@joint/core 4.2.0-alpha.1 → 4.2.0-beta.2
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/geometry.js +1 -1
- package/dist/geometry.min.js +2 -3
- package/dist/joint.d.ts +321 -55
- package/dist/joint.js +2499 -853
- package/dist/joint.min.js +2 -3
- package/dist/joint.nowrap.js +2499 -853
- package/dist/joint.nowrap.min.js +2 -3
- package/dist/vectorizer.js +1 -1
- package/dist/vectorizer.min.js +2 -3
- package/dist/version.mjs +1 -1
- package/package.json +12 -9
- package/src/config/index.mjs +3 -1
- package/src/dia/Cell.mjs +77 -80
- package/src/dia/CellCollection.mjs +136 -0
- package/src/dia/CellView.mjs +1 -2
- package/src/dia/Element.mjs +2 -3
- package/src/dia/Graph.mjs +610 -317
- package/src/dia/GraphLayer.mjs +53 -0
- package/src/dia/GraphLayerCollection.mjs +313 -0
- package/src/dia/GraphLayerView.mjs +128 -0
- package/src/dia/GraphLayersController.mjs +166 -0
- package/src/dia/GraphTopologyIndex.mjs +222 -0
- package/src/dia/{layers/GridLayer.mjs → GridLayerView.mjs} +23 -16
- package/src/dia/{PaperLayer.mjs → LayerView.mjs} +52 -17
- package/src/dia/LegacyGraphLayerView.mjs +14 -0
- package/src/dia/Paper.mjs +756 -423
- package/src/dia/ToolsView.mjs +3 -3
- package/src/dia/index.mjs +6 -1
- package/src/dia/ports.mjs +11 -2
- package/src/dia/symbols.mjs +24 -0
- package/src/mvc/Collection.mjs +19 -19
- package/src/mvc/Model.mjs +13 -10
- package/types/joint.d.ts +320 -54
package/types/joint.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export namespace config {
|
|
|
10
10
|
var doubleTapInterval: number;
|
|
11
11
|
var cellMergeStrategy: util.MergeCustomizer | null;
|
|
12
12
|
var cellDefaultsMergeStrategy: util.MergeCustomizer | null;
|
|
13
|
+
var layerAttribute: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
type NativeEvent = Event;
|
|
@@ -153,6 +154,89 @@ export namespace dia {
|
|
|
153
154
|
util.filter.FilterJSON<'brightness'> |
|
|
154
155
|
util.filter.FilterJSON<'contrast'>;
|
|
155
156
|
|
|
157
|
+
class CellCollection<C extends Cell = Cell> extends mvc.Collection<C> {
|
|
158
|
+
|
|
159
|
+
cellNamespace: any;
|
|
160
|
+
layer: GraphLayer;
|
|
161
|
+
|
|
162
|
+
minZIndex(): number;
|
|
163
|
+
|
|
164
|
+
maxZIndex(): number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
class GraphLayerCollection<L extends GraphLayer = GraphLayer> extends mvc.Collection<L> {
|
|
168
|
+
|
|
169
|
+
cellNamespace: any;
|
|
170
|
+
layerNamespace: any;
|
|
171
|
+
graph: Graph;
|
|
172
|
+
|
|
173
|
+
insert(layer: Graph.LayerInit, beforeId: GraphLayer.ID | null, opt?: ObjectHash): void;
|
|
174
|
+
|
|
175
|
+
getCell(cellRef: Graph.CellRef): Cell | undefined;
|
|
176
|
+
|
|
177
|
+
getCells(): Cell[];
|
|
178
|
+
|
|
179
|
+
removeCell(cell: Cell, opt?: ObjectHash): void;
|
|
180
|
+
|
|
181
|
+
moveCellBetweenLayers(cell: Cell, targetLayerId: GraphLayer.ID, opt?: ObjectHash): void;
|
|
182
|
+
|
|
183
|
+
addCellToLayer(cell: Cell, layerId: GraphLayer.ID, opt?: ObjectHash): void;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
class GraphLayersController extends mvc.Listener<[]> {
|
|
187
|
+
|
|
188
|
+
graph: Graph;
|
|
189
|
+
|
|
190
|
+
layerCollection: GraphLayerCollection;
|
|
191
|
+
|
|
192
|
+
startListening(): void;
|
|
193
|
+
|
|
194
|
+
protected onCellChange(cell: Cell, opt: ObjectHash): void;
|
|
195
|
+
|
|
196
|
+
protected onCellRemove(cell: Cell, opt: ObjectHash): void;
|
|
197
|
+
|
|
198
|
+
protected onLayerCollectionEvent(eventName: string, ...args: any[]): void;
|
|
199
|
+
|
|
200
|
+
protected forwardLayerEvent(...args: any[]): void;
|
|
201
|
+
|
|
202
|
+
protected forwardCellEvent(...args: any[]): void;
|
|
203
|
+
|
|
204
|
+
protected forwardCellCollectionEvent(...args: any[]): void;
|
|
205
|
+
|
|
206
|
+
protected forwardLayerCollectionEvent(...args: any[]): void;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
class GraphTopologyIndex extends mvc.Listener<[]> {
|
|
210
|
+
|
|
211
|
+
layerCollection: GraphLayerCollection;
|
|
212
|
+
|
|
213
|
+
startListening(): void;
|
|
214
|
+
|
|
215
|
+
getOutboundEdges(id: Cell.ID): { [edgeId: string]: true };
|
|
216
|
+
|
|
217
|
+
getInboundEdges(id: Cell.ID): { [edgeId: string]: true };
|
|
218
|
+
|
|
219
|
+
getSinkNodes(): string[];
|
|
220
|
+
|
|
221
|
+
getSourceNodes(): string[];
|
|
222
|
+
|
|
223
|
+
isSinkNode(id: Cell.ID): boolean;
|
|
224
|
+
|
|
225
|
+
isSourceNode(id: Cell.ID): boolean;
|
|
226
|
+
|
|
227
|
+
protected initializeIndex(): void;
|
|
228
|
+
|
|
229
|
+
protected _restructureOnReset(): void;
|
|
230
|
+
|
|
231
|
+
protected _restructureOnAdd(cell: Cell): void;
|
|
232
|
+
|
|
233
|
+
protected _restructureOnRemove(cell: Cell): void;
|
|
234
|
+
|
|
235
|
+
protected _restructureOnChangeSource(cell: Cell): void;
|
|
236
|
+
|
|
237
|
+
protected _restructureOnChangeTarget(cell: Cell): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
156
240
|
export namespace Graph {
|
|
157
241
|
|
|
158
242
|
interface Options {
|
|
@@ -176,35 +260,100 @@ export namespace dia {
|
|
|
176
260
|
strict?: boolean;
|
|
177
261
|
}
|
|
178
262
|
|
|
263
|
+
interface SyncCellOptions extends Options {
|
|
264
|
+
remove?: boolean;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
interface RemoveCellOptions extends Options {
|
|
268
|
+
disconnectLinks?: boolean;
|
|
269
|
+
replace?: boolean;
|
|
270
|
+
clear?: boolean;
|
|
271
|
+
}
|
|
272
|
+
|
|
179
273
|
type SearchByKey = 'bbox' | PositionName;
|
|
180
274
|
|
|
181
275
|
interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions {
|
|
182
276
|
searchBy?: SearchByKey;
|
|
183
277
|
}
|
|
184
278
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
279
|
+
type Cells = CellCollection;
|
|
280
|
+
|
|
281
|
+
type CellInit = Cell | Cell.JSON;
|
|
282
|
+
|
|
283
|
+
type CellRef = Cell | Cell.ID;
|
|
284
|
+
|
|
285
|
+
type LayerInit = GraphLayer | GraphLayer.Attributes;
|
|
286
|
+
|
|
287
|
+
type LayerRef = GraphLayer | GraphLayer.ID;
|
|
189
288
|
|
|
190
289
|
interface Attributes {
|
|
191
|
-
|
|
290
|
+
/** @deprecated use cellsCollection property **/
|
|
291
|
+
cells?: CellCollection;
|
|
192
292
|
[key: string]: any;
|
|
193
293
|
}
|
|
294
|
+
|
|
295
|
+
interface JSON {
|
|
296
|
+
cells: Array<Cell.JSON>;
|
|
297
|
+
layers?: Array<GraphLayer.Attributes>;
|
|
298
|
+
defaultLayer?: string;
|
|
299
|
+
[key: string]: any;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface InsertLayerOptions extends Options {
|
|
303
|
+
before?: GraphLayer.ID | null;
|
|
304
|
+
index?: number;
|
|
305
|
+
}
|
|
194
306
|
}
|
|
195
307
|
|
|
196
308
|
class Graph<A extends ObjectHash = Graph.Attributes, S = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
197
309
|
|
|
198
|
-
|
|
310
|
+
layerCollection: GraphLayerCollection;
|
|
311
|
+
|
|
312
|
+
defaultLayerId: GraphLayer.ID;
|
|
313
|
+
|
|
314
|
+
layersController: GraphLayersController;
|
|
315
|
+
|
|
316
|
+
topologyIndex: GraphTopologyIndex;
|
|
317
|
+
|
|
318
|
+
constructor(attributes?: Graph.Attributes, opt?: {
|
|
319
|
+
cellNamespace?: any,
|
|
320
|
+
layerNamespace?: any,
|
|
321
|
+
/** @deprecated use cellNamespace instead */
|
|
322
|
+
cellModel?: typeof Cell
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
addCell(cell: Graph.CellInit, opt?: CollectionAddOptions): this;
|
|
326
|
+
addCell(cell: Array<Graph.CellInit>, opt?: CollectionAddOptions): this;
|
|
327
|
+
|
|
328
|
+
addCells(cells: Array<Graph.CellInit>, opt?: CollectionAddOptions): this;
|
|
329
|
+
|
|
330
|
+
removeCell(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void;
|
|
331
|
+
|
|
332
|
+
removeCells(cells: Array<Graph.CellRef>, opt?: Graph.RemoveCellOptions): this;
|
|
333
|
+
|
|
334
|
+
resetCells(cells: Array<Graph.CellInit>, opt?: Graph.Options): this;
|
|
335
|
+
|
|
336
|
+
syncCells(cells: Array<Graph.CellInit>, opt?: Graph.SyncCellOptions): void;
|
|
337
|
+
|
|
338
|
+
addLayer(layerInit: Graph.LayerInit, opt?: Graph.InsertLayerOptions): void;
|
|
339
|
+
|
|
340
|
+
moveLayer(layerRef: Graph.LayerRef, opt?: Graph.InsertLayerOptions): void;
|
|
341
|
+
|
|
342
|
+
removeLayer(layerRef: Graph.LayerRef, opt?: Graph.Options): void;
|
|
199
343
|
|
|
200
|
-
|
|
201
|
-
addCell(cell: Array<Cell | Cell.JSON>, opt?: CollectionAddOptions): this;
|
|
344
|
+
getDefaultLayer(): GraphLayer;
|
|
202
345
|
|
|
203
|
-
|
|
346
|
+
setDefaultLayer(id: string, opt?: Graph.Options): void;
|
|
204
347
|
|
|
205
|
-
|
|
348
|
+
getLayer(id: string): GraphLayer;
|
|
206
349
|
|
|
207
|
-
|
|
350
|
+
hasLayer(id: string): boolean;
|
|
351
|
+
|
|
352
|
+
getLayers(): GraphLayer[];
|
|
353
|
+
|
|
354
|
+
getCellLayerId(cell: Graph.CellRef): GraphLayer.ID;
|
|
355
|
+
|
|
356
|
+
getCell(id: Graph.CellRef): Cell;
|
|
208
357
|
|
|
209
358
|
getElements(): Element[];
|
|
210
359
|
|
|
@@ -212,15 +361,15 @@ export namespace dia {
|
|
|
212
361
|
|
|
213
362
|
getCells(): Cell[];
|
|
214
363
|
|
|
215
|
-
getFirstCell(): Cell | undefined;
|
|
364
|
+
getFirstCell(layerId?: string): Cell | undefined;
|
|
216
365
|
|
|
217
|
-
getLastCell(): Cell | undefined;
|
|
366
|
+
getLastCell(layerId?: string): Cell | undefined;
|
|
218
367
|
|
|
219
368
|
getConnectedLinks(cell: Cell, opt?: Graph.ConnectionOptions): Link[];
|
|
220
369
|
|
|
221
370
|
disconnectLinks(cell: Cell, opt?: S): void;
|
|
222
371
|
|
|
223
|
-
removeLinks(cell:
|
|
372
|
+
removeLinks(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void;
|
|
224
373
|
|
|
225
374
|
translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
|
|
226
375
|
|
|
@@ -292,6 +441,12 @@ export namespace dia {
|
|
|
292
441
|
|
|
293
442
|
protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[];
|
|
294
443
|
|
|
444
|
+
protected _syncCell(cellInit: Graph.CellInit, opt?: Graph.Options): void;
|
|
445
|
+
|
|
446
|
+
protected _replaceCell(currentCell: Cell, newCellInit: Graph.CellInit, opt?: Graph.Options): void;
|
|
447
|
+
|
|
448
|
+
protected _resetLayers(layers: Array<Graph.LayerInit>, defaultLayerId: GraphLayer.ID | null, opt?: Graph.Options): this;
|
|
449
|
+
|
|
295
450
|
/** @deprecated use `findElementsAtPoint` instead */
|
|
296
451
|
findModelsFromPoint(p: Point): Element[];
|
|
297
452
|
|
|
@@ -307,11 +462,9 @@ export namespace dia {
|
|
|
307
462
|
|
|
308
463
|
hasActiveBatch(name?: string | string[]): boolean;
|
|
309
464
|
|
|
310
|
-
maxZIndex(): number;
|
|
465
|
+
maxZIndex(layerId?: GraphLayer.ID): number;
|
|
311
466
|
|
|
312
|
-
minZIndex(): number;
|
|
313
|
-
|
|
314
|
-
removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
|
|
467
|
+
minZIndex(layerId?: GraphLayer.ID): number;
|
|
315
468
|
|
|
316
469
|
transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void;
|
|
317
470
|
|
|
@@ -370,9 +523,7 @@ export namespace dia {
|
|
|
370
523
|
deep?: T;
|
|
371
524
|
}
|
|
372
525
|
|
|
373
|
-
|
|
374
|
-
disconnectLinks?: boolean;
|
|
375
|
-
}
|
|
526
|
+
type DisconnectableOptions = Graph.RemoveCellOptions;
|
|
376
527
|
|
|
377
528
|
interface GetEmbeddedCellsOptions extends EmbeddableOptions {
|
|
378
529
|
breadthFirst?: boolean;
|
|
@@ -452,9 +603,9 @@ export namespace dia {
|
|
|
452
603
|
|
|
453
604
|
protected generateId(): string | number;
|
|
454
605
|
|
|
455
|
-
protected stopPendingTransitions(path?:
|
|
606
|
+
protected stopPendingTransitions(path?: Path, delim?: string): void;
|
|
456
607
|
|
|
457
|
-
protected stopScheduledTransitions(path?:
|
|
608
|
+
protected stopScheduledTransitions(path?: Path, delim?: string): void;
|
|
458
609
|
|
|
459
610
|
toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON<any, A>;
|
|
460
611
|
|
|
@@ -492,11 +643,11 @@ export namespace dia {
|
|
|
492
643
|
|
|
493
644
|
removeAttr(path: Path, opt?: Cell.Options): this;
|
|
494
645
|
|
|
495
|
-
transition(path:
|
|
646
|
+
transition(path: Path, value?: any, opt?: Cell.TransitionOptions, delim?: string): number;
|
|
496
647
|
|
|
497
648
|
getTransitions(): string[];
|
|
498
649
|
|
|
499
|
-
stopTransitions(path?:
|
|
650
|
+
stopTransitions(path?: Path, delim?: string): this;
|
|
500
651
|
|
|
501
652
|
embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this;
|
|
502
653
|
|
|
@@ -520,6 +671,9 @@ export namespace dia {
|
|
|
520
671
|
|
|
521
672
|
z(): number;
|
|
522
673
|
|
|
674
|
+
layer(): string | null;
|
|
675
|
+
layer(id: string | null, opt?: Graph.Options): this;
|
|
676
|
+
|
|
523
677
|
angle(): number;
|
|
524
678
|
|
|
525
679
|
getBBox(): g.Rect;
|
|
@@ -650,7 +804,7 @@ export namespace dia {
|
|
|
650
804
|
}
|
|
651
805
|
|
|
652
806
|
interface FitParentOptions extends FitToChildrenOptions {
|
|
653
|
-
terminator?:
|
|
807
|
+
terminator?: Graph.CellRef;
|
|
654
808
|
}
|
|
655
809
|
|
|
656
810
|
interface RotateOptions {
|
|
@@ -1377,14 +1531,17 @@ export namespace dia {
|
|
|
1377
1531
|
}
|
|
1378
1532
|
|
|
1379
1533
|
enum Layers {
|
|
1380
|
-
CELLS = 'cells',
|
|
1381
1534
|
LABELS = 'labels',
|
|
1382
1535
|
BACK = 'back',
|
|
1383
1536
|
FRONT = 'front',
|
|
1537
|
+
/** @deprecated */
|
|
1538
|
+
CELLS = 'cells',
|
|
1384
1539
|
TOOLS = 'tools',
|
|
1385
1540
|
GRID = 'grid',
|
|
1386
1541
|
}
|
|
1387
1542
|
|
|
1543
|
+
type LayerRef = Layers | string | dia.LayerView | dia.GraphLayer;
|
|
1544
|
+
|
|
1388
1545
|
interface RenderStats {
|
|
1389
1546
|
priority: number;
|
|
1390
1547
|
updated: number;
|
|
@@ -1527,6 +1684,7 @@ export namespace dia {
|
|
|
1527
1684
|
validateUnembedding?: (this: Paper, childView: ElementView) => boolean;
|
|
1528
1685
|
// default views, models & attributes
|
|
1529
1686
|
cellViewNamespace?: any;
|
|
1687
|
+
layerViewNamespace?: any;
|
|
1530
1688
|
routerNamespace?: any;
|
|
1531
1689
|
connectorNamespace?: any;
|
|
1532
1690
|
highlighterNamespace?: any;
|
|
@@ -1700,6 +1858,11 @@ export namespace dia {
|
|
|
1700
1858
|
view: CellView;
|
|
1701
1859
|
magnet: SVGElement;
|
|
1702
1860
|
}
|
|
1861
|
+
|
|
1862
|
+
interface InsertLayerViewOptions {
|
|
1863
|
+
before?: LayerRef | null;
|
|
1864
|
+
index?: number;
|
|
1865
|
+
}
|
|
1703
1866
|
}
|
|
1704
1867
|
|
|
1705
1868
|
class Paper extends mvc.View<Graph> {
|
|
@@ -1712,10 +1875,14 @@ export namespace dia {
|
|
|
1712
1875
|
|
|
1713
1876
|
svg: SVGSVGElement;
|
|
1714
1877
|
defs: SVGDefsElement;
|
|
1878
|
+
|
|
1879
|
+
/** @deprecated use getLayerViewNode()*/
|
|
1715
1880
|
cells: SVGGElement;
|
|
1881
|
+
/** @deprecated use layers property*/
|
|
1882
|
+
viewport: SVGGElement;
|
|
1883
|
+
|
|
1716
1884
|
tools: SVGGElement;
|
|
1717
1885
|
layers: SVGGElement;
|
|
1718
|
-
viewport: SVGGElement;
|
|
1719
1886
|
|
|
1720
1887
|
GUARDED_TAG_NAMES: string[];
|
|
1721
1888
|
FORM_CONTROLS_TAG_NAMES: string[];
|
|
@@ -1791,7 +1958,7 @@ export namespace dia {
|
|
|
1791
1958
|
|
|
1792
1959
|
findView<T extends ElementView | LinkView>(element: mvc.$SVGElement): T;
|
|
1793
1960
|
|
|
1794
|
-
findViewByModel<T extends ElementView | LinkView>(model:
|
|
1961
|
+
findViewByModel<T extends ElementView | LinkView>(model: Graph.CellRef): T;
|
|
1795
1962
|
|
|
1796
1963
|
/**
|
|
1797
1964
|
* Finds all the element views at the specified point
|
|
@@ -1853,7 +2020,7 @@ export namespace dia {
|
|
|
1853
2020
|
|
|
1854
2021
|
getDefaultLink(cellView: CellView, magnet: SVGElement): Link;
|
|
1855
2022
|
|
|
1856
|
-
getModelById(id:
|
|
2023
|
+
getModelById(id: Graph.CellRef): Cell;
|
|
1857
2024
|
|
|
1858
2025
|
setDimensions(width: Paper.Dimension, height: Paper.Dimension, data?: any): void;
|
|
1859
2026
|
|
|
@@ -1889,29 +2056,38 @@ export namespace dia {
|
|
|
1889
2056
|
|
|
1890
2057
|
// layers
|
|
1891
2058
|
|
|
1892
|
-
|
|
2059
|
+
getLayerView(layerRef: Paper.LayerRef): LayerView;
|
|
2060
|
+
getLayerView(layer: GraphLayer): GraphLayerView;
|
|
2061
|
+
|
|
2062
|
+
hasLayerView(layerRef: Paper.LayerRef): boolean;
|
|
2063
|
+
|
|
2064
|
+
getLayerViews(): Array<LayerView>;
|
|
2065
|
+
|
|
2066
|
+
getGraphLayerViews(): Array<GraphLayerView>;
|
|
1893
2067
|
|
|
1894
|
-
|
|
2068
|
+
addLayerView(layerView: LayerView, options?: Paper.InsertLayerViewOptions): void;
|
|
1895
2069
|
|
|
1896
|
-
|
|
2070
|
+
moveLayerView(layerRef: Paper.LayerRef, options?: Paper.InsertLayerViewOptions): void;
|
|
1897
2071
|
|
|
1898
|
-
|
|
2072
|
+
removeLayerView(layerRef: Paper.LayerRef): void;
|
|
1899
2073
|
|
|
1900
|
-
protected
|
|
2074
|
+
protected insertLayerView(layerView: LayerView, before?: Paper.LayerRef): void;
|
|
1901
2075
|
|
|
1902
|
-
protected
|
|
2076
|
+
protected requestLayerViewRemoval(layerRef: Paper.LayerRef): void;
|
|
1903
2077
|
|
|
1904
|
-
|
|
2078
|
+
protected createLayerView(options: Omit<LayerView.Options, 'paper'>): LayerView;
|
|
1905
2079
|
|
|
1906
|
-
|
|
2080
|
+
protected getLayerViewOrder(): string[];
|
|
1907
2081
|
|
|
1908
|
-
|
|
2082
|
+
protected renderLayerViews(): void;
|
|
1909
2083
|
|
|
1910
|
-
|
|
2084
|
+
protected renderImplicitLayerViews(): void;
|
|
1911
2085
|
|
|
1912
|
-
|
|
2086
|
+
protected renderGraphLayerViews(): void;
|
|
1913
2087
|
|
|
1914
|
-
|
|
2088
|
+
protected removeLayerViews(): void;
|
|
2089
|
+
|
|
2090
|
+
protected resetLayerViews(): void;
|
|
1915
2091
|
|
|
1916
2092
|
// rendering
|
|
1917
2093
|
|
|
@@ -1925,7 +2101,9 @@ export namespace dia {
|
|
|
1925
2101
|
|
|
1926
2102
|
requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
|
|
1927
2103
|
|
|
1928
|
-
|
|
2104
|
+
requestCellViewInsertion(cell: Graph.CellRef, opt?: { [key: string]: any }): void;
|
|
2105
|
+
|
|
2106
|
+
requireView<T extends ElementView | LinkView>(cellOrId: Graph.CellRef, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): T;
|
|
1929
2107
|
|
|
1930
2108
|
updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number };
|
|
1931
2109
|
|
|
@@ -1933,10 +2111,10 @@ export namespace dia {
|
|
|
1933
2111
|
|
|
1934
2112
|
disposeHiddenCellViews(): void;
|
|
1935
2113
|
|
|
1936
|
-
isCellVisible(cellOrId:
|
|
2114
|
+
isCellVisible(cellOrId: Graph.CellRef): boolean;
|
|
1937
2115
|
|
|
1938
2116
|
updateCellVisibility(
|
|
1939
|
-
cell:
|
|
2117
|
+
cell: Graph.CellRef,
|
|
1940
2118
|
opt?: Paper.CellVisibilityOptions & Paper.UpdateViewOptions & Paper.RenderCallbackOptions
|
|
1941
2119
|
): void;
|
|
1942
2120
|
|
|
@@ -1988,9 +2166,9 @@ export namespace dia {
|
|
|
1988
2166
|
|
|
1989
2167
|
protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: Paper.MountOptions): number;
|
|
1990
2168
|
|
|
1991
|
-
protected prioritizeCellViewMount(cellOrId:
|
|
2169
|
+
protected prioritizeCellViewMount(cellOrId: Graph.CellRef): boolean;
|
|
1992
2170
|
|
|
1993
|
-
protected prioritizeCellViewUnmount(cellOrId:
|
|
2171
|
+
protected prioritizeCellViewUnmount(cellOrId: Graph.CellRef): boolean;
|
|
1994
2172
|
|
|
1995
2173
|
protected isViewMounted(viewOrCid: dia.CellView | string): boolean;
|
|
1996
2174
|
|
|
@@ -2051,6 +2229,14 @@ export namespace dia {
|
|
|
2051
2229
|
protected onCellChanged(cell: Cell, opt: dia.Cell.Options): void;
|
|
2052
2230
|
protected onCellChanged(cell: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
2053
2231
|
|
|
2232
|
+
protected onGraphLayerAdd(layer: GraphLayer, collection: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
|
|
2233
|
+
|
|
2234
|
+
protected onGraphLayerRemove(layer: GraphLayer, collection: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
|
|
2235
|
+
|
|
2236
|
+
protected onGraphLayerCollectionReset(layer: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
|
|
2237
|
+
|
|
2238
|
+
protected onGraphLayerCollectionSort(layer: GraphLayer[]): void;
|
|
2239
|
+
|
|
2054
2240
|
protected onGraphReset(cells: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
2055
2241
|
|
|
2056
2242
|
protected onGraphSort(): void;
|
|
@@ -2081,6 +2267,11 @@ export namespace dia {
|
|
|
2081
2267
|
|
|
2082
2268
|
protected addStylesheet(stylesheet: string): void;
|
|
2083
2269
|
|
|
2270
|
+
/**
|
|
2271
|
+
* @deprecated use `getLayerView(id).el` instead
|
|
2272
|
+
* **/
|
|
2273
|
+
getLayerNode(id: Paper.Layers | string): SVGElement;
|
|
2274
|
+
|
|
2084
2275
|
/**
|
|
2085
2276
|
* @deprecated use `findElementViewsAtPoint()
|
|
2086
2277
|
*/
|
|
@@ -2107,17 +2298,20 @@ export namespace dia {
|
|
|
2107
2298
|
dumpViews(opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions): void;
|
|
2108
2299
|
}
|
|
2109
2300
|
|
|
2110
|
-
namespace
|
|
2301
|
+
namespace LayerView {
|
|
2111
2302
|
|
|
2112
|
-
interface Options extends mvc.ViewOptions<
|
|
2113
|
-
|
|
2303
|
+
interface Options<T extends mvc.Model | undefined = undefined> extends mvc.ViewOptions<T, SVGElement> {
|
|
2304
|
+
id: string;
|
|
2305
|
+
paper: Paper;
|
|
2306
|
+
type?: string;
|
|
2114
2307
|
}
|
|
2115
2308
|
}
|
|
2116
|
-
class PaperLayer extends mvc.View<undefined, SVGElement> {
|
|
2117
2309
|
|
|
2118
|
-
|
|
2310
|
+
class LayerView<T extends mvc.Model | undefined = undefined> extends mvc.View<T, SVGElement> {
|
|
2119
2311
|
|
|
2120
|
-
|
|
2312
|
+
constructor(opt?: LayerView.Options);
|
|
2313
|
+
|
|
2314
|
+
options: LayerView.Options;
|
|
2121
2315
|
|
|
2122
2316
|
pivotNodes: { [z: number]: Comment };
|
|
2123
2317
|
|
|
@@ -2127,7 +2321,78 @@ export namespace dia {
|
|
|
2127
2321
|
|
|
2128
2322
|
insertPivot(z: number): Comment;
|
|
2129
2323
|
|
|
2130
|
-
|
|
2324
|
+
isEmpty(): boolean;
|
|
2325
|
+
|
|
2326
|
+
reset(): void;
|
|
2327
|
+
|
|
2328
|
+
setPaperReference(paper: Paper): void;
|
|
2329
|
+
|
|
2330
|
+
unsetPaperReference(): void;
|
|
2331
|
+
|
|
2332
|
+
protected removePivots(): void;
|
|
2333
|
+
|
|
2334
|
+
protected afterPaperReferenceSet(paper: Paper): void;
|
|
2335
|
+
|
|
2336
|
+
protected beforePaperReferenceUnset(paper: Paper): void;
|
|
2337
|
+
|
|
2338
|
+
protected assertPaperReferenceSet(): void;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
namespace GraphLayer {
|
|
2342
|
+
|
|
2343
|
+
type ID = string;
|
|
2344
|
+
|
|
2345
|
+
interface Attributes extends mvc.ObjectHash {
|
|
2346
|
+
id: ID;
|
|
2347
|
+
type?: string;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
class GraphLayer<C extends CellCollection = CellCollection, A extends GraphLayer.Attributes = GraphLayer.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
2352
|
+
|
|
2353
|
+
declare id: string;
|
|
2354
|
+
|
|
2355
|
+
cellCollection: C;
|
|
2356
|
+
graph: Graph | null;
|
|
2357
|
+
|
|
2358
|
+
constructor(attributes?: DeepPartial<A>, options?: mvc.ModelConstructorOptions<GraphLayer>);
|
|
2359
|
+
|
|
2360
|
+
getCells(): Cell[];
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
class GraphLayerView<T extends GraphLayer = GraphLayer> extends LayerView<T> {
|
|
2364
|
+
|
|
2365
|
+
sort(): void;
|
|
2366
|
+
|
|
2367
|
+
sortExact(): void;
|
|
2368
|
+
|
|
2369
|
+
insertCellView(cellView: CellView): void;
|
|
2370
|
+
|
|
2371
|
+
protected onCellMove(cell: Cell, opt: Graph.Options): void;
|
|
2372
|
+
|
|
2373
|
+
protected onCellChange(cell: Cell, opt: Cell.Options): void;
|
|
2374
|
+
|
|
2375
|
+
protected onCellCollectionSort(collection: CellCollection, opt: Graph.Options): void;
|
|
2376
|
+
|
|
2377
|
+
protected onGraphBatchStop(data: any): void;
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
namespace GridLayerView {
|
|
2381
|
+
|
|
2382
|
+
interface Options extends LayerView.Options {
|
|
2383
|
+
patterns?: Record<string, Paper.GridOptions[]>;
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
class GridLayerView extends LayerView {
|
|
2388
|
+
|
|
2389
|
+
setGrid(opt?: null | boolean | string | Paper.GridOptions | Paper.GridOptions[]): void;
|
|
2390
|
+
|
|
2391
|
+
renderGrid(): void;
|
|
2392
|
+
|
|
2393
|
+
updateGrid(): void;
|
|
2394
|
+
|
|
2395
|
+
removeGrid(): void;
|
|
2131
2396
|
}
|
|
2132
2397
|
|
|
2133
2398
|
namespace ToolsView {
|
|
@@ -3287,6 +3552,7 @@ export namespace mvc {
|
|
|
3287
3552
|
|
|
3288
3553
|
interface ModelConstructorOptions<TModel extends Model = Model> extends ModelSetOptions, Parseable {
|
|
3289
3554
|
collection?: Collection<TModel> | undefined;
|
|
3555
|
+
eventPrefix?: string | undefined;
|
|
3290
3556
|
}
|
|
3291
3557
|
|
|
3292
3558
|
type CombinedModelConstructorOptions<E, M extends Model<any, any, E> = Model> = ModelConstructorOptions<M> & E;
|