Fixed issue with visible rules when using multiple world list

This commit is contained in:
George Kalampokis 2020-09-22 17:34:12 +03:00
parent 71deb5f473
commit fed426e64b
1 changed files with 18 additions and 6 deletions

View File

@ -96,12 +96,17 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.WordList) {
if (this.form.get('data').value.multiList) {
const originalValue = <string>this.form.get('value').value;
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ');
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
values = undefined;
values = [originalValue];
if (originalValue !== null && typeof originalValue === 'string') {
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ');
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
values = undefined;
values = [originalValue];
}
this.form.patchValue({ 'value': values });
values.forEach(element => {
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, element);
});
}
this.form.patchValue({ 'value': values });
}
}
@ -233,7 +238,14 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
this.form.get('value').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(item => {
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, item);
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.WordList && this.form.get('data').value.multiList) {
item.forEach(element => {
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, element);
});
} else {
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, item);
}
});
}