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