@unifylib/ui-lib 1.2.20 → 1.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ import * as i10 from 'ngx-json-viewer';
42
42
  import { NgxJsonViewerModule } from 'ngx-json-viewer';
43
43
  import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input';
44
44
  import { MatAutocompleteTrigger, MatAutocomplete, MatOption as MatOption$1 } from '@angular/material/autocomplete';
45
- import { BehaviorSubject, Subject, of, map, takeUntil } from 'rxjs';
45
+ import { BehaviorSubject, Subject, of, takeUntil, map } from 'rxjs';
46
46
  import * as i1$2 from '@angular/common/http';
47
47
  import { HttpHeaders, HttpParams } from '@angular/common/http';
48
48
  import { distinctUntilChanged, catchError } from 'rxjs/operators';
@@ -1641,6 +1641,9 @@ class AutoCompleteComponent {
1641
1641
  this.question = 'Would you like to add ?"';
1642
1642
  this.cascadedId = 0;
1643
1643
  this.isRequired = false;
1644
+ this.lastOpenLookupRefreshAt = 0;
1645
+ this.openLookupRefreshGuardMs = 150;
1646
+ this.destroy$ = new Subject();
1644
1647
  this.myControl = new FormControl();
1645
1648
  }
1646
1649
  ngOnInit() {
@@ -1666,6 +1669,9 @@ class AutoCompleteComponent {
1666
1669
  this.getLookupData();
1667
1670
  });
1668
1671
  }
1672
+ this.translateService.onLangChange
1673
+ .pipe(takeUntil(this.destroy$))
1674
+ .subscribe(() => this.refreshDisplayedValue());
1669
1675
  }
1670
1676
  extractWorkflowGuidedCascading() {
1671
1677
  if (this.supportingAttributes && this.field.workflowCascadingField && this.supportingAttributes[this.field.workflowCascadingField]) {
@@ -1751,7 +1757,7 @@ class AutoCompleteComponent {
1751
1757
  }
1752
1758
  if (Array.isArray(selected))
1753
1759
  selected = this.defaultValue;
1754
- return this.translateService.getDefaultLang() === 'en'
1760
+ return this.currentLanguage() === 'en'
1755
1761
  ? selected?.englishName
1756
1762
  : selected?.arabicName;
1757
1763
  }
@@ -1761,7 +1767,21 @@ class AutoCompleteComponent {
1761
1767
  };
1762
1768
  }
1763
1769
  itemNameByLag(item) {
1764
- return this.translateService.getDefaultLang() === 'en' ? item.englishName : item.arabicName;
1770
+ return this.currentLanguage() === 'en' ? item.englishName : item.arabicName;
1771
+ }
1772
+ currentLanguage() {
1773
+ return this.translateService.currentLang
1774
+ || this.translateService.defaultLang
1775
+ || this.translateService.getDefaultLang()
1776
+ || 'en';
1777
+ }
1778
+ refreshDisplayedValue() {
1779
+ const selectedValue = this.myControl.value;
1780
+ if (!selectedValue || typeof selectedValue === 'string') {
1781
+ return;
1782
+ }
1783
+ this.myControl.setValue(selectedValue, { emitEvent: false });
1784
+ this.lookupItems$ = of(this.items);
1765
1785
  }
