@next-bricks/diagram 0.58.1 → 0.59.0

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.
Files changed (42) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/7770.2cad0922.js +2 -0
  3. package/dist/chunks/7770.2cad0922.js.map +1 -0
  4. package/dist/chunks/9711.24b8bf0e.js +2 -0
  5. package/dist/chunks/9711.24b8bf0e.js.map +1 -0
  6. package/dist/chunks/{eo-display-canvas.459f2949.js → eo-display-canvas.35e32036.js} +2 -2
  7. package/dist/chunks/{eo-display-canvas.459f2949.js.map → eo-display-canvas.35e32036.js.map} +1 -1
  8. package/dist/chunks/eo-draw-canvas.bc84c42f.js +2 -0
  9. package/dist/chunks/eo-draw-canvas.bc84c42f.js.map +1 -0
  10. package/dist/chunks/{main.1e2e3e8d.js → main.9cf7d12a.js} +2 -2
  11. package/dist/chunks/{main.1e2e3e8d.js.map → main.9cf7d12a.js.map} +1 -1
  12. package/dist/examples.json +1 -1
  13. package/dist/{index.cc69f1f0.js → index.b15c7b4f.js} +2 -2
  14. package/dist/{index.cc69f1f0.js.map → index.b15c7b4f.js.map} +1 -1
  15. package/dist/manifest.json +78 -33
  16. package/dist/types.json +266 -18
  17. package/dist-types/draw-canvas/CellComponent.d.ts +3 -1
  18. package/dist-types/draw-canvas/LockIcon.d.ts +6 -0
  19. package/dist-types/draw-canvas/NodeComponent.d.ts +3 -1
  20. package/dist-types/draw-canvas/decorators/DecoratorArea.d.ts +1 -1
  21. package/dist-types/draw-canvas/decorators/DecoratorContainer.d.ts +1 -1
  22. package/dist-types/draw-canvas/decorators/DecoratorLine.d.ts +2 -2
  23. package/dist-types/draw-canvas/decorators/DecoratorRect.d.ts +1 -1
  24. package/dist-types/draw-canvas/decorators/DecoratorText.d.ts +2 -2
  25. package/dist-types/draw-canvas/decorators/index.d.ts +1 -1
  26. package/dist-types/draw-canvas/index.d.ts +28 -0
  27. package/dist-types/draw-canvas/interfaces.d.ts +23 -0
  28. package/dist-types/draw-canvas/processors/getContentEditable.d.ts +2 -0
  29. package/dist-types/draw-canvas/processors/getLineLockIconPosition.d.ts +2 -0
  30. package/dist-types/draw-canvas/processors/getLineLockIconPosition.spec.d.ts +1 -0
  31. package/dist-types/draw-canvas/processors/handleKeyboard.d.ts +2 -1
  32. package/dist-types/draw-canvas/processors/isLocked.d.ts +3 -0
  33. package/dist-types/draw-canvas/processors/toggleLock.d.ts +5 -0
  34. package/dist-types/draw-canvas/processors/toggleLock.spec.d.ts +1 -0
  35. package/docs/eo-draw-canvas.md +42 -19
  36. package/package.json +3 -3
  37. package/dist/chunks/9024.7b4f6cb7.js +0 -2
  38. package/dist/chunks/9024.7b4f6cb7.js.map +0 -1
  39. package/dist/chunks/9711.c17794d0.js +0 -2
  40. package/dist/chunks/9711.c17794d0.js.map +0 -1
  41. package/dist/chunks/eo-draw-canvas.f4591339.js +0 -2
  42. package/dist/chunks/eo-draw-canvas.f4591339.js.map +0 -1
package/dist/types.json CHANGED
@@ -844,6 +844,19 @@
844
844
  },
845
845
  "optional": true,
846
846
  "computed": false
847
+ },
848
+ {
849
+ "type": "propertySignature",
850
+ "key": {
851
+ "type": "identifier",
852
+ "name": "locked"
853
+ },
854
+ "annotation": {
855
+ "type": "keyword",
856
+ "value": "boolean"
857
+ },
858
+ "optional": true,
859
+ "computed": false
847
860
  }
