@next-bricks/diagram 0.30.0 → 0.31.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.
package/dist/types.json CHANGED
@@ -1,4 +1,71 @@
1
1
  {
2
+ "diagram.editable-label": {
3
+ "properties": [
4
+ {
5
+ "name": "label",
6
+ "annotation": {
7
+ "type": "keyword",
8
+ "value": "string"
9
+ }
10
+ },
11
+ {
12
+ "name": "type",
13
+ "annotation": {
14
+ "type": "reference",
15
+ "typeName": {
16
+ "type": "identifier",
17
+ "name": "LabelType"
18
+ }
19
+ }
20
+ }
21
+ ],
22
+ "events": [
23
+ {
24
+ "name": "label.editing.change",
25
+ "detail": {
26
+ "annotation": {
27
+ "type": "keyword",
28
+ "value": "boolean"
29
+ }
30
+ }
31
+ },
32
+ {
33
+ "name": "label.change",
34
+ "detail": {
35
+ "annotation": {
36
+ "type": "keyword",
37
+ "value": "string"
38
+ }
39
+ }
40
+ }
41
+ ],
42
+ "methods": [
43
+ {
44
+ "name": "enableEditing",
45
+ "params": [],
46
+ "returns": {}
47
+ }
48
+ ],
49
+ "types": [
50
+ {
51
+ "type": "typeAlias",
52
+ "name": "LabelType",
53
+ "annotation": {
54
+ "type": "union",
55
+ "types": [
56
+ {
57
+ "type": "jsLiteral",
58
+ "value": "line"
59
+ },
60
+ {
61
+ "type": "jsLiteral",
62
+ "value": "default"
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
68
+ },
2
69
  "diagram.experimental-node": {
3
70
  "properties": [
4
71
  {
@@ -160,73 +227,6 @@
160
227
  }
161
228
  ]
162
229
  },
163
- "diagram.editable-label": {
164
- "properties": [
165
- {
166
- "name": "label",
167
- "annotation": {
168
- "type": "keyword",
169
- "value": "string"
170
- }
171
- },
172
- {
173
- "name": "type",
174
- "annotation": {
175
- "type": "reference",
176
- "typeName": {
177
- "type": "identifier",
178
- "name": "LabelType"
179
- }
180
- }
181
- }
182
- ],
183
- "events": [
184
- {
185
- "name": "label.editing.change",
186
- "detail": {
187
- "annotation": {
188
- "type": "keyword",
189
- "value": "boolean"
190
- }
191
- }
192
- },
193
- {
194
- "name": "label.change",
195
- "detail": {
196
- "annotation": {
197
- "type": "keyword",
198
- "value": "string"
199
- }
200
- }
201
- }
202
- ],
203
- "methods": [
204
- {
205
- "name": "enableEditing",
206
- "params": [],
207
- "returns": {}
208
- }
209
- ],
210
- "types": [
211
- {
212
- "type": "typeAlias",
213
- "name": "LabelType",
214
- "annotation": {
215
- "type": "union",
216
- "types": [
217
- {
218
- "type": "jsLiteral",
219
- "value": "line"
220
- },
221
- {
222
- "type": "jsLiteral",
223
- "value": "default"
224
- }
225
- ]
226
- }
227
- }
228
- ]
229
- },
230
230
  "eo-draw-canvas": {
231
231
  "properties": [
232
232
  {
@@ -1692,7 +1692,50 @@
1692
1692
  },
1693
1693
  "optional": true,
1694
1694
  "computed": false
1695
- },
1695
+ }
1696
+ ],
1697
+ "extends": [
1698
+ {
1699
+ "type": "expressionWithTypeArguments",
1700
+ "expression": {
1701
+ "type": "identifier",
1702
+ "name": "Omit"
1703
+ },
1704
+ "typeParameters": {
1705
+ "type": "typeParameterInstantiation",
1706
+ "params": [
1707
+ {
1708
+ "type": "reference",
1709
+ "typeName": {
1710
+ "type": "identifier",
1711
+ "name": "Partial"
1712
+ },
1713
+ "typeParameters": {
1714
+ "type": "typeParameterInstantiation",
1715
+ "params": [
1716
+ {
1717
+ "type": "reference",
1718
+ "typeName": {
1719
+ "type": "identifier",
1720
+ "name": "ComputedEdgeLineConf"
1721
+ }
1722
+ }
1723
+ ]
1724
+ }
1725
+ },
1726
+ {
1727
+ "type": "jsLiteral",
1728
+ "value": "markerArrow"
1729
+ }
1730
+ ]
1731
+ }
1732
+ }
1733
+ ]
1734
+ },
1735
+ {
1736
+ "type": "interface",
1737
+ "name": "ComputedEdgeLineConf",
1738
+ "body": [
1696
1739
  {
1697
1740
  "type": "propertySignature",
1698
1741
  "key": {
@@ -1703,7 +1746,6 @@
1703
1746
  "type": "keyword",
1704
1747
  "value": "boolean"
1705
1748
  },
1706
- "optional": true,
1707
1749
  "computed": false
1708
1750
  },
1709
1751
  {
@@ -1716,7 +1758,6 @@
1716
1758
  "type": "keyword",
1717
1759
  "value": "number"
1718
1760
  },
1719
- "optional": true,
1720
1761
  "computed": false
1721
1762
  },
1722
1763
  {
@@ -1729,7 +1770,6 @@
1729
1770
  "type": "keyword",
1730
1771
  "value": "string"
1731
1772
  },
1732
- "optional": true,
1733
1773
  "computed": false
1734
1774
  },
1735
1775
  {
@@ -1742,7 +1782,111 @@
1742
1782
  "type": "keyword",
1743
1783
  "value": "number"
1744
1784
  },
1745
- "optional": true,
1785
+ "computed": false
1786
+ },
1787
+ {
1788
+ "type": "propertySignature",
1789
+ "key": {
1790
+ "type": "identifier",
1791
+ "name": "parallelGap"
1792
+ },
1793
+ "annotation": {
1794
+ "type": "keyword",
1795
+ "value": "number"
1796
+ },
1797
+ "computed": false
1798
+ },
1799
+ {
1800
+ "type": "propertySignature",
1801
+ "key": {
1802
+ "type": "identifier",
1803
+ "name": "markerEnd"
1804
+ },
1805
+ "annotation": {
1806
+ "type": "keyword",
1807
+ "value": "string"
1808
+ },
1809
+ "computed": false
1810
+ },
1811
+ {
1812
+ "type": "propertySignature",
1813
+ "key": {
1814
+ "type": "identifier",
1815
+ "name": "markerArrow"
1816
+ },
1817
+ "annotation": {
1818
+ "type": "keyword",
1819
+ "value": "string"
1820
+ },
1821
+ "computed": false
1822
+ },
1823
+ {
1824
+ "type": "propertySignature",
1825
+ "key": {
1826
+ "type": "identifier",
1827
+ "name": "showStartArrow"
1828
+ },
1829
+ "annotation": {
1830
+ "type": "keyword",
1831
+ "value": "boolean"
1832
+ },
1833
+ "computed": false
1834
+ },
1835
+ {
1836
+ "type": "propertySignature",
1837
+ "key": {
1838
+ "type": "identifier",
1839
+ "name": "showEndArrow"
1840
+ },
1841
+ "annotation": {
1842
+ "type": "keyword",
1843
+ "value": "boolean"
1844
+ },
1845
+ "computed": false
1846
+ },
1847
+ {
1848
+ "type": "propertySignature",
1849
+ "key": {
1850
+ "type": "identifier",
1851
+ "name": "animate"
1852
+ },
1853
+ "annotation": {
1854
+ "type": "reference",
1855
+ "typeName": {
1856
+ "type": "identifier",
1857
+ "name": "LineAnimate"
1858
+ }
1859
+ },
1860
+ "computed": false
1861
+ }
1862
+ ]
1863
+ },
1864
+ {
1865
+ "type": "interface",
1866
+ "name": "LineAnimate",
1867
+ "body": [
1868
+ {
1869
+ "type": "propertySignature",
1870
+ "key": {
1871
+ "type": "identifier",
1872
+ "name": "useAnimate"
1873
+ },
1874
+ "annotation": {
1875
+ "type": "keyword",
1876
+ "value": "boolean"
1877
+ },
1878
+ "computed": false
1879
+ },
1880
+ {
1881
+ "type": "propertySignature",
1882
+ "key": {
1883
+ "type": "identifier",
1884
+ "name": "duration"
1885
+ },
1886
+ "annotation": {
1887
+ "type": "keyword",
1888
+ "value": "number"
1889
+ },
1746
1890
  "computed": false
1747
1891
  }
1748
1892
  ]
@@ -5339,7 +5483,50 @@
5339
5483
  },
5340
5484
  "optional": true,
5341
5485
  "computed": false
5342
- },
5486
+ }
5487
+ ],
5488
+ "extends": [
5489
+ {
5490
+ "type": "expressionWithTypeArguments",
5491
+ "expression": {
5492
+ "type": "identifier",
5493
+ "name": "Omit"
5494
+ },
5495
+ "typeParameters": {
5496
+ "type": "typeParameterInstantiation",
5497
+ "params": [
5498
+ {
5499
+ "type": "reference",
5500
+ "typeName": {
5501
+ "type": "identifier",
5502
+ "name": "Partial"
5503
+ },
5504
+ "typeParameters": {
5505
+ "type": "typeParameterInstantiation",
5506
+ "params": [
5507
+ {
5508
+ "type": "reference",
5509
+ "typeName": {
5510
+ "type": "identifier",
5511
+ "name": "ComputedEdgeLineConf"
5512
+ }
5513
+ }
5514
+ ]
5515
+ }
5516
+ },
5517
+ {
5518
+ "type": "jsLiteral",
5519
+ "value": "markerArrow"
5520
+ }
5521
+ ]
5522
+ }
5523
+ }
5524
+ ]
5525
+ },
5526
+ {
5527
+ "type": "interface",
5528
+ "name": "ComputedEdgeLineConf",
5529
+ "body": [
5343
5530
  {
5344
5531
  "type": "propertySignature",
5345
5532
  "key": {
@@ -5350,7 +5537,6 @@
5350
5537
  "type": "keyword",
5351
5538
  "value": "boolean"
5352
5539
  },
5353
- "optional": true,
5354
5540
  "computed": false
5355
5541
  },
5356
5542
  {
@@ -5363,7 +5549,6 @@
5363
5549
  "type": "keyword",
5364
5550
  "value": "number"
5365
5551
  },
5366
- "optional": true,
5367
5552
  "computed": false
5368
5553
  },
5369
5554
  {
@@ -5376,7 +5561,6 @@
5376
5561
  "type": "keyword",
5377
5562
  "value": "string"
5378
5563
  },
5379
- "optional": true,
5380
5564
  "computed": false
5381
5565
  },