1766
1786
  filterLookupItems(name, trigger) {
1767
1787
  if (this.myControl.enabled) {
@@ -1789,7 +1809,7 @@ class AutoCompleteComponent {
1789
1809
  listItems.columns = ['id', 'code', 'englishName', 'arabicName'];
1790
1810
  this.backendService.getLookupItemsByFilter(listItems, this.cascadedId).subscribe(resp => {
1791
1811
  if (resp.valid) {
1792
- this.items = resp.body.filter((item) => this.myControl.value?.id !== item.id);
1812
+ this.items = this.buildVisibleItems(resp.body ?? [], name);
1793
1813
  if (!this.items?.length) {
1794
1814
  this.field.acceptNewItem ?
1795
1815
  this.items?.push(new LookupItem({ id: -2, englishName: this.question + name, arabicName: this.question + name })) :
@@ -1807,6 +1827,30 @@ class AutoCompleteComponent {
1807
1827
  return;
1808
1828
  }
1809
1829
  }
1830
+ buildVisibleItems(items, searchValue) {
1831
+ const selectedId = this.myControl.value?.id;
1832
+ if (selectedId === undefined || selectedId === null) {
1833
+ return items;
1834
+ }
1835
+ if ((searchValue ?? '') !== '') {
1836
+ return items.filter((item) => item.id !== selectedId);
1837
+ }
1838
+ const selectedIndex = items.findIndex((item) => item.id === selectedId);
1839
+ if (selectedIndex <= 0) {
1840
+ return items;
1841
+ }
1842
+ const selectedItem = items[selectedIndex];
1843
+ return [selectedItem, ...items.filter((_, index) => index !== selectedIndex)];
1844
+ }
1845
+ showNoneOption() {
1846
+ const selectedValue = this.myControl.value;
1847
+ return this.items.length > 1 &&
1848
+ !!this.lookupItems$ &&
1849
+ selectedValue &&
1850
+ typeof selectedValue !== 'string' &&
1851
+ selectedValue.id !== undefined &&
1852
+ selectedValue.id !== null;
1853
+ }
1810
1854
  addLookupFilterByAnotherProperties(listItems) {
1811
1855
  const properties = this.field.lookupFilterList;
1812
1856
  if (!Array.isArray(properties))
@@ -1850,10 +1894,21 @@ class AutoCompleteComponent {
1850
1894
  getId() {
1851
1895
  return this.field.property;
1852
1896
  }
1897
+ openLookupPanel(autocompleteTrigger = this.autocompleteTrigger) {
1898
+ if (!autocompleteTrigger || this.field?.readonly || this.readonly || this.myControl.disabled) {
1899
+ return;
1900
+ }
1901
+ const now = Date.now();
1902
+ if (now - this.lastOpenLookupRefreshAt < this.openLookupRefreshGuardMs) {
1903
+ autocompleteTrigger.openPanel();
1904
+ return;
1905
+ }
1906
+ this.lastOpenLookupRefreshAt = now;
1907
+ this.filterLookupItems('', autocompleteTrigger);
1908
+ }
1853
1909
  onKeydown(event, autocompleteTrigger) {
1854
1910
  if (event.key === 'Enter') {
1855
- this.filterLookupItems('', autocompleteTrigger);
1856
- autocompleteTrigger.openPanel();
1911
+ this.openLookupPanel(autocompleteTrigger);
1857
1912
  event.preventDefault();
1858
1913
  }
1859
1914
  }
@@ -1866,8 +1921,12 @@ class AutoCompleteComponent {
1866
1921
  this.myControl.setValue(null);
1867
1922
  }
1868
1923
  }
1924
+ ngOnDestroy() {
1925
+ this.destroy$.next();
1926
+ this.destroy$.complete();
1927
+ }
1869
1928
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AutoCompleteComponent, deps: [{ token: BackendService }, { token: i2.TranslateService }, { token: 'secretsManager' }], target: i0.ɵɵFactoryTarget.Component }); }
1870
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: AutoCompleteComponent, isStandalone: true, selector: "app-auto-complete", inputs: { field: "field", form: "form", defaultValue: "defaultValue", readonly: "readonly", supportingAttributes: "supportingAttributes" }, outputs: { selectedValue: "selectedValue" }, viewQueries: [{ propertyName: "matACTrigger", first: true, predicate: ["autocompleteTrigger"], descendants: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"field\" class=\"main-auto-complete\">\n <div class=\"mat-field-wrapper\" [formGroup]=\"form\">\n\n <div class=\"label-and-asterisk-container\">\n <span class=\"custom-label\" id=\"label-{{field.property}}\">\n {{ field.label! | translate }}\n </span>\n <span *ngIf=\"field.required\" class=\"required-asterisk\"> * </span>\n <span *ngIf=\"!field.required\" class=\"optional-text\"> {{ 'optional' | translate }} </span>\n </div>\n\n <mat-form-field class=\"autocomplete-field\" appearance=\"outline\">\n <input type=\"text\"\n [placeholder]=\"'search_placeholder' | translate\"\n [id]=\"getId()\"\n [formControl]=\"myControl\"\n (keydown)=\"onKeydown($event, autocompleteTrigger)\"\n [matAutocomplete]=\"auto\"\n (click)=\"autocompleteTrigger.openPanel(); filterLookupItems('', autocompleteTrigger); $event.stopPropagation()\"\n matInput\n [required]=\"isRequired\"\n [attr.aria-labelledby]=\"'label-' + field.property\"\n [attr.aria-describedby]=\"matErrorDescribedBy\"\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [readonly]=\"readonly\"\n >\n\n <button mat-button matSuffix\n color=\"primary\"\n class=\"autocomplete-button\"\n (click)=\"autocompleteTrigger.openPanel(); filterLookupItems('', autocompleteTrigger); $event.stopPropagation()\"\n [attr.id]=\"'autocomplete-trigger-' + field.property\">\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-autocomplete #auto=\"matAutocomplete\" autoActiveFirstOption [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"itemSelected($event.option.value)\"\n (closed)=\"closed()\">\n <ng-container *ngIf=\"!field.readonly\">\n <mat-option *ngIf=\"items.length > 1 && lookupItems$\" [value]=\"null\">{{ \"none\" | translate }}</mat-option>\n <mat-option *ngFor=\"let item of lookupItems$ | async\" [value]=\"item\" [ngClass]=\"_allowSelection(item)\">\n {{ itemNameByLag(item) }}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n <ng-content select=\"mat-error\"></ng-content>\n </mat-form-field>\n\n </div>\n</ng-container>\n", styles: [".main-auto-complete,.mat-field-wrapper{display:flex;flex-direction:column;width:100%}.label-and-asterisk-container{display:flex;align-items:center;gap:4px;margin-bottom:4px}.custom-label{font-weight:500}.required-asterisk{color:red}.optional-text{color:#9b9b9b;font-size:14px;font-weight:400}.autocomplete-field{width:100%;display:flex;align-items:center}.autocomplete-button{margin-left:4px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix{height:36px!important}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button.mat-mdc-button{min-height:36px!important;height:36px!important;--mdc-text-button-container-height: 36px;line-height:36px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button .mat-mdc-button-touch-target{height:36px!important}@media (max-width: 600px){.main-auto-complete,.mat-field-wrapper,.autocomplete-field{flex-direction:column;width:100%}.autocomplete-button{margin-left:0;margin-top:4px}}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: MatOption$1, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
1929
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: AutoCompleteComponent, isStandalone: true, selector: "app-auto-complete", inputs: { field: "field", form: "form", defaultValue: "defaultValue", readonly: "readonly", supportingAttributes: "supportingAttributes" }, outputs: { selectedValue: "selectedValue" }, viewQueries: [{ propertyName: "matACTrigger", first: true, predicate: ["autocompleteTrigger"], descendants: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"field\" class=\"main-auto-complete\">\n <div class=\"mat-field-wrapper\" [formGroup]=\"form\">\n\n <div class=\"label-and-asterisk-container\">\n <span class=\"custom-label\" id=\"label-{{field.property}}\">\n {{ field.label! | translate }}\n </span>\n <span *ngIf=\"field.required\" class=\"required-asterisk\"> * </span>\n <span *ngIf=\"!field.required\" class=\"optional-text\"> {{ 'optional' | translate }} </span>\n </div>\n\n <mat-form-field class=\"autocomplete-field\" appearance=\"outline\" (click)=\"openLookupPanel(); $event.stopPropagation()\">\n <input type=\"text\"\n [placeholder]=\"'search_placeholder' | translate\"\n [id]=\"getId()\"\n [formControl]=\"myControl\"\n (keydown)=\"onKeydown($event, autocompleteTrigger)\"\n [matAutocomplete]=\"auto\"\n (focus)=\"openLookupPanel(autocompleteTrigger)\"\n (click)=\"openLookupPanel(autocompleteTrigger); $event.stopPropagation()\"\n matInput\n [required]=\"isRequired\"\n [attr.aria-labelledby]=\"'label-' + field.property\"\n [attr.aria-describedby]=\"matErrorDescribedBy\"\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [readonly]=\"readonly\"\n >\n\n <button mat-button matSuffix\n color=\"primary\"\n class=\"autocomplete-button\"\n (click)=\"openLookupPanel(autocompleteTrigger); $event.stopPropagation()\"\n [attr.id]=\"'autocomplete-trigger-' + field.property\">\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-autocomplete #auto=\"matAutocomplete\" autoActiveFirstOption [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"itemSelected($event.option.value)\"\n (closed)=\"closed()\">\n <ng-container *ngIf=\"!field.readonly\">\n <mat-option *ngFor=\"let item of lookupItems$ | async\" [value]=\"item\" [ngClass]=\"_allowSelection(item)\">\n {{ itemNameByLag(item) }}\n </mat-option>\n <mat-option *ngIf=\"showNoneOption()\" [value]=\"null\">{{ \"none\" | translate }}</mat-option>\n </ng-container>\n </mat-autocomplete>\n <ng-content select=\"mat-error\"></ng-content>\n </mat-form-field>\n\n </div>\n</ng-container>\n", styles: [".main-auto-complete,.mat-field-wrapper{display:flex;flex-direction:column;width:100%}.label-and-asterisk-container{display:flex;align-items:center;gap:4px;margin-bottom:4px}.custom-label{font-weight:500}.required-asterisk{color:red}.optional-text{color:#9b9b9b;font-size:14px;font-weight:400}.autocomplete-field{width:100%;display:flex;align-items:center}.autocomplete-button{margin-left:4px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix{height:36px!important}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button.mat-mdc-button{min-height:36px!important;height:36px!important;--mdc-text-button-container-height: 36px;line-height:36px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button .mat-mdc-button-touch-target{height:36px!important}@media (max-width: 600px){.main-auto-complete,.mat-field-wrapper,.autocomplete-field{flex-direction:column;width:100%}.autocomplete-button{margin-left:0;margin-top:4px}}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: MatOption$1, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
1871
1930
  }
1872
1931
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AutoCompleteComponent, decorators: [{
1873
1932
  type: Component,
@@ -1886,7 +1945,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
1886
1945
  NgForOf,
1887
1946
  MatIconButton,
1888
1947
  MatButton,
1889
- ], template: "<ng-container *ngIf=\"field\" class=\"main-auto-complete\">\n <div class=\"mat-field-wrapper\" [formGroup]=\"form\">\n\n <div class=\"label-and-asterisk-container\">\n <span class=\"custom-label\" id=\"label-{{field.property}}\">\n {{ field.label! | translate }}\n </span>\n <span *ngIf=\"field.required\" class=\"required-asterisk\"> * </span>\n <span *ngIf=\"!field.required\" class=\"optional-text\"> {{ 'optional' | translate }} </span>\n </div>\n\n <mat-form-field class=\"autocomplete-field\" appearance=\"outline\">\n <input type=\"text\"\n [placeholder]=\"'search_placeholder' | translate\"\n [id]=\"getId()\"\n [formControl]=\"myControl\"\n (keydown)=\"onKeydown($event, autocompleteTrigger)\"\n [matAutocomplete]=\"auto\"\n (click)=\"autocompleteTrigger.openPanel(); filterLookupItems('', autocompleteTrigger); $event.stopPropagation()\"\n matInput\n [required]=\"isRequired\"\n [attr.aria-labelledby]=\"'label-' + field.property\"\n [attr.aria-describedby]=\"matErrorDescribedBy\"\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [readonly]=\"readonly\"\n >\n\n <button mat-button matSuffix\n color=\"primary\"\n class=\"autocomplete-button\"\n (click)=\"autocompleteTrigger.openPanel(); filterLookupItems('', autocompleteTrigger); $event.stopPropagation()\"\n [attr.id]=\"'autocomplete-trigger-' + field.property\">\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-autocomplete #auto=\"matAutocomplete\" autoActiveFirstOption [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"itemSelected($event.option.value)\"\n (closed)=\"closed()\">\n <ng-container *ngIf=\"!field.readonly\">\n <mat-option *ngIf=\"items.length > 1 && lookupItems$\" [value]=\"null\">{{ \"none\" | translate }}</mat-option>\n <mat-option *ngFor=\"let item of lookupItems$ | async\" [value]=\"item\" [ngClass]=\"_allowSelection(item)\">\n {{ itemNameByLag(item) }}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n <ng-content select=\"mat-error\"></ng-content>\n </mat-form-field>\n\n </div>\n</ng-container>\n", styles: [".main-auto-complete,.mat-field-wrapper{display:flex;flex-direction:column;width:100%}.label-and-asterisk-container{display:flex;align-items:center;gap:4px;margin-bottom:4px}.custom-label{font-weight:500}.required-asterisk{color:red}.optional-text{color:#9b9b9b;font-size:14px;font-weight:400}.autocomplete-field{width:100%;display:flex;align-items:center}.autocomplete-button{margin-left:4px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix{height:36px!important}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button.mat-mdc-button{min-height:36px!important;height:36px!important;--mdc-text-button-container-height: 36px;line-height:36px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button .mat-mdc-button-touch-target{height:36px!important}@media (max-width: 600px){.main-auto-complete,.mat-field-wrapper,.autocomplete-field{flex-direction:column;width:100%}.autocomplete-button{margin-left:0;margin-top:4px}}\n"] }]
1948
+ ], template: "<ng-container *ngIf=\"field\" class=\"main-auto-complete\">\n <div class=\"mat-field-wrapper\" [formGroup]=\"form\">\n\n <div class=\"label-and-asterisk-container\">\n <span class=\"custom-label\" id=\"label-{{field.property}}\">\n {{ field.label! | translate }}\n </span>\n <span *ngIf=\"field.required\" class=\"required-asterisk\"> * </span>\n <span *ngIf=\"!field.required\" class=\"optional-text\"> {{ 'optional' | translate }} </span>\n </div>\n\n <mat-form-field class=\"autocomplete-field\" appearance=\"outline\" (click)=\"openLookupPanel(); $event.stopPropagation()\">\n <input type=\"text\"\n [placeholder]=\"'search_placeholder' | translate\"\n [id]=\"getId()\"\n [formControl]=\"myControl\"\n (keydown)=\"onKeydown($event, autocompleteTrigger)\"\n [matAutocomplete]=\"auto\"\n (focus)=\"openLookupPanel(autocompleteTrigger)\"\n (click)=\"openLookupPanel(autocompleteTrigger); $event.stopPropagation()\"\n matInput\n [required]=\"isRequired\"\n [attr.aria-labelledby]=\"'label-' + field.property\"\n [attr.aria-describedby]=\"matErrorDescribedBy\"\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [readonly]=\"readonly\"\n >\n\n <button mat-button matSuffix\n color=\"primary\"\n class=\"autocomplete-button\"\n (click)=\"openLookupPanel(autocompleteTrigger); $event.stopPropagation()\"\n [attr.id]=\"'autocomplete-trigger-' + field.property\">\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-autocomplete #auto=\"matAutocomplete\" autoActiveFirstOption [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"itemSelected($event.option.value)\"\n (closed)=\"closed()\">\n <ng-container *ngIf=\"!field.readonly\">\n <mat-option *ngFor=\"let item of lookupItems$ | async\" [value]=\"item\" [ngClass]=\"_allowSelection(item)\">\n {{ itemNameByLag(item) }}\n </mat-option>\n <mat-option *ngIf=\"showNoneOption()\" [value]=\"null\">{{ \"none\" | translate }}</mat-option>\n </ng-container>\n </mat-autocomplete>\n <ng-content select=\"mat-error\"></ng-content>\n </mat-form-field>\n\n </div>\n</ng-container>\n", styles: [".main-auto-complete,.mat-field-wrapper{display:flex;flex-direction:column;width:100%}.label-and-asterisk-container{display:flex;align-items:center;gap:4px;margin-bottom:4px}.custom-label{font-weight:500}.required-asterisk{color:red}.optional-text{color:#9b9b9b;font-size:14px;font-weight:400}.autocomplete-field{width:100%;display:flex;align-items:center}.autocomplete-button{margin-left:4px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix{height:36px!important}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button.mat-mdc-button{min-height:36px!important;height:36px!important;--mdc-text-button-container-height: 36px;line-height:36px}:host ::ng-deep .autocomplete-field .mat-mdc-form-field-icon-suffix .autocomplete-button .mat-mdc-button-touch-target{height:36px!important}@media (max-width: 600px){.main-auto-complete,.mat-field-wrapper,.autocomplete-field{flex-direction:column;width:100%}.autocomplete-button{margin-left:0;margin-top:4px}}\n"] }]
1890
1949
  }], ctorParameters: () => [{ type: BackendService }, { type: i2.TranslateService }, { type: undefined, decorators: [{
1891
1950
  type: Inject,
1892
1951
  args: ['secretsManager']
@@ -2730,9 +2789,9 @@ class BaseFormCanvasComponent {
2730
2789
  if (selected.length === 0) {
2731
2790
  return this.translateService.instant(this.pageInfo.labelsSection + "." + field.placeholder);
2732
2791
  }
2733
- if (this.areAllMultiStateOptionsSelected(field, selected)) {
2734
- return this.translateService.instant(this.pageInfo.labelsSection + "." + field.placeholder);
2735
- }
2792
+ // if (this.areAllMultiStateOptionsSelected(field, selected)) {
2793
+ // return this.translateService.instant(this.pageInfo.labelsSection+ "." + field.placeholder);
2794
+ // }
2736
2795
  if (selected.length <= 2) {
2737
2796
  return selected
2738
2797
  .map(c => this.translateService.instant(section ? `${section}.${c}` : c))