@knotx/plugins-connection-line 0.3.0 → 0.3.1

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/dist/index.cjs CHANGED
@@ -76,14 +76,14 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
76
76
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
77
77
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
78
78
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
79
- var _destroy_dec, _init_dec, _createEdges_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerCreator_dec, _getConnectHandleAttributes_dec, _selectedNodeIds_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _dispatchEdgeOperation_dec, _dispatchNodeOperation_dec, _getNode_dec, _a, _init;
79
+ var _destroy_dec, _init_dec, _createEdges_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerCreator_dec, _getConnectHandleAttributes_dec, _selected_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _dispatchEdgeOperation_dec, _dispatchNodeOperation_dec, _getNode_dec, _a, _init;
80
80
  const DEFAULT_CONFIG = {
81
81
  allowCreateNodeOnBlankArea: true,
82
82
  edgeType: "bezier",
83
83
  connectionLineClassName: core.bem("connection-line", "line"),
84
84
  allowMultiDrag: true
85
85
  };
86
- class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.inject.getNode()], _dispatchNodeOperation_dec = [decorators.inject.dispatchNodeOperation()], _dispatchEdgeOperation_dec = [decorators.inject.dispatchEdgeOperation()], _startInteraction_dec = [decorators.inject.startInteraction()], _endInteraction_dec = [decorators.inject.endInteraction()], _canInteract_dec = [decorators.inject.canInteract()], _selectedNodeIds_dec = [decorators.inject.selection.selectedNodeIds()], _getConnectHandleAttributes_dec = [decorators.register("getConnectHandleAttributes")], _registerCreator_dec = [decorators.register("registerCreator")], _containerRender_dec = [decorators.layer(core.Layer.Nodes, 10)], _createNodeAndEdge_dec = [decorators.edgeOperator()], _createEdges_dec = [decorators.edgeOperator()], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _a) {
86
+ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.inject.getNode()], _dispatchNodeOperation_dec = [decorators.inject.dispatchNodeOperation()], _dispatchEdgeOperation_dec = [decorators.inject.dispatchEdgeOperation()], _startInteraction_dec = [decorators.inject.startInteraction()], _endInteraction_dec = [decorators.inject.endInteraction()], _canInteract_dec = [decorators.inject.canInteract()], _selected_dec = [decorators.inject.selection.selected()], _getConnectHandleAttributes_dec = [decorators.register("getConnectHandleAttributes")], _registerCreator_dec = [decorators.register("registerCreator")], _containerRender_dec = [decorators.layer(core.Layer.Nodes, 10)], _createNodeAndEdge_dec = [decorators.edgeOperator()], _createEdges_dec = [decorators.edgeOperator()], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _a) {
87
87
  constructor() {
88
88
  super(...arguments);
89
89
  __runInitializers(_init, 5, this);
@@ -94,7 +94,7 @@ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.i
94
94
  __publicField(this, "startInteraction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
95
95
  __publicField(this, "endInteraction", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
96
96
  __publicField(this, "canInteract", __runInitializers(_init, 28, this)), __runInitializers(_init, 31, this);
97
- __publicField(this, "selectedNodeIds", __runInitializers(_init, 32, this, [])), __runInitializers(_init, 35, this);
97
+ __publicField(this, "selected", __runInitializers(_init, 32, this, [])), __runInitializers(_init, 35, this);
98
98
  __publicField(this, "getConnectHandleAttributes", __runInitializers(_init, 36, this, ({ nodeId, type, index = 0, className = "" }) => {
99
99
  return {
100
100
  "className": `${className} ${this.classNames.connector} ${this.classNames[type]}`,
@@ -169,10 +169,10 @@ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.i
169
169
  * 根据当前拖拽的节点和选中的节点决定
170
170
  */
171
171
  getSourceNodeIdsForDrag(currentNodeId) {
172
- if (!this.config.allowMultiDrag || !this.selectedNodeIds.includes(currentNodeId)) {
172
+ if (!this.config.allowMultiDrag || !this.selected.some((item) => item.id === currentNodeId)) {
173
173
  return [currentNodeId];
174
174
  }
175
- return [...this.selectedNodeIds];
175
+ return this.selected.filter((item) => item.type === "node").map((item) => item.id);
176
176
  }
177
177
  /**
178
178
  * 创建临时连接线
@@ -432,7 +432,7 @@ __decorateElement(_init, 5, "dispatchEdgeOperation", _dispatchEdgeOperation_dec,
432
432
  __decorateElement(_init, 5, "startInteraction", _startInteraction_dec, ConnectionLine);
433
433
  __decorateElement(_init, 5, "endInteraction", _endInteraction_dec, ConnectionLine);
434
434
  __decorateElement(_init, 5, "canInteract", _canInteract_dec, ConnectionLine);
435
- __decorateElement(_init, 5, "selectedNodeIds", _selectedNodeIds_dec, ConnectionLine);
435
+ __decorateElement(_init, 5, "selected", _selected_dec, ConnectionLine);
436
436
  __decorateElement(_init, 5, "getConnectHandleAttributes", _getConnectHandleAttributes_dec, ConnectionLine);
437
437
  __decorateElement(_init, 5, "registerCreator", _registerCreator_dec, ConnectionLine);
438
438
  __decoratorMetadata(_init, ConnectionLine);
package/dist/index.d.cts CHANGED
@@ -68,7 +68,7 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
68
68
  startInteraction: Engine['startInteraction'];
69
69
  endInteraction: Engine['endInteraction'];
70
70
  canInteract: Engine['canInteract'];
71
- selectedNodeIds: string[];
71
+ selected: PluginData['selection']['selected'];
72
72
  getConnectHandleAttributes: PluginData['connectionLine']['getConnectHandleAttributes'];
73
73
  private classNames;
74
74
  private connectionLines;
package/dist/index.d.mts CHANGED
@@ -68,7 +68,7 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
68
68
  startInteraction: Engine['startInteraction'];
69
69
  endInteraction: Engine['endInteraction'];
70
70
  canInteract: Engine['canInteract'];
71
- selectedNodeIds: string[];
71
+ selected: PluginData['selection']['selected'];
72
72
  getConnectHandleAttributes: PluginData['connectionLine']['getConnectHandleAttributes'];
73
73
  private classNames;
74
74
  private connectionLines;
package/dist/index.d.ts CHANGED
@@ -68,7 +68,7 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
68
68
  startInteraction: Engine['startInteraction'];
69
69
  endInteraction: Engine['endInteraction'];
70
70
  canInteract: Engine['canInteract'];
71
- selectedNodeIds: string[];
71
+ selected: PluginData['selection']['selected'];
72
72
  getConnectHandleAttributes: PluginData['connectionLine']['getConnectHandleAttributes'];
73
73
  private classNames;
74
74
  private connectionLines;
package/dist/index.js CHANGED
@@ -70,14 +70,14 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
70
70
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
71
71
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
72
72
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
73
- var _destroy_dec, _init_dec, _createEdges_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerCreator_dec, _getConnectHandleAttributes_dec, _selectedNodeIds_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _dispatchEdgeOperation_dec, _dispatchNodeOperation_dec, _getNode_dec, _a, _init;
73
+ var _destroy_dec, _init_dec, _createEdges_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerCreator_dec, _getConnectHandleAttributes_dec, _selected_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _dispatchEdgeOperation_dec, _dispatchNodeOperation_dec, _getNode_dec, _a, _init;
74
74
  const DEFAULT_CONFIG = {
75
75
  allowCreateNodeOnBlankArea: true,
76
76
  edgeType: "bezier",
77
77
  connectionLineClassName: bem("connection-line", "line"),
78
78
  allowMultiDrag: true
79
79
  };
80
- class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()], _dispatchNodeOperation_dec = [inject.dispatchNodeOperation()], _dispatchEdgeOperation_dec = [inject.dispatchEdgeOperation()], _startInteraction_dec = [inject.startInteraction()], _endInteraction_dec = [inject.endInteraction()], _canInteract_dec = [inject.canInteract()], _selectedNodeIds_dec = [inject.selection.selectedNodeIds()], _getConnectHandleAttributes_dec = [register("getConnectHandleAttributes")], _registerCreator_dec = [register("registerCreator")], _containerRender_dec = [layer(Layer.Nodes, 10)], _createNodeAndEdge_dec = [edgeOperator()], _createEdges_dec = [edgeOperator()], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _a) {
80
+ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()], _dispatchNodeOperation_dec = [inject.dispatchNodeOperation()], _dispatchEdgeOperation_dec = [inject.dispatchEdgeOperation()], _startInteraction_dec = [inject.startInteraction()], _endInteraction_dec = [inject.endInteraction()], _canInteract_dec = [inject.canInteract()], _selected_dec = [inject.selection.selected()], _getConnectHandleAttributes_dec = [register("getConnectHandleAttributes")], _registerCreator_dec = [register("registerCreator")], _containerRender_dec = [layer(Layer.Nodes, 10)], _createNodeAndEdge_dec = [edgeOperator()], _createEdges_dec = [edgeOperator()], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _a) {
81
81
  constructor() {
82
82
  super(...arguments);
83
83
  __runInitializers(_init, 5, this);
@@ -88,7 +88,7 @@ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()]
88
88
  __publicField(this, "startInteraction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
89
89
  __publicField(this, "endInteraction", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
90
90
  __publicField(this, "canInteract", __runInitializers(_init, 28, this)), __runInitializers(_init, 31, this);
91
- __publicField(this, "selectedNodeIds", __runInitializers(_init, 32, this, [])), __runInitializers(_init, 35, this);
91
+ __publicField(this, "selected", __runInitializers(_init, 32, this, [])), __runInitializers(_init, 35, this);
92
92
  __publicField(this, "getConnectHandleAttributes", __runInitializers(_init, 36, this, ({ nodeId, type, index = 0, className = "" }) => {
93
93
  return {
94
94
  "className": `${className} ${this.classNames.connector} ${this.classNames[type]}`,
@@ -163,10 +163,10 @@ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()]
163
163
  * 根据当前拖拽的节点和选中的节点决定
164
164
  */
165
165
  getSourceNodeIdsForDrag(currentNodeId) {
166
- if (!this.config.allowMultiDrag || !this.selectedNodeIds.includes(currentNodeId)) {
166
+ if (!this.config.allowMultiDrag || !this.selected.some((item) => item.id === currentNodeId)) {
167
167
  return [currentNodeId];
168
168
  }
169
- return [...this.selectedNodeIds];
169
+ return this.selected.filter((item) => item.type === "node").map((item) => item.id);
170
170
  }
171
171
  /**
172
172
  * 创建临时连接线
@@ -426,7 +426,7 @@ __decorateElement(_init, 5, "dispatchEdgeOperation", _dispatchEdgeOperation_dec,
426
426
  __decorateElement(_init, 5, "startInteraction", _startInteraction_dec, ConnectionLine);
427
427
  __decorateElement(_init, 5, "endInteraction", _endInteraction_dec, ConnectionLine);
428
428
  __decorateElement(_init, 5, "canInteract", _canInteract_dec, ConnectionLine);
429
- __decorateElement(_init, 5, "selectedNodeIds", _selectedNodeIds_dec, ConnectionLine);
429
+ __decorateElement(_init, 5, "selected", _selected_dec, ConnectionLine);
430
430
  __decorateElement(_init, 5, "getConnectHandleAttributes", _getConnectHandleAttributes_dec, ConnectionLine);
431
431
  __decorateElement(_init, 5, "registerCreator", _registerCreator_dec, ConnectionLine);
432
432
  __decoratorMetadata(_init, ConnectionLine);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-connection-line",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Connectionline Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -33,14 +33,14 @@
33
33
  "@interactjs/modifiers": "^1.10.27",
34
34
  "@interactjs/types": "^1.10.27",
35
35
  "interactjs": "^1.10.27",
36
- "@knotx/jsx": "0.3.0",
37
- "@knotx/plugins-selection": "0.3.0"
36
+ "@knotx/jsx": "0.3.1",
37
+ "@knotx/plugins-selection": "0.3.1"
38
38
  },
39
39
  "dependencies": {
40
40
  "lodash-es": "^4.17.21",
41
41
  "rxjs": "^7.8.1",
42
- "@knotx/core": "0.3.0",
43
- "@knotx/decorators": "0.3.0"
42
+ "@knotx/core": "0.3.1",
43
+ "@knotx/decorators": "0.3.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@interactjs/actions": "^1.10.27",
@@ -49,11 +49,11 @@
49
49
  "@interactjs/types": "^1.10.27",
50
50
  "@types/lodash-es": "^4.17.12",
51
51
  "interactjs": "^1.10.27",
52
- "@knotx/build-config": "0.3.0",
53
- "@knotx/eslint-config": "0.3.0",
54
- "@knotx/jsx": "0.3.0",
55
- "@knotx/plugins-selection": "0.3.0",
56
- "@knotx/typescript-config": "0.3.0"
52
+ "@knotx/build-config": "0.3.1",
53
+ "@knotx/eslint-config": "0.3.1",
54
+ "@knotx/jsx": "0.3.1",
55
+ "@knotx/plugins-selection": "0.3.1",
56
+ "@knotx/typescript-config": "0.3.1"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",