@node-red/editor-client 4.0.0-beta.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locales/en-US/editor.json +2 -1
- package/package.json +1 -1
- package/public/red/about +20 -0
- package/public/red/red.js +183 -122
- package/public/red/red.min.js +3 -3
- package/public/red/tours/welcome.js +32 -32
package/package.json
CHANGED
package/public/red/about
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
#### 4.0.0: Milestone Release
|
|
2
|
+
|
|
3
|
+
This marks the next major release of Node-RED. The following changes represent
|
|
4
|
+
those added since the last beta. Check the beta release details below for the complete
|
|
5
|
+
list.
|
|
6
|
+
|
|
7
|
+
Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Node-RED now requires Node 18.x or later. At the time of release, we recommend
|
|
10
|
+
using Node 20.
|
|
11
|
+
|
|
12
|
+
Editor
|
|
13
|
+
|
|
14
|
+
- Add `httpStaticCors` (#4761) @knolleary
|
|
15
|
+
- Update dependencies (#4763) @knolleary
|
|
16
|
+
- Sync master to dev (#4756) @knolleary
|
|
17
|
+
- Add tooltip and message validation to `typedInput` (#4747) @GogoVega
|
|
18
|
+
- Replace bcrypt with @node-rs/bcrypt (#4744) @knolleary
|
|
19
|
+
- Export Nodes dialog refinement (#4746) @Steve-Mcl
|
|
20
|
+
|
|
1
21
|
#### 4.0.0-beta.4: Beta Release
|
|
2
22
|
|
|
3
23
|
Editor
|
package/public/red/red.js
CHANGED
|
@@ -6757,6 +6757,13 @@ RED.nodes = (function() {
|
|
|
6757
6757
|
} else {
|
|
6758
6758
|
delete n.g
|
|
6759
6759
|
}
|
|
6760
|
+
// If importing into a subflow, ensure an outbound-link doesn't get added
|
|
6761
|
+
if (activeSubflow && /^link /.test(n.type) && n.links) {
|
|
6762
|
+
n.links = n.links.filter(function(id) {
|
|
6763
|
+
const otherNode = node_map[id] || RED.nodes.node(id);
|
|
6764
|
+
return (otherNode && otherNode.z === activeWorkspace);
|
|
6765
|
+
});
|
|
6766
|
+
}
|
|
6760
6767
|
for (var d3 in n._def.defaults) {
|
|
6761
6768
|
if (n._def.defaults.hasOwnProperty(d3)) {
|
|
6762
6769
|
if (n._def.defaults[d3].type) {
|
|
@@ -6780,14 +6787,6 @@ RED.nodes = (function() {
|
|
|
6780
6787
|
}
|
|
6781
6788
|
}
|
|
6782
6789
|
}
|
|
6783
|
-
// If importing into a subflow, ensure an outbound-link doesn't
|
|
6784
|
-
// get added
|
|
6785
|
-
if (activeSubflow && /^link /.test(n.type) && n.links) {
|
|
6786
|
-
n.links = n.links.filter(function(id) {
|
|
6787
|
-
const otherNode = node_map[id] || RED.nodes.node(id);
|
|
6788
|
-
return (otherNode && otherNode.z === activeWorkspace)
|
|
6789
|
-
});
|
|
6790
|
-
}
|
|
6791
6790
|
}
|
|
6792
6791
|
for (i=0;i<new_subflows.length;i++) {
|
|
6793
6792
|
n = new_subflows[i];
|
|
@@ -10129,11 +10128,25 @@ RED.utils = (function() {
|
|
|
10129
10128
|
return parts;
|
|
10130
10129
|
}
|
|
10131
10130
|
|
|
10132
|
-
|
|
10131
|
+
/**
|
|
10132
|
+
* Validate a property expression
|
|
10133
|
+
* @param {*} str - the property value
|
|
10134
|
+
* @returns {boolean|string} whether the node proprty is valid. `true`: valid `false|String`: invalid
|
|
10135
|
+
*/
|
|
10136
|
+
function validatePropertyExpression(str, opt) {
|
|
10133
10137
|
try {
|
|
10134
|
-
|
|
10138
|
+
const parts = normalisePropertyExpression(str);
|
|
10135
10139
|
return true;
|
|
10136
10140
|
} catch(err) {
|
|
10141
|
+
// If the validator has opt, it is a 3.x validator that
|
|
10142
|
+
// can return a String to mean 'invalid' and provide a reason
|
|
10143
|
+
if (opt) {
|
|
10144
|
+
if (opt.label) {
|
|
10145
|
+
return opt.label + ': ' + err.message;
|
|
10146
|
+
}
|
|
10147
|
+
return err.message;
|
|
10148
|
+
}
|
|
10149
|
+
// Otherwise, a 2.x returns a false value
|
|
10137
10150
|
return false;
|
|
10138
10151
|
}
|
|
10139
10152
|
}
|
|
@@ -10151,22 +10164,24 @@ RED.utils = (function() {
|
|
|
10151
10164
|
// Allow ${ENV_VAR} value
|
|
10152
10165
|
return true
|
|
10153
10166
|
}
|
|
10154
|
-
let error
|
|
10167
|
+
let error;
|
|
10155
10168
|
if (propertyType === 'json') {
|
|
10156
10169
|
try {
|
|
10157
10170
|
JSON.parse(propertyValue);
|
|
10158
10171
|
} catch(err) {
|
|
10159
10172
|
error = RED._("validator.errors.invalid-json", {
|
|
10160
10173
|
error: err.message
|
|
10161
|
-
})
|
|
10174
|
+
});
|
|
10162
10175
|
}
|
|
10163
10176
|
} else if (propertyType === 'msg' || propertyType === 'flow' || propertyType === 'global' ) {
|
|
10164
|
-
|
|
10165
|
-
|
|
10177
|
+
// To avoid double label
|
|
10178
|
+
const valid = RED.utils.validatePropertyExpression(propertyValue, opt ? {} : null);
|
|
10179
|
+
if (valid !== true) {
|
|
10180
|
+
error = opt ? valid : RED._("validator.errors.invalid-prop");
|
|
10166
10181
|
}
|
|
10167
10182
|
} else if (propertyType === 'num') {
|
|
10168
10183
|
if (!/^NaN$|^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$|^[+-]?(0b|0B)[01]+$|^[+-]?(0o|0O)[0-7]+$|^[+-]?(0x|0X)[0-9a-fA-F]+$/.test(propertyValue)) {
|
|
10169
|
-
error = RED._("validator.errors.invalid-num")
|
|
10184
|
+
error = RED._("validator.errors.invalid-num");
|
|
10170
10185
|
}
|
|
10171
10186
|
} else if (propertyType === 'jsonata') {
|
|
10172
10187
|
try {
|
|
@@ -10174,16 +10189,16 @@ RED.utils = (function() {
|
|
|
10174
10189
|
} catch(err) {
|
|
10175
10190
|
error = RED._("validator.errors.invalid-expr", {
|
|
10176
10191
|
error: err.message
|
|
10177
|
-
})
|
|
10192
|
+
});
|
|
10178
10193
|
}
|
|
10179
10194
|
}
|
|
10180
10195
|
if (error) {
|
|
10181
10196
|
if (opt && opt.label) {
|
|
10182
|
-
return opt.label+': '+error
|
|
10197
|
+
return opt.label + ': ' + error;
|
|
10183
10198
|
}
|
|
10184
|
-
return error
|
|
10199
|
+
return error;
|
|
10185
10200
|
}
|
|
10186
|
-
return true
|
|
10201
|
+
return true;
|
|
10187
10202
|
}
|
|
10188
10203
|
|
|
10189
10204
|
function getMessageProperty(msg,expr) {
|
|
@@ -15231,61 +15246,64 @@ RED.stack = (function() {
|
|
|
15231
15246
|
{ value: "_session", source: ["websocket out","tcp out"] },
|
|
15232
15247
|
]
|
|
15233
15248
|
var allOptions = {
|
|
15234
|
-
msg: {value:"msg",label:"msg.",validate:RED.utils.validatePropertyExpression, autoComplete: msgAutoComplete(msgCompletions)},
|
|
15235
|
-
flow: {value:"flow",label:"flow.",hasValue:true,
|
|
15236
|
-
options:[],
|
|
15237
|
-
validate:RED.utils.validatePropertyExpression,
|
|
15249
|
+
msg: { value: "msg", label: "msg.", validate: RED.utils.validatePropertyExpression, autoComplete: msgAutoComplete(msgCompletions) },
|
|
15250
|
+
flow: { value: "flow", label: "flow.", hasValue: true,
|
|
15251
|
+
options: [],
|
|
15252
|
+
validate: RED.utils.validatePropertyExpression,
|
|
15238
15253
|
parse: contextParse,
|
|
15239
15254
|
export: contextExport,
|
|
15240
15255
|
valueLabel: contextLabel,
|
|
15241
15256
|
autoComplete: contextAutoComplete
|
|
15242
15257
|
},
|
|
15243
|
-
global: {
|
|
15244
|
-
|
|
15245
|
-
|
|
15258
|
+
global: {
|
|
15259
|
+
value: "global", label: "global.", hasValue: true,
|
|
15260
|
+
options: [],
|
|
15261
|
+
validate: RED.utils.validatePropertyExpression,
|
|
15246
15262
|
parse: contextParse,
|
|
15247
15263
|
export: contextExport,
|
|
15248
15264
|
valueLabel: contextLabel,
|
|
15249
15265
|
autoComplete: contextAutoComplete
|
|
15250
15266
|
},
|
|
15251
|
-
str: {value:"str",label:"string",icon:"red/images/typedInput/az.svg"},
|
|
15252
|
-
num: {value:"num",label:"number",icon:"red/images/typedInput/09.svg",validate: function(v) {
|
|
15253
|
-
return
|
|
15267
|
+
str: { value: "str", label: "string", icon: "red/images/typedInput/az.svg" },
|
|
15268
|
+
num: { value: "num", label: "number", icon: "red/images/typedInput/09.svg", validate: function (v, o) {
|
|
15269
|
+
return RED.utils.validateTypedProperty(v, "num", o);
|
|
15254
15270
|
} },
|
|
15255
|
-
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.svg",options:["true","false"]},
|
|
15271
|
+
bool: { value: "bool", label: "boolean", icon: "red/images/typedInput/bool.svg", options: ["true", "false"] },
|
|
15256
15272
|
json: {
|
|
15257
|
-
value:"json",
|
|
15258
|
-
label:"JSON",
|
|
15259
|
-
icon:"red/images/typedInput/json.svg",
|
|
15260
|
-
validate: function(v
|
|
15261
|
-
|
|
15273
|
+
value: "json",
|
|
15274
|
+
label: "JSON",
|
|
15275
|
+
icon: "red/images/typedInput/json.svg",
|
|
15276
|
+
validate: function (v, o) {
|
|
15277
|
+
return RED.utils.validateTypedProperty(v, "json", o);
|
|
15278
|
+
},
|
|
15279
|
+
expand: function () {
|
|
15262
15280
|
var that = this;
|
|
15263
15281
|
var value = this.value();
|
|
15264
15282
|
try {
|
|
15265
|
-
value = JSON.stringify(JSON.parse(value),null,4);
|
|
15266
|
-
} catch(err) {
|
|
15283
|
+
value = JSON.stringify(JSON.parse(value), null, 4);
|
|
15284
|
+
} catch (err) {
|
|
15267
15285
|
}
|
|
15268
15286
|
RED.editor.editJSON({
|
|
15269
15287
|
value: value,
|
|
15270
15288
|
stateId: RED.editor.generateViewStateId("typedInput", that, "json"),
|
|
15271
15289
|
focus: true,
|
|
15272
|
-
complete: function(v) {
|
|
15290
|
+
complete: function (v) {
|
|
15273
15291
|
var value = v;
|
|
15274
15292
|
try {
|
|
15275
15293
|
value = JSON.stringify(JSON.parse(v));
|
|
15276
|
-
} catch(err) {
|
|
15294
|
+
} catch (err) {
|
|
15277
15295
|
}
|
|
15278
15296
|
that.value(value);
|
|
15279
15297
|
}
|
|
15280
15298
|
})
|
|
15281
15299
|
}
|
|
15282
15300
|
},
|
|
15283
|
-
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.svg"},
|
|
15301
|
+
re: { value: "re", label: "regular expression", icon: "red/images/typedInput/re.svg" },
|
|
15284
15302
|
date: {
|
|
15285
|
-
value:"date",
|
|
15286
|
-
label:"timestamp",
|
|
15287
|
-
icon:"fa fa-clock-o",
|
|
15288
|
-
options:[
|
|
15303
|
+
value: "date",
|
|
15304
|
+
label: "timestamp",
|
|
15305
|
+
icon: "fa fa-clock-o",
|
|
15306
|
+
options: [
|
|
15289
15307
|
{
|
|
15290
15308
|
label: 'milliseconds since epoch',
|
|
15291
15309
|
value: ''
|
|
@@ -15304,15 +15322,17 @@ RED.stack = (function() {
|
|
|
15304
15322
|
value: "jsonata",
|
|
15305
15323
|
label: "expression",
|
|
15306
15324
|
icon: "red/images/typedInput/expr.svg",
|
|
15307
|
-
validate: function(v
|
|
15308
|
-
|
|
15325
|
+
validate: function (v, o) {
|
|
15326
|
+
return RED.utils.validateTypedProperty(v, "jsonata", o);
|
|
15327
|
+
},
|
|
15328
|
+
expand: function () {
|
|
15309
15329
|
var that = this;
|
|
15310
15330
|
RED.editor.editExpression({
|
|
15311
|
-
value: this.value().replace(/\t/g,"\n"),
|
|
15331
|
+
value: this.value().replace(/\t/g, "\n"),
|
|
15312
15332
|
stateId: RED.editor.generateViewStateId("typedInput", that, "jsonata"),
|
|
15313
15333
|
focus: true,
|
|
15314
|
-
complete: function(v) {
|
|
15315
|
-
that.value(v.replace(/\n/g,"\t"));
|
|
15334
|
+
complete: function (v) {
|
|
15335
|
+
that.value(v.replace(/\n/g, "\t"));
|
|
15316
15336
|
}
|
|
15317
15337
|
})
|
|
15318
15338
|
}
|
|
@@ -15321,13 +15341,13 @@ RED.stack = (function() {
|
|
|
15321
15341
|
value: "bin",
|
|
15322
15342
|
label: "buffer",
|
|
15323
15343
|
icon: "red/images/typedInput/bin.svg",
|
|
15324
|
-
expand: function() {
|
|
15344
|
+
expand: function () {
|
|
15325
15345
|
var that = this;
|
|
15326
15346
|
RED.editor.editBuffer({
|
|
15327
15347
|
value: this.value(),
|
|
15328
15348
|
stateId: RED.editor.generateViewStateId("typedInput", that, "bin"),
|
|
15329
15349
|
focus: true,
|
|
15330
|
-
complete: function(v) {
|
|
15350
|
+
complete: function (v) {
|
|
15331
15351
|
that.value(v);
|
|
15332
15352
|
}
|
|
15333
15353
|
})
|
|
@@ -15343,9 +15363,9 @@ RED.stack = (function() {
|
|
|
15343
15363
|
value: "node",
|
|
15344
15364
|
label: "node",
|
|
15345
15365
|
icon: "red/images/typedInput/target.svg",
|
|
15346
|
-
valueLabel: function(container,value) {
|
|
15366
|
+
valueLabel: function (container, value) {
|
|
15347
15367
|
var node = RED.nodes.node(value);
|
|
15348
|
-
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).css({
|
|
15368
|
+
var nodeDiv = $('<div>', { class: "red-ui-search-result-node" }).css({
|
|
15349
15369
|
"margin-top": "2px",
|
|
15350
15370
|
"margin-left": "3px"
|
|
15351
15371
|
}).appendTo(container);
|
|
@@ -15354,117 +15374,117 @@ RED.stack = (function() {
|
|
|
15354
15374
|
"margin-left": "6px"
|
|
15355
15375
|
}).appendTo(container);
|
|
15356
15376
|
if (node) {
|
|
15357
|
-
var colour = RED.utils.getNodeColor(node.type,node._def);
|
|
15358
|
-
var icon_url = RED.utils.getNodeIcon(node._def,node);
|
|
15377
|
+
var colour = RED.utils.getNodeColor(node.type, node._def);
|
|
15378
|
+
var icon_url = RED.utils.getNodeIcon(node._def, node);
|
|
15359
15379
|
if (node.type === 'tab') {
|
|
15360
15380
|
colour = "#C0DEED";
|
|
15361
15381
|
}
|
|
15362
|
-
nodeDiv.css('backgroundColor',colour);
|
|
15363
|
-
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
|
|
15382
|
+
nodeDiv.css('backgroundColor', colour);
|
|
15383
|
+
var iconContainer = $('<div/>', { class: "red-ui-palette-icon-container" }).appendTo(nodeDiv);
|
|
15364
15384
|
RED.utils.createIconElement(icon_url, iconContainer, true);
|
|
15365
|
-
var l = RED.utils.getNodeLabel(node,node.id);
|
|
15385
|
+
var l = RED.utils.getNodeLabel(node, node.id);
|
|
15366
15386
|
nodeLabel.text(l);
|
|
15367
15387
|
} else {
|
|
15368
15388
|
nodeDiv.css({
|
|
15369
15389
|
'backgroundColor': '#eee',
|
|
15370
|
-
'border-style'
|
|
15390
|
+
'border-style': 'dashed'
|
|
15371
15391
|
});
|
|
15372
15392
|
|
|
15373
15393
|
}
|
|
15374
15394
|
},
|
|
15375
|
-
expand: function() {
|
|
15395
|
+
expand: function () {
|
|
15376
15396
|
var that = this;
|
|
15377
15397
|
RED.tray.hide();
|
|
15378
15398
|
RED.view.selectNodes({
|
|
15379
15399
|
single: true,
|
|
15380
15400
|
selected: [that.value()],
|
|
15381
|
-
onselect: function(selection) {
|
|
15401
|
+
onselect: function (selection) {
|
|
15382
15402
|
that.value(selection.id);
|
|
15383
15403
|
RED.tray.show();
|
|
15384
15404
|
},
|
|
15385
|
-
oncancel: function() {
|
|
15405
|
+
oncancel: function () {
|
|
15386
15406
|
RED.tray.show();
|
|
15387
15407
|
}
|
|
15388
15408
|
})
|
|
15389
15409
|
}
|
|
15390
15410
|
},
|
|
15391
|
-
cred:{
|
|
15392
|
-
value:"cred",
|
|
15393
|
-
label:"credential",
|
|
15394
|
-
icon:"fa fa-lock",
|
|
15411
|
+
cred: {
|
|
15412
|
+
value: "cred",
|
|
15413
|
+
label: "credential",
|
|
15414
|
+
icon: "fa fa-lock",
|
|
15395
15415
|
inputType: "password",
|
|
15396
|
-
valueLabel: function(container,value) {
|
|
15416
|
+
valueLabel: function (container, value) {
|
|
15397
15417
|
var that = this;
|
|
15398
|
-
container.css("pointer-events","none");
|
|
15399
|
-
container.css("flex-grow",0);
|
|
15418
|
+
container.css("pointer-events", "none");
|
|
15419
|
+
container.css("flex-grow", 0);
|
|
15400
15420
|
this.elementDiv.hide();
|
|
15401
15421
|
var buttons = $('<div>').css({
|
|
15402
15422
|
position: "absolute",
|
|
15403
|
-
right:"6px",
|
|
15423
|
+
right: "6px",
|
|
15404
15424
|
top: "6px",
|
|
15405
|
-
"pointer-events":"all"
|
|
15425
|
+
"pointer-events": "all"
|
|
15406
15426
|
}).appendTo(container);
|
|
15407
15427
|
var eyeButton = $('<button type="button" class="red-ui-button red-ui-button-small"></button>').css({
|
|
15408
|
-
width:"20px"
|
|
15409
|
-
}).appendTo(buttons).on("click", function(evt) {
|
|
15428
|
+
width: "20px"
|
|
15429
|
+
}).appendTo(buttons).on("click", function (evt) {
|
|
15410
15430
|
evt.preventDefault();
|
|
15411
15431
|
var cursorPosition = that.input[0].selectionStart;
|
|
15412
15432
|
var currentType = that.input.attr("type");
|
|
15413
15433
|
if (currentType === "text") {
|
|
15414
|
-
that.input.attr("type","password");
|
|
15434
|
+
that.input.attr("type", "password");
|
|
15415
15435
|
eyeCon.removeClass("fa-eye-slash").addClass("fa-eye");
|
|
15416
|
-
setTimeout(function() {
|
|
15436
|
+
setTimeout(function () {
|
|
15417
15437
|
that.input.focus();
|
|
15418
15438
|
that.input[0].setSelectionRange(cursorPosition, cursorPosition);
|
|
15419
|
-
},50);
|
|
15439
|
+
}, 50);
|
|
15420
15440
|
} else {
|
|
15421
|
-
that.input.attr("type","text");
|
|
15441
|
+
that.input.attr("type", "text");
|
|
15422
15442
|
eyeCon.removeClass("fa-eye").addClass("fa-eye-slash");
|
|
15423
|
-
setTimeout(function() {
|
|
15443
|
+
setTimeout(function () {
|
|
15424
15444
|
that.input.focus();
|
|
15425
15445
|
that.input[0].setSelectionRange(cursorPosition, cursorPosition);
|
|
15426
|
-
},50);
|
|
15446
|
+
}, 50);
|
|
15427
15447
|
}
|
|
15428
15448
|
}).hide();
|
|
15429
|
-
var eyeCon = $('<i class="fa fa-eye"></i>').css("margin-left","-2px").appendTo(eyeButton);
|
|
15449
|
+
var eyeCon = $('<i class="fa fa-eye"></i>').css("margin-left", "-2px").appendTo(eyeButton);
|
|
15430
15450
|
|
|
15431
15451
|
if (value === "__PWRD__") {
|
|
15432
15452
|
var innerContainer = $('<div><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i></div>').css({
|
|
15433
|
-
padding:"6px 6px",
|
|
15434
|
-
borderRadius:"4px"
|
|
15453
|
+
padding: "6px 6px",
|
|
15454
|
+
borderRadius: "4px"
|
|
15435
15455
|
}).addClass("red-ui-typedInput-value-label-inactive").appendTo(container);
|
|
15436
|
-
var editButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-pencil"></i></button>').appendTo(buttons).on("click", function(evt) {
|
|
15456
|
+
var editButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-pencil"></i></button>').appendTo(buttons).on("click", function (evt) {
|
|
15437
15457
|
evt.preventDefault();
|
|
15438
15458
|
innerContainer.hide();
|
|
15439
|
-
container.css("background","none");
|
|
15440
|
-
container.css("pointer-events","none");
|
|
15459
|
+
container.css("background", "none");
|
|
15460
|
+
container.css("pointer-events", "none");
|
|
15441
15461
|
that.input.val("");
|
|
15442
15462
|
that.element.val("");
|
|
15443
15463
|
that.elementDiv.show();
|
|
15444
15464
|
editButton.hide();
|
|
15445
15465
|
cancelButton.show();
|
|
15446
15466
|
eyeButton.show();
|
|
15447
|
-
setTimeout(function() {
|
|
15467
|
+
setTimeout(function () {
|
|
15448
15468
|
that.input.focus();
|
|
15449
|
-
},50);
|
|
15469
|
+
}, 50);
|
|
15450
15470
|
});
|
|
15451
|
-
var cancelButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-times"></i></button>').css("margin-left","3px").appendTo(buttons).on("click", function(evt) {
|
|
15471
|
+
var cancelButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-times"></i></button>').css("margin-left", "3px").appendTo(buttons).on("click", function (evt) {
|
|
15452
15472
|
evt.preventDefault();
|
|
15453
15473
|
innerContainer.show();
|
|
15454
|
-
container.css("background","");
|
|
15474
|
+
container.css("background", "");
|
|
15455
15475
|
that.input.val("__PWRD__");
|
|
15456
15476
|
that.element.val("__PWRD__");
|
|
15457
15477
|
that.elementDiv.hide();
|
|
15458
15478
|
editButton.show();
|
|
15459
15479
|
cancelButton.hide();
|
|
15460
15480
|
eyeButton.hide();
|
|
15461
|
-
that.input.attr("type","password");
|
|
15481
|
+
that.input.attr("type", "password");
|
|
15462
15482
|
eyeCon.removeClass("fa-eye-slash").addClass("fa-eye");
|
|
15463
15483
|
|
|
15464
15484
|
}).hide();
|
|
15465
15485
|
} else {
|
|
15466
|
-
container.css("background","none");
|
|
15467
|
-
container.css("pointer-events","none");
|
|
15486
|
+
container.css("background", "none");
|
|
15487
|
+
container.css("pointer-events", "none");
|
|
15468
15488
|
this.elementDiv.show();
|
|
15469
15489
|
eyeButton.show();
|
|
15470
15490
|
}
|
|
@@ -16411,26 +16431,48 @@ RED.stack = (function() {
|
|
|
16411
16431
|
}
|
|
16412
16432
|
}
|
|
16413
16433
|
},
|
|
16414
|
-
validate: function() {
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16434
|
+
validate: function(options) {
|
|
16435
|
+
let valid = true;
|
|
16436
|
+
const value = this.value();
|
|
16437
|
+
const type = this.type();
|
|
16418
16438
|
if (this.typeMap[type] && this.typeMap[type].validate) {
|
|
16419
|
-
|
|
16420
|
-
if (typeof
|
|
16421
|
-
|
|
16439
|
+
const validate = this.typeMap[type].validate;
|
|
16440
|
+
if (typeof validate === 'function') {
|
|
16441
|
+
valid = validate(value, {});
|
|
16422
16442
|
} else {
|
|
16423
|
-
|
|
16443
|
+
// Regex
|
|
16444
|
+
valid = validate.test(value);
|
|
16445
|
+
if (!valid) {
|
|
16446
|
+
valid = RED._("validator.errors.invalid-regexp");
|
|
16447
|
+
}
|
|
16424
16448
|
}
|
|
16425
|
-
} else {
|
|
16426
|
-
result = true;
|
|
16427
16449
|
}
|
|
16428
|
-
if (
|
|
16429
|
-
this.
|
|
16450
|
+
if ((typeof valid === "string") || !valid) {
|
|
16451
|
+
this.element.addClass("input-error");
|
|
16452
|
+
this.uiSelect.addClass("input-error");
|
|
16453
|
+
if (typeof valid === "string") {
|
|
16454
|
+
let tooltip = this.element.data("tooltip");
|
|
16455
|
+
if (tooltip) {
|
|
16456
|
+
tooltip.setContent(valid);
|
|
16457
|
+
} else {
|
|
16458
|
+
tooltip = RED.popover.tooltip(this.elementDiv, valid);
|
|
16459
|
+
this.element.data("tooltip", tooltip);
|
|
16460
|
+
}
|
|
16461
|
+
}
|
|
16430
16462
|
} else {
|
|
16431
|
-
this.
|
|
16463
|
+
this.element.removeClass("input-error");
|
|
16464
|
+
this.uiSelect.removeClass("input-error");
|
|
16465
|
+
const tooltip = this.element.data("tooltip");
|
|
16466
|
+
if (tooltip) {
|
|
16467
|
+
this.element.data("tooltip", null);
|
|
16468
|
+
tooltip.delete();
|
|
16469
|
+
}
|
|
16432
16470
|
}
|
|
16433
|
-
|
|
16471
|
+
if (options?.returnErrorMessage === true) {
|
|
16472
|
+
return valid;
|
|
16473
|
+
}
|
|
16474
|
+
// Must return a boolean for no 3.x validator
|
|
16475
|
+
return (typeof valid === "string") ? false : valid;
|
|
16434
16476
|
},
|
|
16435
16477
|
show: function() {
|
|
16436
16478
|
this.uiSelect.show();
|
|
@@ -35338,7 +35380,10 @@ RED.editor = (function() {
|
|
|
35338
35380
|
const input = $("#"+prefix+"-"+property);
|
|
35339
35381
|
const isTypedInput = input.length > 0 && input.next(".red-ui-typedInput-container").length > 0;
|
|
35340
35382
|
if (isTypedInput) {
|
|
35341
|
-
valid = input.typedInput("validate");
|
|
35383
|
+
valid = input.typedInput("validate", { returnErrorMessage: true });
|
|
35384
|
+
if (typeof valid === "string") {
|
|
35385
|
+
return label ? label + ": " + valid : valid;
|
|
35386
|
+
}
|
|
35342
35387
|
}
|
|
35343
35388
|
}
|
|
35344
35389
|
}
|
|
@@ -43573,6 +43618,7 @@ RED.clipboard = (function() {
|
|
|
43573
43618
|
var currentPopoverError;
|
|
43574
43619
|
var activeTab;
|
|
43575
43620
|
var libraryBrowser;
|
|
43621
|
+
var clipboardTabs;
|
|
43576
43622
|
|
|
43577
43623
|
var activeLibraries = {};
|
|
43578
43624
|
|
|
@@ -43762,6 +43808,13 @@ RED.clipboard = (function() {
|
|
|
43762
43808
|
open: function( event, ui ) {
|
|
43763
43809
|
RED.keyboard.disable();
|
|
43764
43810
|
},
|
|
43811
|
+
beforeClose: function(e) {
|
|
43812
|
+
if (clipboardTabs && activeTab === "red-ui-clipboard-dialog-export-tab-clipboard") {
|
|
43813
|
+
const jsonTabIndex = clipboardTabs.getTabIndex('red-ui-clipboard-dialog-export-tab-clipboard-json')
|
|
43814
|
+
const activeTabIndex = clipboardTabs.activeIndex()
|
|
43815
|
+
RED.settings.set("editor.dialog.export.json-view", activeTabIndex === jsonTabIndex )
|
|
43816
|
+
}
|
|
43817
|
+
},
|
|
43765
43818
|
close: function(e) {
|
|
43766
43819
|
RED.keyboard.enable();
|
|
43767
43820
|
if (popover) {
|
|
@@ -43775,12 +43828,23 @@ RED.clipboard = (function() {
|
|
|
43775
43828
|
|
|
43776
43829
|
exportNodesDialog =
|
|
43777
43830
|
'<div class="form-row">'+
|
|
43778
|
-
'<
|
|
43779
|
-
|
|
43780
|
-
|
|
43781
|
-
|
|
43782
|
-
|
|
43783
|
-
|
|
43831
|
+
'<div style="display: flex; justify-content: space-between;">'+
|
|
43832
|
+
'<div class="form-row">'+
|
|
43833
|
+
'<label style="width:auto;margin-right: 10px;" data-i18n="common.label.export"></label>'+
|
|
43834
|
+
'<span id="red-ui-clipboard-dialog-export-rng-group" class="button-group">'+
|
|
43835
|
+
'<a id="red-ui-clipboard-dialog-export-rng-selected" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.selected"></a>'+
|
|
43836
|
+
'<a id="red-ui-clipboard-dialog-export-rng-flow" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.current"></a>'+
|
|
43837
|
+
'<a id="red-ui-clipboard-dialog-export-rng-full" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.all"></a>'+
|
|
43838
|
+
'</span>'+
|
|
43839
|
+
'</div>'+
|
|
43840
|
+
'<div class="form-row">'+
|
|
43841
|
+
'<label style="width:auto;margin-right: 10px;" data-i18n="common.label.format"></label>'+
|
|
43842
|
+
'<span id="red-ui-clipboard-dialog-export-fmt-group" class="button-group">'+
|
|
43843
|
+
'<a id="red-ui-clipboard-dialog-export-fmt-mini" class="red-ui-button red-ui-button toggle" href="#" data-i18n="clipboard.export.compact"></a>'+
|
|
43844
|
+
'<a id="red-ui-clipboard-dialog-export-fmt-full" class="red-ui-button red-ui-button toggle" href="#" data-i18n="clipboard.export.formatted"></a>'+
|
|
43845
|
+
'</span>'+
|
|
43846
|
+
'</div>'+
|
|
43847
|
+
'</div>'+
|
|
43784
43848
|
'</div>'+
|
|
43785
43849
|
'<div class="red-ui-clipboard-dialog-box">'+
|
|
43786
43850
|
'<div class="red-ui-clipboard-dialog-tabs">'+
|
|
@@ -43795,15 +43859,9 @@ RED.clipboard = (function() {
|
|
|
43795
43859
|
'<div id="red-ui-clipboard-dialog-export-tab-clipboard-preview-list"></div>'+
|
|
43796
43860
|
'</div>'+
|
|
43797
43861
|
'<div class="red-ui-clipboard-dialog-export-tab-clipboard-tab" id="red-ui-clipboard-dialog-export-tab-clipboard-json">'+
|
|
43798
|
-
'<div class="form-row" style="height:calc(100% -
|
|
43862
|
+
'<div class="form-row" style="height:calc(100% - 10px)">'+
|
|
43799
43863
|
'<textarea readonly id="red-ui-clipboard-dialog-export-text"></textarea>'+
|
|
43800
43864
|
'</div>'+
|
|
43801
|
-
'<div class="form-row" style="text-align: right;">'+
|
|
43802
|
-
'<span id="red-ui-clipboard-dialog-export-fmt-group" class="button-group">'+
|
|
43803
|
-
'<a id="red-ui-clipboard-dialog-export-fmt-mini" class="red-ui-button red-ui-button-small toggle" href="#" data-i18n="clipboard.export.compact"></a>'+
|
|
43804
|
-
'<a id="red-ui-clipboard-dialog-export-fmt-full" class="red-ui-button red-ui-button-small toggle" href="#" data-i18n="clipboard.export.formatted"></a>'+
|
|
43805
|
-
'</span>'+
|
|
43806
|
-
'</div>'+
|
|
43807
43865
|
'</div>'+
|
|
43808
43866
|
'</div>'+
|
|
43809
43867
|
'<div class="form-row" id="red-ui-clipboard-dialog-export-tab-library-filename">'+
|
|
@@ -44116,7 +44174,7 @@ RED.clipboard = (function() {
|
|
|
44116
44174
|
|
|
44117
44175
|
dialogContainer.empty();
|
|
44118
44176
|
dialogContainer.append($(exportNodesDialog));
|
|
44119
|
-
|
|
44177
|
+
clipboardTabs = null
|
|
44120
44178
|
var tabs = RED.tabs.create({
|
|
44121
44179
|
id: "red-ui-clipboard-dialog-export-tabs",
|
|
44122
44180
|
vertical: true,
|
|
@@ -44177,7 +44235,7 @@ RED.clipboard = (function() {
|
|
|
44177
44235
|
$("#red-ui-clipboard-dialog-tab-library-name").on('paste',function() { setTimeout(validateExportFilename,10)});
|
|
44178
44236
|
$("#red-ui-clipboard-dialog-export").button("enable");
|
|
44179
44237
|
|
|
44180
|
-
|
|
44238
|
+
clipboardTabs = RED.tabs.create({
|
|
44181
44239
|
id: "red-ui-clipboard-dialog-export-tab-clipboard-tabs",
|
|
44182
44240
|
onchange: function(tab) {
|
|
44183
44241
|
$(".red-ui-clipboard-dialog-export-tab-clipboard-tab").hide();
|
|
@@ -44194,6 +44252,9 @@ RED.clipboard = (function() {
|
|
|
44194
44252
|
id: "red-ui-clipboard-dialog-export-tab-clipboard-json",
|
|
44195
44253
|
label: RED._("editor.types.json")
|
|
44196
44254
|
});
|
|
44255
|
+
if (RED.settings.get("editor.dialog.export.json-view") === true) {
|
|
44256
|
+
clipboardTabs.activateTab("red-ui-clipboard-dialog-export-tab-clipboard-json");
|
|
44257
|
+
}
|
|
44197
44258
|
|
|
44198
44259
|
var previewList = $("#red-ui-clipboard-dialog-export-tab-clipboard-preview-list").css({position:"absolute",top:0,right:0,bottom:0,left:0}).treeList({
|
|
44199
44260
|
data: []
|