Merge pull request #5690 from tsiegleauq/search-value-single-val
Fix non-multipl os-search-val-selector
This commit is contained in:
commit
34070843c2
@ -6,7 +6,7 @@
|
||||
(openedChange)="openSelect($event)"
|
||||
>
|
||||
<!-- Custom display of selected items -->
|
||||
<mat-select-trigger>
|
||||
<mat-select-trigger *ngIf="multiple">
|
||||
<ng-container *ngIf="selectedItems?.length">
|
||||
<span *ngFor="let item of selectedItems; let i = index">
|
||||
{{ item.getTitle() | translate }}<span *ngIf="i < selectedItems.length - 1">, </span>
|
||||
|
@ -124,9 +124,12 @@ export class SearchValueSelectorComponent extends BaseFormControlComponentDirect
|
||||
}
|
||||
|
||||
public get selectedItems(): Selectable[] {
|
||||
return this.selectableItems && this.contentForm.value
|
||||
? this.selectableItems.filter(item => this.contentForm.value.includes(item.id))
|
||||
: [];
|
||||
if (this.multiple && this.selectableItems?.length && this.contentForm.value) {
|
||||
return this.selectableItems.filter(item => {
|
||||
return this.contentForm.value.includes(item.id);
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public controlType = 'search-value-selector';
|
||||
@ -197,7 +200,7 @@ export class SearchValueSelectorComponent extends BaseFormControlComponentDirect
|
||||
}
|
||||
|
||||
public onSelectionChange(change: MatOptionSelectionChange): void {
|
||||
if (change.isUserInput) {
|
||||
if (this.multiple && change.isUserInput) {
|
||||
const value = change.source.value;
|
||||
this.addRemoveId(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user