@object-ui/fields 3.1.2 → 3.1.3
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/dist/fields/src/index.d.ts +7 -0
- package/dist/fields/src/widgets/LookupField.d.ts +13 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +1153 -985
- package/package.json +5 -5
- package/src/__tests__/cell-renderers.test.tsx +133 -4
- package/src/complex-widgets.test.tsx +426 -2
- package/src/index.tsx +70 -22
- package/src/widgets/LookupField.tsx +366 -65
package/dist/index.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ComponentRegistry as
|
|
3
|
-
import { Textarea as
|
|
4
|
-
import { X as
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
if (
|
|
9
|
-
|
|
1
|
+
import E, { useId as Pt, useState as I, useRef as fe, useContext as Rt, useMemo as kt, useEffect as le, useCallback as W } from "react";
|
|
2
|
+
import { ComponentRegistry as y } from "@object-ui/core";
|
|
3
|
+
import { Textarea as xe, Input as T, Checkbox as Be, Label as G, Switch as At, Select as $t, SelectTrigger as zt, SelectValue as Et, SelectContent as Dt, SelectItem as Mt, Badge as Z, Dialog as Lt, DialogTrigger as It, Button as P, DialogContent as Ut, DialogHeader as Vt, DialogTitle as Bt, Slider as Ye, Avatar as ee, AvatarFallback as te, cn as B, AvatarImage as Te } from "@object-ui/components";
|
|
4
|
+
import { X as ie, Search as Oe, Loader2 as Pe, AlertCircle as Yt, Plus as je, EyeOff as qt, Eye as Jt, Upload as qe, ImageIcon as Wt, File as Gt, Image as Qt, Star as Re, MapPin as ke, Crosshair as Ht, Eraser as Xt, QrCode as Ae, Copy as Se, ExternalLink as $e, Check as Fe, Phone as Kt } from "lucide-react";
|
|
5
|
+
var pe = { exports: {} }, ue = {};
|
|
6
|
+
var ze;
|
|
7
|
+
function Zt() {
|
|
8
|
+
if (ze) return ue;
|
|
9
|
+
ze = 1;
|
|
10
10
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
for (var o in
|
|
16
|
-
o !== "key" && (
|
|
17
|
-
} else
|
|
18
|
-
return
|
|
11
|
+
function s(l, n, a) {
|
|
12
|
+
var i = null;
|
|
13
|
+
if (a !== void 0 && (i = "" + a), n.key !== void 0 && (i = "" + n.key), "key" in n) {
|
|
14
|
+
a = {};
|
|
15
|
+
for (var o in n)
|
|
16
|
+
o !== "key" && (a[o] = n[o]);
|
|
17
|
+
} else a = n;
|
|
18
|
+
return n = a.ref, {
|
|
19
19
|
$$typeof: e,
|
|
20
|
-
type:
|
|
21
|
-
key:
|
|
22
|
-
ref:
|
|
23
|
-
props:
|
|
20
|
+
type: l,
|
|
21
|
+
key: i,
|
|
22
|
+
ref: n !== void 0 ? n : null,
|
|
23
|
+
props: a
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return ue.Fragment = r, ue.jsx = s, ue.jsxs = s, ue;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
return
|
|
28
|
+
var me = {};
|
|
29
|
+
var Ee;
|
|
30
|
+
function er() {
|
|
31
|
+
return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
32
|
function e(d) {
|
|
33
33
|
if (d == null) return null;
|
|
34
34
|
if (typeof d == "function")
|
|
35
|
-
return d.$$typeof ===
|
|
35
|
+
return d.$$typeof === q ? null : d.displayName || d.name || null;
|
|
36
36
|
if (typeof d == "string") return d;
|
|
37
37
|
switch (d) {
|
|
38
|
-
case
|
|
38
|
+
case k:
|
|
39
39
|
return "Fragment";
|
|
40
|
-
case
|
|
40
|
+
case M:
|
|
41
41
|
return "Profiler";
|
|
42
|
-
case
|
|
42
|
+
case D:
|
|
43
43
|
return "StrictMode";
|
|
44
44
|
case b:
|
|
45
45
|
return "Suspense";
|
|
46
|
-
case
|
|
46
|
+
case w:
|
|
47
47
|
return "SuspenseList";
|
|
48
|
-
case
|
|
48
|
+
case C:
|
|
49
49
|
return "Activity";
|
|
50
50
|
}
|
|
51
51
|
if (typeof d == "object")
|
|
52
52
|
switch (typeof d.tag == "number" && console.error(
|
|
53
53
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
54
|
), d.$$typeof) {
|
|
55
|
-
case
|
|
55
|
+
case _:
|
|
56
56
|
return "Portal";
|
|
57
|
-
case
|
|
57
|
+
case re:
|
|
58
58
|
return d.displayName || "Context";
|
|
59
|
-
case
|
|
59
|
+
case Q:
|
|
60
60
|
return (d._context.displayName || "Context") + ".Consumer";
|
|
61
|
-
case
|
|
61
|
+
case U:
|
|
62
62
|
var j = d.render;
|
|
63
63
|
return d = d.displayName, d || (d = j.displayName || j.name || "", d = d !== "" ? "ForwardRef(" + d + ")" : "ForwardRef"), d;
|
|
64
64
|
case A:
|
|
65
65
|
return j = d.displayName || null, j !== null ? j : e(d.type) || "Memo";
|
|
66
|
-
case
|
|
66
|
+
case R:
|
|
67
67
|
j = d._payload, d = d._init;
|
|
68
68
|
try {
|
|
69
69
|
return e(d(j));
|
|
@@ -75,7 +75,7 @@ function qt() {
|
|
|
75
75
|
function r(d) {
|
|
76
76
|
return "" + d;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function s(d) {
|
|
79
79
|
try {
|
|
80
80
|
r(d);
|
|
81
81
|
var j = !1;
|
|
@@ -84,17 +84,17 @@ function qt() {
|
|
|
84
84
|
}
|
|
85
85
|
if (j) {
|
|
86
86
|
j = console;
|
|
87
|
-
var
|
|
88
|
-
return
|
|
87
|
+
var F = j.error, S = typeof Symbol == "function" && Symbol.toStringTag && d[Symbol.toStringTag] || d.constructor.name || "Object";
|
|
88
|
+
return F.call(
|
|
89
89
|
j,
|
|
90
90
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
91
|
S
|
|
92
92
|
), r(d);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
if (d ===
|
|
97
|
-
if (typeof d == "object" && d !== null && d.$$typeof ===
|
|
95
|
+
function l(d) {
|
|
96
|
+
if (d === k) return "<>";
|
|
97
|
+
if (typeof d == "object" && d !== null && d.$$typeof === R)
|
|
98
98
|
return "<...>";
|
|
99
99
|
try {
|
|
100
100
|
var j = e(d);
|
|
@@ -103,47 +103,47 @@ function qt() {
|
|
|
103
103
|
return "<...>";
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var d =
|
|
106
|
+
function n() {
|
|
107
|
+
var d = J.A;
|
|
108
108
|
return d === null ? null : d.getOwner();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function a() {
|
|
111
111
|
return Error("react-stack-top-frame");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
if (
|
|
113
|
+
function i(d) {
|
|
114
|
+
if (L.call(d, "key")) {
|
|
115
115
|
var j = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
116
116
|
if (j && j.isReactWarning) return !1;
|
|
117
117
|
}
|
|
118
118
|
return d.key !== void 0;
|
|
119
119
|
}
|
|
120
120
|
function o(d, j) {
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function F() {
|
|
122
|
+
H || (H = !0, console.error(
|
|
123
123
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
124
|
j
|
|
125
125
|
));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
get:
|
|
127
|
+
F.isReactWarning = !0, Object.defineProperty(d, "key", {
|
|
128
|
+
get: F,
|
|
129
129
|
configurable: !0
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
function c() {
|
|
133
133
|
var d = e(this.type);
|
|
134
|
-
return
|
|
134
|
+
return V[d] || (V[d] = !0, console.error(
|
|
135
135
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
136
|
)), d = this.props.ref, d !== void 0 ? d : null;
|
|
137
137
|
}
|
|
138
|
-
function m(d, j,
|
|
139
|
-
var
|
|
138
|
+
function m(d, j, F, S, X, de) {
|
|
139
|
+
var O = F.ref;
|
|
140
140
|
return d = {
|
|
141
|
-
$$typeof:
|
|
141
|
+
$$typeof: g,
|
|
142
142
|
type: d,
|
|
143
143
|
key: j,
|
|
144
|
-
props:
|
|
144
|
+
props: F,
|
|
145
145
|
_owner: S
|
|
146
|
-
}, (
|
|
146
|
+
}, (O !== void 0 ? O : null) !== null ? Object.defineProperty(d, "ref", {
|
|
147
147
|
enumerable: !1,
|
|
148
148
|
get: c
|
|
149
149
|
}) : Object.defineProperty(d, "ref", { enumerable: !1, value: null }), d._store = {}, Object.defineProperty(d._store, "validated", {
|
|
@@ -160,33 +160,33 @@ function qt() {
|
|
|
160
160
|
configurable: !1,
|
|
161
161
|
enumerable: !1,
|
|
162
162
|
writable: !0,
|
|
163
|
-
value:
|
|
163
|
+
value: X
|
|
164
164
|
}), Object.defineProperty(d, "_debugTask", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
writable: !0,
|
|
168
|
-
value:
|
|
168
|
+
value: de
|
|
169
169
|
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
170
170
|
}
|
|
171
|
-
function p(d, j,
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
171
|
+
function p(d, j, F, S, X, de) {
|
|
172
|
+
var O = j.children;
|
|
173
|
+
if (O !== void 0)
|
|
174
174
|
if (S)
|
|
175
|
-
if (
|
|
176
|
-
for (S = 0; S <
|
|
177
|
-
f(
|
|
178
|
-
Object.freeze && Object.freeze(
|
|
175
|
+
if (Ce(O)) {
|
|
176
|
+
for (S = 0; S < O.length; S++)
|
|
177
|
+
f(O[S]);
|
|
178
|
+
Object.freeze && Object.freeze(O);
|
|
179
179
|
} else
|
|
180
180
|
console.error(
|
|
181
181
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
182
|
);
|
|
183
|
-
else f(
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
var
|
|
187
|
-
return
|
|
183
|
+
else f(O);
|
|
184
|
+
if (L.call(j, "key")) {
|
|
185
|
+
O = e(d);
|
|
186
|
+
var h = Object.keys(j).filter(function($) {
|
|
187
|
+
return $ !== "key";
|
|
188
188
|
});
|
|
189
|
-
S = 0 <
|
|
189
|
+
S = 0 < h.length ? "{key: someKey, " + h.join(": ..., ") + ": ...}" : "{key: someKey}", z[O + S] || (h = 0 < h.length ? "{" + h.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
190
|
`A props object containing a "key" prop is being spread into JSX:
|
|
191
191
|
let props = %s;
|
|
192
192
|
<%s {...props} />
|
|
@@ -194,35 +194,35 @@ React keys must be passed directly to JSX without using spread:
|
|
|
194
194
|
let props = %s;
|
|
195
195
|
<%s key={someKey} {...props} />`,
|
|
196
196
|
S,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
),
|
|
197
|
+
O,
|
|
198
|
+
h,
|
|
199
|
+
O
|
|
200
|
+
), z[O + S] = !0);
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
for (var
|
|
205
|
-
|
|
206
|
-
} else
|
|
207
|
-
return
|
|
208
|
-
|
|
202
|
+
if (O = null, F !== void 0 && (s(F), O = "" + F), i(j) && (s(j.key), O = "" + j.key), "key" in j) {
|
|
203
|
+
F = {};
|
|
204
|
+
for (var N in j)
|
|
205
|
+
N !== "key" && (F[N] = j[N]);
|
|
206
|
+
} else F = j;
|
|
207
|
+
return O && o(
|
|
208
|
+
F,
|
|
209
209
|
typeof d == "function" ? d.displayName || d.name || "Unknown" : d
|
|
210
210
|
), m(
|
|
211
211
|
d,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
O,
|
|
213
|
+
F,
|
|
214
|
+
n(),
|
|
215
|
+
X,
|
|
216
|
+
de
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
function f(d) {
|
|
220
|
-
u(d) ? d._store && (d._store.validated = 1) : typeof d == "object" && d !== null && d.$$typeof ===
|
|
220
|
+
u(d) ? d._store && (d._store.validated = 1) : typeof d == "object" && d !== null && d.$$typeof === R && (d._payload.status === "fulfilled" ? u(d._payload.value) && d._payload.value._store && (d._payload.value._store.validated = 1) : d._store && (d._store.validated = 1));
|
|
221
221
|
}
|
|
222
222
|
function u(d) {
|
|
223
|
-
return typeof d == "object" && d !== null && d.$$typeof ===
|
|
223
|
+
return typeof d == "object" && d !== null && d.$$typeof === g;
|
|
224
224
|
}
|
|
225
|
-
var x =
|
|
225
|
+
var x = E, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), _ = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__PURE__ */ Symbol.for("react.fragment"), D = /* @__PURE__ */ Symbol.for("react.strict_mode"), M = /* @__PURE__ */ Symbol.for("react.profiler"), Q = /* @__PURE__ */ Symbol.for("react.consumer"), re = /* @__PURE__ */ Symbol.for("react.context"), U = /* @__PURE__ */ Symbol.for("react.forward_ref"), b = /* @__PURE__ */ Symbol.for("react.suspense"), w = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), R = /* @__PURE__ */ Symbol.for("react.lazy"), C = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), J = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, Ce = Array.isArray, ce = console.createTask ? console.createTask : function() {
|
|
226
226
|
return null;
|
|
227
227
|
};
|
|
228
228
|
x = {
|
|
@@ -230,74 +230,74 @@ React keys must be passed directly to JSX without using spread:
|
|
|
230
230
|
return d();
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
var
|
|
233
|
+
var H, V = {}, se = x.react_stack_bottom_frame.bind(
|
|
234
234
|
x,
|
|
235
|
-
|
|
236
|
-
)(),
|
|
237
|
-
|
|
238
|
-
var S = 1e4 >
|
|
235
|
+
a
|
|
236
|
+
)(), ne = ce(l(a)), z = {};
|
|
237
|
+
me.Fragment = k, me.jsx = function(d, j, F) {
|
|
238
|
+
var S = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
239
239
|
return p(
|
|
240
240
|
d,
|
|
241
241
|
j,
|
|
242
|
-
|
|
242
|
+
F,
|
|
243
243
|
!1,
|
|
244
|
-
S ? Error("react-stack-top-frame") :
|
|
245
|
-
S ?
|
|
244
|
+
S ? Error("react-stack-top-frame") : se,
|
|
245
|
+
S ? ce(l(d)) : ne
|
|
246
246
|
);
|
|
247
|
-
},
|
|
248
|
-
var S = 1e4 >
|
|
247
|
+
}, me.jsxs = function(d, j, F) {
|
|
248
|
+
var S = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
249
249
|
return p(
|
|
250
250
|
d,
|
|
251
251
|
j,
|
|
252
|
-
|
|
252
|
+
F,
|
|
253
253
|
!0,
|
|
254
|
-
S ? Error("react-stack-top-frame") :
|
|
255
|
-
S ?
|
|
254
|
+
S ? Error("react-stack-top-frame") : se,
|
|
255
|
+
S ? ce(l(d)) : ne
|
|
256
256
|
);
|
|
257
257
|
};
|
|
258
|
-
})()),
|
|
258
|
+
})()), me;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
261
|
-
function
|
|
262
|
-
return
|
|
260
|
+
var De;
|
|
261
|
+
function tr() {
|
|
262
|
+
return De || (De = 1, process.env.NODE_ENV === "production" ? pe.exports = Zt() : pe.exports = er()), pe.exports;
|
|
263
263
|
}
|
|
264
|
-
var t =
|
|
265
|
-
function
|
|
266
|
-
const
|
|
267
|
-
if (
|
|
264
|
+
var t = tr();
|
|
265
|
+
function Je({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
266
|
+
const a = s || n.schema;
|
|
267
|
+
if (l)
|
|
268
268
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e || "-" });
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
|
|
269
|
+
const i = a?.rows, { inputType: o, ...c } = n;
|
|
270
|
+
return i && i > 1 ? /* @__PURE__ */ t.jsx(
|
|
271
|
+
xe,
|
|
272
272
|
{
|
|
273
273
|
...c,
|
|
274
274
|
value: e || "",
|
|
275
275
|
onChange: (m) => r(m.target.value),
|
|
276
|
-
placeholder:
|
|
277
|
-
disabled:
|
|
276
|
+
placeholder: a?.placeholder,
|
|
277
|
+
disabled: l || c.disabled
|
|
278
278
|
}
|
|
279
279
|
) : /* @__PURE__ */ t.jsx(
|
|
280
|
-
|
|
280
|
+
T,
|
|
281
281
|
{
|
|
282
282
|
...c,
|
|
283
|
-
type:
|
|
283
|
+
type: a?.type === "password" ? "password" : "text",
|
|
284
284
|
value: e || "",
|
|
285
285
|
onChange: (m) => r(m.target.value),
|
|
286
|
-
placeholder:
|
|
287
|
-
disabled:
|
|
286
|
+
placeholder: a?.placeholder,
|
|
287
|
+
disabled: l || c.disabled
|
|
288
288
|
}
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
|
-
const
|
|
291
|
+
const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
292
292
|
__proto__: null,
|
|
293
|
-
TextField:
|
|
293
|
+
TextField: Je
|
|
294
294
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
295
|
-
function
|
|
296
|
-
if (
|
|
295
|
+
function We({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
296
|
+
if (l)
|
|
297
297
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ?? "-" });
|
|
298
|
-
const
|
|
298
|
+
const a = s || n.schema, i = a?.precision, { inputType: o, ...c } = n;
|
|
299
299
|
return /* @__PURE__ */ t.jsx(
|
|
300
|
-
|
|
300
|
+
T,
|
|
301
301
|
{
|
|
302
302
|
...c,
|
|
303
303
|
type: "number",
|
|
@@ -306,97 +306,97 @@ function Ie({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
306
306
|
const p = m.target.value;
|
|
307
307
|
r(p === "" ? null : Number(p));
|
|
308
308
|
},
|
|
309
|
-
placeholder:
|
|
310
|
-
disabled:
|
|
311
|
-
step:
|
|
309
|
+
placeholder: a?.placeholder,
|
|
310
|
+
disabled: l || c.disabled,
|
|
311
|
+
step: i ? Math.pow(10, -i) : "any"
|
|
312
312
|
}
|
|
313
313
|
);
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
316
316
|
__proto__: null,
|
|
317
|
-
NumberField:
|
|
317
|
+
NumberField: We
|
|
318
318
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
319
|
-
function
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
319
|
+
function Ge({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
320
|
+
const a = s || n.schema, i = a?.widget, o = Pt(), c = a?.name || o, m = a?.label || "Checkbox";
|
|
321
|
+
if (l)
|
|
322
322
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ? "Yes" : "No" });
|
|
323
|
-
const { inputType: p, ...f } =
|
|
324
|
-
return
|
|
323
|
+
const { inputType: p, ...f } = n;
|
|
324
|
+
return i === "checkbox" ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
325
325
|
/* @__PURE__ */ t.jsx(
|
|
326
|
-
|
|
326
|
+
Be,
|
|
327
327
|
{
|
|
328
328
|
...f,
|
|
329
329
|
id: c,
|
|
330
330
|
checked: !!e,
|
|
331
331
|
onCheckedChange: (u) => r(!!u),
|
|
332
|
-
disabled:
|
|
332
|
+
disabled: l || f.disabled
|
|
333
333
|
}
|
|
334
334
|
),
|
|
335
|
-
/* @__PURE__ */ t.jsx(
|
|
335
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: c, children: m })
|
|
336
336
|
] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
337
337
|
/* @__PURE__ */ t.jsx(
|
|
338
|
-
|
|
338
|
+
At,
|
|
339
339
|
{
|
|
340
340
|
...f,
|
|
341
341
|
id: c,
|
|
342
342
|
checked: !!e,
|
|
343
343
|
onCheckedChange: r,
|
|
344
|
-
disabled:
|
|
344
|
+
disabled: l || f.disabled
|
|
345
345
|
}
|
|
346
346
|
),
|
|
347
|
-
/* @__PURE__ */ t.jsx(
|
|
347
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: c, children: m })
|
|
348
348
|
] });
|
|
349
349
|
}
|
|
350
|
-
const
|
|
350
|
+
const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
351
351
|
__proto__: null,
|
|
352
|
-
BooleanField:
|
|
352
|
+
BooleanField: Ge
|
|
353
353
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
357
|
-
const o =
|
|
354
|
+
function Qe({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
355
|
+
const a = s || n.schema, i = a?.options || [];
|
|
356
|
+
if (l) {
|
|
357
|
+
const o = i.find((c) => c.value === e);
|
|
358
358
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o?.label || e || "-" });
|
|
359
359
|
}
|
|
360
360
|
return /* @__PURE__ */ t.jsxs(
|
|
361
|
-
|
|
361
|
+
$t,
|
|
362
362
|
{
|
|
363
|
-
...
|
|
363
|
+
...n,
|
|
364
364
|
value: e,
|
|
365
365
|
onValueChange: r,
|
|
366
|
-
disabled:
|
|
366
|
+
disabled: l || n.disabled,
|
|
367
367
|
children: [
|
|
368
|
-
/* @__PURE__ */ t.jsx(
|
|
369
|
-
/* @__PURE__ */ t.jsx(
|
|
368
|
+
/* @__PURE__ */ t.jsx(zt, { className: n.className, id: n.id, children: /* @__PURE__ */ t.jsx(Et, { placeholder: a?.placeholder || "Select an option" }) }),
|
|
369
|
+
/* @__PURE__ */ t.jsx(Dt, { position: "popper", children: i.map((o) => /* @__PURE__ */ t.jsx(Mt, { value: o.value, children: o.label }, o.value)) })
|
|
370
370
|
]
|
|
371
371
|
}
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
375
375
|
__proto__: null,
|
|
376
|
-
SelectField:
|
|
376
|
+
SelectField: Qe
|
|
377
377
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
378
|
-
function
|
|
379
|
-
if (
|
|
378
|
+
function He({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
379
|
+
if (l)
|
|
380
380
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ? new Date(e).toLocaleDateString() : "-" });
|
|
381
|
-
const { inputType:
|
|
381
|
+
const { inputType: a, ...i } = n;
|
|
382
382
|
return /* @__PURE__ */ t.jsx(
|
|
383
|
-
|
|
383
|
+
T,
|
|
384
384
|
{
|
|
385
|
-
...
|
|
385
|
+
...i,
|
|
386
386
|
type: "date",
|
|
387
387
|
value: e || "",
|
|
388
388
|
onChange: (o) => r(o.target.value),
|
|
389
|
-
disabled:
|
|
389
|
+
disabled: l || i.disabled
|
|
390
390
|
}
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
|
-
const
|
|
393
|
+
const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
394
394
|
__proto__: null,
|
|
395
|
-
DateField:
|
|
395
|
+
DateField: He
|
|
396
396
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
397
|
+
function Xe({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, ...a }) {
|
|
398
|
+
const i = s || a.schema;
|
|
399
|
+
if (l)
|
|
400
400
|
return e ? /* @__PURE__ */ t.jsx(
|
|
401
401
|
"a",
|
|
402
402
|
{
|
|
@@ -405,27 +405,27 @@ function Ye({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
405
405
|
children: e
|
|
406
406
|
}
|
|
407
407
|
) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
408
|
-
const { inputType: o, ...c } =
|
|
408
|
+
const { inputType: o, ...c } = a;
|
|
409
409
|
return /* @__PURE__ */ t.jsx(
|
|
410
|
-
|
|
410
|
+
T,
|
|
411
411
|
{
|
|
412
412
|
...c,
|
|
413
413
|
type: "email",
|
|
414
414
|
value: e || "",
|
|
415
415
|
onChange: (m) => r(m.target.value),
|
|
416
|
-
placeholder:
|
|
417
|
-
disabled:
|
|
418
|
-
"aria-invalid": !!
|
|
416
|
+
placeholder: i?.placeholder || "email@example.com",
|
|
417
|
+
disabled: l || c.disabled,
|
|
418
|
+
"aria-invalid": !!n
|
|
419
419
|
}
|
|
420
420
|
);
|
|
421
421
|
}
|
|
422
|
-
const
|
|
422
|
+
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
423
423
|
__proto__: null,
|
|
424
|
-
EmailField:
|
|
424
|
+
EmailField: Xe
|
|
425
425
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
426
|
-
function
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
426
|
+
function Ke({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, ...a }) {
|
|
427
|
+
const i = s || a.schema;
|
|
428
|
+
if (l)
|
|
429
429
|
return e ? /* @__PURE__ */ t.jsx(
|
|
430
430
|
"a",
|
|
431
431
|
{
|
|
@@ -434,27 +434,27 @@ function qe({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
434
434
|
children: e
|
|
435
435
|
}
|
|
436
436
|
) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
437
|
-
const { inputType: o, ...c } =
|
|
437
|
+
const { inputType: o, ...c } = a;
|
|
438
438
|
return /* @__PURE__ */ t.jsx(
|
|
439
|
-
|
|
439
|
+
T,
|
|
440
440
|
{
|
|
441
441
|
...c,
|
|
442
442
|
type: "tel",
|
|
443
443
|
value: e || "",
|
|
444
444
|
onChange: (m) => r(m.target.value),
|
|
445
|
-
placeholder:
|
|
446
|
-
disabled:
|
|
447
|
-
"aria-invalid": !!
|
|
445
|
+
placeholder: i?.placeholder || "(555) 123-4567",
|
|
446
|
+
disabled: l || c.disabled,
|
|
447
|
+
"aria-invalid": !!n
|
|
448
448
|
}
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
|
-
const
|
|
451
|
+
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
452
452
|
__proto__: null,
|
|
453
|
-
PhoneField:
|
|
453
|
+
PhoneField: Ke
|
|
454
454
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
455
|
-
function
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
455
|
+
function Ze({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, ...a }) {
|
|
456
|
+
const i = s || a.schema;
|
|
457
|
+
if (l)
|
|
458
458
|
return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ t.jsx(
|
|
459
459
|
"a",
|
|
460
460
|
{
|
|
@@ -465,25 +465,25 @@ function Je({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
465
465
|
children: e
|
|
466
466
|
}
|
|
467
467
|
) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
468
|
-
const { inputType: o, ...c } =
|
|
468
|
+
const { inputType: o, ...c } = a;
|
|
469
469
|
return /* @__PURE__ */ t.jsx(
|
|
470
|
-
|
|
470
|
+
T,
|
|
471
471
|
{
|
|
472
472
|
...c,
|
|
473
473
|
type: "url",
|
|
474
474
|
value: e || "",
|
|
475
475
|
onChange: (m) => r(m.target.value),
|
|
476
|
-
placeholder:
|
|
477
|
-
disabled:
|
|
478
|
-
"aria-invalid": !!
|
|
476
|
+
placeholder: i?.placeholder || "https://example.com",
|
|
477
|
+
disabled: l || c.disabled,
|
|
478
|
+
"aria-invalid": !!n
|
|
479
479
|
}
|
|
480
480
|
);
|
|
481
481
|
}
|
|
482
|
-
const
|
|
482
|
+
const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
483
483
|
__proto__: null,
|
|
484
|
-
UrlField:
|
|
484
|
+
UrlField: Ze
|
|
485
485
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
486
|
-
function
|
|
486
|
+
function dr(e, r = "USD") {
|
|
487
487
|
try {
|
|
488
488
|
return new Intl.NumberFormat("en-US", {
|
|
489
489
|
style: "currency",
|
|
@@ -493,10 +493,10 @@ function tr(e, r = "USD") {
|
|
|
493
493
|
return `${r} ${e.toFixed(2)}`;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
function
|
|
497
|
-
const o =
|
|
498
|
-
if (
|
|
499
|
-
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium tabular-nums", children:
|
|
496
|
+
function et({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, className: a, ...i }) {
|
|
497
|
+
const o = s || i.schema, c = o?.currency || "USD", m = o?.precision ?? 2;
|
|
498
|
+
if (l)
|
|
499
|
+
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium tabular-nums", children: dr(Number(e), c) });
|
|
500
500
|
const p = (f) => {
|
|
501
501
|
const u = parseFloat(f.target.value);
|
|
502
502
|
isNaN(u) || r(parseFloat(u.toFixed(m)));
|
|
@@ -504,9 +504,9 @@ function We({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
504
504
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
505
505
|
/* @__PURE__ */ t.jsx("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: c === "USD" ? "$" : c }),
|
|
506
506
|
/* @__PURE__ */ t.jsx(
|
|
507
|
-
|
|
507
|
+
T,
|
|
508
508
|
{
|
|
509
|
-
...
|
|
509
|
+
...i,
|
|
510
510
|
type: "number",
|
|
511
511
|
value: e ?? "",
|
|
512
512
|
onChange: (f) => {
|
|
@@ -515,34 +515,34 @@ function We({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
515
515
|
},
|
|
516
516
|
onBlur: p,
|
|
517
517
|
placeholder: o?.placeholder || "0.00",
|
|
518
|
-
disabled:
|
|
519
|
-
className: `pl-8 ${
|
|
518
|
+
disabled: l || i.disabled,
|
|
519
|
+
className: `pl-8 ${a || ""}`,
|
|
520
520
|
step: Math.pow(10, -m).toFixed(m),
|
|
521
|
-
"aria-invalid": !!
|
|
521
|
+
"aria-invalid": !!n
|
|
522
522
|
}
|
|
523
523
|
)
|
|
524
524
|
] });
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
527
527
|
__proto__: null,
|
|
528
|
-
CurrencyField:
|
|
528
|
+
CurrencyField: et
|
|
529
529
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
530
|
-
function
|
|
531
|
-
if (
|
|
530
|
+
function tt({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, ...a }) {
|
|
531
|
+
if (l)
|
|
532
532
|
return /* @__PURE__ */ t.jsx("div", { className: "text-sm whitespace-pre-wrap", children: e || "-" });
|
|
533
|
-
const
|
|
533
|
+
const i = s || a.schema, o = i?.rows || 4, c = i?.max_length, { inputType: m, ...p } = a;
|
|
534
534
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
535
535
|
/* @__PURE__ */ t.jsx(
|
|
536
|
-
|
|
536
|
+
xe,
|
|
537
537
|
{
|
|
538
538
|
...p,
|
|
539
539
|
value: e || "",
|
|
540
540
|
onChange: (f) => r(f.target.value),
|
|
541
|
-
placeholder:
|
|
542
|
-
disabled:
|
|
541
|
+
placeholder: i?.placeholder,
|
|
542
|
+
disabled: l || p.disabled,
|
|
543
543
|
rows: o,
|
|
544
544
|
maxLength: c,
|
|
545
|
-
"aria-invalid": !!
|
|
545
|
+
"aria-invalid": !!n
|
|
546
546
|
}
|
|
547
547
|
),
|
|
548
548
|
c && /* @__PURE__ */ t.jsxs(
|
|
@@ -560,12 +560,12 @@ function Ge({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
560
560
|
)
|
|
561
561
|
] });
|
|
562
562
|
}
|
|
563
|
-
const
|
|
563
|
+
const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
564
564
|
__proto__: null,
|
|
565
|
-
TextAreaField:
|
|
565
|
+
TextAreaField: tt
|
|
566
566
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
567
|
-
function
|
|
568
|
-
if (
|
|
567
|
+
function ye({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, ...a }) {
|
|
568
|
+
if (l)
|
|
569
569
|
return /* @__PURE__ */ t.jsx(
|
|
570
570
|
"div",
|
|
571
571
|
{
|
|
@@ -573,7 +573,7 @@ function ce({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
573
573
|
children: e || "-"
|
|
574
574
|
}
|
|
575
575
|
);
|
|
576
|
-
const
|
|
576
|
+
const i = s || a.schema, o = i?.rows || 8, c = i?.format || "markdown";
|
|
577
577
|
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
578
578
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between text-xs text-gray-500", children: [
|
|
579
579
|
/* @__PURE__ */ t.jsxs("span", { children: [
|
|
@@ -583,119 +583,262 @@ function ce({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...
|
|
|
583
583
|
/* @__PURE__ */ t.jsx("span", { className: "italic", children: "Rich text editor (basic)" })
|
|
584
584
|
] }),
|
|
585
585
|
/* @__PURE__ */ t.jsx(
|
|
586
|
-
|
|
586
|
+
xe,
|
|
587
587
|
{
|
|
588
588
|
value: e || "",
|
|
589
589
|
onChange: (m) => r(m.target.value),
|
|
590
|
-
placeholder:
|
|
591
|
-
disabled:
|
|
590
|
+
placeholder: i?.placeholder || "Enter text...",
|
|
591
|
+
disabled: l || a.disabled,
|
|
592
592
|
rows: o,
|
|
593
|
-
className: `font-mono text-sm ${
|
|
594
|
-
"aria-invalid": !!
|
|
593
|
+
className: `font-mono text-sm ${a.className || ""}`,
|
|
594
|
+
"aria-invalid": !!n
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
597
|
] });
|
|
598
598
|
}
|
|
599
|
-
const
|
|
599
|
+
const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
600
600
|
__proto__: null,
|
|
601
|
-
RichTextField:
|
|
602
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (
|
|
616
|
-
|
|
617
|
-
|
|
601
|
+
RichTextField: ye
|
|
602
|
+
}, Symbol.toStringTag, { value: "Module" })), fr = 50, xr = E.createContext(null);
|
|
603
|
+
let rt = xr;
|
|
604
|
+
try {
|
|
605
|
+
const e = require("@object-ui/react");
|
|
606
|
+
e.SchemaRendererContext && (rt = e.SchemaRendererContext);
|
|
607
|
+
} catch {
|
|
608
|
+
}
|
|
609
|
+
function pr(e, r, s, l) {
|
|
610
|
+
const n = e[s] ?? e.id ?? e._id, a = e[r] ?? e.label ?? e.name ?? String(n), i = l ? e[l] : void 0;
|
|
611
|
+
return { value: n, label: String(a), description: i, ...e };
|
|
612
|
+
}
|
|
613
|
+
function st({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
614
|
+
const [a, i] = I(!1), [o, c] = I(""), [m, p] = I([]), [f, u] = I(!1), [x, g] = I(null), [_, k] = I(0), D = fe(null), [M, Q] = I(-1), re = fe(null), U = s || n.schema, b = U?.field, w = b && typeof b == "object" && ("reference_to" in b || "reference" in b || "type" in b) ? b : U, A = w?.options || [], R = w?.multiple || !1, C = w?.display_field || w?.reference_field || "name", q = w?.description_field, J = w?.id_field || "id", L = w?.reference_to || w?.reference, ce = Rt(rt)?.dataSource ?? null, H = n.dataSource ?? U?.dataSource ?? w?.dataSource ?? ce, V = H != null && typeof H.find == "function" && !!L, se = n.onCreateNew ?? U?.onCreateNew, ne = V ? m : A, z = kt(() => {
|
|
615
|
+
if (V || !o) return ne;
|
|
616
|
+
const h = o.toLowerCase();
|
|
617
|
+
return ne.filter(
|
|
618
|
+
(N) => N.label.toLowerCase().includes(h) || N.description && N.description.toLowerCase().includes(h)
|
|
619
|
+
);
|
|
620
|
+
}, [V, ne, o]);
|
|
621
|
+
le(() => {
|
|
622
|
+
Q(-1);
|
|
623
|
+
}, [z.length]);
|
|
624
|
+
const d = W(
|
|
625
|
+
async (h) => {
|
|
626
|
+
if (!(!H || !L)) {
|
|
627
|
+
u(!0), g(null);
|
|
628
|
+
try {
|
|
629
|
+
const N = {
|
|
630
|
+
$top: fr
|
|
631
|
+
};
|
|
632
|
+
h && h.trim() && (N.$search = h.trim());
|
|
633
|
+
const $ = await H.find(L, N), ae = $?.data ?? $ ?? [], Tt = ae.map((Ot) => pr(Ot, C, J, q));
|
|
634
|
+
p(Tt), k($?.total ?? ae.length);
|
|
635
|
+
} catch (N) {
|
|
636
|
+
const $ = N instanceof Error ? N.message : String(N);
|
|
637
|
+
g($), p([]);
|
|
638
|
+
} finally {
|
|
639
|
+
u(!1);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
[H, L, C, J, q]
|
|
644
|
+
);
|
|
645
|
+
le(() => {
|
|
646
|
+
a && V && d(o || void 0), a || (c(""), g(null), Q(-1));
|
|
647
|
+
}, [a]);
|
|
648
|
+
const j = W(
|
|
649
|
+
(h) => {
|
|
650
|
+
c(h), V && (D.current && clearTimeout(D.current), D.current = setTimeout(() => {
|
|
651
|
+
d(h || void 0);
|
|
652
|
+
}, 300));
|
|
653
|
+
},
|
|
654
|
+
[V, d]
|
|
655
|
+
);
|
|
656
|
+
le(() => () => {
|
|
657
|
+
D.current && clearTimeout(D.current);
|
|
658
|
+
}, []);
|
|
659
|
+
const F = W(
|
|
660
|
+
(h) => A.find((N) => N.value === h) ?? m.find((N) => N.value === h),
|
|
661
|
+
[A, m]
|
|
662
|
+
), S = R ? (Array.isArray(e) ? e : []).map(F).filter(Boolean) : e ? [F(e)].filter(Boolean) : [], X = W(
|
|
663
|
+
(h) => {
|
|
664
|
+
if (R) {
|
|
665
|
+
const N = Array.isArray(e) ? e : [], $ = N.includes(h.value);
|
|
666
|
+
r($ ? N.filter((ae) => ae !== h.value) : [...N, h.value]);
|
|
667
|
+
} else
|
|
668
|
+
r(h.value), i(!1);
|
|
669
|
+
},
|
|
670
|
+
[R, e, r]
|
|
671
|
+
), de = (h) => {
|
|
672
|
+
if (R) {
|
|
673
|
+
const N = Array.isArray(e) ? e : [];
|
|
674
|
+
r(N.filter(($) => $ !== h));
|
|
618
675
|
} else
|
|
619
676
|
r(null);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
677
|
+
}, O = W(
|
|
678
|
+
(h) => {
|
|
679
|
+
h.key === "ArrowDown" ? (h.preventDefault(), Q(
|
|
680
|
+
(N) => N < z.length - 1 ? N + 1 : N
|
|
681
|
+
)) : h.key === "ArrowUp" ? (h.preventDefault(), Q((N) => N > 0 ? N - 1 : 0)) : h.key === "Enter" && (h.preventDefault(), M >= 0 && M < z.length && X(z[M]));
|
|
682
|
+
},
|
|
683
|
+
[z, M, X]
|
|
684
|
+
);
|
|
685
|
+
return le(() => {
|
|
686
|
+
M >= 0 && re.current && re.current.querySelector(`[data-lookup-index="${M}"]`)?.scrollIntoView({ block: "nearest" });
|
|
687
|
+
}, [M]), l ? S.length ? R ? /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: S.map((h, N) => /* @__PURE__ */ t.jsx(Z, { variant: "outline", children: h?.[C] || h?.label }, N)) }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: S[0]?.[C] || S[0]?.label }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
688
|
+
S.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: S.map((h, N) => /* @__PURE__ */ t.jsxs(
|
|
689
|
+
Z,
|
|
624
690
|
{
|
|
625
691
|
variant: "outline",
|
|
626
692
|
className: "gap-1",
|
|
627
693
|
children: [
|
|
628
|
-
|
|
694
|
+
h?.[C] || h?.label,
|
|
629
695
|
/* @__PURE__ */ t.jsx(
|
|
630
696
|
"button",
|
|
631
697
|
{
|
|
632
|
-
onClick: () =>
|
|
698
|
+
onClick: () => de(h?.value),
|
|
633
699
|
className: "ml-1 hover:text-destructive",
|
|
634
700
|
type: "button",
|
|
635
|
-
"aria-label": `Remove ${
|
|
636
|
-
children: /* @__PURE__ */ t.jsx(
|
|
701
|
+
"aria-label": `Remove ${h?.[C] || h?.label}`,
|
|
702
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "size-3" })
|
|
637
703
|
}
|
|
638
704
|
)
|
|
639
705
|
]
|
|
640
706
|
},
|
|
641
|
-
|
|
707
|
+
N
|
|
642
708
|
)) }),
|
|
643
|
-
/* @__PURE__ */ t.jsxs(
|
|
644
|
-
/* @__PURE__ */ t.jsx(
|
|
709
|
+
/* @__PURE__ */ t.jsxs(Lt, { open: a, onOpenChange: i, children: [
|
|
710
|
+
/* @__PURE__ */ t.jsx(It, { asChild: !0, children: /* @__PURE__ */ t.jsxs(
|
|
645
711
|
P,
|
|
646
712
|
{
|
|
647
713
|
variant: "outline",
|
|
648
714
|
className: "w-full justify-start text-left font-normal",
|
|
649
715
|
type: "button",
|
|
650
716
|
children: [
|
|
651
|
-
/* @__PURE__ */ t.jsx(
|
|
652
|
-
|
|
717
|
+
/* @__PURE__ */ t.jsx(Oe, { className: "mr-2 size-4" }),
|
|
718
|
+
S.length === 0 ? U?.placeholder || "Select..." : R ? `${S.length} selected` : "Change selection"
|
|
653
719
|
]
|
|
654
720
|
}
|
|
655
721
|
) }),
|
|
656
|
-
/* @__PURE__ */ t.jsxs(
|
|
657
|
-
/* @__PURE__ */ t.jsx(
|
|
658
|
-
|
|
722
|
+
/* @__PURE__ */ t.jsxs(Ut, { className: "max-w-md", children: [
|
|
723
|
+
/* @__PURE__ */ t.jsx(Vt, { children: /* @__PURE__ */ t.jsxs(Bt, { children: [
|
|
724
|
+
U?.label || "Select",
|
|
659
725
|
" ",
|
|
660
|
-
|
|
726
|
+
R && "(multiple)"
|
|
661
727
|
] }) }),
|
|
662
728
|
/* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
|
|
663
|
-
/* @__PURE__ */ t.
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
729
|
+
/* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
730
|
+
/* @__PURE__ */ t.jsx(Oe, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
731
|
+
/* @__PURE__ */ t.jsx(
|
|
732
|
+
T,
|
|
733
|
+
{
|
|
734
|
+
placeholder: "Search...",
|
|
735
|
+
value: o,
|
|
736
|
+
onChange: (h) => j(h.target.value),
|
|
737
|
+
onKeyDown: O,
|
|
738
|
+
className: "w-full pl-9"
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
f && /* @__PURE__ */ t.jsx(
|
|
742
|
+
Pe,
|
|
743
|
+
{
|
|
744
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
|
|
745
|
+
"data-testid": "lookup-loading"
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] }),
|
|
749
|
+
x && /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-center gap-2 py-4", role: "alert", children: [
|
|
750
|
+
/* @__PURE__ */ t.jsx(Yt, { className: "size-5 text-destructive" }),
|
|
751
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-sm text-destructive", children: x }),
|
|
752
|
+
/* @__PURE__ */ t.jsx(
|
|
753
|
+
P,
|
|
754
|
+
{
|
|
755
|
+
variant: "outline",
|
|
756
|
+
size: "sm",
|
|
757
|
+
onClick: () => d(o || void 0),
|
|
758
|
+
type: "button",
|
|
759
|
+
children: "Retry"
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
] }),
|
|
763
|
+
f && z.length === 0 && !x && /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-center gap-2 py-6", role: "status", "aria-live": "polite", children: [
|
|
764
|
+
/* @__PURE__ */ t.jsx(Pe, { className: "size-6 animate-spin text-muted-foreground" }),
|
|
765
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-sm text-muted-foreground", children: "Loading…" })
|
|
766
|
+
] }),
|
|
767
|
+
!x && !(f && z.length === 0) && /* @__PURE__ */ t.jsx("div", { ref: re, className: "max-h-64 overflow-y-auto space-y-1", role: "listbox", children: z.length === 0 ? /* @__PURE__ */ t.jsxs("div", { className: "py-4 text-center", children: [
|
|
768
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-sm text-muted-foreground", children: "No options found" }),
|
|
769
|
+
se && /* @__PURE__ */ t.jsxs(
|
|
770
|
+
P,
|
|
771
|
+
{
|
|
772
|
+
variant: "ghost",
|
|
773
|
+
size: "sm",
|
|
774
|
+
className: "mt-2 gap-1",
|
|
775
|
+
type: "button",
|
|
776
|
+
onClick: () => {
|
|
777
|
+
se(o), i(!1);
|
|
778
|
+
},
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ t.jsx(je, { className: "size-4" }),
|
|
781
|
+
"Create new"
|
|
782
|
+
]
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
786
|
+
z.map((h, N) => {
|
|
787
|
+
const $ = R ? (Array.isArray(e) ? e : []).includes(h.value) : e === h.value, ae = N === M;
|
|
788
|
+
return /* @__PURE__ */ t.jsxs(
|
|
789
|
+
"button",
|
|
790
|
+
{
|
|
791
|
+
"data-lookup-index": N,
|
|
792
|
+
role: "option",
|
|
793
|
+
"aria-selected": $,
|
|
794
|
+
onClick: () => X(h),
|
|
795
|
+
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${ae ? "bg-accent text-accent-foreground" : $ ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
796
|
+
type: "button",
|
|
797
|
+
children: [
|
|
798
|
+
/* @__PURE__ */ t.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
799
|
+
/* @__PURE__ */ t.jsx("span", { className: "block truncate", children: h.label }),
|
|
800
|
+
h.description && /* @__PURE__ */ t.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: h.description })
|
|
801
|
+
] }),
|
|
802
|
+
$ && /* @__PURE__ */ t.jsx(Z, { variant: "default", className: "ml-2 shrink-0", children: "Selected" })
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
h.value
|
|
806
|
+
);
|
|
807
|
+
}),
|
|
808
|
+
V && _ > z.length && /* @__PURE__ */ t.jsxs("p", { className: "text-xs text-muted-foreground text-center py-2", children: [
|
|
809
|
+
"Showing ",
|
|
810
|
+
z.length,
|
|
811
|
+
" of ",
|
|
812
|
+
_,
|
|
813
|
+
" results. Refine your search to find more."
|
|
814
|
+
] }),
|
|
815
|
+
se && /* @__PURE__ */ t.jsxs(
|
|
675
816
|
"button",
|
|
676
817
|
{
|
|
677
|
-
onClick: () => v(N),
|
|
678
|
-
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${T ? "bg-blue-50 text-blue-700" : ""}`,
|
|
679
818
|
type: "button",
|
|
819
|
+
className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
|
|
820
|
+
onClick: () => {
|
|
821
|
+
se(o), i(!1);
|
|
822
|
+
},
|
|
680
823
|
children: [
|
|
681
|
-
/* @__PURE__ */ t.jsx(
|
|
682
|
-
|
|
824
|
+
/* @__PURE__ */ t.jsx(je, { className: "size-3.5" }),
|
|
825
|
+
"Create new",
|
|
826
|
+
o ? ` "${o}"` : ""
|
|
683
827
|
]
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}) })
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
] }) })
|
|
688
831
|
] })
|
|
689
832
|
] })
|
|
690
833
|
] })
|
|
691
834
|
] });
|
|
692
835
|
}
|
|
693
|
-
const
|
|
836
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
694
837
|
__proto__: null,
|
|
695
|
-
LookupField:
|
|
838
|
+
LookupField: st
|
|
696
839
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
697
|
-
function
|
|
698
|
-
if (
|
|
840
|
+
function nt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
841
|
+
if (l) {
|
|
699
842
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
700
843
|
const o = new Date(e);
|
|
701
844
|
return /* @__PURE__ */ t.jsxs("span", { className: "text-sm", children: [
|
|
@@ -704,91 +847,91 @@ function He({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
704
847
|
o.toLocaleTimeString()
|
|
705
848
|
] });
|
|
706
849
|
}
|
|
707
|
-
const { inputType:
|
|
850
|
+
const { inputType: a, ...i } = n;
|
|
708
851
|
return /* @__PURE__ */ t.jsx(
|
|
709
|
-
|
|
852
|
+
T,
|
|
710
853
|
{
|
|
711
|
-
...
|
|
854
|
+
...i,
|
|
712
855
|
type: "datetime-local",
|
|
713
856
|
value: e || "",
|
|
714
857
|
onChange: (o) => r(o.target.value),
|
|
715
|
-
disabled:
|
|
858
|
+
disabled: l || i.disabled
|
|
716
859
|
}
|
|
717
860
|
);
|
|
718
861
|
}
|
|
719
|
-
const
|
|
862
|
+
const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
720
863
|
__proto__: null,
|
|
721
|
-
DateTimeField:
|
|
864
|
+
DateTimeField: nt
|
|
722
865
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
723
|
-
function
|
|
724
|
-
if (
|
|
866
|
+
function at({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
867
|
+
if (l)
|
|
725
868
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e || "-" });
|
|
726
|
-
const { inputType:
|
|
869
|
+
const { inputType: a, ...i } = n;
|
|
727
870
|
return /* @__PURE__ */ t.jsx(
|
|
728
|
-
|
|
871
|
+
T,
|
|
729
872
|
{
|
|
730
|
-
...
|
|
873
|
+
...i,
|
|
731
874
|
type: "time",
|
|
732
875
|
value: e || "",
|
|
733
876
|
onChange: (o) => r(o.target.value),
|
|
734
|
-
disabled:
|
|
877
|
+
disabled: l || i.disabled
|
|
735
878
|
}
|
|
736
879
|
);
|
|
737
880
|
}
|
|
738
|
-
const
|
|
881
|
+
const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
739
882
|
__proto__: null,
|
|
740
|
-
TimeField:
|
|
883
|
+
TimeField: at
|
|
741
884
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
742
|
-
function
|
|
743
|
-
const o =
|
|
744
|
-
if (
|
|
885
|
+
function lt({ value: e, onChange: r, field: s, readonly: l, errorMessage: n, className: a, ...i }) {
|
|
886
|
+
const o = s || i.schema, c = o?.precision ?? 2;
|
|
887
|
+
if (l)
|
|
745
888
|
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsxs("span", { className: "text-sm font-medium tabular-nums", children: [
|
|
746
889
|
(e * 100).toFixed(c),
|
|
747
890
|
"%"
|
|
748
891
|
] });
|
|
749
|
-
const m = e != null ? e * 100 : "", p = e != null ? e * 100 : 0, f = (
|
|
750
|
-
if (
|
|
892
|
+
const m = e != null ? e * 100 : "", p = e != null ? e * 100 : 0, f = (g) => {
|
|
893
|
+
if (g.target.value === "") {
|
|
751
894
|
r(null);
|
|
752
895
|
return;
|
|
753
896
|
}
|
|
754
|
-
const
|
|
755
|
-
r(
|
|
756
|
-
}, u = (
|
|
757
|
-
if (
|
|
758
|
-
if (!Array.isArray(
|
|
897
|
+
const _ = parseFloat(g.target.value), k = isNaN(_) ? null : _ / 100;
|
|
898
|
+
r(k);
|
|
899
|
+
}, u = (g) => {
|
|
900
|
+
if (l || i.disabled) return;
|
|
901
|
+
if (!Array.isArray(g) || g.length === 0) {
|
|
759
902
|
r(null);
|
|
760
903
|
return;
|
|
761
904
|
}
|
|
762
|
-
const
|
|
763
|
-
r(
|
|
905
|
+
const _ = g[0], k = typeof _ == "number" ? _ / 100 : null;
|
|
906
|
+
r(k);
|
|
764
907
|
}, x = Math.pow(10, -c);
|
|
765
908
|
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
766
909
|
/* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
767
910
|
/* @__PURE__ */ t.jsx(
|
|
768
|
-
|
|
911
|
+
T,
|
|
769
912
|
{
|
|
770
|
-
...
|
|
913
|
+
...i,
|
|
771
914
|
type: "number",
|
|
772
915
|
value: m,
|
|
773
916
|
onChange: f,
|
|
774
917
|
placeholder: o?.placeholder || "0",
|
|
775
|
-
disabled:
|
|
776
|
-
className: `pr-8 ${
|
|
918
|
+
disabled: l || i.disabled,
|
|
919
|
+
className: `pr-8 ${a || ""}`,
|
|
777
920
|
step: Math.pow(10, -c).toFixed(c),
|
|
778
|
-
"aria-invalid": !!
|
|
921
|
+
"aria-invalid": !!n
|
|
779
922
|
}
|
|
780
923
|
),
|
|
781
924
|
/* @__PURE__ */ t.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: "%" })
|
|
782
925
|
] }),
|
|
783
926
|
/* @__PURE__ */ t.jsx(
|
|
784
|
-
|
|
927
|
+
Ye,
|
|
785
928
|
{
|
|
786
929
|
value: [p],
|
|
787
930
|
onValueChange: u,
|
|
788
931
|
min: 0,
|
|
789
932
|
max: 100,
|
|
790
933
|
step: x,
|
|
791
|
-
disabled:
|
|
934
|
+
disabled: l || i.disabled,
|
|
792
935
|
className: "w-full",
|
|
793
936
|
"aria-label": "Percentage",
|
|
794
937
|
"data-testid": "percent-slider"
|
|
@@ -796,26 +939,26 @@ function Ze({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
796
939
|
)
|
|
797
940
|
] });
|
|
798
941
|
}
|
|
799
|
-
const
|
|
942
|
+
const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
800
943
|
__proto__: null,
|
|
801
|
-
PercentField:
|
|
944
|
+
PercentField: lt
|
|
802
945
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
803
|
-
function
|
|
804
|
-
const [
|
|
805
|
-
if (
|
|
946
|
+
function it({ value: e, onChange: r, field: s, readonly: l, className: n, ...a }) {
|
|
947
|
+
const [i, o] = I(!1), c = s || a.schema;
|
|
948
|
+
if (l)
|
|
806
949
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "••••••••" });
|
|
807
|
-
const { inputType: m, ...p } =
|
|
950
|
+
const { inputType: m, ...p } = a;
|
|
808
951
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
809
952
|
/* @__PURE__ */ t.jsx(
|
|
810
|
-
|
|
953
|
+
T,
|
|
811
954
|
{
|
|
812
955
|
...p,
|
|
813
|
-
type:
|
|
956
|
+
type: i ? "text" : "password",
|
|
814
957
|
value: e || "",
|
|
815
958
|
onChange: (f) => r(f.target.value),
|
|
816
959
|
placeholder: c?.placeholder,
|
|
817
|
-
disabled:
|
|
818
|
-
className: `pr-10 ${
|
|
960
|
+
disabled: l || p.disabled,
|
|
961
|
+
className: `pr-10 ${n || ""}`
|
|
819
962
|
}
|
|
820
963
|
),
|
|
821
964
|
/* @__PURE__ */ t.jsx(
|
|
@@ -825,78 +968,78 @@ function Ke({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
825
968
|
variant: "ghost",
|
|
826
969
|
size: "sm",
|
|
827
970
|
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
828
|
-
onClick: () => o(!
|
|
971
|
+
onClick: () => o(!i),
|
|
829
972
|
tabIndex: -1,
|
|
830
|
-
children:
|
|
973
|
+
children: i ? /* @__PURE__ */ t.jsx(qt, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ t.jsx(Jt, { className: "size-4 text-gray-500" })
|
|
831
974
|
}
|
|
832
975
|
)
|
|
833
976
|
] });
|
|
834
977
|
}
|
|
835
|
-
const
|
|
978
|
+
const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
836
979
|
__proto__: null,
|
|
837
|
-
PasswordField:
|
|
980
|
+
PasswordField: it
|
|
838
981
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
839
|
-
function
|
|
840
|
-
const
|
|
982
|
+
function ot({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
983
|
+
const a = fe(null), i = s || n.schema, o = i?.multiple || !1, c = i?.accept ? i.accept.join(",") : void 0, m = i?.maxSize, [p, f] = I(!1), [u, x] = I([]), g = e ? Array.isArray(e) ? e : [e] : [], _ = W((b) => {
|
|
841
984
|
if (b.length === 0) return;
|
|
842
|
-
const
|
|
843
|
-
if (m &&
|
|
844
|
-
const
|
|
845
|
-
return
|
|
985
|
+
const w = [], A = b.filter((C) => {
|
|
986
|
+
if (m && C.size > m) {
|
|
987
|
+
const q = (m / 1048576).toFixed(1);
|
|
988
|
+
return w.push(`"${C.name}" exceeds max size (${q} MB)`), !1;
|
|
846
989
|
}
|
|
847
990
|
return !0;
|
|
848
991
|
});
|
|
849
|
-
if (x(
|
|
850
|
-
const
|
|
851
|
-
name:
|
|
852
|
-
original_name:
|
|
853
|
-
size:
|
|
854
|
-
mime_type:
|
|
992
|
+
if (x(w), A.length === 0) return;
|
|
993
|
+
const R = A.map((C) => ({
|
|
994
|
+
name: C.name,
|
|
995
|
+
original_name: C.name,
|
|
996
|
+
size: C.size,
|
|
997
|
+
mime_type: C.type,
|
|
855
998
|
// In a real implementation, this would upload the file and return a URL
|
|
856
|
-
url: URL.createObjectURL(
|
|
999
|
+
url: URL.createObjectURL(C)
|
|
857
1000
|
}));
|
|
858
|
-
r(o ? [...
|
|
859
|
-
}, [
|
|
1001
|
+
r(o ? [...g, ...R] : R[0]);
|
|
1002
|
+
}, [g, o, r, m]), k = W((b) => {
|
|
860
1003
|
b.preventDefault(), b.stopPropagation(), f(!0);
|
|
861
|
-
}, []),
|
|
1004
|
+
}, []), D = W((b) => {
|
|
862
1005
|
b.preventDefault(), b.stopPropagation(), f(!1);
|
|
863
|
-
}, []),
|
|
1006
|
+
}, []), M = W((b) => {
|
|
864
1007
|
b.preventDefault(), b.stopPropagation(), f(!1);
|
|
865
|
-
const
|
|
1008
|
+
const w = Array.from(b.dataTransfer.files);
|
|
866
1009
|
if (c) {
|
|
867
|
-
const A = c.split(",").map((
|
|
868
|
-
const
|
|
1010
|
+
const A = c.split(",").map((C) => C.trim().toLowerCase()), R = w.filter((C) => {
|
|
1011
|
+
const q = C.name.split("."), J = q.length > 1 ? "." + q.pop()?.toLowerCase() : "";
|
|
869
1012
|
return A.some(
|
|
870
|
-
(
|
|
1013
|
+
(L) => L === C.type || J && L === J || L.endsWith("/*") && C.type.startsWith(L.replace("/*", "/"))
|
|
871
1014
|
);
|
|
872
1015
|
});
|
|
873
|
-
|
|
1016
|
+
_(R);
|
|
874
1017
|
} else
|
|
875
|
-
|
|
876
|
-
}, [c,
|
|
877
|
-
if (
|
|
1018
|
+
_(w);
|
|
1019
|
+
}, [c, _]);
|
|
1020
|
+
if (l) {
|
|
878
1021
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
879
1022
|
const b = Array.isArray(e) ? e : [e];
|
|
880
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: b.map((
|
|
1023
|
+
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: b.map((w, A) => /* @__PURE__ */ t.jsx("span", { className: "text-sm truncate max-w-xs", children: w.name || w.original_name || "File" }, A)) });
|
|
881
1024
|
}
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
},
|
|
1025
|
+
const Q = (b) => {
|
|
1026
|
+
_(Array.from(b.target.files || []));
|
|
1027
|
+
}, re = (b) => {
|
|
885
1028
|
if (o) {
|
|
886
|
-
const
|
|
887
|
-
r(
|
|
1029
|
+
const w = g.filter((A, R) => R !== b);
|
|
1030
|
+
r(w.length > 0 ? w : null);
|
|
888
1031
|
} else
|
|
889
1032
|
r(null);
|
|
890
|
-
},
|
|
891
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
1033
|
+
}, U = (b) => (b.mime_type || "").startsWith("image/");
|
|
1034
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
892
1035
|
/* @__PURE__ */ t.jsx(
|
|
893
1036
|
"input",
|
|
894
1037
|
{
|
|
895
|
-
ref:
|
|
1038
|
+
ref: a,
|
|
896
1039
|
type: "file",
|
|
897
1040
|
multiple: o,
|
|
898
1041
|
accept: c,
|
|
899
|
-
onChange:
|
|
1042
|
+
onChange: Q,
|
|
900
1043
|
className: "hidden"
|
|
901
1044
|
}
|
|
902
1045
|
),
|
|
@@ -904,10 +1047,10 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
904
1047
|
/* @__PURE__ */ t.jsxs(
|
|
905
1048
|
"div",
|
|
906
1049
|
{
|
|
907
|
-
onDragOver:
|
|
908
|
-
onDragLeave:
|
|
909
|
-
onDrop:
|
|
910
|
-
onClick: () =>
|
|
1050
|
+
onDragOver: k,
|
|
1051
|
+
onDragLeave: D,
|
|
1052
|
+
onDrop: M,
|
|
1053
|
+
onClick: () => a.current?.click(),
|
|
911
1054
|
className: `
|
|
912
1055
|
flex flex-col items-center justify-center gap-2 p-6
|
|
913
1056
|
border-2 border-dashed rounded-lg cursor-pointer
|
|
@@ -917,10 +1060,10 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
917
1060
|
role: "button",
|
|
918
1061
|
tabIndex: 0,
|
|
919
1062
|
onKeyDown: (b) => {
|
|
920
|
-
(b.key === "Enter" || b.key === " ") && (b.preventDefault(),
|
|
1063
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), a.current?.click());
|
|
921
1064
|
},
|
|
922
1065
|
children: [
|
|
923
|
-
/* @__PURE__ */ t.jsx(
|
|
1066
|
+
/* @__PURE__ */ t.jsx(qe, { className: `size-8 ${p ? "text-primary" : "text-muted-foreground"}` }),
|
|
924
1067
|
/* @__PURE__ */ t.jsxs("div", { className: "text-center", children: [
|
|
925
1068
|
/* @__PURE__ */ t.jsx("p", { className: "text-sm font-medium", children: p ? "Drop files here" : "Drag & drop files here" }),
|
|
926
1069
|
/* @__PURE__ */ t.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "or click to browse" })
|
|
@@ -928,14 +1071,14 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
928
1071
|
]
|
|
929
1072
|
}
|
|
930
1073
|
),
|
|
931
|
-
u.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "space-y-0.5", children: u.map((b,
|
|
932
|
-
|
|
1074
|
+
u.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "space-y-0.5", children: u.map((b, w) => /* @__PURE__ */ t.jsx("p", { className: "text-xs text-destructive", children: b }, w)) }),
|
|
1075
|
+
g.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "space-y-1", children: g.map((b, w) => /* @__PURE__ */ t.jsxs(
|
|
933
1076
|
"div",
|
|
934
1077
|
{
|
|
935
1078
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
936
1079
|
children: [
|
|
937
1080
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
938
|
-
|
|
1081
|
+
U(b) && b.url ? /* @__PURE__ */ t.jsx("img", { src: b.url, alt: b.name, className: "size-8 object-cover rounded flex-shrink-0" }) : U(b) ? /* @__PURE__ */ t.jsx(Wt, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ t.jsx(Gt, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
939
1082
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm truncate", children: b.name || b.original_name || "File" }),
|
|
940
1083
|
b.size && /* @__PURE__ */ t.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
941
1084
|
"(",
|
|
@@ -950,62 +1093,62 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
950
1093
|
variant: "ghost",
|
|
951
1094
|
size: "sm",
|
|
952
1095
|
onClick: (A) => {
|
|
953
|
-
A.stopPropagation(),
|
|
1096
|
+
A.stopPropagation(), re(w);
|
|
954
1097
|
},
|
|
955
1098
|
className: "h-6 w-6 p-0",
|
|
956
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1099
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "size-3" })
|
|
957
1100
|
}
|
|
958
1101
|
)
|
|
959
1102
|
]
|
|
960
1103
|
},
|
|
961
|
-
|
|
1104
|
+
w
|
|
962
1105
|
)) })
|
|
963
1106
|
] })
|
|
964
1107
|
] });
|
|
965
1108
|
}
|
|
966
|
-
const
|
|
1109
|
+
const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
967
1110
|
__proto__: null,
|
|
968
|
-
FileField:
|
|
1111
|
+
FileField: ot
|
|
969
1112
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
970
|
-
function
|
|
971
|
-
const
|
|
972
|
-
if (
|
|
1113
|
+
function ct({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1114
|
+
const a = fe(null), i = s || n.schema, o = i?.multiple || !1, c = i?.accept ? i.accept.join(",") : "image/*";
|
|
1115
|
+
if (l) {
|
|
973
1116
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
974
1117
|
const u = Array.isArray(e) ? e : [e];
|
|
975
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: u.map((x,
|
|
1118
|
+
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: u.map((x, g) => /* @__PURE__ */ t.jsx(
|
|
976
1119
|
"img",
|
|
977
1120
|
{
|
|
978
1121
|
src: x.url || "",
|
|
979
|
-
alt: x.name || `Image ${
|
|
1122
|
+
alt: x.name || `Image ${g + 1}`,
|
|
980
1123
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
981
1124
|
},
|
|
982
|
-
|
|
1125
|
+
g
|
|
983
1126
|
)) });
|
|
984
1127
|
}
|
|
985
1128
|
const m = e ? Array.isArray(e) ? e : [e] : [], p = (u) => {
|
|
986
1129
|
const x = Array.from(u.target.files || []);
|
|
987
1130
|
if (x.length === 0) return;
|
|
988
|
-
const
|
|
989
|
-
name:
|
|
990
|
-
original_name:
|
|
991
|
-
size:
|
|
992
|
-
mime_type:
|
|
1131
|
+
const g = x.map((_) => ({
|
|
1132
|
+
name: _.name,
|
|
1133
|
+
original_name: _.name,
|
|
1134
|
+
size: _.size,
|
|
1135
|
+
mime_type: _.type,
|
|
993
1136
|
// In a real implementation, this would upload the image and return a URL
|
|
994
|
-
url: URL.createObjectURL(
|
|
1137
|
+
url: URL.createObjectURL(_)
|
|
995
1138
|
}));
|
|
996
|
-
r(o ? [...m, ...
|
|
1139
|
+
r(o ? [...m, ...g] : g[0]);
|
|
997
1140
|
}, f = (u) => {
|
|
998
1141
|
if (o) {
|
|
999
|
-
const x = m.filter((
|
|
1142
|
+
const x = m.filter((g, _) => _ !== u);
|
|
1000
1143
|
r(x.length > 0 ? x : null);
|
|
1001
1144
|
} else
|
|
1002
1145
|
r(null);
|
|
1003
1146
|
};
|
|
1004
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
1147
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
1005
1148
|
/* @__PURE__ */ t.jsx(
|
|
1006
1149
|
"input",
|
|
1007
1150
|
{
|
|
1008
|
-
ref:
|
|
1151
|
+
ref: a,
|
|
1009
1152
|
type: "file",
|
|
1010
1153
|
multiple: o,
|
|
1011
1154
|
accept: c,
|
|
@@ -1031,7 +1174,7 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1031
1174
|
size: "sm",
|
|
1032
1175
|
onClick: () => f(x),
|
|
1033
1176
|
className: "absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1034
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1177
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "size-3" })
|
|
1035
1178
|
}
|
|
1036
1179
|
)
|
|
1037
1180
|
] }, x)) }),
|
|
@@ -1040,10 +1183,10 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1040
1183
|
{
|
|
1041
1184
|
type: "button",
|
|
1042
1185
|
variant: "outline",
|
|
1043
|
-
onClick: () =>
|
|
1186
|
+
onClick: () => a.current?.click(),
|
|
1044
1187
|
className: "w-full",
|
|
1045
1188
|
children: [
|
|
1046
|
-
/* @__PURE__ */ t.jsx(
|
|
1189
|
+
/* @__PURE__ */ t.jsx(Qt, { className: "size-4 mr-2" }),
|
|
1047
1190
|
m.length > 0 ? "Add More Images" : "Upload Image"
|
|
1048
1191
|
]
|
|
1049
1192
|
}
|
|
@@ -1051,14 +1194,14 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1051
1194
|
] })
|
|
1052
1195
|
] });
|
|
1053
1196
|
}
|
|
1054
|
-
const
|
|
1197
|
+
const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1055
1198
|
__proto__: null,
|
|
1056
|
-
ImageField:
|
|
1199
|
+
ImageField: ct
|
|
1057
1200
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1058
|
-
function
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children:
|
|
1201
|
+
function dt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1202
|
+
const a = s || n.schema, i = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
1203
|
+
if (l)
|
|
1204
|
+
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: i || "-" });
|
|
1062
1205
|
const o = (c) => {
|
|
1063
1206
|
const m = c.target.value;
|
|
1064
1207
|
if (!m.trim()) {
|
|
@@ -1072,75 +1215,75 @@ function rt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1072
1215
|
}
|
|
1073
1216
|
};
|
|
1074
1217
|
return /* @__PURE__ */ t.jsx(
|
|
1075
|
-
|
|
1218
|
+
T,
|
|
1076
1219
|
{
|
|
1077
1220
|
type: "text",
|
|
1078
|
-
value:
|
|
1221
|
+
value: i,
|
|
1079
1222
|
onChange: o,
|
|
1080
|
-
placeholder:
|
|
1081
|
-
disabled:
|
|
1082
|
-
className:
|
|
1223
|
+
placeholder: a?.placeholder || "latitude, longitude",
|
|
1224
|
+
disabled: l || n.disabled,
|
|
1225
|
+
className: n.className
|
|
1083
1226
|
}
|
|
1084
1227
|
);
|
|
1085
1228
|
}
|
|
1086
|
-
const
|
|
1229
|
+
const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1087
1230
|
__proto__: null,
|
|
1088
|
-
LocationField:
|
|
1231
|
+
LocationField: dt
|
|
1089
1232
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1090
|
-
function
|
|
1091
|
-
const
|
|
1092
|
-
let
|
|
1093
|
-
return e != null && (
|
|
1233
|
+
function ut({ value: e, field: r, ...s }) {
|
|
1234
|
+
const n = (r || s.schema)?.return_type || "text";
|
|
1235
|
+
let a = "-";
|
|
1236
|
+
return e != null && (n === "number" || n === "currency" ? a = typeof e == "number" ? e.toFixed(2) : String(e) : n === "boolean" ? a = e ? "Yes" : "No" : n === "date" ? a = new Date(e).toLocaleDateString() : a = String(e)), /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${s.className || ""}`, children: a });
|
|
1094
1237
|
}
|
|
1095
|
-
const
|
|
1238
|
+
const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1096
1239
|
__proto__: null,
|
|
1097
|
-
FormulaField:
|
|
1240
|
+
FormulaField: ut
|
|
1098
1241
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1099
|
-
function
|
|
1100
|
-
const
|
|
1101
|
-
let
|
|
1102
|
-
return e != null && (
|
|
1242
|
+
function mt({ value: e, field: r, ...s }) {
|
|
1243
|
+
const n = (r || s.schema)?.summary_type || "count";
|
|
1244
|
+
let a = "-";
|
|
1245
|
+
return e != null && (n === "count" ? a = String(e) : ["sum", "avg", "min", "max"].includes(n) ? a = typeof e == "number" ? e.toFixed(2) : String(e) : a = String(e)), /* @__PURE__ */ t.jsx("span", { className: `text-sm font-medium tabular-nums text-gray-700 ${s.className || ""}`, children: a });
|
|
1103
1246
|
}
|
|
1104
|
-
const
|
|
1247
|
+
const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1105
1248
|
__proto__: null,
|
|
1106
|
-
SummaryField:
|
|
1249
|
+
SummaryField: mt
|
|
1107
1250
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1108
|
-
function
|
|
1109
|
-
const
|
|
1110
|
-
return /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${
|
|
1251
|
+
function ft({ value: e, field: r, ...s }) {
|
|
1252
|
+
const l = e != null ? String(e) : "-";
|
|
1253
|
+
return /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${s.className || ""}`, children: l });
|
|
1111
1254
|
}
|
|
1112
|
-
const
|
|
1255
|
+
const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1113
1256
|
__proto__: null,
|
|
1114
|
-
AutoNumberField:
|
|
1257
|
+
AutoNumberField: ft
|
|
1115
1258
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1116
|
-
function
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1259
|
+
function Ne({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1260
|
+
const i = (s || n.schema)?.multiple || !1;
|
|
1261
|
+
if (l) {
|
|
1119
1262
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
1120
1263
|
const m = Array.isArray(e) ? e : [e];
|
|
1121
1264
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
1122
1265
|
m.slice(0, 3).map((p, f) => {
|
|
1123
|
-
const u = p.name || p.username || "User", x = u.split(" ").map((
|
|
1124
|
-
return /* @__PURE__ */ t.jsx(
|
|
1266
|
+
const u = p.name || p.username || "User", x = u.split(" ").map((g) => g[0]).join("").toUpperCase().slice(0, 2);
|
|
1267
|
+
return /* @__PURE__ */ t.jsx(ee, { className: "size-8 border-2 border-white", title: u, children: /* @__PURE__ */ t.jsx(te, { className: "bg-blue-500 text-white text-xs", children: x }) }, f);
|
|
1125
1268
|
}),
|
|
1126
|
-
m.length > 3 && /* @__PURE__ */ t.jsx(
|
|
1269
|
+
m.length > 3 && /* @__PURE__ */ t.jsx(ee, { className: "size-8 border-2 border-white", children: /* @__PURE__ */ t.jsxs(te, { className: "bg-gray-200 text-gray-600 text-xs", children: [
|
|
1127
1270
|
"+",
|
|
1128
1271
|
m.length - 3
|
|
1129
1272
|
] }) })
|
|
1130
1273
|
] });
|
|
1131
1274
|
}
|
|
1132
1275
|
const o = e ? Array.isArray(e) ? e : [e] : [], c = (m) => {
|
|
1133
|
-
if (
|
|
1276
|
+
if (i) {
|
|
1134
1277
|
const p = o.filter((f, u) => u !== m);
|
|
1135
1278
|
r(p.length > 0 ? p : null);
|
|
1136
1279
|
} else
|
|
1137
1280
|
r(null);
|
|
1138
1281
|
};
|
|
1139
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
1282
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
1140
1283
|
o.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: o.map((m, p) => {
|
|
1141
1284
|
const f = m.name || m.username || "User", u = f.split(" ").map((x) => x[0]).join("").toUpperCase().slice(0, 2);
|
|
1142
|
-
return /* @__PURE__ */ t.jsxs(
|
|
1143
|
-
/* @__PURE__ */ t.jsx(
|
|
1285
|
+
return /* @__PURE__ */ t.jsxs(Z, { variant: "outline", className: "gap-2 pr-1", children: [
|
|
1286
|
+
/* @__PURE__ */ t.jsx(ee, { className: "size-5", children: /* @__PURE__ */ t.jsx(te, { className: "bg-blue-500 text-white text-xs", children: u }) }),
|
|
1144
1287
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children: f }),
|
|
1145
1288
|
/* @__PURE__ */ t.jsx(
|
|
1146
1289
|
"button",
|
|
@@ -1148,7 +1291,7 @@ function de({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1148
1291
|
type: "button",
|
|
1149
1292
|
onClick: () => c(p),
|
|
1150
1293
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
1151
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1294
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "size-3" })
|
|
1152
1295
|
}
|
|
1153
1296
|
)
|
|
1154
1297
|
] }, p);
|
|
@@ -1156,13 +1299,13 @@ function de({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1156
1299
|
/* @__PURE__ */ t.jsx("div", { className: "text-sm text-gray-500 italic", children: "User selection component requires integration with user management system" })
|
|
1157
1300
|
] });
|
|
1158
1301
|
}
|
|
1159
|
-
const
|
|
1302
|
+
const Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1160
1303
|
__proto__: null,
|
|
1161
|
-
UserField:
|
|
1304
|
+
UserField: Ne
|
|
1162
1305
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1306
|
+
function xt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1307
|
+
const a = s || n.schema, i = () => e == null ? "" : JSON.stringify(e, null, 2), [o, c] = I(i), [m, p] = I(null);
|
|
1308
|
+
if (le(() => {
|
|
1166
1309
|
try {
|
|
1167
1310
|
if (e == null) {
|
|
1168
1311
|
c("");
|
|
@@ -1173,8 +1316,8 @@ function lt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1173
1316
|
} catch {
|
|
1174
1317
|
c(JSON.stringify(e, null, 2));
|
|
1175
1318
|
}
|
|
1176
|
-
}, [e, o]),
|
|
1177
|
-
return e ? /* @__PURE__ */ t.jsx("pre", { className:
|
|
1319
|
+
}, [e, o]), l)
|
|
1320
|
+
return e ? /* @__PURE__ */ t.jsx("pre", { className: B("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", n.className), children: JSON.stringify(e, null, 2) }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
1178
1321
|
const f = (u) => {
|
|
1179
1322
|
const x = u.target.value;
|
|
1180
1323
|
if (c(x), p(null), !x.trim()) {
|
|
@@ -1182,74 +1325,74 @@ function lt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1182
1325
|
return;
|
|
1183
1326
|
}
|
|
1184
1327
|
try {
|
|
1185
|
-
const
|
|
1186
|
-
r(
|
|
1328
|
+
const g = JSON.parse(x);
|
|
1329
|
+
r(g);
|
|
1187
1330
|
} catch {
|
|
1188
1331
|
p("Invalid JSON");
|
|
1189
1332
|
}
|
|
1190
1333
|
};
|
|
1191
1334
|
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1192
1335
|
/* @__PURE__ */ t.jsx(
|
|
1193
|
-
|
|
1336
|
+
xe,
|
|
1194
1337
|
{
|
|
1195
1338
|
value: o,
|
|
1196
1339
|
onChange: f,
|
|
1197
|
-
placeholder:
|
|
1340
|
+
placeholder: a?.placeholder || `{
|
|
1198
1341
|
"key": "value"
|
|
1199
1342
|
}`,
|
|
1200
|
-
disabled:
|
|
1201
|
-
className:
|
|
1343
|
+
disabled: l || n.disabled,
|
|
1344
|
+
className: B("font-mono text-xs", m ? "border-red-500 focus-visible:ring-red-500" : "", n.className),
|
|
1202
1345
|
rows: 6
|
|
1203
1346
|
}
|
|
1204
1347
|
),
|
|
1205
1348
|
m && /* @__PURE__ */ t.jsx("p", { className: "text-xs text-red-500", children: m })
|
|
1206
1349
|
] });
|
|
1207
1350
|
}
|
|
1208
|
-
const
|
|
1351
|
+
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1209
1352
|
__proto__: null,
|
|
1210
|
-
ObjectField:
|
|
1353
|
+
ObjectField: xt
|
|
1211
1354
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1212
|
-
function
|
|
1213
|
-
const
|
|
1355
|
+
function pt({ value: e, field: r, ...s }) {
|
|
1356
|
+
const n = (r || s.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
1214
1357
|
if (!e || !Array.isArray(e))
|
|
1215
1358
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm text-gray-500", children: "-" });
|
|
1216
|
-
const
|
|
1217
|
-
const o = Number(
|
|
1359
|
+
const a = e.slice(0, 3).map((i) => {
|
|
1360
|
+
const o = Number(i);
|
|
1218
1361
|
return isNaN(o) ? "0" : o.toFixed(4);
|
|
1219
1362
|
}).join(", ");
|
|
1220
|
-
return /* @__PURE__ */ t.jsxs("div", { className: `text-sm ${
|
|
1363
|
+
return /* @__PURE__ */ t.jsxs("div", { className: `text-sm ${s.className || ""}`, children: [
|
|
1221
1364
|
/* @__PURE__ */ t.jsxs("span", { className: "font-mono text-gray-700", children: [
|
|
1222
1365
|
"[",
|
|
1223
|
-
|
|
1366
|
+
a,
|
|
1224
1367
|
"...]"
|
|
1225
1368
|
] }),
|
|
1226
1369
|
/* @__PURE__ */ t.jsxs("span", { className: "text-gray-500 ml-2", children: [
|
|
1227
1370
|
"(",
|
|
1228
|
-
|
|
1371
|
+
n,
|
|
1229
1372
|
"D)"
|
|
1230
1373
|
] })
|
|
1231
1374
|
] });
|
|
1232
1375
|
}
|
|
1233
|
-
const
|
|
1376
|
+
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1234
1377
|
__proto__: null,
|
|
1235
|
-
VectorField:
|
|
1378
|
+
VectorField: pt
|
|
1236
1379
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1237
|
-
function
|
|
1238
|
-
const
|
|
1239
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "-" }) :
|
|
1380
|
+
function ht({ value: e, field: r, readonly: s, ...l }) {
|
|
1381
|
+
const a = (r || l.schema)?.columns || [];
|
|
1382
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "-" }) : s ? /* @__PURE__ */ t.jsx("div", { className: B("text-sm", l.className), children: /* @__PURE__ */ t.jsxs("span", { className: "text-foreground", children: [
|
|
1240
1383
|
e.length,
|
|
1241
1384
|
" rows"
|
|
1242
|
-
] }) }) : /* @__PURE__ */ t.jsxs("div", { className:
|
|
1385
|
+
] }) }) : /* @__PURE__ */ t.jsxs("div", { className: B("border border-border rounded-lg overflow-hidden", l.className), children: [
|
|
1243
1386
|
/* @__PURE__ */ t.jsx("div", { className: "overflow-auto max-h-60", children: /* @__PURE__ */ t.jsxs("table", { className: "w-full text-sm", children: [
|
|
1244
|
-
/* @__PURE__ */ t.jsx("thead", { className: "bg-muted border-b border-border", children: /* @__PURE__ */ t.jsx("tr", { children:
|
|
1387
|
+
/* @__PURE__ */ t.jsx("thead", { className: "bg-muted border-b border-border", children: /* @__PURE__ */ t.jsx("tr", { children: a.map((i, o) => /* @__PURE__ */ t.jsx(
|
|
1245
1388
|
"th",
|
|
1246
1389
|
{
|
|
1247
1390
|
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
1248
|
-
children:
|
|
1391
|
+
children: i.label || i.name
|
|
1249
1392
|
},
|
|
1250
1393
|
o
|
|
1251
1394
|
)) }) }),
|
|
1252
|
-
/* @__PURE__ */ t.jsx("tbody", { className: "divide-y divide-border", children: e.slice(0, 5).map((
|
|
1395
|
+
/* @__PURE__ */ t.jsx("tbody", { className: "divide-y divide-border", children: e.slice(0, 5).map((i, o) => /* @__PURE__ */ t.jsx("tr", { className: "hover:bg-muted/50 transition-colors", children: a.map((c, m) => /* @__PURE__ */ t.jsx("td", { className: "px-3 py-2 text-foreground", children: i[c.name] != null ? String(i[c.name]) : "-" }, m)) }, o)) })
|
|
1253
1396
|
] }) }),
|
|
1254
1397
|
e.length > 5 && /* @__PURE__ */ t.jsxs("div", { className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border", children: [
|
|
1255
1398
|
"Showing 5 of ",
|
|
@@ -1258,13 +1401,13 @@ function ot({ value: e, field: r, readonly: n, ...a }) {
|
|
|
1258
1401
|
] })
|
|
1259
1402
|
] });
|
|
1260
1403
|
}
|
|
1261
|
-
const
|
|
1404
|
+
const Or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1262
1405
|
__proto__: null,
|
|
1263
|
-
GridField:
|
|
1406
|
+
GridField: ht
|
|
1264
1407
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1265
|
-
function
|
|
1266
|
-
const
|
|
1267
|
-
return
|
|
1408
|
+
function gt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1409
|
+
const a = s || n.schema;
|
|
1410
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1268
1411
|
/* @__PURE__ */ t.jsx(
|
|
1269
1412
|
"div",
|
|
1270
1413
|
{
|
|
@@ -1279,62 +1422,62 @@ function ct({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1279
1422
|
{
|
|
1280
1423
|
type: "color",
|
|
1281
1424
|
value: e || "#000000",
|
|
1282
|
-
onChange: (
|
|
1283
|
-
disabled:
|
|
1425
|
+
onChange: (i) => r(i.target.value),
|
|
1426
|
+
disabled: l || n.disabled,
|
|
1284
1427
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
1285
1428
|
}
|
|
1286
1429
|
),
|
|
1287
1430
|
/* @__PURE__ */ t.jsx(
|
|
1288
|
-
|
|
1431
|
+
T,
|
|
1289
1432
|
{
|
|
1290
1433
|
type: "text",
|
|
1291
1434
|
value: e || "",
|
|
1292
|
-
onChange: (
|
|
1293
|
-
placeholder:
|
|
1294
|
-
disabled:
|
|
1295
|
-
className:
|
|
1435
|
+
onChange: (i) => r(i.target.value),
|
|
1436
|
+
placeholder: a?.placeholder || "#000000",
|
|
1437
|
+
disabled: l || n.disabled,
|
|
1438
|
+
className: n.className,
|
|
1296
1439
|
pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
|
|
1297
1440
|
}
|
|
1298
1441
|
)
|
|
1299
1442
|
] });
|
|
1300
1443
|
}
|
|
1301
|
-
const
|
|
1444
|
+
const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1302
1445
|
__proto__: null,
|
|
1303
|
-
ColorField:
|
|
1446
|
+
ColorField: gt
|
|
1304
1447
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1305
|
-
function
|
|
1306
|
-
const
|
|
1307
|
-
return
|
|
1308
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium", children: e ??
|
|
1448
|
+
function bt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1449
|
+
const a = s || n.schema, i = a?.min ?? 0, o = a?.max ?? 100, c = a?.step ?? 1;
|
|
1450
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1451
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium", children: e ?? i }),
|
|
1309
1452
|
/* @__PURE__ */ t.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
1310
1453
|
"/ ",
|
|
1311
1454
|
o
|
|
1312
1455
|
] })
|
|
1313
1456
|
] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1314
1457
|
/* @__PURE__ */ t.jsx(
|
|
1315
|
-
|
|
1458
|
+
Ye,
|
|
1316
1459
|
{
|
|
1317
|
-
value: [e ??
|
|
1460
|
+
value: [e ?? i],
|
|
1318
1461
|
onValueChange: (m) => r(m[0]),
|
|
1319
|
-
min:
|
|
1462
|
+
min: i,
|
|
1320
1463
|
max: o,
|
|
1321
1464
|
step: c,
|
|
1322
|
-
disabled:
|
|
1323
|
-
className:
|
|
1465
|
+
disabled: l || n.disabled,
|
|
1466
|
+
className: n.className
|
|
1324
1467
|
}
|
|
1325
1468
|
),
|
|
1326
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium w-12 text-right", children: e ??
|
|
1469
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium w-12 text-right", children: e ?? i })
|
|
1327
1470
|
] });
|
|
1328
1471
|
}
|
|
1329
|
-
const
|
|
1472
|
+
const Rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1330
1473
|
__proto__: null,
|
|
1331
|
-
SliderField:
|
|
1474
|
+
SliderField: bt
|
|
1332
1475
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1333
|
-
function
|
|
1334
|
-
const o = (
|
|
1335
|
-
return
|
|
1476
|
+
function jt({ value: e, onChange: r, field: s, readonly: l, className: n, ...a }) {
|
|
1477
|
+
const o = (s || a.schema)?.max ?? 5, c = e ?? 0, [m, p] = E.useState(null), f = m !== null ? m : c;
|
|
1478
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: B("flex items-center gap-1", n), children: [
|
|
1336
1479
|
Array.from({ length: o }, (u, x) => /* @__PURE__ */ t.jsx(
|
|
1337
|
-
|
|
1480
|
+
Re,
|
|
1338
1481
|
{
|
|
1339
1482
|
className: `w-5 h-5 ${x < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}`
|
|
1340
1483
|
},
|
|
@@ -1345,7 +1488,7 @@ function ut({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
1345
1488
|
" / ",
|
|
1346
1489
|
o
|
|
1347
1490
|
] })
|
|
1348
|
-
] }) : /* @__PURE__ */ t.jsxs("div", { className:
|
|
1491
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: B("flex items-center gap-1", n), children: [
|
|
1349
1492
|
Array.from({ length: o }, (u, x) => /* @__PURE__ */ t.jsx(
|
|
1350
1493
|
"button",
|
|
1351
1494
|
{
|
|
@@ -1354,9 +1497,9 @@ function ut({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
1354
1497
|
onMouseEnter: () => p(x + 1),
|
|
1355
1498
|
onMouseLeave: () => p(null),
|
|
1356
1499
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
1357
|
-
disabled:
|
|
1500
|
+
disabled: l || a.disabled,
|
|
1358
1501
|
children: /* @__PURE__ */ t.jsx(
|
|
1359
|
-
|
|
1502
|
+
Re,
|
|
1360
1503
|
{
|
|
1361
1504
|
className: `w-5 h-5 transition-colors ${x < f ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}`
|
|
1362
1505
|
}
|
|
@@ -1371,31 +1514,31 @@ function ut({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
1371
1514
|
] })
|
|
1372
1515
|
] });
|
|
1373
1516
|
}
|
|
1374
|
-
const
|
|
1517
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1375
1518
|
__proto__: null,
|
|
1376
|
-
RatingField:
|
|
1519
|
+
RatingField: jt
|
|
1377
1520
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1378
|
-
function
|
|
1379
|
-
const
|
|
1380
|
-
return
|
|
1381
|
-
|
|
1521
|
+
function yt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1522
|
+
const a = s || n.schema, i = a?.language ?? "javascript";
|
|
1523
|
+
return l ? /* @__PURE__ */ t.jsx("pre", { className: B("text-sm bg-muted p-2 rounded overflow-x-auto border", n.className), children: /* @__PURE__ */ t.jsx("code", { children: e || "-" }) }) : /* @__PURE__ */ t.jsx(
|
|
1524
|
+
xe,
|
|
1382
1525
|
{
|
|
1383
1526
|
value: e || "",
|
|
1384
1527
|
onChange: (o) => r(o.target.value),
|
|
1385
|
-
placeholder:
|
|
1386
|
-
disabled:
|
|
1387
|
-
className:
|
|
1528
|
+
placeholder: a?.placeholder || `// Write ${i} code here...`,
|
|
1529
|
+
disabled: l || n.disabled,
|
|
1530
|
+
className: B("font-mono text-sm", n.className),
|
|
1388
1531
|
rows: 12,
|
|
1389
1532
|
spellCheck: !1
|
|
1390
1533
|
}
|
|
1391
1534
|
);
|
|
1392
1535
|
}
|
|
1393
|
-
const
|
|
1536
|
+
const Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1394
1537
|
__proto__: null,
|
|
1395
|
-
CodeField:
|
|
1538
|
+
CodeField: yt
|
|
1396
1539
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1397
|
-
function
|
|
1398
|
-
const [
|
|
1540
|
+
function Nt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1541
|
+
const [a, i] = E.useState(!1), o = E.useRef(null), c = s || n.schema, m = (u) => {
|
|
1399
1542
|
const x = u.target.files?.[0];
|
|
1400
1543
|
if (!x) return;
|
|
1401
1544
|
if (!x.type.startsWith("image/")) {
|
|
@@ -1406,35 +1549,35 @@ function ft({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1406
1549
|
console.error("File size must be less than 5MB");
|
|
1407
1550
|
return;
|
|
1408
1551
|
}
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
r(
|
|
1412
|
-
},
|
|
1552
|
+
const g = new FileReader();
|
|
1553
|
+
g.onloadend = () => {
|
|
1554
|
+
r(g.result);
|
|
1555
|
+
}, g.readAsDataURL(x);
|
|
1413
1556
|
}, p = () => {
|
|
1414
1557
|
r("");
|
|
1415
1558
|
}, f = () => (c?.defaultName || c?.label || "User").split(" ").map((x) => x[0]).join("").toUpperCase().slice(0, 2);
|
|
1416
|
-
return
|
|
1417
|
-
e && /* @__PURE__ */ t.jsx(
|
|
1418
|
-
/* @__PURE__ */ t.jsx(
|
|
1559
|
+
return l ? /* @__PURE__ */ t.jsxs(ee, { className: "w-16 h-16", children: [
|
|
1560
|
+
e && /* @__PURE__ */ t.jsx(Te, { src: e, alt: c?.label }),
|
|
1561
|
+
/* @__PURE__ */ t.jsx(te, { children: f() })
|
|
1419
1562
|
] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1420
1563
|
/* @__PURE__ */ t.jsxs(
|
|
1421
1564
|
"div",
|
|
1422
1565
|
{
|
|
1423
1566
|
className: "relative",
|
|
1424
|
-
onMouseEnter: () =>
|
|
1425
|
-
onMouseLeave: () =>
|
|
1567
|
+
onMouseEnter: () => i(!0),
|
|
1568
|
+
onMouseLeave: () => i(!1),
|
|
1426
1569
|
children: [
|
|
1427
|
-
/* @__PURE__ */ t.jsxs(
|
|
1428
|
-
e && /* @__PURE__ */ t.jsx(
|
|
1429
|
-
/* @__PURE__ */ t.jsx(
|
|
1570
|
+
/* @__PURE__ */ t.jsxs(ee, { className: "w-16 h-16", children: [
|
|
1571
|
+
e && /* @__PURE__ */ t.jsx(Te, { src: e, alt: c?.label }),
|
|
1572
|
+
/* @__PURE__ */ t.jsx(te, { children: f() })
|
|
1430
1573
|
] }),
|
|
1431
|
-
!
|
|
1574
|
+
!l && a && e && /* @__PURE__ */ t.jsx(
|
|
1432
1575
|
"button",
|
|
1433
1576
|
{
|
|
1434
1577
|
type: "button",
|
|
1435
1578
|
onClick: p,
|
|
1436
1579
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
1437
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1580
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "w-3 h-3" })
|
|
1438
1581
|
}
|
|
1439
1582
|
)
|
|
1440
1583
|
]
|
|
@@ -1458,9 +1601,9 @@ function ft({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1458
1601
|
variant: "outline",
|
|
1459
1602
|
size: "sm",
|
|
1460
1603
|
onClick: () => o.current?.click(),
|
|
1461
|
-
disabled:
|
|
1604
|
+
disabled: l || n.disabled,
|
|
1462
1605
|
children: [
|
|
1463
|
-
/* @__PURE__ */ t.jsx(
|
|
1606
|
+
/* @__PURE__ */ t.jsx(qe, { className: "w-4 h-4 mr-2" }),
|
|
1464
1607
|
e ? "Change" : "Upload",
|
|
1465
1608
|
" Avatar"
|
|
1466
1609
|
]
|
|
@@ -1470,14 +1613,14 @@ function ft({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1470
1613
|
] })
|
|
1471
1614
|
] });
|
|
1472
1615
|
}
|
|
1473
|
-
const
|
|
1616
|
+
const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1474
1617
|
__proto__: null,
|
|
1475
|
-
AvatarField:
|
|
1618
|
+
AvatarField: Nt
|
|
1476
1619
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1477
|
-
function
|
|
1478
|
-
const
|
|
1620
|
+
function vt({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1621
|
+
const a = e || {}, i = (c, m) => {
|
|
1479
1622
|
r({
|
|
1480
|
-
...
|
|
1623
|
+
...a,
|
|
1481
1624
|
[c]: m
|
|
1482
1625
|
});
|
|
1483
1626
|
}, o = (c) => [
|
|
@@ -1486,90 +1629,90 @@ function xt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1486
1629
|
[c.state, c.zipCode].filter(Boolean).join(" "),
|
|
1487
1630
|
c.country
|
|
1488
1631
|
].filter(Boolean).join(", ") || "-";
|
|
1489
|
-
return
|
|
1632
|
+
return l ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o(a) }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-3", children: [
|
|
1490
1633
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1491
|
-
/* @__PURE__ */ t.jsx(
|
|
1634
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "street", className: "text-xs", children: "Street Address" }),
|
|
1492
1635
|
/* @__PURE__ */ t.jsx(
|
|
1493
|
-
|
|
1636
|
+
T,
|
|
1494
1637
|
{
|
|
1495
1638
|
id: "street",
|
|
1496
1639
|
type: "text",
|
|
1497
|
-
value:
|
|
1498
|
-
onChange: (c) =>
|
|
1640
|
+
value: a.street || "",
|
|
1641
|
+
onChange: (c) => i("street", c.target.value),
|
|
1499
1642
|
placeholder: "123 Main St",
|
|
1500
|
-
disabled:
|
|
1501
|
-
className:
|
|
1643
|
+
disabled: l || n.disabled,
|
|
1644
|
+
className: n.className
|
|
1502
1645
|
}
|
|
1503
1646
|
)
|
|
1504
1647
|
] }),
|
|
1505
1648
|
/* @__PURE__ */ t.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1506
1649
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1507
|
-
/* @__PURE__ */ t.jsx(
|
|
1650
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "city", className: "text-xs", children: "City" }),
|
|
1508
1651
|
/* @__PURE__ */ t.jsx(
|
|
1509
|
-
|
|
1652
|
+
T,
|
|
1510
1653
|
{
|
|
1511
1654
|
id: "city",
|
|
1512
1655
|
type: "text",
|
|
1513
|
-
value:
|
|
1514
|
-
onChange: (c) =>
|
|
1656
|
+
value: a.city || "",
|
|
1657
|
+
onChange: (c) => i("city", c.target.value),
|
|
1515
1658
|
placeholder: "San Francisco",
|
|
1516
|
-
disabled:
|
|
1659
|
+
disabled: l || n.disabled
|
|
1517
1660
|
}
|
|
1518
1661
|
)
|
|
1519
1662
|
] }),
|
|
1520
1663
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1521
|
-
/* @__PURE__ */ t.jsx(
|
|
1664
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "state", className: "text-xs", children: "State / Province" }),
|
|
1522
1665
|
/* @__PURE__ */ t.jsx(
|
|
1523
|
-
|
|
1666
|
+
T,
|
|
1524
1667
|
{
|
|
1525
1668
|
id: "state",
|
|
1526
1669
|
type: "text",
|
|
1527
|
-
value:
|
|
1528
|
-
onChange: (c) =>
|
|
1670
|
+
value: a.state || "",
|
|
1671
|
+
onChange: (c) => i("state", c.target.value),
|
|
1529
1672
|
placeholder: "CA",
|
|
1530
|
-
disabled:
|
|
1673
|
+
disabled: l || n.disabled
|
|
1531
1674
|
}
|
|
1532
1675
|
)
|
|
1533
1676
|
] })
|
|
1534
1677
|
] }),
|
|
1535
1678
|
/* @__PURE__ */ t.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1536
1679
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1537
|
-
/* @__PURE__ */ t.jsx(
|
|
1680
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "zipCode", className: "text-xs", children: "ZIP / Postal Code" }),
|
|
1538
1681
|
/* @__PURE__ */ t.jsx(
|
|
1539
|
-
|
|
1682
|
+
T,
|
|
1540
1683
|
{
|
|
1541
1684
|
id: "zipCode",
|
|
1542
1685
|
type: "text",
|
|
1543
|
-
value:
|
|
1544
|
-
onChange: (c) =>
|
|
1686
|
+
value: a.zipCode || "",
|
|
1687
|
+
onChange: (c) => i("zipCode", c.target.value),
|
|
1545
1688
|
placeholder: "94102",
|
|
1546
|
-
disabled:
|
|
1689
|
+
disabled: l || n.disabled
|
|
1547
1690
|
}
|
|
1548
1691
|
)
|
|
1549
1692
|
] }),
|
|
1550
1693
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1551
|
-
/* @__PURE__ */ t.jsx(
|
|
1694
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "country", className: "text-xs", children: "Country" }),
|
|
1552
1695
|
/* @__PURE__ */ t.jsx(
|
|
1553
|
-
|
|
1696
|
+
T,
|
|
1554
1697
|
{
|
|
1555
1698
|
id: "country",
|
|
1556
1699
|
type: "text",
|
|
1557
|
-
value:
|
|
1558
|
-
onChange: (c) =>
|
|
1700
|
+
value: a.country || "",
|
|
1701
|
+
onChange: (c) => i("country", c.target.value),
|
|
1559
1702
|
placeholder: "United States",
|
|
1560
|
-
disabled:
|
|
1703
|
+
disabled: l || n.disabled
|
|
1561
1704
|
}
|
|
1562
1705
|
)
|
|
1563
1706
|
] })
|
|
1564
1707
|
] })
|
|
1565
1708
|
] });
|
|
1566
1709
|
}
|
|
1567
|
-
const
|
|
1710
|
+
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1568
1711
|
__proto__: null,
|
|
1569
|
-
AddressField:
|
|
1712
|
+
AddressField: vt
|
|
1570
1713
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1571
|
-
function
|
|
1572
|
-
const [
|
|
1714
|
+
function _t({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1715
|
+
const [a, i] = E.useState(!1), o = e || {}, c = (u, x) => {
|
|
1573
1716
|
r({
|
|
1574
1717
|
...o,
|
|
1575
1718
|
[u]: x ? Number(x) : void 0
|
|
@@ -1579,16 +1722,16 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1579
1722
|
console.error("Geolocation is not supported by this browser");
|
|
1580
1723
|
return;
|
|
1581
1724
|
}
|
|
1582
|
-
|
|
1725
|
+
i(!0), navigator.geolocation.getCurrentPosition(
|
|
1583
1726
|
(u) => {
|
|
1584
1727
|
r({
|
|
1585
1728
|
latitude: u.coords.latitude,
|
|
1586
1729
|
longitude: u.coords.longitude,
|
|
1587
1730
|
accuracy: u.coords.accuracy
|
|
1588
|
-
}),
|
|
1731
|
+
}), i(!1);
|
|
1589
1732
|
},
|
|
1590
1733
|
(u) => {
|
|
1591
|
-
console.error("Error getting location:", u.message),
|
|
1734
|
+
console.error("Error getting location:", u.message), i(!1);
|
|
1592
1735
|
},
|
|
1593
1736
|
{
|
|
1594
1737
|
enableHighAccuracy: !0,
|
|
@@ -1601,8 +1744,8 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1601
1744
|
const u = `https://www.google.com/maps?q=${o.latitude},${o.longitude}`;
|
|
1602
1745
|
window.open(u, "_blank");
|
|
1603
1746
|
};
|
|
1604
|
-
return
|
|
1605
|
-
/* @__PURE__ */ t.jsx(
|
|
1747
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1748
|
+
/* @__PURE__ */ t.jsx(ke, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1606
1749
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children: p(o) }),
|
|
1607
1750
|
o.latitude && o.longitude && /* @__PURE__ */ t.jsx(
|
|
1608
1751
|
P,
|
|
@@ -1624,10 +1767,10 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1624
1767
|
variant: "outline",
|
|
1625
1768
|
size: "sm",
|
|
1626
1769
|
onClick: m,
|
|
1627
|
-
disabled:
|
|
1770
|
+
disabled: l || a,
|
|
1628
1771
|
children: [
|
|
1629
|
-
/* @__PURE__ */ t.jsx(
|
|
1630
|
-
|
|
1772
|
+
/* @__PURE__ */ t.jsx(Ht, { className: "w-4 h-4 mr-2" }),
|
|
1773
|
+
a ? "Getting location..." : "Use Current Location"
|
|
1631
1774
|
]
|
|
1632
1775
|
}
|
|
1633
1776
|
),
|
|
@@ -1639,7 +1782,7 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1639
1782
|
size: "sm",
|
|
1640
1783
|
onClick: f,
|
|
1641
1784
|
children: [
|
|
1642
|
-
/* @__PURE__ */ t.jsx(
|
|
1785
|
+
/* @__PURE__ */ t.jsx(ke, { className: "w-4 h-4 mr-2" }),
|
|
1643
1786
|
"View on map"
|
|
1644
1787
|
]
|
|
1645
1788
|
}
|
|
@@ -1647,32 +1790,32 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1647
1790
|
] }),
|
|
1648
1791
|
/* @__PURE__ */ t.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1649
1792
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1650
|
-
/* @__PURE__ */ t.jsx(
|
|
1793
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "latitude", className: "text-xs", children: "Latitude" }),
|
|
1651
1794
|
/* @__PURE__ */ t.jsx(
|
|
1652
|
-
|
|
1795
|
+
T,
|
|
1653
1796
|
{
|
|
1654
1797
|
id: "latitude",
|
|
1655
1798
|
type: "number",
|
|
1656
1799
|
value: o.latitude ?? "",
|
|
1657
1800
|
onChange: (u) => c("latitude", u.target.value),
|
|
1658
1801
|
placeholder: "37.7749",
|
|
1659
|
-
disabled:
|
|
1802
|
+
disabled: l || n.disabled,
|
|
1660
1803
|
step: "any",
|
|
1661
|
-
className:
|
|
1804
|
+
className: n.className
|
|
1662
1805
|
}
|
|
1663
1806
|
)
|
|
1664
1807
|
] }),
|
|
1665
1808
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1666
|
-
/* @__PURE__ */ t.jsx(
|
|
1809
|
+
/* @__PURE__ */ t.jsx(G, { htmlFor: "longitude", className: "text-xs", children: "Longitude" }),
|
|
1667
1810
|
/* @__PURE__ */ t.jsx(
|
|
1668
|
-
|
|
1811
|
+
T,
|
|
1669
1812
|
{
|
|
1670
1813
|
id: "longitude",
|
|
1671
1814
|
type: "number",
|
|
1672
1815
|
value: o.longitude ?? "",
|
|
1673
1816
|
onChange: (u) => c("longitude", u.target.value),
|
|
1674
1817
|
placeholder: "-122.4194",
|
|
1675
|
-
disabled:
|
|
1818
|
+
disabled: l || n.disabled,
|
|
1676
1819
|
step: "any"
|
|
1677
1820
|
}
|
|
1678
1821
|
)
|
|
@@ -1685,58 +1828,58 @@ function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1685
1828
|
] })
|
|
1686
1829
|
] });
|
|
1687
1830
|
}
|
|
1688
|
-
const
|
|
1831
|
+
const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1689
1832
|
__proto__: null,
|
|
1690
|
-
GeolocationField:
|
|
1833
|
+
GeolocationField: _t
|
|
1691
1834
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1692
|
-
function
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1695
|
-
if (e &&
|
|
1696
|
-
const x =
|
|
1835
|
+
function wt({ value: e, onChange: r, readonly: s }) {
|
|
1836
|
+
const l = fe(null), [n, a] = E.useState(!1), [i, o] = E.useState(!e);
|
|
1837
|
+
le(() => {
|
|
1838
|
+
if (e && l.current) {
|
|
1839
|
+
const x = l.current.getContext("2d");
|
|
1697
1840
|
if (x) {
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1700
|
-
x.drawImage(
|
|
1701
|
-
},
|
|
1841
|
+
const g = new Image();
|
|
1842
|
+
g.onload = () => {
|
|
1843
|
+
x.drawImage(g, 0, 0), o(!1);
|
|
1844
|
+
}, g.src = e;
|
|
1702
1845
|
}
|
|
1703
1846
|
}
|
|
1704
1847
|
}, [e]);
|
|
1705
1848
|
const c = (u) => {
|
|
1706
|
-
if (
|
|
1707
|
-
|
|
1708
|
-
const x =
|
|
1849
|
+
if (s) return;
|
|
1850
|
+
a(!0), o(!1);
|
|
1851
|
+
const x = l.current;
|
|
1709
1852
|
if (!x) return;
|
|
1710
|
-
const
|
|
1711
|
-
if (!
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1853
|
+
const g = x.getContext("2d");
|
|
1854
|
+
if (!g) return;
|
|
1855
|
+
const _ = x.getBoundingClientRect(), k = "touches" in u ? u.touches[0].clientX - _.left : u.clientX - _.left, D = "touches" in u ? u.touches[0].clientY - _.top : u.clientY - _.top;
|
|
1856
|
+
g.beginPath(), g.moveTo(k, D);
|
|
1714
1857
|
}, m = (u) => {
|
|
1715
|
-
if (!
|
|
1716
|
-
const x =
|
|
1858
|
+
if (!n || s) return;
|
|
1859
|
+
const x = l.current;
|
|
1717
1860
|
if (!x) return;
|
|
1718
|
-
const
|
|
1719
|
-
if (!
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1861
|
+
const g = x.getContext("2d");
|
|
1862
|
+
if (!g) return;
|
|
1863
|
+
const _ = x.getBoundingClientRect(), k = "touches" in u ? u.touches[0].clientX - _.left : u.clientX - _.left, D = "touches" in u ? u.touches[0].clientY - _.top : u.clientY - _.top;
|
|
1864
|
+
g.lineTo(k, D), g.strokeStyle = "#000", g.lineWidth = 2, g.lineCap = "round", g.lineJoin = "round", g.stroke();
|
|
1722
1865
|
}, p = () => {
|
|
1723
|
-
if (!
|
|
1724
|
-
|
|
1725
|
-
const u =
|
|
1866
|
+
if (!n) return;
|
|
1867
|
+
a(!1);
|
|
1868
|
+
const u = l.current;
|
|
1726
1869
|
if (!u) return;
|
|
1727
1870
|
const x = u.toDataURL("image/png");
|
|
1728
1871
|
r(x);
|
|
1729
1872
|
}, f = () => {
|
|
1730
|
-
const u =
|
|
1873
|
+
const u = l.current;
|
|
1731
1874
|
if (!u) return;
|
|
1732
1875
|
const x = u.getContext("2d");
|
|
1733
1876
|
x && (x.clearRect(0, 0, u.width, u.height), o(!0), r(""));
|
|
1734
1877
|
};
|
|
1735
|
-
return
|
|
1878
|
+
return s && e ? /* @__PURE__ */ t.jsx("div", { className: "border rounded p-2 bg-white", children: /* @__PURE__ */ t.jsx("img", { src: e, alt: "Signature", loading: "lazy", className: "max-w-full h-auto" }) }) : s && !e ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "No signature" }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
1736
1879
|
/* @__PURE__ */ t.jsx("div", { className: "border rounded bg-white", children: /* @__PURE__ */ t.jsx(
|
|
1737
1880
|
"canvas",
|
|
1738
1881
|
{
|
|
1739
|
-
ref:
|
|
1882
|
+
ref: l,
|
|
1740
1883
|
width: 400,
|
|
1741
1884
|
height: 200,
|
|
1742
1885
|
className: "w-full touch-none cursor-crosshair",
|
|
@@ -1750,7 +1893,7 @@ function ht({ value: e, onChange: r, readonly: n }) {
|
|
|
1750
1893
|
}
|
|
1751
1894
|
) }),
|
|
1752
1895
|
/* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
1753
|
-
/* @__PURE__ */ t.jsx("p", { className: "text-xs text-muted-foreground", children:
|
|
1896
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-xs text-muted-foreground", children: i ? "Sign above" : "Signature captured" }),
|
|
1754
1897
|
/* @__PURE__ */ t.jsxs(
|
|
1755
1898
|
P,
|
|
1756
1899
|
{
|
|
@@ -1758,9 +1901,9 @@ function ht({ value: e, onChange: r, readonly: n }) {
|
|
|
1758
1901
|
variant: "outline",
|
|
1759
1902
|
size: "sm",
|
|
1760
1903
|
onClick: f,
|
|
1761
|
-
disabled:
|
|
1904
|
+
disabled: s || i,
|
|
1762
1905
|
children: [
|
|
1763
|
-
/* @__PURE__ */ t.jsx(
|
|
1906
|
+
/* @__PURE__ */ t.jsx(Xt, { className: "w-4 h-4 mr-2" }),
|
|
1764
1907
|
"Clear"
|
|
1765
1908
|
]
|
|
1766
1909
|
}
|
|
@@ -1768,15 +1911,15 @@ function ht({ value: e, onChange: r, readonly: n }) {
|
|
|
1768
1911
|
] })
|
|
1769
1912
|
] });
|
|
1770
1913
|
}
|
|
1771
|
-
const
|
|
1914
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1772
1915
|
__proto__: null,
|
|
1773
|
-
SignatureField:
|
|
1916
|
+
SignatureField: wt
|
|
1774
1917
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1775
|
-
function
|
|
1776
|
-
const [
|
|
1918
|
+
function St({ value: e, onChange: r, field: s, readonly: l, ...n }) {
|
|
1919
|
+
const [a, i] = E.useState(!1), o = s || n.schema, c = (p) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(p)}`, m = () => {
|
|
1777
1920
|
e && navigator.clipboard.writeText(e);
|
|
1778
1921
|
};
|
|
1779
|
-
return
|
|
1922
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1780
1923
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm flex-1 truncate", children: e || "-" }),
|
|
1781
1924
|
e && /* @__PURE__ */ t.jsxs(
|
|
1782
1925
|
P,
|
|
@@ -1784,10 +1927,10 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1784
1927
|
type: "button",
|
|
1785
1928
|
variant: "outline",
|
|
1786
1929
|
size: "sm",
|
|
1787
|
-
onClick: () =>
|
|
1930
|
+
onClick: () => i(!a),
|
|
1788
1931
|
children: [
|
|
1789
|
-
/* @__PURE__ */ t.jsx(
|
|
1790
|
-
|
|
1932
|
+
/* @__PURE__ */ t.jsx(Ae, { className: "w-4 h-4 mr-2" }),
|
|
1933
|
+
a ? "Hide" : "Show",
|
|
1791
1934
|
" QR"
|
|
1792
1935
|
]
|
|
1793
1936
|
}
|
|
@@ -1795,14 +1938,14 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1795
1938
|
] }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-3", children: [
|
|
1796
1939
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1797
1940
|
/* @__PURE__ */ t.jsx(
|
|
1798
|
-
|
|
1941
|
+
T,
|
|
1799
1942
|
{
|
|
1800
1943
|
type: "text",
|
|
1801
1944
|
value: e || "",
|
|
1802
1945
|
onChange: (p) => r(p.target.value),
|
|
1803
1946
|
placeholder: o?.placeholder || "Enter text for QR code",
|
|
1804
|
-
disabled:
|
|
1805
|
-
className:
|
|
1947
|
+
disabled: l || n.disabled,
|
|
1948
|
+
className: n.className
|
|
1806
1949
|
}
|
|
1807
1950
|
),
|
|
1808
1951
|
e && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
@@ -1813,7 +1956,7 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1813
1956
|
variant: "outline",
|
|
1814
1957
|
size: "sm",
|
|
1815
1958
|
onClick: m,
|
|
1816
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1959
|
+
children: /* @__PURE__ */ t.jsx(Se, { className: "w-4 h-4" })
|
|
1817
1960
|
}
|
|
1818
1961
|
),
|
|
1819
1962
|
/* @__PURE__ */ t.jsx(
|
|
@@ -1822,13 +1965,13 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1822
1965
|
type: "button",
|
|
1823
1966
|
variant: "outline",
|
|
1824
1967
|
size: "sm",
|
|
1825
|
-
onClick: () =>
|
|
1826
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1968
|
+
onClick: () => i(!a),
|
|
1969
|
+
children: /* @__PURE__ */ t.jsx(Ae, { className: "w-4 h-4" })
|
|
1827
1970
|
}
|
|
1828
1971
|
)
|
|
1829
1972
|
] })
|
|
1830
1973
|
] }),
|
|
1831
|
-
|
|
1974
|
+
a && e && /* @__PURE__ */ t.jsx("div", { className: "border rounded p-4 bg-white flex justify-center", children: /* @__PURE__ */ t.jsx(
|
|
1832
1975
|
"img",
|
|
1833
1976
|
{
|
|
1834
1977
|
src: c(e),
|
|
@@ -1843,31 +1986,31 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1843
1986
|
] })
|
|
1844
1987
|
] });
|
|
1845
1988
|
}
|
|
1846
|
-
const
|
|
1989
|
+
const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1847
1990
|
__proto__: null,
|
|
1848
|
-
QRCodeField:
|
|
1991
|
+
QRCodeField: St
|
|
1849
1992
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1850
|
-
function
|
|
1993
|
+
function Ft({
|
|
1851
1994
|
value: e,
|
|
1852
1995
|
onChange: r,
|
|
1853
|
-
field:
|
|
1854
|
-
readonly:
|
|
1855
|
-
className:
|
|
1856
|
-
...
|
|
1996
|
+
field: s,
|
|
1997
|
+
readonly: l,
|
|
1998
|
+
className: n,
|
|
1999
|
+
...a
|
|
1857
2000
|
}) {
|
|
1858
|
-
const
|
|
2001
|
+
const i = e || [], o = s || a.schema, c = () => {
|
|
1859
2002
|
const f = {
|
|
1860
2003
|
id: `new-${Date.now()}`,
|
|
1861
2004
|
label: "New Related Record"
|
|
1862
2005
|
};
|
|
1863
|
-
r([...
|
|
2006
|
+
r([...i, f]);
|
|
1864
2007
|
}, m = (f) => {
|
|
1865
|
-
r(
|
|
2008
|
+
r(i.filter((u) => u.id !== f));
|
|
1866
2009
|
}, p = (f) => {
|
|
1867
2010
|
console.log("View detail:", f);
|
|
1868
2011
|
};
|
|
1869
|
-
return
|
|
1870
|
-
|
|
2012
|
+
return l ? /* @__PURE__ */ t.jsxs("div", { className: B("space-y-2", n), children: [
|
|
2013
|
+
i.length === 0 ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "No related records" }) : i.map((f) => /* @__PURE__ */ t.jsxs(
|
|
1871
2014
|
"div",
|
|
1872
2015
|
{
|
|
1873
2016
|
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
@@ -1880,7 +2023,7 @@ function bt({
|
|
|
1880
2023
|
variant: "ghost",
|
|
1881
2024
|
size: "sm",
|
|
1882
2025
|
onClick: () => p(f),
|
|
1883
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2026
|
+
children: /* @__PURE__ */ t.jsx($e, { className: "w-4 h-4" })
|
|
1884
2027
|
}
|
|
1885
2028
|
)
|
|
1886
2029
|
]
|
|
@@ -1888,19 +2031,19 @@ function bt({
|
|
|
1888
2031
|
f.id
|
|
1889
2032
|
)),
|
|
1890
2033
|
/* @__PURE__ */ t.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
1891
|
-
|
|
2034
|
+
i.length,
|
|
1892
2035
|
" ",
|
|
1893
|
-
|
|
2036
|
+
i.length === 1 ? "record" : "records"
|
|
1894
2037
|
] })
|
|
1895
|
-
] }) : /* @__PURE__ */ t.jsxs("div", { className:
|
|
2038
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: B("space-y-3", n), children: [
|
|
1896
2039
|
/* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
1897
|
-
|
|
2040
|
+
i.map((f) => /* @__PURE__ */ t.jsxs(
|
|
1898
2041
|
"div",
|
|
1899
2042
|
{
|
|
1900
2043
|
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
1901
2044
|
children: [
|
|
1902
2045
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
1903
|
-
/* @__PURE__ */ t.jsx(
|
|
2046
|
+
/* @__PURE__ */ t.jsx(Z, { variant: "outline", children: f.id }),
|
|
1904
2047
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm flex-1", children: f.label })
|
|
1905
2048
|
] }),
|
|
1906
2049
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -1911,7 +2054,7 @@ function bt({
|
|
|
1911
2054
|
variant: "ghost",
|
|
1912
2055
|
size: "sm",
|
|
1913
2056
|
onClick: () => p(f),
|
|
1914
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2057
|
+
children: /* @__PURE__ */ t.jsx($e, { className: "w-4 h-4" })
|
|
1915
2058
|
}
|
|
1916
2059
|
),
|
|
1917
2060
|
/* @__PURE__ */ t.jsx(
|
|
@@ -1921,8 +2064,8 @@ function bt({
|
|
|
1921
2064
|
variant: "ghost",
|
|
1922
2065
|
size: "sm",
|
|
1923
2066
|
onClick: () => m(f.id),
|
|
1924
|
-
disabled:
|
|
1925
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2067
|
+
disabled: a.disabled,
|
|
2068
|
+
children: /* @__PURE__ */ t.jsx(ie, { className: "w-4 h-4" })
|
|
1926
2069
|
}
|
|
1927
2070
|
)
|
|
1928
2071
|
] })
|
|
@@ -1930,7 +2073,7 @@ function bt({
|
|
|
1930
2073
|
},
|
|
1931
2074
|
f.id
|
|
1932
2075
|
)),
|
|
1933
|
-
|
|
2076
|
+
i.length === 0 && /* @__PURE__ */ t.jsx("div", { className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20", children: "No related records" })
|
|
1934
2077
|
] }),
|
|
1935
2078
|
/* @__PURE__ */ t.jsxs(
|
|
1936
2079
|
P,
|
|
@@ -1939,9 +2082,9 @@ function bt({
|
|
|
1939
2082
|
variant: "outline",
|
|
1940
2083
|
className: "w-full",
|
|
1941
2084
|
onClick: c,
|
|
1942
|
-
disabled:
|
|
2085
|
+
disabled: a.disabled,
|
|
1943
2086
|
children: [
|
|
1944
|
-
/* @__PURE__ */ t.jsx(
|
|
2087
|
+
/* @__PURE__ */ t.jsx(je, { className: "w-4 h-4 mr-2" }),
|
|
1945
2088
|
"Add ",
|
|
1946
2089
|
o?.label || "Record"
|
|
1947
2090
|
]
|
|
@@ -1949,11 +2092,28 @@ function bt({
|
|
|
1949
2092
|
)
|
|
1950
2093
|
] });
|
|
1951
2094
|
}
|
|
1952
|
-
const
|
|
2095
|
+
const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1953
2096
|
__proto__: null,
|
|
1954
|
-
MasterDetailField:
|
|
2097
|
+
MasterDetailField: Ft
|
|
1955
2098
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1956
|
-
function
|
|
2099
|
+
function Y(e) {
|
|
2100
|
+
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
|
|
2101
|
+
if (e instanceof Date) return e.toISOString();
|
|
2102
|
+
if (Array.isArray(e))
|
|
2103
|
+
return e.map((r) => {
|
|
2104
|
+
if (r != null && typeof r == "object") {
|
|
2105
|
+
const s = r;
|
|
2106
|
+
return String(s.name || s.label || s.id || s._id || "[Object]");
|
|
2107
|
+
}
|
|
2108
|
+
return String(r);
|
|
2109
|
+
}).join(", ");
|
|
2110
|
+
if (typeof e == "object") {
|
|
2111
|
+
const r = e;
|
|
2112
|
+
return "$numberDecimal" in r ? Number(r.$numberDecimal) : "$oid" in r ? String(r.$oid) : "$date" in r ? String(r.$date) : String(r.name || r.label || r.id || r._id || "[Object]");
|
|
2113
|
+
}
|
|
2114
|
+
return String(e);
|
|
2115
|
+
}
|
|
2116
|
+
function Ir(e, r = "USD") {
|
|
1957
2117
|
try {
|
|
1958
2118
|
return new Intl.NumberFormat("en-US", {
|
|
1959
2119
|
style: "currency",
|
|
@@ -1963,7 +2123,7 @@ function Pr(e, r = "USD") {
|
|
|
1963
2123
|
return `${r} ${e.toFixed(2)}`;
|
|
1964
2124
|
}
|
|
1965
2125
|
}
|
|
1966
|
-
function
|
|
2126
|
+
function ds(e, r = "USD") {
|
|
1967
2127
|
try {
|
|
1968
2128
|
return new Intl.NumberFormat("en-US", {
|
|
1969
2129
|
style: "currency",
|
|
@@ -1975,41 +2135,41 @@ function Zr(e, r = "USD") {
|
|
|
1975
2135
|
return `${r} ${e}`;
|
|
1976
2136
|
}
|
|
1977
2137
|
}
|
|
1978
|
-
function
|
|
2138
|
+
function Ur(e, r = 0) {
|
|
1979
2139
|
return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(r)}%`;
|
|
1980
2140
|
}
|
|
1981
|
-
function
|
|
2141
|
+
function ve(e) {
|
|
1982
2142
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
|
|
1983
2143
|
}
|
|
1984
|
-
function
|
|
2144
|
+
function Vr(e) {
|
|
1985
2145
|
if (!e) return "-";
|
|
1986
2146
|
const r = typeof e == "string" ? new Date(e) : e;
|
|
1987
2147
|
if (isNaN(r.getTime())) return "-";
|
|
1988
|
-
const
|
|
1989
|
-
if (
|
|
1990
|
-
if (
|
|
1991
|
-
if (
|
|
1992
|
-
if (
|
|
1993
|
-
const o = Math.abs(
|
|
1994
|
-
return o <= 7 ? `Overdue ${o}d` :
|
|
2148
|
+
const s = /* @__PURE__ */ new Date(), l = new Date(s.getFullYear(), s.getMonth(), s.getDate()), a = new Date(r.getFullYear(), r.getMonth(), r.getDate()).getTime() - l.getTime(), i = Math.round(a / (1e3 * 60 * 60 * 24));
|
|
2149
|
+
if (i === 0) return "Today";
|
|
2150
|
+
if (i === 1) return "Tomorrow";
|
|
2151
|
+
if (i === -1) return "Yesterday";
|
|
2152
|
+
if (i < -1) {
|
|
2153
|
+
const o = Math.abs(i);
|
|
2154
|
+
return o <= 7 ? `Overdue ${o}d` : _e(r);
|
|
1995
2155
|
}
|
|
1996
|
-
return
|
|
2156
|
+
return i > 1 && i <= 7 ? `In ${i} days` : _e(r);
|
|
1997
2157
|
}
|
|
1998
|
-
function
|
|
2158
|
+
function _e(e, r) {
|
|
1999
2159
|
if (!e) return "-";
|
|
2000
|
-
const
|
|
2001
|
-
if (isNaN(
|
|
2160
|
+
const s = typeof e == "string" ? new Date(e) : e;
|
|
2161
|
+
if (isNaN(s.getTime())) return "-";
|
|
2002
2162
|
if (r === "short") {
|
|
2003
|
-
const
|
|
2004
|
-
return `${
|
|
2163
|
+
const l = s.toLocaleDateString("en-US", { month: "short" }), n = s.getDate(), a = String(s.getFullYear()).slice(-2);
|
|
2164
|
+
return `${l} ${n}, '${a}`;
|
|
2005
2165
|
}
|
|
2006
|
-
return r === "relative" ?
|
|
2166
|
+
return r === "relative" ? Vr(s) : s.toLocaleDateString(void 0, {
|
|
2007
2167
|
year: "numeric",
|
|
2008
2168
|
month: "short",
|
|
2009
2169
|
day: "numeric"
|
|
2010
2170
|
});
|
|
2011
2171
|
}
|
|
2012
|
-
function
|
|
2172
|
+
function us(e) {
|
|
2013
2173
|
if (!e) return "-";
|
|
2014
2174
|
const r = typeof e == "string" ? new Date(e) : e;
|
|
2015
2175
|
return isNaN(r.getTime()) ? "-" : r.toLocaleDateString(void 0, {
|
|
@@ -2020,45 +2180,49 @@ function Kr(e) {
|
|
|
2020
2180
|
minute: "2-digit"
|
|
2021
2181
|
});
|
|
2022
2182
|
}
|
|
2023
|
-
function
|
|
2024
|
-
|
|
2183
|
+
function K({ value: e }) {
|
|
2184
|
+
const r = Y(e);
|
|
2185
|
+
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children: r != null && r !== "" ? String(r) : "-" });
|
|
2025
2186
|
}
|
|
2026
|
-
function
|
|
2187
|
+
function Br({ value: e, field: r }) {
|
|
2027
2188
|
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2028
|
-
const
|
|
2029
|
-
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums", children:
|
|
2189
|
+
const s = Y(e), n = r.precision ?? 0, a = Number(s), i = isNaN(a) ? String(s) : new Intl.NumberFormat("en-US", { minimumFractionDigits: n, maximumFractionDigits: n }).format(a);
|
|
2190
|
+
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums", children: i });
|
|
2030
2191
|
}
|
|
2031
|
-
function
|
|
2192
|
+
function Yr({ value: e, field: r }) {
|
|
2032
2193
|
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2033
|
-
const
|
|
2034
|
-
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums font-medium whitespace-nowrap", children:
|
|
2194
|
+
const s = Y(e), n = r.currency || "USD", a = Number(s), i = isNaN(a) ? String(s) : Ir(a, n);
|
|
2195
|
+
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums font-medium whitespace-nowrap", children: i });
|
|
2035
2196
|
}
|
|
2036
|
-
const
|
|
2037
|
-
function
|
|
2197
|
+
const qr = /progress|completion/;
|
|
2198
|
+
function Jr({ value: e, field: r }) {
|
|
2038
2199
|
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2039
|
-
const
|
|
2200
|
+
const s = Y(e), n = r.precision ?? 0, a = Number(s);
|
|
2201
|
+
if (isNaN(a))
|
|
2202
|
+
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums whitespace-nowrap", children: String(s) });
|
|
2203
|
+
const i = qr.test(r?.name?.toLowerCase() || ""), o = i ? a : a > -1 && a < 1 ? a * 100 : a, c = i ? `${a.toFixed(n)}%` : Ur(a, n), m = Math.max(0, Math.min(100, o));
|
|
2040
2204
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2041
2205
|
/* @__PURE__ */ t.jsx(
|
|
2042
2206
|
"div",
|
|
2043
2207
|
{
|
|
2044
2208
|
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",
|
|
2045
2209
|
role: "progressbar",
|
|
2046
|
-
"aria-valuenow":
|
|
2210
|
+
"aria-valuenow": m,
|
|
2047
2211
|
"aria-valuemin": 0,
|
|
2048
2212
|
"aria-valuemax": 100,
|
|
2049
2213
|
children: /* @__PURE__ */ t.jsx(
|
|
2050
2214
|
"div",
|
|
2051
2215
|
{
|
|
2052
2216
|
className: "h-full rounded-full bg-primary transition-all",
|
|
2053
|
-
style: { width: `${
|
|
2217
|
+
style: { width: `${m}%` }
|
|
2054
2218
|
}
|
|
2055
2219
|
)
|
|
2056
2220
|
}
|
|
2057
2221
|
),
|
|
2058
|
-
/* @__PURE__ */ t.jsx("span", { className: "tabular-nums whitespace-nowrap", children:
|
|
2222
|
+
/* @__PURE__ */ t.jsx("span", { className: "tabular-nums whitespace-nowrap", children: c })
|
|
2059
2223
|
] });
|
|
2060
2224
|
}
|
|
2061
|
-
const
|
|
2225
|
+
const Wr = /* @__PURE__ */ new Set([
|
|
2062
2226
|
"active",
|
|
2063
2227
|
"is_active",
|
|
2064
2228
|
"enabled",
|
|
@@ -2066,48 +2230,48 @@ const zr = /* @__PURE__ */ new Set([
|
|
|
2066
2230
|
"verified",
|
|
2067
2231
|
"is_verified"
|
|
2068
2232
|
]);
|
|
2069
|
-
function
|
|
2233
|
+
function Gr({ value: e, field: r }) {
|
|
2070
2234
|
if (e == null)
|
|
2071
2235
|
return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground/50 text-xs italic flex items-center justify-center", children: "—" });
|
|
2072
|
-
const
|
|
2073
|
-
return
|
|
2074
|
-
r?.label ||
|
|
2236
|
+
const s = r?.name?.toLowerCase() || "";
|
|
2237
|
+
return s === "completed" || s === "is_completed" || s === "done" || s === "is_done" ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: e ? /* @__PURE__ */ t.jsx("div", { className: "size-5 rounded-full bg-green-500 flex items-center justify-center", role: "img", "aria-label": "Completed", "data-testid": "completion-indicator", children: /* @__PURE__ */ t.jsx(Fe, { className: "size-3 text-white" }) }) : /* @__PURE__ */ t.jsx("div", { className: "size-5 rounded-full border-2 border-muted-foreground/30", role: "img", "aria-label": "Not completed", "data-testid": "completion-indicator" }) }) : Wr.has(s) && !e ? /* @__PURE__ */ t.jsxs(Z, { variant: "destructive", className: "text-xs", "data-testid": "boolean-warning-badge", children: [
|
|
2238
|
+
r?.label || ve(s),
|
|
2075
2239
|
" — Off"
|
|
2076
|
-
] }) : /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t.jsx(
|
|
2240
|
+
] }) : /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t.jsx(Be, { checked: !!e, disabled: !0, className: "pointer-events-none" }) });
|
|
2077
2241
|
}
|
|
2078
|
-
function
|
|
2242
|
+
function Qr({ value: e, field: r }) {
|
|
2079
2243
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
const
|
|
2244
|
+
const s = Y(e), n = r.format || "relative", a = _e(s, n), i = typeof s == "string" ? new Date(s) : s, o = i instanceof Date && !isNaN(i.getTime()), c = /* @__PURE__ */ new Date();
|
|
2245
|
+
c.setHours(0, 0, 0, 0);
|
|
2246
|
+
const m = o && i < c, p = o ? i.toISOString() : String(s);
|
|
2083
2247
|
return /* @__PURE__ */ t.jsx(
|
|
2084
2248
|
"span",
|
|
2085
2249
|
{
|
|
2086
|
-
className: `tabular-nums${
|
|
2087
|
-
title:
|
|
2088
|
-
children:
|
|
2250
|
+
className: `tabular-nums${m ? " text-red-600" : ""}`,
|
|
2251
|
+
title: p,
|
|
2252
|
+
children: a
|
|
2089
2253
|
}
|
|
2090
2254
|
);
|
|
2091
2255
|
}
|
|
2092
|
-
function
|
|
2256
|
+
function Hr({ value: e }) {
|
|
2093
2257
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2094
|
-
const r = typeof
|
|
2095
|
-
if (isNaN(
|
|
2096
|
-
const
|
|
2258
|
+
const r = Y(e), s = typeof r == "string" ? new Date(r) : r;
|
|
2259
|
+
if (!(s instanceof Date) || isNaN(s.getTime())) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
2260
|
+
const l = s.toLocaleDateString(void 0, {
|
|
2097
2261
|
month: "numeric",
|
|
2098
2262
|
day: "numeric",
|
|
2099
2263
|
year: "numeric"
|
|
2100
|
-
}),
|
|
2264
|
+
}), n = s.toLocaleTimeString(void 0, {
|
|
2101
2265
|
hour: "numeric",
|
|
2102
2266
|
minute: "2-digit",
|
|
2103
2267
|
hour12: !0
|
|
2104
2268
|
}).toLowerCase();
|
|
2105
2269
|
return /* @__PURE__ */ t.jsxs("span", { className: "tabular-nums text-sm whitespace-nowrap", children: [
|
|
2106
|
-
/* @__PURE__ */ t.jsx("span", { children:
|
|
2107
|
-
/* @__PURE__ */ t.jsx("span", { className: "ml-2 text-muted-foreground", children:
|
|
2270
|
+
/* @__PURE__ */ t.jsx("span", { children: l }),
|
|
2271
|
+
/* @__PURE__ */ t.jsx("span", { className: "ml-2 text-muted-foreground", children: n })
|
|
2108
2272
|
] });
|
|
2109
2273
|
}
|
|
2110
|
-
const
|
|
2274
|
+
const Xr = {
|
|
2111
2275
|
// Priority values
|
|
2112
2276
|
critical: "red",
|
|
2113
2277
|
urgent: "red",
|
|
@@ -2141,7 +2305,7 @@ const Lr = {
|
|
|
2141
2305
|
overdue: "red",
|
|
2142
2306
|
delivered: "purple",
|
|
2143
2307
|
archived: "indigo"
|
|
2144
|
-
},
|
|
2308
|
+
}, Kr = {
|
|
2145
2309
|
gray: "bg-gray-100 text-gray-800 border-gray-300",
|
|
2146
2310
|
red: "bg-red-100 text-red-800 border-red-300",
|
|
2147
2311
|
orange: "bg-orange-100 text-orange-800 border-orange-300",
|
|
@@ -2152,18 +2316,18 @@ const Lr = {
|
|
|
2152
2316
|
purple: "bg-purple-100 text-purple-800 border-purple-300",
|
|
2153
2317
|
pink: "bg-pink-100 text-pink-800 border-pink-300"
|
|
2154
2318
|
};
|
|
2155
|
-
function
|
|
2156
|
-
const
|
|
2157
|
-
return
|
|
2319
|
+
function Ie(e, r) {
|
|
2320
|
+
const s = e || (r ? Xr[String(r).toLowerCase().replace(/[\s-]/g, "_")] : void 0);
|
|
2321
|
+
return Kr[s || ""] || "bg-muted text-muted-foreground border-border";
|
|
2158
2322
|
}
|
|
2159
|
-
function
|
|
2160
|
-
const
|
|
2323
|
+
function he({ value: e, field: r }) {
|
|
2324
|
+
const l = r.options || [];
|
|
2161
2325
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2162
2326
|
if (Array.isArray(e))
|
|
2163
2327
|
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((o, c) => {
|
|
2164
|
-
const m =
|
|
2328
|
+
const m = l.find((u) => u.value === o), p = m?.label || ve(String(o)), f = Ie(m?.color, o);
|
|
2165
2329
|
return /* @__PURE__ */ t.jsx(
|
|
2166
|
-
|
|
2330
|
+
Z,
|
|
2167
2331
|
{
|
|
2168
2332
|
variant: "outline",
|
|
2169
2333
|
className: f,
|
|
@@ -2172,21 +2336,21 @@ function se({ value: e, field: r }) {
|
|
|
2172
2336
|
c
|
|
2173
2337
|
);
|
|
2174
2338
|
}) });
|
|
2175
|
-
const
|
|
2339
|
+
const n = l.find((o) => o.value === e), a = n?.label || ve(String(e)), i = Ie(n?.color, e);
|
|
2176
2340
|
return /* @__PURE__ */ t.jsx(
|
|
2177
|
-
|
|
2341
|
+
Z,
|
|
2178
2342
|
{
|
|
2179
2343
|
variant: "outline",
|
|
2180
|
-
className:
|
|
2181
|
-
children:
|
|
2344
|
+
className: i,
|
|
2345
|
+
children: a
|
|
2182
2346
|
}
|
|
2183
2347
|
);
|
|
2184
2348
|
}
|
|
2185
|
-
function
|
|
2349
|
+
function Zr({ value: e }) {
|
|
2186
2350
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2189
|
-
|
|
2351
|
+
const r = String(Y(e) ?? ""), [s, l] = E.useState(!1), n = (a) => {
|
|
2352
|
+
a.stopPropagation(), a.preventDefault(), navigator.clipboard.writeText(r).then(() => {
|
|
2353
|
+
l(!0), setTimeout(() => l(!1), 2e3);
|
|
2190
2354
|
}).catch(() => {
|
|
2191
2355
|
});
|
|
2192
2356
|
};
|
|
@@ -2200,9 +2364,9 @@ function Ur({ value: e }) {
|
|
|
2200
2364
|
children: /* @__PURE__ */ t.jsx(
|
|
2201
2365
|
"a",
|
|
2202
2366
|
{
|
|
2203
|
-
href: `mailto:${
|
|
2204
|
-
onClick: (
|
|
2205
|
-
children:
|
|
2367
|
+
href: `mailto:${r}`,
|
|
2368
|
+
onClick: (a) => a.stopPropagation(),
|
|
2369
|
+
children: r
|
|
2206
2370
|
}
|
|
2207
2371
|
)
|
|
2208
2372
|
}
|
|
@@ -2212,15 +2376,17 @@ function Ur({ value: e }) {
|
|
|
2212
2376
|
{
|
|
2213
2377
|
type: "button",
|
|
2214
2378
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2215
|
-
onClick:
|
|
2379
|
+
onClick: n,
|
|
2216
2380
|
"aria-label": "Copy email",
|
|
2217
|
-
children:
|
|
2381
|
+
children: s ? /* @__PURE__ */ t.jsx(Fe, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ t.jsx(Se, { className: "h-3 w-3 text-muted-foreground" })
|
|
2218
2382
|
}
|
|
2219
2383
|
)
|
|
2220
2384
|
] });
|
|
2221
2385
|
}
|
|
2222
|
-
function
|
|
2223
|
-
|
|
2386
|
+
function es({ value: e }) {
|
|
2387
|
+
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2388
|
+
const r = String(Y(e) ?? "");
|
|
2389
|
+
return /* @__PURE__ */ t.jsx(
|
|
2224
2390
|
P,
|
|
2225
2391
|
{
|
|
2226
2392
|
variant: "link",
|
|
@@ -2229,21 +2395,21 @@ function Vr({ value: e }) {
|
|
|
2229
2395
|
children: /* @__PURE__ */ t.jsx(
|
|
2230
2396
|
"a",
|
|
2231
2397
|
{
|
|
2232
|
-
href:
|
|
2398
|
+
href: r,
|
|
2233
2399
|
target: "_blank",
|
|
2234
2400
|
rel: "noopener noreferrer",
|
|
2235
|
-
onClick: (
|
|
2236
|
-
children:
|
|
2401
|
+
onClick: (s) => s.stopPropagation(),
|
|
2402
|
+
children: r
|
|
2237
2403
|
}
|
|
2238
2404
|
)
|
|
2239
2405
|
}
|
|
2240
|
-
)
|
|
2406
|
+
);
|
|
2241
2407
|
}
|
|
2242
|
-
function
|
|
2408
|
+
function ts({ value: e }) {
|
|
2243
2409
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
|
|
2410
|
+
const r = String(Y(e) ?? ""), [s, l] = E.useState(!1), n = (a) => {
|
|
2411
|
+
a.stopPropagation(), a.preventDefault(), navigator.clipboard.writeText(r).then(() => {
|
|
2412
|
+
l(!0), setTimeout(() => l(!1), 2e3);
|
|
2247
2413
|
}).catch(() => {
|
|
2248
2414
|
});
|
|
2249
2415
|
};
|
|
@@ -2251,12 +2417,12 @@ function Br({ value: e }) {
|
|
|
2251
2417
|
/* @__PURE__ */ t.jsxs(
|
|
2252
2418
|
"a",
|
|
2253
2419
|
{
|
|
2254
|
-
href: `tel:${
|
|
2420
|
+
href: `tel:${r}`,
|
|
2255
2421
|
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
2256
|
-
onClick: (
|
|
2422
|
+
onClick: (a) => a.stopPropagation(),
|
|
2257
2423
|
children: [
|
|
2258
|
-
/* @__PURE__ */ t.jsx(
|
|
2259
|
-
|
|
2424
|
+
/* @__PURE__ */ t.jsx(Kt, { className: "h-3 w-3" }),
|
|
2425
|
+
r
|
|
2260
2426
|
]
|
|
2261
2427
|
}
|
|
2262
2428
|
),
|
|
@@ -2265,36 +2431,36 @@ function Br({ value: e }) {
|
|
|
2265
2431
|
{
|
|
2266
2432
|
type: "button",
|
|
2267
2433
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2268
|
-
onClick:
|
|
2434
|
+
onClick: n,
|
|
2269
2435
|
"aria-label": "Copy phone number",
|
|
2270
|
-
children:
|
|
2436
|
+
children: s ? /* @__PURE__ */ t.jsx(Fe, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ t.jsx(Se, { className: "h-3 w-3 text-muted-foreground" })
|
|
2271
2437
|
}
|
|
2272
2438
|
)
|
|
2273
2439
|
] });
|
|
2274
2440
|
}
|
|
2275
|
-
function
|
|
2441
|
+
function rs({ value: e, field: r }) {
|
|
2276
2442
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2277
2443
|
if (r.multiple, Array.isArray(e)) {
|
|
2278
|
-
const
|
|
2444
|
+
const n = e.length;
|
|
2279
2445
|
return /* @__PURE__ */ t.jsxs("span", { className: "text-sm text-gray-600", children: [
|
|
2280
|
-
|
|
2446
|
+
n,
|
|
2281
2447
|
" ",
|
|
2282
|
-
|
|
2448
|
+
n === 1 ? "file" : "files"
|
|
2283
2449
|
] });
|
|
2284
2450
|
}
|
|
2285
|
-
const
|
|
2286
|
-
return /* @__PURE__ */ t.jsx("span", { className: "text-sm truncate", children:
|
|
2451
|
+
const l = e.name || e.original_name || "File";
|
|
2452
|
+
return /* @__PURE__ */ t.jsx("span", { className: "text-sm truncate", children: l });
|
|
2287
2453
|
}
|
|
2288
|
-
function
|
|
2454
|
+
function ss({ value: e }) {
|
|
2289
2455
|
return e ? Array.isArray(e) ? /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
2290
|
-
e.slice(0, 3).map((r,
|
|
2456
|
+
e.slice(0, 3).map((r, s) => /* @__PURE__ */ t.jsx(
|
|
2291
2457
|
"img",
|
|
2292
2458
|
{
|
|
2293
2459
|
src: r.url || "",
|
|
2294
|
-
alt: r.name || `Image ${
|
|
2460
|
+
alt: r.name || `Image ${s + 1}`,
|
|
2295
2461
|
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
2296
2462
|
},
|
|
2297
|
-
|
|
2463
|
+
s
|
|
2298
2464
|
)),
|
|
2299
2465
|
e.length > 3 && /* @__PURE__ */ t.jsxs("div", { className: "size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600", children: [
|
|
2300
2466
|
"+",
|
|
@@ -2309,113 +2475,114 @@ function qr({ value: e }) {
|
|
|
2309
2475
|
}
|
|
2310
2476
|
) : /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2311
2477
|
}
|
|
2312
|
-
function
|
|
2478
|
+
function ge({ value: e, field: r }) {
|
|
2313
2479
|
if (e == null || e === "") return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2314
|
-
const
|
|
2315
|
-
if (
|
|
2316
|
-
const
|
|
2317
|
-
if (
|
|
2480
|
+
const s = r.options || [], l = (n) => {
|
|
2481
|
+
if (s.length > 0) {
|
|
2482
|
+
const a = s.find((i) => String(i.value) === String(n));
|
|
2483
|
+
if (a) return a.label;
|
|
2318
2484
|
}
|
|
2319
|
-
return String(
|
|
2485
|
+
return String(n);
|
|
2320
2486
|
};
|
|
2321
2487
|
if (Array.isArray(e))
|
|
2322
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((
|
|
2323
|
-
let
|
|
2324
|
-
return
|
|
2488
|
+
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((n, a) => {
|
|
2489
|
+
let i;
|
|
2490
|
+
return n != null && typeof n == "object" ? i = n.name || n.label || n.id || n._id || String(n) : i = l(n), /* @__PURE__ */ t.jsx(
|
|
2325
2491
|
"span",
|
|
2326
2492
|
{
|
|
2327
2493
|
className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",
|
|
2328
|
-
children:
|
|
2494
|
+
children: i
|
|
2329
2495
|
},
|
|
2330
|
-
|
|
2496
|
+
a
|
|
2331
2497
|
);
|
|
2332
2498
|
}) });
|
|
2333
2499
|
if (typeof e == "object" && e !== null) {
|
|
2334
|
-
const
|
|
2335
|
-
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children:
|
|
2500
|
+
const n = e.name || e.label || e.id || e._id || "[Object]";
|
|
2501
|
+
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children: n });
|
|
2336
2502
|
}
|
|
2337
|
-
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children:
|
|
2503
|
+
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children: l(e) });
|
|
2338
2504
|
}
|
|
2339
|
-
function
|
|
2340
|
-
|
|
2505
|
+
function Ue({ value: e }) {
|
|
2506
|
+
const r = Y(e);
|
|
2507
|
+
return /* @__PURE__ */ t.jsx("span", { className: "text-gray-700 font-mono text-sm", children: r != null ? String(r) : "-" });
|
|
2341
2508
|
}
|
|
2342
|
-
function
|
|
2509
|
+
function be({ value: e }) {
|
|
2343
2510
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2344
2511
|
if (typeof e != "object")
|
|
2345
2512
|
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children: String(e) });
|
|
2346
2513
|
if (Array.isArray(e))
|
|
2347
2514
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
2348
|
-
e.slice(0, 3).map((
|
|
2349
|
-
if (typeof
|
|
2350
|
-
return /* @__PURE__ */ t.jsx("span", { className: "truncate text-sm", children: String(
|
|
2351
|
-
const
|
|
2515
|
+
e.slice(0, 3).map((l, n) => {
|
|
2516
|
+
if (typeof l != "object" || l === null)
|
|
2517
|
+
return /* @__PURE__ */ t.jsx("span", { className: "truncate text-sm", children: String(l) }, n);
|
|
2518
|
+
const a = l.name || l.username || "User", i = a.split(" ").map((o) => o[0]).join("").toUpperCase().slice(0, 2);
|
|
2352
2519
|
return /* @__PURE__ */ t.jsx(
|
|
2353
|
-
|
|
2520
|
+
ee,
|
|
2354
2521
|
{
|
|
2355
2522
|
className: "size-8 border-2 border-white",
|
|
2356
|
-
title:
|
|
2357
|
-
children: /* @__PURE__ */ t.jsx(
|
|
2523
|
+
title: a,
|
|
2524
|
+
children: /* @__PURE__ */ t.jsx(te, { className: "bg-blue-500 text-white text-xs", children: i })
|
|
2358
2525
|
},
|
|
2359
|
-
|
|
2526
|
+
n
|
|
2360
2527
|
);
|
|
2361
2528
|
}),
|
|
2362
|
-
e.length > 3 && /* @__PURE__ */ t.jsx(
|
|
2529
|
+
e.length > 3 && /* @__PURE__ */ t.jsx(ee, { className: "size-8 border-2 border-white", children: /* @__PURE__ */ t.jsxs(te, { className: "bg-gray-200 text-gray-600 text-xs", children: [
|
|
2363
2530
|
"+",
|
|
2364
2531
|
e.length - 3
|
|
2365
2532
|
] }) })
|
|
2366
2533
|
] });
|
|
2367
|
-
const r = e.name || e.username || "User",
|
|
2534
|
+
const r = e.name || e.username || "User", s = r.split(" ").map((l) => l[0]).join("").toUpperCase().slice(0, 2);
|
|
2368
2535
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2369
|
-
/* @__PURE__ */ t.jsx(
|
|
2536
|
+
/* @__PURE__ */ t.jsx(ee, { className: "size-8", children: /* @__PURE__ */ t.jsx(te, { className: "bg-blue-500 text-white text-xs", children: s }) }),
|
|
2370
2537
|
/* @__PURE__ */ t.jsx("span", { className: "truncate", children: r })
|
|
2371
2538
|
] });
|
|
2372
2539
|
}
|
|
2373
|
-
const
|
|
2374
|
-
function
|
|
2375
|
-
|
|
2376
|
-
}
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2379
|
-
text:
|
|
2380
|
-
textarea:
|
|
2381
|
-
markdown:
|
|
2382
|
-
html:
|
|
2383
|
-
number:
|
|
2384
|
-
currency:
|
|
2385
|
-
percent:
|
|
2386
|
-
boolean:
|
|
2387
|
-
date:
|
|
2388
|
-
datetime:
|
|
2389
|
-
time:
|
|
2390
|
-
select:
|
|
2391
|
-
status:
|
|
2392
|
-
lookup:
|
|
2393
|
-
master_detail:
|
|
2394
|
-
email:
|
|
2395
|
-
url:
|
|
2396
|
-
phone:
|
|
2397
|
-
file:
|
|
2398
|
-
image:
|
|
2399
|
-
formula:
|
|
2400
|
-
summary:
|
|
2401
|
-
auto_number:
|
|
2402
|
-
user:
|
|
2403
|
-
owner:
|
|
2540
|
+
const we = /* @__PURE__ */ new Map();
|
|
2541
|
+
function oe(e, r) {
|
|
2542
|
+
we.set(e, r);
|
|
2543
|
+
}
|
|
2544
|
+
function ms(e) {
|
|
2545
|
+
return we.has(e) ? we.get(e) : {
|
|
2546
|
+
text: K,
|
|
2547
|
+
textarea: K,
|
|
2548
|
+
markdown: K,
|
|
2549
|
+
html: K,
|
|
2550
|
+
number: Br,
|
|
2551
|
+
currency: Yr,
|
|
2552
|
+
percent: Jr,
|
|
2553
|
+
boolean: Gr,
|
|
2554
|
+
date: Qr,
|
|
2555
|
+
datetime: Hr,
|
|
2556
|
+
time: K,
|
|
2557
|
+
select: he,
|
|
2558
|
+
status: he,
|
|
2559
|
+
lookup: ge,
|
|
2560
|
+
master_detail: ge,
|
|
2561
|
+
email: Zr,
|
|
2562
|
+
url: es,
|
|
2563
|
+
phone: ts,
|
|
2564
|
+
file: rs,
|
|
2565
|
+
image: ss,
|
|
2566
|
+
formula: Ue,
|
|
2567
|
+
summary: Ue,
|
|
2568
|
+
auto_number: K,
|
|
2569
|
+
user: be,
|
|
2570
|
+
owner: be,
|
|
2404
2571
|
password: () => /* @__PURE__ */ t.jsx("span", { children: "••••••" }),
|
|
2405
|
-
location:
|
|
2572
|
+
location: K,
|
|
2406
2573
|
// Default fallback
|
|
2407
2574
|
object: () => /* @__PURE__ */ t.jsx("span", { className: "text-gray-500 italic", children: "[Object]" }),
|
|
2408
2575
|
vector: () => /* @__PURE__ */ t.jsx("span", { className: "text-gray-500 italic", children: "[Vector]" }),
|
|
2409
2576
|
grid: () => /* @__PURE__ */ t.jsx("span", { className: "text-gray-500 italic", children: "[Grid]" })
|
|
2410
|
-
}[e] ||
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
function
|
|
2577
|
+
}[e] || K;
|
|
2578
|
+
}
|
|
2579
|
+
oe("lookup", ge);
|
|
2580
|
+
oe("master_detail", ge);
|
|
2581
|
+
oe("select", he);
|
|
2582
|
+
oe("status", he);
|
|
2583
|
+
oe("user", be);
|
|
2584
|
+
oe("owner", be);
|
|
2585
|
+
function fs(e) {
|
|
2419
2586
|
return {
|
|
2420
2587
|
// Text-based fields
|
|
2421
2588
|
text: "field:text",
|
|
@@ -2455,16 +2622,16 @@ function ts(e) {
|
|
|
2455
2622
|
auto_number: "field:auto_number"
|
|
2456
2623
|
}[e] || "field:text";
|
|
2457
2624
|
}
|
|
2458
|
-
function
|
|
2625
|
+
function xs(e) {
|
|
2459
2626
|
if (e < 0 || !Number.isFinite(e) || e === 0)
|
|
2460
2627
|
return "0 B";
|
|
2461
2628
|
const r = ["B", "KB", "MB", "GB", "TB"];
|
|
2462
|
-
let
|
|
2463
|
-
for (;
|
|
2464
|
-
|
|
2465
|
-
return `${
|
|
2629
|
+
let s = e, l = 0;
|
|
2630
|
+
for (; s >= 1024 && l < r.length - 1; )
|
|
2631
|
+
s /= 1024, l++;
|
|
2632
|
+
return `${s.toFixed(l > 0 ? 1 : 0)} ${r[l]}`;
|
|
2466
2633
|
}
|
|
2467
|
-
function
|
|
2634
|
+
function ps(e) {
|
|
2468
2635
|
const r = {};
|
|
2469
2636
|
return e.required && (r.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (r.minLength = {
|
|
2470
2637
|
value: e.min_length,
|
|
@@ -2489,202 +2656,203 @@ function ss(e) {
|
|
|
2489
2656
|
message: "Please enter a valid URL"
|
|
2490
2657
|
}), e.validate && (r.validate = e.validate), Object.keys(r).length > 0 ? r : void 0;
|
|
2491
2658
|
}
|
|
2492
|
-
function
|
|
2659
|
+
function Ve(e, r) {
|
|
2493
2660
|
if (!e) return !0;
|
|
2494
2661
|
if (e.field && e.value !== void 0) {
|
|
2495
|
-
const
|
|
2662
|
+
const s = r[e.field];
|
|
2496
2663
|
if (e.operator === "=" || e.operator === "==")
|
|
2497
|
-
return
|
|
2664
|
+
return s === e.value;
|
|
2498
2665
|
if (e.operator === "!=")
|
|
2499
|
-
return
|
|
2666
|
+
return s !== e.value;
|
|
2500
2667
|
if (e.operator === ">")
|
|
2501
|
-
return
|
|
2668
|
+
return s > e.value;
|
|
2502
2669
|
if (e.operator === ">=")
|
|
2503
|
-
return
|
|
2670
|
+
return s >= e.value;
|
|
2504
2671
|
if (e.operator === "<")
|
|
2505
|
-
return
|
|
2672
|
+
return s < e.value;
|
|
2506
2673
|
if (e.operator === "<=")
|
|
2507
|
-
return
|
|
2674
|
+
return s <= e.value;
|
|
2508
2675
|
if (e.operator === "in")
|
|
2509
|
-
return Array.isArray(e.value) && e.value.includes(
|
|
2676
|
+
return Array.isArray(e.value) && e.value.includes(s);
|
|
2510
2677
|
}
|
|
2511
|
-
return e.and && Array.isArray(e.and) ? e.and.every((
|
|
2512
|
-
}
|
|
2513
|
-
function
|
|
2514
|
-
const r = ({ schema:
|
|
2515
|
-
const [
|
|
2516
|
-
name:
|
|
2517
|
-
label:
|
|
2518
|
-
type:
|
|
2519
|
-
placeholder:
|
|
2520
|
-
required:
|
|
2521
|
-
readonly:
|
|
2522
|
-
help:
|
|
2523
|
-
description:
|
|
2524
|
-
defaultValue:
|
|
2525
|
-
...
|
|
2526
|
-
}, m =
|
|
2527
|
-
o(f),
|
|
2528
|
-
}, [
|
|
2678
|
+
return e.and && Array.isArray(e.and) ? e.and.every((s) => Ve(s, r)) : e.or && Array.isArray(e.or) ? e.or.some((s) => Ve(s, r)) : !0;
|
|
2679
|
+
}
|
|
2680
|
+
function v(e) {
|
|
2681
|
+
const r = ({ schema: s, className: l, value: n, ...a }) => {
|
|
2682
|
+
const [i, o] = E.useState(n ?? s?.value ?? ""), c = {
|
|
2683
|
+
name: s?.name || "field",
|
|
2684
|
+
label: s?.label,
|
|
2685
|
+
type: s?.type,
|
|
2686
|
+
placeholder: s?.placeholder,
|
|
2687
|
+
required: s?.required,
|
|
2688
|
+
readonly: s?.readonly || s?.readOnly,
|
|
2689
|
+
help: s?.help,
|
|
2690
|
+
description: s?.description,
|
|
2691
|
+
defaultValue: s?.defaultValue || s?.value,
|
|
2692
|
+
...s
|
|
2693
|
+
}, m = E.useCallback((f) => {
|
|
2694
|
+
o(f), a.onChange && a.onChange(f);
|
|
2695
|
+
}, [a]), p = s?.readonly || s?.readOnly || !1;
|
|
2529
2696
|
return /* @__PURE__ */ t.jsxs(
|
|
2530
2697
|
"div",
|
|
2531
2698
|
{
|
|
2532
2699
|
className: "grid w-full items-center gap-1.5",
|
|
2533
|
-
"data-obj-id":
|
|
2534
|
-
"data-obj-type":
|
|
2700
|
+
"data-obj-id": s?.id,
|
|
2701
|
+
"data-obj-type": s?.type,
|
|
2535
2702
|
children: [
|
|
2536
|
-
|
|
2703
|
+
s?.label && /* @__PURE__ */ t.jsx("label", { htmlFor: s.id, className: s.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "", children: s.label }),
|
|
2537
2704
|
/* @__PURE__ */ t.jsx(
|
|
2538
2705
|
e,
|
|
2539
2706
|
{
|
|
2540
|
-
value:
|
|
2707
|
+
value: i,
|
|
2541
2708
|
onChange: m,
|
|
2542
2709
|
field: c,
|
|
2543
2710
|
readonly: p,
|
|
2544
|
-
className:
|
|
2711
|
+
className: l
|
|
2545
2712
|
}
|
|
2546
2713
|
),
|
|
2547
|
-
|
|
2714
|
+
s?.description && /* @__PURE__ */ t.jsx("p", { className: "text-sm text-gray-500", children: s.description })
|
|
2548
2715
|
]
|
|
2549
2716
|
}
|
|
2550
2717
|
);
|
|
2551
2718
|
};
|
|
2552
2719
|
return r.displayName = `FieldRenderer(${e.displayName || e.name || "Component"})`, r;
|
|
2553
2720
|
}
|
|
2554
|
-
const
|
|
2721
|
+
const Ct = {
|
|
2555
2722
|
// Basic fields
|
|
2556
|
-
text: () => Promise.resolve().then(() =>
|
|
2557
|
-
textarea: () => Promise.resolve().then(() =>
|
|
2558
|
-
number: () => Promise.resolve().then(() =>
|
|
2559
|
-
boolean: () => Promise.resolve().then(() =>
|
|
2560
|
-
select: () => Promise.resolve().then(() =>
|
|
2561
|
-
date: () => Promise.resolve().then(() =>
|
|
2562
|
-
datetime: () => Promise.resolve().then(() =>
|
|
2563
|
-
time: () => Promise.resolve().then(() =>
|
|
2723
|
+
text: () => Promise.resolve().then(() => rr).then((e) => ({ default: e.TextField })),
|
|
2724
|
+
textarea: () => Promise.resolve().then(() => mr).then((e) => ({ default: e.TextAreaField })),
|
|
2725
|
+
number: () => Promise.resolve().then(() => sr).then((e) => ({ default: e.NumberField })),
|
|
2726
|
+
boolean: () => Promise.resolve().then(() => nr).then((e) => ({ default: e.BooleanField })),
|
|
2727
|
+
select: () => Promise.resolve().then(() => ar).then((e) => ({ default: e.SelectField })),
|
|
2728
|
+
date: () => Promise.resolve().then(() => lr).then((e) => ({ default: e.DateField })),
|
|
2729
|
+
datetime: () => Promise.resolve().then(() => gr).then((e) => ({ default: e.DateTimeField })),
|
|
2730
|
+
time: () => Promise.resolve().then(() => br).then((e) => ({ default: e.TimeField })),
|
|
2564
2731
|
// Contact fields
|
|
2565
|
-
email: () => Promise.resolve().then(() =>
|
|
2566
|
-
phone: () => Promise.resolve().then(() =>
|
|
2567
|
-
url: () => Promise.resolve().then(() =>
|
|
2732
|
+
email: () => Promise.resolve().then(() => ir).then((e) => ({ default: e.EmailField })),
|
|
2733
|
+
phone: () => Promise.resolve().then(() => or).then((e) => ({ default: e.PhoneField })),
|
|
2734
|
+
url: () => Promise.resolve().then(() => cr).then((e) => ({ default: e.UrlField })),
|
|
2568
2735
|
// Specialized fields
|
|
2569
|
-
currency: () => Promise.resolve().then(() =>
|
|
2570
|
-
percent: () => Promise.resolve().then(() =>
|
|
2571
|
-
password: () => Promise.resolve().then(() =>
|
|
2572
|
-
markdown: () => Promise.resolve().then(() =>
|
|
2573
|
-
html: () => Promise.resolve().then(() =>
|
|
2574
|
-
lookup: () => Promise.resolve().then(() =>
|
|
2575
|
-
master_detail: () => Promise.resolve().then(() =>
|
|
2736
|
+
currency: () => Promise.resolve().then(() => ur).then((e) => ({ default: e.CurrencyField })),
|
|
2737
|
+
percent: () => Promise.resolve().then(() => jr).then((e) => ({ default: e.PercentField })),
|
|
2738
|
+
password: () => Promise.resolve().then(() => yr).then((e) => ({ default: e.PasswordField })),
|
|
2739
|
+
markdown: () => Promise.resolve().then(() => Me).then((e) => ({ default: e.RichTextField })),
|
|
2740
|
+
html: () => Promise.resolve().then(() => Me).then((e) => ({ default: e.RichTextField })),
|
|
2741
|
+
lookup: () => Promise.resolve().then(() => hr).then((e) => ({ default: e.LookupField })),
|
|
2742
|
+
master_detail: () => Promise.resolve().then(() => Lr).then((e) => ({ default: e.MasterDetailField })),
|
|
2576
2743
|
// File fields
|
|
2577
|
-
file: () => Promise.resolve().then(() =>
|
|
2578
|
-
image: () => Promise.resolve().then(() =>
|
|
2744
|
+
file: () => Promise.resolve().then(() => Nr).then((e) => ({ default: e.FileField })),
|
|
2745
|
+
image: () => Promise.resolve().then(() => vr).then((e) => ({ default: e.ImageField })),
|
|
2579
2746
|
// Location field
|
|
2580
|
-
location: () => Promise.resolve().then(() =>
|
|
2747
|
+
location: () => Promise.resolve().then(() => _r).then((e) => ({ default: e.LocationField })),
|
|
2581
2748
|
// Computed/Read-only fields
|
|
2582
|
-
formula: () => Promise.resolve().then(() =>
|
|
2583
|
-
summary: () => Promise.resolve().then(() =>
|
|
2584
|
-
auto_number: () => Promise.resolve().then(() =>
|
|
2749
|
+
formula: () => Promise.resolve().then(() => wr).then((e) => ({ default: e.FormulaField })),
|
|
2750
|
+
summary: () => Promise.resolve().then(() => Sr).then((e) => ({ default: e.SummaryField })),
|
|
2751
|
+
auto_number: () => Promise.resolve().then(() => Fr).then((e) => ({ default: e.AutoNumberField })),
|
|
2585
2752
|
// User fields
|
|
2586
|
-
user: () => Promise.resolve().then(() =>
|
|
2587
|
-
owner: () => Promise.resolve().then(() =>
|
|
2753
|
+
user: () => Promise.resolve().then(() => Le).then((e) => ({ default: e.UserField })),
|
|
2754
|
+
owner: () => Promise.resolve().then(() => Le).then((e) => ({ default: e.UserField })),
|
|
2588
2755
|
// Complex data types
|
|
2589
|
-
object: () => Promise.resolve().then(() =>
|
|
2590
|
-
vector: () => Promise.resolve().then(() =>
|
|
2591
|
-
grid: () => Promise.resolve().then(() =>
|
|
2756
|
+
object: () => Promise.resolve().then(() => Cr).then((e) => ({ default: e.ObjectField })),
|
|
2757
|
+
vector: () => Promise.resolve().then(() => Tr).then((e) => ({ default: e.VectorField })),
|
|
2758
|
+
grid: () => Promise.resolve().then(() => Or).then((e) => ({ default: e.GridField })),
|
|
2592
2759
|
// Additional field types from @objectstack/spec
|
|
2593
|
-
color: () => Promise.resolve().then(() =>
|
|
2594
|
-
slider: () => Promise.resolve().then(() =>
|
|
2595
|
-
rating: () => Promise.resolve().then(() =>
|
|
2596
|
-
code: () => Promise.resolve().then(() =>
|
|
2597
|
-
avatar: () => Promise.resolve().then(() =>
|
|
2598
|
-
address: () => Promise.resolve().then(() =>
|
|
2599
|
-
geolocation: () => Promise.resolve().then(() =>
|
|
2600
|
-
signature: () => Promise.resolve().then(() =>
|
|
2601
|
-
qrcode: () => Promise.resolve().then(() =>
|
|
2760
|
+
color: () => Promise.resolve().then(() => Pr).then((e) => ({ default: e.ColorField })),
|
|
2761
|
+
slider: () => Promise.resolve().then(() => Rr).then((e) => ({ default: e.SliderField })),
|
|
2762
|
+
rating: () => Promise.resolve().then(() => kr).then((e) => ({ default: e.RatingField })),
|
|
2763
|
+
code: () => Promise.resolve().then(() => Ar).then((e) => ({ default: e.CodeField })),
|
|
2764
|
+
avatar: () => Promise.resolve().then(() => $r).then((e) => ({ default: e.AvatarField })),
|
|
2765
|
+
address: () => Promise.resolve().then(() => zr).then((e) => ({ default: e.AddressField })),
|
|
2766
|
+
geolocation: () => Promise.resolve().then(() => Er).then((e) => ({ default: e.GeolocationField })),
|
|
2767
|
+
signature: () => Promise.resolve().then(() => Dr).then((e) => ({ default: e.SignatureField })),
|
|
2768
|
+
qrcode: () => Promise.resolve().then(() => Mr).then((e) => ({ default: e.QRCodeField }))
|
|
2602
2769
|
};
|
|
2603
|
-
function
|
|
2604
|
-
const r =
|
|
2770
|
+
function ns(e) {
|
|
2771
|
+
const r = Ct[e];
|
|
2605
2772
|
if (!r) {
|
|
2606
2773
|
console.warn(`Unknown field type: ${e}`);
|
|
2607
2774
|
return;
|
|
2608
2775
|
}
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2776
|
+
const s = E.lazy(r);
|
|
2777
|
+
y.register(e, s, { namespace: "field" });
|
|
2611
2778
|
}
|
|
2612
|
-
function
|
|
2613
|
-
Object.keys(
|
|
2614
|
-
|
|
2779
|
+
function as() {
|
|
2780
|
+
Object.keys(Ct).forEach((e) => {
|
|
2781
|
+
ns(e);
|
|
2615
2782
|
});
|
|
2616
2783
|
}
|
|
2617
|
-
function
|
|
2618
|
-
|
|
2784
|
+
function hs() {
|
|
2785
|
+
y.register("text", v(Je), { namespace: "field" }), y.register("textarea", v(tt), { namespace: "field" }), y.register("number", v(We), { namespace: "field" }), y.register("boolean", v(Ge), { namespace: "field" }), y.register("select", v(Qe), { namespace: "field" }), y.register("date", v(He), { namespace: "field" }), y.register("datetime", v(nt), { namespace: "field" }), y.register("time", v(at), { namespace: "field" }), y.register("email", v(Xe), { namespace: "field" }), y.register("phone", v(Ke), { namespace: "field" }), y.register("url", v(Ze), { namespace: "field" }), y.register("currency", v(et), { namespace: "field" }), y.register("percent", v(lt), { namespace: "field" }), y.register("password", v(it), { namespace: "field" }), y.register("markdown", v(ye), { namespace: "field" }), y.register("html", v(ye), { namespace: "field" }), y.register("lookup", v(st), { namespace: "field" }), y.register("master_detail", v(Ft), { namespace: "field" }), y.register("file", v(ot), { namespace: "field" }), y.register("image", v(ct), { namespace: "field" }), y.register("location", v(dt), { namespace: "field" }), y.register("formula", v(ut), { namespace: "field" }), y.register("summary", v(mt), { namespace: "field" }), y.register("auto_number", v(ft), { namespace: "field" }), y.register("user", v(Ne), { namespace: "field" }), y.register("owner", v(Ne), { namespace: "field" }), y.register("object", v(xt), { namespace: "field" }), y.register("vector", v(pt), { namespace: "field" }), y.register("grid", v(ht), { namespace: "field" }), y.register("color", v(gt), { namespace: "field" }), y.register("slider", v(bt), { namespace: "field" }), y.register("rating", v(jt), { namespace: "field" }), y.register("code", v(yt), { namespace: "field" }), y.register("avatar", v(Nt), { namespace: "field" }), y.register("address", v(vt), { namespace: "field" }), y.register("geolocation", v(_t), { namespace: "field" }), y.register("signature", v(wt), { namespace: "field" }), y.register("qrcode", v(St), { namespace: "field" });
|
|
2619
2786
|
}
|
|
2620
|
-
|
|
2787
|
+
as();
|
|
2621
2788
|
export {
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2789
|
+
vt as AddressField,
|
|
2790
|
+
ft as AutoNumberField,
|
|
2791
|
+
Nt as AvatarField,
|
|
2792
|
+
Gr as BooleanCellRenderer,
|
|
2793
|
+
Ge as BooleanField,
|
|
2794
|
+
yt as CodeField,
|
|
2795
|
+
gt as ColorField,
|
|
2796
|
+
Yr as CurrencyCellRenderer,
|
|
2797
|
+
et as CurrencyField,
|
|
2798
|
+
Qr as DateCellRenderer,
|
|
2799
|
+
He as DateField,
|
|
2800
|
+
Hr as DateTimeCellRenderer,
|
|
2801
|
+
nt as DateTimeField,
|
|
2802
|
+
Zr as EmailCellRenderer,
|
|
2803
|
+
Xe as EmailField,
|
|
2804
|
+
rs as FileCellRenderer,
|
|
2805
|
+
ot as FileField,
|
|
2806
|
+
Ue as FormulaCellRenderer,
|
|
2807
|
+
ut as FormulaField,
|
|
2808
|
+
_t as GeolocationField,
|
|
2809
|
+
ht as GridField,
|
|
2810
|
+
ss as ImageCellRenderer,
|
|
2811
|
+
ct as ImageField,
|
|
2812
|
+
dt as LocationField,
|
|
2813
|
+
ge as LookupCellRenderer,
|
|
2814
|
+
st as LookupField,
|
|
2815
|
+
Ft as MasterDetailField,
|
|
2816
|
+
Br as NumberCellRenderer,
|
|
2817
|
+
We as NumberField,
|
|
2818
|
+
xt as ObjectField,
|
|
2819
|
+
it as PasswordField,
|
|
2820
|
+
Jr as PercentCellRenderer,
|
|
2821
|
+
lt as PercentField,
|
|
2822
|
+
ts as PhoneCellRenderer,
|
|
2823
|
+
Ke as PhoneField,
|
|
2824
|
+
St as QRCodeField,
|
|
2825
|
+
jt as RatingField,
|
|
2826
|
+
ye as RichTextField,
|
|
2827
|
+
he as SelectCellRenderer,
|
|
2828
|
+
Qe as SelectField,
|
|
2829
|
+
wt as SignatureField,
|
|
2830
|
+
bt as SliderField,
|
|
2831
|
+
mt as SummaryField,
|
|
2832
|
+
tt as TextAreaField,
|
|
2833
|
+
K as TextCellRenderer,
|
|
2834
|
+
Je as TextField,
|
|
2835
|
+
at as TimeField,
|
|
2836
|
+
es as UrlCellRenderer,
|
|
2837
|
+
Ze as UrlField,
|
|
2838
|
+
be as UserCellRenderer,
|
|
2839
|
+
Ne as UserField,
|
|
2840
|
+
pt as VectorField,
|
|
2841
|
+
ps as buildValidationRules,
|
|
2842
|
+
Y as coerceToSafeValue,
|
|
2843
|
+
Ve as evaluateCondition,
|
|
2844
|
+
ds as formatCompactCurrency,
|
|
2845
|
+
Ir as formatCurrency,
|
|
2846
|
+
_e as formatDate,
|
|
2847
|
+
us as formatDateTime,
|
|
2848
|
+
xs as formatFileSize,
|
|
2849
|
+
Ur as formatPercent,
|
|
2850
|
+
Vr as formatRelativeDate,
|
|
2851
|
+
ms as getCellRenderer,
|
|
2852
|
+
ve as humanizeLabel,
|
|
2853
|
+
fs as mapFieldTypeToFormType,
|
|
2854
|
+
as as registerAllFields,
|
|
2855
|
+
ns as registerField,
|
|
2856
|
+
oe as registerFieldRenderer,
|
|
2857
|
+
hs as registerFields
|
|
2690
2858
|
};
|