@memberjunction/ng-entity-relationship-diagram 0.0.1 → 2.130.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/README.md +754 -27
- package/dist/lib/components/entity-details/entity-details.component.d.ts +70 -0
- package/dist/lib/components/entity-details/entity-details.component.d.ts.map +1 -0
- package/dist/lib/components/entity-details/entity-details.component.js +694 -0
- package/dist/lib/components/entity-details/entity-details.component.js.map +1 -0
- package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.d.ts +48 -0
- package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.d.ts.map +1 -0
- package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.js +179 -0
- package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.js.map +1 -0
- package/dist/lib/components/erd-composite/erd-composite.component.d.ts +170 -0
- package/dist/lib/components/erd-composite/erd-composite.component.d.ts.map +1 -0
- package/dist/lib/components/erd-composite/erd-composite.component.js +391 -0
- package/dist/lib/components/erd-composite/erd-composite.component.js.map +1 -0
- package/dist/lib/components/erd-diagram.component.d.ts +486 -0
- package/dist/lib/components/erd-diagram.component.d.ts.map +1 -0
- package/dist/lib/components/erd-diagram.component.js +1936 -0
- package/dist/lib/components/erd-diagram.component.js.map +1 -0
- package/dist/lib/components/mj-entity-erd.component.d.ts +261 -0
- package/dist/lib/components/mj-entity-erd.component.d.ts.map +1 -0
- package/dist/lib/components/mj-entity-erd.component.js +416 -0
- package/dist/lib/components/mj-entity-erd.component.js.map +1 -0
- package/dist/lib/entity-relationship-diagram.module.d.ts +83 -0
- package/dist/lib/entity-relationship-diagram.module.d.ts.map +1 -0
- package/dist/lib/entity-relationship-diagram.module.js +121 -0
- package/dist/lib/entity-relationship-diagram.module.js.map +1 -0
- package/dist/lib/interfaces/erd-types.d.ts +491 -0
- package/dist/lib/interfaces/erd-types.d.ts.map +1 -0
- package/dist/lib/interfaces/erd-types.js +6 -0
- package/dist/lib/interfaces/erd-types.js.map +1 -0
- package/dist/lib/utils/entity-to-erd-adapter.d.ts +64 -0
- package/dist/lib/utils/entity-to-erd-adapter.d.ts.map +1 -0
- package/dist/lib/utils/entity-to-erd-adapter.js +231 -0
- package/dist/lib/utils/entity-to-erd-adapter.js.map +1 -0
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +45 -6
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, AfterViewInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ERDNode, ERDLink, ERDConfig, ERDNodeClickEvent, ERDNodeDoubleClickEvent, ERDLinkClickEvent, ERDZoomEvent, ERDState, ERDNodeHoverEvent, ERDLinkHoverEvent, ERDNodeContextMenuEvent, ERDLinkContextMenuEvent, ERDDiagramContextMenuEvent, ERDNodeDragEvent, ERDRelationshipInfo } from '../interfaces/erd-types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Entity Relationship Diagram component using D3.js force-directed graph.
|
|
6
|
+
*
|
|
7
|
+
* This is a **generic, reusable Angular component** that can visualize any data
|
|
8
|
+
* that conforms to the `ERDNode` interface. It is completely decoupled from
|
|
9
|
+
* MemberJunction-specific types and can be used in any Angular project.
|
|
10
|
+
*
|
|
11
|
+
* ## Features
|
|
12
|
+
*
|
|
13
|
+
* - **Interactive Force-Directed Layout**: Nodes automatically arrange themselves
|
|
14
|
+
* using physics-based simulation with customizable forces
|
|
15
|
+
* - **Zoom and Pan**: Mouse wheel zoom and drag-to-pan with configurable limits
|
|
16
|
+
* - **Node Selection**: Click to select nodes with visual highlighting
|
|
17
|
+
* - **Focus Mode**: Show a single node with its N-hop related entities
|
|
18
|
+
* - **Relationship Visualization**: Arrows show foreign key relationships
|
|
19
|
+
* - **Customizable Styling**: Full control over colors, sizes, and appearance
|
|
20
|
+
* - **Rich Event System**: Comprehensive events for integration with parent components
|
|
21
|
+
* - **State Persistence**: Save and restore diagram state (zoom, pan, selection, positions)
|
|
22
|
+
*
|
|
23
|
+
* ## Basic Usage
|
|
24
|
+
*
|
|
25
|
+
* ```html
|
|
26
|
+
* <mj-erd-diagram
|
|
27
|
+
* [nodes]="entityNodes"
|
|
28
|
+
* [selectedNodeId]="selectedId"
|
|
29
|
+
* [config]="erdConfig"
|
|
30
|
+
* (nodeClick)="onNodeClick($event)"
|
|
31
|
+
* (nodeSelected)="onNodeSelected($event)"
|
|
32
|
+
* (zoomChange)="onZoomChange($event)">
|
|
33
|
+
* </mj-erd-diagram>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* ## Focus Mode Example
|
|
37
|
+
*
|
|
38
|
+
* Show a single entity with its immediate relationships:
|
|
39
|
+
*
|
|
40
|
+
* ```html
|
|
41
|
+
* <mj-erd-diagram
|
|
42
|
+
* [nodes]="allNodes"
|
|
43
|
+
* [focusNodeId]="'user-entity-id'"
|
|
44
|
+
* [focusDepth]="1"
|
|
45
|
+
* (nodeSelected)="onNodeSelected($event)">
|
|
46
|
+
* </mj-erd-diagram>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ## State Persistence Example
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // Save state
|
|
53
|
+
* const state = this.erdDiagram.getState();
|
|
54
|
+
* localStorage.setItem('erd-state', JSON.stringify(state));
|
|
55
|
+
*
|
|
56
|
+
* // Restore state
|
|
57
|
+
* const savedState = JSON.parse(localStorage.getItem('erd-state'));
|
|
58
|
+
* this.erdDiagram.setState(savedState);
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @see ERDNode for the node data structure
|
|
62
|
+
* @see ERDConfig for configuration options
|
|
63
|
+
* @see ERDState for state persistence
|
|
64
|
+
*/
|
|
65
|
+
export declare class ERDDiagramComponent implements AfterViewInit, OnDestroy, OnChanges {
|
|
66
|
+
erdContainer: ElementRef;
|
|
67
|
+
/**
|
|
68
|
+
* The nodes (entities) to display in the diagram.
|
|
69
|
+
* Each node should conform to the `ERDNode` interface.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* nodes: ERDNode[] = [
|
|
74
|
+
* {
|
|
75
|
+
* id: 'user-1',
|
|
76
|
+
* name: 'Users',
|
|
77
|
+
* fields: [
|
|
78
|
+
* { id: 'id', name: 'ID', isPrimaryKey: true },
|
|
79
|
+
* { id: 'email', name: 'Email', isPrimaryKey: false }
|
|
80
|
+
* ]
|
|
81
|
+
* }
|
|
82
|
+
* ];
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
nodes: ERDNode[];
|
|
86
|
+
/**
|
|
87
|
+
* ID of the currently selected node.
|
|
88
|
+
* Use this for external control of selection state.
|
|
89
|
+
* The component will highlight this node and emit selection events accordingly.
|
|
90
|
+
*
|
|
91
|
+
* @example `[selectedNodeId]="'entity-123'"`
|
|
92
|
+
*/
|
|
93
|
+
selectedNodeId: string | null;
|
|
94
|
+
/**
|
|
95
|
+
* IDs of nodes to highlight (in addition to selected node).
|
|
96
|
+
* Highlighted nodes receive a distinct visual style (orange border by default).
|
|
97
|
+
* Useful for showing search results or related items.
|
|
98
|
+
*
|
|
99
|
+
* @example `[highlightedNodeIds]="['entity-1', 'entity-2']"`
|
|
100
|
+
*/
|
|
101
|
+
highlightedNodeIds: string[];
|
|
102
|
+
/**
|
|
103
|
+
* ID of the node to focus on.
|
|
104
|
+
* When set, the diagram will only show this node and its related nodes
|
|
105
|
+
* up to `focusDepth` hops away. This is useful for entity-centric views.
|
|
106
|
+
*
|
|
107
|
+
* Set to `null` to show all nodes.
|
|
108
|
+
*
|
|
109
|
+
* @example `[focusNodeId]="'user-entity-id'"`
|
|
110
|
+
*/
|
|
111
|
+
focusNodeId: string | null;
|
|
112
|
+
/**
|
|
113
|
+
* Number of relationship hops to include when in focus mode.
|
|
114
|
+
* - `0`: Show only the focus node
|
|
115
|
+
* - `1`: Show focus node + directly related nodes
|
|
116
|
+
* - `2`: Show focus node + nodes within 2 relationship hops
|
|
117
|
+
*
|
|
118
|
+
* Only applies when `focusNodeId` is set.
|
|
119
|
+
*
|
|
120
|
+
* @default 1
|
|
121
|
+
* @example `[focusDepth]="2"`
|
|
122
|
+
*/
|
|
123
|
+
focusDepth: number;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the diagram is currently refreshing/loading.
|
|
126
|
+
* When `true`, displays a loading overlay on the diagram.
|
|
127
|
+
*
|
|
128
|
+
* @example `[isRefreshing]="isLoadingData"`
|
|
129
|
+
*/
|
|
130
|
+
isRefreshing: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether the diagram is in read-only mode.
|
|
133
|
+
* When `true`, disables dragging and selection (zoom/pan still work).
|
|
134
|
+
*
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
readOnly: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Configuration options for the diagram.
|
|
140
|
+
* All options are optional with sensible defaults.
|
|
141
|
+
*
|
|
142
|
+
* @see ERDConfig for all available options
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* config: ERDConfig = {
|
|
146
|
+
* nodeWidth: 200,
|
|
147
|
+
* chargeStrength: -1000,
|
|
148
|
+
* colors: {
|
|
149
|
+
* nodeHeader: '#0066cc'
|
|
150
|
+
* }
|
|
151
|
+
* };
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
config: ERDConfig;
|
|
155
|
+
/**
|
|
156
|
+
* Whether to show the header bar with zoom controls.
|
|
157
|
+
* Set to `false` to hide the header and use programmatic control instead.
|
|
158
|
+
*
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
showHeader: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Title to display in the header bar.
|
|
164
|
+
* Only visible when `showHeader` is `true`.
|
|
165
|
+
*
|
|
166
|
+
* @default 'Entity Relationship Diagram'
|
|
167
|
+
*/
|
|
168
|
+
headerTitle: string;
|
|
169
|
+
/**
|
|
170
|
+
* Emitted when a node is clicked.
|
|
171
|
+
* Set `event.cancel = true` to prevent the default selection behavior.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* onNodeClick(event: ERDNodeClickEvent) {
|
|
176
|
+
* console.log('Clicked:', event.node.name);
|
|
177
|
+
* // Prevent selection for certain nodes
|
|
178
|
+
* if (event.node.customData?.['locked']) {
|
|
179
|
+
* event.cancel = true;
|
|
180
|
+
* }
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
nodeClick: EventEmitter<ERDNodeClickEvent>;
|
|
185
|
+
/**
|
|
186
|
+
* Emitted when a node is double-clicked.
|
|
187
|
+
* Useful for opening detail views or triggering actions.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* onNodeDoubleClick(event: ERDNodeDoubleClickEvent) {
|
|
192
|
+
* this.openEntityDetail(event.node.id);
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
nodeDoubleClick: EventEmitter<ERDNodeDoubleClickEvent>;
|
|
197
|
+
/**
|
|
198
|
+
* Emitted when a node is selected (after click, unless cancelled).
|
|
199
|
+
* The node parameter contains the full `ERDNode` data.
|
|
200
|
+
*/
|
|
201
|
+
nodeSelected: EventEmitter<ERDNode>;
|
|
202
|
+
/**
|
|
203
|
+
* Emitted when the current node is deselected.
|
|
204
|
+
* This happens when clicking the background or selecting a different node.
|
|
205
|
+
*/
|
|
206
|
+
nodeDeselected: EventEmitter<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Emitted when a relationship link is clicked.
|
|
209
|
+
* The event includes both source and target nodes for context.
|
|
210
|
+
*/
|
|
211
|
+
linkClick: EventEmitter<ERDLinkClickEvent>;
|
|
212
|
+
/**
|
|
213
|
+
* Emitted when the mouse enters a node.
|
|
214
|
+
* Includes related nodes and position for tooltip display.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* onNodeHover(event: ERDNodeHoverEvent) {
|
|
219
|
+
* this.showTooltip(event.node, event.position);
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
nodeHover: EventEmitter<ERDNodeHoverEvent>;
|
|
224
|
+
/**
|
|
225
|
+
* Emitted when the mouse leaves a node.
|
|
226
|
+
*/
|
|
227
|
+
nodeHoverEnd: EventEmitter<ERDNode>;
|
|
228
|
+
/**
|
|
229
|
+
* Emitted when the mouse enters a relationship link.
|
|
230
|
+
*/
|
|
231
|
+
linkHover: EventEmitter<ERDLinkHoverEvent>;
|
|
232
|
+
/**
|
|
233
|
+
* Emitted when the mouse leaves a relationship link.
|
|
234
|
+
*/
|
|
235
|
+
linkHoverEnd: EventEmitter<ERDLink>;
|
|
236
|
+
/**
|
|
237
|
+
* Emitted when a node is right-clicked.
|
|
238
|
+
* Set `event.cancel = true` to prevent the default browser context menu.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* onNodeContextMenu(event: ERDNodeContextMenuEvent) {
|
|
243
|
+
* event.cancel = true;
|
|
244
|
+
* this.showContextMenu(event.node, event.position);
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
nodeContextMenu: EventEmitter<ERDNodeContextMenuEvent>;
|
|
249
|
+
/**
|
|
250
|
+
* Emitted when a relationship link is right-clicked.
|
|
251
|
+
*/
|
|
252
|
+
linkContextMenu: EventEmitter<ERDLinkContextMenuEvent>;
|
|
253
|
+
/**
|
|
254
|
+
* Emitted when the diagram background is right-clicked.
|
|
255
|
+
* Includes diagram coordinates for adding new nodes at click position.
|
|
256
|
+
*/
|
|
257
|
+
diagramContextMenu: EventEmitter<ERDDiagramContextMenuEvent>;
|
|
258
|
+
/**
|
|
259
|
+
* Emitted when a node drag operation starts.
|
|
260
|
+
* Set `event.cancel = true` to prevent the drag.
|
|
261
|
+
*/
|
|
262
|
+
nodeDragStart: EventEmitter<ERDNodeDragEvent>;
|
|
263
|
+
/**
|
|
264
|
+
* Emitted when a node drag operation ends.
|
|
265
|
+
*/
|
|
266
|
+
nodeDragEnd: EventEmitter<ERDNodeDragEvent>;
|
|
267
|
+
/**
|
|
268
|
+
* Emitted when zoom level or pan position changes.
|
|
269
|
+
* Useful for synchronizing zoom controls or saving view state.
|
|
270
|
+
*/
|
|
271
|
+
zoomChange: EventEmitter<ERDZoomEvent>;
|
|
272
|
+
/**
|
|
273
|
+
* Emitted when the diagram requests a refresh.
|
|
274
|
+
* Triggered by the refresh button in the header.
|
|
275
|
+
*/
|
|
276
|
+
refreshRequested: EventEmitter<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Emitted when the force simulation completes initial layout.
|
|
279
|
+
* Useful for performing actions after nodes have settled.
|
|
280
|
+
*/
|
|
281
|
+
layoutComplete: EventEmitter<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Emitted when diagram state changes (selection, zoom, highlights).
|
|
284
|
+
* Useful for auto-saving state or syncing with other components.
|
|
285
|
+
*/
|
|
286
|
+
stateChange: EventEmitter<ERDState>;
|
|
287
|
+
private svg;
|
|
288
|
+
private simulation;
|
|
289
|
+
private internalNodes;
|
|
290
|
+
private internalLinks;
|
|
291
|
+
private visibleNodes;
|
|
292
|
+
private visibleLinks;
|
|
293
|
+
private zoom;
|
|
294
|
+
private resizeObserver?;
|
|
295
|
+
private lastKnownSize;
|
|
296
|
+
private resizeTimeout?;
|
|
297
|
+
private mergedConfig;
|
|
298
|
+
private layoutCompleted;
|
|
299
|
+
private isLayoutFrozen;
|
|
300
|
+
ngAfterViewInit(): void;
|
|
301
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
302
|
+
ngOnDestroy(): void;
|
|
303
|
+
/**
|
|
304
|
+
* Zoom in on the diagram by a fixed factor (1.2x).
|
|
305
|
+
* Uses smooth animation transition.
|
|
306
|
+
*/
|
|
307
|
+
zoomIn(): void;
|
|
308
|
+
/**
|
|
309
|
+
* Zoom out on the diagram by a fixed factor (0.83x).
|
|
310
|
+
* Uses smooth animation transition.
|
|
311
|
+
*/
|
|
312
|
+
zoomOut(): void;
|
|
313
|
+
/**
|
|
314
|
+
* Reset zoom to default level (1x) and center the diagram.
|
|
315
|
+
* Uses smooth animation transition.
|
|
316
|
+
*/
|
|
317
|
+
resetZoom(): void;
|
|
318
|
+
/**
|
|
319
|
+
* Zoom and pan to center on a specific node.
|
|
320
|
+
*
|
|
321
|
+
* @param nodeId - ID of the node to center on
|
|
322
|
+
* @param scale - Optional zoom scale (default: 1.5)
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* // Center on node with default zoom
|
|
327
|
+
* this.erdDiagram.zoomToNode('user-entity-id');
|
|
328
|
+
*
|
|
329
|
+
* // Center with custom zoom level
|
|
330
|
+
* this.erdDiagram.zoomToNode('user-entity-id', 2.0);
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
zoomToNode(nodeId: string, scale?: number): void;
|
|
334
|
+
/**
|
|
335
|
+
* Fit all visible nodes within the viewport.
|
|
336
|
+
* Calculates optimal zoom level and position to show all nodes.
|
|
337
|
+
*
|
|
338
|
+
* @param padding - Padding around nodes (default: 50px)
|
|
339
|
+
*/
|
|
340
|
+
zoomToFit(padding?: number): void;
|
|
341
|
+
/**
|
|
342
|
+
* Programmatically select a node by ID.
|
|
343
|
+
*
|
|
344
|
+
* @param nodeId - ID of the node to select
|
|
345
|
+
* @returns `true` if node was found and selected, `false` otherwise
|
|
346
|
+
*/
|
|
347
|
+
selectNode(nodeId: string): boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Clear all selections.
|
|
350
|
+
*/
|
|
351
|
+
deselectAll(): void;
|
|
352
|
+
/**
|
|
353
|
+
* Highlight a specific node.
|
|
354
|
+
*
|
|
355
|
+
* @param nodeId - ID of the node to highlight
|
|
356
|
+
*/
|
|
357
|
+
highlightNode(nodeId: string): void;
|
|
358
|
+
/**
|
|
359
|
+
* Clear all highlights.
|
|
360
|
+
*/
|
|
361
|
+
clearHighlights(): void;
|
|
362
|
+
/**
|
|
363
|
+
* Highlight a node and all its directly related nodes.
|
|
364
|
+
*
|
|
365
|
+
* @param nodeId - ID of the center node
|
|
366
|
+
* @param depth - Number of relationship hops to highlight (default: 1)
|
|
367
|
+
*/
|
|
368
|
+
highlightRelated(nodeId: string, depth?: number): void;
|
|
369
|
+
/**
|
|
370
|
+
* Get nodes that are related to a specific node.
|
|
371
|
+
*
|
|
372
|
+
* @param nodeId - ID of the node to find relationships for
|
|
373
|
+
* @param depth - Number of relationship hops (default: 1)
|
|
374
|
+
* @returns Array of relationship information
|
|
375
|
+
*/
|
|
376
|
+
getRelatedNodes(nodeId: string, depth?: number): ERDRelationshipInfo[];
|
|
377
|
+
/**
|
|
378
|
+
* Get the current state of the diagram for persistence.
|
|
379
|
+
* Includes selection, highlights, zoom, pan, and node positions.
|
|
380
|
+
*
|
|
381
|
+
* @returns Current diagram state
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* // Save to localStorage
|
|
386
|
+
* const state = erdDiagram.getState();
|
|
387
|
+
* localStorage.setItem('erd-state', JSON.stringify(state));
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
getState(): ERDState;
|
|
391
|
+
/**
|
|
392
|
+
* Restore a previously saved diagram state.
|
|
393
|
+
*
|
|
394
|
+
* @param state - State object from `getState()`
|
|
395
|
+
* @param restorePositions - Whether to restore node positions (default: true)
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* // Restore from localStorage
|
|
400
|
+
* const savedState = JSON.parse(localStorage.getItem('erd-state'));
|
|
401
|
+
* if (savedState) {
|
|
402
|
+
* erdDiagram.setState(savedState);
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
setState(state: Partial<ERDState>, restorePositions?: boolean): void;
|
|
407
|
+
/**
|
|
408
|
+
* Freeze the layout simulation.
|
|
409
|
+
* Nodes will stay in their current positions and won't move.
|
|
410
|
+
*/
|
|
411
|
+
freezeLayout(): void;
|
|
412
|
+
/**
|
|
413
|
+
* Unfreeze the layout simulation.
|
|
414
|
+
* Nodes will resume natural movement based on forces.
|
|
415
|
+
*/
|
|
416
|
+
unfreezeLayout(): void;
|
|
417
|
+
/**
|
|
418
|
+
* Center the diagram without changing zoom level.
|
|
419
|
+
*/
|
|
420
|
+
centerDiagram(): void;
|
|
421
|
+
/**
|
|
422
|
+
* Rebuild the entire ERD visualization.
|
|
423
|
+
*/
|
|
424
|
+
refresh(): void;
|
|
425
|
+
/**
|
|
426
|
+
* Trigger a resize recalculation.
|
|
427
|
+
* Call this when the container size changes.
|
|
428
|
+
*/
|
|
429
|
+
triggerResize(): void;
|
|
430
|
+
/**
|
|
431
|
+
* Get current zoom state.
|
|
432
|
+
*
|
|
433
|
+
* @returns Current zoom level and translation
|
|
434
|
+
*/
|
|
435
|
+
getZoomState(): ERDZoomEvent;
|
|
436
|
+
/**
|
|
437
|
+
* Export the diagram as an SVG string.
|
|
438
|
+
*
|
|
439
|
+
* @returns SVG markup string
|
|
440
|
+
*/
|
|
441
|
+
exportAsSVG(): string;
|
|
442
|
+
private setupERD;
|
|
443
|
+
private mergeConfig;
|
|
444
|
+
private resizeSVG;
|
|
445
|
+
private setupResizeObserver;
|
|
446
|
+
private clearVisualization;
|
|
447
|
+
private applyFocusMode;
|
|
448
|
+
private getRelatedNodeIds;
|
|
449
|
+
private createInternalNodes;
|
|
450
|
+
private createInternalLinks;
|
|
451
|
+
/**
|
|
452
|
+
* Applies dagre hierarchical layout to position nodes and compute edge paths.
|
|
453
|
+
* This provides clean, orthogonal edge routing.
|
|
454
|
+
*/
|
|
455
|
+
private applyDagreLayout;
|
|
456
|
+
/**
|
|
457
|
+
* Checks if the current layout algorithm uses dagre.
|
|
458
|
+
*/
|
|
459
|
+
private usesDagreLayout;
|
|
460
|
+
private createVisualization;
|
|
461
|
+
private renderNodeFields;
|
|
462
|
+
private attachNodeEventHandlers;
|
|
463
|
+
private attachLinkEventHandlers;
|
|
464
|
+
private updatePositions;
|
|
465
|
+
private getSourceConnectionPoint;
|
|
466
|
+
private getTargetConnectionPoint;
|
|
467
|
+
private createOrthogonalPath;
|
|
468
|
+
/**
|
|
469
|
+
* Creates an SVG path string from dagre's edge points.
|
|
470
|
+
* Dagre provides an array of points for each edge that forms a clean orthogonal path.
|
|
471
|
+
* @param points Array of {x, y} coordinates from dagre layout
|
|
472
|
+
* @returns SVG path string
|
|
473
|
+
*/
|
|
474
|
+
private createPathFromDagrePoints;
|
|
475
|
+
private screenToDiagramCoords;
|
|
476
|
+
private clearAllHighlighting;
|
|
477
|
+
private updateSelectionHighlighting;
|
|
478
|
+
private updateHighlighting;
|
|
479
|
+
private emitStateChange;
|
|
480
|
+
private dragstarted;
|
|
481
|
+
private dragged;
|
|
482
|
+
private dragended;
|
|
483
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ERDDiagramComponent, never>;
|
|
484
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ERDDiagramComponent, "mj-erd-diagram", never, { "nodes": { "alias": "nodes"; "required": false; }; "selectedNodeId": { "alias": "selectedNodeId"; "required": false; }; "highlightedNodeIds": { "alias": "highlightedNodeIds"; "required": false; }; "focusNodeId": { "alias": "focusNodeId"; "required": false; }; "focusDepth": { "alias": "focusDepth"; "required": false; }; "isRefreshing": { "alias": "isRefreshing"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "config": { "alias": "config"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "headerTitle": { "alias": "headerTitle"; "required": false; }; }, { "nodeClick": "nodeClick"; "nodeDoubleClick": "nodeDoubleClick"; "nodeSelected": "nodeSelected"; "nodeDeselected": "nodeDeselected"; "linkClick": "linkClick"; "nodeHover": "nodeHover"; "nodeHoverEnd": "nodeHoverEnd"; "linkHover": "linkHover"; "linkHoverEnd": "linkHoverEnd"; "nodeContextMenu": "nodeContextMenu"; "linkContextMenu": "linkContextMenu"; "diagramContextMenu": "diagramContextMenu"; "nodeDragStart": "nodeDragStart"; "nodeDragEnd": "nodeDragEnd"; "zoomChange": "zoomChange"; "refreshRequested": "refreshRequested"; "layoutComplete": "layoutComplete"; "stateChange": "stateChange"; }, never, never, false, never>;
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=erd-diagram.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erd-diagram.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/erd-diagram.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EACZ,UAAU,EAEV,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,OAAO,EAEP,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EAEZ,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EAGpB,MAAM,yBAAyB,CAAC;;AA8FjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,qBAKa,mBAAoB,YAAW,aAAa,EAAE,SAAS,EAAE,SAAS;IAC/B,YAAY,EAAG,UAAU,CAAC;IAMxE;;;;;;;;;;;;;;;;;OAiBG;IACM,KAAK,EAAE,OAAO,EAAE,CAAM;IAE/B;;;;;;OAMG;IACM,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE9C;;;;;;OAMG;IACM,kBAAkB,EAAE,MAAM,EAAE,CAAM;IAE3C;;;;;;;;OAQG;IACM,WA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