mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix Inject/Change node restoring typedInput options
This commit is contained in:
parent
ae12ddd32b
commit
d0ec055222
@ -539,12 +539,10 @@
|
|||||||
var propertyValue = $('<input/>',{class:"node-input-prop-property-value",type:"text"})
|
var propertyValue = $('<input/>',{class:"node-input-prop-property-value",type:"text"})
|
||||||
.css("width","calc(70% - 30px)")
|
.css("width","calc(70% - 30px)")
|
||||||
.appendTo(row)
|
.appendTo(row)
|
||||||
.typedInput({default:'str',types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']});
|
.typedInput({default:prop.vt,types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']});
|
||||||
|
|
||||||
propertyName.typedInput('value',prop.p);
|
propertyName.typedInput('value',prop.p);
|
||||||
|
|
||||||
propertyValue.typedInput('value',prop.v);
|
propertyValue.typedInput('value',prop.v);
|
||||||
propertyValue.typedInput('type',prop.vt);
|
|
||||||
},
|
},
|
||||||
removable: true,
|
removable: true,
|
||||||
sortable: true
|
sortable: true
|
||||||
|
@ -115,10 +115,10 @@
|
|||||||
var regex = this._("change.label.regex");
|
var regex = this._("change.label.regex");
|
||||||
var deepCopyLabel = this._("change.label.deepCopy");
|
var deepCopyLabel = this._("change.label.deepCopy");
|
||||||
|
|
||||||
function createPropertyValue(row2_1,row2_2) {
|
function createPropertyValue(row2_1, row2_2, defaultType) {
|
||||||
var propValInput = $('<input/>',{class:"node-input-rule-property-value",type:"text"})
|
var propValInput = $('<input/>',{class:"node-input-rule-property-value",type:"text"})
|
||||||
.appendTo(row2_1)
|
.appendTo(row2_1)
|
||||||
.typedInput({default:'str',types:['msg','flow','global','str','num','bool','json','bin','date','jsonata','env']});
|
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','num','bool','json','bin','date','jsonata','env']});
|
||||||
|
|
||||||
var dcLabel = $('<label style="padding-left: 130px;"></label>').appendTo(row2_2);
|
var dcLabel = $('<label style="padding-left: 130px;"></label>').appendTo(row2_2);
|
||||||
var deepCopy = $('<input type="checkbox" class="node-input-rule-property-deepCopy" style="width: auto; margin: 0 6px 0 0">').appendTo(dcLabel)
|
var deepCopy = $('<input type="checkbox" class="node-input-rule-property-deepCopy" style="width: auto; margin: 0 6px 0 0">').appendTo(dcLabel)
|
||||||
@ -129,20 +129,20 @@
|
|||||||
})
|
})
|
||||||
return [propValInput, deepCopy];
|
return [propValInput, deepCopy];
|
||||||
}
|
}
|
||||||
function createFromValue(row3_1) {
|
function createFromValue(row3_1, defaultType) {
|
||||||
return $('<input/>',{class:"node-input-rule-property-search-value",type:"text"})
|
return $('<input/>',{class:"node-input-rule-property-search-value",type:"text"})
|
||||||
.appendTo(row3_1)
|
.appendTo(row3_1)
|
||||||
.typedInput({default:'str',types:['msg','flow','global','str','re','num','bool','env']});
|
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','re','num','bool','env']});
|
||||||
}
|
}
|
||||||
function createToValue(row3_2) {
|
function createToValue(row3_2, defaultType) {
|
||||||
return $('<input/>',{class:"node-input-rule-property-replace-value",type:"text"})
|
return $('<input/>',{class:"node-input-rule-property-replace-value",type:"text"})
|
||||||
.appendTo(row3_2)
|
.appendTo(row3_2)
|
||||||
.typedInput({default:'str',types:['msg','flow','global','str','num','bool','json','bin','env']});
|
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','num','bool','json','bin','env']});
|
||||||
}
|
}
|
||||||
function createMoveValue(row4) {
|
function createMoveValue(row4, defaultType) {
|
||||||
return $('<input/>',{class:"node-input-rule-property-move-value",type:"text"})
|
return $('<input/>',{class:"node-input-rule-property-move-value",type:"text"})
|
||||||
.appendTo(row4)
|
.appendTo(row4)
|
||||||
.typedInput({default:'msg',types:['msg','flow','global']});
|
.typedInput({default:defaultType||'msg',types:['msg','flow','global']});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#node-input-rule-container').css('min-height','150px').css('min-width','450px').editableList({
|
$('#node-input-rule-container').css('min-height','150px').css('min-width','450px').editableList({
|
||||||
@ -268,33 +268,22 @@
|
|||||||
propertyName.typedInput('value',rule.p);
|
propertyName.typedInput('value',rule.p);
|
||||||
propertyName.typedInput('type',rule.pt);
|
propertyName.typedInput('type',rule.pt);
|
||||||
if (rule.t == "set") {
|
if (rule.t == "set") {
|
||||||
if(!propertyValue) {
|
var parts = createPropertyValue(row2_1, row2_2, rule.tot);
|
||||||
var parts = createPropertyValue(row2_1, row2_2);
|
|
||||||
propertyValue = parts[0];
|
propertyValue = parts[0];
|
||||||
deepCopy = parts[1];
|
deepCopy = parts[1];
|
||||||
}
|
|
||||||
propertyValue.typedInput('value',rule.to);
|
propertyValue.typedInput('value',rule.to);
|
||||||
propertyValue.typedInput('type',rule.tot);
|
|
||||||
deepCopy.prop("checked", !!rule.dc);
|
deepCopy.prop("checked", !!rule.dc);
|
||||||
}
|
}
|
||||||
if (rule.t == "move") {
|
if (rule.t == "move") {
|
||||||
if(!moveValue) {
|
moveValue = createMoveValue(row4,rule.tot);
|
||||||
moveValue = createMoveValue(row4);
|
|
||||||
}
|
|
||||||
moveValue.typedInput('value',rule.to);
|
moveValue.typedInput('value',rule.to);
|
||||||
moveValue.typedInput('type',rule.tot);
|
|
||||||
}
|
}
|
||||||
if (rule.t == "change") {
|
if (rule.t == "change") {
|
||||||
if(!fromValue) {
|
fromValue = createFromValue(row3_1, rule.fromt);
|
||||||
fromValue = createFromValue(row3_1);
|
|
||||||
}
|
|
||||||
fromValue.typedInput('value',rule.from);
|
fromValue.typedInput('value',rule.from);
|
||||||
fromValue.typedInput('type',rule.fromt);
|
|
||||||
if (!toValue) {
|
toValue = createToValue(row3_2,rule.tot);
|
||||||
toValue = createToValue(row3_2);
|
|
||||||
}
|
|
||||||
toValue.typedInput('value',rule.to);
|
toValue.typedInput('value',rule.to);
|
||||||
toValue.typedInput('type',rule.tot);
|
|
||||||
}
|
}
|
||||||
selectField.change();
|
selectField.change();
|
||||||
container[0].appendChild(fragment);
|
container[0].appendChild(fragment);
|
||||||
|
Loading…
Reference in New Issue
Block a user