@elyra/canvas 12.32.2 → 12.33.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 (50) hide show
  1. package/dist/{_baseIteratee-eabd2a94.js → _baseIteratee-2a601011.js} +2 -2
  2. package/dist/{_baseIteratee-eabd2a94.js.map → _baseIteratee-2a601011.js.map} +1 -1
  3. package/dist/{_baseIteratee-e1311552.js → _baseIteratee-7fb1949c.js} +2 -2
  4. package/dist/{_baseIteratee-e1311552.js.map → _baseIteratee-7fb1949c.js.map} +1 -1
  5. package/dist/{common-canvas-8eb241dc.js → common-canvas-da94213a.js} +2 -2
  6. package/dist/{common-canvas-55d8916f.js.map → common-canvas-da94213a.js.map} +1 -1
  7. package/dist/{common-canvas-55d8916f.js → common-canvas-dcc564f1.js} +2 -2
  8. package/dist/{common-canvas-8eb241dc.js.map → common-canvas-dcc564f1.js.map} +1 -1
  9. package/dist/common-canvas.es.js +1 -1
  10. package/dist/common-canvas.js +1 -1
  11. package/dist/common-properties-c6bc9d53.js +2 -0
  12. package/dist/common-properties-c6bc9d53.js.map +1 -0
  13. package/dist/common-properties-e3da18c4.js +2 -0
  14. package/dist/common-properties-e3da18c4.js.map +1 -0
  15. package/dist/{flexible-table-4259d869.js → flexible-table-11488132.js} +2 -2
  16. package/dist/flexible-table-11488132.js.map +1 -0
  17. package/dist/{flexible-table-23d61157.js → flexible-table-a7325a4e.js} +2 -2
  18. package/dist/flexible-table-a7325a4e.js.map +1 -0
  19. package/dist/{icon-8cc7816d.js → icon-111df69c.js} +2 -2
  20. package/dist/{icon-8cc7816d.js.map → icon-111df69c.js.map} +1 -1
  21. package/dist/{icon-04f858ce.js → icon-cc184f86.js} +2 -2
  22. package/dist/{icon-04f858ce.js.map → icon-cc184f86.js.map} +1 -1
  23. package/dist/{index-101f9560.js → index-d75b9194.js} +2 -2
  24. package/dist/{index-101f9560.js.map → index-d75b9194.js.map} +1 -1
  25. package/dist/{index-2788d55d.js → index-e76525b3.js} +2 -2
  26. package/dist/{index-2788d55d.js.map → index-e76525b3.js.map} +1 -1
  27. package/dist/lib/canvas.es.js +1 -1
  28. package/dist/lib/canvas.js +1 -1
  29. package/dist/lib/properties/field-picker.es.js +1 -1
  30. package/dist/lib/properties/field-picker.js +1 -1
  31. package/dist/lib/properties/flexible-table.es.js +1 -1
  32. package/dist/lib/properties/flexible-table.js +1 -1
  33. package/dist/lib/properties.es.js +1 -1
  34. package/dist/lib/properties.js +1 -1
  35. package/dist/{toolbar-12f6def6.js → toolbar-556dad41.js} +2 -2
  36. package/dist/{toolbar-12f6def6.js.map → toolbar-556dad41.js.map} +1 -1
  37. package/dist/{toolbar-55e2020e.js → toolbar-df55ee97.js} +2 -2
  38. package/dist/{toolbar-55e2020e.js.map → toolbar-df55ee97.js.map} +1 -1
  39. package/package.json +1 -1
  40. package/src/common-canvas/svg-canvas-renderer.js +89 -11
  41. package/src/common-properties/components/flexible-table/flexible-table.jsx +5 -5
  42. package/src/common-properties/constants/constants.js +1 -1
  43. package/src/common-properties/controls/numberfield/numberfield.jsx +21 -2
  44. package/stats.html +1 -1
  45. package/dist/common-properties-96c9c88a.js +0 -2
  46. package/dist/common-properties-96c9c88a.js.map +0 -1
  47. package/dist/common-properties-c5292c66.js +0 -2
  48. package/dist/common-properties-c5292c66.js.map +0 -1
  49. package/dist/flexible-table-23d61157.js.map +0 -1
  50. package/dist/flexible-table-4259d869.js.map +0 -1
