@node-red/editor-client 3.1.3 → 3.1.5

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/public/red/red.js CHANGED
@@ -813,7 +813,7 @@ var RED = (function() {
813
813
  menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:"core:show-config-tab"});
814
814
  menuOptions.push({id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
815
815
  {id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:"core:add-flow"},
816
- {id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:"core:edit-flow"},
816
+ {id:"menu-item-workspace-edit",label:RED._("menu.label.edit"),onselect:"core:edit-flow"},
817
817
  {id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:"core:remove-flow"}
818
818
  ]});
819
819
  menuOptions.push({id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
@@ -1039,15 +1039,16 @@ var RED = (function() {
1039
1039
  console.warn(evt,args);
1040
1040
  }
1041
1041
  if (handlers[evt]) {
1042
- for (var i=0;i<handlers[evt].length;i++) {
1042
+ let cpyHandlers = [...handlers[evt]];
1043
+
1044
+ for (var i=0;i<cpyHandlers.length;i++) {
1043
1045
  try {
1044
- handlers[evt][i].apply(null, args);
1046
+ cpyHandlers[i].apply(null, args);
1045
1047
  } catch(err) {
1046
1048
  console.warn("RED.events.emit error: ["+evt+"] "+(err.toString()));
1047
1049
  console.warn(err);
1048
1050
  }
1049
1051
  }
1050
-
1051
1052
  }
1052
1053
  }
1053
1054
  return {
@@ -4944,7 +4945,6 @@ RED.nodes = (function() {
4944
4945
  }
4945
4946
  }
4946
4947
  } else if (n.credentials) {
4947
- node.credentials = {};
4948
4948
  // All other nodes have a well-defined list of possible credentials
4949
4949
  for (var cred in n._def.credentials) {
4950
4950
  if (n._def.credentials.hasOwnProperty(cred)) {
@@ -5933,7 +5933,7 @@ RED.nodes = (function() {
5933
5933
  set: registry.getNodeSet("node-red/unknown")
5934
5934
  }
5935
5935
  } else {
5936
- if (createNewIds || options.importMap[n.id] === "copy") {
5936
+ if (subflow_denylist[parentId] || createNewIds || options.importMap[n.id] === "copy") {
5937
5937
  parentId = subflow.id;
5938
5938
  node.type = "subflow:"+parentId;
5939
5939
  node._def = registry.getNodeType(node.type);
@@ -19444,7 +19444,7 @@ RED.keyboard = (function() {
19444
19444
  };
19445
19445
  if (item.name.trim() !== "") {
19446
19446
  new_env.push(item);
19447
- if ((item.type === "cred") && (item.value !== "__PWRD__")) {
19447
+ if (item.type === "cred") {
19448
19448
  credentials.map[item.name] = item.value;
19449
19449
  credentials.map["has_"+item.name] = (item.value !== "");
19450
19450
  item.value = "__PWRD__";
@@ -24679,10 +24679,15 @@ RED.view = (function() {
24679
24679
  scaleFactor = 30/largestEdge;
24680
24680
  }
24681
24681
  var width = img.width * scaleFactor;
24682
+ if (width > 20) {
24683
+ scalefactor *= 20/width;
24684
+ width = 20;
24685
+ }
24682
24686
  var height = img.height * scaleFactor;
24683
24687
  icon.attr("width",width);
24684
24688
  icon.attr("height",height);
24685
24689
  icon.attr("x",15-width/2);
24690
+ icon.attr("y",(30-height)/2);
24686
24691
  }
24687
24692
  icon.attr("xlink:href",iconUrl);
24688
24693
  icon.style("display",null);
@@ -29473,7 +29478,7 @@ RED.palette = (function() {
29473
29478
  var currentLabel = paletteNode.attr("data-palette-label");
29474
29479
  var currentInfo = paletteNode.attr("data-palette-info");
29475
29480
 
29476
- if (currentLabel !== sf.name || currentInfo !== sf.info) {
29481
+ if (currentLabel !== sf.name || currentInfo !== sf.info || sf.in.length > 0 || sf.out.length > 0) {
29477
29482
  paletteNode.attr("data-palette-info",sf.info);
29478
29483
  setLabel(sf.type+":"+sf.id,paletteNode,sf.name,RED.utils.renderMarkdown(sf.info||""));
29479
29484
  }
@@ -31663,6 +31668,7 @@ RED.sidebar.config = (function() {
31663
31668
  entry.data('node',node.id);
31664
31669
  nodeDiv.data('node',node.id);
31665
31670
  var label = $('<div class="red-ui-palette-label"></div>').text(labelText).appendTo(nodeDiv);
31671
+
31666
31672
  if (node.d) {
31667
31673
  nodeDiv.addClass("red-ui-palette-node-config-disabled");
31668
31674
  $('<i class="fa fa-ban"></i>').prependTo(label);
@@ -31684,6 +31690,20 @@ RED.sidebar.config = (function() {
31684
31690
  nodeDiv.addClass("red-ui-palette-node-config-unused");
31685
31691
  }
31686
31692
  }
31693
+
31694
+ if (!node.valid) {
31695
+ nodeDiv.addClass("red-ui-palette-node-config-invalid")
31696
+ const nodeDivAnnotations = $('<svg class="red-ui-palette-node-annotations red-ui-flow-node-error" width="10" height="10"></svg>').appendTo(nodeDiv)
31697
+ const errorBadge = document.createElementNS("http://www.w3.org/2000/svg","path");
31698
+ errorBadge.setAttribute("d","M 0,9 l 10,0 -5,-8 z");
31699
+ nodeDivAnnotations.append($(errorBadge))
31700
+ RED.popover.tooltip(nodeDivAnnotations, function () {
31701
+ if (node.validationErrors && node.validationErrors.length > 0) {
31702
+ return RED._("editor.errors.invalidProperties")+"<br> - "+node.validationErrors.join("<br> - ")
31703
+ }
31704
+ })
31705
+ }
31706
+
31687
31707
  nodeDiv.on('click',function(e) {
31688
31708
  e.stopPropagation();
31689
31709
  RED.view.select(false);
@@ -32171,7 +32191,7 @@ RED.sidebar.context = (function() {
32171
32191
  typeHint: data.format,
32172
32192
  sourceId: id+"."+k,
32173
32193
  tools: tools,
32174
- path: ""
32194
+ path: k
32175
32195
  }).appendTo(propRow.children()[1]);
32176
32196
  }
32177
32197
  })
@@ -32217,7 +32237,7 @@ RED.sidebar.context = (function() {
32217
32237
  typeHint: data.format,
32218
32238
  sourceId: id+"."+k,
32219
32239
  tools: tools,
32220
- path: ""
32240
+ path: k
32221
32241
  }).appendTo(propRow.children()[1]);
32222
32242
  }
32223
32243
  });
@@ -32238,7 +32258,7 @@ RED.sidebar.context = (function() {
32238
32258
  typeHint: v.format,
32239
32259
  sourceId: id+"."+k,
32240
32260
  tools: tools,
32241
- path: ""
32261
+ path: k
32242
32262
  }).appendTo(propRow.children()[1]);
32243
32263
  if (contextStores.length > 1) {
32244
32264
  $("<span>",{class:"red-ui-sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
@@ -34818,7 +34838,11 @@ RED.editor = (function() {
34818
34838
  })
34819
34839
 
34820
34840
  if (node_def.hasUsers !== false) {
34821
- $('<span><i class="fa fa-info-circle"></i> <span id="red-ui-editor-config-user-count"></span></span>').css("margin-left", "10px").appendTo(trayFooterLeft);
34841
+ // $('<span><i class="fa fa-info-circle"></i> <span id="red-ui-editor-config-user-count"></span></span>').css("margin-left", "10px").appendTo(trayFooterLeft);
34842
+ $('<button type="button" class="red-ui-button"><i class="fa fa-user"></i><span id="red-ui-editor-config-user-count"></span></button>').on('click', function() {
34843
+ RED.sidebar.info.outliner.search('uses:'+editing_config_node.id)
34844
+ RED.sidebar.info.show()
34845
+ }).appendTo(trayFooterLeft);
34822
34846
  }
34823
34847
  trayFooter.append('<span class="red-ui-tray-footer-right"><span id="red-ui-editor-config-scope-warning" data-i18n="[title]editor.errors.scopeChange"><i class="fa fa-warning"></i></span><select id="red-ui-editor-config-scope"></select></span>');
34824
34848
 
@@ -34876,7 +34900,8 @@ RED.editor = (function() {
34876
34900
  });
34877
34901
  }
34878
34902
  if (node_def.hasUsers !== false) {
34879
- $("#red-ui-editor-config-user-count").text(RED._("editor.nodesUse", {count:editing_config_node.users.length})).parent().show();
34903
+ $("#red-ui-editor-config-user-count").text(editing_config_node.users.length).parent().show();
34904
+ RED.popover.tooltip($("#red-ui-editor-config-user-count").parent(), function() { return RED._('editor.nodesUse',{count:editing_config_node.users.length})});
34880
34905
  }
34881
34906
  trayBody.i18n();
34882
34907
  trayFooter.i18n();
@@ -42613,7 +42638,7 @@ RED.clipboard = (function() {
42613
42638
  flow.forEach(function(node) {
42614
42639
  if (node.type === "tab") {
42615
42640
  flows[node.id] = {
42616
- element: getFlowLabel(node,false),
42641
+ element: getFlowLabel(node),
42617
42642
  deferBuild: type !== "flow",
42618
42643
  expanded: type === "flow",
42619
42644
  children: []
@@ -42794,7 +42819,6 @@ RED.clipboard = (function() {
42794
42819
  try {
42795
42820
  RED.view.importNodes(newNodes, importOptions);
42796
42821
  } catch(error) {
42797
- console.log(error.importConfig)
42798
42822
  // Thrown for import_conflict
42799
42823
  confirmImport(error.importConfig, newNodes, importOptions);
42800
42824
  }
@@ -42964,9 +42988,9 @@ RED.clipboard = (function() {
42964
42988
  function getNodeElement(n, isConflicted, isSelected, parent) {
42965
42989
  var element;
42966
42990
  if (n.type === "tab") {
42967
- element = getFlowLabel(n, isSelected);
42991
+ element = getFlowLabel(n, isConflicted);
42968
42992
  } else {
42969
- element = getNodeLabel(n, isConflicted, isSelected);
42993
+ element = getNodeLabel(n, isConflicted, isSelected, parent);
42970
42994
  }
42971
42995
  var controls = $('<div>',{class:"red-ui-clipboard-dialog-import-conflicts-controls"}).appendTo(element);
42972
42996
  controls.on("click", function(evt) { evt.stopPropagation(); });
@@ -43016,14 +43040,14 @@ RED.clipboard = (function() {
43016
43040
  }
43017
43041
  }
43018
43042
 
43019
- function getFlowLabel(n) {
43043
+ function getFlowLabel(n, isConflicted) {
43020
43044
  n = JSON.parse(JSON.stringify(n));
43021
43045
  n._def = RED.nodes.getType(n.type) || {};
43022
43046
  if (n._def) {
43023
43047
  n._ = n._def._;
43024
43048
  }
43025
43049
 
43026
- var div = $('<div>',{class:"red-ui-info-outline-item red-ui-info-outline-item-flow"});
43050
+ var div = $('<div>',{class:"red-ui-info-outline-item red-ui-info-outline-item-flow red-ui-node-list-item"});
43027
43051
  var contentDiv = $('<div>',{class:"red-ui-search-result-description red-ui-info-outline-item-label"}).appendTo(div);
43028
43052
  var label = (typeof n === "string")? n : n.label;
43029
43053
  var newlineIndex = label.indexOf("\\n");
@@ -43031,11 +43055,17 @@ RED.clipboard = (function() {
43031
43055
  label = label.substring(0,newlineIndex)+"...";
43032
43056
  }
43033
43057
  contentDiv.text(label);
43058
+
43059
+ if (!!isConflicted) {
43060
+ const conflictIcon = $('<span style="padding: 0 10px;"><i class="fa fa-exclamation-circle"></span>').appendTo(div)
43061
+ RED.popover.tooltip(conflictIcon, RED._('clipboard.import.alreadyExists'))
43062
+ }
43063
+
43034
43064
  // A conflicted flow should not be imported by default.
43035
43065
  return div;
43036
43066
  }
43037
43067
 
43038
- function getNodeLabel(n, isConflicted) {
43068
+ function getNodeLabel(n, isConflicted, isSelected, parent) {
43039
43069
  n = JSON.parse(JSON.stringify(n));
43040
43070
  n._def = RED.nodes.getType(n.type) || {};
43041
43071
  if (n._def) {
@@ -43043,6 +43073,11 @@ RED.clipboard = (function() {
43043
43073
  }
43044
43074
  var div = $('<div>',{class:"red-ui-node-list-item"});
43045
43075
  RED.utils.createNodeIcon(n,true).appendTo(div);
43076
+
43077
+ if (!parent && !!isConflicted) {
43078
+ const conflictIcon = $('<span style="padding: 0 10px;"><i class="fa fa-exclamation-circle"></span>').appendTo(div)
43079
+ RED.popover.tooltip(conflictIcon, RED._('clipboard.import.alreadyExists'))
43080
+ }
43046
43081
  return div;
43047
43082
  }
43048
43083
 
@@ -45041,8 +45076,26 @@ RED.search = (function() {
45041
45076
  const isGroup = hasSelection && selection.nodes.length === 1 && selection.nodes[0].type === 'group'
45042
45077
  const canEdit = !RED.workspaces.isLocked()
45043
45078
  const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
45044
- const isAllGroups = hasSelection && selection.nodes.filter(n => n.type !== 'group').length === 0
45045
- const hasGroup = hasSelection && selection.nodes.filter(n => n.type === 'group' ).length > 0
45079
+ let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
45080
+ if (hasSelection) {
45081
+ selection.nodes.forEach(n => {
45082
+ if (n.type === 'group') {
45083
+ hasGroup = true;
45084
+ } else {
45085
+ isAllGroups = false;
45086
+ }
45087
+ if (n.d) {
45088
+ hasDisabledNode = true;
45089
+ } else {
45090
+ hasEnabledNode = true;
45091
+ }
45092
+ if (n.l === undefined || n.l) {
45093
+ hasLabeledNode = true;
45094
+ } else {
45095
+ hasUnlabeledNode = true;
45096
+ }
45097
+ });
45098
+ }
45046
45099
  const offset = $("#red-ui-workspace-chart").offset()
45047
45100
 
45048
45101
  let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
@@ -45066,7 +45119,7 @@ RED.search = (function() {
45066
45119
  onselect: function () {
45067
45120
  RED.view.showQuickAddDialog({
45068
45121
  position: [addX, addY],
45069
- touchTrigger: true,
45122
+ touchTrigger: 'ontouchstart' in window,
45070
45123
  splice: isSingleLink ? selection.links[0] : undefined,
45071
45124
  // spliceMultiple: isMultipleLinks
45072
45125
  })
@@ -45124,11 +45177,11 @@ RED.search = (function() {
45124
45177
  )
45125
45178
  }
45126
45179
  nodeOptions.push(
45127
- { onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes') },
45128
- { onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes') },
45180
+ { onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes'), disabled: !hasDisabledNode },
45181
+ { onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes'), disabled: !hasEnabledNode },
45129
45182
  null,
45130
- { onselect: 'core:show-selected-node-labels', label: RED._('menu.label.showSelectedNodeLabels') },
45131
- { onselect: 'core:hide-selected-node-labels', label: RED._('menu.label.hideSelectedNodeLabels') }
45183
+ { onselect: 'core:show-selected-node-labels', label: RED._('menu.label.showSelectedNodeLabels'), disabled: !hasUnlabeledNode },
45184
+ { onselect: 'core:hide-selected-node-labels', label: RED._('menu.label.hideSelectedNodeLabels'), disabled: !hasLabeledNode }
45132
45185
  )
45133
45186
  menuItems.push({
45134
45187
  label: RED._('sidebar.info.node'),
@@ -45675,8 +45728,15 @@ RED.actionList = (function() {
45675
45728
  var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
45676
45729
  RED.utils.createIconElement(icon_url, iconContainer, false);
45677
45730
 
45678
-
45679
- if (!/^_action_:/.test(object.type) && object.type !== "junction") {
45731
+ if (/^subflow:/.test(object.type)) {
45732
+ var sf = RED.nodes.subflow(object.type.substring(8));
45733
+ if (sf.in.length > 0) {
45734
+ $('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
45735
+ }
45736
+ if (sf.out.length > 0) {
45737
+ $('<div/>',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv);
45738
+ }
45739
+ } else if (!/^_action_:/.test(object.type) && object.type !== "junction") {
45680
45740
  if (def.inputs > 0) {
45681
45741
  $('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
45682
45742
  }