Merge pull request #5773 from tsiegleauq/mat-chips-in-search-val
Overwork chip list in search value selector
This commit is contained in:
commit
1ebad842de
@ -17,22 +17,24 @@
|
|||||||
<mat-option>
|
<mat-option>
|
||||||
<ngx-mat-select-search [formControl]="searchValue"></ngx-mat-select-search>
|
<ngx-mat-select-search [formControl]="searchValue"></ngx-mat-select-search>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
<ng-container *ngIf="multiple && showChips">
|
<ng-container>
|
||||||
<div #chipPlaceholder>
|
<div *ngIf="multiple && showChips" class="h-scroller">
|
||||||
<div class="os-search-value-selector-chip-container" [style.width]="width">
|
<div class="os-search-value-selector-chip-container">
|
||||||
<mat-chip-list class="chip-list" [selectable]="false">
|
<mat-chip-list [selectable]="false">
|
||||||
<mat-chip
|
<mat-chip
|
||||||
*ngFor="let item of selectedItems"
|
*ngFor="let item of selectedItems"
|
||||||
[removable]="true"
|
[removable]="true"
|
||||||
(removed)="removeChipItem(item)"
|
(removed)="removeChipItem(item)"
|
||||||
[disableRipple]="true"
|
[disableRipple]="true"
|
||||||
|
matTooltip="{{ item.getTitle() | translate }}"
|
||||||
>
|
>
|
||||||
{{ item.getTitle() | translate }}
|
<span class="ellipsis-overflow">
|
||||||
|
{{ item.getTitle() | translate }}
|
||||||
|
</span>
|
||||||
<mat-icon matChipRemove>cancel</mat-icon>
|
<mat-icon matChipRemove>cancel</mat-icon>
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
</mat-chip-list>
|
</mat-chip-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="os-search-value-selector-chip-placeholder"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="showNotFoundButton && !getFilteredItems().length">
|
<ng-container *ngIf="showNotFoundButton && !getFilteredItems().length">
|
||||||
|
@ -3,21 +3,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.os-search-value-selector-chip-container {
|
.os-search-value-selector-chip-container {
|
||||||
position: absolute;
|
margin: 5px;
|
||||||
padding: 8px;
|
width: max-content;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
height: 30px;
|
||||||
top: 52px;
|
|
||||||
width: 100%;
|
.mat-chip {
|
||||||
background: white;
|
max-width: 150px;
|
||||||
z-index: 100;
|
}
|
||||||
min-height: 41px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.os-search-value-selector-chip-placeholder {
|
.h-scroller {
|
||||||
padding: 8px;
|
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
width: 100%;
|
|
||||||
background: white;
|
|
||||||
min-height: 39px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.os-not-found-button {
|
.os-not-found-button {
|
||||||
|
@ -55,9 +55,6 @@ import { Selectable } from '../selectable';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class SearchValueSelectorComponent extends BaseFormControlComponentDirective<Selectable[]> {
|
export class SearchValueSelectorComponent extends BaseFormControlComponentDirective<Selectable[]> {
|
||||||
@ViewChild('chipPlaceholder', { static: false })
|
|
||||||
public chipPlaceholder: ElementRef<HTMLElement>;
|
|
||||||
|
|
||||||
@ViewChild(CdkVirtualScrollViewport, { static: true })
|
@ViewChild(CdkVirtualScrollViewport, { static: true })
|
||||||
public cdkVirtualScrollViewPort: CdkVirtualScrollViewport;
|
public cdkVirtualScrollViewPort: CdkVirtualScrollViewport;
|
||||||
|
|
||||||
@ -134,10 +131,6 @@ export class SearchValueSelectorComponent extends BaseFormControlComponentDirect
|
|||||||
|
|
||||||
public controlType = 'search-value-selector';
|
public controlType = 'search-value-selector';
|
||||||
|
|
||||||
public get width(): string {
|
|
||||||
return this.chipPlaceholder ? `${this.chipPlaceholder.nativeElement.clientWidth - 16}px` : '100%';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All items
|
* All items
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user