848
861
  ]
849
862
  },
@@ -1053,6 +1066,19 @@
1053
1066
  },
1054
1067
  "optional": true,
1055
1068
  "computed": false
1069
+ },
1070
+ {
1071
+ "type": "propertySignature",
1072
+ "key": {
1073
+ "type": "identifier",
1074
+ "name": "locked"
1075
+ },
1076
+ "annotation": {
1077
+ "type": "keyword",
1078
+ "value": "boolean"
1079
+ },
1080
+ "optional": true,
1081
+ "computed": false
1056
1082
  }
1057
1083
  ],
1058
1084
  "extends": [
@@ -1533,7 +1559,8 @@
1533
1559
  },
1534
1560
  "optional": true,
1535
1561
  "computed": false,
1536
- "description": ""
1562
+ "description": "",
1563
+ "default": "10"
1537
1564
  }
1538
1565
  ]
1539
1566
  },
@@ -1553,7 +1580,8 @@
1553
1580
  },
1554
1581
  "optional": true,
1555
1582
  "computed": false,
1556
- "description": ""
1583
+ "description": "",
1584
+ "default": "5"
1557
1585
  },
1558
1586
  {
1559
1587
  "type": "propertySignature",
@@ -1567,7 +1595,8 @@
1567
1595
  },
1568
1596
  "optional": true,
1569
1597
  "computed": false,
1570
- "description": "默认为 \"all\",在中心、上下左右共五个位置进行对齐。\n设置为 \"center\" 表示只对中心进行对齐。\n可以按顺序设置对齐位置,例如 \"center top bottom\" 表示只对中心和上下共三个位置进行对齐。"
1598
+ "description": "默认为 \"all\",在中心、上下左右共五个位置进行对齐。\n设置为 \"center\" 表示只对中心进行对齐。\n可以按顺序设置对齐位置,例如 \"center top bottom\" 表示只对中心和上下共三个位置进行对齐。",
1599
+ "default": "\"all\""
1571
1600
  }
1572
1601
  ]
1573
1602
  },
@@ -1720,7 +1749,8 @@
1720
1749
  },
1721
1750
  "optional": true,
1722
1751
  "computed": false,
1723
- "description": "根据节点什么位置进行对齐,支持关键字、百分比和比例值。\n第一个值为 x 轴,第二个值为 y 轴。\n使用数字时,表示相对于节点的宽高的比例。\n\n注意,节点宽高将包含 nodePadding 的值。"
1752
+ "description": "根据节点什么位置进行对齐,支持关键字、百分比和比例值。\n第一个值为 x 轴,第二个值为 y 轴。\n使用数字时,表示相对于节点的宽高的比例。\n\n注意,节点宽高将包含 nodePadding 的值。",
1753
+ "default": "[\"center\",\"center\"]"
1724
1754
  }
1725
1755
  ],
1726
1756
  "extends": [
@@ -1805,7 +1835,8 @@
1805
1835
  ]
1806
1836
  },
1807
1837
  "optional": true,
1808
- "computed": false
1838
+ "computed": false,
1839
+ "description": "设置碰撞参数"
1809
1840
  }
1810
1841
  ],
1811
1842
  "extends": [
@@ -1833,7 +1864,9 @@
1833
1864
  "value": "number"
1834
1865
  },
1835
1866
  "optional": true,
1836
- "computed": false
1867
+ "computed": false,
1868
+ "description": "在计算节点碰撞关系时,节点半径 = 节点固有半径 + radiusDiff。\n\n其中,节点固有半径 = 节点矩形对角线长度 / 2。",
1869
+ "default": "18"
1837
1870
  },
1838
1871
  {
1839
1872
  "type": "propertySignature",
@@ -1846,7 +1879,9 @@
1846
1879
  "value": "number"
1847
1880
  },
1848
1881
  "optional": true,
1849
- "computed": false
1882
+ "computed": false,
1883
+ "description": "See https://d3js.org/d3-force/collide#collide_strength",
1884
+ "default": "1"
1850
1885
  },
