drizzle-cube 0.2.11 → 0.2.13
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/adapters/compiler-CMwSRhTS.cjs +22 -0
- package/dist/adapters/{compiler-gcKytLwd.js → compiler-DrkCCzf0.js} +16 -11
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +8 -8
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +9 -9
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +11 -11
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +59 -59
- package/dist/client/charts.js +11 -11
- package/dist/client/chunks/{chart-activitygridchart-D17Fxiuf.js → chart-activitygridchart-CUGN9Xq9.js} +3 -2
- package/dist/client/chunks/chart-activitygridchart-CUGN9Xq9.js.map +1 -0
- package/dist/client/chunks/{chart-areachart-udSbAzl1.js → chart-areachart-B4tknnsY.js} +25 -25
- package/dist/client/chunks/{chart-areachart-udSbAzl1.js.map → chart-areachart-B4tknnsY.js.map} +1 -1
- package/dist/client/chunks/{chart-axisformatcontrols-DqSa245M.js → chart-axisformatcontrols-Ch_IYF94.js} +18 -18
- package/dist/client/chunks/chart-axisformatcontrols-Ch_IYF94.js.map +1 -0
- package/dist/client/chunks/{chart-barchart-CDIpqCKS.js → chart-barchart-D_op06r-.js} +6 -6
- package/dist/client/chunks/{chart-barchart-CDIpqCKS.js.map → chart-barchart-D_op06r-.js.map} +1 -1
- package/dist/client/chunks/{chart-bubblechart-CivK_yfh.js → chart-bubblechart-BsaIXUbS.js} +3 -3
- package/dist/client/chunks/chart-bubblechart-BsaIXUbS.js.map +1 -0
- package/dist/client/chunks/{chart-charttooltip-BVEdz4Q-.js → chart-charttooltip-Bx3I8jQv.js} +2 -2
- package/dist/client/chunks/{chart-charttooltip-BVEdz4Q-.js.map → chart-charttooltip-Bx3I8jQv.js.map} +1 -1
- package/dist/client/chunks/{chart-datatable-NHE7BTMr.js → chart-datatable-C7MS9q4Y.js} +2 -2
- package/dist/client/chunks/{chart-datatable-NHE7BTMr.js.map → chart-datatable-C7MS9q4Y.js.map} +1 -1
- package/dist/client/chunks/{chart-kpidelta-D-FR2o4V.js → chart-kpidelta-7-KOmb3w.js} +62 -60
- package/dist/client/chunks/chart-kpidelta-7-KOmb3w.js.map +1 -0
- package/dist/client/chunks/{chart-kpinumber-DSH8RJxb.js → chart-kpinumber-HOPfcK2N.js} +4 -4
- package/dist/client/chunks/{chart-kpinumber-DSH8RJxb.js.map → chart-kpinumber-HOPfcK2N.js.map} +1 -1
- package/dist/client/chunks/{chart-kpitext-Z9oh0bJq.js → chart-kpitext-BZkC9u3A.js} +24 -24
- package/dist/client/chunks/{chart-kpitext-Z9oh0bJq.js.map → chart-kpitext-BZkC9u3A.js.map} +1 -1
- package/dist/client/chunks/{chart-linechart-D4r0uD1j.js → chart-linechart-DqFmLbRe.js} +7 -7
- package/dist/client/chunks/{chart-linechart-D4r0uD1j.js.map → chart-linechart-DqFmLbRe.js.map} +1 -1
- package/dist/client/chunks/chart-markdownchart-9n_TemoB.js +256 -0
- package/dist/client/chunks/chart-markdownchart-9n_TemoB.js.map +1 -0
- package/dist/client/chunks/{chart-piechart-BhttUWuH.js → chart-piechart-CrXFd9pE.js} +6 -6
- package/dist/client/chunks/{chart-piechart-BhttUWuH.js.map → chart-piechart-CrXFd9pE.js.map} +1 -1
- package/dist/client/chunks/{chart-radarchart-DnqlfoGr.js → chart-radarchart-tar2GBkO.js} +5 -5
- package/dist/client/chunks/{chart-radarchart-DnqlfoGr.js.map → chart-radarchart-tar2GBkO.js.map} +1 -1
- package/dist/client/chunks/{chart-radialbarchart-BFxxiqLw.js → chart-radialbarchart-ab8Swtal.js} +5 -5
- package/dist/client/chunks/{chart-radialbarchart-BFxxiqLw.js.map → chart-radialbarchart-ab8Swtal.js.map} +1 -1
- package/dist/client/chunks/{chart-scatterchart-MN4SM-w7.js → chart-scatterchart-BP06BeU5.js} +5 -5
- package/dist/client/chunks/{chart-scatterchart-MN4SM-w7.js.map → chart-scatterchart-BP06BeU5.js.map} +1 -1
- package/dist/client/chunks/{chart-treemapchart-Nozh2m26.js → chart-treemapchart-DAiixITm.js} +31 -31
- package/dist/client/chunks/{chart-treemapchart-Nozh2m26.js.map → chart-treemapchart-DAiixITm.js.map} +1 -1
- package/dist/client/chunks/{charts-BSDHSv4l.js → charts-CHzWeaY1.js} +26 -26
- package/dist/client/chunks/charts-CHzWeaY1.js.map +1 -0
- package/dist/client/chunks/{components-CbDovlG-.js → components-DnM9CCUS.js} +2453 -2445
- package/dist/client/chunks/components-DnM9CCUS.js.map +1 -0
- package/dist/client/chunks/{index-th92_8oL.js → index-DlsvcKXf.js} +135 -135
- package/dist/client/chunks/index-DlsvcKXf.js.map +1 -0
- package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +5 -5
- package/dist/client/components/AnalysisBuilder/SectionHeading.d.ts +2 -7
- package/dist/client/components/AnalysisBuilder/types.d.ts +8 -8
- package/dist/client/components.js +2 -2
- package/dist/client/hooks/useResponsiveDashboard.d.ts +2 -8
- package/dist/client/hooks.js +2 -2
- package/dist/client/hooks.js.map +1 -1
- package/dist/client/icons/types.d.ts +2 -2
- package/dist/client/index.js +3 -3
- package/dist/client/providers.js +1 -1
- package/dist/client/styles.css +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.js +16 -11
- package/package.json +3 -3
- package/dist/adapters/compiler-DP1pPIcg.cjs +0 -22
- package/dist/client/chunks/chart-activitygridchart-D17Fxiuf.js.map +0 -1
- package/dist/client/chunks/chart-axisformatcontrols-DqSa245M.js.map +0 -1
- package/dist/client/chunks/chart-bubblechart-CivK_yfh.js.map +0 -1
- package/dist/client/chunks/chart-kpidelta-D-FR2o4V.js.map +0 -1
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js +0 -254
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js.map +0 -1
- package/dist/client/chunks/charts-BSDHSv4l.js.map +0 -1
- package/dist/client/chunks/components-CbDovlG-.js.map +0 -1
- package/dist/client/chunks/index-th92_8oL.js.map +0 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { jsxs as o, jsx as t, Fragment as J } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as j, useState as H, useEffect as T, useCallback as S } from "react";
|
|
3
|
-
import Z, { Handle as P, Position as
|
|
4
|
-
import { u as ie } from "./chart-activitygridchart-
|
|
3
|
+
import Z, { Handle as P, Position as g, getBezierPath as K, BaseEdge as Q, EdgeLabelRenderer as U, useNodesState as _, useEdgesState as ee, addEdge as te, ConnectionMode as se, Controls as ne, MiniMap as re, Background as oe, BackgroundVariant as ae } from "reactflow";
|
|
4
|
+
import { u as ie } from "./chart-activitygridchart-CUGN9Xq9.js";
|
|
5
5
|
import O from "dagre";
|
|
6
|
-
function
|
|
7
|
-
const { cube: s, onFieldClick: f, isHighlighted:
|
|
8
|
-
}, y = (e,
|
|
9
|
-
f && f(s.name, e,
|
|
10
|
-
},
|
|
6
|
+
function ce({ data: i }) {
|
|
7
|
+
const { cube: s, onFieldClick: f, isHighlighted: n, highlightedFields: w, searchTerm: m } = i, d = () => {
|
|
8
|
+
}, y = (e, r) => {
|
|
9
|
+
f && f(s.name, e, r);
|
|
10
|
+
}, l = (e) => w.includes(e), b = (e) => {
|
|
11
11
|
if (!m?.trim()) return !0;
|
|
12
|
-
const
|
|
13
|
-
return e.name.toLowerCase().includes(
|
|
12
|
+
const r = m.toLowerCase();
|
|
13
|
+
return e.name.toLowerCase().includes(r) || e.title && e.title.toLowerCase().includes(r);
|
|
14
14
|
}, k = (() => {
|
|
15
15
|
if (!m?.trim()) return !0;
|
|
16
|
-
const e = s.measures.some((
|
|
17
|
-
return e ||
|
|
18
|
-
})(), N = (e,
|
|
16
|
+
const e = s.measures.some((c) => b(c)), r = s.dimensions.some((c) => b(c));
|
|
17
|
+
return e || r;
|
|
18
|
+
})(), N = (e, r, c) => {
|
|
19
19
|
const v = b(e), u = "px-4 py-2 text-xs cursor-pointer transition-all border-b border-dc-border last:border-b-0";
|
|
20
20
|
if (!k && m?.trim()) {
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
23
|
-
return `${u} bg-
|
|
24
|
-
if (
|
|
25
|
-
return e.type === "time" ? `${u} bg-
|
|
21
|
+
if (r) {
|
|
22
|
+
if (c === "measure")
|
|
23
|
+
return `${u} bg-dc-warning-bg text-dc-warning`;
|
|
24
|
+
if (c === "dimension")
|
|
25
|
+
return e.type === "time" ? `${u} bg-dc-accent-bg text-dc-accent` : `${u} bg-dc-success-bg text-dc-success`;
|
|
26
26
|
}
|
|
27
27
|
return `${u} hover:bg-dc-surface-hover text-dc-text-secondary`;
|
|
28
28
|
}
|
|
29
29
|
if (m?.trim() && !v)
|
|
30
30
|
return `${u} opacity-40 hover:opacity-60 text-dc-text-muted`;
|
|
31
|
-
if (m?.trim() && v && !
|
|
32
|
-
return `${u} font-bold hover:bg-
|
|
33
|
-
if (
|
|
34
|
-
if (
|
|
35
|
-
return `${u} bg-
|
|
36
|
-
if (
|
|
37
|
-
return e.type === "time" ? `${u} bg-
|
|
31
|
+
if (m?.trim() && v && !r)
|
|
32
|
+
return `${u} font-bold hover:bg-dc-accent-bg`;
|
|
33
|
+
if (r) {
|
|
34
|
+
if (c === "measure")
|
|
35
|
+
return `${u} bg-dc-warning-bg text-dc-warning font-semibold`;
|
|
36
|
+
if (c === "dimension")
|
|
37
|
+
return e.type === "time" ? `${u} bg-dc-accent-bg text-dc-accent font-semibold` : `${u} bg-dc-success-bg text-dc-success font-semibold`;
|
|
38
38
|
}
|
|
39
39
|
return `${u} hover:bg-dc-surface-hover text-dc-text-secondary`;
|
|
40
40
|
};
|
|
@@ -44,7 +44,7 @@ function de({ data: i }) {
|
|
|
44
44
|
className: `
|
|
45
45
|
border-2 rounded-lg shadow-lg min-w-[280px] overflow-hidden transition-all
|
|
46
46
|
${!k && m?.trim() ? "opacity-30 grayscale" : ""}
|
|
47
|
-
${
|
|
47
|
+
${n ? "border-dc-accent ring-2 ring-dc-accent" : "border-dc-border"}
|
|
48
48
|
`,
|
|
49
49
|
style: {
|
|
50
50
|
backgroundColor: "var(--dc-surface)"
|
|
@@ -55,9 +55,9 @@ function de({ data: i }) {
|
|
|
55
55
|
{
|
|
56
56
|
className: `
|
|
57
57
|
px-4 py-3 cursor-pointer transition-colors
|
|
58
|
-
${
|
|
58
|
+
${n ? "bg-dc-accent-bg hover:bg-dc-accent-bg" : "bg-dc-surface-secondary hover:bg-dc-surface-hover"}
|
|
59
59
|
`,
|
|
60
|
-
onClick:
|
|
60
|
+
onClick: d,
|
|
61
61
|
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
62
62
|
/* @__PURE__ */ o("div", { children: [
|
|
63
63
|
/* @__PURE__ */ t("h3", { className: "font-semibold text-dc-text text-sm", children: s.title || s.name }),
|
|
@@ -77,22 +77,22 @@ function de({ data: i }) {
|
|
|
77
77
|
}
|
|
78
78
|
),
|
|
79
79
|
s.measures.length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
|
|
80
|
-
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-
|
|
81
|
-
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-
|
|
80
|
+
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-warning-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-warning flex items-center", children: [
|
|
81
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-warning-bg0 rounded-full mr-2" }),
|
|
82
82
|
"Measures (",
|
|
83
83
|
s.measures.length,
|
|
84
84
|
")"
|
|
85
85
|
] }) }),
|
|
86
86
|
/* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.measures.map((e) => {
|
|
87
|
-
const
|
|
87
|
+
const r = e.name.split(".")[1] || e.name, c = l(e.name);
|
|
88
88
|
return /* @__PURE__ */ t(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
|
-
className: N(e,
|
|
92
|
-
onClick: () => y(
|
|
91
|
+
className: N(e, c, "measure"),
|
|
92
|
+
onClick: () => y(r, "measure"),
|
|
93
93
|
title: e.title,
|
|
94
94
|
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
95
|
-
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title ||
|
|
95
|
+
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
|
|
96
96
|
/* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
|
|
97
97
|
] })
|
|
98
98
|
},
|
|
@@ -101,22 +101,22 @@ function de({ data: i }) {
|
|
|
101
101
|
}) })
|
|
102
102
|
] }),
|
|
103
103
|
s.dimensions.filter((e) => e.type === "time").length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
|
|
104
|
-
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-
|
|
105
|
-
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-
|
|
104
|
+
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-accent-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-accent flex items-center", children: [
|
|
105
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-accent-bg0 rounded-full mr-2" }),
|
|
106
106
|
"Time Dimensions (",
|
|
107
107
|
s.dimensions.filter((e) => e.type === "time").length,
|
|
108
108
|
")"
|
|
109
109
|
] }) }),
|
|
110
110
|
/* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.dimensions.filter((e) => e.type === "time").map((e) => {
|
|
111
|
-
const
|
|
111
|
+
const r = e.name.split(".")[1] || e.name, c = l(e.name);
|
|
112
112
|
return /* @__PURE__ */ t(
|
|
113
113
|
"div",
|
|
114
114
|
{
|
|
115
|
-
className: N(e,
|
|
116
|
-
onClick: () => y(
|
|
115
|
+
className: N(e, c, "dimension"),
|
|
116
|
+
onClick: () => y(r, "dimension"),
|
|
117
117
|
title: e.title,
|
|
118
118
|
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
119
|
-
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title ||
|
|
119
|
+
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
|
|
120
120
|
/* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
|
|
121
121
|
] })
|
|
122
122
|
},
|
|
@@ -125,22 +125,22 @@ function de({ data: i }) {
|
|
|
125
125
|
}) })
|
|
126
126
|
] }),
|
|
127
127
|
s.dimensions.filter((e) => e.type !== "time").length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
|
|
128
|
-
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-
|
|
129
|
-
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-
|
|
128
|
+
/* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-success-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-success flex items-center", children: [
|
|
129
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-success-bg0 rounded-full mr-2" }),
|
|
130
130
|
"Dimensions (",
|
|
131
131
|
s.dimensions.filter((e) => e.type !== "time").length,
|
|
132
132
|
")"
|
|
133
133
|
] }) }),
|
|
134
134
|
/* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.dimensions.filter((e) => e.type !== "time").map((e) => {
|
|
135
|
-
const
|
|
135
|
+
const r = e.name.split(".")[1] || e.name, c = l(e.name);
|
|
136
136
|
return /* @__PURE__ */ t(
|
|
137
137
|
"div",
|
|
138
138
|
{
|
|
139
|
-
className: N(e,
|
|
140
|
-
onClick: () => y(
|
|
139
|
+
className: N(e, c, "dimension"),
|
|
140
|
+
onClick: () => y(r, "dimension"),
|
|
141
141
|
title: e.title,
|
|
142
142
|
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
143
|
-
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title ||
|
|
143
|
+
/* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
|
|
144
144
|
/* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
|
|
145
145
|
] })
|
|
146
146
|
},
|
|
@@ -152,7 +152,7 @@ function de({ data: i }) {
|
|
|
152
152
|
P,
|
|
153
153
|
{
|
|
154
154
|
type: "source",
|
|
155
|
-
position:
|
|
155
|
+
position: g.Right,
|
|
156
156
|
id: "right",
|
|
157
157
|
className: "opacity-0",
|
|
158
158
|
isConnectable: !1
|
|
@@ -162,7 +162,7 @@ function de({ data: i }) {
|
|
|
162
162
|
P,
|
|
163
163
|
{
|
|
164
164
|
type: "target",
|
|
165
|
-
position:
|
|
165
|
+
position: g.Left,
|
|
166
166
|
id: "left",
|
|
167
167
|
className: "opacity-0",
|
|
168
168
|
isConnectable: !1
|
|
@@ -172,7 +172,7 @@ function de({ data: i }) {
|
|
|
172
172
|
P,
|
|
173
173
|
{
|
|
174
174
|
type: "source",
|
|
175
|
-
position:
|
|
175
|
+
position: g.Bottom,
|
|
176
176
|
id: "bottom",
|
|
177
177
|
className: "opacity-0",
|
|
178
178
|
isConnectable: !1
|
|
@@ -182,7 +182,7 @@ function de({ data: i }) {
|
|
|
182
182
|
P,
|
|
183
183
|
{
|
|
184
184
|
type: "target",
|
|
185
|
-
position:
|
|
185
|
+
position: g.Top,
|
|
186
186
|
id: "top",
|
|
187
187
|
className: "opacity-0",
|
|
188
188
|
isConnectable: !1
|
|
@@ -192,27 +192,27 @@ function de({ data: i }) {
|
|
|
192
192
|
}
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function de({
|
|
196
196
|
sourceX: i,
|
|
197
197
|
sourceY: s,
|
|
198
198
|
targetX: f,
|
|
199
|
-
targetY:
|
|
199
|
+
targetY: n,
|
|
200
200
|
sourcePosition: w,
|
|
201
201
|
targetPosition: m,
|
|
202
|
-
style:
|
|
202
|
+
style: d = {},
|
|
203
203
|
data: y,
|
|
204
|
-
markerEnd:
|
|
204
|
+
markerEnd: l
|
|
205
205
|
}) {
|
|
206
206
|
const [b, E, k] = K({
|
|
207
207
|
sourceX: i,
|
|
208
208
|
sourceY: s,
|
|
209
209
|
sourcePosition: w,
|
|
210
210
|
targetX: f,
|
|
211
|
-
targetY:
|
|
211
|
+
targetY: n,
|
|
212
212
|
targetPosition: m
|
|
213
213
|
});
|
|
214
214
|
if (!y) return null;
|
|
215
|
-
const { relationship: N, joinFields: e } = y,
|
|
215
|
+
const { relationship: N, joinFields: e } = y, r = (C) => {
|
|
216
216
|
switch (C) {
|
|
217
217
|
case "belongsTo":
|
|
218
218
|
return "∈";
|
|
@@ -238,9 +238,9 @@ function le({
|
|
|
238
238
|
default:
|
|
239
239
|
return "#6b7280";
|
|
240
240
|
}
|
|
241
|
-
})(N.relationship), u =
|
|
241
|
+
})(N.relationship), u = r(N.relationship);
|
|
242
242
|
return /* @__PURE__ */ o(J, { children: [
|
|
243
|
-
/* @__PURE__ */ t(Q, { path: b, markerEnd:
|
|
243
|
+
/* @__PURE__ */ t(Q, { path: b, markerEnd: l, style: { ...d, stroke: v } }),
|
|
244
244
|
/* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(
|
|
245
245
|
"div",
|
|
246
246
|
{
|
|
@@ -280,7 +280,7 @@ function le({
|
|
|
280
280
|
) })
|
|
281
281
|
] });
|
|
282
282
|
}
|
|
283
|
-
const
|
|
283
|
+
const le = {
|
|
284
284
|
direction: "TB",
|
|
285
285
|
nodeWidth: 320,
|
|
286
286
|
nodeHeight: 220,
|
|
@@ -289,82 +289,82 @@ const ce = {
|
|
|
289
289
|
ranker: "network-simplex"
|
|
290
290
|
};
|
|
291
291
|
function ue(i, s, f = {}) {
|
|
292
|
-
const
|
|
292
|
+
const n = j(() => ({ ...le, ...f }), [f]), { layoutedNodes: w, layoutedEdges: m } = j(() => {
|
|
293
293
|
if (i.length === 0)
|
|
294
294
|
return { layoutedNodes: [], layoutedEdges: [] };
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
rankdir:
|
|
298
|
-
nodesep:
|
|
299
|
-
ranksep:
|
|
300
|
-
ranker:
|
|
301
|
-
}), i.forEach((
|
|
302
|
-
|
|
303
|
-
width:
|
|
304
|
-
height:
|
|
295
|
+
const d = new O.graphlib.Graph();
|
|
296
|
+
return d.setDefaultEdgeLabel(() => ({})), d.setGraph({
|
|
297
|
+
rankdir: n.direction,
|
|
298
|
+
nodesep: n.nodeSep,
|
|
299
|
+
ranksep: n.rankSep,
|
|
300
|
+
ranker: n.ranker
|
|
301
|
+
}), i.forEach((l) => {
|
|
302
|
+
d.setNode(l.id, {
|
|
303
|
+
width: n.nodeWidth,
|
|
304
|
+
height: n.nodeHeight
|
|
305
305
|
});
|
|
306
|
-
}), s.forEach((
|
|
307
|
-
|
|
308
|
-
}), O.layout(
|
|
309
|
-
layoutedNodes: i.map((
|
|
310
|
-
const b =
|
|
306
|
+
}), s.forEach((l) => {
|
|
307
|
+
d.setEdge(l.source, l.target);
|
|
308
|
+
}), O.layout(d), {
|
|
309
|
+
layoutedNodes: i.map((l) => {
|
|
310
|
+
const b = d.node(l.id);
|
|
311
311
|
return {
|
|
312
|
-
...
|
|
313
|
-
targetPosition: me(
|
|
314
|
-
sourcePosition: he(
|
|
312
|
+
...l,
|
|
313
|
+
targetPosition: me(n.direction),
|
|
314
|
+
sourcePosition: he(n.direction),
|
|
315
315
|
position: {
|
|
316
|
-
x: b.x -
|
|
317
|
-
y: b.y -
|
|
316
|
+
x: b.x - n.nodeWidth / 2,
|
|
317
|
+
y: b.y - n.nodeHeight / 2
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
}),
|
|
321
321
|
layoutedEdges: s
|
|
322
322
|
};
|
|
323
|
-
}, [i, s,
|
|
323
|
+
}, [i, s, n.direction, n.nodeSep, n.rankSep, n.ranker, n.nodeWidth, n.nodeHeight]);
|
|
324
324
|
return { nodes: w, edges: m };
|
|
325
325
|
}
|
|
326
326
|
function me(i) {
|
|
327
327
|
switch (i) {
|
|
328
328
|
case "TB":
|
|
329
|
-
return
|
|
329
|
+
return g.Top;
|
|
330
330
|
case "BT":
|
|
331
|
-
return
|
|
331
|
+
return g.Bottom;
|
|
332
332
|
case "LR":
|
|
333
|
-
return
|
|
333
|
+
return g.Left;
|
|
334
334
|
case "RL":
|
|
335
|
-
return
|
|
335
|
+
return g.Right;
|
|
336
336
|
default:
|
|
337
|
-
return
|
|
337
|
+
return g.Top;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
function he(i) {
|
|
341
341
|
switch (i) {
|
|
342
342
|
case "TB":
|
|
343
|
-
return
|
|
343
|
+
return g.Bottom;
|
|
344
344
|
case "BT":
|
|
345
|
-
return
|
|
345
|
+
return g.Top;
|
|
346
346
|
case "LR":
|
|
347
|
-
return
|
|
347
|
+
return g.Right;
|
|
348
348
|
case "RL":
|
|
349
|
-
return
|
|
349
|
+
return g.Left;
|
|
350
350
|
default:
|
|
351
|
-
return
|
|
351
|
+
return g.Bottom;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
const
|
|
355
|
-
cubeNode:
|
|
356
|
-
},
|
|
357
|
-
relationshipEdge:
|
|
354
|
+
const ge = {
|
|
355
|
+
cubeNode: ce
|
|
356
|
+
}, pe = {
|
|
357
|
+
relationshipEdge: de
|
|
358
358
|
};
|
|
359
359
|
function Ce({
|
|
360
360
|
className: i = "",
|
|
361
361
|
onCubeClick: s,
|
|
362
362
|
onFieldClick: f,
|
|
363
|
-
highlightedCubes:
|
|
363
|
+
highlightedCubes: n = [],
|
|
364
364
|
highlightedFields: w = [],
|
|
365
365
|
searchTerm: m
|
|
366
366
|
}) {
|
|
367
|
-
const { meta:
|
|
367
|
+
const { meta: d, metaLoading: y, metaError: l } = ie(), [b, E] = H({}), [k, N] = H(!1), [e, r] = H(null);
|
|
368
368
|
T(() => {
|
|
369
369
|
try {
|
|
370
370
|
const a = localStorage.getItem("drizzle-cube-erd-node-positions");
|
|
@@ -372,14 +372,14 @@ function Ce({
|
|
|
372
372
|
} catch {
|
|
373
373
|
}
|
|
374
374
|
}, []);
|
|
375
|
-
const { nodes:
|
|
376
|
-
if (!
|
|
375
|
+
const { nodes: c, edges: v } = j(() => {
|
|
376
|
+
if (!d) return { nodes: [], edges: [] };
|
|
377
377
|
const a = [], x = [];
|
|
378
|
-
return
|
|
378
|
+
return d.cubes.forEach((h, p) => {
|
|
379
379
|
a.push({
|
|
380
380
|
id: h.name,
|
|
381
381
|
type: "cubeNode",
|
|
382
|
-
position: b[h.name] || { x:
|
|
382
|
+
position: b[h.name] || { x: p % 3 * 400, y: Math.floor(p / 3) * 300 },
|
|
383
383
|
data: {
|
|
384
384
|
cube: h,
|
|
385
385
|
onCubeClick: s,
|
|
@@ -390,45 +390,45 @@ function Ce({
|
|
|
390
390
|
// Will be updated separately
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
|
-
}),
|
|
394
|
-
h.relationships && h.relationships.forEach((
|
|
395
|
-
if (
|
|
393
|
+
}), d.cubes.forEach((h) => {
|
|
394
|
+
h.relationships && h.relationships.forEach((p, M) => {
|
|
395
|
+
if (p.relationship === "belongsTo")
|
|
396
396
|
return;
|
|
397
|
-
const q = `${h.name}-${
|
|
397
|
+
const q = `${h.name}-${p.targetCube}-${M}`;
|
|
398
398
|
x.push({
|
|
399
399
|
id: q,
|
|
400
400
|
source: h.name,
|
|
401
|
-
target:
|
|
401
|
+
target: p.targetCube,
|
|
402
402
|
type: "relationshipEdge",
|
|
403
403
|
data: {
|
|
404
|
-
relationship:
|
|
405
|
-
joinFields:
|
|
404
|
+
relationship: p,
|
|
405
|
+
joinFields: p.joinFields
|
|
406
406
|
},
|
|
407
407
|
animated: !1,
|
|
408
408
|
style: {
|
|
409
|
-
stroke: be(
|
|
409
|
+
stroke: be(p.relationship),
|
|
410
410
|
strokeWidth: 2
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
}), { nodes: a, edges: x };
|
|
415
|
-
}, [
|
|
415
|
+
}, [d, s, f, b]), u = k || Object.keys(b).length === 0, { nodes: C, edges: B } = ue(c, v, {
|
|
416
416
|
direction: "LR",
|
|
417
417
|
nodeWidth: 320,
|
|
418
418
|
nodeHeight: 220,
|
|
419
419
|
nodeSep: 100,
|
|
420
420
|
rankSep: 200
|
|
421
|
-
}),
|
|
421
|
+
}), L = j(() => (u ? C : c).map((x) => ({
|
|
422
422
|
...x,
|
|
423
423
|
data: {
|
|
424
424
|
...x.data,
|
|
425
|
-
isHighlighted:
|
|
425
|
+
isHighlighted: n.includes(x.id),
|
|
426
426
|
highlightedFields: w,
|
|
427
427
|
searchTerm: m
|
|
428
428
|
}
|
|
429
|
-
})), [u, C,
|
|
429
|
+
})), [u, C, c, n, w, m]), F = u ? B : v;
|
|
430
430
|
T(() => {
|
|
431
|
-
if (k &&
|
|
431
|
+
if (k && L.length > 0) {
|
|
432
432
|
E({});
|
|
433
433
|
try {
|
|
434
434
|
localStorage.removeItem("drizzle-cube-erd-node-positions");
|
|
@@ -436,45 +436,45 @@ function Ce({
|
|
|
436
436
|
}
|
|
437
437
|
N(!1);
|
|
438
438
|
}
|
|
439
|
-
}, [k,
|
|
440
|
-
const [D, $, z] = _(
|
|
439
|
+
}, [k, L]);
|
|
440
|
+
const [D, $, z] = _(L), [W, R, A] = ee(F);
|
|
441
441
|
T(() => {
|
|
442
|
-
$(
|
|
443
|
-
}, [
|
|
442
|
+
$(L);
|
|
443
|
+
}, [L, $]), T(() => {
|
|
444
444
|
R(F);
|
|
445
445
|
}, [F, R]);
|
|
446
446
|
const I = S((a) => {
|
|
447
447
|
z(a), a.filter((h) => h.type === "position" && h.dragging === !1).length > 0 && $((h) => {
|
|
448
|
-
const
|
|
449
|
-
h.forEach((
|
|
450
|
-
|
|
448
|
+
const p = {};
|
|
449
|
+
h.forEach((M) => {
|
|
450
|
+
M.position && (p[M.id] = M.position);
|
|
451
451
|
});
|
|
452
452
|
try {
|
|
453
|
-
localStorage.setItem("drizzle-cube-erd-node-positions", JSON.stringify(
|
|
453
|
+
localStorage.setItem("drizzle-cube-erd-node-positions", JSON.stringify(p));
|
|
454
454
|
} catch {
|
|
455
455
|
}
|
|
456
|
-
return E(
|
|
456
|
+
return E(p), h;
|
|
457
457
|
});
|
|
458
458
|
}, [z, $]), V = S(
|
|
459
459
|
(a) => R((x) => te(a, x)),
|
|
460
460
|
[R]
|
|
461
461
|
), G = S((a) => {
|
|
462
|
-
a.preventDefault(), a.stopPropagation(), console.log("Context menu triggered at:", a.clientX, a.clientY),
|
|
462
|
+
a.preventDefault(), a.stopPropagation(), console.log("Context menu triggered at:", a.clientX, a.clientY), r({
|
|
463
463
|
x: a.clientX,
|
|
464
464
|
y: a.clientY
|
|
465
465
|
});
|
|
466
466
|
}, []), X = S(() => {
|
|
467
|
-
e &&
|
|
467
|
+
e && r(null);
|
|
468
468
|
}, [e]), Y = S(() => {
|
|
469
|
-
N(!0),
|
|
469
|
+
N(!0), r(null);
|
|
470
470
|
}, []);
|
|
471
471
|
return y ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center", children: [
|
|
472
|
-
/* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-
|
|
472
|
+
/* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-dc-accent mx-auto mb-2" }),
|
|
473
473
|
/* @__PURE__ */ t("p", { className: "text-dc-text-muted", children: "Loading cube schema..." })
|
|
474
|
-
] }) }) :
|
|
474
|
+
] }) }) : l ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-dc-error", children: [
|
|
475
475
|
/* @__PURE__ */ t("p", { className: "font-medium", children: "Failed to load cube schema" }),
|
|
476
|
-
/* @__PURE__ */ t("p", { className: "text-sm mt-1", children:
|
|
477
|
-
] }) }) : !
|
|
476
|
+
/* @__PURE__ */ t("p", { className: "text-sm mt-1", children: l })
|
|
477
|
+
] }) }) : !d || d.cubes.length === 0 ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-dc-text-muted", children: [
|
|
478
478
|
/* @__PURE__ */ t("p", { className: "font-medium", children: "No cubes found" }),
|
|
479
479
|
/* @__PURE__ */ t("p", { className: "text-sm mt-1", children: "Register some cubes to see the relationship diagram" })
|
|
480
480
|
] }) }) : /* @__PURE__ */ o("div", { className: `h-full ${i}`, style: { height: "600px" }, children: [
|
|
@@ -486,8 +486,8 @@ function Ce({
|
|
|
486
486
|
onNodesChange: I,
|
|
487
487
|
onEdgesChange: A,
|
|
488
488
|
onConnect: V,
|
|
489
|
-
nodeTypes:
|
|
490
|
-
edgeTypes:
|
|
489
|
+
nodeTypes: ge,
|
|
490
|
+
edgeTypes: pe,
|
|
491
491
|
connectionMode: se.Loose,
|
|
492
492
|
fitView: !0,
|
|
493
493
|
minZoom: 0.1,
|
|
@@ -497,11 +497,11 @@ function Ce({
|
|
|
497
497
|
onPaneContextMenu: G,
|
|
498
498
|
onPaneClick: X,
|
|
499
499
|
children: [
|
|
500
|
-
/* @__PURE__ */ t(
|
|
500
|
+
/* @__PURE__ */ t(ne, {}),
|
|
501
501
|
/* @__PURE__ */ t(
|
|
502
|
-
|
|
502
|
+
re,
|
|
503
503
|
{
|
|
504
|
-
nodeColor: (a) =>
|
|
504
|
+
nodeColor: (a) => n.includes(a.id) ? "#8b5cf6" : "#e5e7eb",
|
|
505
505
|
maskColor: "rgb(240, 242, 246, 0.7)"
|
|
506
506
|
}
|
|
507
507
|
),
|
|
@@ -548,4 +548,4 @@ export {
|
|
|
548
548
|
Ce as CubeRelationshipDiagram,
|
|
549
549
|
Ce as default
|
|
550
550
|
};
|
|
551
|
-
//# sourceMappingURL=index-
|
|
551
|
+
//# sourceMappingURL=index-DlsvcKXf.js.map
|