Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic design for ok and cancel buttons #442

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 22 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
</span>
<span *ngIf="isActive" class="c-angle-up">
<c-icon [name]="'angle-up'"></c-icon>

</span>
</span>
</div>
</div>
<div #dropdownList class="dropdown-list"
Expand Down Expand Up @@ -118,7 +117,7 @@
class="pure-checkbox" [ngClass]="{'selected-item': isSelected(item) == true }">
<input *ngIf="settings.showCheckbox" type="checkbox" [checked]="isSelected(item)" [disabled]="settings.limitSelection == selectedItems?.length && !isSelected(item)"
/>
<label>{{item.id}} {{item[settings.labelKey]}}</label>
<label>{{item[settings.labelKey]}}</label>
</li>
</ul>
</virtual-scroll>
Expand Down Expand Up @@ -226,6 +225,10 @@
</ul>
</div>
<h5 class="list-message" *ngIf="data?.length == 0">{{settings.noDataLabel}}</h5>
<div class="actions">
<button (click)="confirmSelection()">OK</button>
<button (click)="cancelSelection()">Cancel</button>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ virtual-scroll {
margin: 0px;
width: calc(100% - 20px);
.c-token{
list-style: none;
list-style: none;
padding: 2px 8px;
/*background: $base-color; */
/*color: $token-color;*/
Expand Down Expand Up @@ -128,8 +128,8 @@ virtual-scroll {
}
}
.arrow-up, .arrow-down {
width: 0;
height: 0;
width: 0;
height: 0;
border-left: 13px solid transparent;
border-right: 13px solid transparent;
border-bottom: 15px solid #fff;
Expand All @@ -156,6 +156,19 @@ virtual-scroll {
background: #fff;
margin: 0px;
/*box-shadow: 0px 1px 5px $box-shadow-color;*/
.actions{
display: flex;
button{
width: 100%;
background-color: #fff;
border: 0.5px solid rgb(214, 214, 214);
padding: 8px 0px;
cursor: pointer;
&:focus{
outline: none;
}
}
}
}
.select-all{
padding: 10px;
Expand Down Expand Up @@ -346,5 +359,5 @@ virtual-scroll {
padding: 0px 5px 10px;
}
.btn-iceblue {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChang
});
setTimeout(() => {
this.calculateDropdownDirection();
});
});

}
ngOnChanges(changes: SimpleChanges) {
Expand Down Expand Up @@ -353,7 +353,7 @@ export class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChang
setTimeout(() => {
this.calculateDropdownDirection();
}, 0);

evt.preventDefault();
}
public openDropdown() {
Expand Down Expand Up @@ -688,7 +688,7 @@ export class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChang
const dropdownHeight = this.dropdownListElem.nativeElement.clientHeight;
const viewportHeight = document.documentElement.clientHeight;
const selectedListBounds = this.selectedListElem.nativeElement.getBoundingClientRect();

const spaceOnTop: number = selectedListBounds.top;
const spaceOnBottom: number = viewportHeight - selectedListBounds.top;
if (spaceOnBottom < spaceOnTop && dropdownHeight < spaceOnTop){
Expand All @@ -706,17 +706,29 @@ export class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChang
}
} */
}

}
openTowardsTop(value: boolean) {
if (value && this.selectedListElem.nativeElement.clientHeight) {
this.dropdownListYOffset = 15 + this.selectedListElem.nativeElement.clientHeight;
} else {
this.dropdownListYOffset = 0;
}
}
}

//call this when user click ok button
public confirmSelection(){
this.closeDropdown();
}

//call this when user cancel
//deselect selection
public cancelSelection(){
this.closeDropdown();
}
}


@NgModule({
imports: [CommonModule, FormsModule],
declarations: [AngularMultiSelect, ClickOutsideDirective, ScrollDirective, styleDirective, ListFilterPipe, Item, TemplateRenderer, Badge, Search, setPosition, VirtualScrollComponent, CIcon],
Expand Down