1851
1886
  {
1852
1887
  "type": "propertySignature",
@@ -1859,7 +1894,9 @@
1859
1894
  "value": "number"
1860
1895
  },
1861
1896
  "optional": true,
1862
- "computed": false
1897
+ "computed": false,
1898
+ "description": "See https://d3js.org/d3-force/collide#collide_iterations",
1899
+ "default": "1"
1863
1900
  }
1864
1901
  ]
1865
1902
  },
@@ -2692,6 +2729,20 @@
2692
2729
  "value": "number"
2693
2730
  },
2694
2731
  "computed": false
2732
+ },
2733
+ {
2734
+ "type": "propertySignature",
2735
+ "key": {
2736
+ "type": "identifier",
2737
+ "name": "locked"
2738
+ },
2739
+ "annotation": {
2740
+ "type": "keyword",
2741
+ "value": "boolean"
2742
+ },
2743
+ "optional": true,
2744
+ "computed": false,
2745
+ "description": "该元素或其容器是否处于锁定状态"
2695
2746
  }
2696
2747
  ]
2697
2748
  },
@@ -5242,6 +5293,150 @@
5242
5293
  "name": "reCenter",
5243
5294
  "params": [],
5244
5295
  "returns": {}
5296
+ },
5297
+ {
5298
+ "name": "toggleLock",
5299
+ "params": [
5300
+ {
5301
+ "name": "target",
5302
+ "annotation": {
5303
+ "type": "reference",
5304
+ "typeName": {
5305
+ "type": "identifier",
5306
+ "name": "ActiveTarget"
5307
+ }
5308
+ }
5309
+ }
5310
+ ],
5311
+ "returns": {
5312
+ "annotation": {
5313
+ "type": "reference",
5314
+ "typeName": {
5315
+ "type": "identifier",
5316
+ "name": "Promise"
5317
+ },
5318
+ "typeParameters": {
5319
+ "type": "typeParameterInstantiation",
5320
+ "params": [
5321
+ {
5322
+ "type": "union",
5323
+ "types": [
5324
+ {
5325
+ "type": "array",
5326
+ "elementType": {
5327
+ "type": "reference",
5328
+ "typeName": {
5329
+ "type": "identifier",
5330
+ "name": "Cell"
5331
+ }
5332
+ }
5333
+ },
5334
+ {
5335
+ "type": "keyword",
5336
+ "value": "null"
5337
+ }
5338
+ ]
5339
+ }
5340
+ ]
5341
+ }
5342
+ }
5343
+ }
5344
+ },
5345
+ {
5346
+ "name": "lock",
5347
+ "params": [
5348
+ {
5349
+ "name": "target",
5350
+ "annotation": {
5351
+ "type": "reference",
5352
+ "typeName": {
5353
+ "type": "identifier",
5354
+ "name": "ActiveTarget"
5355
+ }
5356
+ }
5357
+ }
5358
+ ],
5359
+ "returns": {
5360
+ "annotation": {
5361
+ "type": "reference",
5362
+ "typeName": {
5363
+ "type": "identifier",
5364
+ "name": "Promise"
5365
+ },
5366
+ "typeParameters": {
5367
+ "type": "typeParameterInstantiation",
5368
+ "params": [
5369
+ {
5370
+ "type": "union",
5371
+ "types": [
5372
+ {
5373
+ "type": "array",
5374
+ "elementType": {
5375
+ "type": "reference",
5376
+ "typeName": {
5377
+ "type": "identifier",
5378
+ "name": "Cell"
5379
+ }
5380
+ }
5381
+ },
5382
+ {
5383
+ "type": "keyword",
5384
+ "value": "null"
5385
+ }
5386
+ ]
5387
+ }
5388
+ ]
5389
+ }
5390
+ }
5391
+ }
5392
+ },
5393
+ {
5394
+ "name": "unlock",
5395
+ "params": [
5396
+ {
5397
+ "name": "target",
5398
+ "annotation": {
5399
+ "type": "reference",
5400
+ "typeName": {
5401
+ "type": "identifier",
5402
+ "name": "ActiveTarget"
5403
+ }
5404
+ }
5405
+ }
5406
+ ],
5407
+ "returns": {
5408
+ "annotation": {
5409
+ "type": "reference",
5410
+ "typeName": {
5411
+ "type": "identifier",
5412
+ "name": "Promise"
5413
+ },
5414
+ "typeParameters": {
5415
+ "type": "typeParameterInstantiation",
5416
+ "params": [
5417
+ {
5418
+ "type": "union",
5419
+ "types": [
5420
+ {
5421
+ "type": "array",
5422
+ "elementType": {
5423
+ "type": "reference",
5424
+ "typeName": {
5425
+ "type": "identifier",
5426
+ "name": "Cell"
5427
+ }
5428
+ }
5429
+ },
5430
+ {
5431
+ "type": "keyword",
5432
+ "value": "null"
5433
+ }
5434
+ ]
5435
+ }
5436
+ ]
5437
+ }
5438
+ }
5439
+ }
5245
5440
  }
