@object-ui/plugin-grid 3.3.0 → 3.3.2
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 +23 -0
- package/README.md +21 -1
- package/dist/index.js +631 -599
- package/dist/index.umd.cjs +8 -8
- package/package.json +44 -12
- 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 -1598
- 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 -58
- package/vitest.config.ts +0 -13
- package/vitest.setup.ts +0 -1
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;
|
|
@@ -62,7 +62,7 @@ function Pe(e) {
|
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region ../../node_modules/.pnpm/react@19.2.5/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
65
|
-
var
|
|
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
|
|
553
|
+
function rt(e) {
|
|
554
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,
|
|
642
643
|
fields: {}
|
|
643
644
|
};
|
|
644
|
-
else if (
|
|
645
|
+
else if (i && H) r = {
|
|
646
|
+
name: H,
|
|
647
|
+
fields: {}
|
|
648
|
+
};
|
|
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,65 +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) => /* @__PURE__ */ (0,
|
|
856
|
+
s = r.link && r.action || f && r.action || p ? (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
852
857
|
type: "button",
|
|
853
858
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
854
859
|
"data-testid": f ? "primary-field-link" : "link-cell",
|
|
855
860
|
onClick: (e) => {
|
|
856
|
-
e.stopPropagation(),
|
|
861
|
+
e.stopPropagation(), q.handleClick(t);
|
|
857
862
|
},
|
|
858
|
-
children: u ? /* @__PURE__ */ (0,
|
|
863
|
+
children: u ? /* @__PURE__ */ (0, K.jsx)(u, {
|
|
859
864
|
value: e,
|
|
860
865
|
field: d
|
|
861
|
-
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
866
|
+
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
862
867
|
className: "text-muted-foreground/50 text-xs italic",
|
|
863
868
|
children: "—"
|
|
864
869
|
})
|
|
865
|
-
}) : r.action ? (e, t) => /* @__PURE__ */ (0,
|
|
870
|
+
}) : r.action ? (e, t) => /* @__PURE__ */ (0, K.jsx)(T, {
|
|
866
871
|
variant: "outline",
|
|
867
872
|
size: "sm",
|
|
868
873
|
className: "h-7 text-xs",
|
|
869
874
|
"data-testid": "action-cell",
|
|
870
875
|
onClick: (n) => {
|
|
871
|
-
n.stopPropagation(),
|
|
876
|
+
n.stopPropagation(), J({
|
|
872
877
|
type: r.action,
|
|
873
878
|
params: {
|
|
874
879
|
record: t,
|
|
@@ -877,28 +882,25 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
877
882
|
}
|
|
878
883
|
});
|
|
879
884
|
},
|
|
880
|
-
children:
|
|
881
|
-
}) : u ? (e) => /* @__PURE__ */ (0,
|
|
885
|
+
children: $e(r.action)
|
|
886
|
+
}) : u ? (e) => /* @__PURE__ */ (0, K.jsx)(u, {
|
|
882
887
|
value: e,
|
|
883
888
|
field: d
|
|
884
|
-
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0,
|
|
885
|
-
className: "text-muted-foreground/50 text-xs italic",
|
|
886
|
-
children: "—"
|
|
887
|
-
});
|
|
889
|
+
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0, K.jsx)("span", { children: String(e) }) : /* @__PURE__ */ (0, K.jsx)(ae, {});
|
|
888
890
|
let m = r.prefix;
|
|
889
891
|
if (m?.field) {
|
|
890
892
|
let e = s, t = m.type === "badge" ? S("select") : null;
|
|
891
893
|
s = (n, r) => {
|
|
892
894
|
let i = r[m.field];
|
|
893
|
-
return /* @__PURE__ */ (0,
|
|
895
|
+
return /* @__PURE__ */ (0, K.jsxs)("span", {
|
|
894
896
|
className: "flex items-center gap-1.5",
|
|
895
|
-
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0,
|
|
897
|
+
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0, K.jsx)(t, {
|
|
896
898
|
value: i,
|
|
897
899
|
field: {
|
|
898
900
|
name: m.field,
|
|
899
901
|
type: "select"
|
|
900
902
|
}
|
|
901
|
-
}) : /* @__PURE__ */ (0,
|
|
903
|
+
}) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
902
904
|
className: "text-muted-foreground text-xs mr-1.5",
|
|
903
905
|
children: String(i)
|
|
904
906
|
}) : null, e(n, r)]
|
|
@@ -913,7 +915,7 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
913
915
|
return {
|
|
914
916
|
header: o,
|
|
915
917
|
accessorKey: r.field,
|
|
916
|
-
headerIcon: t(l),
|
|
918
|
+
...e.showColumnTypeIcons && { headerIcon: t(l) },
|
|
917
919
|
...!v && { className: "hidden sm:table-cell" },
|
|
918
920
|
...r.width && { width: r.width },
|
|
919
921
|
..._ && { align: _ },
|
|
@@ -926,11 +928,11 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
926
928
|
});
|
|
927
929
|
}
|
|
928
930
|
return r.filter((e) => typeof e == "string" && e.trim().length > 0).map((r, i) => {
|
|
929
|
-
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 = {
|
|
930
932
|
name: r,
|
|
931
933
|
type: c || "text"
|
|
932
934
|
};
|
|
933
|
-
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) => ({
|
|
934
936
|
value: e,
|
|
935
937
|
label: C(String(e))
|
|
936
938
|
})));
|
|
@@ -939,103 +941,130 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
939
941
|
"currency",
|
|
940
942
|
"percent"
|
|
941
943
|
].includes(c) ? "right" : void 0, f = i === 0, p;
|
|
942
|
-
return f && l ? p = (e, t) => /* @__PURE__ */ (0,
|
|
944
|
+
return f && l ? p = (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
943
945
|
type: "button",
|
|
944
946
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
945
947
|
"data-testid": "primary-field-link",
|
|
946
948
|
onClick: (e) => {
|
|
947
|
-
e.stopPropagation(),
|
|
949
|
+
e.stopPropagation(), q.handleClick(t);
|
|
948
950
|
},
|
|
949
|
-
children: /* @__PURE__ */ (0,
|
|
951
|
+
children: /* @__PURE__ */ (0, K.jsx)(l, {
|
|
950
952
|
value: e,
|
|
951
953
|
field: u
|
|
952
954
|
})
|
|
953
|
-
}) : f ? p = (e, t) => /* @__PURE__ */ (0,
|
|
955
|
+
}) : f ? p = (e, t) => /* @__PURE__ */ (0, K.jsx)("button", {
|
|
954
956
|
type: "button",
|
|
955
957
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
956
958
|
"data-testid": "primary-field-link",
|
|
957
959
|
onClick: (e) => {
|
|
958
|
-
e.stopPropagation(),
|
|
960
|
+
e.stopPropagation(), q.handleClick(t);
|
|
959
961
|
},
|
|
960
|
-
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
962
|
+
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
961
963
|
className: "text-muted-foreground/50 text-xs italic",
|
|
962
964
|
children: "—"
|
|
963
965
|
})
|
|
964
|
-
}) : l && (p = (e) => /* @__PURE__ */ (0,
|
|
966
|
+
}) : l && (p = (e) => /* @__PURE__ */ (0, K.jsx)(l, {
|
|
965
967
|
value: e,
|
|
966
968
|
field: u
|
|
967
969
|
})), {
|
|
968
970
|
header: s,
|
|
969
971
|
accessorKey: r,
|
|
970
|
-
...c && { headerIcon: t(c) },
|
|
972
|
+
...e.showColumnTypeIcons && c && { headerIcon: t(c) },
|
|
971
973
|
...d && { align: d },
|
|
972
974
|
...p && { cell: p },
|
|
973
975
|
sortable: a?.sortable !== !1
|
|
974
976
|
};
|
|
975
977
|
});
|
|
976
978
|
}
|
|
977
|
-
if (
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
let
|
|
981
|
-
name:
|
|
982
|
-
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"
|
|
983
985
|
};
|
|
984
|
-
|
|
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) => ({
|
|
985
987
|
value: e,
|
|
986
988
|
label: C(String(e))
|
|
987
989
|
})));
|
|
988
|
-
let
|
|
990
|
+
let l = a && [
|
|
989
991
|
"number",
|
|
990
992
|
"currency",
|
|
991
993
|
"percent"
|
|
992
|
-
].includes(
|
|
994
|
+
].includes(a) ? "right" : void 0;
|
|
993
995
|
return {
|
|
994
|
-
header:
|
|
995
|
-
accessorKey:
|
|
996
|
-
...
|
|
997
|
-
...
|
|
998
|
-
...
|
|
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, {
|
|
999
1001
|
value: e,
|
|
1000
|
-
field:
|
|
1002
|
+
field: c
|
|
1001
1003
|
}) },
|
|
1002
|
-
sortable:
|
|
1004
|
+
sortable: i?.sortable !== !1
|
|
1003
1005
|
};
|
|
1004
1006
|
});
|
|
1005
1007
|
}
|
|
1006
1008
|
if (!P) return [];
|
|
1007
|
-
let i = []
|
|
1008
|
-
|
|
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) => {
|
|
1009
1034
|
let n = P.fields?.[t];
|
|
1010
1035
|
if (!n || n.permissions && n.permissions.read === !1) return;
|
|
1011
|
-
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;
|
|
1012
1044
|
i.push({
|
|
1013
|
-
header: e.objectName ?
|
|
1045
|
+
header: e.objectName ? le(e.objectName, t, n.label || t) : n.label || t,
|
|
1014
1046
|
accessorKey: t,
|
|
1015
|
-
...
|
|
1016
|
-
|
|
1017
|
-
"currency",
|
|
1018
|
-
"percent"
|
|
1019
|
-
].includes(n.type) && { align: "right" },
|
|
1020
|
-
cell: (e) => /* @__PURE__ */ (0, Y.jsx)(r, {
|
|
1047
|
+
...a.includes(n.type) && { align: "right" },
|
|
1048
|
+
cell: (e) => /* @__PURE__ */ (0, K.jsx)(r, {
|
|
1021
1049
|
value: e,
|
|
1022
|
-
field:
|
|
1050
|
+
field: o
|
|
1023
1051
|
}),
|
|
1024
1052
|
sortable: n.sortable !== !1
|
|
1025
1053
|
});
|
|
1026
1054
|
}), i;
|
|
1027
1055
|
}, [
|
|
1028
1056
|
P,
|
|
1029
|
-
G,
|
|
1030
|
-
K,
|
|
1031
|
-
H,
|
|
1032
1057
|
U,
|
|
1033
|
-
|
|
1034
|
-
|
|
1058
|
+
W,
|
|
1059
|
+
B,
|
|
1060
|
+
V,
|
|
1061
|
+
q.handleClick,
|
|
1062
|
+
J,
|
|
1035
1063
|
E,
|
|
1064
|
+
le,
|
|
1036
1065
|
N,
|
|
1037
1066
|
e.objectName
|
|
1038
|
-
]),
|
|
1067
|
+
]), ot = r((t) => {
|
|
1039
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) => {
|
|
1040
1069
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1041
1070
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
@@ -1044,101 +1073,101 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1044
1073
|
return t.includes(",") || t.includes("\"") || t.includes("\n") || t.includes("\r") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1045
1074
|
};
|
|
1046
1075
|
if (t === "csv") {
|
|
1047
|
-
let e =
|
|
1076
|
+
let e = Y().filter((e) => e.accessorKey !== "_actions"), t = e.map((e) => e.accessorKey), n = e.map((e) => e.header), r = [];
|
|
1048
1077
|
i && r.push(n.join(",")), o.forEach((e) => {
|
|
1049
1078
|
r.push(t.map((t) => c(e[t])).join(","));
|
|
1050
1079
|
}), s(new Blob([r.join("\n")], { type: "text/csv;charset=utf-8;" }), `${a}.csv`);
|
|
1051
1080
|
} else t === "json" && s(new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), `${a}.json`);
|
|
1052
|
-
|
|
1081
|
+
me(!1);
|
|
1053
1082
|
}, [
|
|
1054
1083
|
E,
|
|
1055
1084
|
e.exportOptions,
|
|
1056
1085
|
e.objectName,
|
|
1057
|
-
|
|
1086
|
+
Y
|
|
1058
1087
|
]);
|
|
1059
|
-
if (k) return /* @__PURE__ */ (0,
|
|
1088
|
+
if (k) return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1060
1089
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1061
|
-
children: [/* @__PURE__ */ (0,
|
|
1090
|
+
children: [/* @__PURE__ */ (0, K.jsx)("h3", {
|
|
1062
1091
|
className: "text-red-800 font-semibold",
|
|
1063
1092
|
children: M("grid.errorLoading")
|
|
1064
|
-
}), /* @__PURE__ */ (0,
|
|
1093
|
+
}), /* @__PURE__ */ (0, K.jsx)("p", {
|
|
1065
1094
|
className: "text-red-600 text-sm mt-1",
|
|
1066
1095
|
children: k.message
|
|
1067
1096
|
})]
|
|
1068
1097
|
});
|
|
1069
|
-
if (D && E.length === 0) return
|
|
1098
|
+
if (D && E.length === 0) return de ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1070
1099
|
className: "space-y-2 p-2",
|
|
1071
1100
|
children: [
|
|
1072
1101
|
1,
|
|
1073
1102
|
2,
|
|
1074
1103
|
3
|
|
1075
|
-
].map((e) => /* @__PURE__ */ (0,
|
|
1104
|
+
].map((e) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1076
1105
|
className: "border rounded-lg p-3 bg-card animate-pulse",
|
|
1077
1106
|
children: [
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__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", {
|
|
1080
1109
|
className: "flex items-center justify-between mb-2",
|
|
1081
|
-
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" })]
|
|
1082
1111
|
}),
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, K.jsx)("div", { className: "h-3 bg-muted rounded w-1/3" })
|
|
1084
1113
|
]
|
|
1085
1114
|
}, e))
|
|
1086
|
-
}) : /* @__PURE__ */ (0,
|
|
1115
|
+
}) : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1087
1116
|
className: "p-4 sm:p-8 text-center",
|
|
1088
|
-
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", {
|
|
1089
1118
|
className: "mt-2 text-sm text-muted-foreground",
|
|
1090
1119
|
children: M("grid.loading")
|
|
1091
1120
|
})]
|
|
1092
1121
|
});
|
|
1093
|
-
let
|
|
1094
|
-
if (
|
|
1095
|
-
let t =
|
|
1122
|
+
let X = [...Y()];
|
|
1123
|
+
if (z.widths && (X = X.map((e) => {
|
|
1124
|
+
let t = z.widths?.[e.accessorKey];
|
|
1096
1125
|
return t ? {
|
|
1097
1126
|
...e,
|
|
1098
1127
|
size: t
|
|
1099
1128
|
} : e;
|
|
1100
|
-
})),
|
|
1101
|
-
let e = new Map(
|
|
1102
|
-
|
|
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));
|
|
1103
1132
|
}
|
|
1104
|
-
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, {
|
|
1105
1134
|
header: M("grid.actions"),
|
|
1106
1135
|
accessorKey: "_actions",
|
|
1107
|
-
cell: (t, n) => /* @__PURE__ */ (0,
|
|
1136
|
+
cell: (t, n) => /* @__PURE__ */ (0, K.jsx)(et, {
|
|
1108
1137
|
row: n,
|
|
1109
1138
|
rowActions: e.rowActions,
|
|
1110
|
-
canEdit: !!(
|
|
1111
|
-
canDelete: !!(
|
|
1139
|
+
canEdit: !!(Z?.update && a),
|
|
1140
|
+
canDelete: !!(Z?.delete && o),
|
|
1112
1141
|
onEdit: a,
|
|
1113
1142
|
onDelete: o,
|
|
1114
|
-
onAction: (e, t) =>
|
|
1143
|
+
onAction: (e, t) => J({
|
|
1115
1144
|
type: e,
|
|
1116
1145
|
params: { record: t }
|
|
1117
1146
|
})
|
|
1118
1147
|
}),
|
|
1119
1148
|
sortable: !1
|
|
1120
|
-
}] :
|
|
1121
|
-
...
|
|
1122
|
-
...
|
|
1123
|
-
...
|
|
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) => ({
|
|
1124
1153
|
...e,
|
|
1125
|
-
className: [e.className,
|
|
1126
|
-
cellClassName: [e.cellClassName,
|
|
1154
|
+
className: [e.className, pt].filter(Boolean).join(" "),
|
|
1155
|
+
cellClassName: [e.cellClassName, pt].filter(Boolean).join(" ")
|
|
1127
1156
|
}))
|
|
1128
|
-
] :
|
|
1129
|
-
e.selection?.type ?
|
|
1130
|
-
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 = {
|
|
1131
1160
|
type: "data-table",
|
|
1132
1161
|
caption: e.label || e.title,
|
|
1133
|
-
columns:
|
|
1162
|
+
columns: mt,
|
|
1134
1163
|
data: E,
|
|
1135
|
-
pagination:
|
|
1136
|
-
pageSize:
|
|
1137
|
-
searchable:
|
|
1138
|
-
selectable:
|
|
1164
|
+
pagination: vt,
|
|
1165
|
+
pageSize: yt,
|
|
1166
|
+
searchable: bt,
|
|
1167
|
+
selectable: $,
|
|
1139
1168
|
sortable: !0,
|
|
1140
|
-
exportable:
|
|
1141
|
-
rowActions: !!(e.editable &&
|
|
1169
|
+
exportable: Z?.export,
|
|
1170
|
+
rowActions: !!(e.editable && st),
|
|
1142
1171
|
resizableColumns: e.resizable ?? e.resizableColumns ?? !0,
|
|
1143
1172
|
reorderableColumns: e.reorderableColumns ?? !1,
|
|
1144
1173
|
editable: e.editable ?? !1,
|
|
@@ -1146,42 +1175,42 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1146
1175
|
className: e.className,
|
|
1147
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",
|
|
1148
1177
|
showRowNumbers: !0,
|
|
1149
|
-
showAddRow:
|
|
1178
|
+
showAddRow: !!Z?.create,
|
|
1150
1179
|
onAddRecord: ne,
|
|
1151
|
-
rowClassName: e.rowColor ? (e, t) =>
|
|
1152
|
-
rowStyle: e.conditionalFormatting?.length ? (e, t) =>
|
|
1153
|
-
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,
|
|
1154
1183
|
onSelectionChange: (e) => {
|
|
1155
|
-
|
|
1184
|
+
_e(e), c?.(e);
|
|
1156
1185
|
},
|
|
1157
|
-
onRowClick:
|
|
1186
|
+
onRowClick: q.handleClick,
|
|
1158
1187
|
onCellChange: _,
|
|
1159
1188
|
onRowSave: ee,
|
|
1160
1189
|
onBatchSave: te,
|
|
1161
1190
|
onColumnResize: (e, t) => {
|
|
1162
|
-
|
|
1163
|
-
...
|
|
1191
|
+
Se({
|
|
1192
|
+
...z,
|
|
1164
1193
|
widths: {
|
|
1165
|
-
...
|
|
1194
|
+
...z.widths,
|
|
1166
1195
|
[e]: t
|
|
1167
1196
|
}
|
|
1168
1197
|
});
|
|
1169
1198
|
},
|
|
1170
1199
|
onColumnReorder: (e) => {
|
|
1171
|
-
|
|
1172
|
-
...
|
|
1200
|
+
Se({
|
|
1201
|
+
...z,
|
|
1173
1202
|
order: e
|
|
1174
1203
|
});
|
|
1175
1204
|
}
|
|
1176
|
-
},
|
|
1177
|
-
...
|
|
1205
|
+
}, St = (e) => ({
|
|
1206
|
+
...xt,
|
|
1178
1207
|
caption: void 0,
|
|
1179
1208
|
data: e,
|
|
1180
1209
|
pagination: !1,
|
|
1181
1210
|
searchable: !1
|
|
1182
|
-
}),
|
|
1183
|
-
if (
|
|
1184
|
-
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();
|
|
1185
1214
|
e.forEach((e) => t.set(e.accessorKey, e));
|
|
1186
1215
|
let n = e[0], r = [
|
|
1187
1216
|
"amount",
|
|
@@ -1225,57 +1254,57 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1225
1254
|
let t = e.toLowerCase();
|
|
1226
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";
|
|
1227
1256
|
};
|
|
1228
|
-
return /* @__PURE__ */ (0,
|
|
1257
|
+
return /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1229
1258
|
className: "space-y-2 p-2",
|
|
1230
1259
|
children: E.map((t, r) => {
|
|
1231
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) : "";
|
|
1232
|
-
return /* @__PURE__ */ (0,
|
|
1261
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1233
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(" "),
|
|
1234
|
-
onClick: () =>
|
|
1263
|
+
onClick: () => q.handleClick(t),
|
|
1235
1264
|
children: [
|
|
1236
|
-
n && /* @__PURE__ */ (0,
|
|
1265
|
+
n && /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1237
1266
|
className: "font-semibold text-sm truncate mb-1",
|
|
1238
1267
|
children: t[n.accessorKey] != null && typeof t[n.accessorKey] == "object" ? String(t[n.accessorKey]) : t[n.accessorKey] ?? "—"
|
|
1239
1268
|
}),
|
|
1240
|
-
(a || o) && /* @__PURE__ */ (0,
|
|
1269
|
+
(a || o) && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1241
1270
|
className: "flex items-center justify-between gap-2 mb-1",
|
|
1242
|
-
children: [a && /* @__PURE__ */ (0,
|
|
1271
|
+
children: [a && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1243
1272
|
className: "text-sm tabular-nums font-medium",
|
|
1244
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] ?? "—"
|
|
1245
|
-
}), o && t[o.accessorKey] && /* @__PURE__ */ (0,
|
|
1274
|
+
}), o && t[o.accessorKey] && /* @__PURE__ */ (0, K.jsx)(w, {
|
|
1246
1275
|
variant: "outline",
|
|
1247
1276
|
className: `text-xs shrink-0 max-w-[140px] truncate ${s(String(t[o.accessorKey]))}`,
|
|
1248
1277
|
children: String(t[o.accessorKey])
|
|
1249
1278
|
})]
|
|
1250
1279
|
}),
|
|
1251
|
-
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0,
|
|
1280
|
+
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1252
1281
|
className: "flex items-center justify-between py-0.5 text-xs text-muted-foreground",
|
|
1253
|
-
children: [u[0] && /* @__PURE__ */ (0,
|
|
1282
|
+
children: [u[0] && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1254
1283
|
className: "tabular-nums",
|
|
1255
1284
|
children: t[u[0].accessorKey] ? b(t[u[0].accessorKey], "short") : "—"
|
|
1256
|
-
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0,
|
|
1285
|
+
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1257
1286
|
className: "tabular-nums",
|
|
1258
1287
|
children: x(Number(t[d[0].accessorKey]))
|
|
1259
1288
|
})]
|
|
1260
1289
|
}),
|
|
1261
|
-
u.slice(1).map((e) => /* @__PURE__ */ (0,
|
|
1290
|
+
u.slice(1).map((e) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1262
1291
|
className: "flex justify-between items-center py-0.5",
|
|
1263
|
-
children: [/* @__PURE__ */ (0,
|
|
1292
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1264
1293
|
className: "text-xs text-muted-foreground",
|
|
1265
1294
|
children: e.header
|
|
1266
|
-
}), /* @__PURE__ */ (0,
|
|
1295
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1267
1296
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
1268
1297
|
children: t[e.accessorKey] ? b(t[e.accessorKey], "short") : "—"
|
|
1269
1298
|
})]
|
|
1270
1299
|
}, e.accessorKey)),
|
|
1271
1300
|
f.map((e) => {
|
|
1272
1301
|
let n = t[e.accessorKey];
|
|
1273
|
-
return n == null || n === "" ? null : /* @__PURE__ */ (0,
|
|
1302
|
+
return n == null || n === "" ? null : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1274
1303
|
className: "flex justify-between items-center py-0.5",
|
|
1275
|
-
children: [/* @__PURE__ */ (0,
|
|
1304
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1276
1305
|
className: "text-xs text-muted-foreground",
|
|
1277
1306
|
children: e.header
|
|
1278
|
-
}), /* @__PURE__ */ (0,
|
|
1307
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1279
1308
|
className: "text-xs font-medium truncate ml-2 text-right",
|
|
1280
1309
|
children: e.cell ? e.cell(n, t) : String(n)
|
|
1281
1310
|
})]
|
|
@@ -1284,17 +1313,17 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1284
1313
|
]
|
|
1285
1314
|
}, t.id || t._id || r);
|
|
1286
1315
|
})
|
|
1287
|
-
}),
|
|
1288
|
-
...
|
|
1289
|
-
title:
|
|
1290
|
-
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", {
|
|
1291
1320
|
className: "space-y-3",
|
|
1292
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0,
|
|
1321
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1293
1322
|
className: "flex flex-col",
|
|
1294
|
-
children: [/* @__PURE__ */ (0,
|
|
1323
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1295
1324
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1296
1325
|
children: e.replace(/_/g, " ")
|
|
1297
|
-
}), /* @__PURE__ */ (0,
|
|
1326
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1298
1327
|
className: "text-sm",
|
|
1299
1328
|
children: String(t ?? "—")
|
|
1300
1329
|
})]
|
|
@@ -1302,56 +1331,56 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1302
1331
|
})
|
|
1303
1332
|
})] });
|
|
1304
1333
|
}
|
|
1305
|
-
let
|
|
1334
|
+
let wt = () => {
|
|
1306
1335
|
R((e) => e === "compact" ? "short" : e === "short" ? "medium" : e === "medium" ? "tall" : e === "tall" ? "extra_tall" : "compact");
|
|
1307
|
-
},
|
|
1308
|
-
compact:
|
|
1309
|
-
short:
|
|
1310
|
-
medium:
|
|
1311
|
-
tall:
|
|
1312
|
-
extra_tall:
|
|
1313
|
-
}[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", {
|
|
1314
1343
|
className: "flex items-center justify-end gap-1 px-2 py-1",
|
|
1315
|
-
children: [
|
|
1344
|
+
children: [Et && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1316
1345
|
variant: "ghost",
|
|
1317
1346
|
size: "sm",
|
|
1318
1347
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1319
|
-
onClick:
|
|
1348
|
+
onClick: wt,
|
|
1320
1349
|
title: `Row height: ${L}`,
|
|
1321
|
-
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", {
|
|
1322
1351
|
className: "hidden sm:inline capitalize",
|
|
1323
1352
|
children: L
|
|
1324
1353
|
})]
|
|
1325
|
-
}), e.exportOptions && /* @__PURE__ */ (0,
|
|
1326
|
-
open:
|
|
1327
|
-
onOpenChange:
|
|
1328
|
-
children: [/* @__PURE__ */ (0,
|
|
1354
|
+
}), e.exportOptions && /* @__PURE__ */ (0, K.jsxs)(oe, {
|
|
1355
|
+
open: I,
|
|
1356
|
+
onOpenChange: me,
|
|
1357
|
+
children: [/* @__PURE__ */ (0, K.jsx)(ce, {
|
|
1329
1358
|
asChild: !0,
|
|
1330
|
-
children: /* @__PURE__ */ (0,
|
|
1359
|
+
children: /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1331
1360
|
variant: "ghost",
|
|
1332
1361
|
size: "sm",
|
|
1333
1362
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1334
|
-
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", {
|
|
1335
1364
|
className: "hidden sm:inline",
|
|
1336
1365
|
children: M("grid.export")
|
|
1337
1366
|
})]
|
|
1338
1367
|
})
|
|
1339
|
-
}), /* @__PURE__ */ (0,
|
|
1368
|
+
}), /* @__PURE__ */ (0, K.jsx)(se, {
|
|
1340
1369
|
align: "end",
|
|
1341
1370
|
className: "w-48 p-2",
|
|
1342
|
-
children: /* @__PURE__ */ (0,
|
|
1371
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1343
1372
|
className: "space-y-1",
|
|
1344
|
-
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0,
|
|
1373
|
+
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
1345
1374
|
variant: "ghost",
|
|
1346
1375
|
size: "sm",
|
|
1347
1376
|
className: "w-full justify-start h-8 text-xs",
|
|
1348
|
-
onClick: () =>
|
|
1349
|
-
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() })]
|
|
1350
1379
|
}, e))
|
|
1351
1380
|
})
|
|
1352
1381
|
})]
|
|
1353
1382
|
})]
|
|
1354
|
-
}) : null,
|
|
1383
|
+
}) : null, Ot = (e) => {
|
|
1355
1384
|
let t = [
|
|
1356
1385
|
"_id",
|
|
1357
1386
|
"id",
|
|
@@ -1360,22 +1389,22 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1360
1389
|
"created_by",
|
|
1361
1390
|
"updated_by"
|
|
1362
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) => {
|
|
1363
|
-
if (t == null || t === "") return /* @__PURE__ */ (0,
|
|
1392
|
+
if (t == null || t === "") return /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1364
1393
|
className: "text-muted-foreground/50 text-sm italic",
|
|
1365
1394
|
children: "Empty"
|
|
1366
1395
|
});
|
|
1367
1396
|
let n = P?.fields?.[e];
|
|
1368
1397
|
if (n?.type) {
|
|
1369
1398
|
let e = S(n.type);
|
|
1370
|
-
if (e) return /* @__PURE__ */ (0,
|
|
1399
|
+
if (e) return /* @__PURE__ */ (0, K.jsx)(e, {
|
|
1371
1400
|
value: t,
|
|
1372
1401
|
field: n
|
|
1373
1402
|
});
|
|
1374
1403
|
}
|
|
1375
|
-
return typeof t == "boolean" ? /* @__PURE__ */ (0,
|
|
1404
|
+
return typeof t == "boolean" ? /* @__PURE__ */ (0, K.jsx)(w, {
|
|
1376
1405
|
variant: t ? "default" : "outline",
|
|
1377
1406
|
children: t ? "Yes" : "No"
|
|
1378
|
-
}) : 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", {
|
|
1379
1408
|
className: "text-sm tabular-nums",
|
|
1380
1409
|
children: b(t)
|
|
1381
1410
|
}) : typeof t == "number" && [
|
|
@@ -1387,48 +1416,48 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1387
1416
|
"value",
|
|
1388
1417
|
"budget",
|
|
1389
1418
|
"salary"
|
|
1390
|
-
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0,
|
|
1419
|
+
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1391
1420
|
className: "text-sm tabular-nums font-medium",
|
|
1392
1421
|
children: y(t)
|
|
1393
|
-
}) : /* @__PURE__ */ (0,
|
|
1422
|
+
}) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1394
1423
|
className: "text-sm break-words",
|
|
1395
1424
|
children: String(t)
|
|
1396
1425
|
});
|
|
1397
1426
|
};
|
|
1398
|
-
return /* @__PURE__ */ (0,
|
|
1427
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1399
1428
|
className: "space-y-4",
|
|
1400
1429
|
"data-testid": "record-detail-panel",
|
|
1401
|
-
children: [/* @__PURE__ */ (0,
|
|
1430
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1402
1431
|
className: "rounded-lg border bg-card",
|
|
1403
|
-
children: /* @__PURE__ */ (0,
|
|
1432
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1404
1433
|
className: "divide-y",
|
|
1405
|
-
children: r.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1434
|
+
children: r.map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1406
1435
|
className: "flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-4 px-4 py-3",
|
|
1407
|
-
children: [/* @__PURE__ */ (0,
|
|
1436
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1408
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",
|
|
1409
1438
|
children: a(e)
|
|
1410
|
-
}), /* @__PURE__ */ (0,
|
|
1439
|
+
}), /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1411
1440
|
className: "flex-1 min-w-0",
|
|
1412
1441
|
children: o(e, t)
|
|
1413
1442
|
})]
|
|
1414
1443
|
}, e))
|
|
1415
1444
|
})
|
|
1416
|
-
}), i.length > 0 && /* @__PURE__ */ (0,
|
|
1445
|
+
}), i.length > 0 && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1417
1446
|
className: "rounded-lg border bg-muted/30",
|
|
1418
|
-
children: [/* @__PURE__ */ (0,
|
|
1447
|
+
children: [/* @__PURE__ */ (0, K.jsx)("div", {
|
|
1419
1448
|
className: "px-4 py-2 border-b",
|
|
1420
|
-
children: /* @__PURE__ */ (0,
|
|
1449
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1421
1450
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1422
1451
|
children: "System"
|
|
1423
1452
|
})
|
|
1424
|
-
}), /* @__PURE__ */ (0,
|
|
1453
|
+
}), /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1425
1454
|
className: "divide-y divide-border/50",
|
|
1426
|
-
children: i.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1455
|
+
children: i.map(([e, t]) => /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1427
1456
|
className: "flex items-center gap-4 px-4 py-2",
|
|
1428
|
-
children: [/* @__PURE__ */ (0,
|
|
1457
|
+
children: [/* @__PURE__ */ (0, K.jsx)("span", {
|
|
1429
1458
|
className: "text-xs text-muted-foreground w-1/3 text-right shrink-0",
|
|
1430
1459
|
children: a(e)
|
|
1431
|
-
}), /* @__PURE__ */ (0,
|
|
1460
|
+
}), /* @__PURE__ */ (0, K.jsx)("span", {
|
|
1432
1461
|
className: "text-xs text-muted-foreground flex-1 min-w-0 break-words",
|
|
1433
1462
|
children: String(t ?? "")
|
|
1434
1463
|
})]
|
|
@@ -1436,14 +1465,14 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1436
1465
|
})]
|
|
1437
1466
|
})]
|
|
1438
1467
|
});
|
|
1439
|
-
},
|
|
1468
|
+
}, kt = Ze ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1440
1469
|
className: "border-t bg-muted/30 px-2 py-1.5",
|
|
1441
1470
|
"data-testid": "column-summary-footer",
|
|
1442
|
-
children: /* @__PURE__ */ (0,
|
|
1471
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1443
1472
|
className: "flex gap-4 text-xs text-muted-foreground font-medium",
|
|
1444
|
-
children:
|
|
1445
|
-
let t =
|
|
1446
|
-
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", {
|
|
1447
1476
|
"data-testid": `summary-${e.accessorKey}`,
|
|
1448
1477
|
children: [
|
|
1449
1478
|
e.header,
|
|
@@ -1453,66 +1482,66 @@ var Q = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onR
|
|
|
1453
1482
|
}, e.accessorKey);
|
|
1454
1483
|
})
|
|
1455
1484
|
})
|
|
1456
|
-
}) : null,
|
|
1485
|
+
}) : null, At = Ke ? /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1457
1486
|
className: "space-y-2",
|
|
1458
|
-
children:
|
|
1487
|
+
children: Ge.map((e) => /* @__PURE__ */ (0, K.jsx)(Je, {
|
|
1459
1488
|
groupKey: e.key,
|
|
1460
1489
|
label: e.label,
|
|
1461
1490
|
count: e.rows.length,
|
|
1462
1491
|
collapsed: e.collapsed,
|
|
1463
1492
|
aggregations: e.aggregations,
|
|
1464
|
-
onToggle:
|
|
1465
|
-
children: /* @__PURE__ */ (0,
|
|
1493
|
+
onToggle: Ye,
|
|
1494
|
+
children: /* @__PURE__ */ (0, K.jsx)(d, { schema: St(e.rows) })
|
|
1466
1495
|
}, e.key))
|
|
1467
|
-
}) : /* @__PURE__ */ (0,
|
|
1468
|
-
return
|
|
1469
|
-
...
|
|
1470
|
-
title:
|
|
1471
|
-
mainContent: /* @__PURE__ */ (0,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
/* @__PURE__ */ (0,
|
|
1475
|
-
selectedRows:
|
|
1476
|
-
actions:
|
|
1477
|
-
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({
|
|
1478
1507
|
type: e,
|
|
1479
1508
|
params: { records: t }
|
|
1480
1509
|
}),
|
|
1481
|
-
onClearSelection: () =>
|
|
1510
|
+
onClearSelection: () => _e([])
|
|
1482
1511
|
})
|
|
1483
1512
|
] }),
|
|
1484
|
-
children: (e) =>
|
|
1485
|
-
}) : /* @__PURE__ */ (0,
|
|
1486
|
-
ref:
|
|
1513
|
+
children: (e) => Ot(e)
|
|
1514
|
+
}) : /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
1515
|
+
ref: Ce,
|
|
1487
1516
|
className: "relative h-full",
|
|
1488
1517
|
children: [
|
|
1489
|
-
|
|
1518
|
+
De > 0 && /* @__PURE__ */ (0, K.jsx)("div", {
|
|
1490
1519
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1491
|
-
style: { height:
|
|
1492
|
-
children: M(
|
|
1520
|
+
style: { height: De },
|
|
1521
|
+
children: M(Ee ? "grid.refreshing" : "grid.pullToRefresh")
|
|
1493
1522
|
}),
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
/* @__PURE__ */ (0,
|
|
1497
|
-
selectedRows:
|
|
1498
|
-
actions:
|
|
1499
|
-
onAction: (e, t) =>
|
|
1523
|
+
Dt,
|
|
1524
|
+
At,
|
|
1525
|
+
/* @__PURE__ */ (0, K.jsx)(tt, {
|
|
1526
|
+
selectedRows: he,
|
|
1527
|
+
actions: gt ?? [],
|
|
1528
|
+
onAction: (e, t) => J({
|
|
1500
1529
|
type: e,
|
|
1501
1530
|
params: { records: t }
|
|
1502
1531
|
}),
|
|
1503
|
-
onClearSelection: () =>
|
|
1532
|
+
onClearSelection: () => _e([])
|
|
1504
1533
|
}),
|
|
1505
|
-
|
|
1506
|
-
...
|
|
1507
|
-
title:
|
|
1508
|
-
children: (e) =>
|
|
1534
|
+
q.isOverlay && /* @__PURE__ */ (0, K.jsx)(j, {
|
|
1535
|
+
...q,
|
|
1536
|
+
title: Ct,
|
|
1537
|
+
children: (e) => Ot(e)
|
|
1509
1538
|
})
|
|
1510
1539
|
]
|
|
1511
1540
|
});
|
|
1512
1541
|
};
|
|
1513
1542
|
//#endregion
|
|
1514
|
-
//#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.
|
|
1515
|
-
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) {
|
|
1516
1545
|
let r = n.initialDeps ?? [], i, a = !0;
|
|
1517
1546
|
function o() {
|
|
1518
1547
|
let o;
|
|
@@ -1537,26 +1566,26 @@ function $(e, t, n) {
|
|
|
1537
1566
|
r = e;
|
|
1538
1567
|
}, o;
|
|
1539
1568
|
}
|
|
1540
|
-
function
|
|
1569
|
+
function Z(e, t) {
|
|
1541
1570
|
if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
|
|
1542
1571
|
return e;
|
|
1543
1572
|
}
|
|
1544
|
-
var
|
|
1573
|
+
var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
1545
1574
|
let r;
|
|
1546
1575
|
return function(...i) {
|
|
1547
1576
|
e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
|
|
1548
1577
|
};
|
|
1549
|
-
},
|
|
1578
|
+
}, Q = (e) => {
|
|
1550
1579
|
let { offsetWidth: t, offsetHeight: n } = e;
|
|
1551
1580
|
return {
|
|
1552
1581
|
width: t,
|
|
1553
1582
|
height: n
|
|
1554
1583
|
};
|
|
1555
|
-
},
|
|
1584
|
+
}, lt = (e) => e, ut = (e) => {
|
|
1556
1585
|
let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
|
|
1557
1586
|
for (let e = t; e <= n; e++) r.push(e);
|
|
1558
1587
|
return r;
|
|
1559
|
-
},
|
|
1588
|
+
}, dt = (e, t) => {
|
|
1560
1589
|
let n = e.scrollElement;
|
|
1561
1590
|
if (!n) return;
|
|
1562
1591
|
let r = e.targetWindow;
|
|
@@ -1568,7 +1597,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1568
1597
|
height: Math.round(r)
|
|
1569
1598
|
});
|
|
1570
1599
|
};
|
|
1571
|
-
if (i(
|
|
1600
|
+
if (i(Q(n)), !r.ResizeObserver) return () => {};
|
|
1572
1601
|
let a = new r.ResizeObserver((t) => {
|
|
1573
1602
|
let r = () => {
|
|
1574
1603
|
let e = t[0];
|
|
@@ -1582,43 +1611,43 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1582
1611
|
return;
|
|
1583
1612
|
}
|
|
1584
1613
|
}
|
|
1585
|
-
i(
|
|
1614
|
+
i(Q(n));
|
|
1586
1615
|
};
|
|
1587
1616
|
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
1588
1617
|
});
|
|
1589
1618
|
return a.observe(n, { box: "border-box" }), () => {
|
|
1590
1619
|
a.unobserve(n);
|
|
1591
1620
|
};
|
|
1592
|
-
},
|
|
1621
|
+
}, ft = { passive: !0 }, pt = typeof window > "u" ? !0 : "onscrollend" in window, mt = (e, t) => {
|
|
1593
1622
|
let n = e.scrollElement;
|
|
1594
1623
|
if (!n) return;
|
|
1595
1624
|
let r = e.targetWindow;
|
|
1596
1625
|
if (!r) return;
|
|
1597
|
-
let i = 0, a = e.options.useScrollendEvent &&
|
|
1626
|
+
let i = 0, a = e.options.useScrollendEvent && pt ? () => void 0 : ct(r, () => {
|
|
1598
1627
|
t(i, !1);
|
|
1599
1628
|
}, e.options.isScrollingResetDelay), o = (r) => () => {
|
|
1600
1629
|
let { horizontal: o, isRtl: s } = e.options;
|
|
1601
1630
|
i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
|
|
1602
1631
|
}, s = o(!0), c = o(!1);
|
|
1603
|
-
n.addEventListener("scroll", s,
|
|
1604
|
-
let l = e.options.useScrollendEvent &&
|
|
1605
|
-
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), () => {
|
|
1606
1635
|
n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
|
|
1607
1636
|
};
|
|
1608
|
-
},
|
|
1637
|
+
}, ht = (e, t, n) => {
|
|
1609
1638
|
if (t?.borderBoxSize) {
|
|
1610
1639
|
let e = t.borderBoxSize[0];
|
|
1611
1640
|
if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
|
|
1612
1641
|
}
|
|
1613
1642
|
return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
1614
|
-
},
|
|
1643
|
+
}, gt = (e, { adjustments: t = 0, behavior: n }, r) => {
|
|
1615
1644
|
var i, a;
|
|
1616
1645
|
let o = e + t;
|
|
1617
1646
|
(a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
|
|
1618
1647
|
[r.options.horizontal ? "left" : "top"]: o,
|
|
1619
1648
|
behavior: n
|
|
1620
1649
|
});
|
|
1621
|
-
},
|
|
1650
|
+
}, _t = class {
|
|
1622
1651
|
constructor(e) {
|
|
1623
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 = () => {
|
|
1624
1653
|
var e;
|
|
@@ -1657,10 +1686,10 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1657
1686
|
scrollPaddingStart: 0,
|
|
1658
1687
|
scrollPaddingEnd: 0,
|
|
1659
1688
|
horizontal: !1,
|
|
1660
|
-
getItemKey:
|
|
1661
|
-
rangeExtractor:
|
|
1689
|
+
getItemKey: lt,
|
|
1690
|
+
rangeExtractor: ut,
|
|
1662
1691
|
onChange: () => {},
|
|
1663
|
-
measureElement:
|
|
1692
|
+
measureElement: ht,
|
|
1664
1693
|
initialRect: {
|
|
1665
1694
|
width: 0,
|
|
1666
1695
|
height: 0
|
|
@@ -1675,12 +1704,13 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1675
1704
|
isRtl: !1,
|
|
1676
1705
|
useScrollendEvent: !1,
|
|
1677
1706
|
useAnimationFrameWithResizeObserver: !1,
|
|
1707
|
+
laneAssignmentMode: "estimate",
|
|
1678
1708
|
...e
|
|
1679
1709
|
};
|
|
1680
1710
|
}, this.notify = (e) => {
|
|
1681
1711
|
var t, n;
|
|
1682
1712
|
(n = (t = this.options).onChange) == null || n.call(t, this, e);
|
|
1683
|
-
}, this.maybeNotify =
|
|
1713
|
+
}, this.maybeNotify = X(() => (this.calculateRange(), [
|
|
1684
1714
|
this.isScrolling,
|
|
1685
1715
|
this.range ? this.range.startIndex : null,
|
|
1686
1716
|
this.range ? this.range.endIndex : null
|
|
@@ -1725,63 +1755,65 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1725
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;
|
|
1726
1756
|
}
|
|
1727
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;
|
|
1728
|
-
}, this.getMeasurementOptions =
|
|
1758
|
+
}, this.getMeasurementOptions = X(() => [
|
|
1729
1759
|
this.options.count,
|
|
1730
1760
|
this.options.paddingStart,
|
|
1731
1761
|
this.options.scrollMargin,
|
|
1732
1762
|
this.options.getItemKey,
|
|
1733
1763
|
this.options.enabled,
|
|
1734
|
-
this.options.lanes
|
|
1735
|
-
|
|
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 = [], {
|
|
1736
1767
|
count: e,
|
|
1737
1768
|
paddingStart: t,
|
|
1738
1769
|
scrollMargin: n,
|
|
1739
1770
|
getItemKey: r,
|
|
1740
1771
|
enabled: i,
|
|
1741
|
-
lanes: a
|
|
1742
|
-
|
|
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) => {
|
|
1743
1775
|
if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
1744
1776
|
if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
|
|
1745
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) => {
|
|
1746
1778
|
this.itemSizeCache.set(e.key, e.size);
|
|
1747
1779
|
}));
|
|
1748
|
-
let
|
|
1780
|
+
let c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
1749
1781
|
this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
|
|
1750
|
-
let
|
|
1751
|
-
for (let e = 0; e <
|
|
1752
|
-
let t =
|
|
1753
|
-
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);
|
|
1754
1786
|
}
|
|
1755
|
-
for (let i =
|
|
1756
|
-
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);
|
|
1757
1789
|
if (a !== void 0 && this.options.lanes > 1) {
|
|
1758
|
-
|
|
1759
|
-
let e =
|
|
1760
|
-
|
|
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;
|
|
1761
1793
|
} else {
|
|
1762
|
-
let e = this.options.lanes === 1 ?
|
|
1763
|
-
|
|
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);
|
|
1764
1796
|
}
|
|
1765
|
-
let
|
|
1766
|
-
|
|
1797
|
+
let p = s.get(e), m = typeof p == "number" ? p : this.options.estimateSize(i), h = d + m;
|
|
1798
|
+
l[i] = {
|
|
1767
1799
|
index: i,
|
|
1768
|
-
start:
|
|
1769
|
-
size:
|
|
1770
|
-
end:
|
|
1800
|
+
start: d,
|
|
1801
|
+
size: m,
|
|
1802
|
+
end: h,
|
|
1771
1803
|
key: e,
|
|
1772
|
-
lane:
|
|
1773
|
-
},
|
|
1804
|
+
lane: c
|
|
1805
|
+
}, u[c] = i;
|
|
1774
1806
|
}
|
|
1775
|
-
return this.measurementsCache =
|
|
1807
|
+
return this.measurementsCache = l, l;
|
|
1776
1808
|
}, {
|
|
1777
1809
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
1778
1810
|
debug: () => this.options.debug
|
|
1779
|
-
}), this.calculateRange =
|
|
1811
|
+
}), this.calculateRange = X(() => [
|
|
1780
1812
|
this.getMeasurements(),
|
|
1781
1813
|
this.getSize(),
|
|
1782
1814
|
this.getScrollOffset(),
|
|
1783
1815
|
this.options.lanes
|
|
1784
|
-
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ?
|
|
1816
|
+
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? vt({
|
|
1785
1817
|
measurements: e,
|
|
1786
1818
|
outerSize: t,
|
|
1787
1819
|
scrollOffset: n,
|
|
@@ -1789,7 +1821,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1789
1821
|
}) : null, {
|
|
1790
1822
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
1791
1823
|
debug: () => this.options.debug
|
|
1792
|
-
}), this.getVirtualIndexes =
|
|
1824
|
+
}), this.getVirtualIndexes = X(() => {
|
|
1793
1825
|
let e = null, t = null, n = this.calculateRange();
|
|
1794
1826
|
return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
|
|
1795
1827
|
this.isScrolling,
|
|
@@ -1838,7 +1870,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1838
1870
|
adjustments: this.scrollAdjustments += r,
|
|
1839
1871
|
behavior: void 0
|
|
1840
1872
|
})), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
|
|
1841
|
-
}, this.getVirtualItems =
|
|
1873
|
+
}, this.getVirtualItems = X(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
|
|
1842
1874
|
let n = [];
|
|
1843
1875
|
for (let r = 0, i = e.length; r < i; r++) {
|
|
1844
1876
|
let i = t[e[r]];
|
|
@@ -1850,7 +1882,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1850
1882
|
debug: () => this.options.debug
|
|
1851
1883
|
}), this.getVirtualItemForOffset = (e) => {
|
|
1852
1884
|
let t = this.getMeasurements();
|
|
1853
|
-
if (t.length !== 0) return
|
|
1885
|
+
if (t.length !== 0) return Z(t[$(0, t.length - 1, (e) => Z(t[e]).start, e)]);
|
|
1854
1886
|
}, this.getMaxScrollOffset = () => {
|
|
1855
1887
|
if (!this.scrollElement) return 0;
|
|
1856
1888
|
if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
@@ -1875,12 +1907,12 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1875
1907
|
let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
|
|
1876
1908
|
return [this.getOffsetForAlignment(a, t, i.size), t];
|
|
1877
1909
|
}, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
|
|
1878
|
-
let r = this.getOffsetForAlignment(e, t);
|
|
1910
|
+
let r = this.getOffsetForAlignment(e, t), i = this.now();
|
|
1879
1911
|
this.scrollState = {
|
|
1880
1912
|
index: null,
|
|
1881
1913
|
align: t,
|
|
1882
1914
|
behavior: n,
|
|
1883
|
-
startedAt:
|
|
1915
|
+
startedAt: i,
|
|
1884
1916
|
lastTargetOffset: r,
|
|
1885
1917
|
stableFrames: 0
|
|
1886
1918
|
}, this._scrollToOffset(r, {
|
|
@@ -1904,12 +1936,12 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1904
1936
|
behavior: n
|
|
1905
1937
|
}), this.scheduleScrollReconcile();
|
|
1906
1938
|
}, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
|
|
1907
|
-
let n = this.getScrollOffset() + e;
|
|
1939
|
+
let n = this.getScrollOffset() + e, r = this.now();
|
|
1908
1940
|
this.scrollState = {
|
|
1909
1941
|
index: null,
|
|
1910
1942
|
align: "start",
|
|
1911
1943
|
behavior: t,
|
|
1912
|
-
startedAt:
|
|
1944
|
+
startedAt: r,
|
|
1913
1945
|
lastTargetOffset: n,
|
|
1914
1946
|
stableFrames: 0
|
|
1915
1947
|
}, this._scrollToOffset(n, {
|
|
@@ -1954,7 +1986,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1954
1986
|
return;
|
|
1955
1987
|
}
|
|
1956
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;
|
|
1957
|
-
if (!n &&
|
|
1989
|
+
if (!n && st(t, this.getScrollOffset())) {
|
|
1958
1990
|
if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
|
|
1959
1991
|
this.scrollState = null;
|
|
1960
1992
|
return;
|
|
@@ -1965,7 +1997,7 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1965
1997
|
}));
|
|
1966
1998
|
this.scheduleScrollReconcile();
|
|
1967
1999
|
}
|
|
1968
|
-
},
|
|
2000
|
+
}, $ = (e, t, n, r) => {
|
|
1969
2001
|
for (; e <= t;) {
|
|
1970
2002
|
let i = (e + t) / 2 | 0, a = n(i);
|
|
1971
2003
|
if (a < r) e = i + 1;
|
|
@@ -1974,13 +2006,13 @@ var it = (e, t) => Math.abs(e - t) < 1.01, at = (e, t, n) => {
|
|
|
1974
2006
|
}
|
|
1975
2007
|
return e > 0 ? e - 1 : 0;
|
|
1976
2008
|
};
|
|
1977
|
-
function
|
|
2009
|
+
function vt({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
1978
2010
|
let i = e.length - 1, a = (t) => e[t].start;
|
|
1979
2011
|
if (e.length <= r) return {
|
|
1980
2012
|
startIndex: 0,
|
|
1981
2013
|
endIndex: i
|
|
1982
2014
|
};
|
|
1983
|
-
let o =
|
|
2015
|
+
let o = $(0, i, a, n), s = o;
|
|
1984
2016
|
if (r === 1) for (; s < i && e[s].end < n + t;) s++;
|
|
1985
2017
|
else if (r > 1) {
|
|
1986
2018
|
let a = Array(r).fill(0);
|
|
@@ -2001,54 +2033,54 @@ function _t({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
|
2001
2033
|
};
|
|
2002
2034
|
}
|
|
2003
2035
|
//#endregion
|
|
2004
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.
|
|
2005
|
-
var
|
|
2006
|
-
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 }) {
|
|
2007
2039
|
let r = e.useReducer(() => ({}), {})[1], i = {
|
|
2008
2040
|
...n,
|
|
2009
2041
|
onChange: (e, i) => {
|
|
2010
2042
|
var a;
|
|
2011
|
-
t && i ?
|
|
2043
|
+
t && i ? U(r) : r(), (a = n.onChange) == null || a.call(n, e, i);
|
|
2012
2044
|
}
|
|
2013
|
-
}, [a] = e.useState(() => new
|
|
2014
|
-
return a.setOptions(i),
|
|
2045
|
+
}, [a] = e.useState(() => new _t(i));
|
|
2046
|
+
return a.setOptions(i), yt(() => a._didMount(), []), yt(() => a._willUpdate()), a;
|
|
2015
2047
|
}
|
|
2016
|
-
function
|
|
2017
|
-
return
|
|
2018
|
-
observeElementRect:
|
|
2019
|
-
observeElementOffset:
|
|
2020
|
-
scrollToFn:
|
|
2048
|
+
function xt(e) {
|
|
2049
|
+
return bt({
|
|
2050
|
+
observeElementRect: dt,
|
|
2051
|
+
observeElementOffset: mt,
|
|
2052
|
+
scrollToFn: gt,
|
|
2021
2053
|
...e
|
|
2022
2054
|
});
|
|
2023
2055
|
}
|
|
2024
2056
|
//#endregion
|
|
2025
2057
|
//#region src/VirtualGrid.tsx
|
|
2026
|
-
var
|
|
2027
|
-
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({
|
|
2028
2060
|
count: e.length,
|
|
2029
2061
|
getScrollElement: () => u.current,
|
|
2030
2062
|
estimateSize: () => n,
|
|
2031
2063
|
overscan: l
|
|
2032
2064
|
}), f = d.getVirtualItems();
|
|
2033
|
-
return /* @__PURE__ */ (0,
|
|
2065
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2034
2066
|
className: i,
|
|
2035
2067
|
children: [
|
|
2036
|
-
/* @__PURE__ */ (0,
|
|
2068
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2037
2069
|
className: `grid border-b sticky top-0 bg-muted/30 z-10 ${a}`,
|
|
2038
2070
|
style: { gridTemplateColumns: t.map((e) => e.width || "1fr").join(" ") },
|
|
2039
|
-
children: t.map((e, t) => /* @__PURE__ */ (0,
|
|
2071
|
+
children: t.map((e, t) => /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2040
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"}`,
|
|
2041
2073
|
children: e.header
|
|
2042
2074
|
}, t))
|
|
2043
2075
|
}),
|
|
2044
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2045
2077
|
ref: u,
|
|
2046
2078
|
className: "overflow-auto",
|
|
2047
2079
|
style: {
|
|
2048
2080
|
height: typeof r == "number" ? `${r}px` : r,
|
|
2049
2081
|
contain: "strict"
|
|
2050
2082
|
},
|
|
2051
|
-
children: /* @__PURE__ */ (0,
|
|
2083
|
+
children: /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2052
2084
|
style: {
|
|
2053
2085
|
height: `${d.getTotalSize()}px`,
|
|
2054
2086
|
width: "100%",
|
|
@@ -2056,7 +2088,7 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2056
2088
|
},
|
|
2057
2089
|
children: f.map((n) => {
|
|
2058
2090
|
let r = e[n.index];
|
|
2059
|
-
return /* @__PURE__ */ (0,
|
|
2091
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2060
2092
|
className: `grid border-b hover:bg-muted/50 cursor-pointer ${typeof s == "function" ? s(r, n.index) : s || ""}`,
|
|
2061
2093
|
style: {
|
|
2062
2094
|
position: "absolute",
|
|
@@ -2070,7 +2102,7 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2070
2102
|
onClick: () => c?.(r, n.index),
|
|
2071
2103
|
children: t.map((e, t) => {
|
|
2072
2104
|
let n = r[e.accessorKey], i = e.cell ? e.cell(n, r) : typeof n == "object" && n ? String(n) : n;
|
|
2073
|
-
return /* @__PURE__ */ (0,
|
|
2105
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2074
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"}`,
|
|
2075
2107
|
children: i
|
|
2076
2108
|
}, t);
|
|
@@ -2079,7 +2111,7 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2079
2111
|
})
|
|
2080
2112
|
})
|
|
2081
2113
|
}),
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2114
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2083
2115
|
className: "px-4 py-2 text-xs text-muted-foreground border-t",
|
|
2084
2116
|
children: [
|
|
2085
2117
|
"Showing ",
|
|
@@ -2091,8 +2123,8 @@ var xt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2091
2123
|
})
|
|
2092
2124
|
]
|
|
2093
2125
|
});
|
|
2094
|
-
},
|
|
2095
|
-
function
|
|
2126
|
+
}, Ct = 10;
|
|
2127
|
+
function wt(e) {
|
|
2096
2128
|
let t = [], n = [], r = "", i = !1;
|
|
2097
2129
|
for (let a = 0; a < e.length; a++) {
|
|
2098
2130
|
let o = e[a], s = e[a + 1];
|
|
@@ -2100,7 +2132,7 @@ function Ct(e) {
|
|
|
2100
2132
|
}
|
|
2101
2133
|
return n.push(r.trim()), n.some((e) => e !== "") && t.push(n), t;
|
|
2102
2134
|
}
|
|
2103
|
-
function
|
|
2135
|
+
function Tt(e, t) {
|
|
2104
2136
|
if (!e) return !0;
|
|
2105
2137
|
switch (t) {
|
|
2106
2138
|
case "number":
|
|
@@ -2119,7 +2151,7 @@ function wt(e, t) {
|
|
|
2119
2151
|
default: return !0;
|
|
2120
2152
|
}
|
|
2121
2153
|
}
|
|
2122
|
-
function
|
|
2154
|
+
function Et(e, t) {
|
|
2123
2155
|
let n = {};
|
|
2124
2156
|
return e.forEach((e, r) => {
|
|
2125
2157
|
let i = e.toLowerCase().replace(/[_\s-]/g, ""), a = t.find((e) => {
|
|
@@ -2129,7 +2161,7 @@ function Tt(e, t) {
|
|
|
2129
2161
|
a && (n[r] = a.name);
|
|
2130
2162
|
}), n;
|
|
2131
2163
|
}
|
|
2132
|
-
function
|
|
2164
|
+
function Dt(e, t, n) {
|
|
2133
2165
|
let r = [], i = {};
|
|
2134
2166
|
for (let a of t) {
|
|
2135
2167
|
let t = e[a.csvIdx] ?? "";
|
|
@@ -2141,7 +2173,7 @@ function Et(e, t, n) {
|
|
|
2141
2173
|
});
|
|
2142
2174
|
continue;
|
|
2143
2175
|
}
|
|
2144
|
-
if (t && !
|
|
2176
|
+
if (t && !Tt(t, a.field.type)) {
|
|
2145
2177
|
r.push({
|
|
2146
2178
|
row: n,
|
|
2147
2179
|
field: a.field.name,
|
|
@@ -2156,7 +2188,7 @@ function Et(e, t, n) {
|
|
|
2156
2188
|
errors: r
|
|
2157
2189
|
};
|
|
2158
2190
|
}
|
|
2159
|
-
var
|
|
2191
|
+
var Ot = ({ onFileLoaded: e }) => {
|
|
2160
2192
|
let [t, n] = s(!1), [i, a] = s(null), o = r((t) => {
|
|
2161
2193
|
if (a(null), !t.name.endsWith(".csv")) {
|
|
2162
2194
|
a("Only CSV files are supported.");
|
|
@@ -2164,7 +2196,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2164
2196
|
}
|
|
2165
2197
|
let n = new FileReader();
|
|
2166
2198
|
n.onload = (t) => {
|
|
2167
|
-
let n =
|
|
2199
|
+
let n = wt(t.target?.result);
|
|
2168
2200
|
if (n.length < 2) {
|
|
2169
2201
|
a("File must contain a header row and at least one data row.");
|
|
2170
2202
|
return;
|
|
@@ -2172,10 +2204,10 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2172
2204
|
e(n[0], n.slice(1));
|
|
2173
2205
|
}, n.readAsText(t);
|
|
2174
2206
|
}, [e]);
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
2207
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2176
2208
|
className: "flex flex-col items-center gap-4 py-6",
|
|
2177
|
-
children: [/* @__PURE__ */ (0,
|
|
2178
|
-
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"),
|
|
2179
2211
|
onDragOver: (e) => {
|
|
2180
2212
|
e.preventDefault(), n(!0);
|
|
2181
2213
|
},
|
|
@@ -2186,12 +2218,12 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2186
2218
|
t && o(t);
|
|
2187
2219
|
},
|
|
2188
2220
|
children: [
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2190
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
/* @__PURE__ */ (0, K.jsx)(V, { className: "h-10 w-10 text-muted-foreground" }),
|
|
2222
|
+
/* @__PURE__ */ (0, K.jsx)("p", {
|
|
2191
2223
|
className: "text-sm text-muted-foreground",
|
|
2192
2224
|
children: "Drag & drop a CSV file here, or click to browse"
|
|
2193
2225
|
}),
|
|
2194
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
/* @__PURE__ */ (0, K.jsxs)("label", { children: [/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2195
2227
|
type: "file",
|
|
2196
2228
|
accept: ".csv",
|
|
2197
2229
|
className: "hidden",
|
|
@@ -2199,63 +2231,63 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2199
2231
|
let t = e.target.files?.[0];
|
|
2200
2232
|
t && o(t);
|
|
2201
2233
|
}
|
|
2202
|
-
}), /* @__PURE__ */ (0,
|
|
2234
|
+
}), /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2203
2235
|
variant: "outline",
|
|
2204
2236
|
size: "sm",
|
|
2205
2237
|
asChild: !0,
|
|
2206
|
-
children: /* @__PURE__ */ (0,
|
|
2238
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", { children: "Browse Files" })
|
|
2207
2239
|
})] })
|
|
2208
2240
|
]
|
|
2209
|
-
}), i && /* @__PURE__ */ (0,
|
|
2241
|
+
}), i && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2210
2242
|
className: "flex items-center gap-1 text-sm text-destructive",
|
|
2211
2243
|
children: [
|
|
2212
|
-
/* @__PURE__ */ (0,
|
|
2244
|
+
/* @__PURE__ */ (0, K.jsx)(he, { className: "h-4 w-4" }),
|
|
2213
2245
|
" ",
|
|
2214
2246
|
i
|
|
2215
2247
|
]
|
|
2216
2248
|
})]
|
|
2217
2249
|
});
|
|
2218
|
-
},
|
|
2250
|
+
}, kt = ({ headers: e, fields: t, mapping: n, onMappingChange: i }) => {
|
|
2219
2251
|
let o = a(() => new Set(Object.values(n)), [n]), s = r((e, t) => {
|
|
2220
2252
|
let r = { ...n };
|
|
2221
2253
|
t === "__skip__" ? delete r[e] : r[e] = t, i(r);
|
|
2222
2254
|
}, [n, i]);
|
|
2223
|
-
return /* @__PURE__ */ (0,
|
|
2255
|
+
return /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2224
2256
|
className: "max-h-[360px] overflow-auto",
|
|
2225
|
-
children: /* @__PURE__ */ (0,
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2227
|
-
/* @__PURE__ */ (0,
|
|
2228
|
-
/* @__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, {
|
|
2229
2261
|
className: "w-24 text-center",
|
|
2230
2262
|
children: "Status"
|
|
2231
2263
|
})
|
|
2232
|
-
] }) }), /* @__PURE__ */ (0,
|
|
2233
|
-
/* @__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, {
|
|
2234
2266
|
className: "font-medium",
|
|
2235
2267
|
children: e
|
|
2236
2268
|
}),
|
|
2237
|
-
/* @__PURE__ */ (0,
|
|
2269
|
+
/* @__PURE__ */ (0, K.jsx)(F, { children: /* @__PURE__ */ (0, K.jsxs)(le, {
|
|
2238
2270
|
value: n[r] ?? "__skip__",
|
|
2239
2271
|
onValueChange: (e) => s(r, e),
|
|
2240
|
-
children: [/* @__PURE__ */ (0,
|
|
2272
|
+
children: [/* @__PURE__ */ (0, K.jsx)(ue, {
|
|
2241
2273
|
className: "h-8 w-56",
|
|
2242
|
-
children: /* @__PURE__ */ (0,
|
|
2243
|
-
}), /* @__PURE__ */ (0,
|
|
2274
|
+
children: /* @__PURE__ */ (0, K.jsx)(de, { placeholder: "Skip column" })
|
|
2275
|
+
}), /* @__PURE__ */ (0, K.jsxs)(N, { children: [/* @__PURE__ */ (0, K.jsx)(P, {
|
|
2244
2276
|
value: "__skip__",
|
|
2245
2277
|
children: "— Skip —"
|
|
2246
|
-
}), t.map((e) => /* @__PURE__ */ (0,
|
|
2278
|
+
}), t.map((e) => /* @__PURE__ */ (0, K.jsxs)(P, {
|
|
2247
2279
|
value: e.name,
|
|
2248
2280
|
disabled: o.has(e.name) && n[r] !== e.name,
|
|
2249
2281
|
children: [e.label, e.required ? " *" : ""]
|
|
2250
2282
|
}, e.name))] })]
|
|
2251
2283
|
}) }),
|
|
2252
|
-
/* @__PURE__ */ (0,
|
|
2284
|
+
/* @__PURE__ */ (0, K.jsx)(F, {
|
|
2253
2285
|
className: "text-center",
|
|
2254
|
-
children: n[r] ? /* @__PURE__ */ (0,
|
|
2286
|
+
children: n[r] ? /* @__PURE__ */ (0, K.jsx)(w, {
|
|
2255
2287
|
variant: "default",
|
|
2256
2288
|
className: "text-xs",
|
|
2257
2289
|
children: "Mapped"
|
|
2258
|
-
}) : /* @__PURE__ */ (0,
|
|
2290
|
+
}) : /* @__PURE__ */ (0, K.jsx)(w, {
|
|
2259
2291
|
variant: "secondary",
|
|
2260
2292
|
className: "text-xs",
|
|
2261
2293
|
children: "Skipped"
|
|
@@ -2263,7 +2295,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2263
2295
|
})
|
|
2264
2296
|
] }, r)) })] })
|
|
2265
2297
|
});
|
|
2266
|
-
},
|
|
2298
|
+
}, At = ({ headers: e, rows: t, mapping: n, fields: r }) => {
|
|
2267
2299
|
let i = a(() => Object.entries(n).map(([t, n]) => ({
|
|
2268
2300
|
csvIdx: Number(t),
|
|
2269
2301
|
header: e[Number(t)],
|
|
@@ -2272,42 +2304,42 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2272
2304
|
n,
|
|
2273
2305
|
e,
|
|
2274
2306
|
r
|
|
2275
|
-
]), o = t.slice(0,
|
|
2307
|
+
]), o = t.slice(0, Ct), s = a(() => o.map((e, t) => {
|
|
2276
2308
|
let n = {};
|
|
2277
2309
|
for (let t of i) {
|
|
2278
2310
|
let r = e[t.csvIdx] ?? "";
|
|
2279
|
-
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}`);
|
|
2280
2312
|
}
|
|
2281
2313
|
return n;
|
|
2282
2314
|
}), [o, i]), c = s.filter((e) => Object.keys(e).length > 0).length;
|
|
2283
|
-
return /* @__PURE__ */ (0,
|
|
2315
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2284
2316
|
className: "max-h-[360px] overflow-auto",
|
|
2285
2317
|
children: [
|
|
2286
|
-
c > 0 && /* @__PURE__ */ (0,
|
|
2318
|
+
c > 0 && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2287
2319
|
className: "mb-2 flex items-center gap-1 text-xs text-destructive",
|
|
2288
2320
|
children: [
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2321
|
+
/* @__PURE__ */ (0, K.jsx)(he, { className: "h-3.5 w-3.5" }),
|
|
2290
2322
|
" ",
|
|
2291
2323
|
c,
|
|
2292
2324
|
" row(s) with errors in preview"
|
|
2293
2325
|
]
|
|
2294
2326
|
}),
|
|
2295
|
-
/* @__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, {
|
|
2296
2328
|
className: "w-12",
|
|
2297
2329
|
children: "#"
|
|
2298
|
-
}), 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) => {
|
|
2299
2331
|
let n = s[t];
|
|
2300
|
-
return /* @__PURE__ */ (0,
|
|
2301
|
-
className:
|
|
2302
|
-
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, {
|
|
2303
2335
|
className: "text-xs text-muted-foreground",
|
|
2304
2336
|
children: t + 1
|
|
2305
2337
|
}), i.map((t) => {
|
|
2306
2338
|
let r = e[t.csvIdx] ?? "", i = n[t.csvIdx];
|
|
2307
|
-
return /* @__PURE__ */ (0,
|
|
2308
|
-
className:
|
|
2339
|
+
return /* @__PURE__ */ (0, K.jsx)(F, {
|
|
2340
|
+
className: R(i && "text-destructive"),
|
|
2309
2341
|
title: i,
|
|
2310
|
-
children: r || /* @__PURE__ */ (0,
|
|
2342
|
+
children: r || /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2311
2343
|
className: "text-muted-foreground/50",
|
|
2312
2344
|
children: "—"
|
|
2313
2345
|
})
|
|
@@ -2315,7 +2347,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2315
2347
|
})]
|
|
2316
2348
|
}, t);
|
|
2317
2349
|
}) })] }),
|
|
2318
|
-
/* @__PURE__ */ (0,
|
|
2350
|
+
/* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2319
2351
|
className: "mt-2 text-xs text-muted-foreground",
|
|
2320
2352
|
children: [
|
|
2321
2353
|
"Showing ",
|
|
@@ -2327,12 +2359,12 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2327
2359
|
})
|
|
2328
2360
|
]
|
|
2329
2361
|
});
|
|
2330
|
-
},
|
|
2331
|
-
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(() => {
|
|
2332
2364
|
let e = new Set(Object.values(y));
|
|
2333
2365
|
return i.filter((t) => t.required && !e.has(t.name));
|
|
2334
|
-
}, [i, y]),
|
|
2335
|
-
g(e), v(t), b(
|
|
2366
|
+
}, [i, y]), j = r((e, t) => {
|
|
2367
|
+
g(e), v(t), b(Et(e, i)), m("mapping");
|
|
2336
2368
|
}, [i]), oe = r(async () => {
|
|
2337
2369
|
S(!0), D(0);
|
|
2338
2370
|
let t = [], n = 0, r = 0, a = Object.entries(y).map(([e, t]) => ({
|
|
@@ -2340,7 +2372,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2340
2372
|
field: i.find((e) => e.name === t)
|
|
2341
2373
|
}));
|
|
2342
2374
|
for (let i = 0; i < _.length; i++) {
|
|
2343
|
-
let { record: s, errors: c } =
|
|
2375
|
+
let { record: s, errors: c } = Dt(_[i], a, i + 1);
|
|
2344
2376
|
if (c.length > 0) {
|
|
2345
2377
|
if (r++, t.push(...c), f === "stop") break;
|
|
2346
2378
|
} else try {
|
|
@@ -2373,41 +2405,41 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2373
2405
|
f
|
|
2374
2406
|
]), se = r(() => {
|
|
2375
2407
|
m("upload"), g([]), v([]), b({}), D(0), k(null);
|
|
2376
|
-
}, []),
|
|
2408
|
+
}, []), ce = r(() => {
|
|
2377
2409
|
se(), d?.(!1), l?.();
|
|
2378
2410
|
}, [
|
|
2379
2411
|
se,
|
|
2380
2412
|
d,
|
|
2381
2413
|
l
|
|
2382
2414
|
]);
|
|
2383
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
+
return /* @__PURE__ */ (0, K.jsx)(ee, {
|
|
2384
2416
|
open: u,
|
|
2385
2417
|
onOpenChange: (e) => {
|
|
2386
|
-
e ? d?.(e) :
|
|
2418
|
+
e ? d?.(e) : ce();
|
|
2387
2419
|
},
|
|
2388
|
-
children: /* @__PURE__ */ (0,
|
|
2420
|
+
children: /* @__PURE__ */ (0, K.jsxs)(te, {
|
|
2389
2421
|
className: "sm:max-w-2xl",
|
|
2390
2422
|
children: [
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2423
|
+
/* @__PURE__ */ (0, K.jsxs)(E, { children: [/* @__PURE__ */ (0, K.jsxs)(ie, {
|
|
2392
2424
|
className: "flex items-center gap-2",
|
|
2393
2425
|
children: [
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2426
|
+
/* @__PURE__ */ (0, K.jsx)(De, { className: "h-5 w-5" }),
|
|
2395
2427
|
" Import ",
|
|
2396
2428
|
A
|
|
2397
2429
|
]
|
|
2398
|
-
}), /* @__PURE__ */ (0,
|
|
2430
|
+
}), /* @__PURE__ */ (0, K.jsxs)(ne, { children: [
|
|
2399
2431
|
p === "upload" && "Upload a CSV file to get started.",
|
|
2400
2432
|
p === "mapping" && "Map CSV columns to object fields.",
|
|
2401
2433
|
p === "preview" && "Review data before importing."
|
|
2402
2434
|
] })] }),
|
|
2403
|
-
/* @__PURE__ */ (0,
|
|
2435
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2404
2436
|
className: "flex items-center justify-center gap-2 text-xs text-muted-foreground",
|
|
2405
2437
|
children: [
|
|
2406
2438
|
"upload",
|
|
2407
2439
|
"mapping",
|
|
2408
2440
|
"preview"
|
|
2409
|
-
].map((e, n) => /* @__PURE__ */ (0,
|
|
2410
|
-
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"),
|
|
2411
2443
|
children: [
|
|
2412
2444
|
n + 1,
|
|
2413
2445
|
". ",
|
|
@@ -2415,27 +2447,27 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2415
2447
|
]
|
|
2416
2448
|
})] }, e))
|
|
2417
2449
|
}),
|
|
2418
|
-
O ? /* @__PURE__ */ (0,
|
|
2450
|
+
O ? /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2419
2451
|
className: "flex flex-col items-center gap-3 py-4",
|
|
2420
2452
|
children: [
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
/* @__PURE__ */ (0, K.jsx)(be, { className: "h-10 w-10 text-green-500" }),
|
|
2454
|
+
/* @__PURE__ */ (0, K.jsx)("p", {
|
|
2423
2455
|
className: "text-lg font-semibold",
|
|
2424
2456
|
children: "Import Complete"
|
|
2425
2457
|
}),
|
|
2426
|
-
/* @__PURE__ */ (0,
|
|
2458
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2427
2459
|
className: "flex gap-3",
|
|
2428
|
-
children: [/* @__PURE__ */ (0,
|
|
2460
|
+
children: [/* @__PURE__ */ (0, K.jsxs)(w, {
|
|
2429
2461
|
variant: "default",
|
|
2430
2462
|
children: [O.importedRows, " imported"]
|
|
2431
|
-
}), O.skippedRows > 0 && /* @__PURE__ */ (0,
|
|
2463
|
+
}), O.skippedRows > 0 && /* @__PURE__ */ (0, K.jsxs)(w, {
|
|
2432
2464
|
variant: "destructive",
|
|
2433
2465
|
children: [O.skippedRows, " skipped"]
|
|
2434
2466
|
})]
|
|
2435
2467
|
}),
|
|
2436
|
-
O.errors.length > 0 && /* @__PURE__ */ (0,
|
|
2468
|
+
O.errors.length > 0 && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2437
2469
|
className: "max-h-32 w-full overflow-auto rounded border p-2 text-xs",
|
|
2438
|
-
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", {
|
|
2439
2471
|
className: "text-destructive",
|
|
2440
2472
|
children: [
|
|
2441
2473
|
"Row ",
|
|
@@ -2444,7 +2476,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2444
2476
|
": ",
|
|
2445
2477
|
e.message
|
|
2446
2478
|
]
|
|
2447
|
-
}, t)), O.errors.length > 10 && /* @__PURE__ */ (0,
|
|
2479
|
+
}, t)), O.errors.length > 10 && /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2448
2480
|
className: "text-muted-foreground",
|
|
2449
2481
|
children: [
|
|
2450
2482
|
"…and ",
|
|
@@ -2454,26 +2486,26 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2454
2486
|
})]
|
|
2455
2487
|
})
|
|
2456
2488
|
]
|
|
2457
|
-
}) : /* @__PURE__ */ (0,
|
|
2458
|
-
p === "upload" && /* @__PURE__ */ (0,
|
|
2459
|
-
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, {
|
|
2460
2492
|
headers: h,
|
|
2461
2493
|
fields: i,
|
|
2462
2494
|
mapping: y,
|
|
2463
2495
|
onMappingChange: b
|
|
2464
2496
|
}),
|
|
2465
|
-
p === "preview" && /* @__PURE__ */ (0,
|
|
2497
|
+
p === "preview" && /* @__PURE__ */ (0, K.jsx)(At, {
|
|
2466
2498
|
headers: h,
|
|
2467
2499
|
rows: _,
|
|
2468
2500
|
mapping: y,
|
|
2469
2501
|
fields: i
|
|
2470
2502
|
}),
|
|
2471
|
-
x && /* @__PURE__ */ (0,
|
|
2503
|
+
x && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2472
2504
|
className: "flex flex-col gap-1",
|
|
2473
|
-
children: [/* @__PURE__ */ (0,
|
|
2505
|
+
children: [/* @__PURE__ */ (0, K.jsx)(M, {
|
|
2474
2506
|
value: C,
|
|
2475
2507
|
className: "h-2"
|
|
2476
|
-
}), /* @__PURE__ */ (0,
|
|
2508
|
+
}), /* @__PURE__ */ (0, K.jsxs)("p", {
|
|
2477
2509
|
className: "text-center text-xs text-muted-foreground",
|
|
2478
2510
|
children: [
|
|
2479
2511
|
"Importing… ",
|
|
@@ -2483,30 +2515,30 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2483
2515
|
})]
|
|
2484
2516
|
})
|
|
2485
2517
|
] }),
|
|
2486
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
/* @__PURE__ */ (0, K.jsx)(re, {
|
|
2487
2519
|
className: "gap-2 sm:gap-0",
|
|
2488
|
-
children: O ? /* @__PURE__ */ (0,
|
|
2489
|
-
onClick:
|
|
2520
|
+
children: O ? /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2521
|
+
onClick: ce,
|
|
2490
2522
|
children: "Close"
|
|
2491
|
-
}) : /* @__PURE__ */ (0,
|
|
2492
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
}) : /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [
|
|
2524
|
+
/* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2493
2525
|
variant: "ghost",
|
|
2494
|
-
onClick:
|
|
2526
|
+
onClick: ce,
|
|
2495
2527
|
disabled: x,
|
|
2496
|
-
children: [/* @__PURE__ */ (0,
|
|
2528
|
+
children: [/* @__PURE__ */ (0, K.jsx)(H, { className: "mr-1 h-4 w-4" }), " Cancel"]
|
|
2497
2529
|
}),
|
|
2498
|
-
(p === "mapping" || p === "preview") && /* @__PURE__ */ (0,
|
|
2530
|
+
(p === "mapping" || p === "preview") && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2499
2531
|
variant: "outline",
|
|
2500
2532
|
onClick: () => m(p === "mapping" ? "upload" : "mapping"),
|
|
2501
2533
|
disabled: x,
|
|
2502
|
-
children: [/* @__PURE__ */ (0,
|
|
2534
|
+
children: [/* @__PURE__ */ (0, K.jsx)(_e, { className: "mr-1 h-4 w-4" }), " Back"]
|
|
2503
2535
|
}),
|
|
2504
|
-
p === "mapping" && /* @__PURE__ */ (0,
|
|
2536
|
+
p === "mapping" && /* @__PURE__ */ (0, K.jsxs)(T, {
|
|
2505
2537
|
onClick: () => m("preview"),
|
|
2506
|
-
disabled: Object.keys(y).length === 0 ||
|
|
2507
|
-
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" })]
|
|
2508
2540
|
}),
|
|
2509
|
-
p === "preview" && /* @__PURE__ */ (0,
|
|
2541
|
+
p === "preview" && /* @__PURE__ */ (0, K.jsx)(T, {
|
|
2510
2542
|
onClick: oe,
|
|
2511
2543
|
disabled: x,
|
|
2512
2544
|
children: x ? "Importing…" : `Import ${_.length} Rows`
|
|
@@ -2519,7 +2551,7 @@ var Dt = ({ onFileLoaded: e }) => {
|
|
|
2519
2551
|
};
|
|
2520
2552
|
//#endregion
|
|
2521
2553
|
//#region src/InlineEditing.tsx
|
|
2522
|
-
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 }) {
|
|
2523
2555
|
let [p, m] = s(u), [h, g] = s(String(e ?? "")), [_, v] = s(), [y, b] = s(!1), x = o(null);
|
|
2524
2556
|
i(() => {
|
|
2525
2557
|
p || g(String(e ?? ""));
|
|
@@ -2560,13 +2592,13 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2560
2592
|
]), T = r((e) => {
|
|
2561
2593
|
e.key === "Enter" ? (e.preventDefault(), w()) : e.key === "Escape" && (e.preventDefault(), C());
|
|
2562
2594
|
}, [w, C]);
|
|
2563
|
-
return p ? /* @__PURE__ */ (0,
|
|
2595
|
+
return p ? /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2564
2596
|
"data-slot": "inline-editing",
|
|
2565
|
-
className:
|
|
2597
|
+
className: R("relative flex items-center gap-1", d),
|
|
2566
2598
|
children: [
|
|
2567
|
-
/* @__PURE__ */ (0,
|
|
2599
|
+
/* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2568
2600
|
className: "flex-1 relative",
|
|
2569
|
-
children: [/* @__PURE__ */ (0,
|
|
2601
|
+
children: [/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2570
2602
|
ref: x,
|
|
2571
2603
|
"data-slot": "inline-editing-input",
|
|
2572
2604
|
type: c,
|
|
@@ -2579,8 +2611,8 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2579
2611
|
disabled: y,
|
|
2580
2612
|
"aria-invalid": !!_,
|
|
2581
2613
|
"aria-describedby": _ ? "inline-editing-error" : void 0,
|
|
2582
|
-
className:
|
|
2583
|
-
}), _ && /* @__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", {
|
|
2584
2616
|
id: "inline-editing-error",
|
|
2585
2617
|
"data-slot": "inline-editing-error",
|
|
2586
2618
|
className: "absolute left-0 top-full mt-0.5 text-xs text-destructive",
|
|
@@ -2588,28 +2620,28 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2588
2620
|
children: _
|
|
2589
2621
|
})]
|
|
2590
2622
|
}),
|
|
2591
|
-
/* @__PURE__ */ (0,
|
|
2623
|
+
/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2592
2624
|
"data-slot": "inline-editing-save",
|
|
2593
2625
|
type: "button",
|
|
2594
2626
|
onClick: w,
|
|
2595
2627
|
disabled: y,
|
|
2596
2628
|
"aria-label": "Save",
|
|
2597
|
-
className:
|
|
2598
|
-
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" })
|
|
2599
2631
|
}),
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2632
|
+
/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2601
2633
|
"data-slot": "inline-editing-cancel",
|
|
2602
2634
|
type: "button",
|
|
2603
2635
|
onClick: C,
|
|
2604
2636
|
disabled: y,
|
|
2605
2637
|
"aria-label": "Cancel",
|
|
2606
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",
|
|
2607
|
-
children: /* @__PURE__ */ (0,
|
|
2639
|
+
children: /* @__PURE__ */ (0, K.jsx)(H, { className: "h-3.5 w-3.5" })
|
|
2608
2640
|
})
|
|
2609
2641
|
]
|
|
2610
|
-
}) : /* @__PURE__ */ (0,
|
|
2642
|
+
}) : /* @__PURE__ */ (0, K.jsx)("div", {
|
|
2611
2643
|
"data-slot": "inline-editing",
|
|
2612
|
-
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),
|
|
2613
2645
|
onClick: S,
|
|
2614
2646
|
role: "button",
|
|
2615
2647
|
tabIndex: f ? -1 : 0,
|
|
@@ -2617,10 +2649,10 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2617
2649
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), S());
|
|
2618
2650
|
},
|
|
2619
2651
|
"aria-label": `Edit value: ${String(e ?? "")}`,
|
|
2620
|
-
children: /* @__PURE__ */ (0,
|
|
2652
|
+
children: /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2621
2653
|
"data-slot": "inline-editing-display",
|
|
2622
2654
|
className: "truncate text-sm",
|
|
2623
|
-
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
2655
|
+
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0, K.jsx)("span", {
|
|
2624
2656
|
className: "text-muted-foreground italic",
|
|
2625
2657
|
children: l || "Click to edit"
|
|
2626
2658
|
})
|
|
@@ -2629,7 +2661,7 @@ function jt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2629
2661
|
}
|
|
2630
2662
|
//#endregion
|
|
2631
2663
|
//#region src/useCellClipboard.ts
|
|
2632
|
-
function
|
|
2664
|
+
function Nt(e) {
|
|
2633
2665
|
return {
|
|
2634
2666
|
startRow: Math.min(e.startRow, e.endRow),
|
|
2635
2667
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -2637,10 +2669,10 @@ function Mt(e) {
|
|
|
2637
2669
|
endCol: Math.max(e.startCol, e.endCol)
|
|
2638
2670
|
};
|
|
2639
2671
|
}
|
|
2640
|
-
function
|
|
2672
|
+
function Pt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
2641
2673
|
let [o, c] = s(null), l = r(() => {
|
|
2642
2674
|
if (!a || !o) return;
|
|
2643
|
-
let { startRow: n, startCol: r, endRow: i, endCol: s } =
|
|
2675
|
+
let { startRow: n, startCol: r, endRow: i, endCol: s } = Nt(o), c = [];
|
|
2644
2676
|
for (let a = n; a <= i; a++) {
|
|
2645
2677
|
let n = e[a];
|
|
2646
2678
|
if (!n) continue;
|
|
@@ -2660,7 +2692,7 @@ function Nt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2660
2692
|
t
|
|
2661
2693
|
]), u = r(() => {
|
|
2662
2694
|
if (!a || !o || !n) return;
|
|
2663
|
-
let { startRow: r, startCol: i } =
|
|
2695
|
+
let { startRow: r, startCol: i } = Nt(o);
|
|
2664
2696
|
navigator.clipboard.readText().then((a) => {
|
|
2665
2697
|
let o = [], s = a.split("\n");
|
|
2666
2698
|
for (let n = 0; n < s.length; n++) {
|
|
@@ -2703,7 +2735,7 @@ function Nt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2703
2735
|
}
|
|
2704
2736
|
//#endregion
|
|
2705
2737
|
//#region src/useGradientColor.ts
|
|
2706
|
-
var
|
|
2738
|
+
var Ft = [
|
|
2707
2739
|
{
|
|
2708
2740
|
position: 0,
|
|
2709
2741
|
className: "bg-green-100"
|
|
@@ -2717,7 +2749,7 @@ var Pt = [
|
|
|
2717
2749
|
className: "bg-red-100"
|
|
2718
2750
|
}
|
|
2719
2751
|
];
|
|
2720
|
-
function
|
|
2752
|
+
function It(e, t) {
|
|
2721
2753
|
let n = Infinity, r = -Infinity;
|
|
2722
2754
|
for (let i of e) {
|
|
2723
2755
|
let e = Number(i[t]);
|
|
@@ -2725,7 +2757,7 @@ function Ft(e, t) {
|
|
|
2725
2757
|
}
|
|
2726
2758
|
return Number.isFinite(n) ? [n, r] : [0, 0];
|
|
2727
2759
|
}
|
|
2728
|
-
function
|
|
2760
|
+
function Lt(e, t) {
|
|
2729
2761
|
if (t.length === 0) return "";
|
|
2730
2762
|
if (t.length === 1) return t[0].className;
|
|
2731
2763
|
let n = t[0], r = Math.abs(e - n.position);
|
|
@@ -2735,11 +2767,11 @@ function It(e, t) {
|
|
|
2735
2767
|
}
|
|
2736
2768
|
return n.className;
|
|
2737
2769
|
}
|
|
2738
|
-
function
|
|
2739
|
-
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;
|
|
2740
2772
|
return r((e) => {
|
|
2741
2773
|
let n = Number(e[t]);
|
|
2742
|
-
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);
|
|
2743
2775
|
}, [
|
|
2744
2776
|
t,
|
|
2745
2777
|
u,
|
|
@@ -2749,8 +2781,8 @@ function Lt(e) {
|
|
|
2749
2781
|
}
|
|
2750
2782
|
//#endregion
|
|
2751
2783
|
//#region src/useGroupReorder.ts
|
|
2752
|
-
var
|
|
2753
|
-
function
|
|
2784
|
+
var zt = "text/x-group-key";
|
|
2785
|
+
function Bt({ groupKeys: e }) {
|
|
2754
2786
|
let [t, n] = s(e), [a, o] = s(null);
|
|
2755
2787
|
return i(() => {
|
|
2756
2788
|
n((t) => {
|
|
@@ -2769,14 +2801,14 @@ function zt({ groupKeys: e }) {
|
|
|
2769
2801
|
});
|
|
2770
2802
|
}, []),
|
|
2771
2803
|
onDragStart: r((e, t) => {
|
|
2772
|
-
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(
|
|
2804
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(zt, t), o(t);
|
|
2773
2805
|
}, []),
|
|
2774
2806
|
onDragOver: r((e) => {
|
|
2775
2807
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2776
2808
|
}, []),
|
|
2777
2809
|
onDrop: r((e, t) => {
|
|
2778
2810
|
e.preventDefault();
|
|
2779
|
-
let r = e.dataTransfer.getData(
|
|
2811
|
+
let r = e.dataTransfer.getData(zt);
|
|
2780
2812
|
!r || r === t || n((e) => {
|
|
2781
2813
|
let n = e.indexOf(r), i = e.indexOf(t);
|
|
2782
2814
|
if (n === -1 || i === -1) return e;
|
|
@@ -2792,7 +2824,7 @@ function zt({ groupKeys: e }) {
|
|
|
2792
2824
|
}
|
|
2793
2825
|
//#endregion
|
|
2794
2826
|
//#region src/FormulaBar.tsx
|
|
2795
|
-
function
|
|
2827
|
+
function Vt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, disabled: l = !1, className: u }) {
|
|
2796
2828
|
let [d, f] = s(!1), [p, m] = s(e), h = o(null);
|
|
2797
2829
|
i(() => {
|
|
2798
2830
|
d || m(e);
|
|
@@ -2812,15 +2844,15 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2812
2844
|
}, [e, a]), y = r((e) => {
|
|
2813
2845
|
e.key === "Enter" ? (e.preventDefault(), _()) : e.key === "Escape" && (e.preventDefault(), v());
|
|
2814
2846
|
}, [_, v]);
|
|
2815
|
-
return /* @__PURE__ */ (0,
|
|
2816
|
-
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),
|
|
2817
2849
|
children: [
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2819
|
-
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", {
|
|
2820
2852
|
className: "min-w-[4rem] shrink-0 rounded bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
2821
2853
|
children: c
|
|
2822
2854
|
}),
|
|
2823
|
-
/* @__PURE__ */ (0,
|
|
2855
|
+
/* @__PURE__ */ (0, K.jsx)("input", {
|
|
2824
2856
|
ref: h,
|
|
2825
2857
|
type: "text",
|
|
2826
2858
|
value: d ? p : e,
|
|
@@ -2829,22 +2861,22 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2829
2861
|
onClick: g,
|
|
2830
2862
|
onChange: (e) => m(e.target.value),
|
|
2831
2863
|
onKeyDown: y,
|
|
2832
|
-
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")
|
|
2833
2865
|
}),
|
|
2834
|
-
d && /* @__PURE__ */ (0,
|
|
2866
|
+
d && /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2835
2867
|
className: "flex items-center gap-1",
|
|
2836
|
-
children: [/* @__PURE__ */ (0,
|
|
2868
|
+
children: [/* @__PURE__ */ (0, K.jsx)("button", {
|
|
2837
2869
|
type: "button",
|
|
2838
2870
|
onClick: _,
|
|
2839
2871
|
className: "rounded p-0.5 text-green-600 hover:bg-green-100",
|
|
2840
2872
|
"aria-label": "Confirm",
|
|
2841
|
-
children: /* @__PURE__ */ (0,
|
|
2842
|
-
}), /* @__PURE__ */ (0,
|
|
2873
|
+
children: /* @__PURE__ */ (0, K.jsx)(z, { className: "h-4 w-4" })
|
|
2874
|
+
}), /* @__PURE__ */ (0, K.jsx)("button", {
|
|
2843
2875
|
type: "button",
|
|
2844
2876
|
onClick: v,
|
|
2845
2877
|
className: "rounded p-0.5 text-red-600 hover:bg-red-100",
|
|
2846
2878
|
"aria-label": "Cancel",
|
|
2847
|
-
children: /* @__PURE__ */ (0,
|
|
2879
|
+
children: /* @__PURE__ */ (0, K.jsx)(H, { className: "h-4 w-4" })
|
|
2848
2880
|
})]
|
|
2849
2881
|
})
|
|
2850
2882
|
]
|
|
@@ -2852,7 +2884,7 @@ function Bt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2852
2884
|
}
|
|
2853
2885
|
//#endregion
|
|
2854
2886
|
//#region src/SplitPaneGrid.tsx
|
|
2855
|
-
function
|
|
2887
|
+
function Ht({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollableWidth: i = 200, left: a, right: c, className: l }) {
|
|
2856
2888
|
let u = o(null), [d, f] = s(e), p = o(!1), m = o(0), h = o(0), g = t ? e : d, _ = r((e) => {
|
|
2857
2889
|
e.preventDefault(), p.current = !0, m.current = e.clientX, h.current = g;
|
|
2858
2890
|
let r = (e) => {
|
|
@@ -2869,23 +2901,23 @@ function Vt({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2869
2901
|
i,
|
|
2870
2902
|
t
|
|
2871
2903
|
]);
|
|
2872
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
+
return /* @__PURE__ */ (0, K.jsxs)("div", {
|
|
2873
2905
|
ref: u,
|
|
2874
|
-
className:
|
|
2906
|
+
className: R("flex h-full w-full overflow-hidden", l),
|
|
2875
2907
|
children: [
|
|
2876
|
-
/* @__PURE__ */ (0,
|
|
2908
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2877
2909
|
className: "shrink-0 overflow-auto",
|
|
2878
2910
|
style: { width: g },
|
|
2879
2911
|
children: a
|
|
2880
2912
|
}),
|
|
2881
|
-
/* @__PURE__ */ (0,
|
|
2913
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2882
2914
|
role: "separator",
|
|
2883
2915
|
"aria-orientation": "vertical",
|
|
2884
2916
|
onPointerDown: _,
|
|
2885
|
-
className:
|
|
2886
|
-
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" })
|
|
2887
2919
|
}),
|
|
2888
|
-
/* @__PURE__ */ (0,
|
|
2920
|
+
/* @__PURE__ */ (0, K.jsx)("div", {
|
|
2889
2921
|
className: "min-w-0 flex-1 overflow-auto",
|
|
2890
2922
|
children: c
|
|
2891
2923
|
})
|
|
@@ -2894,15 +2926,15 @@ function Vt({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2894
2926
|
}
|
|
2895
2927
|
//#endregion
|
|
2896
2928
|
//#region src/index.tsx
|
|
2897
|
-
var
|
|
2929
|
+
var Ut = ({ schema: e, ...t }) => {
|
|
2898
2930
|
let { dataSource: n } = _() || {};
|
|
2899
|
-
return /* @__PURE__ */ (0,
|
|
2931
|
+
return /* @__PURE__ */ (0, K.jsx)(ot, {
|
|
2900
2932
|
schema: e,
|
|
2901
2933
|
dataSource: n,
|
|
2902
2934
|
...t
|
|
2903
2935
|
});
|
|
2904
2936
|
};
|
|
2905
|
-
c.register("object-grid",
|
|
2937
|
+
c.register("object-grid", Ut, {
|
|
2906
2938
|
namespace: "plugin-grid",
|
|
2907
2939
|
label: "Object Grid",
|
|
2908
2940
|
category: "plugin",
|
|
@@ -2924,7 +2956,7 @@ c.register("object-grid", Ht, {
|
|
|
2924
2956
|
label: "Filters"
|
|
2925
2957
|
}
|
|
2926
2958
|
]
|
|
2927
|
-
}), c.register("grid",
|
|
2959
|
+
}), c.register("grid", Ut, {
|
|
2928
2960
|
namespace: "view",
|
|
2929
2961
|
label: "Data Grid",
|
|
2930
2962
|
category: "view",
|
|
@@ -2948,7 +2980,7 @@ c.register("object-grid", Ht, {
|
|
|
2948
2980
|
]
|
|
2949
2981
|
}), c.register("import-wizard", ({ schema: e, ...t }) => {
|
|
2950
2982
|
let { dataSource: n } = _() || {};
|
|
2951
|
-
return /* @__PURE__ */ (0,
|
|
2983
|
+
return /* @__PURE__ */ (0, K.jsx)(jt, {
|
|
2952
2984
|
objectName: e.objectName,
|
|
2953
2985
|
objectLabel: e.objectLabel,
|
|
2954
2986
|
fields: e.fields ?? [],
|
|
@@ -2972,4 +3004,4 @@ c.register("object-grid", Ht, {
|
|
|
2972
3004
|
}]
|
|
2973
3005
|
});
|
|
2974
3006
|
//#endregion
|
|
2975
|
-
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 };
|