@object-ui/fields 4.0.3 → 4.0.4
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 +21 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +574 -574
- package/package.json +7 -7
- package/dist/dist-BoLAKgtw.cjs +0 -1
- package/dist/dist-qtNk7SzD.js +0 -32
- /package/dist/{ImageCropperDialog-DXLQcwWZ.cjs → ImageCropperDialog-CK1apFXU.cjs} +0 -0
- /package/dist/{ImageCropperDialog-BYRMqcYm.js → ImageCropperDialog-DNvktnyM.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CAFD8bLK.js";
|
|
2
2
|
import { t } from "./useFieldTranslation-Bv3oUVgb.js";
|
|
3
3
|
import { i as n, r, t as i } from "./LookupField-XRxsGgLS.js";
|
|
4
|
-
import { t as a } from "./
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { t as a } from "./ImageCropperDialog-DNvktnyM.js";
|
|
5
|
+
import o, { Suspense as s, lazy as c, useCallback as l, useEffect as u, useId as d, useRef as f, useState as p } from "react";
|
|
6
|
+
import { ComponentRegistry as m } from "@object-ui/core";
|
|
7
|
+
import { Avatar as h, AvatarFallback as g, AvatarImage as _, Badge as v, Button as y, Checkbox as b, Dialog as x, DialogContent as S, DialogFooter as C, DialogHeader as w, DialogTitle as ee, EmptyValue as T, Input as E, Label as D, Select as O, SelectContent as k, SelectItem as te, SelectTrigger as ne, SelectValue as re, Slider as A, Switch as ie, Textarea as j, cn as M } from "@object-ui/components";
|
|
8
|
+
import { Camera as ae, Check as N, Copy as oe, Crop as se, Crosshair as ce, Eraser as le, ExternalLink as ue, Eye as de, EyeOff as fe, File as pe, Image as me, ImageIcon as he, Loader2 as ge, MapPin as _e, Maximize2 as ve, Phone as ye, Plus as be, QrCode as xe, Star as Se, Upload as Ce, X as P } from "lucide-react";
|
|
9
|
+
import { Fragment as we, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
10
|
+
import { useUpload as Te } from "@object-ui/providers";
|
|
11
11
|
//#region src/widgets/TextField.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
12
|
+
var Ee = /* @__PURE__ */ e({ TextField: () => De });
|
|
13
|
+
function De({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
14
14
|
let a = n || i.schema;
|
|
15
|
-
if (r) return /* @__PURE__ */
|
|
15
|
+
if (r) return /* @__PURE__ */ F("span", {
|
|
16
16
|
className: "text-sm",
|
|
17
|
-
children: e || /* @__PURE__ */
|
|
17
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
18
18
|
});
|
|
19
19
|
let o = a?.rows, { inputType: s, ...c } = i;
|
|
20
|
-
return o && o > 1 ? /* @__PURE__ */
|
|
20
|
+
return o && o > 1 ? /* @__PURE__ */ F(j, {
|
|
21
21
|
...c,
|
|
22
22
|
value: e || "",
|
|
23
23
|
onChange: (e) => t(e.target.value),
|
|
24
24
|
placeholder: a?.placeholder,
|
|
25
25
|
disabled: r || c.disabled
|
|
26
|
-
}) : /* @__PURE__ */
|
|
26
|
+
}) : /* @__PURE__ */ F(E, {
|
|
27
27
|
...c,
|
|
28
28
|
type: a?.type === "password" ? "password" : "text",
|
|
29
29
|
value: e || "",
|
|
@@ -34,14 +34,14 @@ function Ee({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/widgets/NumberField.tsx
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
37
|
+
var Oe = /* @__PURE__ */ e({ NumberField: () => ke });
|
|
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
40
|
className: "text-sm",
|
|
41
41
|
children: e
|
|
42
42
|
});
|
|
43
43
|
let a = n || i.schema, o = a?.precision, { inputType: s, ...c } = i;
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ F(E, {
|
|
45
45
|
...c,
|
|
46
46
|
type: "number",
|
|
47
47
|
value: e ?? "",
|
|
@@ -56,35 +56,35 @@ function Oe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/widgets/BooleanField.tsx
|
|
59
|
-
var
|
|
60
|
-
function
|
|
61
|
-
let a = n || i.schema, o = a?.widget, s =
|
|
62
|
-
if (r) return /* @__PURE__ */
|
|
59
|
+
var Ae = /* @__PURE__ */ e({ BooleanField: () => je });
|
|
60
|
+
function je({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
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", {
|
|
63
63
|
className: "text-sm",
|
|
64
64
|
children: e ? "Yes" : "No"
|
|
65
65
|
});
|
|
66
|
-
let { inputType: u, ...
|
|
67
|
-
return o === "checkbox" ? /* @__PURE__ */
|
|
66
|
+
let { inputType: u, ...f } = i;
|
|
67
|
+
return o === "checkbox" ? /* @__PURE__ */ I("div", {
|
|
68
68
|
className: "flex items-center space-x-2",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
-
...
|
|
69
|
+
children: [/* @__PURE__ */ F(b, {
|
|
70
|
+
...f,
|
|
71
71
|
id: c,
|
|
72
72
|
checked: !!e,
|
|
73
73
|
onCheckedChange: (e) => t(!!e),
|
|
74
|
-
disabled: r ||
|
|
75
|
-
}), /* @__PURE__ */
|
|
74
|
+
disabled: r || f.disabled
|
|
75
|
+
}), /* @__PURE__ */ F(D, {
|
|
76
76
|
htmlFor: c,
|
|
77
77
|
children: l
|
|
78
78
|
})]
|
|
79
|
-
}) : /* @__PURE__ */
|
|
79
|
+
}) : /* @__PURE__ */ I("div", {
|
|
80
80
|
className: "flex items-center space-x-2",
|
|
81
|
-
children: [/* @__PURE__ */
|
|
82
|
-
...
|
|
81
|
+
children: [/* @__PURE__ */ F(ie, {
|
|
82
|
+
...f,
|
|
83
83
|
id: c,
|
|
84
84
|
checked: !!e,
|
|
85
85
|
onCheckedChange: t,
|
|
86
|
-
disabled: r ||
|
|
87
|
-
}), /* @__PURE__ */
|
|
86
|
+
disabled: r || f.disabled
|
|
87
|
+
}), /* @__PURE__ */ F(D, {
|
|
88
88
|
htmlFor: c,
|
|
89
89
|
children: l
|
|
90
90
|
})]
|
|
@@ -92,28 +92,28 @@ function Ae({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/widgets/SelectField.tsx
|
|
95
|
-
var
|
|
96
|
-
function
|
|
95
|
+
var Me = /* @__PURE__ */ e({ SelectField: () => Ne });
|
|
96
|
+
function Ne({ value: e, onChange: n, field: r, readonly: i, ...a }) {
|
|
97
97
|
let o = r || a.schema, s = o?.options || [], { t: c } = t();
|
|
98
98
|
if (i) {
|
|
99
99
|
let t = s.find((t) => t.value === e)?.label || e;
|
|
100
|
-
return t ? /* @__PURE__ */
|
|
100
|
+
return t ? /* @__PURE__ */ F("span", {
|
|
101
101
|
className: "text-sm",
|
|
102
102
|
children: t
|
|
103
|
-
}) : /* @__PURE__ */
|
|
103
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
104
104
|
}
|
|
105
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ I(O, {
|
|
106
106
|
...a,
|
|
107
107
|
value: e,
|
|
108
108
|
onValueChange: n,
|
|
109
109
|
disabled: i || a.disabled,
|
|
110
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ F(ne, {
|
|
111
111
|
className: a.className,
|
|
112
112
|
id: a.id,
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
}), /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ F(re, { placeholder: o?.placeholder || c("common.selectOption") })
|
|
114
|
+
}), /* @__PURE__ */ F(k, {
|
|
115
115
|
position: "popper",
|
|
116
|
-
children: s.map((e) => /* @__PURE__ */
|
|
116
|
+
children: s.map((e) => /* @__PURE__ */ F(te, {
|
|
117
117
|
value: e.value,
|
|
118
118
|
children: e.label
|
|
119
119
|
}, e.value))
|
|
@@ -122,14 +122,14 @@ function Me({ value: e, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/widgets/DateField.tsx
|
|
125
|
-
var
|
|
126
|
-
function
|
|
127
|
-
if (r) return e ? /* @__PURE__ */
|
|
125
|
+
var Pe = /* @__PURE__ */ e({ DateField: () => Fe });
|
|
126
|
+
function Fe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
127
|
+
if (r) return e ? /* @__PURE__ */ F("span", {
|
|
128
128
|
className: "text-sm",
|
|
129
129
|
children: new Date(e).toLocaleDateString()
|
|
130
|
-
}) : /* @__PURE__ */
|
|
130
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
131
131
|
let { inputType: a, ...o } = i;
|
|
132
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ F(E, {
|
|
133
133
|
...o,
|
|
134
134
|
type: "date",
|
|
135
135
|
value: e || "",
|
|
@@ -139,16 +139,16 @@ function Pe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/widgets/EmailField.tsx
|
|
142
|
-
var
|
|
143
|
-
function
|
|
142
|
+
var Ie = /* @__PURE__ */ e({ EmailField: () => Le });
|
|
143
|
+
function Le({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
144
144
|
let o = n || a.schema;
|
|
145
|
-
if (r) return e ? /* @__PURE__ */
|
|
145
|
+
if (r) return e ? /* @__PURE__ */ F("a", {
|
|
146
146
|
href: `mailto:${e}`,
|
|
147
147
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
148
148
|
children: e
|
|
149
|
-
}) : /* @__PURE__ */
|
|
149
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
150
150
|
let { inputType: s, ...c } = a;
|
|
151
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ F(E, {
|
|
152
152
|
...c,
|
|
153
153
|
type: "email",
|
|
154
154
|
value: e || "",
|
|
@@ -160,16 +160,16 @@ function Ie({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/widgets/PhoneField.tsx
|
|
163
|
-
var
|
|
164
|
-
function
|
|
163
|
+
var Re = /* @__PURE__ */ e({ PhoneField: () => ze });
|
|
164
|
+
function ze({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
165
165
|
let o = n || a.schema;
|
|
166
|
-
if (r) return e ? /* @__PURE__ */
|
|
166
|
+
if (r) return e ? /* @__PURE__ */ F("a", {
|
|
167
167
|
href: `tel:${e}`,
|
|
168
168
|
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
169
169
|
children: e
|
|
170
|
-
}) : /* @__PURE__ */
|
|
170
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
171
171
|
let { inputType: s, ...c } = a;
|
|
172
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ F(E, {
|
|
173
173
|
...c,
|
|
174
174
|
type: "tel",
|
|
175
175
|
value: e || "",
|
|
@@ -181,21 +181,21 @@ function Re({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/widgets/UrlField.tsx
|
|
184
|
-
var
|
|
185
|
-
function
|
|
184
|
+
var Be = /* @__PURE__ */ e({ UrlField: () => Ve });
|
|
185
|
+
function Ve({ 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__ */ F("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__ */ F("span", {
|
|
194
194
|
className: "text-sm",
|
|
195
195
|
children: e
|
|
196
|
-
}) : /* @__PURE__ */
|
|
196
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
197
197
|
let { inputType: s, ...c } = a;
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ F(E, {
|
|
199
199
|
...c,
|
|
200
200
|
type: "url",
|
|
201
201
|
value: e || "",
|
|
@@ -207,8 +207,8 @@ function Be({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region src/widgets/CurrencyField.tsx
|
|
210
|
-
var
|
|
211
|
-
function
|
|
210
|
+
var He = /* @__PURE__ */ e({ CurrencyField: () => We });
|
|
211
|
+
function Ue(e, t = "USD") {
|
|
212
212
|
try {
|
|
213
213
|
return new Intl.NumberFormat("en-US", {
|
|
214
214
|
style: "currency",
|
|
@@ -218,22 +218,22 @@ function He(e, t = "USD") {
|
|
|
218
218
|
return `${t} ${e.toFixed(2)}`;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function We({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
222
222
|
let s = n || o.schema, c = s?.currency || "USD", l = s?.precision ?? 2;
|
|
223
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
223
|
+
if (r) return e == null ? /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ F("span", {
|
|
224
224
|
className: "text-sm font-medium tabular-nums",
|
|
225
|
-
children:
|
|
225
|
+
children: Ue(Number(e), c)
|
|
226
226
|
});
|
|
227
227
|
let u = (e) => {
|
|
228
228
|
let n = parseFloat(e.target.value);
|
|
229
229
|
isNaN(n) || t(parseFloat(n.toFixed(l)));
|
|
230
230
|
};
|
|
231
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ I("div", {
|
|
232
232
|
className: "relative",
|
|
233
|
-
children: [/* @__PURE__ */
|
|
233
|
+
children: [/* @__PURE__ */ F("span", {
|
|
234
234
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
235
235
|
children: c === "USD" ? "$" : c
|
|
236
|
-
}), /* @__PURE__ */
|
|
236
|
+
}), /* @__PURE__ */ F(E, {
|
|
237
237
|
...o,
|
|
238
238
|
type: "number",
|
|
239
239
|
value: e ?? "",
|
|
@@ -251,40 +251,40 @@ function Ue({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
253
|
//#region src/widgets/TextAreaField.tsx
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
-
if (r) return /* @__PURE__ */
|
|
254
|
+
var Ge = /* @__PURE__ */ e({ TextAreaField: () => Ke });
|
|
255
|
+
function Ke({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
256
|
+
if (r) return /* @__PURE__ */ F("div", {
|
|
257
257
|
className: "text-sm whitespace-pre-wrap",
|
|
258
|
-
children: e || /* @__PURE__ */
|
|
258
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
259
259
|
});
|
|
260
|
-
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length, l = !!(a.mobileFullscreen ?? o?.mobile_fullscreen ?? a.mobile_fullscreen ?? a.schema?.mobile_fullscreen), [u, d] =
|
|
261
|
-
|
|
260
|
+
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length, l = !!(a.mobileFullscreen ?? o?.mobile_fullscreen ?? a.mobile_fullscreen ?? a.schema?.mobile_fullscreen), [u, d] = p(!1), [f, m] = p(e ?? ""), h = () => {
|
|
261
|
+
m(e ?? ""), d(!0);
|
|
262
262
|
}, g = () => d(!1), _ = () => {
|
|
263
263
|
t(f), d(!1);
|
|
264
|
-
}, { inputType: v, mobileFullscreen:
|
|
265
|
-
return /* @__PURE__ */
|
|
264
|
+
}, { inputType: v, mobileFullscreen: b, ...E } = a;
|
|
265
|
+
return /* @__PURE__ */ I("div", {
|
|
266
266
|
className: "relative",
|
|
267
267
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
...
|
|
268
|
+
/* @__PURE__ */ F(j, {
|
|
269
|
+
...E,
|
|
270
270
|
value: e || "",
|
|
271
271
|
onChange: (e) => t(e.target.value),
|
|
272
272
|
placeholder: o?.placeholder,
|
|
273
|
-
disabled: r ||
|
|
273
|
+
disabled: r || E.disabled,
|
|
274
274
|
rows: s,
|
|
275
275
|
maxLength: c,
|
|
276
276
|
"aria-invalid": !!i,
|
|
277
|
-
className:
|
|
277
|
+
className: E.className
|
|
278
278
|
}),
|
|
279
|
-
l && /* @__PURE__ */
|
|
279
|
+
l && /* @__PURE__ */ F("button", {
|
|
280
280
|
type: "button",
|
|
281
281
|
onClick: h,
|
|
282
282
|
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
283
|
"aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
|
|
284
284
|
"data-testid": "textarea-fullscreen-toggle",
|
|
285
|
-
children: /* @__PURE__ */
|
|
285
|
+
children: /* @__PURE__ */ F(ve, { className: "size-3.5" })
|
|
286
286
|
}),
|
|
287
|
-
c && /* @__PURE__ */
|
|
287
|
+
c && /* @__PURE__ */ I("div", {
|
|
288
288
|
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
289
289
|
"aria-live": "polite",
|
|
290
290
|
"aria-label": `Character count: ${(e || "").length} of ${c}`,
|
|
@@ -294,53 +294,53 @@ function Ge({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
294
294
|
c
|
|
295
295
|
]
|
|
296
296
|
}),
|
|
297
|
-
l && /* @__PURE__ */
|
|
297
|
+
l && /* @__PURE__ */ F(x, {
|
|
298
298
|
open: u,
|
|
299
299
|
onOpenChange: d,
|
|
300
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ I(S, {
|
|
301
301
|
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
302
|
"data-testid": "textarea-fullscreen-dialog",
|
|
303
303
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ F(w, {
|
|
305
305
|
className: "p-4 border-b",
|
|
306
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ F(ee, {
|
|
307
307
|
className: "text-base",
|
|
308
308
|
children: o?.label ?? "Edit text"
|
|
309
309
|
})
|
|
310
310
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ F("div", {
|
|
312
312
|
className: "flex-1 min-h-0 p-4",
|
|
313
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ F(j, {
|
|
314
314
|
autoFocus: !0,
|
|
315
315
|
value: f,
|
|
316
|
-
onChange: (e) =>
|
|
316
|
+
onChange: (e) => m(e.target.value),
|
|
317
317
|
maxLength: c,
|
|
318
318
|
placeholder: o?.placeholder,
|
|
319
319
|
className: "h-full min-h-full resize-none text-base",
|
|
320
320
|
"data-testid": "textarea-fullscreen-input"
|
|
321
321
|
})
|
|
322
322
|
}),
|
|
323
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ I(C, {
|
|
324
324
|
className: "p-3 border-t flex-row justify-between sm:justify-end gap-2",
|
|
325
|
-
children: [c && /* @__PURE__ */
|
|
325
|
+
children: [c && /* @__PURE__ */ I("span", {
|
|
326
326
|
className: "text-xs text-muted-foreground self-center",
|
|
327
327
|
children: [
|
|
328
328
|
f.length,
|
|
329
329
|
"/",
|
|
330
330
|
c
|
|
331
331
|
]
|
|
332
|
-
}), /* @__PURE__ */
|
|
332
|
+
}), /* @__PURE__ */ I("div", {
|
|
333
333
|
className: "flex gap-2 ml-auto",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ I(y, {
|
|
335
335
|
type: "button",
|
|
336
336
|
variant: "ghost",
|
|
337
337
|
onClick: g,
|
|
338
|
-
children: [/* @__PURE__ */
|
|
339
|
-
}), /* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ F(P, { className: "size-4 mr-1" }), " Cancel"]
|
|
339
|
+
}), /* @__PURE__ */ I(y, {
|
|
340
340
|
type: "button",
|
|
341
341
|
onClick: _,
|
|
342
342
|
"data-testid": "textarea-fullscreen-save",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
343
|
+
children: [/* @__PURE__ */ F(N, { className: "size-4 mr-1" }), " Done"]
|
|
344
344
|
})]
|
|
345
345
|
})]
|
|
346
346
|
})
|
|
@@ -352,22 +352,22 @@ function Ge({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
352
352
|
}
|
|
353
353
|
//#endregion
|
|
354
354
|
//#region src/widgets/RichTextField.tsx
|
|
355
|
-
var
|
|
356
|
-
function
|
|
357
|
-
if (r) return /* @__PURE__ */
|
|
355
|
+
var qe = /* @__PURE__ */ e({ RichTextField: () => L });
|
|
356
|
+
function L({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
357
|
+
if (r) return /* @__PURE__ */ F("div", {
|
|
358
358
|
className: "text-sm prose prose-sm max-w-none",
|
|
359
|
-
children: e || /* @__PURE__ */
|
|
359
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
360
360
|
});
|
|
361
361
|
let o = n || a.schema, s = o?.rows || 8;
|
|
362
|
-
return /* @__PURE__ */
|
|
362
|
+
return /* @__PURE__ */ I("div", {
|
|
363
363
|
className: "space-y-2",
|
|
364
|
-
children: [/* @__PURE__ */
|
|
364
|
+
children: [/* @__PURE__ */ I("div", {
|
|
365
365
|
className: "flex items-center justify-between text-xs text-gray-500",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
366
|
+
children: [/* @__PURE__ */ I("span", { children: ["Format: ", o?.format || "markdown"] }), /* @__PURE__ */ F("span", {
|
|
367
367
|
className: "italic",
|
|
368
368
|
children: "Rich text editor (basic)"
|
|
369
369
|
})]
|
|
370
|
-
}), /* @__PURE__ */
|
|
370
|
+
}), /* @__PURE__ */ F(j, {
|
|
371
371
|
value: e || "",
|
|
372
372
|
onChange: (e) => t(e.target.value),
|
|
373
373
|
placeholder: o?.placeholder || "Enter text...",
|
|
@@ -380,12 +380,12 @@ function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a
|
|
|
380
380
|
}
|
|
381
381
|
//#endregion
|
|
382
382
|
//#region src/widgets/DateTimeField.tsx
|
|
383
|
-
var
|
|
384
|
-
function
|
|
383
|
+
var Je = /* @__PURE__ */ e({ DateTimeField: () => Ye });
|
|
384
|
+
function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
385
385
|
if (r) {
|
|
386
|
-
if (!e) return /* @__PURE__ */
|
|
386
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
387
387
|
let t = new Date(e);
|
|
388
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ I("span", {
|
|
389
389
|
className: "text-sm",
|
|
390
390
|
children: [
|
|
391
391
|
t.toLocaleDateString(),
|
|
@@ -395,7 +395,7 @@ function Je({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
397
|
let { inputType: a, ...o } = i;
|
|
398
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ F(E, {
|
|
399
399
|
...o,
|
|
400
400
|
type: "datetime-local",
|
|
401
401
|
value: e || "",
|
|
@@ -405,14 +405,14 @@ function Je({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
405
405
|
}
|
|
406
406
|
//#endregion
|
|
407
407
|
//#region src/widgets/TimeField.tsx
|
|
408
|
-
var
|
|
409
|
-
function
|
|
410
|
-
if (r) return /* @__PURE__ */
|
|
408
|
+
var Xe = /* @__PURE__ */ e({ TimeField: () => Ze });
|
|
409
|
+
function Ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
410
|
+
if (r) return /* @__PURE__ */ F("span", {
|
|
411
411
|
className: "text-sm",
|
|
412
|
-
children: e || /* @__PURE__ */
|
|
412
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
413
413
|
});
|
|
414
414
|
let { inputType: a, ...o } = i;
|
|
415
|
-
return /* @__PURE__ */
|
|
415
|
+
return /* @__PURE__ */ F(E, {
|
|
416
416
|
...o,
|
|
417
417
|
type: "time",
|
|
418
418
|
value: e || "",
|
|
@@ -422,10 +422,10 @@ function Xe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
422
422
|
}
|
|
423
423
|
//#endregion
|
|
424
424
|
//#region src/widgets/PercentField.tsx
|
|
425
|
-
var
|
|
426
|
-
function
|
|
425
|
+
var Qe = /* @__PURE__ */ e({ PercentField: () => R });
|
|
426
|
+
function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
427
427
|
let s = n || o.schema, c = s?.precision ?? 2;
|
|
428
|
-
if (r) return e == null ? /* @__PURE__ */
|
|
428
|
+
if (r) return e == null ? /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ I("span", {
|
|
429
429
|
className: "text-sm font-medium tabular-nums",
|
|
430
430
|
children: [(e * 100).toFixed(c), "%"]
|
|
431
431
|
});
|
|
@@ -445,11 +445,11 @@ function z({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
445
445
|
let n = e[0];
|
|
446
446
|
t(typeof n == "number" ? n / 100 : null);
|
|
447
447
|
}, p = 10 ** -c;
|
|
448
|
-
return /* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ I("div", {
|
|
449
449
|
className: "space-y-2",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
450
|
+
children: [/* @__PURE__ */ I("div", {
|
|
451
451
|
className: "relative",
|
|
452
|
-
children: [/* @__PURE__ */
|
|
452
|
+
children: [/* @__PURE__ */ F(E, {
|
|
453
453
|
...o,
|
|
454
454
|
type: "number",
|
|
455
455
|
value: l,
|
|
@@ -459,11 +459,11 @@ function z({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
459
459
|
className: `pr-8 ${a || ""}`,
|
|
460
460
|
step: (10 ** -c).toFixed(c),
|
|
461
461
|
"aria-invalid": !!i
|
|
462
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ F("span", {
|
|
463
463
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
464
464
|
children: "%"
|
|
465
465
|
})]
|
|
466
|
-
}), /* @__PURE__ */
|
|
466
|
+
}), /* @__PURE__ */ F(A, {
|
|
467
467
|
value: [u],
|
|
468
468
|
onValueChange: f,
|
|
469
469
|
min: 0,
|
|
@@ -478,17 +478,17 @@ function z({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, clas
|
|
|
478
478
|
}
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/widgets/PasswordField.tsx
|
|
481
|
-
var
|
|
482
|
-
function
|
|
483
|
-
let [o, s] =
|
|
484
|
-
if (r) return /* @__PURE__ */
|
|
481
|
+
var $e = /* @__PURE__ */ e({ PasswordField: () => z });
|
|
482
|
+
function z({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
483
|
+
let [o, s] = p(!1), c = n || a.schema;
|
|
484
|
+
if (r) return /* @__PURE__ */ F("span", {
|
|
485
485
|
className: "text-sm",
|
|
486
486
|
children: "••••••••"
|
|
487
487
|
});
|
|
488
488
|
let { inputType: l, ...u } = a;
|
|
489
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ I("div", {
|
|
490
490
|
className: "relative",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ F(E, {
|
|
492
492
|
...u,
|
|
493
493
|
type: o ? "text" : "password",
|
|
494
494
|
value: e || "",
|
|
@@ -496,36 +496,36 @@ function B({ value: e, onChange: t, field: n, readonly: r, className: i, ...a })
|
|
|
496
496
|
placeholder: c?.placeholder,
|
|
497
497
|
disabled: r || u.disabled,
|
|
498
498
|
className: `pr-10 ${i || ""}`
|
|
499
|
-
}), /* @__PURE__ */
|
|
499
|
+
}), /* @__PURE__ */ F(y, {
|
|
500
500
|
type: "button",
|
|
501
501
|
variant: "ghost",
|
|
502
502
|
size: "sm",
|
|
503
503
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
504
504
|
onClick: () => s(!o),
|
|
505
505
|
tabIndex: -1,
|
|
506
|
-
children:
|
|
506
|
+
children: F(o ? fe : de, { className: "size-4 text-gray-500" })
|
|
507
507
|
})]
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
//#endregion
|
|
511
511
|
//#region src/widgets/FileField.tsx
|
|
512
|
-
var
|
|
513
|
-
function
|
|
514
|
-
let
|
|
512
|
+
var et = /* @__PURE__ */ e({ FileField: () => B });
|
|
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) => {
|
|
515
515
|
if (e.length === 0) return;
|
|
516
516
|
let n = [], r = e.filter((e) => {
|
|
517
|
-
if (
|
|
518
|
-
let t = (
|
|
517
|
+
if (d && e.size > d) {
|
|
518
|
+
let t = (d / (1024 * 1024)).toFixed(1);
|
|
519
519
|
return n.push(`"${e.name}" exceeds max size (${t} MB)`), !1;
|
|
520
520
|
}
|
|
521
521
|
return !0;
|
|
522
522
|
});
|
|
523
|
-
if (
|
|
524
|
-
|
|
523
|
+
if (S(n), r.length !== 0) {
|
|
524
|
+
D(!0);
|
|
525
525
|
try {
|
|
526
526
|
let e = (await Promise.all(r.map(async (e) => {
|
|
527
527
|
try {
|
|
528
|
-
let t = await
|
|
528
|
+
let t = await C(e, { onProgress: (t) => ee((n) => ({
|
|
529
529
|
...n,
|
|
530
530
|
[e.name]: t
|
|
531
531
|
})) });
|
|
@@ -537,142 +537,142 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
537
537
|
url: t.url
|
|
538
538
|
};
|
|
539
539
|
} catch (t) {
|
|
540
|
-
return n.push(`Failed to upload "${e.name}": ${t.message}`),
|
|
540
|
+
return n.push(`Failed to upload "${e.name}": ${t.message}`), S([...n]), null;
|
|
541
541
|
}
|
|
542
542
|
}))).filter(Boolean);
|
|
543
543
|
if (e.length === 0) return;
|
|
544
|
-
t(
|
|
544
|
+
t(c ? [...O, ...e] : e[0]);
|
|
545
545
|
} finally {
|
|
546
|
-
|
|
546
|
+
D(!1), ee({});
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
}, [
|
|
550
|
-
|
|
551
|
-
|
|
550
|
+
O,
|
|
551
|
+
c,
|
|
552
552
|
t,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
]), te =
|
|
556
|
-
e.preventDefault(), e.stopPropagation(),
|
|
557
|
-
}, []), ne =
|
|
558
|
-
e.preventDefault(), e.stopPropagation(),
|
|
559
|
-
}, []), re =
|
|
560
|
-
e.preventDefault(), e.stopPropagation(),
|
|
553
|
+
d,
|
|
554
|
+
C
|
|
555
|
+
]), te = l((e) => {
|
|
556
|
+
e.preventDefault(), e.stopPropagation(), b(!0);
|
|
557
|
+
}, []), ne = l((e) => {
|
|
558
|
+
e.preventDefault(), e.stopPropagation(), b(!1);
|
|
559
|
+
}, []), re = l((e) => {
|
|
560
|
+
e.preventDefault(), e.stopPropagation(), b(!1);
|
|
561
561
|
let t = Array.from(e.dataTransfer.files);
|
|
562
|
-
if (
|
|
563
|
-
let e =
|
|
564
|
-
|
|
562
|
+
if (u) {
|
|
563
|
+
let e = u.split(",").map((e) => e.trim().toLowerCase());
|
|
564
|
+
k(t.filter((t) => {
|
|
565
565
|
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
566
566
|
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
567
567
|
}));
|
|
568
|
-
} else
|
|
569
|
-
}, [
|
|
570
|
-
if (r) return e ? /* @__PURE__ */
|
|
568
|
+
} else k(t);
|
|
569
|
+
}, [u, k]);
|
|
570
|
+
if (r) return e ? /* @__PURE__ */ F("div", {
|
|
571
571
|
className: "flex flex-wrap gap-2",
|
|
572
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
572
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ F("span", {
|
|
573
573
|
className: "text-sm truncate max-w-xs",
|
|
574
574
|
children: e.name || e.original_name || "File"
|
|
575
575
|
}, t))
|
|
576
|
-
}) : /* @__PURE__ */
|
|
577
|
-
let
|
|
578
|
-
|
|
576
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
577
|
+
let A = (e) => {
|
|
578
|
+
k(Array.from(e.target.files || []));
|
|
579
579
|
}, ie = (e) => {
|
|
580
|
-
if (
|
|
581
|
-
let n =
|
|
580
|
+
if (c) {
|
|
581
|
+
let n = O.filter((t, n) => n !== e);
|
|
582
582
|
t(n.length > 0 ? n : null);
|
|
583
583
|
} else t(null);
|
|
584
|
-
},
|
|
585
|
-
return /* @__PURE__ */
|
|
584
|
+
}, j = (e) => (e.mime_type || "").startsWith("image/");
|
|
585
|
+
return /* @__PURE__ */ I("div", {
|
|
586
586
|
className: i.className,
|
|
587
587
|
children: [
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
ref:
|
|
588
|
+
/* @__PURE__ */ F("input", {
|
|
589
|
+
ref: a,
|
|
590
590
|
type: "file",
|
|
591
|
-
multiple:
|
|
592
|
-
accept:
|
|
593
|
-
onChange:
|
|
591
|
+
multiple: c,
|
|
592
|
+
accept: u,
|
|
593
|
+
onChange: A,
|
|
594
594
|
className: "hidden"
|
|
595
595
|
}),
|
|
596
|
-
|
|
597
|
-
ref:
|
|
596
|
+
_ && /* @__PURE__ */ F("input", {
|
|
597
|
+
ref: o,
|
|
598
598
|
type: "file",
|
|
599
599
|
accept: "image/*",
|
|
600
|
-
capture:
|
|
601
|
-
onChange:
|
|
600
|
+
capture: _,
|
|
601
|
+
onChange: A,
|
|
602
602
|
className: "hidden",
|
|
603
603
|
"aria-label": "Camera capture",
|
|
604
604
|
"data-testid": "file-field-camera-input"
|
|
605
605
|
}),
|
|
606
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ I("div", {
|
|
607
607
|
className: "space-y-2",
|
|
608
608
|
children: [
|
|
609
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ I("div", {
|
|
610
610
|
onDragOver: te,
|
|
611
611
|
onDragLeave: ne,
|
|
612
612
|
onDrop: re,
|
|
613
|
-
onClick: () =>
|
|
613
|
+
onClick: () => a.current?.click(),
|
|
614
614
|
className: `
|
|
615
615
|
flex flex-col items-center justify-center gap-2 p-6
|
|
616
616
|
border-2 border-dashed rounded-lg cursor-pointer
|
|
617
617
|
transition-colors duration-200
|
|
618
|
-
${
|
|
618
|
+
${v ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
619
619
|
`,
|
|
620
620
|
role: "button",
|
|
621
621
|
tabIndex: 0,
|
|
622
622
|
onKeyDown: (e) => {
|
|
623
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
623
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a.current?.click());
|
|
624
624
|
},
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ F(Ce, { className: `size-8 ${v ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ I("div", {
|
|
626
626
|
className: "text-center",
|
|
627
|
-
children: [/* @__PURE__ */
|
|
627
|
+
children: [/* @__PURE__ */ F("p", {
|
|
628
628
|
className: "text-sm font-medium",
|
|
629
|
-
children:
|
|
630
|
-
}), /* @__PURE__ */
|
|
629
|
+
children: v ? "Drop files here" : "Drag & drop files here"
|
|
630
|
+
}), /* @__PURE__ */ I("p", {
|
|
631
631
|
className: "text-xs text-muted-foreground mt-1",
|
|
632
|
-
children: ["or click to browse",
|
|
632
|
+
children: ["or click to browse", _ ? " • use the camera button below" : ""]
|
|
633
633
|
})]
|
|
634
634
|
})]
|
|
635
635
|
}),
|
|
636
|
-
|
|
636
|
+
_ && /* @__PURE__ */ I(y, {
|
|
637
637
|
type: "button",
|
|
638
638
|
variant: "outline",
|
|
639
639
|
size: "sm",
|
|
640
640
|
className: "w-full",
|
|
641
641
|
onClick: (e) => {
|
|
642
|
-
e.stopPropagation(),
|
|
642
|
+
e.stopPropagation(), o.current?.click();
|
|
643
643
|
},
|
|
644
644
|
"data-testid": "file-field-camera-button",
|
|
645
|
-
children: [/* @__PURE__ */
|
|
645
|
+
children: [/* @__PURE__ */ F(ae, { className: "size-4 mr-2" }), _ === "user" ? "Take selfie" : "Take photo"]
|
|
646
646
|
}),
|
|
647
|
-
|
|
647
|
+
E && /* @__PURE__ */ I("div", {
|
|
648
648
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
649
649
|
"data-testid": "file-field-uploading",
|
|
650
|
-
children: [/* @__PURE__ */
|
|
650
|
+
children: [/* @__PURE__ */ F(ge, { className: "size-3 animate-spin" }), /* @__PURE__ */ I("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
651
|
}),
|
|
652
|
-
|
|
652
|
+
x.length > 0 && /* @__PURE__ */ F("div", {
|
|
653
653
|
className: "space-y-0.5",
|
|
654
|
-
children:
|
|
654
|
+
children: x.map((e, t) => /* @__PURE__ */ F("p", {
|
|
655
655
|
className: "text-xs text-destructive",
|
|
656
656
|
children: e
|
|
657
657
|
}, t))
|
|
658
658
|
}),
|
|
659
|
-
|
|
659
|
+
O.length > 0 && /* @__PURE__ */ F("div", {
|
|
660
660
|
className: "space-y-1",
|
|
661
|
-
children:
|
|
661
|
+
children: O.map((e, t) => /* @__PURE__ */ I("div", {
|
|
662
662
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
663
|
-
children: [/* @__PURE__ */
|
|
663
|
+
children: [/* @__PURE__ */ I("div", {
|
|
664
664
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
665
665
|
children: [
|
|
666
|
-
|
|
666
|
+
j(e) && e.url ? /* @__PURE__ */ F("img", {
|
|
667
667
|
src: e.url,
|
|
668
668
|
alt: e.name,
|
|
669
669
|
className: "size-8 object-cover rounded flex-shrink-0"
|
|
670
|
-
}) :
|
|
671
|
-
/* @__PURE__ */
|
|
670
|
+
}) : j(e) ? /* @__PURE__ */ F(he, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ F(pe, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
671
|
+
/* @__PURE__ */ F("span", {
|
|
672
672
|
className: "text-sm truncate",
|
|
673
673
|
children: e.name || e.original_name || "File"
|
|
674
674
|
}),
|
|
675
|
-
e.size && /* @__PURE__ */
|
|
675
|
+
e.size && /* @__PURE__ */ I("span", {
|
|
676
676
|
className: "text-xs text-muted-foreground",
|
|
677
677
|
children: [
|
|
678
678
|
"(",
|
|
@@ -681,7 +681,7 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
681
681
|
]
|
|
682
682
|
})
|
|
683
683
|
]
|
|
684
|
-
}), /* @__PURE__ */
|
|
684
|
+
}), /* @__PURE__ */ F(y, {
|
|
685
685
|
type: "button",
|
|
686
686
|
variant: "ghost",
|
|
687
687
|
size: "sm",
|
|
@@ -689,7 +689,7 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
689
689
|
e.stopPropagation(), ie(t);
|
|
690
690
|
},
|
|
691
691
|
className: "h-6 w-6 p-0",
|
|
692
|
-
children: /* @__PURE__ */
|
|
692
|
+
children: /* @__PURE__ */ F(P, { className: "size-3" })
|
|
693
693
|
})]
|
|
694
694
|
}, t))
|
|
695
695
|
})
|
|
@@ -700,24 +700,24 @@ function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
700
700
|
}
|
|
701
701
|
//#endregion
|
|
702
702
|
//#region src/widgets/ImageField.tsx
|
|
703
|
-
var
|
|
704
|
-
function
|
|
705
|
-
let
|
|
706
|
-
if (r) return e ? /* @__PURE__ */
|
|
703
|
+
var tt = /* @__PURE__ */ e({ ImageField: () => V }), nt = c(() => import("./ImageCropperDialog-DNvktnyM.js").then((e) => e.n).then((e) => ({ default: e.ImageCropperDialog })));
|
|
704
|
+
function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
705
|
+
let a = f(null), o = n || i.schema, c = o?.multiple || !1, u = o?.accept ? o.accept.join(",") : "image/*", d = o?.crop !== !1, [m, h] = p(null), { upload: g } = Te(), [_, v] = p(!1);
|
|
706
|
+
if (r) return e ? /* @__PURE__ */ F("div", {
|
|
707
707
|
className: "flex flex-wrap gap-2",
|
|
708
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */
|
|
708
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ F("img", {
|
|
709
709
|
src: e.url || "",
|
|
710
710
|
alt: e.name || `Image ${t + 1}`,
|
|
711
711
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
712
712
|
}, t))
|
|
713
|
-
}) : /* @__PURE__ */
|
|
714
|
-
let
|
|
713
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
714
|
+
let b = e ? Array.isArray(e) ? e : [e] : [], x = async (e) => {
|
|
715
715
|
let n = Array.from(e.target.files || []);
|
|
716
716
|
if (n.length !== 0) {
|
|
717
|
-
|
|
717
|
+
v(!0);
|
|
718
718
|
try {
|
|
719
719
|
let e = await Promise.all(n.map(async (e) => {
|
|
720
|
-
let t = await
|
|
720
|
+
let t = await g(e);
|
|
721
721
|
return {
|
|
722
722
|
name: t.name,
|
|
723
723
|
original_name: e.name,
|
|
@@ -726,109 +726,109 @@ function nt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
726
726
|
url: t.url
|
|
727
727
|
};
|
|
728
728
|
}));
|
|
729
|
-
t(
|
|
729
|
+
t(c ? [...b, ...e] : e[0]);
|
|
730
730
|
} finally {
|
|
731
|
-
|
|
731
|
+
v(!1), a.current && (a.current.value = "");
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
},
|
|
735
|
-
if (
|
|
736
|
-
let n =
|
|
734
|
+
}, S = (e) => {
|
|
735
|
+
if (c) {
|
|
736
|
+
let n = b.filter((t, n) => n !== e);
|
|
737
737
|
t(n.length > 0 ? n : null);
|
|
738
738
|
} else t(null);
|
|
739
|
-
},
|
|
740
|
-
if (
|
|
741
|
-
|
|
739
|
+
}, C = l(async (e, n) => {
|
|
740
|
+
if (m) {
|
|
741
|
+
v(!0);
|
|
742
742
|
try {
|
|
743
|
-
let r = await
|
|
743
|
+
let r = await g(e), i = {
|
|
744
744
|
name: r.name || n,
|
|
745
745
|
original_name: n,
|
|
746
746
|
size: r.size,
|
|
747
747
|
mime_type: r.mimeType,
|
|
748
748
|
url: r.url
|
|
749
749
|
};
|
|
750
|
-
if (
|
|
751
|
-
let e = [...
|
|
752
|
-
e[
|
|
750
|
+
if (c) {
|
|
751
|
+
let e = [...b];
|
|
752
|
+
e[m.index] = i, t(e);
|
|
753
753
|
} else t(i);
|
|
754
754
|
} finally {
|
|
755
|
-
|
|
755
|
+
v(!1), h(null);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
}, [
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
759
|
+
m,
|
|
760
|
+
b,
|
|
761
|
+
c,
|
|
762
762
|
t,
|
|
763
|
-
|
|
764
|
-
]),
|
|
765
|
-
let t =
|
|
766
|
-
t?.url &&
|
|
763
|
+
g
|
|
764
|
+
]), w = l((e) => {
|
|
765
|
+
let t = b[e];
|
|
766
|
+
t?.url && h({
|
|
767
767
|
index: e,
|
|
768
768
|
src: t.url,
|
|
769
769
|
name: t.name || `image-${e}.png`
|
|
770
770
|
});
|
|
771
|
-
}, [
|
|
772
|
-
return /* @__PURE__ */
|
|
771
|
+
}, [b]);
|
|
772
|
+
return /* @__PURE__ */ I("div", {
|
|
773
773
|
className: i.className,
|
|
774
774
|
children: [
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
ref:
|
|
775
|
+
/* @__PURE__ */ F("input", {
|
|
776
|
+
ref: a,
|
|
777
777
|
type: "file",
|
|
778
|
-
multiple:
|
|
779
|
-
accept:
|
|
780
|
-
onChange:
|
|
778
|
+
multiple: c,
|
|
779
|
+
accept: u,
|
|
780
|
+
onChange: x,
|
|
781
781
|
className: "hidden"
|
|
782
782
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ I("div", {
|
|
784
784
|
className: "space-y-2",
|
|
785
|
-
children: [
|
|
785
|
+
children: [b.length > 0 && /* @__PURE__ */ F("div", {
|
|
786
786
|
className: "grid grid-cols-4 gap-2",
|
|
787
|
-
children:
|
|
787
|
+
children: b.map((e, t) => /* @__PURE__ */ I("div", {
|
|
788
788
|
className: "relative group",
|
|
789
|
-
children: [/* @__PURE__ */
|
|
789
|
+
children: [/* @__PURE__ */ F("img", {
|
|
790
790
|
src: e.url || "",
|
|
791
791
|
alt: e.name || `Image ${t + 1}`,
|
|
792
792
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
793
|
-
}), /* @__PURE__ */
|
|
793
|
+
}), /* @__PURE__ */ I("div", {
|
|
794
794
|
className: "absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
795
|
-
children: [
|
|
795
|
+
children: [d && /* @__PURE__ */ F(y, {
|
|
796
796
|
type: "button",
|
|
797
797
|
variant: "secondary",
|
|
798
798
|
size: "sm",
|
|
799
|
-
onClick: () =>
|
|
799
|
+
onClick: () => w(t),
|
|
800
800
|
className: "h-6 w-6 p-0",
|
|
801
801
|
"aria-label": `Crop image ${t + 1}`,
|
|
802
802
|
"data-testid": `image-field-crop-${t}`,
|
|
803
|
-
children: /* @__PURE__ */
|
|
804
|
-
}), /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ F(se, { className: "size-3" })
|
|
804
|
+
}), /* @__PURE__ */ F(y, {
|
|
805
805
|
type: "button",
|
|
806
806
|
variant: "destructive",
|
|
807
807
|
size: "sm",
|
|
808
|
-
onClick: () =>
|
|
808
|
+
onClick: () => S(t),
|
|
809
809
|
className: "h-6 w-6 p-0",
|
|
810
|
-
children: /* @__PURE__ */
|
|
810
|
+
children: /* @__PURE__ */ F(P, { className: "size-3" })
|
|
811
811
|
})]
|
|
812
812
|
})]
|
|
813
813
|
}, t))
|
|
814
|
-
}), /* @__PURE__ */
|
|
814
|
+
}), /* @__PURE__ */ I(y, {
|
|
815
815
|
type: "button",
|
|
816
816
|
variant: "outline",
|
|
817
|
-
onClick: () =>
|
|
817
|
+
onClick: () => a.current?.click(),
|
|
818
818
|
className: "w-full",
|
|
819
|
-
disabled:
|
|
819
|
+
disabled: _,
|
|
820
820
|
"data-testid": "image-field-upload-button",
|
|
821
|
-
children: [
|
|
821
|
+
children: [_ ? /* @__PURE__ */ F(ge, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ F(me, { className: "size-4 mr-2" }), _ ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
|
|
822
822
|
})]
|
|
823
823
|
}),
|
|
824
|
-
|
|
824
|
+
d && m && /* @__PURE__ */ F(s, {
|
|
825
825
|
fallback: null,
|
|
826
|
-
children: /* @__PURE__ */
|
|
826
|
+
children: /* @__PURE__ */ F(nt, {
|
|
827
827
|
open: !0,
|
|
828
|
-
onOpenChange: (e) => !e &&
|
|
829
|
-
src:
|
|
830
|
-
outputName:
|
|
831
|
-
onConfirm:
|
|
828
|
+
onOpenChange: (e) => !e && h(null),
|
|
829
|
+
src: m.src,
|
|
830
|
+
outputName: m.name,
|
|
831
|
+
onConfirm: C
|
|
832
832
|
})
|
|
833
833
|
})
|
|
834
834
|
]
|
|
@@ -839,10 +839,10 @@ function nt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
839
839
|
var rt = /* @__PURE__ */ e({ LocationField: () => it });
|
|
840
840
|
function it({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
841
841
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
842
|
-
return r ? /* @__PURE__ */
|
|
842
|
+
return r ? /* @__PURE__ */ F("span", {
|
|
843
843
|
className: "text-sm",
|
|
844
|
-
children: o || /* @__PURE__ */
|
|
845
|
-
}) : /* @__PURE__ */
|
|
844
|
+
children: o || /* @__PURE__ */ F(T, {})
|
|
845
|
+
}) : /* @__PURE__ */ F(E, {
|
|
846
846
|
type: "text",
|
|
847
847
|
value: o,
|
|
848
848
|
onChange: (e) => {
|
|
@@ -870,9 +870,9 @@ function it({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
870
870
|
var at = /* @__PURE__ */ e({ FormulaField: () => ot });
|
|
871
871
|
function ot({ value: e, field: t, ...n }) {
|
|
872
872
|
let r = (t || n.schema)?.return_type || "text";
|
|
873
|
-
if (e == null) return /* @__PURE__ */
|
|
873
|
+
if (e == null) return /* @__PURE__ */ F(T, { className: n.className });
|
|
874
874
|
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__ */
|
|
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__ */ F("span", {
|
|
876
876
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
877
877
|
children: i
|
|
878
878
|
});
|
|
@@ -882,14 +882,14 @@ function ot({ value: e, field: t, ...n }) {
|
|
|
882
882
|
var st = /* @__PURE__ */ e({ SummaryField: () => ct });
|
|
883
883
|
function ct({ value: e, field: t, ...n }) {
|
|
884
884
|
let r = (t || n.schema)?.summary_type || "count";
|
|
885
|
-
if (e == null) return /* @__PURE__ */
|
|
885
|
+
if (e == null) return /* @__PURE__ */ F(T, { className: n.className });
|
|
886
886
|
let i;
|
|
887
887
|
return i = r === "count" ? String(e) : [
|
|
888
888
|
"sum",
|
|
889
889
|
"avg",
|
|
890
890
|
"min",
|
|
891
891
|
"max"
|
|
892
|
-
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */
|
|
892
|
+
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */ F("span", {
|
|
893
893
|
className: `text-sm font-medium tabular-nums text-gray-700 ${n.className || ""}`,
|
|
894
894
|
children: i
|
|
895
895
|
});
|
|
@@ -898,7 +898,7 @@ function ct({ value: e, field: t, ...n }) {
|
|
|
898
898
|
//#region src/widgets/AutoNumberField.tsx
|
|
899
899
|
var lt = /* @__PURE__ */ e({ AutoNumberField: () => ut });
|
|
900
900
|
function ut({ value: e, field: t, ...n }) {
|
|
901
|
-
return e == null ? /* @__PURE__ */
|
|
901
|
+
return e == null ? /* @__PURE__ */ F(T, { className: n.className }) : /* @__PURE__ */ F("span", {
|
|
902
902
|
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
903
903
|
children: String(e)
|
|
904
904
|
});
|
|
@@ -909,23 +909,23 @@ var dt = /* @__PURE__ */ e({ UserField: () => H });
|
|
|
909
909
|
function H({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
910
910
|
let a = (n || i.schema)?.multiple || !1;
|
|
911
911
|
if (r) {
|
|
912
|
-
if (!e) return /* @__PURE__ */
|
|
912
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
913
913
|
let t = Array.isArray(e) ? e : [e];
|
|
914
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ I("div", {
|
|
915
915
|
className: "flex -space-x-2",
|
|
916
916
|
children: [t.slice(0, 3).map((e, t) => {
|
|
917
917
|
let n = e.name || e.username || "User";
|
|
918
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ F(h, {
|
|
919
919
|
className: "size-8 border-2 border-white",
|
|
920
920
|
title: n,
|
|
921
|
-
children: /* @__PURE__ */
|
|
921
|
+
children: /* @__PURE__ */ F(g, {
|
|
922
922
|
className: "bg-blue-500 text-white text-xs",
|
|
923
923
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
924
924
|
})
|
|
925
925
|
}, t);
|
|
926
|
-
}), t.length > 3 && /* @__PURE__ */
|
|
926
|
+
}), t.length > 3 && /* @__PURE__ */ F(h, {
|
|
927
927
|
className: "size-8 border-2 border-white",
|
|
928
|
-
children: /* @__PURE__ */
|
|
928
|
+
children: /* @__PURE__ */ I(g, {
|
|
929
929
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
930
930
|
children: ["+", t.length - 3]
|
|
931
931
|
})
|
|
@@ -938,37 +938,37 @@ function H({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
938
938
|
t(n.length > 0 ? n : null);
|
|
939
939
|
} else t(null);
|
|
940
940
|
};
|
|
941
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ I("div", {
|
|
942
942
|
className: i.className,
|
|
943
|
-
children: [o.length > 0 && /* @__PURE__ */
|
|
943
|
+
children: [o.length > 0 && /* @__PURE__ */ F("div", {
|
|
944
944
|
className: "flex flex-wrap gap-2 mb-2",
|
|
945
945
|
children: o.map((e, t) => {
|
|
946
946
|
let n = e.name || e.username || "User";
|
|
947
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ I(v, {
|
|
948
948
|
variant: "outline",
|
|
949
949
|
className: "gap-2 pr-1",
|
|
950
950
|
children: [
|
|
951
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ F(h, {
|
|
952
952
|
className: "size-5",
|
|
953
|
-
children: /* @__PURE__ */
|
|
953
|
+
children: /* @__PURE__ */ F(g, {
|
|
954
954
|
className: "bg-blue-500 text-white text-xs",
|
|
955
955
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
956
956
|
})
|
|
957
957
|
}),
|
|
958
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ F("span", {
|
|
959
959
|
className: "text-sm",
|
|
960
960
|
children: n
|
|
961
961
|
}),
|
|
962
|
-
/* @__PURE__ */
|
|
962
|
+
/* @__PURE__ */ F("button", {
|
|
963
963
|
type: "button",
|
|
964
964
|
onClick: () => s(t),
|
|
965
965
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
966
|
-
children: /* @__PURE__ */
|
|
966
|
+
children: /* @__PURE__ */ F(P, { className: "size-3" })
|
|
967
967
|
})
|
|
968
968
|
]
|
|
969
969
|
}, t);
|
|
970
970
|
})
|
|
971
|
-
}), /* @__PURE__ */
|
|
971
|
+
}), /* @__PURE__ */ F("div", {
|
|
972
972
|
className: "text-sm text-gray-500 italic",
|
|
973
973
|
children: "User selection component requires integration with user management system"
|
|
974
974
|
})]
|
|
@@ -978,8 +978,8 @@ function H({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
978
978
|
//#region src/widgets/ObjectField.tsx
|
|
979
979
|
var ft = /* @__PURE__ */ e({ ObjectField: () => pt });
|
|
980
980
|
function pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
981
|
-
let a = n || i.schema, [o, s] =
|
|
982
|
-
return
|
|
981
|
+
let a = n || i.schema, [o, s] = p(() => e == null ? "" : JSON.stringify(e, null, 2)), [c, l] = p(null);
|
|
982
|
+
return u(() => {
|
|
983
983
|
try {
|
|
984
984
|
if (e == null) {
|
|
985
985
|
s("");
|
|
@@ -990,12 +990,12 @@ function pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
990
990
|
} catch {
|
|
991
991
|
s(JSON.stringify(e, null, 2));
|
|
992
992
|
}
|
|
993
|
-
}, [e, o]), r ? e ? /* @__PURE__ */
|
|
994
|
-
className:
|
|
993
|
+
}, [e, o]), r ? e ? /* @__PURE__ */ F("pre", {
|
|
994
|
+
className: M("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
995
995
|
children: JSON.stringify(e, null, 2)
|
|
996
|
-
}) : /* @__PURE__ */
|
|
996
|
+
}) : /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ I("div", {
|
|
997
997
|
className: "space-y-1",
|
|
998
|
-
children: [/* @__PURE__ */
|
|
998
|
+
children: [/* @__PURE__ */ F(j, {
|
|
999
999
|
value: o,
|
|
1000
1000
|
onChange: (e) => {
|
|
1001
1001
|
let n = e.target.value;
|
|
@@ -1011,9 +1011,9 @@ function pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1011
1011
|
},
|
|
1012
1012
|
placeholder: a?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
1013
1013
|
disabled: r || i.disabled,
|
|
1014
|
-
className:
|
|
1014
|
+
className: M("font-mono text-xs", c ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
1015
1015
|
rows: 6
|
|
1016
|
-
}), c && /* @__PURE__ */
|
|
1016
|
+
}), c && /* @__PURE__ */ F("p", {
|
|
1017
1017
|
className: "text-xs text-red-500",
|
|
1018
1018
|
children: c
|
|
1019
1019
|
})]
|
|
@@ -1021,24 +1021,24 @@ function pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/widgets/VectorField.tsx
|
|
1024
|
-
var mt = /* @__PURE__ */ e({ VectorField: () =>
|
|
1025
|
-
function
|
|
1024
|
+
var mt = /* @__PURE__ */ e({ VectorField: () => U });
|
|
1025
|
+
function U({ value: e, field: t, ...n }) {
|
|
1026
1026
|
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
1027
|
-
if (!e || !Array.isArray(e)) return /* @__PURE__ */
|
|
1027
|
+
if (!e || !Array.isArray(e)) return /* @__PURE__ */ F(T, {});
|
|
1028
1028
|
let i = e.slice(0, 3).map((e) => {
|
|
1029
1029
|
let t = Number(e);
|
|
1030
1030
|
return isNaN(t) ? "0" : t.toFixed(4);
|
|
1031
1031
|
}).join(", ");
|
|
1032
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ I("div", {
|
|
1033
1033
|
className: `text-sm ${n.className || ""}`,
|
|
1034
|
-
children: [/* @__PURE__ */
|
|
1034
|
+
children: [/* @__PURE__ */ I("span", {
|
|
1035
1035
|
className: "font-mono text-gray-700",
|
|
1036
1036
|
children: [
|
|
1037
1037
|
"[",
|
|
1038
1038
|
i,
|
|
1039
1039
|
"...]"
|
|
1040
1040
|
]
|
|
1041
|
-
}), /* @__PURE__ */
|
|
1041
|
+
}), /* @__PURE__ */ I("span", {
|
|
1042
1042
|
className: "text-gray-500 ml-2",
|
|
1043
1043
|
children: [
|
|
1044
1044
|
"(",
|
|
@@ -1050,39 +1050,39 @@ function ht({ value: e, field: t, ...n }) {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
//#endregion
|
|
1052
1052
|
//#region src/widgets/GridField.tsx
|
|
1053
|
-
var
|
|
1054
|
-
function
|
|
1053
|
+
var ht = /* @__PURE__ */ e({ GridField: () => gt });
|
|
1054
|
+
function gt({ value: e, field: t, readonly: n, ...r }) {
|
|
1055
1055
|
let i = (t || r.schema)?.columns || [];
|
|
1056
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */
|
|
1057
|
-
className:
|
|
1058
|
-
children: /* @__PURE__ */
|
|
1056
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ F(T, {}) : n ? /* @__PURE__ */ F("div", {
|
|
1057
|
+
className: M("text-sm", r.className),
|
|
1058
|
+
children: /* @__PURE__ */ I("span", {
|
|
1059
1059
|
className: "text-foreground",
|
|
1060
1060
|
children: [e.length, " rows"]
|
|
1061
1061
|
})
|
|
1062
|
-
}) : /* @__PURE__ */
|
|
1063
|
-
className:
|
|
1064
|
-
children: [/* @__PURE__ */
|
|
1062
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1063
|
+
className: M("border border-border rounded-lg overflow-hidden", r.className),
|
|
1064
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1065
1065
|
className: "overflow-auto max-h-60",
|
|
1066
|
-
children: /* @__PURE__ */
|
|
1066
|
+
children: /* @__PURE__ */ I("table", {
|
|
1067
1067
|
className: "w-full text-sm",
|
|
1068
|
-
children: [/* @__PURE__ */
|
|
1068
|
+
children: [/* @__PURE__ */ F("thead", {
|
|
1069
1069
|
className: "bg-muted border-b border-border",
|
|
1070
|
-
children: /* @__PURE__ */
|
|
1070
|
+
children: /* @__PURE__ */ F("tr", { children: i.map((e, t) => /* @__PURE__ */ F("th", {
|
|
1071
1071
|
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
1072
1072
|
children: e.label || e.name
|
|
1073
1073
|
}, t)) })
|
|
1074
|
-
}), /* @__PURE__ */
|
|
1074
|
+
}), /* @__PURE__ */ F("tbody", {
|
|
1075
1075
|
className: "divide-y divide-border",
|
|
1076
|
-
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */
|
|
1076
|
+
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */ F("tr", {
|
|
1077
1077
|
className: "hover:bg-muted/50 transition-colors",
|
|
1078
|
-
children: i.map((t, n) => /* @__PURE__ */
|
|
1078
|
+
children: i.map((t, n) => /* @__PURE__ */ F("td", {
|
|
1079
1079
|
className: "px-3 py-2 text-foreground",
|
|
1080
|
-
children: e[t.name] == null ? /* @__PURE__ */
|
|
1080
|
+
children: e[t.name] == null ? /* @__PURE__ */ F(T, {}) : String(e[t.name])
|
|
1081
1081
|
}, n))
|
|
1082
1082
|
}, t))
|
|
1083
1083
|
})]
|
|
1084
1084
|
})
|
|
1085
|
-
}), e.length > 5 && /* @__PURE__ */
|
|
1085
|
+
}), e.length > 5 && /* @__PURE__ */ I("div", {
|
|
1086
1086
|
className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",
|
|
1087
1087
|
children: [
|
|
1088
1088
|
"Showing 5 of ",
|
|
@@ -1094,27 +1094,27 @@ function _t({ value: e, field: t, readonly: n, ...r }) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
//#endregion
|
|
1096
1096
|
//#region src/widgets/ColorField.tsx
|
|
1097
|
-
var
|
|
1098
|
-
function
|
|
1097
|
+
var _t = /* @__PURE__ */ e({ ColorField: () => vt });
|
|
1098
|
+
function vt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1099
1099
|
let a = n || i.schema;
|
|
1100
|
-
return r ? /* @__PURE__ */
|
|
1100
|
+
return r ? /* @__PURE__ */ I("div", {
|
|
1101
1101
|
className: "flex items-center gap-2",
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
1102
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1103
1103
|
className: "w-6 h-6 rounded border border-input",
|
|
1104
1104
|
style: { backgroundColor: e || "#000000" }
|
|
1105
|
-
}), /* @__PURE__ */
|
|
1105
|
+
}), /* @__PURE__ */ F("span", {
|
|
1106
1106
|
className: "text-sm",
|
|
1107
|
-
children: e || /* @__PURE__ */
|
|
1107
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
1108
1108
|
})]
|
|
1109
|
-
}) : /* @__PURE__ */
|
|
1109
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1110
1110
|
className: "flex items-center gap-2",
|
|
1111
|
-
children: [/* @__PURE__ */
|
|
1111
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1112
1112
|
type: "color",
|
|
1113
1113
|
value: e || "#000000",
|
|
1114
1114
|
onChange: (e) => t(e.target.value),
|
|
1115
1115
|
disabled: r || i.disabled,
|
|
1116
1116
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
1117
|
-
}), /* @__PURE__ */
|
|
1117
|
+
}), /* @__PURE__ */ F(E, {
|
|
1118
1118
|
type: "text",
|
|
1119
1119
|
value: e || "",
|
|
1120
1120
|
onChange: (e) => t(e.target.value),
|
|
@@ -1127,21 +1127,21 @@ function yt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
//#endregion
|
|
1129
1129
|
//#region src/widgets/SliderField.tsx
|
|
1130
|
-
var
|
|
1131
|
-
function
|
|
1130
|
+
var yt = /* @__PURE__ */ e({ SliderField: () => bt });
|
|
1131
|
+
function bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1132
1132
|
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
1133
|
-
return r ? /* @__PURE__ */
|
|
1133
|
+
return r ? /* @__PURE__ */ I("div", {
|
|
1134
1134
|
className: "flex items-center gap-2",
|
|
1135
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1136
1136
|
className: "text-sm font-medium",
|
|
1137
1137
|
children: e ?? o
|
|
1138
|
-
}), /* @__PURE__ */
|
|
1138
|
+
}), /* @__PURE__ */ I("span", {
|
|
1139
1139
|
className: "text-xs text-muted-foreground",
|
|
1140
1140
|
children: ["/ ", s]
|
|
1141
1141
|
})]
|
|
1142
|
-
}) : /* @__PURE__ */
|
|
1142
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1143
1143
|
className: "flex items-center gap-4",
|
|
1144
|
-
children: [/* @__PURE__ */
|
|
1144
|
+
children: [/* @__PURE__ */ F(A, {
|
|
1145
1145
|
value: [e ?? o],
|
|
1146
1146
|
onValueChange: (e) => t(e[0]),
|
|
1147
1147
|
min: o,
|
|
@@ -1149,7 +1149,7 @@ function xt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1149
1149
|
step: c,
|
|
1150
1150
|
disabled: r || i.disabled,
|
|
1151
1151
|
className: i.className
|
|
1152
|
-
}), /* @__PURE__ */
|
|
1152
|
+
}), /* @__PURE__ */ F("span", {
|
|
1153
1153
|
className: "text-sm font-medium w-12 text-right",
|
|
1154
1154
|
children: e ?? o
|
|
1155
1155
|
})]
|
|
@@ -1157,35 +1157,35 @@ function xt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
//#endregion
|
|
1159
1159
|
//#region src/widgets/RatingField.tsx
|
|
1160
|
-
var
|
|
1161
|
-
function
|
|
1162
|
-
let
|
|
1163
|
-
return r ? /* @__PURE__ */
|
|
1164
|
-
className:
|
|
1165
|
-
children: [Array.from({ length:
|
|
1160
|
+
var xt = /* @__PURE__ */ e({ RatingField: () => St });
|
|
1161
|
+
function St({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1162
|
+
let s = (n || a.schema)?.max ?? 5, c = e ?? 0, [l, u] = o.useState(null), d = l === null ? c : l;
|
|
1163
|
+
return r ? /* @__PURE__ */ I("div", {
|
|
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", {
|
|
1166
1166
|
className: "ml-2 text-sm text-muted-foreground",
|
|
1167
1167
|
children: [
|
|
1168
1168
|
c,
|
|
1169
1169
|
" / ",
|
|
1170
|
-
|
|
1170
|
+
s
|
|
1171
1171
|
]
|
|
1172
1172
|
})]
|
|
1173
|
-
}) : /* @__PURE__ */
|
|
1174
|
-
className:
|
|
1175
|
-
children: [Array.from({ length:
|
|
1173
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1174
|
+
className: M("flex items-center gap-1", i),
|
|
1175
|
+
children: [Array.from({ length: s }, (e, n) => /* @__PURE__ */ F("button", {
|
|
1176
1176
|
type: "button",
|
|
1177
1177
|
onClick: () => t(n + 1),
|
|
1178
1178
|
onMouseEnter: () => u(n + 1),
|
|
1179
1179
|
onMouseLeave: () => u(null),
|
|
1180
1180
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
1181
1181
|
disabled: r || a.disabled,
|
|
1182
|
-
children: /* @__PURE__ */
|
|
1183
|
-
}, n)), /* @__PURE__ */
|
|
1182
|
+
children: /* @__PURE__ */ F(Se, { className: `w-5 h-5 transition-colors ${n < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
1183
|
+
}, n)), /* @__PURE__ */ I("span", {
|
|
1184
1184
|
className: "ml-2 text-sm text-muted-foreground",
|
|
1185
1185
|
children: [
|
|
1186
1186
|
c,
|
|
1187
1187
|
" / ",
|
|
1188
|
-
|
|
1188
|
+
s
|
|
1189
1189
|
]
|
|
1190
1190
|
})]
|
|
1191
1191
|
});
|
|
@@ -1195,15 +1195,15 @@ function U({ value: e, onChange: t, field: n, readonly: r, className: i, ...a })
|
|
|
1195
1195
|
var Ct = /* @__PURE__ */ e({ CodeField: () => wt });
|
|
1196
1196
|
function wt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1197
1197
|
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
1198
|
-
return r ? /* @__PURE__ */
|
|
1199
|
-
className:
|
|
1200
|
-
children: /* @__PURE__ */
|
|
1201
|
-
}) : /* @__PURE__ */
|
|
1198
|
+
return r ? /* @__PURE__ */ F("pre", {
|
|
1199
|
+
className: M("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
1200
|
+
children: /* @__PURE__ */ F("code", { children: e || /* @__PURE__ */ F(T, {}) })
|
|
1201
|
+
}) : /* @__PURE__ */ F(j, {
|
|
1202
1202
|
value: e || "",
|
|
1203
1203
|
onChange: (e) => t(e.target.value),
|
|
1204
1204
|
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
1205
1205
|
disabled: r || i.disabled,
|
|
1206
|
-
className:
|
|
1206
|
+
className: M("font-mono text-sm", i.className),
|
|
1207
1207
|
rows: 12,
|
|
1208
1208
|
spellCheck: !1
|
|
1209
1209
|
});
|
|
@@ -1212,7 +1212,7 @@ function wt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1212
1212
|
//#region src/widgets/AvatarField.tsx
|
|
1213
1213
|
var Tt = /* @__PURE__ */ e({ AvatarField: () => Et });
|
|
1214
1214
|
function Et({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1215
|
-
let [a,
|
|
1215
|
+
let [a, s] = o.useState(!1), c = o.useRef(null), l = n || i.schema, u = (e) => {
|
|
1216
1216
|
let n = e.target.files?.[0];
|
|
1217
1217
|
if (!n) return;
|
|
1218
1218
|
if (!n.type.startsWith("image/")) {
|
|
@@ -1230,53 +1230,53 @@ function Et({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1230
1230
|
}, d = () => {
|
|
1231
1231
|
t("");
|
|
1232
1232
|
}, f = () => (l?.defaultName || l?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
1233
|
-
return r ? /* @__PURE__ */
|
|
1233
|
+
return r ? /* @__PURE__ */ I(h, {
|
|
1234
1234
|
className: "w-16 h-16",
|
|
1235
|
-
children: [e && /* @__PURE__ */
|
|
1235
|
+
children: [e && /* @__PURE__ */ F(_, {
|
|
1236
1236
|
src: e,
|
|
1237
1237
|
alt: l?.label
|
|
1238
|
-
}), /* @__PURE__ */
|
|
1239
|
-
}) : /* @__PURE__ */
|
|
1238
|
+
}), /* @__PURE__ */ F(g, { children: f() })]
|
|
1239
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1240
1240
|
className: "flex items-center gap-4",
|
|
1241
|
-
children: [/* @__PURE__ */
|
|
1241
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1242
1242
|
className: "relative",
|
|
1243
|
-
onMouseEnter: () =>
|
|
1244
|
-
onMouseLeave: () =>
|
|
1245
|
-
children: [/* @__PURE__ */
|
|
1243
|
+
onMouseEnter: () => s(!0),
|
|
1244
|
+
onMouseLeave: () => s(!1),
|
|
1245
|
+
children: [/* @__PURE__ */ I(h, {
|
|
1246
1246
|
className: "w-16 h-16",
|
|
1247
|
-
children: [e && /* @__PURE__ */
|
|
1247
|
+
children: [e && /* @__PURE__ */ F(_, {
|
|
1248
1248
|
src: e,
|
|
1249
1249
|
alt: l?.label
|
|
1250
|
-
}), /* @__PURE__ */
|
|
1251
|
-
}), !r && a && e && /* @__PURE__ */
|
|
1250
|
+
}), /* @__PURE__ */ F(g, { children: f() })]
|
|
1251
|
+
}), !r && a && e && /* @__PURE__ */ F("button", {
|
|
1252
1252
|
type: "button",
|
|
1253
1253
|
onClick: d,
|
|
1254
1254
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
1255
|
-
children: /* @__PURE__ */
|
|
1255
|
+
children: /* @__PURE__ */ F(P, { className: "w-3 h-3" })
|
|
1256
1256
|
})]
|
|
1257
|
-
}), /* @__PURE__ */
|
|
1257
|
+
}), /* @__PURE__ */ I("div", {
|
|
1258
1258
|
className: "flex flex-col gap-2",
|
|
1259
1259
|
children: [
|
|
1260
|
-
/* @__PURE__ */
|
|
1260
|
+
/* @__PURE__ */ F("input", {
|
|
1261
1261
|
ref: c,
|
|
1262
1262
|
type: "file",
|
|
1263
1263
|
accept: "image/*",
|
|
1264
1264
|
onChange: u,
|
|
1265
1265
|
className: "hidden"
|
|
1266
1266
|
}),
|
|
1267
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ I(y, {
|
|
1268
1268
|
type: "button",
|
|
1269
1269
|
variant: "outline",
|
|
1270
1270
|
size: "sm",
|
|
1271
1271
|
onClick: () => c.current?.click(),
|
|
1272
1272
|
disabled: r || i.disabled,
|
|
1273
1273
|
children: [
|
|
1274
|
-
/* @__PURE__ */
|
|
1274
|
+
/* @__PURE__ */ F(Ce, { className: "w-4 h-4 mr-2" }),
|
|
1275
1275
|
e ? "Change" : "Upload",
|
|
1276
1276
|
" Avatar"
|
|
1277
1277
|
]
|
|
1278
1278
|
}),
|
|
1279
|
-
/* @__PURE__ */
|
|
1279
|
+
/* @__PURE__ */ F("p", {
|
|
1280
1280
|
className: "text-xs text-muted-foreground",
|
|
1281
1281
|
children: "PNG, JPG up to 5MB"
|
|
1282
1282
|
})
|
|
@@ -1301,19 +1301,19 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1301
1301
|
].filter(Boolean).join(", ");
|
|
1302
1302
|
if (r) {
|
|
1303
1303
|
let e = s(a);
|
|
1304
|
-
return e ? /* @__PURE__ */
|
|
1304
|
+
return e ? /* @__PURE__ */ F("span", {
|
|
1305
1305
|
className: "text-sm",
|
|
1306
1306
|
children: e
|
|
1307
|
-
}) : /* @__PURE__ */
|
|
1307
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
1308
1308
|
}
|
|
1309
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ I("div", {
|
|
1310
1310
|
className: "space-y-3",
|
|
1311
1311
|
children: [
|
|
1312
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1313
1313
|
htmlFor: "street",
|
|
1314
1314
|
className: "text-xs",
|
|
1315
1315
|
children: "Street Address"
|
|
1316
|
-
}), /* @__PURE__ */
|
|
1316
|
+
}), /* @__PURE__ */ F(E, {
|
|
1317
1317
|
id: "street",
|
|
1318
1318
|
type: "text",
|
|
1319
1319
|
value: a.street || "",
|
|
@@ -1322,24 +1322,24 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1322
1322
|
disabled: r || i.disabled,
|
|
1323
1323
|
className: i.className
|
|
1324
1324
|
})] }),
|
|
1325
|
-
/* @__PURE__ */
|
|
1325
|
+
/* @__PURE__ */ I("div", {
|
|
1326
1326
|
className: "grid grid-cols-2 gap-3",
|
|
1327
|
-
children: [/* @__PURE__ */
|
|
1327
|
+
children: [/* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1328
1328
|
htmlFor: "city",
|
|
1329
1329
|
className: "text-xs",
|
|
1330
1330
|
children: "City"
|
|
1331
|
-
}), /* @__PURE__ */
|
|
1331
|
+
}), /* @__PURE__ */ F(E, {
|
|
1332
1332
|
id: "city",
|
|
1333
1333
|
type: "text",
|
|
1334
1334
|
value: a.city || "",
|
|
1335
1335
|
onChange: (e) => o("city", e.target.value),
|
|
1336
1336
|
placeholder: "San Francisco",
|
|
1337
1337
|
disabled: r || i.disabled
|
|
1338
|
-
})] }), /* @__PURE__ */
|
|
1338
|
+
})] }), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1339
1339
|
htmlFor: "state",
|
|
1340
1340
|
className: "text-xs",
|
|
1341
1341
|
children: "State / Province"
|
|
1342
|
-
}), /* @__PURE__ */
|
|
1342
|
+
}), /* @__PURE__ */ F(E, {
|
|
1343
1343
|
id: "state",
|
|
1344
1344
|
type: "text",
|
|
1345
1345
|
value: a.state || "",
|
|
@@ -1348,24 +1348,24 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1348
1348
|
disabled: r || i.disabled
|
|
1349
1349
|
})] })]
|
|
1350
1350
|
}),
|
|
1351
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ I("div", {
|
|
1352
1352
|
className: "grid grid-cols-2 gap-3",
|
|
1353
|
-
children: [/* @__PURE__ */
|
|
1353
|
+
children: [/* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1354
1354
|
htmlFor: "zipCode",
|
|
1355
1355
|
className: "text-xs",
|
|
1356
1356
|
children: "ZIP / Postal Code"
|
|
1357
|
-
}), /* @__PURE__ */
|
|
1357
|
+
}), /* @__PURE__ */ F(E, {
|
|
1358
1358
|
id: "zipCode",
|
|
1359
1359
|
type: "text",
|
|
1360
1360
|
value: a.zipCode || "",
|
|
1361
1361
|
onChange: (e) => o("zipCode", e.target.value),
|
|
1362
1362
|
placeholder: "94102",
|
|
1363
1363
|
disabled: r || i.disabled
|
|
1364
|
-
})] }), /* @__PURE__ */
|
|
1364
|
+
})] }), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1365
1365
|
htmlFor: "country",
|
|
1366
1366
|
className: "text-xs",
|
|
1367
1367
|
children: "Country"
|
|
1368
|
-
}), /* @__PURE__ */
|
|
1368
|
+
}), /* @__PURE__ */ F(E, {
|
|
1369
1369
|
id: "country",
|
|
1370
1370
|
type: "text",
|
|
1371
1371
|
value: a.country || "",
|
|
@@ -1381,7 +1381,7 @@ function Ot({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1381
1381
|
//#region src/widgets/GeolocationField.tsx
|
|
1382
1382
|
var kt = /* @__PURE__ */ e({ GeolocationField: () => At });
|
|
1383
1383
|
function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1384
|
-
let [a,
|
|
1384
|
+
let [a, s] = o.useState(!1), c = e || {}, l = (e, n) => {
|
|
1385
1385
|
t({
|
|
1386
1386
|
...c,
|
|
1387
1387
|
[e]: n ? Number(n) : void 0
|
|
@@ -1391,14 +1391,14 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1391
1391
|
console.error("Geolocation is not supported by this browser");
|
|
1392
1392
|
return;
|
|
1393
1393
|
}
|
|
1394
|
-
|
|
1394
|
+
s(!0), navigator.geolocation.getCurrentPosition((e) => {
|
|
1395
1395
|
t({
|
|
1396
1396
|
latitude: e.coords.latitude,
|
|
1397
1397
|
longitude: e.coords.longitude,
|
|
1398
1398
|
accuracy: e.coords.accuracy
|
|
1399
|
-
}),
|
|
1399
|
+
}), s(!1);
|
|
1400
1400
|
}, (e) => {
|
|
1401
|
-
console.error("Error getting location:", e.message),
|
|
1401
|
+
console.error("Error getting location:", e.message), s(!1);
|
|
1402
1402
|
}, {
|
|
1403
1403
|
enableHighAccuracy: !0,
|
|
1404
1404
|
timeout: 5e3,
|
|
@@ -1411,15 +1411,15 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1411
1411
|
};
|
|
1412
1412
|
if (r) {
|
|
1413
1413
|
let e = d(c);
|
|
1414
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ I("div", {
|
|
1415
1415
|
className: "flex items-center gap-2",
|
|
1416
1416
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
e ? /* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ F(_e, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1418
|
+
e ? /* @__PURE__ */ F("span", {
|
|
1419
1419
|
className: "text-sm",
|
|
1420
1420
|
children: e
|
|
1421
|
-
}) : /* @__PURE__ */
|
|
1422
|
-
c.latitude && c.longitude && /* @__PURE__ */
|
|
1421
|
+
}) : /* @__PURE__ */ F(T, {}),
|
|
1422
|
+
c.latitude && c.longitude && /* @__PURE__ */ F(y, {
|
|
1423
1423
|
type: "button",
|
|
1424
1424
|
variant: "link",
|
|
1425
1425
|
size: "sm",
|
|
@@ -1430,33 +1430,33 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1430
1430
|
]
|
|
1431
1431
|
});
|
|
1432
1432
|
}
|
|
1433
|
-
return /* @__PURE__ */
|
|
1433
|
+
return /* @__PURE__ */ I("div", {
|
|
1434
1434
|
className: "space-y-3",
|
|
1435
1435
|
children: [
|
|
1436
|
-
/* @__PURE__ */
|
|
1436
|
+
/* @__PURE__ */ I("div", {
|
|
1437
1437
|
className: "flex items-center gap-2",
|
|
1438
|
-
children: [/* @__PURE__ */
|
|
1438
|
+
children: [/* @__PURE__ */ I(y, {
|
|
1439
1439
|
type: "button",
|
|
1440
1440
|
variant: "outline",
|
|
1441
1441
|
size: "sm",
|
|
1442
1442
|
onClick: u,
|
|
1443
1443
|
disabled: r || a,
|
|
1444
|
-
children: [/* @__PURE__ */
|
|
1445
|
-
}), c.latitude && c.longitude && /* @__PURE__ */
|
|
1444
|
+
children: [/* @__PURE__ */ F(ce, { className: "w-4 h-4 mr-2" }), a ? "Getting location..." : "Use Current Location"]
|
|
1445
|
+
}), c.latitude && c.longitude && /* @__PURE__ */ I(y, {
|
|
1446
1446
|
type: "button",
|
|
1447
1447
|
variant: "link",
|
|
1448
1448
|
size: "sm",
|
|
1449
1449
|
onClick: f,
|
|
1450
|
-
children: [/* @__PURE__ */
|
|
1450
|
+
children: [/* @__PURE__ */ F(_e, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
1451
1451
|
})]
|
|
1452
1452
|
}),
|
|
1453
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ I("div", {
|
|
1454
1454
|
className: "grid grid-cols-2 gap-3",
|
|
1455
|
-
children: [/* @__PURE__ */
|
|
1455
|
+
children: [/* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1456
1456
|
htmlFor: "latitude",
|
|
1457
1457
|
className: "text-xs",
|
|
1458
1458
|
children: "Latitude"
|
|
1459
|
-
}), /* @__PURE__ */
|
|
1459
|
+
}), /* @__PURE__ */ F(E, {
|
|
1460
1460
|
id: "latitude",
|
|
1461
1461
|
type: "number",
|
|
1462
1462
|
value: c.latitude ?? "",
|
|
@@ -1465,11 +1465,11 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1465
1465
|
disabled: r || i.disabled,
|
|
1466
1466
|
step: "any",
|
|
1467
1467
|
className: i.className
|
|
1468
|
-
})] }), /* @__PURE__ */
|
|
1468
|
+
})] }), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F(D, {
|
|
1469
1469
|
htmlFor: "longitude",
|
|
1470
1470
|
className: "text-xs",
|
|
1471
1471
|
children: "Longitude"
|
|
1472
|
-
}), /* @__PURE__ */
|
|
1472
|
+
}), /* @__PURE__ */ F(E, {
|
|
1473
1473
|
id: "longitude",
|
|
1474
1474
|
type: "number",
|
|
1475
1475
|
value: c.longitude ?? "",
|
|
@@ -1479,7 +1479,7 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1479
1479
|
step: "any"
|
|
1480
1480
|
})] })]
|
|
1481
1481
|
}),
|
|
1482
|
-
c.accuracy && /* @__PURE__ */
|
|
1482
|
+
c.accuracy && /* @__PURE__ */ I("p", {
|
|
1483
1483
|
className: "text-xs text-muted-foreground",
|
|
1484
1484
|
children: [
|
|
1485
1485
|
"Accuracy: ±",
|
|
@@ -1494,8 +1494,8 @@ function At({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
1494
1494
|
//#region src/widgets/SignatureField.tsx
|
|
1495
1495
|
var jt = /* @__PURE__ */ e({ SignatureField: () => Mt });
|
|
1496
1496
|
function Mt({ value: e, onChange: t, readonly: n }) {
|
|
1497
|
-
let r =
|
|
1498
|
-
|
|
1497
|
+
let r = f(null), [i, a] = o.useState(!1), [s, c] = o.useState(!e);
|
|
1498
|
+
u(() => {
|
|
1499
1499
|
if (e && r.current) {
|
|
1500
1500
|
let t = r.current.getContext("2d");
|
|
1501
1501
|
if (t) {
|
|
@@ -1515,7 +1515,7 @@ function Mt({ value: e, onChange: t, readonly: n }) {
|
|
|
1515
1515
|
if (!i) return;
|
|
1516
1516
|
let o = t.getBoundingClientRect(), s = "touches" in e ? e.touches[0].clientX - o.left : e.clientX - o.left, l = "touches" in e ? e.touches[0].clientY - o.top : e.clientY - o.top;
|
|
1517
1517
|
i.beginPath(), i.moveTo(s, l);
|
|
1518
|
-
},
|
|
1518
|
+
}, d = (e) => {
|
|
1519
1519
|
if (!i || n) return;
|
|
1520
1520
|
let t = r.current;
|
|
1521
1521
|
if (!t) return;
|
|
@@ -1523,46 +1523,46 @@ function Mt({ value: e, onChange: t, readonly: n }) {
|
|
|
1523
1523
|
if (!a) return;
|
|
1524
1524
|
let o = t.getBoundingClientRect(), s = "touches" in e ? e.touches[0].clientX - o.left : e.clientX - o.left, c = "touches" in e ? e.touches[0].clientY - o.top : e.clientY - o.top;
|
|
1525
1525
|
a.lineTo(s, c), a.strokeStyle = "#000", a.lineWidth = 2, a.lineCap = "round", a.lineJoin = "round", a.stroke();
|
|
1526
|
-
},
|
|
1526
|
+
}, p = () => {
|
|
1527
1527
|
if (!i) return;
|
|
1528
1528
|
a(!1);
|
|
1529
1529
|
let e = r.current;
|
|
1530
1530
|
e && t(e.toDataURL("image/png"));
|
|
1531
1531
|
};
|
|
1532
|
-
return n && e ? /* @__PURE__ */
|
|
1532
|
+
return n && e ? /* @__PURE__ */ F("div", {
|
|
1533
1533
|
className: "border rounded p-2 bg-white",
|
|
1534
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ F("img", {
|
|
1535
1535
|
src: e,
|
|
1536
1536
|
alt: "Signature",
|
|
1537
1537
|
loading: "lazy",
|
|
1538
1538
|
className: "max-w-full h-auto"
|
|
1539
1539
|
})
|
|
1540
|
-
}) : n && !e ? /* @__PURE__ */
|
|
1540
|
+
}) : n && !e ? /* @__PURE__ */ F("span", {
|
|
1541
1541
|
className: "text-sm text-muted-foreground",
|
|
1542
1542
|
children: "No signature"
|
|
1543
|
-
}) : /* @__PURE__ */
|
|
1543
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1544
1544
|
className: "space-y-2",
|
|
1545
|
-
children: [/* @__PURE__ */
|
|
1545
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1546
1546
|
className: "border rounded bg-white",
|
|
1547
|
-
children: /* @__PURE__ */
|
|
1547
|
+
children: /* @__PURE__ */ F("canvas", {
|
|
1548
1548
|
ref: r,
|
|
1549
1549
|
width: 400,
|
|
1550
1550
|
height: 200,
|
|
1551
1551
|
className: "w-full touch-none cursor-crosshair",
|
|
1552
1552
|
onMouseDown: l,
|
|
1553
|
-
onMouseMove:
|
|
1554
|
-
onMouseUp:
|
|
1555
|
-
onMouseLeave:
|
|
1553
|
+
onMouseMove: d,
|
|
1554
|
+
onMouseUp: p,
|
|
1555
|
+
onMouseLeave: p,
|
|
1556
1556
|
onTouchStart: l,
|
|
1557
|
-
onTouchMove:
|
|
1558
|
-
onTouchEnd:
|
|
1557
|
+
onTouchMove: d,
|
|
1558
|
+
onTouchEnd: p
|
|
1559
1559
|
})
|
|
1560
|
-
}), /* @__PURE__ */
|
|
1560
|
+
}), /* @__PURE__ */ I("div", {
|
|
1561
1561
|
className: "flex justify-between items-center",
|
|
1562
|
-
children: [/* @__PURE__ */
|
|
1562
|
+
children: [/* @__PURE__ */ F("p", {
|
|
1563
1563
|
className: "text-xs text-muted-foreground",
|
|
1564
|
-
children:
|
|
1565
|
-
}), /* @__PURE__ */
|
|
1564
|
+
children: s ? "Sign above" : "Signature captured"
|
|
1565
|
+
}), /* @__PURE__ */ I(y, {
|
|
1566
1566
|
type: "button",
|
|
1567
1567
|
variant: "outline",
|
|
1568
1568
|
size: "sm",
|
|
@@ -1572,8 +1572,8 @@ function Mt({ value: e, onChange: t, readonly: n }) {
|
|
|
1572
1572
|
let n = e.getContext("2d");
|
|
1573
1573
|
n && (n.clearRect(0, 0, e.width, e.height), c(!0), t(""));
|
|
1574
1574
|
},
|
|
1575
|
-
disabled: n ||
|
|
1576
|
-
children: [/* @__PURE__ */
|
|
1575
|
+
disabled: n || s,
|
|
1576
|
+
children: [/* @__PURE__ */ F(le, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
1577
1577
|
})]
|
|
1578
1578
|
})]
|
|
1579
1579
|
});
|
|
@@ -1582,60 +1582,60 @@ function Mt({ value: e, onChange: t, readonly: n }) {
|
|
|
1582
1582
|
//#region src/widgets/QRCodeField.tsx
|
|
1583
1583
|
var Nt = /* @__PURE__ */ e({ QRCodeField: () => Pt });
|
|
1584
1584
|
function Pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1585
|
-
let [a,
|
|
1586
|
-
return r ? /* @__PURE__ */
|
|
1585
|
+
let [a, s] = o.useState(!1), c = n || i.schema;
|
|
1586
|
+
return r ? /* @__PURE__ */ I("div", {
|
|
1587
1587
|
className: "flex items-center gap-3",
|
|
1588
|
-
children: [/* @__PURE__ */
|
|
1588
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1589
1589
|
className: "text-sm flex-1 truncate",
|
|
1590
|
-
children: e || /* @__PURE__ */
|
|
1591
|
-
}), e && /* @__PURE__ */
|
|
1590
|
+
children: e || /* @__PURE__ */ F(T, {})
|
|
1591
|
+
}), e && /* @__PURE__ */ I(y, {
|
|
1592
1592
|
type: "button",
|
|
1593
1593
|
variant: "outline",
|
|
1594
1594
|
size: "sm",
|
|
1595
|
-
onClick: () =>
|
|
1595
|
+
onClick: () => s(!a),
|
|
1596
1596
|
children: [
|
|
1597
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ F(xe, { className: "w-4 h-4 mr-2" }),
|
|
1598
1598
|
a ? "Hide" : "Show",
|
|
1599
1599
|
" QR"
|
|
1600
1600
|
]
|
|
1601
1601
|
})]
|
|
1602
|
-
}) : /* @__PURE__ */
|
|
1602
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1603
1603
|
className: "space-y-3",
|
|
1604
1604
|
children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ I("div", {
|
|
1606
1606
|
className: "flex items-center gap-2",
|
|
1607
|
-
children: [/* @__PURE__ */
|
|
1607
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1608
1608
|
type: "text",
|
|
1609
1609
|
value: e || "",
|
|
1610
1610
|
onChange: (e) => t(e.target.value),
|
|
1611
1611
|
placeholder: c?.placeholder || "Enter text for QR code",
|
|
1612
1612
|
disabled: r || i.disabled,
|
|
1613
1613
|
className: i.className
|
|
1614
|
-
}), e && /* @__PURE__ */
|
|
1614
|
+
}), e && /* @__PURE__ */ I(we, { children: [/* @__PURE__ */ F(y, {
|
|
1615
1615
|
type: "button",
|
|
1616
1616
|
variant: "outline",
|
|
1617
1617
|
size: "sm",
|
|
1618
1618
|
onClick: () => {
|
|
1619
1619
|
e && navigator.clipboard.writeText(e);
|
|
1620
1620
|
},
|
|
1621
|
-
children: /* @__PURE__ */
|
|
1622
|
-
}), /* @__PURE__ */
|
|
1621
|
+
children: /* @__PURE__ */ F(oe, { className: "w-4 h-4" })
|
|
1622
|
+
}), /* @__PURE__ */ F(y, {
|
|
1623
1623
|
type: "button",
|
|
1624
1624
|
variant: "outline",
|
|
1625
1625
|
size: "sm",
|
|
1626
|
-
onClick: () =>
|
|
1627
|
-
children: /* @__PURE__ */
|
|
1626
|
+
onClick: () => s(!a),
|
|
1627
|
+
children: /* @__PURE__ */ F(xe, { className: "w-4 h-4" })
|
|
1628
1628
|
})] })]
|
|
1629
1629
|
}),
|
|
1630
|
-
a && e && /* @__PURE__ */
|
|
1630
|
+
a && e && /* @__PURE__ */ F("div", {
|
|
1631
1631
|
className: "border rounded p-4 bg-white flex justify-center",
|
|
1632
|
-
children: /* @__PURE__ */
|
|
1632
|
+
children: /* @__PURE__ */ F("img", {
|
|
1633
1633
|
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(e),
|
|
1634
1634
|
alt: "QR Code",
|
|
1635
1635
|
className: "w-48 h-48"
|
|
1636
1636
|
})
|
|
1637
1637
|
}),
|
|
1638
|
-
e && /* @__PURE__ */
|
|
1638
|
+
e && /* @__PURE__ */ I("p", {
|
|
1639
1639
|
className: "text-xs text-muted-foreground",
|
|
1640
1640
|
children: [
|
|
1641
1641
|
"QR code contains: ",
|
|
@@ -1661,24 +1661,24 @@ function It({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1661
1661
|
}, u = (e) => {
|
|
1662
1662
|
console.log("View detail:", e);
|
|
1663
1663
|
};
|
|
1664
|
-
return r ? /* @__PURE__ */
|
|
1665
|
-
className:
|
|
1666
|
-
children: [o.length === 0 ? /* @__PURE__ */
|
|
1664
|
+
return r ? /* @__PURE__ */ I("div", {
|
|
1665
|
+
className: M("space-y-2", i),
|
|
1666
|
+
children: [o.length === 0 ? /* @__PURE__ */ F("span", {
|
|
1667
1667
|
className: "text-sm text-muted-foreground",
|
|
1668
1668
|
children: "No related records"
|
|
1669
|
-
}) : o.map((e) => /* @__PURE__ */
|
|
1669
|
+
}) : o.map((e) => /* @__PURE__ */ I("div", {
|
|
1670
1670
|
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
1671
|
-
children: [/* @__PURE__ */
|
|
1671
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1672
1672
|
className: "text-sm",
|
|
1673
1673
|
children: e.label
|
|
1674
|
-
}), /* @__PURE__ */
|
|
1674
|
+
}), /* @__PURE__ */ F(y, {
|
|
1675
1675
|
type: "button",
|
|
1676
1676
|
variant: "ghost",
|
|
1677
1677
|
size: "sm",
|
|
1678
1678
|
onClick: () => u(e),
|
|
1679
|
-
children: /* @__PURE__ */
|
|
1679
|
+
children: /* @__PURE__ */ F(ue, { className: "w-4 h-4" })
|
|
1680
1680
|
})]
|
|
1681
|
-
}, e.id)), /* @__PURE__ */
|
|
1681
|
+
}, e.id)), /* @__PURE__ */ I("p", {
|
|
1682
1682
|
className: "text-xs text-muted-foreground",
|
|
1683
1683
|
children: [
|
|
1684
1684
|
o.length,
|
|
@@ -1686,50 +1686,50 @@ function It({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
1686
1686
|
o.length === 1 ? "record" : "records"
|
|
1687
1687
|
]
|
|
1688
1688
|
})]
|
|
1689
|
-
}) : /* @__PURE__ */
|
|
1690
|
-
className:
|
|
1691
|
-
children: [/* @__PURE__ */
|
|
1689
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1690
|
+
className: M("space-y-3", i),
|
|
1691
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1692
1692
|
className: "space-y-2",
|
|
1693
|
-
children: [o.map((e) => /* @__PURE__ */
|
|
1693
|
+
children: [o.map((e) => /* @__PURE__ */ I("div", {
|
|
1694
1694
|
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
1695
|
-
children: [/* @__PURE__ */
|
|
1695
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1696
1696
|
className: "flex items-center gap-2 flex-1",
|
|
1697
|
-
children: [/* @__PURE__ */
|
|
1697
|
+
children: [/* @__PURE__ */ F(v, {
|
|
1698
1698
|
variant: "outline",
|
|
1699
1699
|
children: e.id
|
|
1700
|
-
}), /* @__PURE__ */
|
|
1700
|
+
}), /* @__PURE__ */ F("span", {
|
|
1701
1701
|
className: "text-sm flex-1",
|
|
1702
1702
|
children: e.label
|
|
1703
1703
|
})]
|
|
1704
|
-
}), /* @__PURE__ */
|
|
1704
|
+
}), /* @__PURE__ */ I("div", {
|
|
1705
1705
|
className: "flex items-center gap-1",
|
|
1706
|
-
children: [/* @__PURE__ */
|
|
1706
|
+
children: [/* @__PURE__ */ F(y, {
|
|
1707
1707
|
type: "button",
|
|
1708
1708
|
variant: "ghost",
|
|
1709
1709
|
size: "sm",
|
|
1710
1710
|
onClick: () => u(e),
|
|
1711
|
-
children: /* @__PURE__ */
|
|
1712
|
-
}), /* @__PURE__ */
|
|
1711
|
+
children: /* @__PURE__ */ F(ue, { className: "w-4 h-4" })
|
|
1712
|
+
}), /* @__PURE__ */ F(y, {
|
|
1713
1713
|
type: "button",
|
|
1714
1714
|
variant: "ghost",
|
|
1715
1715
|
size: "sm",
|
|
1716
1716
|
onClick: () => l(e.id),
|
|
1717
1717
|
disabled: a.disabled,
|
|
1718
|
-
children: /* @__PURE__ */
|
|
1718
|
+
children: /* @__PURE__ */ F(P, { className: "w-4 h-4" })
|
|
1719
1719
|
})]
|
|
1720
1720
|
})]
|
|
1721
|
-
}, e.id)), o.length === 0 && /* @__PURE__ */
|
|
1721
|
+
}, e.id)), o.length === 0 && /* @__PURE__ */ F("div", {
|
|
1722
1722
|
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
1723
1723
|
children: "No related records"
|
|
1724
1724
|
})]
|
|
1725
|
-
}), /* @__PURE__ */
|
|
1725
|
+
}), /* @__PURE__ */ I(y, {
|
|
1726
1726
|
type: "button",
|
|
1727
1727
|
variant: "outline",
|
|
1728
1728
|
className: "w-full",
|
|
1729
1729
|
onClick: c,
|
|
1730
1730
|
disabled: a.disabled,
|
|
1731
1731
|
children: [
|
|
1732
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ F(be, { className: "w-4 h-4 mr-2" }),
|
|
1733
1733
|
"Add ",
|
|
1734
1734
|
s?.label || "Record"
|
|
1735
1735
|
]
|
|
@@ -1818,15 +1818,15 @@ function Vt(e) {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
function q({ value: e }) {
|
|
1820
1820
|
let t = W(e);
|
|
1821
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
1821
|
+
return t == null || t === "" ? /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ F("span", {
|
|
1822
1822
|
className: "truncate",
|
|
1823
1823
|
children: String(t)
|
|
1824
1824
|
});
|
|
1825
1825
|
}
|
|
1826
1826
|
function Ht({ value: e, field: t }) {
|
|
1827
|
-
if (e == null) return /* @__PURE__ */
|
|
1827
|
+
if (e == null) return /* @__PURE__ */ F(T, {});
|
|
1828
1828
|
let n = W(e), r = t.precision ?? 0, i = Number(n);
|
|
1829
|
-
return /* @__PURE__ */
|
|
1829
|
+
return /* @__PURE__ */ F("span", {
|
|
1830
1830
|
className: "tabular-nums",
|
|
1831
1831
|
children: isNaN(i) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
1832
1832
|
minimumFractionDigits: r,
|
|
@@ -1835,35 +1835,35 @@ function Ht({ value: e, field: t }) {
|
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
1837
|
function Ut({ value: e, field: t }) {
|
|
1838
|
-
if (e == null) return /* @__PURE__ */
|
|
1838
|
+
if (e == null) return /* @__PURE__ */ F(T, {});
|
|
1839
1839
|
let n = W(e), r = t.currency || "USD", i = Number(n);
|
|
1840
|
-
return /* @__PURE__ */
|
|
1840
|
+
return /* @__PURE__ */ F("span", {
|
|
1841
1841
|
className: "tabular-nums font-medium whitespace-nowrap",
|
|
1842
1842
|
children: isNaN(i) ? String(n) : Lt(i, r)
|
|
1843
1843
|
});
|
|
1844
1844
|
}
|
|
1845
1845
|
var Wt = /progress|completion/;
|
|
1846
1846
|
function Gt({ value: e, field: t }) {
|
|
1847
|
-
if (e == null) return /* @__PURE__ */
|
|
1847
|
+
if (e == null) return /* @__PURE__ */ F(T, {});
|
|
1848
1848
|
let n = W(e), r = t.precision ?? 0, i = Number(n);
|
|
1849
|
-
if (isNaN(i)) return /* @__PURE__ */
|
|
1849
|
+
if (isNaN(i)) return /* @__PURE__ */ F("span", {
|
|
1850
1850
|
className: "tabular-nums whitespace-nowrap",
|
|
1851
1851
|
children: String(n)
|
|
1852
1852
|
});
|
|
1853
1853
|
let a = Wt.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : zt(i, r), c = Math.max(0, Math.min(100, o));
|
|
1854
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ I("div", {
|
|
1855
1855
|
className: "flex items-center gap-2",
|
|
1856
|
-
children: [/* @__PURE__ */
|
|
1856
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1857
1857
|
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",
|
|
1858
1858
|
role: "progressbar",
|
|
1859
1859
|
"aria-valuenow": c,
|
|
1860
1860
|
"aria-valuemin": 0,
|
|
1861
1861
|
"aria-valuemax": 100,
|
|
1862
|
-
children: /* @__PURE__ */
|
|
1862
|
+
children: /* @__PURE__ */ F("div", {
|
|
1863
1863
|
className: "h-full rounded-full bg-primary transition-all",
|
|
1864
1864
|
style: { width: `${c}%` }
|
|
1865
1865
|
})
|
|
1866
|
-
}), /* @__PURE__ */
|
|
1866
|
+
}), /* @__PURE__ */ F("span", {
|
|
1867
1867
|
className: "tabular-nums whitespace-nowrap",
|
|
1868
1868
|
children: s
|
|
1869
1869
|
})]
|
|
@@ -1878,33 +1878,33 @@ var Kt = new Set([
|
|
|
1878
1878
|
"is_verified"
|
|
1879
1879
|
]);
|
|
1880
1880
|
function qt({ value: e, field: t }) {
|
|
1881
|
-
if (e == null) return /* @__PURE__ */
|
|
1881
|
+
if (e == null) return /* @__PURE__ */ F("span", {
|
|
1882
1882
|
className: "flex items-center justify-center",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
1883
|
+
children: /* @__PURE__ */ F(T, {})
|
|
1884
1884
|
});
|
|
1885
1885
|
let n = t?.name?.toLowerCase() || "";
|
|
1886
|
-
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */
|
|
1886
|
+
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ F("div", {
|
|
1887
1887
|
className: "flex items-center justify-center",
|
|
1888
|
-
children: e ? /* @__PURE__ */
|
|
1888
|
+
children: e ? /* @__PURE__ */ F("div", {
|
|
1889
1889
|
className: "size-5 rounded-full bg-green-500 flex items-center justify-center",
|
|
1890
1890
|
role: "img",
|
|
1891
1891
|
"aria-label": "Completed",
|
|
1892
1892
|
"data-testid": "completion-indicator",
|
|
1893
|
-
children: /* @__PURE__ */
|
|
1894
|
-
}) : /* @__PURE__ */
|
|
1893
|
+
children: /* @__PURE__ */ F(N, { className: "size-3 text-white" })
|
|
1894
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1895
1895
|
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
1896
1896
|
role: "img",
|
|
1897
1897
|
"aria-label": "Not completed",
|
|
1898
1898
|
"data-testid": "completion-indicator"
|
|
1899
1899
|
})
|
|
1900
|
-
}) : Kt.has(n) && !e ? /* @__PURE__ */
|
|
1900
|
+
}) : Kt.has(n) && !e ? /* @__PURE__ */ I(v, {
|
|
1901
1901
|
variant: "destructive",
|
|
1902
1902
|
className: "text-xs",
|
|
1903
1903
|
"data-testid": "boolean-warning-badge",
|
|
1904
1904
|
children: [t?.label || G(n), " — Off"]
|
|
1905
|
-
}) : /* @__PURE__ */
|
|
1905
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1906
1906
|
className: "flex items-center justify-center",
|
|
1907
|
-
children: /* @__PURE__ */
|
|
1907
|
+
children: /* @__PURE__ */ F(b, {
|
|
1908
1908
|
checked: !!e,
|
|
1909
1909
|
disabled: !0,
|
|
1910
1910
|
className: "pointer-events-none"
|
|
@@ -1912,20 +1912,20 @@ function qt({ value: e, field: t }) {
|
|
|
1912
1912
|
});
|
|
1913
1913
|
}
|
|
1914
1914
|
function Jt({ value: e, field: t }) {
|
|
1915
|
-
if (!e) return /* @__PURE__ */
|
|
1915
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
1916
1916
|
let n = W(e), r = t, i = K(n, r.format || "relative"), a = typeof n == "string" ? new Date(n) : n, o = a instanceof Date && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
|
|
1917
1917
|
s.setHours(0, 0, 0, 0);
|
|
1918
1918
|
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__ */
|
|
1919
|
+
return /* @__PURE__ */ F("span", {
|
|
1920
1920
|
className: `tabular-nums${l ? " text-red-600" : ""}`,
|
|
1921
1921
|
title: u,
|
|
1922
1922
|
children: i
|
|
1923
1923
|
});
|
|
1924
1924
|
}
|
|
1925
1925
|
function Yt({ value: e }) {
|
|
1926
|
-
if (!e) return /* @__PURE__ */
|
|
1926
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
1927
1927
|
let t = W(e), n = typeof t == "string" ? new Date(t) : t;
|
|
1928
|
-
if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */
|
|
1928
|
+
if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */ F(T, {});
|
|
1929
1929
|
let r = n.toLocaleDateString(void 0, {
|
|
1930
1930
|
month: "numeric",
|
|
1931
1931
|
day: "numeric",
|
|
@@ -1935,9 +1935,9 @@ function Yt({ value: e }) {
|
|
|
1935
1935
|
minute: "2-digit",
|
|
1936
1936
|
hour12: !0
|
|
1937
1937
|
}).toLowerCase();
|
|
1938
|
-
return /* @__PURE__ */
|
|
1938
|
+
return /* @__PURE__ */ I("span", {
|
|
1939
1939
|
className: "tabular-nums text-sm whitespace-nowrap",
|
|
1940
|
-
children: [/* @__PURE__ */
|
|
1940
|
+
children: [/* @__PURE__ */ F("span", { children: r }), /* @__PURE__ */ F("span", {
|
|
1941
1941
|
className: "ml-2 text-muted-foreground",
|
|
1942
1942
|
children: i
|
|
1943
1943
|
})]
|
|
@@ -2008,12 +2008,12 @@ function $t(e, t) {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
function Y({ value: e, field: t }) {
|
|
2010
2010
|
let n = t.options || [];
|
|
2011
|
-
if (e == null || e === "") return /* @__PURE__ */
|
|
2012
|
-
if (Array.isArray(e)) return /* @__PURE__ */
|
|
2011
|
+
if (e == null || e === "") return /* @__PURE__ */ F(T, {});
|
|
2012
|
+
if (Array.isArray(e)) return /* @__PURE__ */ F("div", {
|
|
2013
2013
|
className: "flex flex-wrap gap-1",
|
|
2014
2014
|
children: e.map((e, t) => {
|
|
2015
2015
|
let r = n.find((t) => t.value === e), i = r?.label || G(String(e));
|
|
2016
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ F(v, {
|
|
2017
2017
|
variant: "outline",
|
|
2018
2018
|
className: $t(r?.color, e),
|
|
2019
2019
|
children: i
|
|
@@ -2021,27 +2021,27 @@ function Y({ value: e, field: t }) {
|
|
|
2021
2021
|
})
|
|
2022
2022
|
});
|
|
2023
2023
|
let r = n.find((t) => t.value === e), i = r?.label || G(String(e));
|
|
2024
|
-
return /* @__PURE__ */
|
|
2024
|
+
return /* @__PURE__ */ F(v, {
|
|
2025
2025
|
variant: "outline",
|
|
2026
2026
|
className: $t(r?.color, e),
|
|
2027
2027
|
children: i
|
|
2028
2028
|
});
|
|
2029
2029
|
}
|
|
2030
2030
|
function en({ value: e }) {
|
|
2031
|
-
if (!e) return /* @__PURE__ */
|
|
2032
|
-
let t = String(W(e) ?? ""), [n, r] =
|
|
2033
|
-
return /* @__PURE__ */
|
|
2031
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
2032
|
+
let t = String(W(e) ?? ""), [n, r] = o.useState(!1);
|
|
2033
|
+
return /* @__PURE__ */ I("span", {
|
|
2034
2034
|
className: "inline-flex items-center gap-1 group/email",
|
|
2035
|
-
children: [/* @__PURE__ */
|
|
2035
|
+
children: [/* @__PURE__ */ F(y, {
|
|
2036
2036
|
variant: "link",
|
|
2037
2037
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
2038
2038
|
asChild: !0,
|
|
2039
|
-
children: /* @__PURE__ */
|
|
2039
|
+
children: /* @__PURE__ */ F("a", {
|
|
2040
2040
|
href: `mailto:${t}`,
|
|
2041
2041
|
onClick: (e) => e.stopPropagation(),
|
|
2042
2042
|
children: t
|
|
2043
2043
|
})
|
|
2044
|
-
}), /* @__PURE__ */
|
|
2044
|
+
}), /* @__PURE__ */ F("button", {
|
|
2045
2045
|
type: "button",
|
|
2046
2046
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2047
2047
|
onClick: (e) => {
|
|
@@ -2050,18 +2050,18 @@ function en({ value: e }) {
|
|
|
2050
2050
|
}).catch(() => {});
|
|
2051
2051
|
},
|
|
2052
2052
|
"aria-label": "Copy email",
|
|
2053
|
-
children: n ? /* @__PURE__ */
|
|
2053
|
+
children: n ? /* @__PURE__ */ F(N, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ F(oe, { className: "h-3 w-3 text-muted-foreground" })
|
|
2054
2054
|
})]
|
|
2055
2055
|
});
|
|
2056
2056
|
}
|
|
2057
2057
|
function tn({ value: e }) {
|
|
2058
|
-
if (!e) return /* @__PURE__ */
|
|
2058
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
2059
2059
|
let t = String(W(e) ?? "");
|
|
2060
|
-
return /* @__PURE__ */
|
|
2060
|
+
return /* @__PURE__ */ F(y, {
|
|
2061
2061
|
variant: "link",
|
|
2062
2062
|
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
2063
2063
|
asChild: !0,
|
|
2064
|
-
children: /* @__PURE__ */
|
|
2064
|
+
children: /* @__PURE__ */ F("a", {
|
|
2065
2065
|
href: t,
|
|
2066
2066
|
target: "_blank",
|
|
2067
2067
|
rel: "noopener noreferrer",
|
|
@@ -2071,16 +2071,16 @@ function tn({ value: e }) {
|
|
|
2071
2071
|
});
|
|
2072
2072
|
}
|
|
2073
2073
|
function nn({ value: e }) {
|
|
2074
|
-
if (!e) return /* @__PURE__ */
|
|
2075
|
-
let t = String(W(e) ?? ""), [n, r] =
|
|
2076
|
-
return /* @__PURE__ */
|
|
2074
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
2075
|
+
let t = String(W(e) ?? ""), [n, r] = o.useState(!1);
|
|
2076
|
+
return /* @__PURE__ */ I("span", {
|
|
2077
2077
|
className: "inline-flex items-center gap-1 group/phone",
|
|
2078
|
-
children: [/* @__PURE__ */
|
|
2078
|
+
children: [/* @__PURE__ */ I("a", {
|
|
2079
2079
|
href: `tel:${t}`,
|
|
2080
2080
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
2081
2081
|
onClick: (e) => e.stopPropagation(),
|
|
2082
|
-
children: [/* @__PURE__ */
|
|
2083
|
-
}), /* @__PURE__ */
|
|
2082
|
+
children: [/* @__PURE__ */ F(ye, { className: "h-3 w-3" }), t]
|
|
2083
|
+
}), /* @__PURE__ */ F("button", {
|
|
2084
2084
|
type: "button",
|
|
2085
2085
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2086
2086
|
onClick: (e) => {
|
|
@@ -2089,15 +2089,15 @@ function nn({ value: e }) {
|
|
|
2089
2089
|
}).catch(() => {});
|
|
2090
2090
|
},
|
|
2091
2091
|
"aria-label": "Copy phone number",
|
|
2092
|
-
children: n ? /* @__PURE__ */
|
|
2092
|
+
children: n ? /* @__PURE__ */ F(N, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ F(oe, { className: "h-3 w-3 text-muted-foreground" })
|
|
2093
2093
|
})]
|
|
2094
2094
|
});
|
|
2095
2095
|
}
|
|
2096
2096
|
function rn({ value: e, field: t }) {
|
|
2097
|
-
if (!e) return /* @__PURE__ */
|
|
2097
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
2098
2098
|
if (t.multiple, Array.isArray(e)) {
|
|
2099
2099
|
let t = e.length;
|
|
2100
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ I("span", {
|
|
2101
2101
|
className: "text-sm text-gray-600",
|
|
2102
2102
|
children: [
|
|
2103
2103
|
t,
|
|
@@ -2106,30 +2106,30 @@ function rn({ value: e, field: t }) {
|
|
|
2106
2106
|
]
|
|
2107
2107
|
});
|
|
2108
2108
|
}
|
|
2109
|
-
return /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ F("span", {
|
|
2110
2110
|
className: "text-sm truncate",
|
|
2111
2111
|
children: e.name || e.original_name || "File"
|
|
2112
2112
|
});
|
|
2113
2113
|
}
|
|
2114
2114
|
function an({ value: e }) {
|
|
2115
|
-
return e ? Array.isArray(e) ? /* @__PURE__ */
|
|
2115
|
+
return e ? Array.isArray(e) ? /* @__PURE__ */ I("div", {
|
|
2116
2116
|
className: "flex -space-x-2",
|
|
2117
|
-
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */
|
|
2117
|
+
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */ F("img", {
|
|
2118
2118
|
src: e.url || "",
|
|
2119
2119
|
alt: e.name || `Image ${t + 1}`,
|
|
2120
2120
|
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
2121
|
-
}, t)), e.length > 3 && /* @__PURE__ */
|
|
2121
|
+
}, t)), e.length > 3 && /* @__PURE__ */ I("div", {
|
|
2122
2122
|
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
2123
|
children: ["+", e.length - 3]
|
|
2124
2124
|
})]
|
|
2125
|
-
}) : /* @__PURE__ */
|
|
2125
|
+
}) : /* @__PURE__ */ F("img", {
|
|
2126
2126
|
src: e.url || "",
|
|
2127
2127
|
alt: e.name || "Image",
|
|
2128
2128
|
className: "size-10 rounded-md object-cover"
|
|
2129
|
-
}) : /* @__PURE__ */
|
|
2129
|
+
}) : /* @__PURE__ */ F(T, {});
|
|
2130
2130
|
}
|
|
2131
2131
|
function X({ value: e, field: t }) {
|
|
2132
|
-
if (e == null || e === "") return /* @__PURE__ */
|
|
2132
|
+
if (e == null || e === "") return /* @__PURE__ */ F(T, {});
|
|
2133
2133
|
let n = t.options || [], r = (e) => {
|
|
2134
2134
|
if (n.length > 0) {
|
|
2135
2135
|
let t = n.find((t) => String(t.value) === String(e));
|
|
@@ -2137,70 +2137,70 @@ function X({ value: e, field: t }) {
|
|
|
2137
2137
|
}
|
|
2138
2138
|
return String(e);
|
|
2139
2139
|
};
|
|
2140
|
-
return Array.isArray(e) ? /* @__PURE__ */
|
|
2140
|
+
return Array.isArray(e) ? /* @__PURE__ */ F("div", {
|
|
2141
2141
|
className: "flex flex-wrap gap-1",
|
|
2142
2142
|
children: e.map((e, t) => {
|
|
2143
2143
|
let n;
|
|
2144
|
-
return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */
|
|
2144
|
+
return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */ F("span", {
|
|
2145
2145
|
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
2146
|
children: n
|
|
2147
2147
|
}, t);
|
|
2148
2148
|
})
|
|
2149
|
-
}) : typeof e == "object" && e ? /* @__PURE__ */
|
|
2149
|
+
}) : typeof e == "object" && e ? /* @__PURE__ */ F("span", {
|
|
2150
2150
|
className: "truncate",
|
|
2151
2151
|
children: e.name || e.label || e.id || e._id || "[Object]"
|
|
2152
|
-
}) : /* @__PURE__ */
|
|
2152
|
+
}) : /* @__PURE__ */ F("span", {
|
|
2153
2153
|
className: "truncate",
|
|
2154
2154
|
children: r(e)
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
2157
2157
|
function on({ value: e }) {
|
|
2158
2158
|
let t = W(e);
|
|
2159
|
-
return t == null || t === "" ? /* @__PURE__ */
|
|
2159
|
+
return t == null || t === "" ? /* @__PURE__ */ F(T, {}) : /* @__PURE__ */ F("span", {
|
|
2160
2160
|
className: "text-gray-700 font-mono text-sm",
|
|
2161
2161
|
children: String(t)
|
|
2162
2162
|
});
|
|
2163
2163
|
}
|
|
2164
2164
|
function Z({ value: e }) {
|
|
2165
|
-
if (!e) return /* @__PURE__ */
|
|
2166
|
-
if (typeof e != "object") return /* @__PURE__ */
|
|
2165
|
+
if (!e) return /* @__PURE__ */ F(T, {});
|
|
2166
|
+
if (typeof e != "object") return /* @__PURE__ */ F("span", {
|
|
2167
2167
|
className: "truncate",
|
|
2168
2168
|
children: String(e)
|
|
2169
2169
|
});
|
|
2170
|
-
if (Array.isArray(e)) return /* @__PURE__ */
|
|
2170
|
+
if (Array.isArray(e)) return /* @__PURE__ */ I("div", {
|
|
2171
2171
|
className: "flex -space-x-2",
|
|
2172
2172
|
children: [e.slice(0, 3).map((e, t) => {
|
|
2173
|
-
if (typeof e != "object" || !e) return /* @__PURE__ */
|
|
2173
|
+
if (typeof e != "object" || !e) return /* @__PURE__ */ F("span", {
|
|
2174
2174
|
className: "truncate text-sm",
|
|
2175
2175
|
children: String(e)
|
|
2176
2176
|
}, t);
|
|
2177
2177
|
let n = e.name || e.username || "User";
|
|
2178
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ F(h, {
|
|
2179
2179
|
className: "size-8 border-2 border-white",
|
|
2180
2180
|
title: n,
|
|
2181
|
-
children: /* @__PURE__ */
|
|
2181
|
+
children: /* @__PURE__ */ F(g, {
|
|
2182
2182
|
className: "bg-blue-500 text-white text-xs",
|
|
2183
2183
|
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2184
2184
|
})
|
|
2185
2185
|
}, t);
|
|
2186
|
-
}), e.length > 3 && /* @__PURE__ */
|
|
2186
|
+
}), e.length > 3 && /* @__PURE__ */ F(h, {
|
|
2187
2187
|
className: "size-8 border-2 border-white",
|
|
2188
|
-
children: /* @__PURE__ */
|
|
2188
|
+
children: /* @__PURE__ */ I(g, {
|
|
2189
2189
|
className: "bg-gray-200 text-gray-600 text-xs",
|
|
2190
2190
|
children: ["+", e.length - 3]
|
|
2191
2191
|
})
|
|
2192
2192
|
})]
|
|
2193
2193
|
});
|
|
2194
2194
|
let t = e.name || e.username || "User";
|
|
2195
|
-
return /* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ I("div", {
|
|
2196
2196
|
className: "flex items-center gap-2",
|
|
2197
|
-
children: [/* @__PURE__ */
|
|
2197
|
+
children: [/* @__PURE__ */ F(h, {
|
|
2198
2198
|
className: "size-8",
|
|
2199
|
-
children: /* @__PURE__ */
|
|
2199
|
+
children: /* @__PURE__ */ F(g, {
|
|
2200
2200
|
className: "bg-blue-500 text-white text-xs",
|
|
2201
2201
|
children: t.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2202
2202
|
})
|
|
2203
|
-
}), /* @__PURE__ */
|
|
2203
|
+
}), /* @__PURE__ */ F("span", {
|
|
2204
2204
|
className: "truncate",
|
|
2205
2205
|
children: t
|
|
2206
2206
|
})]
|
|
@@ -2237,17 +2237,17 @@ function cn(e) {
|
|
|
2237
2237
|
auto_number: q,
|
|
2238
2238
|
user: Z,
|
|
2239
2239
|
owner: Z,
|
|
2240
|
-
password: () => /* @__PURE__ */
|
|
2240
|
+
password: () => /* @__PURE__ */ F("span", { children: "••••••" }),
|
|
2241
2241
|
location: q,
|
|
2242
|
-
object: () => /* @__PURE__ */
|
|
2242
|
+
object: () => /* @__PURE__ */ F("span", {
|
|
2243
2243
|
className: "text-gray-500 italic",
|
|
2244
2244
|
children: "[Object]"
|
|
2245
2245
|
}),
|
|
2246
|
-
vector: () => /* @__PURE__ */
|
|
2246
|
+
vector: () => /* @__PURE__ */ F("span", {
|
|
2247
2247
|
className: "text-gray-500 italic",
|
|
2248
2248
|
children: "[Vector]"
|
|
2249
2249
|
}),
|
|
2250
|
-
grid: () => /* @__PURE__ */
|
|
2250
|
+
grid: () => /* @__PURE__ */ F("span", {
|
|
2251
2251
|
className: "text-gray-500 italic",
|
|
2252
2252
|
children: "[Grid]"
|
|
2253
2253
|
})
|
|
@@ -2335,7 +2335,7 @@ function fn(e, t) {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
function $(e) {
|
|
2337
2337
|
let t = ({ schema: t, className: n, value: r, ...i }) => {
|
|
2338
|
-
let [a,
|
|
2338
|
+
let [a, s] = o.useState(r ?? t?.value ?? ""), c = {
|
|
2339
2339
|
name: t?.name || "field",
|
|
2340
2340
|
label: t?.label,
|
|
2341
2341
|
type: t?.type,
|
|
@@ -2346,27 +2346,27 @@ function $(e) {
|
|
|
2346
2346
|
description: t?.description,
|
|
2347
2347
|
defaultValue: t?.defaultValue || t?.value,
|
|
2348
2348
|
...t
|
|
2349
|
-
}, l =
|
|
2350
|
-
|
|
2349
|
+
}, l = o.useCallback((e) => {
|
|
2350
|
+
s(e), i.onChange && i.onChange(e);
|
|
2351
2351
|
}, [i]), u = t?.readonly || t?.readOnly || !1;
|
|
2352
|
-
return /* @__PURE__ */
|
|
2352
|
+
return /* @__PURE__ */ I("div", {
|
|
2353
2353
|
className: "grid w-full items-center gap-1.5",
|
|
2354
2354
|
"data-obj-id": t?.id,
|
|
2355
2355
|
"data-obj-type": t?.type,
|
|
2356
2356
|
children: [
|
|
2357
|
-
t?.label && /* @__PURE__ */
|
|
2357
|
+
t?.label && /* @__PURE__ */ F("label", {
|
|
2358
2358
|
htmlFor: t.id,
|
|
2359
2359
|
className: t.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "",
|
|
2360
2360
|
children: t.label
|
|
2361
2361
|
}),
|
|
2362
|
-
/* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ F(e, {
|
|
2363
2363
|
value: a,
|
|
2364
2364
|
onChange: l,
|
|
2365
2365
|
field: c,
|
|
2366
2366
|
readonly: u,
|
|
2367
2367
|
className: n
|
|
2368
2368
|
}),
|
|
2369
|
-
t?.description && /* @__PURE__ */
|
|
2369
|
+
t?.description && /* @__PURE__ */ F("p", {
|
|
2370
2370
|
className: "text-sm text-gray-500",
|
|
2371
2371
|
children: t.description
|
|
2372
2372
|
})
|
|
@@ -2376,26 +2376,26 @@ function $(e) {
|
|
|
2376
2376
|
return t.displayName = `FieldRenderer(${e.displayName || e.name || "Component"})`, t;
|
|
2377
2377
|
}
|
|
2378
2378
|
var pn = {
|
|
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(() =>
|
|
2379
|
+
text: () => Promise.resolve().then(() => Ee).then((e) => ({ default: e.TextField })),
|
|
2380
|
+
textarea: () => Promise.resolve().then(() => Ge).then((e) => ({ default: e.TextAreaField })),
|
|
2381
|
+
number: () => Promise.resolve().then(() => Oe).then((e) => ({ default: e.NumberField })),
|
|
2382
|
+
boolean: () => Promise.resolve().then(() => Ae).then((e) => ({ default: e.BooleanField })),
|
|
2383
|
+
select: () => Promise.resolve().then(() => Me).then((e) => ({ default: e.SelectField })),
|
|
2384
|
+
date: () => Promise.resolve().then(() => Pe).then((e) => ({ default: e.DateField })),
|
|
2385
|
+
datetime: () => Promise.resolve().then(() => Je).then((e) => ({ default: e.DateTimeField })),
|
|
2386
|
+
time: () => Promise.resolve().then(() => Xe).then((e) => ({ default: e.TimeField })),
|
|
2387
|
+
email: () => Promise.resolve().then(() => Ie).then((e) => ({ default: e.EmailField })),
|
|
2388
|
+
phone: () => Promise.resolve().then(() => Re).then((e) => ({ default: e.PhoneField })),
|
|
2389
|
+
url: () => Promise.resolve().then(() => Be).then((e) => ({ default: e.UrlField })),
|
|
2390
|
+
currency: () => Promise.resolve().then(() => He).then((e) => ({ default: e.CurrencyField })),
|
|
2391
|
+
percent: () => Promise.resolve().then(() => Qe).then((e) => ({ default: e.PercentField })),
|
|
2392
|
+
password: () => Promise.resolve().then(() => $e).then((e) => ({ default: e.PasswordField })),
|
|
2393
|
+
markdown: () => Promise.resolve().then(() => qe).then((e) => ({ default: e.RichTextField })),
|
|
2394
|
+
html: () => Promise.resolve().then(() => qe).then((e) => ({ default: e.RichTextField })),
|
|
2395
2395
|
lookup: () => import("./LookupField-XRxsGgLS.js").then((e) => e.n).then((e) => ({ default: e.LookupField })),
|
|
2396
2396
|
master_detail: () => Promise.resolve().then(() => Ft).then((e) => ({ default: e.MasterDetailField })),
|
|
2397
|
-
file: () => Promise.resolve().then(() =>
|
|
2398
|
-
image: () => Promise.resolve().then(() =>
|
|
2397
|
+
file: () => Promise.resolve().then(() => et).then((e) => ({ default: e.FileField })),
|
|
2398
|
+
image: () => Promise.resolve().then(() => tt).then((e) => ({ default: e.ImageField })),
|
|
2399
2399
|
location: () => Promise.resolve().then(() => rt).then((e) => ({ default: e.LocationField })),
|
|
2400
2400
|
formula: () => Promise.resolve().then(() => at).then((e) => ({ default: e.FormulaField })),
|
|
2401
2401
|
summary: () => Promise.resolve().then(() => st).then((e) => ({ default: e.SummaryField })),
|
|
@@ -2404,10 +2404,10 @@ var pn = {
|
|
|
2404
2404
|
owner: () => Promise.resolve().then(() => dt).then((e) => ({ default: e.UserField })),
|
|
2405
2405
|
object: () => Promise.resolve().then(() => ft).then((e) => ({ default: e.ObjectField })),
|
|
2406
2406
|
vector: () => Promise.resolve().then(() => mt).then((e) => ({ default: e.VectorField })),
|
|
2407
|
-
grid: () => Promise.resolve().then(() =>
|
|
2408
|
-
color: () => Promise.resolve().then(() =>
|
|
2409
|
-
slider: () => Promise.resolve().then(() =>
|
|
2410
|
-
rating: () => Promise.resolve().then(() =>
|
|
2407
|
+
grid: () => Promise.resolve().then(() => ht).then((e) => ({ default: e.GridField })),
|
|
2408
|
+
color: () => Promise.resolve().then(() => _t).then((e) => ({ default: e.ColorField })),
|
|
2409
|
+
slider: () => Promise.resolve().then(() => yt).then((e) => ({ default: e.SliderField })),
|
|
2410
|
+
rating: () => Promise.resolve().then(() => xt).then((e) => ({ default: e.RatingField })),
|
|
2411
2411
|
code: () => Promise.resolve().then(() => Ct).then((e) => ({ default: e.CodeField })),
|
|
2412
2412
|
avatar: () => Promise.resolve().then(() => Tt).then((e) => ({ default: e.AvatarField })),
|
|
2413
2413
|
address: () => Promise.resolve().then(() => Dt).then((e) => ({ default: e.AddressField })),
|
|
@@ -2421,8 +2421,8 @@ function mn(e) {
|
|
|
2421
2421
|
console.warn(`Unknown field type: ${e}`);
|
|
2422
2422
|
return;
|
|
2423
2423
|
}
|
|
2424
|
-
let n =
|
|
2425
|
-
|
|
2424
|
+
let n = o.lazy(t);
|
|
2425
|
+
m.register(e, n, { namespace: "field" });
|
|
2426
2426
|
}
|
|
2427
2427
|
function hn() {
|
|
2428
2428
|
Object.keys(pn).forEach((e) => {
|
|
@@ -2430,8 +2430,8 @@ function hn() {
|
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
function gn() {
|
|
2433
|
-
|
|
2433
|
+
m.register("text", $(De), { namespace: "field" }), m.register("textarea", $(Ke), { namespace: "field" }), m.register("number", $(ke), { namespace: "field" }), m.register("boolean", $(je), { namespace: "field" }), m.register("select", $(Ne), { namespace: "field" }), m.register("date", $(Fe), { namespace: "field" }), m.register("datetime", $(Ye), { namespace: "field" }), m.register("time", $(Ze), { namespace: "field" }), m.register("email", $(Le), { namespace: "field" }), m.register("phone", $(ze), { namespace: "field" }), m.register("url", $(Ve), { namespace: "field" }), m.register("currency", $(We), { namespace: "field" }), m.register("percent", $(R), { namespace: "field" }), m.register("password", $(z), { namespace: "field" }), m.register("markdown", $(L), { namespace: "field" }), m.register("html", $(L), { namespace: "field" }), m.register("lookup", $(i), { namespace: "field" }), m.register("master_detail", $(It), { namespace: "field" }), m.register("file", $(B), { namespace: "field" }), m.register("image", $(V), { namespace: "field" }), m.register("location", $(it), { namespace: "field" }), m.register("formula", $(ot), { namespace: "field" }), m.register("summary", $(ct), { namespace: "field" }), m.register("auto_number", $(ut), { namespace: "field" }), m.register("user", $(H), { namespace: "field" }), m.register("owner", $(H), { namespace: "field" }), m.register("object", $(pt), { namespace: "field" }), m.register("vector", $(U), { namespace: "field" }), m.register("grid", $(gt), { namespace: "field" }), m.register("color", $(vt), { namespace: "field" }), m.register("slider", $(bt), { namespace: "field" }), m.register("rating", $(St), { namespace: "field" }), m.register("code", $(wt), { namespace: "field" }), m.register("avatar", $(Et), { namespace: "field" }), m.register("address", $(Ot), { namespace: "field" }), m.register("geolocation", $(At), { namespace: "field" }), m.register("signature", $(Mt), { namespace: "field" }), m.register("qrcode", $(Pt), { namespace: "field" });
|
|
2434
2434
|
}
|
|
2435
2435
|
hn();
|
|
2436
2436
|
//#endregion
|
|
2437
|
-
export { Ot as AddressField, ut as AutoNumberField, Et as AvatarField, qt as BooleanCellRenderer,
|
|
2437
|
+
export { Ot as AddressField, ut as AutoNumberField, Et as AvatarField, qt as BooleanCellRenderer, je as BooleanField, wt as CodeField, vt as ColorField, Ut as CurrencyCellRenderer, We as CurrencyField, Jt as DateCellRenderer, Fe as DateField, Yt as DateTimeCellRenderer, Ye as DateTimeField, en as EmailCellRenderer, Le as EmailField, rn as FileCellRenderer, B as FileField, on as FormulaCellRenderer, ot as FormulaField, At as GeolocationField, gt as GridField, an as ImageCellRenderer, a as ImageCropperDialog, V as ImageField, it as LocationField, X as LookupCellRenderer, i as LookupField, It as MasterDetailField, Ht as NumberCellRenderer, ke as NumberField, pt as ObjectField, z as PasswordField, Gt as PercentCellRenderer, R as PercentField, nn as PhoneCellRenderer, ze as PhoneField, Pt as QRCodeField, St as RatingField, n as RecordPickerDialog, L as RichTextField, Y as SelectCellRenderer, Ne as SelectField, Mt as SignatureField, bt as SliderField, ct as SummaryField, Ke as TextAreaField, q as TextCellRenderer, De as TextField, Ze as TimeField, tn as UrlCellRenderer, Ve as UrlField, Z as UserCellRenderer, H as UserField, U as VectorField, dn as buildValidationRules, W as coerceToSafeValue, fn as evaluateCondition, Rt as formatCompactCurrency, Lt as formatCurrency, K as formatDate, Vt as formatDateTime, un as formatFileSize, zt as formatPercent, Bt as formatRelativeDate, cn as getCellRenderer, G as humanizeLabel, ln as mapFieldTypeToFormType, hn as registerAllFields, mn as registerField, Q as registerFieldRenderer, gn as registerFields };
|