@flowgram.ai/document 0.1.13 → 0.1.15
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/esm/index.js +24 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -245,7 +245,8 @@ var _FlowNodeRenderData = class _FlowNodeRenderData extends EntityData {
|
|
|
245
245
|
expanded: defaultExpanded || false,
|
|
246
246
|
activated: false,
|
|
247
247
|
hovered: false,
|
|
248
|
-
dragging: false
|
|
248
|
+
dragging: false,
|
|
249
|
+
stackIndex: 0
|
|
249
250
|
};
|
|
250
251
|
}
|
|
251
252
|
updateExtInfo(info) {
|
|
@@ -351,6 +352,12 @@ var _FlowNodeRenderData = class _FlowNodeRenderData extends EntityData {
|
|
|
351
352
|
}
|
|
352
353
|
return this.data.activated;
|
|
353
354
|
}
|
|
355
|
+
get stackIndex() {
|
|
356
|
+
return this.data.stackIndex;
|
|
357
|
+
}
|
|
358
|
+
set stackIndex(index) {
|
|
359
|
+
this.data.stackIndex = index;
|
|
360
|
+
}
|
|
354
361
|
get lineActivated() {
|
|
355
362
|
const { activated } = this;
|
|
356
363
|
if (!activated) return false;
|
|
@@ -2159,9 +2166,11 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2159
2166
|
this.onNodeAddEmitter = new Emitter6();
|
|
2160
2167
|
this.onNodeAdd = this.onNodeAddEmitter.event;
|
|
2161
2168
|
this.toDispose = new DisposableCollection();
|
|
2169
|
+
this.onNodeMoveEmitter = new Emitter6();
|
|
2170
|
+
this.onNodeMove = this.onNodeMoveEmitter.event;
|
|
2162
2171
|
}
|
|
2163
2172
|
init() {
|
|
2164
|
-
this.toDispose.
|
|
2173
|
+
this.toDispose.pushAll([this.onNodeAddEmitter, this.onNodeMoveEmitter]);
|
|
2165
2174
|
}
|
|
2166
2175
|
addNode(nodeJSON, config = {}) {
|
|
2167
2176
|
const { parent, index, hidden } = config;
|
|
@@ -2225,7 +2234,7 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2225
2234
|
console.warn("no new parent found", newParent);
|
|
2226
2235
|
return;
|
|
2227
2236
|
}
|
|
2228
|
-
let toIndex = typeof index === "undefined" ?
|
|
2237
|
+
let toIndex = typeof index === "undefined" ? newParentEntity.collapsedChildren.length : index;
|
|
2229
2238
|
return this.doMoveNode(entity, newParentEntity, toIndex);
|
|
2230
2239
|
}
|
|
2231
2240
|
/**
|
|
@@ -2378,11 +2387,22 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2378
2387
|
return parent.children.findIndex((child) => child === entity);
|
|
2379
2388
|
}
|
|
2380
2389
|
doMoveNode(node, newParent, index) {
|
|
2381
|
-
|
|
2390
|
+
if (!node.parent) {
|
|
2391
|
+
throw new Error("root node cannot move");
|
|
2392
|
+
}
|
|
2393
|
+
const event = {
|
|
2394
|
+
node,
|
|
2395
|
+
fromParent: node.parent,
|
|
2396
|
+
toParent: newParent,
|
|
2397
|
+
fromIndex: this.getNodeIndex(node),
|
|
2398
|
+
toIndex: index
|
|
2399
|
+
};
|
|
2400
|
+
this.document.moveChildNodes({
|
|
2382
2401
|
nodeIds: [this.toId(node)],
|
|
2383
2402
|
toParentId: this.toId(newParent),
|
|
2384
2403
|
toIndex: index
|
|
2385
2404
|
});
|
|
2405
|
+
this.onNodeMoveEmitter.fire(event);
|
|
2386
2406
|
}
|
|
2387
2407
|
};
|
|
2388
2408
|
__decorateClass([
|