1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix up dynamic generation of switch ui

This commit is contained in:
Nick O'Leary 2019-08-21 12:39:51 +01:00
parent 0d680a58f3
commit 8307f26099
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -251,17 +251,16 @@
var numValueField = null;
var expValueField = null;
var btwnAndLabel = null;
var btwnValueField = null;
var btwnValue2Field = null;
var typeValueField = null;
var finalspan = $('<span/>',{style:"float: right;margin-top: 6px;"}).appendTo(row);
finalspan.append(' &#8594; <span class="node-input-rule-index">'+(i+1)+'</span> ');
var caseSensitive = $('<input/>',{id:"node-input-rule-case-"+i,class:"node-input-rule-case",type:"checkbox",style:"width:auto;vertical-align:top"}).appendTo(row2);
$('<label/>',{for:"node-input-rule-case-"+i,style:"margin-left: 3px;"}).text(caseLabel).appendTo(row2);
selectField.change(function() {
resizeRule(container);
var type = selectField.val();
if (valueField){
valueField.typedInput('hide');
}
@ -274,10 +273,13 @@
if (typeValueField){
typeValueField.typedInput('hide');
}
if (btwnValueField){
btwnValueField.typedInput('hide');
}
if (btwnValue2Field){
btwnValue2Field.typedInput('hide');
}
if ((type === "btwn") || (type === "index")) {
if (!btwnValueField){
btwnValueField = createBtwnValueField();
@ -293,19 +295,16 @@
expValueField = createExpValueField();
}
expValueField.typedInput('show');
} else {
if (type === "istype") {
if (!typeValueField){
typeValueField = createTypeValueField();
}
typeValueField.typedInput('show');
} else if (type === "istype") {
if (!typeValueField){
typeValueField = createTypeValueField();
}
else {
typeValueField.typedInput('show');
} else if (! (type === "true" || type === "false" || type === "null" || type === "nnull" || type === "empty" || type === "nempty" || type === "else" )) {
if (!valueField){
valueField = createValueField();
}
valueField.typedInput('show');
}
}
if (type === "regex") {
row2.show();
@ -321,6 +320,8 @@
row2.hide();
row3.hide();
}
resizeRule(container);
});
selectField.val(rule.t);
if ((rule.t == "btwn") || (rule.t == "index")) {