From 0e0f5c3e15842ce1d5e4dcb49445024ccb6c81f6 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sat, 8 Feb 2020 23:30:09 -0800 Subject: [PATCH] :zap: Display also properties with value "null" in variable selector --- packages/editor-ui/src/components/ExpressionInput.vue | 9 ++++++--- packages/editor-ui/src/components/VariableSelector.vue | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/ExpressionInput.vue b/packages/editor-ui/src/components/ExpressionInput.vue index 9a0f891389..7ee68be5af 100644 --- a/packages/editor-ui/src/components/ExpressionInput.vue +++ b/packages/editor-ui/src/components/ExpressionInput.vue @@ -258,16 +258,19 @@ export default mixins( } else if (value.charAt(0) === '^') { // Is variable - let displayValue = `{{${value.slice(1)}}}` as string | number | boolean; + let displayValue = `{{${value.slice(1)}}}` as string | number | boolean | null; if (this.resolvedValue) { - displayValue = this.resolveParameterString(displayValue.toString()) as NodeParameterValue; + displayValue = [null, undefined].includes(displayValue as null | undefined) ? '' : displayValue; + displayValue = this.resolveParameterString((displayValue as string).toString()) as NodeParameterValue; } + displayValue = [null, undefined].includes(displayValue as null | undefined) ? '' : displayValue; + editorOperations.push({ attributes: { variable: `{{${value.slice(1)}}}`, }, - insert: displayValue.toString(), + insert: (displayValue as string).toString(), }); } else { // Is text diff --git a/packages/editor-ui/src/components/VariableSelector.vue b/packages/editor-ui/src/components/VariableSelector.vue index 71cfc85ff2..22075d5d0c 100644 --- a/packages/editor-ui/src/components/VariableSelector.vue +++ b/packages/editor-ui/src/components/VariableSelector.vue @@ -168,6 +168,13 @@ export default mixins( const returnData: IVariableSelectorOption[] = []; if (inputData === null) { + returnData.push( + { + name: propertyName, + key: fullpath, + value: '[null]', + } as IVariableSelectorOption, + ); return returnData; } else if (Array.isArray(inputData)) { let newPropertyName = propertyName;