From 1c8d79943a1558117dad6f34832d81a9ead66c5f Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 8 Nov 2021 17:30:01 -0400 Subject: [PATCH 1/2] Fix key/content evaluation --- src/components/FormSelectList.vue | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/FormSelectList.vue b/src/components/FormSelectList.vue index 54f978f2..7cad60c2 100644 --- a/src/components/FormSelectList.vue +++ b/src/components/FormSelectList.vue @@ -164,7 +164,7 @@ * @param {*|*[]} list, array of objects */ transformOptions(list) { - const suffix = this.attributeParent(this.options.value); + const suffix = this.options.key; let resultList = []; list.forEach(item => { @@ -183,11 +183,14 @@ parsedOption[this.optionsKey] = itemValue; parsedOption[this.optionsValue] = itemContent; if (this.options.valueTypeReturned === 'object') { - resultList.push(eval( suffix.length > 0 ? 'item.' + suffix : 'item')); - } - else { - resultList.push(parsedOption); + parsedOption = suffix.length > 0 ? get(item, suffix) : item; + Object.defineProperty(parsedOption, this.optionsValue, { + get: function() { + return itemContent; + } + }); } + resultList.push(parsedOption); }); return resultList }, @@ -199,13 +202,6 @@ return removed ? removed : str; }, - attributeParent(str) { - let parts = str.replace(/{{/g,'') - .replace(/}}/g,'') - .split('.') - parts.pop(); - return parts.join('.'); - }, updateWatcherDependentFieldValue(newSelectOptions, oldSelectOptions) { let dataName = this.options.dataName.split('.'); // Check to see if the watcher output variable has been loaded. From a94e82f53178cb0edfe3b0883e67e5059e2390b0 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 8 Nov 2021 18:40:18 -0400 Subject: [PATCH 2/2] Fix content variable --- src/components/FormSelectList.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/FormSelectList.vue b/src/components/FormSelectList.vue index 7cad60c2..b59df22a 100644 --- a/src/components/FormSelectList.vue +++ b/src/components/FormSelectList.vue @@ -304,11 +304,9 @@ optionsValue() { if (this.options.dataSource && this.options.dataSource === 'provideData') { return 'content'; + } else { + return '__content__'; } - - const fieldName = this.options.value || 'content'; - - return this.stripMustache(fieldName); }, classList() { return {