@knotx/plugins-group 0.2.16 → 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 +10 -10
- package/dist/index.js +10 -10
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -174,12 +174,12 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
174
174
|
return true;
|
|
175
175
|
})), __runInitializers(_init, 39, this);
|
|
176
176
|
__publicField(this, "addNodesToGroup", __runInitializers(_init, 40, this, (groupId, nodeIds) => {
|
|
177
|
-
const groupNode = this.getNode(groupId);
|
|
177
|
+
const groupNode = this.getNode({ id: groupId });
|
|
178
178
|
if (!groupNode || groupNode.type !== "group") {
|
|
179
179
|
return false;
|
|
180
180
|
}
|
|
181
181
|
const validNodeIds = nodeIds.filter((id) => {
|
|
182
|
-
const node = this.getNode(id);
|
|
182
|
+
const node = this.getNode({ id });
|
|
183
183
|
return node && node.group !== groupId;
|
|
184
184
|
});
|
|
185
185
|
if (validNodeIds.length === 0) {
|
|
@@ -198,12 +198,12 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
198
198
|
return true;
|
|
199
199
|
})), __runInitializers(_init, 43, this);
|
|
200
200
|
__publicField(this, "removeNodesFromGroup", __runInitializers(_init, 44, this, (groupId, nodeIds) => {
|
|
201
|
-
const groupNode = this.getNode(groupId);
|
|
201
|
+
const groupNode = this.getNode({ id: groupId });
|
|
202
202
|
if (!groupNode || groupNode.type !== "group") {
|
|
203
203
|
return false;
|
|
204
204
|
}
|
|
205
205
|
const validNodeIds = nodeIds.filter((id) => {
|
|
206
|
-
const node = this.getNode(id);
|
|
206
|
+
const node = this.getNode({ id });
|
|
207
207
|
return node && node.group === groupId;
|
|
208
208
|
});
|
|
209
209
|
if (validNodeIds.length === 0) {
|
|
@@ -259,7 +259,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
259
259
|
}
|
|
260
260
|
break;
|
|
261
261
|
case "update": {
|
|
262
|
-
const currentNode = this.getNode(operation2
|
|
262
|
+
const currentNode = this.getNode(operation2);
|
|
263
263
|
if (!("group" in operation2.data) || operation2.data.group === (currentNode == null ? void 0 : currentNode.group)) {
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
@@ -295,7 +295,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
295
295
|
return op;
|
|
296
296
|
}
|
|
297
297
|
const bounds = this.calculateBounds(op.data, {
|
|
298
|
-
getNode: (
|
|
298
|
+
getNode: (params) => groupNodesMap.get(params.id)
|
|
299
299
|
});
|
|
300
300
|
return __spreadProps(__spreadValues({}, op), {
|
|
301
301
|
data: __spreadProps(__spreadValues({}, op.data), {
|
|
@@ -336,7 +336,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
renderGroup({ node: groupNode }) {
|
|
339
|
-
const getNode = (
|
|
339
|
+
const getNode = (params) => this.getNodeDraft(params) || this.getNode(params);
|
|
340
340
|
const bounds = this.calculateBounds(groupNode, { getNode });
|
|
341
341
|
if (!bounds)
|
|
342
342
|
return null;
|
|
@@ -380,7 +380,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
380
380
|
let maxY = -Infinity;
|
|
381
381
|
let hasValidNode = false;
|
|
382
382
|
for (const nodeId of nodeIds) {
|
|
383
|
-
const node2 = getNode(nodeId);
|
|
383
|
+
const node2 = getNode({ id: nodeId });
|
|
384
384
|
if (!node2)
|
|
385
385
|
continue;
|
|
386
386
|
hasValidNode = true;
|
|
@@ -402,7 +402,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
404
|
buildMoveGroupOperation(groupId, position, isDelta = false) {
|
|
405
|
-
const groupNode = this.getNode(groupId);
|
|
405
|
+
const groupNode = this.getNode({ id: groupId });
|
|
406
406
|
if (!groupNode || groupNode.type !== "group") {
|
|
407
407
|
return {
|
|
408
408
|
type: "batch",
|
|
@@ -447,7 +447,7 @@ const _Group = class _Group extends (_a = core.BasePlugin, _getNode_dec = [decor
|
|
|
447
447
|
},
|
|
448
448
|
...children.map((id) => {
|
|
449
449
|
var _a2;
|
|
450
|
-
const nodePosition = ((_a2 = this.getNode(id)) == null ? void 0 : _a2.position) || { x: 0, y: 0 };
|
|
450
|
+
const nodePosition = ((_a2 = this.getNode({ id })) == null ? void 0 : _a2.position) || { x: 0, y: 0 };
|
|
451
451
|
return {
|
|
452
452
|
type: "update",
|
|
453
453
|
id,
|
package/dist/index.js
CHANGED
|
@@ -172,12 +172,12 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
172
172
|
return true;
|
|
173
173
|
})), __runInitializers(_init, 39, this);
|
|
174
174
|
__publicField(this, "addNodesToGroup", __runInitializers(_init, 40, this, (groupId, nodeIds) => {
|
|
175
|
-
const groupNode = this.getNode(groupId);
|
|
175
|
+
const groupNode = this.getNode({ id: groupId });
|
|
176
176
|
if (!groupNode || groupNode.type !== "group") {
|
|
177
177
|
return false;
|
|
178
178
|
}
|
|
179
179
|
const validNodeIds = nodeIds.filter((id) => {
|
|
180
|
-
const node = this.getNode(id);
|
|
180
|
+
const node = this.getNode({ id });
|
|
181
181
|
return node && node.group !== groupId;
|
|
182
182
|
});
|
|
183
183
|
if (validNodeIds.length === 0) {
|
|
@@ -196,12 +196,12 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
196
196
|
return true;
|
|
197
197
|
})), __runInitializers(_init, 43, this);
|
|
198
198
|
__publicField(this, "removeNodesFromGroup", __runInitializers(_init, 44, this, (groupId, nodeIds) => {
|
|
199
|
-
const groupNode = this.getNode(groupId);
|
|
199
|
+
const groupNode = this.getNode({ id: groupId });
|
|
200
200
|
if (!groupNode || groupNode.type !== "group") {
|
|
201
201
|
return false;
|
|
202
202
|
}
|
|
203
203
|
const validNodeIds = nodeIds.filter((id) => {
|
|
204
|
-
const node = this.getNode(id);
|
|
204
|
+
const node = this.getNode({ id });
|
|
205
205
|
return node && node.group === groupId;
|
|
206
206
|
});
|
|
207
207
|
if (validNodeIds.length === 0) {
|
|
@@ -257,7 +257,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
257
257
|
}
|
|
258
258
|
break;
|
|
259
259
|
case "update": {
|
|
260
|
-
const currentNode = this.getNode(operation2
|
|
260
|
+
const currentNode = this.getNode(operation2);
|
|
261
261
|
if (!("group" in operation2.data) || operation2.data.group === (currentNode == null ? void 0 : currentNode.group)) {
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
@@ -293,7 +293,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
293
293
|
return op;
|
|
294
294
|
}
|
|
295
295
|
const bounds = this.calculateBounds(op.data, {
|
|
296
|
-
getNode: (
|
|
296
|
+
getNode: (params) => groupNodesMap.get(params.id)
|
|
297
297
|
});
|
|
298
298
|
return __spreadProps(__spreadValues({}, op), {
|
|
299
299
|
data: __spreadProps(__spreadValues({}, op.data), {
|
|
@@ -334,7 +334,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
renderGroup({ node: groupNode }) {
|
|
337
|
-
const getNode = (
|
|
337
|
+
const getNode = (params) => this.getNodeDraft(params) || this.getNode(params);
|
|
338
338
|
const bounds = this.calculateBounds(groupNode, { getNode });
|
|
339
339
|
if (!bounds)
|
|
340
340
|
return null;
|
|
@@ -378,7 +378,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
378
378
|
let maxY = -Infinity;
|
|
379
379
|
let hasValidNode = false;
|
|
380
380
|
for (const nodeId of nodeIds) {
|
|
381
|
-
const node2 = getNode(nodeId);
|
|
381
|
+
const node2 = getNode({ id: nodeId });
|
|
382
382
|
if (!node2)
|
|
383
383
|
continue;
|
|
384
384
|
hasValidNode = true;
|
|
@@ -400,7 +400,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
buildMoveGroupOperation(groupId, position, isDelta = false) {
|
|
403
|
-
const groupNode = this.getNode(groupId);
|
|
403
|
+
const groupNode = this.getNode({ id: groupId });
|
|
404
404
|
if (!groupNode || groupNode.type !== "group") {
|
|
405
405
|
return {
|
|
406
406
|
type: "batch",
|
|
@@ -445,7 +445,7 @@ const _Group = class _Group extends (_a = BasePlugin, _getNode_dec = [inject.get
|
|
|
445
445
|
},
|
|
446
446
|
...children.map((id) => {
|
|
447
447
|
var _a2;
|
|
448
|
-
const nodePosition = ((_a2 = this.getNode(id)) == null ? void 0 : _a2.position) || { x: 0, y: 0 };
|
|
448
|
+
const nodePosition = ((_a2 = this.getNode({ id })) == null ? void 0 : _a2.position) || { x: 0, y: 0 };
|
|
449
449
|
return {
|
|
450
450
|
type: "update",
|
|
451
451
|
id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-group",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Group Plugin for Knotx",
|
|
5
5
|
"author": "boenfu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@knotx/jsx": "0.
|
|
32
|
-
"@knotx/plugins-base-render": "0.
|
|
31
|
+
"@knotx/jsx": "0.3.1",
|
|
32
|
+
"@knotx/plugins-base-render": "0.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"rxjs": "^7.8.1",
|
|
36
|
-
"@knotx/core": "0.
|
|
37
|
-
"@knotx/decorators": "0.
|
|
36
|
+
"@knotx/core": "0.3.1",
|
|
37
|
+
"@knotx/decorators": "0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@knotx/build-config": "0.
|
|
41
|
-
"@knotx/eslint-config": "0.
|
|
42
|
-
"@knotx/jsx": "0.
|
|
43
|
-
"@knotx/plugins-base-render": "0.
|
|
44
|
-
"@knotx/typescript-config": "0.
|
|
40
|
+
"@knotx/build-config": "0.3.1",
|
|
41
|
+
"@knotx/eslint-config": "0.3.1",
|
|
42
|
+
"@knotx/jsx": "0.3.1",
|
|
43
|
+
"@knotx/plugins-base-render": "0.3.1",
|
|
44
|
+
"@knotx/typescript-config": "0.3.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|