@msdshsk/react-er-canvas 0.0.2 → 0.0.3
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/components/JoinEdge.d.ts +4 -0
- package/dist/components/JoinEdge.d.ts.map +1 -1
- package/dist/components/MermaidER.d.ts +34 -5
- package/dist/components/MermaidER.d.ts.map +1 -1
- package/dist/components/TableNode.d.ts +4 -1
- package/dist/components/TableNode.d.ts.map +1 -1
- package/dist/core/model.d.ts +13 -0
- package/dist/core/model.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +206 -130
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./core-DZ30VgUT.js";
|
|
2
|
-
import { Fragment as c, createContext as l, forwardRef as u, memo as d, useCallback as f, useContext as p, useEffect as m, useImperativeHandle as h, useMemo as g, useRef as
|
|
3
|
-
import { Background as
|
|
2
|
+
import { Fragment as c, createContext as l, forwardRef as u, memo as d, useCallback as f, useContext as p, useEffect as m, useImperativeHandle as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
3
|
+
import { Background as y, BaseEdge as b, Controls as ee, EdgeLabelRenderer as x, Handle as S, MiniMap as te, Position as C, ReactFlow as ne, getSmoothStepPath as w, useNodesState as re, useReactFlow as T } from "@xyflow/react";
|
|
4
4
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/TableNode.tsx
|
|
6
6
|
var k = l(/* @__PURE__ */ new Map()), A = l({
|
|
7
7
|
enabled: !1,
|
|
8
|
+
showSelectAll: !1,
|
|
8
9
|
selected: /* @__PURE__ */ new Set(),
|
|
9
|
-
onToggle: () => void 0
|
|
10
|
-
|
|
10
|
+
onToggle: () => void 0,
|
|
11
|
+
onToggleAll: () => void 0
|
|
12
|
+
}), ie = l(!1), j = l({}), M = {
|
|
11
13
|
pk: {
|
|
12
14
|
label: "PK",
|
|
13
15
|
bg: "#f59e0b"
|
|
@@ -21,9 +23,9 @@ var k = l(/* @__PURE__ */ new Map()), A = l({
|
|
|
21
23
|
bg: "#10b981"
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
|
-
function
|
|
26
|
+
function N({ tableName: e, column: t, highlighted: n, onClick: r, selectionEnabled: i, selected: a, onSelectToggle: o }) {
|
|
25
27
|
let s = [];
|
|
26
|
-
return t.keys.pk && s.push(
|
|
28
|
+
return t.keys.pk && s.push(M.pk), t.keys.fk && s.push(M.fk), t.keys.uk && s.push(M.uk), /* @__PURE__ */ O("div", {
|
|
27
29
|
title: t.comment,
|
|
28
30
|
onClick: r ? () => r(e, t.name) : void 0,
|
|
29
31
|
style: {
|
|
@@ -98,8 +100,22 @@ function P({ tableName: e, column: t, highlighted: n, onClick: r, selectionEnabl
|
|
|
98
100
|
]
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
|
-
var
|
|
102
|
-
let { table: t } = e, n = p(k), r = p(A), i = p(
|
|
103
|
+
var ae = d(function({ data: e }) {
|
|
104
|
+
let { table: t } = e, n = p(k), r = p(A), i = p(ie), a = p(j), o = a.onColumnClick, s = n.get(t.name), l = t.group ? "#1e40af" : "#374151", u = r.enabled && r.showSelectAll && t.columns.length > 0, d = g(() => t.columns.map((e) => e.name), [t.columns]), f = g(() => {
|
|
105
|
+
if (!u) return 0;
|
|
106
|
+
let e = 0;
|
|
107
|
+
for (let n of d) r.selected.has(`${t.name}.${n}`) && e++;
|
|
108
|
+
return e;
|
|
109
|
+
}, [
|
|
110
|
+
u,
|
|
111
|
+
d,
|
|
112
|
+
r.selected,
|
|
113
|
+
t.name
|
|
114
|
+
]), h = u && f === d.length, v = u && f > 0 && f < d.length, y = _(null);
|
|
115
|
+
m(() => {
|
|
116
|
+
y.current && (y.current.indeterminate = v);
|
|
117
|
+
}, [v]);
|
|
118
|
+
let b = (e) => ({
|
|
103
119
|
...e,
|
|
104
120
|
width: i ? 9 : 6,
|
|
105
121
|
height: i ? 9 : 6,
|
|
@@ -124,17 +140,17 @@ var F = d(function({ data: e }) {
|
|
|
124
140
|
position: "relative"
|
|
125
141
|
},
|
|
126
142
|
children: [
|
|
127
|
-
/* @__PURE__ */ D(
|
|
143
|
+
/* @__PURE__ */ D(S, {
|
|
128
144
|
id: "__default-target",
|
|
129
145
|
type: "target",
|
|
130
146
|
position: C.Left,
|
|
131
|
-
style:
|
|
147
|
+
style: b({ top: 32 / 2 })
|
|
132
148
|
}),
|
|
133
|
-
/* @__PURE__ */ D(
|
|
149
|
+
/* @__PURE__ */ D(S, {
|
|
134
150
|
id: "__default-source",
|
|
135
151
|
type: "source",
|
|
136
152
|
position: C.Right,
|
|
137
|
-
style:
|
|
153
|
+
style: b({ top: 32 / 2 })
|
|
138
154
|
}),
|
|
139
155
|
/* @__PURE__ */ O("div", {
|
|
140
156
|
style: {
|
|
@@ -152,13 +168,39 @@ var F = d(function({ data: e }) {
|
|
|
152
168
|
borderTopLeftRadius: 6,
|
|
153
169
|
borderTopRightRadius: 6
|
|
154
170
|
},
|
|
155
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ O("span", {
|
|
156
172
|
style: {
|
|
173
|
+
display: "flex",
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
gap: 6,
|
|
157
176
|
overflow: "hidden",
|
|
158
|
-
|
|
159
|
-
whiteSpace: "nowrap"
|
|
177
|
+
minWidth: 0
|
|
160
178
|
},
|
|
161
|
-
children:
|
|
179
|
+
children: [u && /* @__PURE__ */ D("input", {
|
|
180
|
+
ref: y,
|
|
181
|
+
type: "checkbox",
|
|
182
|
+
className: "nodrag",
|
|
183
|
+
checked: h,
|
|
184
|
+
onChange: (e) => r.onToggleAll(t.name, d, e.target.checked),
|
|
185
|
+
onClick: (e) => e.stopPropagation(),
|
|
186
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
187
|
+
title: h ? "Deselect all columns" : v ? "Some columns selected — click to select all" : "Select all columns",
|
|
188
|
+
style: {
|
|
189
|
+
width: 13,
|
|
190
|
+
height: 13,
|
|
191
|
+
margin: 0,
|
|
192
|
+
flexShrink: 0,
|
|
193
|
+
cursor: "pointer",
|
|
194
|
+
accentColor: "#3b82f6"
|
|
195
|
+
}
|
|
196
|
+
}), /* @__PURE__ */ D("span", {
|
|
197
|
+
style: {
|
|
198
|
+
overflow: "hidden",
|
|
199
|
+
textOverflow: "ellipsis",
|
|
200
|
+
whiteSpace: "nowrap"
|
|
201
|
+
},
|
|
202
|
+
children: t.name
|
|
203
|
+
})]
|
|
162
204
|
}), /* @__PURE__ */ O("span", {
|
|
163
205
|
style: {
|
|
164
206
|
display: "flex",
|
|
@@ -179,7 +221,7 @@ var F = d(function({ data: e }) {
|
|
|
179
221
|
}), a.onTableRemove && /* @__PURE__ */ D("button", {
|
|
180
222
|
className: "nodrag",
|
|
181
223
|
onClick: (e) => {
|
|
182
|
-
e.stopPropagation(), a.onTableRemove?.(t.name);
|
|
224
|
+
e.stopPropagation(), a.onTableRemove?.(t.name, t.meta);
|
|
183
225
|
},
|
|
184
226
|
onMouseDown: (e) => e.stopPropagation(),
|
|
185
227
|
title: "Remove this table",
|
|
@@ -204,34 +246,34 @@ var F = d(function({ data: e }) {
|
|
|
204
246
|
})]
|
|
205
247
|
}),
|
|
206
248
|
t.columns.map((e, n) => {
|
|
207
|
-
let i = 32 + n * 22 + 22 / 2, a = s?.has(e.name) ?? !1, l = `${t.name}.${e.name}`,
|
|
249
|
+
let i = 32 + n * 22 + 22 / 2, a = s?.has(e.name) ?? !1, l = `${t.name}.${e.name}`, u = r.enabled && r.selected.has(l);
|
|
208
250
|
return /* @__PURE__ */ O(c, { children: [
|
|
209
|
-
/* @__PURE__ */ D(
|
|
251
|
+
/* @__PURE__ */ D(S, {
|
|
210
252
|
id: `${e.name}__target`,
|
|
211
253
|
type: "target",
|
|
212
254
|
position: C.Left,
|
|
213
|
-
style:
|
|
255
|
+
style: b({ top: i })
|
|
214
256
|
}),
|
|
215
|
-
/* @__PURE__ */ D(
|
|
257
|
+
/* @__PURE__ */ D(S, {
|
|
216
258
|
id: `${e.name}__source`,
|
|
217
259
|
type: "source",
|
|
218
260
|
position: C.Right,
|
|
219
|
-
style:
|
|
261
|
+
style: b({ top: i })
|
|
220
262
|
}),
|
|
221
|
-
/* @__PURE__ */ D(
|
|
263
|
+
/* @__PURE__ */ D(N, {
|
|
222
264
|
tableName: t.name,
|
|
223
265
|
column: e,
|
|
224
266
|
highlighted: a,
|
|
225
267
|
onClick: o,
|
|
226
268
|
selectionEnabled: r.enabled,
|
|
227
|
-
selected:
|
|
269
|
+
selected: u,
|
|
228
270
|
onSelectToggle: (n) => r.onToggle(t.name, e.name, n)
|
|
229
271
|
})
|
|
230
272
|
] }, `${e.name}-${n}`);
|
|
231
273
|
})
|
|
232
274
|
]
|
|
233
275
|
});
|
|
234
|
-
}),
|
|
276
|
+
}), P = d(function({ id: e, sourceX: t, sourceY: n, targetX: r, targetY: i, sourcePosition: a, targetPosition: o, data: s, selected: c }) {
|
|
235
277
|
let [l, u, d] = w({
|
|
236
278
|
sourceX: t,
|
|
237
279
|
sourceY: n,
|
|
@@ -240,15 +282,15 @@ var F = d(function({ data: e }) {
|
|
|
240
282
|
targetY: i,
|
|
241
283
|
targetPosition: o
|
|
242
284
|
}), f = s ?? {}, p = !!c || !!f.hovered, m = f.color || "#3b82f6";
|
|
243
|
-
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(
|
|
285
|
+
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(b, {
|
|
244
286
|
id: e,
|
|
245
287
|
path: l,
|
|
246
288
|
style: {
|
|
247
289
|
stroke: m,
|
|
248
|
-
strokeWidth: p ? 2.5 : 2,
|
|
249
|
-
strokeDasharray: "6 3"
|
|
290
|
+
strokeWidth: f.strokeWidth ?? (p ? 2.5 : 2),
|
|
291
|
+
strokeDasharray: f.strokeDasharray ?? "6 3"
|
|
250
292
|
}
|
|
251
|
-
}), /* @__PURE__ */ D(
|
|
293
|
+
}), /* @__PURE__ */ D(x, { children: /* @__PURE__ */ O("div", {
|
|
252
294
|
className: "nodrag nopan",
|
|
253
295
|
style: {
|
|
254
296
|
position: "absolute",
|
|
@@ -293,8 +335,8 @@ var F = d(function({ data: e }) {
|
|
|
293
335
|
children: "×"
|
|
294
336
|
})]
|
|
295
337
|
}) })] });
|
|
296
|
-
}),
|
|
297
|
-
function
|
|
338
|
+
}), oe = { table: ae }, se = { joinEdge: P };
|
|
339
|
+
function ce(e) {
|
|
298
340
|
try {
|
|
299
341
|
return {
|
|
300
342
|
model: t(e),
|
|
@@ -308,26 +350,26 @@ function ae(e) {
|
|
|
308
350
|
throw e;
|
|
309
351
|
}
|
|
310
352
|
}
|
|
311
|
-
function
|
|
353
|
+
function F(e, t) {
|
|
312
354
|
return t ? `${t}__${e}` : `__default-${e}`;
|
|
313
355
|
}
|
|
314
|
-
var
|
|
315
|
-
function
|
|
356
|
+
var I = "join:";
|
|
357
|
+
function L(e) {
|
|
316
358
|
if (!e || e.startsWith("__default-")) return;
|
|
317
359
|
let t = /^(.+)__(?:source|target)$/.exec(e);
|
|
318
360
|
return t ? t[1] : void 0;
|
|
319
361
|
}
|
|
320
|
-
function
|
|
362
|
+
function R(e) {
|
|
321
363
|
return `${e.table}.${e.column}`;
|
|
322
364
|
}
|
|
323
|
-
var
|
|
365
|
+
var le = {
|
|
324
366
|
INNER: "#3b82f6",
|
|
325
367
|
LEFT: "#8b5cf6",
|
|
326
368
|
RIGHT: "#a855f7",
|
|
327
369
|
FULL: "#ec4899",
|
|
328
370
|
CROSS: "#6b7280"
|
|
329
371
|
};
|
|
330
|
-
function
|
|
372
|
+
function ue({ apiRef: e, wrapperRef: t }) {
|
|
331
373
|
let n = T();
|
|
332
374
|
return h(e, () => ({
|
|
333
375
|
fitView: (e) => n.fitView(e),
|
|
@@ -338,39 +380,39 @@ function ce({ apiRef: e, wrapperRef: t }) {
|
|
|
338
380
|
getViewportElement: () => t.current?.querySelector(".react-flow__viewport") ?? null
|
|
339
381
|
}), [n, t]), null;
|
|
340
382
|
}
|
|
341
|
-
var
|
|
342
|
-
let { source: n, model: r, algorithm: a, direction: o, aspectRatio: s, positions: c, onPositionsChange: l, showColumnCheckboxes: u, selectedColumns: d, onColumnSelectionChange: p, enableManualJoins: h, joins:
|
|
383
|
+
var z = u(function(e, t) {
|
|
384
|
+
let { source: n, model: r, algorithm: a, direction: o, aspectRatio: s, positions: c, onPositionsChange: l, showColumnCheckboxes: u, selectedColumns: d, onColumnSelectionChange: p, enableManualJoins: h, joins: b, onJoinConnect: x, onJoinDelete: S, onJoinClick: C, joinStyle: w, onTableRemove: T, onColumnClick: E, onTableClick: M, showSelectAllPerTable: N, deleteKeyCode: ae = "Delete", className: P, style: z, highlightReferencesOnHover: B = !0 } = e, { model: V, error: H } = g(() => r ? {
|
|
343
385
|
model: r,
|
|
344
386
|
error: null
|
|
345
387
|
} : n == null ? {
|
|
346
388
|
model: null,
|
|
347
389
|
error: null
|
|
348
|
-
} :
|
|
390
|
+
} : ce(n), [n, r]), [U, W] = v(null), [G, K] = v(null);
|
|
349
391
|
m(() => {
|
|
350
|
-
if (!
|
|
351
|
-
|
|
392
|
+
if (!V) {
|
|
393
|
+
W(null);
|
|
352
394
|
return;
|
|
353
395
|
}
|
|
354
396
|
let e = !1;
|
|
355
|
-
return i(
|
|
397
|
+
return i(V, {
|
|
356
398
|
algorithm: a,
|
|
357
399
|
direction: o,
|
|
358
400
|
aspectRatio: s
|
|
359
401
|
}).then((t) => {
|
|
360
|
-
e ||
|
|
402
|
+
e || W(t);
|
|
361
403
|
}), () => {
|
|
362
404
|
e = !0;
|
|
363
405
|
};
|
|
364
406
|
}, [
|
|
365
|
-
|
|
407
|
+
V,
|
|
366
408
|
a,
|
|
367
409
|
o,
|
|
368
410
|
s
|
|
369
411
|
]);
|
|
370
|
-
let
|
|
371
|
-
if (!
|
|
372
|
-
let e = new Map(
|
|
373
|
-
for (let n of
|
|
412
|
+
let q = g(() => {
|
|
413
|
+
if (!U || !V) return [];
|
|
414
|
+
let e = new Map(V.tables.map((e) => [e.name, e])), t = [];
|
|
415
|
+
for (let n of U.nodes) {
|
|
374
416
|
let r = e.get(n.id);
|
|
375
417
|
if (!r) continue;
|
|
376
418
|
let i = c?.[n.id], a = { table: r };
|
|
@@ -390,14 +432,14 @@ var V = u(function(e, t) {
|
|
|
390
432
|
}
|
|
391
433
|
return t;
|
|
392
434
|
}, [
|
|
393
|
-
|
|
394
|
-
|
|
435
|
+
U,
|
|
436
|
+
V,
|
|
395
437
|
c
|
|
396
|
-
]), [
|
|
438
|
+
]), [de, J, fe] = re(q);
|
|
397
439
|
m(() => {
|
|
398
|
-
q
|
|
399
|
-
}, [
|
|
400
|
-
let
|
|
440
|
+
J(q);
|
|
441
|
+
}, [q, J]);
|
|
442
|
+
let pe = f((e, t, n) => {
|
|
401
443
|
if (!l) return;
|
|
402
444
|
let r = { ...c ?? {} };
|
|
403
445
|
for (let e of n) r[e.id] = {
|
|
@@ -405,26 +447,26 @@ var V = u(function(e, t) {
|
|
|
405
447
|
y: e.position.y
|
|
406
448
|
};
|
|
407
449
|
l(r);
|
|
408
|
-
}, [c, l]),
|
|
409
|
-
if (!(!
|
|
410
|
-
}, [
|
|
411
|
-
if (!
|
|
412
|
-
let e =
|
|
413
|
-
return
|
|
414
|
-
}, [
|
|
450
|
+
}, [c, l]), Y = g(() => {
|
|
451
|
+
if (!(!G || !V)) return V.relations.find((e) => e.id === G);
|
|
452
|
+
}, [G, V]), X = g(() => {
|
|
453
|
+
if (!G || !b || !G.startsWith(I)) return;
|
|
454
|
+
let e = G.slice(5);
|
|
455
|
+
return b.find((t) => t.id === e);
|
|
456
|
+
}, [G, b]), me = g(() => {
|
|
415
457
|
let e = /* @__PURE__ */ new Map();
|
|
416
|
-
if (!
|
|
458
|
+
if (!B) return e;
|
|
417
459
|
let t = (t, n) => {
|
|
418
460
|
if (!n) return;
|
|
419
461
|
let r = e.get(t) ?? /* @__PURE__ */ new Set();
|
|
420
462
|
r.add(n), e.set(t, r);
|
|
421
463
|
};
|
|
422
|
-
return
|
|
464
|
+
return Y && (t(Y.from, Y.fromColumn), t(Y.to, Y.toColumn)), X && (t(X.source.table, X.source.column), t(X.target.table, X.target.column)), e;
|
|
423
465
|
}, [
|
|
424
|
-
J,
|
|
425
466
|
Y,
|
|
426
|
-
|
|
427
|
-
|
|
467
|
+
X,
|
|
468
|
+
B
|
|
469
|
+
]), Z = g(() => new Set((d ?? []).map(R)), [d]), Q = f((e, t, n) => {
|
|
428
470
|
if (!p) return;
|
|
429
471
|
let r = d ?? [];
|
|
430
472
|
if (n) {
|
|
@@ -434,26 +476,45 @@ var V = u(function(e, t) {
|
|
|
434
476
|
column: t
|
|
435
477
|
}]);
|
|
436
478
|
} else p(r.filter((n) => !(n.table === e && n.column === t)));
|
|
437
|
-
}, [d, p]),
|
|
479
|
+
}, [d, p]), he = f((e, t, n) => {
|
|
480
|
+
if (!p) return;
|
|
481
|
+
let r = d ?? [];
|
|
482
|
+
if (n) {
|
|
483
|
+
let n = new Set(r.map(R)), i = [];
|
|
484
|
+
for (let r of t) n.has(`${e}.${r}`) || i.push({
|
|
485
|
+
table: e,
|
|
486
|
+
column: r
|
|
487
|
+
});
|
|
488
|
+
if (i.length === 0) return;
|
|
489
|
+
p([...r, ...i]);
|
|
490
|
+
} else {
|
|
491
|
+
let n = new Set(t);
|
|
492
|
+
p(r.filter((t) => !(t.table === e && n.has(t.column))));
|
|
493
|
+
}
|
|
494
|
+
}, [d, p]), ge = g(() => ({
|
|
438
495
|
enabled: u ?? !1,
|
|
439
|
-
|
|
440
|
-
|
|
496
|
+
showSelectAll: N ?? !1,
|
|
497
|
+
selected: Z,
|
|
498
|
+
onToggle: Q,
|
|
499
|
+
onToggleAll: he
|
|
441
500
|
}), [
|
|
442
501
|
u,
|
|
443
|
-
|
|
444
|
-
Z
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
502
|
+
N,
|
|
503
|
+
Z,
|
|
504
|
+
Q,
|
|
505
|
+
he
|
|
506
|
+
]), _e = g(() => {
|
|
507
|
+
if (!U || !V) return [];
|
|
508
|
+
let e = new Set(V.tables.map((e) => e.name)), t = new Map(V.relations.map((e) => [e.id, e])), n = [];
|
|
509
|
+
for (let r of U.edges) {
|
|
449
510
|
if (!e.has(r.source) || !e.has(r.target)) continue;
|
|
450
|
-
let i = t.get(r.id), a = r.id ===
|
|
511
|
+
let i = t.get(r.id), a = r.id === G;
|
|
451
512
|
n.push({
|
|
452
513
|
id: r.id,
|
|
453
514
|
source: r.source,
|
|
454
515
|
target: r.target,
|
|
455
|
-
sourceHandle:
|
|
456
|
-
targetHandle:
|
|
516
|
+
sourceHandle: F("source", i?.fromColumn),
|
|
517
|
+
targetHandle: F("target", i?.toColumn),
|
|
457
518
|
type: "smoothstep",
|
|
458
519
|
animated: a,
|
|
459
520
|
deletable: !1,
|
|
@@ -475,57 +536,68 @@ var V = u(function(e, t) {
|
|
|
475
536
|
});
|
|
476
537
|
}
|
|
477
538
|
let r = [];
|
|
478
|
-
for (let t of
|
|
539
|
+
for (let t of b ?? []) {
|
|
479
540
|
if (!e.has(t.source.table) || !e.has(t.target.table)) continue;
|
|
480
|
-
let n = `${
|
|
541
|
+
let n = `${I}${t.id}`, i = n === G, a = w?.(t), o = a?.stroke ?? le[t.type] ?? "#3b82f6", s = {
|
|
481
542
|
type: t.type,
|
|
482
|
-
color:
|
|
543
|
+
color: o,
|
|
544
|
+
strokeWidth: a?.strokeWidth,
|
|
545
|
+
strokeDasharray: a?.strokeDasharray,
|
|
483
546
|
hovered: i,
|
|
484
|
-
onDelete:
|
|
547
|
+
onDelete: S ? () => S(t.id, t.meta) : void 0
|
|
485
548
|
};
|
|
486
549
|
r.push({
|
|
487
550
|
id: n,
|
|
488
551
|
source: t.source.table,
|
|
489
552
|
target: t.target.table,
|
|
490
|
-
sourceHandle:
|
|
491
|
-
targetHandle:
|
|
553
|
+
sourceHandle: F("source", t.source.column),
|
|
554
|
+
targetHandle: F("target", t.target.column),
|
|
492
555
|
type: "joinEdge",
|
|
493
556
|
deletable: !0,
|
|
494
|
-
data:
|
|
557
|
+
data: s
|
|
495
558
|
});
|
|
496
559
|
}
|
|
497
560
|
return [...n, ...r];
|
|
498
561
|
}, [
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
562
|
+
U,
|
|
563
|
+
V,
|
|
564
|
+
b,
|
|
565
|
+
G,
|
|
566
|
+
S,
|
|
567
|
+
w
|
|
568
|
+
]), ve = f((e) => {
|
|
569
|
+
x && (!e.source || !e.target || x({
|
|
506
570
|
table: e.source,
|
|
507
|
-
column:
|
|
571
|
+
column: L(e.sourceHandle)
|
|
508
572
|
}, {
|
|
509
573
|
table: e.target,
|
|
510
|
-
column:
|
|
574
|
+
column: L(e.targetHandle)
|
|
511
575
|
}));
|
|
512
|
-
}, [
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
576
|
+
}, [x]), ye = f((e) => {
|
|
577
|
+
if (S) for (let t of e) {
|
|
578
|
+
if (!t.id.startsWith(I)) continue;
|
|
579
|
+
let e = t.id.slice(5), n = b?.find((t) => t.id === e);
|
|
580
|
+
S(e, n?.meta);
|
|
581
|
+
}
|
|
582
|
+
}, [S, b]), be = f((e, t) => {
|
|
583
|
+
if (!C || !t.id.startsWith(I)) return;
|
|
584
|
+
let n = t.id.slice(5), r = b?.find((e) => e.id === n);
|
|
585
|
+
C(n, r?.meta);
|
|
586
|
+
}, [C, b]), xe = !!h, Se = g(() => ({
|
|
587
|
+
onTableRemove: T,
|
|
588
|
+
onColumnClick: E
|
|
589
|
+
}), [T, E]), $ = _(null);
|
|
518
590
|
return /* @__PURE__ */ O("div", {
|
|
519
591
|
ref: $,
|
|
520
|
-
className:
|
|
592
|
+
className: P,
|
|
521
593
|
style: {
|
|
522
594
|
width: "100%",
|
|
523
595
|
height: "100%",
|
|
524
596
|
position: "relative",
|
|
525
|
-
...
|
|
597
|
+
...z
|
|
526
598
|
},
|
|
527
599
|
children: [
|
|
528
|
-
|
|
600
|
+
H && /* @__PURE__ */ D("div", {
|
|
529
601
|
style: {
|
|
530
602
|
position: "absolute",
|
|
531
603
|
top: 8,
|
|
@@ -541,9 +613,9 @@ var V = u(function(e, t) {
|
|
|
541
613
|
fontSize: 12,
|
|
542
614
|
whiteSpace: "pre-wrap"
|
|
543
615
|
},
|
|
544
|
-
children:
|
|
616
|
+
children: H.message
|
|
545
617
|
}),
|
|
546
|
-
!
|
|
618
|
+
!H && !U && /* @__PURE__ */ D("div", {
|
|
547
619
|
style: {
|
|
548
620
|
position: "absolute",
|
|
549
621
|
inset: 0,
|
|
@@ -556,40 +628,44 @@ var V = u(function(e, t) {
|
|
|
556
628
|
children: "Computing layout…"
|
|
557
629
|
}),
|
|
558
630
|
/* @__PURE__ */ D(k.Provider, {
|
|
559
|
-
value:
|
|
631
|
+
value: me,
|
|
560
632
|
children: /* @__PURE__ */ D(A.Provider, {
|
|
561
|
-
value:
|
|
562
|
-
children: /* @__PURE__ */ D(
|
|
563
|
-
value:
|
|
564
|
-
children: /* @__PURE__ */ D(
|
|
565
|
-
value:
|
|
633
|
+
value: ge,
|
|
634
|
+
children: /* @__PURE__ */ D(ie.Provider, {
|
|
635
|
+
value: xe,
|
|
636
|
+
children: /* @__PURE__ */ D(j.Provider, {
|
|
637
|
+
value: Se,
|
|
566
638
|
children: /* @__PURE__ */ O(ne, {
|
|
567
|
-
nodes:
|
|
568
|
-
edges:
|
|
569
|
-
nodeTypes:
|
|
570
|
-
edgeTypes:
|
|
639
|
+
nodes: de,
|
|
640
|
+
edges: _e,
|
|
641
|
+
nodeTypes: oe,
|
|
642
|
+
edgeTypes: se,
|
|
571
643
|
fitView: !0,
|
|
572
|
-
onNodesChange:
|
|
573
|
-
onNodeDragStop:
|
|
574
|
-
onNodeClick:
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
644
|
+
onNodesChange: fe,
|
|
645
|
+
onNodeDragStop: pe,
|
|
646
|
+
onNodeClick: M ? (e, t) => {
|
|
647
|
+
let n = t.data?.table?.meta;
|
|
648
|
+
M(t.id, n);
|
|
649
|
+
} : void 0,
|
|
650
|
+
onEdgeMouseEnter: (e, t) => K(t.id),
|
|
651
|
+
onEdgeMouseLeave: () => K(null),
|
|
652
|
+
onEdgeClick: C ? be : void 0,
|
|
653
|
+
onConnect: ve,
|
|
654
|
+
onEdgesDelete: ye,
|
|
579
655
|
nodesDraggable: !0,
|
|
580
|
-
nodesConnectable:
|
|
656
|
+
nodesConnectable: xe,
|
|
581
657
|
elementsSelectable: !0,
|
|
582
|
-
deleteKeyCode:
|
|
658
|
+
deleteKeyCode: ae,
|
|
583
659
|
minZoom: .1,
|
|
584
660
|
maxZoom: 4,
|
|
585
661
|
children: [
|
|
586
|
-
/* @__PURE__ */ D(
|
|
587
|
-
/* @__PURE__ */ D(
|
|
588
|
-
/* @__PURE__ */ D(
|
|
662
|
+
/* @__PURE__ */ D(y, {}),
|
|
663
|
+
/* @__PURE__ */ D(ee, {}),
|
|
664
|
+
/* @__PURE__ */ D(te, {
|
|
589
665
|
pannable: !0,
|
|
590
666
|
zoomable: !0
|
|
591
667
|
}),
|
|
592
|
-
/* @__PURE__ */ D(
|
|
668
|
+
/* @__PURE__ */ D(ue, {
|
|
593
669
|
apiRef: t,
|
|
594
670
|
wrapperRef: $
|
|
595
671
|
})
|
|
@@ -603,6 +679,6 @@ var V = u(function(e, t) {
|
|
|
603
679
|
});
|
|
604
680
|
});
|
|
605
681
|
//#endregion
|
|
606
|
-
export { s as HEADER_HEIGHT,
|
|
682
|
+
export { s as HEADER_HEIGHT, z as MermaidER, o as MermaidERParseError, r as NODE_WIDTH, a as ROW_HEIGHT, n as VERTICAL_PADDING, e as estimateNodeHeight, i as layoutER, t as parseMermaidER };
|
|
607
683
|
|
|
608
684
|
//# sourceMappingURL=index.js.map
|