Fixes width of autocomplete panel.

This commit is contained in:
apapachristou 2019-10-03 16:06:21 +03:00
parent dc7f05ffd2
commit d89beeaf0f
4 changed files with 43 additions and 35 deletions

View File

@ -7,7 +7,7 @@
<input matInput #textInput autocomplete="off" (focus)="_onInputFocus()" [disabled]="disabled" [placeholder]="placeholder" [ngModel]="_inputValue" (ngModelChange)="_inputValueChange($event)" [matAutocomplete]="auto" [matChipInputFor]="chipList" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur" (matChipInputTokenEnd)="_addItem($event)" (click)="_onInputClick($event)" />
</mat-chip-list>
<mat-progress-spinner mode="indeterminate" class="multi-loading-bar col-auto" [class.not-loading]="!loading" [diameter]="22"></mat-progress-spinner>
<mat-autocomplete [panelWidth]="auto" #auto="matAutocomplete" [displayWith]="_displayFn.bind(this)" (optionSelected)="_optionSelected($event)">
<mat-autocomplete [panelWidth]="auto" class="panel-width" #auto="matAutocomplete" [displayWith]="_displayFn.bind(this)" (optionSelected)="_optionSelected($event)">
<span *ngIf="_groupedItems">
<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)">

View File

@ -1,28 +1,32 @@
.multiple-auto-complete {
margin-left: inherit;
margin-right: inherit;
margin-left: inherit;
margin-right: inherit;
.multi-chip-list {
padding-left: 0;
.multi-chip-list {
padding-left: 0;
.chip {
border-radius: 2em !important;
height: auto !important;
min-width: fit-content !important;
}
}
.chip {
border-radius: 2em !important;
height: auto !important;
min-width: fit-content !important;
}
}
.multi-loading-bar {
padding-right: 0;
padding-left: 0;
}
.multi-loading-bar {
padding-right: 0;
padding-left: 0;
}
.not-loading {
display: none;
}
.not-loading {
display: none;
}
}
.two-line-mat-option {
height: 3.5em;
line-height: 1.2em;
height: 3.5em;
line-height: 1.2em;
}
::ng-deep .mat-autocomplete-panel.panel-width {
max-width: 78vw !important;
}

View File

@ -9,7 +9,7 @@
</mat-chip-list>
<mat-progress-spinner class="progress-loader" mode="indeterminate" [class.not-loading]="!loading" [diameter]="17"></mat-progress-spinner>
<mat-autocomplete #auto="matAutocomplete" [displayWith]="autoCompleteDisplayFn()" (optionSelected)="_optionSelected($event)">
<mat-autocomplete [panelWidth]="auto" class="panel-width" #auto="matAutocomplete" [displayWith]="autoCompleteDisplayFn()" (optionSelected)="_optionSelected($event)">
<span *ngIf="_groupedItems">
<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)">

View File

@ -1,22 +1,26 @@
.auto-complete {
margin-left: inherit;
margin-right: inherit;
margin-left: inherit;
margin-right: inherit;
.not-loading {
display: none;
}
.not-loading {
display: none;
}
.chip-list {
width: 100%;
}
.chip-list {
width: 100%;
}
.progress-loader {
position: absolute;
right: 0;
}
.progress-loader {
position: absolute;
right: 0;
}
}
.two-line-mat-option {
height: 3.5em;
line-height: 1.2em;
height: 3.5em;
line-height: 1.2em;
}
::ng-deep .mat-autocomplete-panel.panel-width {
max-width: 78vw !important;
}