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,6 +251,7 @@
var numValueField = null;
var expValueField = null;
var btwnAndLabel = null;
var btwnValueField = null;
var btwnValue2Field = null;
var typeValueField = null;
@ -259,9 +260,7 @@
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,6 +273,9 @@
if (typeValueField){
typeValueField.typedInput('hide');
}
if (btwnValueField){
btwnValueField.typedInput('hide');
}
if (btwnValue2Field){
btwnValue2Field.typedInput('hide');
}
@ -293,20 +295,17 @@
expValueField = createExpValueField();
}
expValueField.typedInput('show');
} else {
if (type === "istype") {
} else if (type === "istype") {
if (!typeValueField){
typeValueField = createTypeValueField();
}
typeValueField.typedInput('show');
}
else {
} 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();
row3.hide();
@ -321,6 +320,8 @@
row2.hide();
row3.hide();
}
resizeRule(container);
});
selectField.val(rule.t);
if ((rule.t == "btwn") || (rule.t == "index")) {