File

core/select/select-legacy.component.ts

Implements

OnChanges OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs
HostListeners
Accessors

Inputs

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>

Outputs

onChange
Type : EventEmitter<Item[]>

HostListeners

click
Arguments : '$event'
click(evt)

Methods

applyChanges
applyChanges()
Returns : void
deselectItem
deselectItem(item: Item)
Parameters :
Name Type Optional
item Item No
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 :
Name Type Optional
isOpen boolean No
Returns : void
isSelected
isSelected(item: Item)
Parameters :
Name Type Optional
item Item No
Returns : any
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
onChangeItem
onChangeItem(checked: boolean, item: Item)
Parameters :
Name Type Optional
checked boolean No
item Item No
Returns : void
outterSelected
outterSelected(item: Item)
Parameters :
Name Type Optional
item Item No
Returns : any
preventClick
preventClick(evt)
Decorators :
@HostListener('click', ['$event'])
Parameters :
Name Optional
evt No
Returns : void
selectAll
selectAll(checked: boolean)
Parameters :
Name Type Optional
checked boolean No
Returns : void
updateFiltered
updateFiltered(term: string)
Parameters :
Name Type Optional
term string No
Returns : void

Properties

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 : ''

Accessors

selected
getselected()
setselected(value: Item[] | selectedFunction)
Parameters :
Name Type Optional
value Item[] | selectedFunction No
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>

results matching ""

    No results matching ""