5246
5441
  ],
5247
5442
  "types": [
@@ -5623,6 +5818,19 @@
5623
5818
  },
5624
5819
  "optional": true,
5625
5820
  "computed": false
5821
+ },
5822
+ {
5823
+ "type": "propertySignature",
5824
+ "key": {
5825
+ "type": "identifier",
5826
+ "name": "locked"
5827
+ },
5828
+ "annotation": {
5829
+ "type": "keyword",
5830
+ "value": "boolean"
5831
+ },
5832
+ "optional": true,
5833
+ "computed": false
5626
5834
  }
5627
5835
  ]
5628
5836
  },
@@ -5832,6 +6040,19 @@
5832
6040
  },
5833
6041
  "optional": true,
5834
6042
  "computed": false
6043
+ },
6044
+ {
6045
+ "type": "propertySignature",
6046
+ "key": {
6047
+ "type": "identifier",
6048
+ "name": "locked"
6049
+ },
6050
+ "annotation": {
6051
+ "type": "keyword",
6052
+ "value": "boolean"
6053
+ },
6054
+ "optional": true,
6055
+ "computed": false
5835
6056
  }
5836
6057
  ],
5837
6058
  "extends": [
@@ -6312,7 +6533,8 @@
6312
6533
  },
6313
6534
  "optional": true,
6314
6535
  "computed": false,
6315
- "description": ""
6536
+ "description": "",
6537
+ "default": "10"
6316
6538
  }
6317
6539
  ]
6318
6540
  },
@@ -6332,7 +6554,8 @@
6332
6554
  },
6333
6555
  "optional": true,
6334
6556
  "computed": false,
6335
- "description": ""
6557
+ "description": "",
6558
+ "default": "5"
6336
6559
  },
6337
6560
  {
6338
6561
  "type": "propertySignature",
@@ -6346,7 +6569,8 @@
6346
6569
  },
6347
6570
  "optional": true,
6348
6571
  "computed": false,
6349
- "description": "默认为 \"all\",在中心、上下左右共五个位置进行对齐。\n设置为 \"center\" 表示只对中心进行对齐。\n可以按顺序设置对齐位置,例如 \"center top bottom\" 表示只对中心和上下共三个位置进行对齐。"
6572
+ "description": "默认为 \"all\",在中心、上下左右共五个位置进行对齐。\n设置为 \"center\" 表示只对中心进行对齐。\n可以按顺序设置对齐位置,例如 \"center top bottom\" 表示只对中心和上下共三个位置进行对齐。",
6573
+ "default": "\"all\""
6350
6574
  }
6351
6575
  ]
6352
6576
  },
@@ -6499,7 +6723,8 @@
6499
6723
  },
6500
6724
  "optional": true,
6501
6725
  "computed": false,
6502
- "description": "根据节点什么位置进行对齐,支持关键字、百分比和比例值。\n第一个值为 x 轴,第二个值为 y 轴。\n使用数字时,表示相对于节点的宽高的比例。\n\n注意,节点宽高将包含 nodePadding 的值。"
6726
+ "description": "根据节点什么位置进行对齐,支持关键字、百分比和比例值。\n第一个值为 x 轴,第二个值为 y 轴。\n使用数字时,表示相对于节点的宽高的比例。\n\n注意,节点宽高将包含 nodePadding 的值。",
6727
+ "default": "[\"center\",\"center\"]"
6503
6728
  }