5382
5566
  {
@@ -5389,7 +5573,111 @@
5389
5573
  "type": "keyword",
5390
5574
  "value": "number"
5391
5575
  },
5392
- "optional": true,
5576
+ "computed": false
5577
+ },
5578
+ {
5579
+ "type": "propertySignature",
5580
+ "key": {
5581
+ "type": "identifier",
5582
+ "name": "parallelGap"
5583
+ },
5584
+ "annotation": {
5585
+ "type": "keyword",
5586
+ "value": "number"
5587
+ },
5588
+ "computed": false
5589
+ },
5590
+ {
5591
+ "type": "propertySignature",
5592
+ "key": {
5593
+ "type": "identifier",
5594
+ "name": "markerEnd"
5595
+ },
5596
+ "annotation": {
5597
+ "type": "keyword",
5598
+ "value": "string"
5599
+ },
5600
+ "computed": false
5601
+ },
5602
+ {
5603
+ "type": "propertySignature",
5604
+ "key": {
5605
+ "type": "identifier",
5606
+ "name": "markerArrow"
5607
+ },
5608
+ "annotation": {
5609
+ "type": "keyword",
5610
+ "value": "string"
5611
+ },
5612
+ "computed": false
5613
+ },
5614
+ {
5615
+ "type": "propertySignature",
5616
+ "key": {
5617
+ "type": "identifier",
5618
+ "name": "showStartArrow"
5619
+ },
5620
+ "annotation": {
5621
+ "type": "keyword",
5622
+ "value": "boolean"
5623
+ },
5624
+ "computed": false
5625
+ },
5626
+ {
5627
+ "type": "propertySignature",
5628
+ "key": {
5629
+ "type": "identifier",
5630
+ "name": "showEndArrow"
5631
+ },
5632
+ "annotation": {
5633
+ "type": "keyword",
5634
+ "value": "boolean"
5635
+ },
5636
+ "computed": false
5637
+ },
5638
+ {
5639
+ "type": "propertySignature",
5640
+ "key": {
5641
+ "type": "identifier",
5642
+ "name": "animate"
5643
+ },
5644
+ "annotation": {
5645
+ "type": "reference",
5646
+ "typeName": {
5647
+ "type": "identifier",
5648
+ "name": "LineAnimate"
5649
+ }
5650
+ },
5651
+ "computed": false
5652
+ }
5653
+ ]
5654
+ },
5655
+ {
5656
+ "type": "interface",
5657
+ "name": "LineAnimate",
5658
+ "body": [
5659
+ {
5660
+ "type": "propertySignature",
5661
+ "key": {
5662
+ "type": "identifier",
5663
+ "name": "useAnimate"
5664
+ },
5665
+ "annotation": {
5666
+ "type": "keyword",
5667
+ "value": "boolean"
5668
+ },
5669
+ "computed": false
5670
+ },
5671
+ {
5672
+ "type": "propertySignature",
5673
+ "key": {
5674
+ "type": "identifier",
5675
+ "name": "duration"
5676
+ },
5677
+ "annotation": {
5678
+ "type": "keyword",
5679
+ "value": "number"
5680
+ },
5393
5681
  "computed": false
5394
5682
  }
5395
5683
  ]
@@ -1,2 +1,2 @@
1
1
  import type { NodePosition, NodeRect } from "../interfaces";
2
- export declare function getDirectLinePoints(source: NodeRect, target: NodeRect): NodePosition[] | null;
2
+ export declare function getDirectLinePoints(source: NodeRect, target: NodeRect, parallelGap?: number): NodePosition[] | null;
@@ -9,3 +9,6 @@ export declare const DEFAULT_SCALE_RANGE_MAX = 2;
9
9
  export declare const DEFAULT_LINE_STROKE_COLOR = "gray";
10
10
  export declare const DEFAULT_LINE_STROKE_WIDTH = 1;
11
11
  export declare const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;
12
+ export declare const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;
13
+ export declare const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;
14
+ export declare const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;
@@ -57,19 +57,24 @@ export interface NodeBrickConf {
57
57
  useBrick: UseSingleBrickConf;
58
58
  if?: string | boolean | null;
59
59
  }
60
- export interface EdgeLineConf {
60
+ export interface EdgeLineConf extends Omit<Partial<ComputedEdgeLineConf>, "markerArrow"> {
61
61
  if?: string | boolean | null;
62
- dashed?: boolean;
63
- strokeWidth?: number;
64
- strokeColor?: string;
65
- interactStrokeWidth?: number;
62
+ }
63
+ export interface LineAnimate {
64
+ useAnimate: boolean;
65
+ duration: number;
66
66
  }
67
67
  export interface ComputedEdgeLineConf {
68
68
  dashed: boolean;
69
69
  strokeWidth: number;
70
70
  strokeColor: string;
71
71
  interactStrokeWidth: number;
72
+ parallelGap: number;
72
73
  markerEnd: string;
74
+ markerArrow: string;
75
+ showStartArrow: boolean;
76
+ showEndArrow: boolean;
77
+ animate: LineAnimate;
73
78
  }
74
79
  export interface LineMarker {
75
80
  strokeColor: string;
@@ -31,13 +31,38 @@
31
31
  type: "edge",
32
32
  source: "X",
33
33
  target: "Y",
34
+ data: {
35
+ virtual: false,
36
+ showStartArrow: false,
37
+ strokeColor:"red",
38
+ strokeWidth: 5,
39
+ }
34
40
  },
41
+ {
42
+ type: "edge",
43
+ source: "X",
44
+ target: "W",
45
+ data: {
46
+ virtual: false,
47
+ showStartArrow: true,
48
+ strokeColor:"pink",
49
+ animate:{
50
+ useAnimate: true,
51
+ duration: 4
52
+ }
53
+ }
54
+ },
35
55
  {
36
56
  type: "edge",
37
57
  source: "X",
38
58
  target: "Z",
39
59
  data: {
40
60
  virtual: true,
61
+ showStartArrow: true,
62
+ strokeColor:"blue",
63
+ animate:{
64
+ useAnimate: true
65
+ }
41
66
  }
42
67
  },
43
68
  ].concat(
@@ -60,7 +85,7 @@
60
85
  height: 60,
61
86
  }
62
87
  }))
