@object-ui/fields 11.0.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/FieldEditWidget.d.ts +13 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1058 -1002
- package/package.json +11 -11
- package/src/FieldEditWidget.tsx +91 -0
- package/src/index.tsx +1 -0
- package/src/widgets/LookupField.tsx +33 -10
package/dist/index.js
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
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
|
-
import { ComponentRegistry as u,
|
|
3
|
-
import { createSafeTranslation as
|
|
4
|
-
import { Avatar as
|
|
5
|
-
import { AlertCircle as
|
|
6
|
-
import { SchemaRendererContext as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useUpload as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
2
|
+
import { ComponentRegistry as u, getRecordDisplayName as d, percentDisplayValue as f, resolveFieldRuleState as p } from "@object-ui/core";
|
|
3
|
+
import { createSafeTranslation as m, resolveFieldCurrency as h, useLocalization as g } from "@object-ui/i18n";
|
|
4
|
+
import { Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Checkbox as S, Dialog as ee, DialogContent as C, DialogDescription as w, DialogFooter as te, DialogHeader as ne, DialogTitle as T, EmptyValue as E, Input as D, Label as O, Popover as re, PopoverContent as k, PopoverTrigger as A, RadioGroup as ie, RadioGroupItem as j, Select as ae, SelectContent as oe, SelectItem as se, SelectTrigger as ce, SelectValue as M, Skeleton as le, Slider as N, Switch as P, Table as ue, TableBody as F, TableCell as I, TableHead as de, TableHeader as fe, TableRow as pe, Textarea as L, cn as R } from "@object-ui/components";
|
|
5
|
+
import { AlertCircle as me, ArrowDown as z, ArrowUp as he, ArrowUpDown as ge, Camera as _e, Check as B, ChevronLeft as ve, ChevronRight as ye, Copy as V, Crop as H, Crosshair as be, Eraser as U, ExternalLink as W, Eye as G, EyeOff as xe, File as K, GripVertical as Se, Image as Ce, ImageIcon as we, Loader2 as Te, MapPin as q, Maximize2 as Ee, Phone as De, Plus as Oe, QrCode as ke, RotateCw as J, Search as Ae, SlidersHorizontal as je, Star as Me, TableProperties as Ne, Trash2 as Pe, Upload as Fe, X as Ie } from "lucide-react";
|
|
6
|
+
import { SchemaRendererContext as Le, useObjectTranslation as Re } from "@object-ui/react";
|
|
7
|
+
import { Fragment as ze, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
8
|
+
import { useUpload as Be } from "@object-ui/providers";
|
|
9
|
+
import Ve from "react-markdown";
|
|
10
|
+
import He from "remark-gfm";
|
|
11
|
+
import Ue from "rehype-sanitize";
|
|
12
12
|
//#region \0rolldown/runtime.js
|
|
13
|
-
var
|
|
13
|
+
var We = Object.defineProperty, Z = (e, t, n) => () => {
|
|
14
|
+
if (n) throw n[0];
|
|
15
|
+
try {
|
|
16
|
+
return e && (t = e(e = 0)), t;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw n = [e], e;
|
|
19
|
+
}
|
|
20
|
+
}, Q = (e, t) => {
|
|
14
21
|
let n = {};
|
|
15
|
-
for (var r in e)
|
|
22
|
+
for (var r in e) We(n, r, {
|
|
16
23
|
get: e[r],
|
|
17
24
|
enumerable: !0
|
|
18
25
|
});
|
|
19
|
-
return t ||
|
|
20
|
-
},
|
|
21
|
-
function
|
|
26
|
+
return t || We(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
27
|
+
}, Ge = /* @__PURE__ */ Q({ TextField: () => Ke });
|
|
28
|
+
function Ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
22
29
|
let a = n || i.schema;
|
|
23
30
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
24
31
|
className: "text-sm",
|
|
25
|
-
children: e || /* @__PURE__ */ Y(
|
|
32
|
+
children: e || /* @__PURE__ */ Y(E, {})
|
|
26
33
|
});
|
|
27
34
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
28
35
|
return o && o > 1 ? /* @__PURE__ */ Y(L, {
|
|
@@ -31,7 +38,7 @@ function Ge({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
31
38
|
onChange: (e) => t(e.target.value),
|
|
32
39
|
placeholder: a?.placeholder,
|
|
33
40
|
disabled: r || c.disabled
|
|
34
|
-
}) : /* @__PURE__ */ Y(
|
|
41
|
+
}) : /* @__PURE__ */ Y(D, {
|
|
35
42
|
...c,
|
|
36
43
|
type: a?.type === "password" ? "password" : "text",
|
|
37
44
|
value: e || "",
|
|
@@ -40,14 +47,14 @@ function Ge({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
40
47
|
disabled: r || c.disabled
|
|
41
48
|
});
|
|
42
49
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
if (r) return e == null ? /* @__PURE__ */ Y(
|
|
50
|
+
var qe = Z((() => {})), Je = /* @__PURE__ */ Q({ NumberField: () => Ye });
|
|
51
|
+
function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
52
|
+
if (r) return e == null ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("span", {
|
|
46
53
|
className: "text-sm",
|
|
47
54
|
children: e
|
|
48
55
|
});
|
|
49
56
|
let a = n || i.schema, o = a?.precision, { inputType: s, ...c } = i;
|
|
50
|
-
return /* @__PURE__ */ Y(
|
|
57
|
+
return /* @__PURE__ */ Y(D, {
|
|
51
58
|
...c,
|
|
52
59
|
type: "number",
|
|
53
60
|
value: e ?? "",
|
|
@@ -60,8 +67,8 @@ function Je({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
60
67
|
step: o ? 10 ** -o : "any"
|
|
61
68
|
});
|
|
62
69
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
70
|
+
var Xe = Z((() => {})), Ze = /* @__PURE__ */ Q({ BooleanField: () => Qe });
|
|
71
|
+
function Qe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
65
72
|
let a = n || i.schema, s = a?.widget, c = o(), l = a?.name || c, u = a?.label || "Checkbox";
|
|
66
73
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
67
74
|
className: "text-sm",
|
|
@@ -70,34 +77,34 @@ function Ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
70
77
|
let { inputType: d, ...f } = i;
|
|
71
78
|
return s === "checkbox" ? /* @__PURE__ */ X("div", {
|
|
72
79
|
className: "flex items-center space-x-2",
|
|
73
|
-
children: [/* @__PURE__ */ Y(
|
|
80
|
+
children: [/* @__PURE__ */ Y(S, {
|
|
74
81
|
...f,
|
|
75
82
|
id: l,
|
|
76
83
|
checked: !!e,
|
|
77
84
|
onCheckedChange: (e) => t(!!e),
|
|
78
85
|
disabled: r || f.disabled
|
|
79
|
-
}), /* @__PURE__ */ Y(
|
|
86
|
+
}), /* @__PURE__ */ Y(O, {
|
|
80
87
|
htmlFor: l,
|
|
81
88
|
className: "sr-only",
|
|
82
89
|
children: u
|
|
83
90
|
})]
|
|
84
91
|
}) : /* @__PURE__ */ X("div", {
|
|
85
92
|
className: "flex items-center space-x-2",
|
|
86
|
-
children: [/* @__PURE__ */ Y(
|
|
93
|
+
children: [/* @__PURE__ */ Y(P, {
|
|
87
94
|
...f,
|
|
88
95
|
id: l,
|
|
89
96
|
checked: !!e,
|
|
90
97
|
onCheckedChange: t,
|
|
91
98
|
disabled: r || f.disabled
|
|
92
|
-
}), /* @__PURE__ */ Y(
|
|
99
|
+
}), /* @__PURE__ */ Y(O, {
|
|
93
100
|
htmlFor: l,
|
|
94
101
|
className: "sr-only",
|
|
95
102
|
children: u
|
|
96
103
|
})]
|
|
97
104
|
});
|
|
98
105
|
}
|
|
99
|
-
var
|
|
100
|
-
|
|
106
|
+
var $e = Z((() => {})), et, tt, nt = Z((() => {
|
|
107
|
+
et = {
|
|
101
108
|
"common.selectOption": "Select an option",
|
|
102
109
|
"common.select": "Select...",
|
|
103
110
|
"common.search": "Search",
|
|
@@ -132,22 +139,22 @@ var Qe = Z((() => {})), $e, et, tt = Z((() => {
|
|
|
132
139
|
"lookup.nextPage": "Next page",
|
|
133
140
|
"lookup.jumpToPage": "Jump to page",
|
|
134
141
|
"lookup.retry": "Retry"
|
|
135
|
-
},
|
|
136
|
-
})),
|
|
137
|
-
function
|
|
138
|
-
let a = n || i.schema, o = a?.options || [], { t: s } =
|
|
142
|
+
}, tt = m(et, "common.selectOption");
|
|
143
|
+
})), rt = /* @__PURE__ */ Q({ SelectField: () => it });
|
|
144
|
+
function it({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
145
|
+
let a = n || i.schema, o = a?.options || [], { t: s } = tt(), c = i.name || a?.name || i.id || "";
|
|
139
146
|
if (r) {
|
|
140
147
|
let t = o.find((t) => t.value === e)?.label || e;
|
|
141
148
|
return t ? /* @__PURE__ */ Y("span", {
|
|
142
149
|
className: "text-sm",
|
|
143
150
|
children: t
|
|
144
|
-
}) : /* @__PURE__ */ Y(
|
|
151
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
145
152
|
}
|
|
146
153
|
return o.length === 0 ? /* @__PURE__ */ Y("div", {
|
|
147
154
|
"data-testid": c ? `select-empty-${c}` : void 0,
|
|
148
155
|
className: "flex h-9 w-full items-center rounded-md border border-input bg-muted/30 px-3 py-2 text-sm text-muted-foreground",
|
|
149
156
|
children: "No options available"
|
|
150
|
-
}) : /* @__PURE__ */ X(
|
|
157
|
+
}) : /* @__PURE__ */ X(ae, {
|
|
151
158
|
...i,
|
|
152
159
|
value: e,
|
|
153
160
|
onValueChange: t,
|
|
@@ -156,7 +163,7 @@ function rt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
156
163
|
className: i.className,
|
|
157
164
|
id: i.id,
|
|
158
165
|
"data-testid": c ? `select-trigger-${c}` : void 0,
|
|
159
|
-
children: /* @__PURE__ */ Y(
|
|
166
|
+
children: /* @__PURE__ */ Y(M, { placeholder: a?.placeholder || s("common.selectOption") })
|
|
160
167
|
}), /* @__PURE__ */ Y(oe, {
|
|
161
168
|
position: "popper",
|
|
162
169
|
children: o.map((e) => /* @__PURE__ */ Y(se, {
|
|
@@ -167,16 +174,16 @@ function rt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
167
174
|
})]
|
|
168
175
|
});
|
|
169
176
|
}
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
})),
|
|
173
|
-
function
|
|
177
|
+
var at = Z((() => {
|
|
178
|
+
nt();
|
|
179
|
+
})), ot = /* @__PURE__ */ Q({ DateField: () => st });
|
|
180
|
+
function st({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
174
181
|
if (r) return e ? /* @__PURE__ */ Y("span", {
|
|
175
182
|
className: "text-sm",
|
|
176
183
|
children: new Date(e).toLocaleDateString()
|
|
177
|
-
}) : /* @__PURE__ */ Y(
|
|
184
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
178
185
|
let { inputType: a, ...o } = i;
|
|
179
|
-
return /* @__PURE__ */ Y(
|
|
186
|
+
return /* @__PURE__ */ Y(D, {
|
|
180
187
|
...o,
|
|
181
188
|
type: "date",
|
|
182
189
|
value: e || "",
|
|
@@ -184,16 +191,16 @@ function ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
184
191
|
disabled: r || o.disabled
|
|
185
192
|
});
|
|
186
193
|
}
|
|
187
|
-
var
|
|
188
|
-
function
|
|
194
|
+
var ct = Z((() => {})), lt = /* @__PURE__ */ Q({ EmailField: () => ut });
|
|
195
|
+
function ut({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
189
196
|
let o = n || a.schema;
|
|
190
197
|
if (r) return e ? /* @__PURE__ */ Y("a", {
|
|
191
198
|
href: `mailto:${e}`,
|
|
192
199
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
193
200
|
children: e
|
|
194
|
-
}) : /* @__PURE__ */ Y(
|
|
201
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
195
202
|
let { inputType: s, ...c } = a;
|
|
196
|
-
return /* @__PURE__ */ Y(
|
|
203
|
+
return /* @__PURE__ */ Y(D, {
|
|
197
204
|
...c,
|
|
198
205
|
type: "email",
|
|
199
206
|
value: e || "",
|
|
@@ -203,16 +210,16 @@ function lt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
203
210
|
"aria-invalid": !!i
|
|
204
211
|
});
|
|
205
212
|
}
|
|
206
|
-
var
|
|
207
|
-
function
|
|
213
|
+
var dt = Z((() => {})), ft = /* @__PURE__ */ Q({ PhoneField: () => pt });
|
|
214
|
+
function pt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
208
215
|
let o = n || a.schema;
|
|
209
216
|
if (r) return e ? /* @__PURE__ */ Y("a", {
|
|
210
217
|
href: `tel:${e}`,
|
|
211
218
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
212
219
|
children: e
|
|
213
|
-
}) : /* @__PURE__ */ Y(
|
|
220
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
214
221
|
let { inputType: s, ...c } = a;
|
|
215
|
-
return /* @__PURE__ */ Y(
|
|
222
|
+
return /* @__PURE__ */ Y(D, {
|
|
216
223
|
...c,
|
|
217
224
|
type: "tel",
|
|
218
225
|
value: e || "",
|
|
@@ -222,8 +229,8 @@ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
222
229
|
"aria-invalid": !!i
|
|
223
230
|
});
|
|
224
231
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
232
|
+
var mt = Z((() => {})), ht = /* @__PURE__ */ Q({ UrlField: () => gt });
|
|
233
|
+
function gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
227
234
|
let o = n || a.schema;
|
|
228
235
|
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ Y("a", {
|
|
229
236
|
href: e,
|
|
@@ -234,9 +241,9 @@ function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
234
241
|
}) : /* @__PURE__ */ Y("span", {
|
|
235
242
|
className: "text-sm",
|
|
236
243
|
children: e
|
|
237
|
-
}) : /* @__PURE__ */ Y(
|
|
244
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
238
245
|
let { inputType: s, ...c } = a;
|
|
239
|
-
return /* @__PURE__ */ Y(
|
|
246
|
+
return /* @__PURE__ */ Y(D, {
|
|
240
247
|
...c,
|
|
241
248
|
type: "url",
|
|
242
249
|
value: e || "",
|
|
@@ -246,8 +253,8 @@ function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
246
253
|
"aria-invalid": !!i
|
|
247
254
|
});
|
|
248
255
|
}
|
|
249
|
-
var
|
|
250
|
-
function
|
|
256
|
+
var _t = Z((() => {})), vt = Z((() => {})), yt = /* @__PURE__ */ Q({ CurrencyField: () => xt });
|
|
257
|
+
function bt(e, t, n) {
|
|
251
258
|
if (t) try {
|
|
252
259
|
return new Intl.NumberFormat("en-US", {
|
|
253
260
|
style: "currency",
|
|
@@ -267,11 +274,11 @@ function yt(e, t, n) {
|
|
|
267
274
|
return e.toFixed(n);
|
|
268
275
|
}
|
|
269
276
|
}
|
|
270
|
-
function
|
|
271
|
-
let s = n || o.schema, { currency: c } =
|
|
272
|
-
if (r) return e == null ? /* @__PURE__ */ Y(
|
|
277
|
+
function xt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
278
|
+
let s = n || o.schema, { currency: c } = g(), l = h(s, c), u = s?.precision ?? 2;
|
|
279
|
+
if (r) return e == null ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("span", {
|
|
273
280
|
className: "text-sm font-medium tabular-nums",
|
|
274
|
-
children:
|
|
281
|
+
children: bt(Number(e), l, u)
|
|
275
282
|
});
|
|
276
283
|
let d = (e) => {
|
|
277
284
|
let n = parseFloat(e.target.value);
|
|
@@ -282,7 +289,7 @@ function bt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
282
289
|
children: [f && /* @__PURE__ */ Y("span", {
|
|
283
290
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
284
291
|
children: f
|
|
285
|
-
}), /* @__PURE__ */ Y(
|
|
292
|
+
}), /* @__PURE__ */ Y(D, {
|
|
286
293
|
...o,
|
|
287
294
|
type: "number",
|
|
288
295
|
value: e ?? "",
|
|
@@ -298,32 +305,32 @@ function bt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
298
305
|
})]
|
|
299
306
|
});
|
|
300
307
|
}
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
})),
|
|
304
|
-
function
|
|
308
|
+
var St = Z((() => {
|
|
309
|
+
vt();
|
|
310
|
+
})), Ct = /* @__PURE__ */ Q({ TextAreaField: () => wt });
|
|
311
|
+
function wt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
305
312
|
if (r) return /* @__PURE__ */ Y("div", {
|
|
306
313
|
className: "text-sm whitespace-pre-wrap",
|
|
307
|
-
children: e || /* @__PURE__ */ Y(
|
|
314
|
+
children: e || /* @__PURE__ */ Y(E, {})
|
|
308
315
|
});
|
|
309
316
|
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 ?? ""), h = () => {
|
|
310
317
|
m(e ?? ""), f(!0);
|
|
311
318
|
}, g = () => f(!1), _ = () => {
|
|
312
319
|
t(p), f(!1);
|
|
313
|
-
}, { inputType: v, mobileFullscreen: y, ...
|
|
320
|
+
}, { inputType: v, mobileFullscreen: y, ...b } = a;
|
|
314
321
|
return /* @__PURE__ */ X("div", {
|
|
315
322
|
className: "relative",
|
|
316
323
|
children: [
|
|
317
324
|
/* @__PURE__ */ Y(L, {
|
|
318
|
-
...
|
|
325
|
+
...b,
|
|
319
326
|
value: e || "",
|
|
320
327
|
onChange: (e) => t(e.target.value),
|
|
321
328
|
placeholder: o?.placeholder,
|
|
322
|
-
disabled: r ||
|
|
329
|
+
disabled: r || b.disabled,
|
|
323
330
|
rows: s,
|
|
324
331
|
maxLength: c,
|
|
325
332
|
"aria-invalid": !!i,
|
|
326
|
-
className:
|
|
333
|
+
className: b.className
|
|
327
334
|
}),
|
|
328
335
|
u && /* @__PURE__ */ Y("button", {
|
|
329
336
|
type: "button",
|
|
@@ -331,7 +338,7 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
331
338
|
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",
|
|
332
339
|
"aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
|
|
333
340
|
"data-testid": "textarea-fullscreen-toggle",
|
|
334
|
-
children: /* @__PURE__ */ Y(
|
|
341
|
+
children: /* @__PURE__ */ Y(Ee, { className: "size-3.5" })
|
|
335
342
|
}),
|
|
336
343
|
c && /* @__PURE__ */ X("div", {
|
|
337
344
|
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
@@ -343,16 +350,16 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
343
350
|
c
|
|
344
351
|
]
|
|
345
352
|
}),
|
|
346
|
-
u && /* @__PURE__ */ Y(
|
|
353
|
+
u && /* @__PURE__ */ Y(ee, {
|
|
347
354
|
open: d,
|
|
348
355
|
onOpenChange: f,
|
|
349
|
-
children: /* @__PURE__ */ X(
|
|
356
|
+
children: /* @__PURE__ */ X(C, {
|
|
350
357
|
className: "sm:max-w-3xl h-[100dvh] sm:h-[80vh] max-h-[100dvh] sm:max-h-[80vh] flex flex-col p-0 gap-0",
|
|
351
358
|
"data-testid": "textarea-fullscreen-dialog",
|
|
352
359
|
children: [
|
|
353
|
-
/* @__PURE__ */ Y(
|
|
360
|
+
/* @__PURE__ */ Y(ne, {
|
|
354
361
|
className: "p-4 border-b",
|
|
355
|
-
children: /* @__PURE__ */ Y(
|
|
362
|
+
children: /* @__PURE__ */ Y(T, {
|
|
356
363
|
className: "text-base",
|
|
357
364
|
children: o?.label ?? "Edit text"
|
|
358
365
|
})
|
|
@@ -369,7 +376,7 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
369
376
|
"data-testid": "textarea-fullscreen-input"
|
|
370
377
|
})
|
|
371
378
|
}),
|
|
372
|
-
/* @__PURE__ */ X(
|
|
379
|
+
/* @__PURE__ */ X(te, {
|
|
373
380
|
className: "p-3 border-t flex-row justify-between sm:justify-end gap-2",
|
|
374
381
|
children: [c && /* @__PURE__ */ X("span", {
|
|
375
382
|
className: "text-xs text-muted-foreground self-center",
|
|
@@ -380,16 +387,16 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
380
387
|
]
|
|
381
388
|
}), /* @__PURE__ */ X("div", {
|
|
382
389
|
className: "flex gap-2 ml-auto",
|
|
383
|
-
children: [/* @__PURE__ */ X(
|
|
390
|
+
children: [/* @__PURE__ */ X(x, {
|
|
384
391
|
type: "button",
|
|
385
392
|
variant: "ghost",
|
|
386
393
|
onClick: g,
|
|
387
|
-
children: [/* @__PURE__ */ Y(
|
|
388
|
-
}), /* @__PURE__ */ X(
|
|
394
|
+
children: [/* @__PURE__ */ Y(Ie, { className: "size-4 mr-1" }), " Cancel"]
|
|
395
|
+
}), /* @__PURE__ */ X(x, {
|
|
389
396
|
type: "button",
|
|
390
397
|
onClick: _,
|
|
391
398
|
"data-testid": "textarea-fullscreen-save",
|
|
392
|
-
children: [/* @__PURE__ */ Y(
|
|
399
|
+
children: [/* @__PURE__ */ Y(B, { className: "size-4 mr-1" }), " Done"]
|
|
393
400
|
})]
|
|
394
401
|
})]
|
|
395
402
|
})
|
|
@@ -399,12 +406,12 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
399
406
|
]
|
|
400
407
|
});
|
|
401
408
|
}
|
|
402
|
-
var
|
|
403
|
-
function
|
|
404
|
-
let { t: o } =
|
|
409
|
+
var Tt = Z((() => {})), Et = /* @__PURE__ */ Q({ RichTextField: () => Dt });
|
|
410
|
+
function Dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
411
|
+
let { t: o } = Re();
|
|
405
412
|
if (r) return /* @__PURE__ */ Y("div", {
|
|
406
413
|
className: "text-sm prose prose-sm max-w-none",
|
|
407
|
-
children: e || /* @__PURE__ */ Y(
|
|
414
|
+
children: e || /* @__PURE__ */ Y(E, {})
|
|
408
415
|
});
|
|
409
416
|
let s = n || a.schema, c = s?.rows || 8, l = s?.format || "markdown";
|
|
410
417
|
return /* @__PURE__ */ X("div", {
|
|
@@ -429,16 +436,16 @@ function Et({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
429
436
|
})]
|
|
430
437
|
});
|
|
431
438
|
}
|
|
432
|
-
var
|
|
439
|
+
var Ot = Z((() => {}));
|
|
433
440
|
//#endregion
|
|
434
441
|
//#region src/widgets/RecordPickerDialog.tsx
|
|
435
|
-
function
|
|
442
|
+
function kt(e) {
|
|
436
443
|
return typeof e == "string" ? { field: e } : e;
|
|
437
444
|
}
|
|
438
|
-
function
|
|
445
|
+
function At(e) {
|
|
439
446
|
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
440
447
|
}
|
|
441
|
-
function
|
|
448
|
+
function jt(e) {
|
|
442
449
|
let t = {};
|
|
443
450
|
for (let n of e) switch (n.operator) {
|
|
444
451
|
case "eq":
|
|
@@ -471,7 +478,7 @@ function At(e) {
|
|
|
471
478
|
}
|
|
472
479
|
return t;
|
|
473
480
|
}
|
|
474
|
-
function
|
|
481
|
+
function Mt(e, t) {
|
|
475
482
|
let n = {};
|
|
476
483
|
for (let r of t) {
|
|
477
484
|
let t = e[r.field];
|
|
@@ -479,17 +486,17 @@ function jt(e, t) {
|
|
|
479
486
|
}
|
|
480
487
|
return n;
|
|
481
488
|
}
|
|
482
|
-
function
|
|
483
|
-
let { t:
|
|
489
|
+
function Nt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: h = Pt, value: g, onSelect: _, onSelectRecords: v, lookupFilters: y, cellRenderer: b, filterColumns: w, renderFilterBar: E, renderGrid: re }) {
|
|
490
|
+
let { t: k } = tt(), [A, ie] = l([]), [j, N] = l(!1), [P, L] = l(null), [_e, V] = l(0), [H, be] = l(""), [U, W] = l(1), G = c(null), [xe, K] = l(null), [Se, Ce] = l("asc"), [we, q] = l(/* @__PURE__ */ new Set()), Ee = c(/* @__PURE__ */ new Map()), [De, Oe] = l(-1), ke = c(null), [J, Me] = l(!1), [Ne, Pe] = l({}), [Fe, Le] = l({}), Re = c(null), [Be, Ve] = l(""), He = s(() => d && d.length > 0 ? d.map(kt) : [{
|
|
484
491
|
field: f,
|
|
485
|
-
label:
|
|
492
|
+
label: At(f)
|
|
486
493
|
}], [d, f]), Ue = s(() => {
|
|
487
|
-
if (
|
|
494
|
+
if (w && w.length > 0) return w;
|
|
488
495
|
if (y && y.length > 0) return y.map((e) => {
|
|
489
496
|
let t = "text";
|
|
490
497
|
return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
|
|
491
498
|
field: e.field,
|
|
492
|
-
label:
|
|
499
|
+
label: At(e.field),
|
|
493
500
|
type: t,
|
|
494
501
|
...Array.isArray(e.value) ? { options: e.value.map((e) => {
|
|
495
502
|
if (typeof e == "object" && e) {
|
|
@@ -506,8 +513,8 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
506
513
|
}) } : {}
|
|
507
514
|
};
|
|
508
515
|
});
|
|
509
|
-
}, [
|
|
510
|
-
let e = y?.length ?
|
|
516
|
+
}, [w, y]), We = s(() => {
|
|
517
|
+
let e = y?.length ? jt(y) : {}, t = Ue?.length ? Mt(Ne, Ue) : {}, n = {
|
|
511
518
|
...e,
|
|
512
519
|
...t
|
|
513
520
|
};
|
|
@@ -516,21 +523,21 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
516
523
|
y,
|
|
517
524
|
Ue,
|
|
518
525
|
Ne
|
|
519
|
-
]),
|
|
526
|
+
]), Z = Math.max(1, Math.ceil(_e / h)), Q = r(async (e, t = 1, n, r) => {
|
|
520
527
|
if (!(!o || !u)) {
|
|
521
|
-
N(!0),
|
|
528
|
+
N(!0), L(null);
|
|
522
529
|
try {
|
|
523
530
|
let i = {
|
|
524
531
|
$top: h,
|
|
525
532
|
$skip: (t - 1) * h
|
|
526
533
|
};
|
|
527
534
|
e && e.trim() && (i.$search = e.trim()), n && (i.$orderby = { [n.field]: n.direction });
|
|
528
|
-
let a = r === void 0 ?
|
|
535
|
+
let a = r === void 0 ? We : r;
|
|
529
536
|
a && Object.keys(a).length > 0 && (i.$filter = a);
|
|
530
537
|
let s = await o.find(u, i), c = s?.data ?? s ?? [];
|
|
531
|
-
|
|
538
|
+
ie(c), V(s?.total ?? c.length), Oe(-1);
|
|
532
539
|
} catch (e) {
|
|
533
|
-
|
|
540
|
+
L(e instanceof Error ? e.message : String(e)), ie([]);
|
|
534
541
|
} finally {
|
|
535
542
|
N(!1);
|
|
536
543
|
}
|
|
@@ -539,20 +546,20 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
539
546
|
o,
|
|
540
547
|
u,
|
|
541
548
|
h,
|
|
542
|
-
|
|
549
|
+
We
|
|
543
550
|
]), Ge = s(() => xe ? {
|
|
544
551
|
field: xe,
|
|
545
|
-
direction:
|
|
546
|
-
} : null, [xe,
|
|
552
|
+
direction: Se
|
|
553
|
+
} : null, [xe, Se]);
|
|
547
554
|
a(() => {
|
|
548
|
-
e || (be(""), W(1),
|
|
555
|
+
e || (be(""), W(1), L(null), ie([]), K(null), Ce("asc"), Oe(-1), Me(!1), Pe({}), Le({}), Ve(""), q(new Set(i && Array.isArray(g) ? g : [])), Ee.current.clear());
|
|
549
556
|
}, [e]), a(() => {
|
|
550
|
-
e &&
|
|
557
|
+
e && Q(H || void 0, U, Ge);
|
|
551
558
|
}, [
|
|
552
559
|
e,
|
|
553
560
|
U,
|
|
554
561
|
Ge,
|
|
555
|
-
|
|
562
|
+
We
|
|
556
563
|
]), a(() => {
|
|
557
564
|
e && i && q(new Set(Array.isArray(g) ? g : []));
|
|
558
565
|
}, [
|
|
@@ -562,21 +569,21 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
562
569
|
]);
|
|
563
570
|
let Ke = r((e) => {
|
|
564
571
|
be(e), W(1), G.current && clearTimeout(G.current), G.current = setTimeout(() => {
|
|
565
|
-
|
|
572
|
+
Q(e || void 0, 1, Ge);
|
|
566
573
|
}, 300);
|
|
567
|
-
}, [
|
|
574
|
+
}, [Q, Ge]);
|
|
568
575
|
a(() => () => {
|
|
569
576
|
G.current && clearTimeout(G.current);
|
|
570
577
|
}, []);
|
|
571
578
|
let qe = r((e) => {
|
|
572
|
-
|
|
579
|
+
K((t) => t === e ? (Ce((e) => e === "asc" ? "desc" : "asc"), e) : (Ce("asc"), e)), W(1);
|
|
573
580
|
}, []), Je = r((e) => e[m] ?? e.id ?? e._id, [m]), Ye = r((e) => {
|
|
574
581
|
let t = Je(e);
|
|
575
|
-
return i ?
|
|
582
|
+
return i ? we.has(t) : g === t;
|
|
576
583
|
}, [
|
|
577
584
|
i,
|
|
578
585
|
g,
|
|
579
|
-
|
|
586
|
+
we,
|
|
580
587
|
Je
|
|
581
588
|
]), Xe = r((e) => {
|
|
582
589
|
let n = Je(e);
|
|
@@ -591,27 +598,27 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
591
598
|
v,
|
|
592
599
|
t
|
|
593
600
|
]), Ze = r(() => {
|
|
594
|
-
let e = Array.from(
|
|
601
|
+
let e = Array.from(we);
|
|
595
602
|
_(e);
|
|
596
603
|
let n = e.map((e) => Ee.current.get(e)).filter(Boolean);
|
|
597
604
|
v?.(n), t(!1);
|
|
598
605
|
}, [
|
|
599
|
-
|
|
606
|
+
we,
|
|
600
607
|
_,
|
|
601
608
|
v,
|
|
602
609
|
t
|
|
603
610
|
]), Qe = r(() => {
|
|
604
611
|
W((e) => Math.max(1, e - 1));
|
|
605
612
|
}, []), $e = r(() => {
|
|
606
|
-
W((e) => Math.min(
|
|
607
|
-
}, [
|
|
613
|
+
W((e) => Math.min(Z, e + 1));
|
|
614
|
+
}, [Z]), et = r((e) => {
|
|
608
615
|
if (e.key !== "Enter") return;
|
|
609
616
|
let t = parseInt(Be, 10);
|
|
610
|
-
!isNaN(t) && t >= 1 && t <=
|
|
611
|
-
}, [Be,
|
|
612
|
-
|
|
617
|
+
!isNaN(t) && t >= 1 && t <= Z && W(t), Ve("");
|
|
618
|
+
}, [Be, Z]), nt = r((e) => {
|
|
619
|
+
A.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Oe((e) => Math.min(e + 1, A.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Oe((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), De >= 0 && De < A.length && Xe(A[De])));
|
|
613
620
|
}, [
|
|
614
|
-
|
|
621
|
+
A,
|
|
615
622
|
De,
|
|
616
623
|
Xe
|
|
617
624
|
]);
|
|
@@ -633,8 +640,8 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
633
640
|
}
|
|
634
641
|
}
|
|
635
642
|
let n = e[t.field];
|
|
636
|
-
if (t.type &&
|
|
637
|
-
let e =
|
|
643
|
+
if (t.type && b) {
|
|
644
|
+
let e = b(t.type);
|
|
638
645
|
if (e) return /* @__PURE__ */ Y(e, {
|
|
639
646
|
value: n,
|
|
640
647
|
field: {
|
|
@@ -645,24 +652,24 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
645
652
|
}
|
|
646
653
|
return n == null ? "" : typeof n == "object" ? n.$numberDecimal ? String(Number(n.$numberDecimal)) : n.$oid ? String(n.$oid) : n.$date ? new Date(n.$date).toLocaleDateString() : n.name || n.label ? String(n.name || n.label) : JSON.stringify(n) : typeof n == "boolean" ? n ? "Yes" : "No" : String(n);
|
|
647
654
|
}, [
|
|
648
|
-
|
|
655
|
+
b,
|
|
649
656
|
p,
|
|
650
657
|
f
|
|
651
|
-
]), it = r((e) => xe === e ? Y(
|
|
652
|
-
e.preventDefault(), e.stopPropagation(),
|
|
658
|
+
]), it = r((e) => xe === e ? Y(Se === "asc" ? he : z, { className: "ml-1 size-3" }) : /* @__PURE__ */ Y(ge, { className: "ml-1 size-3 opacity-40" }), [xe, Se]), at = r((e, t, n) => {
|
|
659
|
+
e.preventDefault(), e.stopPropagation(), Re.current = {
|
|
653
660
|
field: t,
|
|
654
661
|
startX: e.clientX,
|
|
655
662
|
startWidth: n
|
|
656
663
|
};
|
|
657
664
|
let r = (e) => {
|
|
658
|
-
if (!
|
|
659
|
-
let t = e.clientX -
|
|
665
|
+
if (!Re.current) return;
|
|
666
|
+
let t = e.clientX - Re.current.startX, n = Math.max(Ft, Re.current.startWidth + t);
|
|
660
667
|
Le((e) => ({
|
|
661
668
|
...e,
|
|
662
|
-
[
|
|
669
|
+
[Re.current.field]: n
|
|
663
670
|
}));
|
|
664
671
|
}, i = () => {
|
|
665
|
-
|
|
672
|
+
Re.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
666
673
|
};
|
|
667
674
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
668
675
|
}, []), ot = r((e, t) => {
|
|
@@ -673,19 +680,19 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
673
680
|
}, []), st = r(() => {
|
|
674
681
|
Pe({}), W(1);
|
|
675
682
|
}, []), ct = s(() => Object.values(Ne).filter((e) => e != null && e !== "").length, [Ne]), lt = r((e) => {
|
|
676
|
-
let t = Ne[e.field], n = e.label ||
|
|
683
|
+
let t = Ne[e.field], n = e.label || At(e.field);
|
|
677
684
|
switch (e.type) {
|
|
678
685
|
case "select": return /* @__PURE__ */ X("div", {
|
|
679
686
|
className: "space-y-1",
|
|
680
|
-
children: [/* @__PURE__ */ Y(
|
|
687
|
+
children: [/* @__PURE__ */ Y(O, {
|
|
681
688
|
className: "text-xs text-muted-foreground",
|
|
682
689
|
children: n
|
|
683
|
-
}), /* @__PURE__ */ X(
|
|
690
|
+
}), /* @__PURE__ */ X(ae, {
|
|
684
691
|
value: t == null ? "" : String(t),
|
|
685
692
|
onValueChange: (t) => ot(e.field, t),
|
|
686
693
|
children: [/* @__PURE__ */ Y(ce, {
|
|
687
694
|
className: "h-8 text-xs",
|
|
688
|
-
children: /* @__PURE__ */ Y(
|
|
695
|
+
children: /* @__PURE__ */ Y(M, { placeholder: k("lookup.filterPlaceholder", { label: n }) })
|
|
689
696
|
}), /* @__PURE__ */ Y(oe, { children: e.options?.map((e) => /* @__PURE__ */ Y(se, {
|
|
690
697
|
value: String(e.value),
|
|
691
698
|
children: e.label
|
|
@@ -694,14 +701,14 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
694
701
|
});
|
|
695
702
|
case "number": return /* @__PURE__ */ X("div", {
|
|
696
703
|
className: "space-y-1",
|
|
697
|
-
children: [/* @__PURE__ */ Y(
|
|
704
|
+
children: [/* @__PURE__ */ Y(O, {
|
|
698
705
|
className: "text-xs text-muted-foreground",
|
|
699
706
|
children: n
|
|
700
|
-
}), /* @__PURE__ */ Y(
|
|
707
|
+
}), /* @__PURE__ */ Y(D, {
|
|
701
708
|
type: "number",
|
|
702
709
|
className: "h-8 text-xs",
|
|
703
710
|
value: t ?? "",
|
|
704
|
-
placeholder:
|
|
711
|
+
placeholder: k("lookup.filterPlaceholder", { label: n }),
|
|
705
712
|
onChange: (t) => {
|
|
706
713
|
let n = t.target.value;
|
|
707
714
|
ot(e.field, n === "" ? "" : Number(n));
|
|
@@ -710,10 +717,10 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
710
717
|
});
|
|
711
718
|
case "date": return /* @__PURE__ */ X("div", {
|
|
712
719
|
className: "space-y-1",
|
|
713
|
-
children: [/* @__PURE__ */ Y(
|
|
720
|
+
children: [/* @__PURE__ */ Y(O, {
|
|
714
721
|
className: "text-xs text-muted-foreground",
|
|
715
722
|
children: n
|
|
716
|
-
}), /* @__PURE__ */ Y(
|
|
723
|
+
}), /* @__PURE__ */ Y(D, {
|
|
717
724
|
type: "date",
|
|
718
725
|
className: "h-8 text-xs",
|
|
719
726
|
value: t ?? "",
|
|
@@ -722,42 +729,42 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
722
729
|
});
|
|
723
730
|
case "boolean": return /* @__PURE__ */ X("div", {
|
|
724
731
|
className: "space-y-1",
|
|
725
|
-
children: [/* @__PURE__ */ Y(
|
|
732
|
+
children: [/* @__PURE__ */ Y(O, {
|
|
726
733
|
className: "text-xs text-muted-foreground",
|
|
727
734
|
children: n
|
|
728
735
|
}), /* @__PURE__ */ X("div", {
|
|
729
736
|
className: "flex items-center gap-2 h-8",
|
|
730
|
-
children: [/* @__PURE__ */ Y(
|
|
737
|
+
children: [/* @__PURE__ */ Y(S, {
|
|
731
738
|
checked: !!t,
|
|
732
739
|
onCheckedChange: (t) => ot(e.field, !!t)
|
|
733
740
|
}), /* @__PURE__ */ Y("span", {
|
|
734
741
|
className: "text-xs text-muted-foreground",
|
|
735
|
-
children:
|
|
742
|
+
children: k("lookup.yes")
|
|
736
743
|
})]
|
|
737
744
|
})]
|
|
738
745
|
});
|
|
739
746
|
default: return /* @__PURE__ */ X("div", {
|
|
740
747
|
className: "space-y-1",
|
|
741
|
-
children: [/* @__PURE__ */ Y(
|
|
748
|
+
children: [/* @__PURE__ */ Y(O, {
|
|
742
749
|
className: "text-xs text-muted-foreground",
|
|
743
750
|
children: n
|
|
744
|
-
}), /* @__PURE__ */ Y(
|
|
751
|
+
}), /* @__PURE__ */ Y(D, {
|
|
745
752
|
className: "h-8 text-xs",
|
|
746
753
|
value: t ?? "",
|
|
747
|
-
placeholder:
|
|
754
|
+
placeholder: k("lookup.filterPlaceholder", { label: n }),
|
|
748
755
|
onChange: (t) => ot(e.field, t.target.value)
|
|
749
756
|
})]
|
|
750
757
|
});
|
|
751
758
|
}
|
|
752
759
|
}, [Ne, ot]), ut = 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", []);
|
|
753
|
-
return /* @__PURE__ */ Y(
|
|
760
|
+
return /* @__PURE__ */ Y(ee, {
|
|
754
761
|
open: e,
|
|
755
762
|
onOpenChange: t,
|
|
756
|
-
children: /* @__PURE__ */ X(
|
|
763
|
+
children: /* @__PURE__ */ X(C, {
|
|
757
764
|
className: "w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0",
|
|
758
765
|
"data-testid": "record-picker-dialog",
|
|
759
766
|
children: [
|
|
760
|
-
/* @__PURE__ */ Y(
|
|
767
|
+
/* @__PURE__ */ Y(ne, { children: /* @__PURE__ */ X(T, { children: [n, i && /* @__PURE__ */ Y("span", {
|
|
761
768
|
className: "sr-only",
|
|
762
769
|
children: " (multiple selection)"
|
|
763
770
|
})] }) }),
|
|
@@ -765,14 +772,14 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
765
772
|
className: "relative rounded-md border bg-muted/30 mb-3",
|
|
766
773
|
children: [
|
|
767
774
|
/* @__PURE__ */ Y(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
768
|
-
/* @__PURE__ */ Y(
|
|
769
|
-
placeholder:
|
|
770
|
-
value:
|
|
775
|
+
/* @__PURE__ */ Y(D, {
|
|
776
|
+
placeholder: k("table.search"),
|
|
777
|
+
value: H,
|
|
771
778
|
onChange: (e) => Ke(e.target.value),
|
|
772
779
|
className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
|
|
773
780
|
"data-testid": "record-picker-search"
|
|
774
781
|
}),
|
|
775
|
-
|
|
782
|
+
j && /* @__PURE__ */ Y(Te, {
|
|
776
783
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
777
784
|
"data-testid": "record-picker-loading-indicator"
|
|
778
785
|
})
|
|
@@ -780,135 +787,135 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
780
787
|
}),
|
|
781
788
|
Ue && Ue.length > 0 && /* @__PURE__ */ Y("div", {
|
|
782
789
|
className: "py-2",
|
|
783
|
-
children:
|
|
790
|
+
children: E ? /* @__PURE__ */ Y("div", {
|
|
784
791
|
"data-testid": "record-picker-filter-bar",
|
|
785
|
-
children:
|
|
792
|
+
children: E({
|
|
786
793
|
filterColumns: Ue,
|
|
787
794
|
values: Ne,
|
|
788
795
|
onChange: ot,
|
|
789
796
|
onClear: st,
|
|
790
797
|
activeCount: ct
|
|
791
798
|
})
|
|
792
|
-
}) : /* @__PURE__ */ X(
|
|
799
|
+
}) : /* @__PURE__ */ X(ze, { children: [/* @__PURE__ */ X("div", {
|
|
793
800
|
className: "flex items-center gap-2",
|
|
794
801
|
"data-testid": "record-picker-filter-bar",
|
|
795
|
-
children: [/* @__PURE__ */ X(
|
|
802
|
+
children: [/* @__PURE__ */ X(x, {
|
|
796
803
|
type: "button",
|
|
797
804
|
variant: ct > 0 ? "secondary" : "outline",
|
|
798
805
|
size: "sm",
|
|
799
806
|
className: "gap-1.5 shrink-0",
|
|
800
807
|
onClick: () => Me((e) => !e),
|
|
801
808
|
children: [
|
|
802
|
-
/* @__PURE__ */ Y(
|
|
803
|
-
|
|
809
|
+
/* @__PURE__ */ Y(je, { className: "size-3.5" }),
|
|
810
|
+
k("lookup.filters"),
|
|
804
811
|
ct > 0 && /* @__PURE__ */ Y("span", {
|
|
805
812
|
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",
|
|
806
813
|
children: ct
|
|
807
814
|
})
|
|
808
815
|
]
|
|
809
|
-
}), ct > 0 && /* @__PURE__ */ X(
|
|
816
|
+
}), ct > 0 && /* @__PURE__ */ X(x, {
|
|
810
817
|
type: "button",
|
|
811
818
|
variant: "ghost",
|
|
812
819
|
size: "sm",
|
|
813
820
|
className: "gap-1 text-xs",
|
|
814
821
|
onClick: st,
|
|
815
|
-
children: [/* @__PURE__ */ Y(
|
|
822
|
+
children: [/* @__PURE__ */ Y(Ie, { className: "size-3" }), k("lookup.clear")]
|
|
816
823
|
})]
|
|
817
|
-
}),
|
|
824
|
+
}), J && /* @__PURE__ */ Y("div", {
|
|
818
825
|
className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
|
|
819
826
|
"data-testid": "record-picker-filter-panel",
|
|
820
827
|
children: Ue.map((e) => /* @__PURE__ */ Y("div", { children: lt(e) }, e.field))
|
|
821
828
|
})] })
|
|
822
829
|
}),
|
|
823
|
-
|
|
830
|
+
P && /* @__PURE__ */ X("div", {
|
|
824
831
|
className: "flex flex-col items-center gap-2 py-4",
|
|
825
832
|
role: "alert",
|
|
826
833
|
children: [
|
|
827
|
-
/* @__PURE__ */ Y(
|
|
834
|
+
/* @__PURE__ */ Y(me, { className: "size-5 text-destructive" }),
|
|
828
835
|
/* @__PURE__ */ Y("p", {
|
|
829
836
|
className: "text-sm text-destructive",
|
|
830
|
-
children:
|
|
837
|
+
children: P
|
|
831
838
|
}),
|
|
832
|
-
/* @__PURE__ */ Y(
|
|
839
|
+
/* @__PURE__ */ Y(x, {
|
|
833
840
|
variant: "outline",
|
|
834
841
|
size: "sm",
|
|
835
|
-
onClick: () =>
|
|
842
|
+
onClick: () => Q(H || void 0, U, Ge),
|
|
836
843
|
type: "button",
|
|
837
|
-
children:
|
|
844
|
+
children: k("lookup.retry")
|
|
838
845
|
})
|
|
839
846
|
]
|
|
840
847
|
}),
|
|
841
|
-
|
|
848
|
+
re ? /* @__PURE__ */ Y("div", {
|
|
842
849
|
className: "flex-1 min-h-0",
|
|
843
850
|
"data-testid": "record-picker-grid-slot",
|
|
844
|
-
children:
|
|
851
|
+
children: re({
|
|
845
852
|
columns: He,
|
|
846
|
-
records:
|
|
847
|
-
loading:
|
|
848
|
-
totalCount:
|
|
853
|
+
records: A,
|
|
854
|
+
loading: j,
|
|
855
|
+
totalCount: _e,
|
|
849
856
|
currentPage: U,
|
|
850
857
|
pageSize: h,
|
|
851
858
|
sortField: xe,
|
|
852
|
-
sortDirection:
|
|
859
|
+
sortDirection: Se,
|
|
853
860
|
onSort: qe,
|
|
854
861
|
onPageChange: W,
|
|
855
862
|
onRowClick: Xe,
|
|
856
863
|
isSelected: Ye,
|
|
857
864
|
multiple: i,
|
|
858
865
|
idField: m,
|
|
859
|
-
cellRenderer:
|
|
866
|
+
cellRenderer: b
|
|
860
867
|
})
|
|
861
|
-
}) : /* @__PURE__ */ X(
|
|
862
|
-
|
|
868
|
+
}) : /* @__PURE__ */ X(ze, { children: [
|
|
869
|
+
j && A.length === 0 && !P && /* @__PURE__ */ Y("div", {
|
|
863
870
|
className: "flex-1 overflow-hidden min-h-0 border rounded-md",
|
|
864
871
|
role: "status",
|
|
865
872
|
"aria-live": "polite",
|
|
866
873
|
"data-testid": "record-picker-skeleton",
|
|
867
|
-
children: /* @__PURE__ */ X(
|
|
874
|
+
children: /* @__PURE__ */ X(ue, { children: [/* @__PURE__ */ Y(fe, { children: /* @__PURE__ */ X(pe, {
|
|
868
875
|
className: "bg-muted/40",
|
|
869
|
-
children: [i && /* @__PURE__ */ Y(
|
|
870
|
-
}) }), /* @__PURE__ */ Y(
|
|
876
|
+
children: [i && /* @__PURE__ */ Y(de, { className: "w-10" }), He.map((e) => /* @__PURE__ */ Y(de, { children: /* @__PURE__ */ Y(le, { className: "h-4 w-20" }) }, e.field))]
|
|
877
|
+
}) }), /* @__PURE__ */ Y(F, { children: Array.from({ length: It }, (e, t) => /* @__PURE__ */ X(pe, { children: [i && /* @__PURE__ */ Y(I, {
|
|
871
878
|
className: "w-10",
|
|
872
|
-
children: /* @__PURE__ */ Y(
|
|
873
|
-
}), He.map((e) => /* @__PURE__ */ Y(
|
|
879
|
+
children: /* @__PURE__ */ Y(le, { className: "size-4 rounded" })
|
|
880
|
+
}), He.map((e) => /* @__PURE__ */ Y(I, { children: /* @__PURE__ */ Y(le, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
874
881
|
}),
|
|
875
|
-
!
|
|
882
|
+
!j && !P && A.length === 0 && /* @__PURE__ */ Y("div", {
|
|
876
883
|
className: "py-8 text-center",
|
|
877
884
|
children: /* @__PURE__ */ Y("p", {
|
|
878
885
|
className: "text-sm text-muted-foreground",
|
|
879
|
-
children:
|
|
886
|
+
children: k("lookup.noRecords")
|
|
880
887
|
})
|
|
881
888
|
}),
|
|
882
|
-
!
|
|
889
|
+
!P && A.length > 0 && /* @__PURE__ */ X("div", {
|
|
883
890
|
className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
|
|
884
|
-
"aria-busy":
|
|
885
|
-
"data-state":
|
|
891
|
+
"aria-busy": j || void 0,
|
|
892
|
+
"data-state": j ? "loading" : "idle",
|
|
886
893
|
tabIndex: 0,
|
|
887
894
|
onKeyDown: nt,
|
|
888
895
|
role: "grid",
|
|
889
896
|
"aria-label": "Records",
|
|
890
|
-
children: [
|
|
897
|
+
children: [j && /* @__PURE__ */ Y("div", {
|
|
891
898
|
className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
|
|
892
899
|
"data-testid": "record-picker-loading-overlay",
|
|
893
|
-
children: /* @__PURE__ */ Y(
|
|
894
|
-
}), /* @__PURE__ */ X(
|
|
895
|
-
style: Object.keys(
|
|
896
|
-
children: [/* @__PURE__ */ Y(
|
|
900
|
+
children: /* @__PURE__ */ Y(Te, { className: "size-6 animate-spin text-muted-foreground" })
|
|
901
|
+
}), /* @__PURE__ */ X(ue, {
|
|
902
|
+
style: Object.keys(Fe).length > 0 ? { tableLayout: "fixed" } : void 0,
|
|
903
|
+
children: [/* @__PURE__ */ Y(fe, {
|
|
897
904
|
className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
|
|
898
905
|
"data-testid": "record-picker-sticky-header",
|
|
899
|
-
children: /* @__PURE__ */ X(
|
|
900
|
-
let t =
|
|
901
|
-
return /* @__PURE__ */ X(
|
|
906
|
+
children: /* @__PURE__ */ X(pe, { children: [i && /* @__PURE__ */ Y(de, { className: "w-10" }), He.map((e) => {
|
|
907
|
+
let t = Fe[e.field];
|
|
908
|
+
return /* @__PURE__ */ X(de, {
|
|
902
909
|
style: t ? {
|
|
903
910
|
width: `${t}px`,
|
|
904
911
|
minWidth: `${t}px`
|
|
905
912
|
} : e.width ? { width: e.width } : void 0,
|
|
906
913
|
className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
|
|
907
914
|
onClick: () => qe(e.field),
|
|
908
|
-
"aria-sort": xe === e.field ?
|
|
915
|
+
"aria-sort": xe === e.field ? Se === "asc" ? "ascending" : "descending" : "none",
|
|
909
916
|
children: [/* @__PURE__ */ X("span", {
|
|
910
917
|
className: "inline-flex items-center",
|
|
911
|
-
children: [e.label ||
|
|
918
|
+
children: [e.label || At(e.field), it(e.field)]
|
|
912
919
|
}), /* @__PURE__ */ Y("span", {
|
|
913
920
|
role: "separator",
|
|
914
921
|
"aria-orientation": "vertical",
|
|
@@ -922,20 +929,20 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
922
929
|
})]
|
|
923
930
|
}, e.field);
|
|
924
931
|
})] })
|
|
925
|
-
}), /* @__PURE__ */ Y(
|
|
932
|
+
}), /* @__PURE__ */ Y(F, {
|
|
926
933
|
ref: ke,
|
|
927
|
-
children:
|
|
934
|
+
children: A.map((e, t) => {
|
|
928
935
|
let n = Je(e), r = Ye(e), a = t === De;
|
|
929
|
-
return /* @__PURE__ */ X(
|
|
936
|
+
return /* @__PURE__ */ X(pe, {
|
|
930
937
|
"data-row-index": t,
|
|
931
938
|
className: R("cursor-pointer transition-colors", ut(r, t), a && "ring-2 ring-primary ring-inset"),
|
|
932
939
|
onClick: () => Xe(e),
|
|
933
940
|
"data-testid": `record-row-${n}`,
|
|
934
941
|
"aria-selected": r,
|
|
935
|
-
children: [i && /* @__PURE__ */ Y(
|
|
942
|
+
children: [i && /* @__PURE__ */ Y(I, {
|
|
936
943
|
className: "w-10",
|
|
937
|
-
children: r && /* @__PURE__ */ Y(
|
|
938
|
-
}), He.map((t) => /* @__PURE__ */ Y(
|
|
944
|
+
children: r && /* @__PURE__ */ Y(B, { className: "size-4 text-primary" })
|
|
945
|
+
}), He.map((t) => /* @__PURE__ */ Y(I, {
|
|
939
946
|
className: "py-2.5",
|
|
940
947
|
children: rt(e, t)
|
|
941
948
|
}, t.field))]
|
|
@@ -944,64 +951,64 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
944
951
|
})]
|
|
945
952
|
})]
|
|
946
953
|
}),
|
|
947
|
-
!
|
|
954
|
+
!P && _e > 0 && /* @__PURE__ */ X("div", {
|
|
948
955
|
className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
|
|
949
956
|
"data-testid": "record-picker-pagination",
|
|
950
|
-
children: [/* @__PURE__ */ X("span", { children: [
|
|
957
|
+
children: [/* @__PURE__ */ X("span", { children: [_e === 1 ? k("lookup.recordCountOne") : k("lookup.recordCount", { count: _e }), Z > 1 && ` · ${k("lookup.pageOf", {
|
|
951
958
|
current: U,
|
|
952
|
-
total:
|
|
953
|
-
})}`] }),
|
|
959
|
+
total: Z
|
|
960
|
+
})}`] }), Z > 1 && /* @__PURE__ */ X("div", {
|
|
954
961
|
className: "flex items-center gap-1.5",
|
|
955
962
|
children: [
|
|
956
|
-
/* @__PURE__ */ Y(
|
|
963
|
+
/* @__PURE__ */ Y(x, {
|
|
957
964
|
variant: "outline",
|
|
958
965
|
size: "icon",
|
|
959
966
|
className: "size-7",
|
|
960
967
|
onClick: Qe,
|
|
961
968
|
disabled: U <= 1,
|
|
962
969
|
type: "button",
|
|
963
|
-
"aria-label":
|
|
964
|
-
children: /* @__PURE__ */ Y(
|
|
970
|
+
"aria-label": k("lookup.prevPage"),
|
|
971
|
+
children: /* @__PURE__ */ Y(ve, { className: "size-4" })
|
|
965
972
|
}),
|
|
966
|
-
/* @__PURE__ */ Y(
|
|
973
|
+
/* @__PURE__ */ Y(D, {
|
|
967
974
|
className: "h-7 w-12 text-center text-xs px-1",
|
|
968
975
|
placeholder: String(U),
|
|
969
976
|
value: Be,
|
|
970
977
|
onChange: (e) => Ve(e.target.value),
|
|
971
|
-
onKeyDown:
|
|
972
|
-
"aria-label":
|
|
978
|
+
onKeyDown: et,
|
|
979
|
+
"aria-label": k("lookup.jumpToPage"),
|
|
973
980
|
"data-testid": "record-picker-page-jump"
|
|
974
981
|
}),
|
|
975
|
-
/* @__PURE__ */ Y(
|
|
982
|
+
/* @__PURE__ */ Y(x, {
|
|
976
983
|
variant: "outline",
|
|
977
984
|
size: "icon",
|
|
978
985
|
className: "size-7",
|
|
979
986
|
onClick: $e,
|
|
980
|
-
disabled: U >=
|
|
987
|
+
disabled: U >= Z,
|
|
981
988
|
type: "button",
|
|
982
|
-
"aria-label":
|
|
983
|
-
children: /* @__PURE__ */ Y(
|
|
989
|
+
"aria-label": k("lookup.nextPage"),
|
|
990
|
+
children: /* @__PURE__ */ Y(ye, { className: "size-4" })
|
|
984
991
|
})
|
|
985
992
|
]
|
|
986
993
|
})]
|
|
987
994
|
})
|
|
988
995
|
] }),
|
|
989
|
-
i && /* @__PURE__ */ Y(
|
|
996
|
+
i && /* @__PURE__ */ Y(te, { children: /* @__PURE__ */ X("div", {
|
|
990
997
|
className: "flex items-center gap-2 w-full justify-between",
|
|
991
998
|
children: [/* @__PURE__ */ Y("span", {
|
|
992
999
|
className: "text-sm text-muted-foreground",
|
|
993
|
-
children:
|
|
1000
|
+
children: k("table.selected", { count: we.size })
|
|
994
1001
|
}), /* @__PURE__ */ X("div", {
|
|
995
1002
|
className: "flex gap-2",
|
|
996
|
-
children: [/* @__PURE__ */ Y(
|
|
1003
|
+
children: [/* @__PURE__ */ Y(x, {
|
|
997
1004
|
variant: "outline",
|
|
998
1005
|
type: "button",
|
|
999
1006
|
onClick: () => t(!1),
|
|
1000
|
-
children:
|
|
1001
|
-
}), /* @__PURE__ */ Y(
|
|
1007
|
+
children: k("common.cancel")
|
|
1008
|
+
}), /* @__PURE__ */ Y(x, {
|
|
1002
1009
|
type: "button",
|
|
1003
1010
|
onClick: Ze,
|
|
1004
|
-
children:
|
|
1011
|
+
children: k("common.confirm")
|
|
1005
1012
|
})]
|
|
1006
1013
|
})]
|
|
1007
1014
|
}) })
|
|
@@ -1009,17 +1016,17 @@ function Mt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
|
|
|
1009
1016
|
})
|
|
1010
1017
|
});
|
|
1011
1018
|
}
|
|
1012
|
-
var
|
|
1013
|
-
|
|
1019
|
+
var Pt, Ft, It, Lt = Z((() => {
|
|
1020
|
+
nt(), Pt = 10, Ft = 60, It = 5;
|
|
1014
1021
|
}));
|
|
1015
1022
|
//#endregion
|
|
1016
1023
|
//#region src/widgets/deriveLookupColumns.ts
|
|
1017
|
-
function
|
|
1024
|
+
function Rt(e) {
|
|
1018
1025
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1019
1026
|
for (let r of e) t.has(r) || (t.add(r), n.push(r));
|
|
1020
1027
|
return n;
|
|
1021
1028
|
}
|
|
1022
|
-
function
|
|
1029
|
+
function zt(e, { displayField: t, max: n = 4 }) {
|
|
1023
1030
|
let r = e?.fields ?? {}, i = (e) => r[e] ?? {}, a = (e) => {
|
|
1024
1031
|
let t = i(e);
|
|
1025
1032
|
return {
|
|
@@ -1030,14 +1037,14 @@ function Rt(e, { displayField: t, max: n = 4 }) {
|
|
|
1030
1037
|
};
|
|
1031
1038
|
if (Object.keys(r).length === 0) return [];
|
|
1032
1039
|
let o = e?.displayFields;
|
|
1033
|
-
return Array.isArray(o) && o.length > 0 ?
|
|
1034
|
-
if (e === t ||
|
|
1040
|
+
return Array.isArray(o) && o.length > 0 ? Rt([t, ...o.filter((e) => typeof e == "string" && e.length > 0).filter((e) => e !== t)]).slice(0, n).map(a) : Rt([t, ...Object.keys(r).filter((e) => {
|
|
1041
|
+
if (e === t || Bt.has(e)) return !1;
|
|
1035
1042
|
let n = i(e);
|
|
1036
|
-
return !(n.hidden || n.type &&
|
|
1043
|
+
return !(n.hidden || n.type && Vt.has(n.type));
|
|
1037
1044
|
})]).slice(0, n).map(a);
|
|
1038
1045
|
}
|
|
1039
|
-
var
|
|
1040
|
-
|
|
1046
|
+
var Bt, Vt, Ht = Z((() => {
|
|
1047
|
+
Bt = /* @__PURE__ */ new Set([
|
|
1041
1048
|
"id",
|
|
1042
1049
|
"_id",
|
|
1043
1050
|
"created",
|
|
@@ -1055,7 +1062,7 @@ var zt, Bt, Vt = Z((() => {
|
|
|
1055
1062
|
"locked",
|
|
1056
1063
|
"is_deleted",
|
|
1057
1064
|
"deleted"
|
|
1058
|
-
]),
|
|
1065
|
+
]), Vt = /* @__PURE__ */ new Set([
|
|
1059
1066
|
"json",
|
|
1060
1067
|
"object",
|
|
1061
1068
|
"grid",
|
|
@@ -1077,45 +1084,45 @@ var zt, Bt, Vt = Z((() => {
|
|
|
1077
1084
|
}));
|
|
1078
1085
|
//#endregion
|
|
1079
1086
|
//#region src/widgets/recentLookups.ts
|
|
1080
|
-
function
|
|
1087
|
+
function Ut() {
|
|
1081
1088
|
try {
|
|
1082
1089
|
return typeof localStorage < "u" ? localStorage : null;
|
|
1083
1090
|
} catch {
|
|
1084
1091
|
return null;
|
|
1085
1092
|
}
|
|
1086
1093
|
}
|
|
1087
|
-
function
|
|
1088
|
-
let t =
|
|
1094
|
+
function Wt(e) {
|
|
1095
|
+
let t = Ut();
|
|
1089
1096
|
if (!e || !t) return [];
|
|
1090
1097
|
try {
|
|
1091
|
-
let n = t.getItem(
|
|
1098
|
+
let n = t.getItem(Kt + e);
|
|
1092
1099
|
if (!n) return [];
|
|
1093
1100
|
let r = JSON.parse(n);
|
|
1094
|
-
return Array.isArray(r) ? r.slice(0,
|
|
1101
|
+
return Array.isArray(r) ? r.slice(0, qt) : [];
|
|
1095
1102
|
} catch {
|
|
1096
1103
|
return [];
|
|
1097
1104
|
}
|
|
1098
1105
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let n =
|
|
1106
|
+
function Gt(e, t) {
|
|
1107
|
+
let n = Ut();
|
|
1101
1108
|
if (!(!e || t == null || t === "" || !n)) try {
|
|
1102
|
-
let r = [t, ...
|
|
1103
|
-
n.setItem(
|
|
1109
|
+
let r = [t, ...Wt(e).filter((e) => e !== t)].slice(0, qt);
|
|
1110
|
+
n.setItem(Kt + e, JSON.stringify(r));
|
|
1104
1111
|
} catch {}
|
|
1105
1112
|
}
|
|
1106
|
-
var
|
|
1107
|
-
|
|
1113
|
+
var Kt, qt, Jt = Z((() => {
|
|
1114
|
+
Kt = "objectui:lookup:recent:", qt = 5;
|
|
1108
1115
|
}));
|
|
1109
1116
|
//#endregion
|
|
1110
1117
|
//#region src/widgets/_cell-renderer-bridge.ts
|
|
1111
|
-
function
|
|
1112
|
-
|
|
1118
|
+
function Yt(e) {
|
|
1119
|
+
Zt = e;
|
|
1113
1120
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1121
|
+
function Xt() {
|
|
1122
|
+
return Zt;
|
|
1116
1123
|
}
|
|
1117
|
-
var
|
|
1118
|
-
function
|
|
1124
|
+
var Zt, Qt = Z((() => {})), $t = /* @__PURE__ */ Q({ LookupField: () => rn });
|
|
1125
|
+
function en(e, t) {
|
|
1119
1126
|
if (!e || typeof e != "object" || !t) return null;
|
|
1120
1127
|
let n = "[-\\u2013\\u2014|/·,:]", r = !1, i = t.replace(/\{([^{}]+)\}/g, (t, n) => {
|
|
1121
1128
|
let i = e[n.trim()];
|
|
@@ -1123,16 +1130,21 @@ function $t(e, t) {
|
|
|
1123
1130
|
});
|
|
1124
1131
|
return r && i.replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(/* @__PURE__ */ RegExp("\0", "g"), "").replace(/\s+/g, " ").trim() || null;
|
|
1125
1132
|
}
|
|
1126
|
-
function
|
|
1127
|
-
let
|
|
1133
|
+
function tn(e, t, n, r, i, a) {
|
|
1134
|
+
let o = e[n] ?? e.id ?? e._id, s = i ? en(e, i) : null, c;
|
|
1135
|
+
if (a) {
|
|
1136
|
+
let t = d(a, e), n = e?.id ?? e?._id;
|
|
1137
|
+
t === "Untitled" || n != null && t === `Record #${n}` || (c = t);
|
|
1138
|
+
}
|
|
1139
|
+
let l = s ?? e[t] ?? c ?? e.label ?? e.name ?? e.full_name ?? e.title ?? e.subject ?? String(o), u = r ? e[r] : void 0;
|
|
1128
1140
|
return {
|
|
1129
|
-
value:
|
|
1130
|
-
label: String(
|
|
1131
|
-
description:
|
|
1141
|
+
value: o,
|
|
1142
|
+
label: String(l),
|
|
1143
|
+
description: u,
|
|
1132
1144
|
...e
|
|
1133
1145
|
};
|
|
1134
1146
|
}
|
|
1135
|
-
function
|
|
1147
|
+
function nn(e) {
|
|
1136
1148
|
return {
|
|
1137
1149
|
text: "text",
|
|
1138
1150
|
number: "number",
|
|
@@ -1145,9 +1157,9 @@ function tn(e) {
|
|
|
1145
1157
|
boolean: "boolean"
|
|
1146
1158
|
}[e];
|
|
1147
1159
|
}
|
|
1148
|
-
function
|
|
1149
|
-
let [f, p] = l(!1), [m, h] = l(""), { t: g } =
|
|
1150
|
-
let e =
|
|
1160
|
+
function rn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
1161
|
+
let [f, p] = l(!1), [m, h] = l(""), { t: g } = tt(), _ = e.useId(), [v, y] = l([]), [S, ee] = l(!1), [C, w] = l(null), [te, ne] = l(0), T = c(null), [O, ie] = l([]), [j, ae] = l(-1), oe = c(null), se = o || d.schema, ce = se?.field, M = ce && typeof ce == "object" && ("reference_to" in ce || "reference" in ce || "type" in ce) ? ce : se, le = M?.options || [], N = M?.multiple || !1, P = M?.display_field || M?.displayField || M?.reference_field || "name", ue = M?.description_field ?? M?.descriptionField, F = M?.id_field || "id", I = M?.reference_to || M?.reference, de = !!(M?.allow_create ?? M?.allowCreate), fe = M?.lookup_columns ?? M?.lookupColumns, pe = M?.lookup_page_size ?? M?.lookupPageSize, L = M?.lookup_filters ?? M?.lookupFilters, z = s(() => {
|
|
1162
|
+
let e = M?.depends_on ?? M?.dependsOn;
|
|
1151
1163
|
return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
|
|
1152
1164
|
field: e,
|
|
1153
1165
|
param: e
|
|
@@ -1155,14 +1167,14 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1155
1167
|
field: e.field,
|
|
1156
1168
|
param: e.param ?? e.field
|
|
1157
1169
|
}) : [];
|
|
1158
|
-
}, [
|
|
1170
|
+
}, [M?.depends_on, M?.dependsOn]), he = d.dependentValues, ge = i(on), _e = ge?.dataSource ?? null, B = d.dataSource ?? se?.dataSource ?? M?.dataSource ?? _e, ve = s(() => he || (ge?.formValues ?? ge?.data ?? {}), [
|
|
1159
1171
|
he,
|
|
1160
1172
|
ge?.formValues,
|
|
1161
1173
|
ge?.data
|
|
1162
|
-
]),
|
|
1174
|
+
]), ye = s(() => z.length === 0 ? !1 : z.some(({ field: e }) => {
|
|
1163
1175
|
let t = ve[e];
|
|
1164
1176
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
1165
|
-
}), [z, ve]),
|
|
1177
|
+
}), [z, ve]), V = B != null && typeof B.find == "function" && !!I, [H, be] = l(null);
|
|
1166
1178
|
a(() => {
|
|
1167
1179
|
if (!B || !I) return;
|
|
1168
1180
|
let e = B.getObjectSchema;
|
|
@@ -1175,15 +1187,15 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1175
1187
|
};
|
|
1176
1188
|
}, [B, I]);
|
|
1177
1189
|
let U = s(() => {
|
|
1178
|
-
let e =
|
|
1190
|
+
let e = H?.titleFormat;
|
|
1179
1191
|
return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
|
|
1180
|
-
}, [
|
|
1192
|
+
}, [H]), W = s(() => {
|
|
1181
1193
|
if (fe && fe.length > 0) return fe;
|
|
1182
|
-
let e =
|
|
1194
|
+
let e = zt(H, { displayField: P });
|
|
1183
1195
|
return e.length > 0 ? e : void 0;
|
|
1184
1196
|
}, [
|
|
1185
1197
|
fe,
|
|
1186
|
-
|
|
1198
|
+
H,
|
|
1187
1199
|
P
|
|
1188
1200
|
]), G = s(() => {
|
|
1189
1201
|
if (ue) return ue;
|
|
@@ -1197,7 +1209,7 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1197
1209
|
if (!W) return;
|
|
1198
1210
|
let e = [];
|
|
1199
1211
|
for (let t of W) if (typeof t == "object" && t.type) {
|
|
1200
|
-
let n =
|
|
1212
|
+
let n = nn(t.type);
|
|
1201
1213
|
n && e.push({
|
|
1202
1214
|
field: t.field,
|
|
1203
1215
|
label: t.label,
|
|
@@ -1205,27 +1217,27 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1205
1217
|
});
|
|
1206
1218
|
}
|
|
1207
1219
|
return e.length > 0 ? e : void 0;
|
|
1208
|
-
}, [W]),
|
|
1209
|
-
if (
|
|
1220
|
+
}, [W]), K = d.onCreateNew ?? se?.onCreateNew, [Se, Ce] = l(!1), we = V ? v : le, q = s(() => {
|
|
1221
|
+
if (V || !m) return we;
|
|
1210
1222
|
let e = m.toLowerCase();
|
|
1211
|
-
return
|
|
1223
|
+
return we.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
|
|
1212
1224
|
}, [
|
|
1213
|
-
|
|
1214
|
-
|
|
1225
|
+
V,
|
|
1226
|
+
we,
|
|
1215
1227
|
m
|
|
1216
1228
|
]);
|
|
1217
1229
|
a(() => {
|
|
1218
|
-
|
|
1230
|
+
ae(-1);
|
|
1219
1231
|
}, [q.length]);
|
|
1220
1232
|
let Ee = r(async (e) => {
|
|
1221
1233
|
if (!(!B || !I)) {
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1234
|
+
if (ye) {
|
|
1235
|
+
y([]), ne(0);
|
|
1224
1236
|
return;
|
|
1225
1237
|
}
|
|
1226
1238
|
ee(!0), w(null);
|
|
1227
1239
|
try {
|
|
1228
|
-
let t = { $top:
|
|
1240
|
+
let t = { $top: an };
|
|
1229
1241
|
if (e && e.trim() && (t.$search = e.trim()), z.length > 0) {
|
|
1230
1242
|
let e = {};
|
|
1231
1243
|
for (let { field: t, param: n } of z) {
|
|
@@ -1234,14 +1246,14 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1234
1246
|
}
|
|
1235
1247
|
Object.keys(e).length > 0 && (t.$filter = e);
|
|
1236
1248
|
}
|
|
1237
|
-
|
|
1249
|
+
L && L.length > 0 && (t.$filter = {
|
|
1238
1250
|
...t.$filter ?? {},
|
|
1239
|
-
...
|
|
1251
|
+
...jt(L)
|
|
1240
1252
|
});
|
|
1241
1253
|
let n = await B.find(I, t), r = n?.data ?? n ?? [];
|
|
1242
|
-
|
|
1254
|
+
y(r.map((e) => tn(e, P, F, G, U, H))), ne(n?.total ?? r.length);
|
|
1243
1255
|
} catch (e) {
|
|
1244
|
-
w(e instanceof Error ? e.message : String(e)),
|
|
1256
|
+
w(e instanceof Error ? e.message : String(e)), y([]);
|
|
1245
1257
|
} finally {
|
|
1246
1258
|
ee(!1);
|
|
1247
1259
|
}
|
|
@@ -1253,25 +1265,25 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1253
1265
|
F,
|
|
1254
1266
|
G,
|
|
1255
1267
|
U,
|
|
1256
|
-
|
|
1268
|
+
ye,
|
|
1257
1269
|
z,
|
|
1258
1270
|
ve,
|
|
1259
|
-
|
|
1271
|
+
L
|
|
1260
1272
|
]);
|
|
1261
1273
|
a(() => {
|
|
1262
|
-
f &&
|
|
1274
|
+
f && V && z.length > 0 && Ee(m || void 0);
|
|
1263
1275
|
}, [s(() => z.map((e) => `${e.param}=${ve[e.field] ?? ""}`).join("|"), [z, ve])]), a(() => {
|
|
1264
|
-
f &&
|
|
1276
|
+
f && V && Ee(m || void 0), f || (h(""), w(null), ae(-1));
|
|
1265
1277
|
}, [f]);
|
|
1266
|
-
let
|
|
1267
|
-
h(e),
|
|
1278
|
+
let De = r((e) => {
|
|
1279
|
+
h(e), V && (T.current && clearTimeout(T.current), T.current = setTimeout(() => {
|
|
1268
1280
|
Ee(e || void 0);
|
|
1269
1281
|
}, 300));
|
|
1270
|
-
}, [
|
|
1282
|
+
}, [V, Ee]);
|
|
1271
1283
|
a(() => () => {
|
|
1272
|
-
|
|
1284
|
+
T.current && clearTimeout(T.current);
|
|
1273
1285
|
}, []), a(() => {
|
|
1274
|
-
if (!
|
|
1286
|
+
if (!V || !B || !I) return;
|
|
1275
1287
|
let e = N ? Array.isArray(t) ? t : [] : t != null && t !== "" ? [t] : [];
|
|
1276
1288
|
if (!e.length) return;
|
|
1277
1289
|
let n = e.filter((e) => !ke(e));
|
|
@@ -1282,15 +1294,15 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1282
1294
|
let e = [];
|
|
1283
1295
|
for (let t of n) if (typeof B.findOne == "function") {
|
|
1284
1296
|
let n = await B.findOne(I, t);
|
|
1285
|
-
n && e.push(
|
|
1297
|
+
n && e.push(tn(n, P, F, G, U, H));
|
|
1286
1298
|
} else {
|
|
1287
1299
|
let n = await B.find(I, {
|
|
1288
1300
|
$filter: { [F]: t },
|
|
1289
1301
|
$top: 1
|
|
1290
1302
|
}), r = n?.data ?? n ?? [];
|
|
1291
|
-
r[0] && e.push(
|
|
1303
|
+
r[0] && e.push(tn(r[0], P, F, G, U, H));
|
|
1292
1304
|
}
|
|
1293
|
-
!r && e.length &&
|
|
1305
|
+
!r && e.length && ie((t) => {
|
|
1294
1306
|
let n = new Map(t.map((e) => [e.value, e]));
|
|
1295
1307
|
for (let t of e) n.set(t.value, t);
|
|
1296
1308
|
return Array.from(n.values());
|
|
@@ -1301,22 +1313,22 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1301
1313
|
};
|
|
1302
1314
|
}, [
|
|
1303
1315
|
t,
|
|
1304
|
-
|
|
1316
|
+
V,
|
|
1305
1317
|
I,
|
|
1306
1318
|
P,
|
|
1307
1319
|
F,
|
|
1308
1320
|
G,
|
|
1309
1321
|
N
|
|
1310
1322
|
]);
|
|
1311
|
-
let ke = r((e) =>
|
|
1312
|
-
|
|
1323
|
+
let ke = r((e) => le.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? O.find((t) => t.value === e), [
|
|
1324
|
+
le,
|
|
1313
1325
|
v,
|
|
1314
|
-
|
|
1315
|
-
]), J = N ? (Array.isArray(t) ? t : []).map(ke).filter(Boolean) : t ? [ke(t)].filter(Boolean) : [], je = d.onSelectRecord,
|
|
1326
|
+
O
|
|
1327
|
+
]), J = N ? (Array.isArray(t) ? t : []).map(ke).filter(Boolean) : t ? [ke(t)].filter(Boolean) : [], je = d.onSelectRecord, Me = r((e) => {
|
|
1316
1328
|
if (N) {
|
|
1317
1329
|
let r = Array.isArray(t) ? t : [];
|
|
1318
|
-
r.includes(e.value) ? n(r.filter((t) => t !== e.value)) : (I &&
|
|
1319
|
-
} else I &&
|
|
1330
|
+
r.includes(e.value) ? n(r.filter((t) => t !== e.value)) : (I && Gt(I, e.value), n([...r, e.value]));
|
|
1331
|
+
} else I && Gt(I, e.value), je ? je(e) : n(e.value), p(!1);
|
|
1320
1332
|
}, [
|
|
1321
1333
|
N,
|
|
1322
1334
|
t,
|
|
@@ -1325,21 +1337,21 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1325
1337
|
I
|
|
1326
1338
|
]), Pe = (e) => {
|
|
1327
1339
|
n(N ? (Array.isArray(t) ? t : []).filter((t) => t !== e) : null);
|
|
1328
|
-
},
|
|
1329
|
-
let t = e.map((e) =>
|
|
1330
|
-
I && t.forEach((e) =>
|
|
1340
|
+
}, Fe = r((e) => {
|
|
1341
|
+
let t = e.map((e) => tn(e, P, F, G, U, H));
|
|
1342
|
+
I && t.forEach((e) => Gt(I, e.value)), ie(t);
|
|
1331
1343
|
}, [
|
|
1332
1344
|
P,
|
|
1333
1345
|
F,
|
|
1334
1346
|
G,
|
|
1335
1347
|
U,
|
|
1336
1348
|
I
|
|
1337
|
-
]), [Le,
|
|
1349
|
+
]), [Le, Re] = l([]);
|
|
1338
1350
|
a(() => {
|
|
1339
|
-
if (!f || !
|
|
1340
|
-
let e =
|
|
1351
|
+
if (!f || !V || !B || !I || m) return;
|
|
1352
|
+
let e = Wt(I);
|
|
1341
1353
|
if (!e.length) {
|
|
1342
|
-
|
|
1354
|
+
Re([]);
|
|
1343
1355
|
return;
|
|
1344
1356
|
}
|
|
1345
1357
|
let t = !1;
|
|
@@ -1354,46 +1366,46 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1354
1366
|
}
|
|
1355
1367
|
if (typeof B.findOne == "function") {
|
|
1356
1368
|
let e = await B.findOne(I, t);
|
|
1357
|
-
e && n.push(
|
|
1369
|
+
e && n.push(tn(e, P, F, G, U, H));
|
|
1358
1370
|
}
|
|
1359
1371
|
}
|
|
1360
|
-
t ||
|
|
1372
|
+
t || Re(n);
|
|
1361
1373
|
} catch {
|
|
1362
|
-
t ||
|
|
1374
|
+
t || Re([]);
|
|
1363
1375
|
}
|
|
1364
1376
|
})(), () => {
|
|
1365
1377
|
t = !0;
|
|
1366
1378
|
};
|
|
1367
1379
|
}, [
|
|
1368
1380
|
f,
|
|
1369
|
-
|
|
1381
|
+
V,
|
|
1370
1382
|
I,
|
|
1371
1383
|
m
|
|
1372
1384
|
]);
|
|
1373
|
-
let Be = !m &&
|
|
1374
|
-
if (m || !
|
|
1385
|
+
let Be = !m && V ? Le.length : 0, Ve = s(() => {
|
|
1386
|
+
if (m || !V || Le.length === 0) return q;
|
|
1375
1387
|
let e = new Set(Le.map((e) => e.value));
|
|
1376
1388
|
return [...Le, ...q.filter((t) => !e.has(t.value))];
|
|
1377
1389
|
}, [
|
|
1378
1390
|
m,
|
|
1379
|
-
|
|
1391
|
+
V,
|
|
1380
1392
|
Le,
|
|
1381
1393
|
q
|
|
1382
1394
|
]);
|
|
1383
1395
|
a(() => {
|
|
1384
|
-
|
|
1396
|
+
ae(-1);
|
|
1385
1397
|
}, [Ve.length]);
|
|
1386
|
-
let [He, Ue] = l(!1),
|
|
1398
|
+
let [He, Ue] = l(!1), We = !!K || de && V, Z = r(async (e) => {
|
|
1387
1399
|
let t = (e || "").trim();
|
|
1388
|
-
if (
|
|
1389
|
-
|
|
1400
|
+
if (K) {
|
|
1401
|
+
K(t), p(!1);
|
|
1390
1402
|
return;
|
|
1391
1403
|
}
|
|
1392
1404
|
if (!(!de || !B || !I || !t)) {
|
|
1393
1405
|
Ue(!0), w(null);
|
|
1394
1406
|
try {
|
|
1395
|
-
let e =
|
|
1396
|
-
|
|
1407
|
+
let e = tn(await B.create(I, { [P]: t }), P, F, G, U, H);
|
|
1408
|
+
ie((t) => [e, ...t.filter((t) => t.value !== e.value)]), Me(e);
|
|
1397
1409
|
} catch (e) {
|
|
1398
1410
|
w(e instanceof Error ? e.message : String(e));
|
|
1399
1411
|
} finally {
|
|
@@ -1401,7 +1413,7 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1401
1413
|
}
|
|
1402
1414
|
}
|
|
1403
1415
|
}, [
|
|
1404
|
-
|
|
1416
|
+
K,
|
|
1405
1417
|
de,
|
|
1406
1418
|
B,
|
|
1407
1419
|
I,
|
|
@@ -1409,8 +1421,8 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1409
1421
|
F,
|
|
1410
1422
|
G,
|
|
1411
1423
|
U,
|
|
1412
|
-
|
|
1413
|
-
]),
|
|
1424
|
+
Me
|
|
1425
|
+
]), Q = r((e) => {
|
|
1414
1426
|
if (!W || W.length === 0) return;
|
|
1415
1427
|
let t = [];
|
|
1416
1428
|
for (let n of W) {
|
|
@@ -1423,31 +1435,31 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1423
1435
|
}
|
|
1424
1436
|
return t.length ? t.join(" · ") : void 0;
|
|
1425
1437
|
}, [W, P]), Ge = r((e) => {
|
|
1426
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
1438
|
+
e.key === "ArrowDown" ? (e.preventDefault(), ae((e) => e < Ve.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), ae((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), j >= 0 && j < Ve.length && Me(Ve[j]));
|
|
1427
1439
|
}, [
|
|
1428
1440
|
Ve,
|
|
1429
|
-
|
|
1430
|
-
|
|
1441
|
+
j,
|
|
1442
|
+
Me
|
|
1431
1443
|
]);
|
|
1432
1444
|
if (a(() => {
|
|
1433
|
-
|
|
1434
|
-
}, [
|
|
1445
|
+
j >= 0 && oe.current && oe.current.querySelector(`[data-lookup-index="${j}"]`)?.scrollIntoView({ block: "nearest" });
|
|
1446
|
+
}, [j]), u) return J.length ? N ? /* @__PURE__ */ Y("div", {
|
|
1435
1447
|
className: "flex flex-wrap gap-1",
|
|
1436
|
-
children: J.map((e, t) => /* @__PURE__ */ Y(
|
|
1448
|
+
children: J.map((e, t) => /* @__PURE__ */ Y(b, {
|
|
1437
1449
|
variant: "outline",
|
|
1438
1450
|
children: e?.label || e?.[P]
|
|
1439
1451
|
}, t))
|
|
1440
1452
|
}) : /* @__PURE__ */ Y("span", {
|
|
1441
1453
|
className: "text-sm",
|
|
1442
1454
|
children: J[0]?.label || J[0]?.[P]
|
|
1443
|
-
}) : /* @__PURE__ */ Y(
|
|
1455
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
1444
1456
|
let Ke = !!d.compact, qe = J[0]?.label || J[0]?.[P];
|
|
1445
1457
|
return /* @__PURE__ */ X("div", {
|
|
1446
1458
|
className: Ke ? "" : "space-y-2",
|
|
1447
1459
|
children: [
|
|
1448
1460
|
J.length > 0 && !Ke && /* @__PURE__ */ Y("div", {
|
|
1449
1461
|
className: "flex flex-wrap gap-1",
|
|
1450
|
-
children: J.map((e, t) => /* @__PURE__ */ X(
|
|
1462
|
+
children: J.map((e, t) => /* @__PURE__ */ X(b, {
|
|
1451
1463
|
variant: "outline",
|
|
1452
1464
|
className: "gap-1",
|
|
1453
1465
|
children: [e?.label || e?.[P], /* @__PURE__ */ Y("button", {
|
|
@@ -1455,7 +1467,7 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1455
1467
|
className: "ml-1 hover:text-destructive",
|
|
1456
1468
|
type: "button",
|
|
1457
1469
|
"aria-label": g("lookup.remove", { label: e?.label || e?.[P] }),
|
|
1458
|
-
children: /* @__PURE__ */ Y(
|
|
1470
|
+
children: /* @__PURE__ */ Y(Ie, { className: "size-3" })
|
|
1459
1471
|
})]
|
|
1460
1472
|
}, t))
|
|
1461
1473
|
}),
|
|
@@ -1463,25 +1475,25 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1463
1475
|
className: "flex items-center gap-1.5",
|
|
1464
1476
|
children: [/* @__PURE__ */ X(re, {
|
|
1465
1477
|
open: f,
|
|
1466
|
-
onOpenChange: (e) => !
|
|
1467
|
-
children: [/* @__PURE__ */ Y(
|
|
1478
|
+
onOpenChange: (e) => !ye && p(e),
|
|
1479
|
+
children: [/* @__PURE__ */ Y(A, {
|
|
1468
1480
|
asChild: !0,
|
|
1469
|
-
children: /* @__PURE__ */ X(
|
|
1481
|
+
children: /* @__PURE__ */ X(x, {
|
|
1470
1482
|
variant: "outline",
|
|
1471
1483
|
className: R("min-w-0 flex-1 justify-start text-left font-normal", Ke && "h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60"),
|
|
1472
1484
|
type: "button",
|
|
1473
1485
|
"aria-haspopup": "listbox",
|
|
1474
1486
|
"aria-expanded": f,
|
|
1475
1487
|
"aria-controls": _,
|
|
1476
|
-
disabled:
|
|
1477
|
-
"data-testid":
|
|
1478
|
-
title:
|
|
1488
|
+
disabled: ye || d.disabled,
|
|
1489
|
+
"data-testid": ye ? "lookup-trigger-gated" : d.name || se?.name ? `lookup-trigger-${d.name || se.name}` : "lookup-trigger",
|
|
1490
|
+
title: ye ? g("lookup.selectFirst", { fields: z.map((e) => e.field).join(", ") }) : void 0,
|
|
1479
1491
|
children: [/* @__PURE__ */ Y(Ae, { className: R("size-4 shrink-0 text-muted-foreground", Ke ? "mr-1.5" : "mr-2") }), /* @__PURE__ */ Y("span", {
|
|
1480
1492
|
className: R("truncate", Ke && J.length === 0 && "text-muted-foreground"),
|
|
1481
|
-
children:
|
|
1493
|
+
children: ye ? g("lookup.selectFirst", { fields: z.map((e) => e.field).join(", ") }) : Ke && !N && J.length > 0 ? qe : J.length === 0 ? se?.placeholder || g("common.select") : N ? g("table.selected", { count: J.length }) : g("common.select")
|
|
1482
1494
|
})]
|
|
1483
1495
|
})
|
|
1484
|
-
}), /* @__PURE__ */ X(
|
|
1496
|
+
}), /* @__PURE__ */ X(k, {
|
|
1485
1497
|
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
1486
1498
|
align: "start",
|
|
1487
1499
|
children: [
|
|
@@ -1491,19 +1503,19 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1491
1503
|
className: "relative",
|
|
1492
1504
|
children: [
|
|
1493
1505
|
/* @__PURE__ */ Y(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
1494
|
-
/* @__PURE__ */ Y(
|
|
1506
|
+
/* @__PURE__ */ Y(D, {
|
|
1495
1507
|
placeholder: g("common.search") + "...",
|
|
1496
1508
|
value: m,
|
|
1497
|
-
onChange: (e) =>
|
|
1509
|
+
onChange: (e) => De(e.target.value),
|
|
1498
1510
|
onKeyDown: Ge,
|
|
1499
1511
|
className: "w-full pl-9 h-8 text-sm",
|
|
1500
1512
|
role: "combobox",
|
|
1501
1513
|
"aria-autocomplete": "list",
|
|
1502
1514
|
"aria-controls": _,
|
|
1503
1515
|
"aria-expanded": f,
|
|
1504
|
-
"aria-activedescendant":
|
|
1516
|
+
"aria-activedescendant": j >= 0 ? `${_}-opt-${j}` : void 0
|
|
1505
1517
|
}),
|
|
1506
|
-
S && /* @__PURE__ */ Y(
|
|
1518
|
+
S && /* @__PURE__ */ Y(Te, {
|
|
1507
1519
|
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
1508
1520
|
"data-testid": "lookup-loading"
|
|
1509
1521
|
})
|
|
@@ -1514,12 +1526,12 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1514
1526
|
className: "flex flex-col items-center gap-2 py-4 px-2",
|
|
1515
1527
|
role: "alert",
|
|
1516
1528
|
children: [
|
|
1517
|
-
/* @__PURE__ */ Y(
|
|
1529
|
+
/* @__PURE__ */ Y(me, { className: "size-5 text-destructive" }),
|
|
1518
1530
|
/* @__PURE__ */ Y("p", {
|
|
1519
1531
|
className: "text-sm text-destructive",
|
|
1520
1532
|
children: C
|
|
1521
1533
|
}),
|
|
1522
|
-
/* @__PURE__ */ Y(
|
|
1534
|
+
/* @__PURE__ */ Y(x, {
|
|
1523
1535
|
variant: "outline",
|
|
1524
1536
|
size: "sm",
|
|
1525
1537
|
onClick: () => Ee(m || void 0),
|
|
@@ -1532,13 +1544,13 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1532
1544
|
className: "flex flex-col items-center gap-2 py-6",
|
|
1533
1545
|
role: "status",
|
|
1534
1546
|
"aria-live": "polite",
|
|
1535
|
-
children: [/* @__PURE__ */ Y(
|
|
1547
|
+
children: [/* @__PURE__ */ Y(Te, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ Y("p", {
|
|
1536
1548
|
className: "text-sm text-muted-foreground",
|
|
1537
1549
|
children: g("lookup.loading")
|
|
1538
1550
|
})]
|
|
1539
1551
|
}),
|
|
1540
1552
|
!C && !(S && q.length === 0) && /* @__PURE__ */ Y("div", {
|
|
1541
|
-
ref:
|
|
1553
|
+
ref: oe,
|
|
1542
1554
|
className: "max-h-64 overflow-y-auto px-1 pb-1",
|
|
1543
1555
|
role: "listbox",
|
|
1544
1556
|
id: _,
|
|
@@ -1547,18 +1559,18 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1547
1559
|
children: [/* @__PURE__ */ Y("p", {
|
|
1548
1560
|
className: "text-sm text-muted-foreground",
|
|
1549
1561
|
children: g("lookup.noOptions")
|
|
1550
|
-
}),
|
|
1562
|
+
}), We && /* @__PURE__ */ X(x, {
|
|
1551
1563
|
variant: "ghost",
|
|
1552
1564
|
size: "sm",
|
|
1553
1565
|
className: "mt-2 gap-1",
|
|
1554
1566
|
type: "button",
|
|
1555
1567
|
disabled: He,
|
|
1556
|
-
onClick: () =>
|
|
1557
|
-
children: [He ? /* @__PURE__ */ Y(
|
|
1568
|
+
onClick: () => Z(m),
|
|
1569
|
+
children: [He ? /* @__PURE__ */ Y(Te, { className: "size-4 animate-spin" }) : /* @__PURE__ */ Y(Oe, { className: "size-4" }), m ? g("lookup.createNamed", { name: m }) : g("lookup.createNew")]
|
|
1558
1570
|
})]
|
|
1559
|
-
}) : /* @__PURE__ */ X(
|
|
1571
|
+
}) : /* @__PURE__ */ X(ze, { children: [
|
|
1560
1572
|
Ve.map((n, r) => {
|
|
1561
|
-
let i = N ? (Array.isArray(t) ? t : []).includes(n.value) : t === n.value, a = r ===
|
|
1573
|
+
let i = N ? (Array.isArray(t) ? t : []).includes(n.value) : t === n.value, a = r === j, o = Be > 0 && r === 0, s = Be > 0 && r === Be;
|
|
1562
1574
|
return /* @__PURE__ */ X(e.Fragment, { children: [
|
|
1563
1575
|
o && /* @__PURE__ */ Y("div", {
|
|
1564
1576
|
className: "px-3 pt-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
@@ -1573,8 +1585,8 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1573
1585
|
"data-lookup-index": r,
|
|
1574
1586
|
role: "option",
|
|
1575
1587
|
"aria-selected": i,
|
|
1576
|
-
title:
|
|
1577
|
-
onClick: () =>
|
|
1588
|
+
title: Q(n),
|
|
1589
|
+
onClick: () => Me(n),
|
|
1578
1590
|
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${a ? "bg-accent text-accent-foreground" : i ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
1579
1591
|
type: "button",
|
|
1580
1592
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -1586,7 +1598,7 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1586
1598
|
className: "block truncate text-xs text-muted-foreground",
|
|
1587
1599
|
children: n.description
|
|
1588
1600
|
})]
|
|
1589
|
-
}), i && /* @__PURE__ */ Y(
|
|
1601
|
+
}), i && /* @__PURE__ */ Y(b, {
|
|
1590
1602
|
variant: "default",
|
|
1591
1603
|
className: "ml-2 shrink-0",
|
|
1592
1604
|
children: g("lookup.selectedBadge")
|
|
@@ -1594,34 +1606,34 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1594
1606
|
})
|
|
1595
1607
|
] }, n.value);
|
|
1596
1608
|
}),
|
|
1597
|
-
|
|
1609
|
+
V && te > q.length && /* @__PURE__ */ Y("p", {
|
|
1598
1610
|
className: "text-xs text-muted-foreground text-center py-2",
|
|
1599
1611
|
children: g("lookup.showingResults", {
|
|
1600
1612
|
shown: q.length,
|
|
1601
1613
|
total: te
|
|
1602
1614
|
})
|
|
1603
1615
|
}),
|
|
1604
|
-
|
|
1616
|
+
V && te > q.length && /* @__PURE__ */ X("button", {
|
|
1605
1617
|
type: "button",
|
|
1606
1618
|
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",
|
|
1607
1619
|
onClick: () => {
|
|
1608
1620
|
p(!1), Ce(!0);
|
|
1609
1621
|
},
|
|
1610
1622
|
"data-testid": "show-all-results",
|
|
1611
|
-
children: [/* @__PURE__ */ Y(
|
|
1623
|
+
children: [/* @__PURE__ */ Y(Ne, { className: "size-3.5" }), g("lookup.showAllResults", { count: te })]
|
|
1612
1624
|
}),
|
|
1613
|
-
|
|
1625
|
+
We && /* @__PURE__ */ X("button", {
|
|
1614
1626
|
type: "button",
|
|
1615
1627
|
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",
|
|
1616
1628
|
disabled: He,
|
|
1617
|
-
onClick: () =>
|
|
1618
|
-
children: [He ? /* @__PURE__ */ Y(
|
|
1629
|
+
onClick: () => Z(m),
|
|
1630
|
+
children: [He ? /* @__PURE__ */ Y(Te, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ Y(Oe, { className: "size-3.5" }), m ? g("lookup.createNamed", { name: m }) : g("lookup.createNew")]
|
|
1619
1631
|
})
|
|
1620
1632
|
] })
|
|
1621
1633
|
})
|
|
1622
1634
|
]
|
|
1623
1635
|
})]
|
|
1624
|
-
}),
|
|
1636
|
+
}), V && /* @__PURE__ */ Y(x, {
|
|
1625
1637
|
variant: "outline",
|
|
1626
1638
|
size: "icon",
|
|
1627
1639
|
className: "shrink-0",
|
|
@@ -1630,13 +1642,13 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1630
1642
|
"aria-label": g("lookup.browseAll"),
|
|
1631
1643
|
title: g("lookup.browseAll"),
|
|
1632
1644
|
"data-testid": "browse-all-records",
|
|
1633
|
-
children: /* @__PURE__ */ Y(
|
|
1645
|
+
children: /* @__PURE__ */ Y(Ne, { className: "size-4" })
|
|
1634
1646
|
})]
|
|
1635
1647
|
}),
|
|
1636
|
-
|
|
1637
|
-
open:
|
|
1648
|
+
V && B && I && /* @__PURE__ */ Y(Nt, {
|
|
1649
|
+
open: Se,
|
|
1638
1650
|
onOpenChange: Ce,
|
|
1639
|
-
title:
|
|
1651
|
+
title: se?.label || g("common.select"),
|
|
1640
1652
|
multiple: N,
|
|
1641
1653
|
dataSource: B,
|
|
1642
1654
|
objectName: I,
|
|
@@ -1644,23 +1656,23 @@ function nn({ value: t, onChange: n, field: o, readonly: u, ...d }) {
|
|
|
1644
1656
|
displayField: P,
|
|
1645
1657
|
titleFormat: U,
|
|
1646
1658
|
idField: F,
|
|
1647
|
-
pageSize:
|
|
1659
|
+
pageSize: pe,
|
|
1648
1660
|
value: t,
|
|
1649
1661
|
onSelect: n,
|
|
1650
|
-
onSelectRecords:
|
|
1651
|
-
lookupFilters:
|
|
1652
|
-
cellRenderer:
|
|
1662
|
+
onSelectRecords: Fe,
|
|
1663
|
+
lookupFilters: L,
|
|
1664
|
+
cellRenderer: Xt(),
|
|
1653
1665
|
filterColumns: xe
|
|
1654
1666
|
})
|
|
1655
1667
|
]
|
|
1656
1668
|
});
|
|
1657
1669
|
}
|
|
1658
|
-
var
|
|
1659
|
-
|
|
1660
|
-
})),
|
|
1661
|
-
function
|
|
1670
|
+
var an, on, sn = Z((() => {
|
|
1671
|
+
Lt(), Ht(), Jt(), Qt(), nt(), an = 50, on = Le;
|
|
1672
|
+
})), cn = /* @__PURE__ */ Q({ DateTimeField: () => ln });
|
|
1673
|
+
function ln({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1662
1674
|
if (r) {
|
|
1663
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
1675
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
1664
1676
|
let t = new Date(e);
|
|
1665
1677
|
return /* @__PURE__ */ X("span", {
|
|
1666
1678
|
className: "text-sm",
|
|
@@ -1672,7 +1684,7 @@ function cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1672
1684
|
});
|
|
1673
1685
|
}
|
|
1674
1686
|
let { inputType: a, ...o } = i;
|
|
1675
|
-
return /* @__PURE__ */ Y(
|
|
1687
|
+
return /* @__PURE__ */ Y(D, {
|
|
1676
1688
|
...o,
|
|
1677
1689
|
type: "datetime-local",
|
|
1678
1690
|
value: e || "",
|
|
@@ -1680,14 +1692,14 @@ function cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1680
1692
|
disabled: r || o.disabled
|
|
1681
1693
|
});
|
|
1682
1694
|
}
|
|
1683
|
-
var
|
|
1684
|
-
function
|
|
1695
|
+
var un = Z((() => {})), dn = /* @__PURE__ */ Q({ TimeField: () => fn });
|
|
1696
|
+
function fn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1685
1697
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
1686
1698
|
className: "text-sm",
|
|
1687
|
-
children: e || /* @__PURE__ */ Y(
|
|
1699
|
+
children: e || /* @__PURE__ */ Y(E, {})
|
|
1688
1700
|
});
|
|
1689
1701
|
let { inputType: a, ...o } = i;
|
|
1690
|
-
return /* @__PURE__ */ Y(
|
|
1702
|
+
return /* @__PURE__ */ Y(D, {
|
|
1691
1703
|
...o,
|
|
1692
1704
|
type: "time",
|
|
1693
1705
|
value: e || "",
|
|
@@ -1695,10 +1707,10 @@ function dn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1695
1707
|
disabled: r || o.disabled
|
|
1696
1708
|
});
|
|
1697
1709
|
}
|
|
1698
|
-
var
|
|
1699
|
-
function
|
|
1710
|
+
var pn = Z((() => {})), mn = /* @__PURE__ */ Q({ PercentField: () => hn });
|
|
1711
|
+
function hn({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
1700
1712
|
let s = n || o.schema, c = s?.precision ?? 2, l = typeof s?.max == "number" ? s.max : void 0, u = l != null && l > 1, d = (e) => u ? e : e * 100, f = (e) => u ? e : e / 100, p = u ? l : 100;
|
|
1701
|
-
if (r) return e == null ? /* @__PURE__ */ Y(
|
|
1713
|
+
if (r) return e == null ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ X("span", {
|
|
1702
1714
|
className: "text-sm font-medium tabular-nums",
|
|
1703
1715
|
children: [d(e).toFixed(c), "%"]
|
|
1704
1716
|
});
|
|
@@ -1722,7 +1734,7 @@ function mn({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1722
1734
|
className: "space-y-2",
|
|
1723
1735
|
children: [/* @__PURE__ */ X("div", {
|
|
1724
1736
|
className: "relative",
|
|
1725
|
-
children: [/* @__PURE__ */ Y(
|
|
1737
|
+
children: [/* @__PURE__ */ Y(D, {
|
|
1726
1738
|
...o,
|
|
1727
1739
|
type: "number",
|
|
1728
1740
|
value: m,
|
|
@@ -1736,7 +1748,7 @@ function mn({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1736
1748
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
1737
1749
|
children: "%"
|
|
1738
1750
|
})]
|
|
1739
|
-
}), /* @__PURE__ */ Y(
|
|
1751
|
+
}), /* @__PURE__ */ Y(N, {
|
|
1740
1752
|
value: [h],
|
|
1741
1753
|
onValueChange: _,
|
|
1742
1754
|
min: 0,
|
|
@@ -1749,8 +1761,8 @@ function mn({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
1749
1761
|
})]
|
|
1750
1762
|
});
|
|
1751
1763
|
}
|
|
1752
|
-
var
|
|
1753
|
-
function
|
|
1764
|
+
var gn = Z((() => {})), _n = /* @__PURE__ */ Q({ PasswordField: () => vn });
|
|
1765
|
+
function vn({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1754
1766
|
let [o, s] = l(!1), c = n || a.schema;
|
|
1755
1767
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
1756
1768
|
className: "text-sm",
|
|
@@ -1759,7 +1771,7 @@ function _n({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1759
1771
|
let { inputType: u, ...d } = a;
|
|
1760
1772
|
return /* @__PURE__ */ X("div", {
|
|
1761
1773
|
className: "relative",
|
|
1762
|
-
children: [/* @__PURE__ */ Y(
|
|
1774
|
+
children: [/* @__PURE__ */ Y(D, {
|
|
1763
1775
|
...d,
|
|
1764
1776
|
type: o ? "text" : "password",
|
|
1765
1777
|
value: e || "",
|
|
@@ -1767,20 +1779,20 @@ function _n({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1767
1779
|
placeholder: c?.placeholder,
|
|
1768
1780
|
disabled: r || d.disabled,
|
|
1769
1781
|
className: `pr-10 ${i || ""}`
|
|
1770
|
-
}), /* @__PURE__ */ Y(
|
|
1782
|
+
}), /* @__PURE__ */ Y(x, {
|
|
1771
1783
|
type: "button",
|
|
1772
1784
|
variant: "ghost",
|
|
1773
1785
|
size: "sm",
|
|
1774
1786
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
1775
1787
|
onClick: () => s(!o),
|
|
1776
1788
|
tabIndex: -1,
|
|
1777
|
-
children: Y(o ?
|
|
1789
|
+
children: Y(o ? xe : G, { className: "size-4 text-gray-500" })
|
|
1778
1790
|
})]
|
|
1779
1791
|
});
|
|
1780
1792
|
}
|
|
1781
|
-
var
|
|
1782
|
-
function
|
|
1783
|
-
let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, h = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), g = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), _ = m === !1 ? !1 : m ?? (h && g ? "environment" : null), [v, y] = l(!1), [
|
|
1793
|
+
var yn = Z((() => {})), bn = /* @__PURE__ */ Q({ FileField: () => xn });
|
|
1794
|
+
function xn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
1795
|
+
let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, h = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), g = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), _ = m === !1 ? !1 : m ?? (h && g ? "environment" : null), [v, y] = l(!1), [b, S] = l([]), { upload: ee } = Be(), [C, w] = l({}), [te, ne] = l(!1), T = e ? Array.isArray(e) ? e : [e] : [], D = r(async (e) => {
|
|
1784
1796
|
if (e.length === 0) return;
|
|
1785
1797
|
let n = [], r = e.filter((e) => {
|
|
1786
1798
|
if (p && e.size > p) {
|
|
@@ -1810,22 +1822,22 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1810
1822
|
}
|
|
1811
1823
|
}))).filter(Boolean);
|
|
1812
1824
|
if (e.length === 0) return;
|
|
1813
|
-
t(d ? [...
|
|
1825
|
+
t(d ? [...T, ...e] : e[0]);
|
|
1814
1826
|
} finally {
|
|
1815
1827
|
ne(!1), w({});
|
|
1816
1828
|
}
|
|
1817
1829
|
}
|
|
1818
1830
|
}, [
|
|
1819
|
-
|
|
1831
|
+
T,
|
|
1820
1832
|
d,
|
|
1821
1833
|
t,
|
|
1822
1834
|
p,
|
|
1823
1835
|
ee
|
|
1824
|
-
]),
|
|
1836
|
+
]), O = r((e) => {
|
|
1825
1837
|
e.preventDefault(), e.stopPropagation(), y(!0);
|
|
1826
|
-
}, []),
|
|
1838
|
+
}, []), re = r((e) => {
|
|
1827
1839
|
e.preventDefault(), e.stopPropagation(), y(!1);
|
|
1828
|
-
}, []),
|
|
1840
|
+
}, []), k = r((e) => {
|
|
1829
1841
|
e.preventDefault(), e.stopPropagation(), y(!1);
|
|
1830
1842
|
let t = Array.from(e.dataTransfer.files);
|
|
1831
1843
|
if (f) {
|
|
@@ -1842,15 +1854,15 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1842
1854
|
className: "text-sm truncate max-w-xs",
|
|
1843
1855
|
children: e.name || e.original_name || "File"
|
|
1844
1856
|
}, t))
|
|
1845
|
-
}) : /* @__PURE__ */ Y(
|
|
1846
|
-
let
|
|
1857
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
1858
|
+
let A = (e) => {
|
|
1847
1859
|
D(Array.from(e.target.files || []));
|
|
1848
|
-
},
|
|
1860
|
+
}, ie = (e) => {
|
|
1849
1861
|
if (d) {
|
|
1850
|
-
let n =
|
|
1862
|
+
let n = T.filter((t, n) => n !== e);
|
|
1851
1863
|
t(n.length > 0 ? n : null);
|
|
1852
1864
|
} else t(null);
|
|
1853
|
-
},
|
|
1865
|
+
}, j = (e) => (e.mime_type || "").startsWith("image/");
|
|
1854
1866
|
return /* @__PURE__ */ X("div", {
|
|
1855
1867
|
className: a.className,
|
|
1856
1868
|
children: [
|
|
@@ -1859,7 +1871,7 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1859
1871
|
type: "file",
|
|
1860
1872
|
multiple: d,
|
|
1861
1873
|
accept: f,
|
|
1862
|
-
onChange:
|
|
1874
|
+
onChange: A,
|
|
1863
1875
|
className: "hidden"
|
|
1864
1876
|
}),
|
|
1865
1877
|
_ && /* @__PURE__ */ Y("input", {
|
|
@@ -1867,7 +1879,7 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1867
1879
|
type: "file",
|
|
1868
1880
|
accept: "image/*",
|
|
1869
1881
|
capture: _,
|
|
1870
|
-
onChange:
|
|
1882
|
+
onChange: A,
|
|
1871
1883
|
className: "hidden",
|
|
1872
1884
|
"aria-label": "Camera capture",
|
|
1873
1885
|
"data-testid": "file-field-camera-input"
|
|
@@ -1876,9 +1888,9 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1876
1888
|
className: "space-y-2",
|
|
1877
1889
|
children: [
|
|
1878
1890
|
/* @__PURE__ */ X("div", {
|
|
1879
|
-
onDragOver:
|
|
1880
|
-
onDragLeave:
|
|
1881
|
-
onDrop:
|
|
1891
|
+
onDragOver: O,
|
|
1892
|
+
onDragLeave: re,
|
|
1893
|
+
onDrop: k,
|
|
1882
1894
|
onClick: () => o.current?.click(),
|
|
1883
1895
|
className: `
|
|
1884
1896
|
flex flex-col items-center justify-center gap-2 p-6
|
|
@@ -1891,7 +1903,7 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1891
1903
|
onKeyDown: (e) => {
|
|
1892
1904
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
|
|
1893
1905
|
},
|
|
1894
|
-
children: [/* @__PURE__ */ Y(
|
|
1906
|
+
children: [/* @__PURE__ */ Y(Fe, { className: `size-8 ${v ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ X("div", {
|
|
1895
1907
|
className: "text-center",
|
|
1896
1908
|
children: [/* @__PURE__ */ Y("p", {
|
|
1897
1909
|
className: "text-sm font-medium",
|
|
@@ -1902,7 +1914,7 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1902
1914
|
})]
|
|
1903
1915
|
})]
|
|
1904
1916
|
}),
|
|
1905
|
-
_ && /* @__PURE__ */ X(
|
|
1917
|
+
_ && /* @__PURE__ */ X(x, {
|
|
1906
1918
|
type: "button",
|
|
1907
1919
|
variant: "outline",
|
|
1908
1920
|
size: "sm",
|
|
@@ -1911,32 +1923,32 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1911
1923
|
e.stopPropagation(), s.current?.click();
|
|
1912
1924
|
},
|
|
1913
1925
|
"data-testid": "file-field-camera-button",
|
|
1914
|
-
children: [/* @__PURE__ */ Y(
|
|
1926
|
+
children: [/* @__PURE__ */ Y(_e, { className: "size-4 mr-2" }), _ === "user" ? "Take selfie" : "Take photo"]
|
|
1915
1927
|
}),
|
|
1916
1928
|
te && /* @__PURE__ */ X("div", {
|
|
1917
1929
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
1918
1930
|
"data-testid": "file-field-uploading",
|
|
1919
|
-
children: [/* @__PURE__ */ Y(
|
|
1931
|
+
children: [/* @__PURE__ */ Y(Te, { className: "size-3 animate-spin" }), /* @__PURE__ */ X("span", { children: ["Uploading…", Object.keys(C).length > 0 && ` (${Math.round(Object.values(C).reduce((e, t) => e + t, 0) / Object.keys(C).length * 100)}%)`] })]
|
|
1920
1932
|
}),
|
|
1921
|
-
|
|
1933
|
+
b.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1922
1934
|
className: "space-y-0.5",
|
|
1923
|
-
children:
|
|
1935
|
+
children: b.map((e, t) => /* @__PURE__ */ Y("p", {
|
|
1924
1936
|
className: "text-xs text-destructive",
|
|
1925
1937
|
children: e
|
|
1926
1938
|
}, t))
|
|
1927
1939
|
}),
|
|
1928
|
-
|
|
1940
|
+
T.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1929
1941
|
className: "space-y-1",
|
|
1930
|
-
children:
|
|
1942
|
+
children: T.map((e, t) => /* @__PURE__ */ X("div", {
|
|
1931
1943
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
1932
1944
|
children: [/* @__PURE__ */ X("div", {
|
|
1933
1945
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
1934
1946
|
children: [
|
|
1935
|
-
|
|
1947
|
+
j(e) && e.url ? /* @__PURE__ */ Y("img", {
|
|
1936
1948
|
src: e.url,
|
|
1937
1949
|
alt: e.name,
|
|
1938
1950
|
className: "size-8 object-cover rounded shrink-0"
|
|
1939
|
-
}) :
|
|
1951
|
+
}) : j(e) ? /* @__PURE__ */ Y(we, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ Y(K, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
1940
1952
|
/* @__PURE__ */ Y("span", {
|
|
1941
1953
|
className: "text-sm truncate",
|
|
1942
1954
|
children: e.name || e.original_name || "File"
|
|
@@ -1950,15 +1962,15 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1950
1962
|
]
|
|
1951
1963
|
})
|
|
1952
1964
|
]
|
|
1953
|
-
}), /* @__PURE__ */ Y(
|
|
1965
|
+
}), /* @__PURE__ */ Y(x, {
|
|
1954
1966
|
type: "button",
|
|
1955
1967
|
variant: "ghost",
|
|
1956
1968
|
size: "sm",
|
|
1957
1969
|
onClick: (e) => {
|
|
1958
|
-
e.stopPropagation(),
|
|
1970
|
+
e.stopPropagation(), ie(t);
|
|
1959
1971
|
},
|
|
1960
1972
|
className: "h-6 w-6 p-0",
|
|
1961
|
-
children: /* @__PURE__ */ Y(
|
|
1973
|
+
children: /* @__PURE__ */ Y(Ie, { className: "size-3" })
|
|
1962
1974
|
})]
|
|
1963
1975
|
}, t))
|
|
1964
1976
|
})
|
|
@@ -1967,8 +1979,8 @@ function bn({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
|
1967
1979
|
]
|
|
1968
1980
|
});
|
|
1969
1981
|
}
|
|
1970
|
-
var
|
|
1971
|
-
|
|
1982
|
+
var Sn = Z((() => {})), Cn = /* @__PURE__ */ Q({ ImageCropperDialog: () => wn }), wn, Tn = Z((() => {
|
|
1983
|
+
wn = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
|
|
1972
1984
|
let u = c(null), d = c(null), [f, p] = l(0), [m, h] = l({
|
|
1973
1985
|
x: 0,
|
|
1974
1986
|
y: 0,
|
|
@@ -2004,7 +2016,7 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2004
2016
|
m,
|
|
2005
2017
|
f
|
|
2006
2018
|
]);
|
|
2007
|
-
let
|
|
2019
|
+
let b = r((e) => {
|
|
2008
2020
|
if (!d.current || !u.current) return;
|
|
2009
2021
|
let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width;
|
|
2010
2022
|
_({
|
|
@@ -2013,7 +2025,7 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2013
2025
|
cx: m.x,
|
|
2014
2026
|
cy: m.y
|
|
2015
2027
|
}), e.target.setPointerCapture(e.pointerId);
|
|
2016
|
-
}, [m]),
|
|
2028
|
+
}, [m]), S = r((e) => {
|
|
2017
2029
|
if (!g || !d.current || !u.current) return;
|
|
2018
2030
|
let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width, r = (e.clientX - t.left) * n - g.ox, i = (e.clientY - t.top) * n - g.oy, a = Math.max(0, Math.min(g.cx + r, d.current.naturalWidth - m.width)), o = Math.max(0, Math.min(g.cy + i, d.current.naturalHeight - m.height));
|
|
2019
2031
|
h((e) => ({
|
|
@@ -2025,7 +2037,7 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2025
2037
|
g,
|
|
2026
2038
|
m.width,
|
|
2027
2039
|
m.height
|
|
2028
|
-
]), E = r(() => _(null), []), D = r(() => p((e) => (e + 90) % 360), []),
|
|
2040
|
+
]), E = r(() => _(null), []), D = r(() => p((e) => (e + 90) % 360), []), O = r(async () => {
|
|
2029
2041
|
if (!d.current) return;
|
|
2030
2042
|
let e = d.current, n = document.createElement("canvas"), r = m.width, a = m.height;
|
|
2031
2043
|
n.width = f % 180 == 0 ? r : a, n.height = f % 180 == 0 ? a : r;
|
|
@@ -2042,13 +2054,13 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2042
2054
|
s,
|
|
2043
2055
|
t
|
|
2044
2056
|
]);
|
|
2045
|
-
return /* @__PURE__ */ Y(
|
|
2057
|
+
return /* @__PURE__ */ Y(ee, {
|
|
2046
2058
|
open: e,
|
|
2047
2059
|
onOpenChange: t,
|
|
2048
|
-
children: /* @__PURE__ */ X(
|
|
2060
|
+
children: /* @__PURE__ */ X(C, {
|
|
2049
2061
|
className: "max-w-xl",
|
|
2050
2062
|
children: [
|
|
2051
|
-
/* @__PURE__ */ X(
|
|
2063
|
+
/* @__PURE__ */ X(ne, { children: [/* @__PURE__ */ Y(T, { children: "Crop & rotate image" }), /* @__PURE__ */ Y(w, { children: "Drag the highlighted box to reposition the crop. Use the rotate button to spin the image in 90° increments." })] }),
|
|
2052
2064
|
/* @__PURE__ */ X("div", {
|
|
2053
2065
|
className: "flex flex-col items-center gap-3",
|
|
2054
2066
|
children: [v ? /* @__PURE__ */ Y("canvas", {
|
|
@@ -2057,8 +2069,8 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2057
2069
|
role: "img",
|
|
2058
2070
|
"aria-label": "Image crop preview",
|
|
2059
2071
|
className: "border rounded-md cursor-move touch-none max-w-full",
|
|
2060
|
-
onPointerDown:
|
|
2061
|
-
onPointerMove:
|
|
2072
|
+
onPointerDown: b,
|
|
2073
|
+
onPointerMove: S,
|
|
2062
2074
|
onPointerUp: E,
|
|
2063
2075
|
onPointerCancel: E
|
|
2064
2076
|
}) : /* @__PURE__ */ Y("div", {
|
|
@@ -2079,24 +2091,24 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2079
2091
|
] })]
|
|
2080
2092
|
})]
|
|
2081
2093
|
}),
|
|
2082
|
-
/* @__PURE__ */ X(
|
|
2094
|
+
/* @__PURE__ */ X(te, {
|
|
2083
2095
|
className: "flex justify-between sm:justify-between",
|
|
2084
|
-
children: [/* @__PURE__ */ X(
|
|
2096
|
+
children: [/* @__PURE__ */ X(x, {
|
|
2085
2097
|
type: "button",
|
|
2086
2098
|
variant: "outline",
|
|
2087
2099
|
onClick: D,
|
|
2088
2100
|
"data-testid": "image-cropper-rotate",
|
|
2089
|
-
children: [/* @__PURE__ */ Y(
|
|
2101
|
+
children: [/* @__PURE__ */ Y(J, { className: "size-4 mr-2" }), "Rotate 90°"]
|
|
2090
2102
|
}), /* @__PURE__ */ X("div", {
|
|
2091
2103
|
className: "flex gap-2",
|
|
2092
|
-
children: [/* @__PURE__ */ Y(
|
|
2104
|
+
children: [/* @__PURE__ */ Y(x, {
|
|
2093
2105
|
type: "button",
|
|
2094
2106
|
variant: "ghost",
|
|
2095
2107
|
onClick: () => t(!1),
|
|
2096
2108
|
children: "Cancel"
|
|
2097
|
-
}), /* @__PURE__ */ X(
|
|
2109
|
+
}), /* @__PURE__ */ X(x, {
|
|
2098
2110
|
type: "button",
|
|
2099
|
-
onClick:
|
|
2111
|
+
onClick: O,
|
|
2100
2112
|
disabled: !v,
|
|
2101
2113
|
"data-testid": "image-cropper-confirm",
|
|
2102
2114
|
children: [/* @__PURE__ */ Y(H, { className: "size-4 mr-2" }), "Apply crop"]
|
|
@@ -2107,9 +2119,9 @@ var xn = Z((() => {})), Sn = /* @__PURE__ */ Q({ ImageCropperDialog: () => Cn })
|
|
|
2107
2119
|
})
|
|
2108
2120
|
});
|
|
2109
2121
|
};
|
|
2110
|
-
})),
|
|
2111
|
-
function
|
|
2112
|
-
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, h] = l(null), { upload: g } =
|
|
2122
|
+
})), En = /* @__PURE__ */ Q({ ImageField: () => Dn });
|
|
2123
|
+
function Dn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
2124
|
+
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, h] = l(null), { upload: g } = Be(), [_, v] = l(!1);
|
|
2113
2125
|
if (a) return e ? /* @__PURE__ */ Y("div", {
|
|
2114
2126
|
className: "flex flex-wrap gap-2",
|
|
2115
2127
|
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ Y("img", {
|
|
@@ -2117,8 +2129,8 @@ function En({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2117
2129
|
alt: e.name || `Image ${t + 1}`,
|
|
2118
2130
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
2119
2131
|
}, t))
|
|
2120
|
-
}) : /* @__PURE__ */ Y(
|
|
2121
|
-
let y = e ? Array.isArray(e) ? e : [e] : [],
|
|
2132
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
2133
|
+
let y = e ? Array.isArray(e) ? e : [e] : [], b = async (e) => {
|
|
2122
2134
|
let t = Array.from(e.target.files || []);
|
|
2123
2135
|
if (t.length !== 0) {
|
|
2124
2136
|
v(!0);
|
|
@@ -2184,7 +2196,7 @@ function En({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2184
2196
|
type: "file",
|
|
2185
2197
|
multiple: d,
|
|
2186
2198
|
accept: f,
|
|
2187
|
-
onChange:
|
|
2199
|
+
onChange: b,
|
|
2188
2200
|
className: "hidden"
|
|
2189
2201
|
}),
|
|
2190
2202
|
/* @__PURE__ */ X("div", {
|
|
@@ -2199,7 +2211,7 @@ function En({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2199
2211
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
2200
2212
|
}), /* @__PURE__ */ X("div", {
|
|
2201
2213
|
className: "absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2202
|
-
children: [p && /* @__PURE__ */ Y(
|
|
2214
|
+
children: [p && /* @__PURE__ */ Y(x, {
|
|
2203
2215
|
type: "button",
|
|
2204
2216
|
variant: "secondary",
|
|
2205
2217
|
size: "sm",
|
|
@@ -2208,29 +2220,29 @@ function En({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2208
2220
|
"aria-label": `Crop image ${t + 1}`,
|
|
2209
2221
|
"data-testid": `image-field-crop-${t}`,
|
|
2210
2222
|
children: /* @__PURE__ */ Y(H, { className: "size-3" })
|
|
2211
|
-
}), /* @__PURE__ */ Y(
|
|
2223
|
+
}), /* @__PURE__ */ Y(x, {
|
|
2212
2224
|
type: "button",
|
|
2213
2225
|
variant: "destructive",
|
|
2214
2226
|
size: "sm",
|
|
2215
2227
|
onClick: () => S(t),
|
|
2216
2228
|
className: "h-6 w-6 p-0",
|
|
2217
|
-
children: /* @__PURE__ */ Y(
|
|
2229
|
+
children: /* @__PURE__ */ Y(Ie, { className: "size-3" })
|
|
2218
2230
|
})]
|
|
2219
2231
|
})]
|
|
2220
2232
|
}, t))
|
|
2221
|
-
}), /* @__PURE__ */ X(
|
|
2233
|
+
}), /* @__PURE__ */ X(x, {
|
|
2222
2234
|
type: "button",
|
|
2223
2235
|
variant: "outline",
|
|
2224
2236
|
onClick: () => s.current?.click(),
|
|
2225
2237
|
className: "w-full",
|
|
2226
2238
|
disabled: _,
|
|
2227
2239
|
"data-testid": "image-field-upload-button",
|
|
2228
|
-
children: [_ ? /* @__PURE__ */ Y(
|
|
2240
|
+
children: [_ ? /* @__PURE__ */ Y(Te, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ Y(Ce, { className: "size-4 mr-2" }), _ ? "Uploading…" : y.length > 0 ? "Add More Images" : "Upload Image"]
|
|
2229
2241
|
})]
|
|
2230
2242
|
}),
|
|
2231
2243
|
p && m && /* @__PURE__ */ Y(t, {
|
|
2232
2244
|
fallback: null,
|
|
2233
|
-
children: /* @__PURE__ */ Y(
|
|
2245
|
+
children: /* @__PURE__ */ Y(On, {
|
|
2234
2246
|
open: !0,
|
|
2235
2247
|
onOpenChange: (e) => !e && h(null),
|
|
2236
2248
|
src: m.src,
|
|
@@ -2241,15 +2253,15 @@ function En({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
|
2241
2253
|
]
|
|
2242
2254
|
});
|
|
2243
2255
|
}
|
|
2244
|
-
var
|
|
2245
|
-
|
|
2246
|
-
})),
|
|
2247
|
-
function
|
|
2256
|
+
var On, kn = Z((() => {
|
|
2257
|
+
On = n(() => Promise.resolve().then(() => (Tn(), Cn)).then((e) => ({ default: e.ImageCropperDialog })));
|
|
2258
|
+
})), An = /* @__PURE__ */ Q({ LocationField: () => jn });
|
|
2259
|
+
function jn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2248
2260
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
2249
2261
|
return r ? /* @__PURE__ */ Y("span", {
|
|
2250
2262
|
className: "text-sm",
|
|
2251
|
-
children: o || /* @__PURE__ */ Y(
|
|
2252
|
-
}) : /* @__PURE__ */ Y(
|
|
2263
|
+
children: o || /* @__PURE__ */ Y(E, {})
|
|
2264
|
+
}) : /* @__PURE__ */ Y(D, {
|
|
2253
2265
|
type: "text",
|
|
2254
2266
|
value: o,
|
|
2255
2267
|
onChange: (e) => {
|
|
@@ -2272,20 +2284,20 @@ function An({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2272
2284
|
className: i.className
|
|
2273
2285
|
});
|
|
2274
2286
|
}
|
|
2275
|
-
var
|
|
2276
|
-
function
|
|
2287
|
+
var Mn = Z((() => {})), Nn = /* @__PURE__ */ Q({ FormulaField: () => Pn });
|
|
2288
|
+
function Pn({ value: e, field: t, ...n }) {
|
|
2277
2289
|
let r = (t || n.schema)?.return_type || "text";
|
|
2278
|
-
if (e == null) return /* @__PURE__ */ Y(
|
|
2290
|
+
if (e == null) return /* @__PURE__ */ Y(E, { className: n.className });
|
|
2279
2291
|
let i;
|
|
2280
2292
|
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__ */ Y("span", {
|
|
2281
2293
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
2282
2294
|
children: i
|
|
2283
2295
|
});
|
|
2284
2296
|
}
|
|
2285
|
-
var
|
|
2286
|
-
function
|
|
2297
|
+
var Fn = Z((() => {})), In = /* @__PURE__ */ Q({ SummaryField: () => Ln });
|
|
2298
|
+
function Ln({ value: e, field: t, ...n }) {
|
|
2287
2299
|
let r = (t || n.schema)?.summary_type || "count";
|
|
2288
|
-
if (e == null) return /* @__PURE__ */ Y(
|
|
2300
|
+
if (e == null) return /* @__PURE__ */ Y(E, { className: n.className });
|
|
2289
2301
|
let i;
|
|
2290
2302
|
return i = r === "count" ? String(e) : [
|
|
2291
2303
|
"sum",
|
|
@@ -2297,15 +2309,15 @@ function In({ value: e, field: t, ...n }) {
|
|
|
2297
2309
|
children: i
|
|
2298
2310
|
});
|
|
2299
2311
|
}
|
|
2300
|
-
var
|
|
2301
|
-
function
|
|
2302
|
-
return e == null ? /* @__PURE__ */ Y(
|
|
2312
|
+
var Rn = Z((() => {})), zn = /* @__PURE__ */ Q({ AutoNumberField: () => Bn });
|
|
2313
|
+
function Bn({ value: e, field: t, ...n }) {
|
|
2314
|
+
return e == null ? /* @__PURE__ */ Y(E, { className: n.className }) : /* @__PURE__ */ Y("span", {
|
|
2303
2315
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
2304
2316
|
children: String(e)
|
|
2305
2317
|
});
|
|
2306
2318
|
}
|
|
2307
|
-
var
|
|
2308
|
-
function
|
|
2319
|
+
var Vn = Z((() => {})), Hn = /* @__PURE__ */ Q({ UserField: () => Un });
|
|
2320
|
+
function Un(e) {
|
|
2309
2321
|
let t = e.field || e.schema, n = t?.field && typeof t.field == "object" && ("reference" in t.field || "reference_to" in t.field || "type" in t.field), r = n ? t.field : t, i = {
|
|
2310
2322
|
...r || {},
|
|
2311
2323
|
reference: r?.reference || r?.reference_to || "sys_user",
|
|
@@ -2314,15 +2326,15 @@ function Hn(e) {
|
|
|
2314
2326
|
...t,
|
|
2315
2327
|
field: i
|
|
2316
2328
|
} : i;
|
|
2317
|
-
return /* @__PURE__ */ Y(
|
|
2329
|
+
return /* @__PURE__ */ Y(rn, {
|
|
2318
2330
|
...e,
|
|
2319
2331
|
field: a
|
|
2320
2332
|
});
|
|
2321
2333
|
}
|
|
2322
|
-
var
|
|
2323
|
-
|
|
2324
|
-
})),
|
|
2325
|
-
function
|
|
2334
|
+
var Wn = Z((() => {
|
|
2335
|
+
sn();
|
|
2336
|
+
})), Gn = /* @__PURE__ */ Q({ ObjectField: () => Kn });
|
|
2337
|
+
function Kn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2326
2338
|
let o = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
|
|
2327
2339
|
return a(() => {
|
|
2328
2340
|
try {
|
|
@@ -2338,7 +2350,7 @@ function Gn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2338
2350
|
}, [e, s]), r ? e ? /* @__PURE__ */ Y("pre", {
|
|
2339
2351
|
className: R("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
2340
2352
|
children: JSON.stringify(e, null, 2)
|
|
2341
|
-
}) : /* @__PURE__ */ Y(
|
|
2353
|
+
}) : /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ X("div", {
|
|
2342
2354
|
className: "space-y-1",
|
|
2343
2355
|
children: [/* @__PURE__ */ Y(L, {
|
|
2344
2356
|
value: s,
|
|
@@ -2364,10 +2376,10 @@ function Gn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2364
2376
|
})]
|
|
2365
2377
|
});
|
|
2366
2378
|
}
|
|
2367
|
-
var
|
|
2368
|
-
function
|
|
2379
|
+
var qn = Z((() => {})), Jn = /* @__PURE__ */ Q({ VectorField: () => Yn });
|
|
2380
|
+
function Yn({ value: e, field: t, ...n }) {
|
|
2369
2381
|
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
2370
|
-
if (!e || !Array.isArray(e)) return /* @__PURE__ */ Y(
|
|
2382
|
+
if (!e || !Array.isArray(e)) return /* @__PURE__ */ Y(E, {});
|
|
2371
2383
|
let i = e.slice(0, 3).map((e) => {
|
|
2372
2384
|
let t = Number(e);
|
|
2373
2385
|
return isNaN(t) ? "0" : t.toFixed(4);
|
|
@@ -2391,27 +2403,27 @@ function Jn({ value: e, field: t, ...n }) {
|
|
|
2391
2403
|
})]
|
|
2392
2404
|
});
|
|
2393
2405
|
}
|
|
2394
|
-
var
|
|
2395
|
-
GridField: () =>
|
|
2396
|
-
LineItemsField: () =>
|
|
2397
|
-
computeRow: () =>
|
|
2398
|
-
evalArith: () =>
|
|
2399
|
-
lookupAutofillPatch: () =>
|
|
2400
|
-
sumColumn: () =>
|
|
2406
|
+
var Xn = Z((() => {})), Zn = /* @__PURE__ */ Q({
|
|
2407
|
+
GridField: () => sr,
|
|
2408
|
+
LineItemsField: () => dr,
|
|
2409
|
+
computeRow: () => rr,
|
|
2410
|
+
evalArith: () => tr,
|
|
2411
|
+
lookupAutofillPatch: () => nr,
|
|
2412
|
+
sumColumn: () => or
|
|
2401
2413
|
});
|
|
2402
|
-
function
|
|
2414
|
+
function Qn(e) {
|
|
2403
2415
|
if (e.width) return {
|
|
2404
2416
|
width: e.width,
|
|
2405
2417
|
minWidth: e.width
|
|
2406
2418
|
};
|
|
2407
2419
|
if ((e.type ?? "text") === "text") return { minWidth: 180 };
|
|
2408
|
-
let t =
|
|
2420
|
+
let t = lr[e.type ?? "text"] ?? 132;
|
|
2409
2421
|
return {
|
|
2410
2422
|
width: t,
|
|
2411
2423
|
minWidth: t
|
|
2412
2424
|
};
|
|
2413
2425
|
}
|
|
2414
|
-
function
|
|
2426
|
+
function $n(e) {
|
|
2415
2427
|
let t = [], n = 0;
|
|
2416
2428
|
for (; n < e.length;) {
|
|
2417
2429
|
let r = e[n];
|
|
@@ -2462,14 +2474,14 @@ function Qn(e) {
|
|
|
2462
2474
|
}
|
|
2463
2475
|
return t;
|
|
2464
2476
|
}
|
|
2465
|
-
function
|
|
2477
|
+
function er(e, t) {
|
|
2466
2478
|
let n = e.startsWith("record.") ? e.slice(7) : e, r = t?.[n];
|
|
2467
2479
|
if (r == null || r === "") return null;
|
|
2468
2480
|
let i = Number(r);
|
|
2469
2481
|
return Number.isFinite(i) ? i : null;
|
|
2470
2482
|
}
|
|
2471
|
-
function
|
|
2472
|
-
let n =
|
|
2483
|
+
function tr(e, t) {
|
|
2484
|
+
let n = $n(e);
|
|
2473
2485
|
if (!n || n.length === 0) return null;
|
|
2474
2486
|
let r = 0, i = !1, a = () => n[r], o = () => n[r++];
|
|
2475
2487
|
function s() {
|
|
@@ -2480,7 +2492,7 @@ function er(e, t) {
|
|
|
2480
2492
|
if (e.t === "num") return o(), Number(e.v);
|
|
2481
2493
|
if (e.t === "id") {
|
|
2482
2494
|
o();
|
|
2483
|
-
let n =
|
|
2495
|
+
let n = er(e.v, t);
|
|
2484
2496
|
return n === null ? (i = !0, NaN) : n;
|
|
2485
2497
|
}
|
|
2486
2498
|
if (e.t === "lp") {
|
|
@@ -2509,7 +2521,7 @@ function er(e, t) {
|
|
|
2509
2521
|
let u = l();
|
|
2510
2522
|
return i || r !== n.length || !Number.isFinite(u) ? null : u;
|
|
2511
2523
|
}
|
|
2512
|
-
function
|
|
2524
|
+
function nr(e, t, n) {
|
|
2513
2525
|
let r = { [t.field]: n?.value ?? n?.id ?? n?._id };
|
|
2514
2526
|
if (t.autofill !== !1 && n && typeof n == "object") for (let i of e) {
|
|
2515
2527
|
if (i.field === t.field || i.computed || i.type === "lookup") continue;
|
|
@@ -2518,12 +2530,12 @@ function tr(e, t, n) {
|
|
|
2518
2530
|
}
|
|
2519
2531
|
return r;
|
|
2520
2532
|
}
|
|
2521
|
-
function
|
|
2533
|
+
function rr(e, t) {
|
|
2522
2534
|
let n = e.filter((e) => e.computed && e.expr);
|
|
2523
2535
|
if (n.length === 0) return t;
|
|
2524
2536
|
let r = { ...t };
|
|
2525
2537
|
for (let e of n) {
|
|
2526
|
-
let t =
|
|
2538
|
+
let t = tr(e.expr, r);
|
|
2527
2539
|
if (t === null) {
|
|
2528
2540
|
r[e.field] = null;
|
|
2529
2541
|
continue;
|
|
@@ -2533,39 +2545,39 @@ function nr(e, t) {
|
|
|
2533
2545
|
}
|
|
2534
2546
|
return r;
|
|
2535
2547
|
}
|
|
2536
|
-
function
|
|
2548
|
+
function ir(e, t) {
|
|
2537
2549
|
if (t == null || t === "") return "—";
|
|
2538
2550
|
if (e.type === "select" && Array.isArray(e.options)) {
|
|
2539
2551
|
let n = e.options.find((e) => String(e.value) === String(t));
|
|
2540
2552
|
return n ? n.label : String(t);
|
|
2541
2553
|
}
|
|
2542
|
-
if (
|
|
2554
|
+
if (cr(e.type)) {
|
|
2543
2555
|
let n = Number(t);
|
|
2544
2556
|
if (Number.isFinite(n)) return e.type === "currency" ? `${e.prefix || "¥"}${n.toLocaleString()}` : n.toLocaleString();
|
|
2545
2557
|
}
|
|
2546
2558
|
return Array.isArray(t) ? t.join(", ") : String(t);
|
|
2547
2559
|
}
|
|
2548
|
-
function
|
|
2549
|
-
if (
|
|
2560
|
+
function ar(e, t) {
|
|
2561
|
+
if (cr(e)) {
|
|
2550
2562
|
if (t === "" || t == null) return null;
|
|
2551
2563
|
let e = Number(t);
|
|
2552
2564
|
return Number.isNaN(e) ? t : e;
|
|
2553
2565
|
}
|
|
2554
2566
|
return t;
|
|
2555
2567
|
}
|
|
2556
|
-
function
|
|
2568
|
+
function or(e, t) {
|
|
2557
2569
|
return Array.isArray(e) ? e.reduce((e, n) => {
|
|
2558
2570
|
let r = Number(n?.[t]);
|
|
2559
2571
|
return e + (Number.isFinite(r) ? r : 0);
|
|
2560
2572
|
}, 0) : 0;
|
|
2561
2573
|
}
|
|
2562
|
-
function
|
|
2563
|
-
let m = i ||
|
|
2574
|
+
function sr({ value: t, onChange: n, field: i, readonly: a, disabled: o, className: s, onRowExpand: l, displayMode: u, onAdd: d, ...f }) {
|
|
2575
|
+
let m = i || f.schema || {}, h = m.columns || [], g = Array.isArray(t) ? t : [], _ = f.contextRecord, v = r((e, t) => {
|
|
2564
2576
|
if (!e.readonlyWhen && !e.requiredWhen) return {
|
|
2565
2577
|
readonly: !1,
|
|
2566
2578
|
required: !!e.required
|
|
2567
2579
|
};
|
|
2568
|
-
let n =
|
|
2580
|
+
let n = p({
|
|
2569
2581
|
readonlyWhen: e.readonlyWhen,
|
|
2570
2582
|
requiredWhen: e.requiredWhen
|
|
2571
2583
|
}, t || {}, {
|
|
@@ -2576,12 +2588,12 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2576
2588
|
readonly: n.readonly,
|
|
2577
2589
|
required: n.required
|
|
2578
2590
|
};
|
|
2579
|
-
}, [_]), y = u === "list" && !a, [
|
|
2591
|
+
}, [_]), y = u === "list" && !a, [b, ee] = e.useState(() => /* @__PURE__ */ new Set()), C = h.filter((e) => e.defaultHidden && !e.required), w = h.filter((e) => !e.defaultHidden || e.required || b.has(e.field)), te = r((e) => {
|
|
2580
2592
|
ee((t) => {
|
|
2581
2593
|
let n = new Set(t);
|
|
2582
2594
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
2583
2595
|
});
|
|
2584
|
-
}, []), ne = m.allow_add !== !1 && !a && !o, T = m.allow_delete !== !1 && !a && !o,
|
|
2596
|
+
}, []), ne = m.allow_add !== !1 && !a && !o, T = m.allow_delete !== !1 && !a && !o, E = m.allow_duplicate !== !1 && ne, ie = typeof l == "function" && !a, j = m.show_line_numbers !== !1, le = m.min_rows ?? 0, N = m.max_rows, P = m.total_field || m.amount_field || m.amountField, ue = m.sort_field, F = m.reorderable !== !1 && !a && !o, I = r((e) => {
|
|
2585
2597
|
n?.(ue ? e.map((e, t) => ({
|
|
2586
2598
|
...e,
|
|
2587
2599
|
[ue]: t
|
|
@@ -2593,13 +2605,13 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2593
2605
|
}, [w]), fe = r((e, t) => {
|
|
2594
2606
|
if (e >= g.length) {
|
|
2595
2607
|
if (N != null && g.length >= N) return;
|
|
2596
|
-
I([...g,
|
|
2608
|
+
I([...g, rr(w, {
|
|
2597
2609
|
...de(),
|
|
2598
2610
|
...t
|
|
2599
2611
|
})]);
|
|
2600
2612
|
return;
|
|
2601
2613
|
}
|
|
2602
|
-
I(g.map((n, r) => r === e ?
|
|
2614
|
+
I(g.map((n, r) => r === e ? rr(w, {
|
|
2603
2615
|
...n,
|
|
2604
2616
|
...t
|
|
2605
2617
|
}) : n));
|
|
@@ -2609,11 +2621,11 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2609
2621
|
N,
|
|
2610
2622
|
de,
|
|
2611
2623
|
I
|
|
2612
|
-
]),
|
|
2613
|
-
fe(e,
|
|
2614
|
-
}, [w, fe]), me = r((e, t, n) =>
|
|
2615
|
-
|
|
2616
|
-
}, [
|
|
2624
|
+
]), pe = r((e, t, n) => fe(e, { [t]: n }), [fe]), L = r((e, t, n) => {
|
|
2625
|
+
fe(e, nr(w, t, n));
|
|
2626
|
+
}, [w, fe]), me = r((e, t, n) => pe(e, t, n), [pe]), z = r((e, t, n) => {
|
|
2627
|
+
pe(e, t.field, ar(t.type, n));
|
|
2628
|
+
}, [pe]), he = r(() => {
|
|
2617
2629
|
N != null && g.length >= N || I([...g, de()]);
|
|
2618
2630
|
}, [
|
|
2619
2631
|
g,
|
|
@@ -2626,12 +2638,12 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2626
2638
|
}, []), B = r((e, t, n) => {
|
|
2627
2639
|
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(), _e(t + 1, n)) : e.key === "ArrowUp" && (e.preventDefault(), t > 0 && _e(t - 1, n));
|
|
2628
2640
|
}, [_e]), ve = r((e) => {
|
|
2629
|
-
g.length <=
|
|
2641
|
+
g.length <= le || I(g.filter((t, n) => n !== e));
|
|
2630
2642
|
}, [
|
|
2631
2643
|
g,
|
|
2632
|
-
|
|
2644
|
+
le,
|
|
2633
2645
|
I
|
|
2634
|
-
]),
|
|
2646
|
+
]), ye = r((e) => {
|
|
2635
2647
|
if (N != null && g.length >= N) return;
|
|
2636
2648
|
let t = g[e];
|
|
2637
2649
|
if (!t) return;
|
|
@@ -2641,28 +2653,28 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2641
2653
|
g,
|
|
2642
2654
|
N,
|
|
2643
2655
|
I
|
|
2644
|
-
]),
|
|
2656
|
+
]), H = r((e, t) => {
|
|
2645
2657
|
if (e === t || e < 0 || t < 0 || e >= g.length || t >= g.length) return;
|
|
2646
2658
|
let n = [...g], [r] = n.splice(e, 1);
|
|
2647
2659
|
n.splice(t, 0, r), I(n);
|
|
2648
|
-
}, [g, I]), be = c(null), U =
|
|
2660
|
+
}, [g, I]), be = c(null), U = ie || T || E, W = (+!!ie + +!!E + +!!T) * 34 + 12, G = !!P, xe = G ? or(g, P) : 0, K = G ? Math.max(0, w.findIndex((e) => e.field === P)) : -1, Ce = C.length > 0 ? /* @__PURE__ */ X(re, { children: [/* @__PURE__ */ Y(A, {
|
|
2649
2661
|
asChild: !0,
|
|
2650
|
-
children: /* @__PURE__ */ X(
|
|
2662
|
+
children: /* @__PURE__ */ X(x, {
|
|
2651
2663
|
type: "button",
|
|
2652
2664
|
variant: "ghost",
|
|
2653
2665
|
size: "sm",
|
|
2654
2666
|
className: "h-7 gap-1.5 text-xs text-muted-foreground",
|
|
2655
2667
|
"data-testid": "line-items-columns",
|
|
2656
2668
|
children: [
|
|
2657
|
-
/* @__PURE__ */ Y(
|
|
2669
|
+
/* @__PURE__ */ Y(je, { className: "h-3.5 w-3.5" }),
|
|
2658
2670
|
"Columns",
|
|
2659
|
-
|
|
2671
|
+
b.size > 0 && /* @__PURE__ */ X("span", {
|
|
2660
2672
|
className: "rounded-full bg-primary/10 px-1.5 text-[10px] font-medium text-primary",
|
|
2661
|
-
children: ["+",
|
|
2673
|
+
children: ["+", b.size]
|
|
2662
2674
|
})
|
|
2663
2675
|
]
|
|
2664
2676
|
})
|
|
2665
|
-
}), /* @__PURE__ */ X(
|
|
2677
|
+
}), /* @__PURE__ */ X(k, {
|
|
2666
2678
|
align: "end",
|
|
2667
2679
|
className: "w-56 p-2",
|
|
2668
2680
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -2672,12 +2684,12 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2672
2684
|
className: "max-h-64 space-y-0.5 overflow-y-auto",
|
|
2673
2685
|
children: C.map((e) => {
|
|
2674
2686
|
let t = `col-toggle-${e.field}`;
|
|
2675
|
-
return /* @__PURE__ */ X(
|
|
2687
|
+
return /* @__PURE__ */ X(O, {
|
|
2676
2688
|
htmlFor: t,
|
|
2677
2689
|
className: "flex cursor-pointer items-center gap-2 rounded-md px-1.5 py-1.5 text-sm font-normal hover:bg-muted",
|
|
2678
|
-
children: [/* @__PURE__ */ Y(
|
|
2690
|
+
children: [/* @__PURE__ */ Y(S, {
|
|
2679
2691
|
id: t,
|
|
2680
|
-
checked:
|
|
2692
|
+
checked: b.has(e.field),
|
|
2681
2693
|
onCheckedChange: () => te(e.field)
|
|
2682
2694
|
}), /* @__PURE__ */ Y("span", {
|
|
2683
2695
|
className: "truncate",
|
|
@@ -2704,8 +2716,8 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2704
2716
|
className: "w-10 px-2 py-2 text-right text-xs font-medium text-muted-foreground",
|
|
2705
2717
|
children: "#"
|
|
2706
2718
|
}), w.map((e) => /* @__PURE__ */ Y("th", {
|
|
2707
|
-
style: { minWidth:
|
|
2708
|
-
className: R("px-3 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap",
|
|
2719
|
+
style: { minWidth: ur(e) },
|
|
2720
|
+
className: R("px-3 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap", cr(e.type) ? "text-right" : "text-left"),
|
|
2709
2721
|
children: e.label || e.field
|
|
2710
2722
|
}, e.field))] })
|
|
2711
2723
|
}),
|
|
@@ -2719,8 +2731,8 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2719
2731
|
className: "px-2 py-2 text-right text-muted-foreground tabular-nums",
|
|
2720
2732
|
children: t + 1
|
|
2721
2733
|
}), w.map((t) => /* @__PURE__ */ Y("td", {
|
|
2722
|
-
className: R("px-3 py-2 text-foreground",
|
|
2723
|
-
children: t.type === "lookup" && e[t.field] != null && e[t.field] !== "" ? /* @__PURE__ */ Y(
|
|
2734
|
+
className: R("px-3 py-2 text-foreground", cr(t.type) && "text-right tabular-nums"),
|
|
2735
|
+
children: t.type === "lookup" && e[t.field] != null && e[t.field] !== "" ? /* @__PURE__ */ Y(rn, {
|
|
2724
2736
|
value: e[t.field],
|
|
2725
2737
|
onChange: () => {},
|
|
2726
2738
|
readonly: !0,
|
|
@@ -2751,9 +2763,9 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2751
2763
|
})
|
|
2752
2764
|
})]
|
|
2753
2765
|
});
|
|
2754
|
-
let we = !y && ne && (N == null || g.length < N), Te = we ? [...g, de()] : g,
|
|
2766
|
+
let we = !y && ne && (N == null || g.length < N), Te = we ? [...g, de()] : g, q = (e, t, n, r) => {
|
|
2755
2767
|
let i = r?.[e.field], a = o || v(e, r).readonly;
|
|
2756
|
-
return y ? e.type === "lookup" && i != null && i !== "" ? /* @__PURE__ */ Y(
|
|
2768
|
+
return y ? e.type === "lookup" && i != null && i !== "" ? /* @__PURE__ */ Y(rn, {
|
|
2757
2769
|
value: i,
|
|
2758
2770
|
onChange: () => {},
|
|
2759
2771
|
readonly: !0,
|
|
@@ -2763,17 +2775,17 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2763
2775
|
id_field: e.idField
|
|
2764
2776
|
}
|
|
2765
2777
|
}) : /* @__PURE__ */ Y("span", {
|
|
2766
|
-
className: R("px-2 text-sm text-foreground",
|
|
2767
|
-
children:
|
|
2778
|
+
className: R("px-2 text-sm text-foreground", cr(e.type) && "tabular-nums", (i == null || i === "") && "text-muted-foreground"),
|
|
2779
|
+
children: ir(e, i)
|
|
2768
2780
|
}) : e.computed ? /* @__PURE__ */ Y("span", {
|
|
2769
|
-
className: R("block px-2 text-sm tabular-nums",
|
|
2781
|
+
className: R("block px-2 text-sm tabular-nums", cr(e.type) ? "text-right" : "text-left", i == null || i === "" ? "text-muted-foreground" : "text-foreground"),
|
|
2770
2782
|
title: "Computed",
|
|
2771
2783
|
"data-computed": e.field,
|
|
2772
|
-
children:
|
|
2773
|
-
}) : e.type === "lookup" ? /* @__PURE__ */ Y(
|
|
2784
|
+
children: ir(e, i)
|
|
2785
|
+
}) : e.type === "lookup" ? /* @__PURE__ */ Y(rn, {
|
|
2774
2786
|
value: i,
|
|
2775
2787
|
onChange: (t) => me(n, e.field, t),
|
|
2776
|
-
onSelectRecord: (t) =>
|
|
2788
|
+
onSelectRecord: (t) => L(n, e, t),
|
|
2777
2789
|
compact: !0,
|
|
2778
2790
|
field: {
|
|
2779
2791
|
reference: e.reference,
|
|
@@ -2784,14 +2796,14 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2784
2796
|
placeholder: "—"
|
|
2785
2797
|
},
|
|
2786
2798
|
disabled: a
|
|
2787
|
-
}) : e.type === "select" ? /* @__PURE__ */ X(
|
|
2799
|
+
}) : e.type === "select" ? /* @__PURE__ */ X(ae, {
|
|
2788
2800
|
value: i == null ? "" : String(i),
|
|
2789
2801
|
onValueChange: (t) => z(n, e, t),
|
|
2790
2802
|
disabled: a,
|
|
2791
2803
|
children: [/* @__PURE__ */ Y(ce, {
|
|
2792
2804
|
className: "h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus:ring-1 focus:ring-ring/60",
|
|
2793
2805
|
"aria-label": e.label || e.field,
|
|
2794
|
-
children: /* @__PURE__ */ Y(
|
|
2806
|
+
children: /* @__PURE__ */ Y(M, { placeholder: "—" })
|
|
2795
2807
|
}), /* @__PURE__ */ Y(oe, { children: (e.options || []).map((e) => /* @__PURE__ */ Y(se, {
|
|
2796
2808
|
value: e.value,
|
|
2797
2809
|
children: e.label
|
|
@@ -2801,12 +2813,12 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2801
2813
|
children: [e.type === "currency" && /* @__PURE__ */ Y("span", {
|
|
2802
2814
|
className: "pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground",
|
|
2803
2815
|
children: e.prefix || "¥"
|
|
2804
|
-
}), /* @__PURE__ */ Y(
|
|
2816
|
+
}), /* @__PURE__ */ Y(D, {
|
|
2805
2817
|
"data-cell": `${n}-${t}`,
|
|
2806
2818
|
onKeyDown: (e) => B(e, n, t),
|
|
2807
|
-
className: R("h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60", e.type === "currency" && "pl-6",
|
|
2808
|
-
type: e.type === "date" ? "date" :
|
|
2809
|
-
step:
|
|
2819
|
+
className: R("h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60", e.type === "currency" && "pl-6", cr(e.type) && "text-right tabular-nums"),
|
|
2820
|
+
type: e.type === "date" ? "date" : cr(e.type) ? "number" : "text",
|
|
2821
|
+
step: cr(e.type) ? e.step ?? "any" : void 0,
|
|
2810
2822
|
"aria-label": e.label || e.field,
|
|
2811
2823
|
value: i == null ? "" : String(i),
|
|
2812
2824
|
onChange: (t) => z(n, e, t.target.value),
|
|
@@ -2836,8 +2848,8 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2836
2848
|
children: "#"
|
|
2837
2849
|
}),
|
|
2838
2850
|
w.map((e) => /* @__PURE__ */ X("th", {
|
|
2839
|
-
className: R("px-2 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap",
|
|
2840
|
-
style:
|
|
2851
|
+
className: R("px-2 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap", cr(e.type) ? "text-right" : "text-left"),
|
|
2852
|
+
style: Qn(e),
|
|
2841
2853
|
children: [e.label || e.field, e.required && !e.computed && /* @__PURE__ */ Y("span", {
|
|
2842
2854
|
className: "text-destructive",
|
|
2843
2855
|
children: " *"
|
|
@@ -2865,7 +2877,7 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2865
2877
|
be.current != null && e.preventDefault();
|
|
2866
2878
|
},
|
|
2867
2879
|
onDrop: (e) => {
|
|
2868
|
-
e.preventDefault(), be.current != null && (
|
|
2880
|
+
e.preventDefault(), be.current != null && (H(be.current, t), be.current = null);
|
|
2869
2881
|
}
|
|
2870
2882
|
} : {},
|
|
2871
2883
|
children: [
|
|
@@ -2899,7 +2911,7 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2899
2911
|
title: o ? `${r.label || r.field} is required` : void 0,
|
|
2900
2912
|
"data-testid": o ? `line-items-invalid-${t}-${r.field}` : void 0,
|
|
2901
2913
|
className: R("border-r border-border/40 px-1 py-0.5 align-middle last:border-r-0", y && "px-2 py-1.5", o && "bg-destructive/5 ring-1 ring-inset ring-destructive/50"),
|
|
2902
|
-
children:
|
|
2914
|
+
children: q(r, i, t, e)
|
|
2903
2915
|
}, r.field);
|
|
2904
2916
|
}),
|
|
2905
2917
|
U && /* @__PURE__ */ Y("td", {
|
|
@@ -2907,7 +2919,7 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2907
2919
|
children: /* @__PURE__ */ X("div", {
|
|
2908
2920
|
className: "flex items-center justify-center gap-0.5",
|
|
2909
2921
|
children: [
|
|
2910
|
-
!n &&
|
|
2922
|
+
!n && ie && /* @__PURE__ */ Y(x, {
|
|
2911
2923
|
type: "button",
|
|
2912
2924
|
variant: "ghost",
|
|
2913
2925
|
size: "icon",
|
|
@@ -2916,9 +2928,9 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2916
2928
|
title: "Open full form",
|
|
2917
2929
|
"data-testid": `line-items-expand-${t}`,
|
|
2918
2930
|
onClick: () => l(t),
|
|
2919
|
-
children: /* @__PURE__ */ Y(
|
|
2931
|
+
children: /* @__PURE__ */ Y(Ee, { className: "h-3.5 w-3.5" })
|
|
2920
2932
|
}),
|
|
2921
|
-
!n &&
|
|
2933
|
+
!n && E && /* @__PURE__ */ Y(x, {
|
|
2922
2934
|
type: "button",
|
|
2923
2935
|
variant: "ghost",
|
|
2924
2936
|
size: "icon",
|
|
@@ -2926,11 +2938,11 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2926
2938
|
"aria-label": "Duplicate row",
|
|
2927
2939
|
title: "Duplicate line",
|
|
2928
2940
|
"data-testid": `line-items-duplicate-${t}`,
|
|
2929
|
-
onClick: () =>
|
|
2941
|
+
onClick: () => ye(t),
|
|
2930
2942
|
disabled: o || N != null && g.length >= N,
|
|
2931
2943
|
children: /* @__PURE__ */ Y(V, { className: "h-3.5 w-3.5" })
|
|
2932
2944
|
}),
|
|
2933
|
-
!n && T && /* @__PURE__ */ Y(
|
|
2945
|
+
!n && T && /* @__PURE__ */ Y(x, {
|
|
2934
2946
|
type: "button",
|
|
2935
2947
|
variant: "ghost",
|
|
2936
2948
|
size: "icon",
|
|
@@ -2938,8 +2950,8 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2938
2950
|
"aria-label": "Remove row",
|
|
2939
2951
|
"data-testid": `line-items-remove-${t}`,
|
|
2940
2952
|
onClick: () => ve(t),
|
|
2941
|
-
disabled: o || g.length <=
|
|
2942
|
-
children: /* @__PURE__ */ Y(
|
|
2953
|
+
disabled: o || g.length <= le,
|
|
2954
|
+
children: /* @__PURE__ */ Y(Pe, { className: "h-4 w-4" })
|
|
2943
2955
|
})
|
|
2944
2956
|
]
|
|
2945
2957
|
})
|
|
@@ -2967,29 +2979,29 @@ function or({ value: t, onChange: n, field: i, readonly: a, disabled: o, classNa
|
|
|
2967
2979
|
]
|
|
2968
2980
|
})
|
|
2969
2981
|
}),
|
|
2970
|
-
ne && /* @__PURE__ */ X(
|
|
2982
|
+
ne && /* @__PURE__ */ X(x, {
|
|
2971
2983
|
type: "button",
|
|
2972
2984
|
variant: "outline",
|
|
2973
2985
|
size: "sm",
|
|
2974
2986
|
onClick: y && d ? d : he,
|
|
2975
2987
|
disabled: N != null && g.length >= N,
|
|
2976
2988
|
"data-testid": "line-items-add",
|
|
2977
|
-
children: [/* @__PURE__ */ Y(
|
|
2989
|
+
children: [/* @__PURE__ */ Y(Oe, { className: "mr-1.5 h-4 w-4" }), m.add_label || "Add line"]
|
|
2978
2990
|
})
|
|
2979
2991
|
]
|
|
2980
2992
|
});
|
|
2981
2993
|
}
|
|
2982
|
-
var
|
|
2983
|
-
|
|
2994
|
+
var cr, lr, ur, dr, fr = Z((() => {
|
|
2995
|
+
sn(), cr = (e) => e === "number" || e === "currency", lr = {
|
|
2984
2996
|
text: 160,
|
|
2985
2997
|
select: 132,
|
|
2986
2998
|
lookup: 168,
|
|
2987
2999
|
number: 104,
|
|
2988
3000
|
currency: 116,
|
|
2989
3001
|
date: 150
|
|
2990
|
-
},
|
|
2991
|
-
})),
|
|
2992
|
-
function
|
|
3002
|
+
}, ur = (e) => e.width ?? lr[e.type ?? "text"] ?? 132, dr = sr;
|
|
3003
|
+
})), pr = /* @__PURE__ */ Q({ ColorField: () => mr });
|
|
3004
|
+
function mr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2993
3005
|
let a = n || i.schema;
|
|
2994
3006
|
return r ? /* @__PURE__ */ X("div", {
|
|
2995
3007
|
className: "flex items-center gap-2",
|
|
@@ -2998,7 +3010,7 @@ function pr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2998
3010
|
style: { backgroundColor: e || "#000000" }
|
|
2999
3011
|
}), /* @__PURE__ */ Y("span", {
|
|
3000
3012
|
className: "text-sm",
|
|
3001
|
-
children: e || /* @__PURE__ */ Y(
|
|
3013
|
+
children: e || /* @__PURE__ */ Y(E, {})
|
|
3002
3014
|
})]
|
|
3003
3015
|
}) : /* @__PURE__ */ X("div", {
|
|
3004
3016
|
className: "flex items-center gap-2",
|
|
@@ -3008,7 +3020,7 @@ function pr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3008
3020
|
onChange: (e) => t(e.target.value),
|
|
3009
3021
|
disabled: r || i.disabled,
|
|
3010
3022
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
3011
|
-
}), /* @__PURE__ */ Y(
|
|
3023
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3012
3024
|
type: "text",
|
|
3013
3025
|
value: e || "",
|
|
3014
3026
|
onChange: (e) => t(e.target.value),
|
|
@@ -3019,8 +3031,8 @@ function pr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3019
3031
|
})]
|
|
3020
3032
|
});
|
|
3021
3033
|
}
|
|
3022
|
-
var
|
|
3023
|
-
function
|
|
3034
|
+
var hr = Z((() => {})), gr = /* @__PURE__ */ Q({ SliderField: () => _r });
|
|
3035
|
+
function _r({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3024
3036
|
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
3025
3037
|
return r ? /* @__PURE__ */ X("div", {
|
|
3026
3038
|
className: "flex items-center gap-2",
|
|
@@ -3033,7 +3045,7 @@ function gr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3033
3045
|
})]
|
|
3034
3046
|
}) : /* @__PURE__ */ X("div", {
|
|
3035
3047
|
className: "flex items-center gap-4",
|
|
3036
|
-
children: [/* @__PURE__ */ Y(
|
|
3048
|
+
children: [/* @__PURE__ */ Y(N, {
|
|
3037
3049
|
value: [e ?? o],
|
|
3038
3050
|
onValueChange: (e) => t(e[0]),
|
|
3039
3051
|
min: o,
|
|
@@ -3047,12 +3059,12 @@ function gr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3047
3059
|
})]
|
|
3048
3060
|
});
|
|
3049
3061
|
}
|
|
3050
|
-
var
|
|
3051
|
-
function
|
|
3062
|
+
var vr = Z((() => {})), yr = /* @__PURE__ */ Q({ RatingField: () => br });
|
|
3063
|
+
function br({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
3052
3064
|
let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
|
|
3053
3065
|
return i ? /* @__PURE__ */ X("div", {
|
|
3054
3066
|
className: R("flex items-center gap-1", a),
|
|
3055
|
-
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ Y(
|
|
3067
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ Y(Me, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ X("span", {
|
|
3056
3068
|
className: "ml-2 text-sm text-muted-foreground",
|
|
3057
3069
|
children: [
|
|
3058
3070
|
c,
|
|
@@ -3069,7 +3081,7 @@ function yr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3069
3081
|
onMouseLeave: () => u(null),
|
|
3070
3082
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
3071
3083
|
disabled: i || o.disabled,
|
|
3072
|
-
children: /* @__PURE__ */ Y(
|
|
3084
|
+
children: /* @__PURE__ */ Y(Me, { 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"}` })
|
|
3073
3085
|
}, t)), /* @__PURE__ */ X("span", {
|
|
3074
3086
|
className: "ml-2 text-sm text-muted-foreground",
|
|
3075
3087
|
children: [
|
|
@@ -3080,12 +3092,12 @@ function yr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3080
3092
|
})]
|
|
3081
3093
|
});
|
|
3082
3094
|
}
|
|
3083
|
-
var
|
|
3084
|
-
function
|
|
3095
|
+
var xr = Z((() => {})), Sr = /* @__PURE__ */ Q({ CodeField: () => Cr });
|
|
3096
|
+
function Cr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3085
3097
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
3086
3098
|
return r ? /* @__PURE__ */ Y("pre", {
|
|
3087
3099
|
className: R("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
3088
|
-
children: /* @__PURE__ */ Y("code", { children: e || /* @__PURE__ */ Y(
|
|
3100
|
+
children: /* @__PURE__ */ Y("code", { children: e || /* @__PURE__ */ Y(E, {}) })
|
|
3089
3101
|
}) : /* @__PURE__ */ Y(L, {
|
|
3090
3102
|
value: e || "",
|
|
3091
3103
|
onChange: (e) => t(e.target.value),
|
|
@@ -3096,8 +3108,8 @@ function Sr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3096
3108
|
spellCheck: !1
|
|
3097
3109
|
});
|
|
3098
3110
|
}
|
|
3099
|
-
var
|
|
3100
|
-
function
|
|
3111
|
+
var wr = Z((() => {})), Tr = /* @__PURE__ */ Q({ AvatarField: () => Er });
|
|
3112
|
+
function Er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
3101
3113
|
let [o, s] = e.useState(!1), c = e.useRef(null), l = r || a.schema, u = (e) => {
|
|
3102
3114
|
let t = e.target.files?.[0];
|
|
3103
3115
|
if (!t) return;
|
|
@@ -3116,29 +3128,29 @@ function Tr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3116
3128
|
}, d = () => {
|
|
3117
3129
|
n("");
|
|
3118
3130
|
}, f = () => (l?.defaultName || l?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
3119
|
-
return i ? /* @__PURE__ */ X(
|
|
3131
|
+
return i ? /* @__PURE__ */ X(_, {
|
|
3120
3132
|
className: "w-16 h-16",
|
|
3121
|
-
children: [t && /* @__PURE__ */ Y(
|
|
3133
|
+
children: [t && /* @__PURE__ */ Y(y, {
|
|
3122
3134
|
src: t,
|
|
3123
3135
|
alt: l?.label
|
|
3124
|
-
}), /* @__PURE__ */ Y(
|
|
3136
|
+
}), /* @__PURE__ */ Y(v, { children: f() })]
|
|
3125
3137
|
}) : /* @__PURE__ */ X("div", {
|
|
3126
3138
|
className: "flex items-center gap-4",
|
|
3127
3139
|
children: [/* @__PURE__ */ X("div", {
|
|
3128
3140
|
className: "relative",
|
|
3129
3141
|
onMouseEnter: () => s(!0),
|
|
3130
3142
|
onMouseLeave: () => s(!1),
|
|
3131
|
-
children: [/* @__PURE__ */ X(
|
|
3143
|
+
children: [/* @__PURE__ */ X(_, {
|
|
3132
3144
|
className: "w-16 h-16",
|
|
3133
|
-
children: [t && /* @__PURE__ */ Y(
|
|
3145
|
+
children: [t && /* @__PURE__ */ Y(y, {
|
|
3134
3146
|
src: t,
|
|
3135
3147
|
alt: l?.label
|
|
3136
|
-
}), /* @__PURE__ */ Y(
|
|
3148
|
+
}), /* @__PURE__ */ Y(v, { children: f() })]
|
|
3137
3149
|
}), !i && o && t && /* @__PURE__ */ Y("button", {
|
|
3138
3150
|
type: "button",
|
|
3139
3151
|
onClick: d,
|
|
3140
3152
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
3141
|
-
children: /* @__PURE__ */ Y(
|
|
3153
|
+
children: /* @__PURE__ */ Y(Ie, { className: "w-3 h-3" })
|
|
3142
3154
|
})]
|
|
3143
3155
|
}), /* @__PURE__ */ X("div", {
|
|
3144
3156
|
className: "flex flex-col gap-2",
|
|
@@ -3150,14 +3162,14 @@ function Tr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3150
3162
|
onChange: u,
|
|
3151
3163
|
className: "hidden"
|
|
3152
3164
|
}),
|
|
3153
|
-
/* @__PURE__ */ X(
|
|
3165
|
+
/* @__PURE__ */ X(x, {
|
|
3154
3166
|
type: "button",
|
|
3155
3167
|
variant: "outline",
|
|
3156
3168
|
size: "sm",
|
|
3157
3169
|
onClick: () => c.current?.click(),
|
|
3158
3170
|
disabled: i || a.disabled,
|
|
3159
3171
|
children: [
|
|
3160
|
-
/* @__PURE__ */ Y(
|
|
3172
|
+
/* @__PURE__ */ Y(Fe, { className: "w-4 h-4 mr-2" }),
|
|
3161
3173
|
t ? "Change" : "Upload",
|
|
3162
3174
|
" Avatar"
|
|
3163
3175
|
]
|
|
@@ -3170,8 +3182,8 @@ function Tr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3170
3182
|
})]
|
|
3171
3183
|
});
|
|
3172
3184
|
}
|
|
3173
|
-
var
|
|
3174
|
-
function
|
|
3185
|
+
var Dr = Z((() => {})), Or = /* @__PURE__ */ Q({ AddressField: () => kr });
|
|
3186
|
+
function kr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3175
3187
|
let a = e || {}, o = (e, n) => {
|
|
3176
3188
|
t({
|
|
3177
3189
|
...a,
|
|
@@ -3188,16 +3200,16 @@ function Or({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3188
3200
|
return e ? /* @__PURE__ */ Y("span", {
|
|
3189
3201
|
className: "text-sm",
|
|
3190
3202
|
children: e
|
|
3191
|
-
}) : /* @__PURE__ */ Y(
|
|
3203
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
3192
3204
|
}
|
|
3193
3205
|
return /* @__PURE__ */ X("div", {
|
|
3194
3206
|
className: "space-y-3",
|
|
3195
3207
|
children: [
|
|
3196
|
-
/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3208
|
+
/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3197
3209
|
htmlFor: "street",
|
|
3198
3210
|
className: "text-xs",
|
|
3199
3211
|
children: "Street Address"
|
|
3200
|
-
}), /* @__PURE__ */ Y(
|
|
3212
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3201
3213
|
id: "street",
|
|
3202
3214
|
type: "text",
|
|
3203
3215
|
value: a.street || "",
|
|
@@ -3208,22 +3220,22 @@ function Or({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3208
3220
|
})] }),
|
|
3209
3221
|
/* @__PURE__ */ X("div", {
|
|
3210
3222
|
className: "grid grid-cols-2 gap-3",
|
|
3211
|
-
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3223
|
+
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3212
3224
|
htmlFor: "city",
|
|
3213
3225
|
className: "text-xs",
|
|
3214
3226
|
children: "City"
|
|
3215
|
-
}), /* @__PURE__ */ Y(
|
|
3227
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3216
3228
|
id: "city",
|
|
3217
3229
|
type: "text",
|
|
3218
3230
|
value: a.city || "",
|
|
3219
3231
|
onChange: (e) => o("city", e.target.value),
|
|
3220
3232
|
placeholder: "San Francisco",
|
|
3221
3233
|
disabled: r || i.disabled
|
|
3222
|
-
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3234
|
+
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3223
3235
|
htmlFor: "state",
|
|
3224
3236
|
className: "text-xs",
|
|
3225
3237
|
children: "State / Province"
|
|
3226
|
-
}), /* @__PURE__ */ Y(
|
|
3238
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3227
3239
|
id: "state",
|
|
3228
3240
|
type: "text",
|
|
3229
3241
|
value: a.state || "",
|
|
@@ -3234,22 +3246,22 @@ function Or({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3234
3246
|
}),
|
|
3235
3247
|
/* @__PURE__ */ X("div", {
|
|
3236
3248
|
className: "grid grid-cols-2 gap-3",
|
|
3237
|
-
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3249
|
+
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3238
3250
|
htmlFor: "zipCode",
|
|
3239
3251
|
className: "text-xs",
|
|
3240
3252
|
children: "ZIP / Postal Code"
|
|
3241
|
-
}), /* @__PURE__ */ Y(
|
|
3253
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3242
3254
|
id: "zipCode",
|
|
3243
3255
|
type: "text",
|
|
3244
3256
|
value: a.zipCode || "",
|
|
3245
3257
|
onChange: (e) => o("zipCode", e.target.value),
|
|
3246
3258
|
placeholder: "94102",
|
|
3247
3259
|
disabled: r || i.disabled
|
|
3248
|
-
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3260
|
+
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3249
3261
|
htmlFor: "country",
|
|
3250
3262
|
className: "text-xs",
|
|
3251
3263
|
children: "Country"
|
|
3252
|
-
}), /* @__PURE__ */ Y(
|
|
3264
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3253
3265
|
id: "country",
|
|
3254
3266
|
type: "text",
|
|
3255
3267
|
value: a.country || "",
|
|
@@ -3261,8 +3273,8 @@ function Or({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
3261
3273
|
]
|
|
3262
3274
|
});
|
|
3263
3275
|
}
|
|
3264
|
-
var
|
|
3265
|
-
function
|
|
3276
|
+
var Ar = Z((() => {})), jr = /* @__PURE__ */ Q({ GeolocationField: () => Mr });
|
|
3277
|
+
function Mr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
3266
3278
|
let [o, s] = e.useState(!1), c = t || {}, l = (e, t) => {
|
|
3267
3279
|
n({
|
|
3268
3280
|
...c,
|
|
@@ -3296,12 +3308,12 @@ function jr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3296
3308
|
return /* @__PURE__ */ X("div", {
|
|
3297
3309
|
className: "flex items-center gap-2",
|
|
3298
3310
|
children: [
|
|
3299
|
-
/* @__PURE__ */ Y(
|
|
3311
|
+
/* @__PURE__ */ Y(q, { className: "w-4 h-4 text-muted-foreground" }),
|
|
3300
3312
|
e ? /* @__PURE__ */ Y("span", {
|
|
3301
3313
|
className: "text-sm",
|
|
3302
3314
|
children: e
|
|
3303
|
-
}) : /* @__PURE__ */ Y(
|
|
3304
|
-
c.latitude && c.longitude && /* @__PURE__ */ Y(
|
|
3315
|
+
}) : /* @__PURE__ */ Y(E, {}),
|
|
3316
|
+
c.latitude && c.longitude && /* @__PURE__ */ Y(x, {
|
|
3305
3317
|
type: "button",
|
|
3306
3318
|
variant: "link",
|
|
3307
3319
|
size: "sm",
|
|
@@ -3317,28 +3329,28 @@ function jr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3317
3329
|
children: [
|
|
3318
3330
|
/* @__PURE__ */ X("div", {
|
|
3319
3331
|
className: "flex items-center gap-2",
|
|
3320
|
-
children: [/* @__PURE__ */ X(
|
|
3332
|
+
children: [/* @__PURE__ */ X(x, {
|
|
3321
3333
|
type: "button",
|
|
3322
3334
|
variant: "outline",
|
|
3323
3335
|
size: "sm",
|
|
3324
3336
|
onClick: u,
|
|
3325
3337
|
disabled: i || o,
|
|
3326
|
-
children: [/* @__PURE__ */ Y(
|
|
3327
|
-
}), c.latitude && c.longitude && /* @__PURE__ */ X(
|
|
3338
|
+
children: [/* @__PURE__ */ Y(be, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
3339
|
+
}), c.latitude && c.longitude && /* @__PURE__ */ X(x, {
|
|
3328
3340
|
type: "button",
|
|
3329
3341
|
variant: "link",
|
|
3330
3342
|
size: "sm",
|
|
3331
3343
|
onClick: f,
|
|
3332
|
-
children: [/* @__PURE__ */ Y(
|
|
3344
|
+
children: [/* @__PURE__ */ Y(q, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
3333
3345
|
})]
|
|
3334
3346
|
}),
|
|
3335
3347
|
/* @__PURE__ */ X("div", {
|
|
3336
3348
|
className: "grid grid-cols-2 gap-3",
|
|
3337
|
-
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3349
|
+
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3338
3350
|
htmlFor: "latitude",
|
|
3339
3351
|
className: "text-xs",
|
|
3340
3352
|
children: "Latitude"
|
|
3341
|
-
}), /* @__PURE__ */ Y(
|
|
3353
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3342
3354
|
id: "latitude",
|
|
3343
3355
|
type: "number",
|
|
3344
3356
|
value: c.latitude ?? "",
|
|
@@ -3347,11 +3359,11 @@ function jr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3347
3359
|
disabled: i || a.disabled,
|
|
3348
3360
|
step: "any",
|
|
3349
3361
|
className: a.className
|
|
3350
|
-
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(
|
|
3362
|
+
})] }), /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y(O, {
|
|
3351
3363
|
htmlFor: "longitude",
|
|
3352
3364
|
className: "text-xs",
|
|
3353
3365
|
children: "Longitude"
|
|
3354
|
-
}), /* @__PURE__ */ Y(
|
|
3366
|
+
}), /* @__PURE__ */ Y(D, {
|
|
3355
3367
|
id: "longitude",
|
|
3356
3368
|
type: "number",
|
|
3357
3369
|
value: c.longitude ?? "",
|
|
@@ -3372,8 +3384,8 @@ function jr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3372
3384
|
]
|
|
3373
3385
|
});
|
|
3374
3386
|
}
|
|
3375
|
-
var
|
|
3376
|
-
function
|
|
3387
|
+
var Nr = Z((() => {})), Pr = /* @__PURE__ */ Q({ SignatureField: () => Fr });
|
|
3388
|
+
function Fr({ value: t, onChange: n, readonly: r }) {
|
|
3377
3389
|
let i = c(null), [o, s] = e.useState(!1), [l, u] = e.useState(!t);
|
|
3378
3390
|
a(() => {
|
|
3379
3391
|
if (t && i.current) {
|
|
@@ -3442,7 +3454,7 @@ function Pr({ value: t, onChange: n, readonly: r }) {
|
|
|
3442
3454
|
children: [/* @__PURE__ */ Y("p", {
|
|
3443
3455
|
className: "text-xs text-muted-foreground",
|
|
3444
3456
|
children: l ? "Sign above" : "Signature captured"
|
|
3445
|
-
}), /* @__PURE__ */ X(
|
|
3457
|
+
}), /* @__PURE__ */ X(x, {
|
|
3446
3458
|
type: "button",
|
|
3447
3459
|
variant: "outline",
|
|
3448
3460
|
size: "sm",
|
|
@@ -3453,26 +3465,26 @@ function Pr({ value: t, onChange: n, readonly: r }) {
|
|
|
3453
3465
|
t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
|
|
3454
3466
|
},
|
|
3455
3467
|
disabled: r || l,
|
|
3456
|
-
children: [/* @__PURE__ */ Y(
|
|
3468
|
+
children: [/* @__PURE__ */ Y(U, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
3457
3469
|
})]
|
|
3458
3470
|
})]
|
|
3459
3471
|
});
|
|
3460
3472
|
}
|
|
3461
|
-
var
|
|
3462
|
-
function
|
|
3473
|
+
var Ir = Z((() => {})), Lr = /* @__PURE__ */ Q({ QRCodeField: () => Rr });
|
|
3474
|
+
function Rr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
3463
3475
|
let [o, s] = e.useState(!1), c = r || a.schema;
|
|
3464
3476
|
return i ? /* @__PURE__ */ X("div", {
|
|
3465
3477
|
className: "flex items-center gap-3",
|
|
3466
3478
|
children: [/* @__PURE__ */ Y("span", {
|
|
3467
3479
|
className: "text-sm flex-1 truncate",
|
|
3468
|
-
children: t || /* @__PURE__ */ Y(
|
|
3469
|
-
}), t && /* @__PURE__ */ X(
|
|
3480
|
+
children: t || /* @__PURE__ */ Y(E, {})
|
|
3481
|
+
}), t && /* @__PURE__ */ X(x, {
|
|
3470
3482
|
type: "button",
|
|
3471
3483
|
variant: "outline",
|
|
3472
3484
|
size: "sm",
|
|
3473
3485
|
onClick: () => s(!o),
|
|
3474
3486
|
children: [
|
|
3475
|
-
/* @__PURE__ */ Y(
|
|
3487
|
+
/* @__PURE__ */ Y(ke, { className: "w-4 h-4 mr-2" }),
|
|
3476
3488
|
o ? "Hide" : "Show",
|
|
3477
3489
|
" QR"
|
|
3478
3490
|
]
|
|
@@ -3482,14 +3494,14 @@ function Lr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3482
3494
|
children: [
|
|
3483
3495
|
/* @__PURE__ */ X("div", {
|
|
3484
3496
|
className: "flex items-center gap-2",
|
|
3485
|
-
children: [/* @__PURE__ */ Y(
|
|
3497
|
+
children: [/* @__PURE__ */ Y(D, {
|
|
3486
3498
|
type: "text",
|
|
3487
3499
|
value: t || "",
|
|
3488
3500
|
onChange: (e) => n(e.target.value),
|
|
3489
3501
|
placeholder: c?.placeholder || "Enter text for QR code",
|
|
3490
3502
|
disabled: i || a.disabled,
|
|
3491
3503
|
className: a.className
|
|
3492
|
-
}), t && /* @__PURE__ */ X(
|
|
3504
|
+
}), t && /* @__PURE__ */ X(ze, { children: [/* @__PURE__ */ Y(x, {
|
|
3493
3505
|
type: "button",
|
|
3494
3506
|
variant: "outline",
|
|
3495
3507
|
size: "sm",
|
|
@@ -3497,12 +3509,12 @@ function Lr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3497
3509
|
t && navigator.clipboard.writeText(t);
|
|
3498
3510
|
},
|
|
3499
3511
|
children: /* @__PURE__ */ Y(V, { className: "w-4 h-4" })
|
|
3500
|
-
}), /* @__PURE__ */ Y(
|
|
3512
|
+
}), /* @__PURE__ */ Y(x, {
|
|
3501
3513
|
type: "button",
|
|
3502
3514
|
variant: "outline",
|
|
3503
3515
|
size: "sm",
|
|
3504
3516
|
onClick: () => s(!o),
|
|
3505
|
-
children: /* @__PURE__ */ Y(
|
|
3517
|
+
children: /* @__PURE__ */ Y(ke, { className: "w-4 h-4" })
|
|
3506
3518
|
})] })]
|
|
3507
3519
|
}),
|
|
3508
3520
|
o && t && /* @__PURE__ */ Y("div", {
|
|
@@ -3524,105 +3536,12 @@ function Lr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
3524
3536
|
]
|
|
3525
3537
|
});
|
|
3526
3538
|
}
|
|
3527
|
-
var
|
|
3528
|
-
//#endregion
|
|
3529
|
-
//#region src/widgets/MasterDetailField.tsx
|
|
3530
|
-
Ke(), Ye(), Qe(), it(), st(), ut(), pt(), gt(), xt(), wt(), Dt(), ln(), fn(), hn(), vn(), xn(), On(), jn(), Pn(), Ln(), Bn(), Un(), Kn(), Yn(), dr(), mr(), _r(), br(), Cr(), Er(), kr(), Mr(), Fr(), Rr(), wn();
|
|
3531
|
-
function zr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
3532
|
-
let o = e || [], s = n || a.schema, c = () => {
|
|
3533
|
-
let e = {
|
|
3534
|
-
id: `new-${Date.now()}`,
|
|
3535
|
-
label: "New Related Record"
|
|
3536
|
-
};
|
|
3537
|
-
t([...o, e]);
|
|
3538
|
-
}, l = (e) => {
|
|
3539
|
-
t(o.filter((t) => t.id !== e));
|
|
3540
|
-
}, u = (e) => {
|
|
3541
|
-
console.log("View detail:", e);
|
|
3542
|
-
};
|
|
3543
|
-
return r ? /* @__PURE__ */ X("div", {
|
|
3544
|
-
className: R("space-y-2", i),
|
|
3545
|
-
children: [o.length === 0 ? /* @__PURE__ */ Y("span", {
|
|
3546
|
-
className: "text-sm text-muted-foreground",
|
|
3547
|
-
children: "No related records"
|
|
3548
|
-
}) : o.map((e) => /* @__PURE__ */ X("div", {
|
|
3549
|
-
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
3550
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
3551
|
-
className: "text-sm",
|
|
3552
|
-
children: e.label
|
|
3553
|
-
}), /* @__PURE__ */ Y(b, {
|
|
3554
|
-
type: "button",
|
|
3555
|
-
variant: "ghost",
|
|
3556
|
-
size: "sm",
|
|
3557
|
-
onClick: () => u(e),
|
|
3558
|
-
children: /* @__PURE__ */ Y(U, { className: "w-4 h-4" })
|
|
3559
|
-
})]
|
|
3560
|
-
}, e.id)), /* @__PURE__ */ X("p", {
|
|
3561
|
-
className: "text-xs text-muted-foreground",
|
|
3562
|
-
children: [
|
|
3563
|
-
o.length,
|
|
3564
|
-
" ",
|
|
3565
|
-
o.length === 1 ? "record" : "records"
|
|
3566
|
-
]
|
|
3567
|
-
})]
|
|
3568
|
-
}) : /* @__PURE__ */ X("div", {
|
|
3569
|
-
className: R("space-y-3", i),
|
|
3570
|
-
children: [/* @__PURE__ */ X("div", {
|
|
3571
|
-
className: "space-y-2",
|
|
3572
|
-
children: [o.map((e) => /* @__PURE__ */ X("div", {
|
|
3573
|
-
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
3574
|
-
children: [/* @__PURE__ */ X("div", {
|
|
3575
|
-
className: "flex items-center gap-2 flex-1",
|
|
3576
|
-
children: [/* @__PURE__ */ Y(y, {
|
|
3577
|
-
variant: "outline",
|
|
3578
|
-
children: e.id
|
|
3579
|
-
}), /* @__PURE__ */ Y("span", {
|
|
3580
|
-
className: "text-sm flex-1",
|
|
3581
|
-
children: e.label
|
|
3582
|
-
})]
|
|
3583
|
-
}), /* @__PURE__ */ X("div", {
|
|
3584
|
-
className: "flex items-center gap-1",
|
|
3585
|
-
children: [/* @__PURE__ */ Y(b, {
|
|
3586
|
-
type: "button",
|
|
3587
|
-
variant: "ghost",
|
|
3588
|
-
size: "sm",
|
|
3589
|
-
onClick: () => u(e),
|
|
3590
|
-
children: /* @__PURE__ */ Y(U, { className: "w-4 h-4" })
|
|
3591
|
-
}), /* @__PURE__ */ Y(b, {
|
|
3592
|
-
type: "button",
|
|
3593
|
-
variant: "ghost",
|
|
3594
|
-
size: "sm",
|
|
3595
|
-
onClick: () => l(e.id),
|
|
3596
|
-
disabled: a.disabled,
|
|
3597
|
-
children: /* @__PURE__ */ Y(Fe, { className: "w-4 h-4" })
|
|
3598
|
-
})]
|
|
3599
|
-
})]
|
|
3600
|
-
}, e.id)), o.length === 0 && /* @__PURE__ */ Y("div", {
|
|
3601
|
-
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
3602
|
-
children: "No related records"
|
|
3603
|
-
})]
|
|
3604
|
-
}), /* @__PURE__ */ X(b, {
|
|
3605
|
-
type: "button",
|
|
3606
|
-
variant: "outline",
|
|
3607
|
-
className: "w-full",
|
|
3608
|
-
onClick: c,
|
|
3609
|
-
disabled: a.disabled,
|
|
3610
|
-
children: [
|
|
3611
|
-
/* @__PURE__ */ Y(De, { className: "w-4 h-4 mr-2" }),
|
|
3612
|
-
"Add ",
|
|
3613
|
-
s?.label || "Record"
|
|
3614
|
-
]
|
|
3615
|
-
})]
|
|
3616
|
-
});
|
|
3617
|
-
}
|
|
3618
|
-
//#endregion
|
|
3619
|
-
//#region src/widgets/MultiSelectField.tsx
|
|
3620
|
-
var Br = /* @__PURE__ */ Q({ MultiSelectField: () => Vr });
|
|
3539
|
+
var zr = Z((() => {})), Br = /* @__PURE__ */ Q({ MultiSelectField: () => Vr });
|
|
3621
3540
|
function Vr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
3622
3541
|
let o = (n || a.schema)?.options || [], s = Array.isArray(e) ? e : e == null ? [] : [e];
|
|
3623
|
-
if (r) return s.length === 0 ? /* @__PURE__ */ Y(
|
|
3542
|
+
if (r) return s.length === 0 ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("div", {
|
|
3624
3543
|
className: "flex flex-wrap gap-1",
|
|
3625
|
-
children: s.map((e) => /* @__PURE__ */ Y(
|
|
3544
|
+
children: s.map((e) => /* @__PURE__ */ Y(b, {
|
|
3626
3545
|
variant: "outline",
|
|
3627
3546
|
children: o.find((t) => t.value === e)?.label || e
|
|
3628
3547
|
}, e))
|
|
@@ -3648,10 +3567,10 @@ function Vr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
3648
3567
|
var Hr = Z((() => {})), Ur = /* @__PURE__ */ Q({ RadioField: () => Wr });
|
|
3649
3568
|
function Wr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
3650
3569
|
let s = (n || a.schema)?.options || [], c = o();
|
|
3651
|
-
return r ? e == null || e === "" ? /* @__PURE__ */ Y(
|
|
3570
|
+
return r ? e == null || e === "" ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("span", {
|
|
3652
3571
|
className: "text-sm",
|
|
3653
3572
|
children: s.find((t) => t.value === e)?.label || String(e)
|
|
3654
|
-
}) : /* @__PURE__ */ Y(
|
|
3573
|
+
}) : /* @__PURE__ */ Y(ie, {
|
|
3655
3574
|
value: e ?? "",
|
|
3656
3575
|
onValueChange: t,
|
|
3657
3576
|
disabled: a.disabled,
|
|
@@ -3660,10 +3579,10 @@ function Wr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
3660
3579
|
let t = `${c}-${e.value}`;
|
|
3661
3580
|
return /* @__PURE__ */ X("div", {
|
|
3662
3581
|
className: "flex items-center space-x-2",
|
|
3663
|
-
children: [/* @__PURE__ */ Y(
|
|
3582
|
+
children: [/* @__PURE__ */ Y(j, {
|
|
3664
3583
|
value: e.value,
|
|
3665
3584
|
id: t
|
|
3666
|
-
}), /* @__PURE__ */ Y(
|
|
3585
|
+
}), /* @__PURE__ */ Y(O, {
|
|
3667
3586
|
htmlFor: t,
|
|
3668
3587
|
className: "font-normal",
|
|
3669
3588
|
children: e.label
|
|
@@ -3675,9 +3594,9 @@ function Wr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
3675
3594
|
var Gr = Z((() => {})), Kr = /* @__PURE__ */ Q({ CheckboxesField: () => qr });
|
|
3676
3595
|
function qr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
3677
3596
|
let s = (n || a.schema)?.options || [], c = Array.isArray(e) ? e : e == null ? [] : [e], l = o();
|
|
3678
|
-
if (r) return c.length === 0 ? /* @__PURE__ */ Y(
|
|
3597
|
+
if (r) return c.length === 0 ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("div", {
|
|
3679
3598
|
className: "flex flex-wrap gap-1",
|
|
3680
|
-
children: c.map((e) => /* @__PURE__ */ Y(
|
|
3599
|
+
children: c.map((e) => /* @__PURE__ */ Y(b, {
|
|
3681
3600
|
variant: "outline",
|
|
3682
3601
|
children: s.find((t) => t.value === e)?.label || e
|
|
3683
3602
|
}, e))
|
|
@@ -3691,12 +3610,12 @@ function qr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
3691
3610
|
let t = `${l}-${e.value}`;
|
|
3692
3611
|
return /* @__PURE__ */ X("div", {
|
|
3693
3612
|
className: "flex items-center space-x-2 py-0.5",
|
|
3694
|
-
children: [/* @__PURE__ */ Y(
|
|
3613
|
+
children: [/* @__PURE__ */ Y(S, {
|
|
3695
3614
|
id: t,
|
|
3696
3615
|
checked: c.includes(e.value),
|
|
3697
3616
|
onCheckedChange: (t) => u(e.value, !!t),
|
|
3698
3617
|
disabled: a.disabled
|
|
3699
|
-
}), /* @__PURE__ */ Y(
|
|
3618
|
+
}), /* @__PURE__ */ Y(O, {
|
|
3700
3619
|
htmlFor: t,
|
|
3701
3620
|
className: "font-normal",
|
|
3702
3621
|
children: e.label
|
|
@@ -3708,9 +3627,9 @@ function qr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
3708
3627
|
var Jr = Z((() => {})), Yr = /* @__PURE__ */ Q({ TagsField: () => Xr });
|
|
3709
3628
|
function Xr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
3710
3629
|
let s = Array.isArray(t) ? t : t == null ? [] : [t], [c, l] = e.useState("");
|
|
3711
|
-
if (i) return s.length === 0 ? /* @__PURE__ */ Y(
|
|
3630
|
+
if (i) return s.length === 0 ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("div", {
|
|
3712
3631
|
className: "flex flex-wrap gap-1",
|
|
3713
|
-
children: s.map((e) => /* @__PURE__ */ Y(
|
|
3632
|
+
children: s.map((e) => /* @__PURE__ */ Y(b, {
|
|
3714
3633
|
variant: "secondary",
|
|
3715
3634
|
children: e
|
|
3716
3635
|
}, e))
|
|
@@ -3721,7 +3640,7 @@ function Xr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3721
3640
|
}, d = (e) => n(s.filter((t) => t !== e));
|
|
3722
3641
|
return /* @__PURE__ */ X("div", {
|
|
3723
3642
|
className: R("flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background p-1.5", a),
|
|
3724
|
-
children: [s.map((e) => /* @__PURE__ */ X(
|
|
3643
|
+
children: [s.map((e) => /* @__PURE__ */ X(b, {
|
|
3725
3644
|
variant: "secondary",
|
|
3726
3645
|
className: "gap-1",
|
|
3727
3646
|
children: [e, /* @__PURE__ */ Y("button", {
|
|
@@ -3731,7 +3650,7 @@ function Xr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3731
3650
|
"aria-label": `Remove ${e}`,
|
|
3732
3651
|
children: "×"
|
|
3733
3652
|
})]
|
|
3734
|
-
}, e)), /* @__PURE__ */ Y(
|
|
3653
|
+
}, e)), /* @__PURE__ */ Y(D, {
|
|
3735
3654
|
value: c,
|
|
3736
3655
|
onChange: (e) => l(e.target.value),
|
|
3737
3656
|
onKeyDown: (e) => {
|
|
@@ -3744,21 +3663,158 @@ function Xr({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
3744
3663
|
})]
|
|
3745
3664
|
});
|
|
3746
3665
|
}
|
|
3747
|
-
var Zr = Z((() => {}))
|
|
3748
|
-
|
|
3666
|
+
var Zr = Z((() => {}));
|
|
3667
|
+
Ot(), yn(), Sn(), kn(), Mn(), Fn(), Rn(), Vn(), Wn(), qn(), Xn(), fr(), hr(), wr(), Dr(), Ar(), Nr(), Ir(), zr(), qe(), Tt(), Xe(), St(), gn(), vr(), xr(), $e(), at(), Hr(), Gr(), Jr(), Zr(), ct(), un(), pn(), dt(), mt(), _t();
|
|
3668
|
+
var Qr = {
|
|
3669
|
+
text: Ke,
|
|
3670
|
+
textarea: wt,
|
|
3671
|
+
number: Ye,
|
|
3672
|
+
currency: xt,
|
|
3673
|
+
percent: hn,
|
|
3674
|
+
slider: _r,
|
|
3675
|
+
progress: _r,
|
|
3676
|
+
rating: br,
|
|
3677
|
+
boolean: Qe,
|
|
3678
|
+
toggle: Qe,
|
|
3679
|
+
select: it,
|
|
3680
|
+
status: it,
|
|
3681
|
+
multiselect: Vr,
|
|
3682
|
+
radio: Wr,
|
|
3683
|
+
checkboxes: qr,
|
|
3684
|
+
tags: Xr,
|
|
3685
|
+
date: st,
|
|
3686
|
+
datetime: ln,
|
|
3687
|
+
time: fn,
|
|
3688
|
+
email: ut,
|
|
3689
|
+
phone: pt,
|
|
3690
|
+
url: gt
|
|
3691
|
+
}, $r = /* @__PURE__ */ new Set([
|
|
3692
|
+
"boolean",
|
|
3693
|
+
"toggle",
|
|
3694
|
+
"select",
|
|
3695
|
+
"status",
|
|
3696
|
+
"radio",
|
|
3697
|
+
"rating"
|
|
3698
|
+
]);
|
|
3699
|
+
function ei(e) {
|
|
3700
|
+
return !!e && e in Qr;
|
|
3701
|
+
}
|
|
3702
|
+
function ti({ field: e, value: t, onChange: n, readonly: r }) {
|
|
3703
|
+
let i = e?.type ? Qr[e.type] : void 0;
|
|
3704
|
+
return i ? /* @__PURE__ */ Y(i, {
|
|
3705
|
+
field: e,
|
|
3706
|
+
value: t,
|
|
3707
|
+
onChange: n,
|
|
3708
|
+
readonly: r
|
|
3709
|
+
}) : null;
|
|
3710
|
+
}
|
|
3711
|
+
//#endregion
|
|
3712
|
+
//#region src/widgets/MasterDetailField.tsx
|
|
3713
|
+
Tn();
|
|
3714
|
+
function ni({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
3715
|
+
let o = e || [], s = n || a.schema, c = () => {
|
|
3716
|
+
let e = {
|
|
3717
|
+
id: `new-${Date.now()}`,
|
|
3718
|
+
label: "New Related Record"
|
|
3719
|
+
};
|
|
3720
|
+
t([...o, e]);
|
|
3721
|
+
}, l = (e) => {
|
|
3722
|
+
t(o.filter((t) => t.id !== e));
|
|
3723
|
+
}, u = (e) => {
|
|
3724
|
+
console.log("View detail:", e);
|
|
3725
|
+
};
|
|
3726
|
+
return r ? /* @__PURE__ */ X("div", {
|
|
3727
|
+
className: R("space-y-2", i),
|
|
3728
|
+
children: [o.length === 0 ? /* @__PURE__ */ Y("span", {
|
|
3729
|
+
className: "text-sm text-muted-foreground",
|
|
3730
|
+
children: "No related records"
|
|
3731
|
+
}) : o.map((e) => /* @__PURE__ */ X("div", {
|
|
3732
|
+
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
3733
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
3734
|
+
className: "text-sm",
|
|
3735
|
+
children: e.label
|
|
3736
|
+
}), /* @__PURE__ */ Y(x, {
|
|
3737
|
+
type: "button",
|
|
3738
|
+
variant: "ghost",
|
|
3739
|
+
size: "sm",
|
|
3740
|
+
onClick: () => u(e),
|
|
3741
|
+
children: /* @__PURE__ */ Y(W, { className: "w-4 h-4" })
|
|
3742
|
+
})]
|
|
3743
|
+
}, e.id)), /* @__PURE__ */ X("p", {
|
|
3744
|
+
className: "text-xs text-muted-foreground",
|
|
3745
|
+
children: [
|
|
3746
|
+
o.length,
|
|
3747
|
+
" ",
|
|
3748
|
+
o.length === 1 ? "record" : "records"
|
|
3749
|
+
]
|
|
3750
|
+
})]
|
|
3751
|
+
}) : /* @__PURE__ */ X("div", {
|
|
3752
|
+
className: R("space-y-3", i),
|
|
3753
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3754
|
+
className: "space-y-2",
|
|
3755
|
+
children: [o.map((e) => /* @__PURE__ */ X("div", {
|
|
3756
|
+
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
3757
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3758
|
+
className: "flex items-center gap-2 flex-1",
|
|
3759
|
+
children: [/* @__PURE__ */ Y(b, {
|
|
3760
|
+
variant: "outline",
|
|
3761
|
+
children: e.id
|
|
3762
|
+
}), /* @__PURE__ */ Y("span", {
|
|
3763
|
+
className: "text-sm flex-1",
|
|
3764
|
+
children: e.label
|
|
3765
|
+
})]
|
|
3766
|
+
}), /* @__PURE__ */ X("div", {
|
|
3767
|
+
className: "flex items-center gap-1",
|
|
3768
|
+
children: [/* @__PURE__ */ Y(x, {
|
|
3769
|
+
type: "button",
|
|
3770
|
+
variant: "ghost",
|
|
3771
|
+
size: "sm",
|
|
3772
|
+
onClick: () => u(e),
|
|
3773
|
+
children: /* @__PURE__ */ Y(W, { className: "w-4 h-4" })
|
|
3774
|
+
}), /* @__PURE__ */ Y(x, {
|
|
3775
|
+
type: "button",
|
|
3776
|
+
variant: "ghost",
|
|
3777
|
+
size: "sm",
|
|
3778
|
+
onClick: () => l(e.id),
|
|
3779
|
+
disabled: a.disabled,
|
|
3780
|
+
children: /* @__PURE__ */ Y(Ie, { className: "w-4 h-4" })
|
|
3781
|
+
})]
|
|
3782
|
+
})]
|
|
3783
|
+
}, e.id)), o.length === 0 && /* @__PURE__ */ Y("div", {
|
|
3784
|
+
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
3785
|
+
children: "No related records"
|
|
3786
|
+
})]
|
|
3787
|
+
}), /* @__PURE__ */ X(x, {
|
|
3788
|
+
type: "button",
|
|
3789
|
+
variant: "outline",
|
|
3790
|
+
className: "w-full",
|
|
3791
|
+
onClick: c,
|
|
3792
|
+
disabled: a.disabled,
|
|
3793
|
+
children: [
|
|
3794
|
+
/* @__PURE__ */ Y(Oe, { className: "w-4 h-4 mr-2" }),
|
|
3795
|
+
"Add ",
|
|
3796
|
+
s?.label || "Record"
|
|
3797
|
+
]
|
|
3798
|
+
})]
|
|
3799
|
+
});
|
|
3800
|
+
}
|
|
3801
|
+
//#endregion
|
|
3802
|
+
//#region src/widgets/MarkdownContent.tsx
|
|
3803
|
+
var ri = /* @__PURE__ */ Q({ default: () => ii });
|
|
3804
|
+
function ii({ value: e }) {
|
|
3749
3805
|
return /* @__PURE__ */ Y("div", {
|
|
3750
3806
|
className: "prose prose-sm max-w-none dark:prose-invert break-words",
|
|
3751
|
-
children: /* @__PURE__ */ Y(
|
|
3752
|
-
remarkPlugins: [
|
|
3753
|
-
rehypePlugins: [
|
|
3807
|
+
children: /* @__PURE__ */ Y(Ve, {
|
|
3808
|
+
remarkPlugins: [He],
|
|
3809
|
+
rehypePlugins: [Ue],
|
|
3754
3810
|
children: e
|
|
3755
3811
|
})
|
|
3756
3812
|
});
|
|
3757
3813
|
}
|
|
3758
|
-
var
|
|
3759
|
-
|
|
3760
|
-
var
|
|
3761
|
-
function
|
|
3814
|
+
var ai = Z((() => {}));
|
|
3815
|
+
qe(), Xe(), $e(), at(), ct(), dt(), mt(), _t(), St(), Tt(), sn(), un(), pn(), gn(), vr(), xr(), vt(), Qt(), qe(), Xe(), $e(), at(), ct(), un(), pn(), dt(), mt(), _t(), St(), gn(), yn(), Tt(), Ot(), sn(), Lt(), Sn(), kn(), Mn(), Fn(), Rn(), Vn(), Wn(), qn(), Xn(), fr(), hr(), vr(), xr(), wr(), Dr(), Ar(), Nr(), Ir(), zr(), Hr(), Gr(), Jr(), Zr();
|
|
3816
|
+
var oi = /* @__PURE__ */ new Map();
|
|
3817
|
+
function si(e, t) {
|
|
3762
3818
|
if (!e || typeof e != "object") return;
|
|
3763
3819
|
if (t) {
|
|
3764
3820
|
let n = e[t];
|
|
@@ -3786,7 +3842,7 @@ function ni(e, t) {
|
|
|
3786
3842
|
if (i) return i;
|
|
3787
3843
|
let a = e.email;
|
|
3788
3844
|
if (typeof a == "string" && a.trim()) return a.trim();
|
|
3789
|
-
let o = new Set([
|
|
3845
|
+
let o = /* @__PURE__ */ new Set([
|
|
3790
3846
|
"id",
|
|
3791
3847
|
"_id",
|
|
3792
3848
|
"organization_id",
|
|
@@ -3807,16 +3863,16 @@ function ni(e, t) {
|
|
|
3807
3863
|
if (typeof n == "number") return String(n);
|
|
3808
3864
|
}
|
|
3809
3865
|
}
|
|
3810
|
-
function
|
|
3866
|
+
function ci(e) {
|
|
3811
3867
|
if (typeof e != "string" || !/^[A-Za-z0-9_-]{12,32}$/.test(e)) return !1;
|
|
3812
3868
|
let t = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /[0-9_-]/.test(e);
|
|
3813
3869
|
return t && n || t && r || n && r;
|
|
3814
3870
|
}
|
|
3815
|
-
function
|
|
3816
|
-
let r = e.useContext(
|
|
3871
|
+
function li(t, n) {
|
|
3872
|
+
let r = e.useContext(Le)?.dataSource, [, i] = e.useState(0), a = !!t && !!r && typeof r.find == "function" && (typeof n == "string" || typeof n == "number") && n !== "", o = a ? `${t}:${String(n)}` : "";
|
|
3817
3873
|
if (e.useEffect(() => {
|
|
3818
3874
|
if (!a) return;
|
|
3819
|
-
let e =
|
|
3875
|
+
let e = oi.get(o);
|
|
3820
3876
|
if (e && e.state !== "pending" && e.promise == null || e?.state === "pending") return;
|
|
3821
3877
|
let s = (async () => {
|
|
3822
3878
|
try {
|
|
@@ -3829,17 +3885,17 @@ function ii(t, n) {
|
|
|
3829
3885
|
});
|
|
3830
3886
|
e = (Array.isArray(i) ? i : i?.value || i?.data || [])[0];
|
|
3831
3887
|
}
|
|
3832
|
-
let i =
|
|
3833
|
-
|
|
3888
|
+
let i = si(e);
|
|
3889
|
+
oi.set(o, {
|
|
3834
3890
|
state: "ok",
|
|
3835
3891
|
name: i
|
|
3836
3892
|
});
|
|
3837
3893
|
} catch {
|
|
3838
|
-
|
|
3894
|
+
oi.set(o, { state: "err" });
|
|
3839
3895
|
}
|
|
3840
3896
|
i((e) => e + 1);
|
|
3841
3897
|
})();
|
|
3842
|
-
|
|
3898
|
+
oi.set(o, {
|
|
3843
3899
|
state: "pending",
|
|
3844
3900
|
promise: s
|
|
3845
3901
|
});
|
|
@@ -3850,12 +3906,12 @@ function ii(t, n) {
|
|
|
3850
3906
|
n,
|
|
3851
3907
|
r
|
|
3852
3908
|
]), !a) return;
|
|
3853
|
-
let s =
|
|
3909
|
+
let s = oi.get(o);
|
|
3854
3910
|
return s?.state === "ok" ? s.name : void 0;
|
|
3855
3911
|
}
|
|
3856
|
-
function
|
|
3912
|
+
function ui() {
|
|
3857
3913
|
try {
|
|
3858
|
-
let { t: e } =
|
|
3914
|
+
let { t: e } = Re();
|
|
3859
3915
|
return (t, n) => {
|
|
3860
3916
|
let r = e(t);
|
|
3861
3917
|
return !r || r === t ? n : r;
|
|
@@ -3864,12 +3920,12 @@ function ai() {
|
|
|
3864
3920
|
return (e, t) => t;
|
|
3865
3921
|
}
|
|
3866
3922
|
}
|
|
3867
|
-
function
|
|
3923
|
+
function di(e) {
|
|
3868
3924
|
if (e == null || typeof e == "number" || typeof e == "boolean") return e;
|
|
3869
3925
|
if (typeof e == "string") {
|
|
3870
3926
|
let t = e.trim();
|
|
3871
3927
|
if (t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]")) try {
|
|
3872
|
-
return
|
|
3928
|
+
return di(JSON.parse(t));
|
|
3873
3929
|
} catch {}
|
|
3874
3930
|
return e;
|
|
3875
3931
|
}
|
|
@@ -3887,9 +3943,9 @@ function oi(e) {
|
|
|
3887
3943
|
}
|
|
3888
3944
|
return String(e);
|
|
3889
3945
|
}
|
|
3890
|
-
function
|
|
3946
|
+
function fi(e, t) {
|
|
3891
3947
|
let n = Number.isFinite(e) && e === Math.trunc(e) ? 0 : 2;
|
|
3892
|
-
if (!t) return
|
|
3948
|
+
if (!t) return mi(e, n);
|
|
3893
3949
|
try {
|
|
3894
3950
|
return new Intl.NumberFormat("en-US", {
|
|
3895
3951
|
style: "currency",
|
|
@@ -3901,7 +3957,7 @@ function si(e, t) {
|
|
|
3901
3957
|
return `${t} ${e.toFixed(n)}`;
|
|
3902
3958
|
}
|
|
3903
3959
|
}
|
|
3904
|
-
function
|
|
3960
|
+
function pi(e, t) {
|
|
3905
3961
|
if (!t) try {
|
|
3906
3962
|
return new Intl.NumberFormat("en-US", {
|
|
3907
3963
|
notation: "compact",
|
|
@@ -3921,7 +3977,7 @@ function ci(e, t) {
|
|
|
3921
3977
|
return `${t} ${e}`;
|
|
3922
3978
|
}
|
|
3923
3979
|
}
|
|
3924
|
-
function
|
|
3980
|
+
function mi(e, t = 2) {
|
|
3925
3981
|
try {
|
|
3926
3982
|
return new Intl.NumberFormat("en-US", {
|
|
3927
3983
|
minimumFractionDigits: t,
|
|
@@ -3931,13 +3987,13 @@ function li(e, t = 2) {
|
|
|
3931
3987
|
return e.toFixed(t);
|
|
3932
3988
|
}
|
|
3933
3989
|
}
|
|
3934
|
-
function
|
|
3935
|
-
return `${
|
|
3990
|
+
function hi(e, t = 0) {
|
|
3991
|
+
return `${f(e).toFixed(t)}%`;
|
|
3936
3992
|
}
|
|
3937
|
-
function
|
|
3993
|
+
function gi(e) {
|
|
3938
3994
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
3939
3995
|
}
|
|
3940
|
-
function
|
|
3996
|
+
function _i(e) {
|
|
3941
3997
|
if (e == null || e === "") return "—";
|
|
3942
3998
|
let t = e instanceof Date ? e : new Date(e);
|
|
3943
3999
|
if (!(t instanceof Date) || isNaN(t.getTime())) return "—";
|
|
@@ -3947,16 +4003,16 @@ function fi(e) {
|
|
|
3947
4003
|
if (a === -1) return "Yesterday";
|
|
3948
4004
|
if (a < -1) {
|
|
3949
4005
|
let e = Math.abs(a);
|
|
3950
|
-
return e <= 7 ? `Overdue ${e}d` :
|
|
4006
|
+
return e <= 7 ? `Overdue ${e}d` : vi(t);
|
|
3951
4007
|
}
|
|
3952
|
-
return a > 1 && a <= 7 ? `In ${a} days` :
|
|
4008
|
+
return a > 1 && a <= 7 ? `In ${a} days` : vi(t);
|
|
3953
4009
|
}
|
|
3954
|
-
function
|
|
4010
|
+
function vi(e, t) {
|
|
3955
4011
|
if (e == null || e === "") return "—";
|
|
3956
4012
|
let n = e instanceof Date ? e : new Date(e);
|
|
3957
4013
|
if (!(n instanceof Date) || isNaN(n.getTime())) return "—";
|
|
3958
4014
|
if (t === "short") return `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}`;
|
|
3959
|
-
if (t === "relative") return
|
|
4015
|
+
if (t === "relative") return _i(n);
|
|
3960
4016
|
let r = n.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
3961
4017
|
return n.toLocaleDateString(void 0, {
|
|
3962
4018
|
year: r ? void 0 : "numeric",
|
|
@@ -3964,7 +4020,7 @@ function pi(e, t) {
|
|
|
3964
4020
|
day: "numeric"
|
|
3965
4021
|
});
|
|
3966
4022
|
}
|
|
3967
|
-
function
|
|
4023
|
+
function yi(e) {
|
|
3968
4024
|
if (e == null || e === "") return "—";
|
|
3969
4025
|
let t = e instanceof Date ? e : new Date(e);
|
|
3970
4026
|
return !(t instanceof Date) || isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
|
|
@@ -3975,16 +4031,16 @@ function mi(e) {
|
|
|
3975
4031
|
minute: "2-digit"
|
|
3976
4032
|
});
|
|
3977
4033
|
}
|
|
3978
|
-
function
|
|
3979
|
-
let t =
|
|
3980
|
-
return t == null || t === "" ? /* @__PURE__ */ Y(
|
|
4034
|
+
function bi({ value: e }) {
|
|
4035
|
+
let t = di(e);
|
|
4036
|
+
return t == null || t === "" ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("span", {
|
|
3981
4037
|
className: "truncate",
|
|
3982
4038
|
children: String(t)
|
|
3983
4039
|
});
|
|
3984
4040
|
}
|
|
3985
|
-
function
|
|
3986
|
-
if (e == null) return /* @__PURE__ */ Y(
|
|
3987
|
-
let n =
|
|
4041
|
+
function xi({ value: e, field: t }) {
|
|
4042
|
+
if (e == null) return /* @__PURE__ */ Y(E, {});
|
|
4043
|
+
let n = di(e), r = t.precision ?? 0, i = Number(n);
|
|
3988
4044
|
return /* @__PURE__ */ Y("span", {
|
|
3989
4045
|
className: "tabular-nums",
|
|
3990
4046
|
children: isNaN(i) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
@@ -3993,23 +4049,23 @@ function gi({ value: e, field: t }) {
|
|
|
3993
4049
|
}).format(i)
|
|
3994
4050
|
});
|
|
3995
4051
|
}
|
|
3996
|
-
function
|
|
3997
|
-
if (e == null) return /* @__PURE__ */ Y(
|
|
3998
|
-
let n =
|
|
4052
|
+
function Si({ value: e, field: t }) {
|
|
4053
|
+
if (e == null) return /* @__PURE__ */ Y(E, {});
|
|
4054
|
+
let n = di(e), { currency: r } = g(), i = h(t, r), a = Number(n);
|
|
3999
4055
|
return /* @__PURE__ */ Y("span", {
|
|
4000
4056
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
4001
|
-
children: isNaN(a) ? String(n) :
|
|
4057
|
+
children: isNaN(a) ? String(n) : fi(a, i)
|
|
4002
4058
|
});
|
|
4003
4059
|
}
|
|
4004
|
-
var
|
|
4005
|
-
function
|
|
4006
|
-
if (e == null) return /* @__PURE__ */ Y(
|
|
4007
|
-
let n =
|
|
4060
|
+
var Ci = /progress|completion/;
|
|
4061
|
+
function wi({ value: e, field: t }) {
|
|
4062
|
+
if (e == null) return /* @__PURE__ */ Y(E, {});
|
|
4063
|
+
let n = di(e), r = t.precision ?? 0, i = Number(n);
|
|
4008
4064
|
if (isNaN(i)) return /* @__PURE__ */ Y("span", {
|
|
4009
4065
|
className: "tabular-nums whitespace-nowrap",
|
|
4010
4066
|
children: String(n)
|
|
4011
4067
|
});
|
|
4012
|
-
let a =
|
|
4068
|
+
let a = Ci.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : hi(i, r), c = Math.max(0, Math.min(100, o));
|
|
4013
4069
|
return /* @__PURE__ */ X("div", {
|
|
4014
4070
|
className: "flex items-center gap-2",
|
|
4015
4071
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -4028,7 +4084,7 @@ function yi({ value: e, field: t }) {
|
|
|
4028
4084
|
})]
|
|
4029
4085
|
});
|
|
4030
4086
|
}
|
|
4031
|
-
var
|
|
4087
|
+
var Ti = /* @__PURE__ */ new Set([
|
|
4032
4088
|
"active",
|
|
4033
4089
|
"is_active",
|
|
4034
4090
|
"enabled",
|
|
@@ -4036,10 +4092,10 @@ var bi = new Set([
|
|
|
4036
4092
|
"verified",
|
|
4037
4093
|
"is_verified"
|
|
4038
4094
|
]);
|
|
4039
|
-
function
|
|
4095
|
+
function Ei({ value: e, field: t }) {
|
|
4040
4096
|
if (e == null) return /* @__PURE__ */ Y("span", {
|
|
4041
4097
|
className: "flex items-center justify-center",
|
|
4042
|
-
children: /* @__PURE__ */ Y(
|
|
4098
|
+
children: /* @__PURE__ */ Y(E, {})
|
|
4043
4099
|
});
|
|
4044
4100
|
let n = t?.name?.toLowerCase() || "";
|
|
4045
4101
|
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ Y("div", {
|
|
@@ -4049,30 +4105,30 @@ function xi({ value: e, field: t }) {
|
|
|
4049
4105
|
role: "img",
|
|
4050
4106
|
"aria-label": "Completed",
|
|
4051
4107
|
"data-testid": "completion-indicator",
|
|
4052
|
-
children: /* @__PURE__ */ Y(
|
|
4108
|
+
children: /* @__PURE__ */ Y(B, { className: "size-3 text-white" })
|
|
4053
4109
|
}) : /* @__PURE__ */ Y("div", {
|
|
4054
4110
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
4055
4111
|
role: "img",
|
|
4056
4112
|
"aria-label": "Not completed",
|
|
4057
4113
|
"data-testid": "completion-indicator"
|
|
4058
4114
|
})
|
|
4059
|
-
}) :
|
|
4115
|
+
}) : Ti.has(n) && !e ? /* @__PURE__ */ X(b, {
|
|
4060
4116
|
variant: "destructive",
|
|
4061
4117
|
className: "text-xs",
|
|
4062
4118
|
"data-testid": "boolean-warning-badge",
|
|
4063
|
-
children: [t?.label ||
|
|
4119
|
+
children: [t?.label || gi(n), " — Off"]
|
|
4064
4120
|
}) : /* @__PURE__ */ Y("div", {
|
|
4065
4121
|
className: "flex items-center justify-start",
|
|
4066
|
-
children: /* @__PURE__ */ Y(
|
|
4122
|
+
children: /* @__PURE__ */ Y(S, {
|
|
4067
4123
|
checked: !!e,
|
|
4068
4124
|
disabled: !0,
|
|
4069
4125
|
className: "pointer-events-none"
|
|
4070
4126
|
})
|
|
4071
4127
|
});
|
|
4072
4128
|
}
|
|
4073
|
-
function
|
|
4074
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4075
|
-
let n =
|
|
4129
|
+
function Di({ value: e, field: t }) {
|
|
4130
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4131
|
+
let n = di(e), r = t, i = vi(n, r.format || "relative"), a = n == null ? null : new Date(n), o = a !== null && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
|
|
4076
4132
|
s.setHours(0, 0, 0, 0);
|
|
4077
4133
|
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);
|
|
4078
4134
|
return /* @__PURE__ */ Y("span", {
|
|
@@ -4081,10 +4137,10 @@ function Si({ value: e, field: t }) {
|
|
|
4081
4137
|
children: i
|
|
4082
4138
|
});
|
|
4083
4139
|
}
|
|
4084
|
-
function
|
|
4085
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4086
|
-
let t =
|
|
4087
|
-
if (n === null || isNaN(n.getTime())) return /* @__PURE__ */ Y(
|
|
4140
|
+
function Oi({ value: e }) {
|
|
4141
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4142
|
+
let t = di(e), n = t == null ? null : new Date(t);
|
|
4143
|
+
if (n === null || isNaN(n.getTime())) return /* @__PURE__ */ Y(E, {});
|
|
4088
4144
|
let r = n.toLocaleDateString(void 0, {
|
|
4089
4145
|
month: "numeric",
|
|
4090
4146
|
day: "numeric",
|
|
@@ -4102,7 +4158,7 @@ function Ci({ value: e }) {
|
|
|
4102
4158
|
})]
|
|
4103
4159
|
});
|
|
4104
4160
|
}
|
|
4105
|
-
var
|
|
4161
|
+
var ki = {
|
|
4106
4162
|
critical: "red",
|
|
4107
4163
|
urgent: "red",
|
|
4108
4164
|
high: "orange",
|
|
@@ -4177,7 +4233,7 @@ var wi = {
|
|
|
4177
4233
|
逾期: "red",
|
|
4178
4234
|
流失: "red",
|
|
4179
4235
|
丢失: "red"
|
|
4180
|
-
},
|
|
4236
|
+
}, Ai = {
|
|
4181
4237
|
gray: "bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60",
|
|
4182
4238
|
red: "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60",
|
|
4183
4239
|
orange: "bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60",
|
|
@@ -4187,7 +4243,7 @@ var wi = {
|
|
|
4187
4243
|
indigo: "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60",
|
|
4188
4244
|
purple: "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60",
|
|
4189
4245
|
pink: "bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60"
|
|
4190
|
-
},
|
|
4246
|
+
}, ji = {
|
|
4191
4247
|
gray: "bg-gray-400 dark:bg-gray-500",
|
|
4192
4248
|
red: "bg-red-500",
|
|
4193
4249
|
orange: "bg-orange-500",
|
|
@@ -4197,7 +4253,7 @@ var wi = {
|
|
|
4197
4253
|
indigo: "bg-indigo-500",
|
|
4198
4254
|
purple: "bg-purple-500",
|
|
4199
4255
|
pink: "bg-pink-500"
|
|
4200
|
-
},
|
|
4256
|
+
}, Mi = [
|
|
4201
4257
|
"blue",
|
|
4202
4258
|
"green",
|
|
4203
4259
|
"purple",
|
|
@@ -4207,12 +4263,12 @@ var wi = {
|
|
|
4207
4263
|
"yellow",
|
|
4208
4264
|
"red"
|
|
4209
4265
|
];
|
|
4210
|
-
function
|
|
4266
|
+
function Ni(e) {
|
|
4211
4267
|
let t = 5381;
|
|
4212
4268
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e.charCodeAt(n);
|
|
4213
|
-
return
|
|
4269
|
+
return Mi[Math.abs(t) % Mi.length];
|
|
4214
4270
|
}
|
|
4215
|
-
function
|
|
4271
|
+
function Pi(e) {
|
|
4216
4272
|
let t = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e.trim());
|
|
4217
4273
|
if (!t) return;
|
|
4218
4274
|
let n = t[1];
|
|
@@ -4222,27 +4278,27 @@ function ki(e) {
|
|
|
4222
4278
|
let u;
|
|
4223
4279
|
return u = o === r ? ((i - a) / c % 6 + 6) % 6 : o === i ? (a - r) / c + 2 : (r - i) / c + 4, u *= 60, u >= 345 || u < 15 ? "red" : u < 30 ? "orange" : u < 60 ? "yellow" : u < 170 ? "green" : u < 238 ? "blue" : u < 250 ? "indigo" : u < 295 ? "purple" : "pink";
|
|
4224
4280
|
}
|
|
4225
|
-
function
|
|
4281
|
+
function Fi(e) {
|
|
4226
4282
|
if (e) {
|
|
4227
|
-
if (
|
|
4228
|
-
if (e.charAt(0) === "#") return
|
|
4283
|
+
if (Ai[e]) return e;
|
|
4284
|
+
if (e.charAt(0) === "#") return Pi(e);
|
|
4229
4285
|
}
|
|
4230
4286
|
}
|
|
4231
|
-
function
|
|
4232
|
-
let n =
|
|
4233
|
-
if (n &&
|
|
4287
|
+
function Ii(e, t) {
|
|
4288
|
+
let n = Fi(e);
|
|
4289
|
+
if (n && Ai[n]) return Ai[n];
|
|
4234
4290
|
if (t == null || t === "") return "bg-muted text-muted-foreground border-border";
|
|
4235
|
-
let r = String(t).toLowerCase().replace(/[\s-]/g, "_"), i =
|
|
4236
|
-
return i &&
|
|
4291
|
+
let r = String(t).toLowerCase().replace(/[\s-]/g, "_"), i = ki[r];
|
|
4292
|
+
return i && Ai[i] ? Ai[i] : Ai[Ni(r)];
|
|
4237
4293
|
}
|
|
4238
|
-
function
|
|
4239
|
-
let n =
|
|
4240
|
-
if (n &&
|
|
4294
|
+
function Li(e, t) {
|
|
4295
|
+
let n = Fi(e);
|
|
4296
|
+
if (n && Ai[n]) return n;
|
|
4241
4297
|
if (t == null || t === "") return;
|
|
4242
4298
|
let r = String(t).toLowerCase().replace(/[\s-]/g, "_");
|
|
4243
|
-
return
|
|
4299
|
+
return ki[r] || Ni(r);
|
|
4244
4300
|
}
|
|
4245
|
-
var
|
|
4301
|
+
var Ri = {
|
|
4246
4302
|
gray: "#6b7280",
|
|
4247
4303
|
red: "#ef4444",
|
|
4248
4304
|
orange: "#f97316",
|
|
@@ -4253,31 +4309,31 @@ var Ni = {
|
|
|
4253
4309
|
purple: "#a855f7",
|
|
4254
4310
|
pink: "#ec4899"
|
|
4255
4311
|
};
|
|
4256
|
-
function
|
|
4257
|
-
return e ?
|
|
4312
|
+
function zi(e, t = "#3b82f6") {
|
|
4313
|
+
return e ? Ri[e] ?? t : t;
|
|
4258
4314
|
}
|
|
4259
|
-
function
|
|
4315
|
+
function Bi({ value: e, field: t }) {
|
|
4260
4316
|
let n = t, r = n.options || [], i = n.appearance === "dot" ? "dot" : "badge";
|
|
4261
|
-
if (e == null || e === "") return /* @__PURE__ */ Y(
|
|
4317
|
+
if (e == null || e === "") return /* @__PURE__ */ Y(E, {});
|
|
4262
4318
|
let a = (e) => {
|
|
4263
4319
|
let t = r.find((t) => t.value === e);
|
|
4264
4320
|
if (t) return t;
|
|
4265
4321
|
let n = String(e).toLowerCase();
|
|
4266
4322
|
return r.find((e) => String(e.value).toLowerCase() === n);
|
|
4267
4323
|
}, o = (e, t) => {
|
|
4268
|
-
let n = a(e), r = n?.label ||
|
|
4324
|
+
let n = a(e), r = n?.label || gi(String(e));
|
|
4269
4325
|
return i === "dot" ? /* @__PURE__ */ X("span", {
|
|
4270
4326
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
4271
4327
|
children: [/* @__PURE__ */ Y("span", {
|
|
4272
|
-
className: R("h-1.5 w-1.5 rounded-full shrink-0",
|
|
4328
|
+
className: R("h-1.5 w-1.5 rounded-full shrink-0", ji[Fi(n?.color) || ki[String(e).toLowerCase().replace(/[\s-]/g, "_")] || Ni(String(e).toLowerCase().replace(/[\s-]/g, "_"))] || ji.gray),
|
|
4273
4329
|
"aria-hidden": "true"
|
|
4274
4330
|
}), /* @__PURE__ */ Y("span", {
|
|
4275
4331
|
className: "truncate",
|
|
4276
4332
|
children: r
|
|
4277
4333
|
})]
|
|
4278
|
-
}, t) : /* @__PURE__ */ Y(
|
|
4334
|
+
}, t) : /* @__PURE__ */ Y(b, {
|
|
4279
4335
|
variant: "outline",
|
|
4280
|
-
className:
|
|
4336
|
+
className: Ii(n?.color, e),
|
|
4281
4337
|
children: r
|
|
4282
4338
|
}, t);
|
|
4283
4339
|
};
|
|
@@ -4286,12 +4342,12 @@ function Fi({ value: e, field: t }) {
|
|
|
4286
4342
|
children: e.map((e, t) => o(e, t))
|
|
4287
4343
|
}) : o(e);
|
|
4288
4344
|
}
|
|
4289
|
-
function
|
|
4290
|
-
if (!t) return /* @__PURE__ */ Y(
|
|
4291
|
-
let n =
|
|
4345
|
+
function Vi({ value: t }) {
|
|
4346
|
+
if (!t) return /* @__PURE__ */ Y(E, {});
|
|
4347
|
+
let n = ui(), r = String(di(t) ?? ""), [i, a] = e.useState(!1);
|
|
4292
4348
|
return /* @__PURE__ */ X("span", {
|
|
4293
4349
|
className: "inline-flex items-center gap-1 group/email",
|
|
4294
|
-
children: [/* @__PURE__ */ Y(
|
|
4350
|
+
children: [/* @__PURE__ */ Y(x, {
|
|
4295
4351
|
variant: "link",
|
|
4296
4352
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
4297
4353
|
asChild: !0,
|
|
@@ -4309,14 +4365,14 @@ function Ii({ value: t }) {
|
|
|
4309
4365
|
}).catch(() => {});
|
|
4310
4366
|
},
|
|
4311
4367
|
"aria-label": n("detail.copyEmail", "Copy email"),
|
|
4312
|
-
children: i ? /* @__PURE__ */ Y(
|
|
4368
|
+
children: i ? /* @__PURE__ */ Y(B, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Y(V, { className: "h-3 w-3 text-muted-foreground" })
|
|
4313
4369
|
})]
|
|
4314
4370
|
});
|
|
4315
4371
|
}
|
|
4316
|
-
function
|
|
4317
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4318
|
-
let t = String(
|
|
4319
|
-
return /* @__PURE__ */ Y(
|
|
4372
|
+
function Hi({ value: e }) {
|
|
4373
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4374
|
+
let t = String(di(e) ?? "");
|
|
4375
|
+
return /* @__PURE__ */ Y(x, {
|
|
4320
4376
|
variant: "link",
|
|
4321
4377
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
4322
4378
|
asChild: !0,
|
|
@@ -4329,16 +4385,16 @@ function Li({ value: e }) {
|
|
|
4329
4385
|
})
|
|
4330
4386
|
});
|
|
4331
4387
|
}
|
|
4332
|
-
function
|
|
4333
|
-
if (!t) return /* @__PURE__ */ Y(
|
|
4334
|
-
let n =
|
|
4388
|
+
function Ui({ value: t }) {
|
|
4389
|
+
if (!t) return /* @__PURE__ */ Y(E, {});
|
|
4390
|
+
let n = ui(), r = String(di(t) ?? ""), [i, a] = e.useState(!1);
|
|
4335
4391
|
return /* @__PURE__ */ X("span", {
|
|
4336
4392
|
className: "inline-flex items-center gap-1 group/phone",
|
|
4337
4393
|
children: [/* @__PURE__ */ X("a", {
|
|
4338
4394
|
href: `tel:${r}`,
|
|
4339
4395
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
4340
4396
|
onClick: (e) => e.stopPropagation(),
|
|
4341
|
-
children: [/* @__PURE__ */ Y(
|
|
4397
|
+
children: [/* @__PURE__ */ Y(De, { className: "h-3 w-3" }), r]
|
|
4342
4398
|
}), /* @__PURE__ */ Y("button", {
|
|
4343
4399
|
type: "button",
|
|
4344
4400
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
@@ -4348,12 +4404,12 @@ function Ri({ value: t }) {
|
|
|
4348
4404
|
}).catch(() => {});
|
|
4349
4405
|
},
|
|
4350
4406
|
"aria-label": n("detail.copyPhone", "Copy phone number"),
|
|
4351
|
-
children: i ? /* @__PURE__ */ Y(
|
|
4407
|
+
children: i ? /* @__PURE__ */ Y(B, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Y(V, { className: "h-3 w-3 text-muted-foreground" })
|
|
4352
4408
|
})]
|
|
4353
4409
|
});
|
|
4354
4410
|
}
|
|
4355
|
-
function
|
|
4356
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4411
|
+
function Wi({ value: e, field: t }) {
|
|
4412
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4357
4413
|
if (t.multiple, Array.isArray(e)) {
|
|
4358
4414
|
let t = e.length;
|
|
4359
4415
|
return /* @__PURE__ */ X("span", {
|
|
@@ -4370,15 +4426,15 @@ function zi({ value: e, field: t }) {
|
|
|
4370
4426
|
children: e.name || e.original_name || "File"
|
|
4371
4427
|
});
|
|
4372
4428
|
}
|
|
4373
|
-
function
|
|
4374
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4429
|
+
function Gi({ value: e }) {
|
|
4430
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4375
4431
|
let t = (e) => typeof e == "string" ? e : e?.url || e?.src || e?.href || e?.thumbnailUrl || "", n = (e, t) => e && typeof e == "object" && (e.name || e.original_name) || t;
|
|
4376
4432
|
if (Array.isArray(e)) {
|
|
4377
4433
|
let r = e.map((e) => ({
|
|
4378
4434
|
url: t(e),
|
|
4379
4435
|
name: n(e, "Image")
|
|
4380
4436
|
})).filter((e) => e.url);
|
|
4381
|
-
return r.length === 0 ? /* @__PURE__ */ Y(
|
|
4437
|
+
return r.length === 0 ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ X("div", {
|
|
4382
4438
|
className: "flex -space-x-2",
|
|
4383
4439
|
children: [r.slice(0, 3).map((e, t) => /* @__PURE__ */ Y("img", {
|
|
4384
4440
|
src: e.url,
|
|
@@ -4395,20 +4451,20 @@ function Bi({ value: e }) {
|
|
|
4395
4451
|
src: r,
|
|
4396
4452
|
alt: n(e, "Image"),
|
|
4397
4453
|
className: "size-10 rounded-md object-cover"
|
|
4398
|
-
}) : /* @__PURE__ */ Y(
|
|
4454
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
4399
4455
|
}
|
|
4400
|
-
function
|
|
4456
|
+
function Ki({ value: e, field: t }) {
|
|
4401
4457
|
let n = t.reference_to, r = (() => {
|
|
4402
4458
|
if (Array.isArray(e)) return e.find((e) => e != null && (typeof e == "string" || typeof e == "number") && e !== "");
|
|
4403
4459
|
if (e != null && e !== "" && (typeof e == "string" || typeof e == "number") && typeof e != "object") return e;
|
|
4404
|
-
})(), i =
|
|
4405
|
-
if (e == null || e === "") return /* @__PURE__ */ Y(
|
|
4460
|
+
})(), i = li(n, r);
|
|
4461
|
+
if (e == null || e === "") return /* @__PURE__ */ Y(E, {});
|
|
4406
4462
|
if (typeof e == "string") {
|
|
4407
4463
|
let t = e.trim();
|
|
4408
4464
|
if (t.startsWith("{") && t.endsWith("}")) try {
|
|
4409
4465
|
let e = JSON.parse(t);
|
|
4410
4466
|
if (e && typeof e == "object") {
|
|
4411
|
-
let t =
|
|
4467
|
+
let t = si(e) || String(e.externalId ?? e.id ?? e._id ?? "");
|
|
4412
4468
|
if (t) return /* @__PURE__ */ Y("span", {
|
|
4413
4469
|
className: "truncate",
|
|
4414
4470
|
children: t
|
|
@@ -4417,7 +4473,7 @@ function Vi({ value: e, field: t }) {
|
|
|
4417
4473
|
} catch {}
|
|
4418
4474
|
}
|
|
4419
4475
|
if (!Array.isArray(e) && typeof e == "object") {
|
|
4420
|
-
let t = e, n =
|
|
4476
|
+
let t = e, n = si(t) || String(t.id || t._id || "");
|
|
4421
4477
|
if (n) return /* @__PURE__ */ Y("span", {
|
|
4422
4478
|
className: "truncate",
|
|
4423
4479
|
children: n
|
|
@@ -4434,7 +4490,7 @@ function Vi({ value: e, field: t }) {
|
|
|
4434
4490
|
return e === r && i ? {
|
|
4435
4491
|
text: i,
|
|
4436
4492
|
muted: !1
|
|
4437
|
-
} :
|
|
4493
|
+
} : ci(e) ? {
|
|
4438
4494
|
text: "—",
|
|
4439
4495
|
muted: !0
|
|
4440
4496
|
} : {
|
|
@@ -4446,7 +4502,7 @@ function Vi({ value: e, field: t }) {
|
|
|
4446
4502
|
className: "flex flex-wrap gap-1",
|
|
4447
4503
|
children: e.map((e, t) => {
|
|
4448
4504
|
let n, r = !1;
|
|
4449
|
-
if (typeof e == "object" && e) n =
|
|
4505
|
+
if (typeof e == "object" && e) n = si(e) || String(e.id || e._id || "[Object]");
|
|
4450
4506
|
else {
|
|
4451
4507
|
let t = o(e);
|
|
4452
4508
|
n = t.text, r = t.muted;
|
|
@@ -4459,7 +4515,7 @@ function Vi({ value: e, field: t }) {
|
|
|
4459
4515
|
});
|
|
4460
4516
|
if (typeof e == "object" && e) return /* @__PURE__ */ Y("span", {
|
|
4461
4517
|
className: "truncate",
|
|
4462
|
-
children:
|
|
4518
|
+
children: si(e) || String(e.id || e._id || "[Object]")
|
|
4463
4519
|
});
|
|
4464
4520
|
let { text: s, muted: c } = o(e);
|
|
4465
4521
|
return /* @__PURE__ */ Y("span", {
|
|
@@ -4467,15 +4523,15 @@ function Vi({ value: e, field: t }) {
|
|
|
4467
4523
|
children: s
|
|
4468
4524
|
});
|
|
4469
4525
|
}
|
|
4470
|
-
function
|
|
4471
|
-
let t =
|
|
4472
|
-
return t == null || t === "" ? /* @__PURE__ */ Y(
|
|
4526
|
+
function qi({ value: e }) {
|
|
4527
|
+
let t = di(e);
|
|
4528
|
+
return t == null || t === "" ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("span", {
|
|
4473
4529
|
className: "text-gray-700 font-mono text-sm",
|
|
4474
4530
|
children: String(t)
|
|
4475
4531
|
});
|
|
4476
4532
|
}
|
|
4477
|
-
function
|
|
4478
|
-
if (!e) return /* @__PURE__ */ Y(
|
|
4533
|
+
function Ji({ value: e }) {
|
|
4534
|
+
if (!e) return /* @__PURE__ */ Y(E, {});
|
|
4479
4535
|
if (typeof e != "object") return /* @__PURE__ */ Y("span", {
|
|
4480
4536
|
className: "truncate",
|
|
4481
4537
|
children: String(e)
|
|
@@ -4488,17 +4544,17 @@ function Ui({ value: e }) {
|
|
|
4488
4544
|
children: String(e)
|
|
4489
4545
|
}, t);
|
|
4490
4546
|
let n = e.name || e.username || "User";
|
|
4491
|
-
return /* @__PURE__ */ Y(
|
|
4547
|
+
return /* @__PURE__ */ Y(_, {
|
|
4492
4548
|
className: "size-8 border-2 border-white",
|
|
4493
4549
|
title: n,
|
|
4494
|
-
children: /* @__PURE__ */ Y(
|
|
4550
|
+
children: /* @__PURE__ */ Y(v, {
|
|
4495
4551
|
className: "bg-blue-500 text-white text-xs",
|
|
4496
4552
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
4497
4553
|
})
|
|
4498
4554
|
}, t);
|
|
4499
|
-
}), e.length > 3 && /* @__PURE__ */ Y(
|
|
4555
|
+
}), e.length > 3 && /* @__PURE__ */ Y(_, {
|
|
4500
4556
|
className: "size-8 border-2 border-white",
|
|
4501
|
-
children: /* @__PURE__ */ X(
|
|
4557
|
+
children: /* @__PURE__ */ X(v, {
|
|
4502
4558
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
4503
4559
|
children: ["+", e.length - 3]
|
|
4504
4560
|
})
|
|
@@ -4507,9 +4563,9 @@ function Ui({ value: e }) {
|
|
|
4507
4563
|
let t = e.name || e.username || "User";
|
|
4508
4564
|
return /* @__PURE__ */ X("div", {
|
|
4509
4565
|
className: "flex items-center gap-2",
|
|
4510
|
-
children: [/* @__PURE__ */ Y(
|
|
4566
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
4511
4567
|
className: "size-8",
|
|
4512
|
-
children: /* @__PURE__ */ Y(
|
|
4568
|
+
children: /* @__PURE__ */ Y(v, {
|
|
4513
4569
|
className: "bg-blue-500 text-white text-xs",
|
|
4514
4570
|
children: t.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
4515
4571
|
})
|
|
@@ -4519,11 +4575,11 @@ function Ui({ value: e }) {
|
|
|
4519
4575
|
})]
|
|
4520
4576
|
});
|
|
4521
4577
|
}
|
|
4522
|
-
var
|
|
4523
|
-
function
|
|
4524
|
-
|
|
4578
|
+
var Yi = /* @__PURE__ */ new Map();
|
|
4579
|
+
function Xi(e, t) {
|
|
4580
|
+
Yi.set(e, t);
|
|
4525
4581
|
}
|
|
4526
|
-
var
|
|
4582
|
+
var Zi = {
|
|
4527
4583
|
phone: "phone",
|
|
4528
4584
|
tel: "phone",
|
|
4529
4585
|
telephone: "phone",
|
|
@@ -4535,21 +4591,21 @@ var Ki = {
|
|
|
4535
4591
|
money: "currency",
|
|
4536
4592
|
percent: "percent",
|
|
4537
4593
|
percentage: "percent"
|
|
4538
|
-
},
|
|
4594
|
+
}, Qi = /* @__PURE__ */ new Set([
|
|
4539
4595
|
"text",
|
|
4540
4596
|
"textarea",
|
|
4541
4597
|
"string",
|
|
4542
4598
|
"longtext",
|
|
4543
4599
|
""
|
|
4544
4600
|
]);
|
|
4545
|
-
function
|
|
4601
|
+
function $i(e) {
|
|
4546
4602
|
if (!e) return "text";
|
|
4547
4603
|
if (typeof e == "string") return e;
|
|
4548
4604
|
let t = (e.type || "").toLowerCase(), n = e.format, r = typeof n == "string" ? n.toLowerCase() : "";
|
|
4549
|
-
return r &&
|
|
4605
|
+
return r && Zi[r] && Qi.has(t) ? Zi[r] : e.type || "text";
|
|
4550
4606
|
}
|
|
4551
|
-
function
|
|
4552
|
-
if (e == null || e === "") return /* @__PURE__ */ Y(
|
|
4607
|
+
function ea({ value: e }) {
|
|
4608
|
+
if (e == null || e === "") return /* @__PURE__ */ Y(E, {});
|
|
4553
4609
|
let t;
|
|
4554
4610
|
if (typeof e == "object") try {
|
|
4555
4611
|
t = JSON.stringify(e);
|
|
@@ -4563,8 +4619,8 @@ function Yi({ value: e }) {
|
|
|
4563
4619
|
children: t
|
|
4564
4620
|
});
|
|
4565
4621
|
}
|
|
4566
|
-
function
|
|
4567
|
-
if (e == null || e === "") return /* @__PURE__ */ Y(
|
|
4622
|
+
function ta({ value: e }) {
|
|
4623
|
+
if (e == null || e === "") return /* @__PURE__ */ Y(E, {});
|
|
4568
4624
|
let t = String(e);
|
|
4569
4625
|
return /* @__PURE__ */ X("span", {
|
|
4570
4626
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
@@ -4578,27 +4634,27 @@ function Xi({ value: e }) {
|
|
|
4578
4634
|
})]
|
|
4579
4635
|
});
|
|
4580
4636
|
}
|
|
4581
|
-
var
|
|
4582
|
-
function
|
|
4583
|
-
return t == null || t === "" ? /* @__PURE__ */ Y(
|
|
4637
|
+
var na = e.lazy(() => Promise.resolve().then(() => (ai(), ri)));
|
|
4638
|
+
function ra({ value: t }) {
|
|
4639
|
+
return t == null || t === "" ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y(e.Suspense, {
|
|
4584
4640
|
fallback: /* @__PURE__ */ Y("span", {
|
|
4585
4641
|
className: "text-sm text-muted-foreground",
|
|
4586
4642
|
children: String(t).slice(0, 80)
|
|
4587
4643
|
}),
|
|
4588
|
-
children: /* @__PURE__ */ Y(
|
|
4644
|
+
children: /* @__PURE__ */ Y(na, { value: String(t) })
|
|
4589
4645
|
});
|
|
4590
4646
|
}
|
|
4591
|
-
function
|
|
4647
|
+
function ia(e) {
|
|
4592
4648
|
return e.replace(/<\s*(script|style|iframe|object|embed)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/(href|src)\s*=\s*("javascript:[^"]*"|'javascript:[^']*')/gi, "$1=\"#\"");
|
|
4593
4649
|
}
|
|
4594
|
-
function
|
|
4595
|
-
return e == null || e === "" ? /* @__PURE__ */ Y(
|
|
4650
|
+
function aa({ value: e }) {
|
|
4651
|
+
return e == null || e === "" ? /* @__PURE__ */ Y(E, {}) : /* @__PURE__ */ Y("div", {
|
|
4596
4652
|
className: "prose prose-sm max-w-none dark:prose-invert break-words",
|
|
4597
|
-
dangerouslySetInnerHTML: { __html:
|
|
4653
|
+
dangerouslySetInnerHTML: { __html: ia(String(e)) }
|
|
4598
4654
|
});
|
|
4599
4655
|
}
|
|
4600
|
-
function
|
|
4601
|
-
if (e == null || e === "") return /* @__PURE__ */ Y(
|
|
4656
|
+
function oa({ value: e }) {
|
|
4657
|
+
if (e == null || e === "") return /* @__PURE__ */ Y(E, {});
|
|
4602
4658
|
let t, n;
|
|
4603
4659
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
4604
4660
|
let r = e;
|
|
@@ -4611,7 +4667,7 @@ function ta({ value: e }) {
|
|
|
4611
4667
|
return typeof t == "number" && typeof n == "number" && !isNaN(t) && !isNaN(n) ? /* @__PURE__ */ X("span", {
|
|
4612
4668
|
className: "inline-flex items-center gap-1 text-sm tabular-nums",
|
|
4613
4669
|
children: [
|
|
4614
|
-
/* @__PURE__ */ Y(
|
|
4670
|
+
/* @__PURE__ */ Y(q, {
|
|
4615
4671
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground",
|
|
4616
4672
|
"aria-hidden": "true"
|
|
4617
4673
|
}),
|
|
@@ -4619,70 +4675,70 @@ function ta({ value: e }) {
|
|
|
4619
4675
|
", ",
|
|
4620
4676
|
n.toFixed(4)
|
|
4621
4677
|
]
|
|
4622
|
-
}) : /* @__PURE__ */ Y(
|
|
4678
|
+
}) : /* @__PURE__ */ Y(ea, {
|
|
4623
4679
|
value: e,
|
|
4624
4680
|
field: {}
|
|
4625
4681
|
});
|
|
4626
4682
|
}
|
|
4627
|
-
function
|
|
4628
|
-
return
|
|
4629
|
-
text:
|
|
4630
|
-
textarea:
|
|
4631
|
-
markdown:
|
|
4632
|
-
html:
|
|
4633
|
-
richtext:
|
|
4634
|
-
code:
|
|
4635
|
-
qrcode:
|
|
4636
|
-
number:
|
|
4637
|
-
currency:
|
|
4638
|
-
percent:
|
|
4639
|
-
progress:
|
|
4640
|
-
slider:
|
|
4641
|
-
rating:
|
|
4642
|
-
boolean:
|
|
4643
|
-
toggle:
|
|
4644
|
-
date:
|
|
4645
|
-
datetime:
|
|
4646
|
-
time:
|
|
4647
|
-
select:
|
|
4648
|
-
status:
|
|
4649
|
-
multiselect:
|
|
4650
|
-
radio:
|
|
4651
|
-
checkboxes:
|
|
4652
|
-
tags:
|
|
4653
|
-
lookup:
|
|
4654
|
-
master_detail:
|
|
4655
|
-
tree:
|
|
4656
|
-
email:
|
|
4657
|
-
url:
|
|
4658
|
-
phone:
|
|
4659
|
-
file:
|
|
4660
|
-
video:
|
|
4661
|
-
audio:
|
|
4662
|
-
image:
|
|
4663
|
-
avatar:
|
|
4664
|
-
signature:
|
|
4665
|
-
formula:
|
|
4666
|
-
summary:
|
|
4667
|
-
auto_number:
|
|
4668
|
-
user:
|
|
4669
|
-
owner:
|
|
4683
|
+
function sa(e) {
|
|
4684
|
+
return Yi.has(e) ? Yi.get(e) : {
|
|
4685
|
+
text: bi,
|
|
4686
|
+
textarea: bi,
|
|
4687
|
+
markdown: ra,
|
|
4688
|
+
html: aa,
|
|
4689
|
+
richtext: ra,
|
|
4690
|
+
code: bi,
|
|
4691
|
+
qrcode: bi,
|
|
4692
|
+
number: xi,
|
|
4693
|
+
currency: Si,
|
|
4694
|
+
percent: wi,
|
|
4695
|
+
progress: wi,
|
|
4696
|
+
slider: xi,
|
|
4697
|
+
rating: xi,
|
|
4698
|
+
boolean: Ei,
|
|
4699
|
+
toggle: Ei,
|
|
4700
|
+
date: Di,
|
|
4701
|
+
datetime: Oi,
|
|
4702
|
+
time: bi,
|
|
4703
|
+
select: Bi,
|
|
4704
|
+
status: Bi,
|
|
4705
|
+
multiselect: Bi,
|
|
4706
|
+
radio: Bi,
|
|
4707
|
+
checkboxes: Bi,
|
|
4708
|
+
tags: Bi,
|
|
4709
|
+
lookup: Ki,
|
|
4710
|
+
master_detail: Ki,
|
|
4711
|
+
tree: Ki,
|
|
4712
|
+
email: Vi,
|
|
4713
|
+
url: Hi,
|
|
4714
|
+
phone: Ui,
|
|
4715
|
+
file: Wi,
|
|
4716
|
+
video: Wi,
|
|
4717
|
+
audio: Wi,
|
|
4718
|
+
image: Gi,
|
|
4719
|
+
avatar: Gi,
|
|
4720
|
+
signature: Gi,
|
|
4721
|
+
formula: qi,
|
|
4722
|
+
summary: qi,
|
|
4723
|
+
auto_number: bi,
|
|
4724
|
+
user: Ji,
|
|
4725
|
+
owner: Ji,
|
|
4670
4726
|
password: () => /* @__PURE__ */ Y("span", { children: "••••••" }),
|
|
4671
4727
|
secret: () => /* @__PURE__ */ Y("span", { children: "••••••" }),
|
|
4672
|
-
location:
|
|
4673
|
-
geolocation:
|
|
4674
|
-
address:
|
|
4675
|
-
color:
|
|
4676
|
-
json:
|
|
4677
|
-
object:
|
|
4678
|
-
composite:
|
|
4679
|
-
record:
|
|
4728
|
+
location: oa,
|
|
4729
|
+
geolocation: oa,
|
|
4730
|
+
address: ea,
|
|
4731
|
+
color: ta,
|
|
4732
|
+
json: ea,
|
|
4733
|
+
object: ea,
|
|
4734
|
+
composite: ea,
|
|
4735
|
+
record: ea,
|
|
4680
4736
|
repeater: ({ value: e }) => {
|
|
4681
4737
|
let t = Array.isArray(e) ? e.length : 0;
|
|
4682
4738
|
return t > 0 ? /* @__PURE__ */ X("span", {
|
|
4683
4739
|
className: "text-gray-500 italic",
|
|
4684
4740
|
children: [t, " 项"]
|
|
4685
|
-
}) : /* @__PURE__ */ Y(
|
|
4741
|
+
}) : /* @__PURE__ */ Y(E, {});
|
|
4686
4742
|
},
|
|
4687
4743
|
vector: () => /* @__PURE__ */ Y("span", {
|
|
4688
4744
|
className: "text-gray-500 italic",
|
|
@@ -4692,10 +4748,10 @@ function na(e) {
|
|
|
4692
4748
|
className: "text-gray-500 italic",
|
|
4693
4749
|
children: "[Grid]"
|
|
4694
4750
|
})
|
|
4695
|
-
}[e] ||
|
|
4751
|
+
}[e] || bi;
|
|
4696
4752
|
}
|
|
4697
|
-
|
|
4698
|
-
function
|
|
4753
|
+
Xi("lookup", Ki), Xi("master_detail", Ki), Xi("select", Bi), Xi("status", Bi), Xi("user", Ji), Xi("owner", Ji), Yt(sa);
|
|
4754
|
+
function ca(e) {
|
|
4699
4755
|
return {
|
|
4700
4756
|
text: "field:text",
|
|
4701
4757
|
textarea: "field:textarea",
|
|
@@ -4751,7 +4807,7 @@ function ra(e) {
|
|
|
4751
4807
|
auto_number: "field:auto_number"
|
|
4752
4808
|
}[e] || "field:text";
|
|
4753
4809
|
}
|
|
4754
|
-
function
|
|
4810
|
+
function la(e) {
|
|
4755
4811
|
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
4756
4812
|
let t = [
|
|
4757
4813
|
"B",
|
|
@@ -4763,7 +4819,7 @@ function ia(e) {
|
|
|
4763
4819
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
4764
4820
|
return `${n.toFixed(+(r > 0))} ${t[r]}`;
|
|
4765
4821
|
}
|
|
4766
|
-
function
|
|
4822
|
+
function ua(e) {
|
|
4767
4823
|
let t = {};
|
|
4768
4824
|
return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
|
|
4769
4825
|
value: e.min_length,
|
|
@@ -4788,7 +4844,7 @@ function aa(e) {
|
|
|
4788
4844
|
message: "Please enter a valid URL"
|
|
4789
4845
|
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
4790
4846
|
}
|
|
4791
|
-
function
|
|
4847
|
+
function da(e, t) {
|
|
4792
4848
|
if (!e) return !0;
|
|
4793
4849
|
if (e.field && e.value !== void 0) {
|
|
4794
4850
|
let n = t[e.field];
|
|
@@ -4800,7 +4856,7 @@ function oa(e, t) {
|
|
|
4800
4856
|
if (e.operator === "<=") return n <= e.value;
|
|
4801
4857
|
if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
|
|
4802
4858
|
}
|
|
4803
|
-
return e.and && Array.isArray(e.and) ? e.and.every((e) =>
|
|
4859
|
+
return e.and && Array.isArray(e.and) ? e.and.every((e) => da(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => da(e, t)) : !0;
|
|
4804
4860
|
}
|
|
4805
4861
|
function $(t) {
|
|
4806
4862
|
let n = ({ schema: n, className: r, value: i, ...a }) => {
|
|
@@ -4844,51 +4900,51 @@ function $(t) {
|
|
|
4844
4900
|
};
|
|
4845
4901
|
return n.displayName = `FieldRenderer(${t.displayName || t.name || "Component"})`, n;
|
|
4846
4902
|
}
|
|
4847
|
-
var
|
|
4848
|
-
text: () => Promise.resolve().then(() => (
|
|
4849
|
-
textarea: () => Promise.resolve().then(() => (
|
|
4850
|
-
number: () => Promise.resolve().then(() => (
|
|
4851
|
-
boolean: () => Promise.resolve().then(() => (
|
|
4852
|
-
select: () => Promise.resolve().then(() => (
|
|
4853
|
-
date: () => Promise.resolve().then(() => (
|
|
4854
|
-
datetime: () => Promise.resolve().then(() => (
|
|
4855
|
-
time: () => Promise.resolve().then(() => (
|
|
4856
|
-
email: () => Promise.resolve().then(() => (
|
|
4857
|
-
phone: () => Promise.resolve().then(() => (
|
|
4858
|
-
url: () => Promise.resolve().then(() => (
|
|
4903
|
+
var fa = {
|
|
4904
|
+
text: () => Promise.resolve().then(() => (qe(), Ge)).then((e) => ({ default: e.TextField })),
|
|
4905
|
+
textarea: () => Promise.resolve().then(() => (Tt(), Ct)).then((e) => ({ default: e.TextAreaField })),
|
|
4906
|
+
number: () => Promise.resolve().then(() => (Xe(), Je)).then((e) => ({ default: e.NumberField })),
|
|
4907
|
+
boolean: () => Promise.resolve().then(() => ($e(), Ze)).then((e) => ({ default: e.BooleanField })),
|
|
4908
|
+
select: () => Promise.resolve().then(() => (at(), rt)).then((e) => ({ default: e.SelectField })),
|
|
4909
|
+
date: () => Promise.resolve().then(() => (ct(), ot)).then((e) => ({ default: e.DateField })),
|
|
4910
|
+
datetime: () => Promise.resolve().then(() => (un(), cn)).then((e) => ({ default: e.DateTimeField })),
|
|
4911
|
+
time: () => Promise.resolve().then(() => (pn(), dn)).then((e) => ({ default: e.TimeField })),
|
|
4912
|
+
email: () => Promise.resolve().then(() => (dt(), lt)).then((e) => ({ default: e.EmailField })),
|
|
4913
|
+
phone: () => Promise.resolve().then(() => (mt(), ft)).then((e) => ({ default: e.PhoneField })),
|
|
4914
|
+
url: () => Promise.resolve().then(() => (_t(), ht)).then((e) => ({ default: e.UrlField })),
|
|
4859
4915
|
multiselect: () => Promise.resolve().then(() => (Hr(), Br)).then((e) => ({ default: e.MultiSelectField })),
|
|
4860
4916
|
radio: () => Promise.resolve().then(() => (Gr(), Ur)).then((e) => ({ default: e.RadioField })),
|
|
4861
4917
|
checkboxes: () => Promise.resolve().then(() => (Jr(), Kr)).then((e) => ({ default: e.CheckboxesField })),
|
|
4862
4918
|
tags: () => Promise.resolve().then(() => (Zr(), Yr)).then((e) => ({ default: e.TagsField })),
|
|
4863
|
-
currency: () => Promise.resolve().then(() => (
|
|
4864
|
-
percent: () => Promise.resolve().then(() => (
|
|
4865
|
-
password: () => Promise.resolve().then(() => (
|
|
4866
|
-
markdown: () => Promise.resolve().then(() => (
|
|
4867
|
-
html: () => Promise.resolve().then(() => (
|
|
4868
|
-
richtext: () => Promise.resolve().then(() => (
|
|
4869
|
-
lookup: () => Promise.resolve().then(() => (
|
|
4870
|
-
master_detail: () => Promise.resolve().then(() => (
|
|
4871
|
-
file: () => Promise.resolve().then(() => (
|
|
4872
|
-
image: () => Promise.resolve().then(() => (
|
|
4873
|
-
location: () => Promise.resolve().then(() => (
|
|
4874
|
-
formula: () => Promise.resolve().then(() => (
|
|
4875
|
-
summary: () => Promise.resolve().then(() => (
|
|
4876
|
-
auto_number: () => Promise.resolve().then(() => (
|
|
4877
|
-
user: () => Promise.resolve().then(() => (
|
|
4878
|
-
owner: () => Promise.resolve().then(() => (
|
|
4879
|
-
object: () => Promise.resolve().then(() => (
|
|
4880
|
-
vector: () => Promise.resolve().then(() => (
|
|
4881
|
-
grid: () => Promise.resolve().then(() => (
|
|
4882
|
-
color: () => Promise.resolve().then(() => (
|
|
4883
|
-
slider: () => Promise.resolve().then(() => (
|
|
4884
|
-
rating: () => Promise.resolve().then(() => (
|
|
4885
|
-
code: () => Promise.resolve().then(() => (
|
|
4886
|
-
avatar: () => Promise.resolve().then(() => (
|
|
4887
|
-
address: () => Promise.resolve().then(() => (
|
|
4888
|
-
geolocation: () => Promise.resolve().then(() => (
|
|
4889
|
-
signature: () => Promise.resolve().then(() => (
|
|
4890
|
-
qrcode: () => Promise.resolve().then(() => (
|
|
4891
|
-
},
|
|
4919
|
+
currency: () => Promise.resolve().then(() => (St(), yt)).then((e) => ({ default: e.CurrencyField })),
|
|
4920
|
+
percent: () => Promise.resolve().then(() => (gn(), mn)).then((e) => ({ default: e.PercentField })),
|
|
4921
|
+
password: () => Promise.resolve().then(() => (yn(), _n)).then((e) => ({ default: e.PasswordField })),
|
|
4922
|
+
markdown: () => Promise.resolve().then(() => (Ot(), Et)).then((e) => ({ default: e.RichTextField })),
|
|
4923
|
+
html: () => Promise.resolve().then(() => (Ot(), Et)).then((e) => ({ default: e.RichTextField })),
|
|
4924
|
+
richtext: () => Promise.resolve().then(() => (Ot(), Et)).then((e) => ({ default: e.RichTextField })),
|
|
4925
|
+
lookup: () => Promise.resolve().then(() => (sn(), $t)).then((e) => ({ default: e.LookupField })),
|
|
4926
|
+
master_detail: () => Promise.resolve().then(() => (sn(), $t)).then((e) => ({ default: e.LookupField })),
|
|
4927
|
+
file: () => Promise.resolve().then(() => (Sn(), bn)).then((e) => ({ default: e.FileField })),
|
|
4928
|
+
image: () => Promise.resolve().then(() => (kn(), En)).then((e) => ({ default: e.ImageField })),
|
|
4929
|
+
location: () => Promise.resolve().then(() => (Mn(), An)).then((e) => ({ default: e.LocationField })),
|
|
4930
|
+
formula: () => Promise.resolve().then(() => (Fn(), Nn)).then((e) => ({ default: e.FormulaField })),
|
|
4931
|
+
summary: () => Promise.resolve().then(() => (Rn(), In)).then((e) => ({ default: e.SummaryField })),
|
|
4932
|
+
auto_number: () => Promise.resolve().then(() => (Vn(), zn)).then((e) => ({ default: e.AutoNumberField })),
|
|
4933
|
+
user: () => Promise.resolve().then(() => (Wn(), Hn)).then((e) => ({ default: e.UserField })),
|
|
4934
|
+
owner: () => Promise.resolve().then(() => (Wn(), Hn)).then((e) => ({ default: e.UserField })),
|
|
4935
|
+
object: () => Promise.resolve().then(() => (qn(), Gn)).then((e) => ({ default: e.ObjectField })),
|
|
4936
|
+
vector: () => Promise.resolve().then(() => (Xn(), Jn)).then((e) => ({ default: e.VectorField })),
|
|
4937
|
+
grid: () => Promise.resolve().then(() => (fr(), Zn)).then((e) => ({ default: e.GridField })),
|
|
4938
|
+
color: () => Promise.resolve().then(() => (hr(), pr)).then((e) => ({ default: e.ColorField })),
|
|
4939
|
+
slider: () => Promise.resolve().then(() => (vr(), gr)).then((e) => ({ default: e.SliderField })),
|
|
4940
|
+
rating: () => Promise.resolve().then(() => (xr(), yr)).then((e) => ({ default: e.RatingField })),
|
|
4941
|
+
code: () => Promise.resolve().then(() => (wr(), Sr)).then((e) => ({ default: e.CodeField })),
|
|
4942
|
+
avatar: () => Promise.resolve().then(() => (Dr(), Tr)).then((e) => ({ default: e.AvatarField })),
|
|
4943
|
+
address: () => Promise.resolve().then(() => (Ar(), Or)).then((e) => ({ default: e.AddressField })),
|
|
4944
|
+
geolocation: () => Promise.resolve().then(() => (Nr(), jr)).then((e) => ({ default: e.GeolocationField })),
|
|
4945
|
+
signature: () => Promise.resolve().then(() => (Ir(), Pr)).then((e) => ({ default: e.SignatureField })),
|
|
4946
|
+
qrcode: () => Promise.resolve().then(() => (zr(), Lr)).then((e) => ({ default: e.QRCodeField }))
|
|
4947
|
+
}, pa = /* @__PURE__ */ new Set([
|
|
4892
4948
|
"text",
|
|
4893
4949
|
"html",
|
|
4894
4950
|
"image",
|
|
@@ -4901,8 +4957,8 @@ var sa = {
|
|
|
4901
4957
|
"slider",
|
|
4902
4958
|
"markdown"
|
|
4903
4959
|
]);
|
|
4904
|
-
function
|
|
4905
|
-
let n =
|
|
4960
|
+
function ma(t) {
|
|
4961
|
+
let n = fa[t];
|
|
4906
4962
|
if (!n) {
|
|
4907
4963
|
console.warn(`Unknown field type: ${t}`);
|
|
4908
4964
|
return;
|
|
@@ -4910,50 +4966,50 @@ function la(t) {
|
|
|
4910
4966
|
let r = e.lazy(n);
|
|
4911
4967
|
u.register(t, r, {
|
|
4912
4968
|
namespace: "field",
|
|
4913
|
-
skipFallback:
|
|
4969
|
+
skipFallback: pa.has(t)
|
|
4914
4970
|
});
|
|
4915
4971
|
}
|
|
4916
|
-
function
|
|
4917
|
-
Object.keys(
|
|
4918
|
-
|
|
4972
|
+
function ha() {
|
|
4973
|
+
Object.keys(fa).forEach((e) => {
|
|
4974
|
+
ma(e);
|
|
4919
4975
|
});
|
|
4920
4976
|
}
|
|
4921
|
-
function
|
|
4922
|
-
u.register("text", $(
|
|
4977
|
+
function ga() {
|
|
4978
|
+
u.register("text", $(Ke), {
|
|
4923
4979
|
namespace: "field",
|
|
4924
4980
|
skipFallback: !0
|
|
4925
|
-
}), u.register("textarea", $(
|
|
4981
|
+
}), u.register("textarea", $(wt), {
|
|
4926
4982
|
namespace: "field",
|
|
4927
4983
|
skipFallback: !0
|
|
4928
|
-
}), u.register("number", $(
|
|
4984
|
+
}), u.register("number", $(Ye), { namespace: "field" }), u.register("boolean", $(Qe), { namespace: "field" }), u.register("select", $(it), {
|
|
4929
4985
|
namespace: "field",
|
|
4930
4986
|
skipFallback: !0
|
|
4931
|
-
}), u.register("date", $(
|
|
4987
|
+
}), u.register("date", $(st), { namespace: "field" }), u.register("datetime", $(ln), { namespace: "field" }), u.register("time", $(fn), { namespace: "field" }), u.register("email", $(ut), {
|
|
4932
4988
|
namespace: "field",
|
|
4933
4989
|
skipFallback: !0
|
|
4934
|
-
}), u.register("phone", $(
|
|
4990
|
+
}), u.register("phone", $(pt), { namespace: "field" }), u.register("url", $(gt), { namespace: "field" }), u.register("currency", $(xt), { namespace: "field" }), u.register("percent", $(hn), { namespace: "field" }), u.register("password", $(vn), {
|
|
4935
4991
|
namespace: "field",
|
|
4936
4992
|
skipFallback: !0
|
|
4937
|
-
}), u.register("markdown", $(
|
|
4993
|
+
}), u.register("markdown", $(Dt), {
|
|
4938
4994
|
namespace: "field",
|
|
4939
4995
|
skipFallback: !0
|
|
4940
|
-
}), u.register("html", $(
|
|
4996
|
+
}), u.register("html", $(Dt), {
|
|
4941
4997
|
namespace: "field",
|
|
4942
4998
|
skipFallback: !0
|
|
4943
|
-
}), u.register("lookup", $(
|
|
4999
|
+
}), u.register("lookup", $(rn), { namespace: "field" }), u.register("master_detail", $(rn), { namespace: "field" }), u.register("file", $(xn), { namespace: "field" }), u.register("image", $(Dn), {
|
|
4944
5000
|
namespace: "field",
|
|
4945
5001
|
skipFallback: !0
|
|
4946
|
-
}), u.register("location", $(
|
|
5002
|
+
}), u.register("location", $(jn), { namespace: "field" }), u.register("formula", $(Pn), { namespace: "field" }), u.register("summary", $(Ln), { namespace: "field" }), u.register("auto_number", $(Bn), { namespace: "field" }), u.register("user", $(Un), { namespace: "field" }), u.register("owner", $(Un), { namespace: "field" }), u.register("object", $(Kn), { namespace: "field" }), u.register("vector", $(Yn), { namespace: "field" }), u.register("grid", $(sr), {
|
|
4947
5003
|
namespace: "field",
|
|
4948
5004
|
skipFallback: !0
|
|
4949
|
-
}), u.register("color", $(
|
|
5005
|
+
}), u.register("color", $(mr), { namespace: "field" }), u.register("slider", $(_r), {
|
|
4950
5006
|
namespace: "field",
|
|
4951
5007
|
skipFallback: !0
|
|
4952
|
-
}), u.register("rating", $(
|
|
5008
|
+
}), u.register("rating", $(br), { namespace: "field" }), u.register("code", $(Cr), { namespace: "field" }), u.register("avatar", $(Er), {
|
|
4953
5009
|
namespace: "field",
|
|
4954
5010
|
skipFallback: !0
|
|
4955
|
-
}), u.register("address", $(
|
|
5011
|
+
}), u.register("address", $(kr), { namespace: "field" }), u.register("geolocation", $(Mr), { namespace: "field" }), u.register("signature", $(Fr), { namespace: "field" }), u.register("qrcode", $(Rr), { namespace: "field" });
|
|
4956
5012
|
}
|
|
4957
|
-
|
|
5013
|
+
ha();
|
|
4958
5014
|
//#endregion
|
|
4959
|
-
export {
|
|
5015
|
+
export { kr as AddressField, Bn as AutoNumberField, Er as AvatarField, Ei as BooleanCellRenderer, Qe as BooleanField, qr as CheckboxesField, Cr as CodeField, mr as ColorField, ta as ColorSwatchCellRenderer, Si as CurrencyCellRenderer, xt as CurrencyField, $r as DISCRETE_EDIT_TYPES, Di as DateCellRenderer, st as DateField, Oi as DateTimeCellRenderer, ln as DateTimeField, Vi as EmailCellRenderer, ut as EmailField, ti as FieldEditWidget, Wi as FileCellRenderer, xn as FileField, qi as FormulaCellRenderer, Pn as FormulaField, Mr as GeolocationField, sr as GridField, aa as HtmlCellRenderer, Gi as ImageCellRenderer, wn as ImageCropperDialog, Dn as ImageField, ea as JsonCellRenderer, dr as LineItemsField, oa as LocationCellRenderer, jn as LocationField, Ki as LookupCellRenderer, rn as LookupField, ra as MarkdownCellRenderer, ni as MasterDetailField, Vr as MultiSelectField, xi as NumberCellRenderer, Ye as NumberField, Kn as ObjectField, vn as PasswordField, wi as PercentCellRenderer, hn as PercentField, Ui as PhoneCellRenderer, pt as PhoneField, Rr as QRCodeField, Wr as RadioField, br as RatingField, Nt as RecordPickerDialog, Dt as RichTextField, Bi as SelectCellRenderer, it as SelectField, Fr as SignatureField, _r as SliderField, Ln as SummaryField, Xr as TagsField, wt as TextAreaField, bi as TextCellRenderer, Ke as TextField, fn as TimeField, Hi as UrlCellRenderer, gt as UrlField, Ji as UserCellRenderer, Un as UserField, Yn as VectorField, ua as buildValidationRules, di as coerceToSafeValue, rr as computeRow, tr as evalArith, da as evaluateCondition, pi as formatCompactCurrency, fi as formatCurrency, vi as formatDate, yi as formatDateTime, la as formatFileSize, mi as formatNumber, hi as formatPercent, _i as formatRelativeDate, Ii as getBadgeColorClasses, sa as getCellRenderer, Li as getSemanticColorName, zi as getSemanticHex, ei as hasFieldEditWidget, gi as humanizeLabel, ci as isLikelyOpaqueId, nr as lookupAutofillPatch, jt as lookupFiltersToRecord, ca as mapFieldTypeToFormType, ha as registerAllFields, ma as registerField, Xi as registerFieldRenderer, ga as registerFields, $i as resolveCellRendererType, h as resolveFieldCurrency, or as sumColumn };
|