@@ -4639,14 +4639,26 @@ export default class SVGCanvasRenderer {
4639
4639
  const newLink = this.getNewLinkOnDrag(d3Event);
4640
4640
 
4641
4641
  if (newLink) {
4642
- this.canvasController.editActionHandler({
4643
- editType: "updateLink",
4644
- editSource: "canvas",
4645
- newLink: newLink,
4646
- pipelineId: this.pipelineId });
4642
+ const editSubType = this.getLinkEditSubType(newLink);
4643
+ // If editSubType is set the user did a gesture that requires a change
4644
+ // to the object model.
4645
+ if (editSubType) {
4646
+ this.canvasController.editActionHandler({
4647
+ editType: "updateLink",
4648
+ editSubType: editSubType,
4649
+ editSource: "canvas",
4650
+ newLink: newLink,
4651
+ pipelineId: this.pipelineId });
4652
+ // If editSubType is null, the user performed a gesture which should
4653
+ // not be executed as an action so draw the link back in its old position.
4654
+ } else {
4655
+ this.snapBackOldLink();
4656
+ }
4657
+ // newLink might be null when we are dragging a link handle with
4658
+ // enableLinkSelection not set to detachable. If that's the case the
4659
+ // link needs to snap back (redrawn) to its original position.
4647
4660
  } else {
4648
- this.activePipeline.replaceLink(this.draggingLinkData.oldLink);
4649
- this.displayLinks();
4661
+ this.snapBackOldLink();
4650
4662
  }
4651
4663
 
4652
4664
  // Switch 'new link over node' highlighting off
@@ -4658,6 +4670,70 @@ export default class SVGCanvasRenderer {
4658
4670
  this.stopDraggingLink();
4659
4671
  }
4660
4672
 
4673
+ // Resets and redraws the link being dragged back to its original position.
4674
+ // This is necessary when the user performs a link drag gesture which should
4675
+ // NOT be executed as an action -- therefore the link need to be drawn back
4676
+ // in its original position.
4677
+ snapBackOldLink() {
4678
+ this.activePipeline.replaceLink(this.draggingLinkData.oldLink);
4679
+ this.displayLinks();
4680
+ }
4681
+
4682
+ // Returns the edit sub-type for the link action being performed to further
4683
+ // explain the updateLink action.
4684
+ getLinkEditSubType(newLink) {
4685
+ const oldLink = this.draggingLinkData.oldLink;
4686
+
4687
+ if (oldLink.srcNodeId && !newLink.srcNodeId) {
4688
+ return "detachFromSrcNode";
4689
+
4690
+ } else if (oldLink.trgNodeId && !newLink.trgNodeId) {
4691
+ return "detachFromTrgNode";
4692
+
4693
+ } else if (!oldLink.srcNodeId && newLink.srcNodeId) {
4694
+ return "attachToSrcNode";
4695
+
4696
+ } else if (!oldLink.trgNodeId && newLink.trgNodeId) {
4697
+ return "attachToTrgNode";
4698
+
4699
+ } else if (!oldLink.srcNodeId && !newLink.srcNodeId &&
4700
+ (oldLink.srcPos.x_pos !== newLink.srcPos.x_pos ||
4701
+ oldLink.srcPos.y_pos !== newLink.srcPos.y_pos)) {
4702
+ return "moveSrcPosition";
4703
+
4704
+ } else if (!oldLink.trgNodeId && !newLink.trgNodeId &&
4705
+ (oldLink.trgPos.x_pos !== newLink.trgPos.x_pos ||
4706
+ oldLink.trgPos.y_pos !== newLink.trgPos.y_pos)) {
4707
+ return "moveTrgPosition";
4708
+
4709
+ } else if (oldLink.srcNodeId && newLink.srcNodeId &&
4710
+ oldLink.srcNodeId !== newLink.srcNodeId) {
4711
+ return "switchSrcNode";
4712
+
4713
+ } else if (oldLink.trgNodeId && newLink.trgNodeId &&
4714
+ oldLink.trgNodeId !== newLink.trgNodeId) {
4715
+ return "switchTrgNode";
4716
+
4717
+ } else if (oldLink.srcNodeId && newLink.srcNodeId &&
4718
+ oldLink.srcNodeId === newLink.srcNodeId &&
4719
+ oldLink.srcNodePortId !== newLink.srcNodePortId) {
4720
+ return "switchSrcNodePort";
4721
+
4722
+ } else if (oldLink.trgNodeId && newLink.trgNodeId &&
4723
+ oldLink.trgNodeId === newLink.trgNodeId &&
4724
+ oldLink.trgNodePortId !== newLink.trgNodePortId) {
4725
+ return "switchTrgNodePort";
4726
+ }
4727
+ // We arrive here, in two ways:
4728
+ // 1. if the user dragged a link handle from a node/port and dropped it
4729
+ // back on the same node/port.
4730
+ // 2. If the user clicked on the unattached end of a detached link but did
4731
+ // not move it anywhere
4732
+ // In these cases, the updateLink action should NOT be performed and
4733
+ // consequently NO command should be added to the command stack.
4734
+ return null;
4735
+ }
4736
+
4661
4737
  // Returns a new link if one can be created given the current data in the
4662
4738
  // this.draggingLinkData object. Returns null if a link cannot be created.
4663
4739
  getNewLinkOnDrag(d3Event, nodeProximity) {
@@ -4665,6 +4741,7 @@ export default class SVGCanvasRenderer {
4665
4741
  const newLink = cloneDeep(oldLink);
4666
4742
 
4667
4743
  if (this.draggingLinkData.endBeingDragged === "start") {
4744
+ delete newLink.srcObj;
4668
4745
  delete newLink.srcNodeId;
4669
4746
  delete newLink.srcNodePortId;
4670
4747
  delete newLink.srcPos;
@@ -4675,6 +4752,7 @@ export default class SVGCanvasRenderer {
4675
4752
 
4676
4753
  if (srcNode) {
4677
4754
  newLink.srcNodeId = srcNode.id;
4755
+ newLink.srcObj = this.activePipeline.getNode(srcNode.id);
4678
4756
  newLink.srcNodePortId = nodeProximity
4679
4757
  ? this.getNodePortIdNearMousePos(d3Event, OUTPUT_TYPE, srcNode)
4680
4758
  : this.getOutputNodePortId(d3Event, srcNode);
@@ -4683,6 +4761,7 @@ export default class SVGCanvasRenderer {
4683
4761
  }
4684
4762
 
4685
4763
  } else {
4764
+ delete newLink.trgNode;
4686
4765
  delete newLink.trgNodeId;
4687
4766
  delete newLink.trgNodePortId;
4688
4767
  delete newLink.trgPos;
@@ -4693,6 +4772,7 @@ export default class SVGCanvasRenderer {
4693
4772
 
4694
4773
  if (trgNode) {
4695
4774
  newLink.trgNodeId = trgNode.id;
4775
+ newLink.trgNode = this.activePipeline.getNode(trgNode.id);
4696
4776
  newLink.trgNodePortId = nodeProximity
4697
4777
  ? this.getNodePortIdNearMousePos(d3Event, INPUT_TYPE, trgNode)
4698
4778
  : this.getInputNodePortId(d3Event, trgNode);
@@ -6549,6 +6629,7 @@ export default class SVGCanvasRenderer {
6549
6629
  : null;
6550
6630
  const coords = this.linkUtils.getLinkCoords(link, srcObj, srcPortId, trgNode, trgPortId, assocLinkVariation);
6551
6631
 
6632
+ // Set additional calculated fields on link object.
6552
6633
  link.coordsUpdated =
6553
6634
  link.x1 !== coords.x1 ||
6554
6635
  link.y1 !== coords.y1 ||
@@ -6556,8 +6637,6 @@ export default class SVGCanvasRenderer {
6556
6637
  link.y2 !== coords.y2;
6557
6638
 
6558
6639
  link.assocLinkVariation = assocLinkVariation;
6559
- link.srcPortId = srcPortId;
6560
- link.trgPortId = trgPortId;
6561
6640
  link.x1 = coords.x1;
6562
6641
  link.y1 = coords.y1;
6563
6642
  link.x2 = coords.x2;
@@ -6625,14 +6704,13 @@ export default class SVGCanvasRenderer {
6625
6704
  }
6626
6705
  }
6627
6706
 
6707
+ // Set additional calculated fields on link object.
6628
6708
  link.coordsUpdated =
6629
6709
  link.x1 !== coords.x1 ||
6630
6710
  link.y1 !== coords.y1 ||
6631
6711
  link.x2 !== coords.x2 ||
6632
6712
  link.y2 !== coords.y2;
6633
6713
 
6634
- link.srcPortId = srcPortId;
6635
- link.trgPortId = trgPortId;
6636
6714
  link.x1 = coords.x1;
6637
6715
  link.y1 = coords.y1;
6638
6716
  link.x2 = coords.x2;
@@ -251,11 +251,11 @@ class FlexibleTable extends React.Component {
251
251
  let dynamicH = this.state.dynamicHeight;
252
252
  const multiSelectTableHeight = REM_ROW_HEIGHT + REM_HEADER_HEIGHT;
253
253
  if (Array.isArray(this.props.data) && this.props.data.length < this.state.rows) {
254
- newHeight = (REM_ROW_HEIGHT * this.props.data.length + REM_HEADER_HEIGHT + (this.props.selectedEditRow ? multiSelectTableHeight : 0)) + "rem";
254
+ newHeight = (REM_ROW_HEIGHT * this.props.data.length + REM_HEADER_HEIGHT + (this.props.selectedEditRow ? multiSelectTableHeight : 0)) * ONE_REM_HEIGHT;
255
255
  } else if (this.state.rows > 0) {
256
- newHeight = (REM_ROW_HEIGHT * this.state.rows + REM_HEADER_HEIGHT + (this.props.selectedEditRow ? multiSelectTableHeight : 0)) + "rem";
256
+ newHeight = (REM_ROW_HEIGHT * this.state.rows + REM_HEADER_HEIGHT + (this.props.selectedEditRow ? multiSelectTableHeight : 0)) * ONE_REM_HEIGHT;
257
257
  } else if (this.state.rows === 0) { // only display header
258
- newHeight = REM_HEADER_HEIGHT + "rem";
258
+ newHeight = REM_HEADER_HEIGHT * ONE_REM_HEIGHT;
259
259
  } else if (this.state.rows === -1) {
260
260
  if (this.flexibleTable) {
261
261
  const labelAndDescriptionHeight = 50; // possible dynamically set this in the future
@@ -267,7 +267,7 @@ class FlexibleTable extends React.Component {
267
267
  dynamicH = -1;
268
268
  } else {
269
269
  const totalHeight = flyoutHeight !== 0 ? flyoutHeight : tearsheetHeight;
270
- newHeight = `calc(${totalHeight - ftHeaderHeight - labelAndDescriptionHeight}px - 3.5rem)`; // 3.5rem to adjust padding
270
+ newHeight = `calc(${totalHeight - ftHeaderHeight - labelAndDescriptionHeight}px - ${(3.5 * ONE_REM_HEIGHT)}px)`; // 3.5rem to adjust padding
271
271
  dynamicH = (totalHeight - ftHeaderHeight - labelAndDescriptionHeight) - (3.5 * 16);
272
272
  }
273
273
  }
@@ -528,7 +528,7 @@ class FlexibleTable extends React.Component {
528
528
  const multiSelectEditRowsPixels = multiSelectEditRowsRem * ONE_REM_HEIGHT;
529
529
  if (this.state.rows !== -1 && this.state.tableHeight) {
530
530
  const remHeight = parseInt(this.state.tableHeight, 10);
531
- tableHeight = (remHeight - (this.props.selectedEditRow ? multiSelectEditRowsRem : 0)) * ONE_REM_HEIGHT;
531
+ tableHeight = (remHeight - (this.props.selectedEditRow ? multiSelectEditRowsRem : 0));
532
532
  } else if (this.state.rows === -1 && this.state.dynamicHeight && this.state.dynamicHeight !== -1) {
533
533
  tableHeight = this.state.dynamicHeight - (this.props.selectedEditRow ? multiSelectEditRowsPixels : 0);
534
534
  }
@@ -162,7 +162,7 @@ export const DATEPICKER_TYPE = {
162
162
 
163
163
  export const DEFAULT_DATEPICKER_FORMAT = "Y-m-d"; // ISO format
164
164
 
165
- export const DEFAULT_DATE_FORMAT = "yyyy-mm-dd";
165
+ export const DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
166
166
 
167
167
  export const DEFAULT_TIME_FORMAT = "H:m:s";
168
168
 
@@ -30,6 +30,10 @@ import { has } from "lodash";
30
30
  class NumberfieldControl extends React.Component {
31
31
  constructor(props) {
32
32
  super(props);
33
+
34
+ this.state = {
35
+ invalidNumber: false
36
+ };
33
37
  this.onDirection = this.onDirection.bind(this);
34
38
  this.generateNumber = this.generateNumber.bind(this);
35
39
  this.id = ControlUtils.getControlId(this.props.propertyId);
@@ -56,6 +60,15 @@ class NumberfieldControl extends React.Component {
56
60
  }
57
61
  }
58
62
 
63
+ onInput(evt) {
64
+ // There's a specific case when manually deleting negative number (eg. -1), 1 is deleted first and then - becomes an invalid number
65
+ // After user deletes - sign , onInput is called however onChange event isn't triggered.
66
+ // At this time, invalidNumber state variable is true but the evt.target.value will be a valid "empty" number because - sign was deleted.
67
+ if (this.state.invalidNumber && evt.target.validity && !evt.target.validity.badInput) {
68
+ this.handleChange(evt);
69
+ }
70
+ }
71
+
59
72
  handleChange(evt, direction) {
60
73
  if (typeof direction === "string") {
61
74
  this.onDirection(direction);
@@ -79,11 +92,16 @@ class NumberfieldControl extends React.Component {
79
92
  };
80
93
  this.props.controller.updateErrorMessage(this.props.propertyId, errorMessage);
81
94
  }
95
+ this.setState({ invalidNumber: true });
82
96
  // Return without updating property value
83
97
  return;
84
98
  }
85
99
  // Number is valid, clear invalid number error if it exists
86
- const invalidNumberError = this.props.controller.getErrorMessage(this.props.propertyId) !== null &&
100
+ if (this.state.invalidNumber) {
101
+ this.setState({ invalidNumber: false });
102
+ }
103
+
104
+ const invalidNumberError = this.props.controller.getErrorMessage(this.props.propertyId) &&
87
105
  this.props.controller.getErrorMessage(this.props.propertyId).validation_id === "invalid_number";
88
106
  if (invalidNumberError) {
89
107
  this.props.controller.updateErrorMessage(this.props.propertyId, null);
@@ -151,6 +169,7 @@ class NumberfieldControl extends React.Component {
151
169
  allowEmpty
152
170
  light={this.props.controller.getLight() && this.props.control.light}
153
171
  hideSteppers={this.props.tableControl || (this.props.control.controlType === ControlType.NUMBERFIELD)}
172
+ onInput={this.onInput.bind(this)}
154
173
  />
155
174
  {numberGenerator}
156
175
  <ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />
@@ -176,7 +195,7 @@ NumberfieldControl.propTypes = {
176
195
  const mapStateToProps = (state, ownProps) => ({
177
196
  value: ownProps.controller.getPropertyValue(ownProps.propertyId),
178
197
  state: ownProps.controller.getControlState(ownProps.propertyId),
179
- messageInfo: ownProps.controller.getErrorMessage(ownProps.propertyId)
198
+ messageInfo: ownProps.controller.getErrorMessage(ownProps.propertyId, true) // Filter error messages for hidden/disabled controls
180
199
  });
181
200
 
182
201
  export default connect(mapStateToProps, null)(NumberfieldControl);