63
- ).concat([
88
+ ).concat([
64
89
  {
65
90
  type: "decorator",
66
91
  id: "text-1",
@@ -72,7 +97,7 @@
72
97
  height: 20,
73
98
  text: "Hello!"
74
99
  },
75
- },
100
+ },
76
101
  ])
77
102
  %>
78
103
  - name: activeTarget
@@ -109,8 +134,12 @@
109
134
  : "default"
110
135
  %>
111
136
  defaultEdgeLines:
112
- - if: <% DATA.edge.data?.virtual %>
113
- dashed: true
137
+ - if: true
138
+ dashed: <% DATA.edge?.data?.virtual %>
139
+ strokeColor: <% DATA.edge?.data?.strokeColor %>
140
+ showStartArrow: <% DATA.edge?.data?.showStartArrow %>
141
+ strokeWidth: <% DATA.edge?.data?.strokeWidth %>
142
+ animate: <% DATA.edge?.data?.animate %>
114
143
  cells: <% CTX.initialCells %>
115
144
  events:
116
145
  activeTarget.change:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/diagram",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/diagram",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,5 +40,5 @@
40
40
  "peerDependencies": {
41
41
  "@next-bricks/basic": "*"
42
42
  },
43
- "gitHead": "4f1b569afce36c5eaad91a2d227ad2055bd2e280"
43
+ "gitHead": "537ea59c98619cda6e8ebdc5cdd9e145979325a7"
44
44
  }