@flowgram.ai/document 0.1.0-alpha.4 → 0.1.0-alpha.6
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 +30 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +30 -5
- 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;
|
|
@@ -1594,7 +1601,12 @@ var ConstantKeys = {
|
|
|
1594
1601
|
/***
|
|
1595
1602
|
* 线条、label 激活后的颜色
|
|
1596
1603
|
*/
|
|
1597
|
-
BASE_ACTIVATED_COLOR: "BASE_ACTIVATED_COLOR"
|
|
1604
|
+
BASE_ACTIVATED_COLOR: "BASE_ACTIVATED_COLOR",
|
|
1605
|
+
/**
|
|
1606
|
+
* Branch bottom margin
|
|
1607
|
+
* 分支下边距
|
|
1608
|
+
*/
|
|
1609
|
+
INLINE_BLOCKS_PADDING_TOP: "INLINE_BLOCKS_PADDING_TOP"
|
|
1598
1610
|
};
|
|
1599
1611
|
|
|
1600
1612
|
// src/flow-document-contribution.ts
|
|
@@ -2159,9 +2171,11 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2159
2171
|
this.onNodeAddEmitter = new Emitter6();
|
|
2160
2172
|
this.onNodeAdd = this.onNodeAddEmitter.event;
|
|
2161
2173
|
this.toDispose = new DisposableCollection();
|
|
2174
|
+
this.onNodeMoveEmitter = new Emitter6();
|
|
2175
|
+
this.onNodeMove = this.onNodeMoveEmitter.event;
|
|
2162
2176
|
}
|
|
2163
2177
|
init() {
|
|
2164
|
-
this.toDispose.
|
|
2178
|
+
this.toDispose.pushAll([this.onNodeAddEmitter, this.onNodeMoveEmitter]);
|
|
2165
2179
|
}
|
|
2166
2180
|
addNode(nodeJSON, config = {}) {
|
|
2167
2181
|
const { parent, index, hidden } = config;
|
|
@@ -2225,7 +2239,7 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2225
2239
|
console.warn("no new parent found", newParent);
|
|
2226
2240
|
return;
|
|
2227
2241
|
}
|
|
2228
|
-
let toIndex = typeof index === "undefined" ?
|
|
2242
|
+
let toIndex = typeof index === "undefined" ? newParentEntity.collapsedChildren.length : index;
|
|
2229
2243
|
return this.doMoveNode(entity, newParentEntity, toIndex);
|
|
2230
2244
|
}
|
|
2231
2245
|
/**
|
|
@@ -2378,11 +2392,22 @@ var FlowOperationBaseServiceImpl = class {
|
|
|
2378
2392
|
return parent.children.findIndex((child) => child === entity);
|
|
2379
2393
|
}
|
|
2380
2394
|
doMoveNode(node, newParent, index) {
|
|
2381
|
-
|
|
2395
|
+
if (!node.parent) {
|
|
2396
|
+
throw new Error("root node cannot move");
|
|
2397
|
+
}
|
|
2398
|
+
const event = {
|
|
2399
|
+
node,
|
|
2400
|
+
fromParent: node.parent,
|
|
2401
|
+
toParent: newParent,
|
|
2402
|
+
fromIndex: this.getNodeIndex(node),
|
|
2403
|
+
toIndex: index
|
|
2404
|
+
};
|
|
2405
|
+
this.document.moveChildNodes({
|
|
2382
2406
|
nodeIds: [this.toId(node)],
|
|
2383
2407
|
toParentId: this.toId(newParent),
|
|
2384
2408
|
toIndex: index
|
|
2385
2409
|
});
|
|
2410
|
+
this.onNodeMoveEmitter.fire(event);
|
|
2386
2411
|
}
|
|
2387
2412
|
};
|
|
2388
2413
|
__decorateClass([
|