@object-ui/fields 14.0.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +173 -0
- package/README.md +11 -0
- package/dist/__tests__/lookupCellDisplayField.test.d.ts +0 -0
- package/dist/__tests__/lookupCellDisplayName.test.d.ts +0 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +20 -8
- package/dist/index.js +1222 -1033
- package/dist/widgets/FileField.d.ts +22 -0
- package/dist/widgets/GridField.d.ts +6 -2
- package/dist/widgets/SelectField.d.ts +1 -1
- package/package.json +7 -7
- package/src/__tests__/DateCellRenderer.test.tsx +27 -4
- package/src/__tests__/lookupCellDisplayField.test.tsx +107 -0
- package/src/__tests__/lookupCellDisplayName.test.tsx +119 -0
- package/src/index.tsx +219 -39
- package/src/standard-widgets.test.tsx +35 -0
- package/src/widgets/CurrencyField.tsx +5 -0
- package/src/widgets/FileField.tsx +170 -28
- package/src/widgets/GridField.test.tsx +84 -1
- package/src/widgets/GridField.tsx +32 -2
- package/src/widgets/LookupField.tsx +12 -2
- package/src/widgets/NumberField.tsx +14 -2
- package/src/widgets/PeoplePicker.test.tsx +6 -0
- package/src/widgets/PeoplePicker.tsx +11 -2
- package/src/widgets/SelectField.cascade.test.tsx +3 -3
- package/src/widgets/SelectField.tsx +1 -1
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, getRecordDisplayName as d, isOptionGroupGated as f, isValueStillOffered as p, percentDisplayValue as m, resolveDependsOnFields as h, resolveFieldRuleState as g, resolveVisibleOptions as _ } from "@object-ui/core";
|
|
3
3
|
import { createSafeTranslation as v, resolveFieldCurrency as y, useLocalization as b } from "@object-ui/i18n";
|
|
4
|
-
import { Avatar as x, AvatarFallback as S, AvatarImage as C, Badge as w, Button as T, Checkbox as E, Combobox as D, Dialog as O, DialogContent as k, DialogDescription as A, DialogFooter as j, DialogHeader as M, DialogTitle as N, EmptyValue as P, FilterBuilder as ee, Input as F, Label as I, Popover as te, PopoverContent as ne, PopoverTrigger as re, RadioGroup as L, RadioGroupItem as
|
|
5
|
-
import { AlertCircle as
|
|
4
|
+
import { Avatar as x, AvatarFallback as S, AvatarImage as C, Badge as w, Button as T, Checkbox as E, Combobox as D, Dialog as O, DialogContent as k, DialogDescription as A, DialogFooter as j, DialogHeader as M, DialogTitle as N, EmptyValue as P, FilterBuilder as ee, Input as F, Label as I, Popover as te, PopoverContent as ne, PopoverTrigger as re, RadioGroup as L, RadioGroupItem as ie, ScrollArea as ae, Select as oe, SelectContent as R, SelectItem as se, SelectTrigger as ce, SelectValue as le, Sheet as ue, SheetContent as de, SheetHeader as fe, SheetTitle as pe, SheetTrigger as me, Skeleton as z, Slider as he, Switch as B, Table as V, TableBody as H, TableCell as ge, TableHead as _e, TableHeader as U, TableRow as W, Textarea as G, cn as K, useIsMobile as q } from "@object-ui/components";
|
|
5
|
+
import { AlertCircle as ve, ArrowDown as ye, ArrowUp as be, ArrowUpDown as xe, Camera as Se, Check as Ce, ChevronLeft as we, ChevronRight as Te, Copy as Ee, Crop as De, Crosshair as Oe, Eraser as ke, ExternalLink as Ae, Eye as je, EyeOff as Me, File as Ne, GripVertical as Pe, Image as Fe, ImageIcon as Ie, Loader2 as Le, MapPin as J, Maximize2 as Re, Phone as ze, Plus as Be, QrCode as Ve, RotateCw as He, Search as Ue, SlidersHorizontal as We, Star as Ge, TableProperties as Ke, Trash2 as qe, Upload as Je, X as Ye } from "lucide-react";
|
|
6
6
|
import { SchemaRendererContext as Xe, useAction as Ze, useHasActionProvider as Qe, useObjectTranslation as $e, usePredicateScope as et } from "@object-ui/react";
|
|
7
7
|
import { Fragment as tt, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
8
8
|
import { useUpload as nt } from "@object-ui/providers";
|
|
@@ -32,7 +32,7 @@ function ct({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
32
32
|
children: e || /* @__PURE__ */ Y(P, {})
|
|
33
33
|
});
|
|
34
34
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
35
|
-
return o && o > 1 ? /* @__PURE__ */ Y(
|
|
35
|
+
return o && o > 1 ? /* @__PURE__ */ Y(G, {
|
|
36
36
|
...c,
|
|
37
37
|
value: e || "",
|
|
38
38
|
onChange: (e) => t(e.target.value),
|
|
@@ -53,9 +53,9 @@ function dt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
53
53
|
className: "text-sm",
|
|
54
54
|
children: e
|
|
55
55
|
});
|
|
56
|
-
let a = n || i.schema, o = a?.scale, { inputType:
|
|
56
|
+
let a = n || i.schema, o = a?.scale, s = typeof a?.step == "number" ? a.step : typeof o == "number" ? 10 ** -o : "any", { inputType: c, ...l } = i;
|
|
57
57
|
return /* @__PURE__ */ Y(F, {
|
|
58
|
-
...
|
|
58
|
+
...l,
|
|
59
59
|
type: "number",
|
|
60
60
|
value: e ?? "",
|
|
61
61
|
onChange: (e) => {
|
|
@@ -63,8 +63,10 @@ function dt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
63
63
|
t(n === "" ? null : Number(n));
|
|
64
64
|
},
|
|
65
65
|
placeholder: a?.placeholder,
|
|
66
|
-
disabled: r ||
|
|
67
|
-
|
|
66
|
+
disabled: r || l.disabled,
|
|
67
|
+
min: typeof a?.min == "number" ? a.min : void 0,
|
|
68
|
+
max: typeof a?.max == "number" ? a.max : void 0,
|
|
69
|
+
step: s
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
var ft = Z((() => {})), pt = /* @__PURE__ */ Q({ BooleanField: () => mt });
|
|
@@ -90,7 +92,7 @@ function mt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
90
92
|
})]
|
|
91
93
|
}) : /* @__PURE__ */ X("div", {
|
|
92
94
|
className: "flex items-center space-x-2",
|
|
93
|
-
children: [/* @__PURE__ */ Y(
|
|
95
|
+
children: [/* @__PURE__ */ Y(B, {
|
|
94
96
|
...f,
|
|
95
97
|
id: l,
|
|
96
98
|
checked: !!e,
|
|
@@ -173,19 +175,19 @@ function bt({ value: e, onChange: t, field: n, readonly: r, schema: o, dependent
|
|
|
173
175
|
children: e
|
|
174
176
|
});
|
|
175
177
|
}
|
|
176
|
-
return /* @__PURE__ */ X(
|
|
178
|
+
return /* @__PURE__ */ X(oe, {
|
|
177
179
|
...m,
|
|
178
180
|
value: e,
|
|
179
181
|
onValueChange: t,
|
|
180
182
|
disabled: r || m.disabled,
|
|
181
|
-
children: [/* @__PURE__ */ Y(
|
|
183
|
+
children: [/* @__PURE__ */ Y(ce, {
|
|
182
184
|
className: m.className,
|
|
183
185
|
id: m.id,
|
|
184
186
|
"data-testid": b ? `select-trigger-${b}` : void 0,
|
|
185
|
-
children: /* @__PURE__ */ Y(
|
|
186
|
-
}), /* @__PURE__ */ Y(
|
|
187
|
+
children: /* @__PURE__ */ Y(le, { placeholder: g?.placeholder || y("common.selectOption") })
|
|
188
|
+
}), /* @__PURE__ */ Y(R, {
|
|
187
189
|
position: "popper",
|
|
188
|
-
children: D.map((e) => /* @__PURE__ */ Y(
|
|
190
|
+
children: D.map((e) => /* @__PURE__ */ Y(se, {
|
|
189
191
|
value: e.value,
|
|
190
192
|
"data-testid": `select-option-${e.value}`,
|
|
191
193
|
children: e.label
|
|
@@ -332,6 +334,8 @@ function zt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
332
334
|
placeholder: s?.placeholder || "0.00",
|
|
333
335
|
disabled: r || o.disabled,
|
|
334
336
|
className: `${f ? "pl-8" : ""} ${a || ""}`,
|
|
337
|
+
min: typeof s?.min == "number" ? s.min : void 0,
|
|
338
|
+
max: typeof s?.max == "number" ? s.max : void 0,
|
|
335
339
|
step: (10 ** -u).toFixed(u),
|
|
336
340
|
"aria-invalid": !!i
|
|
337
341
|
})]
|
|
@@ -353,7 +357,7 @@ function Ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
353
357
|
return /* @__PURE__ */ X("div", {
|
|
354
358
|
className: "relative",
|
|
355
359
|
children: [
|
|
356
|
-
/* @__PURE__ */ Y(
|
|
360
|
+
/* @__PURE__ */ Y(G, {
|
|
357
361
|
...b,
|
|
358
362
|
value: e || "",
|
|
359
363
|
onChange: (e) => t(e.target.value),
|
|
@@ -398,7 +402,7 @@ function Ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
398
402
|
}),
|
|
399
403
|
/* @__PURE__ */ Y("div", {
|
|
400
404
|
className: "flex-1 min-h-0 p-4",
|
|
401
|
-
children: /* @__PURE__ */ Y(
|
|
405
|
+
children: /* @__PURE__ */ Y(G, {
|
|
402
406
|
autoFocus: !0,
|
|
403
407
|
value: p,
|
|
404
408
|
onChange: (e) => m(e.target.value),
|
|
@@ -428,7 +432,7 @@ function Ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
428
432
|
type: "button",
|
|
429
433
|
onClick: _,
|
|
430
434
|
"data-testid": "textarea-fullscreen-save",
|
|
431
|
-
children: [/* @__PURE__ */ Y(
|
|
435
|
+
children: [/* @__PURE__ */ Y(Ce, { className: "size-4 mr-1" }), " Done"]
|
|
432
436
|
})]
|
|
433
437
|
})]
|
|
434
438
|
})
|
|
@@ -457,7 +461,7 @@ function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
457
461
|
className: "italic",
|
|
458
462
|
children: o("fields.richText.basicEditorHint", { defaultValue: "Rich text editor (basic)" })
|
|
459
463
|
})]
|
|
460
|
-
}), /* @__PURE__ */ Y(
|
|
464
|
+
}), /* @__PURE__ */ Y(G, {
|
|
461
465
|
value: e || "",
|
|
462
466
|
onChange: (e) => t(e.target.value),
|
|
463
467
|
placeholder: s?.placeholder || o("fields.richText.placeholder", { defaultValue: "Enter text..." }),
|
|
@@ -606,10 +610,10 @@ function Qt(e, t) {
|
|
|
606
610
|
return n;
|
|
607
611
|
}
|
|
608
612
|
function $t({ 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: h = en, value: g, onSelect: _, onSelectRecords: v, lookupFilters: y, baseFilter: b, cellRenderer: x, filterColumns: S, renderFilterBar: C, renderGrid: w }) {
|
|
609
|
-
let { t: D } = _t(), [A, P] = l(/* @__PURE__ */ new Set()), ee = c(/* @__PURE__ */ new Map()), [te, ne] = l(-1), re = c(null), [L,
|
|
613
|
+
let { t: D } = _t(), [A, P] = l(/* @__PURE__ */ new Set()), ee = c(/* @__PURE__ */ new Map()), [te, ne] = l(-1), re = c(null), [L, ie] = l(!1), [ae, ue] = l({}), [de, fe] = l({}), pe = c(null), [me, he] = l(""), B = s(() => d && d.length > 0 ? d.map(Yt) : [{
|
|
610
614
|
field: f,
|
|
611
615
|
label: Xt(f)
|
|
612
|
-
}], [d, f]),
|
|
616
|
+
}], [d, f]), G = s(() => {
|
|
613
617
|
if (S && S.length > 0) return S;
|
|
614
618
|
if (y && y.length > 0) return y.map((e) => {
|
|
615
619
|
let t = "text";
|
|
@@ -632,14 +636,14 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
632
636
|
}) } : {}
|
|
633
637
|
};
|
|
634
638
|
});
|
|
635
|
-
}, [S, y]),
|
|
639
|
+
}, [S, y]), q = qt({
|
|
636
640
|
dataSource: o,
|
|
637
641
|
objectName: u,
|
|
638
642
|
enabled: e,
|
|
639
643
|
pageSize: h,
|
|
640
644
|
paginate: !0,
|
|
641
645
|
filter: s(() => {
|
|
642
|
-
let e = y?.length ? Zt(y) : {}, t =
|
|
646
|
+
let e = y?.length ? Zt(y) : {}, t = G?.length ? Qt(ae, G) : {}, n = {
|
|
643
647
|
...e,
|
|
644
648
|
...t,
|
|
645
649
|
...b ?? {}
|
|
@@ -647,13 +651,13 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
647
651
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
648
652
|
}, [
|
|
649
653
|
y,
|
|
650
|
-
|
|
651
|
-
|
|
654
|
+
G,
|
|
655
|
+
ae,
|
|
652
656
|
b
|
|
653
657
|
])
|
|
654
|
-
}), { records:
|
|
658
|
+
}), { records: Se, loading: Ee, error: De } = q, Oe = q.total, ke = q.totalPages, Ae = q.search, je = q.page, Me = q.sort?.field ?? null, Ne = q.sort?.direction ?? "asc", Pe = q.setPage, Fe = q.toggleSort, Ie = q.setSearch;
|
|
655
659
|
a(() => {
|
|
656
|
-
e || (ne(-1),
|
|
660
|
+
e || (ne(-1), ie(!1), ue({}), fe({}), he(""), P(new Set(i && Array.isArray(g) ? g : [])), ee.current.clear());
|
|
657
661
|
}, [e]), a(() => {
|
|
658
662
|
e && i && P(new Set(Array.isArray(g) ? g : []));
|
|
659
663
|
}, [
|
|
@@ -662,24 +666,24 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
662
666
|
g
|
|
663
667
|
]), a(() => {
|
|
664
668
|
ne(-1);
|
|
665
|
-
}, [
|
|
666
|
-
let
|
|
667
|
-
let t =
|
|
669
|
+
}, [Se]);
|
|
670
|
+
let J = r((e) => e[m] ?? e.id ?? e._id, [m]), Re = r((e) => {
|
|
671
|
+
let t = J(e);
|
|
668
672
|
return i ? A.has(t) : g === t;
|
|
669
673
|
}, [
|
|
670
674
|
i,
|
|
671
675
|
g,
|
|
672
676
|
A,
|
|
673
|
-
|
|
677
|
+
J
|
|
674
678
|
]), ze = r((e) => {
|
|
675
|
-
let n =
|
|
679
|
+
let n = J(e);
|
|
676
680
|
i ? P((t) => {
|
|
677
681
|
let r = new Set(t);
|
|
678
682
|
return r.has(n) ? (r.delete(n), ee.current.delete(n)) : (r.add(n), ee.current.set(n, e)), r;
|
|
679
683
|
}) : (_(n), v?.([e]), t(!1));
|
|
680
684
|
}, [
|
|
681
685
|
i,
|
|
682
|
-
|
|
686
|
+
J,
|
|
683
687
|
_,
|
|
684
688
|
v,
|
|
685
689
|
t
|
|
@@ -694,21 +698,21 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
694
698
|
v,
|
|
695
699
|
t
|
|
696
700
|
]), Ve = r(() => {
|
|
697
|
-
|
|
698
|
-
}, [
|
|
699
|
-
|
|
701
|
+
Pe(Math.max(1, je - 1));
|
|
702
|
+
}, [Pe, je]), He = r(() => {
|
|
703
|
+
Pe(Math.min(ke, je + 1));
|
|
700
704
|
}, [
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
705
|
+
Pe,
|
|
706
|
+
je,
|
|
707
|
+
ke
|
|
704
708
|
]), Ge = r((e) => {
|
|
705
709
|
if (e.key !== "Enter") return;
|
|
706
|
-
let t = parseInt(
|
|
707
|
-
!isNaN(t) && t >= 1 && t <=
|
|
708
|
-
}, [
|
|
709
|
-
|
|
710
|
+
let t = parseInt(me, 10);
|
|
711
|
+
!isNaN(t) && t >= 1 && t <= ke && Pe(t), he("");
|
|
712
|
+
}, [me, ke]), Ke = r((e) => {
|
|
713
|
+
Se.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), ne((e) => Math.min(e + 1, Se.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), ne((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), te >= 0 && te < Se.length && ze(Se[te])));
|
|
710
714
|
}, [
|
|
711
|
-
|
|
715
|
+
Se,
|
|
712
716
|
te,
|
|
713
717
|
ze
|
|
714
718
|
]);
|
|
@@ -745,45 +749,45 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
745
749
|
x,
|
|
746
750
|
p,
|
|
747
751
|
f
|
|
748
|
-
]), Je = r((e) =>
|
|
749
|
-
e.preventDefault(), e.stopPropagation(),
|
|
752
|
+
]), Je = r((e) => Me === e ? Y(Ne === "asc" ? be : ye, { className: "ml-1 size-3" }) : /* @__PURE__ */ Y(xe, { className: "ml-1 size-3 opacity-40" }), [Me, Ne]), Xe = r((e, t, n) => {
|
|
753
|
+
e.preventDefault(), e.stopPropagation(), pe.current = {
|
|
750
754
|
field: t,
|
|
751
755
|
startX: e.clientX,
|
|
752
756
|
startWidth: n
|
|
753
757
|
};
|
|
754
758
|
let r = (e) => {
|
|
755
|
-
if (!
|
|
756
|
-
let t = e.clientX -
|
|
757
|
-
|
|
759
|
+
if (!pe.current) return;
|
|
760
|
+
let t = e.clientX - pe.current.startX, n = Math.max(tn, pe.current.startWidth + t);
|
|
761
|
+
fe((e) => ({
|
|
758
762
|
...e,
|
|
759
|
-
[
|
|
763
|
+
[pe.current.field]: n
|
|
760
764
|
}));
|
|
761
765
|
}, i = () => {
|
|
762
|
-
|
|
766
|
+
pe.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
763
767
|
};
|
|
764
768
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
765
769
|
}, []), Ze = r((e, t) => {
|
|
766
|
-
|
|
770
|
+
ue((n) => ({
|
|
767
771
|
...n,
|
|
768
772
|
[e]: t
|
|
769
|
-
})),
|
|
773
|
+
})), Pe(1);
|
|
770
774
|
}, []), Qe = r(() => {
|
|
771
|
-
|
|
772
|
-
}, []), $e = s(() => Object.values(
|
|
773
|
-
let t =
|
|
775
|
+
ue({}), Pe(1);
|
|
776
|
+
}, []), $e = s(() => Object.values(ae).filter((e) => e != null && e !== "").length, [ae]), et = r((e) => {
|
|
777
|
+
let t = ae[e.field], n = e.label || Xt(e.field);
|
|
774
778
|
switch (e.type) {
|
|
775
779
|
case "select": return /* @__PURE__ */ X("div", {
|
|
776
780
|
className: "space-y-1",
|
|
777
781
|
children: [/* @__PURE__ */ Y(I, {
|
|
778
782
|
className: "text-xs text-muted-foreground",
|
|
779
783
|
children: n
|
|
780
|
-
}), /* @__PURE__ */ X(
|
|
784
|
+
}), /* @__PURE__ */ X(oe, {
|
|
781
785
|
value: t == null ? "" : String(t),
|
|
782
786
|
onValueChange: (t) => Ze(e.field, t),
|
|
783
|
-
children: [/* @__PURE__ */ Y(
|
|
787
|
+
children: [/* @__PURE__ */ Y(ce, {
|
|
784
788
|
className: "h-8 text-xs",
|
|
785
|
-
children: /* @__PURE__ */ Y(
|
|
786
|
-
}), /* @__PURE__ */ Y(
|
|
789
|
+
children: /* @__PURE__ */ Y(le, { placeholder: D("lookup.filterPlaceholder", { label: n }) })
|
|
790
|
+
}), /* @__PURE__ */ Y(R, { children: e.options?.map((e) => /* @__PURE__ */ Y(se, {
|
|
787
791
|
value: String(e.value),
|
|
788
792
|
children: e.label
|
|
789
793
|
}, String(e.value))) })]
|
|
@@ -846,7 +850,7 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
846
850
|
})]
|
|
847
851
|
});
|
|
848
852
|
}
|
|
849
|
-
}, [
|
|
853
|
+
}, [ae, Ze]), nt = r((e, t) => e ? "bg-primary/5 hover:bg-primary/10" : t % 2 == 1 ? "bg-muted/20 hover:bg-accent/30" : "hover:bg-accent/30", []);
|
|
850
854
|
return /* @__PURE__ */ Y(O, {
|
|
851
855
|
open: e,
|
|
852
856
|
onOpenChange: t,
|
|
@@ -864,24 +868,24 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
864
868
|
/* @__PURE__ */ Y(Ue, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
865
869
|
/* @__PURE__ */ Y(F, {
|
|
866
870
|
placeholder: D("table.search"),
|
|
867
|
-
value:
|
|
868
|
-
onChange: (e) =>
|
|
871
|
+
value: Ae,
|
|
872
|
+
onChange: (e) => Ie(e.target.value),
|
|
869
873
|
className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
|
|
870
874
|
"data-testid": "record-picker-search"
|
|
871
875
|
}),
|
|
872
|
-
|
|
876
|
+
Ee && /* @__PURE__ */ Y(Le, {
|
|
873
877
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
874
878
|
"data-testid": "record-picker-loading-indicator"
|
|
875
879
|
})
|
|
876
880
|
]
|
|
877
881
|
}),
|
|
878
|
-
|
|
882
|
+
G && G.length > 0 && /* @__PURE__ */ Y("div", {
|
|
879
883
|
className: "py-2",
|
|
880
884
|
children: C ? /* @__PURE__ */ Y("div", {
|
|
881
885
|
"data-testid": "record-picker-filter-bar",
|
|
882
886
|
children: C({
|
|
883
|
-
filterColumns:
|
|
884
|
-
values:
|
|
887
|
+
filterColumns: G,
|
|
888
|
+
values: ae,
|
|
885
889
|
onChange: Ze,
|
|
886
890
|
onClear: Qe,
|
|
887
891
|
activeCount: $e
|
|
@@ -894,7 +898,7 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
894
898
|
variant: $e > 0 ? "secondary" : "outline",
|
|
895
899
|
size: "sm",
|
|
896
900
|
className: "gap-1.5 shrink-0",
|
|
897
|
-
onClick: () =>
|
|
901
|
+
onClick: () => ie((e) => !e),
|
|
898
902
|
children: [
|
|
899
903
|
/* @__PURE__ */ Y(We, { className: "size-3.5" }),
|
|
900
904
|
D("lookup.filters"),
|
|
@@ -914,22 +918,22 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
914
918
|
}), L && /* @__PURE__ */ Y("div", {
|
|
915
919
|
className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
|
|
916
920
|
"data-testid": "record-picker-filter-panel",
|
|
917
|
-
children:
|
|
921
|
+
children: G.map((e) => /* @__PURE__ */ Y("div", { children: et(e) }, e.field))
|
|
918
922
|
})] })
|
|
919
923
|
}),
|
|
920
|
-
|
|
924
|
+
De && /* @__PURE__ */ X("div", {
|
|
921
925
|
className: "flex flex-col items-center gap-2 py-4",
|
|
922
926
|
role: "alert",
|
|
923
927
|
children: [
|
|
924
|
-
/* @__PURE__ */ Y(
|
|
928
|
+
/* @__PURE__ */ Y(ve, { className: "size-5 text-destructive" }),
|
|
925
929
|
/* @__PURE__ */ Y("p", {
|
|
926
930
|
className: "text-sm text-destructive",
|
|
927
|
-
children:
|
|
931
|
+
children: De
|
|
928
932
|
}),
|
|
929
933
|
/* @__PURE__ */ Y(T, {
|
|
930
934
|
variant: "outline",
|
|
931
935
|
size: "sm",
|
|
932
|
-
onClick: () =>
|
|
936
|
+
onClick: () => q.refetch(),
|
|
933
937
|
type: "button",
|
|
934
938
|
children: D("lookup.retry")
|
|
935
939
|
})
|
|
@@ -939,16 +943,16 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
939
943
|
className: "flex-1 min-h-0",
|
|
940
944
|
"data-testid": "record-picker-grid-slot",
|
|
941
945
|
children: w({
|
|
942
|
-
columns:
|
|
943
|
-
records:
|
|
944
|
-
loading:
|
|
945
|
-
totalCount:
|
|
946
|
-
currentPage:
|
|
946
|
+
columns: B,
|
|
947
|
+
records: Se,
|
|
948
|
+
loading: Ee,
|
|
949
|
+
totalCount: Oe,
|
|
950
|
+
currentPage: je,
|
|
947
951
|
pageSize: h,
|
|
948
|
-
sortField:
|
|
949
|
-
sortDirection:
|
|
950
|
-
onSort:
|
|
951
|
-
onPageChange:
|
|
952
|
+
sortField: Me,
|
|
953
|
+
sortDirection: Ne,
|
|
954
|
+
onSort: Fe,
|
|
955
|
+
onPageChange: Pe,
|
|
952
956
|
onRowClick: ze,
|
|
953
957
|
isSelected: Re,
|
|
954
958
|
multiple: i,
|
|
@@ -956,53 +960,53 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
956
960
|
cellRenderer: x
|
|
957
961
|
})
|
|
958
962
|
}) : /* @__PURE__ */ X(tt, { children: [
|
|
959
|
-
|
|
963
|
+
Ee && Se.length === 0 && !De && /* @__PURE__ */ Y("div", {
|
|
960
964
|
className: "flex-1 overflow-hidden min-h-0 border rounded-md",
|
|
961
965
|
role: "status",
|
|
962
966
|
"aria-live": "polite",
|
|
963
967
|
"data-testid": "record-picker-skeleton",
|
|
964
|
-
children: /* @__PURE__ */ X(
|
|
968
|
+
children: /* @__PURE__ */ X(V, { children: [/* @__PURE__ */ Y(U, { children: /* @__PURE__ */ X(W, {
|
|
965
969
|
className: "bg-muted/40",
|
|
966
|
-
children: [i && /* @__PURE__ */ Y(
|
|
967
|
-
}) }), /* @__PURE__ */ Y(
|
|
970
|
+
children: [i && /* @__PURE__ */ Y(_e, { className: "w-10" }), B.map((e) => /* @__PURE__ */ Y(_e, { children: /* @__PURE__ */ Y(z, { className: "h-4 w-20" }) }, e.field))]
|
|
971
|
+
}) }), /* @__PURE__ */ Y(H, { children: Array.from({ length: nn }, (e, t) => /* @__PURE__ */ X(W, { children: [i && /* @__PURE__ */ Y(ge, {
|
|
968
972
|
className: "w-10",
|
|
969
|
-
children: /* @__PURE__ */ Y(
|
|
970
|
-
}),
|
|
973
|
+
children: /* @__PURE__ */ Y(z, { className: "size-4 rounded" })
|
|
974
|
+
}), B.map((e) => /* @__PURE__ */ Y(ge, { children: /* @__PURE__ */ Y(z, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
971
975
|
}),
|
|
972
|
-
!
|
|
976
|
+
!Ee && !De && Se.length === 0 && /* @__PURE__ */ Y("div", {
|
|
973
977
|
className: "py-8 text-center",
|
|
974
978
|
children: /* @__PURE__ */ Y("p", {
|
|
975
979
|
className: "text-sm text-muted-foreground",
|
|
976
980
|
children: D("lookup.noRecords")
|
|
977
981
|
})
|
|
978
982
|
}),
|
|
979
|
-
!
|
|
983
|
+
!De && Se.length > 0 && /* @__PURE__ */ X("div", {
|
|
980
984
|
className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
|
|
981
|
-
"aria-busy":
|
|
982
|
-
"data-state":
|
|
985
|
+
"aria-busy": Ee || void 0,
|
|
986
|
+
"data-state": Ee ? "loading" : "idle",
|
|
983
987
|
tabIndex: 0,
|
|
984
988
|
onKeyDown: Ke,
|
|
985
989
|
role: "grid",
|
|
986
990
|
"aria-label": "Records",
|
|
987
|
-
children: [
|
|
991
|
+
children: [Ee && /* @__PURE__ */ Y("div", {
|
|
988
992
|
className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
|
|
989
993
|
"data-testid": "record-picker-loading-overlay",
|
|
990
|
-
children: /* @__PURE__ */ Y(
|
|
991
|
-
}), /* @__PURE__ */ X(
|
|
992
|
-
style: Object.keys(
|
|
993
|
-
children: [/* @__PURE__ */ Y(
|
|
994
|
+
children: /* @__PURE__ */ Y(Le, { className: "size-6 animate-spin text-muted-foreground" })
|
|
995
|
+
}), /* @__PURE__ */ X(V, {
|
|
996
|
+
style: Object.keys(de).length > 0 ? { tableLayout: "fixed" } : void 0,
|
|
997
|
+
children: [/* @__PURE__ */ Y(U, {
|
|
994
998
|
className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
|
|
995
999
|
"data-testid": "record-picker-sticky-header",
|
|
996
|
-
children: /* @__PURE__ */ X(
|
|
997
|
-
let t =
|
|
998
|
-
return /* @__PURE__ */ X(
|
|
1000
|
+
children: /* @__PURE__ */ X(W, { children: [i && /* @__PURE__ */ Y(_e, { className: "w-10" }), B.map((e) => {
|
|
1001
|
+
let t = de[e.field];
|
|
1002
|
+
return /* @__PURE__ */ X(_e, {
|
|
999
1003
|
style: t ? {
|
|
1000
1004
|
width: `${t}px`,
|
|
1001
1005
|
minWidth: `${t}px`
|
|
1002
1006
|
} : e.width ? { width: e.width } : void 0,
|
|
1003
1007
|
className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
|
|
1004
|
-
onClick: () =>
|
|
1005
|
-
"aria-sort":
|
|
1008
|
+
onClick: () => Fe(e.field),
|
|
1009
|
+
"aria-sort": Me === e.field ? Ne === "asc" ? "ascending" : "descending" : "none",
|
|
1006
1010
|
children: [/* @__PURE__ */ X("span", {
|
|
1007
1011
|
className: "inline-flex items-center",
|
|
1008
1012
|
children: [e.label || Xt(e.field), Je(e.field)]
|
|
@@ -1019,20 +1023,20 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
1019
1023
|
})]
|
|
1020
1024
|
}, e.field);
|
|
1021
1025
|
})] })
|
|
1022
|
-
}), /* @__PURE__ */ Y(
|
|
1026
|
+
}), /* @__PURE__ */ Y(H, {
|
|
1023
1027
|
ref: re,
|
|
1024
|
-
children:
|
|
1025
|
-
let n =
|
|
1026
|
-
return /* @__PURE__ */ X(
|
|
1028
|
+
children: Se.map((e, t) => {
|
|
1029
|
+
let n = J(e), r = Re(e), a = t === te;
|
|
1030
|
+
return /* @__PURE__ */ X(W, {
|
|
1027
1031
|
"data-row-index": t,
|
|
1028
|
-
className:
|
|
1032
|
+
className: K("cursor-pointer transition-colors", nt(r, t), a && "ring-2 ring-primary ring-inset"),
|
|
1029
1033
|
onClick: () => ze(e),
|
|
1030
1034
|
"data-testid": `record-row-${n}`,
|
|
1031
1035
|
"aria-selected": r,
|
|
1032
|
-
children: [i && /* @__PURE__ */ Y(
|
|
1036
|
+
children: [i && /* @__PURE__ */ Y(ge, {
|
|
1033
1037
|
className: "w-10",
|
|
1034
|
-
children: r && /* @__PURE__ */ Y(
|
|
1035
|
-
}),
|
|
1038
|
+
children: r && /* @__PURE__ */ Y(Ce, { className: "size-4 text-primary" })
|
|
1039
|
+
}), B.map((t) => /* @__PURE__ */ Y(ge, {
|
|
1036
1040
|
className: "py-2.5",
|
|
1037
1041
|
children: qe(e, t)
|
|
1038
1042
|
}, t.field))]
|
|
@@ -1041,13 +1045,13 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
1041
1045
|
})]
|
|
1042
1046
|
})]
|
|
1043
1047
|
}),
|
|
1044
|
-
!
|
|
1048
|
+
!De && Oe > 0 && /* @__PURE__ */ X("div", {
|
|
1045
1049
|
className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
|
|
1046
1050
|
"data-testid": "record-picker-pagination",
|
|
1047
|
-
children: [/* @__PURE__ */ X("span", { children: [
|
|
1048
|
-
current:
|
|
1049
|
-
total:
|
|
1050
|
-
})}`] }),
|
|
1051
|
+
children: [/* @__PURE__ */ X("span", { children: [Oe === 1 ? D("lookup.recordCountOne") : D("lookup.recordCount", { count: Oe }), ke > 1 && ` · ${D("lookup.pageOf", {
|
|
1052
|
+
current: je,
|
|
1053
|
+
total: ke
|
|
1054
|
+
})}`] }), ke > 1 && /* @__PURE__ */ X("div", {
|
|
1051
1055
|
className: "flex items-center gap-1.5",
|
|
1052
1056
|
children: [
|
|
1053
1057
|
/* @__PURE__ */ Y(T, {
|
|
@@ -1055,16 +1059,16 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
1055
1059
|
size: "icon",
|
|
1056
1060
|
className: "size-7",
|
|
1057
1061
|
onClick: Ve,
|
|
1058
|
-
disabled:
|
|
1062
|
+
disabled: je <= 1,
|
|
1059
1063
|
type: "button",
|
|
1060
1064
|
"aria-label": D("lookup.prevPage"),
|
|
1061
|
-
children: /* @__PURE__ */ Y(
|
|
1065
|
+
children: /* @__PURE__ */ Y(we, { className: "size-4" })
|
|
1062
1066
|
}),
|
|
1063
1067
|
/* @__PURE__ */ Y(F, {
|
|
1064
1068
|
className: "h-7 w-12 text-center text-xs px-1",
|
|
1065
|
-
placeholder: String(
|
|
1066
|
-
value:
|
|
1067
|
-
onChange: (e) =>
|
|
1069
|
+
placeholder: String(je),
|
|
1070
|
+
value: me,
|
|
1071
|
+
onChange: (e) => he(e.target.value),
|
|
1068
1072
|
onKeyDown: Ge,
|
|
1069
1073
|
"aria-label": D("lookup.jumpToPage"),
|
|
1070
1074
|
"data-testid": "record-picker-page-jump"
|
|
@@ -1074,10 +1078,10 @@ function $t({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
1074
1078
|
size: "icon",
|
|
1075
1079
|
className: "size-7",
|
|
1076
1080
|
onClick: He,
|
|
1077
|
-
disabled:
|
|
1081
|
+
disabled: je >= ke,
|
|
1078
1082
|
type: "button",
|
|
1079
1083
|
"aria-label": D("lookup.nextPage"),
|
|
1080
|
-
children: /* @__PURE__ */ Y(
|
|
1084
|
+
children: /* @__PURE__ */ Y(Te, { className: "size-4" })
|
|
1081
1085
|
})
|
|
1082
1086
|
]
|
|
1083
1087
|
})]
|
|
@@ -1172,7 +1176,7 @@ function mn({ record: e, displayField: t = "name", subtitleFields: n, avatarFiel
|
|
|
1172
1176
|
"aria-pressed": i,
|
|
1173
1177
|
"data-testid": "person-row",
|
|
1174
1178
|
"data-active": o || void 0,
|
|
1175
|
-
className:
|
|
1179
|
+
className: K("flex w-full items-center gap-3 rounded-md px-2 py-1.5 text-left transition-colors", "hover:bg-accent focus-visible:outline-none", i && "bg-accent", o && "bg-accent ring-1 ring-inset ring-ring", u),
|
|
1176
1180
|
children: [
|
|
1177
1181
|
/* @__PURE__ */ X(x, {
|
|
1178
1182
|
className: "size-9 shrink-0",
|
|
@@ -1200,7 +1204,7 @@ function mn({ record: e, displayField: t = "name", subtitleFields: n, avatarFiel
|
|
|
1200
1204
|
})
|
|
1201
1205
|
})]
|
|
1202
1206
|
}),
|
|
1203
|
-
i && /* @__PURE__ */ Y(
|
|
1207
|
+
i && /* @__PURE__ */ Y(Ce, {
|
|
1204
1208
|
className: "size-4 shrink-0 text-primary",
|
|
1205
1209
|
"aria-hidden": !0
|
|
1206
1210
|
})
|
|
@@ -1215,7 +1219,7 @@ var hn = Z((() => {
|
|
|
1215
1219
|
function gn({ records: e, onRemove: t, displayField: n = "name", avatarField: r = "image", idField: i = "id", label: a, onClear: o, clearLabel: s, emptyText: c, className: l }) {
|
|
1216
1220
|
let u = !!a || !!o && e.length > 0;
|
|
1217
1221
|
return /* @__PURE__ */ X("div", {
|
|
1218
|
-
className:
|
|
1222
|
+
className: K("flex flex-col gap-1.5", l),
|
|
1219
1223
|
"data-testid": "selection-tray",
|
|
1220
1224
|
children: [u && /* @__PURE__ */ X("div", {
|
|
1221
1225
|
className: "flex items-center justify-between",
|
|
@@ -1307,7 +1311,7 @@ var xn, Sn, Cn = Z((() => {
|
|
|
1307
1311
|
//#endregion
|
|
1308
1312
|
//#region src/widgets/PeoplePicker.tsx
|
|
1309
1313
|
function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource: o, objectName: u, displayField: d = "name", idField: f = "id", subtitleFields: p, avatarField: m = "image", expand: h, searchFields: g, pageSize: _ = Tn, lookupFilters: v, baseFilter: y, value: b, onSelect: x, onSelectRecords: S, inline: C = !1, trigger: w }) {
|
|
1310
|
-
let { t: E } = _t(), D =
|
|
1314
|
+
let { t: E } = _t(), D = q(), A = s(() => {
|
|
1311
1315
|
let e = {
|
|
1312
1316
|
...v?.length ? Zt(v) : {},
|
|
1313
1317
|
...y ?? {}
|
|
@@ -1327,40 +1331,40 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1327
1331
|
filter: A,
|
|
1328
1332
|
expand: j,
|
|
1329
1333
|
searchFields: g
|
|
1330
|
-
}), ee = s(() => e ? yn(u) : [], [e, u]), I = s(() => i ? Array.isArray(b) ? b : [] : b != null && b !== "" ? [b] : [], [i, b]), L = s(() => Array.from(new Set([...I, ...ee].map((e) => e))), [I, ee]),
|
|
1334
|
+
}), ee = s(() => e ? yn(u) : [], [e, u]), I = s(() => i ? Array.isArray(b) ? b : [] : b != null && b !== "" ? [b] : [], [i, b]), L = s(() => Array.from(new Set([...I, ...ee].map((e) => e))), [I, ee]), ie = qt({
|
|
1331
1335
|
dataSource: o,
|
|
1332
1336
|
objectName: u,
|
|
1333
1337
|
enabled: e && L.length > 0,
|
|
1334
1338
|
pageSize: Math.max(1, L.length),
|
|
1335
1339
|
filter: { [f]: { $in: L } },
|
|
1336
1340
|
expand: j
|
|
1337
|
-
}),
|
|
1341
|
+
}), oe = s(() => {
|
|
1338
1342
|
let e = /* @__PURE__ */ new Map();
|
|
1339
|
-
for (let t of
|
|
1343
|
+
for (let t of ie.records) e.set(String(un(t, f)), t);
|
|
1340
1344
|
return e;
|
|
1341
|
-
}, [
|
|
1345
|
+
}, [ie.records, f]), [R, se] = l([]), ce = c(!1), le = c(!1);
|
|
1342
1346
|
a(() => {
|
|
1343
|
-
e || (
|
|
1347
|
+
e || (ce.current = !1, le.current = !1, se([]));
|
|
1344
1348
|
}, [e]), a(() => {
|
|
1345
|
-
if (!e ||
|
|
1349
|
+
if (!e || ce.current) return;
|
|
1346
1350
|
if (I.length === 0) {
|
|
1347
|
-
|
|
1351
|
+
ce.current = !0;
|
|
1348
1352
|
return;
|
|
1349
1353
|
}
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1354
|
+
if (ie.loading) {
|
|
1355
|
+
le.current = !0;
|
|
1352
1356
|
return;
|
|
1353
1357
|
}
|
|
1354
|
-
if (!
|
|
1355
|
-
let t = I.map((e) =>
|
|
1356
|
-
|
|
1358
|
+
if (!le.current) return;
|
|
1359
|
+
let t = I.map((e) => oe.get(String(e))).filter(Boolean);
|
|
1360
|
+
se(t), ce.current = !0;
|
|
1357
1361
|
}, [
|
|
1358
1362
|
e,
|
|
1359
1363
|
I,
|
|
1360
|
-
|
|
1361
|
-
|
|
1364
|
+
ie.loading,
|
|
1365
|
+
oe
|
|
1362
1366
|
]);
|
|
1363
|
-
let
|
|
1367
|
+
let he = s(() => new Set(R.map((e) => String(un(e, f)))), [R, f]), B = r((e, n) => {
|
|
1364
1368
|
x(i ? e : e[0] ?? null), S?.(n), e.forEach((e) => bn(u, e)), t(!1);
|
|
1365
1369
|
}, [
|
|
1366
1370
|
i,
|
|
@@ -1368,85 +1372,85 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1368
1372
|
x,
|
|
1369
1373
|
S,
|
|
1370
1374
|
t
|
|
1371
|
-
]),
|
|
1375
|
+
]), V = r((e) => {
|
|
1372
1376
|
x(e.map((e) => un(e, f))), S?.(e);
|
|
1373
1377
|
}, [
|
|
1374
1378
|
x,
|
|
1375
1379
|
S,
|
|
1376
1380
|
f
|
|
1377
|
-
]),
|
|
1381
|
+
]), H = r((e) => {
|
|
1378
1382
|
let t = un(e, f);
|
|
1379
1383
|
if (!i) {
|
|
1380
|
-
|
|
1384
|
+
B([t], [e]);
|
|
1381
1385
|
return;
|
|
1382
1386
|
}
|
|
1383
|
-
let n = String(t), r =
|
|
1384
|
-
|
|
1387
|
+
let n = String(t), r = R.some((e) => String(un(e, f)) === n), a = r ? R.filter((e) => String(un(e, f)) !== n) : [...R, e];
|
|
1388
|
+
se(a), C && (r || bn(u, t), V(a));
|
|
1385
1389
|
}, [
|
|
1386
1390
|
i,
|
|
1387
1391
|
f,
|
|
1388
|
-
|
|
1389
|
-
|
|
1392
|
+
B,
|
|
1393
|
+
R,
|
|
1390
1394
|
C,
|
|
1391
1395
|
u,
|
|
1392
|
-
|
|
1393
|
-
]),
|
|
1394
|
-
let t = String(e), n =
|
|
1395
|
-
|
|
1396
|
+
V
|
|
1397
|
+
]), ge = r((e) => {
|
|
1398
|
+
let t = String(e), n = R.filter((e) => String(un(e, f)) !== t);
|
|
1399
|
+
se(n), C && V(n);
|
|
1396
1400
|
}, [
|
|
1397
1401
|
f,
|
|
1398
|
-
|
|
1402
|
+
R,
|
|
1399
1403
|
C,
|
|
1400
|
-
|
|
1401
|
-
]),
|
|
1402
|
-
|
|
1404
|
+
V
|
|
1405
|
+
]), _e = r(() => {
|
|
1406
|
+
B(R.map((e) => un(e, f)), R);
|
|
1403
1407
|
}, [
|
|
1404
|
-
|
|
1405
|
-
|
|
1408
|
+
B,
|
|
1409
|
+
R,
|
|
1406
1410
|
f
|
|
1407
|
-
]),
|
|
1408
|
-
|
|
1411
|
+
]), U = P.search.trim().length > 0, W = s(() => U ? [] : ee.map((e) => oe.get(String(e))).filter(Boolean), [
|
|
1412
|
+
U,
|
|
1409
1413
|
ee,
|
|
1410
|
-
|
|
1411
|
-
]),
|
|
1412
|
-
if (
|
|
1414
|
+
oe
|
|
1415
|
+
]), G = s(() => {
|
|
1416
|
+
if (U) return P.records;
|
|
1413
1417
|
let e = new Set(ee.map(String));
|
|
1414
1418
|
return P.records.filter((t) => !e.has(String(un(t, f))));
|
|
1415
1419
|
}, [
|
|
1416
|
-
|
|
1420
|
+
U,
|
|
1417
1421
|
P.records,
|
|
1418
1422
|
ee,
|
|
1419
1423
|
f
|
|
1420
|
-
]),
|
|
1424
|
+
]), ye = s(() => [...W, ...G], [W, G]), [be, xe] = l(-1), Se = s(() => P.records.map((e) => String(un(e, f))).join("\0"), [P.records, f]);
|
|
1421
1425
|
a(() => {
|
|
1422
|
-
|
|
1423
|
-
}, [P.search,
|
|
1424
|
-
|
|
1425
|
-
}, [
|
|
1426
|
-
let
|
|
1427
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
1426
|
+
xe(-1);
|
|
1427
|
+
}, [P.search, Se]), a(() => {
|
|
1428
|
+
xe((e) => e >= ye.length ? ye.length - 1 : e);
|
|
1429
|
+
}, [ye.length]);
|
|
1430
|
+
let Ce = r((e) => {
|
|
1431
|
+
e.key === "ArrowDown" ? (e.preventDefault(), xe((e) => ye.length ? Math.min(ye.length - 1, e + 1) : -1)) : e.key === "ArrowUp" ? (e.preventDefault(), xe((e) => Math.max(0, e - 1))) : e.key === "Enter" ? be >= 0 && be < ye.length && (e.preventDefault(), H(ye[be])) : e.key === "Backspace" && P.search.length === 0 && i && R.length > 0 && ge(un(R[R.length - 1], f));
|
|
1428
1432
|
}, [
|
|
1429
|
-
ve,
|
|
1430
1433
|
ye,
|
|
1431
|
-
|
|
1434
|
+
be,
|
|
1435
|
+
H,
|
|
1432
1436
|
P.search,
|
|
1433
1437
|
i,
|
|
1434
|
-
|
|
1435
|
-
|
|
1438
|
+
R,
|
|
1439
|
+
ge,
|
|
1436
1440
|
f
|
|
1437
|
-
]),
|
|
1441
|
+
]), we = P.loading && !P.error && P.records.length === 0 && W.length === 0, Te = P.loading && !we, Ee = !P.loading && !P.error && G.length === 0 && W.length === 0, De = (e, t) => {
|
|
1438
1442
|
let n = un(e, f);
|
|
1439
1443
|
return /* @__PURE__ */ Y(mn, {
|
|
1440
1444
|
record: e,
|
|
1441
1445
|
displayField: d,
|
|
1442
1446
|
subtitleFields: p,
|
|
1443
1447
|
avatarField: m,
|
|
1444
|
-
selected:
|
|
1445
|
-
active: t ===
|
|
1448
|
+
selected: he.has(String(n)),
|
|
1449
|
+
active: t === be,
|
|
1446
1450
|
highlightQuery: P.search,
|
|
1447
|
-
onSelect:
|
|
1451
|
+
onSelect: H
|
|
1448
1452
|
}, String(n));
|
|
1449
|
-
},
|
|
1453
|
+
}, Oe = n || E("lookup.selectRecord"), ke = /* @__PURE__ */ X(tt, { children: [
|
|
1450
1454
|
/* @__PURE__ */ X("div", {
|
|
1451
1455
|
className: "relative",
|
|
1452
1456
|
children: [
|
|
@@ -1458,7 +1462,7 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1458
1462
|
autoFocus: !D,
|
|
1459
1463
|
value: P.search,
|
|
1460
1464
|
onChange: (e) => P.setSearch(e.target.value),
|
|
1461
|
-
onKeyDown:
|
|
1465
|
+
onKeyDown: Ce,
|
|
1462
1466
|
placeholder: E("table.search"),
|
|
1463
1467
|
className: "px-8",
|
|
1464
1468
|
role: "combobox",
|
|
@@ -1466,24 +1470,24 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1466
1470
|
"aria-controls": "people-picker-list",
|
|
1467
1471
|
"data-testid": "people-picker-search"
|
|
1468
1472
|
}),
|
|
1469
|
-
P.loading && /* @__PURE__ */ Y(
|
|
1473
|
+
P.loading && /* @__PURE__ */ Y(Le, {
|
|
1470
1474
|
className: "pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 animate-spin text-muted-foreground",
|
|
1471
1475
|
"aria-hidden": !0
|
|
1472
1476
|
})
|
|
1473
1477
|
]
|
|
1474
1478
|
}),
|
|
1475
|
-
/* @__PURE__ */ Y(
|
|
1479
|
+
/* @__PURE__ */ Y(ae, {
|
|
1476
1480
|
className: "min-h-0 flex-1",
|
|
1477
1481
|
"data-testid": "people-picker-list",
|
|
1478
1482
|
children: /* @__PURE__ */ Y("div", {
|
|
1479
1483
|
id: "people-picker-list",
|
|
1480
1484
|
role: "listbox",
|
|
1481
1485
|
"aria-busy": P.loading,
|
|
1482
|
-
className:
|
|
1486
|
+
className: K("flex flex-col gap-0.5 pr-2 transition-opacity", Te && "opacity-70"),
|
|
1483
1487
|
children: P.error ? /* @__PURE__ */ X("div", {
|
|
1484
1488
|
className: "flex flex-col items-center gap-2 py-8 text-center text-sm text-muted-foreground",
|
|
1485
1489
|
children: [
|
|
1486
|
-
/* @__PURE__ */ Y(
|
|
1490
|
+
/* @__PURE__ */ Y(ve, {
|
|
1487
1491
|
className: "size-5 text-destructive",
|
|
1488
1492
|
"aria-hidden": !0
|
|
1489
1493
|
}),
|
|
@@ -1499,20 +1503,20 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1499
1503
|
children: E("lookup.retry")
|
|
1500
1504
|
})
|
|
1501
1505
|
]
|
|
1502
|
-
}) :
|
|
1506
|
+
}) : we ? Array.from({ length: En }).map((e, t) => /* @__PURE__ */ X("div", {
|
|
1503
1507
|
className: "flex items-center gap-3 px-2 py-1.5",
|
|
1504
|
-
children: [/* @__PURE__ */ Y(
|
|
1508
|
+
children: [/* @__PURE__ */ Y(z, { className: "size-9 shrink-0 rounded-full" }), /* @__PURE__ */ X("div", {
|
|
1505
1509
|
className: "flex-1 space-y-1.5",
|
|
1506
|
-
children: [/* @__PURE__ */ Y(
|
|
1510
|
+
children: [/* @__PURE__ */ Y(z, { className: "h-3 w-1/3" }), /* @__PURE__ */ Y(z, { className: "h-2.5 w-1/2" })]
|
|
1507
1511
|
})]
|
|
1508
1512
|
}, t)) : /* @__PURE__ */ X(tt, { children: [
|
|
1509
|
-
|
|
1513
|
+
W.length > 0 && /* @__PURE__ */ X(tt, { children: [
|
|
1510
1514
|
/* @__PURE__ */ Y("div", {
|
|
1511
1515
|
className: "px-2 py-1 text-xs font-medium text-muted-foreground",
|
|
1512
1516
|
children: E("lookup.recentlyUsed")
|
|
1513
1517
|
}),
|
|
1514
|
-
|
|
1515
|
-
|
|
1518
|
+
W.map((e, t) => De(e, t)),
|
|
1519
|
+
G.length > 0 && /* @__PURE__ */ X("div", {
|
|
1516
1520
|
className: "mt-1 flex items-center gap-1.5 px-2 py-1 text-xs font-medium text-muted-foreground",
|
|
1517
1521
|
children: [/* @__PURE__ */ Y("span", { children: E("lookup.allResults") }), /* @__PURE__ */ X("span", {
|
|
1518
1522
|
className: "font-normal opacity-70",
|
|
@@ -1520,8 +1524,8 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1520
1524
|
})]
|
|
1521
1525
|
})
|
|
1522
1526
|
] }),
|
|
1523
|
-
|
|
1524
|
-
|
|
1527
|
+
G.map((e, t) => De(e, W.length + t)),
|
|
1528
|
+
Ee && /* @__PURE__ */ Y("div", {
|
|
1525
1529
|
className: "py-8 text-center text-sm text-muted-foreground",
|
|
1526
1530
|
children: E("lookup.noRecords")
|
|
1527
1531
|
})
|
|
@@ -1529,15 +1533,15 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1529
1533
|
})
|
|
1530
1534
|
}),
|
|
1531
1535
|
i && !C && /* @__PURE__ */ X(tt, { children: [/* @__PURE__ */ Y(gn, {
|
|
1532
|
-
records:
|
|
1533
|
-
onRemove:
|
|
1534
|
-
onClear: () =>
|
|
1536
|
+
records: R,
|
|
1537
|
+
onRemove: ge,
|
|
1538
|
+
onClear: () => se([]),
|
|
1535
1539
|
clearLabel: E("lookup.clear"),
|
|
1536
1540
|
displayField: d,
|
|
1537
1541
|
avatarField: m,
|
|
1538
1542
|
idField: f,
|
|
1539
|
-
label: E("table.selected", { count:
|
|
1540
|
-
className:
|
|
1543
|
+
label: E("table.selected", { count: R.length }),
|
|
1544
|
+
className: K("border-t pt-3")
|
|
1541
1545
|
}), /* @__PURE__ */ X("div", {
|
|
1542
1546
|
className: "flex justify-end gap-2",
|
|
1543
1547
|
children: [/* @__PURE__ */ Y(T, {
|
|
@@ -1547,25 +1551,25 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1547
1551
|
children: E("common.cancel")
|
|
1548
1552
|
}), /* @__PURE__ */ Y(T, {
|
|
1549
1553
|
type: "button",
|
|
1550
|
-
onClick:
|
|
1554
|
+
onClick: _e,
|
|
1551
1555
|
children: E("common.confirm")
|
|
1552
1556
|
})]
|
|
1553
1557
|
})] })
|
|
1554
1558
|
] });
|
|
1555
|
-
return C ? D ? /* @__PURE__ */ X(
|
|
1559
|
+
return C ? D ? /* @__PURE__ */ X(ue, {
|
|
1556
1560
|
open: e,
|
|
1557
1561
|
onOpenChange: t,
|
|
1558
|
-
children: [/* @__PURE__ */ Y(
|
|
1562
|
+
children: [/* @__PURE__ */ Y(me, {
|
|
1559
1563
|
asChild: !0,
|
|
1560
1564
|
children: w
|
|
1561
|
-
}), /* @__PURE__ */ X(
|
|
1565
|
+
}), /* @__PURE__ */ X(de, {
|
|
1562
1566
|
side: "bottom",
|
|
1563
1567
|
className: "flex h-[85vh] flex-col gap-3",
|
|
1564
1568
|
"data-testid": "people-picker-sheet",
|
|
1565
|
-
children: [/* @__PURE__ */ Y(
|
|
1569
|
+
children: [/* @__PURE__ */ Y(fe, {
|
|
1566
1570
|
className: "text-left",
|
|
1567
|
-
children: /* @__PURE__ */ Y(
|
|
1568
|
-
}),
|
|
1571
|
+
children: /* @__PURE__ */ Y(pe, { children: Oe })
|
|
1572
|
+
}), ke]
|
|
1569
1573
|
})]
|
|
1570
1574
|
}) : /* @__PURE__ */ X(te, {
|
|
1571
1575
|
open: e,
|
|
@@ -1577,19 +1581,19 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1577
1581
|
align: "start",
|
|
1578
1582
|
className: "flex max-h-[min(28rem,60vh)] w-[var(--radix-popover-trigger-width)] min-w-72 flex-col gap-3 p-3",
|
|
1579
1583
|
"data-testid": "people-picker-inline",
|
|
1580
|
-
children:
|
|
1584
|
+
children: ke
|
|
1581
1585
|
})]
|
|
1582
|
-
}) : D ? /* @__PURE__ */ Y(
|
|
1586
|
+
}) : D ? /* @__PURE__ */ Y(ue, {
|
|
1583
1587
|
open: e,
|
|
1584
1588
|
onOpenChange: t,
|
|
1585
|
-
children: /* @__PURE__ */ X(
|
|
1589
|
+
children: /* @__PURE__ */ X(de, {
|
|
1586
1590
|
side: "bottom",
|
|
1587
1591
|
className: "flex h-[85vh] flex-col gap-3",
|
|
1588
1592
|
"data-testid": "people-picker-sheet",
|
|
1589
|
-
children: [/* @__PURE__ */ Y(
|
|
1593
|
+
children: [/* @__PURE__ */ Y(fe, {
|
|
1590
1594
|
className: "text-left",
|
|
1591
|
-
children: /* @__PURE__ */ Y(
|
|
1592
|
-
}),
|
|
1595
|
+
children: /* @__PURE__ */ Y(pe, { children: Oe })
|
|
1596
|
+
}), ke]
|
|
1593
1597
|
})
|
|
1594
1598
|
}) : /* @__PURE__ */ Y(O, {
|
|
1595
1599
|
open: e,
|
|
@@ -1597,7 +1601,7 @@ function wn({ open: e, onOpenChange: t, title: n, multiple: i = !1, dataSource:
|
|
|
1597
1601
|
children: /* @__PURE__ */ X(k, {
|
|
1598
1602
|
className: "flex max-h-[80vh] flex-col gap-3 sm:max-w-lg",
|
|
1599
1603
|
"data-testid": "people-picker-dialog",
|
|
1600
|
-
children: [/* @__PURE__ */ Y(M, { children: /* @__PURE__ */ Y(N, { children:
|
|
1604
|
+
children: [/* @__PURE__ */ Y(M, { children: /* @__PURE__ */ Y(N, { children: Oe }) }), ke]
|
|
1601
1605
|
})
|
|
1602
1606
|
});
|
|
1603
1607
|
}
|
|
@@ -1726,7 +1730,7 @@ function Hn(e) {
|
|
|
1726
1730
|
}[e];
|
|
1727
1731
|
}
|
|
1728
1732
|
function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
1729
|
-
let [f, p] = l(!1), { t: m } = _t(), h = e.useId(), [g, _] = l(null), [v, y] = l([]), [b, E] = l(-1), D = c(null), O = o || d.schema, k = O?.field, A = k && typeof k == "object" && ("reference_to" in k || "reference" in k || "type" in k) ? k : O, j = A?.options || [], M = A?.multiple || !1, N = A?.display_field || A?.displayField || A?.reference_field || "name", ee = A?.description_field ?? A?.descriptionField, I = A?.id_field || "id", L = A?.reference_to || A?.reference,
|
|
1733
|
+
let [f, p] = l(!1), { t: m } = _t(), h = e.useId(), [g, _] = l(null), [v, y] = l([]), [b, E] = l(-1), D = c(null), O = o || d.schema, k = O?.field, A = k && typeof k == "object" && ("reference_to" in k || "reference" in k || "type" in k) ? k : O, j = A?.options || [], M = A?.multiple || !1, N = A?.display_field || A?.displayField || A?.reference_field || "name", ee = A?.description_field ?? A?.descriptionField, I = A?.id_field || "id", L = A?.reference_to || A?.reference, ie = A?.allow_create ?? A?.allowCreate, ae = ie == null ? Rn(L) : !!ie, oe = A?.lookup_columns ?? A?.lookupColumns, R = A?.lookup_page_size ?? A?.lookupPageSize, se = A?.lookup_filters ?? A?.lookupFilters, ce = A?.picker, le = A?.subtitle, ue = A?.avatar_field ?? A?.avatarField ?? "image", de = s(() => {
|
|
1730
1734
|
let e = A?.depends_on ?? A?.dependsOn;
|
|
1731
1735
|
return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
|
|
1732
1736
|
field: e,
|
|
@@ -1735,48 +1739,48 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1735
1739
|
field: e.field,
|
|
1736
1740
|
param: e.param ?? e.field
|
|
1737
1741
|
}) : [];
|
|
1738
|
-
}, [A?.depends_on, A?.dependsOn]),
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
]),
|
|
1743
|
-
let t =
|
|
1742
|
+
}, [A?.depends_on, A?.dependsOn]), fe = d.dependentValues, pe = i(Gn), me = pe?.dataSource ?? null, z = d.dataSource ?? O?.dataSource ?? A?.dataSource ?? me, he = s(() => fe || (pe?.formValues ?? pe?.data ?? {}), [
|
|
1743
|
+
fe,
|
|
1744
|
+
pe?.formValues,
|
|
1745
|
+
pe?.data
|
|
1746
|
+
]), B = s(() => de.length !== 0 && de.some(({ field: e }) => {
|
|
1747
|
+
let t = he[e];
|
|
1744
1748
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
1745
|
-
}), [
|
|
1749
|
+
}), [de, he]), V = z != null && typeof z.find == "function" && !!L, [H, ge] = l(null);
|
|
1746
1750
|
a(() => {
|
|
1747
|
-
if (!
|
|
1748
|
-
let e =
|
|
1751
|
+
if (!z || !L) return;
|
|
1752
|
+
let e = z.getObjectSchema;
|
|
1749
1753
|
if (typeof e != "function") return;
|
|
1750
1754
|
let t = !0;
|
|
1751
|
-
return Promise.resolve(e.call(
|
|
1752
|
-
t &&
|
|
1755
|
+
return Promise.resolve(e.call(z, L)).then((e) => {
|
|
1756
|
+
t && ge(e);
|
|
1753
1757
|
}).catch(() => {}), () => {
|
|
1754
1758
|
t = !1;
|
|
1755
1759
|
};
|
|
1756
|
-
}, [
|
|
1757
|
-
let
|
|
1758
|
-
let e =
|
|
1760
|
+
}, [z, L]);
|
|
1761
|
+
let _e = s(() => {
|
|
1762
|
+
let e = H?.titleFormat;
|
|
1759
1763
|
return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
|
|
1760
|
-
}, [
|
|
1761
|
-
if (
|
|
1762
|
-
let e = kn(
|
|
1764
|
+
}, [H]), U = s(() => {
|
|
1765
|
+
if (oe && oe.length > 0) return oe;
|
|
1766
|
+
let e = kn(H, { displayField: N });
|
|
1763
1767
|
return e.length > 0 ? e : void 0;
|
|
1764
1768
|
}, [
|
|
1765
|
-
|
|
1766
|
-
|
|
1769
|
+
oe,
|
|
1770
|
+
H,
|
|
1767
1771
|
N
|
|
1768
|
-
]),
|
|
1772
|
+
]), W = s(() => {
|
|
1769
1773
|
if (ee) return ee;
|
|
1770
|
-
let e =
|
|
1774
|
+
let e = U?.find((e) => (typeof e == "string" ? e : e.field) !== N);
|
|
1771
1775
|
if (e) return typeof e == "string" ? e : e.field;
|
|
1772
1776
|
}, [
|
|
1773
1777
|
ee,
|
|
1774
|
-
|
|
1778
|
+
U,
|
|
1775
1779
|
N
|
|
1776
|
-
]),
|
|
1777
|
-
if (!
|
|
1780
|
+
]), G = s(() => {
|
|
1781
|
+
if (!U) return;
|
|
1778
1782
|
let e = [];
|
|
1779
|
-
for (let t of
|
|
1783
|
+
for (let t of U) if (typeof t == "object" && t.type) {
|
|
1780
1784
|
let n = Hn(t.type);
|
|
1781
1785
|
n && e.push({
|
|
1782
1786
|
field: t.field,
|
|
@@ -1785,66 +1789,66 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1785
1789
|
});
|
|
1786
1790
|
}
|
|
1787
1791
|
return e.length > 0 ? e : void 0;
|
|
1788
|
-
}, [
|
|
1792
|
+
}, [U]), q = d.onCreateNew ?? O?.onCreateNew, [ye, be] = l(!1), xe = s(() => {
|
|
1789
1793
|
let e = {};
|
|
1790
|
-
for (let { field: t, param: n } of
|
|
1791
|
-
let r =
|
|
1794
|
+
for (let { field: t, param: n } of de) {
|
|
1795
|
+
let r = he[t];
|
|
1792
1796
|
r == null || r === "" || (e[n] = typeof r == "number" ? r : String(r));
|
|
1793
1797
|
}
|
|
1794
1798
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1795
|
-
}, [
|
|
1799
|
+
}, [de, he]), Se = s(() => {
|
|
1796
1800
|
let e = {
|
|
1797
|
-
...
|
|
1798
|
-
...
|
|
1801
|
+
...se && se.length > 0 ? Zt(se) : {},
|
|
1802
|
+
...xe ?? {}
|
|
1799
1803
|
};
|
|
1800
1804
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1801
|
-
}, [
|
|
1802
|
-
dataSource:
|
|
1805
|
+
}, [xe, se]), Ce = qt({
|
|
1806
|
+
dataSource: z,
|
|
1803
1807
|
objectName: L,
|
|
1804
|
-
enabled: f &&
|
|
1808
|
+
enabled: f && V && !B,
|
|
1805
1809
|
pageSize: Wn,
|
|
1806
|
-
filter:
|
|
1807
|
-
}),
|
|
1808
|
-
|
|
1810
|
+
filter: Se
|
|
1811
|
+
}), we = Ce.search, Te = Ce.loading, Ee = Ce.total, De = Ce.error ?? g, Oe = s(() => Ce.records.map((e) => Bn(e, N, I, W, _e, H)), [
|
|
1812
|
+
Ce.records,
|
|
1809
1813
|
N,
|
|
1810
1814
|
I,
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
]),
|
|
1815
|
-
if (
|
|
1816
|
-
let e =
|
|
1817
|
-
return
|
|
1815
|
+
W,
|
|
1816
|
+
_e,
|
|
1817
|
+
H
|
|
1818
|
+
]), ke = V ? Oe : j, Ae = s(() => {
|
|
1819
|
+
if (V || !we) return ke;
|
|
1820
|
+
let e = we.toLowerCase();
|
|
1821
|
+
return ke.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
|
|
1818
1822
|
}, [
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1823
|
+
V,
|
|
1824
|
+
ke,
|
|
1825
|
+
we
|
|
1822
1826
|
]);
|
|
1823
1827
|
a(() => {
|
|
1824
1828
|
E(-1);
|
|
1825
|
-
}, [
|
|
1829
|
+
}, [Ae.length]), a(() => {
|
|
1826
1830
|
f || E(-1);
|
|
1827
1831
|
}, [f]);
|
|
1828
|
-
let
|
|
1832
|
+
let je = r((e) => Ce.setSearch(e), [Ce.setSearch]);
|
|
1829
1833
|
a(() => {
|
|
1830
|
-
if (!
|
|
1834
|
+
if (!V || !z || !L) return;
|
|
1831
1835
|
let e = (M ? Array.isArray(t) ? t : [] : t != null && t !== "" ? [t] : []).filter((e) => e != null && e !== "" && typeof e != "object" && !Vn(e));
|
|
1832
1836
|
if (!e.length) return;
|
|
1833
|
-
let n = e.filter((e) => !
|
|
1837
|
+
let n = e.filter((e) => !Me(e));
|
|
1834
1838
|
if (!n.length) return;
|
|
1835
1839
|
let r = !1;
|
|
1836
1840
|
return (async () => {
|
|
1837
1841
|
try {
|
|
1838
1842
|
let e = [];
|
|
1839
|
-
for (let t of n) if (typeof
|
|
1840
|
-
let n = await
|
|
1841
|
-
n && e.push(Bn(n, N, I,
|
|
1843
|
+
for (let t of n) if (typeof z.findOne == "function") {
|
|
1844
|
+
let n = await z.findOne(L, t);
|
|
1845
|
+
n && e.push(Bn(n, N, I, W, _e, H));
|
|
1842
1846
|
} else {
|
|
1843
|
-
let n = await
|
|
1847
|
+
let n = await z.find(L, {
|
|
1844
1848
|
$filter: { [I]: t },
|
|
1845
1849
|
$top: 1
|
|
1846
1850
|
}), r = n?.data ?? n ?? [];
|
|
1847
|
-
r[0] && e.push(Bn(r[0], N, I,
|
|
1851
|
+
r[0] && e.push(Bn(r[0], N, I, W, _e, H));
|
|
1848
1852
|
}
|
|
1849
1853
|
!r && e.length && y((t) => {
|
|
1850
1854
|
let n = new Map(t.map((e) => [e.value, e]));
|
|
@@ -1857,71 +1861,75 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1857
1861
|
};
|
|
1858
1862
|
}, [
|
|
1859
1863
|
t,
|
|
1860
|
-
|
|
1864
|
+
V,
|
|
1861
1865
|
L,
|
|
1862
1866
|
N,
|
|
1863
1867
|
I,
|
|
1864
|
-
|
|
1868
|
+
W,
|
|
1865
1869
|
M
|
|
1866
1870
|
]);
|
|
1867
|
-
let
|
|
1871
|
+
let Me = r((e) => j.find((t) => t.value === e) ?? Oe.find((t) => t.value === e) ?? v.find((t) => t.value === e), [
|
|
1868
1872
|
j,
|
|
1869
|
-
|
|
1873
|
+
Oe,
|
|
1870
1874
|
v
|
|
1871
|
-
]),
|
|
1875
|
+
]), Ne = r((e) => {
|
|
1872
1876
|
let t = String(e);
|
|
1873
|
-
return j.find((e) => String(e.value) === t) ??
|
|
1877
|
+
return j.find((e) => String(e.value) === t) ?? Oe.find((e) => String(e.value) === t) ?? v.find((e) => String(e.value) === t);
|
|
1874
1878
|
}, [
|
|
1875
1879
|
j,
|
|
1876
|
-
|
|
1880
|
+
Oe,
|
|
1877
1881
|
v
|
|
1878
|
-
]),
|
|
1882
|
+
]), Pe = r((e) => {
|
|
1879
1883
|
let t = typeof e == "object" && e ? e : Vn(e);
|
|
1880
1884
|
return t ? t[I] ?? t.id ?? t._id ?? t.externalId : e;
|
|
1881
|
-
}, [I]),
|
|
1885
|
+
}, [I]), Fe = s(() => M ? Array.isArray(t) ? t.map(Pe) : [] : Pe(t), [
|
|
1886
|
+
M,
|
|
1887
|
+
t,
|
|
1888
|
+
Pe
|
|
1889
|
+
]), Ie = r((e) => {
|
|
1882
1890
|
if (e == null || e === "") return;
|
|
1883
1891
|
let t = typeof e == "object" ? e : Vn(e);
|
|
1884
|
-
return t ? Bn(t, N, I,
|
|
1892
|
+
return t ? Bn(t, N, I, W, _e, H) : Me(e) ?? Ne(e);
|
|
1885
1893
|
}, [
|
|
1886
|
-
je,
|
|
1887
1894
|
Me,
|
|
1895
|
+
Ne,
|
|
1888
1896
|
N,
|
|
1889
1897
|
I,
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
]),
|
|
1898
|
+
W,
|
|
1899
|
+
_e,
|
|
1900
|
+
H
|
|
1901
|
+
]), J = M ? (Array.isArray(t) ? t : []).map(Ie).filter(Boolean) : t ? [Ie(t)].filter(Boolean) : [], Re = d.onSelectRecord, ze = r((e) => {
|
|
1894
1902
|
if (e && e.value != null && y((t) => {
|
|
1895
1903
|
let n = new Map(t.map((e) => [e.value, e]));
|
|
1896
1904
|
return n.set(e.value, e), Array.from(n.values());
|
|
1897
1905
|
}), M) {
|
|
1898
|
-
let r = (Array.isArray(t) ? t : []).map(
|
|
1906
|
+
let r = (Array.isArray(t) ? t : []).map(Pe);
|
|
1899
1907
|
r.includes(e.value) ? n(r.filter((t) => t !== e.value)) : (L && bn(L, e.value), n([...r, e.value]));
|
|
1900
|
-
} else L && bn(L, e.value),
|
|
1908
|
+
} else L && bn(L, e.value), Re ? Re(e) : n(e.value), p(!1);
|
|
1901
1909
|
}, [
|
|
1902
1910
|
M,
|
|
1903
1911
|
t,
|
|
1904
1912
|
n,
|
|
1905
|
-
|
|
1913
|
+
Re,
|
|
1906
1914
|
L,
|
|
1907
|
-
|
|
1908
|
-
]),
|
|
1909
|
-
n(M ? (Array.isArray(t) ? t : []).map(
|
|
1910
|
-
},
|
|
1911
|
-
let t = e.map((e) => Bn(e, N, I,
|
|
1915
|
+
Pe
|
|
1916
|
+
]), Ve = (e) => {
|
|
1917
|
+
n(M ? (Array.isArray(t) ? t : []).map(Pe).filter((t) => t !== e) : null);
|
|
1918
|
+
}, He = r((e) => {
|
|
1919
|
+
let t = e.map((e) => Bn(e, N, I, W, _e, H));
|
|
1912
1920
|
L && t.forEach((e) => bn(L, e.value)), y(t);
|
|
1913
1921
|
}, [
|
|
1914
1922
|
N,
|
|
1915
1923
|
I,
|
|
1916
|
-
|
|
1917
|
-
|
|
1924
|
+
W,
|
|
1925
|
+
_e,
|
|
1918
1926
|
L
|
|
1919
|
-
]), [
|
|
1927
|
+
]), [We, Ge] = l([]);
|
|
1920
1928
|
a(() => {
|
|
1921
|
-
if (!f || !
|
|
1929
|
+
if (!f || !V || !z || !L || we) return;
|
|
1922
1930
|
let e = yn(L);
|
|
1923
1931
|
if (!e.length) {
|
|
1924
|
-
|
|
1932
|
+
Ge([]);
|
|
1925
1933
|
return;
|
|
1926
1934
|
}
|
|
1927
1935
|
let t = !1;
|
|
@@ -1929,52 +1937,52 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1929
1937
|
try {
|
|
1930
1938
|
let n = [];
|
|
1931
1939
|
for (let t of e) {
|
|
1932
|
-
let e =
|
|
1940
|
+
let e = Me(t);
|
|
1933
1941
|
if (e) {
|
|
1934
1942
|
n.push(e);
|
|
1935
1943
|
continue;
|
|
1936
1944
|
}
|
|
1937
|
-
if (typeof
|
|
1938
|
-
let e = await
|
|
1939
|
-
e && n.push(Bn(e, N, I,
|
|
1945
|
+
if (typeof z.findOne == "function") {
|
|
1946
|
+
let e = await z.findOne(L, t);
|
|
1947
|
+
e && n.push(Bn(e, N, I, W, _e, H));
|
|
1940
1948
|
}
|
|
1941
1949
|
}
|
|
1942
|
-
t ||
|
|
1950
|
+
t || Ge(n);
|
|
1943
1951
|
} catch {
|
|
1944
|
-
t ||
|
|
1952
|
+
t || Ge([]);
|
|
1945
1953
|
}
|
|
1946
1954
|
})(), () => {
|
|
1947
1955
|
t = !0;
|
|
1948
1956
|
};
|
|
1949
1957
|
}, [
|
|
1950
1958
|
f,
|
|
1951
|
-
|
|
1959
|
+
V,
|
|
1952
1960
|
L,
|
|
1953
|
-
|
|
1961
|
+
we
|
|
1954
1962
|
]);
|
|
1955
|
-
let
|
|
1956
|
-
if (
|
|
1957
|
-
let e = new Set(
|
|
1958
|
-
return [...
|
|
1963
|
+
let qe = !we && V ? We.length : 0, Je = s(() => {
|
|
1964
|
+
if (we || !V || We.length === 0) return Ae;
|
|
1965
|
+
let e = new Set(We.map((e) => e.value));
|
|
1966
|
+
return [...We, ...Ae.filter((t) => !e.has(t.value))];
|
|
1959
1967
|
}, [
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1968
|
+
we,
|
|
1969
|
+
V,
|
|
1970
|
+
We,
|
|
1971
|
+
Ae
|
|
1964
1972
|
]);
|
|
1965
1973
|
a(() => {
|
|
1966
1974
|
E(-1);
|
|
1967
|
-
}, [
|
|
1968
|
-
let [
|
|
1975
|
+
}, [Je.length]);
|
|
1976
|
+
let [Xe, $e] = l(!1), { execute: et } = Ze(), nt = Qe(), rt = !!q || ae && (nt || V), it = r(async (e) => {
|
|
1969
1977
|
let t = (e || "").trim();
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
1978
|
+
if (q) {
|
|
1979
|
+
q(t), p(!1);
|
|
1972
1980
|
return;
|
|
1973
1981
|
}
|
|
1974
|
-
if (!(!
|
|
1975
|
-
if (_(null),
|
|
1982
|
+
if (!(!ae || !L)) {
|
|
1983
|
+
if (_(null), nt) {
|
|
1976
1984
|
p(!1), await new Promise((e) => setTimeout(e, 0));
|
|
1977
|
-
let e = await
|
|
1985
|
+
let e = await et({
|
|
1978
1986
|
type: "modal",
|
|
1979
1987
|
modal: {
|
|
1980
1988
|
objectName: L,
|
|
@@ -1982,41 +1990,41 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1982
1990
|
}
|
|
1983
1991
|
});
|
|
1984
1992
|
if (e?.success && e.data) {
|
|
1985
|
-
let t = Bn(e.data, N, I,
|
|
1986
|
-
y((e) => [t, ...e.filter((e) => e.value !== t.value)]),
|
|
1993
|
+
let t = Bn(e.data, N, I, W, _e, H);
|
|
1994
|
+
y((e) => [t, ...e.filter((e) => e.value !== t.value)]), ze(t);
|
|
1987
1995
|
return;
|
|
1988
1996
|
}
|
|
1989
1997
|
if (!(e?.success && e.modal)) return;
|
|
1990
1998
|
}
|
|
1991
|
-
if (!(!
|
|
1992
|
-
|
|
1999
|
+
if (!(!z || !t)) {
|
|
2000
|
+
$e(!0);
|
|
1993
2001
|
try {
|
|
1994
|
-
let e = Bn(await
|
|
1995
|
-
y((t) => [e, ...t.filter((t) => t.value !== e.value)]),
|
|
2002
|
+
let e = Bn(await z.create(L, { [N]: t }), N, I, W, _e, H);
|
|
2003
|
+
y((t) => [e, ...t.filter((t) => t.value !== e.value)]), ze(e);
|
|
1996
2004
|
} catch (e) {
|
|
1997
2005
|
_(e instanceof Error ? e.message : String(e));
|
|
1998
2006
|
} finally {
|
|
1999
|
-
|
|
2007
|
+
$e(!1);
|
|
2000
2008
|
}
|
|
2001
2009
|
}
|
|
2002
2010
|
}
|
|
2003
2011
|
}, [
|
|
2004
|
-
|
|
2005
|
-
|
|
2012
|
+
q,
|
|
2013
|
+
ae,
|
|
2006
2014
|
L,
|
|
2015
|
+
nt,
|
|
2007
2016
|
et,
|
|
2008
|
-
|
|
2009
|
-
B,
|
|
2017
|
+
z,
|
|
2010
2018
|
N,
|
|
2011
2019
|
I,
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
]),
|
|
2017
|
-
if (!
|
|
2020
|
+
W,
|
|
2021
|
+
_e,
|
|
2022
|
+
H,
|
|
2023
|
+
ze
|
|
2024
|
+
]), at = r((e) => {
|
|
2025
|
+
if (!U || U.length === 0) return;
|
|
2018
2026
|
let t = [];
|
|
2019
|
-
for (let n of
|
|
2027
|
+
for (let n of U) {
|
|
2020
2028
|
let r = typeof n == "string" ? n : n.field;
|
|
2021
2029
|
if (r === N) continue;
|
|
2022
2030
|
let i = e[r];
|
|
@@ -2025,46 +2033,46 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2025
2033
|
t.push(`${a}: ${o}`);
|
|
2026
2034
|
}
|
|
2027
2035
|
return t.length ? t.join(" · ") : void 0;
|
|
2028
|
-
}, [
|
|
2029
|
-
e.key === "ArrowDown" ? (e.preventDefault(), E((e) => e <
|
|
2036
|
+
}, [U, N]), ot = r((e) => {
|
|
2037
|
+
e.key === "ArrowDown" ? (e.preventDefault(), E((e) => e < Je.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), E((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), b >= 0 && b < Je.length && ze(Je[b]));
|
|
2030
2038
|
}, [
|
|
2031
|
-
|
|
2039
|
+
Je,
|
|
2032
2040
|
b,
|
|
2033
|
-
|
|
2041
|
+
ze
|
|
2034
2042
|
]);
|
|
2035
2043
|
if (a(() => {
|
|
2036
2044
|
b >= 0 && D.current && D.current.querySelector(`[data-lookup-index="${b}"]`)?.scrollIntoView({ block: "nearest" });
|
|
2037
|
-
}, [b]), u) return
|
|
2045
|
+
}, [b]), u) return J.length ? M ? /* @__PURE__ */ Y("div", {
|
|
2038
2046
|
className: "flex flex-wrap gap-1",
|
|
2039
|
-
children:
|
|
2047
|
+
children: J.map((e, t) => /* @__PURE__ */ Y(w, {
|
|
2040
2048
|
variant: "outline",
|
|
2041
2049
|
children: e?.label || e?.[N]
|
|
2042
2050
|
}, t))
|
|
2043
2051
|
}) : /* @__PURE__ */ Y("span", {
|
|
2044
2052
|
className: "text-sm",
|
|
2045
|
-
children:
|
|
2053
|
+
children: J[0]?.label || J[0]?.[N]
|
|
2046
2054
|
}) : /* @__PURE__ */ Y(P, {});
|
|
2047
|
-
let
|
|
2055
|
+
let Z = !!d.compact, Q = J[0]?.label || J[0]?.[N], st = /* @__PURE__ */ X(T, {
|
|
2048
2056
|
variant: "outline",
|
|
2049
|
-
className:
|
|
2057
|
+
className: K("min-w-0 flex-1 justify-start text-left font-normal", Z && "h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60"),
|
|
2050
2058
|
type: "button",
|
|
2051
|
-
disabled:
|
|
2052
|
-
"data-testid":
|
|
2053
|
-
title:
|
|
2054
|
-
children: [/* @__PURE__ */ Y(Ue, { className:
|
|
2055
|
-
className:
|
|
2056
|
-
children:
|
|
2059
|
+
disabled: B || d.disabled,
|
|
2060
|
+
"data-testid": B ? "lookup-trigger-gated" : d.name || O?.name ? `lookup-trigger-${d.name || O.name}` : "lookup-trigger",
|
|
2061
|
+
title: B ? m("lookup.selectFirst", { fields: de.map((e) => e.field).join(", ") }) : void 0,
|
|
2062
|
+
children: [/* @__PURE__ */ Y(Ue, { className: K("size-4 shrink-0 text-muted-foreground", Z ? "mr-1.5" : "mr-2") }), /* @__PURE__ */ Y("span", {
|
|
2063
|
+
className: K("truncate", Z && J.length === 0 && "text-muted-foreground"),
|
|
2064
|
+
children: B ? m("lookup.selectFirst", { fields: de.map((e) => e.field).join(", ") }) : Z && !M && J.length > 0 ? Q : J.length === 0 ? O?.placeholder || m("common.select") : M ? m("table.selected", { count: J.length }) : m("common.select")
|
|
2057
2065
|
})]
|
|
2058
2066
|
});
|
|
2059
2067
|
return /* @__PURE__ */ X("div", {
|
|
2060
|
-
className:
|
|
2068
|
+
className: Z ? "" : "space-y-2",
|
|
2061
2069
|
children: [
|
|
2062
|
-
|
|
2070
|
+
J.length > 0 && !Z && /* @__PURE__ */ Y("div", {
|
|
2063
2071
|
className: "flex flex-wrap gap-1",
|
|
2064
|
-
children:
|
|
2072
|
+
children: J.map((e, t) => {
|
|
2065
2073
|
let n = e?.label || e?.[N];
|
|
2066
|
-
if (
|
|
2067
|
-
let r = e?.[
|
|
2074
|
+
if (ce === "search") {
|
|
2075
|
+
let r = e?.[ue] || e?.image;
|
|
2068
2076
|
return /* @__PURE__ */ X("span", {
|
|
2069
2077
|
"data-testid": "people-field-chip",
|
|
2070
2078
|
className: "inline-flex items-center gap-1.5 rounded-full border bg-background py-0.5 pl-0.5 pr-1.5 text-sm",
|
|
@@ -2084,7 +2092,7 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2084
2092
|
children: n
|
|
2085
2093
|
}),
|
|
2086
2094
|
/* @__PURE__ */ Y("button", {
|
|
2087
|
-
onClick: () =>
|
|
2095
|
+
onClick: () => Ve(e?.value),
|
|
2088
2096
|
className: "rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2089
2097
|
type: "button",
|
|
2090
2098
|
"aria-label": m("lookup.remove", { label: n }),
|
|
@@ -2097,7 +2105,7 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2097
2105
|
variant: "outline",
|
|
2098
2106
|
className: "gap-1",
|
|
2099
2107
|
children: [n, /* @__PURE__ */ Y("button", {
|
|
2100
|
-
onClick: () =>
|
|
2108
|
+
onClick: () => Ve(e?.value),
|
|
2101
2109
|
className: "ml-1 hover:text-destructive",
|
|
2102
2110
|
type: "button",
|
|
2103
2111
|
"aria-label": m("lookup.remove", { label: n }),
|
|
@@ -2106,35 +2114,35 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2106
2114
|
}, t);
|
|
2107
2115
|
})
|
|
2108
2116
|
}),
|
|
2109
|
-
|
|
2117
|
+
ce === "search" && V && z && L ? /* @__PURE__ */ Y(wn, {
|
|
2110
2118
|
inline: !0,
|
|
2111
|
-
trigger:
|
|
2112
|
-
open:
|
|
2113
|
-
onOpenChange:
|
|
2119
|
+
trigger: st,
|
|
2120
|
+
open: ye,
|
|
2121
|
+
onOpenChange: be,
|
|
2114
2122
|
title: O?.label || m("common.select"),
|
|
2115
2123
|
multiple: M,
|
|
2116
|
-
dataSource:
|
|
2124
|
+
dataSource: z,
|
|
2117
2125
|
objectName: L,
|
|
2118
2126
|
displayField: N,
|
|
2119
2127
|
idField: I,
|
|
2120
|
-
subtitleFields:
|
|
2121
|
-
avatarField:
|
|
2122
|
-
pageSize:
|
|
2123
|
-
value:
|
|
2128
|
+
subtitleFields: le,
|
|
2129
|
+
avatarField: ue,
|
|
2130
|
+
pageSize: R,
|
|
2131
|
+
value: Fe,
|
|
2124
2132
|
onSelect: n,
|
|
2125
|
-
onSelectRecords:
|
|
2126
|
-
lookupFilters:
|
|
2127
|
-
baseFilter:
|
|
2133
|
+
onSelectRecords: He,
|
|
2134
|
+
lookupFilters: se,
|
|
2135
|
+
baseFilter: xe
|
|
2128
2136
|
}) : /* @__PURE__ */ X("div", {
|
|
2129
2137
|
className: "flex items-center gap-1.5",
|
|
2130
2138
|
children: [/* @__PURE__ */ X(te, {
|
|
2131
2139
|
open: f,
|
|
2132
2140
|
onOpenChange: (e) => {
|
|
2133
|
-
|
|
2141
|
+
B || p(e);
|
|
2134
2142
|
},
|
|
2135
2143
|
children: [/* @__PURE__ */ Y(re, {
|
|
2136
2144
|
asChild: !0,
|
|
2137
|
-
children:
|
|
2145
|
+
children: st
|
|
2138
2146
|
}), /* @__PURE__ */ X(ne, {
|
|
2139
2147
|
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
2140
2148
|
align: "start",
|
|
@@ -2147,9 +2155,9 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2147
2155
|
/* @__PURE__ */ Y(Ue, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
2148
2156
|
/* @__PURE__ */ Y(F, {
|
|
2149
2157
|
placeholder: m("common.search") + "...",
|
|
2150
|
-
value:
|
|
2151
|
-
onChange: (e) =>
|
|
2152
|
-
onKeyDown:
|
|
2158
|
+
value: we,
|
|
2159
|
+
onChange: (e) => je(e.target.value),
|
|
2160
|
+
onKeyDown: ot,
|
|
2153
2161
|
className: "w-full pl-9 h-8 text-sm",
|
|
2154
2162
|
role: "combobox",
|
|
2155
2163
|
"aria-autocomplete": "list",
|
|
@@ -2157,62 +2165,62 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2157
2165
|
"aria-expanded": f,
|
|
2158
2166
|
"aria-activedescendant": b >= 0 ? `${h}-opt-${b}` : void 0
|
|
2159
2167
|
}),
|
|
2160
|
-
|
|
2168
|
+
Te && /* @__PURE__ */ Y(Le, {
|
|
2161
2169
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
2162
2170
|
"data-testid": "lookup-loading"
|
|
2163
2171
|
})
|
|
2164
2172
|
]
|
|
2165
2173
|
})
|
|
2166
2174
|
}),
|
|
2167
|
-
|
|
2175
|
+
De && /* @__PURE__ */ X("div", {
|
|
2168
2176
|
className: "flex flex-col items-center gap-2 py-4 px-2",
|
|
2169
2177
|
role: "alert",
|
|
2170
2178
|
children: [
|
|
2171
|
-
/* @__PURE__ */ Y(
|
|
2179
|
+
/* @__PURE__ */ Y(ve, { className: "size-5 text-destructive" }),
|
|
2172
2180
|
/* @__PURE__ */ Y("p", {
|
|
2173
2181
|
className: "text-sm text-destructive",
|
|
2174
|
-
children:
|
|
2182
|
+
children: De
|
|
2175
2183
|
}),
|
|
2176
2184
|
/* @__PURE__ */ Y(T, {
|
|
2177
2185
|
variant: "outline",
|
|
2178
2186
|
size: "sm",
|
|
2179
|
-
onClick: () =>
|
|
2187
|
+
onClick: () => Ce.refetch(),
|
|
2180
2188
|
type: "button",
|
|
2181
2189
|
children: m("lookup.retry")
|
|
2182
2190
|
})
|
|
2183
2191
|
]
|
|
2184
2192
|
}),
|
|
2185
|
-
|
|
2193
|
+
Te && Ae.length === 0 && !De && /* @__PURE__ */ X("div", {
|
|
2186
2194
|
className: "flex flex-col items-center gap-2 py-6",
|
|
2187
2195
|
role: "status",
|
|
2188
2196
|
"aria-live": "polite",
|
|
2189
|
-
children: [/* @__PURE__ */ Y(
|
|
2197
|
+
children: [/* @__PURE__ */ Y(Le, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ Y("p", {
|
|
2190
2198
|
className: "text-sm text-muted-foreground",
|
|
2191
2199
|
children: m("lookup.loading")
|
|
2192
2200
|
})]
|
|
2193
2201
|
}),
|
|
2194
|
-
!
|
|
2202
|
+
!De && !(Te && Ae.length === 0) && /* @__PURE__ */ Y("div", {
|
|
2195
2203
|
ref: D,
|
|
2196
2204
|
className: "max-h-64 overflow-y-auto px-1 pb-1",
|
|
2197
2205
|
role: "listbox",
|
|
2198
2206
|
id: h,
|
|
2199
|
-
children:
|
|
2207
|
+
children: Je.length === 0 ? /* @__PURE__ */ X("div", {
|
|
2200
2208
|
className: "py-4 text-center",
|
|
2201
2209
|
children: [/* @__PURE__ */ Y("p", {
|
|
2202
2210
|
className: "text-sm text-muted-foreground",
|
|
2203
2211
|
children: m("lookup.noOptions")
|
|
2204
|
-
}),
|
|
2212
|
+
}), rt && /* @__PURE__ */ X(T, {
|
|
2205
2213
|
variant: "ghost",
|
|
2206
2214
|
size: "sm",
|
|
2207
2215
|
className: "mt-2 gap-1",
|
|
2208
2216
|
type: "button",
|
|
2209
|
-
disabled:
|
|
2210
|
-
onClick: () =>
|
|
2211
|
-
children: [
|
|
2217
|
+
disabled: Xe,
|
|
2218
|
+
onClick: () => it(we),
|
|
2219
|
+
children: [Xe ? /* @__PURE__ */ Y(Le, { className: "size-4 animate-spin" }) : /* @__PURE__ */ Y(Be, { className: "size-4" }), we ? m("lookup.createNamed", { name: we }) : m("lookup.createNew")]
|
|
2212
2220
|
})]
|
|
2213
2221
|
}) : /* @__PURE__ */ X(tt, { children: [
|
|
2214
|
-
|
|
2215
|
-
let i = M ? (Array.isArray(t) ? t : []).map(
|
|
2222
|
+
Je.map((n, r) => {
|
|
2223
|
+
let i = M ? (Array.isArray(t) ? t : []).map(Pe).includes(n.value) : Pe(t) === n.value, a = r === b, o = qe > 0 && r === 0, s = qe > 0 && r === qe;
|
|
2216
2224
|
return /* @__PURE__ */ X(e.Fragment, { children: [
|
|
2217
2225
|
o && /* @__PURE__ */ Y("div", {
|
|
2218
2226
|
className: "px-3 pt-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
@@ -2227,8 +2235,8 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2227
2235
|
"data-lookup-index": r,
|
|
2228
2236
|
role: "option",
|
|
2229
2237
|
"aria-selected": i,
|
|
2230
|
-
title:
|
|
2231
|
-
onClick: () =>
|
|
2238
|
+
title: at(n),
|
|
2239
|
+
onClick: () => ze(n),
|
|
2232
2240
|
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${a ? "bg-accent text-accent-foreground" : i ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
2233
2241
|
type: "button",
|
|
2234
2242
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -2248,65 +2256,65 @@ function Un({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
2248
2256
|
})
|
|
2249
2257
|
] }, n.value);
|
|
2250
2258
|
}),
|
|
2251
|
-
|
|
2259
|
+
V && Ee > Ae.length && /* @__PURE__ */ Y("p", {
|
|
2252
2260
|
className: "text-xs text-muted-foreground text-center py-2",
|
|
2253
2261
|
children: m("lookup.showingResults", {
|
|
2254
|
-
shown:
|
|
2255
|
-
total:
|
|
2262
|
+
shown: Ae.length,
|
|
2263
|
+
total: Ee
|
|
2256
2264
|
})
|
|
2257
2265
|
}),
|
|
2258
|
-
|
|
2266
|
+
V && Ee > Ae.length && /* @__PURE__ */ X("button", {
|
|
2259
2267
|
type: "button",
|
|
2260
2268
|
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",
|
|
2261
2269
|
onClick: () => {
|
|
2262
|
-
p(!1),
|
|
2270
|
+
p(!1), be(!0);
|
|
2263
2271
|
},
|
|
2264
2272
|
"data-testid": "show-all-results",
|
|
2265
|
-
children: [/* @__PURE__ */ Y(Ke, { className: "size-3.5" }), m("lookup.showAllResults", { count:
|
|
2273
|
+
children: [/* @__PURE__ */ Y(Ke, { className: "size-3.5" }), m("lookup.showAllResults", { count: Ee })]
|
|
2266
2274
|
}),
|
|
2267
|
-
|
|
2275
|
+
rt && /* @__PURE__ */ X("button", {
|
|
2268
2276
|
type: "button",
|
|
2269
2277
|
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",
|
|
2270
|
-
disabled:
|
|
2271
|
-
onClick: () =>
|
|
2272
|
-
children: [
|
|
2278
|
+
disabled: Xe,
|
|
2279
|
+
onClick: () => it(we),
|
|
2280
|
+
children: [Xe ? /* @__PURE__ */ Y(Le, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ Y(Be, { className: "size-3.5" }), we ? m("lookup.createNamed", { name: we }) : m("lookup.createNew")]
|
|
2273
2281
|
})
|
|
2274
2282
|
] })
|
|
2275
2283
|
})
|
|
2276
2284
|
]
|
|
2277
2285
|
})]
|
|
2278
|
-
}),
|
|
2286
|
+
}), V && ce !== "search" && /* @__PURE__ */ Y(T, {
|
|
2279
2287
|
variant: "outline",
|
|
2280
2288
|
size: "icon",
|
|
2281
2289
|
className: "shrink-0",
|
|
2282
2290
|
type: "button",
|
|
2283
|
-
disabled:
|
|
2284
|
-
onClick: () =>
|
|
2291
|
+
disabled: B || d.disabled,
|
|
2292
|
+
onClick: () => be(!0),
|
|
2285
2293
|
"aria-label": m("lookup.browseAll"),
|
|
2286
|
-
title:
|
|
2294
|
+
title: B ? m("lookup.selectFirst", { fields: de.map((e) => e.field).join(", ") }) : m("lookup.browseAll"),
|
|
2287
2295
|
"data-testid": "browse-all-records",
|
|
2288
2296
|
children: /* @__PURE__ */ Y(Ke, { className: "size-4" })
|
|
2289
2297
|
})]
|
|
2290
2298
|
}),
|
|
2291
|
-
|
|
2292
|
-
open:
|
|
2293
|
-
onOpenChange:
|
|
2299
|
+
V && z && L && ce !== "search" && /* @__PURE__ */ Y($t, {
|
|
2300
|
+
open: ye,
|
|
2301
|
+
onOpenChange: be,
|
|
2294
2302
|
title: O?.label || m("common.select"),
|
|
2295
2303
|
multiple: M,
|
|
2296
|
-
dataSource:
|
|
2304
|
+
dataSource: z,
|
|
2297
2305
|
objectName: L,
|
|
2298
|
-
columns:
|
|
2306
|
+
columns: U,
|
|
2299
2307
|
displayField: N,
|
|
2300
|
-
titleFormat:
|
|
2308
|
+
titleFormat: _e,
|
|
2301
2309
|
idField: I,
|
|
2302
|
-
pageSize:
|
|
2303
|
-
value:
|
|
2310
|
+
pageSize: R,
|
|
2311
|
+
value: Fe,
|
|
2304
2312
|
onSelect: n,
|
|
2305
|
-
onSelectRecords:
|
|
2306
|
-
lookupFilters:
|
|
2307
|
-
baseFilter:
|
|
2313
|
+
onSelectRecords: He,
|
|
2314
|
+
lookupFilters: se,
|
|
2315
|
+
baseFilter: xe,
|
|
2308
2316
|
cellRenderer: Pn(),
|
|
2309
|
-
filterColumns:
|
|
2317
|
+
filterColumns: G
|
|
2310
2318
|
})
|
|
2311
2319
|
]
|
|
2312
2320
|
});
|
|
@@ -2391,7 +2399,7 @@ function Qn({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
2391
2399
|
f(t);
|
|
2392
2400
|
};
|
|
2393
2401
|
return /* @__PURE__ */ X("div", {
|
|
2394
|
-
className:
|
|
2402
|
+
className: K("flex flex-col gap-3", i),
|
|
2395
2403
|
children: [l === null && h.length === 0 && /* @__PURE__ */ Y("span", {
|
|
2396
2404
|
className: "text-sm text-muted-foreground",
|
|
2397
2405
|
children: "Loading capabilities…"
|
|
@@ -2410,7 +2418,7 @@ function Qn({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
2410
2418
|
disabled: c,
|
|
2411
2419
|
"aria-pressed": t,
|
|
2412
2420
|
title: e.description || void 0,
|
|
2413
|
-
className:
|
|
2421
|
+
className: K("rounded-full border px-3 py-1 text-sm transition-colors disabled:opacity-50", t ? "border-primary bg-primary text-primary-foreground" : "border-input bg-background text-foreground hover:bg-accent"),
|
|
2414
2422
|
children: e.label || e.name
|
|
2415
2423
|
}, e.name);
|
|
2416
2424
|
})
|
|
@@ -2509,7 +2517,7 @@ function or({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
2509
2517
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
2510
2518
|
children: "%"
|
|
2511
2519
|
})]
|
|
2512
|
-
}), /* @__PURE__ */ Y(
|
|
2520
|
+
}), /* @__PURE__ */ Y(he, {
|
|
2513
2521
|
value: [h],
|
|
2514
2522
|
onValueChange: _,
|
|
2515
2523
|
min: 0,
|
|
@@ -2547,58 +2555,75 @@ function lr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2547
2555
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
2548
2556
|
onClick: () => s(!o),
|
|
2549
2557
|
tabIndex: -1,
|
|
2550
|
-
children: Y(o ?
|
|
2558
|
+
children: Y(o ? Me : je, { className: "size-4 text-gray-500" })
|
|
2551
2559
|
})]
|
|
2552
2560
|
});
|
|
2553
2561
|
}
|
|
2554
|
-
var ur = Z((() => {})), dr = /* @__PURE__ */ Q({
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2562
|
+
var ur = Z((() => {})), dr = /* @__PURE__ */ Q({
|
|
2563
|
+
FileCell: () => mr,
|
|
2564
|
+
FileField: () => pr
|
|
2565
|
+
});
|
|
2566
|
+
function fr(e) {
|
|
2567
|
+
let { files: t, multiple: n, maxSize: i, onChange: a } = e, { upload: o } = nt(), [s, c] = l([]), [u, d] = l({}), [f, p] = l(!1);
|
|
2568
|
+
return {
|
|
2569
|
+
processFiles: r(async (e) => {
|
|
2570
|
+
if (e.length === 0) return;
|
|
2571
|
+
let r = [], s = e.filter((e) => {
|
|
2572
|
+
if (i && e.size > i) {
|
|
2573
|
+
let t = (i / (1024 * 1024)).toFixed(1);
|
|
2574
|
+
return r.push(`"${e.name}" exceeds max size (${t} MB)`), !1;
|
|
2575
|
+
}
|
|
2576
|
+
return !0;
|
|
2577
|
+
});
|
|
2578
|
+
if (c(r), s.length !== 0) {
|
|
2579
|
+
p(!0);
|
|
2580
|
+
try {
|
|
2581
|
+
let e = (await Promise.all(s.map(async (e) => {
|
|
2582
|
+
try {
|
|
2583
|
+
let t = await o(e, { onProgress: (t) => d((n) => ({
|
|
2584
|
+
...n,
|
|
2585
|
+
[e.name]: t
|
|
2586
|
+
})) });
|
|
2587
|
+
return {
|
|
2588
|
+
name: t.name,
|
|
2589
|
+
original_name: e.name,
|
|
2590
|
+
size: t.size,
|
|
2591
|
+
mime_type: t.mimeType,
|
|
2592
|
+
url: t.url
|
|
2593
|
+
};
|
|
2594
|
+
} catch (t) {
|
|
2595
|
+
return r.push(`Failed to upload "${e.name}": ${t.message}`), c([...r]), null;
|
|
2596
|
+
}
|
|
2597
|
+
}))).filter(Boolean);
|
|
2598
|
+
if (e.length === 0) return;
|
|
2599
|
+
a(n ? [...t, ...e] : e[0]);
|
|
2600
|
+
} finally {
|
|
2601
|
+
p(!1), d({});
|
|
2602
|
+
}
|
|
2589
2603
|
}
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2604
|
+
}, [
|
|
2605
|
+
t,
|
|
2606
|
+
n,
|
|
2607
|
+
a,
|
|
2608
|
+
i,
|
|
2609
|
+
o
|
|
2610
|
+
]),
|
|
2611
|
+
errors: s,
|
|
2612
|
+
uploading: f,
|
|
2613
|
+
uploadProgress: u
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
function pr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
2617
|
+
let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, h = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), g = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), _ = m === !1 ? !1 : m ?? (h && g ? "environment" : null), [v, y] = l(!1), b = e ? Array.isArray(e) ? e : [e] : [], { processFiles: x, errors: S, uploading: C, uploadProgress: w } = fr({
|
|
2618
|
+
files: b,
|
|
2619
|
+
multiple: d,
|
|
2620
|
+
maxSize: p,
|
|
2621
|
+
onChange: t
|
|
2622
|
+
}), E = r((e) => {
|
|
2598
2623
|
e.preventDefault(), e.stopPropagation(), y(!0);
|
|
2599
|
-
}, []),
|
|
2624
|
+
}, []), D = r((e) => {
|
|
2600
2625
|
e.preventDefault(), e.stopPropagation(), y(!1);
|
|
2601
|
-
}, []),
|
|
2626
|
+
}, []), O = r((e) => {
|
|
2602
2627
|
e.preventDefault(), e.stopPropagation(), y(!1);
|
|
2603
2628
|
let t = Array.from(e.dataTransfer.files);
|
|
2604
2629
|
if (f) {
|
|
@@ -2606,9 +2631,9 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2606
2631
|
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
2607
2632
|
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
2608
2633
|
});
|
|
2609
|
-
|
|
2610
|
-
} else
|
|
2611
|
-
}, [f,
|
|
2634
|
+
x(n);
|
|
2635
|
+
} else x(t);
|
|
2636
|
+
}, [f, x]);
|
|
2612
2637
|
if (i) return e ? /* @__PURE__ */ Y("div", {
|
|
2613
2638
|
className: "flex flex-wrap gap-2",
|
|
2614
2639
|
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ Y("span", {
|
|
@@ -2616,14 +2641,14 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2616
2641
|
children: e.name || e.original_name || "File"
|
|
2617
2642
|
}, t))
|
|
2618
2643
|
}) : /* @__PURE__ */ Y(P, {});
|
|
2619
|
-
let
|
|
2620
|
-
|
|
2621
|
-
},
|
|
2644
|
+
let k = (e) => {
|
|
2645
|
+
x(Array.from(e.target.files || []));
|
|
2646
|
+
}, A = (e) => {
|
|
2622
2647
|
if (d) {
|
|
2623
|
-
let n =
|
|
2648
|
+
let n = b.filter((t, n) => n !== e);
|
|
2624
2649
|
t(n.length > 0 ? n : null);
|
|
2625
2650
|
} else t(null);
|
|
2626
|
-
},
|
|
2651
|
+
}, j = (e) => (e.mime_type || "").startsWith("image/");
|
|
2627
2652
|
return /* @__PURE__ */ X("div", {
|
|
2628
2653
|
className: a.className,
|
|
2629
2654
|
children: [
|
|
@@ -2632,7 +2657,7 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2632
2657
|
type: "file",
|
|
2633
2658
|
multiple: d,
|
|
2634
2659
|
accept: f,
|
|
2635
|
-
onChange:
|
|
2660
|
+
onChange: k,
|
|
2636
2661
|
className: "hidden"
|
|
2637
2662
|
}),
|
|
2638
2663
|
_ && /* @__PURE__ */ Y("input", {
|
|
@@ -2640,7 +2665,7 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2640
2665
|
type: "file",
|
|
2641
2666
|
accept: "image/*",
|
|
2642
2667
|
capture: _,
|
|
2643
|
-
onChange:
|
|
2668
|
+
onChange: k,
|
|
2644
2669
|
className: "hidden",
|
|
2645
2670
|
"aria-label": "Camera capture",
|
|
2646
2671
|
"data-testid": "file-field-camera-input"
|
|
@@ -2649,9 +2674,9 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2649
2674
|
className: "space-y-2",
|
|
2650
2675
|
children: [
|
|
2651
2676
|
/* @__PURE__ */ X("div", {
|
|
2652
|
-
onDragOver:
|
|
2653
|
-
onDragLeave:
|
|
2654
|
-
onDrop:
|
|
2677
|
+
onDragOver: E,
|
|
2678
|
+
onDragLeave: D,
|
|
2679
|
+
onDrop: O,
|
|
2655
2680
|
onClick: () => o.current?.click(),
|
|
2656
2681
|
className: `
|
|
2657
2682
|
flex flex-col items-center justify-center gap-2 p-6
|
|
@@ -2684,32 +2709,32 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2684
2709
|
e.stopPropagation(), s.current?.click();
|
|
2685
2710
|
},
|
|
2686
2711
|
"data-testid": "file-field-camera-button",
|
|
2687
|
-
children: [/* @__PURE__ */ Y(
|
|
2712
|
+
children: [/* @__PURE__ */ Y(Se, { className: "size-4 mr-2" }), _ === "user" ? "Take selfie" : "Take photo"]
|
|
2688
2713
|
}),
|
|
2689
|
-
|
|
2714
|
+
C && /* @__PURE__ */ X("div", {
|
|
2690
2715
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
2691
2716
|
"data-testid": "file-field-uploading",
|
|
2692
|
-
children: [/* @__PURE__ */ Y(
|
|
2717
|
+
children: [/* @__PURE__ */ Y(Le, { className: "size-3 animate-spin" }), /* @__PURE__ */ X("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
|
|
2693
2718
|
}),
|
|
2694
|
-
|
|
2719
|
+
S.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2695
2720
|
className: "space-y-0.5",
|
|
2696
|
-
children:
|
|
2721
|
+
children: S.map((e, t) => /* @__PURE__ */ Y("p", {
|
|
2697
2722
|
className: "text-xs text-destructive",
|
|
2698
2723
|
children: e
|
|
2699
2724
|
}, t))
|
|
2700
2725
|
}),
|
|
2701
|
-
|
|
2726
|
+
b.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2702
2727
|
className: "space-y-1",
|
|
2703
|
-
children:
|
|
2728
|
+
children: b.map((e, t) => /* @__PURE__ */ X("div", {
|
|
2704
2729
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
2705
2730
|
children: [/* @__PURE__ */ X("div", {
|
|
2706
2731
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
2707
2732
|
children: [
|
|
2708
|
-
|
|
2733
|
+
j(e) && e.url ? /* @__PURE__ */ Y("img", {
|
|
2709
2734
|
src: e.url,
|
|
2710
2735
|
alt: e.name,
|
|
2711
2736
|
className: "size-8 object-cover rounded shrink-0"
|
|
2712
|
-
}) :
|
|
2737
|
+
}) : j(e) ? /* @__PURE__ */ Y(Ie, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ Y(Ne, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
2713
2738
|
/* @__PURE__ */ Y("span", {
|
|
2714
2739
|
className: "text-sm truncate",
|
|
2715
2740
|
children: e.name || e.original_name || "File"
|
|
@@ -2728,7 +2753,7 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2728
2753
|
variant: "ghost",
|
|
2729
2754
|
size: "sm",
|
|
2730
2755
|
onClick: (e) => {
|
|
2731
|
-
e.stopPropagation(),
|
|
2756
|
+
e.stopPropagation(), A(t);
|
|
2732
2757
|
},
|
|
2733
2758
|
className: "h-6 w-6 p-0",
|
|
2734
2759
|
children: /* @__PURE__ */ Y(Ye, { className: "size-3" })
|
|
@@ -2740,8 +2765,80 @@ function fr({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
2740
2765
|
]
|
|
2741
2766
|
});
|
|
2742
2767
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
2768
|
+
function mr({ value: e, onChange: t, disabled: n, multiple: r, accept: i, maxSize: a, "aria-label": o, "data-cell": s }) {
|
|
2769
|
+
let l = c(null), u = e ? Array.isArray(e) ? e : [e] : [], { processFiles: d, errors: f, uploading: p } = fr({
|
|
2770
|
+
files: u,
|
|
2771
|
+
multiple: !!r,
|
|
2772
|
+
maxSize: a,
|
|
2773
|
+
onChange: t
|
|
2774
|
+
}), m = (e) => {
|
|
2775
|
+
if (r) {
|
|
2776
|
+
let n = u.filter((t, n) => n !== e);
|
|
2777
|
+
t(n.length > 0 ? n : null);
|
|
2778
|
+
} else t(null);
|
|
2779
|
+
}, h = (e) => String(e?.mime_type || "").startsWith("image/"), g = (e) => typeof e == "string" ? e : e?.name || e?.original_name || "File", _ = !n && !p && (r || u.length === 0);
|
|
2780
|
+
return /* @__PURE__ */ X("div", {
|
|
2781
|
+
className: "flex min-h-8 flex-wrap items-center gap-1 px-1 py-0.5",
|
|
2782
|
+
children: [
|
|
2783
|
+
/* @__PURE__ */ Y("input", {
|
|
2784
|
+
ref: l,
|
|
2785
|
+
type: "file",
|
|
2786
|
+
multiple: r,
|
|
2787
|
+
accept: i,
|
|
2788
|
+
onChange: (e) => {
|
|
2789
|
+
d(Array.from(e.target.files || [])), e.target.value = "";
|
|
2790
|
+
},
|
|
2791
|
+
className: "hidden"
|
|
2792
|
+
}),
|
|
2793
|
+
u.map((e, t) => /* @__PURE__ */ X("span", {
|
|
2794
|
+
className: "inline-flex max-w-40 items-center gap-1 rounded border bg-muted/50 px-1 py-0.5 text-xs",
|
|
2795
|
+
title: g(e),
|
|
2796
|
+
"data-testid": "file-cell-chip",
|
|
2797
|
+
children: [
|
|
2798
|
+
h(e) && e.url ? /* @__PURE__ */ Y("img", {
|
|
2799
|
+
src: e.url,
|
|
2800
|
+
alt: g(e),
|
|
2801
|
+
className: "size-5 shrink-0 rounded object-cover"
|
|
2802
|
+
}) : /* @__PURE__ */ Y(Ne, { className: "size-3 shrink-0 text-muted-foreground" }),
|
|
2803
|
+
/* @__PURE__ */ Y("span", {
|
|
2804
|
+
className: "truncate",
|
|
2805
|
+
children: g(e)
|
|
2806
|
+
}),
|
|
2807
|
+
!n && /* @__PURE__ */ Y("button", {
|
|
2808
|
+
type: "button",
|
|
2809
|
+
className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
2810
|
+
"aria-label": `Remove ${g(e)}`,
|
|
2811
|
+
onClick: () => m(t),
|
|
2812
|
+
children: /* @__PURE__ */ Y(Ye, { className: "size-3" })
|
|
2813
|
+
})
|
|
2814
|
+
]
|
|
2815
|
+
}, t)),
|
|
2816
|
+
p && /* @__PURE__ */ Y("span", {
|
|
2817
|
+
className: "inline-flex items-center gap-1 text-xs text-muted-foreground",
|
|
2818
|
+
"data-testid": "file-cell-uploading",
|
|
2819
|
+
children: /* @__PURE__ */ Y(Le, { className: "size-3.5 animate-spin" })
|
|
2820
|
+
}),
|
|
2821
|
+
_ && /* @__PURE__ */ X(T, {
|
|
2822
|
+
type: "button",
|
|
2823
|
+
variant: "ghost",
|
|
2824
|
+
size: "sm",
|
|
2825
|
+
className: "h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
2826
|
+
onClick: () => l.current?.click(),
|
|
2827
|
+
"aria-label": o,
|
|
2828
|
+
"data-cell": s,
|
|
2829
|
+
disabled: n,
|
|
2830
|
+
children: [/* @__PURE__ */ Y(Je, { className: "size-3.5" }), u.length === 0 && "Upload"]
|
|
2831
|
+
}),
|
|
2832
|
+
f.length > 0 && /* @__PURE__ */ Y("span", {
|
|
2833
|
+
className: "w-full truncate text-[11px] text-destructive",
|
|
2834
|
+
title: f.join("; "),
|
|
2835
|
+
children: f[0]
|
|
2836
|
+
})
|
|
2837
|
+
]
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
var hr = Z((() => {})), gr = /* @__PURE__ */ Q({ ImageCropperDialog: () => _r }), _r, vr = Z((() => {
|
|
2841
|
+
_r = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
|
|
2745
2842
|
let u = c(null), d = c(null), [f, p] = l(0), [m, h] = l({
|
|
2746
2843
|
x: 0,
|
|
2747
2844
|
y: 0,
|
|
@@ -2872,7 +2969,7 @@ var pr = Z((() => {})), mr = /* @__PURE__ */ Q({ ImageCropperDialog: () => hr })
|
|
|
2872
2969
|
onClick: w,
|
|
2873
2970
|
disabled: !v,
|
|
2874
2971
|
"data-testid": "image-cropper-confirm",
|
|
2875
|
-
children: [/* @__PURE__ */ Y(
|
|
2972
|
+
children: [/* @__PURE__ */ Y(De, { className: "size-4 mr-2" }), "Apply crop"]
|
|
2876
2973
|
})]
|
|
2877
2974
|
})]
|
|
2878
2975
|
})
|
|
@@ -2880,8 +2977,8 @@ var pr = Z((() => {})), mr = /* @__PURE__ */ Q({ ImageCropperDialog: () => hr })
|
|
|
2880
2977
|
})
|
|
2881
2978
|
});
|
|
2882
2979
|
};
|
|
2883
|
-
})),
|
|
2884
|
-
function
|
|
2980
|
+
})), yr = /* @__PURE__ */ Q({ ImageField: () => br });
|
|
2981
|
+
function br({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
2885
2982
|
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, h] = l(null), { upload: g } = nt(), [_, v] = l(!1);
|
|
2886
2983
|
if (a) return e ? /* @__PURE__ */ Y("div", {
|
|
2887
2984
|
className: "flex flex-wrap gap-2",
|
|
@@ -2980,7 +3077,7 @@ function vr({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2980
3077
|
className: "h-6 w-6 p-0",
|
|
2981
3078
|
"aria-label": `Crop image ${t + 1}`,
|
|
2982
3079
|
"data-testid": `image-field-crop-${t}`,
|
|
2983
|
-
children: /* @__PURE__ */ Y(
|
|
3080
|
+
children: /* @__PURE__ */ Y(De, { className: "size-3" })
|
|
2984
3081
|
}), /* @__PURE__ */ Y(T, {
|
|
2985
3082
|
type: "button",
|
|
2986
3083
|
variant: "destructive",
|
|
@@ -2998,12 +3095,12 @@ function vr({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2998
3095
|
className: "w-full",
|
|
2999
3096
|
disabled: _,
|
|
3000
3097
|
"data-testid": "image-field-upload-button",
|
|
3001
|
-
children: [_ ? /* @__PURE__ */ Y(
|
|
3098
|
+
children: [_ ? /* @__PURE__ */ Y(Le, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ Y(Fe, { className: "size-4 mr-2" }), _ ? "Uploading…" : y.length > 0 ? "Add More Images" : "Upload Image"]
|
|
3002
3099
|
})]
|
|
3003
3100
|
}),
|
|
3004
3101
|
p && m && /* @__PURE__ */ Y(t, {
|
|
3005
3102
|
fallback: null,
|
|
3006
|
-
children: /* @__PURE__ */ Y(
|
|
3103
|
+
children: /* @__PURE__ */ Y(xr, {
|
|
3007
3104
|
open: !0,
|
|
3008
3105
|
onOpenChange: (e) => !e && h(null),
|
|
3009
3106
|
src: m.src,
|
|
@@ -3014,10 +3111,10 @@ function vr({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
3014
3111
|
]
|
|
3015
3112
|
});
|
|
3016
3113
|
}
|
|
3017
|
-
var
|
|
3018
|
-
|
|
3019
|
-
})),
|
|
3020
|
-
function
|
|
3114
|
+
var xr, Sr = Z((() => {
|
|
3115
|
+
xr = n(() => Promise.resolve().then(() => (vr(), gr)).then((e) => ({ default: e.ImageCropperDialog })));
|
|
3116
|
+
})), Cr = /* @__PURE__ */ Q({ LocationField: () => wr });
|
|
3117
|
+
function wr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3021
3118
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
3022
3119
|
return r ? /* @__PURE__ */ Y("span", {
|
|
3023
3120
|
className: "text-sm",
|
|
@@ -3045,8 +3142,8 @@ function Sr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3045
3142
|
className: i.className
|
|
3046
3143
|
});
|
|
3047
3144
|
}
|
|
3048
|
-
var
|
|
3049
|
-
function
|
|
3145
|
+
var Tr = Z((() => {})), Er = /* @__PURE__ */ Q({ FormulaField: () => Dr });
|
|
3146
|
+
function Dr({ value: e, field: t, ...n }) {
|
|
3050
3147
|
let r = (t || n.schema)?.return_type || "text";
|
|
3051
3148
|
if (e == null) return /* @__PURE__ */ Y(P, { className: n.className });
|
|
3052
3149
|
let i;
|
|
@@ -3055,8 +3152,8 @@ function Tr({ value: e, field: t, ...n }) {
|
|
|
3055
3152
|
children: i
|
|
3056
3153
|
});
|
|
3057
3154
|
}
|
|
3058
|
-
var
|
|
3059
|
-
function
|
|
3155
|
+
var Or = Z((() => {})), kr = /* @__PURE__ */ Q({ SummaryField: () => Ar });
|
|
3156
|
+
function Ar({ value: e, field: t, ...n }) {
|
|
3060
3157
|
let r = (t || n.schema)?.summary_type || "count";
|
|
3061
3158
|
if (e == null) return /* @__PURE__ */ Y(P, { className: n.className });
|
|
3062
3159
|
let i;
|
|
@@ -3070,15 +3167,15 @@ function Or({ value: e, field: t, ...n }) {
|
|
|
3070
3167
|
children: i
|
|
3071
3168
|
});
|
|
3072
3169
|
}
|
|
3073
|
-
var
|
|
3074
|
-
function
|
|
3170
|
+
var jr = Z((() => {})), Mr = /* @__PURE__ */ Q({ AutoNumberField: () => Nr });
|
|
3171
|
+
function Nr({ value: e, field: t, ...n }) {
|
|
3075
3172
|
return e == null ? /* @__PURE__ */ Y(P, { className: n.className }) : /* @__PURE__ */ Y("span", {
|
|
3076
3173
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
3077
3174
|
children: String(e)
|
|
3078
3175
|
});
|
|
3079
3176
|
}
|
|
3080
|
-
var
|
|
3081
|
-
function
|
|
3177
|
+
var Pr = Z((() => {})), Fr = /* @__PURE__ */ Q({ UserField: () => Lr });
|
|
3178
|
+
function Ir(e) {
|
|
3082
3179
|
let t = Array.isArray(e) ? e : [];
|
|
3083
3180
|
return t.some((e) => e?.field === "banned") ? t : [...t, {
|
|
3084
3181
|
field: "banned",
|
|
@@ -3086,7 +3183,7 @@ function Pr(e) {
|
|
|
3086
3183
|
value: !0
|
|
3087
3184
|
}];
|
|
3088
3185
|
}
|
|
3089
|
-
function
|
|
3186
|
+
function Lr(e) {
|
|
3090
3187
|
let t = e.field || e.schema, n = t?.field && typeof t.field == "object" && ("reference" in t.field || "reference_to" in t.field || "type" in t.field), r = n ? t.field : t, i = {
|
|
3091
3188
|
...r || {},
|
|
3092
3189
|
reference: r?.reference || r?.reference_to || "sys_user",
|
|
@@ -3094,7 +3191,7 @@ function Fr(e) {
|
|
|
3094
3191
|
picker: r?.picker ?? "search",
|
|
3095
3192
|
subtitle: r?.subtitle ?? ["primary_business_unit_id.name", "email"],
|
|
3096
3193
|
avatar_field: r?.avatar_field ?? r?.avatarField ?? "image",
|
|
3097
|
-
lookup_filters:
|
|
3194
|
+
lookup_filters: Ir(r?.lookup_filters ?? r?.lookupFilters)
|
|
3098
3195
|
}, a = n ? {
|
|
3099
3196
|
...t,
|
|
3100
3197
|
field: i
|
|
@@ -3104,8 +3201,8 @@ function Fr(e) {
|
|
|
3104
3201
|
field: a
|
|
3105
3202
|
});
|
|
3106
3203
|
}
|
|
3107
|
-
var
|
|
3108
|
-
function
|
|
3204
|
+
var Rr = Z((() => {})), zr = /* @__PURE__ */ Q({ ObjectField: () => Br });
|
|
3205
|
+
function Br({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3109
3206
|
let o = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
|
|
3110
3207
|
return a(() => {
|
|
3111
3208
|
try {
|
|
@@ -3119,11 +3216,11 @@ function Rr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3119
3216
|
c(JSON.stringify(e, null, 2));
|
|
3120
3217
|
}
|
|
3121
3218
|
}, [e, s]), r ? e ? /* @__PURE__ */ Y("pre", {
|
|
3122
|
-
className:
|
|
3219
|
+
className: K("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
3123
3220
|
children: JSON.stringify(e, null, 2)
|
|
3124
3221
|
}) : /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ X("div", {
|
|
3125
3222
|
className: "space-y-1",
|
|
3126
|
-
children: [/* @__PURE__ */ Y(
|
|
3223
|
+
children: [/* @__PURE__ */ Y(G, {
|
|
3127
3224
|
value: s,
|
|
3128
3225
|
onChange: (e) => {
|
|
3129
3226
|
let n = e.target.value;
|
|
@@ -3139,7 +3236,7 @@ function Rr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3139
3236
|
},
|
|
3140
3237
|
placeholder: o?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
3141
3238
|
disabled: r || i.disabled,
|
|
3142
|
-
className:
|
|
3239
|
+
className: K("font-mono text-xs", u ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
3143
3240
|
rows: 6
|
|
3144
3241
|
}), u && /* @__PURE__ */ Y("p", {
|
|
3145
3242
|
className: "text-xs text-red-500",
|
|
@@ -3147,8 +3244,8 @@ function Rr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3147
3244
|
})]
|
|
3148
3245
|
});
|
|
3149
3246
|
}
|
|
3150
|
-
var
|
|
3151
|
-
function
|
|
3247
|
+
var Vr = Z((() => {})), Hr = /* @__PURE__ */ Q({ VectorField: () => Ur });
|
|
3248
|
+
function Ur({ value: e, field: t, ...n }) {
|
|
3152
3249
|
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
3153
3250
|
if (!e || !Array.isArray(e)) return /* @__PURE__ */ Y(P, {});
|
|
3154
3251
|
let i = e.slice(0, 3).map((e) => {
|
|
@@ -3174,27 +3271,27 @@ function Vr({ value: e, field: t, ...n }) {
|
|
|
3174
3271
|
})]
|
|
3175
3272
|
});
|
|
3176
3273
|
}
|
|
3177
|
-
var
|
|
3178
|
-
GridField: () =>
|
|
3179
|
-
LineItemsField: () =>
|
|
3180
|
-
computeRow: () =>
|
|
3181
|
-
evalArith: () =>
|
|
3182
|
-
lookupAutofillPatch: () =>
|
|
3183
|
-
sumColumn: () =>
|
|
3274
|
+
var Wr = Z((() => {})), Gr = /* @__PURE__ */ Q({
|
|
3275
|
+
GridField: () => ti,
|
|
3276
|
+
LineItemsField: () => ai,
|
|
3277
|
+
computeRow: () => Zr,
|
|
3278
|
+
evalArith: () => Yr,
|
|
3279
|
+
lookupAutofillPatch: () => Xr,
|
|
3280
|
+
sumColumn: () => ei
|
|
3184
3281
|
});
|
|
3185
|
-
function
|
|
3282
|
+
function Kr(e) {
|
|
3186
3283
|
if (e.width) return {
|
|
3187
3284
|
width: e.width,
|
|
3188
3285
|
minWidth: e.width
|
|
3189
3286
|
};
|
|
3190
3287
|
if ((e.type ?? "text") === "text") return { minWidth: 180 };
|
|
3191
|
-
let t =
|
|
3288
|
+
let t = ri[e.type ?? "text"] ?? 132;
|
|
3192
3289
|
return {
|
|
3193
3290
|
width: t,
|
|
3194
3291
|
minWidth: t
|
|
3195
3292
|
};
|
|
3196
3293
|
}
|
|
3197
|
-
function
|
|
3294
|
+
function qr(e) {
|
|
3198
3295
|
let t = [], n = 0;
|
|
3199
3296
|
for (; n < e.length;) {
|
|
3200
3297
|
let r = e[n];
|
|
@@ -3245,14 +3342,14 @@ function Gr(e) {
|
|
|
3245
3342
|
}
|
|
3246
3343
|
return t;
|
|
3247
3344
|
}
|
|
3248
|
-
function
|
|
3345
|
+
function Jr(e, t) {
|
|
3249
3346
|
let n = e.startsWith("record.") ? e.slice(7) : e, r = t?.[n];
|
|
3250
3347
|
if (r == null || r === "") return null;
|
|
3251
3348
|
let i = Number(r);
|
|
3252
3349
|
return Number.isFinite(i) ? i : null;
|
|
3253
3350
|
}
|
|
3254
|
-
function
|
|
3255
|
-
let n =
|
|
3351
|
+
function Yr(e, t) {
|
|
3352
|
+
let n = qr(e);
|
|
3256
3353
|
if (!n || n.length === 0) return null;
|
|
3257
3354
|
let r = 0, i = !1, a = () => n[r], o = () => n[r++];
|
|
3258
3355
|
function s() {
|
|
@@ -3263,7 +3360,7 @@ function qr(e, t) {
|
|
|
3263
3360
|
if (e.t === "num") return o(), Number(e.v);
|
|
3264
3361
|
if (e.t === "id") {
|
|
3265
3362
|
o();
|
|
3266
|
-
let n =
|
|
3363
|
+
let n = Jr(e.v, t);
|
|
3267
3364
|
return n === null ? (i = !0, NaN) : n;
|
|
3268
3365
|
}
|
|
3269
3366
|
if (e.t === "lp") {
|
|
@@ -3292,7 +3389,7 @@ function qr(e, t) {
|
|
|
3292
3389
|
let u = l();
|
|
3293
3390
|
return i || r !== n.length || !Number.isFinite(u) ? null : u;
|
|
3294
3391
|
}
|
|
3295
|
-
function
|
|
3392
|
+
function Xr(e, t, n) {
|
|
3296
3393
|
let r = { [t.field]: n?.value ?? n?.id ?? n?._id };
|
|
3297
3394
|
if (t.autofill !== !1 && n && typeof n == "object") for (let i of e) {
|
|
3298
3395
|
if (i.field === t.field || i.computed || i.type === "lookup") continue;
|
|
@@ -3301,12 +3398,12 @@ function Jr(e, t, n) {
|
|
|
3301
3398
|
}
|
|
3302
3399
|
return r;
|
|
3303
3400
|
}
|
|
3304
|
-
function
|
|
3401
|
+
function Zr(e, t) {
|
|
3305
3402
|
let n = e.filter((e) => e.computed && e.expr);
|
|
3306
3403
|
if (n.length === 0) return t;
|
|
3307
3404
|
let r = { ...t };
|
|
3308
3405
|
for (let e of n) {
|
|
3309
|
-
let t =
|
|
3406
|
+
let t = Yr(e.expr, r);
|
|
3310
3407
|
if (t === null) {
|
|
3311
3408
|
r[e.field] = null;
|
|
3312
3409
|
continue;
|
|
@@ -3316,33 +3413,40 @@ function Yr(e, t) {
|
|
|
3316
3413
|
}
|
|
3317
3414
|
return r;
|
|
3318
3415
|
}
|
|
3319
|
-
function
|
|
3416
|
+
function Qr(e, t) {
|
|
3320
3417
|
if (t == null || t === "") return "—";
|
|
3418
|
+
if (e.type === "file") {
|
|
3419
|
+
let e = Array.isArray(t) ? t : [t];
|
|
3420
|
+
if (e.length === 0) return "—";
|
|
3421
|
+
if (e.length > 1) return `${e.length} files`;
|
|
3422
|
+
let n = e[0];
|
|
3423
|
+
return typeof n == "string" ? n : n?.name || n?.original_name || "File";
|
|
3424
|
+
}
|
|
3321
3425
|
if (e.type === "select" && Array.isArray(e.options)) {
|
|
3322
3426
|
let n = e.options.find((e) => String(e.value) === String(t));
|
|
3323
3427
|
return n ? n.label : String(t);
|
|
3324
3428
|
}
|
|
3325
|
-
if (
|
|
3429
|
+
if (ni(e.type)) {
|
|
3326
3430
|
let n = Number(t);
|
|
3327
3431
|
if (Number.isFinite(n)) return e.type === "currency" ? `${e.prefix || "¥"}${n.toLocaleString()}` : n.toLocaleString();
|
|
3328
3432
|
}
|
|
3329
3433
|
return Array.isArray(t) ? t.join(", ") : String(t);
|
|
3330
3434
|
}
|
|
3331
|
-
function
|
|
3332
|
-
if (
|
|
3435
|
+
function $r(e, t) {
|
|
3436
|
+
if (ni(e)) {
|
|
3333
3437
|
if (t === "" || t == null) return null;
|
|
3334
3438
|
let e = Number(t);
|
|
3335
3439
|
return Number.isNaN(e) ? t : e;
|
|
3336
3440
|
}
|
|
3337
3441
|
return t;
|
|
3338
3442
|
}
|
|
3339
|
-
function
|
|
3443
|
+
function ei(e, t) {
|
|
3340
3444
|
return Array.isArray(e) ? e.reduce((e, n) => {
|
|
3341
3445
|
let r = Number(n?.[t]);
|
|
3342
3446
|
return e + (Number.isFinite(r) ? r : 0);
|
|
3343
3447
|
}, 0) : 0;
|
|
3344
3448
|
}
|
|
3345
|
-
function
|
|
3449
|
+
function ti({ value: t, onChange: n, field: i, readonly: a, disabled: o, className: s, onRowExpand: l, displayMode: u, onAdd: d, ...f }) {
|
|
3346
3450
|
let p = i || f.schema || {}, m = p.columns || [], h = Array.isArray(t) ? t : [], _ = f.contextRecord, v = r((e, t) => {
|
|
3347
3451
|
if (!e.readonlyWhen && !e.requiredWhen) return {
|
|
3348
3452
|
readonly: !1,
|
|
@@ -3364,25 +3468,25 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3364
3468
|
let n = new Set(t);
|
|
3365
3469
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
3366
3470
|
});
|
|
3367
|
-
}, []), D = p.allow_add !== !1 && !a && !o, O = p.allow_delete !== !1 && !a && !o, k = p.allow_duplicate !== !1 && D, A = typeof l == "function" && !a, j = p.show_line_numbers !== !1, M = p.min_rows ?? 0, N = p.max_rows, P = p.total_field || p.amount_field || p.amountField, ee = p.sort_field, L = p.reorderable !== !1 && !a && !o,
|
|
3471
|
+
}, []), D = p.allow_add !== !1 && !a && !o, O = p.allow_delete !== !1 && !a && !o, k = p.allow_duplicate !== !1 && D, A = typeof l == "function" && !a, j = p.show_line_numbers !== !1, M = p.min_rows ?? 0, N = p.max_rows, P = p.total_field || p.amount_field || p.amountField, ee = p.sort_field, L = p.reorderable !== !1 && !a && !o, ie = r((e) => {
|
|
3368
3472
|
n?.(ee ? e.map((e, t) => ({
|
|
3369
3473
|
...e,
|
|
3370
3474
|
[ee]: t
|
|
3371
3475
|
})) : e);
|
|
3372
|
-
}, [n, ee]),
|
|
3476
|
+
}, [n, ee]), ae = r(() => {
|
|
3373
3477
|
let e = {};
|
|
3374
3478
|
for (let t of C) e[t.field] = null;
|
|
3375
3479
|
return e;
|
|
3376
|
-
}, [C]),
|
|
3480
|
+
}, [C]), ue = r((e, t) => {
|
|
3377
3481
|
if (e >= h.length) {
|
|
3378
3482
|
if (N != null && h.length >= N) return;
|
|
3379
|
-
|
|
3380
|
-
...
|
|
3483
|
+
ie([...h, Zr(C, {
|
|
3484
|
+
...ae(),
|
|
3381
3485
|
...t
|
|
3382
3486
|
})]);
|
|
3383
3487
|
return;
|
|
3384
3488
|
}
|
|
3385
|
-
|
|
3489
|
+
ie(h.map((n, r) => r === e ? Zr(C, {
|
|
3386
3490
|
...n,
|
|
3387
3491
|
...t
|
|
3388
3492
|
}) : n));
|
|
@@ -3390,45 +3494,45 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3390
3494
|
h,
|
|
3391
3495
|
C,
|
|
3392
3496
|
N,
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
]),
|
|
3396
|
-
|
|
3397
|
-
}, [C,
|
|
3398
|
-
|
|
3399
|
-
}, [
|
|
3400
|
-
N != null && h.length >= N ||
|
|
3497
|
+
ae,
|
|
3498
|
+
ie
|
|
3499
|
+
]), de = r((e, t, n) => ue(e, { [t]: n }), [ue]), fe = r((e, t, n) => {
|
|
3500
|
+
ue(e, Xr(C, t, n));
|
|
3501
|
+
}, [C, ue]), pe = r((e, t, n) => de(e, t, n), [de]), me = r((e, t, n) => {
|
|
3502
|
+
de(e, t.field, $r(t.type, n));
|
|
3503
|
+
}, [de]), z = r(() => {
|
|
3504
|
+
N != null && h.length >= N || ie([...h, ae()]);
|
|
3401
3505
|
}, [
|
|
3402
3506
|
h,
|
|
3403
|
-
|
|
3507
|
+
ae,
|
|
3404
3508
|
N,
|
|
3405
|
-
|
|
3406
|
-
]),
|
|
3407
|
-
let n =
|
|
3509
|
+
ie
|
|
3510
|
+
]), he = c(null), B = r((e, t) => {
|
|
3511
|
+
let n = he.current?.querySelector(`[data-cell="${e}-${t}"]`);
|
|
3408
3512
|
n && (n.focus(), n instanceof HTMLInputElement && n.select());
|
|
3409
|
-
}, []),
|
|
3410
|
-
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(),
|
|
3411
|
-
}, [
|
|
3412
|
-
h.length <= M ||
|
|
3513
|
+
}, []), V = r((e, t, n) => {
|
|
3514
|
+
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(), B(t + 1, n)) : e.key === "ArrowUp" && (e.preventDefault(), t > 0 && B(t - 1, n));
|
|
3515
|
+
}, [B]), H = r((e) => {
|
|
3516
|
+
h.length <= M || ie(h.filter((t, n) => n !== e));
|
|
3413
3517
|
}, [
|
|
3414
3518
|
h,
|
|
3415
3519
|
M,
|
|
3416
|
-
|
|
3417
|
-
]),
|
|
3520
|
+
ie
|
|
3521
|
+
]), ge = r((e) => {
|
|
3418
3522
|
if (N != null && h.length >= N) return;
|
|
3419
3523
|
let t = h[e];
|
|
3420
3524
|
if (!t) return;
|
|
3421
3525
|
let { id: n, _id: r, recordId: i, ...a } = t, o = [...h];
|
|
3422
|
-
o.splice(e + 1, 0, { ...a }),
|
|
3526
|
+
o.splice(e + 1, 0, { ...a }), ie(o);
|
|
3423
3527
|
}, [
|
|
3424
3528
|
h,
|
|
3425
3529
|
N,
|
|
3426
|
-
|
|
3427
|
-
]),
|
|
3530
|
+
ie
|
|
3531
|
+
]), _e = r((e, t) => {
|
|
3428
3532
|
if (e === t || e < 0 || t < 0 || e >= h.length || t >= h.length) return;
|
|
3429
3533
|
let n = [...h], [r] = n.splice(e, 1);
|
|
3430
|
-
n.splice(t, 0, r),
|
|
3431
|
-
}, [h,
|
|
3534
|
+
n.splice(t, 0, r), ie(n);
|
|
3535
|
+
}, [h, ie]), U = c(null), W = A || O || k, G = (+!!A + +!!k + +!!O) * 34 + 12, q = !!P, ve = q ? ei(h, P) : 0, ye = q ? Math.max(0, C.findIndex((e) => e.field === P)) : -1, be = S.length > 0 ? /* @__PURE__ */ X(te, { children: [/* @__PURE__ */ Y(re, {
|
|
3432
3536
|
asChild: !0,
|
|
3433
3537
|
children: /* @__PURE__ */ X(T, {
|
|
3434
3538
|
type: "button",
|
|
@@ -3471,10 +3575,10 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3471
3575
|
})]
|
|
3472
3576
|
})] }) : null;
|
|
3473
3577
|
if (a) return /* @__PURE__ */ X("div", {
|
|
3474
|
-
className:
|
|
3475
|
-
children: [
|
|
3578
|
+
className: K("space-y-2", s),
|
|
3579
|
+
children: [be && /* @__PURE__ */ Y("div", {
|
|
3476
3580
|
className: "flex justify-end",
|
|
3477
|
-
children:
|
|
3581
|
+
children: be
|
|
3478
3582
|
}), /* @__PURE__ */ Y("div", {
|
|
3479
3583
|
className: "border border-border rounded-lg overflow-x-auto",
|
|
3480
3584
|
"data-testid": "line-items-readonly",
|
|
@@ -3487,8 +3591,8 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3487
3591
|
className: "w-10 px-2 py-2 text-right text-xs font-medium text-muted-foreground",
|
|
3488
3592
|
children: "#"
|
|
3489
3593
|
}), C.map((e) => /* @__PURE__ */ Y("th", {
|
|
3490
|
-
style: { minWidth:
|
|
3491
|
-
className:
|
|
3594
|
+
style: { minWidth: ii(e) },
|
|
3595
|
+
className: K("px-3 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap", ni(e.type) ? "text-right" : "text-left"),
|
|
3492
3596
|
children: e.label || e.field
|
|
3493
3597
|
}, e.field))] })
|
|
3494
3598
|
}),
|
|
@@ -3502,7 +3606,7 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3502
3606
|
className: "px-2 py-2 text-right text-muted-foreground tabular-nums",
|
|
3503
3607
|
children: t + 1
|
|
3504
3608
|
}), C.map((t) => /* @__PURE__ */ Y("td", {
|
|
3505
|
-
className:
|
|
3609
|
+
className: K("px-3 py-2 text-foreground", ni(t.type) && "text-right tabular-nums"),
|
|
3506
3610
|
children: t.type === "lookup" && e[t.field] != null && e[t.field] !== "" ? /* @__PURE__ */ Y(Un, {
|
|
3507
3611
|
value: e[t.field],
|
|
3508
3612
|
onChange: () => {},
|
|
@@ -3512,29 +3616,29 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3512
3616
|
display_field: t.displayField,
|
|
3513
3617
|
id_field: t.idField
|
|
3514
3618
|
}
|
|
3515
|
-
}) : e[t.field] != null && e[t.field] !== "" ? String(e[t.field]) : "—"
|
|
3619
|
+
}) : t.type === "file" ? Qr(t, e[t.field]) : e[t.field] != null && e[t.field] !== "" ? String(e[t.field]) : "—"
|
|
3516
3620
|
}, t.field))] }, t))
|
|
3517
3621
|
}),
|
|
3518
|
-
|
|
3622
|
+
q && /* @__PURE__ */ Y("tfoot", {
|
|
3519
3623
|
className: "border-t border-border bg-muted/40",
|
|
3520
3624
|
children: /* @__PURE__ */ X("tr", { children: [
|
|
3521
3625
|
/* @__PURE__ */ Y("td", {
|
|
3522
|
-
colSpan: Math.max(+!!j +
|
|
3626
|
+
colSpan: Math.max(+!!j + ye, 1),
|
|
3523
3627
|
className: "px-3 py-2 text-right text-xs font-medium text-muted-foreground",
|
|
3524
3628
|
children: "Total"
|
|
3525
3629
|
}),
|
|
3526
3630
|
/* @__PURE__ */ Y("td", {
|
|
3527
3631
|
className: "px-3 py-2 text-right font-semibold text-foreground tabular-nums",
|
|
3528
|
-
children:
|
|
3632
|
+
children: ve.toLocaleString()
|
|
3529
3633
|
}),
|
|
3530
|
-
C.length -
|
|
3634
|
+
C.length - ye - 1 > 0 && /* @__PURE__ */ Y("td", { colSpan: C.length - ye - 1 })
|
|
3531
3635
|
] })
|
|
3532
3636
|
})
|
|
3533
3637
|
]
|
|
3534
3638
|
})
|
|
3535
3639
|
})]
|
|
3536
3640
|
});
|
|
3537
|
-
let
|
|
3641
|
+
let xe = !y && D && (N == null || h.length < N), Se = xe ? [...h, ae()] : h, Ce = (e, t, n, r) => {
|
|
3538
3642
|
let i = r?.[e.field], a = o || v(e, r).readonly;
|
|
3539
3643
|
return y ? e.type === "lookup" && i != null && i !== "" ? /* @__PURE__ */ Y(Un, {
|
|
3540
3644
|
value: i,
|
|
@@ -3546,17 +3650,17 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3546
3650
|
id_field: e.idField
|
|
3547
3651
|
}
|
|
3548
3652
|
}) : /* @__PURE__ */ Y("span", {
|
|
3549
|
-
className:
|
|
3550
|
-
children:
|
|
3653
|
+
className: K("px-2 text-sm text-foreground", ni(e.type) && "tabular-nums", (i == null || i === "") && "text-muted-foreground"),
|
|
3654
|
+
children: Qr(e, i)
|
|
3551
3655
|
}) : e.computed ? /* @__PURE__ */ Y("span", {
|
|
3552
|
-
className:
|
|
3656
|
+
className: K("block px-2 text-sm tabular-nums", ni(e.type) ? "text-right" : "text-left", i == null || i === "" ? "text-muted-foreground" : "text-foreground"),
|
|
3553
3657
|
title: "Computed",
|
|
3554
3658
|
"data-computed": e.field,
|
|
3555
|
-
children:
|
|
3659
|
+
children: Qr(e, i)
|
|
3556
3660
|
}) : e.type === "lookup" ? /* @__PURE__ */ Y(Un, {
|
|
3557
3661
|
value: i,
|
|
3558
|
-
onChange: (t) =>
|
|
3559
|
-
onSelectRecord: (t) =>
|
|
3662
|
+
onChange: (t) => pe(n, e.field, t),
|
|
3663
|
+
onSelectRecord: (t) => fe(n, e, t),
|
|
3560
3664
|
compact: !0,
|
|
3561
3665
|
field: {
|
|
3562
3666
|
reference: e.reference,
|
|
@@ -3567,15 +3671,23 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3567
3671
|
placeholder: "—"
|
|
3568
3672
|
},
|
|
3569
3673
|
disabled: a
|
|
3570
|
-
}) : e.type === "
|
|
3674
|
+
}) : e.type === "file" ? /* @__PURE__ */ Y(mr, {
|
|
3675
|
+
value: i,
|
|
3676
|
+
onChange: (t) => pe(n, e.field, t),
|
|
3677
|
+
multiple: e.multiple,
|
|
3678
|
+
accept: Array.isArray(e.accept) && e.accept.length > 0 ? e.accept.join(",") : void 0,
|
|
3679
|
+
disabled: a,
|
|
3680
|
+
"aria-label": e.label || e.field,
|
|
3681
|
+
"data-cell": `${n}-${t}`
|
|
3682
|
+
}) : e.type === "select" ? /* @__PURE__ */ X(oe, {
|
|
3571
3683
|
value: i == null ? "" : String(i),
|
|
3572
|
-
onValueChange: (t) =>
|
|
3684
|
+
onValueChange: (t) => me(n, e, t),
|
|
3573
3685
|
disabled: a,
|
|
3574
|
-
children: [/* @__PURE__ */ Y(
|
|
3686
|
+
children: [/* @__PURE__ */ Y(ce, {
|
|
3575
3687
|
className: "h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus:ring-1 focus:ring-ring/60",
|
|
3576
3688
|
"aria-label": e.label || e.field,
|
|
3577
|
-
children: /* @__PURE__ */ Y(
|
|
3578
|
-
}), /* @__PURE__ */ Y(
|
|
3689
|
+
children: /* @__PURE__ */ Y(le, { placeholder: "—" })
|
|
3690
|
+
}), /* @__PURE__ */ Y(R, { children: (e.options || []).map((e) => /* @__PURE__ */ Y(se, {
|
|
3579
3691
|
value: e.value,
|
|
3580
3692
|
children: e.label
|
|
3581
3693
|
}, e.value)) })]
|
|
@@ -3586,69 +3698,69 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3586
3698
|
children: e.prefix || "¥"
|
|
3587
3699
|
}), /* @__PURE__ */ Y(F, {
|
|
3588
3700
|
"data-cell": `${n}-${t}`,
|
|
3589
|
-
onKeyDown: (e) =>
|
|
3590
|
-
className:
|
|
3591
|
-
type: e.type === "date" ? "date" :
|
|
3592
|
-
step:
|
|
3701
|
+
onKeyDown: (e) => V(e, n, t),
|
|
3702
|
+
className: K("h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60", e.type === "currency" && "pl-6", ni(e.type) && "text-right tabular-nums"),
|
|
3703
|
+
type: e.type === "date" ? "date" : ni(e.type) ? "number" : "text",
|
|
3704
|
+
step: ni(e.type) ? e.step ?? "any" : void 0,
|
|
3593
3705
|
"aria-label": e.label || e.field,
|
|
3594
3706
|
value: i == null ? "" : String(i),
|
|
3595
|
-
onChange: (t) =>
|
|
3707
|
+
onChange: (t) => me(n, e, t.target.value),
|
|
3596
3708
|
disabled: a
|
|
3597
3709
|
})]
|
|
3598
3710
|
});
|
|
3599
3711
|
};
|
|
3600
3712
|
return /* @__PURE__ */ X("div", {
|
|
3601
|
-
className:
|
|
3713
|
+
className: K("space-y-2", s),
|
|
3602
3714
|
"data-testid": "line-items",
|
|
3603
3715
|
children: [
|
|
3604
|
-
|
|
3716
|
+
be && /* @__PURE__ */ Y("div", {
|
|
3605
3717
|
className: "flex justify-end",
|
|
3606
|
-
children:
|
|
3718
|
+
children: be
|
|
3607
3719
|
}),
|
|
3608
3720
|
/* @__PURE__ */ Y("div", {
|
|
3609
3721
|
className: "border border-border rounded-lg overflow-x-auto",
|
|
3610
3722
|
children: /* @__PURE__ */ X("table", {
|
|
3611
|
-
ref:
|
|
3723
|
+
ref: he,
|
|
3612
3724
|
className: "w-full text-sm",
|
|
3613
3725
|
children: [
|
|
3614
3726
|
/* @__PURE__ */ Y("thead", {
|
|
3615
3727
|
className: "bg-muted/60 border-b border-border",
|
|
3616
3728
|
children: /* @__PURE__ */ X("tr", { children: [
|
|
3617
3729
|
j && /* @__PURE__ */ Y("th", {
|
|
3618
|
-
className:
|
|
3730
|
+
className: K("px-2 py-2 text-right text-xs font-medium text-muted-foreground", L ? "w-14" : "w-10"),
|
|
3619
3731
|
children: "#"
|
|
3620
3732
|
}),
|
|
3621
3733
|
C.map((e) => /* @__PURE__ */ X("th", {
|
|
3622
|
-
className:
|
|
3623
|
-
style:
|
|
3734
|
+
className: K("px-2 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap", ni(e.type) ? "text-right" : "text-left"),
|
|
3735
|
+
style: Kr(e),
|
|
3624
3736
|
children: [e.label || e.field, e.required && !e.computed && /* @__PURE__ */ Y("span", {
|
|
3625
3737
|
className: "text-destructive",
|
|
3626
3738
|
children: " *"
|
|
3627
3739
|
})]
|
|
3628
3740
|
}, e.field)),
|
|
3629
|
-
|
|
3741
|
+
W && /* @__PURE__ */ Y("th", { style: { width: G } })
|
|
3630
3742
|
] })
|
|
3631
3743
|
}),
|
|
3632
3744
|
/* @__PURE__ */ Y("tbody", {
|
|
3633
3745
|
className: "divide-y divide-border",
|
|
3634
3746
|
children: y && h.length === 0 ? /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ X("td", {
|
|
3635
|
-
colSpan: C.length + +!!
|
|
3747
|
+
colSpan: C.length + +!!W + +!!j,
|
|
3636
3748
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3637
3749
|
children: [
|
|
3638
3750
|
"No items yet — click “",
|
|
3639
3751
|
p.add_label || "Add",
|
|
3640
3752
|
"” to begin."
|
|
3641
3753
|
]
|
|
3642
|
-
}) }) :
|
|
3643
|
-
let n =
|
|
3754
|
+
}) }) : Se.map((e, t) => {
|
|
3755
|
+
let n = xe && t === h.length, r = L && !n && !y;
|
|
3644
3756
|
return /* @__PURE__ */ X("tr", {
|
|
3645
|
-
className:
|
|
3757
|
+
className: K("group", !n && "hover:bg-muted/30"),
|
|
3646
3758
|
...L && !n ? {
|
|
3647
3759
|
onDragOver: (e) => {
|
|
3648
|
-
|
|
3760
|
+
U.current != null && e.preventDefault();
|
|
3649
3761
|
},
|
|
3650
3762
|
onDrop: (e) => {
|
|
3651
|
-
e.preventDefault(),
|
|
3763
|
+
e.preventDefault(), U.current != null && (_e(U.current, t), U.current = null);
|
|
3652
3764
|
}
|
|
3653
3765
|
} : {},
|
|
3654
3766
|
children: [
|
|
@@ -3659,18 +3771,18 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3659
3771
|
children: [r && /* @__PURE__ */ Y("span", {
|
|
3660
3772
|
draggable: !0,
|
|
3661
3773
|
onDragStart: () => {
|
|
3662
|
-
|
|
3774
|
+
U.current = t;
|
|
3663
3775
|
},
|
|
3664
3776
|
onDragEnd: () => {
|
|
3665
|
-
|
|
3777
|
+
U.current = null;
|
|
3666
3778
|
},
|
|
3667
3779
|
className: "cursor-grab text-muted-foreground/40 opacity-0 transition-opacity group-hover:opacity-100",
|
|
3668
3780
|
title: "Drag to reorder",
|
|
3669
3781
|
"aria-label": "Drag to reorder",
|
|
3670
3782
|
"data-testid": `line-items-drag-${t}`,
|
|
3671
|
-
children: /* @__PURE__ */ Y(
|
|
3783
|
+
children: /* @__PURE__ */ Y(Pe, { className: "h-3.5 w-3.5" })
|
|
3672
3784
|
}), /* @__PURE__ */ Y("span", {
|
|
3673
|
-
className:
|
|
3785
|
+
className: K(n && "opacity-30"),
|
|
3674
3786
|
children: t + 1
|
|
3675
3787
|
})]
|
|
3676
3788
|
})
|
|
@@ -3681,11 +3793,11 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3681
3793
|
"aria-invalid": o || void 0,
|
|
3682
3794
|
title: o ? `${r.label || r.field} is required` : void 0,
|
|
3683
3795
|
"data-testid": o ? `line-items-invalid-${t}-${r.field}` : void 0,
|
|
3684
|
-
className:
|
|
3685
|
-
children:
|
|
3796
|
+
className: K("border-r border-border/40 px-1 py-0.5 align-middle last:border-r-0", y && "px-2 py-1.5", o && "bg-destructive/5 ring-1 ring-inset ring-destructive/50"),
|
|
3797
|
+
children: Ce(r, i, t, e)
|
|
3686
3798
|
}, r.field);
|
|
3687
3799
|
}),
|
|
3688
|
-
|
|
3800
|
+
W && /* @__PURE__ */ Y("td", {
|
|
3689
3801
|
className: "px-1 py-0.5 align-middle whitespace-nowrap",
|
|
3690
3802
|
children: /* @__PURE__ */ X("div", {
|
|
3691
3803
|
className: "flex items-center justify-center gap-0.5",
|
|
@@ -3709,9 +3821,9 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3709
3821
|
"aria-label": "Duplicate row",
|
|
3710
3822
|
title: "Duplicate line",
|
|
3711
3823
|
"data-testid": `line-items-duplicate-${t}`,
|
|
3712
|
-
onClick: () =>
|
|
3824
|
+
onClick: () => ge(t),
|
|
3713
3825
|
disabled: o || N != null && h.length >= N,
|
|
3714
|
-
children: /* @__PURE__ */ Y(
|
|
3826
|
+
children: /* @__PURE__ */ Y(Ee, { className: "h-3.5 w-3.5" })
|
|
3715
3827
|
}),
|
|
3716
3828
|
!n && O && /* @__PURE__ */ Y(T, {
|
|
3717
3829
|
type: "button",
|
|
@@ -3720,7 +3832,7 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3720
3832
|
className: "h-8 w-8 text-muted-foreground hover:text-destructive",
|
|
3721
3833
|
"aria-label": "Remove row",
|
|
3722
3834
|
"data-testid": `line-items-remove-${t}`,
|
|
3723
|
-
onClick: () =>
|
|
3835
|
+
onClick: () => H(t),
|
|
3724
3836
|
disabled: o || h.length <= M,
|
|
3725
3837
|
children: /* @__PURE__ */ Y(qe, { className: "h-4 w-4" })
|
|
3726
3838
|
})
|
|
@@ -3731,20 +3843,20 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3731
3843
|
}, t);
|
|
3732
3844
|
})
|
|
3733
3845
|
}),
|
|
3734
|
-
|
|
3846
|
+
q && /* @__PURE__ */ Y("tfoot", {
|
|
3735
3847
|
className: "border-t border-border bg-muted/40",
|
|
3736
3848
|
children: /* @__PURE__ */ X("tr", { children: [
|
|
3737
3849
|
/* @__PURE__ */ Y("td", {
|
|
3738
|
-
colSpan: Math.max(+!!j +
|
|
3850
|
+
colSpan: Math.max(+!!j + ye, 1),
|
|
3739
3851
|
className: "px-3 py-2 text-right text-xs font-medium text-muted-foreground",
|
|
3740
3852
|
children: "Total"
|
|
3741
3853
|
}),
|
|
3742
3854
|
/* @__PURE__ */ Y("td", {
|
|
3743
3855
|
className: "px-3 py-2 text-right font-semibold text-foreground tabular-nums",
|
|
3744
3856
|
"data-testid": "line-items-total",
|
|
3745
|
-
children:
|
|
3857
|
+
children: ve.toLocaleString()
|
|
3746
3858
|
}),
|
|
3747
|
-
C.length -
|
|
3859
|
+
C.length - ye - 1 + +!!W > 0 && /* @__PURE__ */ Y("td", { colSpan: C.length - ye - 1 + +!!W })
|
|
3748
3860
|
] })
|
|
3749
3861
|
})
|
|
3750
3862
|
]
|
|
@@ -3754,7 +3866,7 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3754
3866
|
type: "button",
|
|
3755
3867
|
variant: "outline",
|
|
3756
3868
|
size: "sm",
|
|
3757
|
-
onClick: y && d ? d :
|
|
3869
|
+
onClick: y && d ? d : z,
|
|
3758
3870
|
disabled: N != null && h.length >= N,
|
|
3759
3871
|
"data-testid": "line-items-add",
|
|
3760
3872
|
children: [/* @__PURE__ */ Y(Be, { className: "mr-1.5 h-4 w-4" }), p.add_label || "Add line"]
|
|
@@ -3762,17 +3874,18 @@ function $r({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
3762
3874
|
]
|
|
3763
3875
|
});
|
|
3764
3876
|
}
|
|
3765
|
-
var
|
|
3766
|
-
Jn(),
|
|
3877
|
+
var ni, ri, ii, ai, oi = Z((() => {
|
|
3878
|
+
Jn(), hr(), ni = (e) => e === "number" || e === "currency", ri = {
|
|
3767
3879
|
text: 160,
|
|
3768
3880
|
select: 132,
|
|
3769
3881
|
lookup: 168,
|
|
3770
3882
|
number: 104,
|
|
3771
3883
|
currency: 116,
|
|
3772
|
-
date: 150
|
|
3773
|
-
|
|
3774
|
-
}
|
|
3775
|
-
|
|
3884
|
+
date: 150,
|
|
3885
|
+
file: 168
|
|
3886
|
+
}, ii = (e) => e.width ?? ri[e.type ?? "text"] ?? 132, ai = ti;
|
|
3887
|
+
})), si = /* @__PURE__ */ Q({ ColorField: () => ci });
|
|
3888
|
+
function ci({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3776
3889
|
let a = n || i.schema;
|
|
3777
3890
|
return r ? /* @__PURE__ */ X("div", {
|
|
3778
3891
|
className: "flex items-center gap-2",
|
|
@@ -3802,8 +3915,8 @@ function oi({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3802
3915
|
})]
|
|
3803
3916
|
});
|
|
3804
3917
|
}
|
|
3805
|
-
var
|
|
3806
|
-
function
|
|
3918
|
+
var li = Z((() => {})), ui = /* @__PURE__ */ Q({ SliderField: () => di });
|
|
3919
|
+
function di({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3807
3920
|
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
3808
3921
|
return r ? /* @__PURE__ */ X("div", {
|
|
3809
3922
|
className: "flex items-center gap-2",
|
|
@@ -3816,7 +3929,7 @@ function li({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3816
3929
|
})]
|
|
3817
3930
|
}) : /* @__PURE__ */ X("div", {
|
|
3818
3931
|
className: "flex items-center gap-4",
|
|
3819
|
-
children: [/* @__PURE__ */ Y(
|
|
3932
|
+
children: [/* @__PURE__ */ Y(he, {
|
|
3820
3933
|
value: [e ?? o],
|
|
3821
3934
|
onValueChange: (e) => t(e[0]),
|
|
3822
3935
|
min: o,
|
|
@@ -3830,11 +3943,11 @@ function li({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3830
3943
|
})]
|
|
3831
3944
|
});
|
|
3832
3945
|
}
|
|
3833
|
-
var
|
|
3834
|
-
function
|
|
3946
|
+
var fi = Z((() => {})), pi = /* @__PURE__ */ Q({ RatingField: () => mi });
|
|
3947
|
+
function mi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
3835
3948
|
let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
|
|
3836
3949
|
return i ? /* @__PURE__ */ X("div", {
|
|
3837
|
-
className:
|
|
3950
|
+
className: K("flex items-center gap-1", a),
|
|
3838
3951
|
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ Y(Ge, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ X("span", {
|
|
3839
3952
|
className: "ml-2 text-sm text-muted-foreground",
|
|
3840
3953
|
children: [
|
|
@@ -3844,7 +3957,7 @@ function fi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3844
3957
|
]
|
|
3845
3958
|
})]
|
|
3846
3959
|
}) : /* @__PURE__ */ X("div", {
|
|
3847
|
-
className:
|
|
3960
|
+
className: K("flex items-center gap-1", a),
|
|
3848
3961
|
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ Y("button", {
|
|
3849
3962
|
type: "button",
|
|
3850
3963
|
onClick: () => n(t + 1),
|
|
@@ -3863,24 +3976,24 @@ function fi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3863
3976
|
})]
|
|
3864
3977
|
});
|
|
3865
3978
|
}
|
|
3866
|
-
var
|
|
3867
|
-
function
|
|
3979
|
+
var hi = Z((() => {})), gi = /* @__PURE__ */ Q({ CodeField: () => _i });
|
|
3980
|
+
function _i({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3868
3981
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
3869
3982
|
return r ? /* @__PURE__ */ Y("pre", {
|
|
3870
|
-
className:
|
|
3983
|
+
className: K("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
3871
3984
|
children: /* @__PURE__ */ Y("code", { children: e || /* @__PURE__ */ Y(P, {}) })
|
|
3872
|
-
}) : /* @__PURE__ */ Y(
|
|
3985
|
+
}) : /* @__PURE__ */ Y(G, {
|
|
3873
3986
|
value: e || "",
|
|
3874
3987
|
onChange: (e) => t(e.target.value),
|
|
3875
3988
|
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
3876
3989
|
disabled: r || i.disabled,
|
|
3877
|
-
className:
|
|
3990
|
+
className: K("font-mono text-sm", i.className),
|
|
3878
3991
|
rows: 12,
|
|
3879
3992
|
spellCheck: !1
|
|
3880
3993
|
});
|
|
3881
3994
|
}
|
|
3882
|
-
var
|
|
3883
|
-
function
|
|
3995
|
+
var vi = Z((() => {})), yi = /* @__PURE__ */ Q({ AvatarField: () => bi });
|
|
3996
|
+
function bi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
3884
3997
|
let [o, s] = e.useState(!1), c = e.useRef(null), l = r || a.schema, u = (e) => {
|
|
3885
3998
|
let t = e.target.files?.[0];
|
|
3886
3999
|
if (!t) return;
|
|
@@ -3953,8 +4066,8 @@ function vi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3953
4066
|
})]
|
|
3954
4067
|
});
|
|
3955
4068
|
}
|
|
3956
|
-
var
|
|
3957
|
-
function
|
|
4069
|
+
var xi = Z((() => {})), Si = /* @__PURE__ */ Q({ AddressField: () => Ci });
|
|
4070
|
+
function Ci({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3958
4071
|
let a = e || {}, o = (e, n) => {
|
|
3959
4072
|
t({
|
|
3960
4073
|
...a,
|
|
@@ -4044,8 +4157,8 @@ function xi({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
4044
4157
|
]
|
|
4045
4158
|
});
|
|
4046
4159
|
}
|
|
4047
|
-
var
|
|
4048
|
-
function
|
|
4160
|
+
var wi = Z((() => {})), Ti = /* @__PURE__ */ Q({ GeolocationField: () => Ei });
|
|
4161
|
+
function Ei({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
4049
4162
|
let [o, s] = e.useState(!1), c = t || {}, l = (e, t) => {
|
|
4050
4163
|
n({
|
|
4051
4164
|
...c,
|
|
@@ -4079,7 +4192,7 @@ function wi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4079
4192
|
return /* @__PURE__ */ X("div", {
|
|
4080
4193
|
className: "flex items-center gap-2",
|
|
4081
4194
|
children: [
|
|
4082
|
-
/* @__PURE__ */ Y(
|
|
4195
|
+
/* @__PURE__ */ Y(J, { className: "w-4 h-4 text-muted-foreground" }),
|
|
4083
4196
|
e ? /* @__PURE__ */ Y("span", {
|
|
4084
4197
|
className: "text-sm",
|
|
4085
4198
|
children: e
|
|
@@ -4106,13 +4219,13 @@ function wi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4106
4219
|
size: "sm",
|
|
4107
4220
|
onClick: u,
|
|
4108
4221
|
disabled: i || o,
|
|
4109
|
-
children: [/* @__PURE__ */ Y(
|
|
4222
|
+
children: [/* @__PURE__ */ Y(Oe, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
4110
4223
|
}), c.latitude && c.longitude && /* @__PURE__ */ X(T, {
|
|
4111
4224
|
type: "button",
|
|
4112
4225
|
variant: "link",
|
|
4113
4226
|
size: "sm",
|
|
4114
4227
|
onClick: f,
|
|
4115
|
-
children: [/* @__PURE__ */ Y(
|
|
4228
|
+
children: [/* @__PURE__ */ Y(J, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
4116
4229
|
})]
|
|
4117
4230
|
}),
|
|
4118
4231
|
/* @__PURE__ */ X("div", {
|
|
@@ -4155,8 +4268,8 @@ function wi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4155
4268
|
]
|
|
4156
4269
|
});
|
|
4157
4270
|
}
|
|
4158
|
-
var
|
|
4159
|
-
function
|
|
4271
|
+
var Di = Z((() => {})), Oi = /* @__PURE__ */ Q({ SignatureField: () => ki });
|
|
4272
|
+
function ki({ value: t, onChange: n, readonly: r }) {
|
|
4160
4273
|
let i = c(null), [o, s] = e.useState(!1), [l, u] = e.useState(!t);
|
|
4161
4274
|
a(() => {
|
|
4162
4275
|
if (t && i.current) {
|
|
@@ -4236,13 +4349,13 @@ function Di({ value: t, onChange: n, readonly: r }) {
|
|
|
4236
4349
|
t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
|
|
4237
4350
|
},
|
|
4238
4351
|
disabled: r || l,
|
|
4239
|
-
children: [/* @__PURE__ */ Y(
|
|
4352
|
+
children: [/* @__PURE__ */ Y(ke, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
4240
4353
|
})]
|
|
4241
4354
|
})]
|
|
4242
4355
|
});
|
|
4243
4356
|
}
|
|
4244
|
-
var
|
|
4245
|
-
function
|
|
4357
|
+
var Ai = Z((() => {})), ji = /* @__PURE__ */ Q({ QRCodeField: () => Mi });
|
|
4358
|
+
function Mi({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
4246
4359
|
let [o, s] = e.useState(!1), c = r || a.schema;
|
|
4247
4360
|
return i ? /* @__PURE__ */ X("div", {
|
|
4248
4361
|
className: "flex items-center gap-3",
|
|
@@ -4279,7 +4392,7 @@ function Ai({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4279
4392
|
onClick: () => {
|
|
4280
4393
|
t && navigator.clipboard.writeText(t);
|
|
4281
4394
|
},
|
|
4282
|
-
children: /* @__PURE__ */ Y(
|
|
4395
|
+
children: /* @__PURE__ */ Y(Ee, { className: "w-4 h-4" })
|
|
4283
4396
|
}), /* @__PURE__ */ Y(T, {
|
|
4284
4397
|
type: "button",
|
|
4285
4398
|
variant: "outline",
|
|
@@ -4307,8 +4420,8 @@ function Ai({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4307
4420
|
]
|
|
4308
4421
|
});
|
|
4309
4422
|
}
|
|
4310
|
-
var
|
|
4311
|
-
function
|
|
4423
|
+
var Ni = Z((() => {})), Pi = /* @__PURE__ */ Q({ MultiSelectField: () => Fi });
|
|
4424
|
+
function Fi({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
4312
4425
|
let o = (n || a.schema)?.options || [], s = Array.isArray(e) ? e : e == null ? [] : [e];
|
|
4313
4426
|
if (r) return s.length === 0 ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("div", {
|
|
4314
4427
|
className: "flex flex-wrap gap-1",
|
|
@@ -4321,7 +4434,7 @@ function Ni({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4321
4434
|
t(s.includes(e) ? s.filter((t) => t !== e) : [...s, e]);
|
|
4322
4435
|
};
|
|
4323
4436
|
return /* @__PURE__ */ Y("div", {
|
|
4324
|
-
className:
|
|
4437
|
+
className: K("flex flex-wrap gap-1.5", i),
|
|
4325
4438
|
children: o.map((e) => {
|
|
4326
4439
|
let t = s.includes(e.value);
|
|
4327
4440
|
return /* @__PURE__ */ Y("button", {
|
|
@@ -4329,14 +4442,14 @@ function Ni({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4329
4442
|
onClick: () => c(e.value),
|
|
4330
4443
|
disabled: a.disabled,
|
|
4331
4444
|
"aria-pressed": t,
|
|
4332
|
-
className:
|
|
4445
|
+
className: K("rounded-full border px-3 py-1 text-sm transition-colors", t ? "border-primary bg-primary text-primary-foreground" : "border-input bg-background text-foreground hover:bg-accent"),
|
|
4333
4446
|
children: e.label
|
|
4334
4447
|
}, e.value);
|
|
4335
4448
|
})
|
|
4336
4449
|
});
|
|
4337
4450
|
}
|
|
4338
|
-
var
|
|
4339
|
-
function
|
|
4451
|
+
var Ii = Z((() => {})), Li = /* @__PURE__ */ Q({ RadioField: () => Ri });
|
|
4452
|
+
function Ri({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
4340
4453
|
let s = (n || a.schema)?.options || [], c = o();
|
|
4341
4454
|
return r ? e == null || e === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
4342
4455
|
className: "text-sm",
|
|
@@ -4350,7 +4463,7 @@ function Ii({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4350
4463
|
let t = `${c}-${e.value}`;
|
|
4351
4464
|
return /* @__PURE__ */ X("div", {
|
|
4352
4465
|
className: "flex items-center space-x-2",
|
|
4353
|
-
children: [/* @__PURE__ */ Y(
|
|
4466
|
+
children: [/* @__PURE__ */ Y(ie, {
|
|
4354
4467
|
value: e.value,
|
|
4355
4468
|
id: t
|
|
4356
4469
|
}), /* @__PURE__ */ Y(I, {
|
|
@@ -4362,8 +4475,8 @@ function Ii({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4362
4475
|
})
|
|
4363
4476
|
});
|
|
4364
4477
|
}
|
|
4365
|
-
var
|
|
4366
|
-
function
|
|
4478
|
+
var zi = Z((() => {})), Bi = /* @__PURE__ */ Q({ CheckboxesField: () => Vi });
|
|
4479
|
+
function Vi({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
4367
4480
|
let s = (n || a.schema)?.options || [], c = Array.isArray(e) ? e : e == null ? [] : [e], l = o();
|
|
4368
4481
|
if (r) return c.length === 0 ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("div", {
|
|
4369
4482
|
className: "flex flex-wrap gap-1",
|
|
@@ -4395,8 +4508,8 @@ function zi({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4395
4508
|
})
|
|
4396
4509
|
});
|
|
4397
4510
|
}
|
|
4398
|
-
var
|
|
4399
|
-
function
|
|
4511
|
+
var Hi = Z((() => {})), Ui = /* @__PURE__ */ Q({ TagsField: () => Wi });
|
|
4512
|
+
function Wi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
4400
4513
|
let s = Array.isArray(t) ? t : t == null ? [] : [t], [c, l] = e.useState("");
|
|
4401
4514
|
if (i) return s.length === 0 ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("div", {
|
|
4402
4515
|
className: "flex flex-wrap gap-1",
|
|
@@ -4410,7 +4523,7 @@ function Hi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
4410
4523
|
!t || s.includes(t) || (n([...s, t]), l(""));
|
|
4411
4524
|
}, d = (e) => n(s.filter((t) => t !== e));
|
|
4412
4525
|
return /* @__PURE__ */ X("div", {
|
|
4413
|
-
className:
|
|
4526
|
+
className: K("flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background p-1.5", a),
|
|
4414
4527
|
children: [s.map((e) => /* @__PURE__ */ X(w, {
|
|
4415
4528
|
variant: "secondary",
|
|
4416
4529
|
className: "gap-1",
|
|
@@ -4434,25 +4547,25 @@ function Hi({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
4434
4547
|
})]
|
|
4435
4548
|
});
|
|
4436
4549
|
}
|
|
4437
|
-
var
|
|
4438
|
-
ur(),
|
|
4439
|
-
var
|
|
4550
|
+
var Gi = Z((() => {}));
|
|
4551
|
+
ur(), Sr(), Or(), jr(), Pr(), Vr(), Wr(), oi(), xi(), Ai(), sr(), fi(), hi(), Ii(), zi(), Hi(), Gi(), tr(), ir(), Jn(), Rr(), li(), wi(), Tr(), Di(), vi(), Ni();
|
|
4552
|
+
var Ki = {
|
|
4440
4553
|
text: ct,
|
|
4441
4554
|
textarea: Ht,
|
|
4442
4555
|
number: dt,
|
|
4443
4556
|
currency: zt,
|
|
4444
4557
|
percent: or,
|
|
4445
|
-
slider:
|
|
4446
|
-
progress:
|
|
4447
|
-
rating:
|
|
4558
|
+
slider: di,
|
|
4559
|
+
progress: di,
|
|
4560
|
+
rating: mi,
|
|
4448
4561
|
boolean: mt,
|
|
4449
4562
|
toggle: mt,
|
|
4450
4563
|
select: bt,
|
|
4451
4564
|
status: bt,
|
|
4452
|
-
multiselect:
|
|
4453
|
-
radio:
|
|
4454
|
-
checkboxes:
|
|
4455
|
-
tags:
|
|
4565
|
+
multiselect: Fi,
|
|
4566
|
+
radio: Ri,
|
|
4567
|
+
checkboxes: Vi,
|
|
4568
|
+
tags: Wi,
|
|
4456
4569
|
date: Tt,
|
|
4457
4570
|
datetime: er,
|
|
4458
4571
|
time: rr,
|
|
@@ -4461,15 +4574,15 @@ var Wi = {
|
|
|
4461
4574
|
url: Pt,
|
|
4462
4575
|
lookup: Un,
|
|
4463
4576
|
master_detail: Un,
|
|
4464
|
-
user:
|
|
4465
|
-
owner:
|
|
4466
|
-
color:
|
|
4467
|
-
address:
|
|
4468
|
-
location:
|
|
4469
|
-
geolocation:
|
|
4470
|
-
code:
|
|
4471
|
-
qrcode:
|
|
4472
|
-
},
|
|
4577
|
+
user: Lr,
|
|
4578
|
+
owner: Lr,
|
|
4579
|
+
color: ci,
|
|
4580
|
+
address: Ci,
|
|
4581
|
+
location: wr,
|
|
4582
|
+
geolocation: Ei,
|
|
4583
|
+
code: _i,
|
|
4584
|
+
qrcode: Mi
|
|
4585
|
+
}, qi = /* @__PURE__ */ new Set([
|
|
4473
4586
|
"formula",
|
|
4474
4587
|
"summary",
|
|
4475
4588
|
"auto_number",
|
|
@@ -4487,7 +4600,7 @@ var Wi = {
|
|
|
4487
4600
|
"object-ref",
|
|
4488
4601
|
"filter-condition",
|
|
4489
4602
|
"recipient-picker"
|
|
4490
|
-
]),
|
|
4603
|
+
]), Ji = /* @__PURE__ */ new Set([
|
|
4491
4604
|
"boolean",
|
|
4492
4605
|
"toggle",
|
|
4493
4606
|
"select",
|
|
@@ -4495,32 +4608,32 @@ var Wi = {
|
|
|
4495
4608
|
"radio",
|
|
4496
4609
|
"rating"
|
|
4497
4610
|
]);
|
|
4498
|
-
function
|
|
4499
|
-
return !!e && e in
|
|
4611
|
+
function Yi(e) {
|
|
4612
|
+
return !!e && e in Ki;
|
|
4500
4613
|
}
|
|
4501
|
-
var
|
|
4614
|
+
var Xi = /* @__PURE__ */ new Set([
|
|
4502
4615
|
"lookup",
|
|
4503
4616
|
"master_detail",
|
|
4504
4617
|
"user",
|
|
4505
4618
|
"owner"
|
|
4506
4619
|
]);
|
|
4507
|
-
function
|
|
4508
|
-
let i = e?.type ?
|
|
4620
|
+
function Zi({ field: e, value: t, onChange: n, readonly: r }) {
|
|
4621
|
+
let i = e?.type ? Ki[e.type] : void 0;
|
|
4509
4622
|
return i ? /* @__PURE__ */ Y(i, {
|
|
4510
4623
|
field: e,
|
|
4511
4624
|
value: t,
|
|
4512
4625
|
onChange: n,
|
|
4513
4626
|
readonly: r,
|
|
4514
|
-
...e?.type &&
|
|
4627
|
+
...e?.type && Xi.has(e.type) ? { compact: !0 } : {}
|
|
4515
4628
|
}) : null;
|
|
4516
4629
|
}
|
|
4517
4630
|
//#endregion
|
|
4518
4631
|
//#region src/widgets/ObjectRefField.tsx
|
|
4519
|
-
var
|
|
4520
|
-
ObjectRefField: () =>
|
|
4521
|
-
default: () =>
|
|
4632
|
+
var Qi = /* @__PURE__ */ Q({
|
|
4633
|
+
ObjectRefField: () => $i,
|
|
4634
|
+
default: () => $i
|
|
4522
4635
|
});
|
|
4523
|
-
function
|
|
4636
|
+
function $i({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
4524
4637
|
let o = e.useContext(Xe), s = a.dataSource ?? o?.dataSource ?? null, c = a.disabled, [l, u] = e.useState(null);
|
|
4525
4638
|
e.useEffect(() => {
|
|
4526
4639
|
if (!s) return;
|
|
@@ -4568,19 +4681,19 @@ function Zi({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4568
4681
|
searchPlaceholder: "Search objects…",
|
|
4569
4682
|
emptyText: l === null ? "Loading…" : "No objects found",
|
|
4570
4683
|
disabled: c,
|
|
4571
|
-
className:
|
|
4684
|
+
className: K(i)
|
|
4572
4685
|
});
|
|
4573
4686
|
}
|
|
4574
|
-
var
|
|
4575
|
-
FilterConditionField: () =>
|
|
4576
|
-
default: () =>
|
|
4687
|
+
var ea = Z((() => {})), ta = /* @__PURE__ */ Q({
|
|
4688
|
+
FilterConditionField: () => da,
|
|
4689
|
+
default: () => da
|
|
4577
4690
|
});
|
|
4578
|
-
function
|
|
4691
|
+
function na(e) {
|
|
4579
4692
|
let t = e?.fields, n = Array.isArray(t) ? t.map((e) => [e?.name, e]) : t && typeof t == "object" ? Object.entries(t) : [], r = [];
|
|
4580
4693
|
for (let [e, t] of n) {
|
|
4581
4694
|
if (!e || !t || t.hidden) continue;
|
|
4582
4695
|
let n = t.type;
|
|
4583
|
-
n &&
|
|
4696
|
+
n && pa.has(n) || r.push({
|
|
4584
4697
|
value: e,
|
|
4585
4698
|
label: t.label || e,
|
|
4586
4699
|
type: n,
|
|
@@ -4596,7 +4709,7 @@ function ea(e) {
|
|
|
4596
4709
|
}
|
|
4597
4710
|
return r;
|
|
4598
4711
|
}
|
|
4599
|
-
function
|
|
4712
|
+
function ra(e, t) {
|
|
4600
4713
|
if (e == null) return e;
|
|
4601
4714
|
if (t === "boolean" || t === "toggle") return typeof e == "boolean" ? e : e === "true" || e !== "false" && e;
|
|
4602
4715
|
if (t === "number" || t === "currency" || t === "percent" || t === "rating" || t === "slider") {
|
|
@@ -4605,13 +4718,13 @@ function ta(e, t) {
|
|
|
4605
4718
|
}
|
|
4606
4719
|
return e;
|
|
4607
4720
|
}
|
|
4608
|
-
function
|
|
4721
|
+
function ia(e) {
|
|
4609
4722
|
return Array.isArray(e) ? e : typeof e == "string" ? e.split(",").map((e) => e.trim()).filter(Boolean) : e == null ? [] : [e];
|
|
4610
4723
|
}
|
|
4611
|
-
function
|
|
4724
|
+
function aa(e, t) {
|
|
4612
4725
|
let { field: n, operator: r, value: i } = e || {};
|
|
4613
4726
|
if (!n) return null;
|
|
4614
|
-
let a = t(n), o =
|
|
4727
|
+
let a = t(n), o = ra(i, a);
|
|
4615
4728
|
switch (r) {
|
|
4616
4729
|
case "equals": return { [n]: o };
|
|
4617
4730
|
case "notEquals": return { [n]: { $ne: o } };
|
|
@@ -4628,27 +4741,27 @@ function ra(e, t) {
|
|
|
4628
4741
|
case "between": {
|
|
4629
4742
|
let [e, t] = Array.isArray(i) ? i : [void 0, void 0];
|
|
4630
4743
|
return { [n]: {
|
|
4631
|
-
$gte:
|
|
4632
|
-
$lte:
|
|
4744
|
+
$gte: ra(e, a),
|
|
4745
|
+
$lte: ra(t, a)
|
|
4633
4746
|
} };
|
|
4634
4747
|
}
|
|
4635
|
-
case "in": return { [n]: { $in:
|
|
4636
|
-
case "notIn": return { [n]: { $nin:
|
|
4748
|
+
case "in": return { [n]: { $in: ia(i).map((e) => ra(e, a)) } };
|
|
4749
|
+
case "notIn": return { [n]: { $nin: ia(i).map((e) => ra(e, a)) } };
|
|
4637
4750
|
default: return { [n]: o };
|
|
4638
4751
|
}
|
|
4639
4752
|
}
|
|
4640
|
-
function
|
|
4641
|
-
let n = (e?.conditions ?? []).map((e) =>
|
|
4753
|
+
function oa(e, t) {
|
|
4754
|
+
let n = (e?.conditions ?? []).map((e) => aa(e, t)).filter((e) => !!e);
|
|
4642
4755
|
if (n.length === 0) return null;
|
|
4643
4756
|
if (e.logic === "or") return { $or: n };
|
|
4644
4757
|
if (n.length === 1) return n[0];
|
|
4645
4758
|
let r = n.flatMap((e) => Object.keys(e));
|
|
4646
4759
|
return new Set(r).size === r.length ? Object.assign({}, ...n) : { $and: n };
|
|
4647
4760
|
}
|
|
4648
|
-
function
|
|
4761
|
+
function sa(e, t) {
|
|
4649
4762
|
return Array.isArray(e) && e.length === t.length && e.every((e, n) => e === t[n]);
|
|
4650
4763
|
}
|
|
4651
|
-
function
|
|
4764
|
+
function ca(e, t, n) {
|
|
4652
4765
|
let r = `c_${n}_${e}`;
|
|
4653
4766
|
if (typeof t != "object" || !t || Array.isArray(t)) return {
|
|
4654
4767
|
id: r,
|
|
@@ -4702,7 +4815,7 @@ function oa(e, t, n) {
|
|
|
4702
4815
|
operator: "lessOrEqual",
|
|
4703
4816
|
value: a
|
|
4704
4817
|
};
|
|
4705
|
-
case "$in": return
|
|
4818
|
+
case "$in": return sa(a, [null, ""]) ? {
|
|
4706
4819
|
id: r,
|
|
4707
4820
|
field: e,
|
|
4708
4821
|
operator: "isEmpty",
|
|
@@ -4713,7 +4826,7 @@ function oa(e, t, n) {
|
|
|
4713
4826
|
operator: "in",
|
|
4714
4827
|
value: a
|
|
4715
4828
|
};
|
|
4716
|
-
case "$nin": return
|
|
4829
|
+
case "$nin": return sa(a, [null, ""]) ? {
|
|
4717
4830
|
id: r,
|
|
4718
4831
|
field: e,
|
|
4719
4832
|
operator: "isNotEmpty",
|
|
@@ -4734,15 +4847,15 @@ function oa(e, t, n) {
|
|
|
4734
4847
|
value: [t.$gte, t.$lte]
|
|
4735
4848
|
} : null;
|
|
4736
4849
|
}
|
|
4737
|
-
function
|
|
4850
|
+
function la(e) {
|
|
4738
4851
|
if (e == null) return {
|
|
4739
|
-
...
|
|
4852
|
+
...fa,
|
|
4740
4853
|
conditions: []
|
|
4741
4854
|
};
|
|
4742
4855
|
if (typeof e != "object" || Array.isArray(e)) return null;
|
|
4743
4856
|
let t = Object.entries(e);
|
|
4744
4857
|
if (t.length === 0) return {
|
|
4745
|
-
...
|
|
4858
|
+
...fa,
|
|
4746
4859
|
conditions: []
|
|
4747
4860
|
};
|
|
4748
4861
|
if (t.length === 1 && (e.$or || e.$and)) {
|
|
@@ -4754,7 +4867,7 @@ function sa(e) {
|
|
|
4754
4867
|
if (!t || typeof t != "object" || Object.keys(t).length !== 1) return null;
|
|
4755
4868
|
let i = Object.keys(t)[0];
|
|
4756
4869
|
if (i.startsWith("$")) return null;
|
|
4757
|
-
let a =
|
|
4870
|
+
let a = ca(i, t[i], e);
|
|
4758
4871
|
if (!a) return null;
|
|
4759
4872
|
r.push(a);
|
|
4760
4873
|
}
|
|
@@ -4767,7 +4880,7 @@ function sa(e) {
|
|
|
4767
4880
|
let n = [], r = 0;
|
|
4768
4881
|
for (let [e, i] of t) {
|
|
4769
4882
|
if (e.startsWith("$")) return null;
|
|
4770
|
-
let t =
|
|
4883
|
+
let t = ca(e, i, r++);
|
|
4771
4884
|
if (!t) return null;
|
|
4772
4885
|
n.push(t);
|
|
4773
4886
|
}
|
|
@@ -4777,7 +4890,7 @@ function sa(e) {
|
|
|
4777
4890
|
conditions: n
|
|
4778
4891
|
};
|
|
4779
4892
|
}
|
|
4780
|
-
function
|
|
4893
|
+
function ua(e) {
|
|
4781
4894
|
if (e == null || e === "") return "";
|
|
4782
4895
|
if (typeof e == "string") return e;
|
|
4783
4896
|
try {
|
|
@@ -4786,7 +4899,7 @@ function ca(e) {
|
|
|
4786
4899
|
return "";
|
|
4787
4900
|
}
|
|
4788
4901
|
}
|
|
4789
|
-
function
|
|
4902
|
+
function da({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
4790
4903
|
let o = e.useContext(Xe), s = a.dataSource ?? o?.dataSource ?? null, c = a.dependentValues ?? {}, l = String(c.object_name ?? ""), [u, d] = e.useState(null);
|
|
4791
4904
|
e.useEffect(() => {
|
|
4792
4905
|
if (d(null), !s || !l || typeof s.getObjectSchema != "function") return;
|
|
@@ -4794,7 +4907,7 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4794
4907
|
return (async () => {
|
|
4795
4908
|
try {
|
|
4796
4909
|
let t = await s.getObjectSchema(l);
|
|
4797
|
-
e || d(
|
|
4910
|
+
e || d(na(t));
|
|
4798
4911
|
} catch {
|
|
4799
4912
|
e || d([]);
|
|
4800
4913
|
}
|
|
@@ -4802,7 +4915,7 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4802
4915
|
e = !0;
|
|
4803
4916
|
};
|
|
4804
4917
|
}, [s, l]);
|
|
4805
|
-
let f = e.useMemo(() =>
|
|
4918
|
+
let f = e.useMemo(() => ua(t), [t]), p = e.useMemo(() => {
|
|
4806
4919
|
if (!f.trim()) return {
|
|
4807
4920
|
mongo: {},
|
|
4808
4921
|
ok: !0
|
|
@@ -4818,7 +4931,7 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4818
4931
|
ok: !1
|
|
4819
4932
|
};
|
|
4820
4933
|
}
|
|
4821
|
-
}, [f]), m = e.useMemo(() => p.ok ?
|
|
4934
|
+
}, [f]), m = e.useMemo(() => p.ok ? la(p.mongo) : null, [p]), h = p.ok && m !== null, [g, _] = e.useState(!h);
|
|
4822
4935
|
e.useEffect(() => {
|
|
4823
4936
|
h || _(!0);
|
|
4824
4937
|
}, [h]);
|
|
@@ -4827,13 +4940,13 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4827
4940
|
return (t) => e.get(t);
|
|
4828
4941
|
}, [u]);
|
|
4829
4942
|
return l ? r ? f.trim() ? /* @__PURE__ */ Y("pre", {
|
|
4830
|
-
className:
|
|
4943
|
+
className: K("overflow-x-auto rounded bg-muted/40 p-2 text-xs", i),
|
|
4831
4944
|
children: f
|
|
4832
4945
|
}) : /* @__PURE__ */ Y("span", {
|
|
4833
|
-
className:
|
|
4946
|
+
className: K("text-sm text-muted-foreground", i),
|
|
4834
4947
|
children: "All records"
|
|
4835
4948
|
}) : /* @__PURE__ */ X("div", {
|
|
4836
|
-
className:
|
|
4949
|
+
className: K("flex flex-col gap-2", i),
|
|
4837
4950
|
children: [g ? /* @__PURE__ */ X(tt, { children: [/* @__PURE__ */ Y("textarea", {
|
|
4838
4951
|
className: "min-h-[96px] w-full rounded border bg-background px-2 py-1 font-mono text-xs",
|
|
4839
4952
|
value: f,
|
|
@@ -4844,9 +4957,9 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4844
4957
|
children: "Invalid JSON — the rule will match no records until fixed."
|
|
4845
4958
|
})] }) : /* @__PURE__ */ Y(ee, {
|
|
4846
4959
|
fields: u ?? [],
|
|
4847
|
-
value: m ??
|
|
4960
|
+
value: m ?? fa,
|
|
4848
4961
|
onChange: (e) => {
|
|
4849
|
-
let t =
|
|
4962
|
+
let t = oa(e, v);
|
|
4850
4963
|
n(t == null ? "" : JSON.stringify(t));
|
|
4851
4964
|
}
|
|
4852
4965
|
}), /* @__PURE__ */ Y("button", {
|
|
@@ -4858,16 +4971,16 @@ function la({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4858
4971
|
children: g ? "Use visual builder" : "Edit as JSON"
|
|
4859
4972
|
})]
|
|
4860
4973
|
}) : /* @__PURE__ */ Y("p", {
|
|
4861
|
-
className:
|
|
4974
|
+
className: K("text-sm text-muted-foreground", i),
|
|
4862
4975
|
children: "Select an object first."
|
|
4863
4976
|
});
|
|
4864
4977
|
}
|
|
4865
|
-
var
|
|
4866
|
-
|
|
4978
|
+
var fa, pa, ma = Z((() => {
|
|
4979
|
+
fa = {
|
|
4867
4980
|
id: "root",
|
|
4868
4981
|
logic: "and",
|
|
4869
4982
|
conditions: []
|
|
4870
|
-
},
|
|
4983
|
+
}, pa = /* @__PURE__ */ new Set([
|
|
4871
4984
|
"object",
|
|
4872
4985
|
"vector",
|
|
4873
4986
|
"file",
|
|
@@ -4882,12 +4995,12 @@ var ua, da, fa = Z((() => {
|
|
|
4882
4995
|
"json",
|
|
4883
4996
|
"code"
|
|
4884
4997
|
]);
|
|
4885
|
-
})),
|
|
4886
|
-
RecipientPickerField: () =>
|
|
4887
|
-
default: () =>
|
|
4998
|
+
})), ha = /* @__PURE__ */ Q({
|
|
4999
|
+
RecipientPickerField: () => ga,
|
|
5000
|
+
default: () => ga
|
|
4888
5001
|
});
|
|
4889
|
-
function
|
|
4890
|
-
let o = e.useContext(Xe), s = a.dataSource ?? o?.dataSource ?? null, c = a.disabled, l = a.dependentValues ?? {}, u = String(l.recipient_type ?? ""), d =
|
|
5002
|
+
function ga({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
5003
|
+
let o = e.useContext(Xe), s = a.dataSource ?? o?.dataSource ?? null, c = a.disabled, l = a.dependentValues ?? {}, u = String(l.recipient_type ?? ""), d = _a[u], [f, p] = e.useState(null), m = e.useRef(null);
|
|
4891
5004
|
e.useEffect(() => {
|
|
4892
5005
|
m.current !== null && m.current !== u && t && n(""), m.current = u;
|
|
4893
5006
|
}, [u]), e.useEffect(() => {
|
|
@@ -4937,17 +5050,17 @@ function ma({ value: t, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
4937
5050
|
disabled: c,
|
|
4938
5051
|
className: i
|
|
4939
5052
|
}) : /* @__PURE__ */ Y("input", {
|
|
4940
|
-
className:
|
|
5053
|
+
className: K("w-full rounded border bg-background px-2 py-1 text-sm", i),
|
|
4941
5054
|
value: t ?? "",
|
|
4942
5055
|
disabled: c || r,
|
|
4943
5056
|
onChange: (e) => n(e.target.value)
|
|
4944
5057
|
}) : /* @__PURE__ */ Y("p", {
|
|
4945
|
-
className:
|
|
5058
|
+
className: K("text-sm text-muted-foreground", i),
|
|
4946
5059
|
children: "Select a recipient type first."
|
|
4947
5060
|
});
|
|
4948
5061
|
}
|
|
4949
|
-
var
|
|
4950
|
-
|
|
5062
|
+
var _a, va = Z((() => {
|
|
5063
|
+
_a = {
|
|
4951
5064
|
user: {
|
|
4952
5065
|
object: "sys_user",
|
|
4953
5066
|
storeField: "id",
|
|
@@ -4981,8 +5094,8 @@ var ha, ga = Z((() => {
|
|
|
4981
5094
|
}));
|
|
4982
5095
|
//#endregion
|
|
4983
5096
|
//#region src/widgets/MasterDetailField.tsx
|
|
4984
|
-
|
|
4985
|
-
function
|
|
5097
|
+
vr();
|
|
5098
|
+
function ya({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
4986
5099
|
let o = e || [], s = n || a.schema, c = () => {
|
|
4987
5100
|
let e = {
|
|
4988
5101
|
id: `new-${Date.now()}`,
|
|
@@ -4995,7 +5108,7 @@ function _a({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
4995
5108
|
console.log("View detail:", e);
|
|
4996
5109
|
};
|
|
4997
5110
|
return r ? /* @__PURE__ */ X("div", {
|
|
4998
|
-
className:
|
|
5111
|
+
className: K("space-y-2", i),
|
|
4999
5112
|
children: [o.length === 0 ? /* @__PURE__ */ Y("span", {
|
|
5000
5113
|
className: "text-sm text-muted-foreground",
|
|
5001
5114
|
children: "No related records"
|
|
@@ -5009,7 +5122,7 @@ function _a({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
5009
5122
|
variant: "ghost",
|
|
5010
5123
|
size: "sm",
|
|
5011
5124
|
onClick: () => u(e),
|
|
5012
|
-
children: /* @__PURE__ */ Y(
|
|
5125
|
+
children: /* @__PURE__ */ Y(Ae, { className: "w-4 h-4" })
|
|
5013
5126
|
})]
|
|
5014
5127
|
}, e.id)), /* @__PURE__ */ X("p", {
|
|
5015
5128
|
className: "text-xs text-muted-foreground",
|
|
@@ -5020,7 +5133,7 @@ function _a({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
5020
5133
|
]
|
|
5021
5134
|
})]
|
|
5022
5135
|
}) : /* @__PURE__ */ X("div", {
|
|
5023
|
-
className:
|
|
5136
|
+
className: K("space-y-3", i),
|
|
5024
5137
|
children: [/* @__PURE__ */ X("div", {
|
|
5025
5138
|
className: "space-y-2",
|
|
5026
5139
|
children: [o.map((e) => /* @__PURE__ */ X("div", {
|
|
@@ -5041,7 +5154,7 @@ function _a({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
5041
5154
|
variant: "ghost",
|
|
5042
5155
|
size: "sm",
|
|
5043
5156
|
onClick: () => u(e),
|
|
5044
|
-
children: /* @__PURE__ */ Y(
|
|
5157
|
+
children: /* @__PURE__ */ Y(Ae, { className: "w-4 h-4" })
|
|
5045
5158
|
}), /* @__PURE__ */ Y(T, {
|
|
5046
5159
|
type: "button",
|
|
5047
5160
|
variant: "ghost",
|
|
@@ -5071,8 +5184,8 @@ function _a({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
5071
5184
|
}
|
|
5072
5185
|
//#endregion
|
|
5073
5186
|
//#region src/widgets/MarkdownContent.tsx
|
|
5074
|
-
var
|
|
5075
|
-
function
|
|
5187
|
+
var ba = /* @__PURE__ */ Q({ default: () => xa });
|
|
5188
|
+
function xa({ value: e }) {
|
|
5076
5189
|
return /* @__PURE__ */ Y("div", {
|
|
5077
5190
|
className: "prose prose-sm max-w-none dark:prose-invert break-words",
|
|
5078
5191
|
children: /* @__PURE__ */ Y(rt, {
|
|
@@ -5082,10 +5195,10 @@ function ya({ value: e }) {
|
|
|
5082
5195
|
})
|
|
5083
5196
|
});
|
|
5084
5197
|
}
|
|
5085
|
-
var
|
|
5086
|
-
lt(), ft(), ht(), xt(), Et(), kt(), Mt(), Ft(), Bt(), Ut(), Jn(), tr(), ir(), sr(),
|
|
5087
|
-
var
|
|
5088
|
-
function
|
|
5198
|
+
var Sa = Z((() => {}));
|
|
5199
|
+
lt(), ft(), ht(), xt(), Et(), kt(), Mt(), Ft(), Bt(), Ut(), Jn(), tr(), ir(), sr(), hr(), Tr(), Rr(), li(), fi(), hi(), vi(), wi(), Di(), Ni(), It(), In(), lt(), ft(), ht(), xt(), Et(), tr(), ir(), kt(), Mt(), Ft(), Bt(), sr(), ur(), Ut(), Kt(), Jn(), ea(), ma(), va(), rn(), hr(), Sr(), Tr(), Or(), jr(), Pr(), Rr(), Vr(), Wr(), oi(), li(), fi(), hi(), vi(), xi(), wi(), Di(), Ai(), Ni(), Ii(), zi(), Hi(), Gi();
|
|
5200
|
+
var Ca = /* @__PURE__ */ new Map();
|
|
5201
|
+
function wa(e, t) {
|
|
5089
5202
|
if (!e || typeof e != "object") return;
|
|
5090
5203
|
if (t) {
|
|
5091
5204
|
let n = e[t];
|
|
@@ -5134,69 +5247,126 @@ function Sa(e, t) {
|
|
|
5134
5247
|
if (typeof n == "number") return String(n);
|
|
5135
5248
|
}
|
|
5136
5249
|
}
|
|
5137
|
-
|
|
5250
|
+
var Ta = /* @__PURE__ */ new Map();
|
|
5251
|
+
async function Ea(e, t) {
|
|
5252
|
+
let n = () => {
|
|
5253
|
+
let e = Ta.get(t);
|
|
5254
|
+
return e?.state === "ok" ? e.schema : void 0;
|
|
5255
|
+
}, r = Ta.get(t);
|
|
5256
|
+
if (r?.state === "pending") return await r.promise, n();
|
|
5257
|
+
if (r) return n();
|
|
5258
|
+
let i = e?.getObjectSchema;
|
|
5259
|
+
if (typeof i != "function") return;
|
|
5260
|
+
let a = Promise.resolve().then(() => i.call(e, t)).then((e) => {
|
|
5261
|
+
Ta.set(t, {
|
|
5262
|
+
state: "ok",
|
|
5263
|
+
schema: e
|
|
5264
|
+
});
|
|
5265
|
+
}).catch(() => {
|
|
5266
|
+
Ta.set(t, { state: "err" });
|
|
5267
|
+
});
|
|
5268
|
+
return Ta.set(t, {
|
|
5269
|
+
state: "pending",
|
|
5270
|
+
promise: a
|
|
5271
|
+
}), await a, n();
|
|
5272
|
+
}
|
|
5273
|
+
function Da(t) {
|
|
5274
|
+
let n = e.useContext(Xe)?.dataSource, [, r] = e.useState(0), i = !!t && !!n && typeof n.getObjectSchema == "function";
|
|
5275
|
+
if (e.useEffect(() => {
|
|
5276
|
+
if (!i) return;
|
|
5277
|
+
let e = Ta.get(t);
|
|
5278
|
+
if (e && e.state !== "pending") return;
|
|
5279
|
+
let a = !0;
|
|
5280
|
+
return Ea(n, t).then(() => {
|
|
5281
|
+
a && r((e) => e + 1);
|
|
5282
|
+
}), () => {
|
|
5283
|
+
a = !1;
|
|
5284
|
+
};
|
|
5285
|
+
}, [
|
|
5286
|
+
i,
|
|
5287
|
+
t,
|
|
5288
|
+
n
|
|
5289
|
+
]), !i) return;
|
|
5290
|
+
let a = Ta.get(t);
|
|
5291
|
+
return a?.state === "ok" ? a.schema : void 0;
|
|
5292
|
+
}
|
|
5293
|
+
function Oa(e, t, n) {
|
|
5294
|
+
if (!(!e || typeof e != "object")) {
|
|
5295
|
+
if (t) {
|
|
5296
|
+
let r = d(t, e, { titleField: n }), i = e.id ?? e._id;
|
|
5297
|
+
if (!(r === "Untitled" || i != null && r === `Record #${i}`) && r) return r;
|
|
5298
|
+
}
|
|
5299
|
+
return wa(e, n);
|
|
5300
|
+
}
|
|
5301
|
+
}
|
|
5302
|
+
function ka(e) {
|
|
5138
5303
|
if (typeof e != "string" || !/^[A-Za-z0-9_-]{12,32}$/.test(e)) return !1;
|
|
5139
5304
|
let t = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /[0-9_-]/.test(e);
|
|
5140
5305
|
return t && n || t && r || n && r;
|
|
5141
5306
|
}
|
|
5142
|
-
function
|
|
5143
|
-
let
|
|
5307
|
+
function Aa(t, n, r) {
|
|
5308
|
+
let i = e.useContext(Xe)?.dataSource, [, a] = e.useState(0), o = !!t && !!i && typeof i.find == "function" && (typeof n == "string" || typeof n == "number") && n !== "", s = o ? `${t}:${String(n)}:${r ?? ""}` : "";
|
|
5144
5309
|
if (e.useEffect(() => {
|
|
5145
|
-
if (!
|
|
5146
|
-
let e =
|
|
5310
|
+
if (!o) return;
|
|
5311
|
+
let e = Ca.get(s);
|
|
5147
5312
|
if (e && e.state !== "pending" && e.promise == null || e?.state === "pending") return;
|
|
5148
|
-
let
|
|
5313
|
+
let c = (async () => {
|
|
5149
5314
|
try {
|
|
5150
5315
|
let e;
|
|
5151
|
-
if (typeof
|
|
5316
|
+
if (typeof i.findOne == "function") e = await i.findOne(t, n);
|
|
5152
5317
|
else {
|
|
5153
|
-
let
|
|
5318
|
+
let r = await i.find(t, {
|
|
5154
5319
|
$filter: { id: n },
|
|
5155
5320
|
options: { $top: 1 }
|
|
5156
5321
|
});
|
|
5157
|
-
e = (Array.isArray(
|
|
5322
|
+
e = (Array.isArray(r) ? r : r?.value || r?.data || [])[0];
|
|
5158
5323
|
}
|
|
5159
|
-
let i =
|
|
5160
|
-
|
|
5324
|
+
let a = await Ea(i, t), o = Oa(e, a, r);
|
|
5325
|
+
Ca.set(s, {
|
|
5161
5326
|
state: "ok",
|
|
5162
|
-
name:
|
|
5327
|
+
name: o
|
|
5163
5328
|
});
|
|
5164
5329
|
} catch {
|
|
5165
|
-
|
|
5330
|
+
Ca.set(s, { state: "err" });
|
|
5166
5331
|
}
|
|
5167
|
-
|
|
5332
|
+
a((e) => e + 1);
|
|
5168
5333
|
})();
|
|
5169
|
-
|
|
5334
|
+
Ca.set(s, {
|
|
5170
5335
|
state: "pending",
|
|
5171
|
-
promise:
|
|
5336
|
+
promise: c
|
|
5172
5337
|
});
|
|
5173
5338
|
}, [
|
|
5339
|
+
s,
|
|
5174
5340
|
o,
|
|
5175
|
-
a,
|
|
5176
5341
|
t,
|
|
5177
5342
|
n,
|
|
5178
|
-
r
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5343
|
+
r,
|
|
5344
|
+
i
|
|
5345
|
+
]), !o) return;
|
|
5346
|
+
let c = Ca.get(s);
|
|
5347
|
+
return c?.state === "ok" ? c.name : void 0;
|
|
5348
|
+
}
|
|
5349
|
+
function ja() {
|
|
5350
|
+
let { t: e } = $e();
|
|
5351
|
+
return (t, n) => {
|
|
5352
|
+
let r = e(t);
|
|
5353
|
+
return !r || r === t ? n : r;
|
|
5354
|
+
};
|
|
5182
5355
|
}
|
|
5183
|
-
function
|
|
5356
|
+
function Ma() {
|
|
5184
5357
|
try {
|
|
5185
5358
|
let { t: e } = $e();
|
|
5186
|
-
return
|
|
5187
|
-
let r = e(t);
|
|
5188
|
-
return !r || r === t ? n : r;
|
|
5189
|
-
};
|
|
5359
|
+
return e;
|
|
5190
5360
|
} catch {
|
|
5191
|
-
return
|
|
5361
|
+
return;
|
|
5192
5362
|
}
|
|
5193
5363
|
}
|
|
5194
|
-
function
|
|
5364
|
+
function Na(e) {
|
|
5195
5365
|
if (e == null || typeof e == "number" || typeof e == "boolean") return e;
|
|
5196
5366
|
if (typeof e == "string") {
|
|
5197
5367
|
let t = e.trim();
|
|
5198
5368
|
if (t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]")) try {
|
|
5199
|
-
return
|
|
5369
|
+
return Na(JSON.parse(t));
|
|
5200
5370
|
} catch {}
|
|
5201
5371
|
return e;
|
|
5202
5372
|
}
|
|
@@ -5214,9 +5384,9 @@ function Ea(e) {
|
|
|
5214
5384
|
}
|
|
5215
5385
|
return String(e);
|
|
5216
5386
|
}
|
|
5217
|
-
function
|
|
5387
|
+
function Pa(e, t) {
|
|
5218
5388
|
let n = Number.isFinite(e) && e === Math.trunc(e) ? 0 : 2;
|
|
5219
|
-
if (!t) return
|
|
5389
|
+
if (!t) return Ia(e, n);
|
|
5220
5390
|
try {
|
|
5221
5391
|
return new Intl.NumberFormat("en-US", {
|
|
5222
5392
|
style: "currency",
|
|
@@ -5228,7 +5398,7 @@ function Da(e, t) {
|
|
|
5228
5398
|
return `${t} ${e.toFixed(n)}`;
|
|
5229
5399
|
}
|
|
5230
5400
|
}
|
|
5231
|
-
function
|
|
5401
|
+
function Fa(e, t) {
|
|
5232
5402
|
if (!t) try {
|
|
5233
5403
|
return new Intl.NumberFormat("en-US", {
|
|
5234
5404
|
notation: "compact",
|
|
@@ -5248,7 +5418,7 @@ function Oa(e, t) {
|
|
|
5248
5418
|
return `${t} ${e}`;
|
|
5249
5419
|
}
|
|
5250
5420
|
}
|
|
5251
|
-
function
|
|
5421
|
+
function Ia(e, t = 2) {
|
|
5252
5422
|
try {
|
|
5253
5423
|
return new Intl.NumberFormat("en-US", {
|
|
5254
5424
|
minimumFractionDigits: t,
|
|
@@ -5258,40 +5428,46 @@ function ka(e, t = 2) {
|
|
|
5258
5428
|
return e.toFixed(t);
|
|
5259
5429
|
}
|
|
5260
5430
|
}
|
|
5261
|
-
function
|
|
5431
|
+
function La(e, t = 0) {
|
|
5262
5432
|
return `${m(e).toFixed(t)}%`;
|
|
5263
5433
|
}
|
|
5264
|
-
function
|
|
5434
|
+
function Ra(e) {
|
|
5265
5435
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
5266
5436
|
}
|
|
5267
|
-
function
|
|
5437
|
+
function za(e, t) {
|
|
5438
|
+
try {
|
|
5439
|
+
let n = new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(e, "day");
|
|
5440
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
5441
|
+
} catch {
|
|
5442
|
+
return e === 0 ? "Today" : e === 1 ? "Tomorrow" : e === -1 ? "Yesterday" : e > 0 ? `In ${e} days` : `${Math.abs(e)} days ago`;
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
function Ba(e, t) {
|
|
5268
5446
|
if (e == null || e === "") return "—";
|
|
5269
5447
|
let n = e instanceof Date ? e : new Date(e);
|
|
5270
5448
|
if (!(n instanceof Date) || isNaN(n.getTime())) return "—";
|
|
5271
5449
|
let r = /* @__PURE__ */ new Date(), i = new Date(r.getFullYear(), r.getMonth(), r.getDate()), a = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime() - i.getTime(), o = Math.round(a / (1e3 * 60 * 60 * 24));
|
|
5272
|
-
if (o
|
|
5273
|
-
if (o
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
let e = Math.abs(o);
|
|
5277
|
-
return e <= 7 ? t?.dueLike ? `Overdue ${e}d` : `${e}d ago` : Na(n);
|
|
5450
|
+
if (o < -7 || o > 7) return Va(n, void 0, t);
|
|
5451
|
+
if (o < -1 && t?.dueLike) {
|
|
5452
|
+
let e = Math.abs(o), n = "fields.relativeDate.overdue", r = t.t?.(n, { count: e });
|
|
5453
|
+
return r && r !== n ? r : `Overdue ${e}d`;
|
|
5278
5454
|
}
|
|
5279
|
-
return o
|
|
5455
|
+
return za(o, t?.locale);
|
|
5280
5456
|
}
|
|
5281
|
-
function
|
|
5457
|
+
function Va(e, t, n) {
|
|
5282
5458
|
if (e == null || e === "") return "—";
|
|
5283
5459
|
let r = e instanceof Date ? e : new Date(e);
|
|
5284
5460
|
if (!(r instanceof Date) || isNaN(r.getTime())) return "—";
|
|
5285
5461
|
if (t === "short") return `${r.toLocaleDateString("en-US", { month: "short" })} ${r.getDate()}, '${String(r.getFullYear()).slice(-2)}`;
|
|
5286
|
-
if (t === "relative") return
|
|
5462
|
+
if (t === "relative") return Ba(r, n);
|
|
5287
5463
|
let i = r.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
5288
|
-
return r.toLocaleDateString(
|
|
5464
|
+
return r.toLocaleDateString(n?.locale, {
|
|
5289
5465
|
year: i ? void 0 : "numeric",
|
|
5290
5466
|
month: "short",
|
|
5291
5467
|
day: "numeric"
|
|
5292
5468
|
});
|
|
5293
5469
|
}
|
|
5294
|
-
function
|
|
5470
|
+
function Ha(e) {
|
|
5295
5471
|
if (e == null || e === "") return "—";
|
|
5296
5472
|
let t = e instanceof Date ? e : new Date(e);
|
|
5297
5473
|
return !(t instanceof Date) || isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
|
|
@@ -5302,16 +5478,16 @@ function Pa(e) {
|
|
|
5302
5478
|
minute: "2-digit"
|
|
5303
5479
|
});
|
|
5304
5480
|
}
|
|
5305
|
-
function
|
|
5306
|
-
let t =
|
|
5481
|
+
function Ua({ value: e }) {
|
|
5482
|
+
let t = Na(e);
|
|
5307
5483
|
return t == null || t === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
5308
5484
|
className: "truncate",
|
|
5309
5485
|
children: String(t)
|
|
5310
5486
|
});
|
|
5311
5487
|
}
|
|
5312
|
-
function
|
|
5488
|
+
function Wa({ value: e, field: t }) {
|
|
5313
5489
|
if (e == null) return /* @__PURE__ */ Y(P, {});
|
|
5314
|
-
let n =
|
|
5490
|
+
let n = Na(e), r = t, i = typeof r.scale == "number" ? r.scale : void 0, a = Number(n);
|
|
5315
5491
|
return /* @__PURE__ */ Y("span", {
|
|
5316
5492
|
className: "tabular-nums",
|
|
5317
5493
|
children: isNaN(a) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
@@ -5320,23 +5496,24 @@ function Ia({ value: e, field: t }) {
|
|
|
5320
5496
|
}).format(a)
|
|
5321
5497
|
});
|
|
5322
5498
|
}
|
|
5323
|
-
function
|
|
5499
|
+
function Ga({ value: e, field: t }) {
|
|
5500
|
+
let { currency: n } = b();
|
|
5324
5501
|
if (e == null) return /* @__PURE__ */ Y(P, {});
|
|
5325
|
-
let
|
|
5502
|
+
let r = Na(e), i = y(t, n), a = Number(r);
|
|
5326
5503
|
return /* @__PURE__ */ Y("span", {
|
|
5327
5504
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
5328
|
-
children: isNaN(a) ? String(
|
|
5505
|
+
children: isNaN(a) ? String(r) : Pa(a, i)
|
|
5329
5506
|
});
|
|
5330
5507
|
}
|
|
5331
|
-
var
|
|
5332
|
-
function
|
|
5508
|
+
var Ka = /progress|completion/;
|
|
5509
|
+
function qa({ value: e, field: t }) {
|
|
5333
5510
|
if (e == null) return /* @__PURE__ */ Y(P, {});
|
|
5334
|
-
let n =
|
|
5511
|
+
let n = Na(e), r = t.precision ?? 0, i = Number(n);
|
|
5335
5512
|
if (isNaN(i)) return /* @__PURE__ */ Y("span", {
|
|
5336
5513
|
className: "tabular-nums whitespace-nowrap",
|
|
5337
5514
|
children: String(n)
|
|
5338
5515
|
});
|
|
5339
|
-
let a =
|
|
5516
|
+
let a = Ka.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : La(i, r), c = Math.max(0, Math.min(100, o));
|
|
5340
5517
|
return /* @__PURE__ */ X("div", {
|
|
5341
5518
|
className: "flex items-center gap-2",
|
|
5342
5519
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -5355,7 +5532,7 @@ function za({ value: e, field: t }) {
|
|
|
5355
5532
|
})]
|
|
5356
5533
|
});
|
|
5357
5534
|
}
|
|
5358
|
-
var
|
|
5535
|
+
var Ja = /* @__PURE__ */ new Set([
|
|
5359
5536
|
"active",
|
|
5360
5537
|
"is_active",
|
|
5361
5538
|
"enabled",
|
|
@@ -5363,7 +5540,7 @@ var Ba = /* @__PURE__ */ new Set([
|
|
|
5363
5540
|
"verified",
|
|
5364
5541
|
"is_verified"
|
|
5365
5542
|
]);
|
|
5366
|
-
function
|
|
5543
|
+
function Ya({ value: e, field: t }) {
|
|
5367
5544
|
if (e == null) return /* @__PURE__ */ Y("span", {
|
|
5368
5545
|
className: "flex items-center justify-center",
|
|
5369
5546
|
children: /* @__PURE__ */ Y(P, {})
|
|
@@ -5376,18 +5553,18 @@ function Va({ value: e, field: t }) {
|
|
|
5376
5553
|
role: "img",
|
|
5377
5554
|
"aria-label": "Completed",
|
|
5378
5555
|
"data-testid": "completion-indicator",
|
|
5379
|
-
children: /* @__PURE__ */ Y(
|
|
5556
|
+
children: /* @__PURE__ */ Y(Ce, { className: "size-3 text-white" })
|
|
5380
5557
|
}) : /* @__PURE__ */ Y("div", {
|
|
5381
5558
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
5382
5559
|
role: "img",
|
|
5383
5560
|
"aria-label": "Not completed",
|
|
5384
5561
|
"data-testid": "completion-indicator"
|
|
5385
5562
|
})
|
|
5386
|
-
}) :
|
|
5563
|
+
}) : Ja.has(n) && !e ? /* @__PURE__ */ X(w, {
|
|
5387
5564
|
variant: "destructive",
|
|
5388
5565
|
className: "text-xs",
|
|
5389
5566
|
"data-testid": "boolean-warning-badge",
|
|
5390
|
-
children: [t?.label ||
|
|
5567
|
+
children: [t?.label || Ra(n), " — Off"]
|
|
5391
5568
|
}) : /* @__PURE__ */ Y("div", {
|
|
5392
5569
|
className: "flex items-center justify-start",
|
|
5393
5570
|
children: /* @__PURE__ */ Y(E, {
|
|
@@ -5397,20 +5574,25 @@ function Va({ value: e, field: t }) {
|
|
|
5397
5574
|
})
|
|
5398
5575
|
});
|
|
5399
5576
|
}
|
|
5400
|
-
function
|
|
5577
|
+
function Xa({ value: e, field: t }) {
|
|
5578
|
+
let { locale: n } = b(), r = Ma();
|
|
5401
5579
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5402
|
-
let
|
|
5403
|
-
|
|
5404
|
-
|
|
5580
|
+
let i = Na(e), a = t, o = a.format || "relative", s = String(a?.name || a?.accessorKey || a?.key || "").toLowerCase(), c = a?.dueLike === !0 || /(^|_)(due|deadline|expires?|expiry|expiration|expected_close|target_close|sla|return_by|renewal|next_action)(_|$)/.test(s), l = Va(i, o, {
|
|
5581
|
+
dueLike: c,
|
|
5582
|
+
locale: n,
|
|
5583
|
+
t: r
|
|
5584
|
+
}), u = i == null ? null : new Date(i), d = u !== null && !isNaN(u.getTime()), f = /* @__PURE__ */ new Date();
|
|
5585
|
+
f.setHours(0, 0, 0, 0);
|
|
5586
|
+
let p = c && d && u < f, m = d ? u.toISOString() : String(i);
|
|
5405
5587
|
return /* @__PURE__ */ Y("span", {
|
|
5406
|
-
className: `tabular-nums${
|
|
5407
|
-
title:
|
|
5408
|
-
children:
|
|
5588
|
+
className: `tabular-nums${p ? " text-red-600" : ""}`,
|
|
5589
|
+
title: m,
|
|
5590
|
+
children: l
|
|
5409
5591
|
});
|
|
5410
5592
|
}
|
|
5411
|
-
function
|
|
5593
|
+
function Za({ value: e }) {
|
|
5412
5594
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5413
|
-
let t =
|
|
5595
|
+
let t = Na(e), n = t == null ? null : new Date(t);
|
|
5414
5596
|
if (n === null || isNaN(n.getTime())) return /* @__PURE__ */ Y(P, {});
|
|
5415
5597
|
let r = n.toLocaleDateString(void 0, {
|
|
5416
5598
|
month: "numeric",
|
|
@@ -5429,7 +5611,7 @@ function Ua({ value: e }) {
|
|
|
5429
5611
|
})]
|
|
5430
5612
|
});
|
|
5431
5613
|
}
|
|
5432
|
-
var
|
|
5614
|
+
var Qa = {
|
|
5433
5615
|
critical: "red",
|
|
5434
5616
|
urgent: "red",
|
|
5435
5617
|
high: "orange",
|
|
@@ -5504,7 +5686,7 @@ var Wa = {
|
|
|
5504
5686
|
逾期: "red",
|
|
5505
5687
|
流失: "red",
|
|
5506
5688
|
丢失: "red"
|
|
5507
|
-
},
|
|
5689
|
+
}, $a = {
|
|
5508
5690
|
gray: "bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60",
|
|
5509
5691
|
red: "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60",
|
|
5510
5692
|
orange: "bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60",
|
|
@@ -5514,7 +5696,7 @@ var Wa = {
|
|
|
5514
5696
|
indigo: "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60",
|
|
5515
5697
|
purple: "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60",
|
|
5516
5698
|
pink: "bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60"
|
|
5517
|
-
},
|
|
5699
|
+
}, eo = {
|
|
5518
5700
|
gray: "bg-gray-400 dark:bg-gray-500",
|
|
5519
5701
|
red: "bg-red-500",
|
|
5520
5702
|
orange: "bg-orange-500",
|
|
@@ -5524,7 +5706,7 @@ var Wa = {
|
|
|
5524
5706
|
indigo: "bg-indigo-500",
|
|
5525
5707
|
purple: "bg-purple-500",
|
|
5526
5708
|
pink: "bg-pink-500"
|
|
5527
|
-
},
|
|
5709
|
+
}, to = [
|
|
5528
5710
|
"blue",
|
|
5529
5711
|
"green",
|
|
5530
5712
|
"purple",
|
|
@@ -5534,12 +5716,12 @@ var Wa = {
|
|
|
5534
5716
|
"yellow",
|
|
5535
5717
|
"red"
|
|
5536
5718
|
];
|
|
5537
|
-
function
|
|
5719
|
+
function no(e) {
|
|
5538
5720
|
let t = 5381;
|
|
5539
5721
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e.charCodeAt(n);
|
|
5540
|
-
return
|
|
5722
|
+
return to[Math.abs(t) % to.length];
|
|
5541
5723
|
}
|
|
5542
|
-
function
|
|
5724
|
+
function ro(e) {
|
|
5543
5725
|
let t = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e.trim());
|
|
5544
5726
|
if (!t) return;
|
|
5545
5727
|
let n = t[1];
|
|
@@ -5549,27 +5731,27 @@ function Ya(e) {
|
|
|
5549
5731
|
let u;
|
|
5550
5732
|
return u = o === r ? ((i - a) / c % 6 + 6) % 6 : o === i ? (a - r) / c + 2 : (r - i) / c + 4, u *= 60, u >= 345 || u < 15 ? "red" : u < 30 ? "orange" : u < 60 ? "yellow" : u < 170 ? "green" : u < 238 ? "blue" : u < 250 ? "indigo" : u < 295 ? "purple" : "pink";
|
|
5551
5733
|
}
|
|
5552
|
-
function
|
|
5734
|
+
function io(e) {
|
|
5553
5735
|
if (e) {
|
|
5554
|
-
if (
|
|
5555
|
-
if (e.charAt(0) === "#") return
|
|
5736
|
+
if ($a[e]) return e;
|
|
5737
|
+
if (e.charAt(0) === "#") return ro(e);
|
|
5556
5738
|
}
|
|
5557
5739
|
}
|
|
5558
|
-
function
|
|
5559
|
-
let n =
|
|
5560
|
-
if (n &&
|
|
5740
|
+
function ao(e, t) {
|
|
5741
|
+
let n = io(e);
|
|
5742
|
+
if (n && $a[n]) return $a[n];
|
|
5561
5743
|
if (t == null || t === "") return "bg-muted text-muted-foreground border-border";
|
|
5562
|
-
let r = String(t).toLowerCase().replace(/[\s-]/g, "_"), i =
|
|
5563
|
-
return i &&
|
|
5744
|
+
let r = String(t).toLowerCase().replace(/[\s-]/g, "_"), i = Qa[r];
|
|
5745
|
+
return i && $a[i] ? $a[i] : $a[no(r)];
|
|
5564
5746
|
}
|
|
5565
|
-
function
|
|
5566
|
-
let n =
|
|
5567
|
-
if (n &&
|
|
5747
|
+
function oo(e, t) {
|
|
5748
|
+
let n = io(e);
|
|
5749
|
+
if (n && $a[n]) return n;
|
|
5568
5750
|
if (t == null || t === "") return;
|
|
5569
5751
|
let r = String(t).toLowerCase().replace(/[\s-]/g, "_");
|
|
5570
|
-
return
|
|
5752
|
+
return Qa[r] || no(r);
|
|
5571
5753
|
}
|
|
5572
|
-
var
|
|
5754
|
+
var so = {
|
|
5573
5755
|
gray: "#6b7280",
|
|
5574
5756
|
red: "#ef4444",
|
|
5575
5757
|
orange: "#f97316",
|
|
@@ -5580,10 +5762,10 @@ var $a = {
|
|
|
5580
5762
|
purple: "#a855f7",
|
|
5581
5763
|
pink: "#ec4899"
|
|
5582
5764
|
};
|
|
5583
|
-
function
|
|
5584
|
-
return e ?
|
|
5765
|
+
function co(e, t = "#3b82f6") {
|
|
5766
|
+
return e ? so[e] ?? t : t;
|
|
5585
5767
|
}
|
|
5586
|
-
function
|
|
5768
|
+
function lo({ value: e, field: t }) {
|
|
5587
5769
|
let n = t, r = n.options || [], i = n.appearance === "dot" ? "dot" : "badge";
|
|
5588
5770
|
if (e == null || e === "") return /* @__PURE__ */ Y(P, {});
|
|
5589
5771
|
let a = (e) => {
|
|
@@ -5592,11 +5774,11 @@ function to({ value: e, field: t }) {
|
|
|
5592
5774
|
let n = String(e).toLowerCase();
|
|
5593
5775
|
return r.find((e) => String(e.value).toLowerCase() === n);
|
|
5594
5776
|
}, o = (e, t) => {
|
|
5595
|
-
let n = a(e), r = n?.label ||
|
|
5777
|
+
let n = a(e), r = n?.label || Ra(String(e));
|
|
5596
5778
|
return i === "dot" ? /* @__PURE__ */ X("span", {
|
|
5597
5779
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
5598
5780
|
children: [/* @__PURE__ */ Y("span", {
|
|
5599
|
-
className:
|
|
5781
|
+
className: K("h-1.5 w-1.5 rounded-full shrink-0", eo[io(n?.color) || Qa[String(e).toLowerCase().replace(/[\s-]/g, "_")] || no(String(e).toLowerCase().replace(/[\s-]/g, "_"))] || eo.gray),
|
|
5600
5782
|
"aria-hidden": "true"
|
|
5601
5783
|
}), /* @__PURE__ */ Y("span", {
|
|
5602
5784
|
className: "truncate",
|
|
@@ -5604,18 +5786,23 @@ function to({ value: e, field: t }) {
|
|
|
5604
5786
|
})]
|
|
5605
5787
|
}, t) : /* @__PURE__ */ Y(w, {
|
|
5606
5788
|
variant: "outline",
|
|
5607
|
-
className:
|
|
5608
|
-
|
|
5789
|
+
className: K("max-w-full min-w-0", ao(n?.color, e)),
|
|
5790
|
+
title: r,
|
|
5791
|
+
children: /* @__PURE__ */ Y("span", {
|
|
5792
|
+
className: "truncate",
|
|
5793
|
+
children: r
|
|
5794
|
+
})
|
|
5609
5795
|
}, t);
|
|
5610
5796
|
};
|
|
5611
5797
|
return Array.isArray(e) ? /* @__PURE__ */ Y("div", {
|
|
5612
|
-
className:
|
|
5798
|
+
className: K("flex flex-wrap", i === "dot" ? "gap-x-3 gap-y-1" : "gap-1"),
|
|
5613
5799
|
children: e.map((e, t) => o(e, t))
|
|
5614
5800
|
}) : o(e);
|
|
5615
5801
|
}
|
|
5616
|
-
function
|
|
5802
|
+
function uo({ value: t }) {
|
|
5803
|
+
let n = ja(), [r, i] = e.useState(!1);
|
|
5617
5804
|
if (!t) return /* @__PURE__ */ Y(P, {});
|
|
5618
|
-
let
|
|
5805
|
+
let a = String(Na(t) ?? "");
|
|
5619
5806
|
return /* @__PURE__ */ X("span", {
|
|
5620
5807
|
className: "inline-flex items-center gap-1 group/email",
|
|
5621
5808
|
children: [/* @__PURE__ */ Y(T, {
|
|
@@ -5623,26 +5810,26 @@ function no({ value: t }) {
|
|
|
5623
5810
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
5624
5811
|
asChild: !0,
|
|
5625
5812
|
children: /* @__PURE__ */ Y("a", {
|
|
5626
|
-
href: `mailto:${
|
|
5813
|
+
href: `mailto:${a}`,
|
|
5627
5814
|
onClick: (e) => e.stopPropagation(),
|
|
5628
|
-
children:
|
|
5815
|
+
children: a
|
|
5629
5816
|
})
|
|
5630
5817
|
}), /* @__PURE__ */ Y("button", {
|
|
5631
5818
|
type: "button",
|
|
5632
5819
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
5633
5820
|
onClick: (e) => {
|
|
5634
|
-
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(
|
|
5635
|
-
|
|
5821
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(a).then(() => {
|
|
5822
|
+
i(!0), setTimeout(() => i(!1), 2e3);
|
|
5636
5823
|
}).catch(() => {});
|
|
5637
5824
|
},
|
|
5638
5825
|
"aria-label": n("detail.copyEmail", "Copy email"),
|
|
5639
|
-
children:
|
|
5826
|
+
children: r ? /* @__PURE__ */ Y(Ce, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Y(Ee, { className: "h-3 w-3 text-muted-foreground" })
|
|
5640
5827
|
})]
|
|
5641
5828
|
});
|
|
5642
5829
|
}
|
|
5643
|
-
function
|
|
5830
|
+
function fo({ value: e }) {
|
|
5644
5831
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5645
|
-
let t = String(
|
|
5832
|
+
let t = String(Na(e) ?? "");
|
|
5646
5833
|
return /* @__PURE__ */ Y(T, {
|
|
5647
5834
|
variant: "link",
|
|
5648
5835
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
@@ -5656,30 +5843,31 @@ function ro({ value: e }) {
|
|
|
5656
5843
|
})
|
|
5657
5844
|
});
|
|
5658
5845
|
}
|
|
5659
|
-
function
|
|
5846
|
+
function po({ value: t }) {
|
|
5847
|
+
let n = ja(), [r, i] = e.useState(!1);
|
|
5660
5848
|
if (!t) return /* @__PURE__ */ Y(P, {});
|
|
5661
|
-
let
|
|
5849
|
+
let a = String(Na(t) ?? "");
|
|
5662
5850
|
return /* @__PURE__ */ X("span", {
|
|
5663
5851
|
className: "inline-flex items-center gap-1 group/phone",
|
|
5664
5852
|
children: [/* @__PURE__ */ X("a", {
|
|
5665
|
-
href: `tel:${
|
|
5853
|
+
href: `tel:${a}`,
|
|
5666
5854
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
5667
5855
|
onClick: (e) => e.stopPropagation(),
|
|
5668
|
-
children: [/* @__PURE__ */ Y(ze, { className: "h-3 w-3" }),
|
|
5856
|
+
children: [/* @__PURE__ */ Y(ze, { className: "h-3 w-3" }), a]
|
|
5669
5857
|
}), /* @__PURE__ */ Y("button", {
|
|
5670
5858
|
type: "button",
|
|
5671
5859
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
5672
5860
|
onClick: (e) => {
|
|
5673
|
-
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(
|
|
5674
|
-
|
|
5861
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(a).then(() => {
|
|
5862
|
+
i(!0), setTimeout(() => i(!1), 2e3);
|
|
5675
5863
|
}).catch(() => {});
|
|
5676
5864
|
},
|
|
5677
5865
|
"aria-label": n("detail.copyPhone", "Copy phone number"),
|
|
5678
|
-
children:
|
|
5866
|
+
children: r ? /* @__PURE__ */ Y(Ce, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Y(Ee, { className: "h-3 w-3 text-muted-foreground" })
|
|
5679
5867
|
})]
|
|
5680
5868
|
});
|
|
5681
5869
|
}
|
|
5682
|
-
function
|
|
5870
|
+
function mo({ value: e, field: t }) {
|
|
5683
5871
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5684
5872
|
if (t.multiple, Array.isArray(e)) {
|
|
5685
5873
|
let t = e.length;
|
|
@@ -5697,7 +5885,7 @@ function ao({ value: e, field: t }) {
|
|
|
5697
5885
|
children: e.name || e.original_name || "File"
|
|
5698
5886
|
});
|
|
5699
5887
|
}
|
|
5700
|
-
function
|
|
5888
|
+
function ho({ value: e }) {
|
|
5701
5889
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5702
5890
|
let t = (e) => typeof e == "string" ? e : e?.url || e?.src || e?.href || e?.thumbnailUrl || "", n = (e, t) => e && typeof e == "object" && (e.name || e.original_name) || t;
|
|
5703
5891
|
if (Array.isArray(e)) {
|
|
@@ -5724,44 +5912,45 @@ function oo({ value: e }) {
|
|
|
5724
5912
|
className: "size-10 rounded-md object-cover"
|
|
5725
5913
|
}) : /* @__PURE__ */ Y(P, {});
|
|
5726
5914
|
}
|
|
5727
|
-
function
|
|
5728
|
-
let n = t.reference_to || t.reference, r = (() => {
|
|
5915
|
+
function go({ value: e, field: t }) {
|
|
5916
|
+
let n = t.reference_to || t.reference, r = t.display_field || t.displayField || t.reference_field || void 0, i = Da(n), a = (() => {
|
|
5729
5917
|
if (Array.isArray(e)) return e.find((e) => e != null && (typeof e == "string" || typeof e == "number") && e !== "");
|
|
5730
5918
|
if (e != null && e !== "" && (typeof e == "string" || typeof e == "number") && typeof e != "object") return e;
|
|
5731
|
-
})(),
|
|
5919
|
+
})(), o = Aa(n, a, r);
|
|
5732
5920
|
if (e == null || e === "") return /* @__PURE__ */ Y(P, {});
|
|
5733
5921
|
if (typeof e == "string") {
|
|
5734
5922
|
let t = e.trim();
|
|
5735
|
-
if (t.startsWith("{") && t.endsWith("}"))
|
|
5736
|
-
let e =
|
|
5737
|
-
|
|
5738
|
-
let
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5923
|
+
if (t.startsWith("{") && t.endsWith("}")) {
|
|
5924
|
+
let e = "";
|
|
5925
|
+
try {
|
|
5926
|
+
let n = JSON.parse(t);
|
|
5927
|
+
n && typeof n == "object" && (e = Oa(n, i, r) || String(n.externalId ?? n.id ?? n._id ?? ""));
|
|
5928
|
+
} catch {}
|
|
5929
|
+
if (e) return /* @__PURE__ */ Y("span", {
|
|
5930
|
+
className: "truncate",
|
|
5931
|
+
children: e
|
|
5932
|
+
});
|
|
5933
|
+
}
|
|
5745
5934
|
}
|
|
5746
5935
|
if (!Array.isArray(e) && typeof e == "object") {
|
|
5747
|
-
let t = e, n =
|
|
5936
|
+
let t = e, n = Oa(t, i, r) || String(t.id || t._id || "");
|
|
5748
5937
|
if (n) return /* @__PURE__ */ Y("span", {
|
|
5749
5938
|
className: "truncate",
|
|
5750
5939
|
children: n
|
|
5751
5940
|
});
|
|
5752
5941
|
}
|
|
5753
|
-
let
|
|
5754
|
-
if (
|
|
5755
|
-
let t =
|
|
5942
|
+
let s = t.options || [], c = (e) => {
|
|
5943
|
+
if (s.length > 0) {
|
|
5944
|
+
let t = s.find((t) => String(t.value) === String(e));
|
|
5756
5945
|
if (t) return {
|
|
5757
5946
|
text: t.label,
|
|
5758
5947
|
muted: !1
|
|
5759
5948
|
};
|
|
5760
5949
|
}
|
|
5761
|
-
return e ===
|
|
5762
|
-
text:
|
|
5950
|
+
return e === a && o ? {
|
|
5951
|
+
text: o,
|
|
5763
5952
|
muted: !1
|
|
5764
|
-
} :
|
|
5953
|
+
} : ka(e) ? {
|
|
5765
5954
|
text: "—",
|
|
5766
5955
|
muted: !0
|
|
5767
5956
|
} : {
|
|
@@ -5772,36 +5961,36 @@ function so({ value: e, field: t }) {
|
|
|
5772
5961
|
if (Array.isArray(e)) return /* @__PURE__ */ Y("div", {
|
|
5773
5962
|
className: "flex flex-wrap gap-1",
|
|
5774
5963
|
children: e.map((e, t) => {
|
|
5775
|
-
let n,
|
|
5776
|
-
if (typeof e == "object" && e) n =
|
|
5964
|
+
let n, a = !1;
|
|
5965
|
+
if (typeof e == "object" && e) n = Oa(e, i, r) || String(e.id || e._id || "[Object]");
|
|
5777
5966
|
else {
|
|
5778
|
-
let t =
|
|
5779
|
-
n = t.text,
|
|
5967
|
+
let t = c(e);
|
|
5968
|
+
n = t.text, a = t.muted;
|
|
5780
5969
|
}
|
|
5781
5970
|
return /* @__PURE__ */ Y("span", {
|
|
5782
|
-
className:
|
|
5971
|
+
className: K("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium", a ? "bg-muted/40 text-muted-foreground" : "bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200"),
|
|
5783
5972
|
children: n
|
|
5784
5973
|
}, t);
|
|
5785
5974
|
})
|
|
5786
5975
|
});
|
|
5787
5976
|
if (typeof e == "object" && e) return /* @__PURE__ */ Y("span", {
|
|
5788
5977
|
className: "truncate",
|
|
5789
|
-
children:
|
|
5978
|
+
children: Oa(e, i, r) || String(e.id || e._id || "[Object]")
|
|
5790
5979
|
});
|
|
5791
|
-
let { text:
|
|
5980
|
+
let { text: l, muted: u } = c(e);
|
|
5792
5981
|
return /* @__PURE__ */ Y("span", {
|
|
5793
|
-
className:
|
|
5794
|
-
children:
|
|
5982
|
+
className: K("truncate", u && "text-muted-foreground"),
|
|
5983
|
+
children: l
|
|
5795
5984
|
});
|
|
5796
5985
|
}
|
|
5797
|
-
function
|
|
5798
|
-
let t =
|
|
5986
|
+
function _o({ value: e }) {
|
|
5987
|
+
let t = Na(e);
|
|
5799
5988
|
return t == null || t === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
5800
5989
|
className: "text-gray-700 font-mono text-sm",
|
|
5801
5990
|
children: String(t)
|
|
5802
5991
|
});
|
|
5803
5992
|
}
|
|
5804
|
-
function
|
|
5993
|
+
function vo({ value: e }) {
|
|
5805
5994
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
5806
5995
|
if (typeof e != "object") return /* @__PURE__ */ Y("span", {
|
|
5807
5996
|
className: "truncate",
|
|
@@ -5852,11 +6041,11 @@ function lo({ value: e }) {
|
|
|
5852
6041
|
})]
|
|
5853
6042
|
});
|
|
5854
6043
|
}
|
|
5855
|
-
var
|
|
5856
|
-
function
|
|
5857
|
-
|
|
6044
|
+
var yo = /* @__PURE__ */ new Map();
|
|
6045
|
+
function bo(e, t) {
|
|
6046
|
+
yo.set(e, t);
|
|
5858
6047
|
}
|
|
5859
|
-
var
|
|
6048
|
+
var xo = {
|
|
5860
6049
|
phone: "phone",
|
|
5861
6050
|
tel: "phone",
|
|
5862
6051
|
telephone: "phone",
|
|
@@ -5868,20 +6057,20 @@ var po = {
|
|
|
5868
6057
|
money: "currency",
|
|
5869
6058
|
percent: "percent",
|
|
5870
6059
|
percentage: "percent"
|
|
5871
|
-
},
|
|
6060
|
+
}, So = /* @__PURE__ */ new Set([
|
|
5872
6061
|
"text",
|
|
5873
6062
|
"textarea",
|
|
5874
6063
|
"string",
|
|
5875
6064
|
"longtext",
|
|
5876
6065
|
""
|
|
5877
6066
|
]);
|
|
5878
|
-
function
|
|
6067
|
+
function Co(e) {
|
|
5879
6068
|
if (!e) return "text";
|
|
5880
6069
|
if (typeof e == "string") return e;
|
|
5881
6070
|
let t = (e.type || "").toLowerCase(), n = e.format, r = typeof n == "string" ? n.toLowerCase() : "";
|
|
5882
|
-
return r &&
|
|
6071
|
+
return r && xo[r] && So.has(t) ? xo[r] : e.type || "text";
|
|
5883
6072
|
}
|
|
5884
|
-
function
|
|
6073
|
+
function wo({ value: e }) {
|
|
5885
6074
|
if (e == null || e === "") return /* @__PURE__ */ Y(P, {});
|
|
5886
6075
|
let t;
|
|
5887
6076
|
if (typeof e == "object") try {
|
|
@@ -5896,7 +6085,7 @@ function go({ value: e }) {
|
|
|
5896
6085
|
children: t
|
|
5897
6086
|
});
|
|
5898
6087
|
}
|
|
5899
|
-
function
|
|
6088
|
+
function To({ value: e }) {
|
|
5900
6089
|
if (e == null || e === "") return /* @__PURE__ */ Y(P, {});
|
|
5901
6090
|
let t = String(e);
|
|
5902
6091
|
return /* @__PURE__ */ X("span", {
|
|
@@ -5911,26 +6100,26 @@ function _o({ value: e }) {
|
|
|
5911
6100
|
})]
|
|
5912
6101
|
});
|
|
5913
6102
|
}
|
|
5914
|
-
var
|
|
5915
|
-
function
|
|
6103
|
+
var Eo = e.lazy(() => Promise.resolve().then(() => (Sa(), ba)));
|
|
6104
|
+
function Do({ value: t }) {
|
|
5916
6105
|
return t == null || t === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y(e.Suspense, {
|
|
5917
6106
|
fallback: /* @__PURE__ */ Y("span", {
|
|
5918
6107
|
className: "text-sm text-muted-foreground",
|
|
5919
6108
|
children: String(t).slice(0, 80)
|
|
5920
6109
|
}),
|
|
5921
|
-
children: /* @__PURE__ */ Y(
|
|
6110
|
+
children: /* @__PURE__ */ Y(Eo, { value: String(t) })
|
|
5922
6111
|
});
|
|
5923
6112
|
}
|
|
5924
|
-
function
|
|
6113
|
+
function Oo(e) {
|
|
5925
6114
|
return e.replace(/<\s*(script|style|iframe|object|embed)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/(href|src)\s*=\s*("javascript:[^"]*"|'javascript:[^']*')/gi, "$1=\"#\"");
|
|
5926
6115
|
}
|
|
5927
|
-
function
|
|
6116
|
+
function ko({ value: e }) {
|
|
5928
6117
|
return e == null || e === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("div", {
|
|
5929
6118
|
className: "prose prose-sm max-w-none dark:prose-invert break-words",
|
|
5930
|
-
dangerouslySetInnerHTML: { __html:
|
|
6119
|
+
dangerouslySetInnerHTML: { __html: Oo(String(e)) }
|
|
5931
6120
|
});
|
|
5932
6121
|
}
|
|
5933
|
-
function
|
|
6122
|
+
function Ao({ value: e }) {
|
|
5934
6123
|
if (e == null || e === "") return /* @__PURE__ */ Y(P, {});
|
|
5935
6124
|
let t, n;
|
|
5936
6125
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
@@ -5944,7 +6133,7 @@ function So({ value: e }) {
|
|
|
5944
6133
|
return typeof t == "number" && typeof n == "number" && !isNaN(t) && !isNaN(n) ? /* @__PURE__ */ X("span", {
|
|
5945
6134
|
className: "inline-flex items-center gap-1 text-sm tabular-nums",
|
|
5946
6135
|
children: [
|
|
5947
|
-
/* @__PURE__ */ Y(
|
|
6136
|
+
/* @__PURE__ */ Y(J, {
|
|
5948
6137
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground",
|
|
5949
6138
|
"aria-hidden": "true"
|
|
5950
6139
|
}),
|
|
@@ -5952,64 +6141,64 @@ function So({ value: e }) {
|
|
|
5952
6141
|
", ",
|
|
5953
6142
|
n.toFixed(4)
|
|
5954
6143
|
]
|
|
5955
|
-
}) : /* @__PURE__ */ Y(
|
|
6144
|
+
}) : /* @__PURE__ */ Y(wo, {
|
|
5956
6145
|
value: e,
|
|
5957
6146
|
field: {}
|
|
5958
6147
|
});
|
|
5959
6148
|
}
|
|
5960
|
-
function
|
|
5961
|
-
return
|
|
5962
|
-
text:
|
|
5963
|
-
textarea:
|
|
5964
|
-
markdown:
|
|
5965
|
-
html:
|
|
5966
|
-
richtext:
|
|
5967
|
-
code:
|
|
5968
|
-
qrcode:
|
|
5969
|
-
number:
|
|
5970
|
-
currency:
|
|
5971
|
-
percent:
|
|
5972
|
-
progress:
|
|
5973
|
-
slider:
|
|
5974
|
-
rating:
|
|
5975
|
-
boolean:
|
|
5976
|
-
toggle:
|
|
5977
|
-
date:
|
|
5978
|
-
datetime:
|
|
5979
|
-
time:
|
|
5980
|
-
select:
|
|
5981
|
-
status:
|
|
5982
|
-
multiselect:
|
|
5983
|
-
radio:
|
|
5984
|
-
checkboxes:
|
|
5985
|
-
tags:
|
|
5986
|
-
lookup:
|
|
5987
|
-
master_detail:
|
|
5988
|
-
tree:
|
|
5989
|
-
email:
|
|
5990
|
-
url:
|
|
5991
|
-
phone:
|
|
5992
|
-
file:
|
|
5993
|
-
video:
|
|
5994
|
-
audio:
|
|
5995
|
-
image:
|
|
5996
|
-
avatar:
|
|
5997
|
-
signature:
|
|
5998
|
-
formula:
|
|
5999
|
-
summary:
|
|
6000
|
-
auto_number:
|
|
6001
|
-
user:
|
|
6002
|
-
owner:
|
|
6149
|
+
function jo(e) {
|
|
6150
|
+
return yo.has(e) ? yo.get(e) : {
|
|
6151
|
+
text: Ua,
|
|
6152
|
+
textarea: Ua,
|
|
6153
|
+
markdown: Do,
|
|
6154
|
+
html: ko,
|
|
6155
|
+
richtext: Do,
|
|
6156
|
+
code: Ua,
|
|
6157
|
+
qrcode: Ua,
|
|
6158
|
+
number: Wa,
|
|
6159
|
+
currency: Ga,
|
|
6160
|
+
percent: qa,
|
|
6161
|
+
progress: qa,
|
|
6162
|
+
slider: Wa,
|
|
6163
|
+
rating: Wa,
|
|
6164
|
+
boolean: Ya,
|
|
6165
|
+
toggle: Ya,
|
|
6166
|
+
date: Xa,
|
|
6167
|
+
datetime: Za,
|
|
6168
|
+
time: Ua,
|
|
6169
|
+
select: lo,
|
|
6170
|
+
status: lo,
|
|
6171
|
+
multiselect: lo,
|
|
6172
|
+
radio: lo,
|
|
6173
|
+
checkboxes: lo,
|
|
6174
|
+
tags: lo,
|
|
6175
|
+
lookup: go,
|
|
6176
|
+
master_detail: go,
|
|
6177
|
+
tree: go,
|
|
6178
|
+
email: uo,
|
|
6179
|
+
url: fo,
|
|
6180
|
+
phone: po,
|
|
6181
|
+
file: mo,
|
|
6182
|
+
video: mo,
|
|
6183
|
+
audio: mo,
|
|
6184
|
+
image: ho,
|
|
6185
|
+
avatar: ho,
|
|
6186
|
+
signature: ho,
|
|
6187
|
+
formula: _o,
|
|
6188
|
+
summary: _o,
|
|
6189
|
+
auto_number: Ua,
|
|
6190
|
+
user: vo,
|
|
6191
|
+
owner: vo,
|
|
6003
6192
|
password: () => /* @__PURE__ */ Y("span", { children: "••••••" }),
|
|
6004
6193
|
secret: () => /* @__PURE__ */ Y("span", { children: "••••••" }),
|
|
6005
|
-
location:
|
|
6006
|
-
geolocation:
|
|
6007
|
-
address:
|
|
6008
|
-
color:
|
|
6009
|
-
json:
|
|
6010
|
-
object:
|
|
6011
|
-
composite:
|
|
6012
|
-
record:
|
|
6194
|
+
location: Ao,
|
|
6195
|
+
geolocation: Ao,
|
|
6196
|
+
address: wo,
|
|
6197
|
+
color: To,
|
|
6198
|
+
json: wo,
|
|
6199
|
+
object: wo,
|
|
6200
|
+
composite: wo,
|
|
6201
|
+
record: wo,
|
|
6013
6202
|
repeater: ({ value: e }) => {
|
|
6014
6203
|
let t = Array.isArray(e) ? e.length : 0;
|
|
6015
6204
|
return t > 0 ? /* @__PURE__ */ X("span", {
|
|
@@ -6025,10 +6214,10 @@ function Co(e) {
|
|
|
6025
6214
|
className: "text-gray-500 italic",
|
|
6026
6215
|
children: "[Grid]"
|
|
6027
6216
|
})
|
|
6028
|
-
}[e] ||
|
|
6217
|
+
}[e] || Ua;
|
|
6029
6218
|
}
|
|
6030
|
-
|
|
6031
|
-
function
|
|
6219
|
+
bo("lookup", go), bo("master_detail", go), bo("select", lo), bo("status", lo), bo("user", vo), bo("owner", vo), Nn(jo);
|
|
6220
|
+
function Mo(e) {
|
|
6032
6221
|
return {
|
|
6033
6222
|
text: "field:text",
|
|
6034
6223
|
textarea: "field:textarea",
|
|
@@ -6084,7 +6273,7 @@ function wo(e) {
|
|
|
6084
6273
|
auto_number: "field:auto_number"
|
|
6085
6274
|
}[e] || "field:text";
|
|
6086
6275
|
}
|
|
6087
|
-
function
|
|
6276
|
+
function No(e) {
|
|
6088
6277
|
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
6089
6278
|
let t = [
|
|
6090
6279
|
"B",
|
|
@@ -6096,7 +6285,7 @@ function To(e) {
|
|
|
6096
6285
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
6097
6286
|
return `${n.toFixed(+(r > 0))} ${t[r]}`;
|
|
6098
6287
|
}
|
|
6099
|
-
function
|
|
6288
|
+
function Po(e) {
|
|
6100
6289
|
let t = {};
|
|
6101
6290
|
return e.required && (t.required = typeof e.required_message != "string" || e.required_message), e.min_length && (t.minLength = {
|
|
6102
6291
|
value: e.min_length,
|
|
@@ -6128,7 +6317,7 @@ function Eo(e) {
|
|
|
6128
6317
|
messageKey: "validation.url"
|
|
6129
6318
|
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
6130
6319
|
}
|
|
6131
|
-
function
|
|
6320
|
+
function Fo(e, t) {
|
|
6132
6321
|
if (!e) return !0;
|
|
6133
6322
|
if (e.field && e.value !== void 0) {
|
|
6134
6323
|
let n = t[e.field];
|
|
@@ -6140,7 +6329,7 @@ function Do(e, t) {
|
|
|
6140
6329
|
if (e.operator === "<=") return n <= e.value;
|
|
6141
6330
|
if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
|
|
6142
6331
|
}
|
|
6143
|
-
return e.and && Array.isArray(e.and) ? e.and.every((e) =>
|
|
6332
|
+
return e.and && Array.isArray(e.and) ? e.and.every((e) => Fo(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => Fo(e, t)) : !0;
|
|
6144
6333
|
}
|
|
6145
6334
|
function $(t) {
|
|
6146
6335
|
let n = ({ schema: n, className: r, value: i, ...a }) => {
|
|
@@ -6184,7 +6373,7 @@ function $(t) {
|
|
|
6184
6373
|
};
|
|
6185
6374
|
return n.displayName = `FieldRenderer(${t.displayName || t.name || "Component"})`, n;
|
|
6186
6375
|
}
|
|
6187
|
-
var
|
|
6376
|
+
var Io = {
|
|
6188
6377
|
text: () => Promise.resolve().then(() => (lt(), st)).then((e) => ({ default: e.TextField })),
|
|
6189
6378
|
textarea: () => Promise.resolve().then(() => (Ut(), Vt)).then((e) => ({ default: e.TextAreaField })),
|
|
6190
6379
|
number: () => Promise.resolve().then(() => (ft(), ut)).then((e) => ({ default: e.NumberField })),
|
|
@@ -6196,10 +6385,10 @@ var Oo = {
|
|
|
6196
6385
|
email: () => Promise.resolve().then(() => (kt(), Dt)).then((e) => ({ default: e.EmailField })),
|
|
6197
6386
|
phone: () => Promise.resolve().then(() => (Mt(), At)).then((e) => ({ default: e.PhoneField })),
|
|
6198
6387
|
url: () => Promise.resolve().then(() => (Ft(), Nt)).then((e) => ({ default: e.UrlField })),
|
|
6199
|
-
multiselect: () => Promise.resolve().then(() => (
|
|
6200
|
-
radio: () => Promise.resolve().then(() => (
|
|
6201
|
-
checkboxes: () => Promise.resolve().then(() => (
|
|
6202
|
-
tags: () => Promise.resolve().then(() => (
|
|
6388
|
+
multiselect: () => Promise.resolve().then(() => (Ii(), Pi)).then((e) => ({ default: e.MultiSelectField })),
|
|
6389
|
+
radio: () => Promise.resolve().then(() => (zi(), Li)).then((e) => ({ default: e.RadioField })),
|
|
6390
|
+
checkboxes: () => Promise.resolve().then(() => (Hi(), Bi)).then((e) => ({ default: e.CheckboxesField })),
|
|
6391
|
+
tags: () => Promise.resolve().then(() => (Gi(), Ui)).then((e) => ({ default: e.TagsField })),
|
|
6203
6392
|
currency: () => Promise.resolve().then(() => (Bt(), Lt)).then((e) => ({ default: e.CurrencyField })),
|
|
6204
6393
|
percent: () => Promise.resolve().then(() => (sr(), ar)).then((e) => ({ default: e.PercentField })),
|
|
6205
6394
|
password: () => Promise.resolve().then(() => (ur(), cr)).then((e) => ({ default: e.PasswordField })),
|
|
@@ -6208,30 +6397,30 @@ var Oo = {
|
|
|
6208
6397
|
richtext: () => Promise.resolve().then(() => (Kt(), Wt)).then((e) => ({ default: e.RichTextField })),
|
|
6209
6398
|
lookup: () => Promise.resolve().then(() => (Jn(), Ln)).then((e) => ({ default: e.LookupField })),
|
|
6210
6399
|
master_detail: () => Promise.resolve().then(() => (Jn(), Ln)).then((e) => ({ default: e.LookupField })),
|
|
6211
|
-
file: () => Promise.resolve().then(() => (
|
|
6212
|
-
image: () => Promise.resolve().then(() => (
|
|
6213
|
-
location: () => Promise.resolve().then(() => (
|
|
6214
|
-
formula: () => Promise.resolve().then(() => (
|
|
6215
|
-
summary: () => Promise.resolve().then(() => (
|
|
6216
|
-
auto_number: () => Promise.resolve().then(() => (
|
|
6217
|
-
user: () => Promise.resolve().then(() => (
|
|
6218
|
-
owner: () => Promise.resolve().then(() => (
|
|
6219
|
-
object: () => Promise.resolve().then(() => (
|
|
6220
|
-
vector: () => Promise.resolve().then(() => (
|
|
6221
|
-
grid: () => Promise.resolve().then(() => (
|
|
6222
|
-
color: () => Promise.resolve().then(() => (
|
|
6223
|
-
slider: () => Promise.resolve().then(() => (
|
|
6224
|
-
rating: () => Promise.resolve().then(() => (
|
|
6225
|
-
code: () => Promise.resolve().then(() => (
|
|
6226
|
-
avatar: () => Promise.resolve().then(() => (
|
|
6227
|
-
address: () => Promise.resolve().then(() => (
|
|
6228
|
-
geolocation: () => Promise.resolve().then(() => (
|
|
6229
|
-
signature: () => Promise.resolve().then(() => (
|
|
6230
|
-
qrcode: () => Promise.resolve().then(() => (
|
|
6231
|
-
"object-ref": () => Promise.resolve().then(() => (
|
|
6232
|
-
"filter-condition": () => Promise.resolve().then(() => (
|
|
6233
|
-
"recipient-picker": () => Promise.resolve().then(() => (
|
|
6234
|
-
},
|
|
6400
|
+
file: () => Promise.resolve().then(() => (hr(), dr)).then((e) => ({ default: e.FileField })),
|
|
6401
|
+
image: () => Promise.resolve().then(() => (Sr(), yr)).then((e) => ({ default: e.ImageField })),
|
|
6402
|
+
location: () => Promise.resolve().then(() => (Tr(), Cr)).then((e) => ({ default: e.LocationField })),
|
|
6403
|
+
formula: () => Promise.resolve().then(() => (Or(), Er)).then((e) => ({ default: e.FormulaField })),
|
|
6404
|
+
summary: () => Promise.resolve().then(() => (jr(), kr)).then((e) => ({ default: e.SummaryField })),
|
|
6405
|
+
auto_number: () => Promise.resolve().then(() => (Pr(), Mr)).then((e) => ({ default: e.AutoNumberField })),
|
|
6406
|
+
user: () => Promise.resolve().then(() => (Rr(), Fr)).then((e) => ({ default: e.UserField })),
|
|
6407
|
+
owner: () => Promise.resolve().then(() => (Rr(), Fr)).then((e) => ({ default: e.UserField })),
|
|
6408
|
+
object: () => Promise.resolve().then(() => (Vr(), zr)).then((e) => ({ default: e.ObjectField })),
|
|
6409
|
+
vector: () => Promise.resolve().then(() => (Wr(), Hr)).then((e) => ({ default: e.VectorField })),
|
|
6410
|
+
grid: () => Promise.resolve().then(() => (oi(), Gr)).then((e) => ({ default: e.GridField })),
|
|
6411
|
+
color: () => Promise.resolve().then(() => (li(), si)).then((e) => ({ default: e.ColorField })),
|
|
6412
|
+
slider: () => Promise.resolve().then(() => (fi(), ui)).then((e) => ({ default: e.SliderField })),
|
|
6413
|
+
rating: () => Promise.resolve().then(() => (hi(), pi)).then((e) => ({ default: e.RatingField })),
|
|
6414
|
+
code: () => Promise.resolve().then(() => (vi(), gi)).then((e) => ({ default: e.CodeField })),
|
|
6415
|
+
avatar: () => Promise.resolve().then(() => (xi(), yi)).then((e) => ({ default: e.AvatarField })),
|
|
6416
|
+
address: () => Promise.resolve().then(() => (wi(), Si)).then((e) => ({ default: e.AddressField })),
|
|
6417
|
+
geolocation: () => Promise.resolve().then(() => (Di(), Ti)).then((e) => ({ default: e.GeolocationField })),
|
|
6418
|
+
signature: () => Promise.resolve().then(() => (Ai(), Oi)).then((e) => ({ default: e.SignatureField })),
|
|
6419
|
+
qrcode: () => Promise.resolve().then(() => (Ni(), ji)).then((e) => ({ default: e.QRCodeField })),
|
|
6420
|
+
"object-ref": () => Promise.resolve().then(() => (ea(), Qi)).then((e) => ({ default: e.ObjectRefField })),
|
|
6421
|
+
"filter-condition": () => Promise.resolve().then(() => (ma(), ta)).then((e) => ({ default: e.FilterConditionField })),
|
|
6422
|
+
"recipient-picker": () => Promise.resolve().then(() => (va(), ha)).then((e) => ({ default: e.RecipientPickerField }))
|
|
6423
|
+
}, Lo = Object.freeze(Object.keys(Io)), Ro = /* @__PURE__ */ new Set([
|
|
6235
6424
|
"text",
|
|
6236
6425
|
"html",
|
|
6237
6426
|
"image",
|
|
@@ -6249,8 +6438,8 @@ var Oo = {
|
|
|
6249
6438
|
"filter-condition",
|
|
6250
6439
|
"recipient-picker"
|
|
6251
6440
|
]);
|
|
6252
|
-
function
|
|
6253
|
-
let n =
|
|
6441
|
+
function zo(t) {
|
|
6442
|
+
let n = Io[t];
|
|
6254
6443
|
if (!n) {
|
|
6255
6444
|
console.warn(`Unknown field type: ${t}`);
|
|
6256
6445
|
return;
|
|
@@ -6258,15 +6447,15 @@ function jo(t) {
|
|
|
6258
6447
|
let r = e.lazy(n);
|
|
6259
6448
|
u.register(t, r, {
|
|
6260
6449
|
namespace: "field",
|
|
6261
|
-
skipFallback:
|
|
6450
|
+
skipFallback: Ro.has(t)
|
|
6262
6451
|
});
|
|
6263
6452
|
}
|
|
6264
|
-
function
|
|
6265
|
-
Object.keys(
|
|
6266
|
-
|
|
6453
|
+
function Bo() {
|
|
6454
|
+
Object.keys(Io).forEach((e) => {
|
|
6455
|
+
zo(e);
|
|
6267
6456
|
});
|
|
6268
6457
|
}
|
|
6269
|
-
function
|
|
6458
|
+
function Vo() {
|
|
6270
6459
|
u.register("text", $(ct), {
|
|
6271
6460
|
namespace: "field",
|
|
6272
6461
|
skipFallback: !0
|
|
@@ -6294,23 +6483,23 @@ function No() {
|
|
|
6294
6483
|
}), u.register("lookup", $(Un), { namespace: "field" }), u.register("capability-multiselect", Qn, {
|
|
6295
6484
|
namespace: "field",
|
|
6296
6485
|
skipFallback: !0
|
|
6297
|
-
}), u.register("master_detail", $(Un), { namespace: "field" }), u.register("file", $(
|
|
6486
|
+
}), u.register("master_detail", $(Un), { namespace: "field" }), u.register("file", $(pr), { namespace: "field" }), u.register("image", $(br), {
|
|
6298
6487
|
namespace: "field",
|
|
6299
6488
|
skipFallback: !0
|
|
6300
|
-
}), u.register("location", $(
|
|
6489
|
+
}), u.register("location", $(wr), { namespace: "field" }), u.register("formula", $(Dr), { namespace: "field" }), u.register("summary", $(Ar), { namespace: "field" }), u.register("auto_number", $(Nr), { namespace: "field" }), u.register("user", $(Lr), { namespace: "field" }), u.register("owner", $(Lr), { namespace: "field" }), u.register("object", $(Br), { namespace: "field" }), u.register("vector", $(Ur), { namespace: "field" }), u.register("grid", $(ti), {
|
|
6301
6490
|
namespace: "field",
|
|
6302
6491
|
skipFallback: !0
|
|
6303
|
-
}), u.register("color", $(
|
|
6492
|
+
}), u.register("color", $(ci), { namespace: "field" }), u.register("slider", $(di), {
|
|
6304
6493
|
namespace: "field",
|
|
6305
6494
|
skipFallback: !0
|
|
6306
|
-
}), u.register("rating", $(
|
|
6495
|
+
}), u.register("rating", $(mi), { namespace: "field" }), u.register("code", $(_i), { namespace: "field" }), u.register("avatar", $(bi), {
|
|
6307
6496
|
namespace: "field",
|
|
6308
6497
|
skipFallback: !0
|
|
6309
|
-
}), u.register("address", $(
|
|
6498
|
+
}), u.register("address", $(Ci), {
|
|
6310
6499
|
namespace: "field",
|
|
6311
6500
|
skipFallback: !0
|
|
6312
|
-
}), u.register("geolocation", $(
|
|
6501
|
+
}), u.register("geolocation", $(Ei), { namespace: "field" }), u.register("signature", $(ki), { namespace: "field" }), u.register("qrcode", $(Mi), { namespace: "field" });
|
|
6313
6502
|
}
|
|
6314
|
-
|
|
6503
|
+
Bo();
|
|
6315
6504
|
//#endregion
|
|
6316
|
-
export {
|
|
6505
|
+
export { Ci as AddressField, Nr as AutoNumberField, bi as AvatarField, Ya as BooleanCellRenderer, mt as BooleanField, Qn as CapabilityMultiSelectField, Vi as CheckboxesField, _i as CodeField, ci as ColorField, To as ColorSwatchCellRenderer, Ga as CurrencyCellRenderer, zt as CurrencyField, Ji as DISCRETE_EDIT_TYPES, Xa as DateCellRenderer, Tt as DateField, Za as DateTimeCellRenderer, er as DateTimeField, uo as EmailCellRenderer, Ot as EmailField, Lo as FORM_FIELD_TYPES, Zi as FieldEditWidget, mr as FileCell, mo as FileCellRenderer, pr as FileField, da as FilterConditionField, _o as FormulaCellRenderer, Dr as FormulaField, Ei as GeolocationField, ti as GridField, ko as HtmlCellRenderer, qi as INLINE_EXCLUDED_FIELD_TYPES, ho as ImageCellRenderer, _r as ImageCropperDialog, br as ImageField, wo as JsonCellRenderer, ai as LineItemsField, Ao as LocationCellRenderer, wr as LocationField, go as LookupCellRenderer, Un as LookupField, Do as MarkdownCellRenderer, ya as MasterDetailField, Fi as MultiSelectField, Wa as NumberCellRenderer, dt as NumberField, Br as ObjectField, $i as ObjectRefField, lr as PasswordField, qa as PercentCellRenderer, or as PercentField, po as PhoneCellRenderer, jt as PhoneField, Mi as QRCodeField, Ri as RadioField, mi as RatingField, ga as RecipientPickerField, $t as RecordPickerDialog, Gt as RichTextField, lo as SelectCellRenderer, bt as SelectField, ki as SignatureField, di as SliderField, Ar as SummaryField, Wi as TagsField, Ht as TextAreaField, Ua as TextCellRenderer, ct as TextField, rr as TimeField, fo as UrlCellRenderer, Pt as UrlField, vo as UserCellRenderer, Lr as UserField, Ur as VectorField, Po as buildValidationRules, Na as coerceToSafeValue, Zr as computeRow, Yr as evalArith, Fo as evaluateCondition, Fa as formatCompactCurrency, Pa as formatCurrency, Va as formatDate, Ha as formatDateTime, No as formatFileSize, Ia as formatNumber, La as formatPercent, Ba as formatRelativeDate, ao as getBadgeColorClasses, jo as getCellRenderer, oo as getSemanticColorName, co as getSemanticHex, Yi as hasFieldEditWidget, Ra as humanizeLabel, ka as isLikelyOpaqueId, Xr as lookupAutofillPatch, Zt as lookupFiltersToRecord, Mo as mapFieldTypeToFormType, Yn as parseCapabilityNames, wa as pickRecordDisplayName, Bo as registerAllFields, zo as registerField, bo as registerFieldRenderer, Vo as registerFields, Co as resolveCellRendererType, y as resolveFieldCurrency, ei as sumColumn };
|