core/select/select-legacy.component.ts
OnChanges
OnInit
selector | c8y-select-legacy |
templateUrl | ./select-legacy.component.html |
Properties |
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
addDropdownContainerToBody |
Type : boolean
|
Default value : false
|
applyLabel |
Type : string
|
Default value : gettext('Apply')
|
disableApplyOnNoSelection |
Type : boolean
|
Default value : false
|
items |
Type : Item[]
|
placeholder |
Type : string
|
Default value : gettext('Select item')
|
selected |
Type : [] | selectedFunction
|
selectedLabel |
Type : string | selectedLabelFunction
|
updateItems |
Type : EventEmitter<boolean>
|
onChange |
Type : EventEmitter<Item[]>
|
click |
Arguments : '$event'
|
click(evt)
|
applyChanges |
applyChanges()
|
Returns :
void
|
deselectItem | ||||||
deselectItem(item: Item)
|
||||||
Parameters :
Returns :
void
|
getSelectAllToggleStatus |
getSelectAllToggleStatus()
|
Returns :
{ label: any; checked: boolean; indeterminate: boolean; }
|
isAllFilteredSelected |
isAllFilteredSelected()
|
Returns :
boolean
|
isAllItemsSelected |
isAllItemsSelected()
|
Returns :
boolean
|
isNoItemSelected |
isNoItemSelected()
|
Returns :
boolean
|
isOpenChange | ||||||
isOpenChange(isOpen: boolean)
|
||||||
Parameters :
Returns :
void
|
isSelected | ||||||
isSelected(item: Item)
|
||||||
Parameters :
Returns :
any
|
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
onChangeItem |
onChangeItem(checked: boolean, item: Item)
|
Returns :
void
|
outterSelected | ||||||
outterSelected(item: Item)
|
||||||
Parameters :
Returns :
any
|
preventClick | ||||
preventClick(evt)
|
||||
Decorators :
@HostListener('click', ['$event'])
|
||||
Parameters :
Returns :
void
|
selectAll | ||||||
selectAll(checked: boolean)
|
||||||
Parameters :
Returns :
void
|
updateFiltered | ||||||
updateFiltered(term: string)
|
||||||
Parameters :
Returns :
void
|
dropdown |
Type : BsDropdownDirective
|
Decorators :
@ViewChild(BsDropdownDirective, {static: false})
|
filteredItems |
Type : Item[]
|
Default value : []
|
isOpen |
Default value : false
|
itemsSelected |
Type : Set<Item>
|
Default value : new Set()
|
labelsForSelectAll |
Type : any
|
Default value : {
all: gettext('All'),
allFiltered: gettext('All filtered'),
none: gettext('Select filter…')
}
|
labelText |
Type : string
|
Default value : ''
|
liChildren |
Decorators :
@ContentChildren(ListItemComponent)
|
searchFilter |
Type : null
|
Default value : null
|
showAllLabel |
Default value : false
|
Readonly sizeToShowFilter |
Type : number
|
Default value : 5
|
textFilter |
Type : string
|
Default value : ''
|
selected | ||||||
getselected()
|
||||||
setselected(value: Item[] | selectedFunction)
|
||||||
Parameters :
Returns :
void
|
<div
class="dropdown fit-w"
container="{{ addDropdownContainerToBody ? 'body' : null }}"
(isOpenChange)="isOpenChange($event)"
dropdown
#dropdown="bs-dropdown"
c8yDropdownDirection
px-event="Select type"
[insideClick]="true"
>
<div class="input-group dropdown-toggle">
<div
class="form-control pointer d-flex inner-scroll"
(click)="dropdown.isOpen = !dropdown.isOpen"
>
<ng-container *ngIf="itemsSelected.size !== items.length; else all">
<em
class="text-muted"
*ngIf="itemsSelected.size === 0"
>
{{ placeholder | translate }}
</em>
<span
class="tag tag--info chip"
*ngFor="let selectedItem of itemsSelected"
>
<button
class="btn btn-xs btn-clean text-10"
title="{{ 'Remove' | translate }}"
type="button"
(click)="deselectItem(selectedItem); $event.stopPropagation()"
>
<i [c8yIcon]="'times'"></i>
</button>
{{ selectedItem.name | nameTransform | translate }}
</span>
</ng-container>
<ng-template #all>
{{ 'All`possible options`' | translate }}
</ng-template>
</div>
<div class="input-group-btn">
<button
class="btn btn-default d-flex a-i-center w-auto"
title="{{ labelText || placeholder | translate }}"
aria-haspopup="true"
dropdownToggle
>
<i class="c8y-glyph-caret icon-16"></i>
</button>
</div>
</div>
<ul
class="dropdown-menu multiselect-container"
*dropdownMenu
>
<ng-content select="c8y-li"></ng-content>
<ng-container *ngIf="liChildren.length === 0">
<li
class="multiselect-item sticky-top"
*ngIf="items.length > sizeToShowFilter"
>
<div class="input-group input-group-search">
<input
class="form-control"
placeholder="{{ 'Filter' | translate }}…"
type="search"
(keyup)="updateFiltered($event.target.value)"
[(ngModel)]="searchFilter"
/>
<span class="input-group-addon">
<i
c8yIcon="search"
*ngIf="!textFilter"
></i>
<i
class="text-muted"
c8yIcon="times"
*ngIf="textFilter"
(click)="textFilter = ''"
></i>
</span>
</div>
</li>
<li class="multiselect-item">
<label
class="c8y-checkbox input-sm"
[title]="getSelectAllToggleStatus().label | translate"
ng-click="vm.toggleSelectAll(); $event.preventDefault()"
>
<input
class="m-t-0"
type="checkbox"
[checked]="getSelectAllToggleStatus().checked"
(change)="selectAll($event.target.checked)"
[indeterminate]="getSelectAllToggleStatus().indeterminate"
/>
<span></span>
<span class="label-text">
{{ getSelectAllToggleStatus().label | translate }}
</span>
</label>
</li>
<li
class="multiselect-item"
*ngFor="let item of filteredItems"
>
<label
class="c8y-checkbox d-flex a-i-center"
[title]="item.name | nameTransform | translate"
>
<input
type="checkbox"
[checked]="isSelected(item)"
(change)="onChangeItem($event.target.checked, item)"
/>
<span></span>
<span class="m-l-8">{{ item.name | nameTransform | translate }}</span>
</label>
</li>
<li class="divider"></li>
<li class="sticky-bottom bg-level-0">
<button
class="btn btn-primary btn-block"
title="{{ applyLabel | translate }}"
[disabled]="disableApplyOnNoSelection && isNoItemSelected()"
(click)="applyChanges()"
>
{{ applyLabel | translate }}
</button>
</li>
</ng-container>
</ul>
</div>