@object-ui/fields 4.0.8 → 4.0.9
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 +11 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +895 -775
- package/dist/packages/fields/src/index.d.ts +42 -2
- package/package.json +7 -7
- package/src/index.tsx +271 -46
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import e, { Suspense as t, lazy as n, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
2
2
|
import { ComponentRegistry as u } from "@object-ui/core";
|
|
3
3
|
import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as te, PopoverContent as ne, PopoverTrigger as T, Select as E, SelectContent as re, SelectItem as ie, SelectTrigger as ae, SelectValue as oe, Skeleton as D, Slider as O, Switch as k, Table as se, TableBody as ce, TableCell as A, TableHead as le, TableHeader as j, TableRow as M, Textarea as N, cn as P } from "@object-ui/components";
|
|
4
|
-
import { AlertCircle as ue, ArrowDown as F, ArrowUp as de, ArrowUpDown as fe, Camera as pe, Check as I, ChevronLeft as me, ChevronRight as he, Copy as L, Crop as ge, Crosshair as R, Eraser as _e, ExternalLink as z, Eye as B, EyeOff as ve, File as ye, Image as V, ImageIcon as be, Loader2 as xe, MapPin as H, Maximize2 as U, Phone as Se, Plus as
|
|
5
|
-
import { SchemaRendererContext as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createSafeTranslation as
|
|
8
|
-
import { useUpload as
|
|
4
|
+
import { AlertCircle as ue, ArrowDown as F, ArrowUp as de, ArrowUpDown as fe, Camera as pe, Check as I, ChevronLeft as me, ChevronRight as he, Copy as L, Crop as ge, Crosshair as R, Eraser as _e, ExternalLink as z, Eye as B, EyeOff as ve, File as ye, Image as V, ImageIcon as be, Loader2 as xe, MapPin as H, Maximize2 as U, Phone as Se, Plus as Ce, QrCode as W, RotateCw as G, Search as we, SlidersHorizontal as Te, Star as Ee, TableProperties as De, Upload as K, X as Oe } from "lucide-react";
|
|
5
|
+
import { SchemaRendererContext as ke, useObjectTranslation as Ae } from "@object-ui/react";
|
|
6
|
+
import { Fragment as je, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
7
|
+
import { createSafeTranslation as Me } from "@object-ui/i18n";
|
|
8
|
+
import { useUpload as Ne } from "@object-ui/providers";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
|
-
var
|
|
10
|
+
var Pe = Object.defineProperty, Y = (e, t) => () => (e && (t = e(e = 0)), t), X = (e, t) => {
|
|
11
11
|
let n = {};
|
|
12
|
-
for (var r in e)
|
|
12
|
+
for (var r in e) Pe(n, r, {
|
|
13
13
|
get: e[r],
|
|
14
14
|
enumerable: !0
|
|
15
15
|
});
|
|
16
|
-
return t ||
|
|
17
|
-
},
|
|
18
|
-
function
|
|
16
|
+
return t || Pe(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
17
|
+
}, Fe = /* @__PURE__ */ X({ TextField: () => Ie });
|
|
18
|
+
function Ie({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
19
19
|
let a = n || i.schema;
|
|
20
|
-
if (r) return /* @__PURE__ */
|
|
20
|
+
if (r) return /* @__PURE__ */ q("span", {
|
|
21
21
|
className: "text-sm",
|
|
22
|
-
children: e || /* @__PURE__ */
|
|
22
|
+
children: e || /* @__PURE__ */ q(S, {})
|
|
23
23
|
});
|
|
24
24
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
25
|
-
return o && o > 1 ? /* @__PURE__ */
|
|
25
|
+
return o && o > 1 ? /* @__PURE__ */ q(N, {
|
|
26
26
|
...c,
|
|
27
27
|
value: e || "",
|
|
28
28
|
onChange: (e) => t(e.target.value),
|
|
29
29
|
placeholder: a?.placeholder,
|
|
30
30
|
disabled: r || c.disabled
|
|
31
|
-
}) : /* @__PURE__ */
|
|
31
|
+
}) : /* @__PURE__ */ q(C, {
|
|
32
32
|
...c,
|
|
33
33
|
type: a?.type === "password" ? "password" : "text",
|
|
34
34
|
value: e || "",
|
|
@@ -37,14 +37,14 @@ function Fe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
37
37
|
disabled: r || c.disabled
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
function
|
|
42
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
40
|
+
var Le = Y((() => {})), Re = /* @__PURE__ */ X({ NumberField: () => ze });
|
|
41
|
+
function ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
42
|
+
if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
|
|
43
43
|
className: "text-sm",
|
|
44
44
|
children: e
|
|
45
45
|
});
|
|
46
46
|
let a = n || i.schema, o = a?.precision, { inputType: s, ...c } = i;
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ q(C, {
|
|
48
48
|
...c,
|
|
49
49
|
type: "number",
|
|
50
50
|
value: e ?? "",
|
|
@@ -57,85 +57,85 @@ function Re({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
57
57
|
step: o ? 10 ** -o : "any"
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
var
|
|
61
|
-
function
|
|
60
|
+
var Be = Y((() => {})), Ve = /* @__PURE__ */ X({ BooleanField: () => Z });
|
|
61
|
+
function Z({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
62
62
|
let a = n || i.schema, s = a?.widget, c = o(), l = a?.name || c, u = a?.label || "Checkbox";
|
|
63
|
-
if (r) return /* @__PURE__ */
|
|
63
|
+
if (r) return /* @__PURE__ */ q("span", {
|
|
64
64
|
className: "text-sm",
|
|
65
65
|
children: e ? "Yes" : "No"
|
|
66
66
|
});
|
|
67
67
|
let { inputType: d, ...f } = i;
|
|
68
|
-
return s === "checkbox" ? /* @__PURE__ */
|
|
68
|
+
return s === "checkbox" ? /* @__PURE__ */ J("div", {
|
|
69
69
|
className: "flex items-center space-x-2",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ q(g, {
|
|
71
71
|
...f,
|
|
72
72
|
id: l,
|
|
73
73
|
checked: !!e,
|
|
74
74
|
onCheckedChange: (e) => t(!!e),
|
|
75
75
|
disabled: r || f.disabled
|
|
76
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ q(w, {
|
|
77
77
|
htmlFor: l,
|
|
78
78
|
children: u
|
|
79
79
|
})]
|
|
80
|
-
}) : /* @__PURE__ */
|
|
80
|
+
}) : /* @__PURE__ */ J("div", {
|
|
81
81
|
className: "flex items-center space-x-2",
|
|
82
|
-
children: [/* @__PURE__ */
|
|
82
|
+
children: [/* @__PURE__ */ q(k, {
|
|
83
83
|
...f,
|
|
84
84
|
id: l,
|
|
85
85
|
checked: !!e,
|
|
86
86
|
onCheckedChange: t,
|
|
87
87
|
disabled: r || f.disabled
|
|
88
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ q(w, {
|
|
89
89
|
htmlFor: l,
|
|
90
90
|
children: u
|
|
91
91
|
})]
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
var He =
|
|
94
|
+
var He = Y((() => {})), Ue, We, Ge = Y((() => {
|
|
95
95
|
Ue = {
|
|
96
96
|
"common.selectOption": "Select an option",
|
|
97
97
|
"common.select": "Select...",
|
|
98
98
|
"common.search": "Search",
|
|
99
99
|
"table.selected": "{{count}} selected"
|
|
100
|
-
}, We =
|
|
101
|
-
})), Ke = /* @__PURE__ */
|
|
100
|
+
}, We = Me(Ue, "common.selectOption");
|
|
101
|
+
})), Ke = /* @__PURE__ */ X({ SelectField: () => qe });
|
|
102
102
|
function qe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
103
103
|
let a = n || i.schema, o = a?.options || [], { t: s } = We();
|
|
104
104
|
if (r) {
|
|
105
105
|
let t = o.find((t) => t.value === e)?.label || e;
|
|
106
|
-
return t ? /* @__PURE__ */
|
|
106
|
+
return t ? /* @__PURE__ */ q("span", {
|
|
107
107
|
className: "text-sm",
|
|
108
108
|
children: t
|
|
109
|
-
}) : /* @__PURE__ */
|
|
109
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
110
110
|
}
|
|
111
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ J(E, {
|
|
112
112
|
...i,
|
|
113
113
|
value: e,
|
|
114
114
|
onValueChange: t,
|
|
115
115
|
disabled: r || i.disabled,
|
|
116
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ q(ae, {
|
|
117
117
|
className: i.className,
|
|
118
118
|
id: i.id,
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
}), /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ q(oe, { placeholder: a?.placeholder || s("common.selectOption") })
|
|
120
|
+
}), /* @__PURE__ */ q(re, {
|
|
121
121
|
position: "popper",
|
|
122
|
-
children: o.map((e) => /* @__PURE__ */
|
|
122
|
+
children: o.map((e) => /* @__PURE__ */ q(ie, {
|
|
123
123
|
value: e.value,
|
|
124
124
|
children: e.label
|
|
125
125
|
}, e.value))
|
|
126
126
|
})]
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
var Je =
|
|
129
|
+
var Je = Y((() => {
|
|
130
130
|
Ge();
|
|
131
|
-
})), Ye = /* @__PURE__ */
|
|
131
|
+
})), Ye = /* @__PURE__ */ X({ DateField: () => Xe });
|
|
132
132
|
function Xe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
133
|
-
if (r) return e ? /* @__PURE__ */
|
|
133
|
+
if (r) return e ? /* @__PURE__ */ q("span", {
|
|
134
134
|
className: "text-sm",
|
|
135
135
|
children: new Date(e).toLocaleDateString()
|
|
136
|
-
}) : /* @__PURE__ */
|
|
136
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
137
137
|
let { inputType: a, ...o } = i;
|
|
138
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ q(C, {
|
|
139
139
|
...o,
|
|
140
140
|
type: "date",
|
|
141
141
|
value: e || "",
|
|
@@ -143,16 +143,16 @@ function Xe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
143
143
|
disabled: r || o.disabled
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
var Ze =
|
|
146
|
+
var Ze = Y((() => {})), Qe = /* @__PURE__ */ X({ EmailField: () => $e });
|
|
147
147
|
function $e({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
148
148
|
let o = n || a.schema;
|
|
149
|
-
if (r) return e ? /* @__PURE__ */
|
|
149
|
+
if (r) return e ? /* @__PURE__ */ q("a", {
|
|
150
150
|
href: `mailto:${e}`,
|
|
151
151
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
152
152
|
children: e
|
|
153
|
-
}) : /* @__PURE__ */
|
|
153
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
154
154
|
let { inputType: s, ...c } = a;
|
|
155
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ q(C, {
|
|
156
156
|
...c,
|
|
157
157
|
type: "email",
|
|
158
158
|
value: e || "",
|
|
@@ -162,16 +162,16 @@ function $e({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
162
162
|
"aria-invalid": !!i
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
var et =
|
|
165
|
+
var et = Y((() => {})), tt = /* @__PURE__ */ X({ PhoneField: () => nt });
|
|
166
166
|
function nt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
167
167
|
let o = n || a.schema;
|
|
168
|
-
if (r) return e ? /* @__PURE__ */
|
|
168
|
+
if (r) return e ? /* @__PURE__ */ q("a", {
|
|
169
169
|
href: `tel:${e}`,
|
|
170
170
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
171
171
|
children: e
|
|
172
|
-
}) : /* @__PURE__ */
|
|
172
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
173
173
|
let { inputType: s, ...c } = a;
|
|
174
|
-
return /* @__PURE__ */
|
|
174
|
+
return /* @__PURE__ */ q(C, {
|
|
175
175
|
...c,
|
|
176
176
|
type: "tel",
|
|
177
177
|
value: e || "",
|
|
@@ -181,21 +181,21 @@ function nt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
181
181
|
"aria-invalid": !!i
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
var rt =
|
|
184
|
+
var rt = Y((() => {})), it = /* @__PURE__ */ X({ UrlField: () => at });
|
|
185
185
|
function at({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
186
186
|
let o = n || a.schema;
|
|
187
|
-
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */
|
|
187
|
+
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ q("a", {
|
|
188
188
|
href: e,
|
|
189
189
|
target: "_blank",
|
|
190
190
|
rel: "noopener noreferrer",
|
|
191
191
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
192
192
|
children: e
|
|
193
|
-
}) : /* @__PURE__ */
|
|
193
|
+
}) : /* @__PURE__ */ q("span", {
|
|
194
194
|
className: "text-sm",
|
|
195
195
|
children: e
|
|
196
|
-
}) : /* @__PURE__ */
|
|
196
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
197
197
|
let { inputType: s, ...c } = a;
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ q(C, {
|
|
199
199
|
...c,
|
|
200
200
|
type: "url",
|
|
201
201
|
value: e || "",
|
|
@@ -205,7 +205,7 @@ function at({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
205
205
|
"aria-invalid": !!i
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
var ot =
|
|
208
|
+
var ot = Y((() => {})), st = /* @__PURE__ */ X({ CurrencyField: () => lt });
|
|
209
209
|
function ct(e, t, n) {
|
|
210
210
|
if (t) try {
|
|
211
211
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -228,7 +228,7 @@ function ct(e, t, n) {
|
|
|
228
228
|
}
|
|
229
229
|
function lt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
230
230
|
let s = n || o.schema, c = s?.currency, l = s?.precision ?? 2;
|
|
231
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
231
|
+
if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
|
|
232
232
|
className: "text-sm font-medium tabular-nums",
|
|
233
233
|
children: ct(Number(e), c, l)
|
|
234
234
|
});
|
|
@@ -236,12 +236,12 @@ function lt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
236
236
|
let n = parseFloat(e.target.value);
|
|
237
237
|
isNaN(n) || t(parseFloat(n.toFixed(l)));
|
|
238
238
|
}, d = c ? c === "USD" ? "$" : c : "";
|
|
239
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ J("div", {
|
|
240
240
|
className: "relative",
|
|
241
|
-
children: [d && /* @__PURE__ */
|
|
241
|
+
children: [d && /* @__PURE__ */ q("span", {
|
|
242
242
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
243
243
|
children: d
|
|
244
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ q(C, {
|
|
245
245
|
...o,
|
|
246
246
|
type: "number",
|
|
247
247
|
value: e ?? "",
|
|
@@ -257,21 +257,21 @@ function lt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
257
257
|
})]
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
var ut =
|
|
260
|
+
var ut = Y((() => {})), dt = /* @__PURE__ */ X({ TextAreaField: () => ft });
|
|
261
261
|
function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
262
|
-
if (r) return /* @__PURE__ */
|
|
262
|
+
if (r) return /* @__PURE__ */ q("div", {
|
|
263
263
|
className: "text-sm whitespace-pre-wrap",
|
|
264
|
-
children: e || /* @__PURE__ */
|
|
264
|
+
children: e || /* @__PURE__ */ q(S, {})
|
|
265
265
|
});
|
|
266
266
|
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length, u = !!(a.mobileFullscreen ?? o?.mobile_fullscreen ?? a.mobile_fullscreen ?? a.schema?.mobile_fullscreen), [d, f] = l(!1), [p, m] = l(e ?? ""), g = () => {
|
|
267
267
|
m(e ?? ""), f(!0);
|
|
268
268
|
}, y = () => f(!1), C = () => {
|
|
269
269
|
t(p), f(!1);
|
|
270
270
|
}, { inputType: w, mobileFullscreen: te, ...ne } = a;
|
|
271
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ J("div", {
|
|
272
272
|
className: "relative",
|
|
273
273
|
children: [
|
|
274
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ q(N, {
|
|
275
275
|
...ne,
|
|
276
276
|
value: e || "",
|
|
277
277
|
onChange: (e) => t(e.target.value),
|
|
@@ -282,15 +282,15 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
282
282
|
"aria-invalid": !!i,
|
|
283
283
|
className: ne.className
|
|
284
284
|
}),
|
|
285
|
-
u && /* @__PURE__ */
|
|
285
|
+
u && /* @__PURE__ */ q("button", {
|
|
286
286
|
type: "button",
|
|
287
287
|
onClick: g,
|
|
288
288
|
className: "absolute top-1.5 right-1.5 inline-flex items-center justify-center size-7 rounded-md bg-background/80 text-muted-foreground hover:text-foreground hover:bg-background border shadow-sm transition-colors",
|
|
289
289
|
"aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
|
|
290
290
|
"data-testid": "textarea-fullscreen-toggle",
|
|
291
|
-
children: /* @__PURE__ */
|
|
291
|
+
children: /* @__PURE__ */ q(U, { className: "size-3.5" })
|
|
292
292
|
}),
|
|
293
|
-
c && /* @__PURE__ */
|
|
293
|
+
c && /* @__PURE__ */ J("div", {
|
|
294
294
|
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
295
295
|
"aria-live": "polite",
|
|
296
296
|
"aria-label": `Character count: ${(e || "").length} of ${c}`,
|
|
@@ -300,23 +300,23 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
300
300
|
c
|
|
301
301
|
]
|
|
302
302
|
}),
|
|
303
|
-
u && /* @__PURE__ */
|
|
303
|
+
u && /* @__PURE__ */ q(_, {
|
|
304
304
|
open: d,
|
|
305
305
|
onOpenChange: f,
|
|
306
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ J(v, {
|
|
307
307
|
className: "sm:max-w-3xl h-[100dvh] sm:h-[80vh] max-h-[100dvh] sm:max-h-[80vh] flex flex-col p-0 gap-0",
|
|
308
308
|
"data-testid": "textarea-fullscreen-dialog",
|
|
309
309
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ q(ee, {
|
|
311
311
|
className: "p-4 border-b",
|
|
312
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ q(x, {
|
|
313
313
|
className: "text-base",
|
|
314
314
|
children: o?.label ?? "Edit text"
|
|
315
315
|
})
|
|
316
316
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ q("div", {
|
|
318
318
|
className: "flex-1 min-h-0 p-4",
|
|
319
|
-
children: /* @__PURE__ */
|
|
319
|
+
children: /* @__PURE__ */ q(N, {
|
|
320
320
|
autoFocus: !0,
|
|
321
321
|
value: p,
|
|
322
322
|
onChange: (e) => m(e.target.value),
|
|
@@ -326,27 +326,27 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
326
326
|
"data-testid": "textarea-fullscreen-input"
|
|
327
327
|
})
|
|
328
328
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ J(b, {
|
|
330
330
|
className: "p-3 border-t flex-row justify-between sm:justify-end gap-2",
|
|
331
|
-
children: [c && /* @__PURE__ */
|
|
331
|
+
children: [c && /* @__PURE__ */ J("span", {
|
|
332
332
|
className: "text-xs text-muted-foreground self-center",
|
|
333
333
|
children: [
|
|
334
334
|
p.length,
|
|
335
335
|
"/",
|
|
336
336
|
c
|
|
337
337
|
]
|
|
338
|
-
}), /* @__PURE__ */
|
|
338
|
+
}), /* @__PURE__ */ J("div", {
|
|
339
339
|
className: "flex gap-2 ml-auto",
|
|
340
|
-
children: [/* @__PURE__ */
|
|
340
|
+
children: [/* @__PURE__ */ J(h, {
|
|
341
341
|
type: "button",
|
|
342
342
|
variant: "ghost",
|
|
343
343
|
onClick: y,
|
|
344
|
-
children: [/* @__PURE__ */
|
|
345
|
-
}), /* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ q(Oe, { className: "size-4 mr-1" }), " Cancel"]
|
|
345
|
+
}), /* @__PURE__ */ J(h, {
|
|
346
346
|
type: "button",
|
|
347
347
|
onClick: C,
|
|
348
348
|
"data-testid": "textarea-fullscreen-save",
|
|
349
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ q(I, { className: "size-4 mr-1" }), " Done"]
|
|
350
350
|
})]
|
|
351
351
|
})]
|
|
352
352
|
})
|
|
@@ -356,22 +356,22 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
356
356
|
]
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
|
-
var pt =
|
|
359
|
+
var pt = Y((() => {})), mt = /* @__PURE__ */ X({ RichTextField: () => ht });
|
|
360
360
|
function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
361
|
-
if (r) return /* @__PURE__ */
|
|
361
|
+
if (r) return /* @__PURE__ */ q("div", {
|
|
362
362
|
className: "text-sm prose prose-sm max-w-none",
|
|
363
|
-
children: e || /* @__PURE__ */
|
|
363
|
+
children: e || /* @__PURE__ */ q(S, {})
|
|
364
364
|
});
|
|
365
365
|
let o = n || a.schema, s = o?.rows || 8;
|
|
366
|
-
return /* @__PURE__ */
|
|
366
|
+
return /* @__PURE__ */ J("div", {
|
|
367
367
|
className: "space-y-2",
|
|
368
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ J("div", {
|
|
369
369
|
className: "flex items-center justify-between text-xs text-gray-500",
|
|
370
|
-
children: [/* @__PURE__ */
|
|
370
|
+
children: [/* @__PURE__ */ J("span", { children: ["Format: ", o?.format || "markdown"] }), /* @__PURE__ */ q("span", {
|
|
371
371
|
className: "italic",
|
|
372
372
|
children: "Rich text editor (basic)"
|
|
373
373
|
})]
|
|
374
|
-
}), /* @__PURE__ */
|
|
374
|
+
}), /* @__PURE__ */ q(N, {
|
|
375
375
|
value: e || "",
|
|
376
376
|
onChange: (e) => t(e.target.value),
|
|
377
377
|
placeholder: o?.placeholder || "Enter text...",
|
|
@@ -382,7 +382,7 @@ function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
382
382
|
})]
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
-
var gt =
|
|
385
|
+
var gt = Y((() => {}));
|
|
386
386
|
//#endregion
|
|
387
387
|
//#region src/widgets/RecordPickerDialog.tsx
|
|
388
388
|
function _t(e) {
|
|
@@ -433,10 +433,10 @@ function bt(e, t) {
|
|
|
433
433
|
return n;
|
|
434
434
|
}
|
|
435
435
|
function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: y = St, value: S, onSelect: te, onSelectRecords: ne, lookupFilters: T, cellRenderer: O, filterColumns: k, renderFilterBar: N, renderGrid: pe }) {
|
|
436
|
-
let [L, ge] = l([]), [R, _e] = l(!1), [z, B] = l(null), [ve, ye] = l(0), [V, be] = l(""), [H, U] = l(1), Se = c(null), [
|
|
436
|
+
let [L, ge] = l([]), [R, _e] = l(!1), [z, B] = l(null), [ve, ye] = l(0), [V, be] = l(""), [H, U] = l(1), Se = c(null), [Ce, W] = l(null), [G, Ee] = l("asc"), [De, K] = l(/* @__PURE__ */ new Set()), ke = c(/* @__PURE__ */ new Map()), [Ae, Me] = l(-1), Ne = c(null), [Pe, Y] = l(!1), [X, Fe] = l({}), [Ie, Le] = l({}), Re = c(null), [ze, Be] = l(""), Ve = s(() => d && d.length > 0 ? d.map(_t) : [{
|
|
437
437
|
field: f,
|
|
438
438
|
label: vt(f)
|
|
439
|
-
}], [d, f]),
|
|
439
|
+
}], [d, f]), Z = s(() => {
|
|
440
440
|
if (k && k.length > 0) return k;
|
|
441
441
|
if (T && T.length > 0) return T.map((e) => {
|
|
442
442
|
let t = "text";
|
|
@@ -460,15 +460,15 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
460
460
|
};
|
|
461
461
|
});
|
|
462
462
|
}, [k, T]), He = s(() => {
|
|
463
|
-
let e = T?.length ? yt(T) : {}, t =
|
|
463
|
+
let e = T?.length ? yt(T) : {}, t = Z?.length ? bt(X, Z) : {}, n = {
|
|
464
464
|
...e,
|
|
465
465
|
...t
|
|
466
466
|
};
|
|
467
467
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
468
468
|
}, [
|
|
469
469
|
T,
|
|
470
|
-
|
|
471
|
-
|
|
470
|
+
Z,
|
|
471
|
+
X
|
|
472
472
|
]), Ue = Math.max(1, Math.ceil(ve / y)), We = r(async (e, t = 1, n, r) => {
|
|
473
473
|
if (!(!o || !u)) {
|
|
474
474
|
_e(!0), B(null);
|
|
@@ -481,7 +481,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
481
481
|
let a = r === void 0 ? He : r;
|
|
482
482
|
a && Object.keys(a).length > 0 && (i.$filter = a);
|
|
483
483
|
let s = await o.find(u, i), c = s?.data ?? s ?? [];
|
|
484
|
-
ge(c), ye(s?.total ?? c.length),
|
|
484
|
+
ge(c), ye(s?.total ?? c.length), Me(-1);
|
|
485
485
|
} catch (e) {
|
|
486
486
|
B(e instanceof Error ? e.message : String(e)), ge([]);
|
|
487
487
|
} finally {
|
|
@@ -493,12 +493,12 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
493
493
|
u,
|
|
494
494
|
y,
|
|
495
495
|
He
|
|
496
|
-
]), Ge = s(() =>
|
|
497
|
-
field:
|
|
498
|
-
direction:
|
|
499
|
-
} : null, [
|
|
496
|
+
]), Ge = s(() => Ce ? {
|
|
497
|
+
field: Ce,
|
|
498
|
+
direction: G
|
|
499
|
+
} : null, [Ce, G]);
|
|
500
500
|
a(() => {
|
|
501
|
-
e || (be(""), U(1), B(null), ge([]),
|
|
501
|
+
e || (be(""), U(1), B(null), ge([]), W(null), Ee("asc"), Me(-1), Y(!1), Fe({}), Le({}), Be(""), K(new Set(i && Array.isArray(S) ? S : [])), ke.current.clear());
|
|
502
502
|
}, [e]), a(() => {
|
|
503
503
|
e && We(V || void 0, H, Ge);
|
|
504
504
|
}, [
|
|
@@ -507,7 +507,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
507
507
|
Ge,
|
|
508
508
|
He
|
|
509
509
|
]), a(() => {
|
|
510
|
-
e && i &&
|
|
510
|
+
e && i && K(new Set(Array.isArray(S) ? S : []));
|
|
511
511
|
}, [
|
|
512
512
|
e,
|
|
513
513
|
i,
|
|
@@ -522,20 +522,20 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
522
522
|
Se.current && clearTimeout(Se.current);
|
|
523
523
|
}, []);
|
|
524
524
|
let qe = r((e) => {
|
|
525
|
-
|
|
525
|
+
W((t) => t === e ? (Ee((e) => e === "asc" ? "desc" : "asc"), e) : (Ee("asc"), e)), U(1);
|
|
526
526
|
}, []), Je = r((e) => e[m] ?? e.id ?? e._id, [m]), Ye = r((e) => {
|
|
527
527
|
let t = Je(e);
|
|
528
|
-
return i ?
|
|
528
|
+
return i ? De.has(t) : S === t;
|
|
529
529
|
}, [
|
|
530
530
|
i,
|
|
531
531
|
S,
|
|
532
|
-
|
|
532
|
+
De,
|
|
533
533
|
Je
|
|
534
534
|
]), Xe = r((e) => {
|
|
535
535
|
let n = Je(e);
|
|
536
|
-
i ?
|
|
536
|
+
i ? K((t) => {
|
|
537
537
|
let r = new Set(t);
|
|
538
|
-
return r.has(n) ? (r.delete(n),
|
|
538
|
+
return r.has(n) ? (r.delete(n), ke.current.delete(n)) : (r.add(n), ke.current.set(n, e)), r;
|
|
539
539
|
}) : (te(n), ne?.([e]), t(!1));
|
|
540
540
|
}, [
|
|
541
541
|
i,
|
|
@@ -544,12 +544,12 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
544
544
|
ne,
|
|
545
545
|
t
|
|
546
546
|
]), Ze = r(() => {
|
|
547
|
-
let e = Array.from(
|
|
547
|
+
let e = Array.from(De);
|
|
548
548
|
te(e);
|
|
549
|
-
let n = e.map((e) =>
|
|
549
|
+
let n = e.map((e) => ke.current.get(e)).filter(Boolean);
|
|
550
550
|
ne?.(n), t(!1);
|
|
551
551
|
}, [
|
|
552
|
-
|
|
552
|
+
De,
|
|
553
553
|
te,
|
|
554
554
|
ne,
|
|
555
555
|
t
|
|
@@ -559,21 +559,21 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
559
559
|
U((e) => Math.min(Ue, e + 1));
|
|
560
560
|
}, [Ue]), et = r((e) => {
|
|
561
561
|
if (e.key !== "Enter") return;
|
|
562
|
-
let t = parseInt(
|
|
563
|
-
!isNaN(t) && t >= 1 && t <= Ue && U(t),
|
|
564
|
-
}, [
|
|
565
|
-
L.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(),
|
|
562
|
+
let t = parseInt(ze, 10);
|
|
563
|
+
!isNaN(t) && t >= 1 && t <= Ue && U(t), Be("");
|
|
564
|
+
}, [ze, Ue]), tt = r((e) => {
|
|
565
|
+
L.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Me((e) => Math.min(e + 1, L.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Me((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Ae >= 0 && Ae < L.length && Xe(L[Ae])));
|
|
566
566
|
}, [
|
|
567
567
|
L,
|
|
568
|
-
|
|
568
|
+
Ae,
|
|
569
569
|
Xe
|
|
570
570
|
]);
|
|
571
571
|
a(() => {
|
|
572
|
-
if (
|
|
573
|
-
let e =
|
|
572
|
+
if (Ae >= 0 && Ne.current) {
|
|
573
|
+
let e = Ne.current.querySelector(`[data-row-index="${Ae}"]`);
|
|
574
574
|
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
575
575
|
}
|
|
576
|
-
}, [
|
|
576
|
+
}, [Ae]);
|
|
577
577
|
let nt = r((e, t) => {
|
|
578
578
|
if (p && t.field === f) {
|
|
579
579
|
let t = "[-\\u2013\\u2014|/·,:]", n = !1, r = p.replace(/\{([^{}]+)\}/g, (t, r) => {
|
|
@@ -588,7 +588,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
588
588
|
let n = e[t.field];
|
|
589
589
|
if (t.type && O) {
|
|
590
590
|
let e = O(t.type);
|
|
591
|
-
if (e) return /* @__PURE__ */
|
|
591
|
+
if (e) return /* @__PURE__ */ q(e, {
|
|
592
592
|
value: n,
|
|
593
593
|
field: {
|
|
594
594
|
name: t.field,
|
|
@@ -601,56 +601,56 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
601
601
|
O,
|
|
602
602
|
p,
|
|
603
603
|
f
|
|
604
|
-
]), rt = r((e) =>
|
|
605
|
-
e.preventDefault(), e.stopPropagation(),
|
|
604
|
+
]), rt = r((e) => Ce === e ? q(G === "asc" ? de : F, { className: "ml-1 size-3" }) : /* @__PURE__ */ q(fe, { className: "ml-1 size-3 opacity-40" }), [Ce, G]), it = r((e, t, n) => {
|
|
605
|
+
e.preventDefault(), e.stopPropagation(), Re.current = {
|
|
606
606
|
field: t,
|
|
607
607
|
startX: e.clientX,
|
|
608
608
|
startWidth: n
|
|
609
609
|
};
|
|
610
610
|
let r = (e) => {
|
|
611
|
-
if (!
|
|
612
|
-
let t = e.clientX -
|
|
613
|
-
|
|
611
|
+
if (!Re.current) return;
|
|
612
|
+
let t = e.clientX - Re.current.startX, n = Math.max(Ct, Re.current.startWidth + t);
|
|
613
|
+
Le((e) => ({
|
|
614
614
|
...e,
|
|
615
|
-
[
|
|
615
|
+
[Re.current.field]: n
|
|
616
616
|
}));
|
|
617
617
|
}, i = () => {
|
|
618
|
-
|
|
618
|
+
Re.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
619
619
|
};
|
|
620
620
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
621
621
|
}, []), at = r((e, t) => {
|
|
622
|
-
|
|
622
|
+
Fe((n) => ({
|
|
623
623
|
...n,
|
|
624
624
|
[e]: t
|
|
625
625
|
})), U(1);
|
|
626
626
|
}, []), ot = r(() => {
|
|
627
|
-
|
|
628
|
-
}, []), st = s(() => Object.values(
|
|
629
|
-
let t =
|
|
627
|
+
Fe({}), U(1);
|
|
628
|
+
}, []), st = s(() => Object.values(X).filter((e) => e != null && e !== "").length, [X]), ct = r((e) => {
|
|
629
|
+
let t = X[e.field], n = e.label || vt(e.field);
|
|
630
630
|
switch (e.type) {
|
|
631
|
-
case "select": return /* @__PURE__ */
|
|
631
|
+
case "select": return /* @__PURE__ */ J("div", {
|
|
632
632
|
className: "space-y-1",
|
|
633
|
-
children: [/* @__PURE__ */
|
|
633
|
+
children: [/* @__PURE__ */ q(w, {
|
|
634
634
|
className: "text-xs text-muted-foreground",
|
|
635
635
|
children: n
|
|
636
|
-
}), /* @__PURE__ */
|
|
636
|
+
}), /* @__PURE__ */ J(E, {
|
|
637
637
|
value: t == null ? "" : String(t),
|
|
638
638
|
onValueChange: (t) => at(e.field, t),
|
|
639
|
-
children: [/* @__PURE__ */
|
|
639
|
+
children: [/* @__PURE__ */ q(ae, {
|
|
640
640
|
className: "h-8 text-xs",
|
|
641
|
-
children: /* @__PURE__ */
|
|
642
|
-
}), /* @__PURE__ */
|
|
641
|
+
children: /* @__PURE__ */ q(oe, { placeholder: `Filter ${n}` })
|
|
642
|
+
}), /* @__PURE__ */ q(re, { children: e.options?.map((e) => /* @__PURE__ */ q(ie, {
|
|
643
643
|
value: String(e.value),
|
|
644
644
|
children: e.label
|
|
645
645
|
}, String(e.value))) })]
|
|
646
646
|
})]
|
|
647
647
|
});
|
|
648
|
-
case "number": return /* @__PURE__ */
|
|
648
|
+
case "number": return /* @__PURE__ */ J("div", {
|
|
649
649
|
className: "space-y-1",
|
|
650
|
-
children: [/* @__PURE__ */
|
|
650
|
+
children: [/* @__PURE__ */ q(w, {
|
|
651
651
|
className: "text-xs text-muted-foreground",
|
|
652
652
|
children: n
|
|
653
|
-
}), /* @__PURE__ */
|
|
653
|
+
}), /* @__PURE__ */ q(C, {
|
|
654
654
|
type: "number",
|
|
655
655
|
className: "h-8 text-xs",
|
|
656
656
|
value: t ?? "",
|
|
@@ -661,40 +661,40 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
661
661
|
}
|
|
662
662
|
})]
|
|
663
663
|
});
|
|
664
|
-
case "date": return /* @__PURE__ */
|
|
664
|
+
case "date": return /* @__PURE__ */ J("div", {
|
|
665
665
|
className: "space-y-1",
|
|
666
|
-
children: [/* @__PURE__ */
|
|
666
|
+
children: [/* @__PURE__ */ q(w, {
|
|
667
667
|
className: "text-xs text-muted-foreground",
|
|
668
668
|
children: n
|
|
669
|
-
}), /* @__PURE__ */
|
|
669
|
+
}), /* @__PURE__ */ q(C, {
|
|
670
670
|
type: "date",
|
|
671
671
|
className: "h-8 text-xs",
|
|
672
672
|
value: t ?? "",
|
|
673
673
|
onChange: (t) => at(e.field, t.target.value)
|
|
674
674
|
})]
|
|
675
675
|
});
|
|
676
|
-
case "boolean": return /* @__PURE__ */
|
|
676
|
+
case "boolean": return /* @__PURE__ */ J("div", {
|
|
677
677
|
className: "space-y-1",
|
|
678
|
-
children: [/* @__PURE__ */
|
|
678
|
+
children: [/* @__PURE__ */ q(w, {
|
|
679
679
|
className: "text-xs text-muted-foreground",
|
|
680
680
|
children: n
|
|
681
|
-
}), /* @__PURE__ */
|
|
681
|
+
}), /* @__PURE__ */ J("div", {
|
|
682
682
|
className: "flex items-center gap-2 h-8",
|
|
683
|
-
children: [/* @__PURE__ */
|
|
683
|
+
children: [/* @__PURE__ */ q(g, {
|
|
684
684
|
checked: !!t,
|
|
685
685
|
onCheckedChange: (t) => at(e.field, !!t)
|
|
686
|
-
}), /* @__PURE__ */
|
|
686
|
+
}), /* @__PURE__ */ q("span", {
|
|
687
687
|
className: "text-xs text-muted-foreground",
|
|
688
688
|
children: "Yes"
|
|
689
689
|
})]
|
|
690
690
|
})]
|
|
691
691
|
});
|
|
692
|
-
default: return /* @__PURE__ */
|
|
692
|
+
default: return /* @__PURE__ */ J("div", {
|
|
693
693
|
className: "space-y-1",
|
|
694
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ q(w, {
|
|
695
695
|
className: "text-xs text-muted-foreground",
|
|
696
696
|
children: n
|
|
697
|
-
}), /* @__PURE__ */
|
|
697
|
+
}), /* @__PURE__ */ q(C, {
|
|
698
698
|
className: "h-8 text-xs",
|
|
699
699
|
value: t ?? "",
|
|
700
700
|
placeholder: `Filter ${n}`,
|
|
@@ -702,87 +702,87 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
702
702
|
})]
|
|
703
703
|
});
|
|
704
704
|
}
|
|
705
|
-
}, [
|
|
706
|
-
return /* @__PURE__ */
|
|
705
|
+
}, [X, at]), lt = 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", []);
|
|
706
|
+
return /* @__PURE__ */ q(_, {
|
|
707
707
|
open: e,
|
|
708
708
|
onOpenChange: t,
|
|
709
|
-
children: /* @__PURE__ */
|
|
709
|
+
children: /* @__PURE__ */ J(v, {
|
|
710
710
|
className: "w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0",
|
|
711
711
|
"data-testid": "record-picker-dialog",
|
|
712
712
|
children: [
|
|
713
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ q(ee, { children: /* @__PURE__ */ J(x, { children: [n, i && /* @__PURE__ */ q("span", {
|
|
714
714
|
className: "sr-only",
|
|
715
715
|
children: " (multiple selection)"
|
|
716
716
|
})] }) }),
|
|
717
|
-
/* @__PURE__ */
|
|
717
|
+
/* @__PURE__ */ J("div", {
|
|
718
718
|
className: "relative rounded-md border bg-muted/30 mb-3",
|
|
719
719
|
children: [
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ q(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
721
|
+
/* @__PURE__ */ q(C, {
|
|
722
722
|
placeholder: "Search...",
|
|
723
723
|
value: V,
|
|
724
724
|
onChange: (e) => Ke(e.target.value),
|
|
725
725
|
className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
|
|
726
726
|
"data-testid": "record-picker-search"
|
|
727
727
|
}),
|
|
728
|
-
R && /* @__PURE__ */
|
|
728
|
+
R && /* @__PURE__ */ q(xe, {
|
|
729
729
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
730
730
|
"data-testid": "record-picker-loading-indicator"
|
|
731
731
|
})
|
|
732
732
|
]
|
|
733
733
|
}),
|
|
734
|
-
|
|
734
|
+
Z && Z.length > 0 && /* @__PURE__ */ q("div", {
|
|
735
735
|
className: "py-2",
|
|
736
|
-
children: N ? /* @__PURE__ */
|
|
736
|
+
children: N ? /* @__PURE__ */ q("div", {
|
|
737
737
|
"data-testid": "record-picker-filter-bar",
|
|
738
738
|
children: N({
|
|
739
|
-
filterColumns:
|
|
740
|
-
values:
|
|
739
|
+
filterColumns: Z,
|
|
740
|
+
values: X,
|
|
741
741
|
onChange: at,
|
|
742
742
|
onClear: ot,
|
|
743
743
|
activeCount: st
|
|
744
744
|
})
|
|
745
|
-
}) : /* @__PURE__ */
|
|
745
|
+
}) : /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ J("div", {
|
|
746
746
|
className: "flex items-center gap-2",
|
|
747
747
|
"data-testid": "record-picker-filter-bar",
|
|
748
|
-
children: [/* @__PURE__ */
|
|
748
|
+
children: [/* @__PURE__ */ J(h, {
|
|
749
749
|
type: "button",
|
|
750
750
|
variant: st > 0 ? "secondary" : "outline",
|
|
751
751
|
size: "sm",
|
|
752
752
|
className: "gap-1.5 shrink-0",
|
|
753
|
-
onClick: () =>
|
|
753
|
+
onClick: () => Y((e) => !e),
|
|
754
754
|
children: [
|
|
755
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ q(Te, { className: "size-3.5" }),
|
|
756
756
|
"Filters",
|
|
757
|
-
st > 0 && /* @__PURE__ */
|
|
757
|
+
st > 0 && /* @__PURE__ */ q("span", {
|
|
758
758
|
className: "inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary",
|
|
759
759
|
children: st
|
|
760
760
|
})
|
|
761
761
|
]
|
|
762
|
-
}), st > 0 && /* @__PURE__ */
|
|
762
|
+
}), st > 0 && /* @__PURE__ */ J(h, {
|
|
763
763
|
type: "button",
|
|
764
764
|
variant: "ghost",
|
|
765
765
|
size: "sm",
|
|
766
766
|
className: "gap-1 text-xs",
|
|
767
767
|
onClick: ot,
|
|
768
|
-
children: [/* @__PURE__ */
|
|
768
|
+
children: [/* @__PURE__ */ q(Oe, { className: "size-3" }), "Clear"]
|
|
769
769
|
})]
|
|
770
|
-
}),
|
|
770
|
+
}), Pe && /* @__PURE__ */ q("div", {
|
|
771
771
|
className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
|
|
772
772
|
"data-testid": "record-picker-filter-panel",
|
|
773
|
-
children:
|
|
773
|
+
children: Z.map((e) => /* @__PURE__ */ q("div", { children: ct(e) }, e.field))
|
|
774
774
|
})] })
|
|
775
775
|
}),
|
|
776
|
-
z && /* @__PURE__ */
|
|
776
|
+
z && /* @__PURE__ */ J("div", {
|
|
777
777
|
className: "flex flex-col items-center gap-2 py-4",
|
|
778
778
|
role: "alert",
|
|
779
779
|
children: [
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ q(ue, { className: "size-5 text-destructive" }),
|
|
781
|
+
/* @__PURE__ */ q("p", {
|
|
782
782
|
className: "text-sm text-destructive",
|
|
783
783
|
children: z
|
|
784
784
|
}),
|
|
785
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ q(h, {
|
|
786
786
|
variant: "outline",
|
|
787
787
|
size: "sm",
|
|
788
788
|
onClick: () => We(V || void 0, H, Ge),
|
|
@@ -791,18 +791,18 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
791
791
|
})
|
|
792
792
|
]
|
|
793
793
|
}),
|
|
794
|
-
pe ? /* @__PURE__ */
|
|
794
|
+
pe ? /* @__PURE__ */ q("div", {
|
|
795
795
|
className: "flex-1 min-h-0",
|
|
796
796
|
"data-testid": "record-picker-grid-slot",
|
|
797
797
|
children: pe({
|
|
798
|
-
columns:
|
|
798
|
+
columns: Ve,
|
|
799
799
|
records: L,
|
|
800
800
|
loading: R,
|
|
801
801
|
totalCount: ve,
|
|
802
802
|
currentPage: H,
|
|
803
803
|
pageSize: y,
|
|
804
|
-
sortField:
|
|
805
|
-
sortDirection:
|
|
804
|
+
sortField: Ce,
|
|
805
|
+
sortDirection: G,
|
|
806
806
|
onSort: qe,
|
|
807
807
|
onPageChange: U,
|
|
808
808
|
onRowClick: Xe,
|
|
@@ -811,56 +811,56 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
811
811
|
idField: m,
|
|
812
812
|
cellRenderer: O
|
|
813
813
|
})
|
|
814
|
-
}) : /* @__PURE__ */
|
|
815
|
-
R && L.length === 0 && !z && /* @__PURE__ */
|
|
814
|
+
}) : /* @__PURE__ */ J(je, { children: [
|
|
815
|
+
R && L.length === 0 && !z && /* @__PURE__ */ q("div", {
|
|
816
816
|
className: "flex-1 overflow-hidden min-h-0 border rounded-md",
|
|
817
817
|
role: "status",
|
|
818
818
|
"aria-live": "polite",
|
|
819
819
|
"data-testid": "record-picker-skeleton",
|
|
820
|
-
children: /* @__PURE__ */
|
|
820
|
+
children: /* @__PURE__ */ J(se, { children: [/* @__PURE__ */ q(j, { children: /* @__PURE__ */ J(M, {
|
|
821
821
|
className: "bg-muted/40",
|
|
822
|
-
children: [i && /* @__PURE__ */
|
|
823
|
-
}) }), /* @__PURE__ */
|
|
822
|
+
children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), Ve.map((e) => /* @__PURE__ */ q(le, { children: /* @__PURE__ */ q(D, { className: "h-4 w-20" }) }, e.field))]
|
|
823
|
+
}) }), /* @__PURE__ */ q(ce, { children: Array.from({ length: wt }, (e, t) => /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(A, {
|
|
824
824
|
className: "w-10",
|
|
825
|
-
children: /* @__PURE__ */
|
|
826
|
-
}),
|
|
825
|
+
children: /* @__PURE__ */ q(D, { className: "size-4 rounded" })
|
|
826
|
+
}), Ve.map((e) => /* @__PURE__ */ q(A, { children: /* @__PURE__ */ q(D, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
827
827
|
}),
|
|
828
|
-
!R && !z && L.length === 0 && /* @__PURE__ */
|
|
828
|
+
!R && !z && L.length === 0 && /* @__PURE__ */ q("div", {
|
|
829
829
|
className: "py-8 text-center",
|
|
830
|
-
children: /* @__PURE__ */
|
|
830
|
+
children: /* @__PURE__ */ q("p", {
|
|
831
831
|
className: "text-sm text-muted-foreground",
|
|
832
832
|
children: "No records found"
|
|
833
833
|
})
|
|
834
834
|
}),
|
|
835
|
-
!z && L.length > 0 && /* @__PURE__ */
|
|
835
|
+
!z && L.length > 0 && /* @__PURE__ */ J("div", {
|
|
836
836
|
className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
|
|
837
837
|
tabIndex: 0,
|
|
838
838
|
onKeyDown: tt,
|
|
839
839
|
role: "grid",
|
|
840
840
|
"aria-label": "Records",
|
|
841
|
-
children: [R && /* @__PURE__ */
|
|
841
|
+
children: [R && /* @__PURE__ */ q("div", {
|
|
842
842
|
className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
|
|
843
843
|
"data-testid": "record-picker-loading-overlay",
|
|
844
|
-
children: /* @__PURE__ */
|
|
845
|
-
}), /* @__PURE__ */
|
|
846
|
-
style: Object.keys(
|
|
847
|
-
children: [/* @__PURE__ */
|
|
844
|
+
children: /* @__PURE__ */ q(xe, { className: "size-6 animate-spin text-muted-foreground" })
|
|
845
|
+
}), /* @__PURE__ */ J(se, {
|
|
846
|
+
style: Object.keys(Ie).length > 0 ? { tableLayout: "fixed" } : void 0,
|
|
847
|
+
children: [/* @__PURE__ */ q(j, {
|
|
848
848
|
className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
|
|
849
849
|
"data-testid": "record-picker-sticky-header",
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
let t =
|
|
852
|
-
return /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), Ve.map((e) => {
|
|
851
|
+
let t = Ie[e.field];
|
|
852
|
+
return /* @__PURE__ */ J(le, {
|
|
853
853
|
style: t ? {
|
|
854
854
|
width: `${t}px`,
|
|
855
855
|
minWidth: `${t}px`
|
|
856
856
|
} : e.width ? { width: e.width } : void 0,
|
|
857
857
|
className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
|
|
858
858
|
onClick: () => qe(e.field),
|
|
859
|
-
"aria-sort":
|
|
860
|
-
children: [/* @__PURE__ */
|
|
859
|
+
"aria-sort": Ce === e.field ? G === "asc" ? "ascending" : "descending" : "none",
|
|
860
|
+
children: [/* @__PURE__ */ J("span", {
|
|
861
861
|
className: "inline-flex items-center",
|
|
862
862
|
children: [e.label || vt(e.field), rt(e.field)]
|
|
863
|
-
}), /* @__PURE__ */
|
|
863
|
+
}), /* @__PURE__ */ q("span", {
|
|
864
864
|
role: "separator",
|
|
865
865
|
"aria-orientation": "vertical",
|
|
866
866
|
className: "absolute right-0 top-0 bottom-0 w-1 cursor-col-resize opacity-0 group-hover:opacity-100 bg-border hover:bg-primary/50 transition-opacity",
|
|
@@ -873,20 +873,20 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
873
873
|
})]
|
|
874
874
|
}, e.field);
|
|
875
875
|
})] })
|
|
876
|
-
}), /* @__PURE__ */
|
|
877
|
-
ref:
|
|
876
|
+
}), /* @__PURE__ */ q(ce, {
|
|
877
|
+
ref: Ne,
|
|
878
878
|
children: L.map((e, t) => {
|
|
879
|
-
let n = Je(e), r = Ye(e), a = t ===
|
|
880
|
-
return /* @__PURE__ */
|
|
879
|
+
let n = Je(e), r = Ye(e), a = t === Ae;
|
|
880
|
+
return /* @__PURE__ */ J(M, {
|
|
881
881
|
"data-row-index": t,
|
|
882
882
|
className: P("cursor-pointer transition-colors", lt(r, t), a && "ring-2 ring-primary ring-inset"),
|
|
883
883
|
onClick: () => Xe(e),
|
|
884
884
|
"data-testid": `record-row-${n}`,
|
|
885
885
|
"aria-selected": r,
|
|
886
|
-
children: [i && /* @__PURE__ */
|
|
886
|
+
children: [i && /* @__PURE__ */ q(A, {
|
|
887
887
|
className: "w-10",
|
|
888
|
-
children: r && /* @__PURE__ */
|
|
889
|
-
}),
|
|
888
|
+
children: r && /* @__PURE__ */ q(I, { className: "size-4 text-primary" })
|
|
889
|
+
}), Ve.map((t) => /* @__PURE__ */ q(A, {
|
|
890
890
|
className: "py-2.5",
|
|
891
891
|
children: nt(e, t)
|
|
892
892
|
}, t.field))]
|
|
@@ -895,18 +895,18 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
895
895
|
})]
|
|
896
896
|
})]
|
|
897
897
|
}),
|
|
898
|
-
!z && ve > 0 && /* @__PURE__ */
|
|
898
|
+
!z && ve > 0 && /* @__PURE__ */ J("div", {
|
|
899
899
|
className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
|
|
900
900
|
"data-testid": "record-picker-pagination",
|
|
901
|
-
children: [/* @__PURE__ */
|
|
901
|
+
children: [/* @__PURE__ */ J("span", { children: [
|
|
902
902
|
ve,
|
|
903
903
|
" ",
|
|
904
904
|
ve === 1 ? "record" : "records",
|
|
905
905
|
Ue > 1 && ` · Page ${H} of ${Ue}`
|
|
906
|
-
] }), Ue > 1 && /* @__PURE__ */
|
|
906
|
+
] }), Ue > 1 && /* @__PURE__ */ J("div", {
|
|
907
907
|
className: "flex items-center gap-1.5",
|
|
908
908
|
children: [
|
|
909
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ q(h, {
|
|
910
910
|
variant: "outline",
|
|
911
911
|
size: "icon",
|
|
912
912
|
className: "size-7",
|
|
@@ -914,18 +914,18 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
914
914
|
disabled: H <= 1,
|
|
915
915
|
type: "button",
|
|
916
916
|
"aria-label": "Previous page",
|
|
917
|
-
children: /* @__PURE__ */
|
|
917
|
+
children: /* @__PURE__ */ q(me, { className: "size-4" })
|
|
918
918
|
}),
|
|
919
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ q(C, {
|
|
920
920
|
className: "h-7 w-12 text-center text-xs px-1",
|
|
921
921
|
placeholder: String(H),
|
|
922
|
-
value:
|
|
923
|
-
onChange: (e) =>
|
|
922
|
+
value: ze,
|
|
923
|
+
onChange: (e) => Be(e.target.value),
|
|
924
924
|
onKeyDown: et,
|
|
925
925
|
"aria-label": "Jump to page",
|
|
926
926
|
"data-testid": "record-picker-page-jump"
|
|
927
927
|
}),
|
|
928
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ q(h, {
|
|
929
929
|
variant: "outline",
|
|
930
930
|
size: "icon",
|
|
931
931
|
className: "size-7",
|
|
@@ -933,25 +933,25 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
933
933
|
disabled: H >= Ue,
|
|
934
934
|
type: "button",
|
|
935
935
|
"aria-label": "Next page",
|
|
936
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ q(he, { className: "size-4" })
|
|
937
937
|
})
|
|
938
938
|
]
|
|
939
939
|
})]
|
|
940
940
|
})
|
|
941
941
|
] }),
|
|
942
|
-
i && /* @__PURE__ */
|
|
942
|
+
i && /* @__PURE__ */ q(b, { children: /* @__PURE__ */ J("div", {
|
|
943
943
|
className: "flex items-center gap-2 w-full justify-between",
|
|
944
|
-
children: [/* @__PURE__ */
|
|
944
|
+
children: [/* @__PURE__ */ J("span", {
|
|
945
945
|
className: "text-sm text-muted-foreground",
|
|
946
|
-
children: [
|
|
947
|
-
}), /* @__PURE__ */
|
|
946
|
+
children: [De.size, " selected"]
|
|
947
|
+
}), /* @__PURE__ */ J("div", {
|
|
948
948
|
className: "flex gap-2",
|
|
949
|
-
children: [/* @__PURE__ */
|
|
949
|
+
children: [/* @__PURE__ */ q(h, {
|
|
950
950
|
variant: "outline",
|
|
951
951
|
type: "button",
|
|
952
952
|
onClick: () => t(!1),
|
|
953
953
|
children: "Cancel"
|
|
954
|
-
}), /* @__PURE__ */
|
|
954
|
+
}), /* @__PURE__ */ q(h, {
|
|
955
955
|
type: "button",
|
|
956
956
|
onClick: Ze,
|
|
957
957
|
children: "Confirm"
|
|
@@ -962,7 +962,7 @@ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
962
962
|
})
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
|
-
var St, Ct, wt, Tt =
|
|
965
|
+
var St, Ct, wt, Tt = Y((() => {
|
|
966
966
|
St = 10, Ct = 60, wt = 5;
|
|
967
967
|
}));
|
|
968
968
|
//#endregion
|
|
@@ -973,7 +973,7 @@ function Et(e) {
|
|
|
973
973
|
function Dt() {
|
|
974
974
|
return Ot;
|
|
975
975
|
}
|
|
976
|
-
var Ot, kt =
|
|
976
|
+
var Ot, kt = Y((() => {})), At = /* @__PURE__ */ X({ LookupField: () => Pt });
|
|
977
977
|
function jt(e, t) {
|
|
978
978
|
if (!e || typeof e != "object" || !t) return null;
|
|
979
979
|
let n = "[-\\u2013\\u2014|/·,:]", r = !1, i = t.replace(/\{([^{}]+)\}/g, (t, n) => {
|
|
@@ -1048,7 +1048,7 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1048
1048
|
let V = s(() => {
|
|
1049
1049
|
let e = ve?.titleFormat;
|
|
1050
1050
|
return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
|
|
1051
|
-
}, [ve]), be = u.onCreateNew ?? se?.onCreateNew, [H, U] = l(!1), Se = B ? v : le,
|
|
1051
|
+
}, [ve]), be = u.onCreateNew ?? se?.onCreateNew, [H, U] = l(!1), Se = B ? v : le, W = s(() => {
|
|
1052
1052
|
if (B || !p) return Se;
|
|
1053
1053
|
let e = p.toLowerCase();
|
|
1054
1054
|
return Se.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
|
|
@@ -1059,8 +1059,8 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1059
1059
|
]);
|
|
1060
1060
|
a(() => {
|
|
1061
1061
|
O(-1);
|
|
1062
|
-
}, [
|
|
1063
|
-
let
|
|
1062
|
+
}, [W.length]);
|
|
1063
|
+
let G = r(async (e) => {
|
|
1064
1064
|
if (!(!R || !F)) {
|
|
1065
1065
|
if (z) {
|
|
1066
1066
|
y([]), re(0);
|
|
@@ -1097,22 +1097,22 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1097
1097
|
_e
|
|
1098
1098
|
]);
|
|
1099
1099
|
a(() => {
|
|
1100
|
-
d && B && I.length > 0 &&
|
|
1100
|
+
d && B && I.length > 0 && G(p || void 0);
|
|
1101
1101
|
}, [s(() => I.map((e) => `${e.param}=${_e[e.field] ?? ""}`).join("|"), [I, _e])]), a(() => {
|
|
1102
|
-
d && B &&
|
|
1102
|
+
d && B && G(p || void 0), d || (g(""), w(null), O(-1));
|
|
1103
1103
|
}, [d]);
|
|
1104
|
-
let
|
|
1104
|
+
let Te = r((e) => {
|
|
1105
1105
|
g(e), B && (ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
|
|
1106
|
-
|
|
1106
|
+
G(e || void 0);
|
|
1107
1107
|
}, 300));
|
|
1108
|
-
}, [B,
|
|
1108
|
+
}, [B, G]);
|
|
1109
1109
|
a(() => () => {
|
|
1110
1110
|
ie.current && clearTimeout(ie.current);
|
|
1111
1111
|
}, []), a(() => {
|
|
1112
1112
|
if (!B || !R || !F) return;
|
|
1113
1113
|
let t = j ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : [];
|
|
1114
1114
|
if (!t.length) return;
|
|
1115
|
-
let n = t.filter((e) => !
|
|
1115
|
+
let n = t.filter((e) => !Ee(e));
|
|
1116
1116
|
if (!n.length) return;
|
|
1117
1117
|
let r = !1;
|
|
1118
1118
|
return (async () => {
|
|
@@ -1146,11 +1146,11 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1146
1146
|
N,
|
|
1147
1147
|
j
|
|
1148
1148
|
]);
|
|
1149
|
-
let
|
|
1149
|
+
let Ee = r((e) => le.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? ae.find((t) => t.value === e), [
|
|
1150
1150
|
le,
|
|
1151
1151
|
v,
|
|
1152
1152
|
ae
|
|
1153
|
-
]),
|
|
1153
|
+
]), K = j ? (Array.isArray(e) ? e : []).map(Ee).filter(Boolean) : e ? [Ee(e)].filter(Boolean) : [], ke = r((n) => {
|
|
1154
1154
|
if (j) {
|
|
1155
1155
|
let r = Array.isArray(e) ? e : [];
|
|
1156
1156
|
r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
|
|
@@ -1159,127 +1159,127 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1159
1159
|
j,
|
|
1160
1160
|
e,
|
|
1161
1161
|
t
|
|
1162
|
-
]),
|
|
1162
|
+
]), Ae = (n) => {
|
|
1163
1163
|
t(j ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
|
|
1164
|
-
},
|
|
1164
|
+
}, Me = r((e) => {
|
|
1165
1165
|
oe(e.map((e) => Mt(e, M, P, N, V)));
|
|
1166
1166
|
}, [
|
|
1167
1167
|
M,
|
|
1168
1168
|
P,
|
|
1169
1169
|
N,
|
|
1170
1170
|
V
|
|
1171
|
-
]),
|
|
1172
|
-
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e <
|
|
1171
|
+
]), Ne = r((e) => {
|
|
1172
|
+
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e < W.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), O((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), D >= 0 && D < W.length && ke(W[D]));
|
|
1173
1173
|
}, [
|
|
1174
|
-
|
|
1174
|
+
W,
|
|
1175
1175
|
D,
|
|
1176
|
-
|
|
1176
|
+
ke
|
|
1177
1177
|
]);
|
|
1178
1178
|
return a(() => {
|
|
1179
1179
|
D >= 0 && k.current && k.current.querySelector(`[data-lookup-index="${D}"]`)?.scrollIntoView({ block: "nearest" });
|
|
1180
|
-
}, [D]), o ?
|
|
1180
|
+
}, [D]), o ? K.length ? j ? /* @__PURE__ */ q("div", {
|
|
1181
1181
|
className: "flex flex-wrap gap-1",
|
|
1182
|
-
children:
|
|
1182
|
+
children: K.map((e, t) => /* @__PURE__ */ q(m, {
|
|
1183
1183
|
variant: "outline",
|
|
1184
1184
|
children: e?.label || e?.[M]
|
|
1185
1185
|
}, t))
|
|
1186
|
-
}) : /* @__PURE__ */
|
|
1186
|
+
}) : /* @__PURE__ */ q("span", {
|
|
1187
1187
|
className: "text-sm",
|
|
1188
|
-
children:
|
|
1189
|
-
}) : /* @__PURE__ */
|
|
1188
|
+
children: K[0]?.label || K[0]?.[M]
|
|
1189
|
+
}) : /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("div", {
|
|
1190
1190
|
className: "space-y-2",
|
|
1191
1191
|
children: [
|
|
1192
|
-
|
|
1192
|
+
K.length > 0 && /* @__PURE__ */ q("div", {
|
|
1193
1193
|
className: "flex flex-wrap gap-1",
|
|
1194
|
-
children:
|
|
1194
|
+
children: K.map((e, t) => /* @__PURE__ */ J(m, {
|
|
1195
1195
|
variant: "outline",
|
|
1196
1196
|
className: "gap-1",
|
|
1197
|
-
children: [e?.label || e?.[M], /* @__PURE__ */
|
|
1198
|
-
onClick: () =>
|
|
1197
|
+
children: [e?.label || e?.[M], /* @__PURE__ */ q("button", {
|
|
1198
|
+
onClick: () => Ae(e?.value),
|
|
1199
1199
|
className: "ml-1 hover:text-destructive",
|
|
1200
1200
|
type: "button",
|
|
1201
1201
|
"aria-label": `Remove ${e?.label || e?.[M]}`,
|
|
1202
|
-
children: /* @__PURE__ */
|
|
1202
|
+
children: /* @__PURE__ */ q(Oe, { className: "size-3" })
|
|
1203
1203
|
})]
|
|
1204
1204
|
}, t))
|
|
1205
1205
|
}),
|
|
1206
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ J("div", {
|
|
1207
1207
|
className: "flex items-center gap-1.5",
|
|
1208
|
-
children: [/* @__PURE__ */
|
|
1208
|
+
children: [/* @__PURE__ */ J(te, {
|
|
1209
1209
|
open: d,
|
|
1210
1210
|
onOpenChange: (e) => !z && f(e),
|
|
1211
|
-
children: [/* @__PURE__ */
|
|
1211
|
+
children: [/* @__PURE__ */ q(T, {
|
|
1212
1212
|
asChild: !0,
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1213
|
+
children: /* @__PURE__ */ J(h, {
|
|
1214
1214
|
variant: "outline",
|
|
1215
1215
|
className: "min-w-0 flex-1 justify-start text-left font-normal",
|
|
1216
1216
|
type: "button",
|
|
1217
1217
|
disabled: z || u.disabled,
|
|
1218
1218
|
"data-testid": z ? "lookup-trigger-gated" : void 0,
|
|
1219
1219
|
title: z ? `Select ${I.map((e) => e.field).join(", ")} first` : void 0,
|
|
1220
|
-
children: [/* @__PURE__ */
|
|
1220
|
+
children: [/* @__PURE__ */ q(we, { className: "mr-2 size-4" }), z ? `Select ${I.map((e) => e.field).join(", ")} first` : K.length === 0 ? se?.placeholder || _("common.select") : j ? _("table.selected", { count: K.length }) : _("common.select")]
|
|
1221
1221
|
})
|
|
1222
|
-
}), /* @__PURE__ */
|
|
1222
|
+
}), /* @__PURE__ */ J(ne, {
|
|
1223
1223
|
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
1224
1224
|
align: "start",
|
|
1225
1225
|
children: [
|
|
1226
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ q("div", {
|
|
1227
1227
|
className: "p-2",
|
|
1228
|
-
children: /* @__PURE__ */
|
|
1228
|
+
children: /* @__PURE__ */ J("div", {
|
|
1229
1229
|
className: "relative",
|
|
1230
1230
|
children: [
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ q(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
1232
|
+
/* @__PURE__ */ q(C, {
|
|
1233
1233
|
placeholder: _("common.search") + "...",
|
|
1234
1234
|
value: p,
|
|
1235
|
-
onChange: (e) =>
|
|
1236
|
-
onKeyDown:
|
|
1235
|
+
onChange: (e) => Te(e.target.value),
|
|
1236
|
+
onKeyDown: Ne,
|
|
1237
1237
|
className: "w-full pl-9 h-8 text-sm"
|
|
1238
1238
|
}),
|
|
1239
|
-
b && /* @__PURE__ */
|
|
1239
|
+
b && /* @__PURE__ */ q(xe, {
|
|
1240
1240
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
1241
1241
|
"data-testid": "lookup-loading"
|
|
1242
1242
|
})
|
|
1243
1243
|
]
|
|
1244
1244
|
})
|
|
1245
1245
|
}),
|
|
1246
|
-
x && /* @__PURE__ */
|
|
1246
|
+
x && /* @__PURE__ */ J("div", {
|
|
1247
1247
|
className: "flex flex-col items-center gap-2 py-4 px-2",
|
|
1248
1248
|
role: "alert",
|
|
1249
1249
|
children: [
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ q(ue, { className: "size-5 text-destructive" }),
|
|
1251
|
+
/* @__PURE__ */ q("p", {
|
|
1252
1252
|
className: "text-sm text-destructive",
|
|
1253
1253
|
children: x
|
|
1254
1254
|
}),
|
|
1255
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ q(h, {
|
|
1256
1256
|
variant: "outline",
|
|
1257
1257
|
size: "sm",
|
|
1258
|
-
onClick: () =>
|
|
1258
|
+
onClick: () => G(p || void 0),
|
|
1259
1259
|
type: "button",
|
|
1260
1260
|
children: "Retry"
|
|
1261
1261
|
})
|
|
1262
1262
|
]
|
|
1263
1263
|
}),
|
|
1264
|
-
b &&
|
|
1264
|
+
b && W.length === 0 && !x && /* @__PURE__ */ J("div", {
|
|
1265
1265
|
className: "flex flex-col items-center gap-2 py-6",
|
|
1266
1266
|
role: "status",
|
|
1267
1267
|
"aria-live": "polite",
|
|
1268
|
-
children: [/* @__PURE__ */
|
|
1268
|
+
children: [/* @__PURE__ */ q(xe, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ q("p", {
|
|
1269
1269
|
className: "text-sm text-muted-foreground",
|
|
1270
1270
|
children: "Loading…"
|
|
1271
1271
|
})]
|
|
1272
1272
|
}),
|
|
1273
|
-
!x && !(b &&
|
|
1273
|
+
!x && !(b && W.length === 0) && /* @__PURE__ */ q("div", {
|
|
1274
1274
|
ref: k,
|
|
1275
1275
|
className: "max-h-64 overflow-y-auto px-1 pb-1",
|
|
1276
1276
|
role: "listbox",
|
|
1277
|
-
children:
|
|
1277
|
+
children: W.length === 0 ? /* @__PURE__ */ J("div", {
|
|
1278
1278
|
className: "py-4 text-center",
|
|
1279
|
-
children: [/* @__PURE__ */
|
|
1279
|
+
children: [/* @__PURE__ */ q("p", {
|
|
1280
1280
|
className: "text-sm text-muted-foreground",
|
|
1281
1281
|
children: "No options found"
|
|
1282
|
-
}), be && /* @__PURE__ */
|
|
1282
|
+
}), be && /* @__PURE__ */ J(h, {
|
|
1283
1283
|
variant: "ghost",
|
|
1284
1284
|
size: "sm",
|
|
1285
1285
|
className: "mt-2 gap-1",
|
|
@@ -1287,45 +1287,45 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1287
1287
|
onClick: () => {
|
|
1288
1288
|
be(p), f(!1);
|
|
1289
1289
|
},
|
|
1290
|
-
children: [/* @__PURE__ */
|
|
1290
|
+
children: [/* @__PURE__ */ q(Ce, { className: "size-4" }), "Create new"]
|
|
1291
1291
|
})]
|
|
1292
|
-
}) : /* @__PURE__ */
|
|
1293
|
-
|
|
1292
|
+
}) : /* @__PURE__ */ J(je, { children: [
|
|
1293
|
+
W.map((t, n) => {
|
|
1294
1294
|
let r = j ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
|
|
1295
|
-
return /* @__PURE__ */
|
|
1295
|
+
return /* @__PURE__ */ J("button", {
|
|
1296
1296
|
"data-lookup-index": n,
|
|
1297
1297
|
role: "option",
|
|
1298
1298
|
"aria-selected": r,
|
|
1299
|
-
onClick: () =>
|
|
1299
|
+
onClick: () => ke(t),
|
|
1300
1300
|
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === D ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
1301
1301
|
type: "button",
|
|
1302
|
-
children: [/* @__PURE__ */
|
|
1302
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1303
1303
|
className: "min-w-0 flex-1",
|
|
1304
|
-
children: [/* @__PURE__ */
|
|
1304
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1305
1305
|
className: "block truncate",
|
|
1306
1306
|
children: t.label
|
|
1307
|
-
}), t.description && /* @__PURE__ */
|
|
1307
|
+
}), t.description && /* @__PURE__ */ q("span", {
|
|
1308
1308
|
className: "block truncate text-xs text-muted-foreground",
|
|
1309
1309
|
children: t.description
|
|
1310
1310
|
})]
|
|
1311
|
-
}), r && /* @__PURE__ */
|
|
1311
|
+
}), r && /* @__PURE__ */ q(m, {
|
|
1312
1312
|
variant: "default",
|
|
1313
1313
|
className: "ml-2 shrink-0",
|
|
1314
1314
|
children: "Selected"
|
|
1315
1315
|
})]
|
|
1316
1316
|
}, t.value);
|
|
1317
1317
|
}),
|
|
1318
|
-
B && E >
|
|
1318
|
+
B && E > W.length && /* @__PURE__ */ J("p", {
|
|
1319
1319
|
className: "text-xs text-muted-foreground text-center py-2",
|
|
1320
1320
|
children: [
|
|
1321
1321
|
"Showing ",
|
|
1322
|
-
|
|
1322
|
+
W.length,
|
|
1323
1323
|
" of ",
|
|
1324
1324
|
E,
|
|
1325
1325
|
" results."
|
|
1326
1326
|
]
|
|
1327
1327
|
}),
|
|
1328
|
-
B && E >
|
|
1328
|
+
B && E > W.length && /* @__PURE__ */ J("button", {
|
|
1329
1329
|
type: "button",
|
|
1330
1330
|
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",
|
|
1331
1331
|
onClick: () => {
|
|
@@ -1333,20 +1333,20 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1333
1333
|
},
|
|
1334
1334
|
"data-testid": "show-all-results",
|
|
1335
1335
|
children: [
|
|
1336
|
-
/* @__PURE__ */
|
|
1336
|
+
/* @__PURE__ */ q(De, { className: "size-3.5" }),
|
|
1337
1337
|
"Show All Results (",
|
|
1338
1338
|
E,
|
|
1339
1339
|
")"
|
|
1340
1340
|
]
|
|
1341
1341
|
}),
|
|
1342
|
-
be && /* @__PURE__ */
|
|
1342
|
+
be && /* @__PURE__ */ J("button", {
|
|
1343
1343
|
type: "button",
|
|
1344
1344
|
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",
|
|
1345
1345
|
onClick: () => {
|
|
1346
1346
|
be(p), f(!1);
|
|
1347
1347
|
},
|
|
1348
1348
|
children: [
|
|
1349
|
-
/* @__PURE__ */
|
|
1349
|
+
/* @__PURE__ */ q(Ce, { className: "size-3.5" }),
|
|
1350
1350
|
"Create new",
|
|
1351
1351
|
p ? ` "${p}"` : ""
|
|
1352
1352
|
]
|
|
@@ -1355,7 +1355,7 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1355
1355
|
})
|
|
1356
1356
|
]
|
|
1357
1357
|
})]
|
|
1358
|
-
}), B && /* @__PURE__ */
|
|
1358
|
+
}), B && /* @__PURE__ */ q(h, {
|
|
1359
1359
|
variant: "outline",
|
|
1360
1360
|
size: "icon",
|
|
1361
1361
|
className: "shrink-0",
|
|
@@ -1364,10 +1364,10 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1364
1364
|
"aria-label": "Browse all records",
|
|
1365
1365
|
title: "Browse all records",
|
|
1366
1366
|
"data-testid": "browse-all-records",
|
|
1367
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ q(De, { className: "size-4" })
|
|
1368
1368
|
})]
|
|
1369
1369
|
}),
|
|
1370
|
-
B && R && F && /* @__PURE__ */
|
|
1370
|
+
B && R && F && /* @__PURE__ */ q(xt, {
|
|
1371
1371
|
open: H,
|
|
1372
1372
|
onOpenChange: U,
|
|
1373
1373
|
title: se?.label || "Select",
|
|
@@ -1381,7 +1381,7 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1381
1381
|
pageSize: fe,
|
|
1382
1382
|
value: e,
|
|
1383
1383
|
onSelect: t,
|
|
1384
|
-
onSelectRecords:
|
|
1384
|
+
onSelectRecords: Me,
|
|
1385
1385
|
lookupFilters: pe,
|
|
1386
1386
|
cellRenderer: Dt(),
|
|
1387
1387
|
filterColumns: he
|
|
@@ -1389,14 +1389,14 @@ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
|
1389
1389
|
]
|
|
1390
1390
|
});
|
|
1391
1391
|
}
|
|
1392
|
-
var Ft, It, Lt =
|
|
1393
|
-
Tt(), kt(), Ge(), Ft = 50, It =
|
|
1394
|
-
})), Rt = /* @__PURE__ */
|
|
1392
|
+
var Ft, It, Lt = Y((() => {
|
|
1393
|
+
Tt(), kt(), Ge(), Ft = 50, It = ke;
|
|
1394
|
+
})), Rt = /* @__PURE__ */ X({ DateTimeField: () => zt });
|
|
1395
1395
|
function zt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1396
1396
|
if (r) {
|
|
1397
|
-
if (!e) return /* @__PURE__ */
|
|
1397
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
1398
1398
|
let t = new Date(e);
|
|
1399
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ J("span", {
|
|
1400
1400
|
className: "text-sm",
|
|
1401
1401
|
children: [
|
|
1402
1402
|
t.toLocaleDateString(),
|
|
@@ -1406,7 +1406,7 @@ function zt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1406
1406
|
});
|
|
1407
1407
|
}
|
|
1408
1408
|
let { inputType: a, ...o } = i;
|
|
1409
|
-
return /* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ q(C, {
|
|
1410
1410
|
...o,
|
|
1411
1411
|
type: "datetime-local",
|
|
1412
1412
|
value: e || "",
|
|
@@ -1414,14 +1414,14 @@ function zt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1414
1414
|
disabled: r || o.disabled
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
|
-
var Bt =
|
|
1417
|
+
var Bt = Y((() => {})), Vt = /* @__PURE__ */ X({ TimeField: () => Ht });
|
|
1418
1418
|
function Ht({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1419
|
-
if (r) return /* @__PURE__ */
|
|
1419
|
+
if (r) return /* @__PURE__ */ q("span", {
|
|
1420
1420
|
className: "text-sm",
|
|
1421
|
-
children: e || /* @__PURE__ */
|
|
1421
|
+
children: e || /* @__PURE__ */ q(S, {})
|
|
1422
1422
|
});
|
|
1423
1423
|
let { inputType: a, ...o } = i;
|
|
1424
|
-
return /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ q(C, {
|
|
1425
1425
|
...o,
|
|
1426
1426
|
type: "time",
|
|
1427
1427
|
value: e || "",
|
|
@@ -1429,10 +1429,10 @@ function Ht({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1429
1429
|
disabled: r || o.disabled
|
|
1430
1430
|
});
|
|
1431
1431
|
}
|
|
1432
|
-
var Ut =
|
|
1432
|
+
var Ut = Y((() => {})), Wt = /* @__PURE__ */ X({ PercentField: () => Gt });
|
|
1433
1433
|
function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
1434
1434
|
let s = n || o.schema, c = s?.precision ?? 2;
|
|
1435
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
1435
|
+
if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("span", {
|
|
1436
1436
|
className: "text-sm font-medium tabular-nums",
|
|
1437
1437
|
children: [(e * 100).toFixed(c), "%"]
|
|
1438
1438
|
});
|
|
@@ -1452,11 +1452,11 @@ function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1452
1452
|
let n = e[0];
|
|
1453
1453
|
t(typeof n == "number" ? n / 100 : null);
|
|
1454
1454
|
}, p = 10 ** -c;
|
|
1455
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ J("div", {
|
|
1456
1456
|
className: "space-y-2",
|
|
1457
|
-
children: [/* @__PURE__ */
|
|
1457
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1458
1458
|
className: "relative",
|
|
1459
|
-
children: [/* @__PURE__ */
|
|
1459
|
+
children: [/* @__PURE__ */ q(C, {
|
|
1460
1460
|
...o,
|
|
1461
1461
|
type: "number",
|
|
1462
1462
|
value: l,
|
|
@@ -1466,11 +1466,11 @@ function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1466
1466
|
className: `pr-8 ${a || ""}`,
|
|
1467
1467
|
step: (10 ** -c).toFixed(c),
|
|
1468
1468
|
"aria-invalid": !!i
|
|
1469
|
-
}), /* @__PURE__ */
|
|
1469
|
+
}), /* @__PURE__ */ q("span", {
|
|
1470
1470
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
1471
1471
|
children: "%"
|
|
1472
1472
|
})]
|
|
1473
|
-
}), /* @__PURE__ */
|
|
1473
|
+
}), /* @__PURE__ */ q(O, {
|
|
1474
1474
|
value: [u],
|
|
1475
1475
|
onValueChange: f,
|
|
1476
1476
|
min: 0,
|
|
@@ -1483,17 +1483,17 @@ function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1483
1483
|
})]
|
|
1484
1484
|
});
|
|
1485
1485
|
}
|
|
1486
|
-
var Kt =
|
|
1486
|
+
var Kt = Y((() => {})), qt = /* @__PURE__ */ X({ PasswordField: () => Jt });
|
|
1487
1487
|
function Jt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1488
1488
|
let [o, s] = l(!1), c = n || a.schema;
|
|
1489
|
-
if (r) return /* @__PURE__ */
|
|
1489
|
+
if (r) return /* @__PURE__ */ q("span", {
|
|
1490
1490
|
className: "text-sm",
|
|
1491
1491
|
children: "••••••••"
|
|
1492
1492
|
});
|
|
1493
1493
|
let { inputType: u, ...d } = a;
|
|
1494
|
-
return /* @__PURE__ */
|
|
1494
|
+
return /* @__PURE__ */ J("div", {
|
|
1495
1495
|
className: "relative",
|
|
1496
|
-
children: [/* @__PURE__ */
|
|
1496
|
+
children: [/* @__PURE__ */ q(C, {
|
|
1497
1497
|
...d,
|
|
1498
1498
|
type: o ? "text" : "password",
|
|
1499
1499
|
value: e || "",
|
|
@@ -1501,20 +1501,20 @@ function Jt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1501
1501
|
placeholder: c?.placeholder,
|
|
1502
1502
|
disabled: r || d.disabled,
|
|
1503
1503
|
className: `pr-10 ${i || ""}`
|
|
1504
|
-
}), /* @__PURE__ */
|
|
1504
|
+
}), /* @__PURE__ */ q(h, {
|
|
1505
1505
|
type: "button",
|
|
1506
1506
|
variant: "ghost",
|
|
1507
1507
|
size: "sm",
|
|
1508
1508
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
1509
1509
|
onClick: () => s(!o),
|
|
1510
1510
|
tabIndex: -1,
|
|
1511
|
-
children:
|
|
1511
|
+
children: q(o ? ve : B, { className: "size-4 text-gray-500" })
|
|
1512
1512
|
})]
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
|
-
var Yt =
|
|
1515
|
+
var Yt = Y((() => {})), Xt = /* @__PURE__ */ X({ FileField: () => Zt });
|
|
1516
1516
|
function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
1517
|
-
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, g = !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")), _ = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), v = m === !1 ? !1 : m ?? (g && _ ? "environment" : null), [y, b] = l(!1), [ee, x] = l([]), { upload: C } =
|
|
1517
|
+
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, g = !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")), _ = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), v = m === !1 ? !1 : m ?? (g && _ ? "environment" : null), [y, b] = l(!1), [ee, x] = l([]), { upload: C } = Ne(), [w, te] = l({}), [ne, T] = l(!1), E = e ? Array.isArray(e) ? e : [e] : [], re = r(async (e) => {
|
|
1518
1518
|
if (e.length === 0) return;
|
|
1519
1519
|
let n = [], r = e.filter((e) => {
|
|
1520
1520
|
if (p && e.size > p) {
|
|
@@ -1570,13 +1570,13 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1570
1570
|
}));
|
|
1571
1571
|
} else re(t);
|
|
1572
1572
|
}, [f, re]);
|
|
1573
|
-
if (i) return e ? /* @__PURE__ */
|
|
1573
|
+
if (i) return e ? /* @__PURE__ */ q("div", {
|
|
1574
1574
|
className: "flex flex-wrap gap-2",
|
|
1575
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
1575
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ q("span", {
|
|
1576
1576
|
className: "text-sm truncate max-w-xs",
|
|
1577
1577
|
children: e.name || e.original_name || "File"
|
|
1578
1578
|
}, t))
|
|
1579
|
-
}) : /* @__PURE__ */
|
|
1579
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
1580
1580
|
let D = (e) => {
|
|
1581
1581
|
re(Array.from(e.target.files || []));
|
|
1582
1582
|
}, O = (e) => {
|
|
@@ -1585,10 +1585,10 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1585
1585
|
t(n.length > 0 ? n : null);
|
|
1586
1586
|
} else t(null);
|
|
1587
1587
|
}, k = (e) => (e.mime_type || "").startsWith("image/");
|
|
1588
|
-
return /* @__PURE__ */
|
|
1588
|
+
return /* @__PURE__ */ J("div", {
|
|
1589
1589
|
className: a.className,
|
|
1590
1590
|
children: [
|
|
1591
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ q("input", {
|
|
1592
1592
|
ref: o,
|
|
1593
1593
|
type: "file",
|
|
1594
1594
|
multiple: d,
|
|
@@ -1596,7 +1596,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1596
1596
|
onChange: D,
|
|
1597
1597
|
className: "hidden"
|
|
1598
1598
|
}),
|
|
1599
|
-
v && /* @__PURE__ */
|
|
1599
|
+
v && /* @__PURE__ */ q("input", {
|
|
1600
1600
|
ref: s,
|
|
1601
1601
|
type: "file",
|
|
1602
1602
|
accept: "image/*",
|
|
@@ -1606,10 +1606,10 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1606
1606
|
"aria-label": "Camera capture",
|
|
1607
1607
|
"data-testid": "file-field-camera-input"
|
|
1608
1608
|
}),
|
|
1609
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ J("div", {
|
|
1610
1610
|
className: "space-y-2",
|
|
1611
1611
|
children: [
|
|
1612
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ J("div", {
|
|
1613
1613
|
onDragOver: ie,
|
|
1614
1614
|
onDragLeave: ae,
|
|
1615
1615
|
onDrop: oe,
|
|
@@ -1625,18 +1625,18 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1625
1625
|
onKeyDown: (e) => {
|
|
1626
1626
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
|
|
1627
1627
|
},
|
|
1628
|
-
children: [/* @__PURE__ */
|
|
1628
|
+
children: [/* @__PURE__ */ q(K, { className: `size-8 ${y ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ J("div", {
|
|
1629
1629
|
className: "text-center",
|
|
1630
|
-
children: [/* @__PURE__ */
|
|
1630
|
+
children: [/* @__PURE__ */ q("p", {
|
|
1631
1631
|
className: "text-sm font-medium",
|
|
1632
1632
|
children: y ? "Drop files here" : "Drag & drop files here"
|
|
1633
|
-
}), /* @__PURE__ */
|
|
1633
|
+
}), /* @__PURE__ */ J("p", {
|
|
1634
1634
|
className: "text-xs text-muted-foreground mt-1",
|
|
1635
1635
|
children: ["or click to browse", v ? " • use the camera button below" : ""]
|
|
1636
1636
|
})]
|
|
1637
1637
|
})]
|
|
1638
1638
|
}),
|
|
1639
|
-
v && /* @__PURE__ */
|
|
1639
|
+
v && /* @__PURE__ */ J(h, {
|
|
1640
1640
|
type: "button",
|
|
1641
1641
|
variant: "outline",
|
|
1642
1642
|
size: "sm",
|
|
@@ -1645,37 +1645,37 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1645
1645
|
e.stopPropagation(), s.current?.click();
|
|
1646
1646
|
},
|
|
1647
1647
|
"data-testid": "file-field-camera-button",
|
|
1648
|
-
children: [/* @__PURE__ */
|
|
1648
|
+
children: [/* @__PURE__ */ q(pe, { className: "size-4 mr-2" }), v === "user" ? "Take selfie" : "Take photo"]
|
|
1649
1649
|
}),
|
|
1650
|
-
ne && /* @__PURE__ */
|
|
1650
|
+
ne && /* @__PURE__ */ J("div", {
|
|
1651
1651
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
1652
1652
|
"data-testid": "file-field-uploading",
|
|
1653
|
-
children: [/* @__PURE__ */
|
|
1653
|
+
children: [/* @__PURE__ */ q(xe, { className: "size-3 animate-spin" }), /* @__PURE__ */ J("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
|
|
1654
1654
|
}),
|
|
1655
|
-
ee.length > 0 && /* @__PURE__ */
|
|
1655
|
+
ee.length > 0 && /* @__PURE__ */ q("div", {
|
|
1656
1656
|
className: "space-y-0.5",
|
|
1657
|
-
children: ee.map((e, t) => /* @__PURE__ */
|
|
1657
|
+
children: ee.map((e, t) => /* @__PURE__ */ q("p", {
|
|
1658
1658
|
className: "text-xs text-destructive",
|
|
1659
1659
|
children: e
|
|
1660
1660
|
}, t))
|
|
1661
1661
|
}),
|
|
1662
|
-
E.length > 0 && /* @__PURE__ */
|
|
1662
|
+
E.length > 0 && /* @__PURE__ */ q("div", {
|
|
1663
1663
|
className: "space-y-1",
|
|
1664
|
-
children: E.map((e, t) => /* @__PURE__ */
|
|
1664
|
+
children: E.map((e, t) => /* @__PURE__ */ J("div", {
|
|
1665
1665
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
1666
|
-
children: [/* @__PURE__ */
|
|
1666
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1667
1667
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
1668
1668
|
children: [
|
|
1669
|
-
k(e) && e.url ? /* @__PURE__ */
|
|
1669
|
+
k(e) && e.url ? /* @__PURE__ */ q("img", {
|
|
1670
1670
|
src: e.url,
|
|
1671
1671
|
alt: e.name,
|
|
1672
1672
|
className: "size-8 object-cover rounded shrink-0"
|
|
1673
|
-
}) : k(e) ? /* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1673
|
+
}) : k(e) ? /* @__PURE__ */ q(be, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ q(ye, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
1674
|
+
/* @__PURE__ */ q("span", {
|
|
1675
1675
|
className: "text-sm truncate",
|
|
1676
1676
|
children: e.name || e.original_name || "File"
|
|
1677
1677
|
}),
|
|
1678
|
-
e.size && /* @__PURE__ */
|
|
1678
|
+
e.size && /* @__PURE__ */ J("span", {
|
|
1679
1679
|
className: "text-xs text-muted-foreground",
|
|
1680
1680
|
children: [
|
|
1681
1681
|
"(",
|
|
@@ -1684,7 +1684,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1684
1684
|
]
|
|
1685
1685
|
})
|
|
1686
1686
|
]
|
|
1687
|
-
}), /* @__PURE__ */
|
|
1687
|
+
}), /* @__PURE__ */ q(h, {
|
|
1688
1688
|
type: "button",
|
|
1689
1689
|
variant: "ghost",
|
|
1690
1690
|
size: "sm",
|
|
@@ -1692,7 +1692,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1692
1692
|
e.stopPropagation(), O(t);
|
|
1693
1693
|
},
|
|
1694
1694
|
className: "h-6 w-6 p-0",
|
|
1695
|
-
children: /* @__PURE__ */
|
|
1695
|
+
children: /* @__PURE__ */ q(Oe, { className: "size-3" })
|
|
1696
1696
|
})]
|
|
1697
1697
|
}, t))
|
|
1698
1698
|
})
|
|
@@ -1701,7 +1701,7 @@ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1701
1701
|
]
|
|
1702
1702
|
});
|
|
1703
1703
|
}
|
|
1704
|
-
var Qt =
|
|
1704
|
+
var Qt = Y((() => {})), $t = /* @__PURE__ */ X({ ImageCropperDialog: () => en }), en, tn = Y((() => {
|
|
1705
1705
|
en = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
|
|
1706
1706
|
let u = c(null), d = c(null), [f, p] = l(0), [m, g] = l({
|
|
1707
1707
|
x: 0,
|
|
@@ -1776,16 +1776,16 @@ var Qt = X((() => {})), $t = /* @__PURE__ */ Z({ ImageCropperDialog: () => en })
|
|
|
1776
1776
|
s,
|
|
1777
1777
|
t
|
|
1778
1778
|
]);
|
|
1779
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ q(_, {
|
|
1780
1780
|
open: e,
|
|
1781
1781
|
onOpenChange: t,
|
|
1782
|
-
children: /* @__PURE__ */
|
|
1782
|
+
children: /* @__PURE__ */ J(v, {
|
|
1783
1783
|
className: "max-w-xl",
|
|
1784
1784
|
children: [
|
|
1785
|
-
/* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */
|
|
1785
|
+
/* @__PURE__ */ J(ee, { children: [/* @__PURE__ */ q(x, { children: "Crop & rotate image" }), /* @__PURE__ */ q(y, { children: "Drag the highlighted box to reposition the crop. Use the rotate button to spin the image in 90° increments." })] }),
|
|
1786
|
+
/* @__PURE__ */ J("div", {
|
|
1787
1787
|
className: "flex flex-col items-center gap-3",
|
|
1788
|
-
children: [w ? /* @__PURE__ */
|
|
1788
|
+
children: [w ? /* @__PURE__ */ q("canvas", {
|
|
1789
1789
|
ref: u,
|
|
1790
1790
|
"data-testid": "image-cropper-canvas",
|
|
1791
1791
|
role: "img",
|
|
@@ -1795,45 +1795,45 @@ var Qt = X((() => {})), $t = /* @__PURE__ */ Z({ ImageCropperDialog: () => en })
|
|
|
1795
1795
|
onPointerMove: T,
|
|
1796
1796
|
onPointerUp: E,
|
|
1797
1797
|
onPointerCancel: E
|
|
1798
|
-
}) : /* @__PURE__ */
|
|
1798
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1799
1799
|
className: "flex h-[270px] w-full items-center justify-center text-sm text-muted-foreground",
|
|
1800
1800
|
children: "Loading image…"
|
|
1801
|
-
}), /* @__PURE__ */
|
|
1801
|
+
}), /* @__PURE__ */ J("div", {
|
|
1802
1802
|
className: "flex w-full items-center justify-between text-xs text-muted-foreground",
|
|
1803
|
-
children: [/* @__PURE__ */
|
|
1803
|
+
children: [/* @__PURE__ */ J("span", { children: [
|
|
1804
1804
|
"Crop: ",
|
|
1805
1805
|
Math.round(m.width),
|
|
1806
1806
|
" × ",
|
|
1807
1807
|
Math.round(m.height),
|
|
1808
1808
|
" px"
|
|
1809
|
-
] }), /* @__PURE__ */
|
|
1809
|
+
] }), /* @__PURE__ */ J("span", { children: [
|
|
1810
1810
|
"Rotation: ",
|
|
1811
1811
|
f,
|
|
1812
1812
|
"°"
|
|
1813
1813
|
] })]
|
|
1814
1814
|
})]
|
|
1815
1815
|
}),
|
|
1816
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ J(b, {
|
|
1817
1817
|
className: "flex justify-between sm:justify-between",
|
|
1818
|
-
children: [/* @__PURE__ */
|
|
1818
|
+
children: [/* @__PURE__ */ J(h, {
|
|
1819
1819
|
type: "button",
|
|
1820
1820
|
variant: "outline",
|
|
1821
1821
|
onClick: re,
|
|
1822
1822
|
"data-testid": "image-cropper-rotate",
|
|
1823
|
-
children: [/* @__PURE__ */
|
|
1824
|
-
}), /* @__PURE__ */
|
|
1823
|
+
children: [/* @__PURE__ */ q(G, { className: "size-4 mr-2" }), "Rotate 90°"]
|
|
1824
|
+
}), /* @__PURE__ */ J("div", {
|
|
1825
1825
|
className: "flex gap-2",
|
|
1826
|
-
children: [/* @__PURE__ */
|
|
1826
|
+
children: [/* @__PURE__ */ q(h, {
|
|
1827
1827
|
type: "button",
|
|
1828
1828
|
variant: "ghost",
|
|
1829
1829
|
onClick: () => t(!1),
|
|
1830
1830
|
children: "Cancel"
|
|
1831
|
-
}), /* @__PURE__ */
|
|
1831
|
+
}), /* @__PURE__ */ J(h, {
|
|
1832
1832
|
type: "button",
|
|
1833
1833
|
onClick: ie,
|
|
1834
1834
|
disabled: !w,
|
|
1835
1835
|
"data-testid": "image-cropper-confirm",
|
|
1836
|
-
children: [/* @__PURE__ */
|
|
1836
|
+
children: [/* @__PURE__ */ q(ge, { className: "size-4 mr-2" }), "Apply crop"]
|
|
1837
1837
|
})]
|
|
1838
1838
|
})]
|
|
1839
1839
|
})
|
|
@@ -1841,17 +1841,17 @@ var Qt = X((() => {})), $t = /* @__PURE__ */ Z({ ImageCropperDialog: () => en })
|
|
|
1841
1841
|
})
|
|
1842
1842
|
});
|
|
1843
1843
|
};
|
|
1844
|
-
})), nn = /* @__PURE__ */
|
|
1844
|
+
})), nn = /* @__PURE__ */ X({ ImageField: () => rn });
|
|
1845
1845
|
function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
1846
|
-
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, g] = l(null), { upload: _ } =
|
|
1847
|
-
if (a) return e ? /* @__PURE__ */
|
|
1846
|
+
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, g] = l(null), { upload: _ } = Ne(), [v, y] = l(!1);
|
|
1847
|
+
if (a) return e ? /* @__PURE__ */ q("div", {
|
|
1848
1848
|
className: "flex flex-wrap gap-2",
|
|
1849
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
1849
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ q("img", {
|
|
1850
1850
|
src: e.url || "",
|
|
1851
1851
|
alt: e.name || `Image ${t + 1}`,
|
|
1852
1852
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
1853
1853
|
}, t))
|
|
1854
|
-
}) : /* @__PURE__ */
|
|
1854
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
1855
1855
|
let b = e ? Array.isArray(e) ? e : [e] : [], ee = async (e) => {
|
|
1856
1856
|
let t = Array.from(e.target.files || []);
|
|
1857
1857
|
if (t.length !== 0) {
|
|
@@ -1910,10 +1910,10 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1910
1910
|
name: t.name || `image-${e}.png`
|
|
1911
1911
|
});
|
|
1912
1912
|
}, [b]);
|
|
1913
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ J("div", {
|
|
1914
1914
|
className: o.className,
|
|
1915
1915
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1916
|
+
/* @__PURE__ */ q("input", {
|
|
1917
1917
|
ref: s,
|
|
1918
1918
|
type: "file",
|
|
1919
1919
|
multiple: d,
|
|
@@ -1921,19 +1921,19 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1921
1921
|
onChange: ee,
|
|
1922
1922
|
className: "hidden"
|
|
1923
1923
|
}),
|
|
1924
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ J("div", {
|
|
1925
1925
|
className: "space-y-2",
|
|
1926
|
-
children: [b.length > 0 && /* @__PURE__ */
|
|
1926
|
+
children: [b.length > 0 && /* @__PURE__ */ q("div", {
|
|
1927
1927
|
className: "grid grid-cols-4 gap-2",
|
|
1928
|
-
children: b.map((e, t) => /* @__PURE__ */
|
|
1928
|
+
children: b.map((e, t) => /* @__PURE__ */ J("div", {
|
|
1929
1929
|
className: "relative group",
|
|
1930
|
-
children: [/* @__PURE__ */
|
|
1930
|
+
children: [/* @__PURE__ */ q("img", {
|
|
1931
1931
|
src: e.url || "",
|
|
1932
1932
|
alt: e.name || `Image ${t + 1}`,
|
|
1933
1933
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
1934
|
-
}), /* @__PURE__ */
|
|
1934
|
+
}), /* @__PURE__ */ J("div", {
|
|
1935
1935
|
className: "absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1936
|
-
children: [p && /* @__PURE__ */
|
|
1936
|
+
children: [p && /* @__PURE__ */ q(h, {
|
|
1937
1937
|
type: "button",
|
|
1938
1938
|
variant: "secondary",
|
|
1939
1939
|
size: "sm",
|
|
@@ -1941,30 +1941,30 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1941
1941
|
className: "h-6 w-6 p-0",
|
|
1942
1942
|
"aria-label": `Crop image ${t + 1}`,
|
|
1943
1943
|
"data-testid": `image-field-crop-${t}`,
|
|
1944
|
-
children: /* @__PURE__ */
|
|
1945
|
-
}), /* @__PURE__ */
|
|
1944
|
+
children: /* @__PURE__ */ q(ge, { className: "size-3" })
|
|
1945
|
+
}), /* @__PURE__ */ q(h, {
|
|
1946
1946
|
type: "button",
|
|
1947
1947
|
variant: "destructive",
|
|
1948
1948
|
size: "sm",
|
|
1949
1949
|
onClick: () => x(t),
|
|
1950
1950
|
className: "h-6 w-6 p-0",
|
|
1951
|
-
children: /* @__PURE__ */
|
|
1951
|
+
children: /* @__PURE__ */ q(Oe, { className: "size-3" })
|
|
1952
1952
|
})]
|
|
1953
1953
|
})]
|
|
1954
1954
|
}, t))
|
|
1955
|
-
}), /* @__PURE__ */
|
|
1955
|
+
}), /* @__PURE__ */ J(h, {
|
|
1956
1956
|
type: "button",
|
|
1957
1957
|
variant: "outline",
|
|
1958
1958
|
onClick: () => s.current?.click(),
|
|
1959
1959
|
className: "w-full",
|
|
1960
1960
|
disabled: v,
|
|
1961
1961
|
"data-testid": "image-field-upload-button",
|
|
1962
|
-
children: [v ? /* @__PURE__ */
|
|
1962
|
+
children: [v ? /* @__PURE__ */ q(xe, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ q(V, { className: "size-4 mr-2" }), v ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
|
|
1963
1963
|
})]
|
|
1964
1964
|
}),
|
|
1965
|
-
p && m && /* @__PURE__ */
|
|
1965
|
+
p && m && /* @__PURE__ */ q(t, {
|
|
1966
1966
|
fallback: null,
|
|
1967
|
-
children: /* @__PURE__ */
|
|
1967
|
+
children: /* @__PURE__ */ q(an, {
|
|
1968
1968
|
open: !0,
|
|
1969
1969
|
onOpenChange: (e) => !e && g(null),
|
|
1970
1970
|
src: m.src,
|
|
@@ -1975,15 +1975,15 @@ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
1975
1975
|
]
|
|
1976
1976
|
});
|
|
1977
1977
|
}
|
|
1978
|
-
var an, on =
|
|
1978
|
+
var an, on = Y((() => {
|
|
1979
1979
|
an = n(() => Promise.resolve().then(() => (tn(), $t)).then((e) => ({ default: e.ImageCropperDialog })));
|
|
1980
|
-
})), sn = /* @__PURE__ */
|
|
1980
|
+
})), sn = /* @__PURE__ */ X({ LocationField: () => cn });
|
|
1981
1981
|
function cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1982
1982
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
1983
|
-
return r ? /* @__PURE__ */
|
|
1983
|
+
return r ? /* @__PURE__ */ q("span", {
|
|
1984
1984
|
className: "text-sm",
|
|
1985
|
-
children: o || /* @__PURE__ */
|
|
1986
|
-
}) : /* @__PURE__ */
|
|
1985
|
+
children: o || /* @__PURE__ */ q(S, {})
|
|
1986
|
+
}) : /* @__PURE__ */ q(C, {
|
|
1987
1987
|
type: "text",
|
|
1988
1988
|
value: o,
|
|
1989
1989
|
onChange: (e) => {
|
|
@@ -2006,59 +2006,59 @@ function cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2006
2006
|
className: i.className
|
|
2007
2007
|
});
|
|
2008
2008
|
}
|
|
2009
|
-
var ln =
|
|
2009
|
+
var ln = Y((() => {})), un = /* @__PURE__ */ X({ FormulaField: () => dn });
|
|
2010
2010
|
function dn({ value: e, field: t, ...n }) {
|
|
2011
2011
|
let r = (t || n.schema)?.return_type || "text";
|
|
2012
|
-
if (e == null) return /* @__PURE__ */
|
|
2012
|
+
if (e == null) return /* @__PURE__ */ q(S, { className: n.className });
|
|
2013
2013
|
let i;
|
|
2014
|
-
return i = r === "number" || r === "currency" ? typeof e == "number" ? e.toFixed(2) : String(e) : r === "boolean" ? e ? "Yes" : "No" : r === "date" ? new Date(e).toLocaleDateString() : String(e), /* @__PURE__ */
|
|
2014
|
+
return i = r === "number" || r === "currency" ? typeof e == "number" ? e.toFixed(2) : String(e) : r === "boolean" ? e ? "Yes" : "No" : r === "date" ? new Date(e).toLocaleDateString() : String(e), /* @__PURE__ */ q("span", {
|
|
2015
2015
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
2016
2016
|
children: i
|
|
2017
2017
|
});
|
|
2018
2018
|
}
|
|
2019
|
-
var fn =
|
|
2019
|
+
var fn = Y((() => {})), pn = /* @__PURE__ */ X({ SummaryField: () => mn });
|
|
2020
2020
|
function mn({ value: e, field: t, ...n }) {
|
|
2021
2021
|
let r = (t || n.schema)?.summary_type || "count";
|
|
2022
|
-
if (e == null) return /* @__PURE__ */
|
|
2022
|
+
if (e == null) return /* @__PURE__ */ q(S, { className: n.className });
|
|
2023
2023
|
let i;
|
|
2024
2024
|
return i = r === "count" ? String(e) : [
|
|
2025
2025
|
"sum",
|
|
2026
2026
|
"avg",
|
|
2027
2027
|
"min",
|
|
2028
2028
|
"max"
|
|
2029
|
-
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */
|
|
2029
|
+
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */ q("span", {
|
|
2030
2030
|
className: `text-sm font-medium tabular-nums text-gray-700 ${n.className || ""}`,
|
|
2031
2031
|
children: i
|
|
2032
2032
|
});
|
|
2033
2033
|
}
|
|
2034
|
-
var hn =
|
|
2034
|
+
var hn = Y((() => {})), gn = /* @__PURE__ */ X({ AutoNumberField: () => _n });
|
|
2035
2035
|
function _n({ value: e, field: t, ...n }) {
|
|
2036
|
-
return e == null ? /* @__PURE__ */
|
|
2036
|
+
return e == null ? /* @__PURE__ */ q(S, { className: n.className }) : /* @__PURE__ */ q("span", {
|
|
2037
2037
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
2038
2038
|
children: String(e)
|
|
2039
2039
|
});
|
|
2040
2040
|
}
|
|
2041
|
-
var vn =
|
|
2041
|
+
var vn = Y((() => {})), yn = /* @__PURE__ */ X({ UserField: () => bn });
|
|
2042
2042
|
function bn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2043
2043
|
let a = (n || i.schema)?.multiple || !1;
|
|
2044
2044
|
if (r) {
|
|
2045
|
-
if (!e) return /* @__PURE__ */
|
|
2045
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
2046
2046
|
let t = Array.isArray(e) ? e : [e];
|
|
2047
|
-
return /* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ J("div", {
|
|
2048
2048
|
className: "flex -space-x-2",
|
|
2049
2049
|
children: [t.slice(0, 3).map((e, t) => {
|
|
2050
2050
|
let n = e.name || e.username || "User";
|
|
2051
|
-
return /* @__PURE__ */
|
|
2051
|
+
return /* @__PURE__ */ q(d, {
|
|
2052
2052
|
className: "size-8 border-2 border-white",
|
|
2053
2053
|
title: n,
|
|
2054
|
-
children: /* @__PURE__ */
|
|
2054
|
+
children: /* @__PURE__ */ q(f, {
|
|
2055
2055
|
className: "bg-blue-500 text-white text-xs",
|
|
2056
2056
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2057
2057
|
})
|
|
2058
2058
|
}, t);
|
|
2059
|
-
}), t.length > 3 && /* @__PURE__ */
|
|
2059
|
+
}), t.length > 3 && /* @__PURE__ */ q(d, {
|
|
2060
2060
|
className: "size-8 border-2 border-white",
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2061
|
+
children: /* @__PURE__ */ J(f, {
|
|
2062
2062
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
2063
2063
|
children: ["+", t.length - 3]
|
|
2064
2064
|
})
|
|
@@ -2071,43 +2071,43 @@ function bn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2071
2071
|
t(n.length > 0 ? n : null);
|
|
2072
2072
|
} else t(null);
|
|
2073
2073
|
};
|
|
2074
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ J("div", {
|
|
2075
2075
|
className: i.className,
|
|
2076
|
-
children: [o.length > 0 && /* @__PURE__ */
|
|
2076
|
+
children: [o.length > 0 && /* @__PURE__ */ q("div", {
|
|
2077
2077
|
className: "flex flex-wrap gap-2 mb-2",
|
|
2078
2078
|
children: o.map((e, t) => {
|
|
2079
2079
|
let n = e.name || e.username || "User";
|
|
2080
|
-
return /* @__PURE__ */
|
|
2080
|
+
return /* @__PURE__ */ J(m, {
|
|
2081
2081
|
variant: "outline",
|
|
2082
2082
|
className: "gap-2 pr-1",
|
|
2083
2083
|
children: [
|
|
2084
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ q(d, {
|
|
2085
2085
|
className: "size-5",
|
|
2086
|
-
children: /* @__PURE__ */
|
|
2086
|
+
children: /* @__PURE__ */ q(f, {
|
|
2087
2087
|
className: "bg-blue-500 text-white text-xs",
|
|
2088
2088
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2089
2089
|
})
|
|
2090
2090
|
}),
|
|
2091
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ q("span", {
|
|
2092
2092
|
className: "text-sm",
|
|
2093
2093
|
children: n
|
|
2094
2094
|
}),
|
|
2095
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ q("button", {
|
|
2096
2096
|
type: "button",
|
|
2097
2097
|
onClick: () => s(t),
|
|
2098
2098
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
2099
|
-
children: /* @__PURE__ */
|
|
2099
|
+
children: /* @__PURE__ */ q(Oe, { className: "size-3" })
|
|
2100
2100
|
})
|
|
2101
2101
|
]
|
|
2102
2102
|
}, t);
|
|
2103
2103
|
})
|
|
2104
|
-
}), /* @__PURE__ */
|
|
2104
|
+
}), /* @__PURE__ */ q("div", {
|
|
2105
2105
|
className: "text-sm text-gray-500 italic",
|
|
2106
2106
|
children: "User selection component requires integration with user management system"
|
|
2107
2107
|
})]
|
|
2108
2108
|
});
|
|
2109
2109
|
}
|
|
2110
|
-
var xn =
|
|
2110
|
+
var xn = Y((() => {})), Sn = /* @__PURE__ */ X({ ObjectField: () => Cn });
|
|
2111
2111
|
function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2112
2112
|
let o = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
|
|
2113
2113
|
return a(() => {
|
|
@@ -2121,12 +2121,12 @@ function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2121
2121
|
} catch {
|
|
2122
2122
|
c(JSON.stringify(e, null, 2));
|
|
2123
2123
|
}
|
|
2124
|
-
}, [e, s]), r ? e ? /* @__PURE__ */
|
|
2124
|
+
}, [e, s]), r ? e ? /* @__PURE__ */ q("pre", {
|
|
2125
2125
|
className: P("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
2126
2126
|
children: JSON.stringify(e, null, 2)
|
|
2127
|
-
}) : /* @__PURE__ */
|
|
2127
|
+
}) : /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("div", {
|
|
2128
2128
|
className: "space-y-1",
|
|
2129
|
-
children: [/* @__PURE__ */
|
|
2129
|
+
children: [/* @__PURE__ */ q(N, {
|
|
2130
2130
|
value: s,
|
|
2131
2131
|
onChange: (e) => {
|
|
2132
2132
|
let n = e.target.value;
|
|
@@ -2144,30 +2144,30 @@ function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2144
2144
|
disabled: r || i.disabled,
|
|
2145
2145
|
className: P("font-mono text-xs", u ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
2146
2146
|
rows: 6
|
|
2147
|
-
}), u && /* @__PURE__ */
|
|
2147
|
+
}), u && /* @__PURE__ */ q("p", {
|
|
2148
2148
|
className: "text-xs text-red-500",
|
|
2149
2149
|
children: u
|
|
2150
2150
|
})]
|
|
2151
2151
|
});
|
|
2152
2152
|
}
|
|
2153
|
-
var wn =
|
|
2153
|
+
var wn = Y((() => {})), Tn = /* @__PURE__ */ X({ VectorField: () => En });
|
|
2154
2154
|
function En({ value: e, field: t, ...n }) {
|
|
2155
2155
|
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
2156
|
-
if (!e || !Array.isArray(e)) return /* @__PURE__ */
|
|
2156
|
+
if (!e || !Array.isArray(e)) return /* @__PURE__ */ q(S, {});
|
|
2157
2157
|
let i = e.slice(0, 3).map((e) => {
|
|
2158
2158
|
let t = Number(e);
|
|
2159
2159
|
return isNaN(t) ? "0" : t.toFixed(4);
|
|
2160
2160
|
}).join(", ");
|
|
2161
|
-
return /* @__PURE__ */
|
|
2161
|
+
return /* @__PURE__ */ J("div", {
|
|
2162
2162
|
className: `text-sm ${n.className || ""}`,
|
|
2163
|
-
children: [/* @__PURE__ */
|
|
2163
|
+
children: [/* @__PURE__ */ J("span", {
|
|
2164
2164
|
className: "font-mono text-gray-700",
|
|
2165
2165
|
children: [
|
|
2166
2166
|
"[",
|
|
2167
2167
|
i,
|
|
2168
2168
|
"...]"
|
|
2169
2169
|
]
|
|
2170
|
-
}), /* @__PURE__ */
|
|
2170
|
+
}), /* @__PURE__ */ J("span", {
|
|
2171
2171
|
className: "text-gray-500 ml-2",
|
|
2172
2172
|
children: [
|
|
2173
2173
|
"(",
|
|
@@ -2177,39 +2177,39 @@ function En({ value: e, field: t, ...n }) {
|
|
|
2177
2177
|
})]
|
|
2178
2178
|
});
|
|
2179
2179
|
}
|
|
2180
|
-
var Dn =
|
|
2180
|
+
var Dn = Y((() => {})), On = /* @__PURE__ */ X({ GridField: () => kn });
|
|
2181
2181
|
function kn({ value: e, field: t, readonly: n, ...r }) {
|
|
2182
2182
|
let i = (t || r.schema)?.columns || [];
|
|
2183
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */
|
|
2183
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ q(S, {}) : n ? /* @__PURE__ */ q("div", {
|
|
2184
2184
|
className: P("text-sm", r.className),
|
|
2185
|
-
children: /* @__PURE__ */
|
|
2185
|
+
children: /* @__PURE__ */ J("span", {
|
|
2186
2186
|
className: "text-foreground",
|
|
2187
2187
|
children: [e.length, " rows"]
|
|
2188
2188
|
})
|
|
2189
|
-
}) : /* @__PURE__ */
|
|
2189
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2190
2190
|
className: P("border border-border rounded-lg overflow-hidden", r.className),
|
|
2191
|
-
children: [/* @__PURE__ */
|
|
2191
|
+
children: [/* @__PURE__ */ q("div", {
|
|
2192
2192
|
className: "overflow-auto max-h-60",
|
|
2193
|
-
children: /* @__PURE__ */
|
|
2193
|
+
children: /* @__PURE__ */ J("table", {
|
|
2194
2194
|
className: "w-full text-sm",
|
|
2195
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ q("thead", {
|
|
2196
2196
|
className: "bg-muted border-b border-border",
|
|
2197
|
-
children: /* @__PURE__ */
|
|
2197
|
+
children: /* @__PURE__ */ q("tr", { children: i.map((e, t) => /* @__PURE__ */ q("th", {
|
|
2198
2198
|
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
2199
2199
|
children: e.label || e.name
|
|
2200
2200
|
}, t)) })
|
|
2201
|
-
}), /* @__PURE__ */
|
|
2201
|
+
}), /* @__PURE__ */ q("tbody", {
|
|
2202
2202
|
className: "divide-y divide-border",
|
|
2203
|
-
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */
|
|
2203
|
+
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */ q("tr", {
|
|
2204
2204
|
className: "hover:bg-muted/50 transition-colors",
|
|
2205
|
-
children: i.map((t, n) => /* @__PURE__ */
|
|
2205
|
+
children: i.map((t, n) => /* @__PURE__ */ q("td", {
|
|
2206
2206
|
className: "px-3 py-2 text-foreground",
|
|
2207
|
-
children: e[t.name] == null ? /* @__PURE__ */
|
|
2207
|
+
children: e[t.name] == null ? /* @__PURE__ */ q(S, {}) : String(e[t.name])
|
|
2208
2208
|
}, n))
|
|
2209
2209
|
}, t))
|
|
2210
2210
|
})]
|
|
2211
2211
|
})
|
|
2212
|
-
}), e.length > 5 && /* @__PURE__ */
|
|
2212
|
+
}), e.length > 5 && /* @__PURE__ */ J("div", {
|
|
2213
2213
|
className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",
|
|
2214
2214
|
children: [
|
|
2215
2215
|
"Showing 5 of ",
|
|
@@ -2219,27 +2219,27 @@ function kn({ value: e, field: t, readonly: n, ...r }) {
|
|
|
2219
2219
|
})]
|
|
2220
2220
|
});
|
|
2221
2221
|
}
|
|
2222
|
-
var An =
|
|
2222
|
+
var An = Y((() => {})), jn = /* @__PURE__ */ X({ ColorField: () => Mn });
|
|
2223
2223
|
function Mn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2224
2224
|
let a = n || i.schema;
|
|
2225
|
-
return r ? /* @__PURE__ */
|
|
2225
|
+
return r ? /* @__PURE__ */ J("div", {
|
|
2226
2226
|
className: "flex items-center gap-2",
|
|
2227
|
-
children: [/* @__PURE__ */
|
|
2227
|
+
children: [/* @__PURE__ */ q("div", {
|
|
2228
2228
|
className: "w-6 h-6 rounded border border-input",
|
|
2229
2229
|
style: { backgroundColor: e || "#000000" }
|
|
2230
|
-
}), /* @__PURE__ */
|
|
2230
|
+
}), /* @__PURE__ */ q("span", {
|
|
2231
2231
|
className: "text-sm",
|
|
2232
|
-
children: e || /* @__PURE__ */
|
|
2232
|
+
children: e || /* @__PURE__ */ q(S, {})
|
|
2233
2233
|
})]
|
|
2234
|
-
}) : /* @__PURE__ */
|
|
2234
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2235
2235
|
className: "flex items-center gap-2",
|
|
2236
|
-
children: [/* @__PURE__ */
|
|
2236
|
+
children: [/* @__PURE__ */ q("input", {
|
|
2237
2237
|
type: "color",
|
|
2238
2238
|
value: e || "#000000",
|
|
2239
2239
|
onChange: (e) => t(e.target.value),
|
|
2240
2240
|
disabled: r || i.disabled,
|
|
2241
2241
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
2242
|
-
}), /* @__PURE__ */
|
|
2242
|
+
}), /* @__PURE__ */ q(C, {
|
|
2243
2243
|
type: "text",
|
|
2244
2244
|
value: e || "",
|
|
2245
2245
|
onChange: (e) => t(e.target.value),
|
|
@@ -2250,21 +2250,21 @@ function Mn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2250
2250
|
})]
|
|
2251
2251
|
});
|
|
2252
2252
|
}
|
|
2253
|
-
var Nn =
|
|
2253
|
+
var Nn = Y((() => {})), Pn = /* @__PURE__ */ X({ SliderField: () => Fn });
|
|
2254
2254
|
function Fn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2255
2255
|
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
2256
|
-
return r ? /* @__PURE__ */
|
|
2256
|
+
return r ? /* @__PURE__ */ J("div", {
|
|
2257
2257
|
className: "flex items-center gap-2",
|
|
2258
|
-
children: [/* @__PURE__ */
|
|
2258
|
+
children: [/* @__PURE__ */ q("span", {
|
|
2259
2259
|
className: "text-sm font-medium",
|
|
2260
2260
|
children: e ?? o
|
|
2261
|
-
}), /* @__PURE__ */
|
|
2261
|
+
}), /* @__PURE__ */ J("span", {
|
|
2262
2262
|
className: "text-xs text-muted-foreground",
|
|
2263
2263
|
children: ["/ ", s]
|
|
2264
2264
|
})]
|
|
2265
|
-
}) : /* @__PURE__ */
|
|
2265
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2266
2266
|
className: "flex items-center gap-4",
|
|
2267
|
-
children: [/* @__PURE__ */
|
|
2267
|
+
children: [/* @__PURE__ */ q(O, {
|
|
2268
2268
|
value: [e ?? o],
|
|
2269
2269
|
onValueChange: (e) => t(e[0]),
|
|
2270
2270
|
min: o,
|
|
@@ -2272,18 +2272,18 @@ function Fn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2272
2272
|
step: c,
|
|
2273
2273
|
disabled: r || i.disabled,
|
|
2274
2274
|
className: i.className
|
|
2275
|
-
}), /* @__PURE__ */
|
|
2275
|
+
}), /* @__PURE__ */ q("span", {
|
|
2276
2276
|
className: "text-sm font-medium w-12 text-right",
|
|
2277
2277
|
children: e ?? o
|
|
2278
2278
|
})]
|
|
2279
2279
|
});
|
|
2280
2280
|
}
|
|
2281
|
-
var In =
|
|
2281
|
+
var In = Y((() => {})), Ln = /* @__PURE__ */ X({ RatingField: () => Rn });
|
|
2282
2282
|
function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
2283
2283
|
let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
|
|
2284
|
-
return i ? /* @__PURE__ */
|
|
2284
|
+
return i ? /* @__PURE__ */ J("div", {
|
|
2285
2285
|
className: P("flex items-center gap-1", a),
|
|
2286
|
-
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */
|
|
2286
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q(Ee, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ J("span", {
|
|
2287
2287
|
className: "ml-2 text-sm text-muted-foreground",
|
|
2288
2288
|
children: [
|
|
2289
2289
|
c,
|
|
@@ -2291,17 +2291,17 @@ function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
2291
2291
|
s
|
|
2292
2292
|
]
|
|
2293
2293
|
})]
|
|
2294
|
-
}) : /* @__PURE__ */
|
|
2294
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2295
2295
|
className: P("flex items-center gap-1", a),
|
|
2296
|
-
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */
|
|
2296
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q("button", {
|
|
2297
2297
|
type: "button",
|
|
2298
2298
|
onClick: () => n(t + 1),
|
|
2299
2299
|
onMouseEnter: () => u(t + 1),
|
|
2300
2300
|
onMouseLeave: () => u(null),
|
|
2301
2301
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
2302
2302
|
disabled: i || o.disabled,
|
|
2303
|
-
children: /* @__PURE__ */
|
|
2304
|
-
}, t)), /* @__PURE__ */
|
|
2303
|
+
children: /* @__PURE__ */ q(Ee, { className: `w-5 h-5 transition-colors ${t < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
2304
|
+
}, t)), /* @__PURE__ */ J("span", {
|
|
2305
2305
|
className: "ml-2 text-sm text-muted-foreground",
|
|
2306
2306
|
children: [
|
|
2307
2307
|
c,
|
|
@@ -2311,13 +2311,13 @@ function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
2311
2311
|
})]
|
|
2312
2312
|
});
|
|
2313
2313
|
}
|
|
2314
|
-
var zn =
|
|
2314
|
+
var zn = Y((() => {})), Bn = /* @__PURE__ */ X({ CodeField: () => Vn });
|
|
2315
2315
|
function Vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2316
2316
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
2317
|
-
return r ? /* @__PURE__ */
|
|
2317
|
+
return r ? /* @__PURE__ */ q("pre", {
|
|
2318
2318
|
className: P("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
2319
|
-
children: /* @__PURE__ */
|
|
2320
|
-
}) : /* @__PURE__ */
|
|
2319
|
+
children: /* @__PURE__ */ q("code", { children: e || /* @__PURE__ */ q(S, {}) })
|
|
2320
|
+
}) : /* @__PURE__ */ q(N, {
|
|
2321
2321
|
value: e || "",
|
|
2322
2322
|
onChange: (e) => t(e.target.value),
|
|
2323
2323
|
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
@@ -2327,7 +2327,7 @@ function Vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2327
2327
|
spellCheck: !1
|
|
2328
2328
|
});
|
|
2329
2329
|
}
|
|
2330
|
-
var Hn =
|
|
2330
|
+
var Hn = Y((() => {})), Un = /* @__PURE__ */ X({ AvatarField: () => Wn });
|
|
2331
2331
|
function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2332
2332
|
let [o, s] = e.useState(!1), c = e.useRef(null), l = r || a.schema, u = (e) => {
|
|
2333
2333
|
let t = e.target.files?.[0];
|
|
@@ -2347,53 +2347,53 @@ function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2347
2347
|
}, m = () => {
|
|
2348
2348
|
n("");
|
|
2349
2349
|
}, g = () => (l?.defaultName || l?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
2350
|
-
return i ? /* @__PURE__ */
|
|
2350
|
+
return i ? /* @__PURE__ */ J(d, {
|
|
2351
2351
|
className: "w-16 h-16",
|
|
2352
|
-
children: [t && /* @__PURE__ */
|
|
2352
|
+
children: [t && /* @__PURE__ */ q(p, {
|
|
2353
2353
|
src: t,
|
|
2354
2354
|
alt: l?.label
|
|
2355
|
-
}), /* @__PURE__ */
|
|
2356
|
-
}) : /* @__PURE__ */
|
|
2355
|
+
}), /* @__PURE__ */ q(f, { children: g() })]
|
|
2356
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2357
2357
|
className: "flex items-center gap-4",
|
|
2358
|
-
children: [/* @__PURE__ */
|
|
2358
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2359
2359
|
className: "relative",
|
|
2360
2360
|
onMouseEnter: () => s(!0),
|
|
2361
2361
|
onMouseLeave: () => s(!1),
|
|
2362
|
-
children: [/* @__PURE__ */
|
|
2362
|
+
children: [/* @__PURE__ */ J(d, {
|
|
2363
2363
|
className: "w-16 h-16",
|
|
2364
|
-
children: [t && /* @__PURE__ */
|
|
2364
|
+
children: [t && /* @__PURE__ */ q(p, {
|
|
2365
2365
|
src: t,
|
|
2366
2366
|
alt: l?.label
|
|
2367
|
-
}), /* @__PURE__ */
|
|
2368
|
-
}), !i && o && t && /* @__PURE__ */
|
|
2367
|
+
}), /* @__PURE__ */ q(f, { children: g() })]
|
|
2368
|
+
}), !i && o && t && /* @__PURE__ */ q("button", {
|
|
2369
2369
|
type: "button",
|
|
2370
2370
|
onClick: m,
|
|
2371
2371
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
2372
|
-
children: /* @__PURE__ */
|
|
2372
|
+
children: /* @__PURE__ */ q(Oe, { className: "w-3 h-3" })
|
|
2373
2373
|
})]
|
|
2374
|
-
}), /* @__PURE__ */
|
|
2374
|
+
}), /* @__PURE__ */ J("div", {
|
|
2375
2375
|
className: "flex flex-col gap-2",
|
|
2376
2376
|
children: [
|
|
2377
|
-
/* @__PURE__ */
|
|
2377
|
+
/* @__PURE__ */ q("input", {
|
|
2378
2378
|
ref: c,
|
|
2379
2379
|
type: "file",
|
|
2380
2380
|
accept: "image/*",
|
|
2381
2381
|
onChange: u,
|
|
2382
2382
|
className: "hidden"
|
|
2383
2383
|
}),
|
|
2384
|
-
/* @__PURE__ */
|
|
2384
|
+
/* @__PURE__ */ J(h, {
|
|
2385
2385
|
type: "button",
|
|
2386
2386
|
variant: "outline",
|
|
2387
2387
|
size: "sm",
|
|
2388
2388
|
onClick: () => c.current?.click(),
|
|
2389
2389
|
disabled: i || a.disabled,
|
|
2390
2390
|
children: [
|
|
2391
|
-
/* @__PURE__ */
|
|
2391
|
+
/* @__PURE__ */ q(K, { className: "w-4 h-4 mr-2" }),
|
|
2392
2392
|
t ? "Change" : "Upload",
|
|
2393
2393
|
" Avatar"
|
|
2394
2394
|
]
|
|
2395
2395
|
}),
|
|
2396
|
-
/* @__PURE__ */
|
|
2396
|
+
/* @__PURE__ */ q("p", {
|
|
2397
2397
|
className: "text-xs text-muted-foreground",
|
|
2398
2398
|
children: "PNG, JPG up to 5MB"
|
|
2399
2399
|
})
|
|
@@ -2401,7 +2401,7 @@ function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2401
2401
|
})]
|
|
2402
2402
|
});
|
|
2403
2403
|
}
|
|
2404
|
-
var Gn =
|
|
2404
|
+
var Gn = Y((() => {})), Kn = /* @__PURE__ */ X({ AddressField: () => qn });
|
|
2405
2405
|
function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2406
2406
|
let a = e || {}, o = (e, n) => {
|
|
2407
2407
|
t({
|
|
@@ -2416,19 +2416,19 @@ function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2416
2416
|
].filter(Boolean).join(", ");
|
|
2417
2417
|
if (r) {
|
|
2418
2418
|
let e = s(a);
|
|
2419
|
-
return e ? /* @__PURE__ */
|
|
2419
|
+
return e ? /* @__PURE__ */ q("span", {
|
|
2420
2420
|
className: "text-sm",
|
|
2421
2421
|
children: e
|
|
2422
|
-
}) : /* @__PURE__ */
|
|
2422
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
2423
2423
|
}
|
|
2424
|
-
return /* @__PURE__ */
|
|
2424
|
+
return /* @__PURE__ */ J("div", {
|
|
2425
2425
|
className: "space-y-3",
|
|
2426
2426
|
children: [
|
|
2427
|
-
/* @__PURE__ */
|
|
2427
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2428
2428
|
htmlFor: "street",
|
|
2429
2429
|
className: "text-xs",
|
|
2430
2430
|
children: "Street Address"
|
|
2431
|
-
}), /* @__PURE__ */
|
|
2431
|
+
}), /* @__PURE__ */ q(C, {
|
|
2432
2432
|
id: "street",
|
|
2433
2433
|
type: "text",
|
|
2434
2434
|
value: a.street || "",
|
|
@@ -2437,24 +2437,24 @@ function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2437
2437
|
disabled: r || i.disabled,
|
|
2438
2438
|
className: i.className
|
|
2439
2439
|
})] }),
|
|
2440
|
-
/* @__PURE__ */
|
|
2440
|
+
/* @__PURE__ */ J("div", {
|
|
2441
2441
|
className: "grid grid-cols-2 gap-3",
|
|
2442
|
-
children: [/* @__PURE__ */
|
|
2442
|
+
children: [/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2443
2443
|
htmlFor: "city",
|
|
2444
2444
|
className: "text-xs",
|
|
2445
2445
|
children: "City"
|
|
2446
|
-
}), /* @__PURE__ */
|
|
2446
|
+
}), /* @__PURE__ */ q(C, {
|
|
2447
2447
|
id: "city",
|
|
2448
2448
|
type: "text",
|
|
2449
2449
|
value: a.city || "",
|
|
2450
2450
|
onChange: (e) => o("city", e.target.value),
|
|
2451
2451
|
placeholder: "San Francisco",
|
|
2452
2452
|
disabled: r || i.disabled
|
|
2453
|
-
})] }), /* @__PURE__ */
|
|
2453
|
+
})] }), /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2454
2454
|
htmlFor: "state",
|
|
2455
2455
|
className: "text-xs",
|
|
2456
2456
|
children: "State / Province"
|
|
2457
|
-
}), /* @__PURE__ */
|
|
2457
|
+
}), /* @__PURE__ */ q(C, {
|
|
2458
2458
|
id: "state",
|
|
2459
2459
|
type: "text",
|
|
2460
2460
|
value: a.state || "",
|
|
@@ -2463,24 +2463,24 @@ function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2463
2463
|
disabled: r || i.disabled
|
|
2464
2464
|
})] })]
|
|
2465
2465
|
}),
|
|
2466
|
-
/* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ J("div", {
|
|
2467
2467
|
className: "grid grid-cols-2 gap-3",
|
|
2468
|
-
children: [/* @__PURE__ */
|
|
2468
|
+
children: [/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2469
2469
|
htmlFor: "zipCode",
|
|
2470
2470
|
className: "text-xs",
|
|
2471
2471
|
children: "ZIP / Postal Code"
|
|
2472
|
-
}), /* @__PURE__ */
|
|
2472
|
+
}), /* @__PURE__ */ q(C, {
|
|
2473
2473
|
id: "zipCode",
|
|
2474
2474
|
type: "text",
|
|
2475
2475
|
value: a.zipCode || "",
|
|
2476
2476
|
onChange: (e) => o("zipCode", e.target.value),
|
|
2477
2477
|
placeholder: "94102",
|
|
2478
2478
|
disabled: r || i.disabled
|
|
2479
|
-
})] }), /* @__PURE__ */
|
|
2479
|
+
})] }), /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2480
2480
|
htmlFor: "country",
|
|
2481
2481
|
className: "text-xs",
|
|
2482
2482
|
children: "Country"
|
|
2483
|
-
}), /* @__PURE__ */
|
|
2483
|
+
}), /* @__PURE__ */ q(C, {
|
|
2484
2484
|
id: "country",
|
|
2485
2485
|
type: "text",
|
|
2486
2486
|
value: a.country || "",
|
|
@@ -2492,7 +2492,7 @@ function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2492
2492
|
]
|
|
2493
2493
|
});
|
|
2494
2494
|
}
|
|
2495
|
-
var Jn =
|
|
2495
|
+
var Jn = Y((() => {})), Yn = /* @__PURE__ */ X({ GeolocationField: () => Xn });
|
|
2496
2496
|
function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2497
2497
|
let [o, s] = e.useState(!1), c = t || {}, l = (e, t) => {
|
|
2498
2498
|
n({
|
|
@@ -2524,15 +2524,15 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2524
2524
|
};
|
|
2525
2525
|
if (i) {
|
|
2526
2526
|
let e = d(c);
|
|
2527
|
-
return /* @__PURE__ */
|
|
2527
|
+
return /* @__PURE__ */ J("div", {
|
|
2528
2528
|
className: "flex items-center gap-2",
|
|
2529
2529
|
children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
e ? /* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ q(H, { className: "w-4 h-4 text-muted-foreground" }),
|
|
2531
|
+
e ? /* @__PURE__ */ q("span", {
|
|
2532
2532
|
className: "text-sm",
|
|
2533
2533
|
children: e
|
|
2534
|
-
}) : /* @__PURE__ */
|
|
2535
|
-
c.latitude && c.longitude && /* @__PURE__ */
|
|
2534
|
+
}) : /* @__PURE__ */ q(S, {}),
|
|
2535
|
+
c.latitude && c.longitude && /* @__PURE__ */ q(h, {
|
|
2536
2536
|
type: "button",
|
|
2537
2537
|
variant: "link",
|
|
2538
2538
|
size: "sm",
|
|
@@ -2543,33 +2543,33 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2543
2543
|
]
|
|
2544
2544
|
});
|
|
2545
2545
|
}
|
|
2546
|
-
return /* @__PURE__ */
|
|
2546
|
+
return /* @__PURE__ */ J("div", {
|
|
2547
2547
|
className: "space-y-3",
|
|
2548
2548
|
children: [
|
|
2549
|
-
/* @__PURE__ */
|
|
2549
|
+
/* @__PURE__ */ J("div", {
|
|
2550
2550
|
className: "flex items-center gap-2",
|
|
2551
|
-
children: [/* @__PURE__ */
|
|
2551
|
+
children: [/* @__PURE__ */ J(h, {
|
|
2552
2552
|
type: "button",
|
|
2553
2553
|
variant: "outline",
|
|
2554
2554
|
size: "sm",
|
|
2555
2555
|
onClick: u,
|
|
2556
2556
|
disabled: i || o,
|
|
2557
|
-
children: [/* @__PURE__ */
|
|
2558
|
-
}), c.latitude && c.longitude && /* @__PURE__ */
|
|
2557
|
+
children: [/* @__PURE__ */ q(R, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
2558
|
+
}), c.latitude && c.longitude && /* @__PURE__ */ J(h, {
|
|
2559
2559
|
type: "button",
|
|
2560
2560
|
variant: "link",
|
|
2561
2561
|
size: "sm",
|
|
2562
2562
|
onClick: f,
|
|
2563
|
-
children: [/* @__PURE__ */
|
|
2563
|
+
children: [/* @__PURE__ */ q(H, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
2564
2564
|
})]
|
|
2565
2565
|
}),
|
|
2566
|
-
/* @__PURE__ */
|
|
2566
|
+
/* @__PURE__ */ J("div", {
|
|
2567
2567
|
className: "grid grid-cols-2 gap-3",
|
|
2568
|
-
children: [/* @__PURE__ */
|
|
2568
|
+
children: [/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2569
2569
|
htmlFor: "latitude",
|
|
2570
2570
|
className: "text-xs",
|
|
2571
2571
|
children: "Latitude"
|
|
2572
|
-
}), /* @__PURE__ */
|
|
2572
|
+
}), /* @__PURE__ */ q(C, {
|
|
2573
2573
|
id: "latitude",
|
|
2574
2574
|
type: "number",
|
|
2575
2575
|
value: c.latitude ?? "",
|
|
@@ -2578,11 +2578,11 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2578
2578
|
disabled: i || a.disabled,
|
|
2579
2579
|
step: "any",
|
|
2580
2580
|
className: a.className
|
|
2581
|
-
})] }), /* @__PURE__ */
|
|
2581
|
+
})] }), /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(w, {
|
|
2582
2582
|
htmlFor: "longitude",
|
|
2583
2583
|
className: "text-xs",
|
|
2584
2584
|
children: "Longitude"
|
|
2585
|
-
}), /* @__PURE__ */
|
|
2585
|
+
}), /* @__PURE__ */ q(C, {
|
|
2586
2586
|
id: "longitude",
|
|
2587
2587
|
type: "number",
|
|
2588
2588
|
value: c.longitude ?? "",
|
|
@@ -2592,7 +2592,7 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2592
2592
|
step: "any"
|
|
2593
2593
|
})] })]
|
|
2594
2594
|
}),
|
|
2595
|
-
c.accuracy && /* @__PURE__ */
|
|
2595
|
+
c.accuracy && /* @__PURE__ */ J("p", {
|
|
2596
2596
|
className: "text-xs text-muted-foreground",
|
|
2597
2597
|
children: [
|
|
2598
2598
|
"Accuracy: ±",
|
|
@@ -2603,7 +2603,7 @@ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2603
2603
|
]
|
|
2604
2604
|
});
|
|
2605
2605
|
}
|
|
2606
|
-
var Zn =
|
|
2606
|
+
var Zn = Y((() => {})), Qn = /* @__PURE__ */ X({ SignatureField: () => $n });
|
|
2607
2607
|
function $n({ value: t, onChange: n, readonly: r }) {
|
|
2608
2608
|
let i = c(null), [o, s] = e.useState(!1), [l, u] = e.useState(!t);
|
|
2609
2609
|
a(() => {
|
|
@@ -2640,22 +2640,22 @@ function $n({ value: t, onChange: n, readonly: r }) {
|
|
|
2640
2640
|
let e = i.current;
|
|
2641
2641
|
e && n(e.toDataURL("image/png"));
|
|
2642
2642
|
};
|
|
2643
|
-
return r && t ? /* @__PURE__ */
|
|
2643
|
+
return r && t ? /* @__PURE__ */ q("div", {
|
|
2644
2644
|
className: "border rounded p-2 bg-white",
|
|
2645
|
-
children: /* @__PURE__ */
|
|
2645
|
+
children: /* @__PURE__ */ q("img", {
|
|
2646
2646
|
src: t,
|
|
2647
2647
|
alt: "Signature",
|
|
2648
2648
|
loading: "lazy",
|
|
2649
2649
|
className: "max-w-full h-auto"
|
|
2650
2650
|
})
|
|
2651
|
-
}) : r && !t ? /* @__PURE__ */
|
|
2651
|
+
}) : r && !t ? /* @__PURE__ */ q("span", {
|
|
2652
2652
|
className: "text-sm text-muted-foreground",
|
|
2653
2653
|
children: "No signature"
|
|
2654
|
-
}) : /* @__PURE__ */
|
|
2654
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2655
2655
|
className: "space-y-2",
|
|
2656
|
-
children: [/* @__PURE__ */
|
|
2656
|
+
children: [/* @__PURE__ */ q("div", {
|
|
2657
2657
|
className: "border rounded bg-white",
|
|
2658
|
-
children: /* @__PURE__ */
|
|
2658
|
+
children: /* @__PURE__ */ q("canvas", {
|
|
2659
2659
|
ref: i,
|
|
2660
2660
|
width: 400,
|
|
2661
2661
|
height: 200,
|
|
@@ -2668,12 +2668,12 @@ function $n({ value: t, onChange: n, readonly: r }) {
|
|
|
2668
2668
|
onTouchMove: f,
|
|
2669
2669
|
onTouchEnd: p
|
|
2670
2670
|
})
|
|
2671
|
-
}), /* @__PURE__ */
|
|
2671
|
+
}), /* @__PURE__ */ J("div", {
|
|
2672
2672
|
className: "flex justify-between items-center",
|
|
2673
|
-
children: [/* @__PURE__ */
|
|
2673
|
+
children: [/* @__PURE__ */ q("p", {
|
|
2674
2674
|
className: "text-xs text-muted-foreground",
|
|
2675
2675
|
children: l ? "Sign above" : "Signature captured"
|
|
2676
|
-
}), /* @__PURE__ */
|
|
2676
|
+
}), /* @__PURE__ */ J(h, {
|
|
2677
2677
|
type: "button",
|
|
2678
2678
|
variant: "outline",
|
|
2679
2679
|
size: "sm",
|
|
@@ -2684,67 +2684,67 @@ function $n({ value: t, onChange: n, readonly: r }) {
|
|
|
2684
2684
|
t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
|
|
2685
2685
|
},
|
|
2686
2686
|
disabled: r || l,
|
|
2687
|
-
children: [/* @__PURE__ */
|
|
2687
|
+
children: [/* @__PURE__ */ q(_e, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
2688
2688
|
})]
|
|
2689
2689
|
})]
|
|
2690
2690
|
});
|
|
2691
2691
|
}
|
|
2692
|
-
var er =
|
|
2692
|
+
var er = Y((() => {})), tr = /* @__PURE__ */ X({ QRCodeField: () => nr });
|
|
2693
2693
|
function nr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2694
2694
|
let [o, s] = e.useState(!1), c = r || a.schema;
|
|
2695
|
-
return i ? /* @__PURE__ */
|
|
2695
|
+
return i ? /* @__PURE__ */ J("div", {
|
|
2696
2696
|
className: "flex items-center gap-3",
|
|
2697
|
-
children: [/* @__PURE__ */
|
|
2697
|
+
children: [/* @__PURE__ */ q("span", {
|
|
2698
2698
|
className: "text-sm flex-1 truncate",
|
|
2699
|
-
children: t || /* @__PURE__ */
|
|
2700
|
-
}), t && /* @__PURE__ */
|
|
2699
|
+
children: t || /* @__PURE__ */ q(S, {})
|
|
2700
|
+
}), t && /* @__PURE__ */ J(h, {
|
|
2701
2701
|
type: "button",
|
|
2702
2702
|
variant: "outline",
|
|
2703
2703
|
size: "sm",
|
|
2704
2704
|
onClick: () => s(!o),
|
|
2705
2705
|
children: [
|
|
2706
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ q(W, { className: "w-4 h-4 mr-2" }),
|
|
2707
2707
|
o ? "Hide" : "Show",
|
|
2708
2708
|
" QR"
|
|
2709
2709
|
]
|
|
2710
2710
|
})]
|
|
2711
|
-
}) : /* @__PURE__ */
|
|
2711
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2712
2712
|
className: "space-y-3",
|
|
2713
2713
|
children: [
|
|
2714
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ J("div", {
|
|
2715
2715
|
className: "flex items-center gap-2",
|
|
2716
|
-
children: [/* @__PURE__ */
|
|
2716
|
+
children: [/* @__PURE__ */ q(C, {
|
|
2717
2717
|
type: "text",
|
|
2718
2718
|
value: t || "",
|
|
2719
2719
|
onChange: (e) => n(e.target.value),
|
|
2720
2720
|
placeholder: c?.placeholder || "Enter text for QR code",
|
|
2721
2721
|
disabled: i || a.disabled,
|
|
2722
2722
|
className: a.className
|
|
2723
|
-
}), t && /* @__PURE__ */
|
|
2723
|
+
}), t && /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ q(h, {
|
|
2724
2724
|
type: "button",
|
|
2725
2725
|
variant: "outline",
|
|
2726
2726
|
size: "sm",
|
|
2727
2727
|
onClick: () => {
|
|
2728
2728
|
t && navigator.clipboard.writeText(t);
|
|
2729
2729
|
},
|
|
2730
|
-
children: /* @__PURE__ */
|
|
2731
|
-
}), /* @__PURE__ */
|
|
2730
|
+
children: /* @__PURE__ */ q(L, { className: "w-4 h-4" })
|
|
2731
|
+
}), /* @__PURE__ */ q(h, {
|
|
2732
2732
|
type: "button",
|
|
2733
2733
|
variant: "outline",
|
|
2734
2734
|
size: "sm",
|
|
2735
2735
|
onClick: () => s(!o),
|
|
2736
|
-
children: /* @__PURE__ */
|
|
2736
|
+
children: /* @__PURE__ */ q(W, { className: "w-4 h-4" })
|
|
2737
2737
|
})] })]
|
|
2738
2738
|
}),
|
|
2739
|
-
o && t && /* @__PURE__ */
|
|
2739
|
+
o && t && /* @__PURE__ */ q("div", {
|
|
2740
2740
|
className: "border rounded p-4 bg-white flex justify-center",
|
|
2741
|
-
children: /* @__PURE__ */
|
|
2741
|
+
children: /* @__PURE__ */ q("img", {
|
|
2742
2742
|
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(t),
|
|
2743
2743
|
alt: "QR Code",
|
|
2744
2744
|
className: "w-48 h-48"
|
|
2745
2745
|
})
|
|
2746
2746
|
}),
|
|
2747
|
-
t && /* @__PURE__ */
|
|
2747
|
+
t && /* @__PURE__ */ J("p", {
|
|
2748
2748
|
className: "text-xs text-muted-foreground",
|
|
2749
2749
|
children: [
|
|
2750
2750
|
"QR code contains: ",
|
|
@@ -2755,10 +2755,10 @@ function nr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
2755
2755
|
]
|
|
2756
2756
|
});
|
|
2757
2757
|
}
|
|
2758
|
-
var rr =
|
|
2758
|
+
var rr = Y((() => {}));
|
|
2759
2759
|
//#endregion
|
|
2760
2760
|
//#region src/widgets/MasterDetailField.tsx
|
|
2761
|
-
|
|
2761
|
+
Le(), Be(), He(), Je(), Ze(), et(), rt(), ot(), ut(), pt(), gt(), Lt(), Bt(), Ut(), Kt(), Yt(), Qt(), on(), ln(), fn(), hn(), vn(), xn(), wn(), Dn(), An(), Nn(), In(), zn(), Hn(), Gn(), Jn(), Zn(), er(), rr(), tn();
|
|
2762
2762
|
function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
2763
2763
|
let o = e || [], s = n || a.schema, c = () => {
|
|
2764
2764
|
let e = {
|
|
@@ -2771,24 +2771,24 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2771
2771
|
}, u = (e) => {
|
|
2772
2772
|
console.log("View detail:", e);
|
|
2773
2773
|
};
|
|
2774
|
-
return r ? /* @__PURE__ */
|
|
2774
|
+
return r ? /* @__PURE__ */ J("div", {
|
|
2775
2775
|
className: P("space-y-2", i),
|
|
2776
|
-
children: [o.length === 0 ? /* @__PURE__ */
|
|
2776
|
+
children: [o.length === 0 ? /* @__PURE__ */ q("span", {
|
|
2777
2777
|
className: "text-sm text-muted-foreground",
|
|
2778
2778
|
children: "No related records"
|
|
2779
|
-
}) : o.map((e) => /* @__PURE__ */
|
|
2779
|
+
}) : o.map((e) => /* @__PURE__ */ J("div", {
|
|
2780
2780
|
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
2781
|
-
children: [/* @__PURE__ */
|
|
2781
|
+
children: [/* @__PURE__ */ q("span", {
|
|
2782
2782
|
className: "text-sm",
|
|
2783
2783
|
children: e.label
|
|
2784
|
-
}), /* @__PURE__ */
|
|
2784
|
+
}), /* @__PURE__ */ q(h, {
|
|
2785
2785
|
type: "button",
|
|
2786
2786
|
variant: "ghost",
|
|
2787
2787
|
size: "sm",
|
|
2788
2788
|
onClick: () => u(e),
|
|
2789
|
-
children: /* @__PURE__ */
|
|
2789
|
+
children: /* @__PURE__ */ q(z, { className: "w-4 h-4" })
|
|
2790
2790
|
})]
|
|
2791
|
-
}, e.id)), /* @__PURE__ */
|
|
2791
|
+
}, e.id)), /* @__PURE__ */ J("p", {
|
|
2792
2792
|
className: "text-xs text-muted-foreground",
|
|
2793
2793
|
children: [
|
|
2794
2794
|
o.length,
|
|
@@ -2796,60 +2796,123 @@ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2796
2796
|
o.length === 1 ? "record" : "records"
|
|
2797
2797
|
]
|
|
2798
2798
|
})]
|
|
2799
|
-
}) : /* @__PURE__ */
|
|
2799
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2800
2800
|
className: P("space-y-3", i),
|
|
2801
|
-
children: [/* @__PURE__ */
|
|
2801
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2802
2802
|
className: "space-y-2",
|
|
2803
|
-
children: [o.map((e) => /* @__PURE__ */
|
|
2803
|
+
children: [o.map((e) => /* @__PURE__ */ J("div", {
|
|
2804
2804
|
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
2805
|
-
children: [/* @__PURE__ */
|
|
2805
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2806
2806
|
className: "flex items-center gap-2 flex-1",
|
|
2807
|
-
children: [/* @__PURE__ */
|
|
2807
|
+
children: [/* @__PURE__ */ q(m, {
|
|
2808
2808
|
variant: "outline",
|
|
2809
2809
|
children: e.id
|
|
2810
|
-
}), /* @__PURE__ */
|
|
2810
|
+
}), /* @__PURE__ */ q("span", {
|
|
2811
2811
|
className: "text-sm flex-1",
|
|
2812
2812
|
children: e.label
|
|
2813
2813
|
})]
|
|
2814
|
-
}), /* @__PURE__ */
|
|
2814
|
+
}), /* @__PURE__ */ J("div", {
|
|
2815
2815
|
className: "flex items-center gap-1",
|
|
2816
|
-
children: [/* @__PURE__ */
|
|
2816
|
+
children: [/* @__PURE__ */ q(h, {
|
|
2817
2817
|
type: "button",
|
|
2818
2818
|
variant: "ghost",
|
|
2819
2819
|
size: "sm",
|
|
2820
2820
|
onClick: () => u(e),
|
|
2821
|
-
children: /* @__PURE__ */
|
|
2822
|
-
}), /* @__PURE__ */
|
|
2821
|
+
children: /* @__PURE__ */ q(z, { className: "w-4 h-4" })
|
|
2822
|
+
}), /* @__PURE__ */ q(h, {
|
|
2823
2823
|
type: "button",
|
|
2824
2824
|
variant: "ghost",
|
|
2825
2825
|
size: "sm",
|
|
2826
2826
|
onClick: () => l(e.id),
|
|
2827
2827
|
disabled: a.disabled,
|
|
2828
|
-
children: /* @__PURE__ */
|
|
2828
|
+
children: /* @__PURE__ */ q(Oe, { className: "w-4 h-4" })
|
|
2829
2829
|
})]
|
|
2830
2830
|
})]
|
|
2831
|
-
}, e.id)), o.length === 0 && /* @__PURE__ */
|
|
2831
|
+
}, e.id)), o.length === 0 && /* @__PURE__ */ q("div", {
|
|
2832
2832
|
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
2833
2833
|
children: "No related records"
|
|
2834
2834
|
})]
|
|
2835
|
-
}), /* @__PURE__ */
|
|
2835
|
+
}), /* @__PURE__ */ J(h, {
|
|
2836
2836
|
type: "button",
|
|
2837
2837
|
variant: "outline",
|
|
2838
2838
|
className: "w-full",
|
|
2839
2839
|
onClick: c,
|
|
2840
2840
|
disabled: a.disabled,
|
|
2841
2841
|
children: [
|
|
2842
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ q(Ce, { className: "w-4 h-4 mr-2" }),
|
|
2843
2843
|
"Add ",
|
|
2844
2844
|
s?.label || "Record"
|
|
2845
2845
|
]
|
|
2846
2846
|
})]
|
|
2847
2847
|
});
|
|
2848
2848
|
}
|
|
2849
|
-
kt(),
|
|
2850
|
-
|
|
2849
|
+
kt(), Le(), Be(), He(), Je(), Ze(), Bt(), Ut(), et(), rt(), ot(), ut(), Kt(), Yt(), pt(), gt(), Lt(), Tt(), Qt(), on(), ln(), fn(), hn(), vn(), xn(), wn(), Dn(), An(), Nn(), In(), zn(), Hn(), Gn(), Jn(), Zn(), er(), rr();
|
|
2850
|
+
var ar = /* @__PURE__ */ new Map();
|
|
2851
|
+
function or(e) {
|
|
2852
|
+
if (!(!e || typeof e != "object")) for (let t of [
|
|
2853
|
+
"name",
|
|
2854
|
+
"full_name",
|
|
2855
|
+
"display_name",
|
|
2856
|
+
"label",
|
|
2857
|
+
"title",
|
|
2858
|
+
"subject",
|
|
2859
|
+
"username",
|
|
2860
|
+
"email"
|
|
2861
|
+
]) {
|
|
2862
|
+
let n = e[t];
|
|
2863
|
+
if (typeof n == "string" && n.trim()) return n.trim();
|
|
2864
|
+
if (typeof n == "number") return String(n);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
function sr(e) {
|
|
2868
|
+
if (typeof e != "string" || !/^[A-Za-z0-9_-]{12,32}$/.test(e)) return !1;
|
|
2869
|
+
let t = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /[0-9_-]/.test(e);
|
|
2870
|
+
return t && n || t && r || n && r;
|
|
2871
|
+
}
|
|
2872
|
+
function cr(t, n) {
|
|
2873
|
+
let r = e.useContext(ke)?.dataSource, [, i] = e.useState(0), a = !!t && !!r && typeof r.find == "function" && (typeof n == "string" || typeof n == "number") && n !== "", o = a ? `${t}:${String(n)}` : "";
|
|
2874
|
+
if (e.useEffect(() => {
|
|
2875
|
+
if (!a) return;
|
|
2876
|
+
let e = ar.get(o);
|
|
2877
|
+
if (e && e.state !== "pending" && e.promise == null || e?.state === "pending") return;
|
|
2878
|
+
let s = (async () => {
|
|
2879
|
+
try {
|
|
2880
|
+
let e;
|
|
2881
|
+
if (typeof r.findOne == "function") e = await r.findOne(t, n);
|
|
2882
|
+
else {
|
|
2883
|
+
let i = await r.find(t, {
|
|
2884
|
+
$filter: { id: n },
|
|
2885
|
+
options: { $top: 1 }
|
|
2886
|
+
});
|
|
2887
|
+
e = (Array.isArray(i) ? i : i?.value || i?.data || [])[0];
|
|
2888
|
+
}
|
|
2889
|
+
let i = or(e);
|
|
2890
|
+
ar.set(o, {
|
|
2891
|
+
state: "ok",
|
|
2892
|
+
name: i
|
|
2893
|
+
});
|
|
2894
|
+
} catch {
|
|
2895
|
+
ar.set(o, { state: "err" });
|
|
2896
|
+
}
|
|
2897
|
+
i((e) => e + 1);
|
|
2898
|
+
})();
|
|
2899
|
+
ar.set(o, {
|
|
2900
|
+
state: "pending",
|
|
2901
|
+
promise: s
|
|
2902
|
+
});
|
|
2903
|
+
}, [
|
|
2904
|
+
o,
|
|
2905
|
+
a,
|
|
2906
|
+
t,
|
|
2907
|
+
n,
|
|
2908
|
+
r
|
|
2909
|
+
]), !a) return;
|
|
2910
|
+
let s = ar.get(o);
|
|
2911
|
+
return s?.state === "ok" ? s.name : void 0;
|
|
2912
|
+
}
|
|
2913
|
+
function lr() {
|
|
2851
2914
|
try {
|
|
2852
|
-
let { t: e } =
|
|
2915
|
+
let { t: e } = Ae();
|
|
2853
2916
|
return (t, n) => {
|
|
2854
2917
|
let r = e(t);
|
|
2855
2918
|
return !r || r === t ? n : r;
|
|
@@ -2874,7 +2937,7 @@ function Q(e) {
|
|
|
2874
2937
|
}
|
|
2875
2938
|
return String(e);
|
|
2876
2939
|
}
|
|
2877
|
-
function
|
|
2940
|
+
function ur(e, t = "USD") {
|
|
2878
2941
|
try {
|
|
2879
2942
|
return new Intl.NumberFormat("en-US", {
|
|
2880
2943
|
style: "currency",
|
|
@@ -2884,7 +2947,7 @@ function or(e, t = "USD") {
|
|
|
2884
2947
|
return `${t} ${e.toFixed(2)}`;
|
|
2885
2948
|
}
|
|
2886
2949
|
}
|
|
2887
|
-
function
|
|
2950
|
+
function dr(e, t = "USD") {
|
|
2888
2951
|
try {
|
|
2889
2952
|
return new Intl.NumberFormat("en-US", {
|
|
2890
2953
|
style: "currency",
|
|
@@ -2896,7 +2959,7 @@ function sr(e, t = "USD") {
|
|
|
2896
2959
|
return `${t} ${e}`;
|
|
2897
2960
|
}
|
|
2898
2961
|
}
|
|
2899
|
-
function
|
|
2962
|
+
function fr(e, t = 2) {
|
|
2900
2963
|
try {
|
|
2901
2964
|
return new Intl.NumberFormat("en-US", {
|
|
2902
2965
|
minimumFractionDigits: t,
|
|
@@ -2906,13 +2969,13 @@ function cr(e, t = 2) {
|
|
|
2906
2969
|
return e.toFixed(t);
|
|
2907
2970
|
}
|
|
2908
2971
|
}
|
|
2909
|
-
function
|
|
2972
|
+
function pr(e, t = 0) {
|
|
2910
2973
|
return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(t)}%`;
|
|
2911
2974
|
}
|
|
2912
|
-
function
|
|
2975
|
+
function mr(e) {
|
|
2913
2976
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
2914
2977
|
}
|
|
2915
|
-
function
|
|
2978
|
+
function hr(e) {
|
|
2916
2979
|
if (e == null || e === "") return "—";
|
|
2917
2980
|
let t = e instanceof Date ? e : new Date(e);
|
|
2918
2981
|
if (!(t instanceof Date) || isNaN(t.getTime())) return "—";
|
|
@@ -2922,20 +2985,20 @@ function dr(e) {
|
|
|
2922
2985
|
if (a === -1) return "Yesterday";
|
|
2923
2986
|
if (a < -1) {
|
|
2924
2987
|
let e = Math.abs(a);
|
|
2925
|
-
return e <= 7 ? `Overdue ${e}d` :
|
|
2988
|
+
return e <= 7 ? `Overdue ${e}d` : gr(t);
|
|
2926
2989
|
}
|
|
2927
|
-
return a > 1 && a <= 7 ? `In ${a} days` :
|
|
2990
|
+
return a > 1 && a <= 7 ? `In ${a} days` : gr(t);
|
|
2928
2991
|
}
|
|
2929
|
-
function
|
|
2992
|
+
function gr(e, t) {
|
|
2930
2993
|
if (e == null || e === "") return "—";
|
|
2931
2994
|
let n = e instanceof Date ? e : new Date(e);
|
|
2932
|
-
return !(n instanceof Date) || isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ?
|
|
2995
|
+
return !(n instanceof Date) || isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ? hr(n) : n.toLocaleDateString(void 0, {
|
|
2933
2996
|
year: "numeric",
|
|
2934
2997
|
month: "short",
|
|
2935
2998
|
day: "numeric"
|
|
2936
2999
|
});
|
|
2937
3000
|
}
|
|
2938
|
-
function
|
|
3001
|
+
function _r(e) {
|
|
2939
3002
|
if (e == null || e === "") return "—";
|
|
2940
3003
|
let t = e instanceof Date ? e : new Date(e);
|
|
2941
3004
|
return !(t instanceof Date) || isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
|
|
@@ -2946,17 +3009,17 @@ function pr(e) {
|
|
|
2946
3009
|
minute: "2-digit"
|
|
2947
3010
|
});
|
|
2948
3011
|
}
|
|
2949
|
-
function
|
|
3012
|
+
function vr({ value: e }) {
|
|
2950
3013
|
let t = Q(e);
|
|
2951
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
3014
|
+
return t == null || t === "" ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
|
|
2952
3015
|
className: "truncate",
|
|
2953
3016
|
children: String(t)
|
|
2954
3017
|
});
|
|
2955
3018
|
}
|
|
2956
|
-
function
|
|
2957
|
-
if (e == null) return /* @__PURE__ */
|
|
3019
|
+
function yr({ value: e, field: t }) {
|
|
3020
|
+
if (e == null) return /* @__PURE__ */ q(S, {});
|
|
2958
3021
|
let n = Q(e), r = t.precision ?? 0, i = Number(n);
|
|
2959
|
-
return /* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ q("span", {
|
|
2960
3023
|
className: "tabular-nums",
|
|
2961
3024
|
children: isNaN(i) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
2962
3025
|
minimumFractionDigits: r,
|
|
@@ -2964,42 +3027,42 @@ function hr({ value: e, field: t }) {
|
|
|
2964
3027
|
}).format(i)
|
|
2965
3028
|
});
|
|
2966
3029
|
}
|
|
2967
|
-
function
|
|
2968
|
-
if (e == null) return /* @__PURE__ */
|
|
3030
|
+
function br({ value: e, field: t }) {
|
|
3031
|
+
if (e == null) return /* @__PURE__ */ q(S, {});
|
|
2969
3032
|
let n = Q(e), r = t, i = r.currency || r.defaultCurrency, a = Number(n), o = r.precision ?? r.scale ?? r.decimals ?? 2;
|
|
2970
|
-
return /* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ q("span", {
|
|
2971
3034
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
2972
|
-
children: isNaN(a) ? String(n) : i ?
|
|
3035
|
+
children: isNaN(a) ? String(n) : i ? ur(a, i) : fr(a, o)
|
|
2973
3036
|
});
|
|
2974
3037
|
}
|
|
2975
|
-
var
|
|
2976
|
-
function
|
|
2977
|
-
if (e == null) return /* @__PURE__ */
|
|
3038
|
+
var xr = /progress|completion/;
|
|
3039
|
+
function Sr({ value: e, field: t }) {
|
|
3040
|
+
if (e == null) return /* @__PURE__ */ q(S, {});
|
|
2978
3041
|
let n = Q(e), r = t.precision ?? 0, i = Number(n);
|
|
2979
|
-
if (isNaN(i)) return /* @__PURE__ */
|
|
3042
|
+
if (isNaN(i)) return /* @__PURE__ */ q("span", {
|
|
2980
3043
|
className: "tabular-nums whitespace-nowrap",
|
|
2981
3044
|
children: String(n)
|
|
2982
3045
|
});
|
|
2983
|
-
let a =
|
|
2984
|
-
return /* @__PURE__ */
|
|
3046
|
+
let a = xr.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : pr(i, r), c = Math.max(0, Math.min(100, o));
|
|
3047
|
+
return /* @__PURE__ */ J("div", {
|
|
2985
3048
|
className: "flex items-center gap-2",
|
|
2986
|
-
children: [/* @__PURE__ */
|
|
2987
|
-
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden shrink-0",
|
|
3049
|
+
children: [/* @__PURE__ */ q("div", {
|
|
3050
|
+
className: "h-1.5 w-16 rounded-full bg-muted ring-1 ring-inset ring-border/60 overflow-hidden shrink-0",
|
|
2988
3051
|
role: "progressbar",
|
|
2989
3052
|
"aria-valuenow": c,
|
|
2990
3053
|
"aria-valuemin": 0,
|
|
2991
3054
|
"aria-valuemax": 100,
|
|
2992
|
-
children: /* @__PURE__ */
|
|
3055
|
+
children: /* @__PURE__ */ q("div", {
|
|
2993
3056
|
className: "h-full rounded-full bg-primary transition-all",
|
|
2994
3057
|
style: { width: `${c}%` }
|
|
2995
3058
|
})
|
|
2996
|
-
}), /* @__PURE__ */
|
|
3059
|
+
}), /* @__PURE__ */ q("span", {
|
|
2997
3060
|
className: "tabular-nums whitespace-nowrap",
|
|
2998
3061
|
children: s
|
|
2999
3062
|
})]
|
|
3000
3063
|
});
|
|
3001
3064
|
}
|
|
3002
|
-
var
|
|
3065
|
+
var Cr = new Set([
|
|
3003
3066
|
"active",
|
|
3004
3067
|
"is_active",
|
|
3005
3068
|
"enabled",
|
|
@@ -3007,55 +3070,55 @@ var yr = new Set([
|
|
|
3007
3070
|
"verified",
|
|
3008
3071
|
"is_verified"
|
|
3009
3072
|
]);
|
|
3010
|
-
function
|
|
3011
|
-
if (e == null) return /* @__PURE__ */
|
|
3073
|
+
function wr({ value: e, field: t }) {
|
|
3074
|
+
if (e == null) return /* @__PURE__ */ q("span", {
|
|
3012
3075
|
className: "flex items-center justify-center",
|
|
3013
|
-
children: /* @__PURE__ */
|
|
3076
|
+
children: /* @__PURE__ */ q(S, {})
|
|
3014
3077
|
});
|
|
3015
3078
|
let n = t?.name?.toLowerCase() || "";
|
|
3016
|
-
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */
|
|
3079
|
+
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ q("div", {
|
|
3017
3080
|
className: "flex items-center justify-center",
|
|
3018
|
-
children: e ? /* @__PURE__ */
|
|
3081
|
+
children: e ? /* @__PURE__ */ q("div", {
|
|
3019
3082
|
className: "size-5 rounded-full bg-green-500 flex items-center justify-center",
|
|
3020
3083
|
role: "img",
|
|
3021
3084
|
"aria-label": "Completed",
|
|
3022
3085
|
"data-testid": "completion-indicator",
|
|
3023
|
-
children: /* @__PURE__ */
|
|
3024
|
-
}) : /* @__PURE__ */
|
|
3086
|
+
children: /* @__PURE__ */ q(I, { className: "size-3 text-white" })
|
|
3087
|
+
}) : /* @__PURE__ */ q("div", {
|
|
3025
3088
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
3026
3089
|
role: "img",
|
|
3027
3090
|
"aria-label": "Not completed",
|
|
3028
3091
|
"data-testid": "completion-indicator"
|
|
3029
3092
|
})
|
|
3030
|
-
}) :
|
|
3093
|
+
}) : Cr.has(n) && !e ? /* @__PURE__ */ J(m, {
|
|
3031
3094
|
variant: "destructive",
|
|
3032
3095
|
className: "text-xs",
|
|
3033
3096
|
"data-testid": "boolean-warning-badge",
|
|
3034
|
-
children: [t?.label ||
|
|
3035
|
-
}) : /* @__PURE__ */
|
|
3097
|
+
children: [t?.label || mr(n), " — Off"]
|
|
3098
|
+
}) : /* @__PURE__ */ q("div", {
|
|
3036
3099
|
className: "flex items-center justify-start",
|
|
3037
|
-
children: /* @__PURE__ */
|
|
3100
|
+
children: /* @__PURE__ */ q(g, {
|
|
3038
3101
|
checked: !!e,
|
|
3039
3102
|
disabled: !0,
|
|
3040
3103
|
className: "pointer-events-none"
|
|
3041
3104
|
})
|
|
3042
3105
|
});
|
|
3043
3106
|
}
|
|
3044
|
-
function
|
|
3045
|
-
if (!e) return /* @__PURE__ */
|
|
3046
|
-
let n = Q(e), r = t, i =
|
|
3107
|
+
function Tr({ value: e, field: t }) {
|
|
3108
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
3109
|
+
let n = Q(e), r = t, i = gr(n, r.format || "relative"), a = n == null ? null : new Date(n), o = a !== null && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
|
|
3047
3110
|
s.setHours(0, 0, 0, 0);
|
|
3048
3111
|
let c = String(r?.name || r?.accessorKey || r?.key || "").toLowerCase(), l = (r?.dueLike === !0 || /(^|_)(due|deadline|expires?|expiry|expiration|expected_close|target_close|sla|return_by|renewal|next_action)(_|$)/.test(c)) && o && a < s, u = o ? a.toISOString() : String(n);
|
|
3049
|
-
return /* @__PURE__ */
|
|
3112
|
+
return /* @__PURE__ */ q("span", {
|
|
3050
3113
|
className: `tabular-nums${l ? " text-red-600" : ""}`,
|
|
3051
3114
|
title: u,
|
|
3052
3115
|
children: i
|
|
3053
3116
|
});
|
|
3054
3117
|
}
|
|
3055
|
-
function
|
|
3056
|
-
if (!e) return /* @__PURE__ */
|
|
3118
|
+
function Er({ value: e }) {
|
|
3119
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
3057
3120
|
let t = Q(e), n = t == null ? null : new Date(t);
|
|
3058
|
-
if (n === null || isNaN(n.getTime())) return /* @__PURE__ */
|
|
3121
|
+
if (n === null || isNaN(n.getTime())) return /* @__PURE__ */ q(S, {});
|
|
3059
3122
|
let r = n.toLocaleDateString(void 0, {
|
|
3060
3123
|
month: "numeric",
|
|
3061
3124
|
day: "numeric",
|
|
@@ -3065,15 +3128,15 @@ function Sr({ value: e }) {
|
|
|
3065
3128
|
minute: "2-digit",
|
|
3066
3129
|
hour12: !0
|
|
3067
3130
|
}).toLowerCase();
|
|
3068
|
-
return /* @__PURE__ */
|
|
3131
|
+
return /* @__PURE__ */ J("span", {
|
|
3069
3132
|
className: "tabular-nums text-sm whitespace-nowrap",
|
|
3070
|
-
children: [/* @__PURE__ */
|
|
3133
|
+
children: [/* @__PURE__ */ q("span", { children: r }), /* @__PURE__ */ q("span", {
|
|
3071
3134
|
className: "ml-2 text-muted-foreground",
|
|
3072
3135
|
children: i
|
|
3073
3136
|
})]
|
|
3074
3137
|
});
|
|
3075
3138
|
}
|
|
3076
|
-
var
|
|
3139
|
+
var Dr = {
|
|
3077
3140
|
critical: "red",
|
|
3078
3141
|
urgent: "red",
|
|
3079
3142
|
high: "orange",
|
|
@@ -3148,7 +3211,7 @@ var Cr = {
|
|
|
3148
3211
|
逾期: "red",
|
|
3149
3212
|
流失: "red",
|
|
3150
3213
|
丢失: "red"
|
|
3151
|
-
},
|
|
3214
|
+
}, Or = {
|
|
3152
3215
|
gray: "bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60",
|
|
3153
3216
|
red: "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60",
|
|
3154
3217
|
orange: "bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60",
|
|
@@ -3158,7 +3221,17 @@ var Cr = {
|
|
|
3158
3221
|
indigo: "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60",
|
|
3159
3222
|
purple: "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60",
|
|
3160
3223
|
pink: "bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60"
|
|
3161
|
-
},
|
|
3224
|
+
}, kr = {
|
|
3225
|
+
gray: "bg-gray-400 dark:bg-gray-500",
|
|
3226
|
+
red: "bg-red-500",
|
|
3227
|
+
orange: "bg-orange-500",
|
|
3228
|
+
yellow: "bg-yellow-500",
|
|
3229
|
+
green: "bg-green-500",
|
|
3230
|
+
blue: "bg-blue-500",
|
|
3231
|
+
indigo: "bg-indigo-500",
|
|
3232
|
+
purple: "bg-purple-500",
|
|
3233
|
+
pink: "bg-pink-500"
|
|
3234
|
+
}, Ar = [
|
|
3162
3235
|
"blue",
|
|
3163
3236
|
"green",
|
|
3164
3237
|
"purple",
|
|
@@ -3168,59 +3241,82 @@ var Cr = {
|
|
|
3168
3241
|
"yellow",
|
|
3169
3242
|
"red"
|
|
3170
3243
|
];
|
|
3171
|
-
function
|
|
3244
|
+
function jr(e) {
|
|
3172
3245
|
let t = 5381;
|
|
3173
3246
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e.charCodeAt(n);
|
|
3174
|
-
return
|
|
3247
|
+
return Ar[Math.abs(t) % Ar.length];
|
|
3175
3248
|
}
|
|
3176
|
-
function
|
|
3177
|
-
if (e &&
|
|
3249
|
+
function Mr(e, t) {
|
|
3250
|
+
if (e && Or[e]) return Or[e];
|
|
3178
3251
|
if (t == null || t === "") return "bg-muted text-muted-foreground border-border";
|
|
3179
|
-
let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r =
|
|
3180
|
-
return r &&
|
|
3181
|
-
}
|
|
3182
|
-
function
|
|
3183
|
-
|
|
3184
|
-
if (
|
|
3185
|
-
let
|
|
3186
|
-
|
|
3252
|
+
let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r = Dr[n];
|
|
3253
|
+
return r && Or[r] ? Or[r] : Or[jr(n)];
|
|
3254
|
+
}
|
|
3255
|
+
function Nr(e, t) {
|
|
3256
|
+
if (e && Or[e]) return e;
|
|
3257
|
+
if (t == null || t === "") return;
|
|
3258
|
+
let n = String(t).toLowerCase().replace(/[\s-]/g, "_");
|
|
3259
|
+
return Dr[n] || jr(n);
|
|
3260
|
+
}
|
|
3261
|
+
var Pr = {
|
|
3262
|
+
gray: "#6b7280",
|
|
3263
|
+
red: "#ef4444",
|
|
3264
|
+
orange: "#f97316",
|
|
3265
|
+
yellow: "#eab308",
|
|
3266
|
+
green: "#22c55e",
|
|
3267
|
+
blue: "#3b82f6",
|
|
3268
|
+
indigo: "#6366f1",
|
|
3269
|
+
purple: "#a855f7",
|
|
3270
|
+
pink: "#ec4899"
|
|
3271
|
+
};
|
|
3272
|
+
function Fr(e, t = "#3b82f6") {
|
|
3273
|
+
return e ? Pr[e] ?? t : t;
|
|
3274
|
+
}
|
|
3275
|
+
function Ir({ value: e, field: t }) {
|
|
3276
|
+
let n = t, r = n.options || [], i = n.appearance === "dot" ? "dot" : "badge";
|
|
3277
|
+
if (e == null || e === "") return /* @__PURE__ */ q(S, {});
|
|
3278
|
+
let a = (e) => {
|
|
3279
|
+
let t = r.find((t) => t.value === e);
|
|
3187
3280
|
if (t) return t;
|
|
3188
|
-
let
|
|
3189
|
-
return
|
|
3281
|
+
let n = String(e).toLowerCase();
|
|
3282
|
+
return r.find((e) => String(e.value).toLowerCase() === n);
|
|
3283
|
+
}, o = (e, t) => {
|
|
3284
|
+
let n = a(e), r = n?.label || mr(String(e));
|
|
3285
|
+
return i === "dot" ? /* @__PURE__ */ J("span", {
|
|
3286
|
+
className: "inline-flex items-center gap-1.5 text-sm",
|
|
3287
|
+
children: [/* @__PURE__ */ q("span", {
|
|
3288
|
+
className: P("h-1.5 w-1.5 rounded-full shrink-0", kr[n?.color || Dr[String(e).toLowerCase().replace(/[\s-]/g, "_")] || jr(String(e).toLowerCase().replace(/[\s-]/g, "_"))] || kr.gray),
|
|
3289
|
+
"aria-hidden": "true"
|
|
3290
|
+
}), /* @__PURE__ */ q("span", {
|
|
3291
|
+
className: "truncate",
|
|
3292
|
+
children: r
|
|
3293
|
+
})]
|
|
3294
|
+
}, t) : /* @__PURE__ */ q(m, {
|
|
3295
|
+
variant: "outline",
|
|
3296
|
+
className: Mr(n?.color, e),
|
|
3297
|
+
children: r
|
|
3298
|
+
}, t);
|
|
3190
3299
|
};
|
|
3191
|
-
|
|
3192
|
-
className: "flex flex-wrap gap-1",
|
|
3193
|
-
children: e.map((e, t) =>
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
})
|
|
3201
|
-
});
|
|
3202
|
-
let i = r(e), a = i?.label || ur(String(e));
|
|
3203
|
-
return /* @__PURE__ */ J(m, {
|
|
3204
|
-
variant: "outline",
|
|
3205
|
-
className: Dr(i?.color, e),
|
|
3206
|
-
children: a
|
|
3207
|
-
});
|
|
3208
|
-
}
|
|
3209
|
-
function kr({ value: t }) {
|
|
3210
|
-
if (!t) return /* @__PURE__ */ J(S, {});
|
|
3211
|
-
let n = ar(), r = String(Q(t) ?? ""), [i, a] = e.useState(!1);
|
|
3212
|
-
return /* @__PURE__ */ Y("span", {
|
|
3300
|
+
return Array.isArray(e) ? /* @__PURE__ */ q("div", {
|
|
3301
|
+
className: P("flex flex-wrap", i === "dot" ? "gap-x-3 gap-y-1" : "gap-1"),
|
|
3302
|
+
children: e.map((e, t) => o(e, t))
|
|
3303
|
+
}) : o(e);
|
|
3304
|
+
}
|
|
3305
|
+
function Lr({ value: t }) {
|
|
3306
|
+
if (!t) return /* @__PURE__ */ q(S, {});
|
|
3307
|
+
let n = lr(), r = String(Q(t) ?? ""), [i, a] = e.useState(!1);
|
|
3308
|
+
return /* @__PURE__ */ J("span", {
|
|
3213
3309
|
className: "inline-flex items-center gap-1 group/email",
|
|
3214
|
-
children: [/* @__PURE__ */
|
|
3310
|
+
children: [/* @__PURE__ */ q(h, {
|
|
3215
3311
|
variant: "link",
|
|
3216
3312
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
3217
3313
|
asChild: !0,
|
|
3218
|
-
children: /* @__PURE__ */
|
|
3314
|
+
children: /* @__PURE__ */ q("a", {
|
|
3219
3315
|
href: `mailto:${r}`,
|
|
3220
3316
|
onClick: (e) => e.stopPropagation(),
|
|
3221
3317
|
children: r
|
|
3222
3318
|
})
|
|
3223
|
-
}), /* @__PURE__ */
|
|
3319
|
+
}), /* @__PURE__ */ q("button", {
|
|
3224
3320
|
type: "button",
|
|
3225
3321
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
3226
3322
|
onClick: (e) => {
|
|
@@ -3229,18 +3325,18 @@ function kr({ value: t }) {
|
|
|
3229
3325
|
}).catch(() => {});
|
|
3230
3326
|
},
|
|
3231
3327
|
"aria-label": n("detail.copyEmail", "Copy email"),
|
|
3232
|
-
children: i ? /* @__PURE__ */
|
|
3328
|
+
children: i ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
|
|
3233
3329
|
})]
|
|
3234
3330
|
});
|
|
3235
3331
|
}
|
|
3236
|
-
function
|
|
3237
|
-
if (!e) return /* @__PURE__ */
|
|
3332
|
+
function Rr({ value: e }) {
|
|
3333
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
3238
3334
|
let t = String(Q(e) ?? "");
|
|
3239
|
-
return /* @__PURE__ */
|
|
3335
|
+
return /* @__PURE__ */ q(h, {
|
|
3240
3336
|
variant: "link",
|
|
3241
3337
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
3242
3338
|
asChild: !0,
|
|
3243
|
-
children: /* @__PURE__ */
|
|
3339
|
+
children: /* @__PURE__ */ q("a", {
|
|
3244
3340
|
href: t,
|
|
3245
3341
|
target: "_blank",
|
|
3246
3342
|
rel: "noopener noreferrer",
|
|
@@ -3249,17 +3345,17 @@ function Ar({ value: e }) {
|
|
|
3249
3345
|
})
|
|
3250
3346
|
});
|
|
3251
3347
|
}
|
|
3252
|
-
function
|
|
3253
|
-
if (!t) return /* @__PURE__ */
|
|
3254
|
-
let n =
|
|
3255
|
-
return /* @__PURE__ */
|
|
3348
|
+
function zr({ value: t }) {
|
|
3349
|
+
if (!t) return /* @__PURE__ */ q(S, {});
|
|
3350
|
+
let n = lr(), r = String(Q(t) ?? ""), [i, a] = e.useState(!1);
|
|
3351
|
+
return /* @__PURE__ */ J("span", {
|
|
3256
3352
|
className: "inline-flex items-center gap-1 group/phone",
|
|
3257
|
-
children: [/* @__PURE__ */
|
|
3353
|
+
children: [/* @__PURE__ */ J("a", {
|
|
3258
3354
|
href: `tel:${r}`,
|
|
3259
3355
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
3260
3356
|
onClick: (e) => e.stopPropagation(),
|
|
3261
|
-
children: [/* @__PURE__ */
|
|
3262
|
-
}), /* @__PURE__ */
|
|
3357
|
+
children: [/* @__PURE__ */ q(Se, { className: "h-3 w-3" }), r]
|
|
3358
|
+
}), /* @__PURE__ */ q("button", {
|
|
3263
3359
|
type: "button",
|
|
3264
3360
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
3265
3361
|
onClick: (e) => {
|
|
@@ -3268,15 +3364,15 @@ function jr({ value: t }) {
|
|
|
3268
3364
|
}).catch(() => {});
|
|
3269
3365
|
},
|
|
3270
3366
|
"aria-label": n("detail.copyPhone", "Copy phone number"),
|
|
3271
|
-
children: i ? /* @__PURE__ */
|
|
3367
|
+
children: i ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
|
|
3272
3368
|
})]
|
|
3273
3369
|
});
|
|
3274
3370
|
}
|
|
3275
|
-
function
|
|
3276
|
-
if (!e) return /* @__PURE__ */
|
|
3371
|
+
function Br({ value: e, field: t }) {
|
|
3372
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
3277
3373
|
if (t.multiple, Array.isArray(e)) {
|
|
3278
3374
|
let t = e.length;
|
|
3279
|
-
return /* @__PURE__ */
|
|
3375
|
+
return /* @__PURE__ */ J("span", {
|
|
3280
3376
|
className: "text-sm text-gray-600",
|
|
3281
3377
|
children: [
|
|
3282
3378
|
t,
|
|
@@ -3285,111 +3381,135 @@ function Mr({ value: e, field: t }) {
|
|
|
3285
3381
|
]
|
|
3286
3382
|
});
|
|
3287
3383
|
}
|
|
3288
|
-
return /* @__PURE__ */
|
|
3384
|
+
return /* @__PURE__ */ q("span", {
|
|
3289
3385
|
className: "text-sm truncate",
|
|
3290
3386
|
children: e.name || e.original_name || "File"
|
|
3291
3387
|
});
|
|
3292
3388
|
}
|
|
3293
|
-
function
|
|
3294
|
-
return e ? Array.isArray(e) ? /* @__PURE__ */
|
|
3389
|
+
function Vr({ value: e }) {
|
|
3390
|
+
return e ? Array.isArray(e) ? /* @__PURE__ */ J("div", {
|
|
3295
3391
|
className: "flex -space-x-2",
|
|
3296
|
-
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */
|
|
3392
|
+
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */ q("img", {
|
|
3297
3393
|
src: e.url || "",
|
|
3298
3394
|
alt: e.name || `Image ${t + 1}`,
|
|
3299
3395
|
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
3300
|
-
}, t)), e.length > 3 && /* @__PURE__ */
|
|
3396
|
+
}, t)), e.length > 3 && /* @__PURE__ */ J("div", {
|
|
3301
3397
|
className: "size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600",
|
|
3302
3398
|
children: ["+", e.length - 3]
|
|
3303
3399
|
})]
|
|
3304
|
-
}) : /* @__PURE__ */
|
|
3400
|
+
}) : /* @__PURE__ */ q("img", {
|
|
3305
3401
|
src: e.url || "",
|
|
3306
3402
|
alt: e.name || "Image",
|
|
3307
3403
|
className: "size-10 rounded-md object-cover"
|
|
3308
|
-
}) : /* @__PURE__ */
|
|
3309
|
-
}
|
|
3310
|
-
function
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
if (
|
|
3314
|
-
|
|
3315
|
-
|
|
3404
|
+
}) : /* @__PURE__ */ q(S, {});
|
|
3405
|
+
}
|
|
3406
|
+
function Hr({ value: e, field: t }) {
|
|
3407
|
+
let n = t.reference_to, r = (() => {
|
|
3408
|
+
if (Array.isArray(e)) return e.find((e) => e != null && (typeof e == "string" || typeof e == "number") && e !== "");
|
|
3409
|
+
if (e != null && e !== "" && (typeof e == "string" || typeof e == "number") && typeof e != "object") return e;
|
|
3410
|
+
})(), i = cr(n, r);
|
|
3411
|
+
if (e == null || e === "") return /* @__PURE__ */ q(S, {});
|
|
3412
|
+
let a = t.options || [], o = (e) => {
|
|
3413
|
+
if (a.length > 0) {
|
|
3414
|
+
let t = a.find((t) => String(t.value) === String(e));
|
|
3415
|
+
if (t) return {
|
|
3416
|
+
text: t.label,
|
|
3417
|
+
muted: !1
|
|
3418
|
+
};
|
|
3316
3419
|
}
|
|
3317
|
-
return
|
|
3420
|
+
return e === r && i ? {
|
|
3421
|
+
text: i,
|
|
3422
|
+
muted: !1
|
|
3423
|
+
} : sr(e) ? {
|
|
3424
|
+
text: "—",
|
|
3425
|
+
muted: !0
|
|
3426
|
+
} : {
|
|
3427
|
+
text: String(e),
|
|
3428
|
+
muted: !1
|
|
3429
|
+
};
|
|
3318
3430
|
};
|
|
3319
|
-
|
|
3431
|
+
if (Array.isArray(e)) return /* @__PURE__ */ q("div", {
|
|
3320
3432
|
className: "flex flex-wrap gap-1",
|
|
3321
3433
|
children: e.map((e, t) => {
|
|
3322
|
-
let n;
|
|
3323
|
-
|
|
3324
|
-
|
|
3434
|
+
let n, r = !1;
|
|
3435
|
+
if (typeof e == "object" && e) n = or(e) || String(e.id || e._id || "[Object]");
|
|
3436
|
+
else {
|
|
3437
|
+
let t = o(e);
|
|
3438
|
+
n = t.text, r = t.muted;
|
|
3439
|
+
}
|
|
3440
|
+
return /* @__PURE__ */ q("span", {
|
|
3441
|
+
className: P("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium", r ? "bg-muted/40 text-muted-foreground" : "bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200"),
|
|
3325
3442
|
children: n
|
|
3326
3443
|
}, t);
|
|
3327
3444
|
})
|
|
3328
|
-
})
|
|
3329
|
-
|
|
3330
|
-
children: e.name || e.label || e.id || e._id || "[Object]"
|
|
3331
|
-
}) : /* @__PURE__ */ J("span", {
|
|
3445
|
+
});
|
|
3446
|
+
if (typeof e == "object" && e) return /* @__PURE__ */ q("span", {
|
|
3332
3447
|
className: "truncate",
|
|
3333
|
-
children:
|
|
3448
|
+
children: or(e) || String(e.id || e._id || "[Object]")
|
|
3449
|
+
});
|
|
3450
|
+
let { text: s, muted: c } = o(e);
|
|
3451
|
+
return /* @__PURE__ */ q("span", {
|
|
3452
|
+
className: P("truncate", c && "text-muted-foreground"),
|
|
3453
|
+
children: s
|
|
3334
3454
|
});
|
|
3335
3455
|
}
|
|
3336
|
-
function
|
|
3456
|
+
function Ur({ value: e }) {
|
|
3337
3457
|
let t = Q(e);
|
|
3338
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
3458
|
+
return t == null || t === "" ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
|
|
3339
3459
|
className: "text-gray-700 font-mono text-sm",
|
|
3340
3460
|
children: String(t)
|
|
3341
3461
|
});
|
|
3342
3462
|
}
|
|
3343
|
-
function
|
|
3344
|
-
if (!e) return /* @__PURE__ */
|
|
3345
|
-
if (typeof e != "object") return /* @__PURE__ */
|
|
3463
|
+
function Wr({ value: e }) {
|
|
3464
|
+
if (!e) return /* @__PURE__ */ q(S, {});
|
|
3465
|
+
if (typeof e != "object") return /* @__PURE__ */ q("span", {
|
|
3346
3466
|
className: "truncate",
|
|
3347
3467
|
children: String(e)
|
|
3348
3468
|
});
|
|
3349
|
-
if (Array.isArray(e)) return /* @__PURE__ */
|
|
3469
|
+
if (Array.isArray(e)) return /* @__PURE__ */ J("div", {
|
|
3350
3470
|
className: "flex -space-x-2",
|
|
3351
3471
|
children: [e.slice(0, 3).map((e, t) => {
|
|
3352
|
-
if (typeof e != "object" || !e) return /* @__PURE__ */
|
|
3472
|
+
if (typeof e != "object" || !e) return /* @__PURE__ */ q("span", {
|
|
3353
3473
|
className: "truncate text-sm",
|
|
3354
3474
|
children: String(e)
|
|
3355
3475
|
}, t);
|
|
3356
3476
|
let n = e.name || e.username || "User";
|
|
3357
|
-
return /* @__PURE__ */
|
|
3477
|
+
return /* @__PURE__ */ q(d, {
|
|
3358
3478
|
className: "size-8 border-2 border-white",
|
|
3359
3479
|
title: n,
|
|
3360
|
-
children: /* @__PURE__ */
|
|
3480
|
+
children: /* @__PURE__ */ q(f, {
|
|
3361
3481
|
className: "bg-blue-500 text-white text-xs",
|
|
3362
3482
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
3363
3483
|
})
|
|
3364
3484
|
}, t);
|
|
3365
|
-
}), e.length > 3 && /* @__PURE__ */
|
|
3485
|
+
}), e.length > 3 && /* @__PURE__ */ q(d, {
|
|
3366
3486
|
className: "size-8 border-2 border-white",
|
|
3367
|
-
children: /* @__PURE__ */
|
|
3487
|
+
children: /* @__PURE__ */ J(f, {
|
|
3368
3488
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
3369
3489
|
children: ["+", e.length - 3]
|
|
3370
3490
|
})
|
|
3371
3491
|
})]
|
|
3372
3492
|
});
|
|
3373
3493
|
let t = e.name || e.username || "User";
|
|
3374
|
-
return /* @__PURE__ */
|
|
3494
|
+
return /* @__PURE__ */ J("div", {
|
|
3375
3495
|
className: "flex items-center gap-2",
|
|
3376
|
-
children: [/* @__PURE__ */
|
|
3496
|
+
children: [/* @__PURE__ */ q(d, {
|
|
3377
3497
|
className: "size-8",
|
|
3378
|
-
children: /* @__PURE__ */
|
|
3498
|
+
children: /* @__PURE__ */ q(f, {
|
|
3379
3499
|
className: "bg-blue-500 text-white text-xs",
|
|
3380
3500
|
children: t.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
3381
3501
|
})
|
|
3382
|
-
}), /* @__PURE__ */
|
|
3502
|
+
}), /* @__PURE__ */ q("span", {
|
|
3383
3503
|
className: "truncate",
|
|
3384
3504
|
children: t
|
|
3385
3505
|
})]
|
|
3386
3506
|
});
|
|
3387
3507
|
}
|
|
3388
|
-
var
|
|
3389
|
-
function
|
|
3390
|
-
|
|
3508
|
+
var Gr = /* @__PURE__ */ new Map();
|
|
3509
|
+
function Kr(e, t) {
|
|
3510
|
+
Gr.set(e, t);
|
|
3391
3511
|
}
|
|
3392
|
-
var
|
|
3512
|
+
var qr = {
|
|
3393
3513
|
phone: "phone",
|
|
3394
3514
|
tel: "phone",
|
|
3395
3515
|
telephone: "phone",
|
|
@@ -3401,64 +3521,64 @@ var zr = {
|
|
|
3401
3521
|
money: "currency",
|
|
3402
3522
|
percent: "percent",
|
|
3403
3523
|
percentage: "percent"
|
|
3404
|
-
},
|
|
3524
|
+
}, Jr = new Set([
|
|
3405
3525
|
"text",
|
|
3406
3526
|
"textarea",
|
|
3407
3527
|
"string",
|
|
3408
3528
|
"longtext",
|
|
3409
3529
|
""
|
|
3410
3530
|
]);
|
|
3411
|
-
function
|
|
3531
|
+
function Yr(e) {
|
|
3412
3532
|
if (!e) return "text";
|
|
3413
3533
|
if (typeof e == "string") return e;
|
|
3414
3534
|
let t = (e.type || "").toLowerCase(), n = e.format, r = typeof n == "string" ? n.toLowerCase() : "";
|
|
3415
|
-
return r &&
|
|
3416
|
-
}
|
|
3417
|
-
function
|
|
3418
|
-
return
|
|
3419
|
-
text:
|
|
3420
|
-
textarea:
|
|
3421
|
-
markdown:
|
|
3422
|
-
html:
|
|
3423
|
-
number:
|
|
3424
|
-
currency:
|
|
3425
|
-
percent:
|
|
3426
|
-
boolean:
|
|
3427
|
-
date:
|
|
3428
|
-
datetime:
|
|
3429
|
-
time:
|
|
3430
|
-
select:
|
|
3431
|
-
status:
|
|
3432
|
-
lookup:
|
|
3433
|
-
master_detail:
|
|
3434
|
-
email:
|
|
3435
|
-
url:
|
|
3436
|
-
phone:
|
|
3437
|
-
file:
|
|
3438
|
-
image:
|
|
3439
|
-
formula:
|
|
3440
|
-
summary:
|
|
3441
|
-
auto_number:
|
|
3442
|
-
user:
|
|
3443
|
-
owner:
|
|
3444
|
-
password: () => /* @__PURE__ */
|
|
3445
|
-
location:
|
|
3446
|
-
object: () => /* @__PURE__ */
|
|
3535
|
+
return r && qr[r] && Jr.has(t) ? qr[r] : e.type || "text";
|
|
3536
|
+
}
|
|
3537
|
+
function Xr(e) {
|
|
3538
|
+
return Gr.has(e) ? Gr.get(e) : {
|
|
3539
|
+
text: vr,
|
|
3540
|
+
textarea: vr,
|
|
3541
|
+
markdown: vr,
|
|
3542
|
+
html: vr,
|
|
3543
|
+
number: yr,
|
|
3544
|
+
currency: br,
|
|
3545
|
+
percent: Sr,
|
|
3546
|
+
boolean: wr,
|
|
3547
|
+
date: Tr,
|
|
3548
|
+
datetime: Er,
|
|
3549
|
+
time: vr,
|
|
3550
|
+
select: Ir,
|
|
3551
|
+
status: Ir,
|
|
3552
|
+
lookup: Hr,
|
|
3553
|
+
master_detail: Hr,
|
|
3554
|
+
email: Lr,
|
|
3555
|
+
url: Rr,
|
|
3556
|
+
phone: zr,
|
|
3557
|
+
file: Br,
|
|
3558
|
+
image: Vr,
|
|
3559
|
+
formula: Ur,
|
|
3560
|
+
summary: Ur,
|
|
3561
|
+
auto_number: vr,
|
|
3562
|
+
user: Wr,
|
|
3563
|
+
owner: Wr,
|
|
3564
|
+
password: () => /* @__PURE__ */ q("span", { children: "••••••" }),
|
|
3565
|
+
location: vr,
|
|
3566
|
+
object: () => /* @__PURE__ */ q("span", {
|
|
3447
3567
|
className: "text-gray-500 italic",
|
|
3448
3568
|
children: "[Object]"
|
|
3449
3569
|
}),
|
|
3450
|
-
vector: () => /* @__PURE__ */
|
|
3570
|
+
vector: () => /* @__PURE__ */ q("span", {
|
|
3451
3571
|
className: "text-gray-500 italic",
|
|
3452
3572
|
children: "[Vector]"
|
|
3453
3573
|
}),
|
|
3454
|
-
grid: () => /* @__PURE__ */
|
|
3574
|
+
grid: () => /* @__PURE__ */ q("span", {
|
|
3455
3575
|
className: "text-gray-500 italic",
|
|
3456
3576
|
children: "[Grid]"
|
|
3457
3577
|
})
|
|
3458
|
-
}[e] ||
|
|
3578
|
+
}[e] || vr;
|
|
3459
3579
|
}
|
|
3460
|
-
|
|
3461
|
-
function
|
|
3580
|
+
Kr("lookup", Hr), Kr("master_detail", Hr), Kr("select", Ir), Kr("status", Ir), Kr("user", Wr), Kr("owner", Wr), Et(Xr);
|
|
3581
|
+
function Zr(e) {
|
|
3462
3582
|
return {
|
|
3463
3583
|
text: "field:text",
|
|
3464
3584
|
textarea: "field:textarea",
|
|
@@ -3486,7 +3606,7 @@ function Ur(e) {
|
|
|
3486
3606
|
auto_number: "field:auto_number"
|
|
3487
3607
|
}[e] || "field:text";
|
|
3488
3608
|
}
|
|
3489
|
-
function
|
|
3609
|
+
function Qr(e) {
|
|
3490
3610
|
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
3491
3611
|
let t = [
|
|
3492
3612
|
"B",
|
|
@@ -3498,7 +3618,7 @@ function Wr(e) {
|
|
|
3498
3618
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
3499
3619
|
return `${n.toFixed(+(r > 0))} ${t[r]}`;
|
|
3500
3620
|
}
|
|
3501
|
-
function
|
|
3621
|
+
function $r(e) {
|
|
3502
3622
|
let t = {};
|
|
3503
3623
|
return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
|
|
3504
3624
|
value: e.min_length,
|
|
@@ -3523,7 +3643,7 @@ function Gr(e) {
|
|
|
3523
3643
|
message: "Please enter a valid URL"
|
|
3524
3644
|
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
3525
3645
|
}
|
|
3526
|
-
function
|
|
3646
|
+
function ei(e, t) {
|
|
3527
3647
|
if (!e) return !0;
|
|
3528
3648
|
if (e.field && e.value !== void 0) {
|
|
3529
3649
|
let n = t[e.field];
|
|
@@ -3535,7 +3655,7 @@ function Kr(e, t) {
|
|
|
3535
3655
|
if (e.operator === "<=") return n <= e.value;
|
|
3536
3656
|
if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
|
|
3537
3657
|
}
|
|
3538
|
-
return e.and && Array.isArray(e.and) ? e.and.every((e) =>
|
|
3658
|
+
return e.and && Array.isArray(e.and) ? e.and.every((e) => ei(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => ei(e, t)) : !0;
|
|
3539
3659
|
}
|
|
3540
3660
|
function $(t) {
|
|
3541
3661
|
let n = ({ schema: n, className: r, value: i, ...a }) => {
|
|
@@ -3553,24 +3673,24 @@ function $(t) {
|
|
|
3553
3673
|
}, l = e.useCallback((e) => {
|
|
3554
3674
|
s(e), a.onChange && a.onChange(e);
|
|
3555
3675
|
}, [a]), u = n?.readonly || n?.readOnly || !1;
|
|
3556
|
-
return /* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ J("div", {
|
|
3557
3677
|
className: "grid w-full items-center gap-1.5",
|
|
3558
3678
|
"data-obj-id": n?.id,
|
|
3559
3679
|
"data-obj-type": n?.type,
|
|
3560
3680
|
children: [
|
|
3561
|
-
n?.label && /* @__PURE__ */
|
|
3681
|
+
n?.label && /* @__PURE__ */ q("label", {
|
|
3562
3682
|
htmlFor: n.id,
|
|
3563
3683
|
className: n.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "",
|
|
3564
3684
|
children: n.label
|
|
3565
3685
|
}),
|
|
3566
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ q(t, {
|
|
3567
3687
|
value: o,
|
|
3568
3688
|
onChange: l,
|
|
3569
3689
|
field: c,
|
|
3570
3690
|
readonly: u,
|
|
3571
3691
|
className: r
|
|
3572
3692
|
}),
|
|
3573
|
-
n?.description && /* @__PURE__ */
|
|
3693
|
+
n?.description && /* @__PURE__ */ q("p", {
|
|
3574
3694
|
className: "text-sm text-gray-500",
|
|
3575
3695
|
children: n.description
|
|
3576
3696
|
})
|
|
@@ -3579,11 +3699,11 @@ function $(t) {
|
|
|
3579
3699
|
};
|
|
3580
3700
|
return n.displayName = `FieldRenderer(${t.displayName || t.name || "Component"})`, n;
|
|
3581
3701
|
}
|
|
3582
|
-
var
|
|
3583
|
-
text: () => Promise.resolve().then(() => (
|
|
3702
|
+
var ti = {
|
|
3703
|
+
text: () => Promise.resolve().then(() => (Le(), Fe)).then((e) => ({ default: e.TextField })),
|
|
3584
3704
|
textarea: () => Promise.resolve().then(() => (pt(), dt)).then((e) => ({ default: e.TextAreaField })),
|
|
3585
|
-
number: () => Promise.resolve().then(() => (
|
|
3586
|
-
boolean: () => Promise.resolve().then(() => (He(),
|
|
3705
|
+
number: () => Promise.resolve().then(() => (Be(), Re)).then((e) => ({ default: e.NumberField })),
|
|
3706
|
+
boolean: () => Promise.resolve().then(() => (He(), Ve)).then((e) => ({ default: e.BooleanField })),
|
|
3587
3707
|
select: () => Promise.resolve().then(() => (Je(), Ke)).then((e) => ({ default: e.SelectField })),
|
|
3588
3708
|
date: () => Promise.resolve().then(() => (Ze(), Ye)).then((e) => ({ default: e.DateField })),
|
|
3589
3709
|
datetime: () => Promise.resolve().then(() => (Bt(), Rt)).then((e) => ({ default: e.DateTimeField })),
|
|
@@ -3619,8 +3739,8 @@ var qr = {
|
|
|
3619
3739
|
signature: () => Promise.resolve().then(() => (er(), Qn)).then((e) => ({ default: e.SignatureField })),
|
|
3620
3740
|
qrcode: () => Promise.resolve().then(() => (rr(), tr)).then((e) => ({ default: e.QRCodeField }))
|
|
3621
3741
|
};
|
|
3622
|
-
function
|
|
3623
|
-
let n =
|
|
3742
|
+
function ni(t) {
|
|
3743
|
+
let n = ti[t];
|
|
3624
3744
|
if (!n) {
|
|
3625
3745
|
console.warn(`Unknown field type: ${t}`);
|
|
3626
3746
|
return;
|
|
@@ -3628,14 +3748,14 @@ function Jr(t) {
|
|
|
3628
3748
|
let r = e.lazy(n);
|
|
3629
3749
|
u.register(t, r, { namespace: "field" });
|
|
3630
3750
|
}
|
|
3631
|
-
function
|
|
3632
|
-
Object.keys(
|
|
3633
|
-
|
|
3751
|
+
function ri() {
|
|
3752
|
+
Object.keys(ti).forEach((e) => {
|
|
3753
|
+
ni(e);
|
|
3634
3754
|
});
|
|
3635
3755
|
}
|
|
3636
|
-
function
|
|
3637
|
-
u.register("text", $(
|
|
3756
|
+
function ii() {
|
|
3757
|
+
u.register("text", $(Ie), { namespace: "field" }), u.register("textarea", $(ft), { namespace: "field" }), u.register("number", $(ze), { namespace: "field" }), u.register("boolean", $(Z), { namespace: "field" }), u.register("select", $(qe), { namespace: "field" }), u.register("date", $(Xe), { namespace: "field" }), u.register("datetime", $(zt), { namespace: "field" }), u.register("time", $(Ht), { namespace: "field" }), u.register("email", $($e), { namespace: "field" }), u.register("phone", $(nt), { namespace: "field" }), u.register("url", $(at), { namespace: "field" }), u.register("currency", $(lt), { namespace: "field" }), u.register("percent", $(Gt), { namespace: "field" }), u.register("password", $(Jt), { namespace: "field" }), u.register("markdown", $(ht), { namespace: "field" }), u.register("html", $(ht), { namespace: "field" }), u.register("lookup", $(Pt), { namespace: "field" }), u.register("master_detail", $(Pt), { namespace: "field" }), u.register("file", $(Zt), { namespace: "field" }), u.register("image", $(rn), { namespace: "field" }), u.register("location", $(cn), { namespace: "field" }), u.register("formula", $(dn), { namespace: "field" }), u.register("summary", $(mn), { namespace: "field" }), u.register("auto_number", $(_n), { namespace: "field" }), u.register("user", $(bn), { namespace: "field" }), u.register("owner", $(bn), { namespace: "field" }), u.register("object", $(Cn), { namespace: "field" }), u.register("vector", $(En), { namespace: "field" }), u.register("grid", $(kn), { namespace: "field" }), u.register("color", $(Mn), { namespace: "field" }), u.register("slider", $(Fn), { namespace: "field" }), u.register("rating", $(Rn), { namespace: "field" }), u.register("code", $(Vn), { namespace: "field" }), u.register("avatar", $(Wn), { namespace: "field" }), u.register("address", $(qn), { namespace: "field" }), u.register("geolocation", $(Xn), { namespace: "field" }), u.register("signature", $($n), { namespace: "field" }), u.register("qrcode", $(nr), { namespace: "field" });
|
|
3638
3758
|
}
|
|
3639
|
-
|
|
3759
|
+
ri();
|
|
3640
3760
|
//#endregion
|
|
3641
|
-
export { qn as AddressField, _n as AutoNumberField, Wn as AvatarField,
|
|
3761
|
+
export { qn as AddressField, _n as AutoNumberField, Wn as AvatarField, wr as BooleanCellRenderer, Z as BooleanField, Vn as CodeField, Mn as ColorField, br as CurrencyCellRenderer, lt as CurrencyField, Tr as DateCellRenderer, Xe as DateField, Er as DateTimeCellRenderer, zt as DateTimeField, Lr as EmailCellRenderer, $e as EmailField, Br as FileCellRenderer, Zt as FileField, Ur as FormulaCellRenderer, dn as FormulaField, Xn as GeolocationField, kn as GridField, Vr as ImageCellRenderer, en as ImageCropperDialog, rn as ImageField, cn as LocationField, Hr as LookupCellRenderer, Pt as LookupField, ir as MasterDetailField, yr as NumberCellRenderer, ze as NumberField, Cn as ObjectField, Jt as PasswordField, Sr as PercentCellRenderer, Gt as PercentField, zr as PhoneCellRenderer, nt as PhoneField, nr as QRCodeField, Rn as RatingField, xt as RecordPickerDialog, ht as RichTextField, Ir as SelectCellRenderer, qe as SelectField, $n as SignatureField, Fn as SliderField, mn as SummaryField, ft as TextAreaField, vr as TextCellRenderer, Ie as TextField, Ht as TimeField, Rr as UrlCellRenderer, at as UrlField, Wr as UserCellRenderer, bn as UserField, En as VectorField, $r as buildValidationRules, Q as coerceToSafeValue, ei as evaluateCondition, dr as formatCompactCurrency, ur as formatCurrency, gr as formatDate, _r as formatDateTime, Qr as formatFileSize, fr as formatNumber, pr as formatPercent, hr as formatRelativeDate, Mr as getBadgeColorClasses, Xr as getCellRenderer, Nr as getSemanticColorName, Fr as getSemanticHex, mr as humanizeLabel, sr as isLikelyOpaqueId, Zr as mapFieldTypeToFormType, ri as registerAllFields, ni as registerField, Kr as registerFieldRenderer, ii as registerFields, Yr as resolveCellRendererType };
|