@elyra/canvas 12.15.0 → 12.16.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.
Files changed (70) hide show
  1. package/dist/canvas-controller-c420f377.js +2 -0
  2. package/dist/canvas-controller-c420f377.js.map +1 -0
  3. package/dist/canvas-controller-e02a5de5.js +2 -0
  4. package/dist/canvas-controller-e02a5de5.js.map +1 -0
  5. package/dist/common-canvas-51ed78a5.js +2 -0
  6. package/dist/common-canvas-51ed78a5.js.map +1 -0
  7. package/dist/common-canvas-d0230688.js +2 -0
  8. package/dist/common-canvas-d0230688.js.map +1 -0
  9. package/dist/common-canvas.es.js +1 -1
  10. package/dist/common-canvas.js +1 -1
  11. package/dist/{common-properties-86de4c9f.js → common-properties-0a697e6a.js} +2 -2
  12. package/dist/{common-properties-86de4c9f.js.map → common-properties-0a697e6a.js.map} +1 -1
  13. package/dist/{common-properties-9e579309.js → common-properties-233593d2.js} +2 -2
  14. package/dist/{common-properties-9e579309.js.map → common-properties-233593d2.js.map} +1 -1
  15. package/dist/flexible-table-0c7ae548.js +2 -0
  16. package/dist/flexible-table-0c7ae548.js.map +1 -0
  17. package/dist/flexible-table-60c73b88.js +2 -0
  18. package/dist/flexible-table-60c73b88.js.map +1 -0
  19. package/dist/{index-669f95a7.js → index-390d8148.js} +2 -2
  20. package/dist/{index-669f95a7.js.map → index-390d8148.js.map} +1 -1
  21. package/dist/{index-6d3404e1.js → index-e6d8ea9c.js} +2 -2
  22. package/dist/{index-6d3404e1.js.map → index-e6d8ea9c.js.map} +1 -1
  23. package/dist/lib/canvas-controller.es.js +1 -1
  24. package/dist/lib/canvas-controller.js +1 -1
  25. package/dist/lib/canvas.es.js +1 -1
  26. package/dist/lib/canvas.js +1 -1
  27. package/dist/lib/properties/field-picker.es.js +1 -1
  28. package/dist/lib/properties/field-picker.js +1 -1
  29. package/dist/lib/properties/flexible-table.es.js +1 -1
  30. package/dist/lib/properties/flexible-table.js +1 -1
  31. package/dist/lib/properties.es.js +1 -1
  32. package/dist/lib/properties.js +1 -1
  33. package/dist/styles/common-canvas.min.css +1 -1
  34. package/dist/styles/common-canvas.min.css.map +1 -1
  35. package/locales/command-actions/locales/index.js +3 -1
  36. package/locales/command-actions/locales/sv.json +51 -0
  37. package/locales/common-canvas/locales/index.js +3 -1
  38. package/locales/common-canvas/locales/sv.json +37 -0
  39. package/locales/common-properties/locales/index.js +3 -1
  40. package/locales/common-properties/locales/sv.json +93 -0
  41. package/locales/palette/locales/index.js +3 -1
  42. package/locales/palette/locales/sv.json +10 -0
  43. package/locales/toolbar/locales/index.js +3 -1
  44. package/locales/toolbar/locales/sv.json +8 -0
  45. package/package.json +1 -1
  46. package/src/command-actions/createSuperNodeAction.js +358 -268
  47. package/src/common-canvas/canvas-controller.js +7 -3
  48. package/src/common-canvas/common-canvas-utils.js +1 -1
  49. package/src/common-canvas/svg-canvas-renderer.js +44 -19
  50. package/src/common-canvas/svg-canvas-utils-links.js +5 -1
  51. package/src/common-canvas/svg-canvas-utils-nodes.js +23 -0
  52. package/src/common-properties/components/virtualized-table/virtualized-table.jsx +5 -5
  53. package/src/common-properties/controls/radioset/radioset.jsx +12 -10
  54. package/src/common-properties/controls/radioset/radioset.scss +13 -11
  55. package/src/object-model/api-pipeline.js +19 -6
  56. package/src/object-model/config-utils.js +1 -0
  57. package/src/object-model/layout-dimensions.js +5 -3
  58. package/stats.html +1 -1
  59. package/dist/canvas-controller-720a509c.js +0 -2
  60. package/dist/canvas-controller-720a509c.js.map +0 -1
  61. package/dist/canvas-controller-73113a1b.js +0 -2
  62. package/dist/canvas-controller-73113a1b.js.map +0 -1
  63. package/dist/common-canvas-21b6ab50.js +0 -2
  64. package/dist/common-canvas-21b6ab50.js.map +0 -1
  65. package/dist/common-canvas-baef2726.js +0 -2
  66. package/dist/common-canvas-baef2726.js.map +0 -1
  67. package/dist/flexible-table-d3598aa8.js +0 -2
  68. package/dist/flexible-table-d3598aa8.js.map +0 -1
  69. package/dist/flexible-table-fe7fbc13.js +0 -2
  70. package/dist/flexible-table-fe7fbc13.js.map +0 -1