6504
6729
  ],
6505
6730
  "extends": [
@@ -6584,7 +6809,8 @@
6584
6809
  ]
6585
6810
  },
6586
6811
  "optional": true,
6587
- "computed": false
6812
+ "computed": false,
6813
+ "description": "设置碰撞参数"
6588
6814
  }
6589
6815
  ],
6590
6816
  "extends": [
@@ -6612,7 +6838,9 @@
6612
6838
  "value": "number"
6613
6839
  },
6614
6840
  "optional": true,
6615
- "computed": false
6841
+ "computed": false,
6842
+ "description": "在计算节点碰撞关系时,节点半径 = 节点固有半径 + radiusDiff。\n\n其中,节点固有半径 = 节点矩形对角线长度 / 2。",
6843
+ "default": "18"
6616
6844
  },
6617
6845
  {
6618
6846
  "type": "propertySignature",
@@ -6625,7 +6853,9 @@
6625
6853
  "value": "number"
6626
6854
  },
6627
6855
  "optional": true,
6628
- "computed": false
6856
+ "computed": false,
6857
+ "description": "See https://d3js.org/d3-force/collide#collide_strength",
6858
+ "default": "1"
6629
6859
  },
6630
6860
  {
6631
6861
  "type": "propertySignature",
@@ -6638,7 +6868,9 @@
6638
6868
  "value": "number"
6639
6869
  },
6640
6870
  "optional": true,
6641
- "computed": false
6871
+ "computed": false,
6872
+ "description": "See https://d3js.org/d3-force/collide#collide_iterations",
6873
+ "default": "1"
6642
6874
  }
6643
6875
  ]
6644
6876
  },
@@ -7899,6 +8131,20 @@
7899
8131
  "value": "number"
7900
8132
  },
7901
8133
  "computed": false
8134
+ },
8135
+ {
8136
+ "type": "propertySignature",
8137
+ "key": {
8138
+ "type": "identifier",
8139
+ "name": "locked"
8140
+ },
8141
+ "annotation": {
8142
+ "type": "keyword",
8143
+ "value": "boolean"
8144
+ },
8145
+ "optional": true,
8146
+ "computed": false,
8147
+ "description": "该元素或其容器是否处于锁定状态"
7902
8148
  }
7903
8149
  ]
7904
8150
  },
@@ -8287,7 +8533,8 @@
8287
8533
  },
8288
8534
  "optional": true,
8289
8535
  "computed": false,
8290
- "description": "Line decorator only: setting initial source position related to (0, 0)"
8536
+ "description": "Line decorator only: setting initial source position related to (0, 0)",
8537
+ "default": "{x:-30,y:30}"
8291
8538
  },
8292
8539
  {
8293
8540
  "type": "propertySignature",
@@ -8304,7 +8551,8 @@
8304
8551
  },
8305
8552
  "optional": true,
8306
8553
  "computed": false,
8307
- "description": "Line decorator only: setting initial source position related to (0, 0)"
8554
+ "description": "Line decorator only: setting initial source position related to (0, 0)",
8555
+ "default": "{x:30,y:-30}"
8308
8556
  },
