@mp70/react-networks 0.1.9-beta → 0.2.0-rc.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 +82 -33
- package/dist/index.css +75 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +700 -197
- package/dist/index.d.ts +700 -197
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,182 @@
|
|
|
1
1
|
import React$1, { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
-
import { NodeTypes, EdgeTypes, Connection, Edge, ConnectionMode, FitViewOptions, NodeProps, EdgeProps } from 'reactflow';
|
|
2
|
+
import { Node, NodeTypes, EdgeTypes, Connection, Edge, ConnectionMode, ReactFlowInstance, Viewport, FitViewOptions, NodeProps, EdgeProps } from 'reactflow';
|
|
3
|
+
|
|
4
|
+
type FibreFlowCableKind = 'simple' | 'tube';
|
|
5
|
+
interface FibreFlowEndpoint {
|
|
6
|
+
tube?: number;
|
|
7
|
+
fiber: number;
|
|
8
|
+
}
|
|
9
|
+
interface FibreFlowSplice {
|
|
10
|
+
id: string;
|
|
11
|
+
from: FibreFlowEndpoint;
|
|
12
|
+
to: FibreFlowEndpoint;
|
|
13
|
+
lossDb?: number;
|
|
14
|
+
circuitId?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
18
|
+
interface FibreFlowCable {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
kind?: FibreFlowCableKind;
|
|
22
|
+
fiberCount?: number;
|
|
23
|
+
tubeCount?: number;
|
|
24
|
+
fibersPerTube?: number;
|
|
25
|
+
tubeStartIndex?: number;
|
|
26
|
+
fiberStartIndex?: number;
|
|
27
|
+
tubeColorMap?: Record<number, string>;
|
|
28
|
+
jacketColor?: string;
|
|
29
|
+
distanceLabel?: string;
|
|
30
|
+
distanceMeters?: number;
|
|
31
|
+
}
|
|
32
|
+
interface FibreFlowClosure {
|
|
33
|
+
id: string;
|
|
34
|
+
chamberId?: string;
|
|
35
|
+
leftCable: FibreFlowCable;
|
|
36
|
+
rightCable: FibreFlowCable;
|
|
37
|
+
splices: FibreFlowSplice[];
|
|
38
|
+
}
|
|
39
|
+
interface FibreFlowCircuit {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
color?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface NetBoxDevice {
|
|
46
|
+
id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
device_type: {
|
|
49
|
+
id: number;
|
|
50
|
+
model: string;
|
|
51
|
+
manufacturer: {
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
device_role: {
|
|
56
|
+
name: string;
|
|
57
|
+
color: string;
|
|
58
|
+
};
|
|
59
|
+
site: {
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
62
|
+
rack: {
|
|
63
|
+
id: number;
|
|
64
|
+
name: string;
|
|
65
|
+
} | null;
|
|
66
|
+
position: number | null;
|
|
67
|
+
face: 'front' | 'rear' | null;
|
|
68
|
+
status: {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
color: string;
|
|
72
|
+
};
|
|
73
|
+
primary_ip4?: {
|
|
74
|
+
address: string;
|
|
75
|
+
};
|
|
76
|
+
primary_ip6?: {
|
|
77
|
+
address: string;
|
|
78
|
+
};
|
|
79
|
+
interfaces: NetBoxInterface[];
|
|
80
|
+
}
|
|
81
|
+
interface NetBoxInterface {
|
|
82
|
+
id: number;
|
|
83
|
+
name: string;
|
|
84
|
+
type: {
|
|
85
|
+
label: string;
|
|
86
|
+
value: string;
|
|
87
|
+
};
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
mac_address: string | null;
|
|
90
|
+
mtu: number | null;
|
|
91
|
+
connected_endpoint_type: string | null;
|
|
92
|
+
connected_endpoint: {
|
|
93
|
+
device: {
|
|
94
|
+
id?: number;
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
name: string;
|
|
98
|
+
} | null;
|
|
99
|
+
cable: {
|
|
100
|
+
id: number;
|
|
101
|
+
label: string;
|
|
102
|
+
type: string;
|
|
103
|
+
color: string;
|
|
104
|
+
} | null;
|
|
105
|
+
}
|
|
106
|
+
interface NetBoxRack {
|
|
107
|
+
id: number;
|
|
108
|
+
name: string;
|
|
109
|
+
site: {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
group: {
|
|
113
|
+
name: string;
|
|
114
|
+
} | null;
|
|
115
|
+
tenant: {
|
|
116
|
+
name: string;
|
|
117
|
+
} | null;
|
|
118
|
+
role: {
|
|
119
|
+
name: string;
|
|
120
|
+
color: string;
|
|
121
|
+
} | null;
|
|
122
|
+
status: {
|
|
123
|
+
label: string;
|
|
124
|
+
value: string;
|
|
125
|
+
color: string;
|
|
126
|
+
};
|
|
127
|
+
facility_id: string | null;
|
|
128
|
+
serial: string | null;
|
|
129
|
+
asset_tag: string | null;
|
|
130
|
+
type: {
|
|
131
|
+
label: string;
|
|
132
|
+
value: string;
|
|
133
|
+
};
|
|
134
|
+
width: {
|
|
135
|
+
label: string;
|
|
136
|
+
value: number;
|
|
137
|
+
};
|
|
138
|
+
u_height: number;
|
|
139
|
+
desc_units: boolean;
|
|
140
|
+
outer_width: number | null;
|
|
141
|
+
outer_depth: number | null;
|
|
142
|
+
weight: number | null;
|
|
143
|
+
max_weight: number | null;
|
|
144
|
+
weight_unit: string;
|
|
145
|
+
mounting_depth: number | null;
|
|
146
|
+
devices: NetBoxDevice[];
|
|
147
|
+
}
|
|
148
|
+
interface NetBoxCable {
|
|
149
|
+
id: number;
|
|
150
|
+
label: string;
|
|
151
|
+
type: {
|
|
152
|
+
label: string;
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
155
|
+
status: {
|
|
156
|
+
label: string;
|
|
157
|
+
value: string;
|
|
158
|
+
color: string;
|
|
159
|
+
};
|
|
160
|
+
color: string;
|
|
161
|
+
length: number | null;
|
|
162
|
+
length_unit: string;
|
|
163
|
+
termination_a_type: string;
|
|
164
|
+
termination_a: {
|
|
165
|
+
device: {
|
|
166
|
+
id?: number;
|
|
167
|
+
name: string;
|
|
168
|
+
};
|
|
169
|
+
name: string;
|
|
170
|
+
};
|
|
171
|
+
termination_b_type: string;
|
|
172
|
+
termination_b: {
|
|
173
|
+
device: {
|
|
174
|
+
id?: number;
|
|
175
|
+
name: string;
|
|
176
|
+
};
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
3
180
|
|
|
4
181
|
/**
|
|
5
182
|
* Rack device width configuration
|
|
@@ -21,6 +198,47 @@ declare enum Width {
|
|
|
21
198
|
* @public
|
|
22
199
|
*/
|
|
23
200
|
type PortType = 'ethernet' | 'fiber' | 'console' | 'mgmt' | 'usb' | 'power_ac' | 'power_c13' | 'power_c19';
|
|
201
|
+
/**
|
|
202
|
+
* Cable types used for connected network ports.
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
type PortCableType = 'smf' | 'cat6' | 'om3' | 'om4' | 'om5' | 'cat5e' | 'cat6a' | 'cat7' | 'fiber' | 'ethernet';
|
|
206
|
+
/**
|
|
207
|
+
* Device image fit options.
|
|
208
|
+
*
|
|
209
|
+
* Values mirror object-fit terms for API ergonomics and are mapped to valid
|
|
210
|
+
* background-size values by renderers where needed.
|
|
211
|
+
*
|
|
212
|
+
* @public
|
|
213
|
+
*/
|
|
214
|
+
type DeviceImageFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
215
|
+
/**
|
|
216
|
+
* Device image repeat options.
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
type DeviceImageRepeat = 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
220
|
+
/**
|
|
221
|
+
* Shared image configuration for rack-mounted devices and device nodes.
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
224
|
+
interface DeviceImageOptions {
|
|
225
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
226
|
+
frontImageUrl?: string;
|
|
227
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
228
|
+
rearImageUrl?: string;
|
|
229
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
230
|
+
frontImageAttribution?: string;
|
|
231
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
232
|
+
rearImageAttribution?: string;
|
|
233
|
+
/** Optional background sizing for device images */
|
|
234
|
+
imageFit?: DeviceImageFit;
|
|
235
|
+
/** Optional background position for device images */
|
|
236
|
+
imagePosition?: string;
|
|
237
|
+
/** Optional background repeat for device images */
|
|
238
|
+
imageRepeat?: DeviceImageRepeat;
|
|
239
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
240
|
+
stretchToFit?: boolean;
|
|
241
|
+
}
|
|
24
242
|
interface Port {
|
|
25
243
|
/** Display label for the port */
|
|
26
244
|
label: string;
|
|
@@ -29,7 +247,7 @@ interface Port {
|
|
|
29
247
|
/** Type of port for styling and validation */
|
|
30
248
|
type?: PortType;
|
|
31
249
|
/** Cable type for connection validation */
|
|
32
|
-
cableType?:
|
|
250
|
+
cableType?: PortCableType;
|
|
33
251
|
}
|
|
34
252
|
/**
|
|
35
253
|
* Group of related ports on a device
|
|
@@ -67,119 +285,287 @@ type PowerSide = 'left' | 'right';
|
|
|
67
285
|
*/
|
|
68
286
|
type UNumberingDirection = 'bottom-up' | 'top-down';
|
|
69
287
|
/**
|
|
70
|
-
*
|
|
288
|
+
* Shared node data fields available across node types.
|
|
289
|
+
* Specific node kinds can narrow these fields via `NetworkNodeDataByType`.
|
|
71
290
|
* @public
|
|
72
291
|
*/
|
|
73
|
-
interface
|
|
74
|
-
/**
|
|
75
|
-
|
|
292
|
+
interface NetworkNodeDataBase extends DeviceImageOptions {
|
|
293
|
+
/** Display label for the node */
|
|
294
|
+
label: string;
|
|
295
|
+
/** Current status of the node/device */
|
|
296
|
+
status?: DeviceStatus | string;
|
|
297
|
+
/** Port configurations for device-like nodes */
|
|
298
|
+
ports?: PortBlock[] | number;
|
|
299
|
+
/** Rear port configurations */
|
|
300
|
+
rearPorts?: PortBlock[];
|
|
301
|
+
/** List of connected node IDs */
|
|
302
|
+
connections?: string[];
|
|
303
|
+
/** NetBox integration ID */
|
|
304
|
+
netboxId?: number | string;
|
|
305
|
+
/** NetBox object type */
|
|
306
|
+
netboxType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
307
|
+
/** Inventory integration ID */
|
|
308
|
+
inventoryId?: number | string;
|
|
309
|
+
/** Inventory object type */
|
|
310
|
+
inventoryType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
311
|
+
/** Rack height in U units */
|
|
312
|
+
uHeight?: number;
|
|
313
|
+
/** Device position within rack in U units */
|
|
314
|
+
uPosition?: number;
|
|
315
|
+
/** Current front/rear view orientation */
|
|
316
|
+
view?: DeviceView;
|
|
317
|
+
/** Rack face orientation */
|
|
318
|
+
face?: DeviceView;
|
|
319
|
+
/** Device type specification */
|
|
320
|
+
deviceType?: string;
|
|
321
|
+
/** Device manufacturer */
|
|
322
|
+
manufacturer?: string;
|
|
323
|
+
/** Device role in network */
|
|
324
|
+
role?: string;
|
|
325
|
+
/** Device width configuration */
|
|
326
|
+
width?: Width | number;
|
|
327
|
+
/** Power port side for rear view */
|
|
328
|
+
powerSide?: PowerSide;
|
|
329
|
+
/** Vertical PDU height in centimeters */
|
|
330
|
+
heightCm?: number;
|
|
331
|
+
/** Number of AC power ports */
|
|
332
|
+
powerPorts?: number;
|
|
333
|
+
/** Vertical PDU width in pixels */
|
|
334
|
+
widthPx?: number;
|
|
335
|
+
/** Optional management unit position for vertical PDUs */
|
|
336
|
+
mgmt_unit?: 'top' | 'middle' | 'bottom';
|
|
337
|
+
/** U numbering direction for rack nodes */
|
|
338
|
+
uNumberingDirection?: UNumberingDirection;
|
|
339
|
+
/** Custom header text for rack nodes */
|
|
340
|
+
customHeaderText?: string;
|
|
341
|
+
/** Rack UI marker visibility */
|
|
342
|
+
showUMarkers?: boolean;
|
|
343
|
+
/** Holder position within tray (1-12) for splice nodes */
|
|
344
|
+
holderPosition?: number;
|
|
345
|
+
/** Loss value in dB for splice nodes */
|
|
346
|
+
lossDb?: number;
|
|
347
|
+
/** Splice mode */
|
|
348
|
+
mode?: 'single' | 'ribbon';
|
|
349
|
+
/** Legacy ribbon flag */
|
|
350
|
+
ribbon?: boolean;
|
|
351
|
+
/** Ribbon fiber IDs */
|
|
352
|
+
ribbonFiberIds?: number[];
|
|
353
|
+
/** Connector type for coupler nodes */
|
|
354
|
+
connector?: 'SC' | 'LC';
|
|
355
|
+
/** Number of fibers for coupler nodes (1, 2, or 4) */
|
|
356
|
+
couplerFiberCount?: 1 | 2 | 4;
|
|
357
|
+
/** Optional port labels for left side of coupler */
|
|
358
|
+
portLabelsLeft?: string[];
|
|
359
|
+
/** Optional port labels for right side of coupler */
|
|
360
|
+
portLabelsRight?: string[];
|
|
361
|
+
/** Slot position for couplers inside panels (1-based, vertical slots aligned to right edge) */
|
|
362
|
+
slotPosition?: number;
|
|
363
|
+
/** Width override for panel-like container nodes */
|
|
364
|
+
panelWidth?: number;
|
|
365
|
+
/** Height override for panel-like container nodes */
|
|
366
|
+
panelHeight?: number;
|
|
367
|
+
/** Width override for closure nodes */
|
|
368
|
+
closureWidth?: number;
|
|
369
|
+
/** Height override for closure nodes */
|
|
370
|
+
closureHeight?: number;
|
|
371
|
+
/** Optional rack width in pixels (for rack nodes, default: 300px) */
|
|
372
|
+
rackWidthPx?: number;
|
|
373
|
+
/** Number of rows for container nodes (patch-panel, closure) */
|
|
374
|
+
rows?: number;
|
|
375
|
+
/** Number of columns for container nodes (patch-panel, closure) */
|
|
376
|
+
cols?: number;
|
|
377
|
+
/** Number of trays for closure nodes */
|
|
378
|
+
trayCount?: number;
|
|
379
|
+
/** Header text for container nodes */
|
|
380
|
+
header?: string;
|
|
381
|
+
/** Type of fibre splitter: 'splitter' or 'WDM' (default: 'splitter') */
|
|
382
|
+
splitterType?: 'splitter' | 'WDM';
|
|
383
|
+
/** Number of input fibers on the left (1 or 2, default: 1) */
|
|
384
|
+
inputCount?: number;
|
|
385
|
+
/** Number of output fibers on the right (1-64, default: 8) */
|
|
386
|
+
outputCount?: number;
|
|
387
|
+
/** Tube index (1-based) */
|
|
388
|
+
tubeIndex?: number;
|
|
389
|
+
/** Tube count for multi-tube cables */
|
|
390
|
+
tubeCount?: number;
|
|
391
|
+
/** Tube start index for multi-tube cables */
|
|
392
|
+
tubeStartIndex?: number;
|
|
393
|
+
/** Number of fibers per tube */
|
|
394
|
+
fibersPerTube?: number;
|
|
395
|
+
/** Total fiber count for cables */
|
|
396
|
+
fiberCount?: number;
|
|
397
|
+
/** Cable identifier */
|
|
398
|
+
cableId?: string;
|
|
399
|
+
/** Primary node color override */
|
|
400
|
+
color?: string;
|
|
401
|
+
/** Rotation in degrees for rotatable nodes */
|
|
402
|
+
rotation?: number;
|
|
403
|
+
/** Tube handle orientation */
|
|
404
|
+
startOn?: 'left-center' | 'left' | 'right';
|
|
405
|
+
/** Rack metadata for integrations */
|
|
406
|
+
facilityId?: string | number | null;
|
|
407
|
+
/** Rack serial metadata */
|
|
408
|
+
serial?: string | null;
|
|
409
|
+
/** Asset tag metadata */
|
|
410
|
+
assetTag?: string | null;
|
|
411
|
+
/** Site metadata */
|
|
412
|
+
site?: string;
|
|
413
|
+
/** Tenant metadata */
|
|
414
|
+
tenant?: string;
|
|
415
|
+
/** Primary IPv4 metadata */
|
|
416
|
+
primaryIp4?: string;
|
|
417
|
+
/** Primary IPv6 metadata */
|
|
418
|
+
primaryIp6?: string;
|
|
419
|
+
/** Rack name metadata */
|
|
420
|
+
rack?: string | number | null;
|
|
421
|
+
/** Optional arrays used by inventory/netbox transforms */
|
|
422
|
+
racks?: unknown[];
|
|
423
|
+
devices?: unknown[];
|
|
424
|
+
cables?: unknown[];
|
|
425
|
+
/** UI color mode metadata */
|
|
426
|
+
colorMode?: 'light' | 'dark' | 'system';
|
|
427
|
+
/** Generic dimensions used by some helpers */
|
|
428
|
+
height?: number;
|
|
429
|
+
headerHeight?: number;
|
|
430
|
+
/** Optional precomputed map for handle-to-face resolution */
|
|
431
|
+
handleSideMap?: Record<string, DeviceView>;
|
|
432
|
+
/** Additional extension metadata */
|
|
433
|
+
metadata?: Record<string, unknown>;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Rack node data.
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
439
|
+
interface RackNodeData extends NetworkNodeDataBase {
|
|
440
|
+
ports?: number | PortBlock[];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Device-like node data (servers/switches/routers/generic device).
|
|
444
|
+
* @public
|
|
445
|
+
*/
|
|
446
|
+
interface DeviceNodeData extends NetworkNodeDataBase {
|
|
447
|
+
ports?: PortBlock[] | number;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Fibre flow cable node data.
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
interface FibreFlowCableNodeData extends NetworkNodeDataBase {
|
|
454
|
+
cable: FibreFlowCable;
|
|
455
|
+
side: 'left' | 'right';
|
|
456
|
+
rowHeight: number;
|
|
457
|
+
columnWidth: number;
|
|
458
|
+
showTubeLabels: boolean;
|
|
459
|
+
showFiberNumbers: boolean;
|
|
460
|
+
layout: unknown;
|
|
461
|
+
colorMode?: 'dark' | 'light';
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Fibre flow closure node data.
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
467
|
+
interface FibreFlowClosureNodeData extends NetworkNodeDataBase {
|
|
468
|
+
width?: number;
|
|
469
|
+
height?: number;
|
|
470
|
+
headerHeight?: number;
|
|
471
|
+
colorMode?: 'dark' | 'light';
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Mapping from node type to corresponding data type.
|
|
475
|
+
* @public
|
|
476
|
+
*/
|
|
477
|
+
interface NetworkNodeDataByType {
|
|
478
|
+
rack: RackNodeData;
|
|
479
|
+
switch: DeviceNodeData;
|
|
480
|
+
router: DeviceNodeData;
|
|
481
|
+
server: DeviceNodeData;
|
|
482
|
+
fiber: NetworkNodeDataBase;
|
|
483
|
+
'patch-panel': NetworkNodeDataBase;
|
|
484
|
+
device: DeviceNodeData;
|
|
485
|
+
'vertical-pdu': NetworkNodeDataBase;
|
|
486
|
+
splice: NetworkNodeDataBase;
|
|
487
|
+
'splice-tray': NetworkNodeDataBase;
|
|
488
|
+
tube: NetworkNodeDataBase;
|
|
489
|
+
cable: NetworkNodeDataBase;
|
|
490
|
+
'multi-tube-cable': NetworkNodeDataBase;
|
|
491
|
+
coupler: NetworkNodeDataBase;
|
|
492
|
+
closure: NetworkNodeDataBase;
|
|
493
|
+
'fibre-split': NetworkNodeDataBase;
|
|
494
|
+
'fibre-flow-cable': FibreFlowCableNodeData;
|
|
495
|
+
'fibre-flow-closure': FibreFlowClosureNodeData;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Union of all node data variants.
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
501
|
+
type NetworkNodeData = NetworkNodeDataByType[NetworkNodeType];
|
|
502
|
+
/**
|
|
503
|
+
* Network node structure with data discriminated by `type`.
|
|
504
|
+
* @public
|
|
505
|
+
*/
|
|
506
|
+
type NetworkNode<TType extends NetworkNodeType = NetworkNodeType, TExtra = unknown> = TType extends NetworkNodeType ? Node<NetworkNodeDataByType[TType] & TExtra, TType> & {
|
|
76
507
|
/** Type of network node */
|
|
77
|
-
type:
|
|
78
|
-
/** Position coordinates in the diagram */
|
|
79
|
-
position: {
|
|
80
|
-
x: number;
|
|
81
|
-
y: number;
|
|
82
|
-
};
|
|
83
|
-
/** Parent node ID for React Flow sub-flows */
|
|
84
|
-
parentId?: string;
|
|
85
|
-
/** Node extent for sub-flows */
|
|
86
|
-
extent?: 'parent' | [[number, number], [number, number]];
|
|
508
|
+
type: TType;
|
|
87
509
|
/** Node data and configuration */
|
|
88
|
-
data:
|
|
89
|
-
|
|
90
|
-
label: string;
|
|
91
|
-
/** Port configurations for the device */
|
|
92
|
-
ports?: PortBlock[];
|
|
93
|
-
/** List of connected node IDs */
|
|
94
|
-
connections?: string[];
|
|
95
|
-
/** Current status of the device */
|
|
96
|
-
status?: DeviceStatus;
|
|
97
|
-
/** NetBox integration ID */
|
|
98
|
-
netboxId?: number;
|
|
99
|
-
/** NetBox object type */
|
|
100
|
-
netboxType?: 'device' | 'rack' | 'interface' | 'cable';
|
|
101
|
-
/** Rack height in U units */
|
|
102
|
-
uHeight?: number;
|
|
103
|
-
/** Device position within rack in U units */
|
|
104
|
-
uPosition?: number;
|
|
105
|
-
/** Current view orientation */
|
|
106
|
-
view?: DeviceView;
|
|
107
|
-
/** Device type specification */
|
|
108
|
-
deviceType?: string;
|
|
109
|
-
/** Device manufacturer */
|
|
110
|
-
manufacturer?: string;
|
|
111
|
-
/** Device role in network */
|
|
112
|
-
role?: string;
|
|
113
|
-
/** Device width configuration */
|
|
114
|
-
width?: Width;
|
|
115
|
-
/** Rear port configurations */
|
|
116
|
-
rearPorts?: PortBlock[];
|
|
117
|
-
/** Power port side for rear view */
|
|
118
|
-
powerSide?: PowerSide;
|
|
119
|
-
/** Optional front image URL for device background */
|
|
120
|
-
frontImageUrl?: string;
|
|
121
|
-
/** Optional rear image URL for device background */
|
|
122
|
-
rearImageUrl?: string;
|
|
123
|
-
/** Optional background sizing for device images */
|
|
124
|
-
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
125
|
-
/** Optional background position for device images */
|
|
126
|
-
imagePosition?: string;
|
|
127
|
-
/** Optional background repeat for device images */
|
|
128
|
-
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
129
|
-
/** Vertical PDU height in centimeters */
|
|
130
|
-
heightCm?: number;
|
|
131
|
-
/** Number of AC power ports */
|
|
132
|
-
powerPorts?: number;
|
|
133
|
-
/** U numbering direction for rack nodes */
|
|
134
|
-
uNumberingDirection?: UNumberingDirection;
|
|
135
|
-
/** Custom header text for rack nodes */
|
|
136
|
-
customHeaderText?: string;
|
|
137
|
-
/** Holder position within tray (1-12) for splice nodes */
|
|
138
|
-
holderPosition?: number;
|
|
139
|
-
/** Loss value in dB for splice nodes */
|
|
140
|
-
lossDb?: number;
|
|
141
|
-
/** Connector type for coupler nodes */
|
|
142
|
-
connector?: 'SC' | 'LC';
|
|
143
|
-
/** Number of fibers for coupler nodes (1, 2, or 4) */
|
|
144
|
-
couplerFiberCount?: 1 | 2 | 4;
|
|
145
|
-
/** Optional port labels for left side of coupler */
|
|
146
|
-
portLabelsLeft?: string[];
|
|
147
|
-
/** Optional port labels for right side of coupler */
|
|
148
|
-
portLabelsRight?: string[];
|
|
149
|
-
/** Slot position for couplers inside panels (1-based, vertical slots aligned to right edge) */
|
|
150
|
-
slotPosition?: number;
|
|
151
|
-
/** Width override for container nodes (patch-panel, closure) */
|
|
152
|
-
panelWidth?: number;
|
|
153
|
-
/** Height override for container nodes (patch-panel, closure) */
|
|
154
|
-
panelHeight?: number;
|
|
155
|
-
/** Optional rack width in pixels (for rack nodes, default: 300px) */
|
|
156
|
-
rackWidthPx?: number;
|
|
157
|
-
/** Number of rows for container nodes (patch-panel, closure) */
|
|
158
|
-
rows?: number;
|
|
159
|
-
/** Number of columns for container nodes (patch-panel, closure) */
|
|
160
|
-
cols?: number;
|
|
161
|
-
/** Header text for container nodes */
|
|
162
|
-
header?: string;
|
|
163
|
-
/** Type of fibre splitter: 'splitter' or 'WDM' (default: 'splitter') */
|
|
164
|
-
splitterType?: 'splitter' | 'WDM';
|
|
165
|
-
/** Number of input fibers on the left (1 or 2, default: 1) */
|
|
166
|
-
inputCount?: number;
|
|
167
|
-
/** Number of output fibers on the right (1-64, default: 8) */
|
|
168
|
-
outputCount?: number;
|
|
169
|
-
/** Additional custom properties */
|
|
170
|
-
[key: string]: any;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
510
|
+
data: NetworkNodeDataByType[TType] & TExtra;
|
|
511
|
+
} : never;
|
|
173
512
|
/**
|
|
174
513
|
* Network edge types
|
|
175
514
|
* @public
|
|
176
515
|
*/
|
|
177
516
|
type NetworkEdgeType = 'fiber' | 'ethernet' | 'power' | 'smoothstep' | 'step' | 'thick-cable' | 'fibre-flow' | 'fibre-flow-link';
|
|
517
|
+
/**
|
|
518
|
+
* Edge data payload.
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
interface NetworkEdgeData {
|
|
522
|
+
/** Connection bandwidth */
|
|
523
|
+
bandwidth?: string;
|
|
524
|
+
/** Cable length */
|
|
525
|
+
length?: number;
|
|
526
|
+
/** Edge color for styling */
|
|
527
|
+
color?: string;
|
|
528
|
+
/** Edge kind for styling/validation */
|
|
529
|
+
kind?: 'fiber' | 'power' | 'network';
|
|
530
|
+
/** Whether this edge represents a ribbon fiber connection */
|
|
531
|
+
isRibbon?: boolean;
|
|
532
|
+
/** Array of fiber IDs for ribbon mode (6-12 fibers) */
|
|
533
|
+
ribbonFiberIds?: number[];
|
|
534
|
+
/** Highlight edge with a pulsing stroke */
|
|
535
|
+
highlight?: boolean;
|
|
536
|
+
/** Override highlight color (defaults to edge color) */
|
|
537
|
+
highlightColor?: string;
|
|
538
|
+
/** Override highlight max stroke width */
|
|
539
|
+
highlightWidth?: number;
|
|
540
|
+
/** Optional tag for grouping edges in demos */
|
|
541
|
+
traceTag?: string;
|
|
542
|
+
/** Legacy striped edge flag */
|
|
543
|
+
striped?: boolean;
|
|
544
|
+
/** Cable type metadata used by demos/helpers */
|
|
545
|
+
cableType?: PortCableType;
|
|
546
|
+
/** NetBox integration metadata */
|
|
547
|
+
netboxId?: number | string;
|
|
548
|
+
netboxType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
549
|
+
/** Inventory integration metadata */
|
|
550
|
+
inventoryId?: number | string;
|
|
551
|
+
inventoryType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
552
|
+
/** Status metadata */
|
|
553
|
+
status?: string;
|
|
554
|
+
/** Endpoint metadata */
|
|
555
|
+
terminationA?: string;
|
|
556
|
+
terminationB?: string;
|
|
557
|
+
/** Optional display label for the edge */
|
|
558
|
+
label?: string;
|
|
559
|
+
/** Optional opacity for styling (0–1) */
|
|
560
|
+
opacity?: number;
|
|
561
|
+
/** Additional extension metadata */
|
|
562
|
+
metadata?: Record<string, unknown>;
|
|
563
|
+
}
|
|
178
564
|
/**
|
|
179
565
|
* Network edge data structure
|
|
180
566
|
* @public
|
|
181
567
|
*/
|
|
182
|
-
|
|
568
|
+
type NetworkEdge<TData extends NetworkEdgeData = NetworkEdgeData> = {
|
|
183
569
|
/** Unique identifier for the edge */
|
|
184
570
|
id: string;
|
|
185
571
|
/** Source node ID */
|
|
@@ -193,31 +579,8 @@ interface NetworkEdge {
|
|
|
193
579
|
/** Type of network connection */
|
|
194
580
|
type?: NetworkEdgeType;
|
|
195
581
|
/** Edge data and configuration */
|
|
196
|
-
data?:
|
|
197
|
-
|
|
198
|
-
bandwidth?: string;
|
|
199
|
-
/** Cable length */
|
|
200
|
-
length?: number;
|
|
201
|
-
/** Edge color for styling */
|
|
202
|
-
color?: string;
|
|
203
|
-
/** Edge kind for styling/validation */
|
|
204
|
-
kind?: 'fiber' | 'power' | 'network';
|
|
205
|
-
/** Whether this edge represents a ribbon fiber connection */
|
|
206
|
-
isRibbon?: boolean;
|
|
207
|
-
/** Array of fiber IDs for ribbon mode (6-12 fibers) */
|
|
208
|
-
ribbonFiberIds?: number[];
|
|
209
|
-
/** Highlight edge with a pulsing stroke */
|
|
210
|
-
highlight?: boolean;
|
|
211
|
-
/** Override highlight color (defaults to edge color) */
|
|
212
|
-
highlightColor?: string;
|
|
213
|
-
/** Override highlight max stroke width */
|
|
214
|
-
highlightWidth?: number;
|
|
215
|
-
/** Optional tag for grouping edges in demos */
|
|
216
|
-
traceTag?: string;
|
|
217
|
-
/** Additional custom properties */
|
|
218
|
-
[key: string]: any;
|
|
219
|
-
};
|
|
220
|
-
}
|
|
582
|
+
data?: TData;
|
|
583
|
+
};
|
|
221
584
|
/**
|
|
222
585
|
* Rack device types
|
|
223
586
|
* @public
|
|
@@ -252,7 +615,7 @@ interface RackConfig {
|
|
|
252
615
|
* Device mounted in a rack
|
|
253
616
|
* @public
|
|
254
617
|
*/
|
|
255
|
-
interface RackDevice {
|
|
618
|
+
interface RackDevice extends DeviceImageOptions {
|
|
256
619
|
/** Unique device identifier */
|
|
257
620
|
id: string;
|
|
258
621
|
/** Device display name */
|
|
@@ -267,22 +630,14 @@ interface RackDevice {
|
|
|
267
630
|
width?: Width;
|
|
268
631
|
/** Device role in network */
|
|
269
632
|
role?: string;
|
|
633
|
+
/** Current status of the device */
|
|
634
|
+
status?: DeviceStatus | string;
|
|
270
635
|
/** Front port configurations */
|
|
271
636
|
ports?: PortBlock[];
|
|
272
637
|
/** Rear port configurations */
|
|
273
638
|
rearPorts?: PortBlock[];
|
|
274
639
|
/** Power port side for rear view */
|
|
275
640
|
powerSide?: PowerSide;
|
|
276
|
-
/** Optional front image URL for device background */
|
|
277
|
-
frontImageUrl?: string;
|
|
278
|
-
/** Optional rear image URL for device background */
|
|
279
|
-
rearImageUrl?: string;
|
|
280
|
-
/** Optional background sizing for device images */
|
|
281
|
-
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
282
|
-
/** Optional background position for device images */
|
|
283
|
-
imagePosition?: string;
|
|
284
|
-
/** Optional background repeat for device images */
|
|
285
|
-
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
286
641
|
/** Connected device IDs */
|
|
287
642
|
connections?: string[];
|
|
288
643
|
}
|
|
@@ -349,6 +704,139 @@ interface SpliceTrayConfig {
|
|
|
349
704
|
/** Splices in this tray */
|
|
350
705
|
splices: SpliceConfig[];
|
|
351
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Fine-grained interaction controls for network diagrams.
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
interface NetworkDiagramInteractionOptions {
|
|
712
|
+
/** Enable node dragging. */
|
|
713
|
+
nodesDraggable?: boolean;
|
|
714
|
+
/** Enable creating connections from node handles. */
|
|
715
|
+
nodesConnectable?: boolean;
|
|
716
|
+
/** Enable selecting nodes/edges. */
|
|
717
|
+
elementsSelectable?: boolean;
|
|
718
|
+
/** Enable keyboard/mouse focus on edges. */
|
|
719
|
+
edgesFocusable?: boolean;
|
|
720
|
+
/** Enable reconnecting existing edges. */
|
|
721
|
+
edgesReconnectable?: boolean;
|
|
722
|
+
/** Enable click-to-connect behavior on handles. */
|
|
723
|
+
connectOnClick?: boolean;
|
|
724
|
+
/** Enable panning by dragging the canvas. */
|
|
725
|
+
panOnDrag?: boolean;
|
|
726
|
+
/** Enable panning by scrolling. */
|
|
727
|
+
panOnScroll?: boolean;
|
|
728
|
+
/** Enable zoom via mouse wheel/trackpad scroll. */
|
|
729
|
+
zoomOnScroll?: boolean;
|
|
730
|
+
/** Enable pinch-zoom gestures. */
|
|
731
|
+
zoomOnPinch?: boolean;
|
|
732
|
+
/** Enable zoom on double click. */
|
|
733
|
+
zoomOnDoubleClick?: boolean;
|
|
734
|
+
/** Enable deleting selected edges with keyboard keys. */
|
|
735
|
+
allowKeyboardDelete?: boolean;
|
|
736
|
+
/** Show or hide the built-in React Flow controls widget. */
|
|
737
|
+
showControls?: boolean;
|
|
738
|
+
/** Show or hide the minimap. */
|
|
739
|
+
showMiniMap?: boolean;
|
|
740
|
+
/** Show or hide the interactive lock/unlock button in controls. */
|
|
741
|
+
showInteractiveControl?: boolean;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Selection action panel options rendered above selected racks/devices.
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
interface NetworkDiagramActionPanelOptions {
|
|
748
|
+
/** Enable or disable the floating action panel entirely. Defaults to true. */
|
|
749
|
+
enabled?: boolean;
|
|
750
|
+
/** Show or hide the front/rear toggle button. Defaults to true. */
|
|
751
|
+
showRearToggle?: boolean;
|
|
752
|
+
/** Show or hide the De-rack button for rack-mounted devices. Defaults to true. */
|
|
753
|
+
showDeRack?: boolean;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Serializable flow snapshot payload for save/restore helpers.
|
|
757
|
+
* @public
|
|
758
|
+
*/
|
|
759
|
+
interface NetworkDiagramFlowObject {
|
|
760
|
+
/** Snapshot nodes */
|
|
761
|
+
nodes: NetworkNode[];
|
|
762
|
+
/** Snapshot edges */
|
|
763
|
+
edges: NetworkEdge[];
|
|
764
|
+
/** Optional viewport state */
|
|
765
|
+
viewport?: Viewport;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Options for exported diagram images.
|
|
769
|
+
* @public
|
|
770
|
+
*/
|
|
771
|
+
interface NetworkDiagramToImageOptions {
|
|
772
|
+
/** Export width in px (clamped to 1-8192). */
|
|
773
|
+
width?: number;
|
|
774
|
+
/** Export height in px (clamped to 1-8192). */
|
|
775
|
+
height?: number;
|
|
776
|
+
backgroundColor?: string;
|
|
777
|
+
/** Export padding in px (clamped to 0-2048). */
|
|
778
|
+
padding?: number;
|
|
779
|
+
/** Device pixel ratio multiplier (clamped to 0.1-4). */
|
|
780
|
+
pixelRatio?: number;
|
|
781
|
+
/** JPEG/WebP quality (clamped to 0-1 when used). */
|
|
782
|
+
quality?: number;
|
|
783
|
+
filter?: (domNode: HTMLElement) => boolean;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Fit-view options that support targeting node IDs directly.
|
|
787
|
+
* @public
|
|
788
|
+
*/
|
|
789
|
+
interface NetworkDiagramFitViewOptions extends Omit<FitViewOptions, 'nodes'> {
|
|
790
|
+
/** Optional node IDs to fit */
|
|
791
|
+
nodes?: string[];
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Exposed methods for save/restore and export integrations.
|
|
795
|
+
* @public
|
|
796
|
+
*/
|
|
797
|
+
interface NetworkDiagramFlowMethods {
|
|
798
|
+
toObject: () => NetworkDiagramFlowObject;
|
|
799
|
+
setViewport: (viewport: Viewport) => void;
|
|
800
|
+
setNodes: (nodes: NetworkNode[]) => void;
|
|
801
|
+
setEdges: (edges: NetworkEdge[]) => void;
|
|
802
|
+
toImage: (options?: NetworkDiagramToImageOptions) => Promise<string>;
|
|
803
|
+
getNodes: () => NetworkNode[];
|
|
804
|
+
getEdges: () => NetworkEdge[];
|
|
805
|
+
fitView: (options?: NetworkDiagramFitViewOptions) => void;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Store contract accepted by `NetworkDiagram`.
|
|
809
|
+
* @public
|
|
810
|
+
*/
|
|
811
|
+
interface NetworkDiagramStoreApi {
|
|
812
|
+
getState: () => {
|
|
813
|
+
nodes: NetworkNode[];
|
|
814
|
+
edges: NetworkEdge[];
|
|
815
|
+
debug?: boolean;
|
|
816
|
+
};
|
|
817
|
+
setState: (partial: Partial<{
|
|
818
|
+
nodes: NetworkNode[];
|
|
819
|
+
edges: NetworkEdge[];
|
|
820
|
+
debug?: boolean;
|
|
821
|
+
}>) => void;
|
|
822
|
+
subscribe: (listener: (state: {
|
|
823
|
+
nodes: NetworkNode[];
|
|
824
|
+
edges: NetworkEdge[];
|
|
825
|
+
debug?: boolean;
|
|
826
|
+
}) => void) => () => void;
|
|
827
|
+
selectEdgeZIndex: (edge: NetworkEdge) => number;
|
|
828
|
+
validateConnection: (params: {
|
|
829
|
+
source: string | null;
|
|
830
|
+
target: string | null;
|
|
831
|
+
sourceHandle?: string | null;
|
|
832
|
+
targetHandle?: string | null;
|
|
833
|
+
}) => {
|
|
834
|
+
valid: boolean;
|
|
835
|
+
reason?: string;
|
|
836
|
+
};
|
|
837
|
+
selectNodeById: (id: string) => NetworkNode | undefined;
|
|
838
|
+
selectConnectedEdges: (nodeId: string) => NetworkEdge[];
|
|
839
|
+
}
|
|
352
840
|
/**
|
|
353
841
|
* Network diagram component props
|
|
354
842
|
* @public
|
|
@@ -367,7 +855,7 @@ interface NetworkDiagramProps {
|
|
|
367
855
|
/** Initial edges for uncontrolled mode */
|
|
368
856
|
initialEdges?: NetworkEdge[];
|
|
369
857
|
/** Headless store injection */
|
|
370
|
-
store?:
|
|
858
|
+
store?: NetworkDiagramStoreApi;
|
|
371
859
|
/** Enable debug mode */
|
|
372
860
|
debug?: boolean;
|
|
373
861
|
/** Callback when a node is clicked or selection changes (null when deselected) */
|
|
@@ -396,21 +884,14 @@ interface NetworkDiagramProps {
|
|
|
396
884
|
style?: React.CSSProperties;
|
|
397
885
|
/** If true, vertically align rack bottoms to the same baseline */
|
|
398
886
|
alignRacksToBottom?: boolean;
|
|
887
|
+
/** Allow rack-mounted devices to move between racks/ungroup on drag and drop. Defaults to true. */
|
|
888
|
+
reAssignable?: boolean;
|
|
399
889
|
/** Color mode for the diagram */
|
|
400
890
|
colorMode?: 'light' | 'dark' | 'system';
|
|
401
891
|
/** Callback when React Flow instance is initialized */
|
|
402
|
-
onInit?: (instance:
|
|
892
|
+
onInit?: (instance: ReactFlowInstance) => void;
|
|
403
893
|
/** Callback to get React Flow methods for save/restore */
|
|
404
|
-
onFlowMethods?: (methods:
|
|
405
|
-
toObject: () => any;
|
|
406
|
-
setViewport: (viewport: any) => void;
|
|
407
|
-
setNodes: (nodes: any[]) => void;
|
|
408
|
-
setEdges: (edges: any[]) => void;
|
|
409
|
-
toImage: (options?: any) => Promise<string>;
|
|
410
|
-
getNodes: () => any[];
|
|
411
|
-
getEdges: () => any[];
|
|
412
|
-
fitView: (options?: any) => void;
|
|
413
|
-
}) => void;
|
|
894
|
+
onFlowMethods?: (methods: NetworkDiagramFlowMethods) => void;
|
|
414
895
|
/** Show download button */
|
|
415
896
|
showDownloadButton?: boolean;
|
|
416
897
|
/** Download button position */
|
|
@@ -421,6 +902,12 @@ interface NetworkDiagramProps {
|
|
|
421
902
|
downloadButtonStyle?: React.CSSProperties;
|
|
422
903
|
/** Use smoothstep edges for tube connections (both tube-to-cable and cable-to-tube). Default is fiber. */
|
|
423
904
|
useSmoothstepEdgesForTubes?: boolean;
|
|
905
|
+
/** Force read-only behavior for the diagram (no drag/connect/delete/reconnect/pan/zoom edits). */
|
|
906
|
+
readOnly?: boolean;
|
|
907
|
+
/** Centralized interaction options for consistent edit/lock behavior. */
|
|
908
|
+
interaction?: NetworkDiagramInteractionOptions;
|
|
909
|
+
/** Configuration for the floating action panel shown on selected rack/device nodes. */
|
|
910
|
+
actionPanel?: NetworkDiagramActionPanelOptions;
|
|
424
911
|
/** Enable connecting edges by clicking on handles. When true, increases handle sizes for better touch targets. Default is true. */
|
|
425
912
|
connectOnClick?: boolean;
|
|
426
913
|
/** Disable panning on drag. Default is false. */
|
|
@@ -638,47 +1125,6 @@ declare const ClosureNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
|
638
1125
|
*/
|
|
639
1126
|
declare const FibreSplitNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
640
1127
|
|
|
641
|
-
type FibreFlowCableKind = 'simple' | 'tube';
|
|
642
|
-
interface FibreFlowEndpoint {
|
|
643
|
-
tube?: number;
|
|
644
|
-
fiber: number;
|
|
645
|
-
}
|
|
646
|
-
interface FibreFlowSplice {
|
|
647
|
-
id: string;
|
|
648
|
-
from: FibreFlowEndpoint;
|
|
649
|
-
to: FibreFlowEndpoint;
|
|
650
|
-
lossDb?: number;
|
|
651
|
-
circuitId?: string;
|
|
652
|
-
label?: string;
|
|
653
|
-
color?: string;
|
|
654
|
-
}
|
|
655
|
-
interface FibreFlowCable {
|
|
656
|
-
id: string;
|
|
657
|
-
label: string;
|
|
658
|
-
kind?: FibreFlowCableKind;
|
|
659
|
-
fiberCount?: number;
|
|
660
|
-
tubeCount?: number;
|
|
661
|
-
fibersPerTube?: number;
|
|
662
|
-
tubeStartIndex?: number;
|
|
663
|
-
fiberStartIndex?: number;
|
|
664
|
-
tubeColorMap?: Record<number, string>;
|
|
665
|
-
jacketColor?: string;
|
|
666
|
-
distanceLabel?: string;
|
|
667
|
-
distanceMeters?: number;
|
|
668
|
-
}
|
|
669
|
-
interface FibreFlowClosure {
|
|
670
|
-
id: string;
|
|
671
|
-
chamberId?: string;
|
|
672
|
-
leftCable: FibreFlowCable;
|
|
673
|
-
rightCable: FibreFlowCable;
|
|
674
|
-
splices: FibreFlowSplice[];
|
|
675
|
-
}
|
|
676
|
-
interface FibreFlowCircuit {
|
|
677
|
-
id: string;
|
|
678
|
-
label: string;
|
|
679
|
-
color?: string;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
1128
|
type FibreFlowLayoutDirection = 'horizontal' | 'vertical';
|
|
683
1129
|
type FibreFlowColorMode = 'dark' | 'light';
|
|
684
1130
|
interface FibreFlowMapProps {
|
|
@@ -697,6 +1143,7 @@ interface FibreFlowMapProps {
|
|
|
697
1143
|
showCircuitId?: boolean;
|
|
698
1144
|
className?: string;
|
|
699
1145
|
style?: React$1.CSSProperties;
|
|
1146
|
+
readOnly?: boolean;
|
|
700
1147
|
panOnDrag?: boolean;
|
|
701
1148
|
panOnScroll?: boolean;
|
|
702
1149
|
zoomOnScroll?: boolean;
|
|
@@ -845,6 +1292,34 @@ declare const inventoryToNetworkDiagram: (data: {
|
|
|
845
1292
|
*/
|
|
846
1293
|
declare const generateLayout: (nodes: NetworkNode[]) => NetworkNode[];
|
|
847
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* Convert NetBox rack data to NetworkNode
|
|
1297
|
+
*/
|
|
1298
|
+
declare const netboxRackToNetworkNode: (rack: NetBoxRack) => NetworkNode;
|
|
1299
|
+
/**
|
|
1300
|
+
* Convert NetBox device data to NetworkNode
|
|
1301
|
+
*/
|
|
1302
|
+
declare const netboxDeviceToNetworkNode: (device: NetBoxDevice) => NetworkNode;
|
|
1303
|
+
/**
|
|
1304
|
+
* Convert NetBox cable data to NetworkEdge
|
|
1305
|
+
*/
|
|
1306
|
+
declare const netboxCableToNetworkEdge: (cable: NetBoxCable) => NetworkEdge;
|
|
1307
|
+
/**
|
|
1308
|
+
* Convert NetBox data to network diagram format
|
|
1309
|
+
*/
|
|
1310
|
+
declare const netboxToNetworkDiagram: (data: {
|
|
1311
|
+
racks: NetBoxRack[];
|
|
1312
|
+
devices: NetBoxDevice[];
|
|
1313
|
+
cables: NetBoxCable[];
|
|
1314
|
+
}) => {
|
|
1315
|
+
nodes: NetworkNode[];
|
|
1316
|
+
edges: NetworkEdge[];
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* Calculate U position for devices in a rack
|
|
1320
|
+
*/
|
|
1321
|
+
declare const calculateUPositions: (devices: NetBoxDevice[], _rackHeight: number) => Map<number, number>;
|
|
1322
|
+
|
|
848
1323
|
/**
|
|
849
1324
|
* Snap a device position to the nearest U position within a rack
|
|
850
1325
|
*/
|
|
@@ -874,11 +1349,11 @@ declare const calculateDevicePositionFromU: (rack: NetworkNode, uPosition: numbe
|
|
|
874
1349
|
/**
|
|
875
1350
|
* Update device U position and recalculate position
|
|
876
1351
|
*/
|
|
877
|
-
declare const updateDeviceUPosition$1: (device: NetworkNode
|
|
1352
|
+
declare const updateDeviceUPosition$1: (device: NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">, rack: NetworkNode, newUPosition: number) => NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">;
|
|
878
1353
|
/**
|
|
879
1354
|
* Validate and snap device to valid U position
|
|
880
1355
|
*/
|
|
881
|
-
declare const validateAndSnapDevice: (device: NetworkNode
|
|
1356
|
+
declare const validateAndSnapDevice: (device: NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">, rack: NetworkNode) => NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">;
|
|
882
1357
|
|
|
883
1358
|
/**
|
|
884
1359
|
* Snap a splice to the nearest holder position within a tray
|
|
@@ -1115,7 +1590,31 @@ declare function calculateCouplerSpacing(numCouplers: number, couplerHeight: num
|
|
|
1115
1590
|
* @public
|
|
1116
1591
|
*/
|
|
1117
1592
|
declare function calculateCouplerSlotSpacing(numCouplers: number, couplerHeight: number, availableHeight: number): number;
|
|
1593
|
+
/**
|
|
1594
|
+
* Calculate closure dimensions based on child nodes
|
|
1595
|
+
*
|
|
1596
|
+
* Automatically calculates the width and height of a closure based on its child nodes.
|
|
1597
|
+
* Supports special layouts for closures with tubes and trays.
|
|
1598
|
+
* Closure layout: [padding] [left tubes] [spacing] [trays] [spacing] [right tubes] [padding]
|
|
1599
|
+
*
|
|
1600
|
+
* @param closureNode - The closure node
|
|
1601
|
+
* @param childNodes - Array of child nodes within the closure
|
|
1602
|
+
* @returns Object with calculated width and height in pixels
|
|
1603
|
+
* @public
|
|
1604
|
+
*
|
|
1605
|
+
* @example
|
|
1606
|
+
* ```ts
|
|
1607
|
+
* const closure = { id: 'closure-1', type: 'closure', data: {} };
|
|
1608
|
+
* const children = [leftTubeNode, trayNode, rightTubeNode];
|
|
1609
|
+
* const dims = calculateClosureDimensions(closure, children);
|
|
1610
|
+
* ```
|
|
1611
|
+
*/
|
|
1612
|
+
declare function calculateClosureDimensions(closureNode: NetworkNode, childNodes: NetworkNode[]): {
|
|
1613
|
+
width: number;
|
|
1614
|
+
height: number;
|
|
1615
|
+
};
|
|
1118
1616
|
|
|
1617
|
+
type RackMountedNodeType = 'device' | 'server' | 'switch' | 'router' | 'patch-panel' | 'vertical-pdu';
|
|
1119
1618
|
/**
|
|
1120
1619
|
* Configuration options for building nodes from rack schema
|
|
1121
1620
|
*/
|
|
@@ -1125,7 +1624,7 @@ interface RackSchemaOptions {
|
|
|
1125
1624
|
/** Whether to validate all placements before creating nodes */
|
|
1126
1625
|
validatePlacements?: boolean;
|
|
1127
1626
|
/** Custom device type mapping from schema to NetworkNode type */
|
|
1128
|
-
deviceTypeMapping?: Record<string,
|
|
1627
|
+
deviceTypeMapping?: Record<string, RackMountedNodeType>;
|
|
1129
1628
|
}
|
|
1130
1629
|
/**
|
|
1131
1630
|
* Error thrown when device placement conflicts occur in strict mode
|
|
@@ -1427,7 +1926,7 @@ declare function fiberSolidOrStriped(id: FiberColorId | number): React$1.CSSProp
|
|
|
1427
1926
|
declare function getFiberColor(id: FiberColorId | number): string;
|
|
1428
1927
|
|
|
1429
1928
|
/**
|
|
1430
|
-
* Calculate the bounding box of a rack node
|
|
1929
|
+
* Calculate the bounding box of a rack node (header + body)
|
|
1431
1930
|
* @param rack - The rack node
|
|
1432
1931
|
* @returns Object with left, right, top, and bottom coordinates
|
|
1433
1932
|
* @public
|
|
@@ -1483,8 +1982,10 @@ interface ReplaceEdgeOptions {
|
|
|
1483
1982
|
edgeType: 'power' | 'fiber' | 'step' | 'smoothstep' | 'thick-cable';
|
|
1484
1983
|
/** Function to calculate zIndex for the edge */
|
|
1485
1984
|
selectEdgeZIndex: (edge: NetworkEdge) => number;
|
|
1486
|
-
/**
|
|
1985
|
+
/** Which end of the connection to use (source or target) for finding the edge */
|
|
1487
1986
|
findBy: 'source' | 'target';
|
|
1987
|
+
/** Which end of the existing edge to match against. Defaults to findBy. Use 'source' when the connection's target handle is on the edge's source (e.g. replacing switch connection when dragging from server to switch) */
|
|
1988
|
+
matchOn?: 'source' | 'target';
|
|
1488
1989
|
/** Optional edge data to set on the new edge */
|
|
1489
1990
|
data?: NetworkEdge['data'];
|
|
1490
1991
|
}
|
|
@@ -1507,6 +2008,8 @@ interface ValidateConnectionParams {
|
|
|
1507
2008
|
target: string | null;
|
|
1508
2009
|
sourceHandle?: string | null;
|
|
1509
2010
|
targetHandle?: string | null;
|
|
2011
|
+
/** Optional edge id to ignore during occupancy checks (used for reconnect). */
|
|
2012
|
+
ignoreEdgeId?: string;
|
|
1510
2013
|
}
|
|
1511
2014
|
interface ValidationResult {
|
|
1512
2015
|
valid: boolean;
|
|
@@ -1530,4 +2033,4 @@ declare function useNetworkDiagram(store: NetworkDiagramStore): NetworkDiagramSt
|
|
|
1530
2033
|
declare function useNodes(store: NetworkDiagramStore): NetworkNode[];
|
|
1531
2034
|
declare function useEdges(store: NetworkDiagramStore): NetworkEdge[];
|
|
1532
2035
|
|
|
1533
|
-
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, DeviceNode, DevicePlacementError, type DevicePlacementValidation, DiagramErrorBoundary, type DiagramErrorBoundaryProps, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, FibreCableWithTubesExpanded, type FibreFlowCable, type FibreFlowCableKind, type FibreFlowCircuit, type FibreFlowClosure, type FibreFlowEndpoint, FibreFlowMap, type FibreFlowMapProps, type FibreFlowSplice, FibreSplitNode, HANDLE_EXTENSION_PX, MultiTubeCableNode, NetworkDiagram, type NetworkDiagramProps, type NetworkEdge, type NetworkNode, PANEL_BORDER_WIDTH, PANEL_HEADER_HEIGHT, PANEL_HEIGHT_PX, PANEL_PADDING, PANEL_TUBE_TRAY_SPACING, PANEL_WIDTH_PX, POWER_CONNECTORS, PatchPanelNode, type Port, type PortBlock, type PortType, PowerEdge, RACK_HEADER_HEIGHT, RACK_WIDTH_PX, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, U_HEIGHT_PX, VerticalPDU, Width, addDeviceToRack, addSpliceToTray, baseColorFor, buildNodesFromRackConfig, buildNodesFromSpliceConfig, calculateCouplerRightX, calculateCouplerSlotSpacing, calculateCouplerSpacing, calculateDevicePositionFromU, calculatePanelDimensions, calculateSlotPositionFromY, calculateSplicePositionFromNumber, calculateYFromSlotPosition, createNetworkDiagramStore, createRackConfigFromNodes, createSpliceConfigFromNodes, fiberSolidOrStriped, findNearestRack, findNextAvailableHolderPosition, findNextAvailableUPosition, generateLayout, getConnectorConfig, getCouplerDimensions, getDeviceConnectorType, getFiberColor, getInnerContentWidth, getPDUPortType, getPanelHeight, getPanelWidth, getPowerPortStyle, getRackBounds, getStatusColor, getTrayDimensions, getTubeDimensions, inventoryCableToNetworkEdge, inventoryDeviceToNetworkNode, inventoryRackToNetworkNode, inventoryToNetworkDiagram, isHighPowerConnector, isPointInRack, isStriped, isUPositionAvailable, removeDeviceFromRack, removeSpliceFromTray, replaceEdge, snapToCouplerPosition, snapToSplicePosition, snapToUPosition, updateDeviceUPosition$1 as updateDeviceUPosition, updateDeviceUPosition as updateDeviceUPositionInSchema, updateSpliceHolderPosition, useEdges as useDiagramEdges, useNodes as useDiagramNodes, useNetworkDiagram, validateAndSnapDevice, validateRackDevicePlacements, validateSplicePlacements };
|
|
2036
|
+
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, type DeviceImageFit, type DeviceImageOptions, type DeviceImageRepeat, DeviceNode, DevicePlacementError, type DevicePlacementValidation, DiagramErrorBoundary, type DiagramErrorBoundaryProps, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, FibreCableWithTubesExpanded, type FibreFlowCable, type FibreFlowCableKind, type FibreFlowCableNodeData, type FibreFlowCircuit, type FibreFlowClosure, type FibreFlowClosureNodeData, type FibreFlowEndpoint, FibreFlowMap, type FibreFlowMapProps, type FibreFlowSplice, FibreSplitNode, HANDLE_EXTENSION_PX, MultiTubeCableNode, NetworkDiagram, type NetworkDiagramFitViewOptions, type NetworkDiagramFlowMethods, type NetworkDiagramFlowObject, type NetworkDiagramOptions, type NetworkDiagramProps, type NetworkDiagramStoreApi, type NetworkDiagramToImageOptions, type NetworkEdge, type NetworkEdgeData, type NetworkNode, type NetworkNodeData, type NetworkNodeDataBase, type NetworkNodeDataByType, PANEL_BORDER_WIDTH, PANEL_HEADER_HEIGHT, PANEL_HEIGHT_PX, PANEL_PADDING, PANEL_TUBE_TRAY_SPACING, PANEL_WIDTH_PX, POWER_CONNECTORS, PatchPanelNode, type Port, type PortBlock, type PortCableType, type PortType, PowerEdge, RACK_HEADER_HEIGHT, RACK_WIDTH_PX, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, U_HEIGHT_PX, type ValidateConnectionParams, type ValidationResult, VerticalPDU, Width, addDeviceToRack, addSpliceToTray, baseColorFor, buildNodesFromRackConfig, buildNodesFromSpliceConfig, calculateClosureDimensions, calculateCouplerRightX, calculateCouplerSlotSpacing, calculateCouplerSpacing, calculateDevicePositionFromU, calculatePanelDimensions, calculateSlotPositionFromY, calculateSplicePositionFromNumber, calculateUPositions, calculateYFromSlotPosition, createNetworkDiagramStore, createRackConfigFromNodes, createSpliceConfigFromNodes, fiberSolidOrStriped, findNearestRack, findNextAvailableHolderPosition, findNextAvailableUPosition, generateLayout, getConnectorConfig, getCouplerDimensions, getDeviceConnectorType, getFiberColor, getInnerContentWidth, getPDUPortType, getPanelHeight, getPanelWidth, getPowerPortStyle, getRackBounds, getStatusColor, getTrayDimensions, getTubeDimensions, inventoryCableToNetworkEdge, inventoryDeviceToNetworkNode, inventoryRackToNetworkNode, inventoryToNetworkDiagram, isHighPowerConnector, isPointInRack, isStriped, isUPositionAvailable, netboxCableToNetworkEdge, netboxDeviceToNetworkNode, netboxRackToNetworkNode, netboxToNetworkDiagram, removeDeviceFromRack, removeSpliceFromTray, replaceEdge, snapToCouplerPosition, snapToSplicePosition, snapToUPosition, updateDeviceUPosition$1 as updateDeviceUPosition, updateDeviceUPosition as updateDeviceUPositionInSchema, updateSpliceHolderPosition, useEdges as useDiagramEdges, useNodes as useDiagramNodes, useNetworkDiagram, validateAndSnapDevice, validateRackDevicePlacements, validateSplicePlacements };
|