@@ -1540,9 +1540,13 @@ export default class CanvasController {
1540
1540
  }
1541
1541
  }
1542
1542
 
1543
- // Returns the current zoom object for the currently displayed canvas.
1543
+ // Returns the current zoom object for the currently displayed canvas or null
1544
+ // if the canvas is not yet rendered for the first time.
1544
1545
  getZoom() {
1545
- return this.getSVGCanvasD3().getZoom();
1546
+ if (this.canvasContents) {
1547
+ return this.getSVGCanvasD3().getZoom();
1548
+ }
1549
+ return null;
1546
1550
  }
1547
1551
 
1548
1552
  // Returns a zoom object required to pan the objects (nodes and/or comments)
@@ -2468,7 +2472,7 @@ export default class CanvasController {
2468
2472
  }
2469
2473
  case "createSuperNode":
2470
2474
  case "createSuperNodeExternal": {
2471
- command = new CreateSuperNodeAction(data, this.objectModel, this.labelUtil);
2475
+ command = new CreateSuperNodeAction(data, this.objectModel, this.labelUtil, this.getCanvasConfig().enableUseCardFromOriginalPorts);
2472
2476
  this.commandStack.do(command);
2473
2477
  break;
2474
2478
  }
@@ -354,7 +354,7 @@ export default class CanvasUtils {
354
354
  }
355
355
  }
356
356
 
357
- return { x: startPointX, y: startPointY };
357
+ return { x: startPointX, y: startPointY, originX, originY };
358
358
  }
359
359
 
360
360
  // Returns a direction NORTH, SOUTH, EAST or WEST which is the direction
@@ -3892,6 +3892,8 @@ export default class SVGCanvasRenderer {
3892
3892
  "y1": startPos.y,
3893
3893
  "x2": transPos.x,
3894
3894
  "y2": transPos.y,
3895
+ "originX": startPos.originX,
3896
+ "originY": startPos.originY,
3895
3897
  "type": linkType }];
3896
3898
 
