@object-ui/fields 4.0.4 → 4.0.5
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 +33 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +1928 -908
- package/package.json +7 -7
- package/dist/ImageCropperDialog-CK1apFXU.cjs +0 -1
- package/dist/ImageCropperDialog-DNvktnyM.js +0 -147
- package/dist/LookupField-CRKvDPFG.cjs +0 -1
- package/dist/LookupField-XRxsGgLS.js +0 -938
- package/dist/chunk-D-qHiVGv.cjs +0 -1
- package/dist/rolldown-runtime-CAFD8bLK.js +0 -11
- package/dist/useFieldTranslation-BYPwtuNZ.cjs +0 -1
- package/dist/useFieldTranslation-Bv3oUVgb.js +0 -9
package/dist/index.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
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 } from "@object-ui/core";
|
|
3
|
+
import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as te, PopoverContent as T, PopoverTrigger as ne, Select as E, SelectContent as re, SelectItem as ie, SelectTrigger as ae, SelectValue as oe, Skeleton as D, Slider as O, Switch as se, Table as ce, TableBody as le, TableCell as k, TableHead as ue, TableHeader as A, TableRow as j, Textarea as M, cn as N } from "@object-ui/components";
|
|
4
|
+
import { AlertCircle as de, ArrowDown as fe, ArrowUp as pe, ArrowUpDown as me, Camera as P, Check as F, ChevronLeft as he, ChevronRight as ge, Copy as I, Crop as _e, Crosshair as L, Eraser as R, ExternalLink as z, Eye as B, EyeOff as ve, File as ye, Image as be, ImageIcon as V, Loader2 as xe, MapPin as H, Maximize2 as U, Phone as Se, Plus as Ce, QrCode as W, RotateCw as G, Search as we, SlidersHorizontal as Te, Star as Ee, TableProperties as De, Upload as Oe, X as ke } from "lucide-react";
|
|
5
|
+
import { Fragment as Ae, jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
6
|
+
import { createSafeTranslation as J } from "@object-ui/i18n";
|
|
7
|
+
import { SchemaRendererContext as je } from "@object-ui/react";
|
|
8
|
+
import { useUpload as Me } from "@object-ui/providers";
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var Ne = Object.defineProperty, Y = (e, t) => () => (e && (t = e(e = 0)), t), X = (e, t) => {
|
|
11
|
+
let n = {};
|
|
12
|
+
for (var r in e) Ne(n, r, {
|
|
13
|
+
get: e[r],
|
|
14
|
+
enumerable: !0
|
|
15
|
+
});
|
|
16
|
+
return t || Ne(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
17
|
+
}, Pe = /* @__PURE__ */ X({ TextField: () => Fe });
|
|
18
|
+
function Fe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
14
19
|
let a = n || i.schema;
|
|
15
|
-
if (r) return /* @__PURE__ */
|
|
20
|
+
if (r) return /* @__PURE__ */ K("span", {
|
|
16
21
|
className: "text-sm",
|
|
17
|
-
children: e || /* @__PURE__ */
|
|
22
|
+
children: e || /* @__PURE__ */ K(S, {})
|
|
18
23
|
});
|
|
19
24
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
20
|
-
return o && o > 1 ? /* @__PURE__ */
|
|
25
|
+
return o && o > 1 ? /* @__PURE__ */ K(M, {
|
|
21
26
|
...c,
|
|
22
27
|
value: e || "",
|
|
23
28
|
onChange: (e) => t(e.target.value),
|
|
24
29
|
placeholder: a?.placeholder,
|
|
25
30
|
disabled: r || c.disabled
|
|
26
|
-
}) : /* @__PURE__ */
|
|
31
|
+
}) : /* @__PURE__ */ K(C, {
|
|
27
32
|
...c,
|
|
28
33
|
type: a?.type === "password" ? "password" : "text",
|
|
29
34
|
value: e || "",
|
|
@@ -32,16 +37,14 @@ function De({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
32
37
|
disabled: r || c.disabled
|
|
33
38
|
});
|
|
34
39
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
39
|
-
if (r) return e == null ? /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ F("span", {
|
|
40
|
+
var Ie = Y((() => {})), Le = /* @__PURE__ */ X({ NumberField: () => Re });
|
|
41
|
+
function Re({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
42
|
+
if (r) return e == null ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ K("span", {
|
|
40
43
|
className: "text-sm",
|
|
41
44
|
children: e
|
|
42
45
|
});
|
|
43
46
|
let a = n || i.schema, o = a?.precision, { inputType: s, ...c } = i;
|
|
44
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ K(C, {
|
|
45
48
|
...c,
|
|
46
49
|
type: "number",
|
|
47
50
|
value: e ?? "",
|
|
@@ -54,82 +57,85 @@ function ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
54
57
|
step: o ? 10 ** -o : "any"
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
let a = n || i.schema, o = a?.widget, s = d(), c = a?.name || s, l = a?.label || "Checkbox";
|
|
62
|
-
if (r) return /* @__PURE__ */ F("span", {
|
|
60
|
+
var ze = Y((() => {})), Be = /* @__PURE__ */ X({ BooleanField: () => Z });
|
|
61
|
+
function Z({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
62
|
+
let a = n || i.schema, s = a?.widget, c = o(), l = a?.name || c, u = a?.label || "Checkbox";
|
|
63
|
+
if (r) return /* @__PURE__ */ K("span", {
|
|
63
64
|
className: "text-sm",
|
|
64
65
|
children: e ? "Yes" : "No"
|
|
65
66
|
});
|
|
66
|
-
let { inputType:
|
|
67
|
-
return
|
|
67
|
+
let { inputType: d, ...f } = i;
|
|
68
|
+
return s === "checkbox" ? /* @__PURE__ */ q("div", {
|
|
68
69
|
className: "flex items-center space-x-2",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ K(g, {
|
|
70
71
|
...f,
|
|
71
|
-
id:
|
|
72
|
+
id: l,
|
|
72
73
|
checked: !!e,
|
|
73
74
|
onCheckedChange: (e) => t(!!e),
|
|
74
75
|
disabled: r || f.disabled
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
htmlFor:
|
|
77
|
-
children:
|
|
76
|
+
}), /* @__PURE__ */ K(w, {
|
|
77
|
+
htmlFor: l,
|
|
78
|
+
children: u
|
|
78
79
|
})]
|
|
79
|
-
}) : /* @__PURE__ */
|
|
80
|
+
}) : /* @__PURE__ */ q("div", {
|
|
80
81
|
className: "flex items-center space-x-2",
|
|
81
|
-
children: [/* @__PURE__ */
|
|
82
|
+
children: [/* @__PURE__ */ K(se, {
|
|
82
83
|
...f,
|
|
83
|
-
id:
|
|
84
|
+
id: l,
|
|
84
85
|
checked: !!e,
|
|
85
86
|
onCheckedChange: t,
|
|
86
87
|
disabled: r || f.disabled
|
|
87
|
-
}), /* @__PURE__ */
|
|
88
|
-
htmlFor:
|
|
89
|
-
children:
|
|
88
|
+
}), /* @__PURE__ */ K(w, {
|
|
89
|
+
htmlFor: l,
|
|
90
|
+
children: u
|
|
90
91
|
})]
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
var Ve = Y((() => {})), He, Ue, We = Y((() => {
|
|
95
|
+
He = {
|
|
96
|
+
"common.selectOption": "Select an option",
|
|
97
|
+
"common.select": "Select...",
|
|
98
|
+
"common.search": "Search",
|
|
99
|
+
"table.selected": "{{count}} selected"
|
|
100
|
+
}, Ue = J(He, "common.selectOption");
|
|
101
|
+
})), Ge = /* @__PURE__ */ X({ SelectField: () => Ke });
|
|
102
|
+
function Ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
103
|
+
let a = n || i.schema, o = a?.options || [], { t: s } = Ue();
|
|
104
|
+
if (r) {
|
|
105
|
+
let t = o.find((t) => t.value === e)?.label || e;
|
|
106
|
+
return t ? /* @__PURE__ */ K("span", {
|
|
101
107
|
className: "text-sm",
|
|
102
108
|
children: t
|
|
103
|
-
}) : /* @__PURE__ */
|
|
109
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
104
110
|
}
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
...
|
|
111
|
+
return /* @__PURE__ */ q(E, {
|
|
112
|
+
...i,
|
|
107
113
|
value: e,
|
|
108
|
-
onValueChange:
|
|
109
|
-
disabled:
|
|
110
|
-
children: [/* @__PURE__ */
|
|
111
|
-
className:
|
|
112
|
-
id:
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
}), /* @__PURE__ */
|
|
114
|
+
onValueChange: t,
|
|
115
|
+
disabled: r || i.disabled,
|
|
116
|
+
children: [/* @__PURE__ */ K(ae, {
|
|
117
|
+
className: i.className,
|
|
118
|
+
id: i.id,
|
|
119
|
+
children: /* @__PURE__ */ K(oe, { placeholder: a?.placeholder || s("common.selectOption") })
|
|
120
|
+
}), /* @__PURE__ */ K(re, {
|
|
115
121
|
position: "popper",
|
|
116
|
-
children:
|
|
122
|
+
children: o.map((e) => /* @__PURE__ */ K(ie, {
|
|
117
123
|
value: e.value,
|
|
118
124
|
children: e.label
|
|
119
125
|
}, e.value))
|
|
120
126
|
})]
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
function
|
|
127
|
-
if (r) return e ? /* @__PURE__ */
|
|
129
|
+
var qe = Y((() => {
|
|
130
|
+
We();
|
|
131
|
+
})), Je = /* @__PURE__ */ X({ DateField: () => Ye });
|
|
132
|
+
function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
133
|
+
if (r) return e ? /* @__PURE__ */ K("span", {
|
|
128
134
|
className: "text-sm",
|
|
129
135
|
children: new Date(e).toLocaleDateString()
|
|
130
|
-
}) : /* @__PURE__ */
|
|
136
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
131
137
|
let { inputType: a, ...o } = i;
|
|
132
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ K(C, {
|
|
133
139
|
...o,
|
|
134
140
|
type: "date",
|
|
135
141
|
value: e || "",
|
|
@@ -137,18 +143,16 @@ function Fe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
137
143
|
disabled: r || o.disabled
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var Ie = /* @__PURE__ */ e({ EmailField: () => Le });
|
|
143
|
-
function Le({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
146
|
+
var Xe = Y((() => {})), Ze = /* @__PURE__ */ X({ EmailField: () => Qe });
|
|
147
|
+
function Qe({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
144
148
|
let o = n || a.schema;
|
|
145
|
-
if (r) return e ? /* @__PURE__ */
|
|
149
|
+
if (r) return e ? /* @__PURE__ */ K("a", {
|
|
146
150
|
href: `mailto:${e}`,
|
|
147
151
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
148
152
|
children: e
|
|
149
|
-
}) : /* @__PURE__ */
|
|
153
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
150
154
|
let { inputType: s, ...c } = a;
|
|
151
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ K(C, {
|
|
152
156
|
...c,
|
|
153
157
|
type: "email",
|
|
154
158
|
value: e || "",
|
|
@@ -158,18 +162,16 @@ function Le({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
158
162
|
"aria-invalid": !!i
|
|
159
163
|
});
|
|
160
164
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
var Re = /* @__PURE__ */ e({ PhoneField: () => ze });
|
|
164
|
-
function ze({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
165
|
+
var $e = Y((() => {})), et = /* @__PURE__ */ X({ PhoneField: () => tt });
|
|
166
|
+
function tt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
165
167
|
let o = n || a.schema;
|
|
166
|
-
if (r) return e ? /* @__PURE__ */
|
|
168
|
+
if (r) return e ? /* @__PURE__ */ K("a", {
|
|
167
169
|
href: `tel:${e}`,
|
|
168
170
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
169
171
|
children: e
|
|
170
|
-
}) : /* @__PURE__ */
|
|
172
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
171
173
|
let { inputType: s, ...c } = a;
|
|
172
|
-
return /* @__PURE__ */
|
|
174
|
+
return /* @__PURE__ */ K(C, {
|
|
173
175
|
...c,
|
|
174
176
|
type: "tel",
|
|
175
177
|
value: e || "",
|
|
@@ -179,23 +181,21 @@ function ze({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
179
181
|
"aria-invalid": !!i
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var Be = /* @__PURE__ */ e({ UrlField: () => Ve });
|
|
185
|
-
function Ve({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
184
|
+
var nt = Y((() => {})), rt = /* @__PURE__ */ X({ UrlField: () => it });
|
|
185
|
+
function it({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
186
186
|
let o = n || a.schema;
|
|
187
|
-
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */
|
|
187
|
+
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ K("a", {
|
|
188
188
|
href: e,
|
|
189
189
|
target: "_blank",
|
|
190
190
|
rel: "noopener noreferrer",
|
|
191
191
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
192
192
|
children: e
|
|
193
|
-
}) : /* @__PURE__ */
|
|
193
|
+
}) : /* @__PURE__ */ K("span", {
|
|
194
194
|
className: "text-sm",
|
|
195
195
|
children: e
|
|
196
|
-
}) : /* @__PURE__ */
|
|
196
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
197
197
|
let { inputType: s, ...c } = a;
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ K(C, {
|
|
199
199
|
...c,
|
|
200
200
|
type: "url",
|
|
201
201
|
value: e || "",
|
|
@@ -205,10 +205,8 @@ function Ve({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
205
205
|
"aria-invalid": !!i
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var He = /* @__PURE__ */ e({ CurrencyField: () => We });
|
|
211
|
-
function Ue(e, t = "USD") {
|
|
208
|
+
var at = Y((() => {})), ot = /* @__PURE__ */ X({ CurrencyField: () => ct });
|
|
209
|
+
function st(e, t = "USD") {
|
|
212
210
|
try {
|
|
213
211
|
return new Intl.NumberFormat("en-US", {
|
|
214
212
|
style: "currency",
|
|
@@ -218,22 +216,22 @@ function Ue(e, t = "USD") {
|
|
|
218
216
|
return `${t} ${e.toFixed(2)}`;
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
|
-
function
|
|
219
|
+
function ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
222
220
|
let s = n || o.schema, c = s?.currency || "USD", l = s?.precision ?? 2;
|
|
223
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
221
|
+
if (r) return e == null ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ K("span", {
|
|
224
222
|
className: "text-sm font-medium tabular-nums",
|
|
225
|
-
children:
|
|
223
|
+
children: st(Number(e), c)
|
|
226
224
|
});
|
|
227
225
|
let u = (e) => {
|
|
228
226
|
let n = parseFloat(e.target.value);
|
|
229
227
|
isNaN(n) || t(parseFloat(n.toFixed(l)));
|
|
230
228
|
};
|
|
231
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ q("div", {
|
|
232
230
|
className: "relative",
|
|
233
|
-
children: [/* @__PURE__ */
|
|
231
|
+
children: [/* @__PURE__ */ K("span", {
|
|
234
232
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
235
233
|
children: c === "USD" ? "$" : c
|
|
236
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ K(C, {
|
|
237
235
|
...o,
|
|
238
236
|
type: "number",
|
|
239
237
|
value: e ?? "",
|
|
@@ -249,42 +247,40 @@ function We({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
249
247
|
})]
|
|
250
248
|
});
|
|
251
249
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function Ke({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
256
|
-
if (r) return /* @__PURE__ */ F("div", {
|
|
250
|
+
var lt = Y((() => {})), ut = /* @__PURE__ */ X({ TextAreaField: () => dt });
|
|
251
|
+
function dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
252
|
+
if (r) return /* @__PURE__ */ K("div", {
|
|
257
253
|
className: "text-sm whitespace-pre-wrap",
|
|
258
|
-
children: e || /* @__PURE__ */
|
|
259
|
-
});
|
|
260
|
-
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length,
|
|
261
|
-
m(e ?? ""),
|
|
262
|
-
},
|
|
263
|
-
t(
|
|
264
|
-
}, { inputType:
|
|
265
|
-
return /* @__PURE__ */
|
|
254
|
+
children: e || /* @__PURE__ */ K(S, {})
|
|
255
|
+
});
|
|
256
|
+
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length, u = !!(a.mobileFullscreen ?? o?.mobile_fullscreen ?? a.mobile_fullscreen ?? a.schema?.mobile_fullscreen), [d, f] = l(!1), [p, m] = l(e ?? ""), g = () => {
|
|
257
|
+
m(e ?? ""), f(!0);
|
|
258
|
+
}, y = () => f(!1), C = () => {
|
|
259
|
+
t(p), f(!1);
|
|
260
|
+
}, { inputType: w, mobileFullscreen: te, ...T } = a;
|
|
261
|
+
return /* @__PURE__ */ q("div", {
|
|
266
262
|
className: "relative",
|
|
267
263
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
...
|
|
264
|
+
/* @__PURE__ */ K(M, {
|
|
265
|
+
...T,
|
|
270
266
|
value: e || "",
|
|
271
267
|
onChange: (e) => t(e.target.value),
|
|
272
268
|
placeholder: o?.placeholder,
|
|
273
|
-
disabled: r ||
|
|
269
|
+
disabled: r || T.disabled,
|
|
274
270
|
rows: s,
|
|
275
271
|
maxLength: c,
|
|
276
272
|
"aria-invalid": !!i,
|
|
277
|
-
className:
|
|
273
|
+
className: T.className
|
|
278
274
|
}),
|
|
279
|
-
|
|
275
|
+
u && /* @__PURE__ */ K("button", {
|
|
280
276
|
type: "button",
|
|
281
|
-
onClick:
|
|
277
|
+
onClick: g,
|
|
282
278
|
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",
|
|
283
279
|
"aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
|
|
284
280
|
"data-testid": "textarea-fullscreen-toggle",
|
|
285
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ K(U, { className: "size-3.5" })
|
|
286
282
|
}),
|
|
287
|
-
c && /* @__PURE__ */
|
|
283
|
+
c && /* @__PURE__ */ q("div", {
|
|
288
284
|
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
289
285
|
"aria-live": "polite",
|
|
290
286
|
"aria-label": `Character count: ${(e || "").length} of ${c}`,
|
|
@@ -294,25 +290,25 @@ function Ke({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
294
290
|
c
|
|
295
291
|
]
|
|
296
292
|
}),
|
|
297
|
-
|
|
298
|
-
open:
|
|
299
|
-
onOpenChange:
|
|
300
|
-
children: /* @__PURE__ */
|
|
293
|
+
u && /* @__PURE__ */ K(_, {
|
|
294
|
+
open: d,
|
|
295
|
+
onOpenChange: f,
|
|
296
|
+
children: /* @__PURE__ */ q(v, {
|
|
301
297
|
className: "sm:max-w-3xl h-[100dvh] sm:h-[80vh] max-h-[100dvh] sm:max-h-[80vh] flex flex-col p-0 gap-0",
|
|
302
298
|
"data-testid": "textarea-fullscreen-dialog",
|
|
303
299
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ K(ee, {
|
|
305
301
|
className: "p-4 border-b",
|
|
306
|
-
children: /* @__PURE__ */
|
|
302
|
+
children: /* @__PURE__ */ K(x, {
|
|
307
303
|
className: "text-base",
|
|
308
304
|
children: o?.label ?? "Edit text"
|
|
309
305
|
})
|
|
310
306
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ K("div", {
|
|
312
308
|
className: "flex-1 min-h-0 p-4",
|
|
313
|
-
children: /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ K(M, {
|
|
314
310
|
autoFocus: !0,
|
|
315
|
-
value:
|
|
311
|
+
value: p,
|
|
316
312
|
onChange: (e) => m(e.target.value),
|
|
317
313
|
maxLength: c,
|
|
318
314
|
placeholder: o?.placeholder,
|
|
@@ -320,27 +316,27 @@ function Ke({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
320
316
|
"data-testid": "textarea-fullscreen-input"
|
|
321
317
|
})
|
|
322
318
|
}),
|
|
323
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ q(b, {
|
|
324
320
|
className: "p-3 border-t flex-row justify-between sm:justify-end gap-2",
|
|
325
|
-
children: [c && /* @__PURE__ */
|
|
321
|
+
children: [c && /* @__PURE__ */ q("span", {
|
|
326
322
|
className: "text-xs text-muted-foreground self-center",
|
|
327
323
|
children: [
|
|
328
|
-
|
|
324
|
+
p.length,
|
|
329
325
|
"/",
|
|
330
326
|
c
|
|
331
327
|
]
|
|
332
|
-
}), /* @__PURE__ */
|
|
328
|
+
}), /* @__PURE__ */ q("div", {
|
|
333
329
|
className: "flex gap-2 ml-auto",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ q(h, {
|
|
335
331
|
type: "button",
|
|
336
332
|
variant: "ghost",
|
|
337
|
-
onClick:
|
|
338
|
-
children: [/* @__PURE__ */
|
|
339
|
-
}), /* @__PURE__ */
|
|
333
|
+
onClick: y,
|
|
334
|
+
children: [/* @__PURE__ */ K(ke, { className: "size-4 mr-1" }), " Cancel"]
|
|
335
|
+
}), /* @__PURE__ */ q(h, {
|
|
340
336
|
type: "button",
|
|
341
|
-
onClick:
|
|
337
|
+
onClick: C,
|
|
342
338
|
"data-testid": "textarea-fullscreen-save",
|
|
343
|
-
children: [/* @__PURE__ */ F
|
|
339
|
+
children: [/* @__PURE__ */ K(F, { className: "size-4 mr-1" }), " Done"]
|
|
344
340
|
})]
|
|
345
341
|
})]
|
|
346
342
|
})
|
|
@@ -350,24 +346,22 @@ function Ke({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
350
346
|
]
|
|
351
347
|
});
|
|
352
348
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
function L({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
357
|
-
if (r) return /* @__PURE__ */ F("div", {
|
|
349
|
+
var ft = Y((() => {})), pt = /* @__PURE__ */ X({ RichTextField: () => mt });
|
|
350
|
+
function mt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
351
|
+
if (r) return /* @__PURE__ */ K("div", {
|
|
358
352
|
className: "text-sm prose prose-sm max-w-none",
|
|
359
|
-
children: e || /* @__PURE__ */
|
|
353
|
+
children: e || /* @__PURE__ */ K(S, {})
|
|
360
354
|
});
|
|
361
355
|
let o = n || a.schema, s = o?.rows || 8;
|
|
362
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ q("div", {
|
|
363
357
|
className: "space-y-2",
|
|
364
|
-
children: [/* @__PURE__ */
|
|
358
|
+
children: [/* @__PURE__ */ q("div", {
|
|
365
359
|
className: "flex items-center justify-between text-xs text-gray-500",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
360
|
+
children: [/* @__PURE__ */ q("span", { children: ["Format: ", o?.format || "markdown"] }), /* @__PURE__ */ K("span", {
|
|
367
361
|
className: "italic",
|
|
368
362
|
children: "Rich text editor (basic)"
|
|
369
363
|
})]
|
|
370
|
-
}), /* @__PURE__ */
|
|
364
|
+
}), /* @__PURE__ */ K(M, {
|
|
371
365
|
value: e || "",
|
|
372
366
|
onChange: (e) => t(e.target.value),
|
|
373
367
|
placeholder: o?.placeholder || "Enter text...",
|
|
@@ -378,14 +372,944 @@ function L({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a
|
|
|
378
372
|
})]
|
|
379
373
|
});
|
|
380
374
|
}
|
|
375
|
+
var ht = Y((() => {}));
|
|
381
376
|
//#endregion
|
|
382
|
-
//#region src/widgets/
|
|
383
|
-
|
|
384
|
-
|
|
377
|
+
//#region src/widgets/RecordPickerDialog.tsx
|
|
378
|
+
function gt(e) {
|
|
379
|
+
return typeof e == "string" ? { field: e } : e;
|
|
380
|
+
}
|
|
381
|
+
function _t(e) {
|
|
382
|
+
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
383
|
+
}
|
|
384
|
+
function vt(e) {
|
|
385
|
+
let t = {};
|
|
386
|
+
for (let n of e) switch (n.operator) {
|
|
387
|
+
case "eq":
|
|
388
|
+
t[n.field] = n.value;
|
|
389
|
+
break;
|
|
390
|
+
case "ne":
|
|
391
|
+
t[n.field] = { $ne: n.value };
|
|
392
|
+
break;
|
|
393
|
+
case "gt":
|
|
394
|
+
t[n.field] = { $gt: n.value };
|
|
395
|
+
break;
|
|
396
|
+
case "lt":
|
|
397
|
+
t[n.field] = { $lt: n.value };
|
|
398
|
+
break;
|
|
399
|
+
case "gte":
|
|
400
|
+
t[n.field] = { $gte: n.value };
|
|
401
|
+
break;
|
|
402
|
+
case "lte":
|
|
403
|
+
t[n.field] = { $lte: n.value };
|
|
404
|
+
break;
|
|
405
|
+
case "contains":
|
|
406
|
+
t[n.field] = { $contains: n.value };
|
|
407
|
+
break;
|
|
408
|
+
case "in":
|
|
409
|
+
t[n.field] = { $in: n.value };
|
|
410
|
+
break;
|
|
411
|
+
case "notIn":
|
|
412
|
+
t[n.field] = { $nin: n.value };
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
return t;
|
|
416
|
+
}
|
|
417
|
+
function yt(e, t) {
|
|
418
|
+
let n = {};
|
|
419
|
+
for (let r of t) {
|
|
420
|
+
let t = e[r.field];
|
|
421
|
+
t == null || t === "" || (r.type === "boolean" ? n[r.field] = !!t : r.type === "text" ? n[r.field] = { $contains: t } : n[r.field] = t);
|
|
422
|
+
}
|
|
423
|
+
return n;
|
|
424
|
+
}
|
|
425
|
+
function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", idField: p = "id", pageSize: m = xt, value: y, onSelect: S, onSelectRecords: te, lookupFilters: T, cellRenderer: ne, filterColumns: O, renderFilterBar: se, renderGrid: M }) {
|
|
426
|
+
let [P, I] = l([]), [_e, L] = l(!1), [R, z] = l(null), [B, ve] = l(0), [ye, be] = l(""), [V, H] = l(1), U = c(null), [Se, Ce] = l(null), [W, G] = l("asc"), [Ee, De] = l(/* @__PURE__ */ new Set()), Oe = c(/* @__PURE__ */ new Map()), [J, je] = l(-1), Me = c(null), [Ne, Y] = l(!1), [X, Pe] = l({}), [Fe, Ie] = l({}), Le = c(null), [Re, ze] = l(""), Be = s(() => d && d.length > 0 ? d.map(gt) : [{
|
|
427
|
+
field: f,
|
|
428
|
+
label: _t(f)
|
|
429
|
+
}], [d, f]), Z = s(() => {
|
|
430
|
+
if (O && O.length > 0) return O;
|
|
431
|
+
if (T && T.length > 0) return T.map((e) => {
|
|
432
|
+
let t = "text";
|
|
433
|
+
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"), {
|
|
434
|
+
field: e.field,
|
|
435
|
+
label: _t(e.field),
|
|
436
|
+
type: t,
|
|
437
|
+
...Array.isArray(e.value) ? { options: e.value.map((e) => {
|
|
438
|
+
if (typeof e == "object" && e) {
|
|
439
|
+
let t = e;
|
|
440
|
+
return {
|
|
441
|
+
label: String(t.name || t.label || t.title || e),
|
|
442
|
+
value: e
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
label: String(e),
|
|
447
|
+
value: e
|
|
448
|
+
};
|
|
449
|
+
}) } : {}
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
}, [O, T]), Ve = s(() => {
|
|
453
|
+
let e = T?.length ? vt(T) : {}, t = Z?.length ? yt(X, Z) : {}, n = {
|
|
454
|
+
...e,
|
|
455
|
+
...t
|
|
456
|
+
};
|
|
457
|
+
return Object.keys(n).length > 0 ? n : void 0;
|
|
458
|
+
}, [
|
|
459
|
+
T,
|
|
460
|
+
Z,
|
|
461
|
+
X
|
|
462
|
+
]), He = Math.max(1, Math.ceil(B / m)), Ue = r(async (e, t = 1, n, r) => {
|
|
463
|
+
if (!(!o || !u)) {
|
|
464
|
+
L(!0), z(null);
|
|
465
|
+
try {
|
|
466
|
+
let i = {
|
|
467
|
+
$top: m,
|
|
468
|
+
$skip: (t - 1) * m
|
|
469
|
+
};
|
|
470
|
+
e && e.trim() && (i.$search = e.trim()), n && (i.$orderby = { [n.field]: n.direction });
|
|
471
|
+
let a = r === void 0 ? Ve : r;
|
|
472
|
+
a && Object.keys(a).length > 0 && (i.$filter = a);
|
|
473
|
+
let s = await o.find(u, i), c = s?.data ?? s ?? [];
|
|
474
|
+
I(c), ve(s?.total ?? c.length), je(-1);
|
|
475
|
+
} catch (e) {
|
|
476
|
+
z(e instanceof Error ? e.message : String(e)), I([]);
|
|
477
|
+
} finally {
|
|
478
|
+
L(!1);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}, [
|
|
482
|
+
o,
|
|
483
|
+
u,
|
|
484
|
+
m,
|
|
485
|
+
Ve
|
|
486
|
+
]), We = s(() => Se ? {
|
|
487
|
+
field: Se,
|
|
488
|
+
direction: W
|
|
489
|
+
} : null, [Se, W]);
|
|
490
|
+
a(() => {
|
|
491
|
+
e || (be(""), H(1), z(null), I([]), Ce(null), G("asc"), je(-1), Y(!1), Pe({}), Ie({}), ze(""), De(new Set(i && Array.isArray(y) ? y : [])), Oe.current.clear());
|
|
492
|
+
}, [e]), a(() => {
|
|
493
|
+
e && Ue(ye || void 0, V, We);
|
|
494
|
+
}, [
|
|
495
|
+
e,
|
|
496
|
+
V,
|
|
497
|
+
We,
|
|
498
|
+
Ve
|
|
499
|
+
]), a(() => {
|
|
500
|
+
e && i && De(new Set(Array.isArray(y) ? y : []));
|
|
501
|
+
}, [
|
|
502
|
+
e,
|
|
503
|
+
i,
|
|
504
|
+
y
|
|
505
|
+
]);
|
|
506
|
+
let Ge = r((e) => {
|
|
507
|
+
be(e), H(1), U.current && clearTimeout(U.current), U.current = setTimeout(() => {
|
|
508
|
+
Ue(e || void 0, 1, We);
|
|
509
|
+
}, 300);
|
|
510
|
+
}, [Ue, We]);
|
|
511
|
+
a(() => () => {
|
|
512
|
+
U.current && clearTimeout(U.current);
|
|
513
|
+
}, []);
|
|
514
|
+
let Ke = r((e) => {
|
|
515
|
+
Ce((t) => t === e ? (G((e) => e === "asc" ? "desc" : "asc"), e) : (G("asc"), e)), H(1);
|
|
516
|
+
}, []), qe = r((e) => e[p] ?? e.id ?? e._id, [p]), Je = r((e) => {
|
|
517
|
+
let t = qe(e);
|
|
518
|
+
return i ? Ee.has(t) : y === t;
|
|
519
|
+
}, [
|
|
520
|
+
i,
|
|
521
|
+
y,
|
|
522
|
+
Ee,
|
|
523
|
+
qe
|
|
524
|
+
]), Ye = r((e) => {
|
|
525
|
+
let n = qe(e);
|
|
526
|
+
i ? De((t) => {
|
|
527
|
+
let r = new Set(t);
|
|
528
|
+
return r.has(n) ? (r.delete(n), Oe.current.delete(n)) : (r.add(n), Oe.current.set(n, e)), r;
|
|
529
|
+
}) : (S(n), te?.([e]), t(!1));
|
|
530
|
+
}, [
|
|
531
|
+
i,
|
|
532
|
+
qe,
|
|
533
|
+
S,
|
|
534
|
+
te,
|
|
535
|
+
t
|
|
536
|
+
]), Xe = r(() => {
|
|
537
|
+
let e = Array.from(Ee);
|
|
538
|
+
S(e);
|
|
539
|
+
let n = e.map((e) => Oe.current.get(e)).filter(Boolean);
|
|
540
|
+
te?.(n), t(!1);
|
|
541
|
+
}, [
|
|
542
|
+
Ee,
|
|
543
|
+
S,
|
|
544
|
+
te,
|
|
545
|
+
t
|
|
546
|
+
]), Ze = r(() => {
|
|
547
|
+
H((e) => Math.max(1, e - 1));
|
|
548
|
+
}, []), Qe = r(() => {
|
|
549
|
+
H((e) => Math.min(He, e + 1));
|
|
550
|
+
}, [He]), $e = r((e) => {
|
|
551
|
+
if (e.key !== "Enter") return;
|
|
552
|
+
let t = parseInt(Re, 10);
|
|
553
|
+
!isNaN(t) && t >= 1 && t <= He && H(t), ze("");
|
|
554
|
+
}, [Re, He]), et = r((e) => {
|
|
555
|
+
P.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), je((e) => Math.min(e + 1, P.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), je((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J >= 0 && J < P.length && Ye(P[J])));
|
|
556
|
+
}, [
|
|
557
|
+
P,
|
|
558
|
+
J,
|
|
559
|
+
Ye
|
|
560
|
+
]);
|
|
561
|
+
a(() => {
|
|
562
|
+
if (J >= 0 && Me.current) {
|
|
563
|
+
let e = Me.current.querySelector(`[data-row-index="${J}"]`);
|
|
564
|
+
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
565
|
+
}
|
|
566
|
+
}, [J]);
|
|
567
|
+
let tt = r((e, t) => {
|
|
568
|
+
let n = e[t.field];
|
|
569
|
+
if (t.type && ne) {
|
|
570
|
+
let e = ne(t.type);
|
|
571
|
+
if (e) return /* @__PURE__ */ K(e, {
|
|
572
|
+
value: n,
|
|
573
|
+
field: {
|
|
574
|
+
name: t.field,
|
|
575
|
+
type: t.type
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
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);
|
|
580
|
+
}, [ne]), nt = r((e) => Se === e ? K(W === "asc" ? pe : fe, { className: "ml-1 size-3" }) : /* @__PURE__ */ K(me, { className: "ml-1 size-3 opacity-40" }), [Se, W]), rt = r((e, t, n) => {
|
|
581
|
+
e.preventDefault(), e.stopPropagation(), Le.current = {
|
|
582
|
+
field: t,
|
|
583
|
+
startX: e.clientX,
|
|
584
|
+
startWidth: n
|
|
585
|
+
};
|
|
586
|
+
let r = (e) => {
|
|
587
|
+
if (!Le.current) return;
|
|
588
|
+
let t = e.clientX - Le.current.startX, n = Math.max(St, Le.current.startWidth + t);
|
|
589
|
+
Ie((e) => ({
|
|
590
|
+
...e,
|
|
591
|
+
[Le.current.field]: n
|
|
592
|
+
}));
|
|
593
|
+
}, i = () => {
|
|
594
|
+
Le.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
595
|
+
};
|
|
596
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
597
|
+
}, []), it = r((e, t) => {
|
|
598
|
+
Pe((n) => ({
|
|
599
|
+
...n,
|
|
600
|
+
[e]: t
|
|
601
|
+
})), H(1);
|
|
602
|
+
}, []), at = r(() => {
|
|
603
|
+
Pe({}), H(1);
|
|
604
|
+
}, []), ot = s(() => Object.values(X).filter((e) => e != null && e !== "").length, [X]), st = r((e) => {
|
|
605
|
+
let t = X[e.field], n = e.label || _t(e.field);
|
|
606
|
+
switch (e.type) {
|
|
607
|
+
case "select": return /* @__PURE__ */ q("div", {
|
|
608
|
+
className: "space-y-1",
|
|
609
|
+
children: [/* @__PURE__ */ K(w, {
|
|
610
|
+
className: "text-xs text-muted-foreground",
|
|
611
|
+
children: n
|
|
612
|
+
}), /* @__PURE__ */ q(E, {
|
|
613
|
+
value: t == null ? "" : String(t),
|
|
614
|
+
onValueChange: (t) => it(e.field, t),
|
|
615
|
+
children: [/* @__PURE__ */ K(ae, {
|
|
616
|
+
className: "h-8 text-xs",
|
|
617
|
+
children: /* @__PURE__ */ K(oe, { placeholder: `Filter ${n}` })
|
|
618
|
+
}), /* @__PURE__ */ K(re, { children: e.options?.map((e) => /* @__PURE__ */ K(ie, {
|
|
619
|
+
value: String(e.value),
|
|
620
|
+
children: e.label
|
|
621
|
+
}, String(e.value))) })]
|
|
622
|
+
})]
|
|
623
|
+
});
|
|
624
|
+
case "number": return /* @__PURE__ */ q("div", {
|
|
625
|
+
className: "space-y-1",
|
|
626
|
+
children: [/* @__PURE__ */ K(w, {
|
|
627
|
+
className: "text-xs text-muted-foreground",
|
|
628
|
+
children: n
|
|
629
|
+
}), /* @__PURE__ */ K(C, {
|
|
630
|
+
type: "number",
|
|
631
|
+
className: "h-8 text-xs",
|
|
632
|
+
value: t ?? "",
|
|
633
|
+
placeholder: `Filter ${n}`,
|
|
634
|
+
onChange: (t) => {
|
|
635
|
+
let n = t.target.value;
|
|
636
|
+
it(e.field, n === "" ? "" : Number(n));
|
|
637
|
+
}
|
|
638
|
+
})]
|
|
639
|
+
});
|
|
640
|
+
case "date": return /* @__PURE__ */ q("div", {
|
|
641
|
+
className: "space-y-1",
|
|
642
|
+
children: [/* @__PURE__ */ K(w, {
|
|
643
|
+
className: "text-xs text-muted-foreground",
|
|
644
|
+
children: n
|
|
645
|
+
}), /* @__PURE__ */ K(C, {
|
|
646
|
+
type: "date",
|
|
647
|
+
className: "h-8 text-xs",
|
|
648
|
+
value: t ?? "",
|
|
649
|
+
onChange: (t) => it(e.field, t.target.value)
|
|
650
|
+
})]
|
|
651
|
+
});
|
|
652
|
+
case "boolean": return /* @__PURE__ */ q("div", {
|
|
653
|
+
className: "space-y-1",
|
|
654
|
+
children: [/* @__PURE__ */ K(w, {
|
|
655
|
+
className: "text-xs text-muted-foreground",
|
|
656
|
+
children: n
|
|
657
|
+
}), /* @__PURE__ */ q("div", {
|
|
658
|
+
className: "flex items-center gap-2 h-8",
|
|
659
|
+
children: [/* @__PURE__ */ K(g, {
|
|
660
|
+
checked: !!t,
|
|
661
|
+
onCheckedChange: (t) => it(e.field, !!t)
|
|
662
|
+
}), /* @__PURE__ */ K("span", {
|
|
663
|
+
className: "text-xs text-muted-foreground",
|
|
664
|
+
children: "Yes"
|
|
665
|
+
})]
|
|
666
|
+
})]
|
|
667
|
+
});
|
|
668
|
+
default: return /* @__PURE__ */ q("div", {
|
|
669
|
+
className: "space-y-1",
|
|
670
|
+
children: [/* @__PURE__ */ K(w, {
|
|
671
|
+
className: "text-xs text-muted-foreground",
|
|
672
|
+
children: n
|
|
673
|
+
}), /* @__PURE__ */ K(C, {
|
|
674
|
+
className: "h-8 text-xs",
|
|
675
|
+
value: t ?? "",
|
|
676
|
+
placeholder: `Filter ${n}`,
|
|
677
|
+
onChange: (t) => it(e.field, t.target.value)
|
|
678
|
+
})]
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
}, [X, it]), ct = 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", []);
|
|
682
|
+
return /* @__PURE__ */ K(_, {
|
|
683
|
+
open: e,
|
|
684
|
+
onOpenChange: t,
|
|
685
|
+
children: /* @__PURE__ */ q(v, {
|
|
686
|
+
className: "w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0",
|
|
687
|
+
"data-testid": "record-picker-dialog",
|
|
688
|
+
children: [
|
|
689
|
+
/* @__PURE__ */ K(ee, { children: /* @__PURE__ */ q(x, { children: [n, i && /* @__PURE__ */ K("span", {
|
|
690
|
+
className: "sr-only",
|
|
691
|
+
children: " (multiple selection)"
|
|
692
|
+
})] }) }),
|
|
693
|
+
/* @__PURE__ */ q("div", {
|
|
694
|
+
className: "relative rounded-md border bg-muted/30 mb-3",
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ K(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
697
|
+
/* @__PURE__ */ K(C, {
|
|
698
|
+
placeholder: "Search...",
|
|
699
|
+
value: ye,
|
|
700
|
+
onChange: (e) => Ge(e.target.value),
|
|
701
|
+
className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
|
|
702
|
+
"data-testid": "record-picker-search"
|
|
703
|
+
}),
|
|
704
|
+
_e && /* @__PURE__ */ K(xe, {
|
|
705
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
706
|
+
"data-testid": "record-picker-loading-indicator"
|
|
707
|
+
})
|
|
708
|
+
]
|
|
709
|
+
}),
|
|
710
|
+
Z && Z.length > 0 && /* @__PURE__ */ K("div", {
|
|
711
|
+
className: "py-2",
|
|
712
|
+
children: se ? /* @__PURE__ */ K("div", {
|
|
713
|
+
"data-testid": "record-picker-filter-bar",
|
|
714
|
+
children: se({
|
|
715
|
+
filterColumns: Z,
|
|
716
|
+
values: X,
|
|
717
|
+
onChange: it,
|
|
718
|
+
onClear: at,
|
|
719
|
+
activeCount: ot
|
|
720
|
+
})
|
|
721
|
+
}) : /* @__PURE__ */ q(Ae, { children: [/* @__PURE__ */ q("div", {
|
|
722
|
+
className: "flex items-center gap-2",
|
|
723
|
+
"data-testid": "record-picker-filter-bar",
|
|
724
|
+
children: [/* @__PURE__ */ q(h, {
|
|
725
|
+
type: "button",
|
|
726
|
+
variant: ot > 0 ? "secondary" : "outline",
|
|
727
|
+
size: "sm",
|
|
728
|
+
className: "gap-1.5 shrink-0",
|
|
729
|
+
onClick: () => Y((e) => !e),
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ K(Te, { className: "size-3.5" }),
|
|
732
|
+
"Filters",
|
|
733
|
+
ot > 0 && /* @__PURE__ */ K("span", {
|
|
734
|
+
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",
|
|
735
|
+
children: ot
|
|
736
|
+
})
|
|
737
|
+
]
|
|
738
|
+
}), ot > 0 && /* @__PURE__ */ q(h, {
|
|
739
|
+
type: "button",
|
|
740
|
+
variant: "ghost",
|
|
741
|
+
size: "sm",
|
|
742
|
+
className: "gap-1 text-xs",
|
|
743
|
+
onClick: at,
|
|
744
|
+
children: [/* @__PURE__ */ K(ke, { className: "size-3" }), "Clear"]
|
|
745
|
+
})]
|
|
746
|
+
}), Ne && /* @__PURE__ */ K("div", {
|
|
747
|
+
className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
|
|
748
|
+
"data-testid": "record-picker-filter-panel",
|
|
749
|
+
children: Z.map((e) => /* @__PURE__ */ K("div", { children: st(e) }, e.field))
|
|
750
|
+
})] })
|
|
751
|
+
}),
|
|
752
|
+
R && /* @__PURE__ */ q("div", {
|
|
753
|
+
className: "flex flex-col items-center gap-2 py-4",
|
|
754
|
+
role: "alert",
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ K(de, { className: "size-5 text-destructive" }),
|
|
757
|
+
/* @__PURE__ */ K("p", {
|
|
758
|
+
className: "text-sm text-destructive",
|
|
759
|
+
children: R
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ K(h, {
|
|
762
|
+
variant: "outline",
|
|
763
|
+
size: "sm",
|
|
764
|
+
onClick: () => Ue(ye || void 0, V, We),
|
|
765
|
+
type: "button",
|
|
766
|
+
children: "Retry"
|
|
767
|
+
})
|
|
768
|
+
]
|
|
769
|
+
}),
|
|
770
|
+
M ? /* @__PURE__ */ K("div", {
|
|
771
|
+
className: "flex-1 min-h-0",
|
|
772
|
+
"data-testid": "record-picker-grid-slot",
|
|
773
|
+
children: M({
|
|
774
|
+
columns: Be,
|
|
775
|
+
records: P,
|
|
776
|
+
loading: _e,
|
|
777
|
+
totalCount: B,
|
|
778
|
+
currentPage: V,
|
|
779
|
+
pageSize: m,
|
|
780
|
+
sortField: Se,
|
|
781
|
+
sortDirection: W,
|
|
782
|
+
onSort: Ke,
|
|
783
|
+
onPageChange: H,
|
|
784
|
+
onRowClick: Ye,
|
|
785
|
+
isSelected: Je,
|
|
786
|
+
multiple: i,
|
|
787
|
+
idField: p,
|
|
788
|
+
cellRenderer: ne
|
|
789
|
+
})
|
|
790
|
+
}) : /* @__PURE__ */ q(Ae, { children: [
|
|
791
|
+
_e && P.length === 0 && !R && /* @__PURE__ */ K("div", {
|
|
792
|
+
className: "flex-1 overflow-hidden min-h-0 border rounded-md",
|
|
793
|
+
role: "status",
|
|
794
|
+
"aria-live": "polite",
|
|
795
|
+
"data-testid": "record-picker-skeleton",
|
|
796
|
+
children: /* @__PURE__ */ q(ce, { children: [/* @__PURE__ */ K(A, { children: /* @__PURE__ */ q(j, {
|
|
797
|
+
className: "bg-muted/40",
|
|
798
|
+
children: [i && /* @__PURE__ */ K(ue, { className: "w-10" }), Be.map((e) => /* @__PURE__ */ K(ue, { children: /* @__PURE__ */ K(D, { className: "h-4 w-20" }) }, e.field))]
|
|
799
|
+
}) }), /* @__PURE__ */ K(le, { children: Array.from({ length: Ct }, (e, t) => /* @__PURE__ */ q(j, { children: [i && /* @__PURE__ */ K(k, {
|
|
800
|
+
className: "w-10",
|
|
801
|
+
children: /* @__PURE__ */ K(D, { className: "size-4 rounded" })
|
|
802
|
+
}), Be.map((e) => /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K(D, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
803
|
+
}),
|
|
804
|
+
!_e && !R && P.length === 0 && /* @__PURE__ */ K("div", {
|
|
805
|
+
className: "py-8 text-center",
|
|
806
|
+
children: /* @__PURE__ */ K("p", {
|
|
807
|
+
className: "text-sm text-muted-foreground",
|
|
808
|
+
children: "No records found"
|
|
809
|
+
})
|
|
810
|
+
}),
|
|
811
|
+
!R && P.length > 0 && /* @__PURE__ */ q("div", {
|
|
812
|
+
className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
|
|
813
|
+
tabIndex: 0,
|
|
814
|
+
onKeyDown: et,
|
|
815
|
+
role: "grid",
|
|
816
|
+
"aria-label": "Records",
|
|
817
|
+
children: [_e && /* @__PURE__ */ K("div", {
|
|
818
|
+
className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
|
|
819
|
+
"data-testid": "record-picker-loading-overlay",
|
|
820
|
+
children: /* @__PURE__ */ K(xe, { className: "size-6 animate-spin text-muted-foreground" })
|
|
821
|
+
}), /* @__PURE__ */ q(ce, {
|
|
822
|
+
style: Object.keys(Fe).length > 0 ? { tableLayout: "fixed" } : void 0,
|
|
823
|
+
children: [/* @__PURE__ */ K(A, {
|
|
824
|
+
className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
|
|
825
|
+
"data-testid": "record-picker-sticky-header",
|
|
826
|
+
children: /* @__PURE__ */ q(j, { children: [i && /* @__PURE__ */ K(ue, { className: "w-10" }), Be.map((e) => {
|
|
827
|
+
let t = Fe[e.field];
|
|
828
|
+
return /* @__PURE__ */ q(ue, {
|
|
829
|
+
style: t ? {
|
|
830
|
+
width: `${t}px`,
|
|
831
|
+
minWidth: `${t}px`
|
|
832
|
+
} : e.width ? { width: e.width } : void 0,
|
|
833
|
+
className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
|
|
834
|
+
onClick: () => Ke(e.field),
|
|
835
|
+
"aria-sort": Se === e.field ? W === "asc" ? "ascending" : "descending" : "none",
|
|
836
|
+
children: [/* @__PURE__ */ q("span", {
|
|
837
|
+
className: "inline-flex items-center",
|
|
838
|
+
children: [e.label || _t(e.field), nt(e.field)]
|
|
839
|
+
}), /* @__PURE__ */ K("span", {
|
|
840
|
+
role: "separator",
|
|
841
|
+
"aria-orientation": "vertical",
|
|
842
|
+
className: "absolute right-0 top-0 bottom-0 w-1 cursor-col-resize opacity-0 group-hover:opacity-100 bg-border hover:bg-primary/50 transition-opacity",
|
|
843
|
+
onMouseDown: (t) => {
|
|
844
|
+
let n = t.currentTarget.parentElement?.getBoundingClientRect();
|
|
845
|
+
rt(t, e.field, n?.width ?? 100);
|
|
846
|
+
},
|
|
847
|
+
onClick: (e) => e.stopPropagation(),
|
|
848
|
+
"data-testid": `resize-handle-${e.field}`
|
|
849
|
+
})]
|
|
850
|
+
}, e.field);
|
|
851
|
+
})] })
|
|
852
|
+
}), /* @__PURE__ */ K(le, {
|
|
853
|
+
ref: Me,
|
|
854
|
+
children: P.map((e, t) => {
|
|
855
|
+
let n = qe(e), r = Je(e), a = t === J;
|
|
856
|
+
return /* @__PURE__ */ q(j, {
|
|
857
|
+
"data-row-index": t,
|
|
858
|
+
className: N("cursor-pointer transition-colors", ct(r, t), a && "ring-2 ring-primary ring-inset"),
|
|
859
|
+
onClick: () => Ye(e),
|
|
860
|
+
"data-testid": `record-row-${n}`,
|
|
861
|
+
"aria-selected": r,
|
|
862
|
+
children: [i && /* @__PURE__ */ K(k, {
|
|
863
|
+
className: "w-10",
|
|
864
|
+
children: r && /* @__PURE__ */ K(F, { className: "size-4 text-primary" })
|
|
865
|
+
}), Be.map((t) => /* @__PURE__ */ K(k, {
|
|
866
|
+
className: "py-2.5",
|
|
867
|
+
children: tt(e, t)
|
|
868
|
+
}, t.field))]
|
|
869
|
+
}, n ?? t);
|
|
870
|
+
})
|
|
871
|
+
})]
|
|
872
|
+
})]
|
|
873
|
+
}),
|
|
874
|
+
!R && B > 0 && /* @__PURE__ */ q("div", {
|
|
875
|
+
className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
|
|
876
|
+
"data-testid": "record-picker-pagination",
|
|
877
|
+
children: [/* @__PURE__ */ q("span", { children: [
|
|
878
|
+
B,
|
|
879
|
+
" ",
|
|
880
|
+
B === 1 ? "record" : "records",
|
|
881
|
+
He > 1 && ` · Page ${V} of ${He}`
|
|
882
|
+
] }), He > 1 && /* @__PURE__ */ q("div", {
|
|
883
|
+
className: "flex items-center gap-1.5",
|
|
884
|
+
children: [
|
|
885
|
+
/* @__PURE__ */ K(h, {
|
|
886
|
+
variant: "outline",
|
|
887
|
+
size: "icon",
|
|
888
|
+
className: "size-7",
|
|
889
|
+
onClick: Ze,
|
|
890
|
+
disabled: V <= 1,
|
|
891
|
+
type: "button",
|
|
892
|
+
"aria-label": "Previous page",
|
|
893
|
+
children: /* @__PURE__ */ K(he, { className: "size-4" })
|
|
894
|
+
}),
|
|
895
|
+
/* @__PURE__ */ K(C, {
|
|
896
|
+
className: "h-7 w-12 text-center text-xs px-1",
|
|
897
|
+
placeholder: String(V),
|
|
898
|
+
value: Re,
|
|
899
|
+
onChange: (e) => ze(e.target.value),
|
|
900
|
+
onKeyDown: $e,
|
|
901
|
+
"aria-label": "Jump to page",
|
|
902
|
+
"data-testid": "record-picker-page-jump"
|
|
903
|
+
}),
|
|
904
|
+
/* @__PURE__ */ K(h, {
|
|
905
|
+
variant: "outline",
|
|
906
|
+
size: "icon",
|
|
907
|
+
className: "size-7",
|
|
908
|
+
onClick: Qe,
|
|
909
|
+
disabled: V >= He,
|
|
910
|
+
type: "button",
|
|
911
|
+
"aria-label": "Next page",
|
|
912
|
+
children: /* @__PURE__ */ K(ge, { className: "size-4" })
|
|
913
|
+
})
|
|
914
|
+
]
|
|
915
|
+
})]
|
|
916
|
+
})
|
|
917
|
+
] }),
|
|
918
|
+
i && /* @__PURE__ */ K(b, { children: /* @__PURE__ */ q("div", {
|
|
919
|
+
className: "flex items-center gap-2 w-full justify-between",
|
|
920
|
+
children: [/* @__PURE__ */ q("span", {
|
|
921
|
+
className: "text-sm text-muted-foreground",
|
|
922
|
+
children: [Ee.size, " selected"]
|
|
923
|
+
}), /* @__PURE__ */ q("div", {
|
|
924
|
+
className: "flex gap-2",
|
|
925
|
+
children: [/* @__PURE__ */ K(h, {
|
|
926
|
+
variant: "outline",
|
|
927
|
+
type: "button",
|
|
928
|
+
onClick: () => t(!1),
|
|
929
|
+
children: "Cancel"
|
|
930
|
+
}), /* @__PURE__ */ K(h, {
|
|
931
|
+
type: "button",
|
|
932
|
+
onClick: Xe,
|
|
933
|
+
children: "Confirm"
|
|
934
|
+
})]
|
|
935
|
+
})]
|
|
936
|
+
}) })
|
|
937
|
+
]
|
|
938
|
+
})
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
var xt, St, Ct, wt = Y((() => {
|
|
942
|
+
xt = 10, St = 60, Ct = 5;
|
|
943
|
+
}));
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/widgets/_cell-renderer-bridge.ts
|
|
946
|
+
function Tt(e) {
|
|
947
|
+
Dt = e;
|
|
948
|
+
}
|
|
949
|
+
function Et() {
|
|
950
|
+
return Dt;
|
|
951
|
+
}
|
|
952
|
+
var Dt, Ot = Y((() => {})), kt = /* @__PURE__ */ X({ LookupField: () => Mt });
|
|
953
|
+
function At(e, t, n, r) {
|
|
954
|
+
let i = e[n] ?? e.id ?? e._id, a = e[t] ?? e.label ?? e.name ?? String(i), o = r ? e[r] : void 0;
|
|
955
|
+
return {
|
|
956
|
+
value: i,
|
|
957
|
+
label: String(a),
|
|
958
|
+
description: o,
|
|
959
|
+
...e
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
function jt(e) {
|
|
963
|
+
return {
|
|
964
|
+
text: "text",
|
|
965
|
+
number: "number",
|
|
966
|
+
currency: "number",
|
|
967
|
+
percent: "number",
|
|
968
|
+
select: "select",
|
|
969
|
+
status: "select",
|
|
970
|
+
date: "date",
|
|
971
|
+
datetime: "date",
|
|
972
|
+
boolean: "boolean"
|
|
973
|
+
}[e];
|
|
974
|
+
}
|
|
975
|
+
function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
|
|
976
|
+
let [d, f] = l(!1), [p, g] = l(""), { t: _ } = Ue(), [v, y] = l([]), [b, ee] = l(!1), [x, w] = l(null), [E, re] = l(0), ie = c(null), [ae, oe] = l([]), [D, O] = l(-1), se = c(null), ce = n || u.schema, le = ce?.field, k = le && typeof le == "object" && ("reference_to" in le || "reference" in le || "type" in le) ? le : ce, ue = k?.options || [], A = k?.multiple || !1, j = k?.display_field || k?.reference_field || "name", M = k?.description_field, N = k?.id_field || "id", fe = k?.reference_to || k?.reference, pe = k?.lookup_columns, me = k?.lookup_page_size, P = k?.lookup_filters, F = s(() => {
|
|
977
|
+
let e = k?.depends_on ?? k?.dependsOn;
|
|
978
|
+
return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
|
|
979
|
+
field: e,
|
|
980
|
+
param: e
|
|
981
|
+
} : {
|
|
982
|
+
field: e.field,
|
|
983
|
+
param: e.param ?? e.field
|
|
984
|
+
}) : [];
|
|
985
|
+
}, [k?.depends_on, k?.dependsOn]), he = u.dependentValues, ge = s(() => {
|
|
986
|
+
if (!pe) return;
|
|
987
|
+
let e = [];
|
|
988
|
+
for (let t of pe) if (typeof t == "object" && t.type) {
|
|
989
|
+
let n = jt(t.type);
|
|
990
|
+
n && e.push({
|
|
991
|
+
field: t.field,
|
|
992
|
+
label: t.label,
|
|
993
|
+
type: n
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
return e.length > 0 ? e : void 0;
|
|
997
|
+
}, [pe]), I = i(Pt), _e = I?.dataSource ?? null, L = u.dataSource ?? ce?.dataSource ?? k?.dataSource ?? _e, R = s(() => he || (I?.formValues ?? I?.data ?? {}), [
|
|
998
|
+
he,
|
|
999
|
+
I?.formValues,
|
|
1000
|
+
I?.data
|
|
1001
|
+
]), z = s(() => F.length === 0 ? !1 : F.some(({ field: e }) => {
|
|
1002
|
+
let t = R[e];
|
|
1003
|
+
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
1004
|
+
}), [F, R]), B = L != null && typeof L.find == "function" && !!fe, ve = u.onCreateNew ?? ce?.onCreateNew, [ye, be] = l(!1), V = B ? v : ue, H = s(() => {
|
|
1005
|
+
if (B || !p) return V;
|
|
1006
|
+
let e = p.toLowerCase();
|
|
1007
|
+
return V.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
|
|
1008
|
+
}, [
|
|
1009
|
+
B,
|
|
1010
|
+
V,
|
|
1011
|
+
p
|
|
1012
|
+
]);
|
|
1013
|
+
a(() => {
|
|
1014
|
+
O(-1);
|
|
1015
|
+
}, [H.length]);
|
|
1016
|
+
let U = r(async (e) => {
|
|
1017
|
+
if (!(!L || !fe)) {
|
|
1018
|
+
if (z) {
|
|
1019
|
+
y([]), re(0);
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
ee(!0), w(null);
|
|
1023
|
+
try {
|
|
1024
|
+
let t = { $top: Nt };
|
|
1025
|
+
if (e && e.trim() && (t.$search = e.trim()), F.length > 0) {
|
|
1026
|
+
let e = {};
|
|
1027
|
+
for (let { field: t, param: n } of F) {
|
|
1028
|
+
let r = R[t];
|
|
1029
|
+
r == null || r === "" || (e[n] = typeof r == "number" ? r : String(r));
|
|
1030
|
+
}
|
|
1031
|
+
Object.keys(e).length > 0 && (t.$filter = e);
|
|
1032
|
+
}
|
|
1033
|
+
let n = await L.find(fe, t), r = n?.data ?? n ?? [];
|
|
1034
|
+
y(r.map((e) => At(e, j, N, M))), re(n?.total ?? r.length);
|
|
1035
|
+
} catch (e) {
|
|
1036
|
+
w(e instanceof Error ? e.message : String(e)), y([]);
|
|
1037
|
+
} finally {
|
|
1038
|
+
ee(!1);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}, [
|
|
1042
|
+
L,
|
|
1043
|
+
fe,
|
|
1044
|
+
j,
|
|
1045
|
+
N,
|
|
1046
|
+
M,
|
|
1047
|
+
z,
|
|
1048
|
+
F,
|
|
1049
|
+
R
|
|
1050
|
+
]);
|
|
1051
|
+
a(() => {
|
|
1052
|
+
d && B && F.length > 0 && U(p || void 0);
|
|
1053
|
+
}, [s(() => F.map((e) => `${e.param}=${R[e.field] ?? ""}`).join("|"), [F, R])]), a(() => {
|
|
1054
|
+
d && B && U(p || void 0), d || (g(""), w(null), O(-1));
|
|
1055
|
+
}, [d]);
|
|
1056
|
+
let Se = r((e) => {
|
|
1057
|
+
g(e), B && (ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
|
|
1058
|
+
U(e || void 0);
|
|
1059
|
+
}, 300));
|
|
1060
|
+
}, [B, U]);
|
|
1061
|
+
a(() => () => {
|
|
1062
|
+
ie.current && clearTimeout(ie.current);
|
|
1063
|
+
}, []);
|
|
1064
|
+
let W = r((e) => ue.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? ae.find((t) => t.value === e), [
|
|
1065
|
+
ue,
|
|
1066
|
+
v,
|
|
1067
|
+
ae
|
|
1068
|
+
]), G = A ? (Array.isArray(e) ? e : []).map(W).filter(Boolean) : e ? [W(e)].filter(Boolean) : [], Te = r((n) => {
|
|
1069
|
+
if (A) {
|
|
1070
|
+
let r = Array.isArray(e) ? e : [];
|
|
1071
|
+
r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
|
|
1072
|
+
} else t(n.value), f(!1);
|
|
1073
|
+
}, [
|
|
1074
|
+
A,
|
|
1075
|
+
e,
|
|
1076
|
+
t
|
|
1077
|
+
]), Ee = (n) => {
|
|
1078
|
+
t(A ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
|
|
1079
|
+
}, Oe = r((e) => {
|
|
1080
|
+
oe(e.map((e) => At(e, j, N, M)));
|
|
1081
|
+
}, [
|
|
1082
|
+
j,
|
|
1083
|
+
N,
|
|
1084
|
+
M
|
|
1085
|
+
]), J = r((e) => {
|
|
1086
|
+
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e < H.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), O((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), D >= 0 && D < H.length && Te(H[D]));
|
|
1087
|
+
}, [
|
|
1088
|
+
H,
|
|
1089
|
+
D,
|
|
1090
|
+
Te
|
|
1091
|
+
]);
|
|
1092
|
+
return a(() => {
|
|
1093
|
+
D >= 0 && se.current && se.current.querySelector(`[data-lookup-index="${D}"]`)?.scrollIntoView({ block: "nearest" });
|
|
1094
|
+
}, [D]), o ? G.length ? A ? /* @__PURE__ */ K("div", {
|
|
1095
|
+
className: "flex flex-wrap gap-1",
|
|
1096
|
+
children: G.map((e, t) => /* @__PURE__ */ K(m, {
|
|
1097
|
+
variant: "outline",
|
|
1098
|
+
children: e?.[j] || e?.label
|
|
1099
|
+
}, t))
|
|
1100
|
+
}) : /* @__PURE__ */ K("span", {
|
|
1101
|
+
className: "text-sm",
|
|
1102
|
+
children: G[0]?.[j] || G[0]?.label
|
|
1103
|
+
}) : /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ q("div", {
|
|
1104
|
+
className: "space-y-2",
|
|
1105
|
+
children: [
|
|
1106
|
+
G.length > 0 && /* @__PURE__ */ K("div", {
|
|
1107
|
+
className: "flex flex-wrap gap-1",
|
|
1108
|
+
children: G.map((e, t) => /* @__PURE__ */ q(m, {
|
|
1109
|
+
variant: "outline",
|
|
1110
|
+
className: "gap-1",
|
|
1111
|
+
children: [e?.[j] || e?.label, /* @__PURE__ */ K("button", {
|
|
1112
|
+
onClick: () => Ee(e?.value),
|
|
1113
|
+
className: "ml-1 hover:text-destructive",
|
|
1114
|
+
type: "button",
|
|
1115
|
+
"aria-label": `Remove ${e?.[j] || e?.label}`,
|
|
1116
|
+
children: /* @__PURE__ */ K(ke, { className: "size-3" })
|
|
1117
|
+
})]
|
|
1118
|
+
}, t))
|
|
1119
|
+
}),
|
|
1120
|
+
/* @__PURE__ */ q("div", {
|
|
1121
|
+
className: "flex items-center gap-1.5",
|
|
1122
|
+
children: [/* @__PURE__ */ q(te, {
|
|
1123
|
+
open: d,
|
|
1124
|
+
onOpenChange: (e) => !z && f(e),
|
|
1125
|
+
children: [/* @__PURE__ */ K(ne, {
|
|
1126
|
+
asChild: !0,
|
|
1127
|
+
children: /* @__PURE__ */ q(h, {
|
|
1128
|
+
variant: "outline",
|
|
1129
|
+
className: "min-w-0 flex-1 justify-start text-left font-normal",
|
|
1130
|
+
type: "button",
|
|
1131
|
+
disabled: z || u.disabled,
|
|
1132
|
+
"data-testid": z ? "lookup-trigger-gated" : void 0,
|
|
1133
|
+
title: z ? `Select ${F.map((e) => e.field).join(", ")} first` : void 0,
|
|
1134
|
+
children: [/* @__PURE__ */ K(we, { className: "mr-2 size-4" }), z ? `Select ${F.map((e) => e.field).join(", ")} first` : G.length === 0 ? ce?.placeholder || _("common.select") : A ? _("table.selected", { count: G.length }) : _("common.select")]
|
|
1135
|
+
})
|
|
1136
|
+
}), /* @__PURE__ */ q(T, {
|
|
1137
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
1138
|
+
align: "start",
|
|
1139
|
+
children: [
|
|
1140
|
+
/* @__PURE__ */ K("div", {
|
|
1141
|
+
className: "p-2",
|
|
1142
|
+
children: /* @__PURE__ */ q("div", {
|
|
1143
|
+
className: "relative",
|
|
1144
|
+
children: [
|
|
1145
|
+
/* @__PURE__ */ K(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
1146
|
+
/* @__PURE__ */ K(C, {
|
|
1147
|
+
placeholder: _("common.search") + "...",
|
|
1148
|
+
value: p,
|
|
1149
|
+
onChange: (e) => Se(e.target.value),
|
|
1150
|
+
onKeyDown: J,
|
|
1151
|
+
className: "w-full pl-9 h-8 text-sm"
|
|
1152
|
+
}),
|
|
1153
|
+
b && /* @__PURE__ */ K(xe, {
|
|
1154
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
1155
|
+
"data-testid": "lookup-loading"
|
|
1156
|
+
})
|
|
1157
|
+
]
|
|
1158
|
+
})
|
|
1159
|
+
}),
|
|
1160
|
+
x && /* @__PURE__ */ q("div", {
|
|
1161
|
+
className: "flex flex-col items-center gap-2 py-4 px-2",
|
|
1162
|
+
role: "alert",
|
|
1163
|
+
children: [
|
|
1164
|
+
/* @__PURE__ */ K(de, { className: "size-5 text-destructive" }),
|
|
1165
|
+
/* @__PURE__ */ K("p", {
|
|
1166
|
+
className: "text-sm text-destructive",
|
|
1167
|
+
children: x
|
|
1168
|
+
}),
|
|
1169
|
+
/* @__PURE__ */ K(h, {
|
|
1170
|
+
variant: "outline",
|
|
1171
|
+
size: "sm",
|
|
1172
|
+
onClick: () => U(p || void 0),
|
|
1173
|
+
type: "button",
|
|
1174
|
+
children: "Retry"
|
|
1175
|
+
})
|
|
1176
|
+
]
|
|
1177
|
+
}),
|
|
1178
|
+
b && H.length === 0 && !x && /* @__PURE__ */ q("div", {
|
|
1179
|
+
className: "flex flex-col items-center gap-2 py-6",
|
|
1180
|
+
role: "status",
|
|
1181
|
+
"aria-live": "polite",
|
|
1182
|
+
children: [/* @__PURE__ */ K(xe, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ K("p", {
|
|
1183
|
+
className: "text-sm text-muted-foreground",
|
|
1184
|
+
children: "Loading…"
|
|
1185
|
+
})]
|
|
1186
|
+
}),
|
|
1187
|
+
!x && !(b && H.length === 0) && /* @__PURE__ */ K("div", {
|
|
1188
|
+
ref: se,
|
|
1189
|
+
className: "max-h-64 overflow-y-auto px-1 pb-1",
|
|
1190
|
+
role: "listbox",
|
|
1191
|
+
children: H.length === 0 ? /* @__PURE__ */ q("div", {
|
|
1192
|
+
className: "py-4 text-center",
|
|
1193
|
+
children: [/* @__PURE__ */ K("p", {
|
|
1194
|
+
className: "text-sm text-muted-foreground",
|
|
1195
|
+
children: "No options found"
|
|
1196
|
+
}), ve && /* @__PURE__ */ q(h, {
|
|
1197
|
+
variant: "ghost",
|
|
1198
|
+
size: "sm",
|
|
1199
|
+
className: "mt-2 gap-1",
|
|
1200
|
+
type: "button",
|
|
1201
|
+
onClick: () => {
|
|
1202
|
+
ve(p), f(!1);
|
|
1203
|
+
},
|
|
1204
|
+
children: [/* @__PURE__ */ K(Ce, { className: "size-4" }), "Create new"]
|
|
1205
|
+
})]
|
|
1206
|
+
}) : /* @__PURE__ */ q(Ae, { children: [
|
|
1207
|
+
H.map((t, n) => {
|
|
1208
|
+
let r = A ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
|
|
1209
|
+
return /* @__PURE__ */ q("button", {
|
|
1210
|
+
"data-lookup-index": n,
|
|
1211
|
+
role: "option",
|
|
1212
|
+
"aria-selected": r,
|
|
1213
|
+
onClick: () => Te(t),
|
|
1214
|
+
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === D ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
1215
|
+
type: "button",
|
|
1216
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1217
|
+
className: "min-w-0 flex-1",
|
|
1218
|
+
children: [/* @__PURE__ */ K("span", {
|
|
1219
|
+
className: "block truncate",
|
|
1220
|
+
children: t.label
|
|
1221
|
+
}), t.description && /* @__PURE__ */ K("span", {
|
|
1222
|
+
className: "block truncate text-xs text-muted-foreground",
|
|
1223
|
+
children: t.description
|
|
1224
|
+
})]
|
|
1225
|
+
}), r && /* @__PURE__ */ K(m, {
|
|
1226
|
+
variant: "default",
|
|
1227
|
+
className: "ml-2 shrink-0",
|
|
1228
|
+
children: "Selected"
|
|
1229
|
+
})]
|
|
1230
|
+
}, t.value);
|
|
1231
|
+
}),
|
|
1232
|
+
B && E > H.length && /* @__PURE__ */ q("p", {
|
|
1233
|
+
className: "text-xs text-muted-foreground text-center py-2",
|
|
1234
|
+
children: [
|
|
1235
|
+
"Showing ",
|
|
1236
|
+
H.length,
|
|
1237
|
+
" of ",
|
|
1238
|
+
E,
|
|
1239
|
+
" results."
|
|
1240
|
+
]
|
|
1241
|
+
}),
|
|
1242
|
+
B && E > H.length && /* @__PURE__ */ q("button", {
|
|
1243
|
+
type: "button",
|
|
1244
|
+
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",
|
|
1245
|
+
onClick: () => {
|
|
1246
|
+
f(!1), be(!0);
|
|
1247
|
+
},
|
|
1248
|
+
"data-testid": "show-all-results",
|
|
1249
|
+
children: [
|
|
1250
|
+
/* @__PURE__ */ K(De, { className: "size-3.5" }),
|
|
1251
|
+
"Show All Results (",
|
|
1252
|
+
E,
|
|
1253
|
+
")"
|
|
1254
|
+
]
|
|
1255
|
+
}),
|
|
1256
|
+
ve && /* @__PURE__ */ q("button", {
|
|
1257
|
+
type: "button",
|
|
1258
|
+
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",
|
|
1259
|
+
onClick: () => {
|
|
1260
|
+
ve(p), f(!1);
|
|
1261
|
+
},
|
|
1262
|
+
children: [
|
|
1263
|
+
/* @__PURE__ */ K(Ce, { className: "size-3.5" }),
|
|
1264
|
+
"Create new",
|
|
1265
|
+
p ? ` "${p}"` : ""
|
|
1266
|
+
]
|
|
1267
|
+
})
|
|
1268
|
+
] })
|
|
1269
|
+
})
|
|
1270
|
+
]
|
|
1271
|
+
})]
|
|
1272
|
+
}), B && /* @__PURE__ */ K(h, {
|
|
1273
|
+
variant: "outline",
|
|
1274
|
+
size: "icon",
|
|
1275
|
+
className: "shrink-0",
|
|
1276
|
+
type: "button",
|
|
1277
|
+
onClick: () => be(!0),
|
|
1278
|
+
"aria-label": "Browse all records",
|
|
1279
|
+
title: "Browse all records",
|
|
1280
|
+
"data-testid": "browse-all-records",
|
|
1281
|
+
children: /* @__PURE__ */ K(De, { className: "size-4" })
|
|
1282
|
+
})]
|
|
1283
|
+
}),
|
|
1284
|
+
B && L && fe && /* @__PURE__ */ K(bt, {
|
|
1285
|
+
open: ye,
|
|
1286
|
+
onOpenChange: be,
|
|
1287
|
+
title: ce?.label || "Select",
|
|
1288
|
+
multiple: A,
|
|
1289
|
+
dataSource: L,
|
|
1290
|
+
objectName: fe,
|
|
1291
|
+
columns: pe,
|
|
1292
|
+
displayField: j,
|
|
1293
|
+
idField: N,
|
|
1294
|
+
pageSize: me,
|
|
1295
|
+
value: e,
|
|
1296
|
+
onSelect: t,
|
|
1297
|
+
onSelectRecords: Oe,
|
|
1298
|
+
lookupFilters: P,
|
|
1299
|
+
cellRenderer: Et(),
|
|
1300
|
+
filterColumns: ge
|
|
1301
|
+
})
|
|
1302
|
+
]
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
var Nt, Pt, Ft = Y((() => {
|
|
1306
|
+
wt(), Ot(), We(), Nt = 50, Pt = je;
|
|
1307
|
+
})), It = /* @__PURE__ */ X({ DateTimeField: () => Lt });
|
|
1308
|
+
function Lt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
385
1309
|
if (r) {
|
|
386
|
-
if (!e) return /* @__PURE__ */
|
|
1310
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
387
1311
|
let t = new Date(e);
|
|
388
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ q("span", {
|
|
389
1313
|
className: "text-sm",
|
|
390
1314
|
children: [
|
|
391
1315
|
t.toLocaleDateString(),
|
|
@@ -395,7 +1319,7 @@ function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
395
1319
|
});
|
|
396
1320
|
}
|
|
397
1321
|
let { inputType: a, ...o } = i;
|
|
398
|
-
return /* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ K(C, {
|
|
399
1323
|
...o,
|
|
400
1324
|
type: "datetime-local",
|
|
401
1325
|
value: e || "",
|
|
@@ -403,16 +1327,14 @@ function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
403
1327
|
disabled: r || o.disabled
|
|
404
1328
|
});
|
|
405
1329
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
function Ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
410
|
-
if (r) return /* @__PURE__ */ F("span", {
|
|
1330
|
+
var Rt = Y((() => {})), zt = /* @__PURE__ */ X({ TimeField: () => Bt });
|
|
1331
|
+
function Bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1332
|
+
if (r) return /* @__PURE__ */ K("span", {
|
|
411
1333
|
className: "text-sm",
|
|
412
|
-
children: e || /* @__PURE__ */
|
|
1334
|
+
children: e || /* @__PURE__ */ K(S, {})
|
|
413
1335
|
});
|
|
414
1336
|
let { inputType: a, ...o } = i;
|
|
415
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ K(C, {
|
|
416
1338
|
...o,
|
|
417
1339
|
type: "time",
|
|
418
1340
|
value: e || "",
|
|
@@ -420,12 +1342,10 @@ function Ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
420
1342
|
disabled: r || o.disabled
|
|
421
1343
|
});
|
|
422
1344
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
var Qe = /* @__PURE__ */ e({ PercentField: () => R });
|
|
426
|
-
function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
1345
|
+
var Vt = Y((() => {})), Ht = /* @__PURE__ */ X({ PercentField: () => Ut });
|
|
1346
|
+
function Ut({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
427
1347
|
let s = n || o.schema, c = s?.precision ?? 2;
|
|
428
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
1348
|
+
if (r) return e == null ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ q("span", {
|
|
429
1349
|
className: "text-sm font-medium tabular-nums",
|
|
430
1350
|
children: [(e * 100).toFixed(c), "%"]
|
|
431
1351
|
});
|
|
@@ -445,11 +1365,11 @@ function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
445
1365
|
let n = e[0];
|
|
446
1366
|
t(typeof n == "number" ? n / 100 : null);
|
|
447
1367
|
}, p = 10 ** -c;
|
|
448
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ q("div", {
|
|
449
1369
|
className: "space-y-2",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
1370
|
+
children: [/* @__PURE__ */ q("div", {
|
|
451
1371
|
className: "relative",
|
|
452
|
-
children: [/* @__PURE__ */
|
|
1372
|
+
children: [/* @__PURE__ */ K(C, {
|
|
453
1373
|
...o,
|
|
454
1374
|
type: "number",
|
|
455
1375
|
value: l,
|
|
@@ -459,11 +1379,11 @@ function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
459
1379
|
className: `pr-8 ${a || ""}`,
|
|
460
1380
|
step: (10 ** -c).toFixed(c),
|
|
461
1381
|
"aria-invalid": !!i
|
|
462
|
-
}), /* @__PURE__ */
|
|
1382
|
+
}), /* @__PURE__ */ K("span", {
|
|
463
1383
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
464
1384
|
children: "%"
|
|
465
1385
|
})]
|
|
466
|
-
}), /* @__PURE__ */
|
|
1386
|
+
}), /* @__PURE__ */ K(O, {
|
|
467
1387
|
value: [u],
|
|
468
1388
|
onValueChange: f,
|
|
469
1389
|
min: 0,
|
|
@@ -476,56 +1396,52 @@ function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
476
1396
|
})]
|
|
477
1397
|
});
|
|
478
1398
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
let [o, s] = p(!1), c = n || a.schema;
|
|
484
|
-
if (r) return /* @__PURE__ */ F("span", {
|
|
1399
|
+
var Wt = Y((() => {})), Gt = /* @__PURE__ */ X({ PasswordField: () => Kt });
|
|
1400
|
+
function Kt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1401
|
+
let [o, s] = l(!1), c = n || a.schema;
|
|
1402
|
+
if (r) return /* @__PURE__ */ K("span", {
|
|
485
1403
|
className: "text-sm",
|
|
486
1404
|
children: "••••••••"
|
|
487
1405
|
});
|
|
488
|
-
let { inputType:
|
|
489
|
-
return /* @__PURE__ */
|
|
1406
|
+
let { inputType: u, ...d } = a;
|
|
1407
|
+
return /* @__PURE__ */ q("div", {
|
|
490
1408
|
className: "relative",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
492
|
-
...
|
|
1409
|
+
children: [/* @__PURE__ */ K(C, {
|
|
1410
|
+
...d,
|
|
493
1411
|
type: o ? "text" : "password",
|
|
494
1412
|
value: e || "",
|
|
495
1413
|
onChange: (e) => t(e.target.value),
|
|
496
1414
|
placeholder: c?.placeholder,
|
|
497
|
-
disabled: r ||
|
|
1415
|
+
disabled: r || d.disabled,
|
|
498
1416
|
className: `pr-10 ${i || ""}`
|
|
499
|
-
}), /* @__PURE__ */
|
|
1417
|
+
}), /* @__PURE__ */ K(h, {
|
|
500
1418
|
type: "button",
|
|
501
1419
|
variant: "ghost",
|
|
502
1420
|
size: "sm",
|
|
503
1421
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
504
1422
|
onClick: () => s(!o),
|
|
505
1423
|
tabIndex: -1,
|
|
506
|
-
children:
|
|
1424
|
+
children: K(o ? ve : B, { className: "size-4 text-gray-500" })
|
|
507
1425
|
})]
|
|
508
1426
|
});
|
|
509
1427
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
function B({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
514
|
-
let a = f(null), o = f(null), s = n || i.schema, c = s?.multiple || !1, u = s?.accept ? s.accept.join(",") : void 0, d = s?.maxSize, m = s?.capture ?? null, h = !u || u.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, b] = p(!1), [x, S] = p([]), { upload: C } = Te(), [w, ee] = p({}), [E, D] = p(!1), O = e ? Array.isArray(e) ? e : [e] : [], k = l(async (e) => {
|
|
1428
|
+
var qt = Y((() => {})), Jt = /* @__PURE__ */ X({ FileField: () => Yt });
|
|
1429
|
+
function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
|
|
1430
|
+
let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, g = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), _ = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), v = m === !1 ? !1 : m ?? (g && _ ? "environment" : null), [y, b] = l(!1), [ee, x] = l([]), { upload: C } = Me(), [w, te] = l({}), [T, ne] = l(!1), E = e ? Array.isArray(e) ? e : [e] : [], re = r(async (e) => {
|
|
515
1431
|
if (e.length === 0) return;
|
|
516
1432
|
let n = [], r = e.filter((e) => {
|
|
517
|
-
if (
|
|
518
|
-
let t = (
|
|
1433
|
+
if (p && e.size > p) {
|
|
1434
|
+
let t = (p / (1024 * 1024)).toFixed(1);
|
|
519
1435
|
return n.push(`"${e.name}" exceeds max size (${t} MB)`), !1;
|
|
520
1436
|
}
|
|
521
1437
|
return !0;
|
|
522
1438
|
});
|
|
523
|
-
if (
|
|
524
|
-
|
|
1439
|
+
if (x(n), r.length !== 0) {
|
|
1440
|
+
ne(!0);
|
|
525
1441
|
try {
|
|
526
1442
|
let e = (await Promise.all(r.map(async (e) => {
|
|
527
1443
|
try {
|
|
528
|
-
let t = await C(e, { onProgress: (t) =>
|
|
1444
|
+
let t = await C(e, { onProgress: (t) => te((n) => ({
|
|
529
1445
|
...n,
|
|
530
1446
|
[e.name]: t
|
|
531
1447
|
})) });
|
|
@@ -537,142 +1453,142 @@ function B({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
537
1453
|
url: t.url
|
|
538
1454
|
};
|
|
539
1455
|
} catch (t) {
|
|
540
|
-
return n.push(`Failed to upload "${e.name}": ${t.message}`),
|
|
1456
|
+
return n.push(`Failed to upload "${e.name}": ${t.message}`), x([...n]), null;
|
|
541
1457
|
}
|
|
542
1458
|
}))).filter(Boolean);
|
|
543
1459
|
if (e.length === 0) return;
|
|
544
|
-
t(
|
|
1460
|
+
t(d ? [...E, ...e] : e[0]);
|
|
545
1461
|
} finally {
|
|
546
|
-
|
|
1462
|
+
ne(!1), te({});
|
|
547
1463
|
}
|
|
548
1464
|
}
|
|
549
1465
|
}, [
|
|
550
|
-
|
|
551
|
-
c,
|
|
552
|
-
t,
|
|
1466
|
+
E,
|
|
553
1467
|
d,
|
|
1468
|
+
t,
|
|
1469
|
+
p,
|
|
554
1470
|
C
|
|
555
|
-
]),
|
|
1471
|
+
]), ie = r((e) => {
|
|
556
1472
|
e.preventDefault(), e.stopPropagation(), b(!0);
|
|
557
|
-
}, []),
|
|
1473
|
+
}, []), ae = r((e) => {
|
|
558
1474
|
e.preventDefault(), e.stopPropagation(), b(!1);
|
|
559
|
-
}, []),
|
|
1475
|
+
}, []), oe = r((e) => {
|
|
560
1476
|
e.preventDefault(), e.stopPropagation(), b(!1);
|
|
561
1477
|
let t = Array.from(e.dataTransfer.files);
|
|
562
|
-
if (
|
|
563
|
-
let e =
|
|
564
|
-
|
|
1478
|
+
if (f) {
|
|
1479
|
+
let e = f.split(",").map((e) => e.trim().toLowerCase());
|
|
1480
|
+
re(t.filter((t) => {
|
|
565
1481
|
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
566
1482
|
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
567
1483
|
}));
|
|
568
|
-
} else
|
|
569
|
-
}, [
|
|
570
|
-
if (
|
|
1484
|
+
} else re(t);
|
|
1485
|
+
}, [f, re]);
|
|
1486
|
+
if (i) return e ? /* @__PURE__ */ K("div", {
|
|
571
1487
|
className: "flex flex-wrap gap-2",
|
|
572
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
1488
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ K("span", {
|
|
573
1489
|
className: "text-sm truncate max-w-xs",
|
|
574
1490
|
children: e.name || e.original_name || "File"
|
|
575
1491
|
}, t))
|
|
576
|
-
}) : /* @__PURE__ */
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
},
|
|
580
|
-
if (
|
|
581
|
-
let n =
|
|
1492
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
1493
|
+
let D = (e) => {
|
|
1494
|
+
re(Array.from(e.target.files || []));
|
|
1495
|
+
}, O = (e) => {
|
|
1496
|
+
if (d) {
|
|
1497
|
+
let n = E.filter((t, n) => n !== e);
|
|
582
1498
|
t(n.length > 0 ? n : null);
|
|
583
1499
|
} else t(null);
|
|
584
|
-
},
|
|
585
|
-
return /* @__PURE__ */
|
|
586
|
-
className:
|
|
1500
|
+
}, se = (e) => (e.mime_type || "").startsWith("image/");
|
|
1501
|
+
return /* @__PURE__ */ q("div", {
|
|
1502
|
+
className: a.className,
|
|
587
1503
|
children: [
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
ref:
|
|
1504
|
+
/* @__PURE__ */ K("input", {
|
|
1505
|
+
ref: o,
|
|
590
1506
|
type: "file",
|
|
591
|
-
multiple:
|
|
592
|
-
accept:
|
|
593
|
-
onChange:
|
|
1507
|
+
multiple: d,
|
|
1508
|
+
accept: f,
|
|
1509
|
+
onChange: D,
|
|
594
1510
|
className: "hidden"
|
|
595
1511
|
}),
|
|
596
|
-
|
|
597
|
-
ref:
|
|
1512
|
+
v && /* @__PURE__ */ K("input", {
|
|
1513
|
+
ref: s,
|
|
598
1514
|
type: "file",
|
|
599
1515
|
accept: "image/*",
|
|
600
|
-
capture:
|
|
601
|
-
onChange:
|
|
1516
|
+
capture: v,
|
|
1517
|
+
onChange: D,
|
|
602
1518
|
className: "hidden",
|
|
603
1519
|
"aria-label": "Camera capture",
|
|
604
1520
|
"data-testid": "file-field-camera-input"
|
|
605
1521
|
}),
|
|
606
|
-
/* @__PURE__ */
|
|
1522
|
+
/* @__PURE__ */ q("div", {
|
|
607
1523
|
className: "space-y-2",
|
|
608
1524
|
children: [
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
onDragOver:
|
|
611
|
-
onDragLeave:
|
|
612
|
-
onDrop:
|
|
613
|
-
onClick: () =>
|
|
1525
|
+
/* @__PURE__ */ q("div", {
|
|
1526
|
+
onDragOver: ie,
|
|
1527
|
+
onDragLeave: ae,
|
|
1528
|
+
onDrop: oe,
|
|
1529
|
+
onClick: () => o.current?.click(),
|
|
614
1530
|
className: `
|
|
615
1531
|
flex flex-col items-center justify-center gap-2 p-6
|
|
616
1532
|
border-2 border-dashed rounded-lg cursor-pointer
|
|
617
1533
|
transition-colors duration-200
|
|
618
|
-
${
|
|
1534
|
+
${y ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
619
1535
|
`,
|
|
620
1536
|
role: "button",
|
|
621
1537
|
tabIndex: 0,
|
|
622
1538
|
onKeyDown: (e) => {
|
|
623
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1539
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
|
|
624
1540
|
},
|
|
625
|
-
children: [/* @__PURE__ */
|
|
1541
|
+
children: [/* @__PURE__ */ K(Oe, { className: `size-8 ${y ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ q("div", {
|
|
626
1542
|
className: "text-center",
|
|
627
|
-
children: [/* @__PURE__ */
|
|
1543
|
+
children: [/* @__PURE__ */ K("p", {
|
|
628
1544
|
className: "text-sm font-medium",
|
|
629
|
-
children:
|
|
630
|
-
}), /* @__PURE__ */
|
|
1545
|
+
children: y ? "Drop files here" : "Drag & drop files here"
|
|
1546
|
+
}), /* @__PURE__ */ q("p", {
|
|
631
1547
|
className: "text-xs text-muted-foreground mt-1",
|
|
632
|
-
children: ["or click to browse",
|
|
1548
|
+
children: ["or click to browse", v ? " • use the camera button below" : ""]
|
|
633
1549
|
})]
|
|
634
1550
|
})]
|
|
635
1551
|
}),
|
|
636
|
-
|
|
1552
|
+
v && /* @__PURE__ */ q(h, {
|
|
637
1553
|
type: "button",
|
|
638
1554
|
variant: "outline",
|
|
639
1555
|
size: "sm",
|
|
640
1556
|
className: "w-full",
|
|
641
1557
|
onClick: (e) => {
|
|
642
|
-
e.stopPropagation(),
|
|
1558
|
+
e.stopPropagation(), s.current?.click();
|
|
643
1559
|
},
|
|
644
1560
|
"data-testid": "file-field-camera-button",
|
|
645
|
-
children: [/* @__PURE__ */
|
|
1561
|
+
children: [/* @__PURE__ */ K(P, { className: "size-4 mr-2" }), v === "user" ? "Take selfie" : "Take photo"]
|
|
646
1562
|
}),
|
|
647
|
-
|
|
1563
|
+
T && /* @__PURE__ */ q("div", {
|
|
648
1564
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
649
1565
|
"data-testid": "file-field-uploading",
|
|
650
|
-
children: [/* @__PURE__ */
|
|
1566
|
+
children: [/* @__PURE__ */ K(xe, { className: "size-3 animate-spin" }), /* @__PURE__ */ q("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
|
|
651
1567
|
}),
|
|
652
|
-
|
|
1568
|
+
ee.length > 0 && /* @__PURE__ */ K("div", {
|
|
653
1569
|
className: "space-y-0.5",
|
|
654
|
-
children:
|
|
1570
|
+
children: ee.map((e, t) => /* @__PURE__ */ K("p", {
|
|
655
1571
|
className: "text-xs text-destructive",
|
|
656
1572
|
children: e
|
|
657
1573
|
}, t))
|
|
658
1574
|
}),
|
|
659
|
-
|
|
1575
|
+
E.length > 0 && /* @__PURE__ */ K("div", {
|
|
660
1576
|
className: "space-y-1",
|
|
661
|
-
children:
|
|
1577
|
+
children: E.map((e, t) => /* @__PURE__ */ q("div", {
|
|
662
1578
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
663
|
-
children: [/* @__PURE__ */
|
|
1579
|
+
children: [/* @__PURE__ */ q("div", {
|
|
664
1580
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
665
1581
|
children: [
|
|
666
|
-
|
|
1582
|
+
se(e) && e.url ? /* @__PURE__ */ K("img", {
|
|
667
1583
|
src: e.url,
|
|
668
1584
|
alt: e.name,
|
|
669
1585
|
className: "size-8 object-cover rounded flex-shrink-0"
|
|
670
|
-
}) :
|
|
671
|
-
/* @__PURE__ */
|
|
1586
|
+
}) : se(e) ? /* @__PURE__ */ K(V, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ K(ye, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
1587
|
+
/* @__PURE__ */ K("span", {
|
|
672
1588
|
className: "text-sm truncate",
|
|
673
1589
|
children: e.name || e.original_name || "File"
|
|
674
1590
|
}),
|
|
675
|
-
e.size && /* @__PURE__ */
|
|
1591
|
+
e.size && /* @__PURE__ */ q("span", {
|
|
676
1592
|
className: "text-xs text-muted-foreground",
|
|
677
1593
|
children: [
|
|
678
1594
|
"(",
|
|
@@ -681,15 +1597,15 @@ function B({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
681
1597
|
]
|
|
682
1598
|
})
|
|
683
1599
|
]
|
|
684
|
-
}), /* @__PURE__ */
|
|
1600
|
+
}), /* @__PURE__ */ K(h, {
|
|
685
1601
|
type: "button",
|
|
686
1602
|
variant: "ghost",
|
|
687
1603
|
size: "sm",
|
|
688
1604
|
onClick: (e) => {
|
|
689
|
-
e.stopPropagation(),
|
|
1605
|
+
e.stopPropagation(), O(t);
|
|
690
1606
|
},
|
|
691
1607
|
className: "h-6 w-6 p-0",
|
|
692
|
-
children: /* @__PURE__ */
|
|
1608
|
+
children: /* @__PURE__ */ K(ke, { className: "size-3" })
|
|
693
1609
|
})]
|
|
694
1610
|
}, t))
|
|
695
1611
|
})
|
|
@@ -698,26 +1614,164 @@ function B({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
698
1614
|
]
|
|
699
1615
|
});
|
|
700
1616
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1617
|
+
var Xt = Y((() => {})), Zt = /* @__PURE__ */ X({ ImageCropperDialog: () => Qt }), Qt, $t = Y((() => {
|
|
1618
|
+
Qt = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
|
|
1619
|
+
let u = c(null), d = c(null), [f, p] = l(0), [m, g] = l({
|
|
1620
|
+
x: 0,
|
|
1621
|
+
y: 0,
|
|
1622
|
+
width: 100,
|
|
1623
|
+
height: 100
|
|
1624
|
+
}), [S, C] = l(null), [w, te] = l(!1);
|
|
1625
|
+
a(() => {
|
|
1626
|
+
if (!e || !n) return;
|
|
1627
|
+
te(!1);
|
|
1628
|
+
let t = new Image();
|
|
1629
|
+
t.crossOrigin = "anonymous", t.onload = () => {
|
|
1630
|
+
d.current = t;
|
|
1631
|
+
let e = t.naturalWidth * .8, n = t.naturalHeight * .8;
|
|
1632
|
+
g({
|
|
1633
|
+
x: (t.naturalWidth - e) / 2,
|
|
1634
|
+
y: (t.naturalHeight - n) / 2,
|
|
1635
|
+
width: e,
|
|
1636
|
+
height: n
|
|
1637
|
+
}), p(0), te(!0);
|
|
1638
|
+
}, t.onerror = () => te(!1), t.src = n;
|
|
1639
|
+
}, [e, n]), a(() => {
|
|
1640
|
+
if (!w || !d.current || !u.current) return;
|
|
1641
|
+
let e = d.current, t = u.current, n = t.getContext("2d");
|
|
1642
|
+
if (!n) return;
|
|
1643
|
+
let r = 480 / e.naturalWidth, i = e.naturalHeight * r;
|
|
1644
|
+
t.width = 480, t.height = i, n.clearRect(0, 0, 480, i), n.save(), n.translate(480 / 2, i / 2), n.rotate(f * Math.PI / 180);
|
|
1645
|
+
let a = f % 180 == 0 ? 480 : i, o = f % 180 == 0 ? i : 480;
|
|
1646
|
+
n.drawImage(e, -a / 2, -o / 2, a, o), n.restore();
|
|
1647
|
+
let s = m.x * r, c = m.y * r, l = m.width * r, p = m.height * r;
|
|
1648
|
+
n.fillStyle = "rgba(0,0,0,0.45)", n.fillRect(0, 0, 480, c), n.fillRect(0, c + p, 480, i - c - p), n.fillRect(0, c, s, p), n.fillRect(s + l, c, 480 - s - l, p), n.strokeStyle = "#3b82f6", n.lineWidth = 2, n.strokeRect(s, c, l, p);
|
|
1649
|
+
}, [
|
|
1650
|
+
w,
|
|
1651
|
+
m,
|
|
1652
|
+
f
|
|
1653
|
+
]);
|
|
1654
|
+
let T = r((e) => {
|
|
1655
|
+
if (!d.current || !u.current) return;
|
|
1656
|
+
let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width;
|
|
1657
|
+
C({
|
|
1658
|
+
ox: (e.clientX - t.left) * n,
|
|
1659
|
+
oy: (e.clientY - t.top) * n,
|
|
1660
|
+
cx: m.x,
|
|
1661
|
+
cy: m.y
|
|
1662
|
+
}), e.target.setPointerCapture(e.pointerId);
|
|
1663
|
+
}, [m]), ne = r((e) => {
|
|
1664
|
+
if (!S || !d.current || !u.current) return;
|
|
1665
|
+
let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width, r = (e.clientX - t.left) * n - S.ox, i = (e.clientY - t.top) * n - S.oy, a = Math.max(0, Math.min(S.cx + r, d.current.naturalWidth - m.width)), o = Math.max(0, Math.min(S.cy + i, d.current.naturalHeight - m.height));
|
|
1666
|
+
g((e) => ({
|
|
1667
|
+
...e,
|
|
1668
|
+
x: a,
|
|
1669
|
+
y: o
|
|
1670
|
+
}));
|
|
1671
|
+
}, [
|
|
1672
|
+
S,
|
|
1673
|
+
m.width,
|
|
1674
|
+
m.height
|
|
1675
|
+
]), E = r(() => C(null), []), re = r(() => p((e) => (e + 90) % 360), []), ie = r(async () => {
|
|
1676
|
+
if (!d.current) return;
|
|
1677
|
+
let e = d.current, n = document.createElement("canvas"), r = m.width, a = m.height;
|
|
1678
|
+
n.width = f % 180 == 0 ? r : a, n.height = f % 180 == 0 ? a : r;
|
|
1679
|
+
let c = n.getContext("2d");
|
|
1680
|
+
if (!c) return;
|
|
1681
|
+
c.save(), c.translate(n.width / 2, n.height / 2), c.rotate(f * Math.PI / 180), c.drawImage(e, m.x, m.y, r, a, -r / 2, -a / 2, r, a), c.restore();
|
|
1682
|
+
let l = await new Promise((e) => n.toBlob(e, i));
|
|
1683
|
+
l && (s(l, o), t(!1));
|
|
1684
|
+
}, [
|
|
1685
|
+
m,
|
|
1686
|
+
f,
|
|
1687
|
+
o,
|
|
1688
|
+
i,
|
|
1689
|
+
s,
|
|
1690
|
+
t
|
|
1691
|
+
]);
|
|
1692
|
+
return /* @__PURE__ */ K(_, {
|
|
1693
|
+
open: e,
|
|
1694
|
+
onOpenChange: t,
|
|
1695
|
+
children: /* @__PURE__ */ q(v, {
|
|
1696
|
+
className: "max-w-xl",
|
|
1697
|
+
children: [
|
|
1698
|
+
/* @__PURE__ */ q(ee, { children: [/* @__PURE__ */ K(x, { children: "Crop & rotate image" }), /* @__PURE__ */ K(y, { children: "Drag the highlighted box to reposition the crop. Use the rotate button to spin the image in 90° increments." })] }),
|
|
1699
|
+
/* @__PURE__ */ q("div", {
|
|
1700
|
+
className: "flex flex-col items-center gap-3",
|
|
1701
|
+
children: [w ? /* @__PURE__ */ K("canvas", {
|
|
1702
|
+
ref: u,
|
|
1703
|
+
"data-testid": "image-cropper-canvas",
|
|
1704
|
+
role: "img",
|
|
1705
|
+
"aria-label": "Image crop preview",
|
|
1706
|
+
className: "border rounded-md cursor-move touch-none max-w-full",
|
|
1707
|
+
onPointerDown: T,
|
|
1708
|
+
onPointerMove: ne,
|
|
1709
|
+
onPointerUp: E,
|
|
1710
|
+
onPointerCancel: E
|
|
1711
|
+
}) : /* @__PURE__ */ K("div", {
|
|
1712
|
+
className: "flex h-[270px] w-full items-center justify-center text-sm text-muted-foreground",
|
|
1713
|
+
children: "Loading image…"
|
|
1714
|
+
}), /* @__PURE__ */ q("div", {
|
|
1715
|
+
className: "flex w-full items-center justify-between text-xs text-muted-foreground",
|
|
1716
|
+
children: [/* @__PURE__ */ q("span", { children: [
|
|
1717
|
+
"Crop: ",
|
|
1718
|
+
Math.round(m.width),
|
|
1719
|
+
" × ",
|
|
1720
|
+
Math.round(m.height),
|
|
1721
|
+
" px"
|
|
1722
|
+
] }), /* @__PURE__ */ q("span", { children: [
|
|
1723
|
+
"Rotation: ",
|
|
1724
|
+
f,
|
|
1725
|
+
"°"
|
|
1726
|
+
] })]
|
|
1727
|
+
})]
|
|
1728
|
+
}),
|
|
1729
|
+
/* @__PURE__ */ q(b, {
|
|
1730
|
+
className: "flex justify-between sm:justify-between",
|
|
1731
|
+
children: [/* @__PURE__ */ q(h, {
|
|
1732
|
+
type: "button",
|
|
1733
|
+
variant: "outline",
|
|
1734
|
+
onClick: re,
|
|
1735
|
+
"data-testid": "image-cropper-rotate",
|
|
1736
|
+
children: [/* @__PURE__ */ K(G, { className: "size-4 mr-2" }), "Rotate 90°"]
|
|
1737
|
+
}), /* @__PURE__ */ q("div", {
|
|
1738
|
+
className: "flex gap-2",
|
|
1739
|
+
children: [/* @__PURE__ */ K(h, {
|
|
1740
|
+
type: "button",
|
|
1741
|
+
variant: "ghost",
|
|
1742
|
+
onClick: () => t(!1),
|
|
1743
|
+
children: "Cancel"
|
|
1744
|
+
}), /* @__PURE__ */ q(h, {
|
|
1745
|
+
type: "button",
|
|
1746
|
+
onClick: ie,
|
|
1747
|
+
disabled: !w,
|
|
1748
|
+
"data-testid": "image-cropper-confirm",
|
|
1749
|
+
children: [/* @__PURE__ */ K(_e, { className: "size-4 mr-2" }), "Apply crop"]
|
|
1750
|
+
})]
|
|
1751
|
+
})]
|
|
1752
|
+
})
|
|
1753
|
+
]
|
|
1754
|
+
})
|
|
1755
|
+
});
|
|
1756
|
+
};
|
|
1757
|
+
})), en = /* @__PURE__ */ X({ ImageField: () => tn });
|
|
1758
|
+
function tn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
|
|
1759
|
+
let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, g] = l(null), { upload: _ } = Me(), [v, y] = l(!1);
|
|
1760
|
+
if (a) return e ? /* @__PURE__ */ K("div", {
|
|
707
1761
|
className: "flex flex-wrap gap-2",
|
|
708
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
1762
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ K("img", {
|
|
709
1763
|
src: e.url || "",
|
|
710
1764
|
alt: e.name || `Image ${t + 1}`,
|
|
711
1765
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
712
1766
|
}, t))
|
|
713
|
-
}) : /* @__PURE__ */
|
|
714
|
-
let b = e ? Array.isArray(e) ? e : [e] : [],
|
|
715
|
-
let
|
|
716
|
-
if (
|
|
717
|
-
|
|
1767
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
1768
|
+
let b = e ? Array.isArray(e) ? e : [e] : [], ee = async (e) => {
|
|
1769
|
+
let t = Array.from(e.target.files || []);
|
|
1770
|
+
if (t.length !== 0) {
|
|
1771
|
+
y(!0);
|
|
718
1772
|
try {
|
|
719
|
-
let e = await Promise.all(
|
|
720
|
-
let t = await
|
|
1773
|
+
let e = await Promise.all(t.map(async (e) => {
|
|
1774
|
+
let t = await _(e);
|
|
721
1775
|
return {
|
|
722
1776
|
name: t.name,
|
|
723
1777
|
original_name: e.name,
|
|
@@ -726,73 +1780,73 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
726
1780
|
url: t.url
|
|
727
1781
|
};
|
|
728
1782
|
}));
|
|
729
|
-
|
|
1783
|
+
n(d ? [...b, ...e] : e[0]);
|
|
730
1784
|
} finally {
|
|
731
|
-
|
|
1785
|
+
y(!1), s.current && (s.current.value = "");
|
|
732
1786
|
}
|
|
733
1787
|
}
|
|
734
|
-
},
|
|
735
|
-
if (
|
|
736
|
-
let
|
|
737
|
-
t
|
|
738
|
-
} else
|
|
739
|
-
}, C =
|
|
1788
|
+
}, x = (e) => {
|
|
1789
|
+
if (d) {
|
|
1790
|
+
let t = b.filter((t, n) => n !== e);
|
|
1791
|
+
n(t.length > 0 ? t : null);
|
|
1792
|
+
} else n(null);
|
|
1793
|
+
}, C = r(async (e, t) => {
|
|
740
1794
|
if (m) {
|
|
741
|
-
|
|
1795
|
+
y(!0);
|
|
742
1796
|
try {
|
|
743
|
-
let r = await
|
|
744
|
-
name: r.name ||
|
|
745
|
-
original_name:
|
|
1797
|
+
let r = await _(e), i = {
|
|
1798
|
+
name: r.name || t,
|
|
1799
|
+
original_name: t,
|
|
746
1800
|
size: r.size,
|
|
747
1801
|
mime_type: r.mimeType,
|
|
748
1802
|
url: r.url
|
|
749
1803
|
};
|
|
750
|
-
if (
|
|
1804
|
+
if (d) {
|
|
751
1805
|
let e = [...b];
|
|
752
|
-
e[m.index] = i,
|
|
753
|
-
} else
|
|
1806
|
+
e[m.index] = i, n(e);
|
|
1807
|
+
} else n(i);
|
|
754
1808
|
} finally {
|
|
755
|
-
|
|
1809
|
+
y(!1), g(null);
|
|
756
1810
|
}
|
|
757
1811
|
}
|
|
758
1812
|
}, [
|
|
759
1813
|
m,
|
|
760
1814
|
b,
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
]), w =
|
|
1815
|
+
d,
|
|
1816
|
+
n,
|
|
1817
|
+
_
|
|
1818
|
+
]), w = r((e) => {
|
|
765
1819
|
let t = b[e];
|
|
766
|
-
t?.url &&
|
|
1820
|
+
t?.url && g({
|
|
767
1821
|
index: e,
|
|
768
1822
|
src: t.url,
|
|
769
1823
|
name: t.name || `image-${e}.png`
|
|
770
1824
|
});
|
|
771
1825
|
}, [b]);
|
|
772
|
-
return /* @__PURE__ */
|
|
773
|
-
className:
|
|
1826
|
+
return /* @__PURE__ */ q("div", {
|
|
1827
|
+
className: o.className,
|
|
774
1828
|
children: [
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
ref:
|
|
1829
|
+
/* @__PURE__ */ K("input", {
|
|
1830
|
+
ref: s,
|
|
777
1831
|
type: "file",
|
|
778
|
-
multiple:
|
|
779
|
-
accept:
|
|
780
|
-
onChange:
|
|
1832
|
+
multiple: d,
|
|
1833
|
+
accept: f,
|
|
1834
|
+
onChange: ee,
|
|
781
1835
|
className: "hidden"
|
|
782
1836
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ q("div", {
|
|
784
1838
|
className: "space-y-2",
|
|
785
|
-
children: [b.length > 0 && /* @__PURE__ */
|
|
1839
|
+
children: [b.length > 0 && /* @__PURE__ */ K("div", {
|
|
786
1840
|
className: "grid grid-cols-4 gap-2",
|
|
787
|
-
children: b.map((e, t) => /* @__PURE__ */
|
|
1841
|
+
children: b.map((e, t) => /* @__PURE__ */ q("div", {
|
|
788
1842
|
className: "relative group",
|
|
789
|
-
children: [/* @__PURE__ */
|
|
1843
|
+
children: [/* @__PURE__ */ K("img", {
|
|
790
1844
|
src: e.url || "",
|
|
791
1845
|
alt: e.name || `Image ${t + 1}`,
|
|
792
1846
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
793
|
-
}), /* @__PURE__ */
|
|
1847
|
+
}), /* @__PURE__ */ q("div", {
|
|
794
1848
|
className: "absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
795
|
-
children: [
|
|
1849
|
+
children: [p && /* @__PURE__ */ K(h, {
|
|
796
1850
|
type: "button",
|
|
797
1851
|
variant: "secondary",
|
|
798
1852
|
size: "sm",
|
|
@@ -800,32 +1854,32 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
800
1854
|
className: "h-6 w-6 p-0",
|
|
801
1855
|
"aria-label": `Crop image ${t + 1}`,
|
|
802
1856
|
"data-testid": `image-field-crop-${t}`,
|
|
803
|
-
children: /* @__PURE__ */
|
|
804
|
-
}), /* @__PURE__ */
|
|
1857
|
+
children: /* @__PURE__ */ K(_e, { className: "size-3" })
|
|
1858
|
+
}), /* @__PURE__ */ K(h, {
|
|
805
1859
|
type: "button",
|
|
806
1860
|
variant: "destructive",
|
|
807
1861
|
size: "sm",
|
|
808
|
-
onClick: () =>
|
|
1862
|
+
onClick: () => x(t),
|
|
809
1863
|
className: "h-6 w-6 p-0",
|
|
810
|
-
children: /* @__PURE__ */
|
|
1864
|
+
children: /* @__PURE__ */ K(ke, { className: "size-3" })
|
|
811
1865
|
})]
|
|
812
1866
|
})]
|
|
813
1867
|
}, t))
|
|
814
|
-
}), /* @__PURE__ */
|
|
1868
|
+
}), /* @__PURE__ */ q(h, {
|
|
815
1869
|
type: "button",
|
|
816
1870
|
variant: "outline",
|
|
817
|
-
onClick: () =>
|
|
1871
|
+
onClick: () => s.current?.click(),
|
|
818
1872
|
className: "w-full",
|
|
819
|
-
disabled:
|
|
1873
|
+
disabled: v,
|
|
820
1874
|
"data-testid": "image-field-upload-button",
|
|
821
|
-
children: [
|
|
1875
|
+
children: [v ? /* @__PURE__ */ K(xe, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ K(be, { className: "size-4 mr-2" }), v ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
|
|
822
1876
|
})]
|
|
823
1877
|
}),
|
|
824
|
-
|
|
1878
|
+
p && m && /* @__PURE__ */ K(t, {
|
|
825
1879
|
fallback: null,
|
|
826
|
-
children: /* @__PURE__ */
|
|
1880
|
+
children: /* @__PURE__ */ K(nn, {
|
|
827
1881
|
open: !0,
|
|
828
|
-
onOpenChange: (e) => !e &&
|
|
1882
|
+
onOpenChange: (e) => !e && g(null),
|
|
829
1883
|
src: m.src,
|
|
830
1884
|
outputName: m.name,
|
|
831
1885
|
onConfirm: C
|
|
@@ -834,15 +1888,15 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
834
1888
|
]
|
|
835
1889
|
});
|
|
836
1890
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
function
|
|
1891
|
+
var nn, rn = Y((() => {
|
|
1892
|
+
nn = n(() => Promise.resolve().then(() => ($t(), Zt)).then((e) => ({ default: e.ImageCropperDialog })));
|
|
1893
|
+
})), an = /* @__PURE__ */ X({ LocationField: () => on });
|
|
1894
|
+
function on({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
841
1895
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
842
|
-
return r ? /* @__PURE__ */
|
|
1896
|
+
return r ? /* @__PURE__ */ K("span", {
|
|
843
1897
|
className: "text-sm",
|
|
844
|
-
children: o || /* @__PURE__ */
|
|
845
|
-
}) : /* @__PURE__ */
|
|
1898
|
+
children: o || /* @__PURE__ */ K(S, {})
|
|
1899
|
+
}) : /* @__PURE__ */ K(C, {
|
|
846
1900
|
type: "text",
|
|
847
1901
|
value: o,
|
|
848
1902
|
onChange: (e) => {
|
|
@@ -865,67 +1919,59 @@ function it({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
865
1919
|
className: i.className
|
|
866
1920
|
});
|
|
867
1921
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
var at = /* @__PURE__ */ e({ FormulaField: () => ot });
|
|
871
|
-
function ot({ value: e, field: t, ...n }) {
|
|
1922
|
+
var sn = Y((() => {})), cn = /* @__PURE__ */ X({ FormulaField: () => ln });
|
|
1923
|
+
function ln({ value: e, field: t, ...n }) {
|
|
872
1924
|
let r = (t || n.schema)?.return_type || "text";
|
|
873
|
-
if (e == null) return /* @__PURE__ */
|
|
1925
|
+
if (e == null) return /* @__PURE__ */ K(S, { className: n.className });
|
|
874
1926
|
let i;
|
|
875
|
-
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__ */
|
|
1927
|
+
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__ */ K("span", {
|
|
876
1928
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
877
1929
|
children: i
|
|
878
1930
|
});
|
|
879
1931
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
var st = /* @__PURE__ */ e({ SummaryField: () => ct });
|
|
883
|
-
function ct({ value: e, field: t, ...n }) {
|
|
1932
|
+
var un = Y((() => {})), dn = /* @__PURE__ */ X({ SummaryField: () => fn });
|
|
1933
|
+
function fn({ value: e, field: t, ...n }) {
|
|
884
1934
|
let r = (t || n.schema)?.summary_type || "count";
|
|
885
|
-
if (e == null) return /* @__PURE__ */
|
|
1935
|
+
if (e == null) return /* @__PURE__ */ K(S, { className: n.className });
|
|
886
1936
|
let i;
|
|
887
1937
|
return i = r === "count" ? String(e) : [
|
|
888
1938
|
"sum",
|
|
889
1939
|
"avg",
|
|
890
1940
|
"min",
|
|
891
1941
|
"max"
|
|
892
|
-
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */
|
|
1942
|
+
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */ K("span", {
|
|
893
1943
|
className: `text-sm font-medium tabular-nums text-gray-700 ${n.className || ""}`,
|
|
894
1944
|
children: i
|
|
895
1945
|
});
|
|
896
1946
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
function ut({ value: e, field: t, ...n }) {
|
|
901
|
-
return e == null ? /* @__PURE__ */ F(T, { className: n.className }) : /* @__PURE__ */ F("span", {
|
|
1947
|
+
var pn = Y((() => {})), mn = /* @__PURE__ */ X({ AutoNumberField: () => hn });
|
|
1948
|
+
function hn({ value: e, field: t, ...n }) {
|
|
1949
|
+
return e == null ? /* @__PURE__ */ K(S, { className: n.className }) : /* @__PURE__ */ K("span", {
|
|
902
1950
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
903
1951
|
children: String(e)
|
|
904
1952
|
});
|
|
905
1953
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
var dt = /* @__PURE__ */ e({ UserField: () => H });
|
|
909
|
-
function H({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1954
|
+
var gn = Y((() => {})), _n = /* @__PURE__ */ X({ UserField: () => vn });
|
|
1955
|
+
function vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
910
1956
|
let a = (n || i.schema)?.multiple || !1;
|
|
911
1957
|
if (r) {
|
|
912
|
-
if (!e) return /* @__PURE__ */
|
|
1958
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
913
1959
|
let t = Array.isArray(e) ? e : [e];
|
|
914
|
-
return /* @__PURE__ */
|
|
1960
|
+
return /* @__PURE__ */ q("div", {
|
|
915
1961
|
className: "flex -space-x-2",
|
|
916
1962
|
children: [t.slice(0, 3).map((e, t) => {
|
|
917
1963
|
let n = e.name || e.username || "User";
|
|
918
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ K(d, {
|
|
919
1965
|
className: "size-8 border-2 border-white",
|
|
920
1966
|
title: n,
|
|
921
|
-
children: /* @__PURE__ */
|
|
1967
|
+
children: /* @__PURE__ */ K(f, {
|
|
922
1968
|
className: "bg-blue-500 text-white text-xs",
|
|
923
1969
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
924
1970
|
})
|
|
925
1971
|
}, t);
|
|
926
|
-
}), t.length > 3 && /* @__PURE__ */
|
|
1972
|
+
}), t.length > 3 && /* @__PURE__ */ K(d, {
|
|
927
1973
|
className: "size-8 border-2 border-white",
|
|
928
|
-
children: /* @__PURE__ */
|
|
1974
|
+
children: /* @__PURE__ */ q(f, {
|
|
929
1975
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
930
1976
|
children: ["+", t.length - 3]
|
|
931
1977
|
})
|
|
@@ -938,107 +1984,103 @@ function H({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
938
1984
|
t(n.length > 0 ? n : null);
|
|
939
1985
|
} else t(null);
|
|
940
1986
|
};
|
|
941
|
-
return /* @__PURE__ */
|
|
1987
|
+
return /* @__PURE__ */ q("div", {
|
|
942
1988
|
className: i.className,
|
|
943
|
-
children: [o.length > 0 && /* @__PURE__ */
|
|
1989
|
+
children: [o.length > 0 && /* @__PURE__ */ K("div", {
|
|
944
1990
|
className: "flex flex-wrap gap-2 mb-2",
|
|
945
1991
|
children: o.map((e, t) => {
|
|
946
1992
|
let n = e.name || e.username || "User";
|
|
947
|
-
return /* @__PURE__ */
|
|
1993
|
+
return /* @__PURE__ */ q(m, {
|
|
948
1994
|
variant: "outline",
|
|
949
1995
|
className: "gap-2 pr-1",
|
|
950
1996
|
children: [
|
|
951
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ K(d, {
|
|
952
1998
|
className: "size-5",
|
|
953
|
-
children: /* @__PURE__ */
|
|
1999
|
+
children: /* @__PURE__ */ K(f, {
|
|
954
2000
|
className: "bg-blue-500 text-white text-xs",
|
|
955
2001
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
956
2002
|
})
|
|
957
2003
|
}),
|
|
958
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ K("span", {
|
|
959
2005
|
className: "text-sm",
|
|
960
2006
|
children: n
|
|
961
2007
|
}),
|
|
962
|
-
/* @__PURE__ */
|
|
2008
|
+
/* @__PURE__ */ K("button", {
|
|
963
2009
|
type: "button",
|
|
964
2010
|
onClick: () => s(t),
|
|
965
2011
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
966
|
-
children: /* @__PURE__ */
|
|
2012
|
+
children: /* @__PURE__ */ K(ke, { className: "size-3" })
|
|
967
2013
|
})
|
|
968
2014
|
]
|
|
969
2015
|
}, t);
|
|
970
2016
|
})
|
|
971
|
-
}), /* @__PURE__ */
|
|
2017
|
+
}), /* @__PURE__ */ K("div", {
|
|
972
2018
|
className: "text-sm text-gray-500 italic",
|
|
973
2019
|
children: "User selection component requires integration with user management system"
|
|
974
2020
|
})]
|
|
975
2021
|
});
|
|
976
2022
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
let a = n || i.schema, [o, s] = p(() => e == null ? "" : JSON.stringify(e, null, 2)), [c, l] = p(null);
|
|
982
|
-
return u(() => {
|
|
2023
|
+
var yn = Y((() => {})), bn = /* @__PURE__ */ X({ ObjectField: () => xn });
|
|
2024
|
+
function xn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2025
|
+
let o = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
|
|
2026
|
+
return a(() => {
|
|
983
2027
|
try {
|
|
984
2028
|
if (e == null) {
|
|
985
|
-
|
|
2029
|
+
c("");
|
|
986
2030
|
return;
|
|
987
2031
|
}
|
|
988
|
-
let t =
|
|
989
|
-
JSON.stringify(t) !== JSON.stringify(e) &&
|
|
2032
|
+
let t = s ? JSON.parse(s) : null;
|
|
2033
|
+
JSON.stringify(t) !== JSON.stringify(e) && c(JSON.stringify(e, null, 2));
|
|
990
2034
|
} catch {
|
|
991
|
-
|
|
2035
|
+
c(JSON.stringify(e, null, 2));
|
|
992
2036
|
}
|
|
993
|
-
}, [e,
|
|
994
|
-
className:
|
|
2037
|
+
}, [e, s]), r ? e ? /* @__PURE__ */ K("pre", {
|
|
2038
|
+
className: N("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
995
2039
|
children: JSON.stringify(e, null, 2)
|
|
996
|
-
}) : /* @__PURE__ */
|
|
2040
|
+
}) : /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ q("div", {
|
|
997
2041
|
className: "space-y-1",
|
|
998
|
-
children: [/* @__PURE__ */
|
|
999
|
-
value:
|
|
2042
|
+
children: [/* @__PURE__ */ K(M, {
|
|
2043
|
+
value: s,
|
|
1000
2044
|
onChange: (e) => {
|
|
1001
2045
|
let n = e.target.value;
|
|
1002
|
-
if (
|
|
2046
|
+
if (c(n), d(null), !n.trim()) {
|
|
1003
2047
|
t(null);
|
|
1004
2048
|
return;
|
|
1005
2049
|
}
|
|
1006
2050
|
try {
|
|
1007
2051
|
t(JSON.parse(n));
|
|
1008
2052
|
} catch {
|
|
1009
|
-
|
|
2053
|
+
d("Invalid JSON");
|
|
1010
2054
|
}
|
|
1011
2055
|
},
|
|
1012
|
-
placeholder:
|
|
2056
|
+
placeholder: o?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
1013
2057
|
disabled: r || i.disabled,
|
|
1014
|
-
className:
|
|
2058
|
+
className: N("font-mono text-xs", u ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
1015
2059
|
rows: 6
|
|
1016
|
-
}),
|
|
2060
|
+
}), u && /* @__PURE__ */ K("p", {
|
|
1017
2061
|
className: "text-xs text-red-500",
|
|
1018
|
-
children:
|
|
2062
|
+
children: u
|
|
1019
2063
|
})]
|
|
1020
2064
|
});
|
|
1021
2065
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
var mt = /* @__PURE__ */ e({ VectorField: () => U });
|
|
1025
|
-
function U({ value: e, field: t, ...n }) {
|
|
2066
|
+
var Sn = Y((() => {})), Cn = /* @__PURE__ */ X({ VectorField: () => wn });
|
|
2067
|
+
function wn({ value: e, field: t, ...n }) {
|
|
1026
2068
|
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
1027
|
-
if (!e || !Array.isArray(e)) return /* @__PURE__ */
|
|
2069
|
+
if (!e || !Array.isArray(e)) return /* @__PURE__ */ K(S, {});
|
|
1028
2070
|
let i = e.slice(0, 3).map((e) => {
|
|
1029
2071
|
let t = Number(e);
|
|
1030
2072
|
return isNaN(t) ? "0" : t.toFixed(4);
|
|
1031
2073
|
}).join(", ");
|
|
1032
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ q("div", {
|
|
1033
2075
|
className: `text-sm ${n.className || ""}`,
|
|
1034
|
-
children: [/* @__PURE__ */
|
|
2076
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1035
2077
|
className: "font-mono text-gray-700",
|
|
1036
2078
|
children: [
|
|
1037
2079
|
"[",
|
|
1038
2080
|
i,
|
|
1039
2081
|
"...]"
|
|
1040
2082
|
]
|
|
1041
|
-
}), /* @__PURE__ */
|
|
2083
|
+
}), /* @__PURE__ */ q("span", {
|
|
1042
2084
|
className: "text-gray-500 ml-2",
|
|
1043
2085
|
children: [
|
|
1044
2086
|
"(",
|
|
@@ -1048,41 +2090,39 @@ function U({ value: e, field: t, ...n }) {
|
|
|
1048
2090
|
})]
|
|
1049
2091
|
});
|
|
1050
2092
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
var ht = /* @__PURE__ */ e({ GridField: () => gt });
|
|
1054
|
-
function gt({ value: e, field: t, readonly: n, ...r }) {
|
|
2093
|
+
var Tn = Y((() => {})), En = /* @__PURE__ */ X({ GridField: () => Dn });
|
|
2094
|
+
function Dn({ value: e, field: t, readonly: n, ...r }) {
|
|
1055
2095
|
let i = (t || r.schema)?.columns || [];
|
|
1056
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */
|
|
1057
|
-
className:
|
|
1058
|
-
children: /* @__PURE__ */
|
|
2096
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ K(S, {}) : n ? /* @__PURE__ */ K("div", {
|
|
2097
|
+
className: N("text-sm", r.className),
|
|
2098
|
+
children: /* @__PURE__ */ q("span", {
|
|
1059
2099
|
className: "text-foreground",
|
|
1060
2100
|
children: [e.length, " rows"]
|
|
1061
2101
|
})
|
|
1062
|
-
}) : /* @__PURE__ */
|
|
1063
|
-
className:
|
|
1064
|
-
children: [/* @__PURE__ */
|
|
2102
|
+
}) : /* @__PURE__ */ q("div", {
|
|
2103
|
+
className: N("border border-border rounded-lg overflow-hidden", r.className),
|
|
2104
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1065
2105
|
className: "overflow-auto max-h-60",
|
|
1066
|
-
children: /* @__PURE__ */
|
|
2106
|
+
children: /* @__PURE__ */ q("table", {
|
|
1067
2107
|
className: "w-full text-sm",
|
|
1068
|
-
children: [/* @__PURE__ */
|
|
2108
|
+
children: [/* @__PURE__ */ K("thead", {
|
|
1069
2109
|
className: "bg-muted border-b border-border",
|
|
1070
|
-
children: /* @__PURE__ */
|
|
2110
|
+
children: /* @__PURE__ */ K("tr", { children: i.map((e, t) => /* @__PURE__ */ K("th", {
|
|
1071
2111
|
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
1072
2112
|
children: e.label || e.name
|
|
1073
2113
|
}, t)) })
|
|
1074
|
-
}), /* @__PURE__ */
|
|
2114
|
+
}), /* @__PURE__ */ K("tbody", {
|
|
1075
2115
|
className: "divide-y divide-border",
|
|
1076
|
-
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */
|
|
2116
|
+
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */ K("tr", {
|
|
1077
2117
|
className: "hover:bg-muted/50 transition-colors",
|
|
1078
|
-
children: i.map((t, n) => /* @__PURE__ */
|
|
2118
|
+
children: i.map((t, n) => /* @__PURE__ */ K("td", {
|
|
1079
2119
|
className: "px-3 py-2 text-foreground",
|
|
1080
|
-
children: e[t.name] == null ? /* @__PURE__ */
|
|
2120
|
+
children: e[t.name] == null ? /* @__PURE__ */ K(S, {}) : String(e[t.name])
|
|
1081
2121
|
}, n))
|
|
1082
2122
|
}, t))
|
|
1083
2123
|
})]
|
|
1084
2124
|
})
|
|
1085
|
-
}), e.length > 5 && /* @__PURE__ */
|
|
2125
|
+
}), e.length > 5 && /* @__PURE__ */ q("div", {
|
|
1086
2126
|
className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",
|
|
1087
2127
|
children: [
|
|
1088
2128
|
"Showing 5 of ",
|
|
@@ -1092,29 +2132,27 @@ function gt({ value: e, field: t, readonly: n, ...r }) {
|
|
|
1092
2132
|
})]
|
|
1093
2133
|
});
|
|
1094
2134
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
var _t = /* @__PURE__ */ e({ ColorField: () => vt });
|
|
1098
|
-
function vt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2135
|
+
var On = Y((() => {})), kn = /* @__PURE__ */ X({ ColorField: () => An });
|
|
2136
|
+
function An({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1099
2137
|
let a = n || i.schema;
|
|
1100
|
-
return r ? /* @__PURE__ */
|
|
2138
|
+
return r ? /* @__PURE__ */ q("div", {
|
|
1101
2139
|
className: "flex items-center gap-2",
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
2140
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1103
2141
|
className: "w-6 h-6 rounded border border-input",
|
|
1104
2142
|
style: { backgroundColor: e || "#000000" }
|
|
1105
|
-
}), /* @__PURE__ */
|
|
2143
|
+
}), /* @__PURE__ */ K("span", {
|
|
1106
2144
|
className: "text-sm",
|
|
1107
|
-
children: e || /* @__PURE__ */
|
|
2145
|
+
children: e || /* @__PURE__ */ K(S, {})
|
|
1108
2146
|
})]
|
|
1109
|
-
}) : /* @__PURE__ */
|
|
2147
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1110
2148
|
className: "flex items-center gap-2",
|
|
1111
|
-
children: [/* @__PURE__ */
|
|
2149
|
+
children: [/* @__PURE__ */ K("input", {
|
|
1112
2150
|
type: "color",
|
|
1113
2151
|
value: e || "#000000",
|
|
1114
2152
|
onChange: (e) => t(e.target.value),
|
|
1115
2153
|
disabled: r || i.disabled,
|
|
1116
2154
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
1117
|
-
}), /* @__PURE__ */
|
|
2155
|
+
}), /* @__PURE__ */ K(C, {
|
|
1118
2156
|
type: "text",
|
|
1119
2157
|
value: e || "",
|
|
1120
2158
|
onChange: (e) => t(e.target.value),
|
|
@@ -1125,23 +2163,21 @@ function vt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1125
2163
|
})]
|
|
1126
2164
|
});
|
|
1127
2165
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
var yt = /* @__PURE__ */ e({ SliderField: () => bt });
|
|
1131
|
-
function bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2166
|
+
var jn = Y((() => {})), Mn = /* @__PURE__ */ X({ SliderField: () => Nn });
|
|
2167
|
+
function Nn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1132
2168
|
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
1133
|
-
return r ? /* @__PURE__ */
|
|
2169
|
+
return r ? /* @__PURE__ */ q("div", {
|
|
1134
2170
|
className: "flex items-center gap-2",
|
|
1135
|
-
children: [/* @__PURE__ */
|
|
2171
|
+
children: [/* @__PURE__ */ K("span", {
|
|
1136
2172
|
className: "text-sm font-medium",
|
|
1137
2173
|
children: e ?? o
|
|
1138
|
-
}), /* @__PURE__ */
|
|
2174
|
+
}), /* @__PURE__ */ q("span", {
|
|
1139
2175
|
className: "text-xs text-muted-foreground",
|
|
1140
2176
|
children: ["/ ", s]
|
|
1141
2177
|
})]
|
|
1142
|
-
}) : /* @__PURE__ */
|
|
2178
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1143
2179
|
className: "flex items-center gap-4",
|
|
1144
|
-
children: [/* @__PURE__ */
|
|
2180
|
+
children: [/* @__PURE__ */ K(O, {
|
|
1145
2181
|
value: [e ?? o],
|
|
1146
2182
|
onValueChange: (e) => t(e[0]),
|
|
1147
2183
|
min: o,
|
|
@@ -1149,20 +2185,18 @@ function bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1149
2185
|
step: c,
|
|
1150
2186
|
disabled: r || i.disabled,
|
|
1151
2187
|
className: i.className
|
|
1152
|
-
}), /* @__PURE__ */
|
|
2188
|
+
}), /* @__PURE__ */ K("span", {
|
|
1153
2189
|
className: "text-sm font-medium w-12 text-right",
|
|
1154
2190
|
children: e ?? o
|
|
1155
2191
|
})]
|
|
1156
2192
|
});
|
|
1157
2193
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
className: M("flex items-center gap-1", i),
|
|
1165
|
-
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ F(Se, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ I("span", {
|
|
2194
|
+
var Pn = Y((() => {})), Fn = /* @__PURE__ */ X({ RatingField: () => In });
|
|
2195
|
+
function In({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
2196
|
+
let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
|
|
2197
|
+
return i ? /* @__PURE__ */ q("div", {
|
|
2198
|
+
className: N("flex items-center gap-1", a),
|
|
2199
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ K(Ee, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ q("span", {
|
|
1166
2200
|
className: "ml-2 text-sm text-muted-foreground",
|
|
1167
2201
|
children: [
|
|
1168
2202
|
c,
|
|
@@ -1170,17 +2204,17 @@ function St({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1170
2204
|
s
|
|
1171
2205
|
]
|
|
1172
2206
|
})]
|
|
1173
|
-
}) : /* @__PURE__ */
|
|
1174
|
-
className:
|
|
1175
|
-
children: [Array.from({ length: s }, (e,
|
|
2207
|
+
}) : /* @__PURE__ */ q("div", {
|
|
2208
|
+
className: N("flex items-center gap-1", a),
|
|
2209
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ K("button", {
|
|
1176
2210
|
type: "button",
|
|
1177
|
-
onClick: () => t
|
|
1178
|
-
onMouseEnter: () => u(
|
|
2211
|
+
onClick: () => n(t + 1),
|
|
2212
|
+
onMouseEnter: () => u(t + 1),
|
|
1179
2213
|
onMouseLeave: () => u(null),
|
|
1180
2214
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
1181
|
-
disabled:
|
|
1182
|
-
children: /* @__PURE__ */
|
|
1183
|
-
},
|
|
2215
|
+
disabled: i || o.disabled,
|
|
2216
|
+
children: /* @__PURE__ */ K(Ee, { className: `w-5 h-5 transition-colors ${t < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
2217
|
+
}, t)), /* @__PURE__ */ q("span", {
|
|
1184
2218
|
className: "ml-2 text-sm text-muted-foreground",
|
|
1185
2219
|
children: [
|
|
1186
2220
|
c,
|
|
@@ -1190,93 +2224,89 @@ function St({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1190
2224
|
})]
|
|
1191
2225
|
});
|
|
1192
2226
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
var Ct = /* @__PURE__ */ e({ CodeField: () => wt });
|
|
1196
|
-
function wt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2227
|
+
var Ln = Y((() => {})), Rn = /* @__PURE__ */ X({ CodeField: () => zn });
|
|
2228
|
+
function zn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1197
2229
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
1198
|
-
return r ? /* @__PURE__ */
|
|
1199
|
-
className:
|
|
1200
|
-
children: /* @__PURE__ */
|
|
1201
|
-
}) : /* @__PURE__ */
|
|
2230
|
+
return r ? /* @__PURE__ */ K("pre", {
|
|
2231
|
+
className: N("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
2232
|
+
children: /* @__PURE__ */ K("code", { children: e || /* @__PURE__ */ K(S, {}) })
|
|
2233
|
+
}) : /* @__PURE__ */ K(M, {
|
|
1202
2234
|
value: e || "",
|
|
1203
2235
|
onChange: (e) => t(e.target.value),
|
|
1204
2236
|
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
1205
2237
|
disabled: r || i.disabled,
|
|
1206
|
-
className:
|
|
2238
|
+
className: N("font-mono text-sm", i.className),
|
|
1207
2239
|
rows: 12,
|
|
1208
2240
|
spellCheck: !1
|
|
1209
2241
|
});
|
|
1210
2242
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
if (!n) return;
|
|
1218
|
-
if (!n.type.startsWith("image/")) {
|
|
2243
|
+
var Bn = Y((() => {})), Vn = /* @__PURE__ */ X({ AvatarField: () => Hn });
|
|
2244
|
+
function Hn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2245
|
+
let [o, s] = e.useState(!1), c = e.useRef(null), l = r || a.schema, u = (e) => {
|
|
2246
|
+
let t = e.target.files?.[0];
|
|
2247
|
+
if (!t) return;
|
|
2248
|
+
if (!t.type.startsWith("image/")) {
|
|
1219
2249
|
console.error("Please select an image file");
|
|
1220
2250
|
return;
|
|
1221
2251
|
}
|
|
1222
|
-
if (
|
|
2252
|
+
if (t.size > 5 * 1024 * 1024) {
|
|
1223
2253
|
console.error("File size must be less than 5MB");
|
|
1224
2254
|
return;
|
|
1225
2255
|
}
|
|
1226
2256
|
let r = new FileReader();
|
|
1227
2257
|
r.onloadend = () => {
|
|
1228
|
-
|
|
1229
|
-
}, r.readAsDataURL(
|
|
1230
|
-
},
|
|
1231
|
-
|
|
1232
|
-
},
|
|
1233
|
-
return
|
|
2258
|
+
n(r.result);
|
|
2259
|
+
}, r.readAsDataURL(t);
|
|
2260
|
+
}, m = () => {
|
|
2261
|
+
n("");
|
|
2262
|
+
}, g = () => (l?.defaultName || l?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
2263
|
+
return i ? /* @__PURE__ */ q(d, {
|
|
1234
2264
|
className: "w-16 h-16",
|
|
1235
|
-
children: [
|
|
1236
|
-
src:
|
|
2265
|
+
children: [t && /* @__PURE__ */ K(p, {
|
|
2266
|
+
src: t,
|
|
1237
2267
|
alt: l?.label
|
|
1238
|
-
}), /* @__PURE__ */
|
|
1239
|
-
}) : /* @__PURE__ */
|
|
2268
|
+
}), /* @__PURE__ */ K(f, { children: g() })]
|
|
2269
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1240
2270
|
className: "flex items-center gap-4",
|
|
1241
|
-
children: [/* @__PURE__ */
|
|
2271
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1242
2272
|
className: "relative",
|
|
1243
2273
|
onMouseEnter: () => s(!0),
|
|
1244
2274
|
onMouseLeave: () => s(!1),
|
|
1245
|
-
children: [/* @__PURE__ */
|
|
2275
|
+
children: [/* @__PURE__ */ q(d, {
|
|
1246
2276
|
className: "w-16 h-16",
|
|
1247
|
-
children: [
|
|
1248
|
-
src:
|
|
2277
|
+
children: [t && /* @__PURE__ */ K(p, {
|
|
2278
|
+
src: t,
|
|
1249
2279
|
alt: l?.label
|
|
1250
|
-
}), /* @__PURE__ */
|
|
1251
|
-
}), !
|
|
2280
|
+
}), /* @__PURE__ */ K(f, { children: g() })]
|
|
2281
|
+
}), !i && o && t && /* @__PURE__ */ K("button", {
|
|
1252
2282
|
type: "button",
|
|
1253
|
-
onClick:
|
|
2283
|
+
onClick: m,
|
|
1254
2284
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
1255
|
-
children: /* @__PURE__ */
|
|
2285
|
+
children: /* @__PURE__ */ K(ke, { className: "w-3 h-3" })
|
|
1256
2286
|
})]
|
|
1257
|
-
}), /* @__PURE__ */
|
|
2287
|
+
}), /* @__PURE__ */ q("div", {
|
|
1258
2288
|
className: "flex flex-col gap-2",
|
|
1259
2289
|
children: [
|
|
1260
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ K("input", {
|
|
1261
2291
|
ref: c,
|
|
1262
2292
|
type: "file",
|
|
1263
2293
|
accept: "image/*",
|
|
1264
2294
|
onChange: u,
|
|
1265
2295
|
className: "hidden"
|
|
1266
2296
|
}),
|
|
1267
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ q(h, {
|
|
1268
2298
|
type: "button",
|
|
1269
2299
|
variant: "outline",
|
|
1270
2300
|
size: "sm",
|
|
1271
2301
|
onClick: () => c.current?.click(),
|
|
1272
|
-
disabled:
|
|
2302
|
+
disabled: i || a.disabled,
|
|
1273
2303
|
children: [
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
|
|
2304
|
+
/* @__PURE__ */ K(Oe, { className: "w-4 h-4 mr-2" }),
|
|
2305
|
+
t ? "Change" : "Upload",
|
|
1276
2306
|
" Avatar"
|
|
1277
2307
|
]
|
|
1278
2308
|
}),
|
|
1279
|
-
/* @__PURE__ */
|
|
2309
|
+
/* @__PURE__ */ K("p", {
|
|
1280
2310
|
className: "text-xs text-muted-foreground",
|
|
1281
2311
|
children: "PNG, JPG up to 5MB"
|
|
1282
2312
|
})
|
|
@@ -1284,10 +2314,8 @@ function Et({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1284
2314
|
})]
|
|
1285
2315
|
});
|
|
1286
2316
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
var Dt = /* @__PURE__ */ e({ AddressField: () => Ot });
|
|
1290
|
-
function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2317
|
+
var Un = Y((() => {})), Wn = /* @__PURE__ */ X({ AddressField: () => Gn });
|
|
2318
|
+
function Gn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1291
2319
|
let a = e || {}, o = (e, n) => {
|
|
1292
2320
|
t({
|
|
1293
2321
|
...a,
|
|
@@ -1301,19 +2329,19 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1301
2329
|
].filter(Boolean).join(", ");
|
|
1302
2330
|
if (r) {
|
|
1303
2331
|
let e = s(a);
|
|
1304
|
-
return e ? /* @__PURE__ */
|
|
2332
|
+
return e ? /* @__PURE__ */ K("span", {
|
|
1305
2333
|
className: "text-sm",
|
|
1306
2334
|
children: e
|
|
1307
|
-
}) : /* @__PURE__ */
|
|
2335
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
1308
2336
|
}
|
|
1309
|
-
return /* @__PURE__ */
|
|
2337
|
+
return /* @__PURE__ */ q("div", {
|
|
1310
2338
|
className: "space-y-3",
|
|
1311
2339
|
children: [
|
|
1312
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1313
2341
|
htmlFor: "street",
|
|
1314
2342
|
className: "text-xs",
|
|
1315
2343
|
children: "Street Address"
|
|
1316
|
-
}), /* @__PURE__ */
|
|
2344
|
+
}), /* @__PURE__ */ K(C, {
|
|
1317
2345
|
id: "street",
|
|
1318
2346
|
type: "text",
|
|
1319
2347
|
value: a.street || "",
|
|
@@ -1322,24 +2350,24 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1322
2350
|
disabled: r || i.disabled,
|
|
1323
2351
|
className: i.className
|
|
1324
2352
|
})] }),
|
|
1325
|
-
/* @__PURE__ */
|
|
2353
|
+
/* @__PURE__ */ q("div", {
|
|
1326
2354
|
className: "grid grid-cols-2 gap-3",
|
|
1327
|
-
children: [/* @__PURE__ */
|
|
2355
|
+
children: [/* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1328
2356
|
htmlFor: "city",
|
|
1329
2357
|
className: "text-xs",
|
|
1330
2358
|
children: "City"
|
|
1331
|
-
}), /* @__PURE__ */
|
|
2359
|
+
}), /* @__PURE__ */ K(C, {
|
|
1332
2360
|
id: "city",
|
|
1333
2361
|
type: "text",
|
|
1334
2362
|
value: a.city || "",
|
|
1335
2363
|
onChange: (e) => o("city", e.target.value),
|
|
1336
2364
|
placeholder: "San Francisco",
|
|
1337
2365
|
disabled: r || i.disabled
|
|
1338
|
-
})] }), /* @__PURE__ */
|
|
2366
|
+
})] }), /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1339
2367
|
htmlFor: "state",
|
|
1340
2368
|
className: "text-xs",
|
|
1341
2369
|
children: "State / Province"
|
|
1342
|
-
}), /* @__PURE__ */
|
|
2370
|
+
}), /* @__PURE__ */ K(C, {
|
|
1343
2371
|
id: "state",
|
|
1344
2372
|
type: "text",
|
|
1345
2373
|
value: a.state || "",
|
|
@@ -1348,24 +2376,24 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1348
2376
|
disabled: r || i.disabled
|
|
1349
2377
|
})] })]
|
|
1350
2378
|
}),
|
|
1351
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ q("div", {
|
|
1352
2380
|
className: "grid grid-cols-2 gap-3",
|
|
1353
|
-
children: [/* @__PURE__ */
|
|
2381
|
+
children: [/* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1354
2382
|
htmlFor: "zipCode",
|
|
1355
2383
|
className: "text-xs",
|
|
1356
2384
|
children: "ZIP / Postal Code"
|
|
1357
|
-
}), /* @__PURE__ */
|
|
2385
|
+
}), /* @__PURE__ */ K(C, {
|
|
1358
2386
|
id: "zipCode",
|
|
1359
2387
|
type: "text",
|
|
1360
2388
|
value: a.zipCode || "",
|
|
1361
2389
|
onChange: (e) => o("zipCode", e.target.value),
|
|
1362
2390
|
placeholder: "94102",
|
|
1363
2391
|
disabled: r || i.disabled
|
|
1364
|
-
})] }), /* @__PURE__ */
|
|
2392
|
+
})] }), /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1365
2393
|
htmlFor: "country",
|
|
1366
2394
|
className: "text-xs",
|
|
1367
2395
|
children: "Country"
|
|
1368
|
-
}), /* @__PURE__ */
|
|
2396
|
+
}), /* @__PURE__ */ K(C, {
|
|
1369
2397
|
id: "country",
|
|
1370
2398
|
type: "text",
|
|
1371
2399
|
value: a.country || "",
|
|
@@ -1377,14 +2405,12 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1377
2405
|
]
|
|
1378
2406
|
});
|
|
1379
2407
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
let [a, s] = o.useState(!1), c = e || {}, l = (e, n) => {
|
|
1385
|
-
t({
|
|
2408
|
+
var Kn = Y((() => {})), qn = /* @__PURE__ */ X({ GeolocationField: () => Jn });
|
|
2409
|
+
function Jn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2410
|
+
let [o, s] = e.useState(!1), c = t || {}, l = (e, t) => {
|
|
2411
|
+
n({
|
|
1386
2412
|
...c,
|
|
1387
|
-
[e]:
|
|
2413
|
+
[e]: t ? Number(t) : void 0
|
|
1388
2414
|
});
|
|
1389
2415
|
}, u = () => {
|
|
1390
2416
|
if (!navigator.geolocation) {
|
|
@@ -1392,7 +2418,7 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1392
2418
|
return;
|
|
1393
2419
|
}
|
|
1394
2420
|
s(!0), navigator.geolocation.getCurrentPosition((e) => {
|
|
1395
|
-
|
|
2421
|
+
n({
|
|
1396
2422
|
latitude: e.coords.latitude,
|
|
1397
2423
|
longitude: e.coords.longitude,
|
|
1398
2424
|
accuracy: e.coords.accuracy
|
|
@@ -1409,17 +2435,17 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1409
2435
|
let e = `https://www.google.com/maps?q=${c.latitude},${c.longitude}`;
|
|
1410
2436
|
window.open(e, "_blank");
|
|
1411
2437
|
};
|
|
1412
|
-
if (
|
|
2438
|
+
if (i) {
|
|
1413
2439
|
let e = d(c);
|
|
1414
|
-
return /* @__PURE__ */
|
|
2440
|
+
return /* @__PURE__ */ q("div", {
|
|
1415
2441
|
className: "flex items-center gap-2",
|
|
1416
2442
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
e ? /* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ K(H, { className: "w-4 h-4 text-muted-foreground" }),
|
|
2444
|
+
e ? /* @__PURE__ */ K("span", {
|
|
1419
2445
|
className: "text-sm",
|
|
1420
2446
|
children: e
|
|
1421
|
-
}) : /* @__PURE__ */
|
|
1422
|
-
c.latitude && c.longitude && /* @__PURE__ */
|
|
2447
|
+
}) : /* @__PURE__ */ K(S, {}),
|
|
2448
|
+
c.latitude && c.longitude && /* @__PURE__ */ K(h, {
|
|
1423
2449
|
type: "button",
|
|
1424
2450
|
variant: "link",
|
|
1425
2451
|
size: "sm",
|
|
@@ -1430,56 +2456,56 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1430
2456
|
]
|
|
1431
2457
|
});
|
|
1432
2458
|
}
|
|
1433
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ q("div", {
|
|
1434
2460
|
className: "space-y-3",
|
|
1435
2461
|
children: [
|
|
1436
|
-
/* @__PURE__ */
|
|
2462
|
+
/* @__PURE__ */ q("div", {
|
|
1437
2463
|
className: "flex items-center gap-2",
|
|
1438
|
-
children: [/* @__PURE__ */
|
|
2464
|
+
children: [/* @__PURE__ */ q(h, {
|
|
1439
2465
|
type: "button",
|
|
1440
2466
|
variant: "outline",
|
|
1441
2467
|
size: "sm",
|
|
1442
2468
|
onClick: u,
|
|
1443
|
-
disabled:
|
|
1444
|
-
children: [/* @__PURE__ */
|
|
1445
|
-
}), c.latitude && c.longitude && /* @__PURE__ */
|
|
2469
|
+
disabled: i || o,
|
|
2470
|
+
children: [/* @__PURE__ */ K(L, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
2471
|
+
}), c.latitude && c.longitude && /* @__PURE__ */ q(h, {
|
|
1446
2472
|
type: "button",
|
|
1447
2473
|
variant: "link",
|
|
1448
2474
|
size: "sm",
|
|
1449
2475
|
onClick: f,
|
|
1450
|
-
children: [/* @__PURE__ */
|
|
2476
|
+
children: [/* @__PURE__ */ K(H, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
1451
2477
|
})]
|
|
1452
2478
|
}),
|
|
1453
|
-
/* @__PURE__ */
|
|
2479
|
+
/* @__PURE__ */ q("div", {
|
|
1454
2480
|
className: "grid grid-cols-2 gap-3",
|
|
1455
|
-
children: [/* @__PURE__ */
|
|
2481
|
+
children: [/* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1456
2482
|
htmlFor: "latitude",
|
|
1457
2483
|
className: "text-xs",
|
|
1458
2484
|
children: "Latitude"
|
|
1459
|
-
}), /* @__PURE__ */
|
|
2485
|
+
}), /* @__PURE__ */ K(C, {
|
|
1460
2486
|
id: "latitude",
|
|
1461
2487
|
type: "number",
|
|
1462
2488
|
value: c.latitude ?? "",
|
|
1463
2489
|
onChange: (e) => l("latitude", e.target.value),
|
|
1464
2490
|
placeholder: "37.7749",
|
|
1465
|
-
disabled:
|
|
2491
|
+
disabled: i || a.disabled,
|
|
1466
2492
|
step: "any",
|
|
1467
|
-
className:
|
|
1468
|
-
})] }), /* @__PURE__ */
|
|
2493
|
+
className: a.className
|
|
2494
|
+
})] }), /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K(w, {
|
|
1469
2495
|
htmlFor: "longitude",
|
|
1470
2496
|
className: "text-xs",
|
|
1471
2497
|
children: "Longitude"
|
|
1472
|
-
}), /* @__PURE__ */
|
|
2498
|
+
}), /* @__PURE__ */ K(C, {
|
|
1473
2499
|
id: "longitude",
|
|
1474
2500
|
type: "number",
|
|
1475
2501
|
value: c.longitude ?? "",
|
|
1476
2502
|
onChange: (e) => l("longitude", e.target.value),
|
|
1477
2503
|
placeholder: "-122.4194",
|
|
1478
|
-
disabled:
|
|
2504
|
+
disabled: i || a.disabled,
|
|
1479
2505
|
step: "any"
|
|
1480
2506
|
})] })]
|
|
1481
2507
|
}),
|
|
1482
|
-
c.accuracy && /* @__PURE__ */
|
|
2508
|
+
c.accuracy && /* @__PURE__ */ q("p", {
|
|
1483
2509
|
className: "text-xs text-muted-foreground",
|
|
1484
2510
|
children: [
|
|
1485
2511
|
"Accuracy: ±",
|
|
@@ -1490,166 +2516,160 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1490
2516
|
]
|
|
1491
2517
|
});
|
|
1492
2518
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
let t = r.current.getContext("2d");
|
|
1501
|
-
if (t) {
|
|
2519
|
+
var Yn = Y((() => {})), Xn = /* @__PURE__ */ X({ SignatureField: () => Zn });
|
|
2520
|
+
function Zn({ value: t, onChange: n, readonly: r }) {
|
|
2521
|
+
let i = c(null), [o, s] = e.useState(!1), [l, u] = e.useState(!t);
|
|
2522
|
+
a(() => {
|
|
2523
|
+
if (t && i.current) {
|
|
2524
|
+
let e = i.current.getContext("2d");
|
|
2525
|
+
if (e) {
|
|
1502
2526
|
let n = new Image();
|
|
1503
2527
|
n.onload = () => {
|
|
1504
|
-
|
|
1505
|
-
}, n.src =
|
|
2528
|
+
e.drawImage(n, 0, 0), u(!1);
|
|
2529
|
+
}, n.src = t;
|
|
1506
2530
|
}
|
|
1507
2531
|
}
|
|
1508
|
-
}, [
|
|
1509
|
-
let
|
|
1510
|
-
if (
|
|
1511
|
-
|
|
1512
|
-
let t =
|
|
2532
|
+
}, [t]);
|
|
2533
|
+
let d = (e) => {
|
|
2534
|
+
if (r) return;
|
|
2535
|
+
s(!0), u(!1);
|
|
2536
|
+
let t = i.current;
|
|
1513
2537
|
if (!t) return;
|
|
1514
|
-
let
|
|
1515
|
-
if (!
|
|
1516
|
-
let
|
|
1517
|
-
|
|
1518
|
-
},
|
|
1519
|
-
if (!
|
|
1520
|
-
let t =
|
|
2538
|
+
let n = t.getContext("2d");
|
|
2539
|
+
if (!n) return;
|
|
2540
|
+
let a = t.getBoundingClientRect(), o = "touches" in e ? e.touches[0].clientX - a.left : e.clientX - a.left, c = "touches" in e ? e.touches[0].clientY - a.top : e.clientY - a.top;
|
|
2541
|
+
n.beginPath(), n.moveTo(o, c);
|
|
2542
|
+
}, f = (e) => {
|
|
2543
|
+
if (!o || r) return;
|
|
2544
|
+
let t = i.current;
|
|
1521
2545
|
if (!t) return;
|
|
1522
|
-
let
|
|
1523
|
-
if (!
|
|
1524
|
-
let
|
|
1525
|
-
|
|
2546
|
+
let n = t.getContext("2d");
|
|
2547
|
+
if (!n) return;
|
|
2548
|
+
let a = t.getBoundingClientRect(), s = "touches" in e ? e.touches[0].clientX - a.left : e.clientX - a.left, c = "touches" in e ? e.touches[0].clientY - a.top : e.clientY - a.top;
|
|
2549
|
+
n.lineTo(s, c), n.strokeStyle = "#000", n.lineWidth = 2, n.lineCap = "round", n.lineJoin = "round", n.stroke();
|
|
1526
2550
|
}, p = () => {
|
|
1527
|
-
if (!
|
|
1528
|
-
|
|
1529
|
-
let e =
|
|
1530
|
-
e &&
|
|
2551
|
+
if (!o) return;
|
|
2552
|
+
s(!1);
|
|
2553
|
+
let e = i.current;
|
|
2554
|
+
e && n(e.toDataURL("image/png"));
|
|
1531
2555
|
};
|
|
1532
|
-
return
|
|
2556
|
+
return r && t ? /* @__PURE__ */ K("div", {
|
|
1533
2557
|
className: "border rounded p-2 bg-white",
|
|
1534
|
-
children: /* @__PURE__ */
|
|
1535
|
-
src:
|
|
2558
|
+
children: /* @__PURE__ */ K("img", {
|
|
2559
|
+
src: t,
|
|
1536
2560
|
alt: "Signature",
|
|
1537
2561
|
loading: "lazy",
|
|
1538
2562
|
className: "max-w-full h-auto"
|
|
1539
2563
|
})
|
|
1540
|
-
}) :
|
|
2564
|
+
}) : r && !t ? /* @__PURE__ */ K("span", {
|
|
1541
2565
|
className: "text-sm text-muted-foreground",
|
|
1542
2566
|
children: "No signature"
|
|
1543
|
-
}) : /* @__PURE__ */
|
|
2567
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1544
2568
|
className: "space-y-2",
|
|
1545
|
-
children: [/* @__PURE__ */
|
|
2569
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1546
2570
|
className: "border rounded bg-white",
|
|
1547
|
-
children: /* @__PURE__ */
|
|
1548
|
-
ref:
|
|
2571
|
+
children: /* @__PURE__ */ K("canvas", {
|
|
2572
|
+
ref: i,
|
|
1549
2573
|
width: 400,
|
|
1550
2574
|
height: 200,
|
|
1551
2575
|
className: "w-full touch-none cursor-crosshair",
|
|
1552
|
-
onMouseDown:
|
|
1553
|
-
onMouseMove:
|
|
2576
|
+
onMouseDown: d,
|
|
2577
|
+
onMouseMove: f,
|
|
1554
2578
|
onMouseUp: p,
|
|
1555
2579
|
onMouseLeave: p,
|
|
1556
|
-
onTouchStart:
|
|
1557
|
-
onTouchMove:
|
|
2580
|
+
onTouchStart: d,
|
|
2581
|
+
onTouchMove: f,
|
|
1558
2582
|
onTouchEnd: p
|
|
1559
2583
|
})
|
|
1560
|
-
}), /* @__PURE__ */
|
|
2584
|
+
}), /* @__PURE__ */ q("div", {
|
|
1561
2585
|
className: "flex justify-between items-center",
|
|
1562
|
-
children: [/* @__PURE__ */
|
|
2586
|
+
children: [/* @__PURE__ */ K("p", {
|
|
1563
2587
|
className: "text-xs text-muted-foreground",
|
|
1564
|
-
children:
|
|
1565
|
-
}), /* @__PURE__ */
|
|
2588
|
+
children: l ? "Sign above" : "Signature captured"
|
|
2589
|
+
}), /* @__PURE__ */ q(h, {
|
|
1566
2590
|
type: "button",
|
|
1567
2591
|
variant: "outline",
|
|
1568
2592
|
size: "sm",
|
|
1569
2593
|
onClick: () => {
|
|
1570
|
-
let e =
|
|
2594
|
+
let e = i.current;
|
|
1571
2595
|
if (!e) return;
|
|
1572
|
-
let
|
|
1573
|
-
|
|
2596
|
+
let t = e.getContext("2d");
|
|
2597
|
+
t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
|
|
1574
2598
|
},
|
|
1575
|
-
disabled:
|
|
1576
|
-
children: [/* @__PURE__ */
|
|
2599
|
+
disabled: r || l,
|
|
2600
|
+
children: [/* @__PURE__ */ K(R, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
1577
2601
|
})]
|
|
1578
2602
|
})]
|
|
1579
2603
|
});
|
|
1580
2604
|
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
let [a, s] = o.useState(!1), c = n || i.schema;
|
|
1586
|
-
return r ? /* @__PURE__ */ I("div", {
|
|
2605
|
+
var Qn = Y((() => {})), $n = /* @__PURE__ */ X({ QRCodeField: () => er });
|
|
2606
|
+
function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
|
|
2607
|
+
let [o, s] = e.useState(!1), c = r || a.schema;
|
|
2608
|
+
return i ? /* @__PURE__ */ q("div", {
|
|
1587
2609
|
className: "flex items-center gap-3",
|
|
1588
|
-
children: [/* @__PURE__ */
|
|
2610
|
+
children: [/* @__PURE__ */ K("span", {
|
|
1589
2611
|
className: "text-sm flex-1 truncate",
|
|
1590
|
-
children:
|
|
1591
|
-
}),
|
|
2612
|
+
children: t || /* @__PURE__ */ K(S, {})
|
|
2613
|
+
}), t && /* @__PURE__ */ q(h, {
|
|
1592
2614
|
type: "button",
|
|
1593
2615
|
variant: "outline",
|
|
1594
2616
|
size: "sm",
|
|
1595
|
-
onClick: () => s(!
|
|
2617
|
+
onClick: () => s(!o),
|
|
1596
2618
|
children: [
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
|
|
2619
|
+
/* @__PURE__ */ K(W, { className: "w-4 h-4 mr-2" }),
|
|
2620
|
+
o ? "Hide" : "Show",
|
|
1599
2621
|
" QR"
|
|
1600
2622
|
]
|
|
1601
2623
|
})]
|
|
1602
|
-
}) : /* @__PURE__ */
|
|
2624
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1603
2625
|
className: "space-y-3",
|
|
1604
2626
|
children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ q("div", {
|
|
1606
2628
|
className: "flex items-center gap-2",
|
|
1607
|
-
children: [/* @__PURE__ */
|
|
2629
|
+
children: [/* @__PURE__ */ K(C, {
|
|
1608
2630
|
type: "text",
|
|
1609
|
-
value:
|
|
1610
|
-
onChange: (e) =>
|
|
2631
|
+
value: t || "",
|
|
2632
|
+
onChange: (e) => n(e.target.value),
|
|
1611
2633
|
placeholder: c?.placeholder || "Enter text for QR code",
|
|
1612
|
-
disabled:
|
|
1613
|
-
className:
|
|
1614
|
-
}),
|
|
2634
|
+
disabled: i || a.disabled,
|
|
2635
|
+
className: a.className
|
|
2636
|
+
}), t && /* @__PURE__ */ q(Ae, { children: [/* @__PURE__ */ K(h, {
|
|
1615
2637
|
type: "button",
|
|
1616
2638
|
variant: "outline",
|
|
1617
2639
|
size: "sm",
|
|
1618
2640
|
onClick: () => {
|
|
1619
|
-
|
|
2641
|
+
t && navigator.clipboard.writeText(t);
|
|
1620
2642
|
},
|
|
1621
|
-
children: /* @__PURE__ */
|
|
1622
|
-
}), /* @__PURE__ */
|
|
2643
|
+
children: /* @__PURE__ */ K(I, { className: "w-4 h-4" })
|
|
2644
|
+
}), /* @__PURE__ */ K(h, {
|
|
1623
2645
|
type: "button",
|
|
1624
2646
|
variant: "outline",
|
|
1625
2647
|
size: "sm",
|
|
1626
|
-
onClick: () => s(!
|
|
1627
|
-
children: /* @__PURE__ */
|
|
2648
|
+
onClick: () => s(!o),
|
|
2649
|
+
children: /* @__PURE__ */ K(W, { className: "w-4 h-4" })
|
|
1628
2650
|
})] })]
|
|
1629
2651
|
}),
|
|
1630
|
-
|
|
2652
|
+
o && t && /* @__PURE__ */ K("div", {
|
|
1631
2653
|
className: "border rounded p-4 bg-white flex justify-center",
|
|
1632
|
-
children: /* @__PURE__ */
|
|
1633
|
-
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(
|
|
2654
|
+
children: /* @__PURE__ */ K("img", {
|
|
2655
|
+
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(t),
|
|
1634
2656
|
alt: "QR Code",
|
|
1635
2657
|
className: "w-48 h-48"
|
|
1636
2658
|
})
|
|
1637
2659
|
}),
|
|
1638
|
-
|
|
2660
|
+
t && /* @__PURE__ */ q("p", {
|
|
1639
2661
|
className: "text-xs text-muted-foreground",
|
|
1640
2662
|
children: [
|
|
1641
2663
|
"QR code contains: ",
|
|
1642
|
-
|
|
2664
|
+
t.length,
|
|
1643
2665
|
" characters"
|
|
1644
2666
|
]
|
|
1645
2667
|
})
|
|
1646
2668
|
]
|
|
1647
2669
|
});
|
|
1648
2670
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
var Ft = /* @__PURE__ */ e({ MasterDetailField: () => It });
|
|
1652
|
-
function It({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
2671
|
+
var tr = Y((() => {})), nr = /* @__PURE__ */ X({ MasterDetailField: () => rr });
|
|
2672
|
+
function rr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1653
2673
|
let o = e || [], s = n || a.schema, c = () => {
|
|
1654
2674
|
let e = {
|
|
1655
2675
|
id: `new-${Date.now()}`,
|
|
@@ -1661,24 +2681,24 @@ function It({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1661
2681
|
}, u = (e) => {
|
|
1662
2682
|
console.log("View detail:", e);
|
|
1663
2683
|
};
|
|
1664
|
-
return r ? /* @__PURE__ */
|
|
1665
|
-
className:
|
|
1666
|
-
children: [o.length === 0 ? /* @__PURE__ */
|
|
2684
|
+
return r ? /* @__PURE__ */ q("div", {
|
|
2685
|
+
className: N("space-y-2", i),
|
|
2686
|
+
children: [o.length === 0 ? /* @__PURE__ */ K("span", {
|
|
1667
2687
|
className: "text-sm text-muted-foreground",
|
|
1668
2688
|
children: "No related records"
|
|
1669
|
-
}) : o.map((e) => /* @__PURE__ */
|
|
2689
|
+
}) : o.map((e) => /* @__PURE__ */ q("div", {
|
|
1670
2690
|
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
1671
|
-
children: [/* @__PURE__ */
|
|
2691
|
+
children: [/* @__PURE__ */ K("span", {
|
|
1672
2692
|
className: "text-sm",
|
|
1673
2693
|
children: e.label
|
|
1674
|
-
}), /* @__PURE__ */
|
|
2694
|
+
}), /* @__PURE__ */ K(h, {
|
|
1675
2695
|
type: "button",
|
|
1676
2696
|
variant: "ghost",
|
|
1677
2697
|
size: "sm",
|
|
1678
2698
|
onClick: () => u(e),
|
|
1679
|
-
children: /* @__PURE__ */
|
|
2699
|
+
children: /* @__PURE__ */ K(z, { className: "w-4 h-4" })
|
|
1680
2700
|
})]
|
|
1681
|
-
}, e.id)), /* @__PURE__ */
|
|
2701
|
+
}, e.id)), /* @__PURE__ */ q("p", {
|
|
1682
2702
|
className: "text-xs text-muted-foreground",
|
|
1683
2703
|
children: [
|
|
1684
2704
|
o.length,
|
|
@@ -1686,59 +2706,59 @@ function It({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1686
2706
|
o.length === 1 ? "record" : "records"
|
|
1687
2707
|
]
|
|
1688
2708
|
})]
|
|
1689
|
-
}) : /* @__PURE__ */
|
|
1690
|
-
className:
|
|
1691
|
-
children: [/* @__PURE__ */
|
|
2709
|
+
}) : /* @__PURE__ */ q("div", {
|
|
2710
|
+
className: N("space-y-3", i),
|
|
2711
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1692
2712
|
className: "space-y-2",
|
|
1693
|
-
children: [o.map((e) => /* @__PURE__ */
|
|
2713
|
+
children: [o.map((e) => /* @__PURE__ */ q("div", {
|
|
1694
2714
|
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
1695
|
-
children: [/* @__PURE__ */
|
|
2715
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1696
2716
|
className: "flex items-center gap-2 flex-1",
|
|
1697
|
-
children: [/* @__PURE__ */
|
|
2717
|
+
children: [/* @__PURE__ */ K(m, {
|
|
1698
2718
|
variant: "outline",
|
|
1699
2719
|
children: e.id
|
|
1700
|
-
}), /* @__PURE__ */
|
|
2720
|
+
}), /* @__PURE__ */ K("span", {
|
|
1701
2721
|
className: "text-sm flex-1",
|
|
1702
2722
|
children: e.label
|
|
1703
2723
|
})]
|
|
1704
|
-
}), /* @__PURE__ */
|
|
2724
|
+
}), /* @__PURE__ */ q("div", {
|
|
1705
2725
|
className: "flex items-center gap-1",
|
|
1706
|
-
children: [/* @__PURE__ */
|
|
2726
|
+
children: [/* @__PURE__ */ K(h, {
|
|
1707
2727
|
type: "button",
|
|
1708
2728
|
variant: "ghost",
|
|
1709
2729
|
size: "sm",
|
|
1710
2730
|
onClick: () => u(e),
|
|
1711
|
-
children: /* @__PURE__ */
|
|
1712
|
-
}), /* @__PURE__ */
|
|
2731
|
+
children: /* @__PURE__ */ K(z, { className: "w-4 h-4" })
|
|
2732
|
+
}), /* @__PURE__ */ K(h, {
|
|
1713
2733
|
type: "button",
|
|
1714
2734
|
variant: "ghost",
|
|
1715
2735
|
size: "sm",
|
|
1716
2736
|
onClick: () => l(e.id),
|
|
1717
2737
|
disabled: a.disabled,
|
|
1718
|
-
children: /* @__PURE__ */
|
|
2738
|
+
children: /* @__PURE__ */ K(ke, { className: "w-4 h-4" })
|
|
1719
2739
|
})]
|
|
1720
2740
|
})]
|
|
1721
|
-
}, e.id)), o.length === 0 && /* @__PURE__ */
|
|
2741
|
+
}, e.id)), o.length === 0 && /* @__PURE__ */ K("div", {
|
|
1722
2742
|
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
1723
2743
|
children: "No related records"
|
|
1724
2744
|
})]
|
|
1725
|
-
}), /* @__PURE__ */
|
|
2745
|
+
}), /* @__PURE__ */ q(h, {
|
|
1726
2746
|
type: "button",
|
|
1727
2747
|
variant: "outline",
|
|
1728
2748
|
className: "w-full",
|
|
1729
2749
|
onClick: c,
|
|
1730
2750
|
disabled: a.disabled,
|
|
1731
2751
|
children: [
|
|
1732
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ K(Ce, { className: "w-4 h-4 mr-2" }),
|
|
1733
2753
|
"Add ",
|
|
1734
2754
|
s?.label || "Record"
|
|
1735
2755
|
]
|
|
1736
2756
|
})]
|
|
1737
2757
|
});
|
|
1738
2758
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
function
|
|
2759
|
+
var ir = Y((() => {}));
|
|
2760
|
+
Ie(), ze(), Ve(), qe(), Xe(), $e(), nt(), at(), lt(), ft(), ht(), Ft(), Rt(), Vt(), Wt(), qt(), Xt(), rn(), sn(), un(), pn(), gn(), yn(), Sn(), Tn(), On(), jn(), Pn(), Ln(), Bn(), Un(), Kn(), Yn(), Qn(), tr(), ir(), Ot(), Ie(), ze(), Ve(), qe(), Xe(), Rt(), Vt(), $e(), nt(), at(), lt(), Wt(), qt(), ft(), ht(), Ft(), wt(), Xt(), rn(), $t(), sn(), un(), pn(), gn(), yn(), Sn(), Tn(), On(), jn(), Pn(), Ln(), Bn(), Un(), Kn(), Yn(), Qn(), tr(), ir();
|
|
2761
|
+
function Q(e) {
|
|
1742
2762
|
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
|
|
1743
2763
|
if (e instanceof Date) return e.toISOString();
|
|
1744
2764
|
if (Array.isArray(e)) return e.map((e) => {
|
|
@@ -1754,7 +2774,7 @@ function W(e) {
|
|
|
1754
2774
|
}
|
|
1755
2775
|
return String(e);
|
|
1756
2776
|
}
|
|
1757
|
-
function
|
|
2777
|
+
function ar(e, t = "USD") {
|
|
1758
2778
|
try {
|
|
1759
2779
|
return new Intl.NumberFormat("en-US", {
|
|
1760
2780
|
style: "currency",
|
|
@@ -1764,7 +2784,7 @@ function Lt(e, t = "USD") {
|
|
|
1764
2784
|
return `${t} ${e.toFixed(2)}`;
|
|
1765
2785
|
}
|
|
1766
2786
|
}
|
|
1767
|
-
function
|
|
2787
|
+
function or(e, t = "USD") {
|
|
1768
2788
|
try {
|
|
1769
2789
|
return new Intl.NumberFormat("en-US", {
|
|
1770
2790
|
style: "currency",
|
|
@@ -1776,13 +2796,13 @@ function Rt(e, t = "USD") {
|
|
|
1776
2796
|
return `${t} ${e}`;
|
|
1777
2797
|
}
|
|
1778
2798
|
}
|
|
1779
|
-
function
|
|
2799
|
+
function sr(e, t = 0) {
|
|
1780
2800
|
return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(t)}%`;
|
|
1781
2801
|
}
|
|
1782
|
-
function
|
|
2802
|
+
function cr(e) {
|
|
1783
2803
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1784
2804
|
}
|
|
1785
|
-
function
|
|
2805
|
+
function lr(e) {
|
|
1786
2806
|
if (!e) return "—";
|
|
1787
2807
|
let t = typeof e == "string" ? new Date(e) : e;
|
|
1788
2808
|
if (isNaN(t.getTime())) return "—";
|
|
@@ -1792,20 +2812,20 @@ function Bt(e) {
|
|
|
1792
2812
|
if (a === -1) return "Yesterday";
|
|
1793
2813
|
if (a < -1) {
|
|
1794
2814
|
let e = Math.abs(a);
|
|
1795
|
-
return e <= 7 ? `Overdue ${e}d` :
|
|
2815
|
+
return e <= 7 ? `Overdue ${e}d` : ur(t);
|
|
1796
2816
|
}
|
|
1797
|
-
return a > 1 && a <= 7 ? `In ${a} days` :
|
|
2817
|
+
return a > 1 && a <= 7 ? `In ${a} days` : ur(t);
|
|
1798
2818
|
}
|
|
1799
|
-
function
|
|
2819
|
+
function ur(e, t) {
|
|
1800
2820
|
if (!e) return "—";
|
|
1801
2821
|
let n = typeof e == "string" ? new Date(e) : e;
|
|
1802
|
-
return isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ?
|
|
2822
|
+
return isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ? lr(n) : n.toLocaleDateString(void 0, {
|
|
1803
2823
|
year: "numeric",
|
|
1804
2824
|
month: "short",
|
|
1805
2825
|
day: "numeric"
|
|
1806
2826
|
});
|
|
1807
2827
|
}
|
|
1808
|
-
function
|
|
2828
|
+
function dr(e) {
|
|
1809
2829
|
if (!e) return "—";
|
|
1810
2830
|
let t = typeof e == "string" ? new Date(e) : e;
|
|
1811
2831
|
return isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
|
|
@@ -1816,17 +2836,17 @@ function Vt(e) {
|
|
|
1816
2836
|
minute: "2-digit"
|
|
1817
2837
|
});
|
|
1818
2838
|
}
|
|
1819
|
-
function
|
|
1820
|
-
let t =
|
|
1821
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
2839
|
+
function fr({ value: e }) {
|
|
2840
|
+
let t = Q(e);
|
|
2841
|
+
return t == null || t === "" ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ K("span", {
|
|
1822
2842
|
className: "truncate",
|
|
1823
2843
|
children: String(t)
|
|
1824
2844
|
});
|
|
1825
2845
|
}
|
|
1826
|
-
function
|
|
1827
|
-
if (e == null) return /* @__PURE__ */
|
|
1828
|
-
let n =
|
|
1829
|
-
return /* @__PURE__ */
|
|
2846
|
+
function pr({ value: e, field: t }) {
|
|
2847
|
+
if (e == null) return /* @__PURE__ */ K(S, {});
|
|
2848
|
+
let n = Q(e), r = t.precision ?? 0, i = Number(n);
|
|
2849
|
+
return /* @__PURE__ */ K("span", {
|
|
1830
2850
|
className: "tabular-nums",
|
|
1831
2851
|
children: isNaN(i) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
1832
2852
|
minimumFractionDigits: r,
|
|
@@ -1834,42 +2854,42 @@ function Ht({ value: e, field: t }) {
|
|
|
1834
2854
|
}).format(i)
|
|
1835
2855
|
});
|
|
1836
2856
|
}
|
|
1837
|
-
function
|
|
1838
|
-
if (e == null) return /* @__PURE__ */
|
|
1839
|
-
let n =
|
|
1840
|
-
return /* @__PURE__ */
|
|
2857
|
+
function mr({ value: e, field: t }) {
|
|
2858
|
+
if (e == null) return /* @__PURE__ */ K(S, {});
|
|
2859
|
+
let n = Q(e), r = t.currency || "USD", i = Number(n);
|
|
2860
|
+
return /* @__PURE__ */ K("span", {
|
|
1841
2861
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
1842
|
-
children: isNaN(i) ? String(n) :
|
|
2862
|
+
children: isNaN(i) ? String(n) : ar(i, r)
|
|
1843
2863
|
});
|
|
1844
2864
|
}
|
|
1845
|
-
var
|
|
1846
|
-
function
|
|
1847
|
-
if (e == null) return /* @__PURE__ */
|
|
1848
|
-
let n =
|
|
1849
|
-
if (isNaN(i)) return /* @__PURE__ */
|
|
2865
|
+
var hr = /progress|completion/;
|
|
2866
|
+
function gr({ value: e, field: t }) {
|
|
2867
|
+
if (e == null) return /* @__PURE__ */ K(S, {});
|
|
2868
|
+
let n = Q(e), r = t.precision ?? 0, i = Number(n);
|
|
2869
|
+
if (isNaN(i)) return /* @__PURE__ */ K("span", {
|
|
1850
2870
|
className: "tabular-nums whitespace-nowrap",
|
|
1851
2871
|
children: String(n)
|
|
1852
2872
|
});
|
|
1853
|
-
let a =
|
|
1854
|
-
return /* @__PURE__ */
|
|
2873
|
+
let a = hr.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : sr(i, r), c = Math.max(0, Math.min(100, o));
|
|
2874
|
+
return /* @__PURE__ */ q("div", {
|
|
1855
2875
|
className: "flex items-center gap-2",
|
|
1856
|
-
children: [/* @__PURE__ */
|
|
2876
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1857
2877
|
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",
|
|
1858
2878
|
role: "progressbar",
|
|
1859
2879
|
"aria-valuenow": c,
|
|
1860
2880
|
"aria-valuemin": 0,
|
|
1861
2881
|
"aria-valuemax": 100,
|
|
1862
|
-
children: /* @__PURE__ */
|
|
2882
|
+
children: /* @__PURE__ */ K("div", {
|
|
1863
2883
|
className: "h-full rounded-full bg-primary transition-all",
|
|
1864
2884
|
style: { width: `${c}%` }
|
|
1865
2885
|
})
|
|
1866
|
-
}), /* @__PURE__ */
|
|
2886
|
+
}), /* @__PURE__ */ K("span", {
|
|
1867
2887
|
className: "tabular-nums whitespace-nowrap",
|
|
1868
2888
|
children: s
|
|
1869
2889
|
})]
|
|
1870
2890
|
});
|
|
1871
2891
|
}
|
|
1872
|
-
var
|
|
2892
|
+
var _r = new Set([
|
|
1873
2893
|
"active",
|
|
1874
2894
|
"is_active",
|
|
1875
2895
|
"enabled",
|
|
@@ -1877,55 +2897,55 @@ var Kt = new Set([
|
|
|
1877
2897
|
"verified",
|
|
1878
2898
|
"is_verified"
|
|
1879
2899
|
]);
|
|
1880
|
-
function
|
|
1881
|
-
if (e == null) return /* @__PURE__ */
|
|
2900
|
+
function vr({ value: e, field: t }) {
|
|
2901
|
+
if (e == null) return /* @__PURE__ */ K("span", {
|
|
1882
2902
|
className: "flex items-center justify-center",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2903
|
+
children: /* @__PURE__ */ K(S, {})
|
|
1884
2904
|
});
|
|
1885
2905
|
let n = t?.name?.toLowerCase() || "";
|
|
1886
|
-
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */
|
|
2906
|
+
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ K("div", {
|
|
1887
2907
|
className: "flex items-center justify-center",
|
|
1888
|
-
children: e ? /* @__PURE__ */
|
|
2908
|
+
children: e ? /* @__PURE__ */ K("div", {
|
|
1889
2909
|
className: "size-5 rounded-full bg-green-500 flex items-center justify-center",
|
|
1890
2910
|
role: "img",
|
|
1891
2911
|
"aria-label": "Completed",
|
|
1892
2912
|
"data-testid": "completion-indicator",
|
|
1893
|
-
children: /* @__PURE__ */ F
|
|
1894
|
-
}) : /* @__PURE__ */
|
|
2913
|
+
children: /* @__PURE__ */ K(F, { className: "size-3 text-white" })
|
|
2914
|
+
}) : /* @__PURE__ */ K("div", {
|
|
1895
2915
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
1896
2916
|
role: "img",
|
|
1897
2917
|
"aria-label": "Not completed",
|
|
1898
2918
|
"data-testid": "completion-indicator"
|
|
1899
2919
|
})
|
|
1900
|
-
}) :
|
|
2920
|
+
}) : _r.has(n) && !e ? /* @__PURE__ */ q(m, {
|
|
1901
2921
|
variant: "destructive",
|
|
1902
2922
|
className: "text-xs",
|
|
1903
2923
|
"data-testid": "boolean-warning-badge",
|
|
1904
|
-
children: [t?.label ||
|
|
1905
|
-
}) : /* @__PURE__ */
|
|
2924
|
+
children: [t?.label || cr(n), " — Off"]
|
|
2925
|
+
}) : /* @__PURE__ */ K("div", {
|
|
1906
2926
|
className: "flex items-center justify-center",
|
|
1907
|
-
children: /* @__PURE__ */
|
|
2927
|
+
children: /* @__PURE__ */ K(g, {
|
|
1908
2928
|
checked: !!e,
|
|
1909
2929
|
disabled: !0,
|
|
1910
2930
|
className: "pointer-events-none"
|
|
1911
2931
|
})
|
|
1912
2932
|
});
|
|
1913
2933
|
}
|
|
1914
|
-
function
|
|
1915
|
-
if (!e) return /* @__PURE__ */
|
|
1916
|
-
let n =
|
|
2934
|
+
function yr({ value: e, field: t }) {
|
|
2935
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
2936
|
+
let n = Q(e), r = t, i = ur(n, r.format || "relative"), a = typeof n == "string" ? new Date(n) : n, o = a instanceof Date && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
|
|
1917
2937
|
s.setHours(0, 0, 0, 0);
|
|
1918
2938
|
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);
|
|
1919
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ K("span", {
|
|
1920
2940
|
className: `tabular-nums${l ? " text-red-600" : ""}`,
|
|
1921
2941
|
title: u,
|
|
1922
2942
|
children: i
|
|
1923
2943
|
});
|
|
1924
2944
|
}
|
|
1925
|
-
function
|
|
1926
|
-
if (!e) return /* @__PURE__ */
|
|
1927
|
-
let t =
|
|
1928
|
-
if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */
|
|
2945
|
+
function br({ value: e }) {
|
|
2946
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
2947
|
+
let t = Q(e), n = typeof t == "string" ? new Date(t) : t;
|
|
2948
|
+
if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */ K(S, {});
|
|
1929
2949
|
let r = n.toLocaleDateString(void 0, {
|
|
1930
2950
|
month: "numeric",
|
|
1931
2951
|
day: "numeric",
|
|
@@ -1935,15 +2955,15 @@ function Yt({ value: e }) {
|
|
|
1935
2955
|
minute: "2-digit",
|
|
1936
2956
|
hour12: !0
|
|
1937
2957
|
}).toLowerCase();
|
|
1938
|
-
return /* @__PURE__ */
|
|
2958
|
+
return /* @__PURE__ */ q("span", {
|
|
1939
2959
|
className: "tabular-nums text-sm whitespace-nowrap",
|
|
1940
|
-
children: [/* @__PURE__ */
|
|
2960
|
+
children: [/* @__PURE__ */ K("span", { children: r }), /* @__PURE__ */ K("span", {
|
|
1941
2961
|
className: "ml-2 text-muted-foreground",
|
|
1942
2962
|
children: i
|
|
1943
2963
|
})]
|
|
1944
2964
|
});
|
|
1945
2965
|
}
|
|
1946
|
-
var
|
|
2966
|
+
var xr = {
|
|
1947
2967
|
critical: "red",
|
|
1948
2968
|
urgent: "red",
|
|
1949
2969
|
high: "orange",
|
|
@@ -1975,7 +2995,7 @@ var Xt = {
|
|
|
1975
2995
|
overdue: "red",
|
|
1976
2996
|
delivered: "purple",
|
|
1977
2997
|
archived: "indigo"
|
|
1978
|
-
},
|
|
2998
|
+
}, Sr = {
|
|
1979
2999
|
gray: "bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60",
|
|
1980
3000
|
red: "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60",
|
|
1981
3001
|
orange: "bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60",
|
|
@@ -1985,7 +3005,7 @@ var Xt = {
|
|
|
1985
3005
|
indigo: "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60",
|
|
1986
3006
|
purple: "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60",
|
|
1987
3007
|
pink: "bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60"
|
|
1988
|
-
},
|
|
3008
|
+
}, Cr = [
|
|
1989
3009
|
"blue",
|
|
1990
3010
|
"green",
|
|
1991
3011
|
"purple",
|
|
@@ -1995,73 +3015,73 @@ var Xt = {
|
|
|
1995
3015
|
"yellow",
|
|
1996
3016
|
"red"
|
|
1997
3017
|
];
|
|
1998
|
-
function
|
|
3018
|
+
function wr(e) {
|
|
1999
3019
|
let t = 5381;
|
|
2000
3020
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e.charCodeAt(n);
|
|
2001
|
-
return
|
|
3021
|
+
return Cr[Math.abs(t) % Cr.length];
|
|
2002
3022
|
}
|
|
2003
|
-
function
|
|
2004
|
-
if (e &&
|
|
3023
|
+
function Tr(e, t) {
|
|
3024
|
+
if (e && Sr[e]) return Sr[e];
|
|
2005
3025
|
if (t == null || t === "") return "bg-muted text-muted-foreground border-border";
|
|
2006
|
-
let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r =
|
|
2007
|
-
return r &&
|
|
3026
|
+
let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r = xr[n];
|
|
3027
|
+
return r && Sr[r] ? Sr[r] : Sr[wr(n)];
|
|
2008
3028
|
}
|
|
2009
|
-
function
|
|
3029
|
+
function Er({ value: e, field: t }) {
|
|
2010
3030
|
let n = t.options || [];
|
|
2011
|
-
if (e == null || e === "") return /* @__PURE__ */
|
|
2012
|
-
if (Array.isArray(e)) return /* @__PURE__ */
|
|
3031
|
+
if (e == null || e === "") return /* @__PURE__ */ K(S, {});
|
|
3032
|
+
if (Array.isArray(e)) return /* @__PURE__ */ K("div", {
|
|
2013
3033
|
className: "flex flex-wrap gap-1",
|
|
2014
3034
|
children: e.map((e, t) => {
|
|
2015
|
-
let r = n.find((t) => t.value === e), i = r?.label ||
|
|
2016
|
-
return /* @__PURE__ */
|
|
3035
|
+
let r = n.find((t) => t.value === e), i = r?.label || cr(String(e));
|
|
3036
|
+
return /* @__PURE__ */ K(m, {
|
|
2017
3037
|
variant: "outline",
|
|
2018
|
-
className:
|
|
3038
|
+
className: Tr(r?.color, e),
|
|
2019
3039
|
children: i
|
|
2020
3040
|
}, t);
|
|
2021
3041
|
})
|
|
2022
3042
|
});
|
|
2023
|
-
let r = n.find((t) => t.value === e), i = r?.label ||
|
|
2024
|
-
return /* @__PURE__ */
|
|
3043
|
+
let r = n.find((t) => t.value === e), i = r?.label || cr(String(e));
|
|
3044
|
+
return /* @__PURE__ */ K(m, {
|
|
2025
3045
|
variant: "outline",
|
|
2026
|
-
className:
|
|
3046
|
+
className: Tr(r?.color, e),
|
|
2027
3047
|
children: i
|
|
2028
3048
|
});
|
|
2029
3049
|
}
|
|
2030
|
-
function
|
|
2031
|
-
if (!
|
|
2032
|
-
let
|
|
2033
|
-
return /* @__PURE__ */
|
|
3050
|
+
function Dr({ value: t }) {
|
|
3051
|
+
if (!t) return /* @__PURE__ */ K(S, {});
|
|
3052
|
+
let n = String(Q(t) ?? ""), [r, i] = e.useState(!1);
|
|
3053
|
+
return /* @__PURE__ */ q("span", {
|
|
2034
3054
|
className: "inline-flex items-center gap-1 group/email",
|
|
2035
|
-
children: [/* @__PURE__ */
|
|
3055
|
+
children: [/* @__PURE__ */ K(h, {
|
|
2036
3056
|
variant: "link",
|
|
2037
3057
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
2038
3058
|
asChild: !0,
|
|
2039
|
-
children: /* @__PURE__ */
|
|
2040
|
-
href: `mailto:${
|
|
3059
|
+
children: /* @__PURE__ */ K("a", {
|
|
3060
|
+
href: `mailto:${n}`,
|
|
2041
3061
|
onClick: (e) => e.stopPropagation(),
|
|
2042
|
-
children:
|
|
3062
|
+
children: n
|
|
2043
3063
|
})
|
|
2044
|
-
}), /* @__PURE__ */
|
|
3064
|
+
}), /* @__PURE__ */ K("button", {
|
|
2045
3065
|
type: "button",
|
|
2046
3066
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2047
3067
|
onClick: (e) => {
|
|
2048
|
-
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(
|
|
2049
|
-
|
|
3068
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(n).then(() => {
|
|
3069
|
+
i(!0), setTimeout(() => i(!1), 2e3);
|
|
2050
3070
|
}).catch(() => {});
|
|
2051
3071
|
},
|
|
2052
3072
|
"aria-label": "Copy email",
|
|
2053
|
-
children:
|
|
3073
|
+
children: r ? /* @__PURE__ */ K(F, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ K(I, { className: "h-3 w-3 text-muted-foreground" })
|
|
2054
3074
|
})]
|
|
2055
3075
|
});
|
|
2056
3076
|
}
|
|
2057
|
-
function
|
|
2058
|
-
if (!e) return /* @__PURE__ */
|
|
2059
|
-
let t = String(
|
|
2060
|
-
return /* @__PURE__ */
|
|
3077
|
+
function Or({ value: e }) {
|
|
3078
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
3079
|
+
let t = String(Q(e) ?? "");
|
|
3080
|
+
return /* @__PURE__ */ K(h, {
|
|
2061
3081
|
variant: "link",
|
|
2062
3082
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
2063
3083
|
asChild: !0,
|
|
2064
|
-
children: /* @__PURE__ */
|
|
3084
|
+
children: /* @__PURE__ */ K("a", {
|
|
2065
3085
|
href: t,
|
|
2066
3086
|
target: "_blank",
|
|
2067
3087
|
rel: "noopener noreferrer",
|
|
@@ -2070,34 +3090,34 @@ function tn({ value: e }) {
|
|
|
2070
3090
|
})
|
|
2071
3091
|
});
|
|
2072
3092
|
}
|
|
2073
|
-
function
|
|
2074
|
-
if (!
|
|
2075
|
-
let
|
|
2076
|
-
return /* @__PURE__ */
|
|
3093
|
+
function kr({ value: t }) {
|
|
3094
|
+
if (!t) return /* @__PURE__ */ K(S, {});
|
|
3095
|
+
let n = String(Q(t) ?? ""), [r, i] = e.useState(!1);
|
|
3096
|
+
return /* @__PURE__ */ q("span", {
|
|
2077
3097
|
className: "inline-flex items-center gap-1 group/phone",
|
|
2078
|
-
children: [/* @__PURE__ */
|
|
2079
|
-
href: `tel:${
|
|
3098
|
+
children: [/* @__PURE__ */ q("a", {
|
|
3099
|
+
href: `tel:${n}`,
|
|
2080
3100
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
2081
3101
|
onClick: (e) => e.stopPropagation(),
|
|
2082
|
-
children: [/* @__PURE__ */
|
|
2083
|
-
}), /* @__PURE__ */
|
|
3102
|
+
children: [/* @__PURE__ */ K(Se, { className: "h-3 w-3" }), n]
|
|
3103
|
+
}), /* @__PURE__ */ K("button", {
|
|
2084
3104
|
type: "button",
|
|
2085
3105
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2086
3106
|
onClick: (e) => {
|
|
2087
|
-
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(
|
|
2088
|
-
|
|
3107
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(n).then(() => {
|
|
3108
|
+
i(!0), setTimeout(() => i(!1), 2e3);
|
|
2089
3109
|
}).catch(() => {});
|
|
2090
3110
|
},
|
|
2091
3111
|
"aria-label": "Copy phone number",
|
|
2092
|
-
children:
|
|
3112
|
+
children: r ? /* @__PURE__ */ K(F, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ K(I, { className: "h-3 w-3 text-muted-foreground" })
|
|
2093
3113
|
})]
|
|
2094
3114
|
});
|
|
2095
3115
|
}
|
|
2096
|
-
function
|
|
2097
|
-
if (!e) return /* @__PURE__ */
|
|
3116
|
+
function Ar({ value: e, field: t }) {
|
|
3117
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
2098
3118
|
if (t.multiple, Array.isArray(e)) {
|
|
2099
3119
|
let t = e.length;
|
|
2100
|
-
return /* @__PURE__ */
|
|
3120
|
+
return /* @__PURE__ */ q("span", {
|
|
2101
3121
|
className: "text-sm text-gray-600",
|
|
2102
3122
|
children: [
|
|
2103
3123
|
t,
|
|
@@ -2106,30 +3126,30 @@ function rn({ value: e, field: t }) {
|
|
|
2106
3126
|
]
|
|
2107
3127
|
});
|
|
2108
3128
|
}
|
|
2109
|
-
return /* @__PURE__ */
|
|
3129
|
+
return /* @__PURE__ */ K("span", {
|
|
2110
3130
|
className: "text-sm truncate",
|
|
2111
3131
|
children: e.name || e.original_name || "File"
|
|
2112
3132
|
});
|
|
2113
3133
|
}
|
|
2114
|
-
function
|
|
2115
|
-
return e ? Array.isArray(e) ? /* @__PURE__ */
|
|
3134
|
+
function jr({ value: e }) {
|
|
3135
|
+
return e ? Array.isArray(e) ? /* @__PURE__ */ q("div", {
|
|
2116
3136
|
className: "flex -space-x-2",
|
|
2117
|
-
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */
|
|
3137
|
+
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */ K("img", {
|
|
2118
3138
|
src: e.url || "",
|
|
2119
3139
|
alt: e.name || `Image ${t + 1}`,
|
|
2120
3140
|
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
2121
|
-
}, t)), e.length > 3 && /* @__PURE__ */
|
|
3141
|
+
}, t)), e.length > 3 && /* @__PURE__ */ q("div", {
|
|
2122
3142
|
className: "size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600",
|
|
2123
3143
|
children: ["+", e.length - 3]
|
|
2124
3144
|
})]
|
|
2125
|
-
}) : /* @__PURE__ */
|
|
3145
|
+
}) : /* @__PURE__ */ K("img", {
|
|
2126
3146
|
src: e.url || "",
|
|
2127
3147
|
alt: e.name || "Image",
|
|
2128
3148
|
className: "size-10 rounded-md object-cover"
|
|
2129
|
-
}) : /* @__PURE__ */
|
|
3149
|
+
}) : /* @__PURE__ */ K(S, {});
|
|
2130
3150
|
}
|
|
2131
|
-
function
|
|
2132
|
-
if (e == null || e === "") return /* @__PURE__ */
|
|
3151
|
+
function Mr({ value: e, field: t }) {
|
|
3152
|
+
if (e == null || e === "") return /* @__PURE__ */ K(S, {});
|
|
2133
3153
|
let n = t.options || [], r = (e) => {
|
|
2134
3154
|
if (n.length > 0) {
|
|
2135
3155
|
let t = n.find((t) => String(t.value) === String(e));
|
|
@@ -2137,124 +3157,124 @@ function X({ value: e, field: t }) {
|
|
|
2137
3157
|
}
|
|
2138
3158
|
return String(e);
|
|
2139
3159
|
};
|
|
2140
|
-
return Array.isArray(e) ? /* @__PURE__ */
|
|
3160
|
+
return Array.isArray(e) ? /* @__PURE__ */ K("div", {
|
|
2141
3161
|
className: "flex flex-wrap gap-1",
|
|
2142
3162
|
children: e.map((e, t) => {
|
|
2143
3163
|
let n;
|
|
2144
|
-
return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */
|
|
3164
|
+
return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */ K("span", {
|
|
2145
3165
|
className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200",
|
|
2146
3166
|
children: n
|
|
2147
3167
|
}, t);
|
|
2148
3168
|
})
|
|
2149
|
-
}) : typeof e == "object" && e ? /* @__PURE__ */
|
|
3169
|
+
}) : typeof e == "object" && e ? /* @__PURE__ */ K("span", {
|
|
2150
3170
|
className: "truncate",
|
|
2151
3171
|
children: e.name || e.label || e.id || e._id || "[Object]"
|
|
2152
|
-
}) : /* @__PURE__ */
|
|
3172
|
+
}) : /* @__PURE__ */ K("span", {
|
|
2153
3173
|
className: "truncate",
|
|
2154
3174
|
children: r(e)
|
|
2155
3175
|
});
|
|
2156
3176
|
}
|
|
2157
|
-
function
|
|
2158
|
-
let t =
|
|
2159
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
3177
|
+
function Nr({ value: e }) {
|
|
3178
|
+
let t = Q(e);
|
|
3179
|
+
return t == null || t === "" ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ K("span", {
|
|
2160
3180
|
className: "text-gray-700 font-mono text-sm",
|
|
2161
3181
|
children: String(t)
|
|
2162
3182
|
});
|
|
2163
3183
|
}
|
|
2164
|
-
function
|
|
2165
|
-
if (!e) return /* @__PURE__ */
|
|
2166
|
-
if (typeof e != "object") return /* @__PURE__ */
|
|
3184
|
+
function Pr({ value: e }) {
|
|
3185
|
+
if (!e) return /* @__PURE__ */ K(S, {});
|
|
3186
|
+
if (typeof e != "object") return /* @__PURE__ */ K("span", {
|
|
2167
3187
|
className: "truncate",
|
|
2168
3188
|
children: String(e)
|
|
2169
3189
|
});
|
|
2170
|
-
if (Array.isArray(e)) return /* @__PURE__ */
|
|
3190
|
+
if (Array.isArray(e)) return /* @__PURE__ */ q("div", {
|
|
2171
3191
|
className: "flex -space-x-2",
|
|
2172
3192
|
children: [e.slice(0, 3).map((e, t) => {
|
|
2173
|
-
if (typeof e != "object" || !e) return /* @__PURE__ */
|
|
3193
|
+
if (typeof e != "object" || !e) return /* @__PURE__ */ K("span", {
|
|
2174
3194
|
className: "truncate text-sm",
|
|
2175
3195
|
children: String(e)
|
|
2176
3196
|
}, t);
|
|
2177
3197
|
let n = e.name || e.username || "User";
|
|
2178
|
-
return /* @__PURE__ */
|
|
3198
|
+
return /* @__PURE__ */ K(d, {
|
|
2179
3199
|
className: "size-8 border-2 border-white",
|
|
2180
3200
|
title: n,
|
|
2181
|
-
children: /* @__PURE__ */
|
|
3201
|
+
children: /* @__PURE__ */ K(f, {
|
|
2182
3202
|
className: "bg-blue-500 text-white text-xs",
|
|
2183
3203
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2184
3204
|
})
|
|
2185
3205
|
}, t);
|
|
2186
|
-
}), e.length > 3 && /* @__PURE__ */
|
|
3206
|
+
}), e.length > 3 && /* @__PURE__ */ K(d, {
|
|
2187
3207
|
className: "size-8 border-2 border-white",
|
|
2188
|
-
children: /* @__PURE__ */
|
|
3208
|
+
children: /* @__PURE__ */ q(f, {
|
|
2189
3209
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
2190
3210
|
children: ["+", e.length - 3]
|
|
2191
3211
|
})
|
|
2192
3212
|
})]
|
|
2193
3213
|
});
|
|
2194
3214
|
let t = e.name || e.username || "User";
|
|
2195
|
-
return /* @__PURE__ */
|
|
3215
|
+
return /* @__PURE__ */ q("div", {
|
|
2196
3216
|
className: "flex items-center gap-2",
|
|
2197
|
-
children: [/* @__PURE__ */
|
|
3217
|
+
children: [/* @__PURE__ */ K(d, {
|
|
2198
3218
|
className: "size-8",
|
|
2199
|
-
children: /* @__PURE__ */
|
|
3219
|
+
children: /* @__PURE__ */ K(f, {
|
|
2200
3220
|
className: "bg-blue-500 text-white text-xs",
|
|
2201
3221
|
children: t.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2202
3222
|
})
|
|
2203
|
-
}), /* @__PURE__ */
|
|
3223
|
+
}), /* @__PURE__ */ K("span", {
|
|
2204
3224
|
className: "truncate",
|
|
2205
3225
|
children: t
|
|
2206
3226
|
})]
|
|
2207
3227
|
});
|
|
2208
3228
|
}
|
|
2209
|
-
var
|
|
2210
|
-
function
|
|
2211
|
-
|
|
2212
|
-
}
|
|
2213
|
-
function
|
|
2214
|
-
return
|
|
2215
|
-
text:
|
|
2216
|
-
textarea:
|
|
2217
|
-
markdown:
|
|
2218
|
-
html:
|
|
2219
|
-
number:
|
|
2220
|
-
currency:
|
|
2221
|
-
percent:
|
|
2222
|
-
boolean:
|
|
2223
|
-
date:
|
|
2224
|
-
datetime:
|
|
2225
|
-
time:
|
|
2226
|
-
select:
|
|
2227
|
-
status:
|
|
2228
|
-
lookup:
|
|
2229
|
-
master_detail:
|
|
2230
|
-
email:
|
|
2231
|
-
url:
|
|
2232
|
-
phone:
|
|
2233
|
-
file:
|
|
2234
|
-
image:
|
|
2235
|
-
formula:
|
|
2236
|
-
summary:
|
|
2237
|
-
auto_number:
|
|
2238
|
-
user:
|
|
2239
|
-
owner:
|
|
2240
|
-
password: () => /* @__PURE__ */
|
|
2241
|
-
location:
|
|
2242
|
-
object: () => /* @__PURE__ */
|
|
3229
|
+
var Fr = /* @__PURE__ */ new Map();
|
|
3230
|
+
function Ir(e, t) {
|
|
3231
|
+
Fr.set(e, t);
|
|
3232
|
+
}
|
|
3233
|
+
function Lr(e) {
|
|
3234
|
+
return Fr.has(e) ? Fr.get(e) : {
|
|
3235
|
+
text: fr,
|
|
3236
|
+
textarea: fr,
|
|
3237
|
+
markdown: fr,
|
|
3238
|
+
html: fr,
|
|
3239
|
+
number: pr,
|
|
3240
|
+
currency: mr,
|
|
3241
|
+
percent: gr,
|
|
3242
|
+
boolean: vr,
|
|
3243
|
+
date: yr,
|
|
3244
|
+
datetime: br,
|
|
3245
|
+
time: fr,
|
|
3246
|
+
select: Er,
|
|
3247
|
+
status: Er,
|
|
3248
|
+
lookup: Mr,
|
|
3249
|
+
master_detail: Mr,
|
|
3250
|
+
email: Dr,
|
|
3251
|
+
url: Or,
|
|
3252
|
+
phone: kr,
|
|
3253
|
+
file: Ar,
|
|
3254
|
+
image: jr,
|
|
3255
|
+
formula: Nr,
|
|
3256
|
+
summary: Nr,
|
|
3257
|
+
auto_number: fr,
|
|
3258
|
+
user: Pr,
|
|
3259
|
+
owner: Pr,
|
|
3260
|
+
password: () => /* @__PURE__ */ K("span", { children: "••••••" }),
|
|
3261
|
+
location: fr,
|
|
3262
|
+
object: () => /* @__PURE__ */ K("span", {
|
|
2243
3263
|
className: "text-gray-500 italic",
|
|
2244
3264
|
children: "[Object]"
|
|
2245
3265
|
}),
|
|
2246
|
-
vector: () => /* @__PURE__ */
|
|
3266
|
+
vector: () => /* @__PURE__ */ K("span", {
|
|
2247
3267
|
className: "text-gray-500 italic",
|
|
2248
3268
|
children: "[Vector]"
|
|
2249
3269
|
}),
|
|
2250
|
-
grid: () => /* @__PURE__ */
|
|
3270
|
+
grid: () => /* @__PURE__ */ K("span", {
|
|
2251
3271
|
className: "text-gray-500 italic",
|
|
2252
3272
|
children: "[Grid]"
|
|
2253
3273
|
})
|
|
2254
|
-
}[e] ||
|
|
3274
|
+
}[e] || fr;
|
|
2255
3275
|
}
|
|
2256
|
-
|
|
2257
|
-
function
|
|
3276
|
+
Ir("lookup", Mr), Ir("master_detail", Mr), Ir("select", Er), Ir("status", Er), Ir("user", Pr), Ir("owner", Pr), Tt(Lr);
|
|
3277
|
+
function Rr(e) {
|
|
2258
3278
|
return {
|
|
2259
3279
|
text: "field:text",
|
|
2260
3280
|
textarea: "field:textarea",
|
|
@@ -2282,7 +3302,7 @@ function ln(e) {
|
|
|
2282
3302
|
auto_number: "field:auto_number"
|
|
2283
3303
|
}[e] || "field:text";
|
|
2284
3304
|
}
|
|
2285
|
-
function
|
|
3305
|
+
function zr(e) {
|
|
2286
3306
|
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
2287
3307
|
let t = [
|
|
2288
3308
|
"B",
|
|
@@ -2294,7 +3314,7 @@ function un(e) {
|
|
|
2294
3314
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
2295
3315
|
return `${n.toFixed(+(r > 0))} ${t[r]}`;
|
|
2296
3316
|
}
|
|
2297
|
-
function
|
|
3317
|
+
function Br(e) {
|
|
2298
3318
|
let t = {};
|
|
2299
3319
|
return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
|
|
2300
3320
|
value: e.min_length,
|
|
@@ -2319,7 +3339,7 @@ function dn(e) {
|
|
|
2319
3339
|
message: "Please enter a valid URL"
|
|
2320
3340
|
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
2321
3341
|
}
|
|
2322
|
-
function
|
|
3342
|
+
function Vr(e, t) {
|
|
2323
3343
|
if (!e) return !0;
|
|
2324
3344
|
if (e.field && e.value !== void 0) {
|
|
2325
3345
|
let n = t[e.field];
|
|
@@ -2331,107 +3351,107 @@ function fn(e, t) {
|
|
|
2331
3351
|
if (e.operator === "<=") return n <= e.value;
|
|
2332
3352
|
if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
|
|
2333
3353
|
}
|
|
2334
|
-
return e.and && Array.isArray(e.and) ? e.and.every((e) =>
|
|
2335
|
-
}
|
|
2336
|
-
function $(
|
|
2337
|
-
let
|
|
2338
|
-
let [
|
|
2339
|
-
name:
|
|
2340
|
-
label:
|
|
2341
|
-
type:
|
|
2342
|
-
placeholder:
|
|
2343
|
-
required:
|
|
2344
|
-
readonly:
|
|
2345
|
-
help:
|
|
2346
|
-
description:
|
|
2347
|
-
defaultValue:
|
|
2348
|
-
...
|
|
2349
|
-
}, l =
|
|
2350
|
-
s(e),
|
|
2351
|
-
}, [
|
|
2352
|
-
return /* @__PURE__ */
|
|
3354
|
+
return e.and && Array.isArray(e.and) ? e.and.every((e) => Vr(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => Vr(e, t)) : !0;
|
|
3355
|
+
}
|
|
3356
|
+
function $(t) {
|
|
3357
|
+
let n = ({ schema: n, className: r, value: i, ...a }) => {
|
|
3358
|
+
let [o, s] = e.useState(i ?? n?.value ?? ""), c = {
|
|
3359
|
+
name: n?.name || "field",
|
|
3360
|
+
label: n?.label,
|
|
3361
|
+
type: n?.type,
|
|
3362
|
+
placeholder: n?.placeholder,
|
|
3363
|
+
required: n?.required,
|
|
3364
|
+
readonly: n?.readonly || n?.readOnly,
|
|
3365
|
+
help: n?.help,
|
|
3366
|
+
description: n?.description,
|
|
3367
|
+
defaultValue: n?.defaultValue || n?.value,
|
|
3368
|
+
...n
|
|
3369
|
+
}, l = e.useCallback((e) => {
|
|
3370
|
+
s(e), a.onChange && a.onChange(e);
|
|
3371
|
+
}, [a]), u = n?.readonly || n?.readOnly || !1;
|
|
3372
|
+
return /* @__PURE__ */ q("div", {
|
|
2353
3373
|
className: "grid w-full items-center gap-1.5",
|
|
2354
|
-
"data-obj-id":
|
|
2355
|
-
"data-obj-type":
|
|
3374
|
+
"data-obj-id": n?.id,
|
|
3375
|
+
"data-obj-type": n?.type,
|
|
2356
3376
|
children: [
|
|
2357
|
-
|
|
2358
|
-
htmlFor:
|
|
2359
|
-
className:
|
|
2360
|
-
children:
|
|
3377
|
+
n?.label && /* @__PURE__ */ K("label", {
|
|
3378
|
+
htmlFor: n.id,
|
|
3379
|
+
className: n.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "",
|
|
3380
|
+
children: n.label
|
|
2361
3381
|
}),
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
value:
|
|
3382
|
+
/* @__PURE__ */ K(t, {
|
|
3383
|
+
value: o,
|
|
2364
3384
|
onChange: l,
|
|
2365
3385
|
field: c,
|
|
2366
3386
|
readonly: u,
|
|
2367
|
-
className:
|
|
3387
|
+
className: r
|
|
2368
3388
|
}),
|
|
2369
|
-
|
|
3389
|
+
n?.description && /* @__PURE__ */ K("p", {
|
|
2370
3390
|
className: "text-sm text-gray-500",
|
|
2371
|
-
children:
|
|
3391
|
+
children: n.description
|
|
2372
3392
|
})
|
|
2373
3393
|
]
|
|
2374
3394
|
});
|
|
2375
3395
|
};
|
|
2376
|
-
return
|
|
2377
|
-
}
|
|
2378
|
-
var
|
|
2379
|
-
text: () => Promise.resolve().then(() =>
|
|
2380
|
-
textarea: () => Promise.resolve().then(() =>
|
|
2381
|
-
number: () => Promise.resolve().then(() =>
|
|
2382
|
-
boolean: () => Promise.resolve().then(() =>
|
|
2383
|
-
select: () => Promise.resolve().then(() =>
|
|
2384
|
-
date: () => Promise.resolve().then(() =>
|
|
2385
|
-
datetime: () => Promise.resolve().then(() =>
|
|
2386
|
-
time: () => Promise.resolve().then(() =>
|
|
2387
|
-
email: () => Promise.resolve().then(() =>
|
|
2388
|
-
phone: () => Promise.resolve().then(() =>
|
|
2389
|
-
url: () => Promise.resolve().then(() =>
|
|
2390
|
-
currency: () => Promise.resolve().then(() =>
|
|
2391
|
-
percent: () => Promise.resolve().then(() =>
|
|
2392
|
-
password: () => Promise.resolve().then(() =>
|
|
2393
|
-
markdown: () => Promise.resolve().then(() =>
|
|
2394
|
-
html: () => Promise.resolve().then(() =>
|
|
2395
|
-
lookup: () =>
|
|
2396
|
-
master_detail: () => Promise.resolve().then(() =>
|
|
2397
|
-
file: () => Promise.resolve().then(() =>
|
|
2398
|
-
image: () => Promise.resolve().then(() =>
|
|
2399
|
-
location: () => Promise.resolve().then(() =>
|
|
2400
|
-
formula: () => Promise.resolve().then(() =>
|
|
2401
|
-
summary: () => Promise.resolve().then(() =>
|
|
2402
|
-
auto_number: () => Promise.resolve().then(() =>
|
|
2403
|
-
user: () => Promise.resolve().then(() =>
|
|
2404
|
-
owner: () => Promise.resolve().then(() =>
|
|
2405
|
-
object: () => Promise.resolve().then(() =>
|
|
2406
|
-
vector: () => Promise.resolve().then(() =>
|
|
2407
|
-
grid: () => Promise.resolve().then(() =>
|
|
2408
|
-
color: () => Promise.resolve().then(() =>
|
|
2409
|
-
slider: () => Promise.resolve().then(() =>
|
|
2410
|
-
rating: () => Promise.resolve().then(() =>
|
|
2411
|
-
code: () => Promise.resolve().then(() =>
|
|
2412
|
-
avatar: () => Promise.resolve().then(() =>
|
|
2413
|
-
address: () => Promise.resolve().then(() =>
|
|
2414
|
-
geolocation: () => Promise.resolve().then(() =>
|
|
2415
|
-
signature: () => Promise.resolve().then(() =>
|
|
2416
|
-
qrcode: () => Promise.resolve().then(() =>
|
|
3396
|
+
return n.displayName = `FieldRenderer(${t.displayName || t.name || "Component"})`, n;
|
|
3397
|
+
}
|
|
3398
|
+
var Hr = {
|
|
3399
|
+
text: () => Promise.resolve().then(() => (Ie(), Pe)).then((e) => ({ default: e.TextField })),
|
|
3400
|
+
textarea: () => Promise.resolve().then(() => (ft(), ut)).then((e) => ({ default: e.TextAreaField })),
|
|
3401
|
+
number: () => Promise.resolve().then(() => (ze(), Le)).then((e) => ({ default: e.NumberField })),
|
|
3402
|
+
boolean: () => Promise.resolve().then(() => (Ve(), Be)).then((e) => ({ default: e.BooleanField })),
|
|
3403
|
+
select: () => Promise.resolve().then(() => (qe(), Ge)).then((e) => ({ default: e.SelectField })),
|
|
3404
|
+
date: () => Promise.resolve().then(() => (Xe(), Je)).then((e) => ({ default: e.DateField })),
|
|
3405
|
+
datetime: () => Promise.resolve().then(() => (Rt(), It)).then((e) => ({ default: e.DateTimeField })),
|
|
3406
|
+
time: () => Promise.resolve().then(() => (Vt(), zt)).then((e) => ({ default: e.TimeField })),
|
|
3407
|
+
email: () => Promise.resolve().then(() => ($e(), Ze)).then((e) => ({ default: e.EmailField })),
|
|
3408
|
+
phone: () => Promise.resolve().then(() => (nt(), et)).then((e) => ({ default: e.PhoneField })),
|
|
3409
|
+
url: () => Promise.resolve().then(() => (at(), rt)).then((e) => ({ default: e.UrlField })),
|
|
3410
|
+
currency: () => Promise.resolve().then(() => (lt(), ot)).then((e) => ({ default: e.CurrencyField })),
|
|
3411
|
+
percent: () => Promise.resolve().then(() => (Wt(), Ht)).then((e) => ({ default: e.PercentField })),
|
|
3412
|
+
password: () => Promise.resolve().then(() => (qt(), Gt)).then((e) => ({ default: e.PasswordField })),
|
|
3413
|
+
markdown: () => Promise.resolve().then(() => (ht(), pt)).then((e) => ({ default: e.RichTextField })),
|
|
3414
|
+
html: () => Promise.resolve().then(() => (ht(), pt)).then((e) => ({ default: e.RichTextField })),
|
|
3415
|
+
lookup: () => Promise.resolve().then(() => (Ft(), kt)).then((e) => ({ default: e.LookupField })),
|
|
3416
|
+
master_detail: () => Promise.resolve().then(() => (ir(), nr)).then((e) => ({ default: e.MasterDetailField })),
|
|
3417
|
+
file: () => Promise.resolve().then(() => (Xt(), Jt)).then((e) => ({ default: e.FileField })),
|
|
3418
|
+
image: () => Promise.resolve().then(() => (rn(), en)).then((e) => ({ default: e.ImageField })),
|
|
3419
|
+
location: () => Promise.resolve().then(() => (sn(), an)).then((e) => ({ default: e.LocationField })),
|
|
3420
|
+
formula: () => Promise.resolve().then(() => (un(), cn)).then((e) => ({ default: e.FormulaField })),
|
|
3421
|
+
summary: () => Promise.resolve().then(() => (pn(), dn)).then((e) => ({ default: e.SummaryField })),
|
|
3422
|
+
auto_number: () => Promise.resolve().then(() => (gn(), mn)).then((e) => ({ default: e.AutoNumberField })),
|
|
3423
|
+
user: () => Promise.resolve().then(() => (yn(), _n)).then((e) => ({ default: e.UserField })),
|
|
3424
|
+
owner: () => Promise.resolve().then(() => (yn(), _n)).then((e) => ({ default: e.UserField })),
|
|
3425
|
+
object: () => Promise.resolve().then(() => (Sn(), bn)).then((e) => ({ default: e.ObjectField })),
|
|
3426
|
+
vector: () => Promise.resolve().then(() => (Tn(), Cn)).then((e) => ({ default: e.VectorField })),
|
|
3427
|
+
grid: () => Promise.resolve().then(() => (On(), En)).then((e) => ({ default: e.GridField })),
|
|
3428
|
+
color: () => Promise.resolve().then(() => (jn(), kn)).then((e) => ({ default: e.ColorField })),
|
|
3429
|
+
slider: () => Promise.resolve().then(() => (Pn(), Mn)).then((e) => ({ default: e.SliderField })),
|
|
3430
|
+
rating: () => Promise.resolve().then(() => (Ln(), Fn)).then((e) => ({ default: e.RatingField })),
|
|
3431
|
+
code: () => Promise.resolve().then(() => (Bn(), Rn)).then((e) => ({ default: e.CodeField })),
|
|
3432
|
+
avatar: () => Promise.resolve().then(() => (Un(), Vn)).then((e) => ({ default: e.AvatarField })),
|
|
3433
|
+
address: () => Promise.resolve().then(() => (Kn(), Wn)).then((e) => ({ default: e.AddressField })),
|
|
3434
|
+
geolocation: () => Promise.resolve().then(() => (Yn(), qn)).then((e) => ({ default: e.GeolocationField })),
|
|
3435
|
+
signature: () => Promise.resolve().then(() => (Qn(), Xn)).then((e) => ({ default: e.SignatureField })),
|
|
3436
|
+
qrcode: () => Promise.resolve().then(() => (tr(), $n)).then((e) => ({ default: e.QRCodeField }))
|
|
2417
3437
|
};
|
|
2418
|
-
function
|
|
2419
|
-
let
|
|
2420
|
-
if (!
|
|
2421
|
-
console.warn(`Unknown field type: ${
|
|
3438
|
+
function Ur(t) {
|
|
3439
|
+
let n = Hr[t];
|
|
3440
|
+
if (!n) {
|
|
3441
|
+
console.warn(`Unknown field type: ${t}`);
|
|
2422
3442
|
return;
|
|
2423
3443
|
}
|
|
2424
|
-
let
|
|
2425
|
-
|
|
3444
|
+
let r = e.lazy(n);
|
|
3445
|
+
u.register(t, r, { namespace: "field" });
|
|
2426
3446
|
}
|
|
2427
|
-
function
|
|
2428
|
-
Object.keys(
|
|
2429
|
-
|
|
3447
|
+
function Wr() {
|
|
3448
|
+
Object.keys(Hr).forEach((e) => {
|
|
3449
|
+
Ur(e);
|
|
2430
3450
|
});
|
|
2431
3451
|
}
|
|
2432
|
-
function
|
|
2433
|
-
|
|
3452
|
+
function Gr() {
|
|
3453
|
+
u.register("text", $(Fe), { namespace: "field" }), u.register("textarea", $(dt), { namespace: "field" }), u.register("number", $(Re), { namespace: "field" }), u.register("boolean", $(Z), { namespace: "field" }), u.register("select", $(Ke), { namespace: "field" }), u.register("date", $(Ye), { namespace: "field" }), u.register("datetime", $(Lt), { namespace: "field" }), u.register("time", $(Bt), { namespace: "field" }), u.register("email", $(Qe), { namespace: "field" }), u.register("phone", $(tt), { namespace: "field" }), u.register("url", $(it), { namespace: "field" }), u.register("currency", $(ct), { namespace: "field" }), u.register("percent", $(Ut), { namespace: "field" }), u.register("password", $(Kt), { namespace: "field" }), u.register("markdown", $(mt), { namespace: "field" }), u.register("html", $(mt), { namespace: "field" }), u.register("lookup", $(Mt), { namespace: "field" }), u.register("master_detail", $(rr), { namespace: "field" }), u.register("file", $(Yt), { namespace: "field" }), u.register("image", $(tn), { namespace: "field" }), u.register("location", $(on), { namespace: "field" }), u.register("formula", $(ln), { namespace: "field" }), u.register("summary", $(fn), { namespace: "field" }), u.register("auto_number", $(hn), { namespace: "field" }), u.register("user", $(vn), { namespace: "field" }), u.register("owner", $(vn), { namespace: "field" }), u.register("object", $(xn), { namespace: "field" }), u.register("vector", $(wn), { namespace: "field" }), u.register("grid", $(Dn), { namespace: "field" }), u.register("color", $(An), { namespace: "field" }), u.register("slider", $(Nn), { namespace: "field" }), u.register("rating", $(In), { namespace: "field" }), u.register("code", $(zn), { namespace: "field" }), u.register("avatar", $(Hn), { namespace: "field" }), u.register("address", $(Gn), { namespace: "field" }), u.register("geolocation", $(Jn), { namespace: "field" }), u.register("signature", $(Zn), { namespace: "field" }), u.register("qrcode", $(er), { namespace: "field" });
|
|
2434
3454
|
}
|
|
2435
|
-
|
|
3455
|
+
Wr();
|
|
2436
3456
|
//#endregion
|
|
2437
|
-
export {
|
|
3457
|
+
export { Gn as AddressField, hn as AutoNumberField, Hn as AvatarField, vr as BooleanCellRenderer, Z as BooleanField, zn as CodeField, An as ColorField, mr as CurrencyCellRenderer, ct as CurrencyField, yr as DateCellRenderer, Ye as DateField, br as DateTimeCellRenderer, Lt as DateTimeField, Dr as EmailCellRenderer, Qe as EmailField, Ar as FileCellRenderer, Yt as FileField, Nr as FormulaCellRenderer, ln as FormulaField, Jn as GeolocationField, Dn as GridField, jr as ImageCellRenderer, Qt as ImageCropperDialog, tn as ImageField, on as LocationField, Mr as LookupCellRenderer, Mt as LookupField, rr as MasterDetailField, pr as NumberCellRenderer, Re as NumberField, xn as ObjectField, Kt as PasswordField, gr as PercentCellRenderer, Ut as PercentField, kr as PhoneCellRenderer, tt as PhoneField, er as QRCodeField, In as RatingField, bt as RecordPickerDialog, mt as RichTextField, Er as SelectCellRenderer, Ke as SelectField, Zn as SignatureField, Nn as SliderField, fn as SummaryField, dt as TextAreaField, fr as TextCellRenderer, Fe as TextField, Bt as TimeField, Or as UrlCellRenderer, it as UrlField, Pr as UserCellRenderer, vn as UserField, wn as VectorField, Br as buildValidationRules, Q as coerceToSafeValue, Vr as evaluateCondition, or as formatCompactCurrency, ar as formatCurrency, ur as formatDate, dr as formatDateTime, zr as formatFileSize, sr as formatPercent, lr as formatRelativeDate, Lr as getCellRenderer, cr as humanizeLabel, Rr as mapFieldTypeToFormType, Wr as registerAllFields, Ur as registerField, Ir as registerFieldRenderer, Gr as registerFields };
|