@object-ui/plugin-grid 3.3.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/dist/index.js +959 -653
- package/dist/index.umd.cjs +8 -8
- package/dist/packages/plugin-grid/src/ImportWizard.d.ts +40 -0
- package/dist/packages/plugin-grid/src/useGroupedData.d.ts +25 -4
- package/package.json +10 -10
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, EmptyValue as ae, NavigationOverlay 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 j, ExportProgressDialog as ae, Input as M, NavigationOverlay as oe, Popover as se, PopoverContent as N, PopoverTrigger as P, Progress as ce, Select as F, SelectContent as I, SelectItem as L, SelectTrigger as R, SelectValue as le, Table as ue, TableBody as de, TableCell as z, TableHead as B, TableHeader as fe, TableRow as V, cn as H, useExportJob as pe } from "@object-ui/components";
|
|
7
|
+
import { AlertCircle as U, AlignJustify as me, ArrowLeft as he, ArrowRight as ge, Calendar as _e, Check as ve, CheckCircle2 as ye, CheckSquare as be, ChevronDown as W, ChevronRight as xe, Clock as Se, Download as Ce, Edit as we, FileSpreadsheet as Te, FunctionSquare as Ee, GripVertical as De, Hash as Oe, MoreVertical as ke, Rows2 as Ae, Rows3 as je, Rows4 as Me, Save as Ne, Tag as Pe, Trash2 as Fe, Type as Ie, Upload as G, User as Le, X as K } from "lucide-react";
|
|
8
|
+
import { flushSync as q } from "react-dom";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
|
-
var
|
|
10
|
+
var J = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), Y = /* @__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 Re(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 ze(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 ze = /* @__PURE__ */ J(((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 G = /* @__PURE__ */ W(((e) => {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
80
|
-
})),
|
|
80
|
+
})), X = /* @__PURE__ */ J(((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 G = /* @__PURE__ */ W(((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}", ae[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), ae[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 G = /* @__PURE__ */ W(((e) => {
|
|
|
220
220
|
function p(e) {
|
|
221
221
|
return typeof e == "object" && !!e && e.$$typeof === h;
|
|
222
222
|
}
|
|
223
|
-
var m =
|
|
223
|
+
var m = Y("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)(), j = D(i(o)), ae = {};
|
|
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)) : j);
|
|
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)) : j);
|
|
236
236
|
};
|
|
237
237
|
})();
|
|
238
|
-
})),
|
|
239
|
-
process.env.NODE_ENV === "production" ? t.exports =
|
|
240
|
-
})))(),
|
|
241
|
-
|
|
238
|
+
})), Z = (/* @__PURE__ */ J(((e, t) => {
|
|
239
|
+
process.env.NODE_ENV === "production" ? t.exports = ze() : t.exports = X();
|
|
240
|
+
})))(), Be = n(null);
|
|
241
|
+
Be.displayName = "MobileContext";
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/useRowColor.ts
|
|
244
|
-
var
|
|
244
|
+
var Ve = {
|
|
245
245
|
red: "bg-red-100",
|
|
246
246
|
green: "bg-green-100",
|
|
247
247
|
blue: "bg-blue-100",
|
|
@@ -266,28 +266,59 @@ var q = {
|
|
|
266
266
|
stone: "bg-stone-100",
|
|
267
267
|
neutral: "bg-neutral-100"
|
|
268
268
|
};
|
|
269
|
-
function
|
|
270
|
-
return e.startsWith("bg-") ? e :
|
|
269
|
+
function Q(e) {
|
|
270
|
+
return e.startsWith("bg-") ? e : Ve[e.toLowerCase().trim()];
|
|
271
271
|
}
|
|
272
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 Q(r);
|
|
277
277
|
}, [e?.field, e?.colors]);
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/useGroupedData.ts
|
|
281
|
-
function Ue(e
|
|
282
|
-
|
|
281
|
+
function Ue(e) {
|
|
282
|
+
if (e == null || e === "") return "";
|
|
283
|
+
if (Array.isArray(e)) return e.map((e) => Ue(e)).join("|");
|
|
284
|
+
if (typeof e == "object") {
|
|
285
|
+
let t = e.id ?? e._id ?? e.pk ?? e.value;
|
|
286
|
+
if (t != null && t !== "") return String(t);
|
|
287
|
+
let n = e.name ?? e.label ?? e.title;
|
|
288
|
+
if (n != null && n !== "") return String(n);
|
|
289
|
+
try {
|
|
290
|
+
return JSON.stringify(e);
|
|
291
|
+
} catch {
|
|
292
|
+
return "";
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return String(e);
|
|
283
296
|
}
|
|
284
297
|
function We(e, t) {
|
|
285
|
-
return
|
|
286
|
-
|
|
298
|
+
return Ue(e[t]);
|
|
299
|
+
}
|
|
300
|
+
function Ge(e, t, n) {
|
|
301
|
+
if (e == null || e === "") return "(empty)";
|
|
302
|
+
if (n) {
|
|
303
|
+
let r = n(t, e);
|
|
304
|
+
if (r !== void 0 && r !== "") return r;
|
|
305
|
+
}
|
|
306
|
+
if (Array.isArray(e)) return e.map((e) => {
|
|
307
|
+
if (n) {
|
|
308
|
+
let r = n(t, e);
|
|
309
|
+
if (r !== void 0 && r !== "") return r;
|
|
310
|
+
}
|
|
311
|
+
return Ge(e, t);
|
|
312
|
+
}).join(", ") || "(empty)";
|
|
313
|
+
if (typeof e == "object") {
|
|
314
|
+
let t = e.name ?? e.label ?? e.title ?? e.display_name ?? e.displayName ?? e.fullName ?? e.full_name;
|
|
315
|
+
if (t != null && t !== "") return String(t);
|
|
316
|
+
let n = e.id ?? e._id ?? e.pk;
|
|
287
317
|
return n != null && n !== "" ? String(n) : "(empty)";
|
|
288
|
-
}
|
|
318
|
+
}
|
|
319
|
+
return String(e);
|
|
289
320
|
}
|
|
290
|
-
function
|
|
321
|
+
function Ke(e, t) {
|
|
291
322
|
return t.map(({ field: t, type: n }) => {
|
|
292
323
|
let r = e.map((e) => Number(e[t])).filter((e) => Number.isFinite(e)), i;
|
|
293
324
|
switch (n) {
|
|
@@ -315,73 +346,83 @@ function Ge(e, t) {
|
|
|
315
346
|
};
|
|
316
347
|
});
|
|
317
348
|
}
|
|
318
|
-
function
|
|
349
|
+
function qe(e, t, n) {
|
|
319
350
|
let r = e.localeCompare(t, void 0, {
|
|
320
351
|
numeric: !0,
|
|
321
352
|
sensitivity: "base"
|
|
322
353
|
});
|
|
323
354
|
return n === "desc" ? -r : r;
|
|
324
355
|
}
|
|
325
|
-
function
|
|
326
|
-
let
|
|
356
|
+
function Je(e, t, n, i) {
|
|
357
|
+
let o = e?.fields, c = !!(o && o.length > 0), [l, u] = s({});
|
|
327
358
|
return {
|
|
328
359
|
groups: a(() => {
|
|
329
|
-
if (!
|
|
330
|
-
let e =
|
|
331
|
-
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
let
|
|
341
|
-
return {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
360
|
+
if (!c || !o) return [];
|
|
361
|
+
let e = (t, r, a) => {
|
|
362
|
+
if (r >= o.length) return [];
|
|
363
|
+
let s = o[r], c = /* @__PURE__ */ new Map(), u = [];
|
|
364
|
+
for (let e of t) {
|
|
365
|
+
let t = We(e, s.field);
|
|
366
|
+
c.has(t) || (c.set(t, {
|
|
367
|
+
label: Ge(e[s.field], s.field, i),
|
|
368
|
+
rows: []
|
|
369
|
+
}), u.push(t)), c.get(t).rows.push(e);
|
|
370
|
+
}
|
|
371
|
+
let d = s.order ?? "asc";
|
|
372
|
+
return u.sort((e, t) => qe(c.get(e)?.label ?? e, c.get(t)?.label ?? t, d)), u.map((t) => {
|
|
373
|
+
let i = c.get(t), u = a ? `${a}__${r}:${t}` : `${r}:${t}`, d = !!s.collapsed, f = u in l ? l[u] : d, p = n && n.length > 0 ? Ke(i.rows, n) : [], m = r + 1 < o.length ? e(i.rows, r + 1, u) : [];
|
|
374
|
+
return {
|
|
375
|
+
key: u,
|
|
376
|
+
label: i.label,
|
|
377
|
+
field: s.field,
|
|
378
|
+
depth: r,
|
|
379
|
+
rows: i.rows,
|
|
380
|
+
collapsed: f,
|
|
381
|
+
aggregations: p,
|
|
382
|
+
subgroups: m
|
|
383
|
+
};
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
return e(t, 0, "");
|
|
349
387
|
}, [
|
|
350
388
|
t,
|
|
351
|
-
i,
|
|
352
389
|
o,
|
|
353
390
|
c,
|
|
354
|
-
|
|
355
|
-
n
|
|
391
|
+
l,
|
|
392
|
+
n,
|
|
393
|
+
i
|
|
356
394
|
]),
|
|
357
|
-
isGrouped:
|
|
395
|
+
isGrouped: c,
|
|
358
396
|
toggleGroup: r((e) => {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
397
|
+
u((t) => {
|
|
398
|
+
let n = e.split("__").pop() || "", r = /^(\d+):/.exec(n), i = r ? Number(r[1]) : 0, a = !!o?.[i]?.collapsed;
|
|
399
|
+
return {
|
|
400
|
+
...t,
|
|
401
|
+
[e]: t[e] === void 0 ? !a : !t[e]
|
|
402
|
+
};
|
|
403
|
+
});
|
|
404
|
+
}, [o])
|
|
364
405
|
};
|
|
365
406
|
}
|
|
366
407
|
//#endregion
|
|
367
408
|
//#region src/GroupRow.tsx
|
|
368
|
-
var
|
|
409
|
+
var Ye = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onToggle: a, children: o }) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
369
410
|
className: "border rounded-md",
|
|
370
411
|
"data-testid": `group-row-${e}`,
|
|
371
|
-
children: [/* @__PURE__ */ (0,
|
|
412
|
+
children: [/* @__PURE__ */ (0, Z.jsxs)("button", {
|
|
372
413
|
type: "button",
|
|
373
414
|
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
415
|
onClick: () => a(e),
|
|
375
416
|
"aria-expanded": !r,
|
|
376
417
|
children: [
|
|
377
|
-
r ? /* @__PURE__ */ (0,
|
|
378
|
-
/* @__PURE__ */ (0,
|
|
418
|
+
r ? /* @__PURE__ */ (0, Z.jsx)(xe, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ (0, Z.jsx)(W, { className: "h-4 w-4 shrink-0" }),
|
|
419
|
+
/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
379
420
|
className: "group-label",
|
|
380
421
|
children: t
|
|
381
422
|
}),
|
|
382
|
-
i && i.length > 0 && /* @__PURE__ */ (0,
|
|
423
|
+
i && i.length > 0 && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
383
424
|
className: "ml-2 text-xs text-muted-foreground group-aggregations",
|
|
384
|
-
children: i.map((e) => /* @__PURE__ */ (0,
|
|
425
|
+
children: i.map((e) => /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
385
426
|
className: "mr-2",
|
|
386
427
|
children: [
|
|
387
428
|
e.type,
|
|
@@ -390,7 +431,7 @@ var Je = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onTo
|
|
|
390
431
|
]
|
|
391
432
|
}, `${e.field}-${e.type}`))
|
|
392
433
|
}),
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
434
|
+
/* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
394
435
|
className: "ml-auto text-xs text-muted-foreground group-count",
|
|
395
436
|
children: [
|
|
396
437
|
"(",
|
|
@@ -403,10 +444,10 @@ var Je = ({ groupKey: e, label: t, count: n, collapsed: r, aggregations: i, onTo
|
|
|
403
444
|
});
|
|
404
445
|
//#endregion
|
|
405
446
|
//#region src/useColumnSummary.ts
|
|
406
|
-
function
|
|
447
|
+
function Xe(e) {
|
|
407
448
|
return typeof e == "string" ? { type: e } : e;
|
|
408
449
|
}
|
|
409
|
-
function
|
|
450
|
+
function Ze(e, t) {
|
|
410
451
|
if (t.length === 0) return null;
|
|
411
452
|
switch (e) {
|
|
412
453
|
case "count": return t.length;
|
|
@@ -417,7 +458,7 @@ function Xe(e, t) {
|
|
|
417
458
|
default: return null;
|
|
418
459
|
}
|
|
419
460
|
}
|
|
420
|
-
function
|
|
461
|
+
function Qe(e, t) {
|
|
421
462
|
return t === null ? "" : `${{
|
|
422
463
|
count: "Count",
|
|
423
464
|
sum: "Sum",
|
|
@@ -426,7 +467,7 @@ function Ze(e, t) {
|
|
|
426
467
|
max: "Max"
|
|
427
468
|
}[e] || e}: ${e === "avg" ? t.toLocaleString(void 0, { maximumFractionDigits: 2 }) : t.toLocaleString()}`;
|
|
428
469
|
}
|
|
429
|
-
function
|
|
470
|
+
function $e(e, t) {
|
|
430
471
|
return a(() => {
|
|
431
472
|
let n = /* @__PURE__ */ new Map();
|
|
432
473
|
if (!e || e.length === 0 || t.length === 0) return {
|
|
@@ -435,7 +476,7 @@ function Qe(e, t) {
|
|
|
435
476
|
};
|
|
436
477
|
for (let r of e) {
|
|
437
478
|
if (!r.summary) continue;
|
|
438
|
-
let e =
|
|
479
|
+
let e = Xe(r.summary), i = e.field || r.field, a = [];
|
|
439
480
|
for (let e of t) {
|
|
440
481
|
let t = e[i];
|
|
441
482
|
if (t != null && typeof t == "number" && !isNaN(t)) a.push(t);
|
|
@@ -448,11 +489,11 @@ function Qe(e, t) {
|
|
|
448
489
|
if (e.type === "count") {
|
|
449
490
|
let e = t.filter((e) => e[i] != null && e[i] !== "").length;
|
|
450
491
|
o = e > 0 ? e : null;
|
|
451
|
-
} else o =
|
|
492
|
+
} else o = Ze(e.type, a);
|
|
452
493
|
n.set(r.field, {
|
|
453
494
|
field: r.field,
|
|
454
495
|
value: o,
|
|
455
|
-
label:
|
|
496
|
+
label: Qe(e.type, o)
|
|
456
497
|
});
|
|
457
498
|
}
|
|
458
499
|
return {
|
|
@@ -463,58 +504,58 @@ function Qe(e, t) {
|
|
|
463
504
|
}
|
|
464
505
|
//#endregion
|
|
465
506
|
//#region src/components/RowActionMenu.tsx
|
|
466
|
-
function
|
|
507
|
+
function et(e) {
|
|
467
508
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
468
509
|
}
|
|
469
|
-
var
|
|
510
|
+
var tt = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete: a, onAction: o }) => /* @__PURE__ */ (0, Z.jsxs)(D, { children: [/* @__PURE__ */ (0, Z.jsx)(A, {
|
|
470
511
|
asChild: !0,
|
|
471
|
-
children: /* @__PURE__ */ (0,
|
|
512
|
+
children: /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
472
513
|
variant: "ghost",
|
|
473
514
|
size: "icon",
|
|
474
515
|
className: "h-8 w-8 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0",
|
|
475
516
|
"data-testid": "row-action-trigger",
|
|
476
|
-
children: [/* @__PURE__ */ (0,
|
|
517
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(ke, { className: "h-4 w-4" }), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
477
518
|
className: "sr-only",
|
|
478
519
|
children: "Open menu"
|
|
479
520
|
})]
|
|
480
521
|
})
|
|
481
|
-
}), /* @__PURE__ */ (0,
|
|
522
|
+
}), /* @__PURE__ */ (0, Z.jsxs)(O, {
|
|
482
523
|
align: "end",
|
|
483
524
|
children: [
|
|
484
|
-
n && i && /* @__PURE__ */ (0,
|
|
525
|
+
n && i && /* @__PURE__ */ (0, Z.jsxs)(k, {
|
|
485
526
|
onClick: () => i(e),
|
|
486
|
-
children: [/* @__PURE__ */ (0,
|
|
527
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(we, { className: "mr-2 h-4 w-4" }), "Edit"]
|
|
487
528
|
}),
|
|
488
|
-
r && a && /* @__PURE__ */ (0,
|
|
529
|
+
r && a && /* @__PURE__ */ (0, Z.jsxs)(k, {
|
|
489
530
|
onClick: () => a(e),
|
|
490
|
-
children: [/* @__PURE__ */ (0,
|
|
531
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(Fe, { className: "mr-2 h-4 w-4" }), "Delete"]
|
|
491
532
|
}),
|
|
492
|
-
t?.map((t) => /* @__PURE__ */ (0,
|
|
533
|
+
t?.map((t) => /* @__PURE__ */ (0, Z.jsx)(k, {
|
|
493
534
|
onClick: () => o?.(t, e),
|
|
494
535
|
"data-testid": `row-action-${t}`,
|
|
495
|
-
children:
|
|
536
|
+
children: et(t)
|
|
496
537
|
}, t))
|
|
497
538
|
]
|
|
498
|
-
})] }),
|
|
539
|
+
})] }), nt = ({ selectedRows: e, actions: t, onAction: n, onClearSelection: r }) => !t || t.length === 0 || e.length === 0 ? null : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
499
540
|
className: "border-t px-4 py-1.5 flex items-center gap-2 text-xs bg-primary/5 shrink-0",
|
|
500
541
|
"data-testid": "bulk-actions-bar",
|
|
501
542
|
children: [
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
543
|
+
/* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
503
544
|
className: "text-muted-foreground font-medium",
|
|
504
545
|
children: [e.length, " selected"]
|
|
505
546
|
}),
|
|
506
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
507
548
|
className: "flex items-center gap-1 ml-2",
|
|
508
|
-
children: t.map((t) => /* @__PURE__ */ (0,
|
|
549
|
+
children: t.map((t) => /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
509
550
|
variant: "outline",
|
|
510
551
|
size: "sm",
|
|
511
552
|
className: "h-6 px-2 text-xs",
|
|
512
553
|
onClick: () => n?.(t, e),
|
|
513
554
|
"data-testid": `bulk-action-${t}`,
|
|
514
|
-
children:
|
|
555
|
+
children: et(t)
|
|
515
556
|
}, t))
|
|
516
557
|
}),
|
|
517
|
-
/* @__PURE__ */ (0,
|
|
558
|
+
/* @__PURE__ */ (0, Z.jsx)(T, {
|
|
518
559
|
variant: "ghost",
|
|
519
560
|
size: "sm",
|
|
520
561
|
className: "h-6 px-2 text-xs ml-auto",
|
|
@@ -522,7 +563,7 @@ var et = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete
|
|
|
522
563
|
children: "Clear"
|
|
523
564
|
})
|
|
524
565
|
]
|
|
525
|
-
}),
|
|
566
|
+
}), rt = {
|
|
526
567
|
"grid.actions": "Actions",
|
|
527
568
|
"grid.edit": "Edit",
|
|
528
569
|
"grid.delete": "Delete",
|
|
@@ -534,26 +575,26 @@ var et = ({ row: e, rowActions: t, canEdit: n, canDelete: r, onEdit: i, onDelete
|
|
|
534
575
|
"grid.refreshing": "Refreshing…",
|
|
535
576
|
"grid.openRecord": "Open record"
|
|
536
577
|
};
|
|
537
|
-
function
|
|
578
|
+
function it() {
|
|
538
579
|
try {
|
|
539
580
|
let e = h();
|
|
540
581
|
return e.t("grid.actions") === "grid.actions" ? { t: (e, t) => {
|
|
541
|
-
let n =
|
|
582
|
+
let n = rt[e] || e;
|
|
542
583
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
543
584
|
return n;
|
|
544
585
|
} } : { t: e.t };
|
|
545
586
|
} catch {
|
|
546
587
|
return { t: (e, t) => {
|
|
547
|
-
let n =
|
|
588
|
+
let n = rt[e] || e;
|
|
548
589
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
549
590
|
return n;
|
|
550
591
|
} };
|
|
551
592
|
}
|
|
552
593
|
}
|
|
553
|
-
function
|
|
594
|
+
function at(e) {
|
|
554
595
|
if (e != null) return typeof e == "string" ? e : void 0;
|
|
555
596
|
}
|
|
556
|
-
function
|
|
597
|
+
function ot(e) {
|
|
557
598
|
return e.data ? Array.isArray(e.data) ? {
|
|
558
599
|
provider: "value",
|
|
559
600
|
items: e.data
|
|
@@ -565,101 +606,101 @@ function it(e) {
|
|
|
565
606
|
object: e.objectName
|
|
566
607
|
} : null;
|
|
567
608
|
}
|
|
568
|
-
function
|
|
609
|
+
function st(e) {
|
|
569
610
|
if (!(!e || e.length === 0)) return typeof e[0] == "object" && e[0], e;
|
|
570
611
|
}
|
|
571
|
-
var
|
|
572
|
-
let [E, ie] = s([]), [D, O] = s(!0), [k, A] = s(null), { t: M } =
|
|
612
|
+
var ct = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, onRowClick: h, onCellChange: _, onRowSave: ee, onBatchSave: te, onAddRecord: ne, ...re }) => {
|
|
613
|
+
let [E, ie] = s([]), [D, O] = s(!0), [k, A] = s(null), { t: M } = it(), { fieldLabel: ce, translateOptions: F } = g(), [I, L] = s(null), [R, le] = s(!1), [ue, de] = s(0), [z, B] = s(!1), [fe, V] = s(!1), H = pe({ dataSource: n }), [U, he] = s(e.rowHeight ?? "compact"), [ge, ve] = s([]), ye = t.useMemo(() => e.id ? `grid-columns-${e.objectName}-${e.id}` : `grid-columns-${e.objectName}`, [e.objectName, e.id]), [W, xe] = s(() => {
|
|
573
614
|
try {
|
|
574
|
-
let e = localStorage.getItem(
|
|
615
|
+
let e = localStorage.getItem(ye);
|
|
575
616
|
return e ? JSON.parse(e) : {};
|
|
576
617
|
} catch {
|
|
577
618
|
return {};
|
|
578
619
|
}
|
|
579
|
-
}),
|
|
580
|
-
|
|
620
|
+
}), we = r((e) => {
|
|
621
|
+
xe(e);
|
|
581
622
|
try {
|
|
582
|
-
localStorage.setItem(
|
|
623
|
+
localStorage.setItem(ye, JSON.stringify(e));
|
|
583
624
|
} catch (e) {
|
|
584
625
|
console.warn("Failed to persist column state:", e);
|
|
585
626
|
}
|
|
586
|
-
}, [
|
|
627
|
+
}, [ye]), { ref: Te, isRefreshing: Ee, pullDistance: De } = Re({
|
|
587
628
|
onRefresh: r(async () => {
|
|
588
|
-
|
|
629
|
+
de((e) => e + 1);
|
|
589
630
|
}, []),
|
|
590
631
|
enabled: !!n && !!e.objectName
|
|
591
632
|
});
|
|
592
633
|
i(() => {
|
|
593
|
-
let e = () =>
|
|
634
|
+
let e = () => le(window.innerWidth < 480);
|
|
594
635
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
595
636
|
}, []);
|
|
596
|
-
let
|
|
597
|
-
provider: "value",
|
|
598
|
-
items: Oe
|
|
599
|
-
} : ke && Array.isArray(ke) ? {
|
|
637
|
+
let ke = re.data, Ne = p(e.bind), Fe = ot(e), G = t.useMemo(() => ke && Array.isArray(ke) ? {
|
|
600
638
|
provider: "value",
|
|
601
639
|
items: ke
|
|
602
|
-
} :
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
640
|
+
} : Ne && Array.isArray(Ne) ? {
|
|
641
|
+
provider: "value",
|
|
642
|
+
items: Ne
|
|
643
|
+
} : Fe, [
|
|
644
|
+
JSON.stringify(Fe),
|
|
645
|
+
Ne,
|
|
646
|
+
ke
|
|
647
|
+
]), K = G?.provider === "value", q = G?.provider === "object" && G && "object" in G ? G.object : e.objectName, J = e.fields, Y = e.columns, ze = e.filter, X = e.sort, Be = e.pagination, Ve = e.pageSize;
|
|
607
648
|
i(() => {
|
|
608
|
-
|
|
609
|
-
let t =
|
|
649
|
+
K && G?.provider === "value" && (ie((e) => {
|
|
650
|
+
let t = G.items;
|
|
610
651
|
return JSON.stringify(e) === JSON.stringify(t) ? e : t;
|
|
611
652
|
}), O(!1));
|
|
612
|
-
}, [
|
|
613
|
-
if (!
|
|
653
|
+
}, [K, G]), i(() => {
|
|
654
|
+
if (!K || !q || !n) return;
|
|
614
655
|
let e = !1;
|
|
615
656
|
return (async () => {
|
|
616
657
|
try {
|
|
617
658
|
if (typeof n.getObjectSchema != "function") return;
|
|
618
|
-
let t = await n.getObjectSchema(
|
|
619
|
-
e ||
|
|
659
|
+
let t = await n.getObjectSchema(q);
|
|
660
|
+
e || L(t);
|
|
620
661
|
} catch (e) {
|
|
621
|
-
console.warn(`[ObjectGrid] Failed to fetch objectSchema for inline data (objectName: ${
|
|
662
|
+
console.warn(`[ObjectGrid] Failed to fetch objectSchema for inline data (objectName: ${q}):`, e);
|
|
622
663
|
}
|
|
623
664
|
})(), () => {
|
|
624
665
|
e = !0;
|
|
625
666
|
};
|
|
626
667
|
}, [
|
|
627
|
-
|
|
628
|
-
|
|
668
|
+
K,
|
|
669
|
+
q,
|
|
629
670
|
n
|
|
630
671
|
]), i(() => {
|
|
631
|
-
if (
|
|
672
|
+
if (K) return;
|
|
632
673
|
let t = !1;
|
|
633
674
|
return (async () => {
|
|
634
675
|
O(!0), A(null);
|
|
635
676
|
try {
|
|
636
|
-
let r = null, i =
|
|
637
|
-
if (
|
|
638
|
-
let e = await n.getObjectSchema(
|
|
677
|
+
let r = null, i = st(Y) || J;
|
|
678
|
+
if (q && n) if (typeof n.getObjectSchema == "function") {
|
|
679
|
+
let e = await n.getObjectSchema(q);
|
|
639
680
|
if (t) return;
|
|
640
681
|
r = e;
|
|
641
682
|
} else r = {
|
|
642
|
-
name:
|
|
683
|
+
name: q,
|
|
643
684
|
fields: {}
|
|
644
685
|
};
|
|
645
|
-
else if (i &&
|
|
646
|
-
name:
|
|
686
|
+
else if (i && q) r = {
|
|
687
|
+
name: q,
|
|
647
688
|
fields: {}
|
|
648
689
|
};
|
|
649
|
-
else if (
|
|
690
|
+
else if (q) throw Error("DataSource required");
|
|
650
691
|
else throw Error("Object name required for data fetching");
|
|
651
|
-
if (t ||
|
|
692
|
+
if (t || L(r), n && q) {
|
|
652
693
|
let i = {
|
|
653
694
|
$select: (() => {
|
|
654
|
-
if (
|
|
655
|
-
if (
|
|
695
|
+
if (J) return J;
|
|
696
|
+
if (Y && Array.isArray(Y)) return Y.map((e) => typeof e == "string" ? e : e.field);
|
|
656
697
|
})(),
|
|
657
698
|
$top: Be?.pageSize || Ve || 50
|
|
658
699
|
};
|
|
659
|
-
|
|
660
|
-
let a = l(r?.fields,
|
|
700
|
+
ze && Array.isArray(ze) ? i.$filter = ze : e.defaultFilters && (i.$filter = e.defaultFilters), X ? typeof X == "string" ? i.$orderby = X : Array.isArray(X) && (i.$orderby = X.map((e) => `${e.field} ${e.order}`).join(", ")) : e.defaultSort && (i.$orderby = `${e.defaultSort.field} ${e.defaultSort.order}`);
|
|
701
|
+
let a = l(r?.fields, Y ?? J);
|
|
661
702
|
a.length > 0 && (i.$expand = a);
|
|
662
|
-
let o = await n.find(
|
|
703
|
+
let o = await n.find(q, i);
|
|
663
704
|
if (t) return;
|
|
664
705
|
ie(o.data || []);
|
|
665
706
|
}
|
|
@@ -672,24 +713,24 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
672
713
|
t = !0;
|
|
673
714
|
};
|
|
674
715
|
}, [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
716
|
+
q,
|
|
717
|
+
J,
|
|
718
|
+
Y,
|
|
719
|
+
ze,
|
|
720
|
+
X,
|
|
680
721
|
Be,
|
|
681
722
|
Ve,
|
|
682
723
|
n,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
724
|
+
K,
|
|
725
|
+
G,
|
|
726
|
+
ue
|
|
686
727
|
]);
|
|
687
|
-
let
|
|
728
|
+
let Q = m({
|
|
688
729
|
navigation: e.navigation,
|
|
689
730
|
objectName: e.objectName,
|
|
690
731
|
onNavigate: e.onNavigate,
|
|
691
732
|
onRowClick: h
|
|
692
|
-
}), { execute:
|
|
733
|
+
}), { execute: Ue } = f(), We = He(e.rowColor), Ge = r((t) => {
|
|
693
734
|
let n = e.conditionalFormatting;
|
|
694
735
|
if (!(!n || n.length === 0)) for (let e of n) {
|
|
695
736
|
let n = !1, r = ("condition" in e ? e.condition : void 0) || ("expression" in e ? e.expression : void 0) || void 0;
|
|
@@ -722,21 +763,59 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
722
763
|
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;
|
|
723
764
|
}
|
|
724
765
|
}
|
|
725
|
-
}, [e.conditionalFormatting]),
|
|
726
|
-
let t =
|
|
766
|
+
}, [e.conditionalFormatting]), Ke = t.useMemo(() => {
|
|
767
|
+
let t = e.grouping;
|
|
768
|
+
if (!t?.fields?.length) return;
|
|
769
|
+
let n = /* @__PURE__ */ new Map();
|
|
770
|
+
for (let r of t.fields) {
|
|
771
|
+
let t = r.field, i = I?.fields?.[t], a = st(e.columns)?.find?.((e) => typeof e == "object" && e?.field === t), o = a?.type || i?.type, s = a?.options || i?.options, c = /* @__PURE__ */ new Map();
|
|
772
|
+
if (Array.isArray(s) && s.length > 0) {
|
|
773
|
+
let n = e.objectName ? F(e.objectName, t, s) : s;
|
|
774
|
+
for (let e of n) if (e && e.value !== void 0 && e.value !== null) {
|
|
775
|
+
let t = e.label;
|
|
776
|
+
c.set(String(e.value), String(t ?? e.value));
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
n.set(t, {
|
|
780
|
+
type: o || void 0,
|
|
781
|
+
options: c.size > 0 ? c : void 0
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
return (e, t) => {
|
|
785
|
+
let r = n.get(e);
|
|
786
|
+
if (r) {
|
|
787
|
+
if (r.options) {
|
|
788
|
+
let e = r.options.get(String(t));
|
|
789
|
+
if (e !== void 0) return e;
|
|
790
|
+
}
|
|
791
|
+
if (r.type === "boolean" || typeof t == "boolean") {
|
|
792
|
+
if (t === !0 || t === "true") return M("grid.booleanTrue", "Yes");
|
|
793
|
+
if (t === !1 || t === "false") return M("grid.booleanFalse", "No");
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
}, [
|
|
798
|
+
e.grouping,
|
|
799
|
+
e.columns,
|
|
800
|
+
e.objectName,
|
|
801
|
+
I,
|
|
802
|
+
F,
|
|
803
|
+
M
|
|
804
|
+
]), { groups: qe, isGrouped: Xe, toggleGroup: Ze } = Je(e.grouping, E, void 0, Ke), { summaries: Qe, hasSummary: rt } = $e(t.useMemo(() => {
|
|
805
|
+
let t = st(e.columns);
|
|
727
806
|
if (t && t.length > 0 && typeof t[0] == "object") return t;
|
|
728
|
-
}, [e.columns]), E),
|
|
807
|
+
}, [e.columns]), E), ct = r(() => {
|
|
729
808
|
let t = (e) => e && {
|
|
730
|
-
text: /* @__PURE__ */ (0,
|
|
731
|
-
number: /* @__PURE__ */ (0,
|
|
732
|
-
currency: /* @__PURE__ */ (0,
|
|
733
|
-
percent: /* @__PURE__ */ (0,
|
|
734
|
-
date: /* @__PURE__ */ (0,
|
|
735
|
-
datetime: /* @__PURE__ */ (0,
|
|
736
|
-
boolean: /* @__PURE__ */ (0,
|
|
737
|
-
user: /* @__PURE__ */ (0,
|
|
738
|
-
select: /* @__PURE__ */ (0,
|
|
739
|
-
}[e] || /* @__PURE__ */ (0,
|
|
809
|
+
text: /* @__PURE__ */ (0, Z.jsx)(Ie, { className: "h-3.5 w-3.5" }),
|
|
810
|
+
number: /* @__PURE__ */ (0, Z.jsx)(Oe, { className: "h-3.5 w-3.5" }),
|
|
811
|
+
currency: /* @__PURE__ */ (0, Z.jsx)(Oe, { className: "h-3.5 w-3.5" }),
|
|
812
|
+
percent: /* @__PURE__ */ (0, Z.jsx)(Oe, { className: "h-3.5 w-3.5" }),
|
|
813
|
+
date: /* @__PURE__ */ (0, Z.jsx)(_e, { className: "h-3.5 w-3.5" }),
|
|
814
|
+
datetime: /* @__PURE__ */ (0, Z.jsx)(Se, { className: "h-3.5 w-3.5" }),
|
|
815
|
+
boolean: /* @__PURE__ */ (0, Z.jsx)(be, { className: "h-3.5 w-3.5" }),
|
|
816
|
+
user: /* @__PURE__ */ (0, Z.jsx)(Le, { className: "h-3.5 w-3.5" }),
|
|
817
|
+
select: /* @__PURE__ */ (0, Z.jsx)(Pe, { className: "h-3.5 w-3.5" })
|
|
818
|
+
}[e] || /* @__PURE__ */ (0, Z.jsx)(Ie, { className: "h-3.5 w-3.5" }), n = (e) => {
|
|
740
819
|
if (e.type) return e.type;
|
|
741
820
|
let t = e.field.toLowerCase();
|
|
742
821
|
if ([
|
|
@@ -815,7 +894,7 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
815
894
|
if (typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(t)) return "datetime";
|
|
816
895
|
}
|
|
817
896
|
return null;
|
|
818
|
-
}, r =
|
|
897
|
+
}, r = st(Y);
|
|
819
898
|
if (r) {
|
|
820
899
|
if (r.length > 0 && typeof r[0] == "object" && r[0] !== null) {
|
|
821
900
|
let i = r[0];
|
|
@@ -837,43 +916,43 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
837
916
|
}))), {
|
|
838
917
|
...r,
|
|
839
918
|
...e.showColumnTypeIcons && { headerIcon: t(i) },
|
|
840
|
-
cell: (e) => /* @__PURE__ */ (0,
|
|
919
|
+
cell: (e) => /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
841
920
|
value: e,
|
|
842
921
|
field: o
|
|
843
922
|
})
|
|
844
923
|
};
|
|
845
924
|
});
|
|
846
925
|
if ("field" in i) return r.filter((e) => e?.field && typeof e.field == "string" && !e.hidden).map((r, i) => {
|
|
847
|
-
let a =
|
|
926
|
+
let a = at(r.label) || r.field.charAt(0).toUpperCase() + r.field.slice(1).replace(/_/g, " "), o = e.objectName ? ce(e.objectName, r.field, a) : a, s, c = I?.fields?.[r.field], l = r.type || c?.type || n({ field: r.field }) || null, u = l ? S(l) : null, d = {
|
|
848
927
|
name: r.field,
|
|
849
928
|
type: l || "text"
|
|
850
929
|
};
|
|
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 =
|
|
930
|
+
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 = F(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) => ({
|
|
852
931
|
value: e,
|
|
853
932
|
label: C(String(e))
|
|
854
|
-
}))), r.options && (d.options =
|
|
933
|
+
}))), r.options && (d.options = F(e.objectName, r.field, r.options));
|
|
855
934
|
let f = i === 0 && !r.link && !r.action, p = r.link || f;
|
|
856
|
-
s = r.link && r.action || f && r.action || p ? (e, t) => /* @__PURE__ */ (0,
|
|
935
|
+
s = r.link && r.action || f && r.action || p ? (e, t) => /* @__PURE__ */ (0, Z.jsx)("button", {
|
|
857
936
|
type: "button",
|
|
858
937
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
859
938
|
"data-testid": f ? "primary-field-link" : "link-cell",
|
|
860
939
|
onClick: (e) => {
|
|
861
|
-
e.stopPropagation(),
|
|
940
|
+
e.stopPropagation(), Q.handleClick(t);
|
|
862
941
|
},
|
|
863
|
-
children: u ? /* @__PURE__ */ (0,
|
|
942
|
+
children: u ? /* @__PURE__ */ (0, Z.jsx)(u, {
|
|
864
943
|
value: e,
|
|
865
944
|
field: d
|
|
866
|
-
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
945
|
+
}) : e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
867
946
|
className: "text-muted-foreground/50 text-xs italic",
|
|
868
947
|
children: "—"
|
|
869
948
|
})
|
|
870
|
-
}) : r.action ? (e, t) => /* @__PURE__ */ (0,
|
|
949
|
+
}) : r.action ? (e, t) => /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
871
950
|
variant: "outline",
|
|
872
951
|
size: "sm",
|
|
873
952
|
className: "h-7 text-xs",
|
|
874
953
|
"data-testid": "action-cell",
|
|
875
954
|
onClick: (n) => {
|
|
876
|
-
n.stopPropagation(),
|
|
955
|
+
n.stopPropagation(), Ue({
|
|
877
956
|
type: r.action,
|
|
878
957
|
params: {
|
|
879
958
|
record: t,
|
|
@@ -882,25 +961,25 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
882
961
|
}
|
|
883
962
|
});
|
|
884
963
|
},
|
|
885
|
-
children:
|
|
886
|
-
}) : u ? (e) => /* @__PURE__ */ (0,
|
|
964
|
+
children: et(r.action)
|
|
965
|
+
}) : u ? (e) => /* @__PURE__ */ (0, Z.jsx)(u, {
|
|
887
966
|
value: e,
|
|
888
967
|
field: d
|
|
889
|
-
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0,
|
|
968
|
+
}) : (e) => e != null && e !== "" ? /* @__PURE__ */ (0, Z.jsx)("span", { children: String(e) }) : /* @__PURE__ */ (0, Z.jsx)(j, {});
|
|
890
969
|
let m = r.prefix;
|
|
891
970
|
if (m?.field) {
|
|
892
971
|
let e = s, t = m.type === "badge" ? S("select") : null;
|
|
893
972
|
s = (n, r) => {
|
|
894
973
|
let i = r[m.field];
|
|
895
|
-
return /* @__PURE__ */ (0,
|
|
974
|
+
return /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
896
975
|
className: "flex items-center gap-1.5",
|
|
897
|
-
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0,
|
|
976
|
+
children: [i != null && i !== "" ? t ? /* @__PURE__ */ (0, Z.jsx)(t, {
|
|
898
977
|
value: i,
|
|
899
978
|
field: {
|
|
900
979
|
name: m.field,
|
|
901
980
|
type: "select"
|
|
902
981
|
}
|
|
903
|
-
}) : /* @__PURE__ */ (0,
|
|
982
|
+
}) : /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
904
983
|
className: "text-muted-foreground text-xs mr-1.5",
|
|
905
984
|
children: String(i)
|
|
906
985
|
}) : null, e(n, r)]
|
|
@@ -928,11 +1007,11 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
928
1007
|
});
|
|
929
1008
|
}
|
|
930
1009
|
return r.filter((e) => typeof e == "string" && e.trim().length > 0).map((r, i) => {
|
|
931
|
-
let a =
|
|
1010
|
+
let a = I?.fields?.[r], o = a?.label || r.charAt(0).toUpperCase() + r.slice(1).replace(/_/g, " "), s = e.objectName ? ce(e.objectName, r, o) : o, c = a?.type || n({ field: r }) || null, l = c ? S(c) : null, u = {
|
|
932
1011
|
name: r,
|
|
933
1012
|
type: c || "text"
|
|
934
1013
|
};
|
|
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 =
|
|
1014
|
+
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 = F(e.objectName, r, a.options))), c === "select" && !u.options && (u.options = Array.from(new Set(E.map((e) => e[r]).filter(Boolean))).map((e) => ({
|
|
936
1015
|
value: e,
|
|
937
1016
|
label: C(String(e))
|
|
938
1017
|
})));
|
|
@@ -941,29 +1020,29 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
941
1020
|
"currency",
|
|
942
1021
|
"percent"
|
|
943
1022
|
].includes(c) ? "right" : void 0, f = i === 0, p;
|
|
944
|
-
return f && l ? p = (e, t) => /* @__PURE__ */ (0,
|
|
1023
|
+
return f && l ? p = (e, t) => /* @__PURE__ */ (0, Z.jsx)("button", {
|
|
945
1024
|
type: "button",
|
|
946
1025
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
947
1026
|
"data-testid": "primary-field-link",
|
|
948
1027
|
onClick: (e) => {
|
|
949
|
-
e.stopPropagation(),
|
|
1028
|
+
e.stopPropagation(), Q.handleClick(t);
|
|
950
1029
|
},
|
|
951
|
-
children: /* @__PURE__ */ (0,
|
|
1030
|
+
children: /* @__PURE__ */ (0, Z.jsx)(l, {
|
|
952
1031
|
value: e,
|
|
953
1032
|
field: u
|
|
954
1033
|
})
|
|
955
|
-
}) : f ? p = (e, t) => /* @__PURE__ */ (0,
|
|
1034
|
+
}) : f ? p = (e, t) => /* @__PURE__ */ (0, Z.jsx)("button", {
|
|
956
1035
|
type: "button",
|
|
957
1036
|
className: "text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
|
|
958
1037
|
"data-testid": "primary-field-link",
|
|
959
1038
|
onClick: (e) => {
|
|
960
|
-
e.stopPropagation(),
|
|
1039
|
+
e.stopPropagation(), Q.handleClick(t);
|
|
961
1040
|
},
|
|
962
|
-
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
1041
|
+
children: e != null && e !== "" ? String(e) : /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
963
1042
|
className: "text-muted-foreground/50 text-xs italic",
|
|
964
1043
|
children: "—"
|
|
965
1044
|
})
|
|
966
|
-
}) : l && (p = (e) => /* @__PURE__ */ (0,
|
|
1045
|
+
}) : l && (p = (e) => /* @__PURE__ */ (0, Z.jsx)(l, {
|
|
967
1046
|
value: e,
|
|
968
1047
|
field: u
|
|
969
1048
|
})), {
|
|
@@ -976,14 +1055,14 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
976
1055
|
};
|
|
977
1056
|
});
|
|
978
1057
|
}
|
|
979
|
-
if (
|
|
980
|
-
let r =
|
|
981
|
-
if (r.length > 0) return (
|
|
982
|
-
let i =
|
|
1058
|
+
if (K) {
|
|
1059
|
+
let r = G?.provider === "value" ? G.items : [];
|
|
1060
|
+
if (r.length > 0) return (J || Object.keys(r[0])).map((r) => {
|
|
1061
|
+
let i = I?.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
1062
|
name: r,
|
|
984
1063
|
type: a || "text"
|
|
985
1064
|
};
|
|
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 =
|
|
1065
|
+
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 = F(e.objectName, r, i.options))), a === "select" && !c.options && (c.options = Array.from(new Set(E.map((e) => e[r]).filter(Boolean))).map((e) => ({
|
|
987
1066
|
value: e,
|
|
988
1067
|
label: C(String(e))
|
|
989
1068
|
})));
|
|
@@ -997,7 +1076,7 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
997
1076
|
accessorKey: r,
|
|
998
1077
|
...e.showColumnTypeIcons && a && { headerIcon: t(a) },
|
|
999
1078
|
...l && { align: l },
|
|
1000
|
-
...o && { cell: (e) => /* @__PURE__ */ (0,
|
|
1079
|
+
...o && { cell: (e) => /* @__PURE__ */ (0, Z.jsx)(o, {
|
|
1001
1080
|
value: e,
|
|
1002
1081
|
field: c
|
|
1003
1082
|
}) },
|
|
@@ -1005,7 +1084,7 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1005
1084
|
};
|
|
1006
1085
|
});
|
|
1007
1086
|
}
|
|
1008
|
-
if (!
|
|
1087
|
+
if (!I) return [];
|
|
1009
1088
|
let i = [], a = new Set([
|
|
1010
1089
|
"id",
|
|
1011
1090
|
"created_at",
|
|
@@ -1020,18 +1099,18 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1020
1099
|
"updatedBy",
|
|
1021
1100
|
"_version",
|
|
1022
1101
|
"_rev"
|
|
1023
|
-
]), o =
|
|
1024
|
-
if (
|
|
1025
|
-
else if (o?.length) c = o.filter((e) =>
|
|
1102
|
+
]), o = I?.compactLayout, s = Object.keys(I.fields || {}), c;
|
|
1103
|
+
if (J) c = J;
|
|
1104
|
+
else if (o?.length) c = o.filter((e) => I.fields?.[e]);
|
|
1026
1105
|
else {
|
|
1027
1106
|
let e = s.filter((e) => {
|
|
1028
|
-
let t =
|
|
1107
|
+
let t = I.fields?.[e];
|
|
1029
1108
|
return !(!t || t.hidden || t.readonly && a.has(e));
|
|
1030
1109
|
});
|
|
1031
1110
|
c = [...e.filter((e) => !a.has(e)), ...e.filter((e) => a.has(e))];
|
|
1032
1111
|
}
|
|
1033
1112
|
return c.forEach((t) => {
|
|
1034
|
-
let n =
|
|
1113
|
+
let n = I.fields?.[t];
|
|
1035
1114
|
if (!n || n.permissions && n.permissions.read === !1) return;
|
|
1036
1115
|
let r = S(n.type), a = [
|
|
1037
1116
|
"number",
|
|
@@ -1039,13 +1118,13 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1039
1118
|
"percent"
|
|
1040
1119
|
], o = n.options ? {
|
|
1041
1120
|
...n,
|
|
1042
|
-
options:
|
|
1121
|
+
options: F(e.objectName, t, n.options)
|
|
1043
1122
|
} : n;
|
|
1044
1123
|
i.push({
|
|
1045
|
-
header: e.objectName ?
|
|
1124
|
+
header: e.objectName ? ce(e.objectName, t, n.label || t) : n.label || t,
|
|
1046
1125
|
accessorKey: t,
|
|
1047
1126
|
...a.includes(n.type) && { align: "right" },
|
|
1048
|
-
cell: (e) => /* @__PURE__ */ (0,
|
|
1127
|
+
cell: (e) => /* @__PURE__ */ (0, Z.jsx)(r, {
|
|
1049
1128
|
value: e,
|
|
1050
1129
|
field: o
|
|
1051
1130
|
}),
|
|
@@ -1053,19 +1132,30 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1053
1132
|
});
|
|
1054
1133
|
}), i;
|
|
1055
1134
|
}, [
|
|
1056
|
-
|
|
1057
|
-
U,
|
|
1058
|
-
W,
|
|
1059
|
-
B,
|
|
1060
|
-
V,
|
|
1061
|
-
q.handleClick,
|
|
1135
|
+
I,
|
|
1062
1136
|
J,
|
|
1137
|
+
Y,
|
|
1138
|
+
G,
|
|
1139
|
+
K,
|
|
1140
|
+
Q.handleClick,
|
|
1141
|
+
Ue,
|
|
1063
1142
|
E,
|
|
1064
|
-
|
|
1065
|
-
|
|
1143
|
+
ce,
|
|
1144
|
+
F,
|
|
1066
1145
|
e.objectName
|
|
1067
|
-
]),
|
|
1068
|
-
let n = e.exportOptions, r = n?.maxRecords || 0, i = n?.includeHeaders !== !1, a = n?.fileNamePrefix || e.objectName || "export"
|
|
1146
|
+
]), lt = r((t) => {
|
|
1147
|
+
let n = e.exportOptions, r = n?.maxRecords || 0, i = n?.includeHeaders !== !1, a = n?.fileNamePrefix || e.objectName || "export";
|
|
1148
|
+
if ((t === "csv" || t === "xlsx" || t === "json") && H.isSupported && e.objectName && !K && n?.streaming !== !1) {
|
|
1149
|
+
let n = ct().filter((e) => e.accessorKey !== "_actions").map((e) => e.accessorKey).filter(Boolean);
|
|
1150
|
+
B(!1), V(!0), H.start(e.objectName, {
|
|
1151
|
+
format: t === "json" ? "json" : t,
|
|
1152
|
+
fields: n.length ? n : void 0,
|
|
1153
|
+
includeHeaders: i,
|
|
1154
|
+
limit: r > 0 ? r : void 0
|
|
1155
|
+
});
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
let o = r > 0 ? E.slice(0, r) : E, s = (e, t) => {
|
|
1069
1159
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1070
1160
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
1071
1161
|
}, c = (e) => {
|
|
@@ -1073,144 +1163,146 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1073
1163
|
return t.includes(",") || t.includes("\"") || t.includes("\n") || t.includes("\r") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1074
1164
|
};
|
|
1075
1165
|
if (t === "csv") {
|
|
1076
|
-
let e =
|
|
1166
|
+
let e = ct().filter((e) => e.accessorKey !== "_actions"), t = e.map((e) => e.accessorKey), n = e.map((e) => e.header), r = [];
|
|
1077
1167
|
i && r.push(n.join(",")), o.forEach((e) => {
|
|
1078
1168
|
r.push(t.map((t) => c(e[t])).join(","));
|
|
1079
1169
|
}), s(new Blob([r.join("\n")], { type: "text/csv;charset=utf-8;" }), `${a}.csv`);
|
|
1080
1170
|
} else t === "json" && s(new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), `${a}.json`);
|
|
1081
|
-
|
|
1171
|
+
B(!1);
|
|
1082
1172
|
}, [
|
|
1083
1173
|
E,
|
|
1084
1174
|
e.exportOptions,
|
|
1085
1175
|
e.objectName,
|
|
1086
|
-
|
|
1176
|
+
ct,
|
|
1177
|
+
H,
|
|
1178
|
+
K
|
|
1087
1179
|
]);
|
|
1088
|
-
if (k) return /* @__PURE__ */ (0,
|
|
1180
|
+
if (k) return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1089
1181
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1090
|
-
children: [/* @__PURE__ */ (0,
|
|
1182
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("h3", {
|
|
1091
1183
|
className: "text-red-800 font-semibold",
|
|
1092
1184
|
children: M("grid.errorLoading")
|
|
1093
|
-
}), /* @__PURE__ */ (0,
|
|
1185
|
+
}), /* @__PURE__ */ (0, Z.jsx)("p", {
|
|
1094
1186
|
className: "text-red-600 text-sm mt-1",
|
|
1095
1187
|
children: k.message
|
|
1096
1188
|
})]
|
|
1097
1189
|
});
|
|
1098
|
-
if (D && E.length === 0) return
|
|
1190
|
+
if (D && E.length === 0) return R ? /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1099
1191
|
className: "space-y-2 p-2",
|
|
1100
1192
|
children: [
|
|
1101
1193
|
1,
|
|
1102
1194
|
2,
|
|
1103
1195
|
3
|
|
1104
|
-
].map((e) => /* @__PURE__ */ (0,
|
|
1196
|
+
].map((e) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1105
1197
|
className: "border rounded-lg p-3 bg-card animate-pulse",
|
|
1106
1198
|
children: [
|
|
1107
|
-
/* @__PURE__ */ (0,
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1199
|
+
/* @__PURE__ */ (0, Z.jsx)("div", { className: "h-5 bg-muted rounded w-3/4 mb-3" }),
|
|
1200
|
+
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1109
1201
|
className: "flex items-center justify-between mb-2",
|
|
1110
|
-
children: [/* @__PURE__ */ (0,
|
|
1202
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("div", { className: "h-4 bg-muted rounded w-1/4" }), /* @__PURE__ */ (0, Z.jsx)("div", { className: "h-5 bg-muted rounded-full w-20" })]
|
|
1111
1203
|
}),
|
|
1112
|
-
/* @__PURE__ */ (0,
|
|
1204
|
+
/* @__PURE__ */ (0, Z.jsx)("div", { className: "h-3 bg-muted rounded w-1/3" })
|
|
1113
1205
|
]
|
|
1114
1206
|
}, e))
|
|
1115
|
-
}) : /* @__PURE__ */ (0,
|
|
1207
|
+
}) : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1116
1208
|
className: "p-4 sm:p-8 text-center",
|
|
1117
|
-
children: [/* @__PURE__ */ (0,
|
|
1209
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-foreground" }), /* @__PURE__ */ (0, Z.jsx)("p", {
|
|
1118
1210
|
className: "mt-2 text-sm text-muted-foreground",
|
|
1119
1211
|
children: M("grid.loading")
|
|
1120
1212
|
})]
|
|
1121
1213
|
});
|
|
1122
|
-
let
|
|
1123
|
-
if (
|
|
1124
|
-
let t =
|
|
1214
|
+
let ut = [...ct()];
|
|
1215
|
+
if (W.widths && (ut = ut.map((e) => {
|
|
1216
|
+
let t = W.widths?.[e.accessorKey];
|
|
1125
1217
|
return t ? {
|
|
1126
1218
|
...e,
|
|
1127
1219
|
size: t
|
|
1128
1220
|
} : e;
|
|
1129
|
-
})),
|
|
1130
|
-
let e = new Map(
|
|
1131
|
-
|
|
1221
|
+
})), W.order && W.order.length > 0) {
|
|
1222
|
+
let e = new Map(W.order.map((e, t) => [e, t]));
|
|
1223
|
+
ut.sort((t, n) => (e.get(t.accessorKey) ?? Infinity) - (e.get(n.accessorKey) ?? Infinity));
|
|
1132
1224
|
}
|
|
1133
|
-
let
|
|
1225
|
+
let $ = "operations" in e ? e.operations : void 0, dt = $ && ($.update || $.delete), ft = e.rowActions && e.rowActions.length > 0, pt = dt || ft ? [...ut, {
|
|
1134
1226
|
header: M("grid.actions"),
|
|
1135
1227
|
accessorKey: "_actions",
|
|
1136
|
-
cell: (t, n) => /* @__PURE__ */ (0,
|
|
1228
|
+
cell: (t, n) => /* @__PURE__ */ (0, Z.jsx)(tt, {
|
|
1137
1229
|
row: n,
|
|
1138
1230
|
rowActions: e.rowActions,
|
|
1139
|
-
canEdit: !!(
|
|
1140
|
-
canDelete: !!(
|
|
1231
|
+
canEdit: !!($?.update && a),
|
|
1232
|
+
canDelete: !!($?.delete && o),
|
|
1141
1233
|
onEdit: a,
|
|
1142
1234
|
onDelete: o,
|
|
1143
|
-
onAction: (e, t) =>
|
|
1235
|
+
onAction: (e, t) => Ue({
|
|
1144
1236
|
type: e,
|
|
1145
1237
|
params: { record: t }
|
|
1146
1238
|
})
|
|
1147
1239
|
}),
|
|
1148
1240
|
sortable: !1
|
|
1149
|
-
}] :
|
|
1150
|
-
...
|
|
1151
|
-
...
|
|
1152
|
-
...
|
|
1241
|
+
}] : ut, mt = pt.filter((e) => e.pinned === "left"), ht = pt.filter((e) => e.pinned === "right"), gt = pt.filter((e) => !e.pinned), _t = mt.length > 0 || ht.length > 0, vt = "sticky right-0 z-10 bg-background border-l border-border", yt = _t ? [
|
|
1242
|
+
...mt,
|
|
1243
|
+
...gt,
|
|
1244
|
+
...ht.map((e) => ({
|
|
1153
1245
|
...e,
|
|
1154
|
-
className: [e.className,
|
|
1155
|
-
cellClassName: [e.cellClassName,
|
|
1246
|
+
className: [e.className, vt].filter(Boolean).join(" "),
|
|
1247
|
+
cellClassName: [e.cellClassName, vt].filter(Boolean).join(" ")
|
|
1156
1248
|
}))
|
|
1157
|
-
] :
|
|
1158
|
-
e.selection?.type ?
|
|
1159
|
-
let
|
|
1249
|
+
] : pt, bt = _t ? mt.length : e.frozenColumns ?? 1, xt = e.batchActions ?? e.bulkActions, St = xt && xt.length > 0, Ct = !1;
|
|
1250
|
+
e.selection?.type ? Ct = e.selection.type === "none" ? !1 : e.selection.type : e.selectable === void 0 ? St && (Ct = "multiple") : Ct = e.selectable;
|
|
1251
|
+
let wt = e.pagination === void 0 ? e.showPagination === void 0 ? !0 : e.showPagination : !0, Tt = e.pagination?.pageSize || e.pageSize || 10, Et = e.searchableFields === void 0 ? e.showSearch === void 0 ? !0 : e.showSearch : e.searchableFields.length > 0, Dt = {
|
|
1160
1252
|
type: "data-table",
|
|
1161
1253
|
caption: e.label || e.title,
|
|
1162
|
-
columns:
|
|
1254
|
+
columns: yt,
|
|
1163
1255
|
data: E,
|
|
1164
|
-
pagination:
|
|
1165
|
-
pageSize:
|
|
1166
|
-
searchable:
|
|
1167
|
-
selectable:
|
|
1256
|
+
pagination: wt,
|
|
1257
|
+
pageSize: Tt,
|
|
1258
|
+
searchable: Et,
|
|
1259
|
+
selectable: Ct,
|
|
1168
1260
|
sortable: !0,
|
|
1169
|
-
exportable:
|
|
1170
|
-
rowActions: !!(e.editable &&
|
|
1261
|
+
exportable: $?.export,
|
|
1262
|
+
rowActions: !!(e.editable && dt),
|
|
1171
1263
|
resizableColumns: e.resizable ?? e.resizableColumns ?? !0,
|
|
1172
1264
|
reorderableColumns: e.reorderableColumns ?? !1,
|
|
1173
1265
|
editable: e.editable ?? !1,
|
|
1174
1266
|
singleClickEdit: e.singleClickEdit ?? !0,
|
|
1175
1267
|
className: e.className,
|
|
1176
|
-
cellClassName:
|
|
1268
|
+
cellClassName: U === "compact" ? "px-3 py-1 text-[13px] leading-tight" : U === "short" ? "px-3 py-1 text-[13px] leading-normal" : U === "tall" ? "px-3 py-2.5 text-sm" : U === "extra_tall" ? "px-3 py-3.5 text-sm leading-relaxed" : "px-3 py-1.5 text-[13px] leading-normal",
|
|
1177
1269
|
showRowNumbers: !0,
|
|
1178
|
-
showAddRow:
|
|
1270
|
+
showAddRow: !!$?.create,
|
|
1179
1271
|
onAddRecord: ne,
|
|
1180
|
-
rowClassName: e.rowColor ? (e, t) =>
|
|
1181
|
-
rowStyle: e.conditionalFormatting?.length ? (e, t) =>
|
|
1182
|
-
frozenColumns:
|
|
1272
|
+
rowClassName: e.rowColor ? (e, t) => We(e) : void 0,
|
|
1273
|
+
rowStyle: e.conditionalFormatting?.length ? (e, t) => Ge(e) : void 0,
|
|
1274
|
+
frozenColumns: bt,
|
|
1183
1275
|
onSelectionChange: (e) => {
|
|
1184
|
-
|
|
1276
|
+
ve(e), c?.(e);
|
|
1185
1277
|
},
|
|
1186
|
-
onRowClick:
|
|
1278
|
+
onRowClick: Q.handleClick,
|
|
1187
1279
|
onCellChange: _,
|
|
1188
1280
|
onRowSave: ee,
|
|
1189
1281
|
onBatchSave: te,
|
|
1190
1282
|
onColumnResize: (e, t) => {
|
|
1191
|
-
|
|
1192
|
-
...
|
|
1283
|
+
we({
|
|
1284
|
+
...W,
|
|
1193
1285
|
widths: {
|
|
1194
|
-
...
|
|
1286
|
+
...W.widths,
|
|
1195
1287
|
[e]: t
|
|
1196
1288
|
}
|
|
1197
1289
|
});
|
|
1198
1290
|
},
|
|
1199
1291
|
onColumnReorder: (e) => {
|
|
1200
|
-
|
|
1201
|
-
...
|
|
1292
|
+
we({
|
|
1293
|
+
...W,
|
|
1202
1294
|
order: e
|
|
1203
1295
|
});
|
|
1204
1296
|
}
|
|
1205
|
-
},
|
|
1206
|
-
...
|
|
1297
|
+
}, Ot = (e) => ({
|
|
1298
|
+
...Dt,
|
|
1207
1299
|
caption: void 0,
|
|
1208
1300
|
data: e,
|
|
1209
1301
|
pagination: !1,
|
|
1210
1302
|
searchable: !1
|
|
1211
|
-
}),
|
|
1212
|
-
if (
|
|
1213
|
-
let e =
|
|
1303
|
+
}), kt = e.label ? `${e.label} Detail` : e.objectName ? `${e.objectName.charAt(0).toUpperCase() + e.objectName.slice(1)} Detail` : "Record Detail";
|
|
1304
|
+
if (R && E.length > 0 && !Xe) {
|
|
1305
|
+
let e = ct().filter((e) => e.accessorKey !== "_actions"), t = /* @__PURE__ */ new Map();
|
|
1214
1306
|
e.forEach((e) => t.set(e.accessorKey, e));
|
|
1215
1307
|
let n = e[0], r = [
|
|
1216
1308
|
"amount",
|
|
@@ -1246,65 +1338,65 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1246
1338
|
"score"
|
|
1247
1339
|
], s = (e) => {
|
|
1248
1340
|
let t = (e || "").toLowerCase();
|
|
1249
|
-
return t.includes("won") || t.includes("completed") || t.includes("done") || t.includes("active") ? "bg-green-
|
|
1341
|
+
return t.includes("won") || t.includes("completed") || t.includes("done") || t.includes("active") || t === "activated" || t === "success" || t === "approved" || t === "paid" ? "bg-green-50 text-green-700 border-green-200 dark:bg-green-950/40 dark:text-green-300 dark:border-green-900/60" : t.includes("lost") || t.includes("cancelled") || t.includes("rejected") || t.includes("closed lost") || t === "expired" || t === "terminated" || t === "failed" || t === "overdue" ? "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60" : t.includes("negotiation") || t.includes("review") || t.includes("in progress") || t.includes("approval") || t === "in_approval" || t === "pending_approval" ? "bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-950/40 dark:text-yellow-300 dark:border-yellow-900/60" : t.includes("proposal") || t.includes("pending") ? "bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-950/40 dark:text-blue-300 dark:border-blue-900/60" : t.includes("qualification") || t.includes("qualified") ? "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60" : t.includes("prospecting") || t.includes("new") || t.includes("open") ? "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60" : t === "draft" || t.includes("draft") ? "bg-slate-50 text-slate-700 border-slate-200 dark:bg-slate-950/40 dark:text-slate-300 dark:border-slate-900/60" : "bg-muted text-muted-foreground border-border";
|
|
1250
1342
|
}, c = (e) => {
|
|
1251
1343
|
let t = (e || "").toLowerCase();
|
|
1252
|
-
return t.includes("won") || t.includes("completed") || t.includes("done") || t.includes("active") ? "border-l-green-500" : t.includes("lost") || t.includes("cancelled") || t.includes("rejected") ? "border-l-red-500" : t.includes("negotiation") || t.includes("review") || t.includes("in progress") ? "border-l-yellow-500" : t.includes("proposal") || t.includes("pending") ? "border-l-blue-500" : t.includes("qualification") || t.includes("qualified") ? "border-l-indigo-500" : t.includes("prospecting") || t.includes("new") || t.includes("open") ? "border-l-purple-500" : "border-l-gray-300";
|
|
1344
|
+
return t.includes("won") || t.includes("completed") || t.includes("done") || t.includes("active") || t === "activated" ? "border-l-green-500" : t.includes("lost") || t.includes("cancelled") || t.includes("rejected") || t === "expired" || t === "terminated" ? "border-l-red-500" : t.includes("negotiation") || t.includes("review") || t.includes("in progress") || t.includes("approval") ? "border-l-yellow-500" : t.includes("proposal") || t.includes("pending") ? "border-l-blue-500" : t.includes("qualification") || t.includes("qualified") ? "border-l-indigo-500" : t.includes("prospecting") || t.includes("new") || t.includes("open") ? "border-l-purple-500" : t === "draft" || t.includes("draft") ? "border-l-slate-400" : "border-l-gray-300";
|
|
1253
1345
|
}, l = (e) => {
|
|
1254
1346
|
let t = e.toLowerCase();
|
|
1255
1347
|
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";
|
|
1256
1348
|
};
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1349
|
+
return /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1258
1350
|
className: "space-y-2 p-2",
|
|
1259
1351
|
children: E.map((t, r) => {
|
|
1260
1352
|
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) : "";
|
|
1261
|
-
return /* @__PURE__ */ (0,
|
|
1353
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1262
1354
|
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(" "),
|
|
1263
|
-
onClick: () =>
|
|
1355
|
+
onClick: () => Q.handleClick(t),
|
|
1264
1356
|
children: [
|
|
1265
|
-
n && /* @__PURE__ */ (0,
|
|
1357
|
+
n && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1266
1358
|
className: "font-semibold text-sm truncate mb-1",
|
|
1267
1359
|
children: t[n.accessorKey] != null && typeof t[n.accessorKey] == "object" ? String(t[n.accessorKey]) : t[n.accessorKey] ?? "—"
|
|
1268
1360
|
}),
|
|
1269
|
-
(a || o) && /* @__PURE__ */ (0,
|
|
1361
|
+
(a || o) && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1270
1362
|
className: "flex items-center justify-between gap-2 mb-1",
|
|
1271
|
-
children: [a && /* @__PURE__ */ (0,
|
|
1363
|
+
children: [a && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1272
1364
|
className: "text-sm tabular-nums font-medium",
|
|
1273
1365
|
children: typeof t[a.accessorKey] == "number" ? v(t[a.accessorKey]) : t[a.accessorKey] != null && typeof t[a.accessorKey] == "object" ? String(t[a.accessorKey]) : t[a.accessorKey] ?? "—"
|
|
1274
|
-
}), o && t[o.accessorKey] && /* @__PURE__ */ (0,
|
|
1366
|
+
}), o && t[o.accessorKey] && /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
1275
1367
|
variant: "outline",
|
|
1276
1368
|
className: `text-xs shrink-0 max-w-[140px] truncate ${s(String(t[o.accessorKey]))}`,
|
|
1277
1369
|
children: String(t[o.accessorKey])
|
|
1278
1370
|
})]
|
|
1279
1371
|
}),
|
|
1280
|
-
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0,
|
|
1372
|
+
(u.length > 0 || d.length > 0) && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1281
1373
|
className: "flex items-center justify-between py-0.5 text-xs text-muted-foreground",
|
|
1282
|
-
children: [u[0] && /* @__PURE__ */ (0,
|
|
1374
|
+
children: [u[0] && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1283
1375
|
className: "tabular-nums",
|
|
1284
1376
|
children: t[u[0].accessorKey] ? b(t[u[0].accessorKey], "short") : "—"
|
|
1285
|
-
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0,
|
|
1377
|
+
}), d[0] && t[d[0].accessorKey] != null && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1286
1378
|
className: "tabular-nums",
|
|
1287
1379
|
children: x(Number(t[d[0].accessorKey]))
|
|
1288
1380
|
})]
|
|
1289
1381
|
}),
|
|
1290
|
-
u.slice(1).map((e) => /* @__PURE__ */ (0,
|
|
1382
|
+
u.slice(1).map((e) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1291
1383
|
className: "flex justify-between items-center py-0.5",
|
|
1292
|
-
children: [/* @__PURE__ */ (0,
|
|
1384
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1293
1385
|
className: "text-xs text-muted-foreground",
|
|
1294
1386
|
children: e.header
|
|
1295
|
-
}), /* @__PURE__ */ (0,
|
|
1387
|
+
}), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1296
1388
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
1297
1389
|
children: t[e.accessorKey] ? b(t[e.accessorKey], "short") : "—"
|
|
1298
1390
|
})]
|
|
1299
1391
|
}, e.accessorKey)),
|
|
1300
1392
|
f.map((e) => {
|
|
1301
1393
|
let n = t[e.accessorKey];
|
|
1302
|
-
return n == null || n === "" ? null : /* @__PURE__ */ (0,
|
|
1394
|
+
return n == null || n === "" ? null : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1303
1395
|
className: "flex justify-between items-center py-0.5",
|
|
1304
|
-
children: [/* @__PURE__ */ (0,
|
|
1396
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1305
1397
|
className: "text-xs text-muted-foreground",
|
|
1306
1398
|
children: e.header
|
|
1307
|
-
}), /* @__PURE__ */ (0,
|
|
1399
|
+
}), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1308
1400
|
className: "text-xs font-medium truncate ml-2 text-right",
|
|
1309
1401
|
children: e.cell ? e.cell(n, t) : String(n)
|
|
1310
1402
|
})]
|
|
@@ -1313,17 +1405,17 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1313
1405
|
]
|
|
1314
1406
|
}, t.id || t._id || r);
|
|
1315
1407
|
})
|
|
1316
|
-
}),
|
|
1317
|
-
...
|
|
1318
|
-
title:
|
|
1319
|
-
children: (e) => /* @__PURE__ */ (0,
|
|
1408
|
+
}), Q.isOverlay && /* @__PURE__ */ (0, Z.jsx)(oe, {
|
|
1409
|
+
...Q,
|
|
1410
|
+
title: kt,
|
|
1411
|
+
children: (e) => /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1320
1412
|
className: "space-y-3",
|
|
1321
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0,
|
|
1413
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1322
1414
|
className: "flex flex-col",
|
|
1323
|
-
children: [/* @__PURE__ */ (0,
|
|
1415
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1324
1416
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1325
1417
|
children: e.replace(/_/g, " ")
|
|
1326
|
-
}), /* @__PURE__ */ (0,
|
|
1418
|
+
}), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1327
1419
|
className: "text-sm",
|
|
1328
1420
|
children: String(t ?? "—")
|
|
1329
1421
|
})]
|
|
@@ -1331,56 +1423,56 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1331
1423
|
})
|
|
1332
1424
|
})] });
|
|
1333
1425
|
}
|
|
1334
|
-
let
|
|
1335
|
-
|
|
1336
|
-
},
|
|
1337
|
-
compact:
|
|
1338
|
-
short:
|
|
1339
|
-
medium:
|
|
1340
|
-
tall:
|
|
1341
|
-
extra_tall:
|
|
1342
|
-
}[
|
|
1426
|
+
let At = () => {
|
|
1427
|
+
he((e) => e === "compact" ? "short" : e === "short" ? "medium" : e === "medium" ? "tall" : e === "tall" ? "extra_tall" : "compact");
|
|
1428
|
+
}, jt = {
|
|
1429
|
+
compact: Me,
|
|
1430
|
+
short: je,
|
|
1431
|
+
medium: Ae,
|
|
1432
|
+
tall: me,
|
|
1433
|
+
extra_tall: me
|
|
1434
|
+
}[U], Mt = e.rowHeight !== void 0, Nt = e.exportOptions || Mt ? /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1343
1435
|
className: "flex items-center justify-end gap-1 px-2 py-1",
|
|
1344
|
-
children: [
|
|
1436
|
+
children: [Mt && /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
1345
1437
|
variant: "ghost",
|
|
1346
1438
|
size: "sm",
|
|
1347
1439
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1348
|
-
onClick:
|
|
1349
|
-
title: `Row height: ${
|
|
1350
|
-
children: [/* @__PURE__ */ (0,
|
|
1440
|
+
onClick: At,
|
|
1441
|
+
title: `Row height: ${U}`,
|
|
1442
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(jt, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1351
1443
|
className: "hidden sm:inline capitalize",
|
|
1352
|
-
children:
|
|
1444
|
+
children: U
|
|
1353
1445
|
})]
|
|
1354
|
-
}), e.exportOptions && /* @__PURE__ */ (0,
|
|
1355
|
-
open:
|
|
1356
|
-
onOpenChange:
|
|
1357
|
-
children: [/* @__PURE__ */ (0,
|
|
1446
|
+
}), e.exportOptions && /* @__PURE__ */ (0, Z.jsxs)(se, {
|
|
1447
|
+
open: z,
|
|
1448
|
+
onOpenChange: B,
|
|
1449
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(P, {
|
|
1358
1450
|
asChild: !0,
|
|
1359
|
-
children: /* @__PURE__ */ (0,
|
|
1451
|
+
children: /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
1360
1452
|
variant: "ghost",
|
|
1361
1453
|
size: "sm",
|
|
1362
1454
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs",
|
|
1363
|
-
children: [/* @__PURE__ */ (0,
|
|
1455
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(Ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1364
1456
|
className: "hidden sm:inline",
|
|
1365
1457
|
children: M("grid.export")
|
|
1366
1458
|
})]
|
|
1367
1459
|
})
|
|
1368
|
-
}), /* @__PURE__ */ (0,
|
|
1460
|
+
}), /* @__PURE__ */ (0, Z.jsx)(N, {
|
|
1369
1461
|
align: "end",
|
|
1370
1462
|
className: "w-48 p-2",
|
|
1371
|
-
children: /* @__PURE__ */ (0,
|
|
1463
|
+
children: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1372
1464
|
className: "space-y-1",
|
|
1373
|
-
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0,
|
|
1465
|
+
children: (e.exportOptions.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
1374
1466
|
variant: "ghost",
|
|
1375
1467
|
size: "sm",
|
|
1376
1468
|
className: "w-full justify-start h-8 text-xs",
|
|
1377
|
-
onClick: () =>
|
|
1378
|
-
children: [/* @__PURE__ */ (0,
|
|
1469
|
+
onClick: () => lt(e),
|
|
1470
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(Ce, { className: "h-3.5 w-3.5 mr-2" }), M("grid.exportAs", { format: e.toUpperCase() })]
|
|
1379
1471
|
}, e))
|
|
1380
1472
|
})
|
|
1381
1473
|
})]
|
|
1382
1474
|
})]
|
|
1383
|
-
}) : null,
|
|
1475
|
+
}) : null, Pt = (e) => {
|
|
1384
1476
|
let t = [
|
|
1385
1477
|
"_id",
|
|
1386
1478
|
"id",
|
|
@@ -1389,22 +1481,22 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1389
1481
|
"created_by",
|
|
1390
1482
|
"updated_by"
|
|
1391
1483
|
], 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) => {
|
|
1392
|
-
if (t == null || t === "") return /* @__PURE__ */ (0,
|
|
1484
|
+
if (t == null || t === "") return /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1393
1485
|
className: "text-muted-foreground/50 text-sm italic",
|
|
1394
1486
|
children: "Empty"
|
|
1395
1487
|
});
|
|
1396
|
-
let n =
|
|
1488
|
+
let n = I?.fields?.[e];
|
|
1397
1489
|
if (n?.type) {
|
|
1398
1490
|
let e = S(n.type);
|
|
1399
|
-
if (e) return /* @__PURE__ */ (0,
|
|
1491
|
+
if (e) return /* @__PURE__ */ (0, Z.jsx)(e, {
|
|
1400
1492
|
value: t,
|
|
1401
1493
|
field: n
|
|
1402
1494
|
});
|
|
1403
1495
|
}
|
|
1404
|
-
return typeof t == "boolean" ? /* @__PURE__ */ (0,
|
|
1496
|
+
return typeof t == "boolean" ? /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
1405
1497
|
variant: t ? "default" : "outline",
|
|
1406
1498
|
children: t ? "Yes" : "No"
|
|
1407
|
-
}) : typeof t == "string" && !isNaN(Date.parse(t)) && (e.includes("date") || e.includes("_at") || e.includes("time")) ? /* @__PURE__ */ (0,
|
|
1499
|
+
}) : typeof t == "string" && !isNaN(Date.parse(t)) && (e.includes("date") || e.includes("_at") || e.includes("time")) ? /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1408
1500
|
className: "text-sm tabular-nums",
|
|
1409
1501
|
children: b(t)
|
|
1410
1502
|
}) : typeof t == "number" && [
|
|
@@ -1416,48 +1508,48 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1416
1508
|
"value",
|
|
1417
1509
|
"budget",
|
|
1418
1510
|
"salary"
|
|
1419
|
-
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0,
|
|
1511
|
+
].some((t) => e.toLowerCase().includes(t)) ? /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1420
1512
|
className: "text-sm tabular-nums font-medium",
|
|
1421
1513
|
children: y(t)
|
|
1422
|
-
}) : /* @__PURE__ */ (0,
|
|
1514
|
+
}) : /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1423
1515
|
className: "text-sm break-words",
|
|
1424
1516
|
children: String(t)
|
|
1425
1517
|
});
|
|
1426
1518
|
};
|
|
1427
|
-
return /* @__PURE__ */ (0,
|
|
1519
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1428
1520
|
className: "space-y-4",
|
|
1429
1521
|
"data-testid": "record-detail-panel",
|
|
1430
|
-
children: [/* @__PURE__ */ (0,
|
|
1522
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1431
1523
|
className: "rounded-lg border bg-card",
|
|
1432
|
-
children: /* @__PURE__ */ (0,
|
|
1524
|
+
children: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1433
1525
|
className: "divide-y",
|
|
1434
|
-
children: r.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1526
|
+
children: r.map(([e, t]) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1435
1527
|
className: "flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-4 px-4 py-3",
|
|
1436
|
-
children: [/* @__PURE__ */ (0,
|
|
1528
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1437
1529
|
className: "text-xs font-medium text-muted-foreground sm:w-1/3 sm:text-right sm:pt-0.5 uppercase tracking-wide shrink-0",
|
|
1438
1530
|
children: a(e)
|
|
1439
|
-
}), /* @__PURE__ */ (0,
|
|
1531
|
+
}), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1440
1532
|
className: "flex-1 min-w-0",
|
|
1441
1533
|
children: o(e, t)
|
|
1442
1534
|
})]
|
|
1443
1535
|
}, e))
|
|
1444
1536
|
})
|
|
1445
|
-
}), i.length > 0 && /* @__PURE__ */ (0,
|
|
1537
|
+
}), i.length > 0 && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1446
1538
|
className: "rounded-lg border bg-muted/30",
|
|
1447
|
-
children: [/* @__PURE__ */ (0,
|
|
1539
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1448
1540
|
className: "px-4 py-2 border-b",
|
|
1449
|
-
children: /* @__PURE__ */ (0,
|
|
1541
|
+
children: /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1450
1542
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1451
1543
|
children: "System"
|
|
1452
1544
|
})
|
|
1453
|
-
}), /* @__PURE__ */ (0,
|
|
1545
|
+
}), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1454
1546
|
className: "divide-y divide-border/50",
|
|
1455
|
-
children: i.map(([e, t]) => /* @__PURE__ */ (0,
|
|
1547
|
+
children: i.map(([e, t]) => /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1456
1548
|
className: "flex items-center gap-4 px-4 py-2",
|
|
1457
|
-
children: [/* @__PURE__ */ (0,
|
|
1549
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1458
1550
|
className: "text-xs text-muted-foreground w-1/3 text-right shrink-0",
|
|
1459
1551
|
children: a(e)
|
|
1460
|
-
}), /* @__PURE__ */ (0,
|
|
1552
|
+
}), /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
1461
1553
|
className: "text-xs text-muted-foreground flex-1 min-w-0 break-words",
|
|
1462
1554
|
children: String(t ?? "")
|
|
1463
1555
|
})]
|
|
@@ -1465,14 +1557,14 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1465
1557
|
})]
|
|
1466
1558
|
})]
|
|
1467
1559
|
});
|
|
1468
|
-
},
|
|
1560
|
+
}, Ft = rt ? /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1469
1561
|
className: "border-t bg-muted/30 px-2 py-1.5",
|
|
1470
1562
|
"data-testid": "column-summary-footer",
|
|
1471
|
-
children: /* @__PURE__ */ (0,
|
|
1563
|
+
children: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1472
1564
|
className: "flex gap-4 text-xs text-muted-foreground font-medium",
|
|
1473
|
-
children:
|
|
1474
|
-
let t =
|
|
1475
|
-
return /* @__PURE__ */ (0,
|
|
1565
|
+
children: yt.filter((e) => Qe.has(e.accessorKey)).map((e) => {
|
|
1566
|
+
let t = Qe.get(e.accessorKey);
|
|
1567
|
+
return /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
1476
1568
|
"data-testid": `summary-${e.accessorKey}`,
|
|
1477
1569
|
children: [
|
|
1478
1570
|
e.header,
|
|
@@ -1482,66 +1574,79 @@ var ot = ({ schema: e, dataSource: n, onEdit: a, onDelete: o, onRowSelect: c, on
|
|
|
1482
1574
|
}, e.accessorKey);
|
|
1483
1575
|
})
|
|
1484
1576
|
})
|
|
1485
|
-
}) : null,
|
|
1486
|
-
|
|
1487
|
-
children:
|
|
1577
|
+
}) : null, It = (e) => /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1578
|
+
style: e.depth > 0 ? { marginLeft: e.depth * 16 } : void 0,
|
|
1579
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Ye, {
|
|
1488
1580
|
groupKey: e.key,
|
|
1489
1581
|
label: e.label,
|
|
1490
1582
|
count: e.rows.length,
|
|
1491
1583
|
collapsed: e.collapsed,
|
|
1492
1584
|
aggregations: e.aggregations,
|
|
1493
|
-
onToggle:
|
|
1494
|
-
children: /* @__PURE__ */ (0,
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1585
|
+
onToggle: Ze,
|
|
1586
|
+
children: e.subgroups.length > 0 ? /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1587
|
+
className: "space-y-2 p-2",
|
|
1588
|
+
children: e.subgroups.map(It)
|
|
1589
|
+
}) : /* @__PURE__ */ (0, Z.jsx)(d, { schema: Ot(e.rows) })
|
|
1590
|
+
})
|
|
1591
|
+
}, e.key), Lt = Xe ? /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1592
|
+
className: "space-y-2",
|
|
1593
|
+
children: qe.map(It)
|
|
1594
|
+
}) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(d, { schema: Dt }), Ft] }), Rt = /* @__PURE__ */ (0, Z.jsx)(ae, {
|
|
1595
|
+
open: fe,
|
|
1596
|
+
onOpenChange: V,
|
|
1597
|
+
job: H,
|
|
1598
|
+
filename: `${e.exportOptions?.fileNamePrefix || e.objectName || "export"}.${H.progress?.format || "csv"}`,
|
|
1599
|
+
closeAfterDownloadMs: 400
|
|
1600
|
+
});
|
|
1601
|
+
return Q.isOverlay && Q.mode === "split" ? /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(oe, {
|
|
1602
|
+
...Q,
|
|
1603
|
+
title: kt,
|
|
1604
|
+
mainContent: /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
|
|
1605
|
+
Nt,
|
|
1606
|
+
Lt,
|
|
1607
|
+
/* @__PURE__ */ (0, Z.jsx)(nt, {
|
|
1608
|
+
selectedRows: ge,
|
|
1609
|
+
actions: xt ?? [],
|
|
1610
|
+
onAction: (e, t) => Ue({
|
|
1507
1611
|
type: e,
|
|
1508
1612
|
params: { records: t }
|
|
1509
1613
|
}),
|
|
1510
|
-
onClearSelection: () =>
|
|
1614
|
+
onClearSelection: () => ve([])
|
|
1511
1615
|
})
|
|
1512
1616
|
] }),
|
|
1513
|
-
children: (e) =>
|
|
1514
|
-
}) : /* @__PURE__ */ (0,
|
|
1515
|
-
ref:
|
|
1617
|
+
children: (e) => Pt(e)
|
|
1618
|
+
}), Rt] }) : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
1619
|
+
ref: Te,
|
|
1516
1620
|
className: "relative h-full",
|
|
1517
1621
|
children: [
|
|
1518
|
-
De > 0 && /* @__PURE__ */ (0,
|
|
1622
|
+
De > 0 && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
1519
1623
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1520
1624
|
style: { height: De },
|
|
1521
1625
|
children: M(Ee ? "grid.refreshing" : "grid.pullToRefresh")
|
|
1522
1626
|
}),
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
/* @__PURE__ */ (0,
|
|
1526
|
-
selectedRows:
|
|
1527
|
-
actions:
|
|
1528
|
-
onAction: (e, t) =>
|
|
1627
|
+
Nt,
|
|
1628
|
+
Lt,
|
|
1629
|
+
/* @__PURE__ */ (0, Z.jsx)(nt, {
|
|
1630
|
+
selectedRows: ge,
|
|
1631
|
+
actions: xt ?? [],
|
|
1632
|
+
onAction: (e, t) => Ue({
|
|
1529
1633
|
type: e,
|
|
1530
1634
|
params: { records: t }
|
|
1531
1635
|
}),
|
|
1532
|
-
onClearSelection: () =>
|
|
1636
|
+
onClearSelection: () => ve([])
|
|
1533
1637
|
}),
|
|
1534
|
-
|
|
1535
|
-
...
|
|
1536
|
-
title:
|
|
1537
|
-
children: (e) =>
|
|
1538
|
-
})
|
|
1638
|
+
Q.isOverlay && /* @__PURE__ */ (0, Z.jsx)(oe, {
|
|
1639
|
+
...Q,
|
|
1640
|
+
title: kt,
|
|
1641
|
+
children: (e) => Pt(e)
|
|
1642
|
+
}),
|
|
1643
|
+
Rt
|
|
1539
1644
|
]
|
|
1540
1645
|
});
|
|
1541
1646
|
};
|
|
1542
1647
|
//#endregion
|
|
1543
1648
|
//#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
1544
|
-
function
|
|
1649
|
+
function lt(e, t, n) {
|
|
1545
1650
|
let r = n.initialDeps ?? [], i, a = !0;
|
|
1546
1651
|
function o() {
|
|
1547
1652
|
let o;
|
|
@@ -1566,26 +1671,26 @@ function X(e, t, n) {
|
|
|
1566
1671
|
r = e;
|
|
1567
1672
|
}, o;
|
|
1568
1673
|
}
|
|
1569
|
-
function
|
|
1674
|
+
function ut(e, t) {
|
|
1570
1675
|
if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
|
|
1571
1676
|
return e;
|
|
1572
1677
|
}
|
|
1573
|
-
var
|
|
1678
|
+
var $ = (e, t) => Math.abs(e - t) < 1.01, dt = (e, t, n) => {
|
|
1574
1679
|
let r;
|
|
1575
1680
|
return function(...i) {
|
|
1576
1681
|
e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
|
|
1577
1682
|
};
|
|
1578
|
-
},
|
|
1683
|
+
}, ft = (e) => {
|
|
1579
1684
|
let { offsetWidth: t, offsetHeight: n } = e;
|
|
1580
1685
|
return {
|
|
1581
1686
|
width: t,
|
|
1582
1687
|
height: n
|
|
1583
1688
|
};
|
|
1584
|
-
},
|
|
1689
|
+
}, pt = (e) => e, mt = (e) => {
|
|
1585
1690
|
let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
|
|
1586
1691
|
for (let e = t; e <= n; e++) r.push(e);
|
|
1587
1692
|
return r;
|
|
1588
|
-
},
|
|
1693
|
+
}, ht = (e, t) => {
|
|
1589
1694
|
let n = e.scrollElement;
|
|
1590
1695
|
if (!n) return;
|
|
1591
1696
|
let r = e.targetWindow;
|
|
@@ -1597,7 +1702,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1597
1702
|
height: Math.round(r)
|
|
1598
1703
|
});
|
|
1599
1704
|
};
|
|
1600
|
-
if (i(
|
|
1705
|
+
if (i(ft(n)), !r.ResizeObserver) return () => {};
|
|
1601
1706
|
let a = new r.ResizeObserver((t) => {
|
|
1602
1707
|
let r = () => {
|
|
1603
1708
|
let e = t[0];
|
|
@@ -1611,43 +1716,43 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1611
1716
|
return;
|
|
1612
1717
|
}
|
|
1613
1718
|
}
|
|
1614
|
-
i(
|
|
1719
|
+
i(ft(n));
|
|
1615
1720
|
};
|
|
1616
1721
|
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
1617
1722
|
});
|
|
1618
1723
|
return a.observe(n, { box: "border-box" }), () => {
|
|
1619
1724
|
a.unobserve(n);
|
|
1620
1725
|
};
|
|
1621
|
-
},
|
|
1726
|
+
}, gt = { passive: !0 }, _t = typeof window > "u" ? !0 : "onscrollend" in window, vt = (e, t) => {
|
|
1622
1727
|
let n = e.scrollElement;
|
|
1623
1728
|
if (!n) return;
|
|
1624
1729
|
let r = e.targetWindow;
|
|
1625
1730
|
if (!r) return;
|
|
1626
|
-
let i = 0, a = e.options.useScrollendEvent &&
|
|
1731
|
+
let i = 0, a = e.options.useScrollendEvent && _t ? () => void 0 : dt(r, () => {
|
|
1627
1732
|
t(i, !1);
|
|
1628
1733
|
}, e.options.isScrollingResetDelay), o = (r) => () => {
|
|
1629
1734
|
let { horizontal: o, isRtl: s } = e.options;
|
|
1630
1735
|
i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
|
|
1631
1736
|
}, s = o(!0), c = o(!1);
|
|
1632
|
-
n.addEventListener("scroll", s,
|
|
1633
|
-
let l = e.options.useScrollendEvent &&
|
|
1634
|
-
return l && n.addEventListener("scrollend", c,
|
|
1737
|
+
n.addEventListener("scroll", s, gt);
|
|
1738
|
+
let l = e.options.useScrollendEvent && _t;
|
|
1739
|
+
return l && n.addEventListener("scrollend", c, gt), () => {
|
|
1635
1740
|
n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
|
|
1636
1741
|
};
|
|
1637
|
-
},
|
|
1742
|
+
}, yt = (e, t, n) => {
|
|
1638
1743
|
if (t?.borderBoxSize) {
|
|
1639
1744
|
let e = t.borderBoxSize[0];
|
|
1640
1745
|
if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
|
|
1641
1746
|
}
|
|
1642
1747
|
return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
1643
|
-
},
|
|
1748
|
+
}, bt = (e, { adjustments: t = 0, behavior: n }, r) => {
|
|
1644
1749
|
var i, a;
|
|
1645
1750
|
let o = e + t;
|
|
1646
1751
|
(a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
|
|
1647
1752
|
[r.options.horizontal ? "left" : "top"]: o,
|
|
1648
1753
|
behavior: n
|
|
1649
1754
|
});
|
|
1650
|
-
},
|
|
1755
|
+
}, xt = class {
|
|
1651
1756
|
constructor(e) {
|
|
1652
1757
|
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 = () => {
|
|
1653
1758
|
var e;
|
|
@@ -1686,10 +1791,10 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1686
1791
|
scrollPaddingStart: 0,
|
|
1687
1792
|
scrollPaddingEnd: 0,
|
|
1688
1793
|
horizontal: !1,
|
|
1689
|
-
getItemKey:
|
|
1690
|
-
rangeExtractor:
|
|
1794
|
+
getItemKey: pt,
|
|
1795
|
+
rangeExtractor: mt,
|
|
1691
1796
|
onChange: () => {},
|
|
1692
|
-
measureElement:
|
|
1797
|
+
measureElement: yt,
|
|
1693
1798
|
initialRect: {
|
|
1694
1799
|
width: 0,
|
|
1695
1800
|
height: 0
|
|
@@ -1710,7 +1815,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1710
1815
|
}, this.notify = (e) => {
|
|
1711
1816
|
var t, n;
|
|
1712
1817
|
(n = (t = this.options).onChange) == null || n.call(t, this, e);
|
|
1713
|
-
}, this.maybeNotify =
|
|
1818
|
+
}, this.maybeNotify = lt(() => (this.calculateRange(), [
|
|
1714
1819
|
this.isScrolling,
|
|
1715
1820
|
this.range ? this.range.startIndex : null,
|
|
1716
1821
|
this.range ? this.range.endIndex : null
|
|
@@ -1755,7 +1860,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1755
1860
|
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;
|
|
1756
1861
|
}
|
|
1757
1862
|
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;
|
|
1758
|
-
}, this.getMeasurementOptions =
|
|
1863
|
+
}, this.getMeasurementOptions = lt(() => [
|
|
1759
1864
|
this.options.count,
|
|
1760
1865
|
this.options.paddingStart,
|
|
1761
1866
|
this.options.scrollMargin,
|
|
@@ -1771,7 +1876,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1771
1876
|
enabled: i,
|
|
1772
1877
|
lanes: a,
|
|
1773
1878
|
laneAssignmentMode: o
|
|
1774
|
-
}), { key: !1 }), this.getMeasurements =
|
|
1879
|
+
}), { key: !1 }), this.getMeasurements = lt(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o }, s) => {
|
|
1775
1880
|
if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
1776
1881
|
if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
|
|
1777
1882
|
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) => {
|
|
@@ -1808,12 +1913,12 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1808
1913
|
}, {
|
|
1809
1914
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
1810
1915
|
debug: () => this.options.debug
|
|
1811
|
-
}), this.calculateRange =
|
|
1916
|
+
}), this.calculateRange = lt(() => [
|
|
1812
1917
|
this.getMeasurements(),
|
|
1813
1918
|
this.getSize(),
|
|
1814
1919
|
this.getScrollOffset(),
|
|
1815
1920
|
this.options.lanes
|
|
1816
|
-
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ?
|
|
1921
|
+
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? Ct({
|
|
1817
1922
|
measurements: e,
|
|
1818
1923
|
outerSize: t,
|
|
1819
1924
|
scrollOffset: n,
|
|
@@ -1821,7 +1926,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1821
1926
|
}) : null, {
|
|
1822
1927
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
1823
1928
|
debug: () => this.options.debug
|
|
1824
|
-
}), this.getVirtualIndexes =
|
|
1929
|
+
}), this.getVirtualIndexes = lt(() => {
|
|
1825
1930
|
let e = null, t = null, n = this.calculateRange();
|
|
1826
1931
|
return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
|
|
1827
1932
|
this.isScrolling,
|
|
@@ -1870,7 +1975,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1870
1975
|
adjustments: this.scrollAdjustments += r,
|
|
1871
1976
|
behavior: void 0
|
|
1872
1977
|
})), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
|
|
1873
|
-
}, this.getVirtualItems =
|
|
1978
|
+
}, this.getVirtualItems = lt(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
|
|
1874
1979
|
let n = [];
|
|
1875
1980
|
for (let r = 0, i = e.length; r < i; r++) {
|
|
1876
1981
|
let i = t[e[r]];
|
|
@@ -1882,7 +1987,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1882
1987
|
debug: () => this.options.debug
|
|
1883
1988
|
}), this.getVirtualItemForOffset = (e) => {
|
|
1884
1989
|
let t = this.getMeasurements();
|
|
1885
|
-
if (t.length !== 0) return
|
|
1990
|
+
if (t.length !== 0) return ut(t[St(0, t.length - 1, (e) => ut(t[e]).start, e)]);
|
|
1886
1991
|
}, this.getMaxScrollOffset = () => {
|
|
1887
1992
|
if (!this.scrollElement) return 0;
|
|
1888
1993
|
if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
@@ -1986,7 +2091,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1986
2091
|
return;
|
|
1987
2092
|
}
|
|
1988
2093
|
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;
|
|
1989
|
-
if (!n &&
|
|
2094
|
+
if (!n && $(t, this.getScrollOffset())) {
|
|
1990
2095
|
if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
|
|
1991
2096
|
this.scrollState = null;
|
|
1992
2097
|
return;
|
|
@@ -1997,7 +2102,7 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
1997
2102
|
}));
|
|
1998
2103
|
this.scheduleScrollReconcile();
|
|
1999
2104
|
}
|
|
2000
|
-
},
|
|
2105
|
+
}, St = (e, t, n, r) => {
|
|
2001
2106
|
for (; e <= t;) {
|
|
2002
2107
|
let i = (e + t) / 2 | 0, a = n(i);
|
|
2003
2108
|
if (a < r) e = i + 1;
|
|
@@ -2006,13 +2111,13 @@ var st = (e, t) => Math.abs(e - t) < 1.01, ct = (e, t, n) => {
|
|
|
2006
2111
|
}
|
|
2007
2112
|
return e > 0 ? e - 1 : 0;
|
|
2008
2113
|
};
|
|
2009
|
-
function
|
|
2114
|
+
function Ct({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
2010
2115
|
let i = e.length - 1, a = (t) => e[t].start;
|
|
2011
2116
|
if (e.length <= r) return {
|
|
2012
2117
|
startIndex: 0,
|
|
2013
2118
|
endIndex: i
|
|
2014
2119
|
};
|
|
2015
|
-
let o =
|
|
2120
|
+
let o = St(0, i, a, n), s = o;
|
|
2016
2121
|
if (r === 1) for (; s < i && e[s].end < n + t;) s++;
|
|
2017
2122
|
else if (r > 1) {
|
|
2018
2123
|
let a = Array(r).fill(0);
|
|
@@ -2034,53 +2139,53 @@ function vt({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
|
2034
2139
|
}
|
|
2035
2140
|
//#endregion
|
|
2036
2141
|
//#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
|
|
2038
|
-
function
|
|
2142
|
+
var wt = typeof document < "u" ? e.useLayoutEffect : e.useEffect;
|
|
2143
|
+
function Tt({ useFlushSync: t = !0, ...n }) {
|
|
2039
2144
|
let r = e.useReducer(() => ({}), {})[1], i = {
|
|
2040
2145
|
...n,
|
|
2041
2146
|
onChange: (e, i) => {
|
|
2042
2147
|
var a;
|
|
2043
|
-
t && i ?
|
|
2148
|
+
t && i ? q(r) : r(), (a = n.onChange) == null || a.call(n, e, i);
|
|
2044
2149
|
}
|
|
2045
|
-
}, [a] = e.useState(() => new
|
|
2046
|
-
return a.setOptions(i),
|
|
2150
|
+
}, [a] = e.useState(() => new xt(i));
|
|
2151
|
+
return a.setOptions(i), wt(() => a._didMount(), []), wt(() => a._willUpdate()), a;
|
|
2047
2152
|
}
|
|
2048
|
-
function
|
|
2049
|
-
return
|
|
2050
|
-
observeElementRect:
|
|
2051
|
-
observeElementOffset:
|
|
2052
|
-
scrollToFn:
|
|
2153
|
+
function Et(e) {
|
|
2154
|
+
return Tt({
|
|
2155
|
+
observeElementRect: ht,
|
|
2156
|
+
observeElementOffset: vt,
|
|
2157
|
+
scrollToFn: bt,
|
|
2053
2158
|
...e
|
|
2054
2159
|
});
|
|
2055
2160
|
}
|
|
2056
2161
|
//#endregion
|
|
2057
2162
|
//#region src/VirtualGrid.tsx
|
|
2058
|
-
var
|
|
2059
|
-
let u = o(null), d =
|
|
2163
|
+
var Dt = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className: i = "", headerClassName: a = "", rowClassName: s, onRowClick: c, overscan: l = 5 }) => {
|
|
2164
|
+
let u = o(null), d = Et({
|
|
2060
2165
|
count: e.length,
|
|
2061
2166
|
getScrollElement: () => u.current,
|
|
2062
2167
|
estimateSize: () => n,
|
|
2063
2168
|
overscan: l
|
|
2064
2169
|
}), f = d.getVirtualItems();
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2170
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2066
2171
|
className: i,
|
|
2067
2172
|
children: [
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2173
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2069
2174
|
className: `grid border-b sticky top-0 bg-muted/30 z-10 ${a}`,
|
|
2070
2175
|
style: { gridTemplateColumns: t.map((e) => e.width || "1fr").join(" ") },
|
|
2071
|
-
children: t.map((e, t) => /* @__PURE__ */ (0,
|
|
2176
|
+
children: t.map((e, t) => /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2072
2177
|
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"}`,
|
|
2073
2178
|
children: e.header
|
|
2074
2179
|
}, t))
|
|
2075
2180
|
}),
|
|
2076
|
-
/* @__PURE__ */ (0,
|
|
2181
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2077
2182
|
ref: u,
|
|
2078
2183
|
className: "overflow-auto",
|
|
2079
2184
|
style: {
|
|
2080
2185
|
height: typeof r == "number" ? `${r}px` : r,
|
|
2081
2186
|
contain: "strict"
|
|
2082
2187
|
},
|
|
2083
|
-
children: /* @__PURE__ */ (0,
|
|
2188
|
+
children: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2084
2189
|
style: {
|
|
2085
2190
|
height: `${d.getTotalSize()}px`,
|
|
2086
2191
|
width: "100%",
|
|
@@ -2088,7 +2193,7 @@ var St = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2088
2193
|
},
|
|
2089
2194
|
children: f.map((n) => {
|
|
2090
2195
|
let r = e[n.index];
|
|
2091
|
-
return /* @__PURE__ */ (0,
|
|
2196
|
+
return /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2092
2197
|
className: `grid border-b hover:bg-muted/50 cursor-pointer ${typeof s == "function" ? s(r, n.index) : s || ""}`,
|
|
2093
2198
|
style: {
|
|
2094
2199
|
position: "absolute",
|
|
@@ -2102,7 +2207,7 @@ var St = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2102
2207
|
onClick: () => c?.(r, n.index),
|
|
2103
2208
|
children: t.map((e, t) => {
|
|
2104
2209
|
let n = r[e.accessorKey], i = e.cell ? e.cell(n, r) : typeof n == "object" && n ? String(n) : n;
|
|
2105
|
-
return /* @__PURE__ */ (0,
|
|
2210
|
+
return /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2106
2211
|
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"}`,
|
|
2107
2212
|
children: i
|
|
2108
2213
|
}, t);
|
|
@@ -2111,7 +2216,7 @@ var St = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2111
2216
|
})
|
|
2112
2217
|
})
|
|
2113
2218
|
}),
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2219
|
+
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2115
2220
|
className: "px-4 py-2 text-xs text-muted-foreground border-t",
|
|
2116
2221
|
children: [
|
|
2117
2222
|
"Showing ",
|
|
@@ -2123,8 +2228,8 @@ var St = ({ data: e, columns: t, rowHeight: n = 40, height: r = 600, className:
|
|
|
2123
2228
|
})
|
|
2124
2229
|
]
|
|
2125
2230
|
});
|
|
2126
|
-
},
|
|
2127
|
-
function
|
|
2231
|
+
}, Ot = 10;
|
|
2232
|
+
function kt(e) {
|
|
2128
2233
|
let t = [], n = [], r = "", i = !1;
|
|
2129
2234
|
for (let a = 0; a < e.length; a++) {
|
|
2130
2235
|
let o = e[a], s = e[a + 1];
|
|
@@ -2132,7 +2237,7 @@ function wt(e) {
|
|
|
2132
2237
|
}
|
|
2133
2238
|
return n.push(r.trim()), n.some((e) => e !== "") && t.push(n), t;
|
|
2134
2239
|
}
|
|
2135
|
-
function
|
|
2240
|
+
function At(e, t) {
|
|
2136
2241
|
if (!e) return !0;
|
|
2137
2242
|
switch (t) {
|
|
2138
2243
|
case "number":
|
|
@@ -2151,7 +2256,7 @@ function Tt(e, t) {
|
|
|
2151
2256
|
default: return !0;
|
|
2152
2257
|
}
|
|
2153
2258
|
}
|
|
2154
|
-
function
|
|
2259
|
+
function jt(e, t) {
|
|
2155
2260
|
let n = {};
|
|
2156
2261
|
return e.forEach((e, r) => {
|
|
2157
2262
|
let i = e.toLowerCase().replace(/[_\s-]/g, ""), a = t.find((e) => {
|
|
@@ -2161,7 +2266,45 @@ function Et(e, t) {
|
|
|
2161
2266
|
a && (n[r] = a.name);
|
|
2162
2267
|
}), n;
|
|
2163
2268
|
}
|
|
2164
|
-
function
|
|
2269
|
+
function Mt() {
|
|
2270
|
+
if (typeof window > "u") return null;
|
|
2271
|
+
try {
|
|
2272
|
+
return window.localStorage;
|
|
2273
|
+
} catch {
|
|
2274
|
+
return null;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
function Nt(e, t) {
|
|
2278
|
+
if (!e) return [];
|
|
2279
|
+
try {
|
|
2280
|
+
let n = e.getItem(t);
|
|
2281
|
+
if (!n) return [];
|
|
2282
|
+
let r = JSON.parse(n);
|
|
2283
|
+
return Array.isArray(r) ? r.filter((e) => e && e.id && e.name && e.mapping) : [];
|
|
2284
|
+
} catch {
|
|
2285
|
+
return [];
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
function Pt(e, t, n) {
|
|
2289
|
+
if (e) try {
|
|
2290
|
+
e.setItem(t, JSON.stringify(n));
|
|
2291
|
+
} catch {}
|
|
2292
|
+
}
|
|
2293
|
+
function Ft(e, t) {
|
|
2294
|
+
let n = {};
|
|
2295
|
+
return Object.entries(t).forEach(([t, r]) => {
|
|
2296
|
+
let i = e[Number(t)];
|
|
2297
|
+
i && (n[i.trim().toLowerCase()] = r);
|
|
2298
|
+
}), n;
|
|
2299
|
+
}
|
|
2300
|
+
function It(e, t, n) {
|
|
2301
|
+
let r = new Set(n.map((e) => e.name)), i = {};
|
|
2302
|
+
return t.forEach((t, n) => {
|
|
2303
|
+
let a = e.mapping[t.trim().toLowerCase()];
|
|
2304
|
+
a && r.has(a) && (i[n] = a);
|
|
2305
|
+
}), i;
|
|
2306
|
+
}
|
|
2307
|
+
function Lt(e, t, n) {
|
|
2165
2308
|
let r = [], i = {};
|
|
2166
2309
|
for (let a of t) {
|
|
2167
2310
|
let t = e[a.csvIdx] ?? "";
|
|
@@ -2173,7 +2316,7 @@ function Dt(e, t, n) {
|
|
|
2173
2316
|
});
|
|
2174
2317
|
continue;
|
|
2175
2318
|
}
|
|
2176
|
-
if (t && !
|
|
2319
|
+
if (t && !At(t, a.field.type)) {
|
|
2177
2320
|
r.push({
|
|
2178
2321
|
row: n,
|
|
2179
2322
|
field: a.field.name,
|
|
@@ -2188,7 +2331,7 @@ function Dt(e, t, n) {
|
|
|
2188
2331
|
errors: r
|
|
2189
2332
|
};
|
|
2190
2333
|
}
|
|
2191
|
-
var
|
|
2334
|
+
var Rt = ({ onFileLoaded: e }) => {
|
|
2192
2335
|
let [t, n] = s(!1), [i, a] = s(null), o = r((t) => {
|
|
2193
2336
|
if (a(null), !t.name.endsWith(".csv")) {
|
|
2194
2337
|
a("Only CSV files are supported.");
|
|
@@ -2196,7 +2339,7 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2196
2339
|
}
|
|
2197
2340
|
let n = new FileReader();
|
|
2198
2341
|
n.onload = (t) => {
|
|
2199
|
-
let n =
|
|
2342
|
+
let n = kt(t.target?.result);
|
|
2200
2343
|
if (n.length < 2) {
|
|
2201
2344
|
a("File must contain a header row and at least one data row.");
|
|
2202
2345
|
return;
|
|
@@ -2204,10 +2347,10 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2204
2347
|
e(n[0], n.slice(1));
|
|
2205
2348
|
}, n.readAsText(t);
|
|
2206
2349
|
}, [e]);
|
|
2207
|
-
return /* @__PURE__ */ (0,
|
|
2350
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2208
2351
|
className: "flex flex-col items-center gap-4 py-6",
|
|
2209
|
-
children: [/* @__PURE__ */ (0,
|
|
2210
|
-
className:
|
|
2352
|
+
children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2353
|
+
className: H("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"),
|
|
2211
2354
|
onDragOver: (e) => {
|
|
2212
2355
|
e.preventDefault(), n(!0);
|
|
2213
2356
|
},
|
|
@@ -2218,12 +2361,12 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2218
2361
|
t && o(t);
|
|
2219
2362
|
},
|
|
2220
2363
|
children: [
|
|
2221
|
-
/* @__PURE__ */ (0,
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2364
|
+
/* @__PURE__ */ (0, Z.jsx)(G, { className: "h-10 w-10 text-muted-foreground" }),
|
|
2365
|
+
/* @__PURE__ */ (0, Z.jsx)("p", {
|
|
2223
2366
|
className: "text-sm text-muted-foreground",
|
|
2224
2367
|
children: "Drag & drop a CSV file here, or click to browse"
|
|
2225
2368
|
}),
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2369
|
+
/* @__PURE__ */ (0, Z.jsxs)("label", { children: [/* @__PURE__ */ (0, Z.jsx)("input", {
|
|
2227
2370
|
type: "file",
|
|
2228
2371
|
accept: ".csv",
|
|
2229
2372
|
className: "hidden",
|
|
@@ -2231,127 +2374,243 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2231
2374
|
let t = e.target.files?.[0];
|
|
2232
2375
|
t && o(t);
|
|
2233
2376
|
}
|
|
2234
|
-
}), /* @__PURE__ */ (0,
|
|
2377
|
+
}), /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2235
2378
|
variant: "outline",
|
|
2236
2379
|
size: "sm",
|
|
2237
2380
|
asChild: !0,
|
|
2238
|
-
children: /* @__PURE__ */ (0,
|
|
2381
|
+
children: /* @__PURE__ */ (0, Z.jsx)("span", { children: "Browse Files" })
|
|
2239
2382
|
})] })
|
|
2240
2383
|
]
|
|
2241
|
-
}), i && /* @__PURE__ */ (0,
|
|
2384
|
+
}), i && /* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2242
2385
|
className: "flex items-center gap-1 text-sm text-destructive",
|
|
2243
2386
|
children: [
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2387
|
+
/* @__PURE__ */ (0, Z.jsx)(U, { className: "h-4 w-4" }),
|
|
2245
2388
|
" ",
|
|
2246
2389
|
i
|
|
2247
2390
|
]
|
|
2248
2391
|
})]
|
|
2249
2392
|
});
|
|
2250
|
-
},
|
|
2251
|
-
let o =
|
|
2393
|
+
}, zt = ({ templates: e, selectedId: t, onSelect: n, onSaveAs: r, onDelete: i, disabled: a }) => {
|
|
2394
|
+
let [o, c] = s(""), [l, u] = s(!1);
|
|
2395
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2396
|
+
className: "mb-3 flex flex-wrap items-center gap-2 rounded-md border bg-muted/30 p-2",
|
|
2397
|
+
"data-testid": "import-template-bar",
|
|
2398
|
+
children: [
|
|
2399
|
+
/* @__PURE__ */ (0, Z.jsx)(Ne, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2400
|
+
/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
2401
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
2402
|
+
children: "Mapping template:"
|
|
2403
|
+
}),
|
|
2404
|
+
/* @__PURE__ */ (0, Z.jsxs)(F, {
|
|
2405
|
+
value: t ?? "__none__",
|
|
2406
|
+
onValueChange: (e) => e !== "__none__" && n(e),
|
|
2407
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(R, {
|
|
2408
|
+
className: "h-7 w-48 text-xs",
|
|
2409
|
+
"data-testid": "import-template-select",
|
|
2410
|
+
children: /* @__PURE__ */ (0, Z.jsx)(le, { placeholder: e.length ? "Choose template…" : "No saved templates" })
|
|
2411
|
+
}), /* @__PURE__ */ (0, Z.jsxs)(I, { children: [/* @__PURE__ */ (0, Z.jsx)(L, {
|
|
2412
|
+
value: "__none__",
|
|
2413
|
+
disabled: e.length === 0,
|
|
2414
|
+
children: e.length ? "— None —" : "No saved templates"
|
|
2415
|
+
}), e.map((e) => /* @__PURE__ */ (0, Z.jsx)(L, {
|
|
2416
|
+
value: e.id,
|
|
2417
|
+
children: e.name
|
|
2418
|
+
}, e.id))] })]
|
|
2419
|
+
}),
|
|
2420
|
+
l ? /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2421
|
+
className: "flex items-center gap-1",
|
|
2422
|
+
children: [
|
|
2423
|
+
/* @__PURE__ */ (0, Z.jsx)(M, {
|
|
2424
|
+
value: o,
|
|
2425
|
+
onChange: (e) => c(e.target.value),
|
|
2426
|
+
placeholder: "Template name",
|
|
2427
|
+
className: "h-7 w-40 text-xs",
|
|
2428
|
+
"data-testid": "import-template-name-input",
|
|
2429
|
+
autoFocus: !0
|
|
2430
|
+
}),
|
|
2431
|
+
/* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2432
|
+
type: "button",
|
|
2433
|
+
size: "sm",
|
|
2434
|
+
onClick: () => {
|
|
2435
|
+
o.trim() && (r(o.trim()), c(""), u(!1));
|
|
2436
|
+
},
|
|
2437
|
+
disabled: !o.trim() || a,
|
|
2438
|
+
"data-testid": "import-template-confirm-save",
|
|
2439
|
+
children: "Save"
|
|
2440
|
+
}),
|
|
2441
|
+
/* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2442
|
+
type: "button",
|
|
2443
|
+
variant: "ghost",
|
|
2444
|
+
size: "sm",
|
|
2445
|
+
onClick: () => {
|
|
2446
|
+
u(!1), c("");
|
|
2447
|
+
},
|
|
2448
|
+
children: "Cancel"
|
|
2449
|
+
})
|
|
2450
|
+
]
|
|
2451
|
+
}) : /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2452
|
+
type: "button",
|
|
2453
|
+
variant: "outline",
|
|
2454
|
+
size: "sm",
|
|
2455
|
+
onClick: () => u(!0),
|
|
2456
|
+
disabled: a,
|
|
2457
|
+
"data-testid": "import-template-save-btn",
|
|
2458
|
+
children: "Save current"
|
|
2459
|
+
}),
|
|
2460
|
+
t && /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2461
|
+
type: "button",
|
|
2462
|
+
variant: "ghost",
|
|
2463
|
+
size: "sm",
|
|
2464
|
+
onClick: i,
|
|
2465
|
+
"aria-label": "Delete template",
|
|
2466
|
+
"data-testid": "import-template-delete-btn",
|
|
2467
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Fe, { className: "h-3.5 w-3.5" })
|
|
2468
|
+
})
|
|
2469
|
+
]
|
|
2470
|
+
});
|
|
2471
|
+
}, Bt = ({ headers: e, fields: t, mapping: n, onMappingChange: i, templates: o, selectedTemplateId: s, onSelectTemplate: c, onSaveTemplate: l, onDeleteTemplate: u }) => {
|
|
2472
|
+
let d = a(() => new Set(Object.values(n)), [n]), f = r((e, t) => {
|
|
2252
2473
|
let r = { ...n };
|
|
2253
2474
|
t === "__skip__" ? delete r[e] : r[e] = t, i(r);
|
|
2254
2475
|
}, [n, i]);
|
|
2255
|
-
return /* @__PURE__ */ (0,
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2476
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", { children: [/* @__PURE__ */ (0, Z.jsx)(zt, {
|
|
2477
|
+
templates: o,
|
|
2478
|
+
selectedId: s,
|
|
2479
|
+
onSelect: c,
|
|
2480
|
+
onSaveAs: l,
|
|
2481
|
+
onDelete: u,
|
|
2482
|
+
disabled: Object.keys(n).length === 0
|
|
2483
|
+
}), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2484
|
+
className: "max-h-[320px] overflow-auto",
|
|
2485
|
+
children: /* @__PURE__ */ (0, Z.jsxs)(ue, { children: [/* @__PURE__ */ (0, Z.jsx)(fe, { children: /* @__PURE__ */ (0, Z.jsxs)(V, { children: [
|
|
2486
|
+
/* @__PURE__ */ (0, Z.jsx)(B, { children: "CSV Column" }),
|
|
2487
|
+
/* @__PURE__ */ (0, Z.jsx)(B, { children: "Maps To" }),
|
|
2488
|
+
/* @__PURE__ */ (0, Z.jsx)(B, {
|
|
2261
2489
|
className: "w-24 text-center",
|
|
2262
2490
|
children: "Status"
|
|
2263
2491
|
})
|
|
2264
|
-
] }) }), /* @__PURE__ */ (0,
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2492
|
+
] }) }), /* @__PURE__ */ (0, Z.jsx)(de, { children: e.map((e, r) => /* @__PURE__ */ (0, Z.jsxs)(V, { children: [
|
|
2493
|
+
/* @__PURE__ */ (0, Z.jsx)(z, {
|
|
2266
2494
|
className: "font-medium",
|
|
2267
2495
|
children: e
|
|
2268
2496
|
}),
|
|
2269
|
-
/* @__PURE__ */ (0,
|
|
2497
|
+
/* @__PURE__ */ (0, Z.jsx)(z, { children: /* @__PURE__ */ (0, Z.jsxs)(F, {
|
|
2270
2498
|
value: n[r] ?? "__skip__",
|
|
2271
|
-
onValueChange: (e) =>
|
|
2272
|
-
children: [/* @__PURE__ */ (0,
|
|
2499
|
+
onValueChange: (e) => f(r, e),
|
|
2500
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(R, {
|
|
2273
2501
|
className: "h-8 w-56",
|
|
2274
|
-
children: /* @__PURE__ */ (0,
|
|
2275
|
-
}), /* @__PURE__ */ (0,
|
|
2502
|
+
children: /* @__PURE__ */ (0, Z.jsx)(le, { placeholder: "Skip column" })
|
|
2503
|
+
}), /* @__PURE__ */ (0, Z.jsxs)(I, { children: [/* @__PURE__ */ (0, Z.jsx)(L, {
|
|
2276
2504
|
value: "__skip__",
|
|
2277
2505
|
children: "— Skip —"
|
|
2278
|
-
}), t.map((e) => /* @__PURE__ */ (0,
|
|
2506
|
+
}), t.map((e) => /* @__PURE__ */ (0, Z.jsxs)(L, {
|
|
2279
2507
|
value: e.name,
|
|
2280
|
-
disabled:
|
|
2508
|
+
disabled: d.has(e.name) && n[r] !== e.name,
|
|
2281
2509
|
children: [e.label, e.required ? " *" : ""]
|
|
2282
2510
|
}, e.name))] })]
|
|
2283
2511
|
}) }),
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
/* @__PURE__ */ (0, Z.jsx)(z, {
|
|
2285
2513
|
className: "text-center",
|
|
2286
|
-
children: n[r] ? /* @__PURE__ */ (0,
|
|
2514
|
+
children: n[r] ? /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
2287
2515
|
variant: "default",
|
|
2288
2516
|
className: "text-xs",
|
|
2289
2517
|
children: "Mapped"
|
|
2290
|
-
}) : /* @__PURE__ */ (0,
|
|
2518
|
+
}) : /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
2291
2519
|
variant: "secondary",
|
|
2292
2520
|
className: "text-xs",
|
|
2293
2521
|
children: "Skipped"
|
|
2294
2522
|
})
|
|
2295
2523
|
})
|
|
2296
2524
|
] }, r)) })] })
|
|
2297
|
-
});
|
|
2298
|
-
},
|
|
2299
|
-
let
|
|
2525
|
+
})] });
|
|
2526
|
+
}, Vt = ({ headers: e, rows: t, mapping: n, fields: i, corrections: o, onCorrect: s }) => {
|
|
2527
|
+
let c = a(() => Object.entries(n).map(([t, n]) => ({
|
|
2300
2528
|
csvIdx: Number(t),
|
|
2301
2529
|
header: e[Number(t)],
|
|
2302
|
-
field:
|
|
2530
|
+
field: i.find((e) => e.name === n)
|
|
2303
2531
|
})), [
|
|
2304
2532
|
n,
|
|
2305
2533
|
e,
|
|
2306
|
-
|
|
2307
|
-
]),
|
|
2534
|
+
i
|
|
2535
|
+
]), l = t.slice(0, Ot), u = r((e, t) => {
|
|
2536
|
+
let n = o[e]?.[t];
|
|
2537
|
+
return n === void 0 ? l[e]?.[t] ?? "" : n;
|
|
2538
|
+
}, [o, l]), d = a(() => l.map((e, t) => {
|
|
2308
2539
|
let n = {};
|
|
2309
|
-
for (let
|
|
2310
|
-
let r = e
|
|
2311
|
-
|
|
2540
|
+
for (let e of c) {
|
|
2541
|
+
let r = u(t, e.csvIdx);
|
|
2542
|
+
e.field.required && !r ? n[e.csvIdx] = "Required" : r && !At(r, e.field.type) && (n[e.csvIdx] = `Invalid ${e.field.type}`);
|
|
2312
2543
|
}
|
|
2313
2544
|
return n;
|
|
2314
|
-
}), [
|
|
2315
|
-
|
|
2545
|
+
}), [
|
|
2546
|
+
l,
|
|
2547
|
+
c,
|
|
2548
|
+
u
|
|
2549
|
+
]), f = d.filter((e) => Object.keys(e).length > 0).length, p = Object.keys(o).length;
|
|
2550
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2316
2551
|
className: "max-h-[360px] overflow-auto",
|
|
2317
2552
|
children: [
|
|
2318
|
-
|
|
2319
|
-
className: "mb-2 flex items-center gap-
|
|
2553
|
+
(f > 0 || p > 0) && /* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2554
|
+
className: "mb-2 flex items-center gap-2 text-xs",
|
|
2555
|
+
"data-testid": "import-preview-status",
|
|
2320
2556
|
children: [
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2557
|
+
f > 0 && /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
2558
|
+
className: "flex items-center gap-1 text-destructive",
|
|
2559
|
+
children: [
|
|
2560
|
+
/* @__PURE__ */ (0, Z.jsx)(U, { className: "h-3.5 w-3.5" }),
|
|
2561
|
+
" ",
|
|
2562
|
+
f,
|
|
2563
|
+
" row(s) with errors"
|
|
2564
|
+
]
|
|
2565
|
+
}),
|
|
2566
|
+
p > 0 && /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
2567
|
+
className: "flex items-center gap-1 text-emerald-600",
|
|
2568
|
+
children: [
|
|
2569
|
+
/* @__PURE__ */ (0, Z.jsx)(ye, { className: "h-3.5 w-3.5" }),
|
|
2570
|
+
" ",
|
|
2571
|
+
p,
|
|
2572
|
+
" row(s) corrected"
|
|
2573
|
+
]
|
|
2574
|
+
}),
|
|
2575
|
+
/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
2576
|
+
className: "text-muted-foreground",
|
|
2577
|
+
children: "— click a highlighted cell to fix it inline."
|
|
2578
|
+
})
|
|
2325
2579
|
]
|
|
2326
2580
|
}),
|
|
2327
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
/* @__PURE__ */ (0, Z.jsxs)(ue, { children: [/* @__PURE__ */ (0, Z.jsx)(fe, { children: /* @__PURE__ */ (0, Z.jsxs)(V, { children: [/* @__PURE__ */ (0, Z.jsx)(B, {
|
|
2328
2582
|
className: "w-12",
|
|
2329
2583
|
children: "#"
|
|
2330
|
-
}),
|
|
2331
|
-
let n =
|
|
2332
|
-
return /* @__PURE__ */ (0,
|
|
2333
|
-
className:
|
|
2334
|
-
|
|
2584
|
+
}), c.map((e) => /* @__PURE__ */ (0, Z.jsx)(B, { children: e.field.label }, e.csvIdx))] }) }), /* @__PURE__ */ (0, Z.jsx)(de, { children: l.map((e, t) => {
|
|
2585
|
+
let n = d[t], r = Object.keys(n).length > 0, i = o[t] !== void 0;
|
|
2586
|
+
return /* @__PURE__ */ (0, Z.jsxs)(V, {
|
|
2587
|
+
className: H(r && "bg-destructive/5", !r && i && "bg-emerald-50 dark:bg-emerald-950/20"),
|
|
2588
|
+
"data-testid": `import-preview-row-${t}`,
|
|
2589
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(z, {
|
|
2335
2590
|
className: "text-xs text-muted-foreground",
|
|
2336
2591
|
children: t + 1
|
|
2337
|
-
}),
|
|
2338
|
-
let r = e
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
2340
|
-
className:
|
|
2592
|
+
}), c.map((e) => {
|
|
2593
|
+
let r = u(t, e.csvIdx), i = n[e.csvIdx], a = o[t]?.[e.csvIdx] !== void 0;
|
|
2594
|
+
return /* @__PURE__ */ (0, Z.jsx)(z, {
|
|
2595
|
+
className: H(i && "text-destructive", a && !i && "text-emerald-600"),
|
|
2341
2596
|
title: i,
|
|
2342
|
-
children:
|
|
2343
|
-
|
|
2344
|
-
|
|
2597
|
+
children: /* @__PURE__ */ (0, Z.jsx)(M, {
|
|
2598
|
+
value: r,
|
|
2599
|
+
onChange: (n) => s(t, e.csvIdx, n.target.value),
|
|
2600
|
+
className: H("h-7 px-1 text-xs", i && "border-destructive", a && !i && "border-emerald-500"),
|
|
2601
|
+
"data-testid": `import-preview-cell-${t}-${e.csvIdx}`,
|
|
2602
|
+
"aria-invalid": i ? "true" : "false",
|
|
2603
|
+
"aria-label": `${e.field.label} for row ${t + 1}`
|
|
2345
2604
|
})
|
|
2346
|
-
},
|
|
2605
|
+
}, e.csvIdx);
|
|
2347
2606
|
})]
|
|
2348
2607
|
}, t);
|
|
2349
2608
|
}) })] }),
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2609
|
+
/* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2351
2610
|
className: "mt-2 text-xs text-muted-foreground",
|
|
2352
2611
|
children: [
|
|
2353
2612
|
"Showing ",
|
|
2354
|
-
|
|
2613
|
+
l.length,
|
|
2355
2614
|
" of ",
|
|
2356
2615
|
t.length,
|
|
2357
2616
|
" rows"
|
|
@@ -2359,87 +2618,127 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2359
2618
|
})
|
|
2360
2619
|
]
|
|
2361
2620
|
});
|
|
2362
|
-
},
|
|
2363
|
-
let [
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
}, [
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2621
|
+
}, Ht = ({ objectName: e, objectLabel: n, fields: o, dataSource: c, onComplete: l, onCancel: u, open: d, onOpenChange: f, onErrorMode: p = "skip", templateStorageKey: m, templateStorage: h }) => {
|
|
2622
|
+
let [g, _] = s("upload"), [v, y] = s([]), [b, x] = s([]), [S, C] = s({}), [D, O] = s(!1), [k, A] = s(0), [j, ae] = s(null), [M, oe] = s({}), se = n ?? e, N = a(() => h === void 0 ? Mt() : h, [h]), P = m ?? `objectui:import-templates:${e}`, [F, I] = s(() => Nt(N, P)), [L, R] = s(null);
|
|
2623
|
+
i(() => {
|
|
2624
|
+
I(Nt(N, P));
|
|
2625
|
+
}, [N, P]);
|
|
2626
|
+
let le = r((e) => {
|
|
2627
|
+
let t = F.find((t) => t.id === e);
|
|
2628
|
+
t && (R(e), C(It(t, v, o)));
|
|
2629
|
+
}, [
|
|
2630
|
+
F,
|
|
2631
|
+
v,
|
|
2632
|
+
o
|
|
2633
|
+
]), ue = r((e) => {
|
|
2634
|
+
let t = {
|
|
2635
|
+
id: `tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`,
|
|
2636
|
+
name: e,
|
|
2637
|
+
mapping: Ft(v, S),
|
|
2638
|
+
updatedAt: Date.now()
|
|
2639
|
+
}, n = [...F, t];
|
|
2640
|
+
I(n), R(t.id), Pt(N, P, n);
|
|
2641
|
+
}, [
|
|
2642
|
+
F,
|
|
2643
|
+
v,
|
|
2644
|
+
S,
|
|
2645
|
+
N,
|
|
2646
|
+
P
|
|
2647
|
+
]), de = r(() => {
|
|
2648
|
+
if (!L) return;
|
|
2649
|
+
let e = F.filter((e) => e.id !== L);
|
|
2650
|
+
I(e), R(null), Pt(N, P, e);
|
|
2651
|
+
}, [
|
|
2652
|
+
F,
|
|
2653
|
+
L,
|
|
2654
|
+
N,
|
|
2655
|
+
P
|
|
2656
|
+
]), z = r((e, t, n) => {
|
|
2657
|
+
oe((r) => {
|
|
2658
|
+
let i = { ...r }, a = { ...i[e] ?? {} };
|
|
2659
|
+
return n === (b[e]?.[t] ?? "") ? delete a[t] : a[t] = n, Object.keys(a).length === 0 ? delete i[e] : i[e] = a, i;
|
|
2660
|
+
});
|
|
2661
|
+
}, [b]), B = a(() => {
|
|
2662
|
+
let e = new Set(Object.values(S));
|
|
2663
|
+
return o.filter((t) => t.required && !e.has(t.name));
|
|
2664
|
+
}, [o, S]), fe = r((e, t) => {
|
|
2665
|
+
y(e), x(t), C(jt(e, o)), oe({}), _("mapping");
|
|
2666
|
+
}, [o]), V = r(async () => {
|
|
2667
|
+
O(!0), A(0);
|
|
2668
|
+
let t = [], n = 0, r = 0, i = Object.entries(S).map(([e, t]) => ({
|
|
2371
2669
|
csvIdx: Number(e),
|
|
2372
|
-
field:
|
|
2670
|
+
field: o.find((e) => e.name === t)
|
|
2373
2671
|
}));
|
|
2374
|
-
for (let
|
|
2375
|
-
let { record:
|
|
2376
|
-
if (
|
|
2377
|
-
if (r++, t.push(...
|
|
2672
|
+
for (let a = 0; a < b.length; a++) {
|
|
2673
|
+
let o = b[a], s = M[a], { record: l, errors: u } = Lt(s ? o.map((e, t) => s[t] === void 0 ? e : s[t]) : o, i, a + 1);
|
|
2674
|
+
if (u.length > 0) {
|
|
2675
|
+
if (r++, t.push(...u), p === "stop") break;
|
|
2378
2676
|
} else try {
|
|
2379
|
-
|
|
2677
|
+
c?.create && await c.create(e, l), n++;
|
|
2380
2678
|
} catch (e) {
|
|
2381
2679
|
r++;
|
|
2382
2680
|
let n = e instanceof Error ? e.message : "Failed to create record";
|
|
2383
2681
|
if (t.push({
|
|
2384
|
-
row:
|
|
2682
|
+
row: a + 1,
|
|
2385
2683
|
field: "",
|
|
2386
2684
|
message: n
|
|
2387
|
-
}),
|
|
2685
|
+
}), p === "stop") break;
|
|
2388
2686
|
}
|
|
2389
|
-
|
|
2687
|
+
A(Math.round((a + 1) / b.length * 100));
|
|
2390
2688
|
}
|
|
2391
|
-
let
|
|
2392
|
-
totalRows:
|
|
2689
|
+
let a = {
|
|
2690
|
+
totalRows: b.length,
|
|
2393
2691
|
importedRows: n,
|
|
2394
2692
|
skippedRows: r,
|
|
2395
2693
|
errors: t
|
|
2396
2694
|
};
|
|
2397
|
-
|
|
2695
|
+
ae(a), O(!1), l?.(a);
|
|
2398
2696
|
}, [
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
i,
|
|
2697
|
+
b,
|
|
2698
|
+
S,
|
|
2402
2699
|
o,
|
|
2403
|
-
e,
|
|
2404
2700
|
c,
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2701
|
+
e,
|
|
2702
|
+
l,
|
|
2703
|
+
p,
|
|
2704
|
+
M
|
|
2705
|
+
]), pe = r(() => {
|
|
2706
|
+
_("upload"), y([]), x([]), C({}), A(0), ae(null), oe({}), R(null);
|
|
2707
|
+
}, []), U = r(() => {
|
|
2708
|
+
pe(), f?.(!1), u?.();
|
|
2410
2709
|
}, [
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2710
|
+
pe,
|
|
2711
|
+
f,
|
|
2712
|
+
u
|
|
2414
2713
|
]);
|
|
2415
|
-
return /* @__PURE__ */ (0,
|
|
2416
|
-
open:
|
|
2714
|
+
return /* @__PURE__ */ (0, Z.jsx)(ee, {
|
|
2715
|
+
open: d,
|
|
2417
2716
|
onOpenChange: (e) => {
|
|
2418
|
-
e ?
|
|
2717
|
+
e ? f?.(e) : U();
|
|
2419
2718
|
},
|
|
2420
|
-
children: /* @__PURE__ */ (0,
|
|
2719
|
+
children: /* @__PURE__ */ (0, Z.jsxs)(te, {
|
|
2421
2720
|
className: "sm:max-w-2xl",
|
|
2422
2721
|
children: [
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2722
|
+
/* @__PURE__ */ (0, Z.jsxs)(E, { children: [/* @__PURE__ */ (0, Z.jsxs)(ie, {
|
|
2424
2723
|
className: "flex items-center gap-2",
|
|
2425
2724
|
children: [
|
|
2426
|
-
/* @__PURE__ */ (0,
|
|
2725
|
+
/* @__PURE__ */ (0, Z.jsx)(Te, { className: "h-5 w-5" }),
|
|
2427
2726
|
" Import ",
|
|
2428
|
-
|
|
2727
|
+
se
|
|
2429
2728
|
]
|
|
2430
|
-
}), /* @__PURE__ */ (0,
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2729
|
+
}), /* @__PURE__ */ (0, Z.jsxs)(ne, { children: [
|
|
2730
|
+
g === "upload" && "Upload a CSV file to get started.",
|
|
2731
|
+
g === "mapping" && "Map CSV columns to object fields.",
|
|
2732
|
+
g === "preview" && "Review data before importing."
|
|
2434
2733
|
] })] }),
|
|
2435
|
-
/* @__PURE__ */ (0,
|
|
2734
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2436
2735
|
className: "flex items-center justify-center gap-2 text-xs text-muted-foreground",
|
|
2437
2736
|
children: [
|
|
2438
2737
|
"upload",
|
|
2439
2738
|
"mapping",
|
|
2440
2739
|
"preview"
|
|
2441
|
-
].map((e, n) => /* @__PURE__ */ (0,
|
|
2442
|
-
className:
|
|
2740
|
+
].map((e, n) => /* @__PURE__ */ (0, Z.jsxs)(t.Fragment, { children: [n > 0 && /* @__PURE__ */ (0, Z.jsx)(ge, { className: "h-3 w-3" }), /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
2741
|
+
className: H("rounded-full px-3 py-1", g === e ? "bg-primary text-primary-foreground" : "bg-muted"),
|
|
2443
2742
|
children: [
|
|
2444
2743
|
n + 1,
|
|
2445
2744
|
". ",
|
|
@@ -2447,27 +2746,27 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2447
2746
|
]
|
|
2448
2747
|
})] }, e))
|
|
2449
2748
|
}),
|
|
2450
|
-
|
|
2749
|
+
j ? /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2451
2750
|
className: "flex flex-col items-center gap-3 py-4",
|
|
2452
2751
|
children: [
|
|
2453
|
-
/* @__PURE__ */ (0,
|
|
2454
|
-
/* @__PURE__ */ (0,
|
|
2752
|
+
/* @__PURE__ */ (0, Z.jsx)(ye, { className: "h-10 w-10 text-green-500" }),
|
|
2753
|
+
/* @__PURE__ */ (0, Z.jsx)("p", {
|
|
2455
2754
|
className: "text-lg font-semibold",
|
|
2456
2755
|
children: "Import Complete"
|
|
2457
2756
|
}),
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2757
|
+
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2459
2758
|
className: "flex gap-3",
|
|
2460
|
-
children: [/* @__PURE__ */ (0,
|
|
2759
|
+
children: [/* @__PURE__ */ (0, Z.jsxs)(w, {
|
|
2461
2760
|
variant: "default",
|
|
2462
|
-
children: [
|
|
2463
|
-
}),
|
|
2761
|
+
children: [j.importedRows, " imported"]
|
|
2762
|
+
}), j.skippedRows > 0 && /* @__PURE__ */ (0, Z.jsxs)(w, {
|
|
2464
2763
|
variant: "destructive",
|
|
2465
|
-
children: [
|
|
2764
|
+
children: [j.skippedRows, " skipped"]
|
|
2466
2765
|
})]
|
|
2467
2766
|
}),
|
|
2468
|
-
|
|
2767
|
+
j.errors.length > 0 && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2469
2768
|
className: "max-h-32 w-full overflow-auto rounded border p-2 text-xs",
|
|
2470
|
-
children: [
|
|
2769
|
+
children: [j.errors.slice(0, 10).map((e, t) => /* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2471
2770
|
className: "text-destructive",
|
|
2472
2771
|
children: [
|
|
2473
2772
|
"Row ",
|
|
@@ -2476,72 +2775,79 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2476
2775
|
": ",
|
|
2477
2776
|
e.message
|
|
2478
2777
|
]
|
|
2479
|
-
}, t)),
|
|
2778
|
+
}, t)), j.errors.length > 10 && /* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2480
2779
|
className: "text-muted-foreground",
|
|
2481
2780
|
children: [
|
|
2482
2781
|
"…and ",
|
|
2483
|
-
|
|
2782
|
+
j.errors.length - 10,
|
|
2484
2783
|
" more errors"
|
|
2485
2784
|
]
|
|
2486
2785
|
})]
|
|
2487
2786
|
})
|
|
2488
2787
|
]
|
|
2489
|
-
}) : /* @__PURE__ */ (0,
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
headers:
|
|
2493
|
-
fields:
|
|
2494
|
-
mapping:
|
|
2495
|
-
onMappingChange:
|
|
2788
|
+
}) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
|
|
2789
|
+
g === "upload" && /* @__PURE__ */ (0, Z.jsx)(Rt, { onFileLoaded: fe }),
|
|
2790
|
+
g === "mapping" && /* @__PURE__ */ (0, Z.jsx)(Bt, {
|
|
2791
|
+
headers: v,
|
|
2792
|
+
fields: o,
|
|
2793
|
+
mapping: S,
|
|
2794
|
+
onMappingChange: C,
|
|
2795
|
+
templates: F,
|
|
2796
|
+
selectedTemplateId: L,
|
|
2797
|
+
onSelectTemplate: le,
|
|
2798
|
+
onSaveTemplate: ue,
|
|
2799
|
+
onDeleteTemplate: de
|
|
2496
2800
|
}),
|
|
2497
|
-
|
|
2498
|
-
headers:
|
|
2499
|
-
rows:
|
|
2500
|
-
mapping:
|
|
2501
|
-
fields:
|
|
2801
|
+
g === "preview" && /* @__PURE__ */ (0, Z.jsx)(Vt, {
|
|
2802
|
+
headers: v,
|
|
2803
|
+
rows: b,
|
|
2804
|
+
mapping: S,
|
|
2805
|
+
fields: o,
|
|
2806
|
+
corrections: M,
|
|
2807
|
+
onCorrect: z
|
|
2502
2808
|
}),
|
|
2503
|
-
|
|
2809
|
+
D && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2504
2810
|
className: "flex flex-col gap-1",
|
|
2505
|
-
children: [/* @__PURE__ */ (0,
|
|
2506
|
-
value:
|
|
2811
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(ce, {
|
|
2812
|
+
value: k,
|
|
2507
2813
|
className: "h-2"
|
|
2508
|
-
}), /* @__PURE__ */ (0,
|
|
2814
|
+
}), /* @__PURE__ */ (0, Z.jsxs)("p", {
|
|
2509
2815
|
className: "text-center text-xs text-muted-foreground",
|
|
2510
2816
|
children: [
|
|
2511
2817
|
"Importing… ",
|
|
2512
|
-
|
|
2818
|
+
k,
|
|
2513
2819
|
"%"
|
|
2514
2820
|
]
|
|
2515
2821
|
})]
|
|
2516
2822
|
})
|
|
2517
2823
|
] }),
|
|
2518
|
-
/* @__PURE__ */ (0,
|
|
2824
|
+
/* @__PURE__ */ (0, Z.jsx)(re, {
|
|
2519
2825
|
className: "gap-2 sm:gap-0",
|
|
2520
|
-
children:
|
|
2521
|
-
onClick:
|
|
2826
|
+
children: j ? /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2827
|
+
onClick: U,
|
|
2522
2828
|
children: "Close"
|
|
2523
|
-
}) : /* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
}) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
|
|
2830
|
+
/* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
2525
2831
|
variant: "ghost",
|
|
2526
|
-
onClick:
|
|
2527
|
-
disabled:
|
|
2528
|
-
children: [/* @__PURE__ */ (0,
|
|
2832
|
+
onClick: U,
|
|
2833
|
+
disabled: D,
|
|
2834
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(K, { className: "mr-1 h-4 w-4" }), " Cancel"]
|
|
2529
2835
|
}),
|
|
2530
|
-
(
|
|
2836
|
+
(g === "mapping" || g === "preview") && /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
2531
2837
|
variant: "outline",
|
|
2532
|
-
onClick: () =>
|
|
2533
|
-
disabled:
|
|
2534
|
-
children: [/* @__PURE__ */ (0,
|
|
2838
|
+
onClick: () => _(g === "mapping" ? "upload" : "mapping"),
|
|
2839
|
+
disabled: D,
|
|
2840
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(he, { className: "mr-1 h-4 w-4" }), " Back"]
|
|
2535
2841
|
}),
|
|
2536
|
-
|
|
2537
|
-
onClick: () =>
|
|
2538
|
-
disabled: Object.keys(
|
|
2539
|
-
children: ["Next ", /* @__PURE__ */ (0,
|
|
2842
|
+
g === "mapping" && /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
2843
|
+
onClick: () => _("preview"),
|
|
2844
|
+
disabled: Object.keys(S).length === 0 || B.length > 0,
|
|
2845
|
+
children: ["Next ", /* @__PURE__ */ (0, Z.jsx)(ge, { className: "ml-1 h-4 w-4" })]
|
|
2540
2846
|
}),
|
|
2541
|
-
|
|
2542
|
-
onClick:
|
|
2543
|
-
disabled:
|
|
2544
|
-
children:
|
|
2847
|
+
g === "preview" && /* @__PURE__ */ (0, Z.jsx)(T, {
|
|
2848
|
+
onClick: V,
|
|
2849
|
+
disabled: D,
|
|
2850
|
+
children: D ? "Importing…" : `Import ${b.length} Rows`
|
|
2545
2851
|
})
|
|
2546
2852
|
] })
|
|
2547
2853
|
})
|
|
@@ -2551,7 +2857,7 @@ var Ot = ({ onFileLoaded: e }) => {
|
|
|
2551
2857
|
};
|
|
2552
2858
|
//#endregion
|
|
2553
2859
|
//#region src/InlineEditing.tsx
|
|
2554
|
-
function
|
|
2860
|
+
function Ut({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", placeholder: l, editing: u = !1, className: d, disabled: f = !1 }) {
|
|
2555
2861
|
let [p, m] = s(u), [h, g] = s(String(e ?? "")), [_, v] = s(), [y, b] = s(!1), x = o(null);
|
|
2556
2862
|
i(() => {
|
|
2557
2863
|
p || g(String(e ?? ""));
|
|
@@ -2592,13 +2898,13 @@ function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2592
2898
|
]), T = r((e) => {
|
|
2593
2899
|
e.key === "Enter" ? (e.preventDefault(), w()) : e.key === "Escape" && (e.preventDefault(), C());
|
|
2594
2900
|
}, [w, C]);
|
|
2595
|
-
return p ? /* @__PURE__ */ (0,
|
|
2901
|
+
return p ? /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2596
2902
|
"data-slot": "inline-editing",
|
|
2597
|
-
className:
|
|
2903
|
+
className: H("relative flex items-center gap-1", d),
|
|
2598
2904
|
children: [
|
|
2599
|
-
/* @__PURE__ */ (0,
|
|
2905
|
+
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2600
2906
|
className: "flex-1 relative",
|
|
2601
|
-
children: [/* @__PURE__ */ (0,
|
|
2907
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("input", {
|
|
2602
2908
|
ref: x,
|
|
2603
2909
|
"data-slot": "inline-editing-input",
|
|
2604
2910
|
type: c,
|
|
@@ -2611,8 +2917,8 @@ function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2611
2917
|
disabled: y,
|
|
2612
2918
|
"aria-invalid": !!_,
|
|
2613
2919
|
"aria-describedby": _ ? "inline-editing-error" : void 0,
|
|
2614
|
-
className:
|
|
2615
|
-
}), _ && /* @__PURE__ */ (0,
|
|
2920
|
+
className: H("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")
|
|
2921
|
+
}), _ && /* @__PURE__ */ (0, Z.jsx)("p", {
|
|
2616
2922
|
id: "inline-editing-error",
|
|
2617
2923
|
"data-slot": "inline-editing-error",
|
|
2618
2924
|
className: "absolute left-0 top-full mt-0.5 text-xs text-destructive",
|
|
@@ -2620,28 +2926,28 @@ function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2620
2926
|
children: _
|
|
2621
2927
|
})]
|
|
2622
2928
|
}),
|
|
2623
|
-
/* @__PURE__ */ (0,
|
|
2929
|
+
/* @__PURE__ */ (0, Z.jsx)("button", {
|
|
2624
2930
|
"data-slot": "inline-editing-save",
|
|
2625
2931
|
type: "button",
|
|
2626
2932
|
onClick: w,
|
|
2627
2933
|
disabled: y,
|
|
2628
2934
|
"aria-label": "Save",
|
|
2629
|
-
className:
|
|
2630
|
-
children: /* @__PURE__ */ (0,
|
|
2935
|
+
className: H("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"),
|
|
2936
|
+
children: /* @__PURE__ */ (0, Z.jsx)(ve, { className: "h-3.5 w-3.5" })
|
|
2631
2937
|
}),
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2938
|
+
/* @__PURE__ */ (0, Z.jsx)("button", {
|
|
2633
2939
|
"data-slot": "inline-editing-cancel",
|
|
2634
2940
|
type: "button",
|
|
2635
2941
|
onClick: C,
|
|
2636
2942
|
disabled: y,
|
|
2637
2943
|
"aria-label": "Cancel",
|
|
2638
2944
|
className: "inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",
|
|
2639
|
-
children: /* @__PURE__ */ (0,
|
|
2945
|
+
children: /* @__PURE__ */ (0, Z.jsx)(K, { className: "h-3.5 w-3.5" })
|
|
2640
2946
|
})
|
|
2641
2947
|
]
|
|
2642
|
-
}) : /* @__PURE__ */ (0,
|
|
2948
|
+
}) : /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2643
2949
|
"data-slot": "inline-editing",
|
|
2644
|
-
className:
|
|
2950
|
+
className: H("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),
|
|
2645
2951
|
onClick: S,
|
|
2646
2952
|
role: "button",
|
|
2647
2953
|
tabIndex: f ? -1 : 0,
|
|
@@ -2649,10 +2955,10 @@ function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2649
2955
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), S());
|
|
2650
2956
|
},
|
|
2651
2957
|
"aria-label": `Edit value: ${String(e ?? "")}`,
|
|
2652
|
-
children: /* @__PURE__ */ (0,
|
|
2958
|
+
children: /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
2653
2959
|
"data-slot": "inline-editing-display",
|
|
2654
2960
|
className: "truncate text-sm",
|
|
2655
|
-
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0,
|
|
2961
|
+
children: e != null && String(e) !== "" ? String(e) : /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
2656
2962
|
className: "text-muted-foreground italic",
|
|
2657
2963
|
children: l || "Click to edit"
|
|
2658
2964
|
})
|
|
@@ -2661,7 +2967,7 @@ function Mt({ value: e, onSave: t, onCancel: n, validate: a, type: c = "text", p
|
|
|
2661
2967
|
}
|
|
2662
2968
|
//#endregion
|
|
2663
2969
|
//#region src/useCellClipboard.ts
|
|
2664
|
-
function
|
|
2970
|
+
function Wt(e) {
|
|
2665
2971
|
return {
|
|
2666
2972
|
startRow: Math.min(e.startRow, e.endRow),
|
|
2667
2973
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -2669,10 +2975,10 @@ function Nt(e) {
|
|
|
2669
2975
|
endCol: Math.max(e.startCol, e.endCol)
|
|
2670
2976
|
};
|
|
2671
2977
|
}
|
|
2672
|
-
function
|
|
2978
|
+
function Gt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
2673
2979
|
let [o, c] = s(null), l = r(() => {
|
|
2674
2980
|
if (!a || !o) return;
|
|
2675
|
-
let { startRow: n, startCol: r, endRow: i, endCol: s } =
|
|
2981
|
+
let { startRow: n, startCol: r, endRow: i, endCol: s } = Wt(o), c = [];
|
|
2676
2982
|
for (let a = n; a <= i; a++) {
|
|
2677
2983
|
let n = e[a];
|
|
2678
2984
|
if (!n) continue;
|
|
@@ -2692,7 +2998,7 @@ function Pt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2692
2998
|
t
|
|
2693
2999
|
]), u = r(() => {
|
|
2694
3000
|
if (!a || !o || !n) return;
|
|
2695
|
-
let { startRow: r, startCol: i } =
|
|
3001
|
+
let { startRow: r, startCol: i } = Wt(o);
|
|
2696
3002
|
navigator.clipboard.readText().then((a) => {
|
|
2697
3003
|
let o = [], s = a.split("\n");
|
|
2698
3004
|
for (let n = 0; n < s.length; n++) {
|
|
@@ -2735,7 +3041,7 @@ function Pt({ data: e, columns: t, onPaste: n, enabled: a = !0 }) {
|
|
|
2735
3041
|
}
|
|
2736
3042
|
//#endregion
|
|
2737
3043
|
//#region src/useGradientColor.ts
|
|
2738
|
-
var
|
|
3044
|
+
var Kt = [
|
|
2739
3045
|
{
|
|
2740
3046
|
position: 0,
|
|
2741
3047
|
className: "bg-green-100"
|
|
@@ -2749,7 +3055,7 @@ var Ft = [
|
|
|
2749
3055
|
className: "bg-red-100"
|
|
2750
3056
|
}
|
|
2751
3057
|
];
|
|
2752
|
-
function
|
|
3058
|
+
function qt(e, t) {
|
|
2753
3059
|
let n = Infinity, r = -Infinity;
|
|
2754
3060
|
for (let i of e) {
|
|
2755
3061
|
let e = Number(i[t]);
|
|
@@ -2757,7 +3063,7 @@ function It(e, t) {
|
|
|
2757
3063
|
}
|
|
2758
3064
|
return Number.isFinite(n) ? [n, r] : [0, 0];
|
|
2759
3065
|
}
|
|
2760
|
-
function
|
|
3066
|
+
function Jt(e, t) {
|
|
2761
3067
|
if (t.length === 0) return "";
|
|
2762
3068
|
if (t.length === 1) return t[0].className;
|
|
2763
3069
|
let n = t[0], r = Math.abs(e - n.position);
|
|
@@ -2767,11 +3073,11 @@ function Lt(e, t) {
|
|
|
2767
3073
|
}
|
|
2768
3074
|
return n.className;
|
|
2769
3075
|
}
|
|
2770
|
-
function
|
|
2771
|
-
let { field: t, data: n, min: i, max: o, stops: s =
|
|
3076
|
+
function Yt(e) {
|
|
3077
|
+
let { field: t, data: n, min: i, max: o, stops: s = Kt } = e, [c, l] = a(() => qt(n, t), [n, t]), u = i ?? c, d = o ?? l;
|
|
2772
3078
|
return r((e) => {
|
|
2773
3079
|
let n = Number(e[t]);
|
|
2774
|
-
if (Number.isFinite(n)) return d === u ? s.length > 0 ? s[0].className : void 0 :
|
|
3080
|
+
if (Number.isFinite(n)) return d === u ? s.length > 0 ? s[0].className : void 0 : Jt(Math.max(0, Math.min(1, (n - u) / (d - u))), s);
|
|
2775
3081
|
}, [
|
|
2776
3082
|
t,
|
|
2777
3083
|
u,
|
|
@@ -2781,8 +3087,8 @@ function Rt(e) {
|
|
|
2781
3087
|
}
|
|
2782
3088
|
//#endregion
|
|
2783
3089
|
//#region src/useGroupReorder.ts
|
|
2784
|
-
var
|
|
2785
|
-
function
|
|
3090
|
+
var Xt = "text/x-group-key";
|
|
3091
|
+
function Zt({ groupKeys: e }) {
|
|
2786
3092
|
let [t, n] = s(e), [a, o] = s(null);
|
|
2787
3093
|
return i(() => {
|
|
2788
3094
|
n((t) => {
|
|
@@ -2801,14 +3107,14 @@ function Bt({ groupKeys: e }) {
|
|
|
2801
3107
|
});
|
|
2802
3108
|
}, []),
|
|
2803
3109
|
onDragStart: r((e, t) => {
|
|
2804
|
-
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(
|
|
3110
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData(Xt, t), o(t);
|
|
2805
3111
|
}, []),
|
|
2806
3112
|
onDragOver: r((e) => {
|
|
2807
3113
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2808
3114
|
}, []),
|
|
2809
3115
|
onDrop: r((e, t) => {
|
|
2810
3116
|
e.preventDefault();
|
|
2811
|
-
let r = e.dataTransfer.getData(
|
|
3117
|
+
let r = e.dataTransfer.getData(Xt);
|
|
2812
3118
|
!r || r === t || n((e) => {
|
|
2813
3119
|
let n = e.indexOf(r), i = e.indexOf(t);
|
|
2814
3120
|
if (n === -1 || i === -1) return e;
|
|
@@ -2824,7 +3130,7 @@ function Bt({ groupKeys: e }) {
|
|
|
2824
3130
|
}
|
|
2825
3131
|
//#endregion
|
|
2826
3132
|
//#region src/FormulaBar.tsx
|
|
2827
|
-
function
|
|
3133
|
+
function Qt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, disabled: l = !1, className: u }) {
|
|
2828
3134
|
let [d, f] = s(!1), [p, m] = s(e), h = o(null);
|
|
2829
3135
|
i(() => {
|
|
2830
3136
|
d || m(e);
|
|
@@ -2844,15 +3150,15 @@ function Vt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2844
3150
|
}, [e, a]), y = r((e) => {
|
|
2845
3151
|
e.key === "Enter" ? (e.preventDefault(), _()) : e.key === "Escape" && (e.preventDefault(), v());
|
|
2846
3152
|
}, [_, v]);
|
|
2847
|
-
return /* @__PURE__ */ (0,
|
|
2848
|
-
className:
|
|
3153
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
3154
|
+
className: H("flex items-center gap-2 border-b border-border bg-muted/30 px-3 py-1.5", u),
|
|
2849
3155
|
children: [
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
2851
|
-
c && /* @__PURE__ */ (0,
|
|
3156
|
+
/* @__PURE__ */ (0, Z.jsx)(Ee, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3157
|
+
c && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
2852
3158
|
className: "min-w-[4rem] shrink-0 rounded bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
2853
3159
|
children: c
|
|
2854
3160
|
}),
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
3161
|
+
/* @__PURE__ */ (0, Z.jsx)("input", {
|
|
2856
3162
|
ref: h,
|
|
2857
3163
|
type: "text",
|
|
2858
3164
|
value: d ? p : e,
|
|
@@ -2861,22 +3167,22 @@ function Vt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2861
3167
|
onClick: g,
|
|
2862
3168
|
onChange: (e) => m(e.target.value),
|
|
2863
3169
|
onKeyDown: y,
|
|
2864
|
-
className:
|
|
3170
|
+
className: H("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")
|
|
2865
3171
|
}),
|
|
2866
|
-
d && /* @__PURE__ */ (0,
|
|
3172
|
+
d && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2867
3173
|
className: "flex items-center gap-1",
|
|
2868
|
-
children: [/* @__PURE__ */ (0,
|
|
3174
|
+
children: [/* @__PURE__ */ (0, Z.jsx)("button", {
|
|
2869
3175
|
type: "button",
|
|
2870
3176
|
onClick: _,
|
|
2871
3177
|
className: "rounded p-0.5 text-green-600 hover:bg-green-100",
|
|
2872
3178
|
"aria-label": "Confirm",
|
|
2873
|
-
children: /* @__PURE__ */ (0,
|
|
2874
|
-
}), /* @__PURE__ */ (0,
|
|
3179
|
+
children: /* @__PURE__ */ (0, Z.jsx)(ve, { className: "h-4 w-4" })
|
|
3180
|
+
}), /* @__PURE__ */ (0, Z.jsx)("button", {
|
|
2875
3181
|
type: "button",
|
|
2876
3182
|
onClick: v,
|
|
2877
3183
|
className: "rounded p-0.5 text-red-600 hover:bg-red-100",
|
|
2878
3184
|
"aria-label": "Cancel",
|
|
2879
|
-
children: /* @__PURE__ */ (0,
|
|
3185
|
+
children: /* @__PURE__ */ (0, Z.jsx)(K, { className: "h-4 w-4" })
|
|
2880
3186
|
})]
|
|
2881
3187
|
})
|
|
2882
3188
|
]
|
|
@@ -2884,7 +3190,7 @@ function Vt({ value: e, onChange: t, onConfirm: n, onCancel: a, activeCell: c, d
|
|
|
2884
3190
|
}
|
|
2885
3191
|
//#endregion
|
|
2886
3192
|
//#region src/SplitPaneGrid.tsx
|
|
2887
|
-
function
|
|
3193
|
+
function $t({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollableWidth: i = 200, left: a, right: c, className: l }) {
|
|
2888
3194
|
let u = o(null), [d, f] = s(e), p = o(!1), m = o(0), h = o(0), g = t ? e : d, _ = r((e) => {
|
|
2889
3195
|
e.preventDefault(), p.current = !0, m.current = e.clientX, h.current = g;
|
|
2890
3196
|
let r = (e) => {
|
|
@@ -2901,23 +3207,23 @@ function Ht({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2901
3207
|
i,
|
|
2902
3208
|
t
|
|
2903
3209
|
]);
|
|
2904
|
-
return /* @__PURE__ */ (0,
|
|
3210
|
+
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
2905
3211
|
ref: u,
|
|
2906
|
-
className:
|
|
3212
|
+
className: H("flex h-full w-full overflow-hidden", l),
|
|
2907
3213
|
children: [
|
|
2908
|
-
/* @__PURE__ */ (0,
|
|
3214
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2909
3215
|
className: "shrink-0 overflow-auto",
|
|
2910
3216
|
style: { width: g },
|
|
2911
3217
|
children: a
|
|
2912
3218
|
}),
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
3219
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2914
3220
|
role: "separator",
|
|
2915
3221
|
"aria-orientation": "vertical",
|
|
2916
3222
|
onPointerDown: _,
|
|
2917
|
-
className:
|
|
2918
|
-
children: /* @__PURE__ */ (0,
|
|
3223
|
+
className: H("flex w-2 cursor-col-resize items-center justify-center", "border-x border-border bg-muted/50 hover:bg-muted", "transition-colors"),
|
|
3224
|
+
children: /* @__PURE__ */ (0, Z.jsx)(De, { className: "h-4 w-4 text-muted-foreground" })
|
|
2919
3225
|
}),
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
3226
|
+
/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
2921
3227
|
className: "min-w-0 flex-1 overflow-auto",
|
|
2922
3228
|
children: c
|
|
2923
3229
|
})
|
|
@@ -2926,15 +3232,15 @@ function Ht({ frozenWidth: e, onResize: t, minFrozenWidth: n = 100, minScrollabl
|
|
|
2926
3232
|
}
|
|
2927
3233
|
//#endregion
|
|
2928
3234
|
//#region src/index.tsx
|
|
2929
|
-
var
|
|
3235
|
+
var en = ({ schema: e, ...t }) => {
|
|
2930
3236
|
let { dataSource: n } = _() || {};
|
|
2931
|
-
return /* @__PURE__ */ (0,
|
|
3237
|
+
return /* @__PURE__ */ (0, Z.jsx)(ct, {
|
|
2932
3238
|
schema: e,
|
|
2933
3239
|
dataSource: n,
|
|
2934
3240
|
...t
|
|
2935
3241
|
});
|
|
2936
3242
|
};
|
|
2937
|
-
c.register("object-grid",
|
|
3243
|
+
c.register("object-grid", en, {
|
|
2938
3244
|
namespace: "plugin-grid",
|
|
2939
3245
|
label: "Object Grid",
|
|
2940
3246
|
category: "plugin",
|
|
@@ -2956,7 +3262,7 @@ c.register("object-grid", Ut, {
|
|
|
2956
3262
|
label: "Filters"
|
|
2957
3263
|
}
|
|
2958
3264
|
]
|
|
2959
|
-
}), c.register("grid",
|
|
3265
|
+
}), c.register("grid", en, {
|
|
2960
3266
|
namespace: "view",
|
|
2961
3267
|
label: "Data Grid",
|
|
2962
3268
|
category: "view",
|
|
@@ -2980,7 +3286,7 @@ c.register("object-grid", Ut, {
|
|
|
2980
3286
|
]
|
|
2981
3287
|
}), c.register("import-wizard", ({ schema: e, ...t }) => {
|
|
2982
3288
|
let { dataSource: n } = _() || {};
|
|
2983
|
-
return /* @__PURE__ */ (0,
|
|
3289
|
+
return /* @__PURE__ */ (0, Z.jsx)(Ht, {
|
|
2984
3290
|
objectName: e.objectName,
|
|
2985
3291
|
objectLabel: e.objectLabel,
|
|
2986
3292
|
fields: e.fields ?? [],
|
|
@@ -3004,4 +3310,4 @@ c.register("object-grid", Ut, {
|
|
|
3004
3310
|
}]
|
|
3005
3311
|
});
|
|
3006
3312
|
//#endregion
|
|
3007
|
-
export {
|
|
3313
|
+
export { nt as BulkActionBar, Qt as FormulaBar, Ye as GroupRow, Ht as ImportWizard, Ut as InlineEditing, ct as ObjectGrid, en as ObjectGridRenderer, tt as RowActionMenu, $t as SplitPaneGrid, Dt as VirtualGrid, et as formatActionLabel, Gt as useCellClipboard, $e as useColumnSummary, Yt as useGradientColor, Zt as useGroupReorder, Je as useGroupedData, He as useRowColor };
|