styling fixes on single and multiple autocomplete
This commit is contained in:
parent
c02bfe668d
commit
baa49851b4
|
@ -25,7 +25,7 @@
|
||||||
<div (mouseover)="isMouseOverPanel=true" (mouseout)="isMouseOverPanel=false">
|
<div (mouseover)="isMouseOverPanel=true" (mouseout)="isMouseOverPanel=false">
|
||||||
<span *ngIf="_groupedItems">
|
<span *ngIf="_groupedItems">
|
||||||
<mat-optgroup *ngFor="let group of _groupedItems | async" [label]="group.title">
|
<mat-optgroup *ngFor="let group of _groupedItems | async" [label]="group.title">
|
||||||
<mat-option *ngFor="let item of group.items" [value]="item" class="option" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item) && !_optionComponent(item)" (optionActivated)="clickedOnPanel()">
|
<mat-option *ngFor="let item of group.items" [value]="item" class="option autocomplete-option" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item) && !_optionComponent(item)" (optionActivated)="clickedOnPanel()">
|
||||||
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
||||||
<ng-container *ngIf="_optionComponent(item)">
|
<ng-container *ngIf="_optionComponent(item)">
|
||||||
<ng-container *ngComponentOutlet="_optionComponent(item); inputs: { item };" />
|
<ng-container *ngComponentOutlet="_optionComponent(item); inputs: { item };" />
|
||||||
|
@ -33,20 +33,24 @@
|
||||||
<ng-template #cellTemplate *ngIf="_optionTemplate(item) && !_optionComponent(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
<ng-template #cellTemplate *ngIf="_optionTemplate(item) && !_optionComponent(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
||||||
item: item
|
item: item
|
||||||
}"></ng-template>
|
}"></ng-template>
|
||||||
<div *ngIf="!_optionTemplate(item)" class="d-flex">
|
<div *ngIf="!_optionTemplate(item)" class="row mt-2 mb-2">
|
||||||
<div class="title-subtitle-fn">
|
<div class="col">
|
||||||
<div class="title-fn">
|
<div class="title-subtitle-fn">
|
||||||
<div class="title-fn-inner">
|
<div class="title-fn">
|
||||||
<span *ngIf="!_optionTemplate(item)" class="title-text">{{_titleFn(item)}}</span>
|
<div class="title-fn-inner">
|
||||||
|
<span *ngIf="!_optionTemplate(item)" class="title-text">{{_titleFn(item)}}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div *ngIf="_subtitleFn(item)" class="subtitle-fn">
|
||||||
<div *ngIf="_subtitleFn(item)" class="subtitle-fn">
|
<div class="subtitle-fn-inner">
|
||||||
<div class="subtitle-fn-inner">
|
<small [innerHTML]="_subtitleFn(item)" class="subtitle-text"></small>
|
||||||
<small [innerHTML]="_subtitleFn(item)" class="subtitle-text"></small>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
<div class="col-auto align-self-center">
|
||||||
|
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
|
@ -54,7 +58,7 @@
|
||||||
<span *ngIf="!_groupedItems">
|
<span *ngIf="!_groupedItems">
|
||||||
<div *ngIf="_items | async as autocompleteItems; else loading">
|
<div *ngIf="_items | async as autocompleteItems; else loading">
|
||||||
<ng-container *ngIf="autocompleteItems.length; else noItems">
|
<ng-container *ngIf="autocompleteItems.length; else noItems">
|
||||||
<mat-option *ngFor="let item of autocompleteItems" class="option" [value]="item" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item) && !_optionComponent(item)" (optionActivated)="clickedOnPanel()">
|
<mat-option *ngFor="let item of autocompleteItems" class="option autocomplete-option" [value]="item" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item) && !_optionComponent(item)" (optionActivated)="clickedOnPanel()">
|
||||||
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
||||||
<ng-container *ngIf="_optionComponent(item)">
|
<ng-container *ngIf="_optionComponent(item)">
|
||||||
<ng-container *ngComponentOutlet="_optionComponent(item); inputs: { item };" />
|
<ng-container *ngComponentOutlet="_optionComponent(item); inputs: { item };" />
|
||||||
|
@ -62,11 +66,15 @@
|
||||||
<ng-template #cellTemplate *ngIf="_optionTemplate(item) && !_optionComponent(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
<ng-template #cellTemplate *ngIf="_optionTemplate(item) && !_optionComponent(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
||||||
item: item
|
item: item
|
||||||
}"></ng-template>
|
}"></ng-template>
|
||||||
<div *ngIf="!_optionTemplate(item) && !_optionComponent(item)">
|
<div *ngIf="!_optionTemplate(item) && !_optionComponent(item)" class="row mt-2 mb-2">
|
||||||
<span class="title-text">{{_titleFn(item)}}</span>
|
<div class="col">
|
||||||
<br *ngIf="_subtitleFn(item)">
|
<span class="title-text">{{_titleFn(item)}}</span>
|
||||||
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
<br *ngIf="_subtitleFn(item)">
|
||||||
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto align-self-center">
|
||||||
|
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -79,6 +79,11 @@
|
||||||
line-clamp: 1;
|
line-clamp: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .autocomplete-option > .mdc-list-item__primary-text {
|
||||||
|
margin: 0 !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.option {
|
.option {
|
||||||
line-height: 1rem;
|
line-height: 1rem;
|
||||||
// height: 3em;
|
// height: 3em;
|
||||||
|
|
|
@ -7,16 +7,20 @@
|
||||||
<div (mouseover)="isMouseOverPanel=true" (mouseout)="isMouseOverPanel=false">
|
<div (mouseover)="isMouseOverPanel=true" (mouseout)="isMouseOverPanel=false">
|
||||||
<span *ngIf="_groupedItems">
|
<span *ngIf="_groupedItems">
|
||||||
<mat-optgroup *ngFor="let group of _groupedItems | async" [label]="group.title">
|
<mat-optgroup *ngFor="let group of _groupedItems | async" [label]="group.title">
|
||||||
<mat-option *ngFor="let item of group.items" [value]="item" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item)">
|
<mat-option *ngFor="let item of group.items" [value]="item" class="autocomplete-option" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item)">
|
||||||
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
||||||
<ng-template #cellTemplate *ngIf="_optionTemplate(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
<ng-template #cellTemplate *ngIf="_optionTemplate(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
||||||
item: item
|
item: item
|
||||||
}"></ng-template>
|
}"></ng-template>
|
||||||
<div *ngIf="!_optionTemplate(item)">
|
<div *ngIf="!_optionTemplate(item)" class="row mt-2 mb-2">
|
||||||
<span class="title-text">{{_titleFn(item)}}</span>
|
<div class="col">
|
||||||
<br *ngIf="_subtitleFn(item)">
|
<span class="title-text">{{_titleFn(item)}}</span>
|
||||||
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
<br *ngIf="_subtitleFn(item)">
|
||||||
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
|
@ -24,16 +28,20 @@
|
||||||
<span *ngIf="!_groupedItems">
|
<span *ngIf="!_groupedItems">
|
||||||
<div *ngIf="_items | async as autocompleteItems; else loading">
|
<div *ngIf="_items | async as autocompleteItems; else loading">
|
||||||
<ng-container *ngIf="autocompleteItems.length; else noItems">
|
<ng-container *ngIf="autocompleteItems.length; else noItems">
|
||||||
<mat-option *ngFor="let item of autocompleteItems" [value]="item" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item)">
|
<mat-option *ngFor="let item of autocompleteItems" [value]="item" class="autocomplete-option" [class.two-line-mat-option]="_subtitleFn(item) && !_optionTemplate(item)">
|
||||||
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
<!-- <img style="vertical-align:middle;" aria-hidden src="{{state.flag}}" height="25" /> -->
|
||||||
<ng-template #cellTemplate *ngIf="_optionTemplate(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
<ng-template #cellTemplate *ngIf="_optionTemplate(item)" [ngTemplateOutlet]="_optionTemplate(item)" [ngTemplateOutletContext]="{
|
||||||
item: item
|
item: item
|
||||||
}"></ng-template>
|
}"></ng-template>
|
||||||
<div *ngIf="!_optionTemplate(item)">
|
<div *ngIf="!_optionTemplate(item)" class="row mt-2 mb-2">
|
||||||
<span *ngIf="!_optionTemplate(item)" class="title-text">{{_titleFn(item)}}</span>
|
<div class="col">
|
||||||
<br *ngIf="_subtitleFn(item)">
|
<span *ngIf="!_optionTemplate(item)" class="title-text">{{_titleFn(item)}}</span>
|
||||||
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
<br *ngIf="_subtitleFn(item)">
|
||||||
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
<small *ngIf="_subtitleFn(item)" class="subtitle-text">{{_subtitleFn(item)}}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto align-self-center">
|
||||||
|
<span *ngIf="popupItemActionIcon" class="option-icon" (click)="_optionActionClick(item, $event)"><mat-icon>{{popupItemActionIcon}}</mat-icon></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .autocomplete-option > .mdc-list-item__primary-text {
|
||||||
|
margin: 0 !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.option-icon {
|
.option-icon {
|
||||||
mat-icon {
|
mat-icon {
|
||||||
margin: 0px 5px 0px 10px;
|
margin: 0px 5px 0px 10px;
|
||||||
|
|
Loading…
Reference in New Issue