Merge pull request #13022 from vvlladd28/bug/lwm2m/list-model/close-autocomplete
Fixed autocomplete not closing in LWM2M list model
This commit is contained in:
commit
e17013ffd4
@ -48,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ng-template #searchNotEmpty>
|
<ng-template #searchNotEmpty>
|
||||||
<span>
|
<span>
|
||||||
{{ 'device-profile.lwm2m.no-objects-matching' | translate:{object: truncate.transform(searchText, true, 6, '...')} }}
|
{{ 'device-profile.lwm2m.no-objects-matching' | translate:{object: (searchText | truncate: true: 6: '...')} }}
|
||||||
</span>
|
</span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
|||||||
@ -33,8 +33,8 @@ import { DeviceProfileService } from '@core/http/device-profile.service';
|
|||||||
import { Direction } from '@shared/models/page/sort-order';
|
import { Direction } from '@shared/models/page/sort-order';
|
||||||
import { isDefined, isDefinedAndNotNull, isObject, isString } from '@core/utils';
|
import { isDefined, isDefinedAndNotNull, isObject, isString } from '@core/utils';
|
||||||
import { PageLink } from '@shared/models/page/page-link';
|
import { PageLink } from '@shared/models/page/page-link';
|
||||||
import { TruncatePipe } from '@shared/pipe/truncate.pipe';
|
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-profile-lwm2m-object-list',
|
selector: 'tb-profile-lwm2m-object-list',
|
||||||
@ -79,13 +79,12 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
|
|||||||
@Output()
|
@Output()
|
||||||
removeList = new EventEmitter<any>();
|
removeList = new EventEmitter<any>();
|
||||||
|
|
||||||
@ViewChild('objectInput') objectInput: ElementRef<HTMLInputElement>;
|
@ViewChild('objectInput', {static: true}) objectInput: ElementRef<HTMLInputElement>;
|
||||||
|
@ViewChild('objectInput', {static: true, read: MatAutocompleteTrigger}) matAutocompleteTrigger: MatAutocompleteTrigger;
|
||||||
|
|
||||||
private propagateChange = (v: any) => {
|
private propagateChange: (value: any) => void = () => {};
|
||||||
}
|
|
||||||
|
|
||||||
constructor(public truncate: TruncatePipe,
|
constructor(private deviceProfileService: DeviceProfileService,
|
||||||
private deviceProfileService: DeviceProfileService,
|
|
||||||
private fb: UntypedFormBuilder) {
|
private fb: UntypedFormBuilder) {
|
||||||
this.lwm2mListFormGroup = this.fb.group({
|
this.lwm2mListFormGroup = this.fb.group({
|
||||||
objectsList: [this.objectsList],
|
objectsList: [this.objectsList],
|
||||||
@ -113,7 +112,7 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
|
|||||||
this.propagateChange = fn;
|
this.propagateChange = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerOnTouched(fn: any): void {
|
registerOnTouched(_fn: any): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -140,6 +139,9 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
|
|||||||
if (isDefined(this.objectInput)) {
|
if (isDefined(this.objectInput)) {
|
||||||
this.clear('', false);
|
this.clear('', false);
|
||||||
}
|
}
|
||||||
|
if (this.matAutocompleteTrigger.panelOpen) {
|
||||||
|
this.matAutocompleteTrigger.closePanel();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.lwm2mListFormGroup.enable({emitEvent: false});
|
this.lwm2mListFormGroup.enable({emitEvent: false});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user