@antv/g6 5.0.0-beta.3 → 5.0.0-beta.5
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/g6.min.js +2 -2
- package/esm/constant/shape.d.ts +2 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.js +1 -1
- package/esm/item/edge.d.ts +1 -0
- package/esm/item/edge.js +3 -1
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +12 -6
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +1 -0
- package/esm/item/node.js +11 -4
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/item.js +252 -148
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/graph.d.ts +16 -14
- package/esm/runtime/graph.js +66 -28
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.js +50 -27
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.js +8 -8
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.js +10 -10
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.js +47 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/index.d.ts +3 -0
- package/esm/stdlib/index.js +12 -9
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +1 -1
- package/esm/stdlib/item/edge/base.js +13 -4
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +1 -1
- package/esm/stdlib/item/node/base.js +18 -26
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +4 -4
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +1 -0
- package/esm/stdlib/plugin/index.js +1 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +163 -0
- package/esm/stdlib/plugin/snapline/index.js +1052 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/types.d.ts +1 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/graph.d.ts +14 -14
- package/esm/types/hook.d.ts +6 -0
- package/esm/types/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +13 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/shape.js +2 -2
- package/esm/util/shape.js.map +1 -1
- package/lib/constant/shape.d.ts +2 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +1 -1
- package/lib/item/edge.d.ts +1 -0
- package/lib/item/edge.js +3 -1
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +12 -6
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +1 -0
- package/lib/item/node.js +11 -4
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/item.js +251 -147
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/graph.d.ts +16 -14
- package/lib/runtime/graph.js +66 -28
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.js +50 -27
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.js +8 -8
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.js +10 -10
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.js +47 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/index.d.ts +3 -0
- package/lib/stdlib/index.js +12 -9
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +1 -1
- package/lib/stdlib/item/edge/base.js +13 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +1 -1
- package/lib/stdlib/item/node/base.js +18 -26
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +4 -4
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +1 -0
- package/lib/stdlib/plugin/index.js +1 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +163 -0
- package/lib/stdlib/plugin/snapline/index.js +1056 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/types.d.ts +1 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/graph.d.ts +14 -14
- package/lib/types/hook.d.ts +6 -0
- package/lib/types/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +13 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/shape.js +2 -2
- package/lib/util/shape.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/item/edge.ts +4 -1
- package/src/item/item.ts +11 -6
- package/src/item/node.ts +18 -10
- package/src/runtime/controller/item.ts +212 -66
- package/src/runtime/graph.ts +91 -29
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/drag-canvas.ts +65 -27
- package/src/stdlib/behavior/drag-combo.ts +8 -8
- package/src/stdlib/behavior/drag-node.ts +10 -10
- package/src/stdlib/behavior/zoom-canvas.ts +60 -24
- package/src/stdlib/index.ts +12 -7
- package/src/stdlib/item/edge/base.ts +13 -5
- package/src/stdlib/item/node/base.ts +24 -29
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +4 -4
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/snapline/index.ts +1277 -0
- package/src/stdlib/plugin/types.ts +1 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/graph.ts +22 -17
- package/src/types/hook.ts +6 -0
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +13 -0
- package/src/util/bbox.ts +38 -1
- package/src/util/shape.ts +2 -2
|
@@ -200,7 +200,7 @@ export class History extends Base {
|
|
|
200
200
|
/**
|
|
201
201
|
* Pause stacking operations.
|
|
202
202
|
*/
|
|
203
|
-
|
|
203
|
+
pauseStack(): void {
|
|
204
204
|
this.withoutStackingCounter++;
|
|
205
205
|
|
|
206
206
|
if (this.withoutStackingCounter === 1) {
|
|
@@ -212,7 +212,7 @@ export class History extends Base {
|
|
|
212
212
|
/**
|
|
213
213
|
* Resume stacking operations.
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
resumeStack(): void {
|
|
216
216
|
if (this.withoutStackingCounter > 0) {
|
|
217
217
|
this.withoutStackingCounter--;
|
|
218
218
|
}
|
|
@@ -260,14 +260,14 @@ export class History extends Base {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* Begin a
|
|
264
|
-
* Any operations performed between `
|
|
263
|
+
* Begin a historyBatch operation.
|
|
264
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
265
265
|
* treated as a single operation when undoing or redoing.
|
|
266
266
|
*/
|
|
267
|
-
public
|
|
267
|
+
public startHistoryBatch() {
|
|
268
268
|
if (this.isBatching) {
|
|
269
269
|
throw new Error(
|
|
270
|
-
'Ensure that
|
|
270
|
+
'Ensure that historyBatch processing is stopped before starting.',
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
this.initBatchCommands();
|
|
@@ -275,14 +275,14 @@ export class History extends Base {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
|
-
* End a
|
|
279
|
-
* Any operations performed between `
|
|
278
|
+
* End a historyBatch operation.
|
|
279
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
280
280
|
* treated as a single operation when undoing or redoing.
|
|
281
281
|
*/
|
|
282
|
-
public
|
|
282
|
+
public stopHistoryBatch() {
|
|
283
283
|
if (!this.isBatching) {
|
|
284
284
|
throw new Error(
|
|
285
|
-
'Ensure that
|
|
285
|
+
'Ensure that historyBatch processing is started before stopping.',
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
this.push(this.batchCommands);
|
|
@@ -290,13 +290,13 @@ export class History extends Base {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
* Execute the provided function in a
|
|
293
|
+
* Execute the provided function in a historyBatch mode
|
|
294
294
|
* @param callback
|
|
295
295
|
*/
|
|
296
|
-
public
|
|
297
|
-
this.
|
|
296
|
+
public historyBatch(callback) {
|
|
297
|
+
this.startHistoryBatch();
|
|
298
298
|
callback();
|
|
299
|
-
this.
|
|
299
|
+
this.stopHistoryBatch();
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
public getEvents() {
|
|
@@ -26,14 +26,14 @@ export class ItemDataCommand implements Command {
|
|
|
26
26
|
|
|
27
27
|
private removeChangedData(graph) {
|
|
28
28
|
const ids = this.changes.map((data) => data.value?.id).filter(Boolean);
|
|
29
|
-
graph.
|
|
29
|
+
graph.executeWithNoStack(() => {
|
|
30
30
|
graph.removeData(this.type, ids);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
private addChangedData(graph) {
|
|
35
35
|
const models = this.changes.map((data) => data.value).filter(Boolean);
|
|
36
|
-
graph.
|
|
36
|
+
graph.executeWithNoStack(() => {
|
|
37
37
|
graph.addData(this.type, models);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -61,13 +61,13 @@ export class ItemDataCommand implements Command {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
graph.
|
|
64
|
+
graph.pauseStack();
|
|
65
65
|
if (onlyMove) {
|
|
66
66
|
graph.updatePosition(this.type, models, this.upsertAncestors);
|
|
67
67
|
} else {
|
|
68
68
|
graph.updateData(this.type, models);
|
|
69
69
|
}
|
|
70
|
-
graph.
|
|
70
|
+
graph.resumeStack();
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
undo(graph: IGraph) {
|
|
@@ -11,7 +11,7 @@ export class LayerUpdatedCommand implements Command {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
undo(graph: IGraph) {
|
|
14
|
-
graph.
|
|
14
|
+
graph.executeWithNoStack(() => {
|
|
15
15
|
this.action === 'front'
|
|
16
16
|
? graph.backItem(this.ids)
|
|
17
17
|
: graph.frontItem(this.ids);
|
|
@@ -19,7 +19,7 @@ export class LayerUpdatedCommand implements Command {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
redo(graph: IGraph) {
|
|
22
|
-
graph.
|
|
22
|
+
graph.executeWithNoStack(() => {
|
|
23
23
|
this.action === 'front'
|
|
24
24
|
? graph.frontItem(this.ids)
|
|
25
25
|
: graph.backItem(this.ids);
|
|
@@ -20,7 +20,7 @@ export class StateUpdatedCommand implements Command {
|
|
|
20
20
|
private updateItemsStates(graph, stateOptions) {
|
|
21
21
|
stateOptions?.map((option) => {
|
|
22
22
|
const { ids, states, value } = option;
|
|
23
|
-
graph.
|
|
23
|
+
graph.executeWithNoStack(() => {
|
|
24
24
|
graph.setItemState(ids, states, value);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -20,13 +20,13 @@ export class VisibilityUpdatedCommand implements Command {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
private toggleItemsVisible(graph: IGraph, values) {
|
|
23
|
-
graph.
|
|
23
|
+
graph.pauseStack();
|
|
24
24
|
each(values, (value) =>
|
|
25
25
|
value.visible
|
|
26
26
|
? graph.showItem(value.ids, this.disableAnimate)
|
|
27
27
|
: graph.hideItem(value.ids, this.disableAnimate),
|
|
28
28
|
);
|
|
29
|
-
graph.
|
|
29
|
+
graph.resumeStack();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
undo(graph: IGraph) {
|