Revision 60489
Added by Konstantinos Triantafyllou over 3 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/input/input.component.ts | ||
---|---|---|
96 | 96 |
</mat-chip> |
97 | 97 |
<div class="uk-width-expand uk-position-relative chip-input"> |
98 | 98 |
<input #searchInput class="uk-width-1-1" [formControl]="searchControl" [matAutocomplete]="auto" |
99 |
[matChipInputFor]="chipList" |
|
99 |
[matChipInputFor]="chipList" [matAutocompleteConnectedTo]="origin"
|
|
100 | 100 |
[matChipInputAddOnBlur]="addExtraChips && searchControl.value" |
101 | 101 |
(matChipInputTokenEnd)="add($event)"> |
102 | 102 |
<div *ngIf="placeholder && !searchControl.value" class="placeholder uk-width-1-1" |
103 | 103 |
(click)="searchInput.focus()">{{placeholder}}</div> |
104 | 104 |
</div> |
105 |
<div class="uk-width-1-1 uk-invisible" matAutocompleteOrigin #origin="matAutocompleteOrigin"></div> |
|
105 | 106 |
</mat-chip-list> |
106 | 107 |
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)" [class]="panelClass" [panelWidth]="panelWidth"> |
107 | 108 |
<mat-option *ngFor="let option of filteredOptions | async" [value]="option.value"> |
... | ... | |
149 | 150 |
@Input() smallChip: boolean = false; |
150 | 151 |
@Input() panelWidth: number = 300; |
151 | 152 |
@Input() panelClass: string = null; |
153 |
@Input() showOptionsOnEmpty: boolean = true; |
|
152 | 154 |
@Output() focusEmitter: EventEmitter<boolean> = new EventEmitter<boolean>(); |
153 | 155 |
/** Internal basic information */ |
154 | 156 |
public required: boolean = false; |
... | ... | |
250 | 252 |
|
251 | 253 |
private filter(value: string): Option[] { |
252 | 254 |
let options = this.options.filter(option => !this.formAsArray.value.find(value => option.value === value)); |
253 |
if (!value || value.length == 0) {
|
|
255 |
if ((!value || value.length == 0) && !this.showOptionsOnEmpty) {
|
|
254 | 256 |
return []; |
255 | 257 |
} |
256 | 258 |
const filterValue = value.toString().toLowerCase(); |
Also available in: Unified diff
[Library | Trunk]: Input component: Dropdown under search input for chips.