Browse Source

fix selectedOption value

pull/5153/head
ArtemDzhereleiko 5 years ago
parent
commit
26591ffb63
  1. 2
      ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.html
  2. 14
      ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts

2
ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.html

@ -112,7 +112,7 @@
(focus)="key.isFocused = true;" (focus)="key.isFocused = true;"
(blur)="key.isFocused = false; inputChanged(source, key)"> (blur)="key.isFocused = false; inputChanged(source, key)">
<mat-option *ngFor="let option of key.settings.selectOptions" <mat-option *ngFor="let option of key.settings.selectOptions"
[value]="option.value.toLowerCase() !== 'null' ? option.value : null" [value]="option.value"
[disabled]="key.settings.isEditable === 'readonly'"> [disabled]="key.settings.isEditable === 'readonly'">
{{ getCustomTranslationText(option.label ? option.label : option.value) }} {{ getCustomTranslationText(option.label ? option.label : option.value) }}
</mat-option> </mat-option>

14
ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts

@ -59,7 +59,7 @@ interface MultipleInputWidgetSettings {
} }
interface MultipleInputWidgetSelectOption { interface MultipleInputWidgetSelectOption {
value: string; value: string | null;
label: string; label: string;
} }
@ -253,6 +253,14 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
} }
// For backward compatibility // For backward compatibility
if (dataKey.settings.dataKeyValueType === 'select') {
dataKey.settings.selectOptions.forEach((option) => {
if (option.value.toLowerCase() === 'null') {
option.value = null;
}
});
}
source.keys.push(dataKey); source.keys.push(dataKey);
}); });
} else { } else {
@ -452,10 +460,6 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
} }
public getCustomTranslationText(value): string { public getCustomTranslationText(value): string {
if (value.toLowerCase() === 'null') {
return '';
}
return this.utils.customTranslation(value, value); return this.utils.customTranslation(value, value);
} }

Loading…
Cancel
Save