@object-ui/plugin-grid 3.1.5 → 3.3.1
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/CHANGELOG.md +34 -0
- package/README.md +21 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +649 -623
- package/dist/index.umd.cjs +8 -8
- package/package.json +45 -13
- package/.turbo/turbo-build.log +0 -32
- package/src/FormulaBar.tsx +0 -151
- package/src/GroupRow.tsx +0 -69
- package/src/ImportWizard.tsx +0 -412
- package/src/InlineEditing.tsx +0 -235
- package/src/ListColumnExtensions.test.tsx +0 -373
- package/src/ListColumnSchema.test.ts +0 -88
- package/src/ObjectGrid.EdgeCases.stories.tsx +0 -147
- package/src/ObjectGrid.msw.test.tsx +0 -130
- package/src/ObjectGrid.stories.tsx +0 -139
- package/src/ObjectGrid.tsx +0 -1596
- package/src/SplitPaneGrid.tsx +0 -120
- package/src/VirtualGrid.tsx +0 -183
- package/src/__tests__/GroupRow.test.tsx +0 -206
- package/src/__tests__/ImportPreview.test.tsx +0 -171
- package/src/__tests__/InlineEditing.test.tsx +0 -360
- package/src/__tests__/VirtualGrid.test.tsx +0 -438
- package/src/__tests__/accessibility.test.tsx +0 -254
- package/src/__tests__/accessorKey-inference.test.tsx +0 -132
- package/src/__tests__/airtable-style.test.tsx +0 -508
- package/src/__tests__/column-features.test.tsx +0 -490
- package/src/__tests__/grid-export.test.tsx +0 -121
- package/src/__tests__/mobile-card-view.test.tsx +0 -355
- package/src/__tests__/objectdef-enrichment.test.tsx +0 -566
- package/src/__tests__/performance-benchmark.test.tsx +0 -182
- package/src/__tests__/phase11-features.test.tsx +0 -418
- package/src/__tests__/row-bulk-actions.test.tsx +0 -413
- package/src/__tests__/row-height.test.tsx +0 -160
- package/src/__tests__/useGroupedData.test.ts +0 -165
- package/src/__tests__/view-states.test.tsx +0 -203
- package/src/components/BulkActionBar.tsx +0 -66
- package/src/components/RowActionMenu.tsx +0 -91
- package/src/index.test.tsx +0 -29
- package/src/index.tsx +0 -99
- package/src/useCellClipboard.ts +0 -136
- package/src/useColumnSummary.ts +0 -128
- package/src/useGradientColor.ts +0 -103
- package/src/useGroupReorder.ts +0 -123
- package/src/useGroupedData.ts +0 -187
- package/src/useRowColor.ts +0 -74
- package/tsconfig.json +0 -9
- package/vite.config.ts +0 -57
- package/vitest.config.ts +0 -13
- package/vitest.setup.ts +0 -1
- /package/dist/{plugin-grid → packages/plugin-grid}/src/FormulaBar.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/GroupRow.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/ImportWizard.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/InlineEditing.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/ObjectGrid.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/SplitPaneGrid.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/VirtualGrid.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/components/BulkActionBar.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/components/RowActionMenu.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/index.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useCellClipboard.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useColumnSummary.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useGradientColor.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useGroupReorder.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useGroupedData.d.ts +0 -0
- /package/dist/{plugin-grid → packages/plugin-grid}/src/useRowColor.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import t, { createContext as n, useCallback as r, useEffect as i, useMemo as a,
|
|
|
3
3
|
import { ComponentRegistry as c, buildExpandFields as l, evaluatePlainCondition as u } from "@object-ui/core";
|
|
4
4
|
import { SchemaRenderer as d, useAction as f, useDataScope as p, useNavigationOverlay as m, useObjectTranslation as h, useSafeFieldLabel as g, useSchemaContext as _ } from "@object-ui/react";
|
|
5
5
|
import { formatCompactCurrency as v, formatCurrency as y, formatDate as b, formatPercent as x, getCellRenderer as S, humanizeLabel as C } from "@object-ui/fields";
|
|
6
|
-
import { Badge as w, Button as T, Dialog as ee, DialogContent as te, DialogDescription as ne, DialogFooter as re, DialogHeader as E, DialogTitle as ie, DropdownMenu as D, DropdownMenuContent as O, DropdownMenuItem as k, DropdownMenuTrigger as A, NavigationOverlay as j, Popover as
|
|
7
|
-
import { AlertCircle as
|
|
8
|
-
import { flushSync as
|
|
6
|
+
import { Badge as w, Button as T, Dialog as ee, DialogContent as te, DialogDescription as ne, DialogFooter as re, DialogHeader as E, DialogTitle as ie, DropdownMenu as D, DropdownMenuContent as O, DropdownMenuItem as k, DropdownMenuTrigger as A, EmptyValue as ae, NavigationOverlay as j, Popover as oe, PopoverContent as se, PopoverTrigger as ce, Progress as M, Select as le, SelectContent as N, SelectItem as P, SelectTrigger as ue, SelectValue as de, Table as fe, TableBody as pe, TableCell as F, TableHead as I, TableHeader as me, TableRow as L, cn as R } from "@object-ui/components";
|
|
7
|
+
import { AlertCircle as he, AlignJustify as ge, ArrowLeft as _e, ArrowRight as ve, Calendar as ye, Check as z, CheckCircle2 as be, CheckSquare as xe, ChevronDown as Se, ChevronRight as Ce, Clock as we, Download as Te, Edit as Ee, FileSpreadsheet as De, FunctionSquare as Oe, GripVertical as ke, Hash as Ae, MoreVertical as je, Rows2 as Me, Rows3 as Ne, Rows4 as Pe, Tag as Fe, Trash2 as B, Type as Ie, Upload as V, User as Le, X as H } from "lucide-react";
|
|
8
|
+
import { flushSync as U } from "react-dom";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
|
-
var
|
|
10
|
+
var W = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), Re = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
11
11
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
12
12
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
13
13
|
});
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region ../mobile/dist/usePullToRefresh.js
|
|
16
|
-
function
|
|
16
|
+
function ze(e) {
|
|
17
17
|
let { onRefresh: t, threshold: n = 80, enabled: a = !0 } = e, c = o(null), [l, u] = s(!1), [d, f] = s(0), p = o(0), m = r((e) => {
|
|
18
18
|
if (!a || l) return;
|
|
19
19
|
let t = c.current;
|
|
@@ -61,8 +61,8 @@ function Pe(e) {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
|
-
//#region ../../node_modules/.pnpm/react@19.2.
|
|
65
|
-
var
|
|
64
|
+
//#region ../../node_modules/.pnpm/react@19.2.5/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
65
|
+
var G = /* @__PURE__ */ W(((e) => {
|
|
66
66
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
67
67
|
function r(e, n, r) {
|
|
68
68
|
var i = null;
|
|
@@ -77,7 +77,7 @@ var Fe = /* @__PURE__ */ q(((e) => {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
80
|
-
})),
|
|
80
|
+
})), Be = /* @__PURE__ */ W(((e) => {
|
|
81
81
|
process.env.NODE_ENV !== "production" && (function() {
|
|
82
82
|
function t(e) {
|
|
83
83
|
if (e == null) return null;
|
|
@@ -208,7 +208,7 @@ var Fe = /* @__PURE__ */ q(((e) => {
|
|
|
208
208
|
var m = Object.keys(n).filter(function(e) {
|
|
209
209
|
return e !== "key";
|
|
210
210
|
});
|
|
211
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
211
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", j[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), j[p + o] = !0);
|
|
212
212
|
}
|
|
213
213
|
if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
214
214
|
else i = n;
|
|
@@ -220,28 +220,28 @@ var Fe = /* @__PURE__ */ q(((e) => {
|
|
|
220
220
|
function p(e) {
|
|
221
221
|
return typeof e == "object" && !!e && e.$$typeof === h;
|
|
222
222
|
}
|
|
223
|
-
var m =
|
|
223
|
+
var m = Re("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), ee = Symbol.for("react.lazy"), te = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), re = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, E = Object.prototype.hasOwnProperty, ie = Array.isArray, D = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
226
|
m = { react_stack_bottom_frame: function(e) {
|
|
227
227
|
return e();
|
|
228
228
|
} };
|
|
229
|
-
var O, k = {}, A = m.react_stack_bottom_frame.bind(m, o)(),
|
|
229
|
+
var O, k = {}, A = m.react_stack_bottom_frame.bind(m, o)(), ae = D(i(o)), j = {};
|
|
230
230
|
e.Fragment = _, e.jsx = function(e, t, n) {
|
|
231
231
|
var r = 1e4 > re.recentlyCreatedOwnerStacks++;
|
|
232
|
-
return d(e, t, n, !1, r ? Error("react-stack-top-frame") : A, r ? D(i(e)) :
|
|
232
|
+
return d(e, t, n, !1, r ? Error("react-stack-top-frame") : A, r ? D(i(e)) : ae);
|
|
233
233
|
}, e.jsxs = function(e, t, n) {
|
|
234
234
|
var r = 1e4 > re.recentlyCreatedOwnerStacks++;
|
|
235
|
-
return d(e, t, n, !0, r ? Error("react-stack-top-frame") : A, r ? D(i(e)) :
|
|
235
|
+
return d(e, t, n, !0, r ? Error("react-stack-top-frame") : A, r ? D(i(e)) : ae);
|
|
236
236
|
};
|
|
237
237
|
})();
|
|
238
|
-
})),
|
|
239
|
-
process.env.NODE_ENV === "production" ? t.exports =
|
|
240
|
-
})))(),
|
|
241
|
-
|
|
238
|
+
})), K = (/* @__PURE__ */ W(((e, t) => {
|
|
239
|
+
process.env.NODE_ENV === "production" ? t.exports = G() : t.exports = Be();
|
|
240
|
+
})))(), Ve = n(null);
|
|
241
|
+
Ve.displayName = "MobileContext";
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/useRowColor.ts
|
|
244
|
-
var
|
|
244
|
+
var q = {
|
|
245
245
|
red: "bg-red-100",
|
|
246
246
|
green: "bg-green-100",
|
|
247
247
|
blue: "bg-blue-100",
|
|
@@ -266,28 +266,28 @@ var Z = {
|
|
|
266
266
|
stone: "bg-stone-100",
|
|
267
267
|
neutral: "bg-neutral-100"
|
|
268
268
|
};
|
|
269
|
-
function
|
|
270
|
-
return e.startsWith("bg-") ? e :
|
|
269
|
+
function J(e) {
|
|
270
|
+
return e.startsWith("bg-") ? e : q[e.toLowerCase().trim()];
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function He(e) {
|
|
273
273
|
return r((t) => {
|
|
274
274
|
if (!e?.field || !e.colors) return;
|
|
275
275
|
let n = String(t[e.field] ?? ""), r = e.colors[n];
|
|
276
|
-
if (r) return
|
|
276
|
+
if (r) return J(r);
|
|
277
277
|
}, [e?.field, e?.colors]);
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/useGroupedData.ts
|
|
281
|
-
function
|
|
281
|
+
function Ue(e, t) {
|
|
282
282
|
return t.map((t) => String(e[t.field] ?? "")).join(" / ");
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function We(e, t) {
|
|
285
285
|
return t.map((t) => {
|
|
286
286
|
let n = e[t.field];
|
|
287
287
|
return n != null && n !== "" ? String(n) : "(empty)";
|
|
288
288
|
}).join(" / ");
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Ge(e, t) {
|
|
291
291
|
return t.map(({ field: t, type: n }) => {
|
|
292
292
|
let r = e.map((e) => Number(e[t])).filter((e) => Number.isFinite(e)), i;
|
|
293
293
|
switch (n) {
|
|
@@ -315,29 +315,29 @@ function Ve(e, t) {
|
|
|
315
315
|
};
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Ke(e, t, n) {
|
|
319
319
|
let r = e.localeCompare(t, void 0, {
|
|
320
320
|
numeric: !0,
|
|
321
321
|
sensitivity: "base"
|
|
322
322
|
});
|
|
323
323
|
return n === "desc" ? -r : r;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function qe(e, t, n) {
|
|
326
326
|
let i = e?.fields, o = !!(i && i.length > 0), [c, l] = s({}), u = a(() => i ? i.some((e) => e.collapsed) : !1, [i]);
|
|
327
327
|
return {
|
|
328
328
|
groups: a(() => {
|
|
329
329
|
if (!o || !i) return [];
|
|
330
330
|
let e = /* @__PURE__ */ new Map(), r = [];
|
|
331
331
|
for (let n of t) {
|
|
332
|
-
let t =
|
|
332
|
+
let t = Ue(n, i);
|
|
333
333
|
e.has(t) || (e.set(t, {
|
|
334
|
-
label:
|
|
334
|
+
label: We(n, i),
|
|
335
335
|
rows: []
|
|
336
336
|
}), r.push(t)), e.get(t).rows.push(n);
|
|
337
337
|
}
|
|
338
338
|
let a = i[0]?.order ?? "asc";
|
|
339
|
-
return r.sort((e, t) =>
|
|
340
|
-
let r = e.get(t), i = t in c ? c[t] : u, a = n && n.length > 0 ?
|
|
339
|
+
return r.sort((e, t) => Ke(e, t, a)), r.map((t) => {
|
|
340
|
+
let r = e.get(t), i = t in c ? c[t] : u, a = n && n.length > 0 ? Ge(r.rows, n) : [];
|
|
341
341
|
return {
|
|
342
342
|
key: t,
|
|
343
343
|
label: r.label,
|
|
@@ -365,23 +365,23 @@ function Ue(e, t, n) {
|
|
|
365
365
|
}
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region src/GroupRow.tsx
|
|
368
|
-
var
|
|
368
|
+
var Je = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onToggle: a, children: o }) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
369
369
|
className: "border rounded-md",
|
|
370
370
|
"data-testid": `group-row-${e}`,
|
|
371
|
-
children: [/* @__PURE__ */ (0,
|
|
371
|
+
children: [/* @__PURE__ */ (0, K.jsxs)("button", {
|
|
372
372
|
type: "button",
|
|
373
373
|
className: "flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors",
|
|
374
374
|
onClick: () => a(e),
|
|
375
375
|
"aria-expanded": !r,
|
|
376
376
|
children: [
|
|
377
|
-
r ? /* @__PURE__ */ (0,
|
|
378
|
-
/* @__PURE__ */ (0,
|
|
377
|
+
r ? /* @__PURE__ */ (0, K.jsx)(Ce, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ (0, K.jsx)(Se, { className: "h-4 w-4 shrink-0" }),
|
|
378
|
+
/* @__PURE__ */ (0, K.jsx)("span", {
|
|
379
379
|
className: "group-label",
|
|
380
380
|
children: t
|
|
381
381
|
}),
|
|
382
|
-
i && i.length > 0 && /* @__PURE__ */ (0,
|
|
382
|
+
i && i.length > 0 && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
383
383
|
className: "ml-2 text-xs text-muted-foreground group-aggregations",
|
|
384
|
-
children: i.map((e) => /* @__PURE__ */ (0,
|
|
384
|
+
children: i.map((e) => /* @__PURE__ */ (0, K.jsxs)("span", {
|
|
385
385
|
className: "mr-2",
|
|
386
386
|
children: [
|
|
387
387
|
e.type,
|
|
@@ -390,7 +390,7 @@ var We = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onTo
|
|
|
390
390
|
]
|
|
391
391
|
}, `${e.field}-${e.type}`))
|
|
392
392
|
}),
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
393
|
+
/* @__PURE__ */ (0, K.jsxs)("span", {
|
|
394
394
|
className: "ml-auto text-xs text-muted-foreground group-count",
|
|
395
395
|
children: [
|
|
396
396
|
"(",
|
|
@@ -403,10 +403,10 @@ var We = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onTo
|
|
|
403
403
|
});
|
|
404
404
|
//#endregion
|
|
405
405
|
//#region src/useColumnSummary.ts
|
|
406
|
-
function
|
|
406
|
+
function Ye(e) {
|
|
407
407
|
return typeof e == "string" ? { type: e } : e;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function Xe(e, t) {
|
|
410
410
|
if (t.length === 0) return null;
|
|
411
411
|
switch (e) {
|
|
412
412
|
case "count": return t.length;
|
|
@@ -417,7 +417,7 @@ function Ke(e, t) {
|
|
|
417
417
|
default: return null;
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function Ze(e, t) {
|
|
421
421
|
return t === null ? "" : `${{
|
|
422
422
|
count: "Count",
|
|
423
423
|
sum: "Sum",
|
|
@@ -426,7 +426,7 @@ function qe(e, t) {
|
|
|
426
426
|
max: "Max"
|
|
427
427
|
}[e] || e}: ${e === "avg" ? t.toLocaleString(void 0, { maximumFractionDigits: 2 }) : t.toLocaleString()}`;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function Qe(e, t) {
|
|
430
430
|
return a(() => {
|
|
431
431
|
let n = /* @__PURE__ */ new Map();
|
|
432
432
|
if (!e || e.length === 0 || t.length === 0) return {
|
|
@@ -435,7 +435,7 @@ function Je(e, t) {
|
|
|
435
435
|
};
|
|
436
436
|
for (let r of e) {
|
|
437
437
|
if (!r.summary) continue;
|
|
438
|
-
let e =
|
|
438
|
+
let e = Ye(r.summary), i = e.field || r.field, a = [];
|
|
439
439
|
for (let e of t) {
|
|
440
440
|
let t = e[i];
|
|
441
441
|
if (t != null && typeof t == "number" && !isNaN(t)) a.push(t);
|
|
@@ -448,11 +448,11 @@ function Je(e, t) {
|
|
|
448
448
|
if (e.type === "count") {
|
|
449
449
|
let e = t.filter((e) => e[i] != null && e[i] !== "").length;
|
|
450
450
|
o = e > 0 ? e : null;
|
|
451
|
-
} else o =
|
|
451
|
+
} else o = Xe(e.type, a);
|
|
452
452
|
n.set(r.field, {
|
|
453
453
|
field: r.field,
|
|
454
454
|
value: o,
|
|
455
|
-
label:
|
|
455
|
+
label: Ze(e.type, o)
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
458
|
return {
|
|
@@ -463,58 +463,58 @@ function Je(e, t) {
|
|
|
463
463
|
}
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/components/RowActionMenu.tsx
|
|
466
|
-
function
|
|
466
|
+
function $e(e) {
|
|
467
467
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
468
468
|
}
|
|
469
|
-
var
|
|
469
|
+
var et = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete: a, onAction: o }) => /* @__PURE__ */ (0, K.jsxs)(D, { children: [/* @__PURE__ */ (0, K.jsx)(A, {
|
|
470
470
|
asChild: !0,
|
|
471
|
-
children: /* @__PURE__ */ (0,
|
|
471
|
+
children: /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
472
472
|
variant: "ghost",
|
|
473
473
|
size: "icon",
|
|
474
474
|
className: "h-8 w-8 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0",
|
|
475
475
|
"data-testid": "row-action-trigger",
|
|
476
|
-
children: [/* @__PURE__ */ (0,
|
|
476
|
+
children: [/* @__PURE__ */ (0, K.jsx)(je, { className: "h-4 w-4" }), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
477
477
|
className: "sr-only",
|
|
478
478
|
children: "Open menu"
|
|
479
479
|
})]
|
|
480
480
|
})
|
|
481
|
-
}), /* @__PURE__ */ (0,
|
|
481
|
+
}), /* @__PURE__ */ (0, K.jsxs)(O, {
|
|
482
482
|
align: "end",
|
|
483
483
|
children: [
|
|
484
|
-
n && i && /* @__PURE__ */ (0,
|
|
484
|
+
n && i && /* @__PURE__ */ (0, K.jsxs)(k, {
|
|
485
485
|
onClick: () => i(e),
|
|
486
|
-
children: [/* @__PURE__ */ (0,
|
|
486
|
+
children: [/* @__PURE__ */ (0, K.jsx)(Ee, { className: "mr-2 h-4 w-4" }), "Edit"]
|
|
487
487
|
}),
|
|
488
|
-
r && a && /* @__PURE__ */ (0,
|
|
488
|
+
r && a && /* @__PURE__ */ (0, K.jsxs)(k, {
|
|
489
489
|
onClick: () => a(e),
|
|
490
|
-
children: [/* @__PURE__ */ (0,
|
|
490
|
+
children: [/* @__PURE__ */ (0, K.jsx)(B, { className: "mr-2 h-4 w-4" }), "Delete"]
|
|
491
491
|
}),
|
|
492
|
-
t?.map((t) => /* @__PURE__ */ (0,
|
|
492
|
+
t?.map((t) => /* @__PURE__ */ (0, K.jsx)(k, {
|
|
493
493
|
onClick: () => o?.(t, e),
|
|
494
494
|
"data-testid": `row-action-${t}`,
|
|
495
|
-
children:
|
|
495
|
+
children: $e(t)
|
|
496
496
|
}, t))
|
|
497
497
|
]
|
|
498
|
-
})] }),
|
|
498
|
+
})] }), tt = ({ selectedRows: e, actions: t, onAction: n, onClearSelection: r }) => !t || t.length === 0 || e.length === 0 ? null : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
499
499
|
className: "border-t px-4 py-1.5 flex items-center gap-2 text-xs bg-primary/5 shrink-0",
|
|
500
500
|
"data-testid": "bulk-actions-bar",
|
|
501
501
|
children: [
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
502
|
+
/* @__PURE__ */ (0, K.jsxs)("span", {
|
|
503
503
|
className: "text-muted-foreground font-medium",
|
|
504
504
|
children: [e.length, " selected"]
|
|
505
505
|
}),
|
|
506
|
-
/* @__PURE__ */ (0,
|
|
506
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
507
507
|
className: "flex items-center gap-1 ml-2",
|
|
508
|
-
children: t.map((t) => /* @__PURE__ */ (0,
|
|
508
|
+
children: t.map((t) => /* @__PURE__ */ (0, K.jsx)(T, {
|
|
509
509
|
variant: "outline",
|
|
510
510
|
size: "sm",
|
|
511
511
|
className: "h-6 px-2 text-xs",
|
|
512
512
|
onClick: () => n?.(t, e),
|
|
513
513
|
"data-testid": `bulk-action-${t}`,
|
|
514
|
-
children:
|
|
514
|
+
children: $e(t)
|
|
515
515
|
}, t))
|
|
516
516
|
}),
|
|
517
|
-
/* @__PURE__ */ (0,
|
|
517
|
+
/* @__PURE__ */ (0, K.jsx)(T, {
|
|
518
518
|
variant: "ghost",
|
|
519
519
|
size: "sm",
|
|
520
520
|
className: "h-6 px-2 text-xs ml-auto",
|
|
@@ -522,7 +522,7 @@ var Xe = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete
|
|
|
522
522
|
children: "Clear"
|
|
523
523
|
})
|
|
524
524
|
]
|
|
525
|
-
}),
|
|
525
|
+
}), Y = {
|
|
526
526
|
"grid.actions": "Actions",
|
|
527
527
|
"grid.edit": "Edit",
|
|
528
528
|
"grid.delete": "Delete",
|
|
@@ -534,26 +534,26 @@ var Xe = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete
|
|
|
534
534
|
"grid.refreshing": "Refreshing…",
|
|
535
535
|
"grid.openRecord": "Open record"
|
|
536
536
|
};
|
|
537
|
-
function
|
|
537
|
+
function nt() {
|
|
538
538
|
try {
|
|
539
539
|
let e = h();
|
|
540
540
|
return e.t("grid.actions") === "grid.actions" ? { t: (e, t) => {
|
|
541
|
-
let n =
|
|
541
|
+
let n = Y[e] || e;
|
|
542
542
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
543
543
|
return n;
|
|
544
544
|
} } : { t: e.t };
|
|
545
545
|
} catch {
|
|
546
546
|
return { t: (e, t) => {
|
|
547
|
-
let n =
|
|
547
|
+
let n = Y[e] || e;
|
|
548
548
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
549
549
|
return n;
|
|
550
550
|
} };
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
if (e != null) return typeof e == "string" ? e :
|
|
553
|
+
function rt(e) {
|
|
554
|
+
if (e != null) return typeof e == "string" ? e : void 0;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function it(e) {
|
|
557
557
|
return e.data ? Array.isArray(e.data) ? {
|
|
558
558
|
provider: "value",
|
|
559
559
|
items: e.data
|
|
@@ -565,96 +565,101 @@ function tt(e) {
|
|
|
565
565
|
object: e.objectName
|
|
566
566
|
} : null;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function at(e) {
|
|
569
569
|
if (!(!e || e.length === 0)) return typeof e[0] == "object" && e[0], e;
|
|
570
570
|
}
|
|
571
|
-
var
|
|
572
|
-
let [E, ie] = s([]), [D, O] = s(!0), [k, A] = s(null), { t: M } =
|
|
571
|
+
var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onRowClick: h, onCellChange: _, onRowSave: ee, onBatchSave: te, onAddRecord: ne, ...re }) => {
|
|
572
|
+
let [E, ie] = s([]), [D, O] = s(!0), [k, A] = s(null), { t: M } = nt(), { fieldLabel: le, translateOptions: N } = g(), [P, ue] = s(null), [de, fe] = s(!1), [pe, F] = s(0), [I, me] = s(!1), [L, R] = s(e.rowHeight ?? "compact"), [he, _e] = s([]), ve = t.useMemo(() => e.id ? `grid-columns-${e.objectName}-${e.id}` : `grid-columns-${e.objectName}`, [e.objectName, e.id]), [z, be] = s(() => {
|
|
573
573
|
try {
|
|
574
|
-
let e = localStorage.getItem(
|
|
574
|
+
let e = localStorage.getItem(ve);
|
|
575
575
|
return e ? JSON.parse(e) : {};
|
|
576
576
|
} catch {
|
|
577
577
|
return {};
|
|
578
578
|
}
|
|
579
|
-
}),
|
|
580
|
-
|
|
579
|
+
}), Se = r((e) => {
|
|
580
|
+
be(e);
|
|
581
581
|
try {
|
|
582
|
-
localStorage.setItem(
|
|
582
|
+
localStorage.setItem(ve, JSON.stringify(e));
|
|
583
583
|
} catch (e) {
|
|
584
584
|
console.warn("Failed to persist column state:", e);
|
|
585
585
|
}
|
|
586
|
-
}, [
|
|
586
|
+
}, [ve]), { ref: Ce, isRefreshing: Ee, pullDistance: De } = ze({
|
|
587
587
|
onRefresh: r(async () => {
|
|
588
|
-
|
|
588
|
+
F((e) => e + 1);
|
|
589
589
|
}, []),
|
|
590
590
|
enabled: !!n && !!e.objectName
|
|
591
591
|
});
|
|
592
592
|
i(() => {
|
|
593
|
-
let e = () =>
|
|
593
|
+
let e = () => fe(window.innerWidth < 480);
|
|
594
594
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
595
595
|
}, []);
|
|
596
|
-
let
|
|
596
|
+
let Oe = re.data, ke = p(e.bind), je = it(e), B = t.useMemo(() => Oe && Array.isArray(Oe) ? {
|
|
597
597
|
provider: "value",
|
|
598
|
-
items:
|
|
599
|
-
} :
|
|
598
|
+
items: Oe
|
|
599
|
+
} : ke && Array.isArray(ke) ? {
|
|
600
600
|
provider: "value",
|
|
601
|
-
items:
|
|
602
|
-
} :
|
|
603
|
-
JSON.stringify(
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
]),
|
|
601
|
+
items: ke
|
|
602
|
+
} : je, [
|
|
603
|
+
JSON.stringify(je),
|
|
604
|
+
ke,
|
|
605
|
+
Oe
|
|
606
|
+
]), V = B?.provider === "value", H = B?.provider === "object" && B && "object" in B ? B.object : e.objectName, U = e.fields, W = e.columns, Re = e.filter, G = e.sort, Be = e.pagination, Ve = e.pageSize;
|
|
607
607
|
i(() => {
|
|
608
|
-
|
|
609
|
-
let t =
|
|
608
|
+
V && B?.provider === "value" && (ie((e) => {
|
|
609
|
+
let t = B.items;
|
|
610
610
|
return JSON.stringify(e) === JSON.stringify(t) ? e : t;
|
|
611
611
|
}), O(!1));
|
|
612
|
-
}, [
|
|
613
|
-
if (!
|
|
612
|
+
}, [V, B]), i(() => {
|
|
613
|
+
if (!V || !H || !n) return;
|
|
614
614
|
let e = !1;
|
|
615
615
|
return (async () => {
|
|
616
616
|
try {
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
if (typeof n.getObjectSchema != "function") return;
|
|
618
|
+
let t = await n.getObjectSchema(H);
|
|
619
|
+
e || ue(t);
|
|
619
620
|
} catch (e) {
|
|
620
|
-
console.warn(`[ObjectGrid] Failed to fetch objectSchema for inline data (objectName: ${
|
|
621
|
+
console.warn(`[ObjectGrid] Failed to fetch objectSchema for inline data (objectName: ${H}):`, e);
|
|
621
622
|
}
|
|
622
623
|
})(), () => {
|
|
623
624
|
e = !0;
|
|
624
625
|
};
|
|
625
626
|
}, [
|
|
626
|
-
|
|
627
|
-
|
|
627
|
+
V,
|
|
628
|
+
H,
|
|
628
629
|
n
|
|
629
630
|
]), i(() => {
|
|
630
|
-
if (
|
|
631
|
+
if (V) return;
|
|
631
632
|
let t = !1;
|
|
632
633
|
return (async () => {
|
|
633
634
|
O(!0), A(null);
|
|
634
635
|
try {
|
|
635
|
-
let r = null, i =
|
|
636
|
-
if (
|
|
637
|
-
let e = await n.getObjectSchema(
|
|
636
|
+
let r = null, i = at(W) || U;
|
|
637
|
+
if (H && n) if (typeof n.getObjectSchema == "function") {
|
|
638
|
+
let e = await n.getObjectSchema(H);
|
|
638
639
|
if (t) return;
|
|
639
640
|
r = e;
|
|
640
|
-
} else
|
|
641
|
-
name:
|
|
641
|
+
} else r = {
|
|
642
|
+
name: H,
|
|
643
|
+
fields: {}
|
|
644
|
+
};
|
|
645
|
+
else if (i && H) r = {
|
|
646
|
+
name: H,
|
|
642
647
|
fields: {}
|
|
643
648
|
};
|
|
644
|
-
else if (
|
|
649
|
+
else if (H) throw Error("DataSource required");
|
|
645
650
|
else throw Error("Object name required for data fetching");
|
|
646
|
-
if (t ||
|
|
651
|
+
if (t || ue(r), n && H) {
|
|
647
652
|
let i = {
|
|
648
653
|
$select: (() => {
|
|
649
|
-
if (
|
|
650
|
-
if (
|
|
654
|
+
if (U) return U;
|
|
655
|
+
if (W && Array.isArray(W)) return W.map((e) => typeof e == "string" ? e : e.field);
|
|
651
656
|
})(),
|
|
652
|
-
$top:
|
|
657
|
+
$top: Be?.pageSize || Ve || 50
|
|
653
658
|
};
|
|
654
|
-
|
|
655
|
-
let a = l(r?.fields,
|
|
659
|
+
Re && Array.isArray(Re) ? i.$filter = Re : e.defaultFilters && (i.$filter = e.defaultFilters), G ? typeof G == "string" ? i.$orderby = G : Array.isArray(G) && (i.$orderby = G.map((e) => `${e.field} ${e.order}`).join(", ")) : e.defaultSort && (i.$orderby = `${e.defaultSort.field} ${e.defaultSort.order}`);
|
|
660
|
+
let a = l(r?.fields, W ?? U);
|
|
656
661
|
a.length > 0 && (i.$expand = a);
|
|
657
|
-
let o = await n.find(
|
|
662
|
+
let o = await n.find(H, i);
|
|
658
663
|
if (t) return;
|
|
659
664
|
ie(o.data || []);
|
|
660
665
|
}
|
|
@@ -667,24 +672,24 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
667
672
|
t = !0;
|
|
668
673
|
};
|
|
669
674
|
}, [
|
|
675
|
+
H,
|
|
676
|
+
U,
|
|
670
677
|
W,
|
|
678
|
+
Re,
|
|
671
679
|
G,
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
J,
|
|
675
|
-
Fe,
|
|
676
|
-
Ie,
|
|
680
|
+
Be,
|
|
681
|
+
Ve,
|
|
677
682
|
n,
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
683
|
+
V,
|
|
684
|
+
B,
|
|
685
|
+
pe
|
|
681
686
|
]);
|
|
682
|
-
let
|
|
687
|
+
let q = m({
|
|
683
688
|
navigation: e.navigation,
|
|
684
689
|
objectName: e.objectName,
|
|
685
690
|
onNavigate: e.onNavigate,
|
|
686
691
|
onRowClick: h
|
|
687
|
-
}), { execute:
|
|
692
|
+
}), { execute: J } = f(), Ue = He(e.rowColor), We = r((t) => {
|
|
688
693
|
let n = e.conditionalFormatting;
|
|
689
694
|
if (!(!n || n.length === 0)) for (let e of n) {
|
|
690
695
|
let n = !1, r = ("condition" in e ? e.condition : void 0) || ("expression" in e ? e.expression : void 0) || void 0;
|
|
@@ -717,21 +722,21 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
717
722
|
return "style" in e && e.style && Object.assign(t, e.style), "backgroundColor" in e && e.backgroundColor && (t.backgroundColor = e.backgroundColor), "textColor" in e && e.textColor && (t.color = e.textColor), "borderColor" in e && e.borderColor && (t.borderColor = e.borderColor), t;
|
|
718
723
|
}
|
|
719
724
|
}
|
|
720
|
-
}, [e.conditionalFormatting]), { groups:
|
|
721
|
-
let t =
|
|
725
|
+
}, [e.conditionalFormatting]), { groups: Ge, isGrouped: Ke, toggleGroup: Ye } = qe(e.grouping, E), { summaries: Xe, hasSummary: Ze } = Qe(t.useMemo(() => {
|
|
726
|
+
let t = at(e.columns);
|
|
722
727
|
if (t && t.length > 0 && typeof t[0] == "object") return t;
|
|
723
|
-
}, [e.columns]), E),
|
|
728
|
+
}, [e.columns]), E), Y = r(() => {
|
|
724
729
|
let t = (e) => e && {
|
|
725
|
-
text: /* @__PURE__ */ (0,
|
|
726
|
-
number: /* @__PURE__ */ (0,
|
|
727
|
-
currency: /* @__PURE__ */ (0,
|
|
728
|
-
percent: /* @__PURE__ */ (0,
|
|
729
|
-
date: /* @__PURE__ */ (0,
|
|
730
|
-
datetime: /* @__PURE__ */ (0,
|
|
731
|
-
boolean: /* @__PURE__ */ (0,
|
|
732
|
-
user: /* @__PURE__ */ (0,
|
|
733
|
-
select: /* @__PURE__ */ (0,
|
|
734
|
-
}[e] || /* @__PURE__ */ (0,
|
|
730
|
+
text: /* @__PURE__ */ (0, K.jsx)(Ie, { className: "h-3.5 w-3.5" }),
|
|
731
|
+
number: /* @__PURE__ */ (0, K.jsx)(Ae, { className: "h-3.5 w-3.5" }),
|
|
732
|
+
currency: /* @__PURE__ */ (0, K.jsx)(Ae, { className: "h-3.5 w-3.5" }),
|
|
733
|
+
percent: /* @__PURE__ */ (0, K.jsx)(Ae, { className: "h-3.5 w-3.5" }),
|
|
734
|
+
date: /* @__PURE__ */ (0, K.jsx)(ye, { className: "h-3.5 w-3.5" }),
|
|
735
|
+
datetime: /* @__PURE__ */ (0, K.jsx)(we, { className: "h-3.5 w-3.5" }),
|
|
736
|
+
boolean: /* @__PURE__ */ (0, K.jsx)(xe, { className: "h-3.5 w-3.5" }),
|
|
737
|
+
user: /* @__PURE__ */ (0, K.jsx)(Le, { className: "h-3.5 w-3.5" }),
|
|
738
|
+
select: /* @__PURE__ */ (0, K.jsx)(Fe, { className: "h-3.5 w-3.5" })
|
|
739
|
+
}[e] || /* @__PURE__ */ (0, K.jsx)(Ie, { className: "h-3.5 w-3.5" }), n = (e) => {
|
|
735
740
|
if (e.type) return e.type;
|
|
736
741
|
let t = e.field.toLowerCase();
|
|
737
742
|
if ([
|
|
@@ -810,68 +815,65 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
810
815
|
if (typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(t)) return "datetime";
|
|
811
816
|
}
|
|
812
817
|
return null;
|
|
813
|
-
}, r =
|
|
818
|
+
}, r = at(W);
|
|
814
819
|
if (r) {
|
|
815
820
|
if (r.length > 0 && typeof r[0] == "object" && r[0] !== null) {
|
|
816
821
|
let i = r[0];
|
|
817
|
-
if ("accessorKey" in i) return r.map((
|
|
818
|
-
if (
|
|
819
|
-
let
|
|
820
|
-
field:
|
|
821
|
-
label:
|
|
822
|
-
type:
|
|
822
|
+
if ("accessorKey" in i) return r.map((r) => {
|
|
823
|
+
if (r.cell) return r;
|
|
824
|
+
let i = n({
|
|
825
|
+
field: r.accessorKey,
|
|
826
|
+
label: r.header,
|
|
827
|
+
type: r.type
|
|
823
828
|
});
|
|
824
|
-
if (!
|
|
825
|
-
let
|
|
826
|
-
name:
|
|
827
|
-
type:
|
|
829
|
+
if (!i) return r;
|
|
830
|
+
let a = S(i), o = {
|
|
831
|
+
name: r.accessorKey,
|
|
832
|
+
type: i
|
|
828
833
|
};
|
|
829
|
-
return
|
|
834
|
+
return i === "select" && (o.options = Array.from(new Set(E.map((e) => e[r.accessorKey]).filter(Boolean))).map((e) => ({
|
|
830
835
|
value: e,
|
|
831
836
|
label: C(String(e))
|
|
832
837
|
}))), {
|
|
833
|
-
...
|
|
834
|
-
headerIcon: t(
|
|
835
|
-
cell: (e) => /* @__PURE__ */ (0,
|
|
838
|
+
...r,
|
|
839
|
+
...e.showColumnTypeIcons && { headerIcon: t(i) },
|
|
840
|
+
cell: (e) => /* @__PURE__ */ (0, K.jsx)(a, {
|
|
836
841
|
value: e,
|
|
837
|
-
field:
|
|
842
|
+
field: o
|
|
838
843
|
})
|
|
839
844
|
};
|
|
840
845
|
});
|
|
841
846
|
if ("field" in i) return r.filter((e) => e?.field && typeof e.field == "string" && !e.hidden).map((r, i) => {
|
|
842
|
-
let a =
|
|
847
|
+
let a = rt(r.label) || r.field.charAt(0).toUpperCase() + r.field.slice(1).replace(/_/g, " "), o = e.objectName ? le(e.objectName, r.field, a) : a, s, c = P?.fields?.[r.field], l = r.type || c?.type || n({ field: r.field }) || null, u = l ? S(l) : null, d = {
|
|
843
848
|
name: r.field,
|
|
844
849
|
type: l || "text"
|
|
845
850
|
};
|
|
846
|
-
c && (c.label && (d.label = c.label), c.currency && (d.currency = c.currency), c.precision !== void 0 && (d.precision = c.precision), c.format && (d.format = c.format), c.options && (d.options = c.options)), l === "select" && !d.options && (d.options = Array.from(new Set(E.map((e) => e[r.field]).filter(Boolean))).map((e) => ({
|
|
851
|
+
c && (c.label && (d.label = c.label), c.currency && (d.currency = c.currency), c.precision !== void 0 && (d.precision = c.precision), c.format && (d.format = c.format), c.options && (d.options = N(e.objectName, r.field, c.options))), l === "select" && !d.options && (d.options = Array.from(new Set(E.map((e) => e[r.field]).filter(Boolean))).map((e) => ({
|
|
847
852
|
value: e,
|
|
848
853
|
label: C(String(e))
|
|
849
|
-
}))), r.options && (d.options = r.options);
|
|
854
|
+
}))), r.options && (d.options = N(e.objectName, r.field, r.options));
|
|
850
855
|
let f = i === 0 && !r.link && !r.action, p = r.link || f;
|
|
851
|
-
s = r.link && r.action || f && r.action || p ? (e, t) => {
|
|
852
|
-
|
|
856
|
+
s = r.link && r.action || f && r.action || p ? (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
857
|
+
type: "button",
|
|
858
|
+
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
859
|
+
"data-testid": f ? "primary-field-link" : "link-cell",
|
|
860
|
+
onClick: (e) => {
|
|
861
|
+
e.stopPropagation(), q.handleClick(t);
|
|
862
|
+
},
|
|
863
|
+
children: u ? /* @__PURE__ */ (0, K.jsx)(u, {
|
|
853
864
|
value: e,
|
|
854
865
|
field: d
|
|
855
|
-
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
866
|
+
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
856
867
|
className: "text-muted-foreground/50 text-xs italic",
|
|
857
868
|
children: "—"
|
|
858
|
-
})
|
|
859
|
-
|
|
860
|
-
type: "button",
|
|
861
|
-
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
862
|
-
"data-testid": f ? "primary-field-link" : "link-cell",
|
|
863
|
-
onClick: (e) => {
|
|
864
|
-
e.stopPropagation(), X.handleClick(t);
|
|
865
|
-
},
|
|
866
|
-
children: n
|
|
867
|
-
});
|
|
868
|
-
} : r.action ? (e, t) => /* @__PURE__ */ (0, Y.jsx)(T, {
|
|
869
|
+
})
|
|
870
|
+
}) : r.action ? (e, t) => /* @__PURE__ */ (0, K.jsx)(T, {
|
|
869
871
|
variant: "outline",
|
|
870
872
|
size: "sm",
|
|
871
873
|
className: "h-7 text-xs",
|
|
872
874
|
"data-testid": "action-cell",
|
|
873
875
|
onClick: (n) => {
|
|
874
|
-
n.stopPropagation(),
|
|
876
|
+
n.stopPropagation(), J({
|
|
875
877
|
type: r.action,
|
|
876
878
|
params: {
|
|
877
879
|
record: t,
|
|
@@ -880,28 +882,25 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
880
882
|
}
|
|
881
883
|
});
|
|
882
884
|
},
|
|
883
|
-
children:
|
|
884
|
-
}) : u ? (e) => /* @__PURE__ */ (0,
|
|
885
|
+
children: $e(r.action)
|
|
886
|
+
}) : u ? (e) => /* @__PURE__ */ (0, K.jsx)(u, {
|
|
885
887
|
value: e,
|
|
886
888
|
field: d
|
|
887
|
-
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0,
|
|
888
|
-
className: "text-muted-foreground/50 text-xs italic",
|
|
889
|
-
children: "—"
|
|
890
|
-
});
|
|
889
|
+
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0, K.jsx)("span", { children: String(e) }) : /* @__PURE__ */ (0, K.jsx)(ae, {});
|
|
891
890
|
let m = r.prefix;
|
|
892
891
|
if (m?.field) {
|
|
893
892
|
let e = s, t = m.type === "badge" ? S("select") : null;
|
|
894
893
|
s = (n, r) => {
|
|
895
894
|
let i = r[m.field];
|
|
896
|
-
return /* @__PURE__ */ (0,
|
|
895
|
+
return /* @__PURE__ */ (0, K.jsxs)("span", {
|
|
897
896
|
className: "flex items-center gap-1.5",
|
|
898
|
-
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0,
|
|
897
|
+
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0, K.jsx)(t, {
|
|
899
898
|
value: i,
|
|
900
899
|
field: {
|
|
901
900
|
name: m.field,
|
|
902
901
|
type: "select"
|
|
903
902
|
}
|
|
904
|
-
}) : /* @__PURE__ */ (0,
|
|
903
|
+
}) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
905
904
|
className: "text-muted-foreground text-xs mr-1.5",
|
|
906
905
|
children: String(i)
|
|
907
906
|
}) : null, e(n, r)]
|
|
@@ -916,7 +915,7 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
916
915
|
return {
|
|
917
916
|
header: o,
|
|
918
917
|
accessorKey: r.field,
|
|
919
|
-
headerIcon: t(l),
|
|
918
|
+
...e.showColumnTypeIcons && { headerIcon: t(l) },
|
|
920
919
|
...!v && { className: "hidden sm:table-cell" },
|
|
921
920
|
...r.width && { width: r.width },
|
|
922
921
|
..._ && { align: _ },
|
|
@@ -929,11 +928,11 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
929
928
|
});
|
|
930
929
|
}
|
|
931
930
|
return r.filter((e) => typeof e == "string" && e.trim().length > 0).map((r, i) => {
|
|
932
|
-
let a = P?.fields?.[r], o = a?.label || r.charAt(0).toUpperCase() + r.slice(1).replace(/_/g, " "), s = e.objectName ?
|
|
931
|
+
let a = P?.fields?.[r], o = a?.label || r.charAt(0).toUpperCase() + r.slice(1).replace(/_/g, " "), s = e.objectName ? le(e.objectName, r, o) : o, c = a?.type || n({ field: r }) || null, l = c ? S(c) : null, u = {
|
|
933
932
|
name: r,
|
|
934
933
|
type: c || "text"
|
|
935
934
|
};
|
|
936
|
-
a && (a.label && (u.label = a.label), a.currency && (u.currency = a.currency), a.precision !== void 0 && (u.precision = a.precision), a.format && (u.format = a.format), a.options && (u.options = a.options)), c === "select" && !u.options && (u.options = Array.from(new Set(E.map((e) => e[r]).filter(Boolean))).map((e) => ({
|
|
935
|
+
a && (a.label && (u.label = a.label), a.currency && (u.currency = a.currency), a.precision !== void 0 && (u.precision = a.precision), a.format && (u.format = a.format), a.options && (u.options = N(e.objectName, r, a.options))), c === "select" && !u.options && (u.options = Array.from(new Set(E.map((e) => e[r]).filter(Boolean))).map((e) => ({
|
|
937
936
|
value: e,
|
|
938
937
|
label: C(String(e))
|
|
939
938
|
})));
|
|
@@ -942,106 +941,130 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
942
941
|
"currency",
|
|
943
942
|
"percent"
|
|
944
943
|
].includes(c) ? "right" : void 0, f = i === 0, p;
|
|
945
|
-
return f && l ? p = (e, t) => {
|
|
946
|
-
|
|
944
|
+
return f && l ? p = (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
945
|
+
type: "button",
|
|
946
|
+
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
947
|
+
"data-testid": "primary-field-link",
|
|
948
|
+
onClick: (e) => {
|
|
949
|
+
e.stopPropagation(), q.handleClick(t);
|
|
950
|
+
},
|
|
951
|
+
children: /* @__PURE__ */ (0, K.jsx)(l, {
|
|
947
952
|
value: e,
|
|
948
953
|
field: u
|
|
949
|
-
})
|
|
950
|
-
|
|
951
|
-
type: "button",
|
|
952
|
-
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
953
|
-
"data-testid": "primary-field-link",
|
|
954
|
-
onClick: (e) => {
|
|
955
|
-
e.stopPropagation(), X.handleClick(t);
|
|
956
|
-
},
|
|
957
|
-
children: n
|
|
958
|
-
});
|
|
959
|
-
} : f ? p = (e, t) => /* @__PURE__ */ (0, Y.jsx)("button", {
|
|
954
|
+
})
|
|
955
|
+
}) : f ? p = (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
960
956
|
type: "button",
|
|
961
957
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
962
958
|
"data-testid": "primary-field-link",
|
|
963
959
|
onClick: (e) => {
|
|
964
|
-
e.stopPropagation(),
|
|
960
|
+
e.stopPropagation(), q.handleClick(t);
|
|
965
961
|
},
|
|
966
|
-
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
962
|
+
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
967
963
|
className: "text-muted-foreground/50 text-xs italic",
|
|
968
964
|
children: "—"
|
|
969
965
|
})
|
|
970
|
-
}) : l && (p = (e) => /* @__PURE__ */ (0,
|
|
966
|
+
}) : l && (p = (e) => /* @__PURE__ */ (0, K.jsx)(l, {
|
|
971
967
|
value: e,
|
|
972
968
|
field: u
|
|
973
969
|
})), {
|
|
974
970
|
header: s,
|
|
975
971
|
accessorKey: r,
|
|
976
|
-
...c && { headerIcon: t(c) },
|
|
972
|
+
...e.showColumnTypeIcons && c && { headerIcon: t(c) },
|
|
977
973
|
...d && { align: d },
|
|
978
974
|
...p && { cell: p },
|
|
979
975
|
sortable: a?.sortable !== !1
|
|
980
976
|
};
|
|
981
977
|
});
|
|
982
978
|
}
|
|
983
|
-
if (
|
|
984
|
-
let
|
|
985
|
-
if (
|
|
986
|
-
let
|
|
987
|
-
name:
|
|
988
|
-
type:
|
|
979
|
+
if (V) {
|
|
980
|
+
let r = B?.provider === "value" ? B.items : [];
|
|
981
|
+
if (r.length > 0) return (U || Object.keys(r[0])).map((r) => {
|
|
982
|
+
let i = P?.fields?.[r], a = i?.type || n({ field: r }) || null, o = a ? S(a) : null, s = i?.label || r.charAt(0).toUpperCase() + r.slice(1).replace(/_/g, " "), c = {
|
|
983
|
+
name: r,
|
|
984
|
+
type: a || "text"
|
|
989
985
|
};
|
|
990
|
-
|
|
986
|
+
i && (i.label && (c.label = i.label), i.currency && (c.currency = i.currency), i.precision !== void 0 && (c.precision = i.precision), i.format && (c.format = i.format), i.options && (c.options = N(e.objectName, r, i.options))), a === "select" && !c.options && (c.options = Array.from(new Set(E.map((e) => e[r]).filter(Boolean))).map((e) => ({
|
|
991
987
|
value: e,
|
|
992
988
|
label: C(String(e))
|
|
993
989
|
})));
|
|
994
|
-
let
|
|
990
|
+
let l = a && [
|
|
995
991
|
"number",
|
|
996
992
|
"currency",
|
|
997
993
|
"percent"
|
|
998
|
-
].includes(
|
|
994
|
+
].includes(a) ? "right" : void 0;
|
|
999
995
|
return {
|
|
1000
|
-
header:
|
|
1001
|
-
accessorKey:
|
|
1002
|
-
...
|
|
1003
|
-
...
|
|
1004
|
-
...
|
|
996
|
+
header: s,
|
|
997
|
+
accessorKey: r,
|
|
998
|
+
...e.showColumnTypeIcons && a && { headerIcon: t(a) },
|
|
999
|
+
...l && { align: l },
|
|
1000
|
+
...o && { cell: (e) => /* @__PURE__ */ (0, K.jsx)(o, {
|
|
1005
1001
|
value: e,
|
|
1006
|
-
field:
|
|
1002
|
+
field: c
|
|
1007
1003
|
}) },
|
|
1008
|
-
sortable:
|
|
1004
|
+
sortable: i?.sortable !== !1
|
|
1009
1005
|
};
|
|
1010
1006
|
});
|
|
1011
1007
|
}
|
|
1012
1008
|
if (!P) return [];
|
|
1013
|
-
let i = []
|
|
1014
|
-
|
|
1009
|
+
let i = [], a = new Set([
|
|
1010
|
+
"id",
|
|
1011
|
+
"created_at",
|
|
1012
|
+
"createdAt",
|
|
1013
|
+
"updated_at",
|
|
1014
|
+
"updatedAt",
|
|
1015
|
+
"deleted_at",
|
|
1016
|
+
"deletedAt",
|
|
1017
|
+
"created_by",
|
|
1018
|
+
"createdBy",
|
|
1019
|
+
"updated_by",
|
|
1020
|
+
"updatedBy",
|
|
1021
|
+
"_version",
|
|
1022
|
+
"_rev"
|
|
1023
|
+
]), o = P?.compactLayout, s = Object.keys(P.fields || {}), c;
|
|
1024
|
+
if (U) c = U;
|
|
1025
|
+
else if (o?.length) c = o.filter((e) => P.fields?.[e]);
|
|
1026
|
+
else {
|
|
1027
|
+
let e = s.filter((e) => {
|
|
1028
|
+
let t = P.fields?.[e];
|
|
1029
|
+
return !(!t || t.hidden || t.readonly && a.has(e));
|
|
1030
|
+
});
|
|
1031
|
+
c = [...e.filter((e) => !a.has(e)), ...e.filter((e) => a.has(e))];
|
|
1032
|
+
}
|
|
1033
|
+
return c.forEach((t) => {
|
|
1015
1034
|
let n = P.fields?.[t];
|
|
1016
1035
|
if (!n || n.permissions && n.permissions.read === !1) return;
|
|
1017
|
-
let r = S(n.type)
|
|
1036
|
+
let r = S(n.type), a = [
|
|
1037
|
+
"number",
|
|
1038
|
+
"currency",
|
|
1039
|
+
"percent"
|
|
1040
|
+
], o = n.options ? {
|
|
1041
|
+
...n,
|
|
1042
|
+
options: N(e.objectName, t, n.options)
|
|
1043
|
+
} : n;
|
|
1018
1044
|
i.push({
|
|
1019
|
-
header: e.objectName ?
|
|
1045
|
+
header: e.objectName ? le(e.objectName, t, n.label || t) : n.label || t,
|
|
1020
1046
|
accessorKey: t,
|
|
1021
|
-
...
|
|
1022
|
-
|
|
1023
|
-
"currency",
|
|
1024
|
-
"percent"
|
|
1025
|
-
].includes(n.type) && { align: "right" },
|
|
1026
|
-
cell: (e) => /* @__PURE__ */ (0, Y.jsx)(r, {
|
|
1047
|
+
...a.includes(n.type) && { align: "right" },
|
|
1048
|
+
cell: (e) => /* @__PURE__ */ (0, K.jsx)(r, {
|
|
1027
1049
|
value: e,
|
|
1028
|
-
field:
|
|
1050
|
+
field: o
|
|
1029
1051
|
}),
|
|
1030
1052
|
sortable: n.sortable !== !1
|
|
1031
1053
|
});
|
|
1032
1054
|
}), i;
|
|
1033
1055
|
}, [
|
|
1034
1056
|
P,
|
|
1035
|
-
G,
|
|
1036
|
-
K,
|
|
1037
|
-
H,
|
|
1038
1057
|
U,
|
|
1039
|
-
|
|
1040
|
-
|
|
1058
|
+
W,
|
|
1059
|
+
B,
|
|
1060
|
+
V,
|
|
1061
|
+
q.handleClick,
|
|
1062
|
+
J,
|
|
1041
1063
|
E,
|
|
1064
|
+
le,
|
|
1042
1065
|
N,
|
|
1043
1066
|
e.objectName
|
|
1044
|
-
]),
|
|
1067
|
+
]), ot = r((t) => {
|
|
1045
1068
|
let n = e.exportOptions, r = n?.maxRecords || 0, i = n?.includeHeaders !== !1, a = n?.fileNamePrefix || e.objectName || "export", o = r > 0 ? E.slice(0, r) : E, s = (e, t) => {
|
|
1046
1069
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1047
1070
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
@@ -1050,101 +1073,101 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1050
1073
|
return t.includes(",") || t.includes("\"") || t.includes("\n") || t.includes("\r") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1051
1074
|
};
|
|
1052
1075
|
if (t === "csv") {
|
|
1053
|
-
let e =
|
|
1076
|
+
let e = Y().filter((e) => e.accessorKey !== "_actions"), t = e.map((e) => e.accessorKey), n = e.map((e) => e.header), r = [];
|
|
1054
1077
|
i && r.push(n.join(",")), o.forEach((e) => {
|
|
1055
1078
|
r.push(t.map((t) => c(e[t])).join(","));
|
|
1056
1079
|
}), s(new Blob([r.join("\n")], { type: "text/csv;charset=utf-8;" }), `${a}.csv`);
|
|
1057
1080
|
} else t === "json" && s(new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), `${a}.json`);
|
|
1058
|
-
|
|
1081
|
+
me(!1);
|
|
1059
1082
|
}, [
|
|
1060
1083
|
E,
|
|
1061
1084
|
e.exportOptions,
|
|
1062
1085
|
e.objectName,
|
|
1063
|
-
|
|
1086
|
+
Y
|
|
1064
1087
|
]);
|
|
1065
|
-
if (k) return /* @__PURE__ */ (0,
|
|
1088
|
+
if (k) return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1066
1089
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1067
|
-
children: [/* @__PURE__ */ (0,
|
|
1090
|
+
children: [/* @__PURE__ */ (0, K.jsx)("h3", {
|
|
1068
1091
|
className: "text-red-800 font-semibold",
|
|
1069
1092
|
children: M("grid.errorLoading")
|
|
1070
|
-
}), /* @__PURE__ */ (0,
|
|
1093
|
+
}), /* @__PURE__ */ (0, K.jsx)("p", {
|
|
1071
1094
|
className: "text-red-600 text-sm mt-1",
|
|
1072
1095
|
children: k.message
|
|
1073
1096
|
})]
|
|
1074
1097
|
});
|
|
1075
|
-
if (D && E.length === 0) return
|
|
1098
|
+
if (D && E.length === 0) return de ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1076
1099
|
className: "space-y-2 p-2",
|
|
1077
1100
|
children: [
|
|
1078
1101
|
1,
|
|
1079
1102
|
2,
|
|
1080
1103
|
3
|
|
1081
|
-
].map((e) => /* @__PURE__ */ (0,
|
|
1104
|
+
].map((e) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1082
1105
|
className: "border rounded-lg p-3 bg-card animate-pulse",
|
|
1083
1106
|
children: [
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1107
|
+
/* @__PURE__ */ (0, K.jsx)("div", { className: "h-5 bg-muted rounded w-3/4 mb-3" }),
|
|
1108
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1086
1109
|
className: "flex items-center justify-between mb-2",
|
|
1087
|
-
children: [/* @__PURE__ */ (0,
|
|
1110
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", { className: "h-4 bg-muted rounded w-1/4" }), /* @__PURE__ */ (0, K.jsx)("div", { className: "h-5 bg-muted rounded-full w-20" })]
|
|
1088
1111
|
}),
|
|
1089
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, K.jsx)("div", { className: "h-3 bg-muted rounded w-1/3" })
|
|
1090
1113
|
]
|
|
1091
1114
|
}, e))
|
|
1092
|
-
}) : /* @__PURE__ */ (0,
|
|
1115
|
+
}) : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1093
1116
|
className: "p-4 sm:p-8 text-center",
|
|
1094
|
-
children: [/* @__PURE__ */ (0,
|
|
1117
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-foreground" }), /* @__PURE__ */ (0, K.jsx)("p", {
|
|
1095
1118
|
className: "mt-2 text-sm text-muted-foreground",
|
|
1096
1119
|
children: M("grid.loading")
|
|
1097
1120
|
})]
|
|
1098
1121
|
});
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
-
let t =
|
|
1122
|
+
let X = [...Y()];
|
|
1123
|
+
if (z.widths && (X = X.map((e) => {
|
|
1124
|
+
let t = z.widths?.[e.accessorKey];
|
|
1102
1125
|
return t ? {
|
|
1103
1126
|
...e,
|
|
1104
1127
|
size: t
|
|
1105
1128
|
} : e;
|
|
1106
|
-
})),
|
|
1107
|
-
let e = new Map(
|
|
1108
|
-
|
|
1129
|
+
})), z.order && z.order.length > 0) {
|
|
1130
|
+
let e = new Map(z.order.map((e, t) => [e, t]));
|
|
1131
|
+
X.sort((t, n) => (e.get(t.accessorKey) ?? Infinity) - (e.get(n.accessorKey) ?? Infinity));
|
|
1109
1132
|
}
|
|
1110
|
-
let
|
|
1133
|
+
let Z = "operations" in e ? e.operations : void 0, st = Z && (Z.update || Z.delete), ct = e.rowActions && e.rowActions.length > 0, Q = st || ct ? [...X, {
|
|
1111
1134
|
header: M("grid.actions"),
|
|
1112
1135
|
accessorKey: "_actions",
|
|
1113
|
-
cell: (t, n) => /* @__PURE__ */ (0,
|
|
1136
|
+
cell: (t, n) => /* @__PURE__ */ (0, K.jsx)(et, {
|
|
1114
1137
|
row: n,
|
|
1115
1138
|
rowActions: e.rowActions,
|
|
1116
|
-
canEdit: !!(
|
|
1117
|
-
canDelete: !!(
|
|
1139
|
+
canEdit: !!(Z?.update && a),
|
|
1140
|
+
canDelete: !!(Z?.delete && o),
|
|
1118
1141
|
onEdit: a,
|
|
1119
1142
|
onDelete: o,
|
|
1120
|
-
onAction: (e, t) =>
|
|
1143
|
+
onAction: (e, t) => J({
|
|
1121
1144
|
type: e,
|
|
1122
1145
|
params: { record: t }
|
|
1123
1146
|
})
|
|
1124
1147
|
}),
|
|
1125
1148
|
sortable: !1
|
|
1126
|
-
}] :
|
|
1127
|
-
...
|
|
1128
|
-
...
|
|
1129
|
-
...
|
|
1149
|
+
}] : X, lt = Q.filter((e) => e.pinned === "left"), ut = Q.filter((e) => e.pinned === "right"), dt = Q.filter((e) => !e.pinned), ft = lt.length > 0 || ut.length > 0, pt = "sticky right-0 z-10 bg-background border-l border-border", mt = ft ? [
|
|
1150
|
+
...lt,
|
|
1151
|
+
...dt,
|
|
1152
|
+
...ut.map((e) => ({
|
|
1130
1153
|
...e,
|
|
1131
|
-
className: [e.className,
|
|
1132
|
-
cellClassName: [e.cellClassName,
|
|
1154
|
+
className: [e.className, pt].filter(Boolean).join(" "),
|
|
1155
|
+
cellClassName: [e.cellClassName, pt].filter(Boolean).join(" ")
|
|
1133
1156
|
}))
|
|
1134
|
-
] :
|
|
1135
|
-
e.selection?.type ?
|
|
1136
|
-
let
|
|
1157
|
+
] : Q, ht = ft ? lt.length : e.frozenColumns ?? 1, gt = e.batchActions ?? e.bulkActions, _t = gt && gt.length > 0, $ = !1;
|
|
1158
|
+
e.selection?.type ? $ = e.selection.type === "none" ? !1 : e.selection.type : e.selectable === void 0 ? _t && ($ = "multiple") : $ = e.selectable;
|
|
1159
|
+
let vt = e.pagination === void 0 ? e.showPagination === void 0 ? !0 : e.showPagination : !0, yt = e.pagination?.pageSize || e.pageSize || 10, bt = e.searchableFields === void 0 ? e.showSearch === void 0 ? !0 : e.showSearch : e.searchableFields.length > 0, xt = {
|
|
1137
1160
|
type: "data-table",
|
|
1138
1161
|
caption: e.label || e.title,
|
|
1139
|
-
columns:
|
|
1162
|
+
columns: mt,
|
|
1140
1163
|
data: E,
|
|
1141
|
-
pagination:
|
|
1142
|
-
pageSize:
|
|
1143
|
-
searchable:
|
|
1144
|
-
selectable:
|
|
1164
|
+
pagination: vt,
|
|
1165
|
+
pageSize: yt,
|
|
1166
|
+
searchable: bt,
|
|
1167
|
+
selectable: $,
|
|
1145
1168
|
sortable: !0,
|
|
1146
|
-
exportable:
|
|
1147
|
-
rowActions:
|
|
1169
|
+
exportable: Z?.export,
|
|
1170
|
+
rowActions: !!(e.editable && st),
|
|
1148
1171
|
resizableColumns: e.resizable ?? e.resizableColumns ?? !0,
|
|
1149
1172
|
reorderableColumns: e.reorderableColumns ?? !1,
|
|
1150
1173
|
editable: e.editable ?? !1,
|
|
@@ -1152,42 +1175,42 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1152
1175
|
className: e.className,
|
|
1153
1176
|
cellClassName: L === "compact" ? "px-3 py-1 text-[13px] leading-tight" : L === "short" ? "px-3 py-1 text-[13px] leading-normal" : L === "tall" ? "px-3 py-2.5 text-sm" : L === "extra_tall" ? "px-3 py-3.5 text-sm leading-relaxed" : "px-3 py-1.5 text-[13px] leading-normal",
|
|
1154
1177
|
showRowNumbers: !0,
|
|
1155
|
-
showAddRow:
|
|
1178
|
+
showAddRow: !!Z?.create,
|
|
1156
1179
|
onAddRecord: ne,
|
|
1157
|
-
rowClassName: e.rowColor ? (e, t) =>
|
|
1158
|
-
rowStyle: e.conditionalFormatting?.length ? (e, t) =>
|
|
1159
|
-
frozenColumns:
|
|
1180
|
+
rowClassName: e.rowColor ? (e, t) => Ue(e) : void 0,
|
|
1181
|
+
rowStyle: e.conditionalFormatting?.length ? (e, t) => We(e) : void 0,
|
|
1182
|
+
frozenColumns: ht,
|
|
1160
1183
|
onSelectionChange: (e) => {
|
|
1161
|
-
|
|
1184
|
+
_e(e), c?.(e);
|
|
1162
1185
|
},
|
|
1163
|
-
onRowClick:
|
|
1186
|
+
onRowClick: q.handleClick,
|
|
1164
1187
|
onCellChange: _,
|
|
1165
1188
|
onRowSave: ee,
|
|
1166
1189
|
onBatchSave: te,
|
|
1167
1190
|
onColumnResize: (e, t) => {
|
|
1168
|
-
|
|
1169
|
-
...
|
|
1191
|
+
Se({
|
|
1192
|
+
...z,
|
|
1170
1193
|
widths: {
|
|
1171
|
-
...
|
|
1194
|
+
...z.widths,
|
|
1172
1195
|
[e]: t
|
|
1173
1196
|
}
|
|
1174
1197
|
});
|
|
1175
1198
|
},
|
|
1176
1199
|
onColumnReorder: (e) => {
|
|
1177
|
-
|
|
1178
|
-
...
|
|
1200
|
+
Se({
|
|
1201
|
+
...z,
|
|
1179
1202
|
order: e
|
|
1180
1203
|
});
|
|
1181
1204
|
}
|
|
1182
|
-
},
|
|
1183
|
-
...
|
|
1205
|
+
}, St = (e) => ({
|
|
1206
|
+
...xt,
|
|
1184
1207
|
caption: void 0,
|
|
1185
1208
|
data: e,
|
|
1186
1209
|
pagination: !1,
|
|
1187
1210
|
searchable: !1
|
|
1188
|
-
}),
|
|
1189
|
-
if (
|
|
1190
|
-
let e =
|
|
1211
|
+
}), Ct = e.label ? `${e.label} Detail` : e.objectName ? `${e.objectName.charAt(0).toUpperCase() + e.objectName.slice(1)} Detail` : "Record Detail";
|
|
1212
|
+
if (de && E.length > 0 && !Ke) {
|
|
1213
|
+
let e = Y().filter((e) => e.accessorKey !== "_actions"), t = /* @__PURE__ */ new Map();
|
|
1191
1214
|
e.forEach((e) => t.set(e.accessorKey, e));
|
|
1192
1215
|
let n = e[0], r = [
|
|
1193
1216
|
"amount",
|
|
@@ -1231,57 +1254,57 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1231
1254
|
let t = e.toLowerCase();
|
|
1232
1255
|
return r.some((e) => t.includes(e)) ? "amount" : i.some((e) => t.includes(e)) ? "stage" : a.some((e) => t.includes(e)) ? "date" : o.some((e) => t.includes(e)) ? "percent" : "other";
|
|
1233
1256
|
};
|
|
1234
|
-
return /* @__PURE__ */ (0,
|
|
1257
|
+
return /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1235
1258
|
className: "space-y-2 p-2",
|
|
1236
1259
|
children: E.map((t, r) => {
|
|
1237
1260
|
let i = e.slice(1, 5), a = i.find((e) => l(e.accessorKey) === "amount"), o = i.find((e) => l(e.accessorKey) === "stage"), u = i.filter((e) => l(e.accessorKey) === "date"), d = i.filter((e) => l(e.accessorKey) === "percent"), f = i.filter((e) => e !== a && e !== o && !u.includes(e) && !d.includes(e)), p = o ? String(t[o.accessorKey] ?? "") : "", m = p ? c(p) : "";
|
|
1238
|
-
return /* @__PURE__ */ (0,
|
|
1261
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1239
1262
|
className: ["border rounded-lg p-2.5 bg-card hover:bg-accent/50 cursor-pointer transition-colors touch-manipulation", m ? `border-l-[3px] ${m}` : ""].filter(Boolean).join(" "),
|
|
1240
|
-
onClick: () =>
|
|
1263
|
+
onClick: () => q.handleClick(t),
|
|
1241
1264
|
children: [
|
|
1242
|
-
n && /* @__PURE__ */ (0,
|
|
1265
|
+
n && /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1243
1266
|
className: "font-semibold text-sm truncate mb-1",
|
|
1244
|
-
children: t[n.accessorKey] ?? "—"
|
|
1267
|
+
children: t[n.accessorKey] != null && typeof t[n.accessorKey] == "object" ? String(t[n.accessorKey]) : t[n.accessorKey] ?? "—"
|
|
1245
1268
|
}),
|
|
1246
|
-
(a || o) && /* @__PURE__ */ (0,
|
|
1269
|
+
(a || o) && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1247
1270
|
className: "flex items-center justify-between gap-2 mb-1",
|
|
1248
|
-
children: [a && /* @__PURE__ */ (0,
|
|
1271
|
+
children: [a && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1249
1272
|
className: "text-sm tabular-nums font-medium",
|
|
1250
|
-
children: typeof t[a.accessorKey] == "number" ? v(t[a.accessorKey]) : t[a.accessorKey] ?? "—"
|
|
1251
|
-
}), o && t[o.accessorKey] && /* @__PURE__ */ (0,
|
|
1273
|
+
children: typeof t[a.accessorKey] == "number" ? v(t[a.accessorKey]) : t[a.accessorKey] != null && typeof t[a.accessorKey] == "object" ? String(t[a.accessorKey]) : t[a.accessorKey] ?? "—"
|
|
1274
|
+
}), o && t[o.accessorKey] && /* @__PURE__ */ (0, K.jsx)(w, {
|
|
1252
1275
|
variant: "outline",
|
|
1253
1276
|
className: `text-xs shrink-0 max-w-[140px] truncate ${s(String(t[o.accessorKey]))}`,
|
|
1254
|
-
children: t[o.accessorKey]
|
|
1277
|
+
children: String(t[o.accessorKey])
|
|
1255
1278
|
})]
|
|
1256
1279
|
}),
|
|
1257
|
-
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0,
|
|
1280
|
+
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1258
1281
|
className: "flex items-center justify-between py-0.5 text-xs text-muted-foreground",
|
|
1259
|
-
children: [u[0] && /* @__PURE__ */ (0,
|
|
1282
|
+
children: [u[0] && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1260
1283
|
className: "tabular-nums",
|
|
1261
1284
|
children: t[u[0].accessorKey] ? b(t[u[0].accessorKey], "short") : "—"
|
|
1262
|
-
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0,
|
|
1285
|
+
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1263
1286
|
className: "tabular-nums",
|
|
1264
1287
|
children: x(Number(t[d[0].accessorKey]))
|
|
1265
1288
|
})]
|
|
1266
1289
|
}),
|
|
1267
|
-
u.slice(1).map((e) => /* @__PURE__ */ (0,
|
|
1290
|
+
u.slice(1).map((e) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1268
1291
|
className: "flex justify-between items-center py-0.5",
|
|
1269
|
-
children: [/* @__PURE__ */ (0,
|
|
1292
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1270
1293
|
className: "text-xs text-muted-foreground",
|
|
1271
1294
|
children: e.header
|
|
1272
|
-
}), /* @__PURE__ */ (0,
|
|
1295
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1273
1296
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
1274
1297
|
children: t[e.accessorKey] ? b(t[e.accessorKey], "short") : "—"
|
|
1275
1298
|
})]
|
|
1276
1299
|
}, e.accessorKey)),
|
|
1277
1300
|
f.map((e) => {
|
|
1278
1301
|
let n = t[e.accessorKey];
|
|
1279
|
-
return n == null || n === "" ? null : /* @__PURE__ */ (0,
|
|
1302
|
+
return n == null || n === "" ? null : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1280
1303
|
className: "flex justify-between items-center py-0.5",
|
|
1281
|
-
children: [/* @__PURE__ */ (0,
|
|
1304
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1282
1305
|
className: "text-xs text-muted-foreground",
|
|
1283
1306
|
children: e.header
|
|
1284
|
-
}), /* @__PURE__ */ (0,
|
|
1307
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1285
1308
|
className: "text-xs font-medium truncate ml-2 text-right",
|
|
1286
1309
|
children: e.cell ? e.cell(n, t) : String(n)
|
|
1287
1310
|
})]
|
|
@@ -1290,17 +1313,17 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1290
1313
|
]
|
|
1291
1314
|
}, t.id || t._id || r);
|
|
1292
1315
|
})
|
|
1293
|
-
}),
|
|
1294
|
-
...
|
|
1295
|
-
title:
|
|
1296
|
-
children: (e) => /* @__PURE__ */ (0,
|
|
1316
|
+
}), q.isOverlay && /* @__PURE__ */ (0, K.jsx)(j, {
|
|
1317
|
+
...q,
|
|
1318
|
+
title: Ct,
|
|
1319
|
+
children: (e) => /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1297
1320
|
className: "space-y-3",
|
|
1298
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0,
|
|
1321
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1299
1322
|
className: "flex flex-col",
|
|
1300
|
-
children: [/* @__PURE__ */ (0,
|
|
1323
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1301
1324
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1302
1325
|
children: e.replace(/_/g, " ")
|
|
1303
|
-
}), /* @__PURE__ */ (0,
|
|
1326
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1304
1327
|
className: "text-sm",
|
|
1305
1328
|
children: String(t ?? "—")
|
|
1306
1329
|
})]
|
|
@@ -1308,56 +1331,56 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1308
1331
|
})
|
|
1309
1332
|
})] });
|
|
1310
1333
|
}
|
|
1311
|
-
let
|
|
1334
|
+
let wt = () => {
|
|
1312
1335
|
R((e) => e === "compact" ? "short" : e === "short" ? "medium" : e === "medium" ? "tall" : e === "tall" ? "extra_tall" : "compact");
|
|
1313
|
-
},
|
|
1314
|
-
compact:
|
|
1315
|
-
short:
|
|
1316
|
-
medium:
|
|
1317
|
-
tall:
|
|
1318
|
-
extra_tall:
|
|
1319
|
-
}[L],
|
|
1336
|
+
}, Tt = {
|
|
1337
|
+
compact: Pe,
|
|
1338
|
+
short: Ne,
|
|
1339
|
+
medium: Me,
|
|
1340
|
+
tall: ge,
|
|
1341
|
+
extra_tall: ge
|
|
1342
|
+
}[L], Et = e.rowHeight !== void 0, Dt = e.exportOptions || Et ? /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1320
1343
|
className: "flex items-center justify-end gap-1 px-2 py-1",
|
|
1321
|
-
children: [
|
|
1344
|
+
children: [Et && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1322
1345
|
variant: "ghost",
|
|
1323
1346
|
size: "sm",
|
|
1324
1347
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1325
|
-
onClick:
|
|
1348
|
+
onClick: wt,
|
|
1326
1349
|
title: `Row height: ${L}`,
|
|
1327
|
-
children: [/* @__PURE__ */ (0,
|
|
1350
|
+
children: [/* @__PURE__ */ (0, K.jsx)(Tt, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1328
1351
|
className: "hidden sm:inline capitalize",
|
|
1329
1352
|
children: L
|
|
1330
1353
|
})]
|
|
1331
|
-
}), e.exportOptions && /* @__PURE__ */ (0,
|
|
1332
|
-
open:
|
|
1333
|
-
onOpenChange:
|
|
1334
|
-
children: [/* @__PURE__ */ (0,
|
|
1354
|
+
}), e.exportOptions && /* @__PURE__ */ (0, K.jsxs)(oe, {
|
|
1355
|
+
open: I,
|
|
1356
|
+
onOpenChange: me,
|
|
1357
|
+
children: [/* @__PURE__ */ (0, K.jsx)(ce, {
|
|
1335
1358
|
asChild: !0,
|
|
1336
|
-
children: /* @__PURE__ */ (0,
|
|
1359
|
+
children: /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1337
1360
|
variant: "ghost",
|
|
1338
1361
|
size: "sm",
|
|
1339
1362
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1340
|
-
children: [/* @__PURE__ */ (0,
|
|
1363
|
+
children: [/* @__PURE__ */ (0, K.jsx)(Te, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1341
1364
|
className: "hidden sm:inline",
|
|
1342
1365
|
children: M("grid.export")
|
|
1343
1366
|
})]
|
|
1344
1367
|
})
|
|
1345
|
-
}), /* @__PURE__ */ (0,
|
|
1368
|
+
}), /* @__PURE__ */ (0, K.jsx)(se, {
|
|
1346
1369
|
align: "end",
|
|
1347
1370
|
className: "w-48 p-2",
|
|
1348
|
-
children: /* @__PURE__ */ (0,
|
|
1371
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1349
1372
|
className: "space-y-1",
|
|
1350
|
-
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0,
|
|
1373
|
+
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1351
1374
|
variant: "ghost",
|
|
1352
1375
|
size: "sm",
|
|
1353
1376
|
className: "w-full justify-start h-8 text-xs",
|
|
1354
|
-
onClick: () =>
|
|
1355
|
-
children: [/* @__PURE__ */ (0,
|
|
1377
|
+
onClick: () => ot(e),
|
|
1378
|
+
children: [/* @__PURE__ */ (0, K.jsx)(Te, { className: "h-3.5 w-3.5 mr-2" }), M("grid.exportAs", { format: e.toUpperCase() })]
|
|
1356
1379
|
}, e))
|
|
1357
1380
|
})
|
|
1358
1381
|
})]
|
|
1359
1382
|
})]
|
|
1360
|
-
}) : null,
|
|
1383
|
+
}) : null, Ot = (e) => {
|
|
1361
1384
|
let t = [
|
|
1362
1385
|
"_id",
|
|
1363
1386
|
"id",
|
|
@@ -1366,22 +1389,22 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1366
1389
|
"created_by",
|
|
1367
1390
|
"updated_by"
|
|
1368
1391
|
], n = Object.entries(e), r = n.filter(([e]) => !t.includes(e)), i = n.filter(([e]) => t.includes(e) && e !== "_id" && e !== "id"), a = (e) => e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "), o = (e, t) => {
|
|
1369
|
-
if (t == null || t === "") return /* @__PURE__ */ (0,
|
|
1392
|
+
if (t == null || t === "") return /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1370
1393
|
className: "text-muted-foreground/50 text-sm italic",
|
|
1371
1394
|
children: "Empty"
|
|
1372
1395
|
});
|
|
1373
1396
|
let n = P?.fields?.[e];
|
|
1374
1397
|
if (n?.type) {
|
|
1375
1398
|
let e = S(n.type);
|
|
1376
|
-
if (e) return /* @__PURE__ */ (0,
|
|
1399
|
+
if (e) return /* @__PURE__ */ (0, K.jsx)(e, {
|
|
1377
1400
|
value: t,
|
|
1378
1401
|
field: n
|
|
1379
1402
|
});
|
|
1380
1403
|
}
|
|
1381
|
-
return typeof t == "boolean" ? /* @__PURE__ */ (0,
|
|
1404
|
+
return typeof t == "boolean" ? /* @__PURE__ */ (0, K.jsx)(w, {
|
|
1382
1405
|
variant: t ? "default" : "outline",
|
|
1383
1406
|
children: t ? "Yes" : "No"
|
|
1384
|
-
}) : typeof t == "string" && !isNaN(Date.parse(t)) && (e.includes("date") || e.includes("_at") || e.includes("time")) ? /* @__PURE__ */ (0,
|
|
1407
|
+
}) : typeof t == "string" && !isNaN(Date.parse(t)) && (e.includes("date") || e.includes("_at") || e.includes("time")) ? /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1385
1408
|
className: "text-sm tabular-nums",
|
|
1386
1409
|
children: b(t)
|
|
1387
1410
|
}) : typeof t == "number" && [
|
|
@@ -1393,48 +1416,48 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1393
1416
|
"value",
|
|
1394
1417
|
"budget",
|
|
1395
1418
|
"salary"
|
|
1396
|
-
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0,
|
|
1419
|
+
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1397
1420
|
className: "text-sm tabular-nums font-medium",
|
|
1398
1421
|
children: y(t)
|
|
1399
|
-
}) : /* @__PURE__ */ (0,
|
|
1422
|
+
}) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1400
1423
|
className: "text-sm break-words",
|
|
1401
1424
|
children: String(t)
|
|
1402
1425
|
});
|
|
1403
1426
|
};
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1427
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1405
1428
|
className: "space-y-4",
|
|
1406
1429
|
"data-testid": "record-detail-panel",
|
|
1407
|
-
children: [/* @__PURE__ */ (0,
|
|
1430
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1408
1431
|
className: "rounded-lg border bg-card",
|
|
1409
|
-
children: /* @__PURE__ */ (0,
|
|
1432
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1410
1433
|
className: "divide-y",
|
|
1411
|
-
children: r.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1434
|
+
children: r.map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1412
1435
|
className: "flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-4 px-4 py-3",
|
|
1413
|
-
children: [/* @__PURE__ */ (0,
|
|
1436
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1414
1437
|
className: "text-xs font-medium text-muted-foreground sm:w-1/3 sm:text-right sm:pt-0.5 uppercase tracking-wide shrink-0",
|
|
1415
1438
|
children: a(e)
|
|
1416
|
-
}), /* @__PURE__ */ (0,
|
|
1439
|
+
}), /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1417
1440
|
className: "flex-1 min-w-0",
|
|
1418
1441
|
children: o(e, t)
|
|
1419
1442
|
})]
|
|
1420
1443
|
}, e))
|
|
1421
1444
|
})
|
|
1422
|
-
}), i.length > 0 && /* @__PURE__ */ (0,
|
|
1445
|
+
}), i.length > 0 && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1423
1446
|
className: "rounded-lg border bg-muted/30",
|
|
1424
|
-
children: [/* @__PURE__ */ (0,
|
|
1447
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1425
1448
|
className: "px-4 py-2 border-b",
|
|
1426
|
-
children: /* @__PURE__ */ (0,
|
|
1449
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1427
1450
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1428
1451
|
children: "System"
|
|
1429
1452
|
})
|
|
1430
|
-
}), /* @__PURE__ */ (0,
|
|
1453
|
+
}), /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1431
1454
|
className: "divide-y divide-border/50",
|
|
1432
|
-
children: i.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1455
|
+
children: i.map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1433
1456
|
className: "flex items-center gap-4 px-4 py-2",
|
|
1434
|
-
children: [/* @__PURE__ */ (0,
|
|
1457
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1435
1458
|
className: "text-xs text-muted-foreground w-1/3 text-right shrink-0",
|
|
1436
1459
|
children: a(e)
|
|
1437
|
-
}), /* @__PURE__ */ (0,
|
|
1460
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1438
1461
|
className: "text-xs text-muted-foreground flex-1 min-w-0 break-words",
|
|
1439
1462
|
children: String(t ?? "")
|
|
1440
1463
|
})]
|
|
@@ -1442,14 +1465,14 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1442
1465
|
})]
|
|
1443
1466
|
})]
|
|
1444
1467
|
});
|
|
1445
|
-
},
|
|
1468
|
+
}, kt = Ze ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1446
1469
|
className: "border-t bg-muted/30 px-2 py-1.5",
|
|
1447
1470
|
"data-testid": "column-summary-footer",
|
|
1448
|
-
children: /* @__PURE__ */ (0,
|
|
1471
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1449
1472
|
className: "flex gap-4 text-xs text-muted-foreground font-medium",
|
|
1450
|
-
children:
|
|
1451
|
-
let t =
|
|
1452
|
-
return /* @__PURE__ */ (0,
|
|
1473
|
+
children: mt.filter((e) => Xe.has(e.accessorKey)).map((e) => {
|
|
1474
|
+
let t = Xe.get(e.accessorKey);
|
|
1475
|
+
return /* @__PURE__ */ (0, K.jsxs)("span", {
|
|
1453
1476
|
"data-testid": `summary-${e.accessorKey}`,
|
|
1454
1477
|
children: [
|
|
1455
1478
|
e.header,
|
|
@@ -1459,66 +1482,66 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1459
1482
|
}, e.accessorKey);
|
|
1460
1483
|
})
|
|
1461
1484
|
})
|
|
1462
|
-
}) : null,
|
|
1485
|
+
}) : null, At = Ke ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1463
1486
|
className: "space-y-2",
|
|
1464
|
-
children:
|
|
1487
|
+
children: Ge.map((e) => /* @__PURE__ */ (0, K.jsx)(Je, {
|
|
1465
1488
|
groupKey: e.key,
|
|
1466
1489
|
label: e.label,
|
|
1467
1490
|
count: e.rows.length,
|
|
1468
1491
|
collapsed: e.collapsed,
|
|
1469
1492
|
aggregations: e.aggregations,
|
|
1470
|
-
onToggle:
|
|
1471
|
-
children: /* @__PURE__ */ (0,
|
|
1493
|
+
onToggle: Ye,
|
|
1494
|
+
children: /* @__PURE__ */ (0, K.jsx)(d, { schema: St(e.rows) })
|
|
1472
1495
|
}, e.key))
|
|
1473
|
-
}) : /* @__PURE__ */ (0,
|
|
1474
|
-
return
|
|
1475
|
-
...
|
|
1476
|
-
title:
|
|
1477
|
-
mainContent: /* @__PURE__ */ (0,
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1481
|
-
selectedRows:
|
|
1482
|
-
actions:
|
|
1483
|
-
onAction: (e, t) =>
|
|
1496
|
+
}) : /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [/* @__PURE__ */ (0, K.jsx)(d, { schema: xt }), kt] });
|
|
1497
|
+
return q.isOverlay && q.mode === "split" ? /* @__PURE__ */ (0, K.jsx)(j, {
|
|
1498
|
+
...q,
|
|
1499
|
+
title: Ct,
|
|
1500
|
+
mainContent: /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [
|
|
1501
|
+
Dt,
|
|
1502
|
+
At,
|
|
1503
|
+
/* @__PURE__ */ (0, K.jsx)(tt, {
|
|
1504
|
+
selectedRows: he,
|
|
1505
|
+
actions: gt ?? [],
|
|
1506
|
+
onAction: (e, t) => J({
|
|
1484
1507
|
type: e,
|
|
1485
1508
|
params: { records: t }
|
|
1486
1509
|
}),
|
|
1487
|
-
onClearSelection: () =>
|
|
1510
|
+
onClearSelection: () => _e([])
|
|
1488
1511
|
})
|
|
1489
1512
|
] }),
|
|
1490
|
-
children: (e) =>
|
|
1491
|
-
}) : /* @__PURE__ */ (0,
|
|
1492
|
-
ref:
|
|
1513
|
+
children: (e) => Ot(e)
|
|
1514
|
+
}) : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1515
|
+
ref: Ce,
|
|
1493
1516
|
className: "relative h-full",
|
|
1494
1517
|
children: [
|
|
1495
|
-
|
|
1518
|
+
De > 0 && /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1496
1519
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1497
|
-
style: { height:
|
|
1498
|
-
children: M(
|
|
1520
|
+
style: { height: De },
|
|
1521
|
+
children: M(Ee ? "grid.refreshing" : "grid.pullToRefresh")
|
|
1499
1522
|
}),
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1503
|
-
selectedRows:
|
|
1504
|
-
actions:
|
|
1505
|
-
onAction: (e, t) =>
|
|
1523
|
+
Dt,
|
|
1524
|
+
At,
|
|
1525
|
+
/* @__PURE__ */ (0, K.jsx)(tt, {
|
|
1526
|
+
selectedRows: he,
|
|
1527
|
+
actions: gt ?? [],
|
|
1528
|
+
onAction: (e, t) => J({
|
|
1506
1529
|
type: e,
|
|
1507
1530
|
params: { records: t }
|
|
1508
1531
|
}),
|
|
1509
|
-
onClearSelection: () =>
|
|
1532
|
+
onClearSelection: () => _e([])
|
|
1510
1533
|
}),
|
|
1511
|
-
|
|
1512
|
-
...
|
|
1513
|
-
title:
|
|
1514
|
-
children: (e) =>
|
|
1534
|
+
q.isOverlay && /* @__PURE__ */ (0, K.jsx)(j, {
|
|
1535
|
+
...q,
|
|
1536
|
+
title: Ct,
|
|
1537
|
+
children: (e) => Ot(e)
|
|
1515
1538
|
})
|
|
1516
1539
|
]
|
|
1517
1540
|
});
|
|
1518
1541
|
};
|
|
1519
1542
|
//#endregion
|
|
1520
|
-
//#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.
|
|
1521
|
-
function
|
|
1543
|
+
//#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
1544
|
+
function X(e, t, n) {
|
|
1522
1545
|
let r = n.initialDeps ?? [], i, a = !0;
|
|
1523
1546
|
function o() {
|
|
1524
1547
|
let o;
|
|
@@ -1543,26 +1566,26 @@ function $(e, t, n) {
|
|
|
1543
1566
|
r = e;
|
|
1544
1567
|
}, o;
|
|
1545
1568
|
}
|
|
1546
|
-
function
|
|
1569
|
+
function Z(e, t) {
|
|
1547
1570
|
if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
|
|
1548
1571
|
return e;
|
|
1549
1572
|
}
|
|
1550
|
-
var
|
|
1573
|
+
var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
1551
1574
|
let r;
|
|
1552
1575
|
return function(...i) {
|
|
1553
1576
|
e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
|
|
1554
1577
|
};
|
|
1555
|
-
},
|
|
1578
|
+
}, Q = (e) => {
|
|
1556
1579
|
let { offsetWidth: t, offsetHeight: n } = e;
|
|
1557
1580
|
return {
|
|
1558
1581
|
width: t,
|
|
1559
1582
|
height: n
|
|
1560
1583
|
};
|
|
1561
|
-
},
|
|
1584
|
+
}, lt = (e) => e, ut = (e) => {
|
|
1562
1585
|
let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
|
|
1563
1586
|
for (let e = t; e <= n; e++) r.push(e);
|
|
1564
1587
|
return r;
|
|
1565
|
-
},
|
|
1588
|
+
}, dt = (e, t) => {
|
|
1566
1589
|
let n = e.scrollElement;
|
|
1567
1590
|
if (!n) return;
|
|
1568
1591
|
let r = e.targetWindow;
|
|
@@ -1574,7 +1597,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1574
1597
|
height: Math.round(r)
|
|
1575
1598
|
});
|
|
1576
1599
|
};
|
|
1577
|
-
if (i(
|
|
1600
|
+
if (i(Q(n)), !r.ResizeObserver) return () => {};
|
|
1578
1601
|
let a = new r.ResizeObserver((t) => {
|
|
1579
1602
|
let r = () => {
|
|
1580
1603
|
let e = t[0];
|
|
@@ -1588,43 +1611,43 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1588
1611
|
return;
|
|
1589
1612
|
}
|
|
1590
1613
|
}
|
|
1591
|
-
i(
|
|
1614
|
+
i(Q(n));
|
|
1592
1615
|
};
|
|
1593
1616
|
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
1594
1617
|
});
|
|
1595
1618
|
return a.observe(n, { box: "border-box" }), () => {
|
|
1596
1619
|
a.unobserve(n);
|
|
1597
1620
|
};
|
|
1598
|
-
},
|
|
1621
|
+
}, ft = { passive: !0 }, pt = typeof window > "u" ? !0 : "onscrollend" in window, mt = (e, t) => {
|
|
1599
1622
|
let n = e.scrollElement;
|
|
1600
1623
|
if (!n) return;
|
|
1601
1624
|
let r = e.targetWindow;
|
|
1602
1625
|
if (!r) return;
|
|
1603
|
-
let i = 0, a = e.options.useScrollendEvent &&
|
|
1626
|
+
let i = 0, a = e.options.useScrollendEvent && pt ? () => void 0 : ct(r, () => {
|
|
1604
1627
|
t(i, !1);
|
|
1605
1628
|
}, e.options.isScrollingResetDelay), o = (r) => () => {
|
|
1606
1629
|
let { horizontal: o, isRtl: s } = e.options;
|
|
1607
1630
|
i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
|
|
1608
1631
|
}, s = o(!0), c = o(!1);
|
|
1609
|
-
n.addEventListener("scroll", s,
|
|
1610
|
-
let l = e.options.useScrollendEvent &&
|
|
1611
|
-
return l && n.addEventListener("scrollend", c,
|
|
1632
|
+
n.addEventListener("scroll", s, ft);
|
|
1633
|
+
let l = e.options.useScrollendEvent && pt;
|
|
1634
|
+
return l && n.addEventListener("scrollend", c, ft), () => {
|
|
1612
1635
|
n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
|
|
1613
1636
|
};
|
|
1614
|
-
},
|
|
1637
|
+
}, ht = (e, t, n) => {
|
|
1615
1638
|
if (t?.borderBoxSize) {
|
|
1616
1639
|
let e = t.borderBoxSize[0];
|
|
1617
1640
|
if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
|
|
1618
1641
|
}
|
|
1619
1642
|
return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
1620
|
-
},
|
|
1643
|
+
}, gt = (e, { adjustments: t = 0, behavior: n }, r) => {
|
|
1621
1644
|
var i, a;
|
|
1622
1645
|
let o = e + t;
|
|
1623
1646
|
(a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
|
|
1624
1647
|
[r.options.horizontal ? "left" : "top"]: o,
|
|
1625
1648
|
behavior: n
|
|
1626
1649
|
});
|
|
1627
|
-
},
|
|
1650
|
+
}, _t = class {
|
|
1628
1651
|
constructor(e) {
|
|
1629
1652
|
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
|
|
1630
1653
|
var e;
|
|
@@ -1663,10 +1686,10 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1663
1686
|
scrollPaddingStart: 0,
|
|
1664
1687
|
scrollPaddingEnd: 0,
|
|
1665
1688
|
horizontal: !1,
|
|
1666
|
-
getItemKey:
|
|
1667
|
-
rangeExtractor:
|
|
1689
|
+
getItemKey: lt,
|
|
1690
|
+
rangeExtractor: ut,
|
|
1668
1691
|
onChange: () => {},
|
|
1669
|
-
measureElement:
|
|
1692
|
+
measureElement: ht,
|
|
1670
1693
|
initialRect: {
|
|
1671
1694
|
width: 0,
|
|
1672
1695
|
height: 0
|
|
@@ -1681,12 +1704,13 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1681
1704
|
isRtl: !1,
|
|
1682
1705
|
useScrollendEvent: !1,
|
|
1683
1706
|
useAnimationFrameWithResizeObserver: !1,
|
|
1707
|
+
laneAssignmentMode: "estimate",
|
|
1684
1708
|
...e
|
|
1685
1709
|
};
|
|
1686
1710
|
}, this.notify = (e) => {
|
|
1687
1711
|
var t, n;
|
|
1688
1712
|
(n = (t = this.options).onChange) == null || n.call(t, this, e);
|
|
1689
|
-
}, this.maybeNotify =
|
|
1713
|
+
}, this.maybeNotify = X(() => (this.calculateRange(), [
|
|
1690
1714
|
this.isScrolling,
|
|
1691
1715
|
this.range ? this.range.startIndex : null,
|
|
1692
1716
|
this.range ? this.range.endIndex : null
|
|
@@ -1731,63 +1755,65 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1731
1755
|
if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
|
|
1732
1756
|
}
|
|
1733
1757
|
return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
|
|
1734
|
-
}, this.getMeasurementOptions =
|
|
1758
|
+
}, this.getMeasurementOptions = X(() => [
|
|
1735
1759
|
this.options.count,
|
|
1736
1760
|
this.options.paddingStart,
|
|
1737
1761
|
this.options.scrollMargin,
|
|
1738
1762
|
this.options.getItemKey,
|
|
1739
1763
|
this.options.enabled,
|
|
1740
|
-
this.options.lanes
|
|
1741
|
-
|
|
1764
|
+
this.options.lanes,
|
|
1765
|
+
this.options.laneAssignmentMode
|
|
1766
|
+
], (e, t, n, r, i, a, o) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
|
|
1742
1767
|
count: e,
|
|
1743
1768
|
paddingStart: t,
|
|
1744
1769
|
scrollMargin: n,
|
|
1745
1770
|
getItemKey: r,
|
|
1746
1771
|
enabled: i,
|
|
1747
|
-
lanes: a
|
|
1748
|
-
|
|
1772
|
+
lanes: a,
|
|
1773
|
+
laneAssignmentMode: o
|
|
1774
|
+
}), { key: !1 }), this.getMeasurements = X(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o }, s) => {
|
|
1749
1775
|
if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
1750
1776
|
if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
|
|
1751
1777
|
this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
|
|
1752
1778
|
this.itemSizeCache.set(e.key, e.size);
|
|
1753
1779
|
}));
|
|
1754
|
-
let
|
|
1780
|
+
let c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
1755
1781
|
this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
|
|
1756
|
-
let
|
|
1757
|
-
for (let e = 0; e <
|
|
1758
|
-
let t =
|
|
1759
|
-
t && (
|
|
1782
|
+
let l = this.measurementsCache.slice(0, c), u = Array(a).fill(void 0);
|
|
1783
|
+
for (let e = 0; e < c; e++) {
|
|
1784
|
+
let t = l[e];
|
|
1785
|
+
t && (u[t.lane] = e);
|
|
1760
1786
|
}
|
|
1761
|
-
for (let i =
|
|
1762
|
-
let e = r(i), a = this.laneAssignments.get(i),
|
|
1787
|
+
for (let i = c; i < e; i++) {
|
|
1788
|
+
let e = r(i), a = this.laneAssignments.get(i), c, d, f = o === "estimate" || s.has(e);
|
|
1763
1789
|
if (a !== void 0 && this.options.lanes > 1) {
|
|
1764
|
-
|
|
1765
|
-
let e =
|
|
1766
|
-
|
|
1790
|
+
c = a;
|
|
1791
|
+
let e = u[c], r = e === void 0 ? void 0 : l[e];
|
|
1792
|
+
d = r ? r.end + this.options.gap : t + n;
|
|
1767
1793
|
} else {
|
|
1768
|
-
let e = this.options.lanes === 1 ?
|
|
1769
|
-
|
|
1794
|
+
let e = this.options.lanes === 1 ? l[i - 1] : this.getFurthestMeasurement(l, i);
|
|
1795
|
+
d = e ? e.end + this.options.gap : t + n, c = e ? e.lane : i % this.options.lanes, this.options.lanes > 1 && f && this.laneAssignments.set(i, c);
|
|
1770
1796
|
}
|
|
1771
|
-
let
|
|
1772
|
-
|
|
1797
|
+
let p = s.get(e), m = typeof p == "number" ? p : this.options.estimateSize(i), h = d + m;
|
|
1798
|
+
l[i] = {
|
|
1773
1799
|
index: i,
|
|
1774
|
-
start:
|
|
1775
|
-
size:
|
|
1776
|
-
end:
|
|
1800
|
+
start: d,
|
|
1801
|
+
size: m,
|
|
1802
|
+
end: h,
|
|
1777
1803
|
key: e,
|
|
1778
|
-
lane:
|
|
1779
|
-
},
|
|
1804
|
+
lane: c
|
|
1805
|
+
}, u[c] = i;
|
|
1780
1806
|
}
|
|
1781
|
-
return this.measurementsCache =
|
|
1807
|
+
return this.measurementsCache = l, l;
|
|
1782
1808
|
}, {
|
|
1783
1809
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
1784
1810
|
debug: () => this.options.debug
|
|
1785
|
-
}), this.calculateRange =
|
|
1811
|
+
}), this.calculateRange = X(() => [
|
|
1786
1812
|
this.getMeasurements(),
|
|
1787
1813
|
this.getSize(),
|
|
1788
1814
|
this.getScrollOffset(),
|
|
1789
1815
|
this.options.lanes
|
|
1790
|
-
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ?
|
|
1816
|
+
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? vt({
|
|
1791
1817
|
measurements: e,
|
|
1792
1818
|
outerSize: t,
|
|
1793
1819
|
scrollOffset: n,
|
|
@@ -1795,7 +1821,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1795
1821
|
}) : null, {
|
|
1796
1822
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
1797
1823
|
debug: () => this.options.debug
|
|
1798
|
-
}), this.getVirtualIndexes =
|
|
1824
|
+
}), this.getVirtualIndexes = X(() => {
|
|
1799
1825
|
let e = null, t = null, n = this.calculateRange();
|
|
1800
1826
|
return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
|
|
1801
1827
|
this.isScrolling,
|
|
@@ -1844,7 +1870,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1844
1870
|
adjustments: this.scrollAdjustments += r,
|
|
1845
1871
|
behavior: void 0
|
|
1846
1872
|
})), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
|
|
1847
|
-
}, this.getVirtualItems =
|
|
1873
|
+
}, this.getVirtualItems = X(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
|
|
1848
1874
|
let n = [];
|
|
1849
1875
|
for (let r = 0, i = e.length; r < i; r++) {
|
|
1850
1876
|
let i = t[e[r]];
|
|
@@ -1856,7 +1882,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1856
1882
|
debug: () => this.options.debug
|
|
1857
1883
|
}), this.getVirtualItemForOffset = (e) => {
|
|
1858
1884
|
let t = this.getMeasurements();
|
|
1859
|
-
if (t.length !== 0) return
|
|
1885
|
+
if (t.length !== 0) return Z(t[$(0, t.length - 1, (e) => Z(t[e]).start, e)]);
|
|
1860
1886
|
}, this.getMaxScrollOffset = () => {
|
|
1861
1887
|
if (!this.scrollElement) return 0;
|
|
1862
1888
|
if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
@@ -1881,12 +1907,12 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1881
1907
|
let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
|
|
1882
1908
|
return [this.getOffsetForAlignment(a, t, i.size), t];
|
|
1883
1909
|
}, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
|
|
1884
|
-
let r = this.getOffsetForAlignment(e, t);
|
|
1910
|
+
let r = this.getOffsetForAlignment(e, t), i = this.now();
|
|
1885
1911
|
this.scrollState = {
|
|
1886
1912
|
index: null,
|
|
1887
1913
|
align: t,
|
|
1888
1914
|
behavior: n,
|
|
1889
|
-
startedAt:
|
|
1915
|
+
startedAt: i,
|
|
1890
1916
|
lastTargetOffset: r,
|
|
1891
1917
|
stableFrames: 0
|
|
1892
1918
|
}, this._scrollToOffset(r, {
|
|
@@ -1910,12 +1936,12 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1910
1936
|
behavior: n
|
|
1911
1937
|
}), this.scheduleScrollReconcile();
|
|
1912
1938
|
}, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
|
|
1913
|
-
let n = this.getScrollOffset() + e;
|
|
1939
|
+
let n = this.getScrollOffset() + e, r = this.now();
|
|
1914
1940
|
this.scrollState = {
|
|
1915
1941
|
index: null,
|
|
1916
1942
|
align: "start",
|
|
1917
1943
|
behavior: t,
|
|
1918
|
-
startedAt:
|
|
1944
|
+
startedAt: r,
|
|
1919
1945
|
lastTargetOffset: n,
|
|
1920
1946
|
stableFrames: 0
|
|
1921
1947
|
}, this._scrollToOffset(n, {
|
|
@@ -1960,7 +1986,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1960
1986
|
return;
|
|
1961
1987
|
}
|
|
1962
1988
|
let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset;
|
|
1963
|
-
if (!n &&
|
|
1989
|
+
if (!n && st(t, this.getScrollOffset())) {
|
|
1964
1990
|
if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
|
|
1965
1991
|
this.scrollState = null;
|
|
1966
1992
|
return;
|
|
@@ -1971,7 +1997,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1971
1997
|
}));
|
|
1972
1998
|
this.scheduleScrollReconcile();
|
|
1973
1999
|
}
|
|
1974
|
-
},
|
|
2000
|
+
}, $ = (e, t, n, r) => {
|
|
1975
2001
|
for (; e <= t;) {
|
|
1976
2002
|
let i = (e + t) / 2 | 0, a = n(i);
|
|
1977
2003
|
if (a < r) e = i + 1;
|
|
@@ -1980,13 +2006,13 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1980
2006
|
}
|
|
1981
2007
|
return e > 0 ? e - 1 : 0;
|
|
1982
2008
|
};
|
|
1983
|
-
function
|
|
2009
|
+
function vt({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
1984
2010
|
let i = e.length - 1, a = (t) => e[t].start;
|
|
1985
2011
|
if (e.length <= r) return {
|
|
1986
2012
|
startIndex: 0,
|
|
1987
2013
|
endIndex: i
|
|
1988
2014
|
};
|
|
1989
|
-
let o =
|
|
2015
|
+
let o = $(0, i, a, n), s = o;
|
|
1990
2016
|
if (r === 1) for (; s < i && e[s].end < n + t;) s++;
|
|
1991
2017
|
else if (r > 1) {
|
|
1992
2018
|
let a = Array(r).fill(0);
|
|
@@ -2007,54 +2033,54 @@ function _t({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
|
2007
2033
|
};
|
|
2008
2034
|
}
|
|
2009
2035
|
//#endregion
|
|
2010
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.
|
|
2011
|
-
var
|
|
2012
|
-
function
|
|
2036
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/@tanstack/react-virtual/dist/esm/index.js
|
|
2037
|
+
var yt = typeof document < "u" ? e.useLayoutEffect : e.useEffect;
|
|
2038
|
+
function bt({ useFlushSync: t = !0, ...n }) {
|
|
2013
2039
|
let r = e.useReducer(() => ({}), {})[1], i = {
|
|
2014
2040
|
...n,
|
|
2015
2041
|
onChange: (e, i) => {
|
|
2016
2042
|
var a;
|
|
2017
|
-
t && i ?
|
|
2043
|
+
t && i ? U(r) : r(), (a = n.onChange) == null || a.call(n, e, i);
|
|
2018
2044
|
}
|
|
2019
|
-
}, [a] = e.useState(() => new
|
|
2020
|
-
return a.setOptions(i),
|
|
2045
|
+
}, [a] = e.useState(() => new _t(i));
|
|
2046
|
+
return a.setOptions(i), yt(() => a._didMount(), []), yt(() => a._willUpdate()), a;
|
|
2021
2047
|
}
|
|
2022
|
-
function
|
|
2023
|
-
return
|
|
2024
|
-
observeElementRect:
|
|
2025
|
-
observeElementOffset:
|
|
2026
|
-
scrollToFn:
|
|
2048
|
+
function xt(e) {
|
|
2049
|
+
return bt({
|
|
2050
|
+
observeElementRect: dt,
|
|
2051
|
+
observeElementOffset: mt,
|
|
2052
|
+
scrollToFn: gt,
|
|
2027
2053
|
...e
|
|
2028
2054
|
});
|
|
2029
2055
|
}
|
|
2030
2056
|
//#endregion
|
|
2031
2057
|
//#region src/VirtualGrid.tsx
|
|
2032
|
-
var
|
|
2033
|
-
let u = o(null), d =
|
|
2058
|
+
var St = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className: i = "", headerClassName: a = "", rowClassName: s, onRowClick: c, overscan: l = 5 }) => {
|
|
2059
|
+
let u = o(null), d = xt({
|
|
2034
2060
|
count: e.length,
|
|
2035
2061
|
getScrollElement: () => u.current,
|
|
2036
2062
|
estimateSize: () => n,
|
|
2037
2063
|
overscan: l
|
|
2038
2064
|
}), f = d.getVirtualItems();
|
|
2039
|
-
return /* @__PURE__ */ (0,
|
|
2065
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2040
2066
|
className: i,
|
|
2041
2067
|
children: [
|
|
2042
|
-
/* @__PURE__ */ (0,
|
|
2068
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2043
2069
|
className: `grid border-b sticky top-0 bg-muted/30 z-10 ${a}`,
|
|
2044
2070
|
style: { gridTemplateColumns: t.map((e) => e.width || "1fr").join(" ") },
|
|
2045
|
-
children: t.map((e, t) => /* @__PURE__ */ (0,
|
|
2071
|
+
children: t.map((e, t) => /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2046
2072
|
className: `px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70 ${e.align === "center" ? "text-center" : e.align === "right" ? "text-right" : "text-left"}`,
|
|
2047
2073
|
children: e.header
|
|
2048
2074
|
}, t))
|
|
2049
2075
|
}),
|
|
2050
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2051
2077
|
ref: u,
|
|
2052
2078
|
className: "overflow-auto",
|
|
2053
2079
|
style: {
|
|
2054
2080
|
height: typeof r == "number" ? `${r}px` : r,
|
|
2055
2081
|
contain: "strict"
|
|
2056
2082
|
},
|
|
2057
|
-
children: /* @__PURE__ */ (0,
|
|
2083
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2058
2084
|
style: {
|
|
2059
2085
|
height: `${d.getTotalSize()}px`,
|
|
2060
2086
|
width: "100%",
|
|
@@ -2062,7 +2088,7 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2062
2088
|
},
|
|
2063
2089
|
children: f.map((n) => {
|
|
2064
2090
|
let r = e[n.index];
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2091
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2066
2092
|
className: `grid border-b hover:bg-muted/50 cursor-pointer ${typeof s == "function" ? s(r, n.index) : s || ""}`,
|
|
2067
2093
|
style: {
|
|
2068
2094
|
position: "absolute",
|
|
@@ -2075,8 +2101,8 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2075
2101
|
},
|
|
2076
2102
|
onClick: () => c?.(r, n.index),
|
|
2077
2103
|
children: t.map((e, t) => {
|
|
2078
|
-
let n = r[e.accessorKey], i = e.cell ? e.cell(n, r) : n;
|
|
2079
|
-
return /* @__PURE__ */ (0,
|
|
2104
|
+
let n = r[e.accessorKey], i = e.cell ? e.cell(n, r) : typeof n == "object" && n ? String(n) : n;
|
|
2105
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2080
2106
|
className: `px-4 py-2 text-sm flex items-center ${e.align === "center" ? "text-center justify-center" : e.align === "right" ? "text-right justify-end" : "text-left justify-start"}`,
|
|
2081
2107
|
children: i
|
|
2082
2108
|
}, t);
|
|
@@ -2085,7 +2111,7 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2085
2111
|
})
|
|
2086
2112
|
})
|
|
2087
2113
|
}),
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2114
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2089
2115
|
className: "px-4 py-2 text-xs text-muted-foreground border-t",
|
|
2090
2116
|
children: [
|
|
2091
2117
|
"Showing ",
|
|
@@ -2097,8 +2123,8 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2097
2123
|
})
|
|
2098
2124
|
]
|
|
2099
2125
|
});
|
|
2100
|
-
},
|
|
2101
|
-
function
|
|
2126
|
+
}, Ct = 10;
|
|
2127
|
+
function wt(e) {
|
|
2102
2128
|
let t = [], n = [], r = "", i = !1;
|
|
2103
2129
|
for (let a = 0; a < e.length; a++) {
|
|
2104
2130
|
let o = e[a], s = e[a + 1];
|
|
@@ -2106,7 +2132,7 @@ function Ct(e) {
|
|
|
2106
2132
|
}
|
|
2107
2133
|
return n.push(r.trim()), n.some((e) => e !== "") && t.push(n), t;
|
|
2108
2134
|
}
|
|
2109
|
-
function
|
|
2135
|
+
function Tt(e, t) {
|
|
2110
2136
|
if (!e) return !0;
|
|
2111
2137
|
switch (t) {
|
|
2112
2138
|
case "number":
|
|
@@ -2125,7 +2151,7 @@ function wt(e, t) {
|
|
|
2125
2151
|
default: return !0;
|
|
2126
2152
|
}
|
|
2127
2153
|
}
|
|
2128
|
-
function
|
|
2154
|
+
function Et(e, t) {
|
|
2129
2155
|
let n = {};
|
|
2130
2156
|
return e.forEach((e, r) => {
|
|
2131
2157
|
let i = e.toLowerCase().replace(/[_\s-]/g, ""), a = t.find((e) => {
|
|
@@ -2135,7 +2161,7 @@ function Tt(e, t) {
|
|
|
2135
2161
|
a && (n[r] = a.name);
|
|
2136
2162
|
}), n;
|
|
2137
2163
|
}
|
|
2138
|
-
function
|
|
2164
|
+
function Dt(e, t, n) {
|
|
2139
2165
|
let r = [], i = {};
|
|
2140
2166
|
for (let a of t) {
|
|
2141
2167
|
let t = e[a.csvIdx] ?? "";
|
|
@@ -2147,7 +2173,7 @@ function Et(e, t, n) {
|
|
|
2147
2173
|
});
|
|
2148
2174
|
continue;
|
|
2149
2175
|
}
|
|
2150
|
-
if (t && !
|
|
2176
|
+
if (t && !Tt(t, a.field.type)) {
|
|
2151
2177
|
r.push({
|
|
2152
2178
|
row: n,
|
|
2153
2179
|
field: a.field.name,
|
|
@@ -2162,7 +2188,7 @@ function Et(e, t, n) {
|
|
|
2162
2188
|
errors: r
|
|
2163
2189
|
};
|
|
2164
2190
|
}
|
|
2165
|
-
var
|
|
2191
|
+
var Ot = ({ onFileLoaded: e }) => {
|
|
2166
2192
|
let [t, n] = s(!1), [i, a] = s(null), o = r((t) => {
|
|
2167
2193
|
if (a(null), !t.name.endsWith(".csv")) {
|
|
2168
2194
|
a("Only CSV files are supported.");
|
|
@@ -2170,7 +2196,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2170
2196
|
}
|
|
2171
2197
|
let n = new FileReader();
|
|
2172
2198
|
n.onload = (t) => {
|
|
2173
|
-
let n =
|
|
2199
|
+
let n = wt(t.target?.result);
|
|
2174
2200
|
if (n.length < 2) {
|
|
2175
2201
|
a("File must contain a header row and at least one data row.");
|
|
2176
2202
|
return;
|
|
@@ -2178,10 +2204,10 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2178
2204
|
e(n[0], n.slice(1));
|
|
2179
2205
|
}, n.readAsText(t);
|
|
2180
2206
|
}, [e]);
|
|
2181
|
-
return /* @__PURE__ */ (0,
|
|
2207
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2182
2208
|
className: "flex flex-col items-center gap-4 py-6",
|
|
2183
|
-
children: [/* @__PURE__ */ (0,
|
|
2184
|
-
className:
|
|
2209
|
+
children: [/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2210
|
+
className: R("flex w-full flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-10 transition-colors", t ? "border-primary bg-primary/5" : "border-muted-foreground/25"),
|
|
2185
2211
|
onDragOver: (e) => {
|
|
2186
2212
|
e.preventDefault(), n(!0);
|
|
2187
2213
|
},
|
|
@@ -2192,12 +2218,12 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2192
2218
|
t && o(t);
|
|
2193
2219
|
},
|
|
2194
2220
|
children: [
|
|
2195
|
-
/* @__PURE__ */ (0,
|
|
2196
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
/* @__PURE__ */ (0, K.jsx)(V, { className: "h-10 w-10 text-muted-foreground" }),
|
|
2222
|
+
/* @__PURE__ */ (0, K.jsx)("p", {
|
|
2197
2223
|
className: "text-sm text-muted-foreground",
|
|
2198
2224
|
children: "Drag & drop a CSV file here, or click to browse"
|
|
2199
2225
|
}),
|
|
2200
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
/* @__PURE__ */ (0, K.jsxs)("label", { children: [/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2201
2227
|
type: "file",
|
|
2202
2228
|
accept: ".csv",
|
|
2203
2229
|
className: "hidden",
|
|
@@ -2205,63 +2231,63 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2205
2231
|
let t = e.target.files?.[0];
|
|
2206
2232
|
t && o(t);
|
|
2207
2233
|
}
|
|
2208
|
-
}), /* @__PURE__ */ (0,
|
|
2234
|
+
}), /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2209
2235
|
variant: "outline",
|
|
2210
2236
|
size: "sm",
|
|
2211
2237
|
asChild: !0,
|
|
2212
|
-
children: /* @__PURE__ */ (0,
|
|
2238
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", { children: "Browse Files" })
|
|
2213
2239
|
})] })
|
|
2214
2240
|
]
|
|
2215
|
-
}), i && /* @__PURE__ */ (0,
|
|
2241
|
+
}), i && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2216
2242
|
className: "flex items-center gap-1 text-sm text-destructive",
|
|
2217
2243
|
children: [
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2244
|
+
/* @__PURE__ */ (0, K.jsx)(he, { className: "h-4 w-4" }),
|
|
2219
2245
|
" ",
|
|
2220
2246
|
i
|
|
2221
2247
|
]
|
|
2222
2248
|
})]
|
|
2223
2249
|
});
|
|
2224
|
-
},
|
|
2250
|
+
}, kt = ({ headers: e, fields: t, mapping: n, onMappingChange: i }) => {
|
|
2225
2251
|
let o = a(() => new Set(Object.values(n)), [n]), s = r((e, t) => {
|
|
2226
2252
|
let r = { ...n };
|
|
2227
2253
|
t === "__skip__" ? delete r[e] : r[e] = t, i(r);
|
|
2228
2254
|
}, [n, i]);
|
|
2229
|
-
return /* @__PURE__ */ (0,
|
|
2255
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2230
2256
|
className: "max-h-[360px] overflow-auto",
|
|
2231
|
-
children: /* @__PURE__ */ (0,
|
|
2232
|
-
/* @__PURE__ */ (0,
|
|
2233
|
-
/* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2257
|
+
children: /* @__PURE__ */ (0, K.jsxs)(fe, { children: [/* @__PURE__ */ (0, K.jsx)(me, { children: /* @__PURE__ */ (0, K.jsxs)(L, { children: [
|
|
2258
|
+
/* @__PURE__ */ (0, K.jsx)(I, { children: "CSV Column" }),
|
|
2259
|
+
/* @__PURE__ */ (0, K.jsx)(I, { children: "Maps To" }),
|
|
2260
|
+
/* @__PURE__ */ (0, K.jsx)(I, {
|
|
2235
2261
|
className: "w-24 text-center",
|
|
2236
2262
|
children: "Status"
|
|
2237
2263
|
})
|
|
2238
|
-
] }) }), /* @__PURE__ */ (0,
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2264
|
+
] }) }), /* @__PURE__ */ (0, K.jsx)(pe, { children: e.map((e, r) => /* @__PURE__ */ (0, K.jsxs)(L, { children: [
|
|
2265
|
+
/* @__PURE__ */ (0, K.jsx)(F, {
|
|
2240
2266
|
className: "font-medium",
|
|
2241
2267
|
children: e
|
|
2242
2268
|
}),
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2269
|
+
/* @__PURE__ */ (0, K.jsx)(F, { children: /* @__PURE__ */ (0, K.jsxs)(le, {
|
|
2244
2270
|
value: n[r] ?? "__skip__",
|
|
2245
2271
|
onValueChange: (e) => s(r, e),
|
|
2246
|
-
children: [/* @__PURE__ */ (0,
|
|
2272
|
+
children: [/* @__PURE__ */ (0, K.jsx)(ue, {
|
|
2247
2273
|
className: "h-8 w-56",
|
|
2248
|
-
children: /* @__PURE__ */ (0,
|
|
2249
|
-
}), /* @__PURE__ */ (0,
|
|
2274
|
+
children: /* @__PURE__ */ (0, K.jsx)(de, { placeholder: "Skip column" })
|
|
2275
|
+
}), /* @__PURE__ */ (0, K.jsxs)(N, { children: [/* @__PURE__ */ (0, K.jsx)(P, {
|
|
2250
2276
|
value: "__skip__",
|
|
2251
2277
|
children: "— Skip —"
|
|
2252
|
-
}), t.map((e) => /* @__PURE__ */ (0,
|
|
2278
|
+
}), t.map((e) => /* @__PURE__ */ (0, K.jsxs)(P, {
|
|
2253
2279
|
value: e.name,
|
|
2254
2280
|
disabled: o.has(e.name) && n[r] !== e.name,
|
|
2255
2281
|
children: [e.label, e.required ? " *" : ""]
|
|
2256
2282
|
}, e.name))] })]
|
|
2257
2283
|
}) }),
|
|
2258
|
-
/* @__PURE__ */ (0,
|
|
2284
|
+
/* @__PURE__ */ (0, K.jsx)(F, {
|
|
2259
2285
|
className: "text-center",
|
|
2260
|
-
children: n[r] ? /* @__PURE__ */ (0,
|
|
2286
|
+
children: n[r] ? /* @__PURE__ */ (0, K.jsx)(w, {
|
|
2261
2287
|
variant: "default",
|
|
2262
2288
|
className: "text-xs",
|
|
2263
2289
|
children: "Mapped"
|
|
2264
|
-
}) : /* @__PURE__ */ (0,
|
|
2290
|
+
}) : /* @__PURE__ */ (0, K.jsx)(w, {
|
|
2265
2291
|
variant: "secondary",
|
|
2266
2292
|
className: "text-xs",
|
|
2267
2293
|
children: "Skipped"
|
|
@@ -2269,7 +2295,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2269
2295
|
})
|
|
2270
2296
|
] }, r)) })] })
|
|
2271
2297
|
});
|
|
2272
|
-
},
|
|
2298
|
+
}, At = ({ headers: e, rows: t, mapping: n, fields: r }) => {
|
|
2273
2299
|
let i = a(() => Object.entries(n).map(([t, n]) => ({
|
|
2274
2300
|
csvIdx: Number(t),
|
|
2275
2301
|
header: e[Number(t)],
|
|
@@ -2278,42 +2304,42 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2278
2304
|
n,
|
|
2279
2305
|
e,
|
|
2280
2306
|
r
|
|
2281
|
-
]), o = t.slice(0,
|
|
2307
|
+
]), o = t.slice(0, Ct), s = a(() => o.map((e, t) => {
|
|
2282
2308
|
let n = {};
|
|
2283
2309
|
for (let t of i) {
|
|
2284
2310
|
let r = e[t.csvIdx] ?? "";
|
|
2285
|
-
t.field.required && !r ? n[t.csvIdx] = "Required" : r && !
|
|
2311
|
+
t.field.required && !r ? n[t.csvIdx] = "Required" : r && !Tt(r, t.field.type) && (n[t.csvIdx] = `Invalid ${t.field.type}`);
|
|
2286
2312
|
}
|
|
2287
2313
|
return n;
|
|
2288
2314
|
}), [o, i]), c = s.filter((e) => Object.keys(e).length > 0).length;
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2315
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2290
2316
|
className: "max-h-[360px] overflow-auto",
|
|
2291
2317
|
children: [
|
|
2292
|
-
c > 0 && /* @__PURE__ */ (0,
|
|
2318
|
+
c > 0 && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2293
2319
|
className: "mb-2 flex items-center gap-1 text-xs text-destructive",
|
|
2294
2320
|
children: [
|
|
2295
|
-
/* @__PURE__ */ (0,
|
|
2321
|
+
/* @__PURE__ */ (0, K.jsx)(he, { className: "h-3.5 w-3.5" }),
|
|
2296
2322
|
" ",
|
|
2297
2323
|
c,
|
|
2298
2324
|
" row(s) with errors in preview"
|
|
2299
2325
|
]
|
|
2300
2326
|
}),
|
|
2301
|
-
/* @__PURE__ */ (0,
|
|
2327
|
+
/* @__PURE__ */ (0, K.jsxs)(fe, { children: [/* @__PURE__ */ (0, K.jsx)(me, { children: /* @__PURE__ */ (0, K.jsxs)(L, { children: [/* @__PURE__ */ (0, K.jsx)(I, {
|
|
2302
2328
|
className: "w-12",
|
|
2303
2329
|
children: "#"
|
|
2304
|
-
}), i.map((e) => /* @__PURE__ */ (0,
|
|
2330
|
+
}), i.map((e) => /* @__PURE__ */ (0, K.jsx)(I, { children: e.field.label }, e.csvIdx))] }) }), /* @__PURE__ */ (0, K.jsx)(pe, { children: o.map((e, t) => {
|
|
2305
2331
|
let n = s[t];
|
|
2306
|
-
return /* @__PURE__ */ (0,
|
|
2307
|
-
className:
|
|
2308
|
-
children: [/* @__PURE__ */ (0,
|
|
2332
|
+
return /* @__PURE__ */ (0, K.jsxs)(L, {
|
|
2333
|
+
className: R(Object.keys(n).length > 0 && "bg-destructive/5"),
|
|
2334
|
+
children: [/* @__PURE__ */ (0, K.jsx)(F, {
|
|
2309
2335
|
className: "text-xs text-muted-foreground",
|
|
2310
2336
|
children: t + 1
|
|
2311
2337
|
}), i.map((t) => {
|
|
2312
2338
|
let r = e[t.csvIdx] ?? "", i = n[t.csvIdx];
|
|
2313
|
-
return /* @__PURE__ */ (0,
|
|
2314
|
-
className:
|
|
2339
|
+
return /* @__PURE__ */ (0, K.jsx)(F, {
|
|
2340
|
+
className: R(i && "text-destructive"),
|
|
2315
2341
|
title: i,
|
|
2316
|
-
children: r || /* @__PURE__ */ (0,
|
|
2342
|
+
children: r || /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2317
2343
|
className: "text-muted-foreground/50",
|
|
2318
2344
|
children: "—"
|
|
2319
2345
|
})
|
|
@@ -2321,7 +2347,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2321
2347
|
})]
|
|
2322
2348
|
}, t);
|
|
2323
2349
|
}) })] }),
|
|
2324
|
-
/* @__PURE__ */ (0,
|
|
2350
|
+
/* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2325
2351
|
className: "mt-2 text-xs text-muted-foreground",
|
|
2326
2352
|
children: [
|
|
2327
2353
|
"Showing ",
|
|
@@ -2333,12 +2359,12 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2333
2359
|
})
|
|
2334
2360
|
]
|
|
2335
2361
|
});
|
|
2336
|
-
},
|
|
2337
|
-
let [p, m] = s("upload"), [h, g] = s([]), [_, v] = s([]), [y, b] = s({}), [x, S] = s(!1), [C, D] = s(0), [O, k] = s(null), A = n ?? e,
|
|
2362
|
+
}, jt = ({ objectName: e, objectLabel: n, fields: i, dataSource: o, onComplete: c, onCancel: l, open: u, onOpenChange: d, onErrorMode: f = "skip" }) => {
|
|
2363
|
+
let [p, m] = s("upload"), [h, g] = s([]), [_, v] = s([]), [y, b] = s({}), [x, S] = s(!1), [C, D] = s(0), [O, k] = s(null), A = n ?? e, ae = a(() => {
|
|
2338
2364
|
let e = new Set(Object.values(y));
|
|
2339
2365
|
return i.filter((t) => t.required && !e.has(t.name));
|
|
2340
|
-
}, [i, y]),
|
|
2341
|
-
g(e), v(t), b(
|
|
2366
|
+
}, [i, y]), j = r((e, t) => {
|
|
2367
|
+
g(e), v(t), b(Et(e, i)), m("mapping");
|
|
2342
2368
|
}, [i]), oe = r(async () => {
|
|
2343
2369
|
S(!0), D(0);
|
|
2344
2370
|
let t = [], n = 0, r = 0, a = Object.entries(y).map(([e, t]) => ({
|
|
@@ -2346,7 +2372,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2346
2372
|
field: i.find((e) => e.name === t)
|
|
2347
2373
|
}));
|
|
2348
2374
|
for (let i = 0; i < _.length; i++) {
|
|
2349
|
-
let { record: s, errors: c } =
|
|
2375
|
+
let { record: s, errors: c } = Dt(_[i], a, i + 1);
|
|
2350
2376
|
if (c.length > 0) {
|
|
2351
2377
|
if (r++, t.push(...c), f === "stop") break;
|
|
2352
2378
|
} else try {
|
|
@@ -2379,41 +2405,41 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2379
2405
|
f
|
|
2380
2406
|
]), se = r(() => {
|
|
2381
2407
|
m("upload"), g([]), v([]), b({}), D(0), k(null);
|
|
2382
|
-
}, []),
|
|
2408
|
+
}, []), ce = r(() => {
|
|
2383
2409
|
se(), d?.(!1), l?.();
|
|
2384
2410
|
}, [
|
|
2385
2411
|
se,
|
|
2386
2412
|
d,
|
|
2387
2413
|
l
|
|
2388
2414
|
]);
|
|
2389
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
+
return /* @__PURE__ */ (0, K.jsx)(ee, {
|
|
2390
2416
|
open: u,
|
|
2391
2417
|
onOpenChange: (e) => {
|
|
2392
|
-
e ? d?.(e) :
|
|
2418
|
+
e ? d?.(e) : ce();
|
|
2393
2419
|
},
|
|
2394
|
-
children: /* @__PURE__ */ (0,
|
|
2420
|
+
children: /* @__PURE__ */ (0, K.jsxs)(te, {
|
|
2395
2421
|
className: "sm:max-w-2xl",
|
|
2396
2422
|
children: [
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2423
|
+
/* @__PURE__ */ (0, K.jsxs)(E, { children: [/* @__PURE__ */ (0, K.jsxs)(ie, {
|
|
2398
2424
|
className: "flex items-center gap-2",
|
|
2399
2425
|
children: [
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2426
|
+
/* @__PURE__ */ (0, K.jsx)(De, { className: "h-5 w-5" }),
|
|
2401
2427
|
" Import ",
|
|
2402
2428
|
A
|
|
2403
2429
|
]
|
|
2404
|
-
}), /* @__PURE__ */ (0,
|
|
2430
|
+
}), /* @__PURE__ */ (0, K.jsxs)(ne, { children: [
|
|
2405
2431
|
p === "upload" && "Upload a CSV file to get started.",
|
|
2406
2432
|
p === "mapping" && "Map CSV columns to object fields.",
|
|
2407
2433
|
p === "preview" && "Review data before importing."
|
|
2408
2434
|
] })] }),
|
|
2409
|
-
/* @__PURE__ */ (0,
|
|
2435
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2410
2436
|
className: "flex items-center justify-center gap-2 text-xs text-muted-foreground",
|
|
2411
2437
|
children: [
|
|
2412
2438
|
"upload",
|
|
2413
2439
|
"mapping",
|
|
2414
2440
|
"preview"
|
|
2415
|
-
].map((e, n) => /* @__PURE__ */ (0,
|
|
2416
|
-
className:
|
|
2441
|
+
].map((e, n) => /* @__PURE__ */ (0, K.jsxs)(t.Fragment, { children: [n > 0 && /* @__PURE__ */ (0, K.jsx)(ve, { className: "h-3 w-3" }), /* @__PURE__ */ (0, K.jsxs)("span", {
|
|
2442
|
+
className: R("rounded-full px-3 py-1", p === e ? "bg-primary text-primary-foreground" : "bg-muted"),
|
|
2417
2443
|
children: [
|
|
2418
2444
|
n + 1,
|
|
2419
2445
|
". ",
|
|
@@ -2421,27 +2447,27 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2421
2447
|
]
|
|
2422
2448
|
})] }, e))
|
|
2423
2449
|
}),
|
|
2424
|
-
O ? /* @__PURE__ */ (0,
|
|
2450
|
+
O ? /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2425
2451
|
className: "flex flex-col items-center gap-3 py-4",
|
|
2426
2452
|
children: [
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
/* @__PURE__ */ (0, K.jsx)(be, { className: "h-10 w-10 text-green-500" }),
|
|
2454
|
+
/* @__PURE__ */ (0, K.jsx)("p", {
|
|
2429
2455
|
className: "text-lg font-semibold",
|
|
2430
2456
|
children: "Import Complete"
|
|
2431
2457
|
}),
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2458
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2433
2459
|
className: "flex gap-3",
|
|
2434
|
-
children: [/* @__PURE__ */ (0,
|
|
2460
|
+
children: [/* @__PURE__ */ (0, K.jsxs)(w, {
|
|
2435
2461
|
variant: "default",
|
|
2436
2462
|
children: [O.importedRows, " imported"]
|
|
2437
|
-
}), O.skippedRows > 0 && /* @__PURE__ */ (0,
|
|
2463
|
+
}), O.skippedRows > 0 && /* @__PURE__ */ (0, K.jsxs)(w, {
|
|
2438
2464
|
variant: "destructive",
|
|
2439
2465
|
children: [O.skippedRows, " skipped"]
|
|
2440
2466
|
})]
|
|
2441
2467
|
}),
|
|
2442
|
-
O.errors.length > 0 && /* @__PURE__ */ (0,
|
|
2468
|
+
O.errors.length > 0 && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2443
2469
|
className: "max-h-32 w-full overflow-auto rounded border p-2 text-xs",
|
|
2444
|
-
children: [O.errors.slice(0, 10).map((e, t) => /* @__PURE__ */ (0,
|
|
2470
|
+
children: [O.errors.slice(0, 10).map((e, t) => /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2445
2471
|
className: "text-destructive",
|
|
2446
2472
|
children: [
|
|
2447
2473
|
"Row ",
|
|
@@ -2450,7 +2476,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2450
2476
|
": ",
|
|
2451
2477
|
e.message
|
|
2452
2478
|
]
|
|
2453
|
-
}, t)), O.errors.length > 10 && /* @__PURE__ */ (0,
|
|
2479
|
+
}, t)), O.errors.length > 10 && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2454
2480
|
className: "text-muted-foreground",
|
|
2455
2481
|
children: [
|
|
2456
2482
|
"…and ",
|
|
@@ -2460,26 +2486,26 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2460
2486
|
})]
|
|
2461
2487
|
})
|
|
2462
2488
|
]
|
|
2463
|
-
}) : /* @__PURE__ */ (0,
|
|
2464
|
-
p === "upload" && /* @__PURE__ */ (0,
|
|
2465
|
-
p === "mapping" && /* @__PURE__ */ (0,
|
|
2489
|
+
}) : /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [
|
|
2490
|
+
p === "upload" && /* @__PURE__ */ (0, K.jsx)(Ot, { onFileLoaded: j }),
|
|
2491
|
+
p === "mapping" && /* @__PURE__ */ (0, K.jsx)(kt, {
|
|
2466
2492
|
headers: h,
|
|
2467
2493
|
fields: i,
|
|
2468
2494
|
mapping: y,
|
|
2469
2495
|
onMappingChange: b
|
|
2470
2496
|
}),
|
|
2471
|
-
p === "preview" && /* @__PURE__ */ (0,
|
|
2497
|
+
p === "preview" && /* @__PURE__ */ (0, K.jsx)(At, {
|
|
2472
2498
|
headers: h,
|
|
2473
2499
|
rows: _,
|
|
2474
2500
|
mapping: y,
|
|
2475
2501
|
fields: i
|
|
2476
2502
|
}),
|
|
2477
|
-
x && /* @__PURE__ */ (0,
|
|
2503
|
+
x && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2478
2504
|
className: "flex flex-col gap-1",
|
|
2479
|
-
children: [/* @__PURE__ */ (0,
|
|
2505
|
+
children: [/* @__PURE__ */ (0, K.jsx)(M, {
|
|
2480
2506
|
value: C,
|
|
2481
2507
|
className: "h-2"
|
|
2482
|
-
}), /* @__PURE__ */ (0,
|
|
2508
|
+
}), /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2483
2509
|
className: "text-center text-xs text-muted-foreground",
|
|
2484
2510
|
children: [
|
|
2485
2511
|
"Importing… ",
|
|
@@ -2489,30 +2515,30 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2489
2515
|
})]
|
|
2490
2516
|
})
|
|
2491
2517
|
] }),
|
|
2492
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
/* @__PURE__ */ (0, K.jsx)(re, {
|
|
2493
2519
|
className: "gap-2 sm:gap-0",
|
|
2494
|
-
children: O ? /* @__PURE__ */ (0,
|
|
2495
|
-
onClick:
|
|
2520
|
+
children: O ? /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2521
|
+
onClick: ce,
|
|
2496
2522
|
children: "Close"
|
|
2497
|
-
}) : /* @__PURE__ */ (0,
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
}) : /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [
|
|
2524
|
+
/* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2499
2525
|
variant: "ghost",
|
|
2500
|
-
onClick:
|
|
2526
|
+
onClick: ce,
|
|
2501
2527
|
disabled: x,
|
|
2502
|
-
children: [/* @__PURE__ */ (0,
|
|
2528
|
+
children: [/* @__PURE__ */ (0, K.jsx)(H, { className: "mr-1 h-4 w-4" }), " Cancel"]
|
|
2503
2529
|
}),
|
|
2504
|
-
(p === "mapping" || p === "preview") && /* @__PURE__ */ (0,
|
|
2530
|
+
(p === "mapping" || p === "preview") && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2505
2531
|
variant: "outline",
|
|
2506
2532
|
onClick: () => m(p === "mapping" ? "upload" : "mapping"),
|
|
2507
2533
|
disabled: x,
|
|
2508
|
-
children: [/* @__PURE__ */ (0,
|
|
2534
|
+
children: [/* @__PURE__ */ (0, K.jsx)(_e, { className: "mr-1 h-4 w-4" }), " Back"]
|
|
2509
2535
|
}),
|
|
2510
|
-
p === "mapping" && /* @__PURE__ */ (0,
|
|
2536
|
+
p === "mapping" && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2511
2537
|
onClick: () => m("preview"),
|
|
2512
|
-
disabled: Object.keys(y).length === 0 ||
|
|
2513
|
-
children: ["Next ", /* @__PURE__ */ (0,
|
|
2538
|
+
disabled: Object.keys(y).length === 0 || ae.length > 0,
|
|
2539
|
+
children: ["Next ", /* @__PURE__ */ (0, K.jsx)(ve, { className: "ml-1 h-4 w-4" })]
|
|
2514
2540
|
}),
|
|
2515
|
-
p === "preview" && /* @__PURE__ */ (0,
|
|
2541
|
+
p === "preview" && /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2516
2542
|
onClick: oe,
|
|
2517
2543
|
disabled: x,
|
|
2518
2544
|
children: x ? "Importing…" : `Import ${_.length} Rows`
|
|
@@ -2525,7 +2551,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2525
2551
|
};
|
|
2526
2552
|
//#endregion
|
|
2527
2553
|
//#region src/InlineEditing.tsx
|
|
2528
|
-
function
|
|
2554
|
+
function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", placeholder: l, editing: u = !1, className: d, disabled: f = !1 }) {
|
|
2529
2555
|
let [p, m] = s(u), [h, g] = s(String(e ?? "")), [_, v] = s(), [y, b] = s(!1), x = o(null);
|
|
2530
2556
|
i(() => {
|
|
2531
2557
|
p || g(String(e ?? ""));
|
|
@@ -2566,13 +2592,13 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2566
2592
|
]), T = r((e) => {
|
|
2567
2593
|
e.key === "Enter" ? (e.preventDefault(), w()) : e.key === "Escape" && (e.preventDefault(), C());
|
|
2568
2594
|
}, [w, C]);
|
|
2569
|
-
return p ? /* @__PURE__ */ (0,
|
|
2595
|
+
return p ? /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2570
2596
|
"data-slot": "inline-editing",
|
|
2571
|
-
className:
|
|
2597
|
+
className: R("relative flex items-center gap-1", d),
|
|
2572
2598
|
children: [
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2599
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2574
2600
|
className: "flex-1 relative",
|
|
2575
|
-
children: [/* @__PURE__ */ (0,
|
|
2601
|
+
children: [/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2576
2602
|
ref: x,
|
|
2577
2603
|
"data-slot": "inline-editing-input",
|
|
2578
2604
|
type: c,
|
|
@@ -2585,8 +2611,8 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2585
2611
|
disabled: y,
|
|
2586
2612
|
"aria-invalid": !!_,
|
|
2587
2613
|
"aria-describedby": _ ? "inline-editing-error" : void 0,
|
|
2588
|
-
className:
|
|
2589
|
-
}), _ && /* @__PURE__ */ (0,
|
|
2614
|
+
className: R("w-full rounded border px-2 py-1 text-sm outline-none transition-colors", "focus:ring-2 focus:ring-ring focus:border-input", _ ? "border-destructive focus:ring-destructive/30" : "border-input", y && "opacity-50")
|
|
2615
|
+
}), _ && /* @__PURE__ */ (0, K.jsx)("p", {
|
|
2590
2616
|
id: "inline-editing-error",
|
|
2591
2617
|
"data-slot": "inline-editing-error",
|
|
2592
2618
|
className: "absolute left-0 top-full mt-0.5 text-xs text-destructive",
|
|
@@ -2594,28 +2620,28 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2594
2620
|
children: _
|
|
2595
2621
|
})]
|
|
2596
2622
|
}),
|
|
2597
|
-
/* @__PURE__ */ (0,
|
|
2623
|
+
/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2598
2624
|
"data-slot": "inline-editing-save",
|
|
2599
2625
|
type: "button",
|
|
2600
2626
|
onClick: w,
|
|
2601
2627
|
disabled: y,
|
|
2602
2628
|
"aria-label": "Save",
|
|
2603
|
-
className:
|
|
2604
|
-
children: /* @__PURE__ */ (0,
|
|
2629
|
+
className: R("inline-flex h-6 w-6 items-center justify-center rounded text-primary hover:bg-primary/10 transition-colors", y && "opacity-50 cursor-not-allowed"),
|
|
2630
|
+
children: /* @__PURE__ */ (0, K.jsx)(z, { className: "h-3.5 w-3.5" })
|
|
2605
2631
|
}),
|
|
2606
|
-
/* @__PURE__ */ (0,
|
|
2632
|
+
/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2607
2633
|
"data-slot": "inline-editing-cancel",
|
|
2608
2634
|
type: "button",
|
|
2609
2635
|
onClick: C,
|
|
2610
2636
|
disabled: y,
|
|
2611
2637
|
"aria-label": "Cancel",
|
|
2612
2638
|
className: "inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",
|
|
2613
|
-
children: /* @__PURE__ */ (0,
|
|
2639
|
+
children: /* @__PURE__ */ (0, K.jsx)(H, { className: "h-3.5 w-3.5" })
|
|
2614
2640
|
})
|
|
2615
2641
|
]
|
|
2616
|
-
}) : /* @__PURE__ */ (0,
|
|
2642
|
+
}) : /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2617
2643
|
"data-slot": "inline-editing",
|
|
2618
|
-
className:
|
|
2644
|
+
className: R("group relative cursor-pointer rounded px-2 py-1 hover:bg-muted/50 transition-colors min-h-[1.75rem] flex items-center", f && "cursor-default opacity-60", d),
|
|
2619
2645
|
onClick: S,
|
|
2620
2646
|
role: "button",
|
|
2621
2647
|
tabIndex: f ? -1 : 0,
|
|
@@ -2623,10 +2649,10 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2623
2649
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), S());
|
|
2624
2650
|
},
|
|
2625
2651
|
"aria-label": `Edit value: ${String(e ?? "")}`,
|
|
2626
|
-
children: /* @__PURE__ */ (0,
|
|
2652
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2627
2653
|
"data-slot": "inline-editing-display",
|
|
2628
2654
|
className: "truncate text-sm",
|
|
2629
|
-
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
2655
|
+
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2630
2656
|
className: "text-muted-foreground italic",
|
|
2631
2657
|
children: l || "Click to edit"
|
|
2632
2658
|
})
|
|
@@ -2635,7 +2661,7 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2635
2661
|
}
|
|
2636
2662
|
//#endregion
|
|
2637
2663
|
//#region src/useCellClipboard.ts
|
|
2638
|
-
function
|
|
2664
|
+
function Nt(e) {
|
|
2639
2665
|
return {
|
|
2640
2666
|
startRow: Math.min(e.startRow, e.endRow),
|
|
2641
2667
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -2643,10 +2669,10 @@ function Mt(e) {
|
|
|
2643
2669
|
endCol: Math.max(e.startCol, e.endCol)
|
|
2644
2670
|
};
|
|
2645
2671
|
}
|
|
2646
|
-
function
|
|
2672
|
+
function Pt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
2647
2673
|
let [o, c] = s(null), l = r(() => {
|
|
2648
2674
|
if (!a || !o) return;
|
|
2649
|
-
let { startRow: n, startCol: r, endRow: i, endCol: s } =
|
|
2675
|
+
let { startRow: n, startCol: r, endRow: i, endCol: s } = Nt(o), c = [];
|
|
2650
2676
|
for (let a = n; a <= i; a++) {
|
|
2651
2677
|
let n = e[a];
|
|
2652
2678
|
if (!n) continue;
|
|
@@ -2666,7 +2692,7 @@ function Nt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2666
2692
|
t
|
|
2667
2693
|
]), u = r(() => {
|
|
2668
2694
|
if (!a || !o || !n) return;
|
|
2669
|
-
let { startRow: r, startCol: i } =
|
|
2695
|
+
let { startRow: r, startCol: i } = Nt(o);
|
|
2670
2696
|
navigator.clipboard.readText().then((a) => {
|
|
2671
2697
|
let o = [], s = a.split("\n");
|
|
2672
2698
|
for (let n = 0; n < s.length; n++) {
|
|
@@ -2709,7 +2735,7 @@ function Nt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2709
2735
|
}
|
|
2710
2736
|
//#endregion
|
|
2711
2737
|
//#region src/useGradientColor.ts
|
|
2712
|
-
var
|
|
2738
|
+
var Ft = [
|
|
2713
2739
|
{
|
|
2714
2740
|
position: 0,
|
|
2715
2741
|
className: "bg-green-100"
|
|
@@ -2723,7 +2749,7 @@ var Pt = [
|
|
|
2723
2749
|
className: "bg-red-100"
|
|
2724
2750
|
}
|
|
2725
2751
|
];
|
|
2726
|
-
function
|
|
2752
|
+
function It(e, t) {
|
|
2727
2753
|
let n = Infinity, r = -Infinity;
|
|
2728
2754
|
for (let i of e) {
|
|
2729
2755
|
let e = Number(i[t]);
|
|
@@ -2731,7 +2757,7 @@ function Ft(e, t) {
|
|
|
2731
2757
|
}
|
|
2732
2758
|
return Number.isFinite(n) ? [n, r] : [0, 0];
|
|
2733
2759
|
}
|
|
2734
|
-
function
|
|
2760
|
+
function Lt(e, t) {
|
|
2735
2761
|
if (t.length === 0) return "";
|
|
2736
2762
|
if (t.length === 1) return t[0].className;
|
|
2737
2763
|
let n = t[0], r = Math.abs(e - n.position);
|
|
@@ -2741,11 +2767,11 @@ function It(e, t) {
|
|
|
2741
2767
|
}
|
|
2742
2768
|
return n.className;
|
|
2743
2769
|
}
|
|
2744
|
-
function
|
|
2745
|
-
let { field: t, data: n, min: i, max: o, stops: s =
|
|
2770
|
+
function Rt(e) {
|
|
2771
|
+
let { field: t, data: n, min: i, max: o, stops: s = Ft } = e, [c, l] = a(() => It(n, t), [n, t]), u = i ?? c, d = o ?? l;
|
|
2746
2772
|
return r((e) => {
|
|
2747
2773
|
let n = Number(e[t]);
|
|
2748
|
-
if (Number.isFinite(n)) return d === u ? s.length > 0 ? s[0].className : void 0 :
|
|
2774
|
+
if (Number.isFinite(n)) return d === u ? s.length > 0 ? s[0].className : void 0 : Lt(Math.max(0, Math.min(1, (n - u) / (d - u))), s);
|
|
2749
2775
|
}, [
|
|
2750
2776
|
t,
|
|
2751
2777
|
u,
|
|
@@ -2755,8 +2781,8 @@ function Lt(e) {
|
|
|
2755
2781
|
}
|
|
2756
2782
|
//#endregion
|
|
2757
2783
|
//#region src/useGroupReorder.ts
|
|
2758
|
-
var
|
|
2759
|
-
function
|
|
2784
|
+
var zt = "text/x-group-key";
|
|
2785
|
+
function Bt({ groupKeys: e }) {
|
|
2760
2786
|
let [t, n] = s(e), [a, o] = s(null);
|
|
2761
2787
|
return i(() => {
|
|
2762
2788
|
n((t) => {
|
|
@@ -2775,14 +2801,14 @@ function zt({ groupKeys: e }) {
|
|
|
2775
2801
|
});
|
|
2776
2802
|
}, []),
|
|
2777
2803
|
onDragStart: r((e, t) => {
|
|
2778
|
-
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(
|
|
2804
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(zt, t), o(t);
|
|
2779
2805
|
}, []),
|
|
2780
2806
|
onDragOver: r((e) => {
|
|
2781
2807
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2782
2808
|
}, []),
|
|
2783
2809
|
onDrop: r((e, t) => {
|
|
2784
2810
|
e.preventDefault();
|
|
2785
|
-
let r = e.dataTransfer.getData(
|
|
2811
|
+
let r = e.dataTransfer.getData(zt);
|
|
2786
2812
|
!r || r === t || n((e) => {
|
|
2787
2813
|
let n = e.indexOf(r), i = e.indexOf(t);
|
|
2788
2814
|
if (n === -1 || i === -1) return e;
|
|
@@ -2798,7 +2824,7 @@ function zt({ groupKeys: e }) {
|
|
|
2798
2824
|
}
|
|
2799
2825
|
//#endregion
|
|
2800
2826
|
//#region src/FormulaBar.tsx
|
|
2801
|
-
function
|
|
2827
|
+
function Vt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, disabled: l = !1, className: u }) {
|
|
2802
2828
|
let [d, f] = s(!1), [p, m] = s(e), h = o(null);
|
|
2803
2829
|
i(() => {
|
|
2804
2830
|
d || m(e);
|
|
@@ -2818,15 +2844,15 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2818
2844
|
}, [e, a]), y = r((e) => {
|
|
2819
2845
|
e.key === "Enter" ? (e.preventDefault(), _()) : e.key === "Escape" && (e.preventDefault(), v());
|
|
2820
2846
|
}, [_, v]);
|
|
2821
|
-
return /* @__PURE__ */ (0,
|
|
2822
|
-
className:
|
|
2847
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2848
|
+
className: R("flex items-center gap-2 border-b border-border bg-muted/30 px-3 py-1.5", u),
|
|
2823
2849
|
children: [
|
|
2824
|
-
/* @__PURE__ */ (0,
|
|
2825
|
-
c && /* @__PURE__ */ (0,
|
|
2850
|
+
/* @__PURE__ */ (0, K.jsx)(Oe, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2851
|
+
c && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2826
2852
|
className: "min-w-[4rem] shrink-0 rounded bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
2827
2853
|
children: c
|
|
2828
2854
|
}),
|
|
2829
|
-
/* @__PURE__ */ (0,
|
|
2855
|
+
/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2830
2856
|
ref: h,
|
|
2831
2857
|
type: "text",
|
|
2832
2858
|
value: d ? p : e,
|
|
@@ -2835,22 +2861,22 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2835
2861
|
onClick: g,
|
|
2836
2862
|
onChange: (e) => m(e.target.value),
|
|
2837
2863
|
onKeyDown: y,
|
|
2838
|
-
className:
|
|
2864
|
+
className: R("flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground", d && "rounded ring-1 ring-ring px-1", l && "cursor-not-allowed opacity-50")
|
|
2839
2865
|
}),
|
|
2840
|
-
d && /* @__PURE__ */ (0,
|
|
2866
|
+
d && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2841
2867
|
className: "flex items-center gap-1",
|
|
2842
|
-
children: [/* @__PURE__ */ (0,
|
|
2868
|
+
children: [/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2843
2869
|
type: "button",
|
|
2844
2870
|
onClick: _,
|
|
2845
2871
|
className: "rounded p-0.5 text-green-600 hover:bg-green-100",
|
|
2846
2872
|
"aria-label": "Confirm",
|
|
2847
|
-
children: /* @__PURE__ */ (0,
|
|
2848
|
-
}), /* @__PURE__ */ (0,
|
|
2873
|
+
children: /* @__PURE__ */ (0, K.jsx)(z, { className: "h-4 w-4" })
|
|
2874
|
+
}), /* @__PURE__ */ (0, K.jsx)("button", {
|
|
2849
2875
|
type: "button",
|
|
2850
2876
|
onClick: v,
|
|
2851
2877
|
className: "rounded p-0.5 text-red-600 hover:bg-red-100",
|
|
2852
2878
|
"aria-label": "Cancel",
|
|
2853
|
-
children: /* @__PURE__ */ (0,
|
|
2879
|
+
children: /* @__PURE__ */ (0, K.jsx)(H, { className: "h-4 w-4" })
|
|
2854
2880
|
})]
|
|
2855
2881
|
})
|
|
2856
2882
|
]
|
|
@@ -2858,7 +2884,7 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2858
2884
|
}
|
|
2859
2885
|
//#endregion
|
|
2860
2886
|
//#region src/SplitPaneGrid.tsx
|
|
2861
|
-
function
|
|
2887
|
+
function Ht({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollableWidth: i = 200, left: a, right: c, className: l }) {
|
|
2862
2888
|
let u = o(null), [d, f] = s(e), p = o(!1), m = o(0), h = o(0), g = t ? e : d, _ = r((e) => {
|
|
2863
2889
|
e.preventDefault(), p.current = !0, m.current = e.clientX, h.current = g;
|
|
2864
2890
|
let r = (e) => {
|
|
@@ -2875,23 +2901,23 @@ function Vt({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2875
2901
|
i,
|
|
2876
2902
|
t
|
|
2877
2903
|
]);
|
|
2878
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2879
2905
|
ref: u,
|
|
2880
|
-
className:
|
|
2906
|
+
className: R("flex h-full w-full overflow-hidden", l),
|
|
2881
2907
|
children: [
|
|
2882
|
-
/* @__PURE__ */ (0,
|
|
2908
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2883
2909
|
className: "shrink-0 overflow-auto",
|
|
2884
2910
|
style: { width: g },
|
|
2885
2911
|
children: a
|
|
2886
2912
|
}),
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2913
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2888
2914
|
role: "separator",
|
|
2889
2915
|
"aria-orientation": "vertical",
|
|
2890
2916
|
onPointerDown: _,
|
|
2891
|
-
className:
|
|
2892
|
-
children: /* @__PURE__ */ (0,
|
|
2917
|
+
className: R("flex w-2 cursor-col-resize items-center justify-center", "border-x border-border bg-muted/50 hover:bg-muted", "transition-colors"),
|
|
2918
|
+
children: /* @__PURE__ */ (0, K.jsx)(ke, { className: "h-4 w-4 text-muted-foreground" })
|
|
2893
2919
|
}),
|
|
2894
|
-
/* @__PURE__ */ (0,
|
|
2920
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2895
2921
|
className: "min-w-0 flex-1 overflow-auto",
|
|
2896
2922
|
children: c
|
|
2897
2923
|
})
|
|
@@ -2900,15 +2926,15 @@ function Vt({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2900
2926
|
}
|
|
2901
2927
|
//#endregion
|
|
2902
2928
|
//#region src/index.tsx
|
|
2903
|
-
var
|
|
2929
|
+
var Ut = ({ schema: e, ...t }) => {
|
|
2904
2930
|
let { dataSource: n } = _() || {};
|
|
2905
|
-
return /* @__PURE__ */ (0,
|
|
2931
|
+
return /* @__PURE__ */ (0, K.jsx)(ot, {
|
|
2906
2932
|
schema: e,
|
|
2907
2933
|
dataSource: n,
|
|
2908
2934
|
...t
|
|
2909
2935
|
});
|
|
2910
2936
|
};
|
|
2911
|
-
c.register("object-grid",
|
|
2937
|
+
c.register("object-grid", Ut, {
|
|
2912
2938
|
namespace: "plugin-grid",
|
|
2913
2939
|
label: "Object Grid",
|
|
2914
2940
|
category: "plugin",
|
|
@@ -2930,7 +2956,7 @@ c.register("object-grid", Ht, {
|
|
|
2930
2956
|
label: "Filters"
|
|
2931
2957
|
}
|
|
2932
2958
|
]
|
|
2933
|
-
}), c.register("grid",
|
|
2959
|
+
}), c.register("grid", Ut, {
|
|
2934
2960
|
namespace: "view",
|
|
2935
2961
|
label: "Data Grid",
|
|
2936
2962
|
category: "view",
|
|
@@ -2954,7 +2980,7 @@ c.register("object-grid", Ht, {
|
|
|
2954
2980
|
]
|
|
2955
2981
|
}), c.register("import-wizard", ({ schema: e, ...t }) => {
|
|
2956
2982
|
let { dataSource: n } = _() || {};
|
|
2957
|
-
return /* @__PURE__ */ (0,
|
|
2983
|
+
return /* @__PURE__ */ (0, K.jsx)(jt, {
|
|
2958
2984
|
objectName: e.objectName,
|
|
2959
2985
|
objectLabel: e.objectLabel,
|
|
2960
2986
|
fields: e.fields ?? [],
|
|
@@ -2978,4 +3004,4 @@ c.register("object-grid", Ht, {
|
|
|
2978
3004
|
}]
|
|
2979
3005
|
});
|
|
2980
3006
|
//#endregion
|
|
2981
|
-
export {
|
|
3007
|
+
export { tt as BulkActionBar, Vt as FormulaBar, Je as GroupRow, jt as ImportWizard, Mt as InlineEditing, ot as ObjectGrid, Ut as ObjectGridRenderer, et as RowActionMenu, Ht as SplitPaneGrid, St as VirtualGrid, $e as formatActionLabel, Pt as useCellClipboard, Qe as useColumnSummary, Rt as useGradientColor, Bt as useGroupReorder, qe as useGroupedData, He as useRowColor };
|