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