minor ui fixes

This commit is contained in:
Diamantis Tziotzios 2024-04-10 11:03:53 +03:00
parent 6068878cd4
commit 8c24740382
2 changed files with 56 additions and 51 deletions

View File

@ -181,6 +181,9 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
}
stringify(value: any): string {
if (typeof value === 'string' || value instanceof String)
return value as string;
else
return JSON.stringify(value);
}
@ -204,7 +207,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
const newValue = this._valueToAssign(item);
//Update selected items
this._selectedItems.set(JSON.stringify(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(newValue) : newValue), item);
this._selectedItems.set(this.stringify(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(newValue) : newValue), item);
this._setValue(newValue);
@ -244,7 +247,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
public onBlur($event: MouseEvent) {
if (this.value != null) {
const inputLabel = this.inputValue;
const selectedLabel = this._displayFn(this._selectedItems.get(this.selectedItemKey(this.value)));
const selectedLabel = this._displayFn(this._selectedItems.get(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(this.value) : this.value));
if (inputLabel && selectedLabel !== inputLabel) {
this.inputValue = selectedLabel;
}
@ -344,7 +347,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
}
private selectedItemKey(item: any) {
return JSON.stringify(
return this.stringify(
this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(item) :
this.configuration.valueAssign != null ? this.configuration.valueAssign(item) : item
)

View File

@ -313,7 +313,8 @@
</div>
<!-- Static Items -->
<div class="row" *ngIf="formGroup.get('type').value == externalFetcherSourceType.STATIC">
<div class="col-12" *ngIf="formGroup.get('type').value == externalFetcherSourceType.STATIC">
<div class="row">
<h3 class="col-12">{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.STATIC-ITEMS' | translate}}</h3>
<div class="col-12">
<div *ngFor="let staticItem of formGroup.get('items').controls; let staticIndex=index;" class="row mb-3">
@ -369,5 +370,6 @@
<mat-error *ngIf="formGroup.get('items').dirty && formGroup.get('items').hasError('required')">{{'EXTERNAL-FETCHER-SOURCE-EDITOR.STATIC-ITEMS-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="formGroup.get('items').hasError('backendError')">{{formGroup.get('items').getError('backendError').message}}</mat-error>
</div>
</div>
</div>