3897
3899
  if (this.config.enableAssocLinkCreation) {
@@ -3909,15 +3911,24 @@ export default class SVGCanvasRenderer {
3909
3911
  const connectionStartSel = this.nodesLinksGrp.selectAll(".d3-new-connection-start");
3910
3912
  const connectionGuideSel = this.nodesLinksGrp.selectAll(".d3-new-connection-guide");
3911
3913
 
3912
- connectionLineSel
3913
- .data(this.drawingNewLinkData.linkArray)
3914
- .enter()
3915
- .append("path")
3916
- .attr("class", "d3-new-connection-line")
3917
- .attr("linkType", linkType)
3918
- .merge(connectionLineSel)
3919
- .attr("d", pathInfo.path)
3920
- .attr("transform", pathInfo.transform);
3914
+ // For a straight node line, don't draw the new link line when the guide
3915
+ // icon or object is inside the node boundary.
3916
+ if (linkType === NODE_LINK &&
3917
+ this.canvasLayout.linkType === LINK_TYPE_STRAIGHT &&
3918
+ this.nodeUtils.isPointInNodeBoundary(transPos, this.drawingNewLinkData.srcNode)) {
3919
+ this.removeNewLinkLine();
3920
+
3921
+ } else {
3922
+ connectionLineSel
3923
+ .data(this.drawingNewLinkData.linkArray)
3924
+ .enter()
3925
+ .append("path")
3926
+ .attr("class", "d3-new-connection-line")
3927
+ .attr("linkType", linkType)
3928
+ .merge(connectionLineSel)
3929
+ .attr("d", pathInfo.path)
3930
+ .attr("transform", pathInfo.transform);
3931
+ }
3921
3932
 
3922
3933
  if (this.canvasLayout.linkType !== LINK_TYPE_STRAIGHT) {
3923
3934
  connectionStartSel
@@ -3970,8 +3981,8 @@ export default class SVGCanvasRenderer {
3970
3981
  getLinkImageTransform(d) {
3971
3982
  let angle = 0;
3972
3983
  if (this.canvasLayout.linkType === LINK_TYPE_STRAIGHT) {
3973
- const adjacent = d.x2 - d.x1;
3974
- const opposite = d.y2 - d.y1;
3984
+ const adjacent = d.x2 - (d.originX || d.x1);
3985
+ const opposite = d.y2 - (d.originY || d.y1);
3975
3986
  if (adjacent === 0 && opposite === 0) {
3976
3987
  angle = 0;
3977
3988
  } else {
@@ -4259,6 +4270,10 @@ export default class SVGCanvasRenderer {
4259
4270
  this.nodesLinksGrp.selectAll(".d3-new-connection-arrow").remove();
4260
4271
  }
4261
4272
 
4273
+ removeNewLinkLine() {
4274
+ this.nodesLinksGrp.selectAll(".d3-new-connection-line").remove();
4275
+ }
4276
+
4262
4277
  dragLinkHandle(d3Event) {
4263
4278
  const transPos = this.getTransformedMousePos(d3Event);
4264
4279
  const link = this.draggingLinkData.link;
@@ -4856,15 +4871,13 @@ export default class SVGCanvasRenderer {
4856
4871
  this.setPortPositionsVertical(node, node.outputs, node.outputPortsWidth, node.layout.outputPortTopPosX, node.layout.outputPortTopPosY);
4857
4872
  } else {
4858
4873
  this.setPortPositionsLeftRight(node, node.inputs, node.inputPortsHeight, node.layout.inputPortLeftPosX, node.layout.inputPortLeftPosY);
4859
- this.setPortPositionsLeftRight(node, node.outputs, node.outputPortsHeight, this.getOutputPortRightPosX(node), node.layout.outputPortRightPosY,
4874
+ this.setPortPositionsLeftRight(node, node.outputs, node.outputPortsHeight,
4875
+ this.nodeUtils.getNodeOutputPortRightPosX(node),
4876
+ this.nodeUtils.getNodeOutputPortRightPosY(node),
4860
4877
  this.config.enableSingleOutputPortDisplay);
4861
4878
  }
4862
4879
  }
4863
4880
 
4864
- getOutputPortRightPosX(node) {
4865
- return node.width + node.layout.outputPortRightPosX;
4866
- }
4867
-
4868
4881
  getOutputPortBottomPosY(node) {
4869
4882
  return node.height + node.layout.outputPortBottomPosY;
4870
4883
  }
@@ -5578,8 +5591,10 @@ export default class SVGCanvasRenderer {
5578
5591
  };
5579
5592
 
5580
5593
  // If the node has been resized set the resize properties appropriately.
5581
- if (this.resizeObjInitialInfo.width !== resizeObj.width ||
5582
- this.resizeObjInitialInfo.height !== resizeObj.height) {
5594
+ // We use some padding because sometimes, when a node is sized back to its
5595
+ // original dimensions, it isn't retunred to EXACTLY its default width/height.
5596
+ if (resizeObj.height > resizeObj.layout.defaultNodeHeight + 2 ||
5597
+ resizeObj.width > resizeObj.layout.defaultNodeWidth + 2) {
5583
5598
  this.nodeSizingObjectsInfo[resizeObj.id].isResized = true;
5584
5599
  this.nodeSizingObjectsInfo[resizeObj.id].resizeWidth = resizeObj.width;
5585
5600
  this.nodeSizingObjectsInfo[resizeObj.id].resizeHeight = resizeObj.height;
@@ -6021,7 +6036,11 @@ export default class SVGCanvasRenderer {
6021
6036
  ? " d3-draggable"
6022
6037
  : " d3-non-draggable";
6023
6038
 
6024
- return "d3-node-group" + supernodeClass + draggableClass + customClass;
6039
+ const resizeClass = d.isResized // this.isNodeResized(d)
6040
+ ? " d3-resized"
6041
+ : "";
6042
+
6043
+ return "d3-node-group" + supernodeClass + resizeClass + draggableClass + customClass;
6025
6044
  }
6026
6045
 
6027
6046
  // Pushes the links to be below nodes within the nodesLinksGrp group.
@@ -6144,6 +6163,8 @@ export default class SVGCanvasRenderer {
6144
6163
  link.y1 = coords.y1;
6145
6164
  link.x2 = coords.x2;
6146
6165
  link.y2 = coords.y2;
6166
+ link.originX = coords.originX;
6167
+ link.originY = coords.originY;
6147
6168
  return link;
6148
6169
  }
6149
6170
  return null;
@@ -6171,6 +6192,8 @@ export default class SVGCanvasRenderer {
6171
6192
  const startPos = this.linkUtils.getNewStraightNodeLinkStartPos(srcObj, endPos, link.srcOriginInfo);
6172
6193
  coords.x1 = startPos.x;
6173
6194
  coords.y1 = startPos.y;
6195
+ coords.originX = startPos.originX;
6196
+ coords.originY = startPos.originY;
6174
6197
 
6175
6198
  } else {
6176
6199
  srcPortId = this.getSourcePortId(link, srcObj);
@@ -6209,6 +6232,8 @@ export default class SVGCanvasRenderer {
6209
6232
  link.y1 = coords.y1;
6210
6233
  link.x2 = coords.x2;
6211
6234
  link.y2 = coords.y2;
6235
+ link.originX = coords.originX;
6236
+ link.originY = coords.originY;
6212
6237
 
6213
6238
  return link;
6214
6239
  }
@@ -212,7 +212,11 @@ export default class SvgCanvasLinks {
212
212
  srcCenterX,
213
213
  srcCenterY);
214
214
 
215
- return { x1: startPos.x, y1: startPos.y, x2: endPos.x, y2: endPos.y };
215
+ return {
216
+ originX: startPos.originX, originY: startPos.originY,
217
+ x1: startPos.x, y1: startPos.y,
218
+ x2: endPos.x, y2: endPos.y
219
+ };
216
220
  }
217
221
 
218
222
  getCenterOffset(node, originInfo) {
@@ -23,6 +23,13 @@ export default class SvgCanvasNodes {
23
23
  this.canvasLayout = canvasLayout;
24
24
  }
25
25
 
26
+ isPointInNodeBoundary(pos, node) {
27
+ return pos.x >= node.x_pos &&
28
+ pos.x <= node.x_pos + node.width &&
29
+ pos.y >= node.y_pos &&
30
+ pos.y <= node.y_pos + node.height;
31
+ }
32
+
26
33
  getNodeImageClass(node) {
27
34
  return "d3-node-image";
28
35
  }
@@ -336,6 +343,22 @@ export default class SvgCanvasNodes {
336
343
  return node.layout.errorHeight;
337
344
  }
338
345
 
346
+ getNodeInputPortLeftPosX(node) {
347
+ return this.getElementPosX(node.width, node.layout.inputPortLeftPosX, node.layout.inputPortLeftPosition);
348
+ }
349
+
350
+ getNodeInputPortLeftPosY(node) {
351
+ return this.getElementPosY(node.height, node.layout.inputPortLeftPosY, node.layout.inputPortLeftPosition);
352
+ }
353
+
354
+ getNodeOutputPortRightPosX(node) {
355
+ return this.getElementPosX(node.width, node.layout.outputPortRightPosX, node.layout.outputPortRightPosition);
356
+ }
357
+
358
+ getNodeOutputPortRightPosY(node) {
359
+ return this.getElementPosY(node.height, node.layout.outputPortRightPosY, node.layout.outputPortRightPosition);
360
+ }
361
+
339
362
  getElementPosX(width, xOffset = 0, position = "topLeft") {
340
363
  let x = 0;
341
364
 
@@ -396,6 +396,11 @@ class VirtualizedTable extends React.Component {
396
396
  onMouseLeave={(evt) => this.overSelectOption(evt)}
397
397
  onFocus={(evt) => this.overSelectOption(evt)}
398
398
  onBlur={(evt) => this.overSelectOption(evt)}
399
+ onKeyDown={(evt) => {
400
+ if (evt.code === "Space" || evt.code === "Enter") {
401
+ this.onRowClick(evt, rowData, index);
402
+ }
403
+ }}
399
404
  >
400
405
  <Checkbox
401
406
  id={`properties-vt-row-cb-${scrollKey}-${index}`}
@@ -442,11 +447,6 @@ class VirtualizedTable extends React.Component {
442
447
  role="row"
443
448
  style={newStyle}
444
449
  onMouseDown={(evt) => this.onRowClick(evt, rowData, index)}
445
- onKeyPress={(evt) => {
446
- if (evt.code === "Space" || evt.code === "Enter") {
447
- this.onRowClick(evt, rowData, index);
448
- }
449
- }}
450
450
  >
451
451
  {selectOption}
452
452
  {columns}
@@ -202,16 +202,18 @@ class RadiosetControl extends React.Component {
202
202
  };
203
203
  buttons.push(
204
204
  <div key={i} className="properties-radioset-panel">
205
- <RadioButton
206
- key={i}
207
- id={ControlUtils.getControlId(id, this.uuid)}
208
- disabled={disabled || itemDisabled}
209
- labelText={valueSet.valueLabels[i]}
210
- value={val}
211
- onChange={this.handleChange}
212
- checked={checked}
213
- />
214
- {tooltipIcon}
205
+ <div className="properties-radioset-tooltip">
206
+ <RadioButton
207
+ key={i}
208
+ id={ControlUtils.getControlId(id, this.uuid)}
209
+ disabled={disabled || itemDisabled}
210
+ labelText={valueSet.valueLabels[i]}
211
+ value={val}
212
+ onChange={this.handleChange}
213
+ checked={checked}
214
+ />
215
+ {tooltipIcon}
216
+ </div>
215
217
  {optionalPanel}
216
218
  </div>
217
219
  );
@@ -23,6 +23,7 @@
23
23
  }
24
24
  }
25
25
 
26
+
26
27
  .properties-radio-button-group {
27
28
  display: block;
28
29
  &.horizontal {
@@ -38,28 +39,29 @@
38
39
  .properties-radioset-panel {
39
40
  margin-bottom: $spacing-02;
40
41
  margin-right: $spacing-04;
41
- display: grid;
42
- grid-template-columns: 1fr 8fr;
43
- grid-template-rows: auto;
44
- grid-template-areas:
45
- "radio tooltip"
46
- "panel panel";
42
+ display: flex;
43
+ justify-content: flex-start;
44
+ align-items: center;
45
+ flex-wrap: wrap;
46
+ overflow: hidden;
47
47
  .bx--radio-button-wrapper{
48
- grid-area: radio;
49
48
  margin-right: 0; // We removed the space between radio & tooltip to position it correctly
50
49
  }
51
- .tooltip-container{
52
- grid-area: tooltip;
50
+ .properties-radioset-tooltip {
51
+ display: flex;
52
+ align-items: center;
53
+ margin: 2.5px 0 1.5px 1.5px;
53
54
  }
54
55
  .properties-control-nested-panel{
55
- grid-area: panel;
56
+ flex-basis: 100%;
57
+ width: 100%;
56
58
  }
57
59
  &:last-of-type {
58
60
  margin-bottom: 0; // don't want margin when last radio button in group
59
61
  }
60
-
61
62
  .bx--radio-button-wrapper > label {
62
63
  justify-content: left; // override carbon style to center justify radio-button labels
64
+ align-items: center;
63
65
  }
64
66
  }
65
67
  &.error:not([disabled]) {
@@ -1144,19 +1144,32 @@ export default class APIPipeline {
1144
1144
  return linkNodeList;
1145
1145
  }
1146
1146
 
1147
+ // Creates a node link from the srcInfo and trgInfo and other link 'data'
1148
+ // passed in.
1147
1149
  createNodeLink(srcInfo, trgInfo, data) {
1148
1150
  const srcNode = this.getNode(srcInfo.id);
1149
1151
  const trgNode = this.getNode(trgInfo.id);
1150
1152
  const links = this.getLinks();
1151
1153
 
1152
- if (CanvasUtils.isConnectionAllowed(srcInfo.portId, trgInfo.portId, srcNode, trgNode, links, data.type)) {
1154
+ if ((srcInfo.srcPos && trgInfo.trgPos) || // Fully detached
1155
+ (srcInfo.srcPos && CanvasUtils.isTrgConnectionAllowedWithDetachedLinks(trgInfo.portId, trgNode, links)) || // Semi-detached
1156
+ (trgInfo.trgPos && CanvasUtils.isSrcConnectionAllowedWithDetachedLinks(srcInfo.portId, srcNode, links)) || // Semi-detached
1157
+ (CanvasUtils.isConnectionAllowed(srcInfo.portId, trgInfo.portId, srcNode, trgNode, links, data.type))) { // Fully attached
1153
1158
  const link = {};
1154
- link.id = data.id ? data.id : this.objectModel.getUniqueId(CREATE_NODE_LINK, { "sourceNode": this.getNode(srcInfo.id), "targetNode": this.getNode(trgInfo.id) });
1159
+ link.id = data.id ? data.id : this.objectModel.getUniqueId(CREATE_NODE_LINK, { "sourceNode": srcNode, "targetNode": trgNode });
1155
1160
  link.type = data.type;
1156
- link.srcNodeId = srcInfo.id;
1157
- link.srcNodePortId = srcInfo.portId;
1158
- link.trgNodeId = trgInfo.id;
1159
- link.trgNodePortId = trgInfo.portId;
1161
+ if (srcInfo.srcPos) {
1162
+ link.srcPos = srcInfo.srcPos;
1163
+ } else {
1164
+ link.srcNodeId = srcInfo.id;
1165
+ link.srcNodePortId = srcInfo.portId;
1166
+ }
1167
+ if (trgInfo.trgPos) {
1168
+ link.trgPos = trgInfo.trgPos;
1169
+ } else {
1170
+ link.trgNodeId = trgInfo.id;
1171
+ link.trgNodePortId = trgInfo.portId;
1172
+ }
1160
1173
  if (data.class_name) {
1161
1174
  link.class_name = data.class_name;
1162
1175
  }
@@ -94,6 +94,7 @@ export default class CanvasUtils {
94
94
  dropZoneCanvasContent: null,
95
95
  enableNodeLayout: {},
96
96
  enableCanvasLayout: {}, // Not documented
97
+ enableUseCardFromOriginalPorts: false, // Not documented
97
98
  tipConfig: {
98
99
  "palette": true,
99
100
  "nodes": true,
@@ -181,21 +181,22 @@ const portsHorizontalDefaultLayout = {
181
181
  outputPortWidth: 12,
182
182
  outputPortHeight: 12,
183
183
 
184
- // Position of right single input port. Multiple input ports will be
184
+ // Position of right single output port. Multiple input ports will be
185
185
  // automatically positioned with the Y coordinate being overriden. These
186
186
  // values are an offset from the top right corner of the node outline.
187
187
  // Used when linkDirection is "LeftRight".
188
+ outputPortRightPosition: "topRight",
188
189
  outputPortRightPosX: 0,
189
190
  outputPortRightPosY: 20,
190
191
 
191
- // Position of top single input port. Multiple input ports will be
192
+ // Position of top single output port. Multiple input ports will be
192
193
  // automatically positioned with the X coordinate being overriden. These
193
194
  // values are an offset from the top left corner of the node outline.
194
195
  // Used when linkDirection is "BottomTop".
195
196
  outputPortTopPosX: 80,
196
197
  outputPortTopPosY: 0,
197
198
 
198
- // Position of bottom single input port. Multiple input ports will be
199
+ // Position of bottom single output port. Multiple input ports will be
199
200
  // automatically positioned with the X coordinate being overriden. These
200
201
  // values are an offset from the bottom left corner of the node outline.
201
202
  // Used when linkDirection is "TopBottom".
@@ -575,6 +576,7 @@ const portsVerticalDefaultLayout = {
575
576
  // automatically positioned with the Y coordinate being overriden. These
576
577
  // values are an offset from the top right corner of the node outline.
577
578
  // Used when linkDirection is "LeftRight".
579
+ outputPortRightPosition: "topRight",
578
580
  outputPortRightPosX: 0,
579
581
  outputPortRightPosY: 29,
580
582