Skip to content
Snippets Groups Projects
select-search.component.html 1.42 KiB
Newer Older
  • Learn to ignore specific revisions
  • <mat-form-field class="input-form" floatLabel="never">
      <mat-select [formControl]="formControlSelect" [placeholder]="placeholderLabel" #test>
        <input *ngIf="datas.length > 5" matInput class="mat-select-search-input mat-select-search-hidden" />
    
        <div *ngIf="datas.length > 5" class="mat-select-search-inner" [ngClass]="{'mat-select-search-inner-multiple': matSelect.multiple}">
          <input matInput id="searchSelectInput" [formControl]="formControlSearch" class="mat-select-search-input" #searchSelectInput (keydown)="_handleKeydown($event)"
            (input)="onInputChange($event.target.value)" (blur)="onBlur($event.target.value)"
            [placeholder]="lang.filterBy" />
          <button mat-button *ngIf="formControlSearch.value" mat-icon-button aria-label="Clear" (click)="_reset(true)"
            class="mat-select-search-clear">
            <mat-icon class="fa fa-times"></mat-icon>
          </button>
        </div>
    
        <div *ngIf="noEntriesFoundLabel && value && _options?.length === 0 && datas.length > 5" class="mat-select-search-no-entries-found">
          {{lang.noResult}}
        </div>
        <mat-option *ngIf="adminMode"></mat-option>
        <mat-option *ngFor="let value of filteredDatas | async" [value]="value.id"
          [title]="value.title !== undefined ? value.title : value.label" [disabled]="value.disabled"
          [class.opt-group]="value.isTitle" [style.color]="value.color" [innerHTML]="value.label">
        </mat-option>
      </mat-select>
    </mat-form-field>