@knotx/plugins-connection-line 0.2.6 → 0.2.7
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 +6 -10
- package/dist/index.d.cts +0 -7
- package/dist/index.d.mts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.js +6 -10
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ 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,
|
|
79
|
+
var _destroy_dec, _init_dec, _createEdges_dec, _createEdge_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerNewNodeCreator_dec, _registerValidator_dec, _config_dec, _getConnectHandleAttributes_dec, _selectedNodeIds_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
|
newNodeType: "default",
|
|
@@ -84,7 +84,7 @@ const DEFAULT_CONFIG = {
|
|
|
84
84
|
connectionLineClassName: "knotx-connection-line",
|
|
85
85
|
allowMultiDrag: true
|
|
86
86
|
};
|
|
87
|
-
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")], _config_dec = [decorators.register("config")], _registerValidator_dec = [decorators.register("registerValidator")], _registerNewNodeCreator_dec = [decorators.register("registerNewNodeCreator")], _containerRender_dec = [decorators.layer(core.Layer.Nodes, 10)], _createNodeAndEdge_dec = [decorators.edgeOperator()], _createEdge_dec = [decorators.edgeOperator()], _createEdges_dec = [decorators.edgeOperator()],
|
|
87
|
+
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")], _config_dec = [decorators.register("config")], _registerValidator_dec = [decorators.register("registerValidator")], _registerNewNodeCreator_dec = [decorators.register("registerNewNodeCreator")], _containerRender_dec = [decorators.layer(core.Layer.Nodes, 10)], _createNodeAndEdge_dec = [decorators.edgeOperator()], _createEdge_dec = [decorators.edgeOperator()], _createEdges_dec = [decorators.edgeOperator()], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _a) {
|
|
88
88
|
constructor() {
|
|
89
89
|
super(...arguments);
|
|
90
90
|
__runInitializers(_init, 5, this);
|
|
@@ -292,6 +292,9 @@ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.i
|
|
|
292
292
|
this.connectionLines.clear();
|
|
293
293
|
}
|
|
294
294
|
createNodeAndEdge(sourceNodeIds, position) {
|
|
295
|
+
if (sourceNodeIds.length === 0) {
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
295
298
|
const newNodeId = core.generateId();
|
|
296
299
|
const newNode = {
|
|
297
300
|
id: newNodeId,
|
|
@@ -352,12 +355,6 @@ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.i
|
|
|
352
355
|
}))
|
|
353
356
|
}];
|
|
354
357
|
}
|
|
355
|
-
createNodesAndEdges(sourceNodeIds, position) {
|
|
356
|
-
if (sourceNodeIds.length === 0) {
|
|
357
|
-
return [];
|
|
358
|
-
}
|
|
359
|
-
return this.createNodeAndEdge(sourceNodeIds, position);
|
|
360
|
-
}
|
|
361
358
|
init(config) {
|
|
362
359
|
this.config = lodashEs.merge(DEFAULT_CONFIG, config);
|
|
363
360
|
this.dragInteractable = interact__default(`.${this.classNames.source}[data-plugin-id="${this.pluginId}"]`).draggable({
|
|
@@ -455,7 +452,7 @@ class ConnectionLine extends (_a = core.BasePlugin, _getNode_dec = [decorators.i
|
|
|
455
452
|
const sourceNodeIds = Array.from(this.connectionLines.keys());
|
|
456
453
|
const firstLine = this.connectionLines.values().next().value;
|
|
457
454
|
if (firstLine) {
|
|
458
|
-
this.
|
|
455
|
+
this.createNodeAndEdge(sourceNodeIds, firstLine.currentPosition);
|
|
459
456
|
}
|
|
460
457
|
}
|
|
461
458
|
}
|
|
@@ -476,7 +473,6 @@ __decorateElement(_init, 1, "containerRender", _containerRender_dec, ConnectionL
|
|
|
476
473
|
__decorateElement(_init, 1, "createNodeAndEdge", _createNodeAndEdge_dec, ConnectionLine);
|
|
477
474
|
__decorateElement(_init, 1, "createEdge", _createEdge_dec, ConnectionLine);
|
|
478
475
|
__decorateElement(_init, 1, "createEdges", _createEdges_dec, ConnectionLine);
|
|
479
|
-
__decorateElement(_init, 1, "createNodesAndEdges", _createNodesAndEdges_dec, ConnectionLine);
|
|
480
476
|
__decorateElement(_init, 1, "init", _init_dec, ConnectionLine);
|
|
481
477
|
__decorateElement(_init, 1, "destroy", _destroy_dec, ConnectionLine);
|
|
482
478
|
__decorateElement(_init, 5, "getNode", _getNode_dec, ConnectionLine);
|
package/dist/index.d.cts
CHANGED
|
@@ -137,13 +137,6 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
|
|
|
137
137
|
* 批量创建新的边
|
|
138
138
|
*/
|
|
139
139
|
createEdges(sourceNodeIds: string[], targetNodeId: string): EdgeOperation[];
|
|
140
|
-
/**
|
|
141
|
-
* 批量创建新节点和边
|
|
142
|
-
*/
|
|
143
|
-
createNodesAndEdges(sourceNodeIds: string[], position: {
|
|
144
|
-
x: number;
|
|
145
|
-
y: number;
|
|
146
|
-
}): EdgeOperation[];
|
|
147
140
|
init(config: ConnectionLineConfig): void;
|
|
148
141
|
destroy(): void;
|
|
149
142
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -137,13 +137,6 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
|
|
|
137
137
|
* 批量创建新的边
|
|
138
138
|
*/
|
|
139
139
|
createEdges(sourceNodeIds: string[], targetNodeId: string): EdgeOperation[];
|
|
140
|
-
/**
|
|
141
|
-
* 批量创建新节点和边
|
|
142
|
-
*/
|
|
143
|
-
createNodesAndEdges(sourceNodeIds: string[], position: {
|
|
144
|
-
x: number;
|
|
145
|
-
y: number;
|
|
146
|
-
}): EdgeOperation[];
|
|
147
140
|
init(config: ConnectionLineConfig): void;
|
|
148
141
|
destroy(): void;
|
|
149
142
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -137,13 +137,6 @@ declare class ConnectionLine extends BasePlugin<'connectionLine', ConnectionLine
|
|
|
137
137
|
* 批量创建新的边
|
|
138
138
|
*/
|
|
139
139
|
createEdges(sourceNodeIds: string[], targetNodeId: string): EdgeOperation[];
|
|
140
|
-
/**
|
|
141
|
-
* 批量创建新节点和边
|
|
142
|
-
*/
|
|
143
|
-
createNodesAndEdges(sourceNodeIds: string[], position: {
|
|
144
|
-
x: number;
|
|
145
|
-
y: number;
|
|
146
|
-
}): EdgeOperation[];
|
|
147
140
|
init(config: ConnectionLineConfig): void;
|
|
148
141
|
destroy(): void;
|
|
149
142
|
}
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ 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,
|
|
73
|
+
var _destroy_dec, _init_dec, _createEdges_dec, _createEdge_dec, _createNodeAndEdge_dec, _containerRender_dec, _registerNewNodeCreator_dec, _registerValidator_dec, _config_dec, _getConnectHandleAttributes_dec, _selectedNodeIds_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
|
newNodeType: "default",
|
|
@@ -78,7 +78,7 @@ const DEFAULT_CONFIG = {
|
|
|
78
78
|
connectionLineClassName: "knotx-connection-line",
|
|
79
79
|
allowMultiDrag: true
|
|
80
80
|
};
|
|
81
|
-
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")], _config_dec = [register("config")], _registerValidator_dec = [register("registerValidator")], _registerNewNodeCreator_dec = [register("registerNewNodeCreator")], _containerRender_dec = [layer(Layer.Nodes, 10)], _createNodeAndEdge_dec = [edgeOperator()], _createEdge_dec = [edgeOperator()], _createEdges_dec = [edgeOperator()],
|
|
81
|
+
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")], _config_dec = [register("config")], _registerValidator_dec = [register("registerValidator")], _registerNewNodeCreator_dec = [register("registerNewNodeCreator")], _containerRender_dec = [layer(Layer.Nodes, 10)], _createNodeAndEdge_dec = [edgeOperator()], _createEdge_dec = [edgeOperator()], _createEdges_dec = [edgeOperator()], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _a) {
|
|
82
82
|
constructor() {
|
|
83
83
|
super(...arguments);
|
|
84
84
|
__runInitializers(_init, 5, this);
|
|
@@ -286,6 +286,9 @@ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()]
|
|
|
286
286
|
this.connectionLines.clear();
|
|
287
287
|
}
|
|
288
288
|
createNodeAndEdge(sourceNodeIds, position) {
|
|
289
|
+
if (sourceNodeIds.length === 0) {
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
289
292
|
const newNodeId = generateId();
|
|
290
293
|
const newNode = {
|
|
291
294
|
id: newNodeId,
|
|
@@ -346,12 +349,6 @@ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()]
|
|
|
346
349
|
}))
|
|
347
350
|
}];
|
|
348
351
|
}
|
|
349
|
-
createNodesAndEdges(sourceNodeIds, position) {
|
|
350
|
-
if (sourceNodeIds.length === 0) {
|
|
351
|
-
return [];
|
|
352
|
-
}
|
|
353
|
-
return this.createNodeAndEdge(sourceNodeIds, position);
|
|
354
|
-
}
|
|
355
352
|
init(config) {
|
|
356
353
|
this.config = merge(DEFAULT_CONFIG, config);
|
|
357
354
|
this.dragInteractable = interact(`.${this.classNames.source}[data-plugin-id="${this.pluginId}"]`).draggable({
|
|
@@ -449,7 +446,7 @@ class ConnectionLine extends (_a = BasePlugin, _getNode_dec = [inject.getNode()]
|
|
|
449
446
|
const sourceNodeIds = Array.from(this.connectionLines.keys());
|
|
450
447
|
const firstLine = this.connectionLines.values().next().value;
|
|
451
448
|
if (firstLine) {
|
|
452
|
-
this.
|
|
449
|
+
this.createNodeAndEdge(sourceNodeIds, firstLine.currentPosition);
|
|
453
450
|
}
|
|
454
451
|
}
|
|
455
452
|
}
|
|
@@ -470,7 +467,6 @@ __decorateElement(_init, 1, "containerRender", _containerRender_dec, ConnectionL
|
|
|
470
467
|
__decorateElement(_init, 1, "createNodeAndEdge", _createNodeAndEdge_dec, ConnectionLine);
|
|
471
468
|
__decorateElement(_init, 1, "createEdge", _createEdge_dec, ConnectionLine);
|
|
472
469
|
__decorateElement(_init, 1, "createEdges", _createEdges_dec, ConnectionLine);
|
|
473
|
-
__decorateElement(_init, 1, "createNodesAndEdges", _createNodesAndEdges_dec, ConnectionLine);
|
|
474
470
|
__decorateElement(_init, 1, "init", _init_dec, ConnectionLine);
|
|
475
471
|
__decorateElement(_init, 1, "destroy", _destroy_dec, ConnectionLine);
|
|
476
472
|
__decorateElement(_init, 5, "getNode", _getNode_dec, ConnectionLine);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-connection-line",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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.2.
|
|
37
|
-
"@knotx/plugins-selection": "0.2.
|
|
36
|
+
"@knotx/jsx": "0.2.7",
|
|
37
|
+
"@knotx/plugins-selection": "0.2.7"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"lodash-es": "^4.17.21",
|
|
41
41
|
"rxjs": "^7.8.1",
|
|
42
|
-
"@knotx/core": "0.2.
|
|
43
|
-
"@knotx/decorators": "0.2.
|
|
42
|
+
"@knotx/core": "0.2.7",
|
|
43
|
+
"@knotx/decorators": "0.2.7"
|
|
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.2.
|
|
53
|
-
"@knotx/eslint-config": "0.2.
|
|
54
|
-
"@knotx/jsx": "0.2.
|
|
55
|
-
"@knotx/plugins-selection": "0.2.
|
|
56
|
-
"@knotx/typescript-config": "0.2.
|
|
52
|
+
"@knotx/build-config": "0.2.7",
|
|
53
|
+
"@knotx/eslint-config": "0.2.7",
|
|
54
|
+
"@knotx/jsx": "0.2.7",
|
|
55
|
+
"@knotx/plugins-selection": "0.2.7",
|
|
56
|
+
"@knotx/typescript-config": "0.2.7"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "unbuild",
|