diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js index 2a6a7af18..3249a5cbb 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js @@ -419,7 +419,8 @@ } nlsd = true; var that = this; - + this.identifier = this.element.attr('id') || "TypedInput-"+Math.floor(Math.random()*100); + if (this.options.debug) { console.log(this.identifier,"Create",{defaultType:this.options.default, value:this.element.val()}) } this.disarmClick = false; this.input = $(''); this.input.insertAfter(this.element); @@ -533,9 +534,9 @@ // explicitly set optionSelectTrigger display to inline-block otherwise jQ sets it to 'inline' this.optionSelectTrigger = $('').appendTo(this.uiSelect); this.optionSelectLabel = $('').prependTo(this.optionSelectTrigger); - RED.popover.tooltip(this.optionSelectLabel,function() { - return that.optionValue; - }); + // RED.popover.tooltip(this.optionSelectLabel,function() { + // return that.optionValue; + // }); this.optionSelectTrigger.on("click", function(event) { event.preventDefault(); event.stopPropagation(); @@ -556,6 +557,7 @@ this.optionExpandButtonIcon = $('').appendTo(this.optionExpandButton); this.type(this.options.default||this.typeList[0].value); + this.typeChanged = !!this.options.default; }catch(err) { console.log(err.stack); } @@ -857,27 +859,38 @@ } return v; } else { + if (this.options.debug) { console.log(this.identifier,"----- SET VALUE ------",value) } var selectedOption = []; + var valueToCheck = value; if (opt.options) { - var checkValues = [value]; + if (opt.hasValue && opt.parse) { + var parts = opt.parse(value); + if (this.options.debug) { console.log(this.identifier,"new parse",parts) } + value = parts.value; + valueToCheck = parts.option || parts.value; + } + + var checkValues = [valueToCheck]; if (opt.multiple) { selectedOption = []; - checkValues = value.split(","); + checkValues = valueToCheck.split(","); } - checkValues.forEach(function(value) { + checkValues.forEach(function(valueToCheck) { for (var i=0;i