@object-ui/fields 5.0.2 → 5.2.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 +127 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +318 -298
- package/dist/packages/fields/src/index.d.ts +8 -1
- package/package.json +7 -7
- package/src/index.tsx +48 -19
- package/src/widgets/RichTextField.tsx +10 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e, { Suspense as t, lazy as n, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
2
2
|
import { ComponentRegistry as u } from "@object-ui/core";
|
|
3
|
-
import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as te, PopoverContent as ne, PopoverTrigger as T, Select as E, SelectContent as re, SelectItem as ie, SelectTrigger as ae, SelectValue as oe, Skeleton as D, Slider as O, Switch as
|
|
4
|
-
import { AlertCircle as
|
|
5
|
-
import { SchemaRendererContext as
|
|
3
|
+
import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as te, PopoverContent as ne, PopoverTrigger as T, Select as E, SelectContent as re, SelectItem as ie, SelectTrigger as ae, SelectValue as oe, Skeleton as D, Slider as O, Switch as se, Table as ce, TableBody as le, TableCell as k, TableHead as ue, TableHeader as A, TableRow as j, Textarea as M, cn as N } from "@object-ui/components";
|
|
4
|
+
import { AlertCircle as de, ArrowDown as P, ArrowUp as fe, ArrowUpDown as pe, Camera as me, Check as F, ChevronLeft as he, ChevronRight as ge, Copy as I, Crop as _e, Crosshair as L, Eraser as ve, ExternalLink as R, Eye as z, EyeOff as ye, File as be, Image as B, ImageIcon as xe, Loader2 as Se, MapPin as V, Maximize2 as H, Phone as Ce, Plus as we, QrCode as U, RotateCw as W, Search as Te, SlidersHorizontal as Ee, Star as De, TableProperties as Oe, Upload as G, X as ke } from "lucide-react";
|
|
5
|
+
import { SchemaRendererContext as Ae, useObjectTranslation as K } from "@object-ui/react";
|
|
6
6
|
import { Fragment as je, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
7
7
|
import { createSafeTranslation as Me } from "@object-ui/i18n";
|
|
8
8
|
import { useUpload as Ne } from "@object-ui/providers";
|
|
@@ -22,7 +22,7 @@ function Ie({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
22
22
|
children: e || /* @__PURE__ */ q(S, {})
|
|
23
23
|
});
|
|
24
24
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
25
|
-
return o && o > 1 ? /* @__PURE__ */ q(
|
|
25
|
+
return o && o > 1 ? /* @__PURE__ */ q(M, {
|
|
26
26
|
...c,
|
|
27
27
|
value: e || "",
|
|
28
28
|
onChange: (e) => t(e.target.value),
|
|
@@ -80,7 +80,7 @@ function Z({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
80
80
|
})]
|
|
81
81
|
}) : /* @__PURE__ */ J("div", {
|
|
82
82
|
className: "flex items-center space-x-2",
|
|
83
|
-
children: [/* @__PURE__ */ q(
|
|
83
|
+
children: [/* @__PURE__ */ q(se, {
|
|
84
84
|
...f,
|
|
85
85
|
id: l,
|
|
86
86
|
checked: !!e,
|
|
@@ -273,7 +273,7 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
273
273
|
return /* @__PURE__ */ J("div", {
|
|
274
274
|
className: "relative",
|
|
275
275
|
children: [
|
|
276
|
-
/* @__PURE__ */ q(
|
|
276
|
+
/* @__PURE__ */ q(M, {
|
|
277
277
|
...ne,
|
|
278
278
|
value: e || "",
|
|
279
279
|
onChange: (e) => t(e.target.value),
|
|
@@ -290,7 +290,7 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
290
290
|
className: "absolute top-1.5 right-1.5 inline-flex items-center justify-center size-7 rounded-md bg-background/80 text-muted-foreground hover:text-foreground hover:bg-background border shadow-sm transition-colors",
|
|
291
291
|
"aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
|
|
292
292
|
"data-testid": "textarea-fullscreen-toggle",
|
|
293
|
-
children: /* @__PURE__ */ q(
|
|
293
|
+
children: /* @__PURE__ */ q(H, { className: "size-3.5" })
|
|
294
294
|
}),
|
|
295
295
|
c && /* @__PURE__ */ J("div", {
|
|
296
296
|
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
@@ -318,7 +318,7 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
318
318
|
}),
|
|
319
319
|
/* @__PURE__ */ q("div", {
|
|
320
320
|
className: "flex-1 min-h-0 p-4",
|
|
321
|
-
children: /* @__PURE__ */ q(
|
|
321
|
+
children: /* @__PURE__ */ q(M, {
|
|
322
322
|
autoFocus: !0,
|
|
323
323
|
value: p,
|
|
324
324
|
onChange: (e) => m(e.target.value),
|
|
@@ -343,12 +343,12 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
343
343
|
type: "button",
|
|
344
344
|
variant: "ghost",
|
|
345
345
|
onClick: y,
|
|
346
|
-
children: [/* @__PURE__ */ q(
|
|
346
|
+
children: [/* @__PURE__ */ q(ke, { className: "size-4 mr-1" }), " Cancel"]
|
|
347
347
|
}), /* @__PURE__ */ J(h, {
|
|
348
348
|
type: "button",
|
|
349
349
|
onClick: C,
|
|
350
350
|
"data-testid": "textarea-fullscreen-save",
|
|
351
|
-
children: [/* @__PURE__ */ q(
|
|
351
|
+
children: [/* @__PURE__ */ q(F, { className: "size-4 mr-1" }), " Done"]
|
|
352
352
|
})]
|
|
353
353
|
})]
|
|
354
354
|
})
|
|
@@ -360,25 +360,29 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
360
360
|
}
|
|
361
361
|
var pt = Y((() => {})), mt = /* @__PURE__ */ X({ RichTextField: () => ht });
|
|
362
362
|
function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
363
|
+
let { t: o } = K();
|
|
363
364
|
if (r) return /* @__PURE__ */ q("div", {
|
|
364
365
|
className: "text-sm prose prose-sm max-w-none",
|
|
365
366
|
children: e || /* @__PURE__ */ q(S, {})
|
|
366
367
|
});
|
|
367
|
-
let
|
|
368
|
+
let s = n || a.schema, c = s?.rows || 8, l = s?.format || "markdown";
|
|
368
369
|
return /* @__PURE__ */ J("div", {
|
|
369
370
|
className: "space-y-2",
|
|
370
371
|
children: [/* @__PURE__ */ J("div", {
|
|
371
372
|
className: "flex items-center justify-between text-xs text-gray-500",
|
|
372
|
-
children: [/* @__PURE__ */
|
|
373
|
+
children: [/* @__PURE__ */ q("span", { children: o("fields.richText.format", {
|
|
374
|
+
format: l,
|
|
375
|
+
defaultValue: `Format: ${l}`
|
|
376
|
+
}) }), /* @__PURE__ */ q("span", {
|
|
373
377
|
className: "italic",
|
|
374
|
-
children: "Rich text editor (basic)"
|
|
378
|
+
children: o("fields.richText.basicEditorHint", { defaultValue: "Rich text editor (basic)" })
|
|
375
379
|
})]
|
|
376
|
-
}), /* @__PURE__ */ q(
|
|
380
|
+
}), /* @__PURE__ */ q(M, {
|
|
377
381
|
value: e || "",
|
|
378
382
|
onChange: (e) => t(e.target.value),
|
|
379
|
-
placeholder:
|
|
383
|
+
placeholder: s?.placeholder || o("fields.richText.placeholder", { defaultValue: "Enter text..." }),
|
|
380
384
|
disabled: r || a.disabled,
|
|
381
|
-
rows:
|
|
385
|
+
rows: c,
|
|
382
386
|
className: `font-mono text-sm ${a.className || ""}`,
|
|
383
387
|
"aria-invalid": !!i
|
|
384
388
|
})]
|
|
@@ -434,12 +438,12 @@ function bt(e, t) {
|
|
|
434
438
|
}
|
|
435
439
|
return n;
|
|
436
440
|
}
|
|
437
|
-
function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: y = St, value: S, onSelect: te, onSelectRecords: ne, lookupFilters: T, cellRenderer: O, filterColumns:
|
|
438
|
-
let [
|
|
441
|
+
function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: y = St, value: S, onSelect: te, onSelectRecords: ne, lookupFilters: T, cellRenderer: O, filterColumns: se, renderFilterBar: M, renderGrid: me }) {
|
|
442
|
+
let [I, _e] = l([]), [L, ve] = l(!1), [R, z] = l(null), [ye, be] = l(0), [B, xe] = l(""), [V, H] = l(1), Ce = c(null), [we, U] = l(null), [W, De] = l("asc"), [Oe, G] = l(/* @__PURE__ */ new Set()), Ae = c(/* @__PURE__ */ new Map()), [K, Me] = l(-1), Ne = c(null), [Pe, Y] = l(!1), [X, Fe] = l({}), [Ie, Le] = l({}), Re = c(null), [ze, Be] = l(""), Ve = s(() => d && d.length > 0 ? d.map(_t) : [{
|
|
439
443
|
field: f,
|
|
440
444
|
label: vt(f)
|
|
441
445
|
}], [d, f]), Z = s(() => {
|
|
442
|
-
if (
|
|
446
|
+
if (se && se.length > 0) return se;
|
|
443
447
|
if (T && T.length > 0) return T.map((e) => {
|
|
444
448
|
let t = "text";
|
|
445
449
|
return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
|
|
@@ -461,7 +465,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
461
465
|
}) } : {}
|
|
462
466
|
};
|
|
463
467
|
});
|
|
464
|
-
}, [
|
|
468
|
+
}, [se, T]), He = s(() => {
|
|
465
469
|
let e = T?.length ? yt(T) : {}, t = Z?.length ? bt(X, Z) : {}, n = {
|
|
466
470
|
...e,
|
|
467
471
|
...t
|
|
@@ -471,9 +475,9 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
471
475
|
T,
|
|
472
476
|
Z,
|
|
473
477
|
X
|
|
474
|
-
]), Ue = Math.max(1, Math.ceil(
|
|
478
|
+
]), Ue = Math.max(1, Math.ceil(ye / y)), We = r(async (e, t = 1, n, r) => {
|
|
475
479
|
if (!(!o || !u)) {
|
|
476
|
-
|
|
480
|
+
ve(!0), z(null);
|
|
477
481
|
try {
|
|
478
482
|
let i = {
|
|
479
483
|
$top: y,
|
|
@@ -483,11 +487,11 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
483
487
|
let a = r === void 0 ? He : r;
|
|
484
488
|
a && Object.keys(a).length > 0 && (i.$filter = a);
|
|
485
489
|
let s = await o.find(u, i), c = s?.data ?? s ?? [];
|
|
486
|
-
|
|
490
|
+
_e(c), be(s?.total ?? c.length), Me(-1);
|
|
487
491
|
} catch (e) {
|
|
488
|
-
|
|
492
|
+
z(e instanceof Error ? e.message : String(e)), _e([]);
|
|
489
493
|
} finally {
|
|
490
|
-
|
|
494
|
+
ve(!1);
|
|
491
495
|
}
|
|
492
496
|
}
|
|
493
497
|
}, [
|
|
@@ -495,49 +499,49 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
495
499
|
u,
|
|
496
500
|
y,
|
|
497
501
|
He
|
|
498
|
-
]), Ge = s(() =>
|
|
499
|
-
field:
|
|
500
|
-
direction:
|
|
501
|
-
} : null, [
|
|
502
|
+
]), Ge = s(() => we ? {
|
|
503
|
+
field: we,
|
|
504
|
+
direction: W
|
|
505
|
+
} : null, [we, W]);
|
|
502
506
|
a(() => {
|
|
503
|
-
e || (
|
|
507
|
+
e || (xe(""), H(1), z(null), _e([]), U(null), De("asc"), Me(-1), Y(!1), Fe({}), Le({}), Be(""), G(new Set(i && Array.isArray(S) ? S : [])), Ae.current.clear());
|
|
504
508
|
}, [e]), a(() => {
|
|
505
|
-
e && We(
|
|
509
|
+
e && We(B || void 0, V, Ge);
|
|
506
510
|
}, [
|
|
507
511
|
e,
|
|
508
|
-
|
|
512
|
+
V,
|
|
509
513
|
Ge,
|
|
510
514
|
He
|
|
511
515
|
]), a(() => {
|
|
512
|
-
e && i &&
|
|
516
|
+
e && i && G(new Set(Array.isArray(S) ? S : []));
|
|
513
517
|
}, [
|
|
514
518
|
e,
|
|
515
519
|
i,
|
|
516
520
|
S
|
|
517
521
|
]);
|
|
518
522
|
let Ke = r((e) => {
|
|
519
|
-
|
|
523
|
+
xe(e), H(1), Ce.current && clearTimeout(Ce.current), Ce.current = setTimeout(() => {
|
|
520
524
|
We(e || void 0, 1, Ge);
|
|
521
525
|
}, 300);
|
|
522
526
|
}, [We, Ge]);
|
|
523
527
|
a(() => () => {
|
|
524
|
-
|
|
528
|
+
Ce.current && clearTimeout(Ce.current);
|
|
525
529
|
}, []);
|
|
526
530
|
let qe = r((e) => {
|
|
527
|
-
|
|
531
|
+
U((t) => t === e ? (De((e) => e === "asc" ? "desc" : "asc"), e) : (De("asc"), e)), H(1);
|
|
528
532
|
}, []), Je = r((e) => e[m] ?? e.id ?? e._id, [m]), Ye = r((e) => {
|
|
529
533
|
let t = Je(e);
|
|
530
|
-
return i ?
|
|
534
|
+
return i ? Oe.has(t) : S === t;
|
|
531
535
|
}, [
|
|
532
536
|
i,
|
|
533
537
|
S,
|
|
534
|
-
|
|
538
|
+
Oe,
|
|
535
539
|
Je
|
|
536
540
|
]), Xe = r((e) => {
|
|
537
541
|
let n = Je(e);
|
|
538
|
-
i ?
|
|
542
|
+
i ? G((t) => {
|
|
539
543
|
let r = new Set(t);
|
|
540
|
-
return r.has(n) ? (r.delete(n),
|
|
544
|
+
return r.has(n) ? (r.delete(n), Ae.current.delete(n)) : (r.add(n), Ae.current.set(n, e)), r;
|
|
541
545
|
}) : (te(n), ne?.([e]), t(!1));
|
|
542
546
|
}, [
|
|
543
547
|
i,
|
|
@@ -546,36 +550,36 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
546
550
|
ne,
|
|
547
551
|
t
|
|
548
552
|
]), Ze = r(() => {
|
|
549
|
-
let e = Array.from(
|
|
553
|
+
let e = Array.from(Oe);
|
|
550
554
|
te(e);
|
|
551
|
-
let n = e.map((e) =>
|
|
555
|
+
let n = e.map((e) => Ae.current.get(e)).filter(Boolean);
|
|
552
556
|
ne?.(n), t(!1);
|
|
553
557
|
}, [
|
|
554
|
-
|
|
558
|
+
Oe,
|
|
555
559
|
te,
|
|
556
560
|
ne,
|
|
557
561
|
t
|
|
558
562
|
]), Qe = r(() => {
|
|
559
|
-
|
|
563
|
+
H((e) => Math.max(1, e - 1));
|
|
560
564
|
}, []), $e = r(() => {
|
|
561
|
-
|
|
565
|
+
H((e) => Math.min(Ue, e + 1));
|
|
562
566
|
}, [Ue]), et = r((e) => {
|
|
563
567
|
if (e.key !== "Enter") return;
|
|
564
568
|
let t = parseInt(ze, 10);
|
|
565
|
-
!isNaN(t) && t >= 1 && t <= Ue &&
|
|
569
|
+
!isNaN(t) && t >= 1 && t <= Ue && H(t), Be("");
|
|
566
570
|
}, [ze, Ue]), tt = r((e) => {
|
|
567
|
-
|
|
571
|
+
I.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Me((e) => Math.min(e + 1, I.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Me((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), K >= 0 && K < I.length && Xe(I[K])));
|
|
568
572
|
}, [
|
|
569
|
-
|
|
570
|
-
|
|
573
|
+
I,
|
|
574
|
+
K,
|
|
571
575
|
Xe
|
|
572
576
|
]);
|
|
573
577
|
a(() => {
|
|
574
|
-
if (
|
|
575
|
-
let e = Ne.current.querySelector(`[data-row-index="${
|
|
578
|
+
if (K >= 0 && Ne.current) {
|
|
579
|
+
let e = Ne.current.querySelector(`[data-row-index="${K}"]`);
|
|
576
580
|
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
577
581
|
}
|
|
578
|
-
}, [
|
|
582
|
+
}, [K]);
|
|
579
583
|
let nt = r((e, t) => {
|
|
580
584
|
if (p && t.field === f) {
|
|
581
585
|
let t = "[-\\u2013\\u2014|/·,:]", n = !1, r = p.replace(/\{([^{}]+)\}/g, (t, r) => {
|
|
@@ -603,7 +607,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
603
607
|
O,
|
|
604
608
|
p,
|
|
605
609
|
f
|
|
606
|
-
]), rt = r((e) =>
|
|
610
|
+
]), rt = r((e) => we === e ? q(W === "asc" ? fe : P, { className: "ml-1 size-3" }) : /* @__PURE__ */ q(pe, { className: "ml-1 size-3 opacity-40" }), [we, W]), it = r((e, t, n) => {
|
|
607
611
|
e.preventDefault(), e.stopPropagation(), Re.current = {
|
|
608
612
|
field: t,
|
|
609
613
|
startX: e.clientX,
|
|
@@ -624,9 +628,9 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
624
628
|
Fe((n) => ({
|
|
625
629
|
...n,
|
|
626
630
|
[e]: t
|
|
627
|
-
})),
|
|
631
|
+
})), H(1);
|
|
628
632
|
}, []), ot = r(() => {
|
|
629
|
-
Fe({}),
|
|
633
|
+
Fe({}), H(1);
|
|
630
634
|
}, []), st = s(() => Object.values(X).filter((e) => e != null && e !== "").length, [X]), ct = r((e) => {
|
|
631
635
|
let t = X[e.field], n = e.label || vt(e.field);
|
|
632
636
|
switch (e.type) {
|
|
@@ -719,15 +723,15 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
719
723
|
/* @__PURE__ */ J("div", {
|
|
720
724
|
className: "relative rounded-md border bg-muted/30 mb-3",
|
|
721
725
|
children: [
|
|
722
|
-
/* @__PURE__ */ q(
|
|
726
|
+
/* @__PURE__ */ q(Te, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
723
727
|
/* @__PURE__ */ q(C, {
|
|
724
728
|
placeholder: "Search...",
|
|
725
|
-
value:
|
|
729
|
+
value: B,
|
|
726
730
|
onChange: (e) => Ke(e.target.value),
|
|
727
731
|
className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
|
|
728
732
|
"data-testid": "record-picker-search"
|
|
729
733
|
}),
|
|
730
|
-
|
|
734
|
+
L && /* @__PURE__ */ q(Se, {
|
|
731
735
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
732
736
|
"data-testid": "record-picker-loading-indicator"
|
|
733
737
|
})
|
|
@@ -735,9 +739,9 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
735
739
|
}),
|
|
736
740
|
Z && Z.length > 0 && /* @__PURE__ */ q("div", {
|
|
737
741
|
className: "py-2",
|
|
738
|
-
children:
|
|
742
|
+
children: M ? /* @__PURE__ */ q("div", {
|
|
739
743
|
"data-testid": "record-picker-filter-bar",
|
|
740
|
-
children:
|
|
744
|
+
children: M({
|
|
741
745
|
filterColumns: Z,
|
|
742
746
|
values: X,
|
|
743
747
|
onChange: at,
|
|
@@ -754,7 +758,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
754
758
|
className: "gap-1.5 shrink-0",
|
|
755
759
|
onClick: () => Y((e) => !e),
|
|
756
760
|
children: [
|
|
757
|
-
/* @__PURE__ */ q(
|
|
761
|
+
/* @__PURE__ */ q(Ee, { className: "size-3.5" }),
|
|
758
762
|
"Filters",
|
|
759
763
|
st > 0 && /* @__PURE__ */ q("span", {
|
|
760
764
|
className: "inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary",
|
|
@@ -767,7 +771,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
767
771
|
size: "sm",
|
|
768
772
|
className: "gap-1 text-xs",
|
|
769
773
|
onClick: ot,
|
|
770
|
-
children: [/* @__PURE__ */ q(
|
|
774
|
+
children: [/* @__PURE__ */ q(ke, { className: "size-3" }), "Clear"]
|
|
771
775
|
})]
|
|
772
776
|
}), Pe && /* @__PURE__ */ q("div", {
|
|
773
777
|
className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
|
|
@@ -775,38 +779,38 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
775
779
|
children: Z.map((e) => /* @__PURE__ */ q("div", { children: ct(e) }, e.field))
|
|
776
780
|
})] })
|
|
777
781
|
}),
|
|
778
|
-
|
|
782
|
+
R && /* @__PURE__ */ J("div", {
|
|
779
783
|
className: "flex flex-col items-center gap-2 py-4",
|
|
780
784
|
role: "alert",
|
|
781
785
|
children: [
|
|
782
|
-
/* @__PURE__ */ q(
|
|
786
|
+
/* @__PURE__ */ q(de, { className: "size-5 text-destructive" }),
|
|
783
787
|
/* @__PURE__ */ q("p", {
|
|
784
788
|
className: "text-sm text-destructive",
|
|
785
|
-
children:
|
|
789
|
+
children: R
|
|
786
790
|
}),
|
|
787
791
|
/* @__PURE__ */ q(h, {
|
|
788
792
|
variant: "outline",
|
|
789
793
|
size: "sm",
|
|
790
|
-
onClick: () => We(
|
|
794
|
+
onClick: () => We(B || void 0, V, Ge),
|
|
791
795
|
type: "button",
|
|
792
796
|
children: "Retry"
|
|
793
797
|
})
|
|
794
798
|
]
|
|
795
799
|
}),
|
|
796
|
-
|
|
800
|
+
me ? /* @__PURE__ */ q("div", {
|
|
797
801
|
className: "flex-1 min-h-0",
|
|
798
802
|
"data-testid": "record-picker-grid-slot",
|
|
799
|
-
children:
|
|
803
|
+
children: me({
|
|
800
804
|
columns: Ve,
|
|
801
|
-
records:
|
|
802
|
-
loading:
|
|
803
|
-
totalCount:
|
|
804
|
-
currentPage:
|
|
805
|
+
records: I,
|
|
806
|
+
loading: L,
|
|
807
|
+
totalCount: ye,
|
|
808
|
+
currentPage: V,
|
|
805
809
|
pageSize: y,
|
|
806
|
-
sortField:
|
|
807
|
-
sortDirection:
|
|
810
|
+
sortField: we,
|
|
811
|
+
sortDirection: W,
|
|
808
812
|
onSort: qe,
|
|
809
|
-
onPageChange:
|
|
813
|
+
onPageChange: H,
|
|
810
814
|
onRowClick: Xe,
|
|
811
815
|
isSelected: Ye,
|
|
812
816
|
multiple: i,
|
|
@@ -814,51 +818,51 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
814
818
|
cellRenderer: O
|
|
815
819
|
})
|
|
816
820
|
}) : /* @__PURE__ */ J(je, { children: [
|
|
817
|
-
|
|
821
|
+
L && I.length === 0 && !R && /* @__PURE__ */ q("div", {
|
|
818
822
|
className: "flex-1 overflow-hidden min-h-0 border rounded-md",
|
|
819
823
|
role: "status",
|
|
820
824
|
"aria-live": "polite",
|
|
821
825
|
"data-testid": "record-picker-skeleton",
|
|
822
|
-
children: /* @__PURE__ */ J(
|
|
826
|
+
children: /* @__PURE__ */ J(ce, { children: [/* @__PURE__ */ q(A, { children: /* @__PURE__ */ J(j, {
|
|
823
827
|
className: "bg-muted/40",
|
|
824
|
-
children: [i && /* @__PURE__ */ q(
|
|
825
|
-
}) }), /* @__PURE__ */ q(
|
|
828
|
+
children: [i && /* @__PURE__ */ q(ue, { className: "w-10" }), Ve.map((e) => /* @__PURE__ */ q(ue, { children: /* @__PURE__ */ q(D, { className: "h-4 w-20" }) }, e.field))]
|
|
829
|
+
}) }), /* @__PURE__ */ q(le, { children: Array.from({ length: wt }, (e, t) => /* @__PURE__ */ J(j, { children: [i && /* @__PURE__ */ q(k, {
|
|
826
830
|
className: "w-10",
|
|
827
831
|
children: /* @__PURE__ */ q(D, { className: "size-4 rounded" })
|
|
828
|
-
}), Ve.map((e) => /* @__PURE__ */ q(
|
|
832
|
+
}), Ve.map((e) => /* @__PURE__ */ q(k, { children: /* @__PURE__ */ q(D, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
829
833
|
}),
|
|
830
|
-
!
|
|
834
|
+
!L && !R && I.length === 0 && /* @__PURE__ */ q("div", {
|
|
831
835
|
className: "py-8 text-center",
|
|
832
836
|
children: /* @__PURE__ */ q("p", {
|
|
833
837
|
className: "text-sm text-muted-foreground",
|
|
834
838
|
children: "No records found"
|
|
835
839
|
})
|
|
836
840
|
}),
|
|
837
|
-
!
|
|
841
|
+
!R && I.length > 0 && /* @__PURE__ */ J("div", {
|
|
838
842
|
className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
|
|
839
843
|
tabIndex: 0,
|
|
840
844
|
onKeyDown: tt,
|
|
841
845
|
role: "grid",
|
|
842
846
|
"aria-label": "Records",
|
|
843
|
-
children: [
|
|
847
|
+
children: [L && /* @__PURE__ */ q("div", {
|
|
844
848
|
className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
|
|
845
849
|
"data-testid": "record-picker-loading-overlay",
|
|
846
|
-
children: /* @__PURE__ */ q(
|
|
847
|
-
}), /* @__PURE__ */ J(
|
|
850
|
+
children: /* @__PURE__ */ q(Se, { className: "size-6 animate-spin text-muted-foreground" })
|
|
851
|
+
}), /* @__PURE__ */ J(ce, {
|
|
848
852
|
style: Object.keys(Ie).length > 0 ? { tableLayout: "fixed" } : void 0,
|
|
849
|
-
children: [/* @__PURE__ */ q(
|
|
853
|
+
children: [/* @__PURE__ */ q(A, {
|
|
850
854
|
className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
|
|
851
855
|
"data-testid": "record-picker-sticky-header",
|
|
852
|
-
children: /* @__PURE__ */ J(
|
|
856
|
+
children: /* @__PURE__ */ J(j, { children: [i && /* @__PURE__ */ q(ue, { className: "w-10" }), Ve.map((e) => {
|
|
853
857
|
let t = Ie[e.field];
|
|
854
|
-
return /* @__PURE__ */ J(
|
|
858
|
+
return /* @__PURE__ */ J(ue, {
|
|
855
859
|
style: t ? {
|
|
856
860
|
width: `${t}px`,
|
|
857
861
|
minWidth: `${t}px`
|
|
858
862
|
} : e.width ? { width: e.width } : void 0,
|
|
859
863
|
className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
|
|
860
864
|
onClick: () => qe(e.field),
|
|
861
|
-
"aria-sort":
|
|
865
|
+
"aria-sort": we === e.field ? W === "asc" ? "ascending" : "descending" : "none",
|
|
862
866
|
children: [/* @__PURE__ */ J("span", {
|
|
863
867
|
className: "inline-flex items-center",
|
|
864
868
|
children: [e.label || vt(e.field), rt(e.field)]
|
|
@@ -875,20 +879,20 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
875
879
|
})]
|
|
876
880
|
}, e.field);
|
|
877
881
|
})] })
|
|
878
|
-
}), /* @__PURE__ */ q(
|
|
882
|
+
}), /* @__PURE__ */ q(le, {
|
|
879
883
|
ref: Ne,
|
|
880
|
-
children:
|
|
881
|
-
let n = Je(e), r = Ye(e), a = t ===
|
|
882
|
-
return /* @__PURE__ */ J(
|
|
884
|
+
children: I.map((e, t) => {
|
|
885
|
+
let n = Je(e), r = Ye(e), a = t === K;
|
|
886
|
+
return /* @__PURE__ */ J(j, {
|
|
883
887
|
"data-row-index": t,
|
|
884
|
-
className:
|
|
888
|
+
className: N("cursor-pointer transition-colors", lt(r, t), a && "ring-2 ring-primary ring-inset"),
|
|
885
889
|
onClick: () => Xe(e),
|
|
886
890
|
"data-testid": `record-row-${n}`,
|
|
887
891
|
"aria-selected": r,
|
|
888
|
-
children: [i && /* @__PURE__ */ q(
|
|
892
|
+
children: [i && /* @__PURE__ */ q(k, {
|
|
889
893
|
className: "w-10",
|
|
890
|
-
children: r && /* @__PURE__ */ q(
|
|
891
|
-
}), Ve.map((t) => /* @__PURE__ */ q(
|
|
894
|
+
children: r && /* @__PURE__ */ q(F, { className: "size-4 text-primary" })
|
|
895
|
+
}), Ve.map((t) => /* @__PURE__ */ q(k, {
|
|
892
896
|
className: "py-2.5",
|
|
893
897
|
children: nt(e, t)
|
|
894
898
|
}, t.field))]
|
|
@@ -897,14 +901,14 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
897
901
|
})]
|
|
898
902
|
})]
|
|
899
903
|
}),
|
|
900
|
-
!
|
|
904
|
+
!R && ye > 0 && /* @__PURE__ */ J("div", {
|
|
901
905
|
className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
|
|
902
906
|
"data-testid": "record-picker-pagination",
|
|
903
907
|
children: [/* @__PURE__ */ J("span", { children: [
|
|
904
|
-
|
|
908
|
+
ye,
|
|
905
909
|
" ",
|
|
906
|
-
|
|
907
|
-
Ue > 1 && ` · Page ${
|
|
910
|
+
ye === 1 ? "record" : "records",
|
|
911
|
+
Ue > 1 && ` · Page ${V} of ${Ue}`
|
|
908
912
|
] }), Ue > 1 && /* @__PURE__ */ J("div", {
|
|
909
913
|
className: "flex items-center gap-1.5",
|
|
910
914
|
children: [
|
|
@@ -913,14 +917,14 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
913
917
|
size: "icon",
|
|
914
918
|
className: "size-7",
|
|
915
919
|
onClick: Qe,
|
|
916
|
-
disabled:
|
|
920
|
+
disabled: V <= 1,
|
|
917
921
|
type: "button",
|
|
918
922
|
"aria-label": "Previous page",
|
|
919
|
-
children: /* @__PURE__ */ q(
|
|
923
|
+
children: /* @__PURE__ */ q(he, { className: "size-4" })
|
|
920
924
|
}),
|
|
921
925
|
/* @__PURE__ */ q(C, {
|
|
922
926
|
className: "h-7 w-12 text-center text-xs px-1",
|
|
923
|
-
placeholder: String(
|
|
927
|
+
placeholder: String(V),
|
|
924
928
|
value: ze,
|
|
925
929
|
onChange: (e) => Be(e.target.value),
|
|
926
930
|
onKeyDown: et,
|
|
@@ -932,10 +936,10 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
932
936
|
size: "icon",
|
|
933
937
|
className: "size-7",
|
|
934
938
|
onClick: $e,
|
|
935
|
-
disabled:
|
|
939
|
+
disabled: V >= Ue,
|
|
936
940
|
type: "button",
|
|
937
941
|
"aria-label": "Next page",
|
|
938
|
-
children: /* @__PURE__ */ q(
|
|
942
|
+
children: /* @__PURE__ */ q(ge, { className: "size-4" })
|
|
939
943
|
})
|
|
940
944
|
]
|
|
941
945
|
})]
|
|
@@ -945,7 +949,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
945
949
|
className: "flex items-center gap-2 w-full justify-between",
|
|
946
950
|
children: [/* @__PURE__ */ J("span", {
|
|
947
951
|
className: "text-sm text-muted-foreground",
|
|
948
|
-
children: [
|
|
952
|
+
children: [Oe.size, " selected"]
|
|
949
953
|
}), /* @__PURE__ */ J("div", {
|
|
950
954
|
className: "flex gap-2",
|
|
951
955
|
children: [/* @__PURE__ */ q(h, {
|
|
@@ -1007,8 +1011,8 @@ function Nt(e) {
|
|
|
1007
1011
|
}[e];
|
|
1008
1012
|
}
|
|
1009
1013
|
function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
1010
|
-
let [d, f] = l(!1), [p, g] = l(""), { t: _ } = We(), [v, y] = l([]), [b, ee] = l(!1), [x, w] = l(null), [E, re] = l(0), ie = c(null), [ae, oe] = l([]), [D, O] = l(-1),
|
|
1011
|
-
let e =
|
|
1014
|
+
let [d, f] = l(!1), [p, g] = l(""), { t: _ } = We(), [v, y] = l([]), [b, ee] = l(!1), [x, w] = l(null), [E, re] = l(0), ie = c(null), [ae, oe] = l([]), [D, O] = l(-1), se = c(null), ce = n || u.schema, le = ce?.field, k = le && typeof le == "object" && ("reference_to" in le || "reference" in le || "type" in le) ? le : ce, ue = k?.options || [], A = k?.multiple || !1, j = k?.display_field || k?.reference_field || "name", M = k?.description_field, N = k?.id_field || "id", P = k?.reference_to || k?.reference, fe = k?.lookup_columns, pe = k?.lookup_page_size, me = k?.lookup_filters, F = s(() => {
|
|
1015
|
+
let e = k?.depends_on ?? k?.dependsOn;
|
|
1012
1016
|
return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
|
|
1013
1017
|
field: e,
|
|
1014
1018
|
param: e
|
|
@@ -1016,10 +1020,10 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1016
1020
|
field: e.field,
|
|
1017
1021
|
param: e.param ?? e.field
|
|
1018
1022
|
}) : [];
|
|
1019
|
-
}, [
|
|
1020
|
-
if (!
|
|
1023
|
+
}, [k?.depends_on, k?.dependsOn]), he = u.dependentValues, ge = s(() => {
|
|
1024
|
+
if (!fe) return;
|
|
1021
1025
|
let e = [];
|
|
1022
|
-
for (let t of
|
|
1026
|
+
for (let t of fe) if (typeof t == "object" && t.type) {
|
|
1023
1027
|
let n = Nt(t.type);
|
|
1024
1028
|
n && e.push({
|
|
1025
1029
|
field: t.field,
|
|
@@ -1028,59 +1032,59 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1028
1032
|
});
|
|
1029
1033
|
}
|
|
1030
1034
|
return e.length > 0 ? e : void 0;
|
|
1031
|
-
}, [
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
]),
|
|
1036
|
-
let t =
|
|
1035
|
+
}, [fe]), I = i(It), _e = I?.dataSource ?? null, L = u.dataSource ?? ce?.dataSource ?? k?.dataSource ?? _e, ve = s(() => he || (I?.formValues ?? I?.data ?? {}), [
|
|
1036
|
+
he,
|
|
1037
|
+
I?.formValues,
|
|
1038
|
+
I?.data
|
|
1039
|
+
]), R = s(() => F.length === 0 ? !1 : F.some(({ field: e }) => {
|
|
1040
|
+
let t = ve[e];
|
|
1037
1041
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
1038
|
-
}), [
|
|
1042
|
+
}), [F, ve]), z = L != null && typeof L.find == "function" && !!P, [ye, be] = l(null);
|
|
1039
1043
|
a(() => {
|
|
1040
|
-
if (!
|
|
1041
|
-
let e =
|
|
1044
|
+
if (!L || !P) return;
|
|
1045
|
+
let e = L.getObjectSchema;
|
|
1042
1046
|
if (typeof e != "function") return;
|
|
1043
1047
|
let t = !0;
|
|
1044
|
-
return Promise.resolve(e.call(
|
|
1045
|
-
t &&
|
|
1048
|
+
return Promise.resolve(e.call(L, P)).then((e) => {
|
|
1049
|
+
t && be(e);
|
|
1046
1050
|
}).catch(() => {}), () => {
|
|
1047
1051
|
t = !1;
|
|
1048
1052
|
};
|
|
1049
|
-
}, [
|
|
1050
|
-
let
|
|
1051
|
-
let e =
|
|
1053
|
+
}, [L, P]);
|
|
1054
|
+
let B = s(() => {
|
|
1055
|
+
let e = ye?.titleFormat;
|
|
1052
1056
|
return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
|
|
1053
|
-
}, [
|
|
1054
|
-
if (
|
|
1057
|
+
}, [ye]), xe = u.onCreateNew ?? ce?.onCreateNew, [V, H] = l(!1), Ce = z ? v : ue, U = s(() => {
|
|
1058
|
+
if (z || !p) return Ce;
|
|
1055
1059
|
let e = p.toLowerCase();
|
|
1056
|
-
return
|
|
1060
|
+
return Ce.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
|
|
1057
1061
|
}, [
|
|
1058
|
-
|
|
1059
|
-
|
|
1062
|
+
z,
|
|
1063
|
+
Ce,
|
|
1060
1064
|
p
|
|
1061
1065
|
]);
|
|
1062
1066
|
a(() => {
|
|
1063
1067
|
O(-1);
|
|
1064
|
-
}, [
|
|
1065
|
-
let
|
|
1066
|
-
if (!(!
|
|
1067
|
-
if (
|
|
1068
|
+
}, [U.length]);
|
|
1069
|
+
let W = r(async (e) => {
|
|
1070
|
+
if (!(!L || !P)) {
|
|
1071
|
+
if (R) {
|
|
1068
1072
|
y([]), re(0);
|
|
1069
1073
|
return;
|
|
1070
1074
|
}
|
|
1071
1075
|
ee(!0), w(null);
|
|
1072
1076
|
try {
|
|
1073
1077
|
let t = { $top: Ft };
|
|
1074
|
-
if (e && e.trim() && (t.$search = e.trim()),
|
|
1078
|
+
if (e && e.trim() && (t.$search = e.trim()), F.length > 0) {
|
|
1075
1079
|
let e = {};
|
|
1076
|
-
for (let { field: t, param: n } of
|
|
1077
|
-
let r =
|
|
1080
|
+
for (let { field: t, param: n } of F) {
|
|
1081
|
+
let r = ve[t];
|
|
1078
1082
|
r == null || r === "" || (e[n] = typeof r == "number" ? r : String(r));
|
|
1079
1083
|
}
|
|
1080
1084
|
Object.keys(e).length > 0 && (t.$filter = e);
|
|
1081
1085
|
}
|
|
1082
|
-
let n = await
|
|
1083
|
-
y(r.map((e) => Mt(e,
|
|
1086
|
+
let n = await L.find(P, t), r = n?.data ?? n ?? [];
|
|
1087
|
+
y(r.map((e) => Mt(e, j, N, M, B))), re(n?.total ?? r.length);
|
|
1084
1088
|
} catch (e) {
|
|
1085
1089
|
w(e instanceof Error ? e.message : String(e)), y([]);
|
|
1086
1090
|
} finally {
|
|
@@ -1088,47 +1092,47 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1088
1092
|
}
|
|
1089
1093
|
}
|
|
1090
1094
|
}, [
|
|
1091
|
-
|
|
1092
|
-
F,
|
|
1093
|
-
M,
|
|
1095
|
+
L,
|
|
1094
1096
|
P,
|
|
1097
|
+
j,
|
|
1095
1098
|
N,
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1099
|
+
M,
|
|
1100
|
+
B,
|
|
1101
|
+
R,
|
|
1102
|
+
F,
|
|
1103
|
+
ve
|
|
1100
1104
|
]);
|
|
1101
1105
|
a(() => {
|
|
1102
|
-
d &&
|
|
1103
|
-
}, [s(() =>
|
|
1104
|
-
d &&
|
|
1106
|
+
d && z && F.length > 0 && W(p || void 0);
|
|
1107
|
+
}, [s(() => F.map((e) => `${e.param}=${ve[e.field] ?? ""}`).join("|"), [F, ve])]), a(() => {
|
|
1108
|
+
d && z && W(p || void 0), d || (g(""), w(null), O(-1));
|
|
1105
1109
|
}, [d]);
|
|
1106
|
-
let
|
|
1107
|
-
g(e),
|
|
1108
|
-
|
|
1110
|
+
let Ee = r((e) => {
|
|
1111
|
+
g(e), z && (ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
|
|
1112
|
+
W(e || void 0);
|
|
1109
1113
|
}, 300));
|
|
1110
|
-
}, [
|
|
1114
|
+
}, [z, W]);
|
|
1111
1115
|
a(() => () => {
|
|
1112
1116
|
ie.current && clearTimeout(ie.current);
|
|
1113
1117
|
}, []), a(() => {
|
|
1114
|
-
if (!
|
|
1115
|
-
let t =
|
|
1118
|
+
if (!z || !L || !P) return;
|
|
1119
|
+
let t = A ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : [];
|
|
1116
1120
|
if (!t.length) return;
|
|
1117
|
-
let n = t.filter((e) => !
|
|
1121
|
+
let n = t.filter((e) => !De(e));
|
|
1118
1122
|
if (!n.length) return;
|
|
1119
1123
|
let r = !1;
|
|
1120
1124
|
return (async () => {
|
|
1121
1125
|
try {
|
|
1122
1126
|
let e = [];
|
|
1123
|
-
for (let t of n) if (typeof
|
|
1124
|
-
let n = await
|
|
1125
|
-
n && e.push(Mt(n,
|
|
1127
|
+
for (let t of n) if (typeof L.findOne == "function") {
|
|
1128
|
+
let n = await L.findOne(P, t);
|
|
1129
|
+
n && e.push(Mt(n, j, N, M, B));
|
|
1126
1130
|
} else {
|
|
1127
|
-
let n = await
|
|
1128
|
-
$filter: { [
|
|
1131
|
+
let n = await L.find(P, {
|
|
1132
|
+
$filter: { [N]: t },
|
|
1129
1133
|
$top: 1
|
|
1130
1134
|
}), r = n?.data ?? n ?? [];
|
|
1131
|
-
r[0] && e.push(Mt(r[0],
|
|
1135
|
+
r[0] && e.push(Mt(r[0], j, N, M, B));
|
|
1132
1136
|
}
|
|
1133
1137
|
!r && e.length && oe((t) => {
|
|
1134
1138
|
let n = new Map(t.map((e) => [e.value, e]));
|
|
@@ -1141,67 +1145,67 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1141
1145
|
};
|
|
1142
1146
|
}, [
|
|
1143
1147
|
e,
|
|
1144
|
-
|
|
1145
|
-
F,
|
|
1146
|
-
M,
|
|
1148
|
+
z,
|
|
1147
1149
|
P,
|
|
1150
|
+
j,
|
|
1148
1151
|
N,
|
|
1149
|
-
|
|
1152
|
+
M,
|
|
1153
|
+
A
|
|
1150
1154
|
]);
|
|
1151
|
-
let
|
|
1152
|
-
|
|
1155
|
+
let De = r((e) => ue.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? ae.find((t) => t.value === e), [
|
|
1156
|
+
ue,
|
|
1153
1157
|
v,
|
|
1154
1158
|
ae
|
|
1155
|
-
]),
|
|
1156
|
-
if (
|
|
1159
|
+
]), G = A ? (Array.isArray(e) ? e : []).map(De).filter(Boolean) : e ? [De(e)].filter(Boolean) : [], Ae = r((n) => {
|
|
1160
|
+
if (A) {
|
|
1157
1161
|
let r = Array.isArray(e) ? e : [];
|
|
1158
1162
|
r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
|
|
1159
1163
|
} else t(n.value), f(!1);
|
|
1160
1164
|
}, [
|
|
1161
|
-
|
|
1165
|
+
A,
|
|
1162
1166
|
e,
|
|
1163
1167
|
t
|
|
1164
|
-
]),
|
|
1165
|
-
t(
|
|
1168
|
+
]), K = (n) => {
|
|
1169
|
+
t(A ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
|
|
1166
1170
|
}, Me = r((e) => {
|
|
1167
|
-
oe(e.map((e) => Mt(e,
|
|
1171
|
+
oe(e.map((e) => Mt(e, j, N, M, B)));
|
|
1168
1172
|
}, [
|
|
1169
|
-
|
|
1170
|
-
P,
|
|
1173
|
+
j,
|
|
1171
1174
|
N,
|
|
1172
|
-
|
|
1175
|
+
M,
|
|
1176
|
+
B
|
|
1173
1177
|
]), Ne = r((e) => {
|
|
1174
|
-
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e <
|
|
1178
|
+
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e < U.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), O((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), D >= 0 && D < U.length && Ae(U[D]));
|
|
1175
1179
|
}, [
|
|
1176
|
-
|
|
1180
|
+
U,
|
|
1177
1181
|
D,
|
|
1178
|
-
|
|
1182
|
+
Ae
|
|
1179
1183
|
]);
|
|
1180
1184
|
return a(() => {
|
|
1181
|
-
D >= 0 &&
|
|
1182
|
-
}, [D]), o ?
|
|
1185
|
+
D >= 0 && se.current && se.current.querySelector(`[data-lookup-index="${D}"]`)?.scrollIntoView({ block: "nearest" });
|
|
1186
|
+
}, [D]), o ? G.length ? A ? /* @__PURE__ */ q("div", {
|
|
1183
1187
|
className: "flex flex-wrap gap-1",
|
|
1184
|
-
children:
|
|
1188
|
+
children: G.map((e, t) => /* @__PURE__ */ q(m, {
|
|
1185
1189
|
variant: "outline",
|
|
1186
|
-
children: e?.label || e?.[
|
|
1190
|
+
children: e?.label || e?.[j]
|
|
1187
1191
|
}, t))
|
|
1188
1192
|
}) : /* @__PURE__ */ q("span", {
|
|
1189
1193
|
className: "text-sm",
|
|
1190
|
-
children:
|
|
1194
|
+
children: G[0]?.label || G[0]?.[j]
|
|
1191
1195
|
}) : /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("div", {
|
|
1192
1196
|
className: "space-y-2",
|
|
1193
1197
|
children: [
|
|
1194
|
-
|
|
1198
|
+
G.length > 0 && /* @__PURE__ */ q("div", {
|
|
1195
1199
|
className: "flex flex-wrap gap-1",
|
|
1196
|
-
children:
|
|
1200
|
+
children: G.map((e, t) => /* @__PURE__ */ J(m, {
|
|
1197
1201
|
variant: "outline",
|
|
1198
1202
|
className: "gap-1",
|
|
1199
|
-
children: [e?.label || e?.[
|
|
1200
|
-
onClick: () =>
|
|
1203
|
+
children: [e?.label || e?.[j], /* @__PURE__ */ q("button", {
|
|
1204
|
+
onClick: () => K(e?.value),
|
|
1201
1205
|
className: "ml-1 hover:text-destructive",
|
|
1202
1206
|
type: "button",
|
|
1203
|
-
"aria-label": `Remove ${e?.label || e?.[
|
|
1204
|
-
children: /* @__PURE__ */ q(
|
|
1207
|
+
"aria-label": `Remove ${e?.label || e?.[j]}`,
|
|
1208
|
+
children: /* @__PURE__ */ q(ke, { className: "size-3" })
|
|
1205
1209
|
})]
|
|
1206
1210
|
}, t))
|
|
1207
1211
|
}),
|
|
@@ -1209,17 +1213,17 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1209
1213
|
className: "flex items-center gap-1.5",
|
|
1210
1214
|
children: [/* @__PURE__ */ J(te, {
|
|
1211
1215
|
open: d,
|
|
1212
|
-
onOpenChange: (e) => !
|
|
1216
|
+
onOpenChange: (e) => !R && f(e),
|
|
1213
1217
|
children: [/* @__PURE__ */ q(T, {
|
|
1214
1218
|
asChild: !0,
|
|
1215
1219
|
children: /* @__PURE__ */ J(h, {
|
|
1216
1220
|
variant: "outline",
|
|
1217
1221
|
className: "min-w-0 flex-1 justify-start text-left font-normal",
|
|
1218
1222
|
type: "button",
|
|
1219
|
-
disabled:
|
|
1220
|
-
"data-testid":
|
|
1221
|
-
title:
|
|
1222
|
-
children: [/* @__PURE__ */ q(
|
|
1223
|
+
disabled: R || u.disabled,
|
|
1224
|
+
"data-testid": R ? "lookup-trigger-gated" : void 0,
|
|
1225
|
+
title: R ? `Select ${F.map((e) => e.field).join(", ")} first` : void 0,
|
|
1226
|
+
children: [/* @__PURE__ */ q(Te, { className: "mr-2 size-4" }), R ? `Select ${F.map((e) => e.field).join(", ")} first` : G.length === 0 ? ce?.placeholder || _("common.select") : A ? _("table.selected", { count: G.length }) : _("common.select")]
|
|
1223
1227
|
})
|
|
1224
1228
|
}), /* @__PURE__ */ J(ne, {
|
|
1225
1229
|
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
@@ -1230,15 +1234,15 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1230
1234
|
children: /* @__PURE__ */ J("div", {
|
|
1231
1235
|
className: "relative",
|
|
1232
1236
|
children: [
|
|
1233
|
-
/* @__PURE__ */ q(
|
|
1237
|
+
/* @__PURE__ */ q(Te, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
1234
1238
|
/* @__PURE__ */ q(C, {
|
|
1235
1239
|
placeholder: _("common.search") + "...",
|
|
1236
1240
|
value: p,
|
|
1237
|
-
onChange: (e) =>
|
|
1241
|
+
onChange: (e) => Ee(e.target.value),
|
|
1238
1242
|
onKeyDown: Ne,
|
|
1239
1243
|
className: "w-full pl-9 h-8 text-sm"
|
|
1240
1244
|
}),
|
|
1241
|
-
b && /* @__PURE__ */ q(
|
|
1245
|
+
b && /* @__PURE__ */ q(Se, {
|
|
1242
1246
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
1243
1247
|
"data-testid": "lookup-loading"
|
|
1244
1248
|
})
|
|
@@ -1249,7 +1253,7 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1249
1253
|
className: "flex flex-col items-center gap-2 py-4 px-2",
|
|
1250
1254
|
role: "alert",
|
|
1251
1255
|
children: [
|
|
1252
|
-
/* @__PURE__ */ q(
|
|
1256
|
+
/* @__PURE__ */ q(de, { className: "size-5 text-destructive" }),
|
|
1253
1257
|
/* @__PURE__ */ q("p", {
|
|
1254
1258
|
className: "text-sm text-destructive",
|
|
1255
1259
|
children: x
|
|
@@ -1257,48 +1261,48 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1257
1261
|
/* @__PURE__ */ q(h, {
|
|
1258
1262
|
variant: "outline",
|
|
1259
1263
|
size: "sm",
|
|
1260
|
-
onClick: () =>
|
|
1264
|
+
onClick: () => W(p || void 0),
|
|
1261
1265
|
type: "button",
|
|
1262
1266
|
children: "Retry"
|
|
1263
1267
|
})
|
|
1264
1268
|
]
|
|
1265
1269
|
}),
|
|
1266
|
-
b &&
|
|
1270
|
+
b && U.length === 0 && !x && /* @__PURE__ */ J("div", {
|
|
1267
1271
|
className: "flex flex-col items-center gap-2 py-6",
|
|
1268
1272
|
role: "status",
|
|
1269
1273
|
"aria-live": "polite",
|
|
1270
|
-
children: [/* @__PURE__ */ q(
|
|
1274
|
+
children: [/* @__PURE__ */ q(Se, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ q("p", {
|
|
1271
1275
|
className: "text-sm text-muted-foreground",
|
|
1272
1276
|
children: "Loading…"
|
|
1273
1277
|
})]
|
|
1274
1278
|
}),
|
|
1275
|
-
!x && !(b &&
|
|
1276
|
-
ref:
|
|
1279
|
+
!x && !(b && U.length === 0) && /* @__PURE__ */ q("div", {
|
|
1280
|
+
ref: se,
|
|
1277
1281
|
className: "max-h-64 overflow-y-auto px-1 pb-1",
|
|
1278
1282
|
role: "listbox",
|
|
1279
|
-
children:
|
|
1283
|
+
children: U.length === 0 ? /* @__PURE__ */ J("div", {
|
|
1280
1284
|
className: "py-4 text-center",
|
|
1281
1285
|
children: [/* @__PURE__ */ q("p", {
|
|
1282
1286
|
className: "text-sm text-muted-foreground",
|
|
1283
1287
|
children: "No options found"
|
|
1284
|
-
}),
|
|
1288
|
+
}), xe && /* @__PURE__ */ J(h, {
|
|
1285
1289
|
variant: "ghost",
|
|
1286
1290
|
size: "sm",
|
|
1287
1291
|
className: "mt-2 gap-1",
|
|
1288
1292
|
type: "button",
|
|
1289
1293
|
onClick: () => {
|
|
1290
|
-
|
|
1294
|
+
xe(p), f(!1);
|
|
1291
1295
|
},
|
|
1292
|
-
children: [/* @__PURE__ */ q(
|
|
1296
|
+
children: [/* @__PURE__ */ q(we, { className: "size-4" }), "Create new"]
|
|
1293
1297
|
})]
|
|
1294
1298
|
}) : /* @__PURE__ */ J(je, { children: [
|
|
1295
|
-
|
|
1296
|
-
let r =
|
|
1299
|
+
U.map((t, n) => {
|
|
1300
|
+
let r = A ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
|
|
1297
1301
|
return /* @__PURE__ */ J("button", {
|
|
1298
1302
|
"data-lookup-index": n,
|
|
1299
1303
|
role: "option",
|
|
1300
1304
|
"aria-selected": r,
|
|
1301
|
-
onClick: () =>
|
|
1305
|
+
onClick: () => Ae(t),
|
|
1302
1306
|
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === D ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
1303
1307
|
type: "button",
|
|
1304
1308
|
children: [/* @__PURE__ */ J("div", {
|
|
@@ -1317,38 +1321,38 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1317
1321
|
})]
|
|
1318
1322
|
}, t.value);
|
|
1319
1323
|
}),
|
|
1320
|
-
|
|
1324
|
+
z && E > U.length && /* @__PURE__ */ J("p", {
|
|
1321
1325
|
className: "text-xs text-muted-foreground text-center py-2",
|
|
1322
1326
|
children: [
|
|
1323
1327
|
"Showing ",
|
|
1324
|
-
|
|
1328
|
+
U.length,
|
|
1325
1329
|
" of ",
|
|
1326
1330
|
E,
|
|
1327
1331
|
" results."
|
|
1328
1332
|
]
|
|
1329
1333
|
}),
|
|
1330
|
-
|
|
1334
|
+
z && E > U.length && /* @__PURE__ */ J("button", {
|
|
1331
1335
|
type: "button",
|
|
1332
1336
|
className: "w-full text-center px-3 py-2 rounded-md text-sm font-medium text-primary hover:bg-accent flex items-center justify-center gap-1.5",
|
|
1333
1337
|
onClick: () => {
|
|
1334
|
-
f(!1),
|
|
1338
|
+
f(!1), H(!0);
|
|
1335
1339
|
},
|
|
1336
1340
|
"data-testid": "show-all-results",
|
|
1337
1341
|
children: [
|
|
1338
|
-
/* @__PURE__ */ q(
|
|
1342
|
+
/* @__PURE__ */ q(Oe, { className: "size-3.5" }),
|
|
1339
1343
|
"Show All Results (",
|
|
1340
1344
|
E,
|
|
1341
1345
|
")"
|
|
1342
1346
|
]
|
|
1343
1347
|
}),
|
|
1344
|
-
|
|
1348
|
+
xe && /* @__PURE__ */ J("button", {
|
|
1345
1349
|
type: "button",
|
|
1346
1350
|
className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
|
|
1347
1351
|
onClick: () => {
|
|
1348
|
-
|
|
1352
|
+
xe(p), f(!1);
|
|
1349
1353
|
},
|
|
1350
1354
|
children: [
|
|
1351
|
-
/* @__PURE__ */ q(
|
|
1355
|
+
/* @__PURE__ */ q(we, { className: "size-3.5" }),
|
|
1352
1356
|
"Create new",
|
|
1353
1357
|
p ? ` "${p}"` : ""
|
|
1354
1358
|
]
|
|
@@ -1357,42 +1361,42 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1357
1361
|
})
|
|
1358
1362
|
]
|
|
1359
1363
|
})]
|
|
1360
|
-
}),
|
|
1364
|
+
}), z && /* @__PURE__ */ q(h, {
|
|
1361
1365
|
variant: "outline",
|
|
1362
1366
|
size: "icon",
|
|
1363
1367
|
className: "shrink-0",
|
|
1364
1368
|
type: "button",
|
|
1365
|
-
onClick: () =>
|
|
1369
|
+
onClick: () => H(!0),
|
|
1366
1370
|
"aria-label": "Browse all records",
|
|
1367
1371
|
title: "Browse all records",
|
|
1368
1372
|
"data-testid": "browse-all-records",
|
|
1369
|
-
children: /* @__PURE__ */ q(
|
|
1373
|
+
children: /* @__PURE__ */ q(Oe, { className: "size-4" })
|
|
1370
1374
|
})]
|
|
1371
1375
|
}),
|
|
1372
|
-
|
|
1373
|
-
open:
|
|
1374
|
-
onOpenChange:
|
|
1375
|
-
title:
|
|
1376
|
-
multiple:
|
|
1377
|
-
dataSource:
|
|
1378
|
-
objectName:
|
|
1379
|
-
columns:
|
|
1380
|
-
displayField:
|
|
1381
|
-
titleFormat:
|
|
1382
|
-
idField:
|
|
1383
|
-
pageSize:
|
|
1376
|
+
z && L && P && /* @__PURE__ */ q(xt, {
|
|
1377
|
+
open: V,
|
|
1378
|
+
onOpenChange: H,
|
|
1379
|
+
title: ce?.label || "Select",
|
|
1380
|
+
multiple: A,
|
|
1381
|
+
dataSource: L,
|
|
1382
|
+
objectName: P,
|
|
1383
|
+
columns: fe,
|
|
1384
|
+
displayField: j,
|
|
1385
|
+
titleFormat: B,
|
|
1386
|
+
idField: N,
|
|
1387
|
+
pageSize: pe,
|
|
1384
1388
|
value: e,
|
|
1385
1389
|
onSelect: t,
|
|
1386
1390
|
onSelectRecords: Me,
|
|
1387
|
-
lookupFilters:
|
|
1391
|
+
lookupFilters: me,
|
|
1388
1392
|
cellRenderer: Dt(),
|
|
1389
|
-
filterColumns:
|
|
1393
|
+
filterColumns: ge
|
|
1390
1394
|
})
|
|
1391
1395
|
]
|
|
1392
1396
|
});
|
|
1393
1397
|
}
|
|
1394
1398
|
var Ft, It, Lt = Y((() => {
|
|
1395
|
-
Tt(), kt(), Ge(), Ft = 50, It =
|
|
1399
|
+
Tt(), kt(), Ge(), Ft = 50, It = Ae;
|
|
1396
1400
|
})), Rt = /* @__PURE__ */ X({ DateTimeField: () => zt });
|
|
1397
1401
|
function zt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1398
1402
|
if (r) {
|
|
@@ -1510,7 +1514,7 @@ function Jt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1510
1514
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
1511
1515
|
onClick: () => s(!o),
|
|
1512
1516
|
tabIndex: -1,
|
|
1513
|
-
children: q(o ?
|
|
1517
|
+
children: q(o ? ye : z, { className: "size-4 text-gray-500" })
|
|
1514
1518
|
})]
|
|
1515
1519
|
});
|
|
1516
1520
|
}
|
|
@@ -1586,7 +1590,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1586
1590
|
let n = E.filter((t, n) => n !== e);
|
|
1587
1591
|
t(n.length > 0 ? n : null);
|
|
1588
1592
|
} else t(null);
|
|
1589
|
-
},
|
|
1593
|
+
}, se = (e) => (e.mime_type || "").startsWith("image/");
|
|
1590
1594
|
return /* @__PURE__ */ J("div", {
|
|
1591
1595
|
className: a.className,
|
|
1592
1596
|
children: [
|
|
@@ -1627,7 +1631,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1627
1631
|
onKeyDown: (e) => {
|
|
1628
1632
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
|
|
1629
1633
|
},
|
|
1630
|
-
children: [/* @__PURE__ */ q(
|
|
1634
|
+
children: [/* @__PURE__ */ q(G, { className: `size-8 ${y ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ J("div", {
|
|
1631
1635
|
className: "text-center",
|
|
1632
1636
|
children: [/* @__PURE__ */ q("p", {
|
|
1633
1637
|
className: "text-sm font-medium",
|
|
@@ -1647,12 +1651,12 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1647
1651
|
e.stopPropagation(), s.current?.click();
|
|
1648
1652
|
},
|
|
1649
1653
|
"data-testid": "file-field-camera-button",
|
|
1650
|
-
children: [/* @__PURE__ */ q(
|
|
1654
|
+
children: [/* @__PURE__ */ q(me, { className: "size-4 mr-2" }), v === "user" ? "Take selfie" : "Take photo"]
|
|
1651
1655
|
}),
|
|
1652
1656
|
ne && /* @__PURE__ */ J("div", {
|
|
1653
1657
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
1654
1658
|
"data-testid": "file-field-uploading",
|
|
1655
|
-
children: [/* @__PURE__ */ q(
|
|
1659
|
+
children: [/* @__PURE__ */ q(Se, { className: "size-3 animate-spin" }), /* @__PURE__ */ J("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
|
|
1656
1660
|
}),
|
|
1657
1661
|
ee.length > 0 && /* @__PURE__ */ q("div", {
|
|
1658
1662
|
className: "space-y-0.5",
|
|
@@ -1668,11 +1672,11 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1668
1672
|
children: [/* @__PURE__ */ J("div", {
|
|
1669
1673
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
1670
1674
|
children: [
|
|
1671
|
-
|
|
1675
|
+
se(e) && e.url ? /* @__PURE__ */ q("img", {
|
|
1672
1676
|
src: e.url,
|
|
1673
1677
|
alt: e.name,
|
|
1674
1678
|
className: "size-8 object-cover rounded shrink-0"
|
|
1675
|
-
}) :
|
|
1679
|
+
}) : se(e) ? /* @__PURE__ */ q(xe, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ q(be, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
1676
1680
|
/* @__PURE__ */ q("span", {
|
|
1677
1681
|
className: "text-sm truncate",
|
|
1678
1682
|
children: e.name || e.original_name || "File"
|
|
@@ -1694,7 +1698,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1694
1698
|
e.stopPropagation(), O(t);
|
|
1695
1699
|
},
|
|
1696
1700
|
className: "h-6 w-6 p-0",
|
|
1697
|
-
children: /* @__PURE__ */ q(
|
|
1701
|
+
children: /* @__PURE__ */ q(ke, { className: "size-3" })
|
|
1698
1702
|
})]
|
|
1699
1703
|
}, t))
|
|
1700
1704
|
})
|
|
@@ -1822,7 +1826,7 @@ var Qt = Y((() => {})), $t = /* @__PURE__ */ X({ ImageCropperDialog: () => en })
|
|
|
1822
1826
|
variant: "outline",
|
|
1823
1827
|
onClick: re,
|
|
1824
1828
|
"data-testid": "image-cropper-rotate",
|
|
1825
|
-
children: [/* @__PURE__ */ q(
|
|
1829
|
+
children: [/* @__PURE__ */ q(W, { className: "size-4 mr-2" }), "Rotate 90°"]
|
|
1826
1830
|
}), /* @__PURE__ */ J("div", {
|
|
1827
1831
|
className: "flex gap-2",
|
|
1828
1832
|
children: [/* @__PURE__ */ q(h, {
|
|
@@ -1835,7 +1839,7 @@ var Qt = Y((() => {})), $t = /* @__PURE__ */ X({ ImageCropperDialog: () => en })
|
|
|
1835
1839
|
onClick: ie,
|
|
1836
1840
|
disabled: !w,
|
|
1837
1841
|
"data-testid": "image-cropper-confirm",
|
|
1838
|
-
children: [/* @__PURE__ */ q(
|
|
1842
|
+
children: [/* @__PURE__ */ q(_e, { className: "size-4 mr-2" }), "Apply crop"]
|
|
1839
1843
|
})]
|
|
1840
1844
|
})]
|
|
1841
1845
|
})
|
|
@@ -1943,14 +1947,14 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1943
1947
|
className: "h-6 w-6 p-0",
|
|
1944
1948
|
"aria-label": `Crop image ${t + 1}`,
|
|
1945
1949
|
"data-testid": `image-field-crop-${t}`,
|
|
1946
|
-
children: /* @__PURE__ */ q(
|
|
1950
|
+
children: /* @__PURE__ */ q(_e, { className: "size-3" })
|
|
1947
1951
|
}), /* @__PURE__ */ q(h, {
|
|
1948
1952
|
type: "button",
|
|
1949
1953
|
variant: "destructive",
|
|
1950
1954
|
size: "sm",
|
|
1951
1955
|
onClick: () => x(t),
|
|
1952
1956
|
className: "h-6 w-6 p-0",
|
|
1953
|
-
children: /* @__PURE__ */ q(
|
|
1957
|
+
children: /* @__PURE__ */ q(ke, { className: "size-3" })
|
|
1954
1958
|
})]
|
|
1955
1959
|
})]
|
|
1956
1960
|
}, t))
|
|
@@ -1961,7 +1965,7 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1961
1965
|
className: "w-full",
|
|
1962
1966
|
disabled: v,
|
|
1963
1967
|
"data-testid": "image-field-upload-button",
|
|
1964
|
-
children: [v ? /* @__PURE__ */ q(
|
|
1968
|
+
children: [v ? /* @__PURE__ */ q(Se, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ q(B, { className: "size-4 mr-2" }), v ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
|
|
1965
1969
|
})]
|
|
1966
1970
|
}),
|
|
1967
1971
|
p && m && /* @__PURE__ */ q(t, {
|
|
@@ -2098,7 +2102,7 @@ function bn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2098
2102
|
type: "button",
|
|
2099
2103
|
onClick: () => s(t),
|
|
2100
2104
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
2101
|
-
children: /* @__PURE__ */ q(
|
|
2105
|
+
children: /* @__PURE__ */ q(ke, { className: "size-3" })
|
|
2102
2106
|
})
|
|
2103
2107
|
]
|
|
2104
2108
|
}, t);
|
|
@@ -2124,11 +2128,11 @@ function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2124
2128
|
c(JSON.stringify(e, null, 2));
|
|
2125
2129
|
}
|
|
2126
2130
|
}, [e, s]), r ? e ? /* @__PURE__ */ q("pre", {
|
|
2127
|
-
className:
|
|
2131
|
+
className: N("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
2128
2132
|
children: JSON.stringify(e, null, 2)
|
|
2129
2133
|
}) : /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("div", {
|
|
2130
2134
|
className: "space-y-1",
|
|
2131
|
-
children: [/* @__PURE__ */ q(
|
|
2135
|
+
children: [/* @__PURE__ */ q(M, {
|
|
2132
2136
|
value: s,
|
|
2133
2137
|
onChange: (e) => {
|
|
2134
2138
|
let n = e.target.value;
|
|
@@ -2144,7 +2148,7 @@ function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2144
2148
|
},
|
|
2145
2149
|
placeholder: o?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
2146
2150
|
disabled: r || i.disabled,
|
|
2147
|
-
className:
|
|
2151
|
+
className: N("font-mono text-xs", u ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
2148
2152
|
rows: 6
|
|
2149
2153
|
}), u && /* @__PURE__ */ q("p", {
|
|
2150
2154
|
className: "text-xs text-red-500",
|
|
@@ -2183,13 +2187,13 @@ var Dn = Y((() => {})), On = /* @__PURE__ */ X({ GridField: () => kn });
|
|
|
2183
2187
|
function kn({ value: e, field: t, readonly: n, ...r }) {
|
|
2184
2188
|
let i = (t || r.schema)?.columns || [];
|
|
2185
2189
|
return !e || !Array.isArray(e) ? /* @__PURE__ */ q(S, {}) : n ? /* @__PURE__ */ q("div", {
|
|
2186
|
-
className:
|
|
2190
|
+
className: N("text-sm", r.className),
|
|
2187
2191
|
children: /* @__PURE__ */ J("span", {
|
|
2188
2192
|
className: "text-foreground",
|
|
2189
2193
|
children: [e.length, " rows"]
|
|
2190
2194
|
})
|
|
2191
2195
|
}) : /* @__PURE__ */ J("div", {
|
|
2192
|
-
className:
|
|
2196
|
+
className: N("border border-border rounded-lg overflow-hidden", r.className),
|
|
2193
2197
|
children: [/* @__PURE__ */ q("div", {
|
|
2194
2198
|
className: "overflow-auto max-h-60",
|
|
2195
2199
|
children: /* @__PURE__ */ J("table", {
|
|
@@ -2284,8 +2288,8 @@ var In = Y((() => {})), Ln = /* @__PURE__ */ X({ RatingField: () => Rn });
|
|
|
2284
2288
|
function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
2285
2289
|
let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
|
|
2286
2290
|
return i ? /* @__PURE__ */ J("div", {
|
|
2287
|
-
className:
|
|
2288
|
-
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q(
|
|
2291
|
+
className: N("flex items-center gap-1", a),
|
|
2292
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q(De, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ J("span", {
|
|
2289
2293
|
className: "ml-2 text-sm text-muted-foreground",
|
|
2290
2294
|
children: [
|
|
2291
2295
|
c,
|
|
@@ -2294,7 +2298,7 @@ function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
2294
2298
|
]
|
|
2295
2299
|
})]
|
|
2296
2300
|
}) : /* @__PURE__ */ J("div", {
|
|
2297
|
-
className:
|
|
2301
|
+
className: N("flex items-center gap-1", a),
|
|
2298
2302
|
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q("button", {
|
|
2299
2303
|
type: "button",
|
|
2300
2304
|
onClick: () => n(t + 1),
|
|
@@ -2302,7 +2306,7 @@ function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
2302
2306
|
onMouseLeave: () => u(null),
|
|
2303
2307
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
2304
2308
|
disabled: i || o.disabled,
|
|
2305
|
-
children: /* @__PURE__ */ q(
|
|
2309
|
+
children: /* @__PURE__ */ q(De, { className: `w-5 h-5 transition-colors ${t < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
2306
2310
|
}, t)), /* @__PURE__ */ J("span", {
|
|
2307
2311
|
className: "ml-2 text-sm text-muted-foreground",
|
|
2308
2312
|
children: [
|
|
@@ -2317,14 +2321,14 @@ var zn = Y((() => {})), Bn = /* @__PURE__ */ X({ CodeField: () => Vn });
|
|
|
2317
2321
|
function Vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2318
2322
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
2319
2323
|
return r ? /* @__PURE__ */ q("pre", {
|
|
2320
|
-
className:
|
|
2324
|
+
className: N("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
2321
2325
|
children: /* @__PURE__ */ q("code", { children: e || /* @__PURE__ */ q(S, {}) })
|
|
2322
|
-
}) : /* @__PURE__ */ q(
|
|
2326
|
+
}) : /* @__PURE__ */ q(M, {
|
|
2323
2327
|
value: e || "",
|
|
2324
2328
|
onChange: (e) => t(e.target.value),
|
|
2325
2329
|
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
2326
2330
|
disabled: r || i.disabled,
|
|
2327
|
-
className:
|
|
2331
|
+
className: N("font-mono text-sm", i.className),
|
|
2328
2332
|
rows: 12,
|
|
2329
2333
|
spellCheck: !1
|
|
2330
2334
|
});
|
|
@@ -2371,7 +2375,7 @@ function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2371
2375
|
type: "button",
|
|
2372
2376
|
onClick: m,
|
|
2373
2377
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
2374
|
-
children: /* @__PURE__ */ q(
|
|
2378
|
+
children: /* @__PURE__ */ q(ke, { className: "w-3 h-3" })
|
|
2375
2379
|
})]
|
|
2376
2380
|
}), /* @__PURE__ */ J("div", {
|
|
2377
2381
|
className: "flex flex-col gap-2",
|
|
@@ -2390,7 +2394,7 @@ function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2390
2394
|
onClick: () => c.current?.click(),
|
|
2391
2395
|
disabled: i || a.disabled,
|
|
2392
2396
|
children: [
|
|
2393
|
-
/* @__PURE__ */ q(
|
|
2397
|
+
/* @__PURE__ */ q(G, { className: "w-4 h-4 mr-2" }),
|
|
2394
2398
|
t ? "Change" : "Upload",
|
|
2395
2399
|
" Avatar"
|
|
2396
2400
|
]
|
|
@@ -2529,7 +2533,7 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2529
2533
|
return /* @__PURE__ */ J("div", {
|
|
2530
2534
|
className: "flex items-center gap-2",
|
|
2531
2535
|
children: [
|
|
2532
|
-
/* @__PURE__ */ q(
|
|
2536
|
+
/* @__PURE__ */ q(V, { className: "w-4 h-4 text-muted-foreground" }),
|
|
2533
2537
|
e ? /* @__PURE__ */ q("span", {
|
|
2534
2538
|
className: "text-sm",
|
|
2535
2539
|
children: e
|
|
@@ -2556,13 +2560,13 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2556
2560
|
size: "sm",
|
|
2557
2561
|
onClick: u,
|
|
2558
2562
|
disabled: i || o,
|
|
2559
|
-
children: [/* @__PURE__ */ q(
|
|
2563
|
+
children: [/* @__PURE__ */ q(L, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
2560
2564
|
}), c.latitude && c.longitude && /* @__PURE__ */ J(h, {
|
|
2561
2565
|
type: "button",
|
|
2562
2566
|
variant: "link",
|
|
2563
2567
|
size: "sm",
|
|
2564
2568
|
onClick: f,
|
|
2565
|
-
children: [/* @__PURE__ */ q(
|
|
2569
|
+
children: [/* @__PURE__ */ q(V, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
2566
2570
|
})]
|
|
2567
2571
|
}),
|
|
2568
2572
|
/* @__PURE__ */ J("div", {
|
|
@@ -2686,7 +2690,7 @@ function $n({ value: t, onChange: n, readonly: r }) {
|
|
|
2686
2690
|
t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
|
|
2687
2691
|
},
|
|
2688
2692
|
disabled: r || l,
|
|
2689
|
-
children: [/* @__PURE__ */ q(
|
|
2693
|
+
children: [/* @__PURE__ */ q(ve, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
2690
2694
|
})]
|
|
2691
2695
|
})]
|
|
2692
2696
|
});
|
|
@@ -2705,7 +2709,7 @@ function nr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2705
2709
|
size: "sm",
|
|
2706
2710
|
onClick: () => s(!o),
|
|
2707
2711
|
children: [
|
|
2708
|
-
/* @__PURE__ */ q(
|
|
2712
|
+
/* @__PURE__ */ q(U, { className: "w-4 h-4 mr-2" }),
|
|
2709
2713
|
o ? "Hide" : "Show",
|
|
2710
2714
|
" QR"
|
|
2711
2715
|
]
|
|
@@ -2729,13 +2733,13 @@ function nr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2729
2733
|
onClick: () => {
|
|
2730
2734
|
t && navigator.clipboard.writeText(t);
|
|
2731
2735
|
},
|
|
2732
|
-
children: /* @__PURE__ */ q(
|
|
2736
|
+
children: /* @__PURE__ */ q(I, { className: "w-4 h-4" })
|
|
2733
2737
|
}), /* @__PURE__ */ q(h, {
|
|
2734
2738
|
type: "button",
|
|
2735
2739
|
variant: "outline",
|
|
2736
2740
|
size: "sm",
|
|
2737
2741
|
onClick: () => s(!o),
|
|
2738
|
-
children: /* @__PURE__ */ q(
|
|
2742
|
+
children: /* @__PURE__ */ q(U, { className: "w-4 h-4" })
|
|
2739
2743
|
})] })]
|
|
2740
2744
|
}),
|
|
2741
2745
|
o && t && /* @__PURE__ */ q("div", {
|
|
@@ -2774,7 +2778,7 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2774
2778
|
console.log("View detail:", e);
|
|
2775
2779
|
};
|
|
2776
2780
|
return r ? /* @__PURE__ */ J("div", {
|
|
2777
|
-
className:
|
|
2781
|
+
className: N("space-y-2", i),
|
|
2778
2782
|
children: [o.length === 0 ? /* @__PURE__ */ q("span", {
|
|
2779
2783
|
className: "text-sm text-muted-foreground",
|
|
2780
2784
|
children: "No related records"
|
|
@@ -2788,7 +2792,7 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2788
2792
|
variant: "ghost",
|
|
2789
2793
|
size: "sm",
|
|
2790
2794
|
onClick: () => u(e),
|
|
2791
|
-
children: /* @__PURE__ */ q(
|
|
2795
|
+
children: /* @__PURE__ */ q(R, { className: "w-4 h-4" })
|
|
2792
2796
|
})]
|
|
2793
2797
|
}, e.id)), /* @__PURE__ */ J("p", {
|
|
2794
2798
|
className: "text-xs text-muted-foreground",
|
|
@@ -2799,7 +2803,7 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2799
2803
|
]
|
|
2800
2804
|
})]
|
|
2801
2805
|
}) : /* @__PURE__ */ J("div", {
|
|
2802
|
-
className:
|
|
2806
|
+
className: N("space-y-3", i),
|
|
2803
2807
|
children: [/* @__PURE__ */ J("div", {
|
|
2804
2808
|
className: "space-y-2",
|
|
2805
2809
|
children: [o.map((e) => /* @__PURE__ */ J("div", {
|
|
@@ -2820,14 +2824,14 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2820
2824
|
variant: "ghost",
|
|
2821
2825
|
size: "sm",
|
|
2822
2826
|
onClick: () => u(e),
|
|
2823
|
-
children: /* @__PURE__ */ q(
|
|
2827
|
+
children: /* @__PURE__ */ q(R, { className: "w-4 h-4" })
|
|
2824
2828
|
}), /* @__PURE__ */ q(h, {
|
|
2825
2829
|
type: "button",
|
|
2826
2830
|
variant: "ghost",
|
|
2827
2831
|
size: "sm",
|
|
2828
2832
|
onClick: () => l(e.id),
|
|
2829
2833
|
disabled: a.disabled,
|
|
2830
|
-
children: /* @__PURE__ */ q(
|
|
2834
|
+
children: /* @__PURE__ */ q(ke, { className: "w-4 h-4" })
|
|
2831
2835
|
})]
|
|
2832
2836
|
})]
|
|
2833
2837
|
}, e.id)), o.length === 0 && /* @__PURE__ */ q("div", {
|
|
@@ -2841,7 +2845,7 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2841
2845
|
onClick: c,
|
|
2842
2846
|
disabled: a.disabled,
|
|
2843
2847
|
children: [
|
|
2844
|
-
/* @__PURE__ */ q(
|
|
2848
|
+
/* @__PURE__ */ q(we, { className: "w-4 h-4 mr-2" }),
|
|
2845
2849
|
"Add ",
|
|
2846
2850
|
s?.label || "Record"
|
|
2847
2851
|
]
|
|
@@ -2880,7 +2884,7 @@ function sr(e) {
|
|
|
2880
2884
|
return t && n || t && r || n && r;
|
|
2881
2885
|
}
|
|
2882
2886
|
function cr(t, n) {
|
|
2883
|
-
let r = e.useContext(
|
|
2887
|
+
let r = e.useContext(Ae)?.dataSource, [, i] = e.useState(0), a = !!t && !!r && typeof r.find == "function" && (typeof n == "string" || typeof n == "number") && n !== "", o = a ? `${t}:${String(n)}` : "";
|
|
2884
2888
|
if (e.useEffect(() => {
|
|
2885
2889
|
if (!a) return;
|
|
2886
2890
|
let e = ar.get(o);
|
|
@@ -2922,7 +2926,7 @@ function cr(t, n) {
|
|
|
2922
2926
|
}
|
|
2923
2927
|
function lr() {
|
|
2924
2928
|
try {
|
|
2925
|
-
let { t: e } =
|
|
2929
|
+
let { t: e } = K();
|
|
2926
2930
|
return (t, n) => {
|
|
2927
2931
|
let r = e(t);
|
|
2928
2932
|
return !r || r === t ? n : r;
|
|
@@ -2947,17 +2951,29 @@ function Q(e) {
|
|
|
2947
2951
|
}
|
|
2948
2952
|
return String(e);
|
|
2949
2953
|
}
|
|
2950
|
-
function ur(e, t
|
|
2954
|
+
function ur(e, t) {
|
|
2955
|
+
let n = Number.isFinite(e) && e === Math.trunc(e) ? 0 : 2;
|
|
2956
|
+
if (!t) return fr(e, n);
|
|
2951
2957
|
try {
|
|
2952
2958
|
return new Intl.NumberFormat("en-US", {
|
|
2953
2959
|
style: "currency",
|
|
2954
|
-
currency: t
|
|
2960
|
+
currency: t,
|
|
2961
|
+
minimumFractionDigits: 0,
|
|
2962
|
+
maximumFractionDigits: n
|
|
2955
2963
|
}).format(e);
|
|
2956
2964
|
} catch {
|
|
2957
|
-
return `${t} ${e.toFixed(
|
|
2965
|
+
return `${t} ${e.toFixed(n)}`;
|
|
2958
2966
|
}
|
|
2959
2967
|
}
|
|
2960
|
-
function dr(e, t
|
|
2968
|
+
function dr(e, t) {
|
|
2969
|
+
if (!t) try {
|
|
2970
|
+
return new Intl.NumberFormat("en-US", {
|
|
2971
|
+
notation: "compact",
|
|
2972
|
+
maximumFractionDigits: 1
|
|
2973
|
+
}).format(e).replace(/\.0(?=[KMBT])/, "");
|
|
2974
|
+
} catch {
|
|
2975
|
+
return String(e);
|
|
2976
|
+
}
|
|
2961
2977
|
try {
|
|
2962
2978
|
return new Intl.NumberFormat("en-US", {
|
|
2963
2979
|
style: "currency",
|
|
@@ -3002,8 +3018,12 @@ function hr(e) {
|
|
|
3002
3018
|
function gr(e, t) {
|
|
3003
3019
|
if (e == null || e === "") return "—";
|
|
3004
3020
|
let n = e instanceof Date ? e : new Date(e);
|
|
3005
|
-
|
|
3006
|
-
|
|
3021
|
+
if (!(n instanceof Date) || isNaN(n.getTime())) return "—";
|
|
3022
|
+
if (t === "short") return `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}`;
|
|
3023
|
+
if (t === "relative") return hr(n);
|
|
3024
|
+
let r = n.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
3025
|
+
return n.toLocaleDateString(void 0, {
|
|
3026
|
+
year: r ? void 0 : "numeric",
|
|
3007
3027
|
month: "short",
|
|
3008
3028
|
day: "numeric"
|
|
3009
3029
|
});
|
|
@@ -3039,10 +3059,10 @@ function yr({ value: e, field: t }) {
|
|
|
3039
3059
|
}
|
|
3040
3060
|
function br({ value: e, field: t }) {
|
|
3041
3061
|
if (e == null) return /* @__PURE__ */ q(S, {});
|
|
3042
|
-
let n = Q(e), r = t, i = r.currency || r.defaultCurrency ||
|
|
3062
|
+
let n = Q(e), r = t, i = r.currency || r.defaultCurrency || r.currencyConfig?.defaultCurrency || void 0, a = Number(n);
|
|
3043
3063
|
return /* @__PURE__ */ q("span", {
|
|
3044
3064
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
3045
|
-
children:
|
|
3065
|
+
children: isNaN(a) ? String(n) : ur(a, i)
|
|
3046
3066
|
});
|
|
3047
3067
|
}
|
|
3048
3068
|
var xr = /progress|completion/;
|
|
@@ -3093,7 +3113,7 @@ function wr({ value: e, field: t }) {
|
|
|
3093
3113
|
role: "img",
|
|
3094
3114
|
"aria-label": "Completed",
|
|
3095
3115
|
"data-testid": "completion-indicator",
|
|
3096
|
-
children: /* @__PURE__ */ q(
|
|
3116
|
+
children: /* @__PURE__ */ q(F, { className: "size-3 text-white" })
|
|
3097
3117
|
}) : /* @__PURE__ */ q("div", {
|
|
3098
3118
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
3099
3119
|
role: "img",
|
|
@@ -3295,7 +3315,7 @@ function Ir({ value: e, field: t }) {
|
|
|
3295
3315
|
return i === "dot" ? /* @__PURE__ */ J("span", {
|
|
3296
3316
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
3297
3317
|
children: [/* @__PURE__ */ q("span", {
|
|
3298
|
-
className:
|
|
3318
|
+
className: N("h-1.5 w-1.5 rounded-full shrink-0", kr[n?.color || Dr[String(e).toLowerCase().replace(/[\s-]/g, "_")] || jr(String(e).toLowerCase().replace(/[\s-]/g, "_"))] || kr.gray),
|
|
3299
3319
|
"aria-hidden": "true"
|
|
3300
3320
|
}), /* @__PURE__ */ q("span", {
|
|
3301
3321
|
className: "truncate",
|
|
@@ -3308,7 +3328,7 @@ function Ir({ value: e, field: t }) {
|
|
|
3308
3328
|
}, t);
|
|
3309
3329
|
};
|
|
3310
3330
|
return Array.isArray(e) ? /* @__PURE__ */ q("div", {
|
|
3311
|
-
className:
|
|
3331
|
+
className: N("flex flex-wrap", i === "dot" ? "gap-x-3 gap-y-1" : "gap-1"),
|
|
3312
3332
|
children: e.map((e, t) => o(e, t))
|
|
3313
3333
|
}) : o(e);
|
|
3314
3334
|
}
|
|
@@ -3335,7 +3355,7 @@ function Lr({ value: t }) {
|
|
|
3335
3355
|
}).catch(() => {});
|
|
3336
3356
|
},
|
|
3337
3357
|
"aria-label": n("detail.copyEmail", "Copy email"),
|
|
3338
|
-
children: i ? /* @__PURE__ */ q(
|
|
3358
|
+
children: i ? /* @__PURE__ */ q(F, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(I, { className: "h-3 w-3 text-muted-foreground" })
|
|
3339
3359
|
})]
|
|
3340
3360
|
});
|
|
3341
3361
|
}
|
|
@@ -3364,7 +3384,7 @@ function zr({ value: t }) {
|
|
|
3364
3384
|
href: `tel:${r}`,
|
|
3365
3385
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
3366
3386
|
onClick: (e) => e.stopPropagation(),
|
|
3367
|
-
children: [/* @__PURE__ */ q(
|
|
3387
|
+
children: [/* @__PURE__ */ q(Ce, { className: "h-3 w-3" }), r]
|
|
3368
3388
|
}), /* @__PURE__ */ q("button", {
|
|
3369
3389
|
type: "button",
|
|
3370
3390
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
@@ -3374,7 +3394,7 @@ function zr({ value: t }) {
|
|
|
3374
3394
|
}).catch(() => {});
|
|
3375
3395
|
},
|
|
3376
3396
|
"aria-label": n("detail.copyPhone", "Copy phone number"),
|
|
3377
|
-
children: i ? /* @__PURE__ */ q(
|
|
3397
|
+
children: i ? /* @__PURE__ */ q(F, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(I, { className: "h-3 w-3 text-muted-foreground" })
|
|
3378
3398
|
})]
|
|
3379
3399
|
});
|
|
3380
3400
|
}
|
|
@@ -3455,7 +3475,7 @@ function Hr({ value: e, field: t }) {
|
|
|
3455
3475
|
n = t.text, r = t.muted;
|
|
3456
3476
|
}
|
|
3457
3477
|
return /* @__PURE__ */ q("span", {
|
|
3458
|
-
className:
|
|
3478
|
+
className: N("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium", r ? "bg-muted/40 text-muted-foreground" : "bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200"),
|
|
3459
3479
|
children: n
|
|
3460
3480
|
}, t);
|
|
3461
3481
|
})
|
|
@@ -3466,7 +3486,7 @@ function Hr({ value: e, field: t }) {
|
|
|
3466
3486
|
});
|
|
3467
3487
|
let { text: s, muted: c } = o(e);
|
|
3468
3488
|
return /* @__PURE__ */ q("span", {
|
|
3469
|
-
className:
|
|
3489
|
+
className: N("truncate", c && "text-muted-foreground"),
|
|
3470
3490
|
children: s
|
|
3471
3491
|
});
|
|
3472
3492
|
}
|