@aintela/bi 0.2.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 +299 -0
- package/dist/BiClientProvider-CWJochvi.js +219 -0
- package/dist/BiClientProvider-CWJochvi.js.map +1 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
- package/dist/ChartContext-C_f_6khG.js +14 -0
- package/dist/ChartContext-C_f_6khG.js.map +1 -0
- package/dist/DashboardParametersContext-Clv--79U.js +39 -0
- package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
- package/dist/cards/ChartCard.d.ts +62 -0
- package/dist/cards/DataTableCard.d.ts +55 -0
- package/dist/cards/GaugeCard.d.ts +20 -0
- package/dist/cards/GaugeGroup.d.ts +12 -0
- package/dist/cards/MapBubbles.d.ts +35 -0
- package/dist/cards/MapConnections.d.ts +28 -0
- package/dist/cards/MetricCard.d.ts +15 -0
- package/dist/cards/MetricGroupCard.d.ts +10 -0
- package/dist/cards/TreeMapCard.d.ts +15 -0
- package/dist/cards/geoLayers.d.ts +23 -0
- package/dist/cards/index.d.ts +24 -0
- package/dist/cards/licenseGuard.d.ts +9 -0
- package/dist/cards/mapUtils.d.ts +23 -0
- package/dist/cards/useContainerRectangle.d.ts +9 -0
- package/dist/cards/worldMapPath.d.ts +7 -0
- package/dist/cards.d.ts +2 -0
- package/dist/cards.js +28 -0
- package/dist/cards.js.map +1 -0
- package/dist/client/BiClient.d.ts +160 -0
- package/dist/client/BiClientProvider.d.ts +21 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/composer/environment/environmentDom.d.ts +31 -0
- package/dist/composer/environment/types.d.ts +67 -0
- package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
- package/dist/composer/index.d.ts +66 -0
- package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
- package/dist/composer/llm/ExamplePad.d.ts +18 -0
- package/dist/composer/llm/PrototypePad.d.ts +13 -0
- package/dist/composer/llm/useDashboardPad.d.ts +25 -0
- package/dist/composer/models/catalog.d.ts +33 -0
- package/dist/composer/models/sketchModels.d.ts +102 -0
- package/dist/composer/models/utils.d.ts +9 -0
- package/dist/composer/pad/CardSketch.d.ts +25 -0
- package/dist/composer/pad/ClonedComponent.d.ts +13 -0
- package/dist/composer/pad/DashboardPad.d.ts +38 -0
- package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
- package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
- package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
- package/dist/composer/pad/FilterSketch.d.ts +10 -0
- package/dist/composer/pad/HoverButton.d.ts +12 -0
- package/dist/composer/pad/TitleSketch.d.ts +19 -0
- package/dist/composer/pad/ToolBox.d.ts +11 -0
- package/dist/composer/store/ComposerProvider.d.ts +36 -0
- package/dist/composer/store/createComposerStore.d.ts +107 -0
- package/dist/composer/store/drafts.d.ts +20 -0
- package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
- package/dist/composer/view/ComposerView.d.ts +49 -0
- package/dist/composer/view/DashboardPin.d.ts +3 -0
- package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
- package/dist/composer/view/DrawablePrompt.d.ts +22 -0
- package/dist/composer/view/EntryEmptyState.d.ts +22 -0
- package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
- package/dist/composer/view/composerAnimations.d.ts +11 -0
- package/dist/composer/view/composerTypes.d.ts +18 -0
- package/dist/composer/view/data/suggestions.d.ts +10 -0
- package/dist/composer/view/data/templates.d.ts +33 -0
- package/dist/composer/view/surfaces.d.ts +19 -0
- package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +99 -0
- package/dist/composer.js.map +1 -0
- package/dist/createBiTheme-TyUv_UHM.js +93 -0
- package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
- package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
- package/dist/data/dataUtils.d.ts +152 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/queryModel.d.ts +23 -0
- package/dist/data.d.ts +2 -0
- package/dist/data.js +37 -0
- package/dist/data.js.map +1 -0
- package/dist/dataUtils-CAUE5uZY.js +372 -0
- package/dist/dataUtils-CAUE5uZY.js.map +1 -0
- package/dist/filters/VizAutoComplete.d.ts +23 -0
- package/dist/filters/VizDatePicker.d.ts +9 -0
- package/dist/filters/VizDateRangePicker.d.ts +14 -0
- package/dist/filters/VizSelect.d.ts +12 -0
- package/dist/filters/VizTextField.d.ts +8 -0
- package/dist/filters/VizTriggerButton.d.ts +9 -0
- package/dist/filters/filterFactory.d.ts +30 -0
- package/dist/filters/friendlyName.d.ts +4 -0
- package/dist/filters/index.d.ts +15 -0
- package/dist/filters.d.ts +2 -0
- package/dist/filters.js +15 -0
- package/dist/filters.js.map +1 -0
- package/dist/grid/BiErrorBoundary.d.ts +24 -0
- package/dist/grid/ChartContext.d.ts +14 -0
- package/dist/grid/GridCard.d.ts +45 -0
- package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
- package/dist/grid/GridLayout.d.ts +147 -0
- package/dist/grid/gridModels.d.ts +33 -0
- package/dist/grid/index.d.ts +14 -0
- package/dist/grid/types.d.ts +23 -0
- package/dist/grid/useGridConfigTranslator.d.ts +72 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +20 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/DashboardParametersContext.d.ts +32 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/useDashboardData.d.ts +20 -0
- package/dist/hooks/useDashboardLazyData.d.ts +79 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +16 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-BYc79sSy.js +131 -0
- package/dist/index-BYc79sSy.js.map +1 -0
- package/dist/index-C6JQ6770.js +4545 -0
- package/dist/index-C6JQ6770.js.map +1 -0
- package/dist/index-CZbCaXMC.js +15 -0
- package/dist/index-CZbCaXMC.js.map +1 -0
- package/dist/index-D3OoOPjl.js +259 -0
- package/dist/index-D3OoOPjl.js.map +1 -0
- package/dist/index-D7Oo_dC-.js +94 -0
- package/dist/index-D7Oo_dC-.js.map +1 -0
- package/dist/index-D7tVPX8d.js +347 -0
- package/dist/index-D7tVPX8d.js.map +1 -0
- package/dist/index-DGyvUtY3.js +494 -0
- package/dist/index-DGyvUtY3.js.map +1 -0
- package/dist/index-DOpx0R4Y.js +41 -0
- package/dist/index-DOpx0R4Y.js.map +1 -0
- package/dist/index-wtSLspPh.js +1065 -0
- package/dist/index-wtSLspPh.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/dist/inline/Chart.d.ts +29 -0
- package/dist/inline/IFrame.d.ts +19 -0
- package/dist/inline/Metric.d.ts +16 -0
- package/dist/inline/MetricGroup.d.ts +11 -0
- package/dist/inline/index.d.ts +9 -0
- package/dist/inline/parseKnownNumbers.d.ts +11 -0
- package/dist/inline.d.ts +2 -0
- package/dist/inline.js +9 -0
- package/dist/inline.js.map +1 -0
- package/dist/runtime/IDashboardDefinition.d.ts +22 -0
- package/dist/runtime/biModuleSurface.d.ts +2 -0
- package/dist/runtime/createBiUiTools.d.ts +74 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/loadDashboardBundle.d.ts +32 -0
- package/dist/runtime/registerBiModules.d.ts +36 -0
- package/dist/runtime/version.d.ts +6 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +19 -0
- package/dist/runtime.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/BiThemeBridge.d.ts +32 -0
- package/dist/theme/biPalette.d.ts +23 -0
- package/dist/theme/createBiTheme.d.ts +25 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +15 -0
- package/dist/theme.js.map +1 -0
- package/dist/version-DnqajORq.js +83 -0
- package/dist/version-DnqajORq.js.map +1 -0
- package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
- package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
- package/dist/viewer/cardMetadata.d.ts +15 -0
- package/dist/viewer/index.d.ts +8 -0
- package/dist/viewer/models.d.ts +67 -0
- package/dist/viewer/useDashboardBundle.d.ts +73 -0
- package/dist/viewer.d.ts +2 -0
- package/dist/viewer.js +9 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +196 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var fe = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var p = (e, t) => V(e, "name", { value: t, configurable: !0 });
|
|
4
|
+
var ee = (e, t, n) => fe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
|
+
import { jsxs as _, jsx as h, Fragment as me } from "react/jsx-runtime";
|
|
6
|
+
import he, { forwardRef as ne, useCallback as I, useRef as te, useEffect as pe, useMemo as F } from "react";
|
|
7
|
+
import { useContainerWidth as ge, Responsive as we, ReactGridLayout as ye } from "react-grid-layout";
|
|
8
|
+
import { gridBounds as xe, minMaxSize as be } from "react-grid-layout/core";
|
|
9
|
+
import { useTheme as ve, alpha as se } from "@mui/material/styles";
|
|
10
|
+
import { C as ie, u as Ce } from "./ChartContext-C_f_6khG.js";
|
|
11
|
+
const Q = class Q extends he.Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
ee(this, "state", { error: null });
|
|
15
|
+
}
|
|
16
|
+
static getDerivedStateFromError(n) {
|
|
17
|
+
return { error: n };
|
|
18
|
+
}
|
|
19
|
+
componentDidCatch(n, l) {
|
|
20
|
+
var s, r;
|
|
21
|
+
(r = (s = this.props).onError) == null || r.call(s, n, l);
|
|
22
|
+
}
|
|
23
|
+
componentDidUpdate(n) {
|
|
24
|
+
this.state.error && n.resetKey !== this.props.resetKey && this.setState({ error: null });
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return this.state.error ? this.props.fallback(this.state.error) : this.props.children;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
p(Q, "BiErrorBoundary");
|
|
31
|
+
let P = Q;
|
|
32
|
+
const ae = ne(
|
|
33
|
+
({
|
|
34
|
+
style: e,
|
|
35
|
+
htmlStyle: t,
|
|
36
|
+
className: n,
|
|
37
|
+
onMouseDown: l,
|
|
38
|
+
onMouseUp: s,
|
|
39
|
+
onTouchEnd: r,
|
|
40
|
+
children: o,
|
|
41
|
+
variant: m = "default",
|
|
42
|
+
viewType: c = "Boxed",
|
|
43
|
+
header: f,
|
|
44
|
+
renderHeader: w,
|
|
45
|
+
dragLocked: b = !1,
|
|
46
|
+
noBorder: i = !1,
|
|
47
|
+
color: y,
|
|
48
|
+
zoomLevel: v = 0.9,
|
|
49
|
+
customColor: g,
|
|
50
|
+
contentDisplay: H = "default",
|
|
51
|
+
contentStyle: U,
|
|
52
|
+
contentClassName: X,
|
|
53
|
+
isResizable: W = !1,
|
|
54
|
+
...G
|
|
55
|
+
}, x) => {
|
|
56
|
+
const A = ve(), C = c === "Naked", $ = m === "elevated" ? "grid-card-elevated" : "", B = !!f && !C, Y = C ? "" : y ? `grid-card-${y}` : "", q = C ? "grid-card-naked" : "", K = H === "grid" ? "grid-card-content-grid" : "", E = f == null ? void 0 : f.icon, T = {
|
|
57
|
+
position: "relative",
|
|
58
|
+
cursor: b ? "pointer" : "grab",
|
|
59
|
+
border: i ? "0px" : "",
|
|
60
|
+
height: "100%",
|
|
61
|
+
zoom: `${v} !important`,
|
|
62
|
+
...e,
|
|
63
|
+
...y === "custom" && g ? {
|
|
64
|
+
"--grid-card-accent": g,
|
|
65
|
+
"--grid-card-accent-light": re(g, 0.4),
|
|
66
|
+
"--grid-card-accent-dark": re(g, 0.2)
|
|
67
|
+
} : {}
|
|
68
|
+
}, L = parseInt(String((e == null ? void 0 : e.height) ?? "0")), O = f && !C ? w ? w(f) : /* @__PURE__ */ _("div", { className: "grid-card-header", children: [
|
|
69
|
+
/* @__PURE__ */ h("h4", { className: "grid-card-title", children: f.title }),
|
|
70
|
+
f.icon && /* @__PURE__ */ h("div", { className: "grid-card-icon", children: typeof f.icon == "string" ? /* @__PURE__ */ h("i", { className: "material-icons", children: f.icon }) : /* @__PURE__ */ h(E, { fontSize: "small", sx: { fontSize: "16px" } }) })
|
|
71
|
+
] }) : null, z = /* @__PURE__ */ p((a) => /* @__PURE__ */ h(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: "grid-card-error",
|
|
75
|
+
style: {
|
|
76
|
+
border: `1px solid ${A.palette.error.main}`,
|
|
77
|
+
borderRadius: 6,
|
|
78
|
+
padding: "12px 16px",
|
|
79
|
+
margin: "8px 0",
|
|
80
|
+
height: "95%",
|
|
81
|
+
backgroundColor: se(A.palette.error.main, 0.06)
|
|
82
|
+
},
|
|
83
|
+
children: /* @__PURE__ */ _("div", { style: { color: A.palette.error.main, fontSize: "0.85em", fontWeight: 500, marginBottom: 6 }, children: [
|
|
84
|
+
"Card render error: ",
|
|
85
|
+
a.message
|
|
86
|
+
] })
|
|
87
|
+
}
|
|
88
|
+
), "errorFallback"), u = [C ? "grid-card-content-naked" : "grid-card-content", K, X].filter(Boolean).join(" ");
|
|
89
|
+
return /* @__PURE__ */ _(me, { children: [
|
|
90
|
+
t && /* @__PURE__ */ h("style", { children: t }),
|
|
91
|
+
/* @__PURE__ */ _(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
ref: x,
|
|
95
|
+
style: T,
|
|
96
|
+
className: `${W ? "grid-card" : "grid-card-nohandle"} ds-card ${$} ${Y} ${q} ${B ? "grid-card-with-header" : ""} ${n ?? ""}`.trim(),
|
|
97
|
+
onMouseDown: l,
|
|
98
|
+
onMouseUp: s,
|
|
99
|
+
onTouchEnd: r,
|
|
100
|
+
...G,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ _("div", { style: { paddingLeft: `${L * (1 - v)}px`, zoom: v, height: "inherit", width: "inherit", display: "flex", flexDirection: "column" }, children: [
|
|
103
|
+
O && /* @__PURE__ */ h("div", { style: { flexShrink: 0 }, children: O }),
|
|
104
|
+
/* @__PURE__ */ h("div", { className: u, style: { alignItems: "center", flex: 1, minHeight: 0, overflow: "hidden", ...U }, children: /* @__PURE__ */ h(ie, { value: { naked: C }, children: /* @__PURE__ */ h(P, { fallback: z, children: o }) }) }),
|
|
105
|
+
C && /* @__PURE__ */ h("div", { className: "grid-card-naked-resize-handle", "aria-hidden": "true" })
|
|
106
|
+
] }),
|
|
107
|
+
C && /* @__PURE__ */ h("div", { className: "grid-card-naked-resize-handle", "aria-hidden": "true" })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
ae.displayName = "GridCard";
|
|
115
|
+
function re(e, t) {
|
|
116
|
+
try {
|
|
117
|
+
return se(e, t);
|
|
118
|
+
} catch {
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
p(re, "safeAlpha");
|
|
123
|
+
const oe = {
|
|
124
|
+
lg: 920,
|
|
125
|
+
md: 600,
|
|
126
|
+
sm: 400,
|
|
127
|
+
xs: 400,
|
|
128
|
+
xxs: 0
|
|
129
|
+
}, N = { lg: 12, md: 9, sm: 4, xs: 4, xxs: 4 }, de = 20, le = 3, ce = 36;
|
|
130
|
+
function ke(e) {
|
|
131
|
+
return e === !0 ? { enabled: !0, defaultOn: !1, modifierKey: "Shift" } : e ? {
|
|
132
|
+
enabled: e.enabled ?? !0,
|
|
133
|
+
defaultOn: e.defaultOn ?? !1,
|
|
134
|
+
modifierKey: e.modifierKey ?? "Shift"
|
|
135
|
+
} : { enabled: !1, defaultOn: !1, modifierKey: "Shift" };
|
|
136
|
+
}
|
|
137
|
+
p(ke, "normaliseRowAwareResize");
|
|
138
|
+
function Re(e, t, n, l) {
|
|
139
|
+
if (e.length !== t.length) return !1;
|
|
140
|
+
for (let s = 0; s < e.length; s++) {
|
|
141
|
+
const r = e[s], o = t.find((m) => m.i === r.i);
|
|
142
|
+
if (!o || r.x !== o.x || r.y !== o.y || r.w !== o.w || r.h !== o.h)
|
|
143
|
+
return !1;
|
|
144
|
+
}
|
|
145
|
+
return !0;
|
|
146
|
+
}
|
|
147
|
+
p(Re, "areLayoutsEqual");
|
|
148
|
+
const Se = /* @__PURE__ */ p(({
|
|
149
|
+
config: e,
|
|
150
|
+
layouts: t,
|
|
151
|
+
responsive: n = !0,
|
|
152
|
+
autoResponsiveStrategy: l = "scale",
|
|
153
|
+
rowHeight: s = de,
|
|
154
|
+
rowMultiplier: r = le,
|
|
155
|
+
breakpoints: o = oe,
|
|
156
|
+
cols: m = N,
|
|
157
|
+
zoomLevel: c = 0.98,
|
|
158
|
+
maxRows: f = ce,
|
|
159
|
+
dragLocked: w = !1,
|
|
160
|
+
onLayoutChange: b,
|
|
161
|
+
onResizeStop: i,
|
|
162
|
+
onDragStop: y,
|
|
163
|
+
onDrop: v,
|
|
164
|
+
manualWidth: g,
|
|
165
|
+
children: H,
|
|
166
|
+
className: U,
|
|
167
|
+
rowAwareResize: X
|
|
168
|
+
}) => {
|
|
169
|
+
const W = I(
|
|
170
|
+
(u, a, d) => {
|
|
171
|
+
i == null || i(u, a, d);
|
|
172
|
+
},
|
|
173
|
+
[i]
|
|
174
|
+
), G = I(
|
|
175
|
+
(u, a, d) => {
|
|
176
|
+
y == null || y(u, a, d);
|
|
177
|
+
},
|
|
178
|
+
[y]
|
|
179
|
+
), x = ke(X), A = te(!1);
|
|
180
|
+
pe(() => {
|
|
181
|
+
if (!x.enabled) return;
|
|
182
|
+
const a = /* @__PURE__ */ p((d) => {
|
|
183
|
+
switch (x.modifierKey) {
|
|
184
|
+
case "Shift":
|
|
185
|
+
A.current = !!d.shiftKey;
|
|
186
|
+
return;
|
|
187
|
+
case "Alt":
|
|
188
|
+
A.current = !!d.altKey;
|
|
189
|
+
return;
|
|
190
|
+
case "Ctrl":
|
|
191
|
+
A.current = !!d.ctrlKey;
|
|
192
|
+
return;
|
|
193
|
+
case "Meta":
|
|
194
|
+
A.current = !!d.metaKey;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}, "update");
|
|
198
|
+
return window.addEventListener("keydown", a), window.addEventListener("keyup", a), window.addEventListener("mousemove", a), window.addEventListener("mousedown", a), () => {
|
|
199
|
+
window.removeEventListener("keydown", a), window.removeEventListener("keyup", a), window.removeEventListener("mousemove", a), window.removeEventListener("mousedown", a);
|
|
200
|
+
};
|
|
201
|
+
}, [x.enabled, x.modifierKey]);
|
|
202
|
+
const C = F(() => ({
|
|
203
|
+
name: "rowAwareResize",
|
|
204
|
+
constrainSize(u, a, d, k, R) {
|
|
205
|
+
if (!x.enabled) return { w: a, h: d };
|
|
206
|
+
const S = A.current;
|
|
207
|
+
if (!(x.defaultOn ? !S : S)) return { w: a, h: d };
|
|
208
|
+
const j = u.y ?? 0;
|
|
209
|
+
for (const M of R.layout)
|
|
210
|
+
M.i !== u.i && (M.y ?? 0) === j && (M.h = d);
|
|
211
|
+
return { w: a, h: d };
|
|
212
|
+
}
|
|
213
|
+
}), [x.enabled, x.defaultOn]), $ = F(() => {
|
|
214
|
+
if (x.enabled)
|
|
215
|
+
return [xe, be, C];
|
|
216
|
+
}, [x.enabled, C]), { width: B, containerRef: Y, mounted: q } = ge(), K = g ?? B;
|
|
217
|
+
c = c ? c * 0.95 : 0.98 * 0.95;
|
|
218
|
+
const E = te(null);
|
|
219
|
+
e && (e.rowMultipler = r ?? 1);
|
|
220
|
+
const T = I((u) => {
|
|
221
|
+
const a = Array.isArray(u) ? { lg: u, md: u, sm: u, xs: u, xxs: u } : u, d = {};
|
|
222
|
+
for (const k of Object.keys(a)) {
|
|
223
|
+
const R = a[k];
|
|
224
|
+
R && (d[k] = R.map((S) => ({ ...S })));
|
|
225
|
+
}
|
|
226
|
+
return d;
|
|
227
|
+
}, []);
|
|
228
|
+
n && Array.isArray(t) && (t = {
|
|
229
|
+
lg: [...t],
|
|
230
|
+
md: [...t],
|
|
231
|
+
sm: [...t],
|
|
232
|
+
xs: [...t],
|
|
233
|
+
xxs: [...t]
|
|
234
|
+
});
|
|
235
|
+
const L = F(() => t ? Array.isArray(t) ? {
|
|
236
|
+
lg: t,
|
|
237
|
+
md: t,
|
|
238
|
+
sm: t,
|
|
239
|
+
xs: t,
|
|
240
|
+
xxs: t
|
|
241
|
+
} : t : null, [t]);
|
|
242
|
+
L && (E.current = L);
|
|
243
|
+
const O = /* @__PURE__ */ p((u, a, d) => {
|
|
244
|
+
if (!v) return;
|
|
245
|
+
const k = d, R = k == null ? void 0 : k.dataTransfer.getData("text/json");
|
|
246
|
+
let S = null;
|
|
247
|
+
R && (S = JSON.parse(R)), v(S, a);
|
|
248
|
+
}, "handleDrop"), z = I(
|
|
249
|
+
(u, a) => {
|
|
250
|
+
if (!b) return;
|
|
251
|
+
const d = a ?? { lg: u }, k = E.current;
|
|
252
|
+
if (k) {
|
|
253
|
+
let S = !1;
|
|
254
|
+
for (const J of Object.keys(d)) {
|
|
255
|
+
const j = d[J], M = k[J];
|
|
256
|
+
if (!(!j || !M) && !Re(j, M, (e == null ? void 0 : e.rowMultipler) ?? 1)) {
|
|
257
|
+
S = !0;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (!S) return;
|
|
262
|
+
}
|
|
263
|
+
E.current = d;
|
|
264
|
+
const R = T(d);
|
|
265
|
+
b(R.lg, R);
|
|
266
|
+
},
|
|
267
|
+
[b, T, e == null ? void 0 : e.rowMultipler, c]
|
|
268
|
+
);
|
|
269
|
+
if (!L) return null;
|
|
270
|
+
for (const u of Object.keys(L)) {
|
|
271
|
+
const a = L[u];
|
|
272
|
+
a && a.forEach((d) => {
|
|
273
|
+
d.isDraggable = !w, d.isResizable = !w;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return /* @__PURE__ */ h(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
ref: Y,
|
|
280
|
+
className: U,
|
|
281
|
+
style: { minHeight: "100%", paddingBottom: "200px", minWidth: "100%", paddingLeft: `${(1 - c) / 2 * 100}%`, zoom: c, overflow: "auto" },
|
|
282
|
+
children: q && n ? /* @__PURE__ */ h(
|
|
283
|
+
we,
|
|
284
|
+
{
|
|
285
|
+
onDrop: O,
|
|
286
|
+
dropConfig: {
|
|
287
|
+
enabled: !w,
|
|
288
|
+
defaultItem: {
|
|
289
|
+
h: 2,
|
|
290
|
+
w: 2
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
dragConfig: {
|
|
294
|
+
enabled: !w
|
|
295
|
+
},
|
|
296
|
+
layouts: { ...L },
|
|
297
|
+
breakpoints: o,
|
|
298
|
+
cols: m,
|
|
299
|
+
rowHeight: s,
|
|
300
|
+
maxRows: (f ?? 24) * ((e == null ? void 0 : e.rowMultipler) ?? 1),
|
|
301
|
+
width: K,
|
|
302
|
+
containerPadding: [0, 0],
|
|
303
|
+
onLayoutChange: z,
|
|
304
|
+
onResizeStop: W,
|
|
305
|
+
onDragStop: G,
|
|
306
|
+
constraints: $,
|
|
307
|
+
children: H
|
|
308
|
+
}
|
|
309
|
+
) : /* @__PURE__ */ h(
|
|
310
|
+
ye,
|
|
311
|
+
{
|
|
312
|
+
onDrop: O,
|
|
313
|
+
dropConfig: {
|
|
314
|
+
enabled: !w,
|
|
315
|
+
defaultItem: {
|
|
316
|
+
h: 1,
|
|
317
|
+
w: 3
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
gridConfig: { cols: 12, rowHeight: s, maxRows: 100, containerPadding: [0, 0], margin: [0, 2] },
|
|
321
|
+
dragConfig: {
|
|
322
|
+
enabled: !w,
|
|
323
|
+
bounded: !0
|
|
324
|
+
},
|
|
325
|
+
layout: L.lg,
|
|
326
|
+
autoSize: !0,
|
|
327
|
+
width: K,
|
|
328
|
+
onLayoutChange: z,
|
|
329
|
+
onResizeStop: W,
|
|
330
|
+
onDragStop: G,
|
|
331
|
+
constraints: $,
|
|
332
|
+
children: H
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
}, "GridLayout"), ue = ne(
|
|
338
|
+
({ style: e, className: t, onMouseDown: n, onMouseUp: l, onTouchEnd: s, children: r, ...o }, m) => {
|
|
339
|
+
const c = { cursor: "grab", ...e }, { static: f, naked: w, ...b } = o;
|
|
340
|
+
return /* @__PURE__ */ h(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
ref: m,
|
|
344
|
+
style: c,
|
|
345
|
+
className: `${f ? "" : "grid-card"} ds-card dscard-placeholder${w ? "-naked" : ""} react-draggable cssTransforms react-resizable ${t ?? ""}`.trim(),
|
|
346
|
+
onMouseDown: n,
|
|
347
|
+
onMouseUp: l,
|
|
348
|
+
onTouchEnd: s,
|
|
349
|
+
...b,
|
|
350
|
+
children: /* @__PURE__ */ h("div", { className: "grid-card-content", children: r })
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
ue.displayName = "GridCardPlaceHolder";
|
|
356
|
+
function D(e, t = 12) {
|
|
357
|
+
const n = [];
|
|
358
|
+
function l(s, r, o, m) {
|
|
359
|
+
let c = o;
|
|
360
|
+
for (const f of s) {
|
|
361
|
+
const w = f.height ?? 1;
|
|
362
|
+
let b = r;
|
|
363
|
+
for (const i of f.cells) {
|
|
364
|
+
const y = Math.round(i.width / 12 * m);
|
|
365
|
+
let v = i.height ?? w;
|
|
366
|
+
if (v = v == 1 ? 1 : v, i.rows && i.rows.length > 0)
|
|
367
|
+
l(i.rows, b, c, y);
|
|
368
|
+
else if (i.key) {
|
|
369
|
+
const g = {
|
|
370
|
+
i: i.key,
|
|
371
|
+
x: b,
|
|
372
|
+
y: c,
|
|
373
|
+
w: y,
|
|
374
|
+
h: v * (e.rowMultipler ?? 1) + 1
|
|
375
|
+
};
|
|
376
|
+
i.minW !== void 0 && (g.minW = i.minW), i.maxW !== void 0 && (g.maxW = i.maxW), i.minH !== void 0 && (g.minH = i.minH), i.maxH !== void 0 && (g.maxH = i.maxH), i.static !== void 0 && (g.static = i.static), i.isDraggable !== void 0 && (g.isDraggable = i.isDraggable), i.isResizable !== void 0 && (g.isResizable = i.isResizable), n.push(g);
|
|
377
|
+
}
|
|
378
|
+
b += y;
|
|
379
|
+
}
|
|
380
|
+
c += w;
|
|
381
|
+
}
|
|
382
|
+
return c;
|
|
383
|
+
}
|
|
384
|
+
return p(l, "processRows"), l(e.rows, 0, 0, t), n;
|
|
385
|
+
}
|
|
386
|
+
p(D, "translateGridConfig");
|
|
387
|
+
function Z(e, t = N) {
|
|
388
|
+
const n = ["lg", "md", "sm", "xs", "xxs"], l = {};
|
|
389
|
+
let s;
|
|
390
|
+
for (const r of n) {
|
|
391
|
+
const o = e[r];
|
|
392
|
+
o ? (s = o, l[r] = D(o, t[r])) : s && (l[r] = D(
|
|
393
|
+
s,
|
|
394
|
+
t[r]
|
|
395
|
+
));
|
|
396
|
+
}
|
|
397
|
+
return l;
|
|
398
|
+
}
|
|
399
|
+
p(Z, "translateResponsiveGridConfig");
|
|
400
|
+
function Ae(e, t = N, n = "stack") {
|
|
401
|
+
const l = ["lg", "md", "sm", "xs", "xxs"], s = {}, r = t.lg, o = D(e, r);
|
|
402
|
+
for (const m of l) {
|
|
403
|
+
const c = t[m];
|
|
404
|
+
c === r ? s[m] = o : n === "stack" || n === "hybrid" && c <= 4 ? s[m] = Le(o, c) : s[m] = Me(o, r, c, e.rowMultipler ?? 1);
|
|
405
|
+
}
|
|
406
|
+
return s;
|
|
407
|
+
}
|
|
408
|
+
p(Ae, "translateGridConfigAutoResponsive");
|
|
409
|
+
function Le(e, t) {
|
|
410
|
+
let n = 0;
|
|
411
|
+
return [...e].sort((s, r) => s.y !== r.y ? s.y - r.y : s.x - r.x).map((s) => {
|
|
412
|
+
const r = {
|
|
413
|
+
...s,
|
|
414
|
+
x: 0,
|
|
415
|
+
y: n,
|
|
416
|
+
w: t,
|
|
417
|
+
// Full width
|
|
418
|
+
// Keep height, but ensure minimum of 2 for readability on small screens
|
|
419
|
+
h: Math.max(s.h, 2)
|
|
420
|
+
};
|
|
421
|
+
return n += r.h, r;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
p(Le, "createStackedLayout");
|
|
425
|
+
function Me(e, t, n, l) {
|
|
426
|
+
const s = n / t;
|
|
427
|
+
return e.map((r) => {
|
|
428
|
+
const o = Math.max(1, Math.round(r.w * s)), m = Math.round(r.x * s), c = Math.min(m, n - o);
|
|
429
|
+
return {
|
|
430
|
+
...r,
|
|
431
|
+
x: Math.max(0, c) * l,
|
|
432
|
+
w: o
|
|
433
|
+
};
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
p(Me, "createScaledLayout");
|
|
437
|
+
function Ee(e) {
|
|
438
|
+
const { config: t, responsive: n = !1, cols: l = N } = e;
|
|
439
|
+
return F(() => {
|
|
440
|
+
if (n) {
|
|
441
|
+
const r = t;
|
|
442
|
+
return "rows" in r ? {
|
|
443
|
+
layout: void 0,
|
|
444
|
+
layouts: Z(
|
|
445
|
+
{ lg: r },
|
|
446
|
+
l
|
|
447
|
+
)
|
|
448
|
+
} : {
|
|
449
|
+
layout: void 0,
|
|
450
|
+
layouts: Z(r, l)
|
|
451
|
+
};
|
|
452
|
+
} else
|
|
453
|
+
return {
|
|
454
|
+
layout: D(t, l.lg ?? 12),
|
|
455
|
+
layouts: void 0
|
|
456
|
+
};
|
|
457
|
+
}, [t, n, l]);
|
|
458
|
+
}
|
|
459
|
+
p(Ee, "useGridConfigTranslator");
|
|
460
|
+
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
461
|
+
__proto__: null,
|
|
462
|
+
BiErrorBoundary: P,
|
|
463
|
+
ChartContextProvider: ie,
|
|
464
|
+
DEFAULT_BREAKPOINTS: oe,
|
|
465
|
+
DEFAULT_COLS: N,
|
|
466
|
+
DEFAULT_MAX_ROWS: ce,
|
|
467
|
+
DEFAULT_ROW_HEIGHT: de,
|
|
468
|
+
DEFAULT_ROW_MULTIPLIER: le,
|
|
469
|
+
GridCard: ae,
|
|
470
|
+
GridCardPlaceHolder: ue,
|
|
471
|
+
GridLayout: Se,
|
|
472
|
+
translateGridConfig: D,
|
|
473
|
+
translateGridConfigAutoResponsive: Ae,
|
|
474
|
+
translateResponsiveGridConfig: Z,
|
|
475
|
+
useChartContext: Ce,
|
|
476
|
+
useGridConfigTranslator: Ee
|
|
477
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
478
|
+
export {
|
|
479
|
+
P as B,
|
|
480
|
+
oe as D,
|
|
481
|
+
ae as G,
|
|
482
|
+
N as a,
|
|
483
|
+
ce as b,
|
|
484
|
+
de as c,
|
|
485
|
+
le as d,
|
|
486
|
+
ue as e,
|
|
487
|
+
Se as f,
|
|
488
|
+
Ae as g,
|
|
489
|
+
Z as h,
|
|
490
|
+
$e as i,
|
|
491
|
+
D as t,
|
|
492
|
+
Ee as u
|
|
493
|
+
};
|
|
494
|
+
//# sourceMappingURL=index-DGyvUtY3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DGyvUtY3.js","sources":["../src/grid/BiErrorBoundary.tsx","../src/grid/GridCard.tsx","../src/grid/types.ts","../src/grid/GridLayout.tsx","../src/grid/GridCardPlaceHolder.tsx","../src/grid/useGridConfigTranslator.ts"],"sourcesContent":["import React from 'react';\n\nexport interface BiErrorBoundaryProps {\n fallback: (error: Error) => React.ReactNode;\n /** Reset the boundary when this value changes (e.g. the card key or a render generation). */\n resetKey?: unknown;\n onError?: (error: Error, info: React.ErrorInfo) => void;\n children?: React.ReactNode;\n}\n\ninterface State {\n error: Error | null;\n}\n\n/**\n * Minimal error boundary for grid cards. A local copy rather than the chat\n * library's `JsxErrorBoundary`, so `@aintela/bi/grid` has no runtime import\n * from `@aintela/chat` (only `@aintela/bi/runtime` talks to the chat library).\n */\nexport class BiErrorBoundary extends React.Component<BiErrorBoundaryProps, State> {\n state: State = { error: null };\n\n static getDerivedStateFromError(error: Error): State {\n return { error };\n }\n\n componentDidCatch(error: Error, info: React.ErrorInfo): void {\n this.props.onError?.(error, info);\n }\n\n componentDidUpdate(prev: BiErrorBoundaryProps): void {\n if (this.state.error && prev.resetKey !== this.props.resetKey) {\n this.setState({ error: null });\n }\n }\n\n render(): React.ReactNode {\n if (this.state.error) return this.props.fallback(this.state.error);\n return this.props.children;\n }\n}\n\nexport default BiErrorBoundary;\n","import React, { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode, CSSProperties } from 'react';\nimport type { SvgIconComponent } from '@mui/icons-material';\nimport type { OverridableComponent } from '@mui/material/OverridableComponent';\nimport type { SvgIconTypeMap } from '@mui/material/SvgIcon';\nimport { useTheme } from '@mui/material/styles';\nimport { alpha } from '@mui/material/styles';\nimport { BiErrorBoundary } from './BiErrorBoundary';\nimport { ChartContextProvider } from './ChartContext';\nimport './GridLayout.css';\n\n/** Header configuration for GridCard */\nexport interface GridCardHeader {\n title: string;\n /** Material Icons ligature name (host loads the font) or an MUI icon component */\n icon?: string | SvgIconComponent;\n}\n\n/** Predefined accent variants for the card */\nexport type GridCardColor = 'kpi' | 'chart' | 'table' | 'info' | 'iframe' | 'details' | 'custom';\n\nexport type GridCardContentDisplay = 'default' | 'grid';\n\n/**\n * - \"Boxed\": default look with header, border accents, etc.\n * - \"Naked\": no header, no border accents, blends with the background; only\n * subtle drag/resize handles on hover.\n */\nexport type GridCardViewType = 'Boxed' | 'Naked';\n\nexport interface GridCardProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n variant?: 'default' | 'elevated';\n viewType?: GridCardViewType;\n header?: GridCardHeader;\n /** Custom header render function; overrides the default header. */\n renderHeader?: (header: GridCardHeader) => ReactNode;\n /** Accent variant. */\n color?: GridCardColor;\n /** Custom accent (used when color=\"custom\"): any CSS colour, e.g. a theme token you resolved. */\n customColor?: string;\n contentDisplay?: GridCardContentDisplay;\n contentStyle?: CSSProperties;\n contentClassName?: string;\n noBorder?: boolean;\n /** Raw CSS injected in a `<style>` next to the card (dashboard bundles emit per-card styles). */\n htmlStyle?: string;\n dragLocked?: boolean;\n zoomLevel?: number;\n isResizable?: boolean;\n}\n\n/**\n * GridCard — a card usable directly as a react-grid-layout item. Forwards the\n * ref and the mouse/touch props RGL needs; use it as a direct child of\n * `GridLayout` with a `key`.\n */\nexport const GridCard = forwardRef<HTMLDivElement, GridCardProps>(\n (\n {\n style,\n htmlStyle,\n className,\n onMouseDown,\n onMouseUp,\n onTouchEnd,\n children,\n variant = 'default',\n viewType = 'Boxed',\n header,\n renderHeader,\n dragLocked = false,\n noBorder = false,\n color,\n zoomLevel = 0.9,\n customColor,\n contentDisplay = 'default',\n contentStyle,\n contentClassName,\n isResizable = false,\n ...props\n },\n ref,\n ) => {\n const theme = useTheme();\n const isNaked = viewType === 'Naked';\n const variantClass = variant === 'elevated' ? 'grid-card-elevated' : '';\n const hasHeader = !!header && !isNaked;\n const colorClass = isNaked ? '' : color ? `grid-card-${color}` : '';\n const nakedClass = isNaked ? 'grid-card-naked' : '';\n const displayClass = contentDisplay === 'grid' ? 'grid-card-content-grid' : '';\n\n const HeaderIcon = header?.icon as OverridableComponent<SvgIconTypeMap<{}, 'svg'>>;\n\n const cardStyle: CSSProperties = {\n position: 'relative',\n cursor: dragLocked ? 'pointer' : 'grab',\n border: noBorder ? '0px' : '',\n height: '100%',\n zoom: `${zoomLevel} !important`,\n ...style,\n ...(color === 'custom' && customColor\n ? ({\n '--grid-card-accent': customColor,\n '--grid-card-accent-light': safeAlpha(customColor, 0.4),\n '--grid-card-accent-dark': safeAlpha(customColor, 0.2),\n } as CSSProperties)\n : {}),\n };\n\n const innerWidth = parseInt(String(style?.height ?? '0'));\n\n const headerElement = header && !isNaked ? (\n renderHeader ? (\n renderHeader(header)\n ) : (\n <div className=\"grid-card-header\">\n <h4 className=\"grid-card-title\">{header.title}</h4>\n {header.icon && (\n <div className=\"grid-card-icon\">\n {typeof header.icon === 'string' ? <i className=\"material-icons\">{header.icon}</i> : <HeaderIcon fontSize=\"small\" sx={{ fontSize: '16px' }} />}\n </div>\n )}\n </div>\n )\n ) : null;\n\n const errorFallback = (err: Error) => (\n <div\n className=\"grid-card-error\"\n style={{\n border: `1px solid ${theme.palette.error.main}`,\n borderRadius: 6,\n padding: '12px 16px',\n margin: '8px 0',\n height: '95%',\n backgroundColor: alpha(theme.palette.error.main, 0.06),\n }}\n >\n <div style={{ color: theme.palette.error.main, fontSize: '0.85em', fontWeight: 500, marginBottom: 6 }}>Card render error: {err.message}</div>\n </div>\n );\n\n const contentClasses = [isNaked ? 'grid-card-content-naked' : 'grid-card-content', displayClass, contentClassName].filter(Boolean).join(' ');\n\n return (\n <>\n {htmlStyle && <style>{htmlStyle}</style>}\n\n <div\n ref={ref}\n style={cardStyle}\n className={`${isResizable ? 'grid-card' : 'grid-card-nohandle'} ds-card ${variantClass} ${colorClass} ${nakedClass} ${hasHeader ? 'grid-card-with-header' : ''} ${className ?? ''}`.trim()}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onTouchEnd={onTouchEnd}\n {...props}\n >\n {/* Flex column: pinned header slot + a content area that owns the scroll boundary\n (`flex: 1; min-height: 0`), so `height: 100%` inside children resolves to the\n content area and not header + content. */}\n <div style={{ paddingLeft: `${innerWidth * (1 - zoomLevel)}px`, zoom: zoomLevel, height: 'inherit', width: 'inherit', display: 'flex', flexDirection: 'column' }}>\n {headerElement && <div style={{ flexShrink: 0 }}>{headerElement}</div>}\n <div className={contentClasses} style={{ alignItems: 'center', flex: 1, minHeight: 0, overflow: 'hidden', ...contentStyle }}>\n <ChartContextProvider value={{ naked: isNaked }}>\n <BiErrorBoundary fallback={errorFallback}>{children}</BiErrorBoundary>\n </ChartContextProvider>\n </div>\n {isNaked && <div className=\"grid-card-naked-resize-handle\" aria-hidden=\"true\" />}\n </div>\n {isNaked && <div className=\"grid-card-naked-resize-handle\" aria-hidden=\"true\" />}\n </div>\n </>\n );\n },\n);\n\nGridCard.displayName = 'GridCard';\n\nfunction safeAlpha(color: string, a: number): string {\n try {\n return alpha(color, a);\n } catch {\n return color;\n }\n}\n\nexport default GridCard;\n","import type { Layout } from 'react-grid-layout';\nimport type { GridConfig } from './gridModels';\n\nexport type { CellConfig, RowConfig, GridConfig } from './gridModels';\n\n/** Breakpoint names supported by the grid */\nexport type BreakpointName = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';\n\n/** Responsive grid configuration — a GridConfig per breakpoint */\nexport interface ResponsiveGridConfig {\n lg?: GridConfig;\n md?: GridConfig;\n sm?: GridConfig;\n xs?: GridConfig;\n xxs?: GridConfig;\n rowMultipler?: number;\n}\n\n/** Responsive layouts (native react-grid-layout format) */\nexport type ResponsiveLayouts = {\n [K in BreakpointName]?: Layout;\n};\n\nexport const DEFAULT_BREAKPOINTS: Record<BreakpointName, number> = {\n lg: 920,\n md: 600,\n sm: 400,\n xs: 400,\n xxs: 0,\n};\n\nexport const DEFAULT_COLS: Record<BreakpointName, number> = { lg: 12, md: 9, sm: 4, xs: 4, xxs: 4 };\n\nexport const DEFAULT_ROW_HEIGHT = 20;\nexport const DEFAULT_ROW_MULTIPLIER = 3;\nexport const DEFAULT_MAX_ROWS = 36;\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { ReactGridLayout, Responsive, useContainerWidth } from \"react-grid-layout\";\nimport { gridBounds, minMaxSize } from \"react-grid-layout/core\";\nimport type {\n Layout,\n LayoutItem,\n ResponsiveLayouts as RGLResponsiveLayouts,\n} from \"react-grid-layout\";\nimport type { LayoutConstraint } from \"react-grid-layout/core\";\nimport type {\n GridConfig,\n ResponsiveGridConfig,\n ResponsiveLayouts,\n BreakpointName,\n} from \"./types\";\nimport {\n DEFAULT_BREAKPOINTS,\n DEFAULT_COLS,\n DEFAULT_MAX_ROWS,\n DEFAULT_ROW_HEIGHT,\n DEFAULT_ROW_MULTIPLIER,\n} from \"./types\";\nimport type { AutoResponsiveStrategy } from \"./useGridConfigTranslator\";\n\nimport './GridLayout.css';\n\n/**\n * Props for the GridLayout component\n */\nexport interface GridLayoutProps {\n /**\n * Grid configuration abstraction (rows/cells)\n * Used to generate the initial layout\n */\n config?: GridConfig | ResponsiveGridConfig;\n\n /**\n * Optional override layouts (native format)\n * When provided, these are used instead of translating config\n * Use this for persisted user modifications\n */\n layouts?: Layout | ResponsiveLayouts;\n\n /**\n * Whether to automatically generate responsive layouts for different breakpoints.\n * When true (default), a single GridConfig is automatically adapted for all screen sizes.\n * When false, the same layout is used for all breakpoints (only scaled by column count).\n * @default true\n */\n responsive?: boolean;\n\n /**\n * Strategy for auto-responsive layout generation.\n * - \"scale\": Proportionally scale widths (items may become narrow)\n * - \"stack\": Stack items vertically on small screens (full width)\n * - \"hybrid\": Scale for medium screens, stack for small screens (default)\n * Only applies when `responsive` is true and a single GridConfig is provided.\n * @default \"hybrid\"\n */\n autoResponsiveStrategy?: AutoResponsiveStrategy;\n\n dragLocked?: boolean\n\n /**\n * Row height in pixels\n * @default 25\n */\n rowHeight?: number;\n\n /**\n * Row height in pixels\n * @default 50\n */\n rowMultiplier?: number;\n\n /**\n * Breakpoint definitions (name → min-width)\n * @default { lg: 1200, md: 900, sm: 768, xs: 480, xxs: 0 }\n */\n breakpoints?: Record<BreakpointName, number>;\n\n /**\n * Column counts per breakpoint\n * @default { lg: 12, md: 12, sm: 12, xs: 4, xxs: 2 }\n */\n cols?: Record<BreakpointName, number>;\n\n /**\n * Maximum number of rows\n * @default Infinity\n */\n maxRows?: number;\n\n /**\n * Called when layout changes (after drag or resize ends)\n * Only fires when layout actually changed\n */\n onLayoutChange?: (layout: Layout, allLayouts: ResponsiveLayouts) => void;\n\n /**\n * User-driven boundaries. RGL fires these only at the end of a real\n * resize / drag interaction — *not* on prop syncs or layout reflows.\n * Use these (instead of `onLayoutChange`) when the consumer needs a\n * \"the user committed a change\" signal that shouldn't fire when a\n * fresh `layouts` prop comes in from above.\n */\n onResizeStop?: (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n ) => void;\n onDragStop?: (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n ) => void;\n\n /**\n * Children components (must have key prop matching cell keys)\n */\n children: React.ReactNode;\n\n zoomLevel?: number;\n\n /**\n * Additional class name for the container\n */\n className?: string;\n\n /**\n * Additional styles for the container\n */\n style?: React.CSSProperties;\n\n onDrop?: (data: any, item?: LayoutItem) => void;\n\n manualWidth?: number\n\n /**\n * Row-aware resize.\n *\n * When configured, dragging a card's resize handle adjusts the height\n * of every \"row sibling\" — items whose top edge (`y`) matches the\n * resized item's `y` — together. The width of the resized item is\n * unaffected, and so are widths/heights of any items NOT in the row.\n *\n * - Pass `true` for the default policy: a modifier (Shift) must be\n * held to opt into row-aware behaviour for a given drag.\n * - Pass an object to invert the default (`defaultOn: true` makes\n * row-aware the no-modifier behaviour and the modifier turns it\n * OFF for that drag) and/or to pick a different modifier key.\n * - Pass `false` (or omit the prop) to disable entirely.\n */\n rowAwareResize?: boolean | RowAwareResizeConfig;\n}\n\nexport interface RowAwareResizeConfig {\n /** Master switch. Defaults to `true` when this object is supplied. */\n enabled?: boolean;\n /**\n * When `true`, row-aware resize is the DEFAULT and holding the\n * modifier inverts it (i.e. the modifier disables row-aware for that\n * drag). When `false` (default), the user must hold the modifier to\n * opt into row-aware for that drag.\n */\n defaultOn?: boolean;\n /** Modifier key that flips the default behaviour. */\n modifierKey?: 'Shift' | 'Alt' | 'Ctrl' | 'Meta';\n}\n\ninterface NormalisedRowAwareResize {\n enabled: boolean;\n defaultOn: boolean;\n modifierKey: 'Shift' | 'Alt' | 'Ctrl' | 'Meta';\n}\n\nfunction normaliseRowAwareResize(\n cfg: boolean | RowAwareResizeConfig | undefined,\n): NormalisedRowAwareResize {\n if (cfg === true) return { enabled: true, defaultOn: false, modifierKey: 'Shift' };\n if (!cfg) return { enabled: false, defaultOn: false, modifierKey: 'Shift' };\n return {\n enabled: cfg.enabled ?? true,\n defaultOn: cfg.defaultOn ?? false,\n modifierKey: cfg.modifierKey ?? 'Shift',\n };\n}\n\n/**\n * Compare two layouts to check if they are equal\n */\nfunction areLayoutsEqual(a: Layout, b: Layout, _rowMultipler: number, _zoomLevel: number): boolean {\n if (a.length !== b.length) return false;\n\n for (let i = 0; i < a.length; i++) {\n const itemA = a[i];\n const itemB = b.find((item: LayoutItem) => item.i === itemA.i);\n if (!itemB) {\n return false\n }\n if (\n itemA.x !== itemB.x ||\n itemA.y !== itemB.y ||\n itemA.w !== itemB.w ||\n itemA.h !== itemB.h\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * GridLayout component\n *\n * A wrapper around react-grid-layout's Responsive component that accepts\n * a simplified row/cell configuration and translates it to the native format.\n *\n * @example\n * ```tsx\n * const config: GridConfig = {\n * rows: [\n * { height: 1, cells: [{ key: \"header\", width: 12 }] },\n * { height: 3, cells: [\n * { key: \"chart1\", width: 6 },\n * { key: \"chart2\", width: 6 }\n * ]}\n * ]\n * };\n *\n * <GridLayout config={config} onLayoutChange={handleChange}>\n * <div key=\"header\">Header</div>\n * <div key=\"chart1\">Chart 1</div>\n * <div key=\"chart2\">Chart 2</div>\n * </GridLayout>\n * ```\n */\nexport const GridLayout: React.FC<GridLayoutProps> = ({\n config,\n layouts,\n responsive = true,\n autoResponsiveStrategy: _autoResponsiveStrategy = \"scale\",\n rowHeight = DEFAULT_ROW_HEIGHT,\n rowMultiplier = DEFAULT_ROW_MULTIPLIER,\n breakpoints = DEFAULT_BREAKPOINTS,\n cols = DEFAULT_COLS,\n zoomLevel = 0.98,\n maxRows = DEFAULT_MAX_ROWS,\n dragLocked = false,\n onLayoutChange,\n \n onResizeStop,\n onDragStop,\n onDrop,\n manualWidth,\n children,\n className,\n rowAwareResize,\n}) => {\n // The two pass-through callbacks come straight from RGL's own\n // resize-stop / drag-stop events. We unwrap RGL's 6-arg signature\n // (oldItem, newItem, placeholder, e, element) into a leaner shape\n // matching `onLayoutChange` so the consumer doesn't have to know\n // RGL's internals.\n const handleResizeStopPassthrough = useCallback(\n (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n ) => {\n onResizeStop?.(layout, oldItem, newItem);\n },\n [onResizeStop],\n );\n const handleDragStopPassthrough = useCallback(\n (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n ) => {\n onDragStop?.(layout, oldItem, newItem);\n },\n [onDragStop],\n );\n const rowAwareCfg = normaliseRowAwareResize(rowAwareResize);\n // Modifier-key state is read globally rather than from the RGL\n // resize event because the constraint API doesn't pass the event\n // through. We listen on `window` so the state is fresh by the time\n // RGL invokes our constraint mid-drag.\n const modifierHeldRef = useRef(false);\n useEffect(() => {\n if (!rowAwareCfg.enabled) return;\n const update = (e: { shiftKey?: boolean; altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean }) => {\n switch (rowAwareCfg.modifierKey) {\n case 'Shift': modifierHeldRef.current = !!e.shiftKey; return;\n case 'Alt': modifierHeldRef.current = !!e.altKey; return;\n case 'Ctrl': modifierHeldRef.current = !!e.ctrlKey; return;\n case 'Meta': modifierHeldRef.current = !!e.metaKey; return;\n }\n };\n const h = update as unknown as EventListener;\n window.addEventListener('keydown', h);\n window.addEventListener('keyup', h);\n window.addEventListener('mousemove', h);\n window.addEventListener('mousedown', h);\n return () => {\n window.removeEventListener('keydown', h);\n window.removeEventListener('keyup', h);\n window.removeEventListener('mousemove', h);\n window.removeEventListener('mousedown', h);\n };\n }, [rowAwareCfg.enabled, rowAwareCfg.modifierKey]);\n\n // Custom constraint that mutates the row siblings' `h` directly on\n // RGL's internal `layoutRef.current` (handed to us as\n // `context.layout`). RGL's `onResize` internal handler immediately\n // afterwards does `layout.map(item => item.i === id ? newItem : item)`\n // — siblings are returned by reference, so our mutations flow into\n // the new layout that gets handed to `compactor.compact` (which\n // clones items, baking the new heights into the next state). This is\n // the only path that survives RGL 2.x's prop-sync drag bail-out:\n // we're working WITH RGL's state pipeline, not feeding it from props.\n const rowAwareConstraint = useMemo<LayoutConstraint>(() => ({\n name: 'rowAwareResize',\n constrainSize(item, w, h, _handle, context) {\n if (!rowAwareCfg.enabled) return { w, h };\n const modifierHeld = modifierHeldRef.current;\n const shouldApply = rowAwareCfg.defaultOn ? !modifierHeld : modifierHeld;\n if (!shouldApply) return { w, h };\n const rowY = item.y ?? 0;\n for (const sibling of context.layout) {\n if (sibling.i === item.i) continue;\n if ((sibling.y ?? 0) !== rowY) continue;\n (sibling as { h: number }).h = h;\n }\n // Dragged item itself unchanged — RGL applies our returned\n // (w, h) as-is to it.\n return { w, h };\n },\n }), [rowAwareCfg.enabled, rowAwareCfg.defaultOn]);\n\n // RGL replaces its built-in defaults wholesale when `constraints` is\n // passed, so we explicitly bundle them in. When row-aware is\n // disabled we hand back `undefined` so RGL keeps its own defaults.\n const mergedConstraints = useMemo<LayoutConstraint[] | undefined>(() => {\n if (!rowAwareCfg.enabled) return undefined;\n return [gridBounds, minMaxSize, rowAwareConstraint];\n }, [rowAwareCfg.enabled, rowAwareConstraint]);\n const { width, containerRef, mounted } = useContainerWidth();\n const newWidth = manualWidth ?? (width);\n\n zoomLevel = zoomLevel ? zoomLevel * 0.95 : 0.98 * 0.95;\n\n // Last layouts we handed to RGL / received back from it, in *zoomed*\n // space. We compare incoming `onLayoutChange` payloads against this in\n // the same coordinate space so structurally-identical layouts dedupe\n // cleanly — without this the upward emission and the parent's\n // re-feeding form a loop.\n const lastRGLLayoutRef = useRef<ResponsiveLayouts | null>(null);\n\n if (config)\n config.rowMultipler = rowMultiplier ?? 1;\n\n // Pass-through. We used to multiply `h` by `unZoomLevel` here to\n // reverse the per-item h-scaling done in the effect — but that\n // scaling was redundant (the CSS `zoom: zoomLevel` on the wrapper\n // div already shrinks the rendered grid visually) AND the\n // round-trip was lossy due to rounding:\n // 6 → round(6*0.76)=5 → round(5*1.316)=7\n // so every store write came back with `h=7` instead of `h=6`,\n // which then re-zoomed to `h=5`, and any emit RGL fired (e.g.\n // collision compaction on a second card) ping-ponged forever\n // because the h field was effectively non-deterministic.\n //\n // Returning the layouts unchanged makes the round-trip identity:\n // whatever RGL hands us is what we send to the parent, and the\n // parent's next render feeds the exact same values back. RGL\n // settles in one cycle.\n const unZoomLayout = useCallback((internal: Layout | ResponsiveLayouts): ResponsiveLayouts => {\n const incoming: ResponsiveLayouts = Array.isArray(internal)\n ? ({ lg: internal, md: internal, sm: internal, xs: internal, xxs: internal } as ResponsiveLayouts)\n : (internal as ResponsiveLayouts);\n\n const result: ResponsiveLayouts = {} as ResponsiveLayouts;\n for (const bp of Object.keys(incoming) as BreakpointName[]) {\n const layout = incoming[bp];\n if (!layout) continue;\n // Spread each item so the parent gets a fresh object it can\n // mutate without aliasing back into our refs.\n result[bp] = layout.map((item) => ({ ...item }));\n }\n return result;\n }, []);\n\n\n // Translate config to layouts (memoized)\n // const translatedLayouts = useMemo(() => {\n // if (!config) return;\n\n // // If it's a simple GridConfig (has rows)\n // if (\"rows\" in config) {\n // const gridConfig = config as GridConfig;\n\n // if (responsive) {\n // // Auto-generate responsive layouts for all breakpoints\n // const translated = translateGridConfigAutoResponsive(\n // gridConfig,\n // cols,\n // autoResponsiveStrategy\n // );\n\n // return translated;\n // } else {\n // // Use same layout for all breakpoints (just scaled by cols)\n // return translateResponsiveGridConfig({ lg: gridConfig }, cols);\n // }\n // }\n\n // // Otherwise it's a ResponsiveGridConfig - use as-is\n // return translateResponsiveGridConfig(config as ResponsiveGridConfig, cols);\n // }, [config, cols, responsive, autoResponsiveStrategy]);\n\n if (responsive) {\n if (Array.isArray(layouts)) {\n layouts = {\n \"lg\": [...layouts] as Layout,\n \"md\": [...layouts] as Layout,\n \"sm\": [...layouts] as Layout,\n \"xs\": [...layouts] as Layout,\n \"xxs\": [...layouts] as Layout,\n } as ResponsiveLayouts;\n }\n }\n\n\n\n // Wrap the incoming layouts into a ResponsiveLayouts during render\n // (NOT inside a useEffect that calls setActiveLayouts). The\n // previous implementation lagged by one render: the effect set\n // `activeLayouts` *after* RGL had already rendered with the stale\n // value, so when the parent added a card RGL's children-prop saw\n // the new card while RGL's `propsLayout` was still the previous\n // render's. RGL's `synchronizeLayoutWithChildren` then created a\n // default placeholder ({w:1, h:1}) for the missing item and\n // emitted it back upward, which the parent wrote into the store,\n // which fed back as the new `propsLayout` — but by then RGL's\n // internal state was already (1,1), so it bounced to the new\n // (4,6) on the next render. Forever.\n //\n // Computing this with `useMemo` makes `activeLayouts` available\n // synchronously in the same render as the new `layouts` prop,\n // eliminating the one-render lag.\n const activeLayouts = useMemo<ResponsiveLayouts | null>(() => {\n if (!layouts) return null;\n if (Array.isArray(layouts)) {\n return {\n lg: layouts,\n md: layouts,\n sm: layouts,\n xs: layouts,\n xxs: layouts,\n } as ResponsiveLayouts;\n }\n return layouts as ResponsiveLayouts;\n }, [layouts]);\n\n // Sync the dedup baseline during render — refs can be safely\n // updated here (they don't trigger renders) and this guarantees\n // that when RGL fires `onLayoutChange` from one of its effects,\n // our handler compares against the SAME layout we just handed it,\n // not a stale value from the previous render.\n if (activeLayouts) {\n lastRGLLayoutRef.current = activeLayouts;\n }\n\n const handleDrop = (_layout: Layout, item?: LayoutItem, e?: Event) => {\n if (!onDrop) return;\n\n const dragEvent = e as unknown as React.DragEvent | undefined;\n const strData = dragEvent?.dataTransfer.getData(\"text/json\");\n let objData = null;\n if (strData) {\n objData = JSON.parse(strData);\n }\n onDrop(objData, item)\n }\n\n // Capture row-aware intent at the moment the resize finishes. RGL\n // fires `onResizeStop` BEFORE its `onLayoutChange`, so we record the\n // row's `y` and the new `h` here and apply the cascade to siblings\n // when `handleLayoutChange` runs immediately after.\n //\n // The modifier-key state is read directly off the native event RGL\n // hands us. If row-aware mode is configured as `defaultOn`, holding\n // the modifier *disables* the cascade for that drag; otherwise the\n // modifier is required to enable it. When the active policy doesn't\n // ask for row-aware on this drag, we leave `pendingRowAwareRef` null\n // and the layout flows through unchanged.\n // Handle layout change - only emit when layout actually changed.\n //\n // Comparison is done in *zoomed* (RGL-output) space, against the last\n // zoomed layouts we sent to or received from RGL. This is critical:\n // the previous implementation compared zoomed-vs-unzoomed, so equal\n // layouts always read as different and fed an upward emission on\n // every render — which, when the parent writes back into the store\n // and re-feeds `layouts`, closes a render loop.\n const handleLayoutChange = useCallback(\n (currentLayout: Layout, allLayouts?: RGLResponsiveLayouts<BreakpointName>) => {\n if (!onLayoutChange) return;\n\n // Row-aware cascade is applied INSIDE RGL via the\n // `rowAwareConstraint` above (pluggable constraints API), so\n // the layout RGL hands us here already has every row sibling\n // at the new height. Nothing extra to do at this boundary.\n const incoming: ResponsiveLayouts = (allLayouts ?? { lg: currentLayout }) as ResponsiveLayouts;\n\n const last = lastRGLLayoutRef.current;\n\n // Same-space comparison. If we have a baseline and every\n // breakpoint matches, this is a no-op — bail before touching\n // any state.\n if (last) {\n let hasChanged = false;\n for (const bp of Object.keys(incoming) as BreakpointName[]) {\n const newLayout = incoming[bp];\n const oldLayout = last[bp];\n if (!newLayout || !oldLayout) continue;\n if (!areLayoutsEqual(newLayout, oldLayout, config?.rowMultipler ?? 1, zoomLevel)) {\n hasChanged = true;\n break;\n }\n }\n if (!hasChanged) return;\n }\n\n // Update baseline in zoomed space *before* unzooming, so any\n // re-render triggered by the parent's response sees a\n // consistent ref.\n lastRGLLayoutRef.current = incoming;\n\n // Unzoom for the parent — restores the original `h` values\n // RGL scaled down for the visual zoom.\n const unzoomed = unZoomLayout(incoming);\n onLayoutChange(unzoomed[\"lg\"]!, unzoomed as ResponsiveLayouts);\n },\n [onLayoutChange, unZoomLayout, config?.rowMultipler, zoomLevel]\n );\n\n if (!activeLayouts) return null;\n\n for (const key of Object.keys(activeLayouts) as BreakpointName[]) {\n const bp = activeLayouts[key];\n\n if(bp) {\n bp.forEach(c => {\n c.isDraggable = !dragLocked;\n c.isResizable = !dragLocked;\n });\n }\n }\n\n\n return (\n <div\n ref={containerRef as React.RefObject<HTMLDivElement>}\n className={className}\n style={{ minHeight: \"100%\", paddingBottom: '200px', minWidth: '100%', paddingLeft: `${(1 - (zoomLevel)) / 2 * 100}%`, zoom: zoomLevel, overflow: 'auto' }}\n >\n {mounted &&\n responsive ?\n <Responsive\n onDrop={handleDrop}\n dropConfig={{\n enabled: !dragLocked,\n defaultItem: {\n h: 2,\n w: 2\n },\n }}\n dragConfig={{\n enabled: !dragLocked\n }}\n layouts={{ ...activeLayouts } as ResponsiveLayouts}\n breakpoints={breakpoints}\n cols={cols}\n rowHeight={rowHeight}\n maxRows={(maxRows ?? 24) * (config?.rowMultipler ?? 1)}\n width={newWidth}\n containerPadding={[0, 0]}\n\n onLayoutChange={handleLayoutChange}\n onResizeStop={handleResizeStopPassthrough}\n onDragStop={handleDragStopPassthrough}\n constraints={mergedConstraints}\n >\n {children}\n </Responsive>\n : <ReactGridLayout\n onDrop={handleDrop}\n dropConfig={{\n enabled: !dragLocked,\n defaultItem: {\n h: 1,\n w: 3\n },\n }}\n gridConfig={{ cols: 12, rowHeight: rowHeight, maxRows: 100, containerPadding: [0, 0], margin: [0, 2] }}\n dragConfig={{\n enabled: !dragLocked,\n bounded: true,\n }}\n\n layout={activeLayouts[\"lg\"] as Layout}\n autoSize={true}\n width={newWidth}\n onLayoutChange={handleLayoutChange}\n onResizeStop={handleResizeStopPassthrough}\n onDragStop={handleDragStopPassthrough}\n constraints={mergedConstraints}\n >\n {children}\n </ReactGridLayout>\n\n }\n </div >\n );\n};\n\nexport default GridLayout;\n","import React, { forwardRef } from 'react';\nimport type { HTMLAttributes, CSSProperties } from 'react';\n\nexport interface GridCardPlaceHolderProps extends HTMLAttributes<HTMLDivElement> {\n static?: boolean;\n naked?: boolean;\n}\n\n/** An empty grid item drawn while a card is being sketched / dropped. */\nexport const GridCardPlaceHolder = forwardRef<HTMLDivElement, GridCardPlaceHolderProps>(\n ({ style, className, onMouseDown, onMouseUp, onTouchEnd, children, ...props }, ref) => {\n const cardStyle: CSSProperties = { cursor: 'grab', ...style };\n const { static: isStatic, naked, ...rest } = props;\n return (\n <div\n ref={ref}\n style={cardStyle}\n className={`${!isStatic ? 'grid-card' : ''} ds-card dscard-placeholder${naked ? '-naked' : ''} react-draggable cssTransforms react-resizable ${className ?? ''}`.trim()}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onTouchEnd={onTouchEnd}\n {...rest}\n >\n <div className=\"grid-card-content\">{children}</div>\n </div>\n );\n },\n);\n\nGridCardPlaceHolder.displayName = 'GridCardPlaceHolder';\n\nexport default GridCardPlaceHolder;\n","import { useMemo } from \"react\";\nimport type { Layout, LayoutItem } from \"react-grid-layout\";\nimport type {\n GridConfig,\n RowConfig,\n ResponsiveGridConfig,\n ResponsiveLayouts,\n BreakpointName,\n} from \"./types\";\nimport { DEFAULT_COLS } from \"./types\";\n\n/**\n * Translates a GridConfig (row/cell tree) into a flat Layout array\n * that react-grid-layout understands.\n *\n * @param config - The grid configuration\n * @param cols - Number of columns (default: 12)\n * @returns Flat layout array for react-grid-layout\n */\nexport function translateGridConfig(\n config: GridConfig,\n cols: number = 12\n): Layout {\n const items: LayoutItem[] = [];\n\n function processRows(\n rows: RowConfig[],\n offsetX: number,\n offsetY: number,\n parentCols: number\n ): number {\n let y = offsetY;\n\n for (const row of rows) {\n const rowHeight = row.height ?? 1;\n let x = offsetX;\n\n for (const cell of row.cells) {\n // Scale width relative to parent columns\n const scaledW = Math.round((cell.width / 12) * parentCols);\n let cellHeight = cell.height ?? rowHeight;\n\n cellHeight = cellHeight == 1 ? 1 : cellHeight;\n\n if (cell.rows && cell.rows.length > 0) {\n // Nested rows - recurse\n processRows(cell.rows, x, y, scaledW);\n } else if (cell.key) {\n // Leaf cell - add to layout\n const item: LayoutItem = {\n i: cell.key,\n x,\n y,\n w: scaledW,\n h: (cellHeight * (config.rowMultipler ?? 1)) + 1,\n };\n\n // Add optional constraints\n if (cell.minW !== undefined) item.minW = cell.minW;\n if (cell.maxW !== undefined) item.maxW = cell.maxW;\n if (cell.minH !== undefined) item.minH = cell.minH;\n if (cell.maxH !== undefined) item.maxH = cell.maxH;\n if (cell.static !== undefined) item.static = cell.static;\n if (cell.isDraggable !== undefined) item.isDraggable = cell.isDraggable;\n if (cell.isResizable !== undefined) item.isResizable = cell.isResizable;\n\n items.push(item);\n }\n\n x += scaledW;\n }\n\n y += rowHeight;\n }\n\n return y;\n }\n\n processRows(config.rows, 0, 0, cols);\n\n return items;\n}\n\n/**\n * Translates a ResponsiveGridConfig into ResponsiveLayouts\n * If a breakpoint is not defined, it falls back to larger breakpoints\n *\n * @param config - The responsive grid configuration\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateResponsiveGridConfig(\n config: ResponsiveGridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Find the first defined config to use as fallback\n let fallbackConfig: GridConfig | undefined;\n\n for (const bp of breakpointOrder) {\n const bpConfig = config[bp];\n\n if (bpConfig) {\n fallbackConfig = bpConfig;\n layouts[bp] = translateGridConfig(bpConfig, colsPerBreakpoint[bp]);\n } else if (fallbackConfig) {\n // Use fallback from larger breakpoint, but translate with this breakpoint's cols\n layouts[bp] = translateGridConfig(\n fallbackConfig,\n colsPerBreakpoint[bp]\n );\n }\n }\n\n return layouts;\n}\n\n/**\n * Auto-responsive translation strategy.\n * Determines how items should be arranged when columns decrease.\n */\nexport type AutoResponsiveStrategy = \"scale\" | \"stack\" | \"hybrid\";\n\n/**\n * Translates a single GridConfig into responsive layouts automatically.\n * \n * This function intelligently adapts the layout for different screen sizes:\n * - For breakpoints with same column count as base: preserves layout\n * - For breakpoints with fewer columns: applies the chosen strategy\n * \n * Strategies:\n * - \"scale\": Proportionally scale widths (items may become very narrow)\n * - \"stack\": Stack items vertically (each item becomes full width)\n * - \"hybrid\": Scale for moderate reductions, stack for small screens (default)\n *\n * @param config - The grid configuration (designed for lg/12 columns)\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @param strategy - How to handle smaller breakpoints (default: \"hybrid\")\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateGridConfigAutoResponsive(\n config: GridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS,\n strategy: AutoResponsiveStrategy = \"stack\"\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Base layout (lg - 12 columns typically)\n const baseCols = colsPerBreakpoint.lg;\n const baseLayout = translateGridConfig(config, baseCols);\n\n for (const bp of breakpointOrder) {\n const targetCols = colsPerBreakpoint[bp];\n\n if (targetCols === baseCols) {\n // Same column count - use base layout directly\n layouts[bp] = baseLayout;\n } else {\n // Different column count - apply strategy\n const shouldStack =\n strategy === \"stack\" ||\n (strategy === \"hybrid\" && targetCols <= 4);\n\n if (shouldStack) {\n // Stack: arrange items vertically, full width\n layouts[bp] = createStackedLayout(baseLayout, targetCols);\n } else {\n // Scale: proportionally adjust widths\n layouts[bp] = createScaledLayout(baseLayout, baseCols, targetCols, config.rowMultipler ?? 1);\n }\n }\n }\n\n return layouts;\n}\n\n/**\n * Creates a stacked layout where each item takes full width\n * and items are arranged vertically.\n */\nfunction createStackedLayout(baseLayout: Layout, cols: number): Layout {\n let currentY = 0;\n\n // Sort by original position (top to bottom, left to right)\n const sorted = [...baseLayout].sort((a, b) => {\n if (a.y !== b.y) return a.y - b.y;\n return a.x - b.x;\n });\n\n return sorted.map((item) => {\n const newItem: LayoutItem = {\n ...item,\n x: 0,\n y: currentY,\n w: cols, // Full width\n // Keep height, but ensure minimum of 2 for readability on small screens\n h: Math.max(item.h, 2)\n };\n currentY += newItem.h;\n return newItem;\n });\n}\n\n/**\n * Creates a scaled layout by proportionally adjusting widths.\n * Items maintain their relative positions but widths are scaled.\n */\nfunction createScaledLayout(baseLayout: Layout, baseCols: number, targetCols: number, rowMultipler: number): Layout {\n const scale = targetCols / baseCols;\n\n return baseLayout.map((item) => {\n // Scale x and width, ensure minimum width of 1\n const scaledW = Math.max(1, Math.round(item.w * scale));\n const scaledX = Math.round(item.x * scale);\n\n // Ensure item doesn't overflow\n const adjustedX = Math.min(scaledX, targetCols - scaledW);\n\n return {\n ...item,\n x: Math.max(0, adjustedX) * rowMultipler,\n w: scaledW,\n\n };\n });\n}\n\n/**\n * Options for the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorOptions {\n /** Grid configuration (single or responsive) */\n config: GridConfig | ResponsiveGridConfig;\n /** Whether the config is responsive (has per-breakpoint configs) */\n responsive?: boolean;\n /** Columns per breakpoint (only used if responsive) */\n cols?: Record<BreakpointName, number>;\n}\n\n/**\n * Result of the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorResult {\n /** Single layout (only if not responsive) */\n layout: Layout | undefined;\n /** Responsive layouts (only if responsive) */\n layouts: ResponsiveLayouts | undefined;\n}\n\n/**\n * Hook to translate GridConfig to react-grid-layout format\n * Memoizes the result to avoid unnecessary recalculations\n *\n * @param options - Translation options\n * @returns Translated layout(s)\n */\nexport function useGridConfigTranslator(\n options: UseGridConfigTranslatorOptions\n): UseGridConfigTranslatorResult {\n const { config, responsive = false, cols = DEFAULT_COLS } = options;\n\n const result = useMemo(() => {\n if (responsive) {\n // Responsive mode - config should be ResponsiveGridConfig\n const responsiveConfig = config as ResponsiveGridConfig;\n\n // If it looks like a simple GridConfig (has rows), wrap it\n if (\"rows\" in responsiveConfig) {\n const simpleConfig = responsiveConfig as unknown as GridConfig;\n return {\n layout: undefined,\n layouts: translateResponsiveGridConfig(\n { lg: simpleConfig },\n cols\n ),\n };\n }\n\n const translatedResponsive = translateResponsiveGridConfig(responsiveConfig, cols);\n\n return {\n layout: undefined,\n layouts: translatedResponsive\n };\n } else {\n // Single layout mode\n const simpleConfig = config as GridConfig;\n const translated = translateGridConfig(simpleConfig, cols.lg ?? 12);\n\n return {\n layout: translated,\n layouts: undefined,\n };\n }\n }, [config, responsive, cols]);\n\n return result;\n}\n\nexport default useGridConfigTranslator;\n"],"names":["_BiErrorBoundary","React","__publicField","error","info","_b","_a","prev","__name","BiErrorBoundary","GridCard","forwardRef","style","htmlStyle","className","onMouseDown","onMouseUp","onTouchEnd","children","variant","viewType","header","renderHeader","dragLocked","noBorder","color","zoomLevel","customColor","contentDisplay","contentStyle","contentClassName","isResizable","props","ref","theme","useTheme","isNaked","variantClass","hasHeader","colorClass","nakedClass","displayClass","HeaderIcon","cardStyle","safeAlpha","innerWidth","headerElement","jsxs","jsx","errorFallback","err","alpha","contentClasses","Fragment","ChartContextProvider","a","DEFAULT_BREAKPOINTS","DEFAULT_COLS","DEFAULT_ROW_HEIGHT","DEFAULT_ROW_MULTIPLIER","DEFAULT_MAX_ROWS","normaliseRowAwareResize","cfg","areLayoutsEqual","b","_rowMultipler","_zoomLevel","i","itemA","itemB","item","GridLayout","config","layouts","responsive","_autoResponsiveStrategy","rowHeight","rowMultiplier","breakpoints","cols","maxRows","onLayoutChange","onResizeStop","onDragStop","onDrop","manualWidth","rowAwareResize","handleResizeStopPassthrough","useCallback","layout","oldItem","newItem","handleDragStopPassthrough","rowAwareCfg","modifierHeldRef","useRef","useEffect","h","e","rowAwareConstraint","useMemo","w","_handle","context","modifierHeld","rowY","sibling","mergedConstraints","gridBounds","minMaxSize","width","containerRef","mounted","useContainerWidth","newWidth","lastRGLLayoutRef","unZoomLayout","internal","incoming","result","bp","activeLayouts","handleDrop","_layout","dragEvent","strData","objData","handleLayoutChange","currentLayout","allLayouts","last","hasChanged","newLayout","oldLayout","unzoomed","key","c","Responsive","ReactGridLayout","GridCardPlaceHolder","isStatic","naked","rest","translateGridConfig","items","processRows","rows","offsetX","offsetY","parentCols","y","row","x","cell","scaledW","cellHeight","translateResponsiveGridConfig","colsPerBreakpoint","breakpointOrder","fallbackConfig","bpConfig","translateGridConfigAutoResponsive","strategy","baseCols","baseLayout","targetCols","createStackedLayout","createScaledLayout","currentY","rowMultipler","scale","scaledX","adjustedX","useGridConfigTranslator","options","responsiveConfig"],"mappings":";;;;;;;;;;AAmBO,MAAMA,IAAN,MAAMA,UAAwBC,GAAM,UAAuC;AAAA,EAA3E;AAAA;AACH,IAAAC,GAAA,eAAe,EAAE,OAAO,KAAA;AAAA;AAAA,EAExB,OAAO,yBAAyBC,GAAqB;AACjD,WAAO,EAAE,OAAAA,EAAA;AAAA,EACb;AAAA,EAEA,kBAAkBA,GAAcC,GAA6B;;AACzD,KAAAC,KAAAC,IAAA,KAAK,OAAM,YAAX,QAAAD,EAAA,KAAAC,GAAqBH,GAAOC;AAAA,EAChC;AAAA,EAEA,mBAAmBG,GAAkC;AACjD,IAAI,KAAK,MAAM,SAASA,EAAK,aAAa,KAAK,MAAM,YACjD,KAAK,SAAS,EAAE,OAAO,KAAA,CAAM;AAAA,EAErC;AAAA,EAEA,SAA0B;AACtB,WAAI,KAAK,MAAM,QAAc,KAAK,MAAM,SAAS,KAAK,MAAM,KAAK,IAC1D,KAAK,MAAM;AAAA,EACtB;AACJ;AArBkFC,EAAAR,GAAA;AAA3E,IAAMS,IAANT;ACsCA,MAAMU,KAAWC;AAAA,EACpB,CACI;AAAA,IACI,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAC,IAAW;AAAA,IACX,QAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,a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