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