8309
8557
  {
8310
8558
  "type": "propertySignature",
@@ -19,6 +19,8 @@ export interface CellComponentProps {
19
19
  dragoverContainer?: boolean;
20
20
  allowEdgeToArea?: boolean;
21
21
  curActiveEditableLine?: EditableLineCell | null;
22
+ locked?: boolean;
23
+ containerLocked?: boolean;
22
24
  updateCurActiveEditableLine?: (activeEditableLine: EditableLineCell | null) => void;
23
25
  onCellsMoving?(info: MoveCellPayload[]): void;
24
26
  onCellsMoved?(info: MoveCellPayload[]): void;
@@ -36,4 +38,4 @@ export interface CellComponentProps {
36
38
  onCellMouseEnter?(cell: Cell): void;
37
39
  onCellMouseLeave?(cell: Cell): void;
38
40
  }
39
- export declare function CellComponent({ layout, layoutOptions, cell, cells, degraded, degradedNodeLabel, defaultNodeBricks, lineConfMap, editableLineMap, activeTarget, dragoverContainer, readOnly, transform, hoverCell, unrelatedCells, allowEdgeToArea, curActiveEditableLine, updateCurActiveEditableLine, onCellsMoving, onCellsMoved, onCellResizing, onCellResized, onSwitchActiveTarget, onCellContextMenu, onCellClick, onDecoratorTextEditing, onDecoratorTextChange, onNodeBrickResize, onCellMouseEnter, onCellMouseLeave, }: CellComponentProps): JSX.Element | null;
41
+ export declare function CellComponent({ layout, layoutOptions, cell, cells, degraded, degradedNodeLabel, defaultNodeBricks, lineConfMap, editableLineMap, activeTarget, dragoverContainer, readOnly, transform, hoverCell, unrelatedCells, allowEdgeToArea, curActiveEditableLine, locked, containerLocked, updateCurActiveEditableLine, onCellsMoving, onCellsMoved, onCellResizing, onCellResized, onSwitchActiveTarget, onCellContextMenu, onCellClick, onDecoratorTextEditing, onDecoratorTextChange, onNodeBrickResize, onCellMouseEnter, onCellMouseLeave, }: CellComponentProps): JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export interface LockIconProps {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export declare function LockIcon({ x, y }: LockIconProps): React.JSX.Element;
@@ -7,6 +7,8 @@ export interface NodeComponentProps {
7
7
  degraded: boolean;
8
8
  degradedNodeLabel?: string;
9
9
  defaultNodeBricks?: NodeBrickConf[];
10
+ locked?: boolean;
11
+ containerLocked?: boolean;
10
12
  onResize(id: string, size: SizeTuple | null): void;
11
13
  }
12
- export declare function NodeComponent({ node, x, y, degraded, degradedNodeLabel, defaultNodeBricks, onResize, }: NodeComponentProps): JSX.Element | null;
14
+ export declare function NodeComponent({ node, x, y, degraded, degradedNodeLabel, defaultNodeBricks, locked, containerLocked, onResize, }: NodeComponentProps): JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
- export declare function DecoratorArea({ cell, transform, readOnly, layoutOptions, activeTarget, cells, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element;
2
+ export declare function DecoratorArea({ cell, transform, readOnly, layoutOptions, activeTarget, cells, locked, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
- export declare function DecoratorContainer({ cell, transform, readOnly, layout, view, activeTarget, cells, onCellResizing, onCellResized, onSwitchActiveTarget, onDecoratorTextEditing, onDecoratorTextChange, }: BasicDecoratorProps): JSX.Element;
2
+ export declare function DecoratorContainer({ cell, transform, readOnly, layout, view, activeTarget, cells, locked, onCellResizing, onCellResized, onSwitchActiveTarget, onDecoratorTextEditing, onDecoratorTextChange, }: BasicDecoratorProps): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
- export type DecoratorLineProps = Pick<BasicDecoratorProps, "cell" | "active" | "lineConfMap" | "editableLineMap">;
3
- export declare function DecoratorLine({ cell, active, lineConfMap, editableLineMap, }: DecoratorLineProps): JSX.Element | null;
2
+ export type DecoratorLineProps = Pick<BasicDecoratorProps, "cell" | "active" | "locked" | "lineConfMap" | "editableLineMap">;
3
+ export declare function DecoratorLine({ cell, active, lineConfMap, editableLineMap, locked, }: DecoratorLineProps): JSX.Element | null;
@@ -1,3 +1,3 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
2
  export type DecoratorRectProps = Omit<BasicDecoratorProps, "lineConfMap" | "editableLineMap">;
3
- export declare function DecoratorRect({ cell, transform, readOnly, layout, view, activeTarget, cells, onCellResizing, onCellResized, onSwitchActiveTarget, }: DecoratorRectProps): JSX.Element;
3
+ export declare function DecoratorRect({ cell, transform, readOnly, layout, view, activeTarget, cells, locked, onCellResizing, onCellResized, onSwitchActiveTarget, }: DecoratorRectProps): JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
- export type DecoratorTextProps = Pick<BasicDecoratorProps, "cell" | "readOnly" | "onDecoratorTextEditing" | "onDecoratorTextChange">;
3
- export declare function DecoratorText({ cell, readOnly, onDecoratorTextEditing, onDecoratorTextChange, }: DecoratorTextProps): JSX.Element;
2
+ export type DecoratorTextProps = Pick<BasicDecoratorProps, "cell" | "readOnly" | "locked" | "onDecoratorTextEditing" | "onDecoratorTextChange">;
3
+ export declare function DecoratorText({ cell, readOnly, locked, onDecoratorTextEditing, onDecoratorTextChange, }: DecoratorTextProps): JSX.Element;
4
4
  export declare function selectAllText(element: HTMLElement): void;
@@ -1,2 +1,2 @@
1
1
  import type { BasicDecoratorProps } from "../interfaces";
2
- export declare function DecoratorComponent({ cell, view, transform, readOnly, layout, layoutOptions, active, activeTarget, cells, lineConfMap, editableLineMap, onCellResizing, onCellResized, onSwitchActiveTarget, onDecoratorTextEditing, onDecoratorTextChange, }: BasicDecoratorProps): JSX.Element | null;
2
+ export declare function DecoratorComponent({ cell, view, transform, readOnly, layout, layoutOptions, active, activeTarget, cells, lineConfMap, editableLineMap, locked, onCellResizing, onCellResized, onSwitchActiveTarget, onDecoratorTextEditing, onDecoratorTextChange, }: BasicDecoratorProps): JSX.Element | null;
@@ -160,6 +160,33 @@ export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanv
160
160
  updated: Cell[];
161
161
  }>;
162
162
  reCenter(): Promise<void>;
163
+ /**
164
+ * 切换锁定状态。
165
+ *
166
+ * 如果目标中包含未锁定且可以锁定的元素,则将这些元素锁定;
167
+ * 否则,如果目标中包含已锁定且可以解锁的元素,则将这些元素解锁;
168
+ * 否则,不执行任何操作。
169
+ *
170
+ * 另,如果容器当前处于锁定状态,其子节点不可执行锁定或解锁操作。
171
+ *
172
+ * @param target 当前选中的目标
173
+ * @returns 有更新的元素列表,其中仅 view 信息有变更
174
+ */
175
+ toggleLock(target: ActiveTarget): Promise<Cell[] | null>;
176
+ /**
177
+ * 锁定选中的目标。规则类似 `toggleLock`,但仅执行锁定操作。
178
+ *
179
+ * @param target 当前选中的目标
180
+ * @returns 有更新的元素列表,其中仅 view 信息有变更
181
+ */
182
+ lock(target: ActiveTarget): Promise<Cell[] | null>;
183
+ /**
184
+ * 解锁选中的目标。规则类似 `toggleLock`,但仅执行解锁操作。
185
+ *
186
+ * @param target 当前选中的目标
187
+ * @returns 有更新的元素列表,其中仅 view 信息有变更
188
+ */
189
+ unlock(target: ActiveTarget): Promise<Cell[] | null>;
163
190
  disconnectedCallback(): void;
164
191
  render(): React.JSX.Element;
165
192
  }
@@ -196,5 +223,6 @@ export interface DrawCanvasRef {
196
223
  };
197
224
  getTransform(): TransformLiteral;
198
225
  reCenter(): void;
226
+ toggleLock(target: ActiveTarget, type: "toggle" | "lock" | "unlock"): Cell[] | null;
199
227
  }
200
228
  export declare function uuidV4(): string;
@@ -72,6 +72,7 @@ export interface InitialNodeView {
72
72
  y: number;
73
73
  width?: number;
74
74
  height?: number;
75
+ locked?: boolean;
75
76
  }
76
77
  export type InitialNodeCell = Omit<NodeCell, "view"> & {
77
78
  view?: InitialNodeView;
@@ -89,6 +90,7 @@ export interface EdgeView extends LineSettings {
89
90
  y?: number;
90
91
  width?: number;
91
92
  height?: number;
93
+ locked?: boolean;
92
94
  }
93
95
  export interface EdgeLineConf extends BaseEdgeLineConf {
94
96
  if?: string | boolean | null;
@@ -196,6 +198,7 @@ export interface BasicDecoratorProps {
196
198
  cells: Cell[];
197
199
  lineConfMap: WeakMap<EditableLineCell, ComputedEdgeLineConf>;
198
200
  editableLineMap: WeakMap<EditableLineCell, EditableLine>;
201
+ locked?: boolean;
199
202
  onCellResizing?(info: ResizeCellPayload): void;
200
203
  onCellResized?(info: ResizeCellPayload): void;
201
204
  onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;
@@ -209,6 +212,8 @@ export interface CellContextMenuDetail {
209
212
  cell: Cell;
210
213
  clientX: number;
211
214
  clientY: number;
215
+ /** 该元素或其容器是否处于锁定状态 */
216
+ locked?: boolean;
212
217
  }
213
218
  export interface ConnectLineState {
214
219
  source: NodeCell | DecoratorCell;
@@ -273,11 +278,29 @@ export interface LayoutOptionsDagre extends BaseLayoutOptions {
273
278
  align?: "UL" | "UR" | "DL" | "DR";
274
279
  }
275
280
  export interface LayoutOptionsForce extends BaseLayoutOptions {
281
+ /** 设置碰撞参数 */
276
282
  collide?: boolean | ForceCollideOptions;
277
283
  }
278
284
  export interface ForceCollideOptions {
285
+ /**
286
+ * 在计算节点碰撞关系时,节点半径 = 节点固有半径 + radiusDiff。
287
+ *
288
+ * 其中,节点固有半径 = 节点矩形对角线长度 / 2。
289
+ *
290
+ * @default 18
291
+ */
279
292
  radiusDiff?: number;
293
+ /**
294
+ * See https://d3js.org/d3-force/collide#collide_strength
295
+ *
296
+ * @default 1
297
+ */
280
298
  strength?: number;
299
+ /**
300
+ * See https://d3js.org/d3-force/collide#collide_iterations
301
+ *
302
+ * @default 1
303
+ */
281
304
  iterations?: number;
282
305
  }
283
306
  export interface BaseLayoutOptions extends LayoutSnapOptions {
@@ -0,0 +1,2 @@
1
+ import type { HTMLAttributes } from "react";
2
+ export declare function getContentEditable(editable: boolean): HTMLAttributes<HTMLDivElement>["contentEditable"];
@@ -0,0 +1,2 @@
1
+ import type { NodePosition } from "../../diagram/interfaces";
2
+ export declare function getLineLockIconPosition(linePoints: NodePosition[]): NodePosition;
@@ -4,7 +4,8 @@ export interface KeyboardActionDeleteCells {
4
4
  action: "delete-cells";
5
5
  cells: Cell[];
6
6
  }
7
- export declare function handleKeyboard(event: KeyboardEvent, { cells, activeTarget, }: {
7
+ export declare function handleKeyboard(event: KeyboardEvent, { cells, activeTarget, lockedContainerIds, }: {
8
8
  cells: Cell[];
9
9
  activeTarget: ActiveTarget | null | undefined;
10
+ lockedContainerIds?: string[];
10
11
  }): KeyboardAction | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Cell } from "../interfaces";
2
+ export declare function getLockedContainerIds(cells: Cell[]): string[];
3
+ export declare function isLocked(cell: Cell, lockedContainerIds: string[] | undefined): boolean;
@@ -0,0 +1,5 @@
1
+ import type { ActiveTarget, Cell } from "../interfaces";
2
+ export declare function toggleLock(target: ActiveTarget, type: "toggle" | "lock" | "unlock", cells: Cell[], lockedContainerIds: string[]): {
3
+ newCells: Cell[] | null;
4
+ updates: Cell[];
5
+ };