@object-ui/fields 0.5.0 → 3.0.0
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/__tests__/datetime-timezone.test.d.ts +0 -0
- package/dist/fields/src/__tests__/extreme-inputs.test.d.ts +0 -0
- package/dist/fields/src/__tests__/form-variants.test.d.ts +0 -0
- package/dist/fields/src/__tests__/validation-feedback.test.d.ts +0 -0
- package/dist/fields/src/fields-edge-cases.stories.d.ts +45 -0
- package/dist/fields/src/index.d.ts +2 -1
- package/dist/fields/src/widgets/BooleanField.d.ts +4 -0
- package/dist/fields/src/widgets/DateField.d.ts +4 -0
- package/dist/fields/src/widgets/DateTimeField.d.ts +4 -0
- package/dist/fields/src/widgets/EmailField.d.ts +4 -0
- package/dist/fields/src/widgets/FileField.d.ts +4 -0
- package/dist/fields/src/widgets/ImageField.d.ts +4 -0
- package/dist/fields/src/widgets/LocationField.d.ts +4 -0
- package/dist/fields/src/widgets/NumberField.d.ts +4 -0
- package/dist/fields/src/widgets/PasswordField.d.ts +4 -0
- package/dist/fields/src/widgets/PercentField.d.ts +4 -0
- package/dist/fields/src/widgets/PhoneField.d.ts +4 -0
- package/dist/fields/src/widgets/SelectField.d.ts +4 -0
- package/dist/fields/src/widgets/TextAreaField.d.ts +4 -0
- package/dist/fields/src/widgets/TextField.d.ts +4 -0
- package/dist/fields/src/widgets/TimeField.d.ts +4 -0
- package/dist/fields/src/widgets/UrlField.d.ts +4 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +216 -197
- package/package.json +9 -9
- package/src/__tests__/datetime-timezone.test.tsx +770 -0
- package/src/__tests__/extreme-inputs.test.tsx +567 -0
- package/src/__tests__/form-variants.test.tsx +306 -0
- package/src/__tests__/validation-feedback.test.tsx +352 -0
- package/src/fields-edge-cases.stories.tsx +407 -0
- package/src/index.tsx +36 -11
- package/src/widgets/BooleanField.tsx +4 -0
- package/src/widgets/DateField.tsx +4 -0
- package/src/widgets/DateTimeField.tsx +4 -0
- package/src/widgets/EmailField.tsx +4 -0
- package/src/widgets/FileField.tsx +4 -0
- package/src/widgets/ImageField.tsx +4 -0
- package/src/widgets/LocationField.tsx +4 -0
- package/src/widgets/NumberField.tsx +4 -0
- package/src/widgets/PasswordField.tsx +4 -0
- package/src/widgets/PercentField.tsx +4 -0
- package/src/widgets/PhoneField.tsx +4 -0
- package/src/widgets/SelectField.tsx +4 -0
- package/src/widgets/SignatureField.tsx +1 -1
- package/src/widgets/TextAreaField.tsx +4 -0
- package/src/widgets/TextField.tsx +4 -0
- package/src/widgets/TimeField.tsx +4 -0
- package/src/widgets/UrlField.tsx +4 -0
package/dist/index.js
CHANGED
|
@@ -8,22 +8,22 @@ function Ut() {
|
|
|
8
8
|
if (xe) return D;
|
|
9
9
|
xe = 1;
|
|
10
10
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
-
function
|
|
11
|
+
function a(s, n, l) {
|
|
12
12
|
var i = null;
|
|
13
|
-
if (l !== void 0 && (i = "" + l),
|
|
13
|
+
if (l !== void 0 && (i = "" + l), n.key !== void 0 && (i = "" + n.key), "key" in n) {
|
|
14
14
|
l = {};
|
|
15
|
-
for (var o in
|
|
16
|
-
o !== "key" && (l[o] =
|
|
17
|
-
} else l =
|
|
18
|
-
return
|
|
15
|
+
for (var o in n)
|
|
16
|
+
o !== "key" && (l[o] = n[o]);
|
|
17
|
+
} else l = n;
|
|
18
|
+
return n = l.ref, {
|
|
19
19
|
$$typeof: e,
|
|
20
20
|
type: s,
|
|
21
21
|
key: i,
|
|
22
|
-
ref:
|
|
22
|
+
ref: n !== void 0 ? n : null,
|
|
23
23
|
props: l
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
return D.Fragment = r, D.jsx =
|
|
26
|
+
return D.Fragment = r, D.jsx = a, D.jsxs = a, D;
|
|
27
27
|
}
|
|
28
28
|
var I = {};
|
|
29
29
|
var he;
|
|
@@ -75,7 +75,7 @@ function Dt() {
|
|
|
75
75
|
function r(u) {
|
|
76
76
|
return "" + u;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function a(u) {
|
|
79
79
|
try {
|
|
80
80
|
r(u);
|
|
81
81
|
var b = !1;
|
|
@@ -103,7 +103,7 @@ function Dt() {
|
|
|
103
103
|
return "<...>";
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function n() {
|
|
107
107
|
var u = W.A;
|
|
108
108
|
return u === null ? null : u.getOwner();
|
|
109
109
|
}
|
|
@@ -199,7 +199,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
199
199
|
S
|
|
200
200
|
), oe[S + w] = !0);
|
|
201
201
|
}
|
|
202
|
-
if (S = null, v !== void 0 && (
|
|
202
|
+
if (S = null, v !== void 0 && (a(v), S = "" + v), i(b) && (a(b.key), S = "" + b.key), "key" in b) {
|
|
203
203
|
v = {};
|
|
204
204
|
for (var H in b)
|
|
205
205
|
H !== "key" && (v[H] = b[H]);
|
|
@@ -211,7 +211,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
211
211
|
u,
|
|
212
212
|
S,
|
|
213
213
|
v,
|
|
214
|
-
|
|
214
|
+
n(),
|
|
215
215
|
B,
|
|
216
216
|
X
|
|
217
217
|
);
|
|
@@ -262,11 +262,11 @@ function It() {
|
|
|
262
262
|
return pe || (pe = 1, process.env.NODE_ENV === "production" ? Y.exports = Ut() : Y.exports = Dt()), Y.exports;
|
|
263
263
|
}
|
|
264
264
|
var t = It();
|
|
265
|
-
function Fe({ value: e, onChange: r, field:
|
|
266
|
-
const l =
|
|
265
|
+
function Fe({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
266
|
+
const l = a || n.schema;
|
|
267
267
|
if (s)
|
|
268
268
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e || "-" });
|
|
269
|
-
const i = l?.rows, { inputType: o, ...c } =
|
|
269
|
+
const i = l?.rows, { inputType: o, ...c } = n;
|
|
270
270
|
return i && i > 1 ? /* @__PURE__ */ t.jsx(
|
|
271
271
|
V,
|
|
272
272
|
{
|
|
@@ -292,10 +292,10 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
292
292
|
__proto__: null,
|
|
293
293
|
TextField: Fe
|
|
294
294
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
295
|
-
function we({ value: e, onChange: r, field:
|
|
295
|
+
function we({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
296
296
|
if (s)
|
|
297
297
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ?? "-" });
|
|
298
|
-
const l =
|
|
298
|
+
const l = a || n.schema, i = l?.precision, { inputType: o, ...c } = n;
|
|
299
299
|
return /* @__PURE__ */ t.jsx(
|
|
300
300
|
_,
|
|
301
301
|
{
|
|
@@ -316,11 +316,11 @@ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
316
316
|
__proto__: null,
|
|
317
317
|
NumberField: we
|
|
318
318
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
319
|
-
function Se({ value: e, onChange: r, field:
|
|
320
|
-
const l =
|
|
319
|
+
function Se({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
320
|
+
const l = a || n.schema, i = l?.widget, o = xt(), c = l?.name || o, m = l?.label || "Checkbox";
|
|
321
321
|
if (s)
|
|
322
322
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ? "Yes" : "No" });
|
|
323
|
-
const { inputType: h, ...x } =
|
|
323
|
+
const { inputType: h, ...x } = n;
|
|
324
324
|
return i === "checkbox" ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
325
325
|
/* @__PURE__ */ t.jsx(
|
|
326
326
|
ht,
|
|
@@ -351,8 +351,8 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
351
351
|
__proto__: null,
|
|
352
352
|
BooleanField: Se
|
|
353
353
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
354
|
-
function Ce({ value: e, onChange: r, field:
|
|
355
|
-
const l =
|
|
354
|
+
function Ce({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
355
|
+
const l = a || n.schema, i = l?.options || [];
|
|
356
356
|
if (s) {
|
|
357
357
|
const o = i.find((c) => c.value === e);
|
|
358
358
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o?.label || e || "-" });
|
|
@@ -360,12 +360,12 @@ function Ce({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
360
360
|
return /* @__PURE__ */ t.jsxs(
|
|
361
361
|
gt,
|
|
362
362
|
{
|
|
363
|
-
...
|
|
363
|
+
...n,
|
|
364
364
|
value: e,
|
|
365
365
|
onValueChange: r,
|
|
366
|
-
disabled: s ||
|
|
366
|
+
disabled: s || n.disabled,
|
|
367
367
|
children: [
|
|
368
|
-
/* @__PURE__ */ t.jsx(bt, { className:
|
|
368
|
+
/* @__PURE__ */ t.jsx(bt, { className: n.className, id: n.id, children: /* @__PURE__ */ t.jsx(jt, { placeholder: l?.placeholder || "Select an option" }) }),
|
|
369
369
|
/* @__PURE__ */ t.jsx(yt, { position: "popper", children: i.map((o) => /* @__PURE__ */ t.jsx(Nt, { value: o.value, children: o.label }, o.value)) })
|
|
370
370
|
]
|
|
371
371
|
}
|
|
@@ -375,10 +375,10 @@ const Yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
375
375
|
__proto__: null,
|
|
376
376
|
SelectField: Ce
|
|
377
377
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
378
|
-
function Pe({ value: e, onChange: r, field:
|
|
378
|
+
function Pe({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
379
379
|
if (s)
|
|
380
380
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ? new Date(e).toLocaleDateString() : "-" });
|
|
381
|
-
const { inputType: l, ...i } =
|
|
381
|
+
const { inputType: l, ...i } = n;
|
|
382
382
|
return /* @__PURE__ */ t.jsx(
|
|
383
383
|
_,
|
|
384
384
|
{
|
|
@@ -394,8 +394,8 @@ const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
394
394
|
__proto__: null,
|
|
395
395
|
DateField: Pe
|
|
396
396
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
397
|
-
function Oe({ value: e, onChange: r, field:
|
|
398
|
-
const i =
|
|
397
|
+
function Oe({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, ...l }) {
|
|
398
|
+
const i = a || l.schema;
|
|
399
399
|
if (s)
|
|
400
400
|
return e ? /* @__PURE__ */ t.jsx(
|
|
401
401
|
"a",
|
|
@@ -415,7 +415,7 @@ function Oe({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...
|
|
|
415
415
|
onChange: (m) => r(m.target.value),
|
|
416
416
|
placeholder: i?.placeholder || "email@example.com",
|
|
417
417
|
disabled: s || c.disabled,
|
|
418
|
-
"aria-invalid": !!
|
|
418
|
+
"aria-invalid": !!n
|
|
419
419
|
}
|
|
420
420
|
);
|
|
421
421
|
}
|
|
@@ -423,8 +423,8 @@ const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
423
423
|
__proto__: null,
|
|
424
424
|
EmailField: Oe
|
|
425
425
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
426
|
-
function Te({ value: e, onChange: r, field:
|
|
427
|
-
const i =
|
|
426
|
+
function Te({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, ...l }) {
|
|
427
|
+
const i = a || l.schema;
|
|
428
428
|
if (s)
|
|
429
429
|
return e ? /* @__PURE__ */ t.jsx(
|
|
430
430
|
"a",
|
|
@@ -444,7 +444,7 @@ function Te({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...
|
|
|
444
444
|
onChange: (m) => r(m.target.value),
|
|
445
445
|
placeholder: i?.placeholder || "(555) 123-4567",
|
|
446
446
|
disabled: s || c.disabled,
|
|
447
|
-
"aria-invalid": !!
|
|
447
|
+
"aria-invalid": !!n
|
|
448
448
|
}
|
|
449
449
|
);
|
|
450
450
|
}
|
|
@@ -452,8 +452,8 @@ const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
452
452
|
__proto__: null,
|
|
453
453
|
PhoneField: Te
|
|
454
454
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
455
|
-
function Re({ value: e, onChange: r, field:
|
|
456
|
-
const i =
|
|
455
|
+
function Re({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, ...l }) {
|
|
456
|
+
const i = a || l.schema;
|
|
457
457
|
if (s)
|
|
458
458
|
return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ t.jsx(
|
|
459
459
|
"a",
|
|
@@ -475,7 +475,7 @@ function Re({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...
|
|
|
475
475
|
onChange: (m) => r(m.target.value),
|
|
476
476
|
placeholder: i?.placeholder || "https://example.com",
|
|
477
477
|
disabled: s || c.disabled,
|
|
478
|
-
"aria-invalid": !!
|
|
478
|
+
"aria-invalid": !!n
|
|
479
479
|
}
|
|
480
480
|
);
|
|
481
481
|
}
|
|
@@ -493,8 +493,8 @@ function Qt(e, r = "USD") {
|
|
|
493
493
|
return `${r} ${e.toFixed(2)}`;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
function ke({ value: e, onChange: r, field:
|
|
497
|
-
const o =
|
|
496
|
+
function ke({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, className: l, ...i }) {
|
|
497
|
+
const o = a || i.schema, c = o?.currency || "USD", m = o?.precision ?? 2;
|
|
498
498
|
if (s)
|
|
499
499
|
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium tabular-nums", children: Qt(Number(e), c) });
|
|
500
500
|
const h = (x) => {
|
|
@@ -518,7 +518,7 @@ function ke({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, cla
|
|
|
518
518
|
disabled: s || i.disabled,
|
|
519
519
|
className: `pl-8 ${l || ""}`,
|
|
520
520
|
step: Math.pow(10, -m).toFixed(m),
|
|
521
|
-
"aria-invalid": !!
|
|
521
|
+
"aria-invalid": !!n
|
|
522
522
|
}
|
|
523
523
|
)
|
|
524
524
|
] });
|
|
@@ -527,10 +527,10 @@ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
527
527
|
__proto__: null,
|
|
528
528
|
CurrencyField: ke
|
|
529
529
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
530
|
-
function Ae({ value: e, onChange: r, field:
|
|
530
|
+
function Ae({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, ...l }) {
|
|
531
531
|
if (s)
|
|
532
532
|
return /* @__PURE__ */ t.jsx("div", { className: "text-sm whitespace-pre-wrap", children: e || "-" });
|
|
533
|
-
const i =
|
|
533
|
+
const i = a || l.schema, o = i?.rows || 4, c = i?.max_length, { inputType: m, ...h } = l;
|
|
534
534
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
535
535
|
/* @__PURE__ */ t.jsx(
|
|
536
536
|
V,
|
|
@@ -542,7 +542,7 @@ function Ae({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...
|
|
|
542
542
|
disabled: s || h.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(
|
|
@@ -564,7 +564,7 @@ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
564
564
|
__proto__: null,
|
|
565
565
|
TextAreaField: Ae
|
|
566
566
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
567
|
-
function Z({ value: e, onChange: r, field:
|
|
567
|
+
function Z({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, ...l }) {
|
|
568
568
|
if (s)
|
|
569
569
|
return /* @__PURE__ */ t.jsx(
|
|
570
570
|
"div",
|
|
@@ -573,7 +573,7 @@ function Z({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...l
|
|
|
573
573
|
children: e || "-"
|
|
574
574
|
}
|
|
575
575
|
);
|
|
576
|
-
const i =
|
|
576
|
+
const i = a || l.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: [
|
|
@@ -591,7 +591,7 @@ function Z({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, ...l
|
|
|
591
591
|
disabled: s || l.disabled,
|
|
592
592
|
rows: o,
|
|
593
593
|
className: `font-mono text-sm ${l.className || ""}`,
|
|
594
|
-
"aria-invalid": !!
|
|
594
|
+
"aria-invalid": !!n
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
597
|
] });
|
|
@@ -600,8 +600,8 @@ const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
600
600
|
__proto__: null,
|
|
601
601
|
RichTextField: Z
|
|
602
602
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
603
|
-
function $e({ value: e, onChange: r, field:
|
|
604
|
-
const [l, i] = L(!1), [o, c] = L(""), m =
|
|
603
|
+
function $e({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
604
|
+
const [l, i] = L(!1), [o, c] = L(""), m = a || n.schema, h = m?.options || [], x = m.multiple || !1, d = m.display_field || "label", f = h.filter(
|
|
605
605
|
(y) => y.label.toLowerCase().includes(o.toLowerCase())
|
|
606
606
|
), p = x ? (Array.isArray(e) ? e : []).map(
|
|
607
607
|
(y) => h.find((C) => C.value === y)
|
|
@@ -694,7 +694,7 @@ const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
694
694
|
__proto__: null,
|
|
695
695
|
LookupField: $e
|
|
696
696
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
697
|
-
function ze({ value: e, onChange: r, field:
|
|
697
|
+
function ze({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
698
698
|
if (s) {
|
|
699
699
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
700
700
|
const o = new Date(e);
|
|
@@ -704,7 +704,7 @@ function ze({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
704
704
|
o.toLocaleTimeString()
|
|
705
705
|
] });
|
|
706
706
|
}
|
|
707
|
-
const { inputType: l, ...i } =
|
|
707
|
+
const { inputType: l, ...i } = n;
|
|
708
708
|
return /* @__PURE__ */ t.jsx(
|
|
709
709
|
_,
|
|
710
710
|
{
|
|
@@ -720,10 +720,10 @@ const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
720
720
|
__proto__: null,
|
|
721
721
|
DateTimeField: ze
|
|
722
722
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
723
|
-
function Ee({ value: e, onChange: r, field:
|
|
723
|
+
function Ee({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
724
724
|
if (s)
|
|
725
725
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e || "-" });
|
|
726
|
-
const { inputType: l, ...i } =
|
|
726
|
+
const { inputType: l, ...i } = n;
|
|
727
727
|
return /* @__PURE__ */ t.jsx(
|
|
728
728
|
_,
|
|
729
729
|
{
|
|
@@ -739,8 +739,8 @@ const er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
739
739
|
__proto__: null,
|
|
740
740
|
TimeField: Ee
|
|
741
741
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
742
|
-
function Me({ value: e, onChange: r, field:
|
|
743
|
-
const o =
|
|
742
|
+
function Me({ value: e, onChange: r, field: a, readonly: s, errorMessage: n, className: l, ...i }) {
|
|
743
|
+
const o = a || i.schema, c = o?.precision ?? 2;
|
|
744
744
|
if (s)
|
|
745
745
|
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsxs("span", { className: "text-sm font-medium tabular-nums", children: [
|
|
746
746
|
(e * 100).toFixed(c),
|
|
@@ -766,7 +766,7 @@ function Me({ value: e, onChange: r, field: n, readonly: s, errorMessage: a, cla
|
|
|
766
766
|
disabled: s || i.disabled,
|
|
767
767
|
className: `pr-8 ${l || ""}`,
|
|
768
768
|
step: Math.pow(10, -c).toFixed(c),
|
|
769
|
-
"aria-invalid": !!
|
|
769
|
+
"aria-invalid": !!n
|
|
770
770
|
}
|
|
771
771
|
),
|
|
772
772
|
/* @__PURE__ */ t.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: "%" })
|
|
@@ -776,8 +776,8 @@ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
776
776
|
__proto__: null,
|
|
777
777
|
PercentField: Me
|
|
778
778
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
779
|
-
function Ue({ value: e, onChange: r, field:
|
|
780
|
-
const [i, o] = L(!1), c =
|
|
779
|
+
function Ue({ value: e, onChange: r, field: a, readonly: s, className: n, ...l }) {
|
|
780
|
+
const [i, o] = L(!1), c = a || l.schema;
|
|
781
781
|
if (s)
|
|
782
782
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "••••••••" });
|
|
783
783
|
const { inputType: m, ...h } = l;
|
|
@@ -791,7 +791,7 @@ function Ue({ value: e, onChange: r, field: n, readonly: s, className: a, ...l }
|
|
|
791
791
|
onChange: (x) => r(x.target.value),
|
|
792
792
|
placeholder: c?.placeholder,
|
|
793
793
|
disabled: s || h.disabled,
|
|
794
|
-
className: `pr-10 ${
|
|
794
|
+
className: `pr-10 ${n || ""}`
|
|
795
795
|
}
|
|
796
796
|
),
|
|
797
797
|
/* @__PURE__ */ t.jsx(
|
|
@@ -812,8 +812,8 @@ const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
812
812
|
__proto__: null,
|
|
813
813
|
PasswordField: Ue
|
|
814
814
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
815
|
-
function De({ value: e, onChange: r, field:
|
|
816
|
-
const l = te(null), i =
|
|
815
|
+
function De({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
816
|
+
const l = te(null), i = a || n.schema, o = i?.multiple || !1, c = i?.accept ? i.accept.join(",") : void 0;
|
|
817
817
|
if (s) {
|
|
818
818
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
819
819
|
const d = Array.isArray(e) ? e : [e];
|
|
@@ -838,7 +838,7 @@ function De({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
838
838
|
} else
|
|
839
839
|
r(null);
|
|
840
840
|
};
|
|
841
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
841
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
842
842
|
/* @__PURE__ */ t.jsx(
|
|
843
843
|
"input",
|
|
844
844
|
{
|
|
@@ -900,8 +900,8 @@ const sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
900
900
|
__proto__: null,
|
|
901
901
|
FileField: De
|
|
902
902
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
903
|
-
function Ie({ value: e, onChange: r, field:
|
|
904
|
-
const l = te(null), i =
|
|
903
|
+
function Ie({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
904
|
+
const l = te(null), i = a || n.schema, o = i?.multiple || !1, c = i?.accept ? i.accept.join(",") : "image/*";
|
|
905
905
|
if (s) {
|
|
906
906
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
907
907
|
const d = Array.isArray(e) ? e : [e];
|
|
@@ -934,7 +934,7 @@ function Ie({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
934
934
|
} else
|
|
935
935
|
r(null);
|
|
936
936
|
};
|
|
937
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
937
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
938
938
|
/* @__PURE__ */ t.jsx(
|
|
939
939
|
"input",
|
|
940
940
|
{
|
|
@@ -988,8 +988,8 @@ const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
988
988
|
__proto__: null,
|
|
989
989
|
ImageField: Ie
|
|
990
990
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
991
|
-
function Le({ value: e, onChange: r, field:
|
|
992
|
-
const l =
|
|
991
|
+
function Le({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
992
|
+
const l = a || n.schema, i = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
993
993
|
if (s)
|
|
994
994
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: i || "-" });
|
|
995
995
|
const o = (c) => {
|
|
@@ -1011,8 +1011,8 @@ function Le({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1011
1011
|
value: i,
|
|
1012
1012
|
onChange: o,
|
|
1013
1013
|
placeholder: l?.placeholder || "latitude, longitude",
|
|
1014
|
-
disabled: s ||
|
|
1015
|
-
className:
|
|
1014
|
+
disabled: s || n.disabled,
|
|
1015
|
+
className: n.className
|
|
1016
1016
|
}
|
|
1017
1017
|
);
|
|
1018
1018
|
}
|
|
@@ -1020,34 +1020,34 @@ const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1020
1020
|
__proto__: null,
|
|
1021
1021
|
LocationField: Le
|
|
1022
1022
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1023
|
-
function Ve({ value: e, field: r, ...
|
|
1024
|
-
const
|
|
1023
|
+
function Ve({ value: e, field: r, ...a }) {
|
|
1024
|
+
const n = (r || a.schema)?.return_type || "text";
|
|
1025
1025
|
let l = "-";
|
|
1026
|
-
return e != null && (
|
|
1026
|
+
return e != null && (n === "number" || n === "currency" ? l = typeof e == "number" ? e.toFixed(2) : String(e) : n === "boolean" ? l = e ? "Yes" : "No" : n === "date" ? l = new Date(e).toLocaleDateString() : l = String(e)), /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${a.className || ""}`, children: l });
|
|
1027
1027
|
}
|
|
1028
1028
|
const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1029
1029
|
__proto__: null,
|
|
1030
1030
|
FormulaField: Ve
|
|
1031
1031
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1032
|
-
function Be({ value: e, field: r, ...
|
|
1033
|
-
const
|
|
1032
|
+
function Be({ value: e, field: r, ...a }) {
|
|
1033
|
+
const n = (r || a.schema)?.summary_type || "count";
|
|
1034
1034
|
let l = "-";
|
|
1035
|
-
return e != null && (
|
|
1035
|
+
return e != null && (n === "count" ? l = String(e) : ["sum", "avg", "min", "max"].includes(n) ? l = typeof e == "number" ? e.toFixed(2) : String(e) : l = String(e)), /* @__PURE__ */ t.jsx("span", { className: `text-sm font-medium tabular-nums text-gray-700 ${a.className || ""}`, children: l });
|
|
1036
1036
|
}
|
|
1037
1037
|
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1038
1038
|
__proto__: null,
|
|
1039
1039
|
SummaryField: Be
|
|
1040
1040
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1041
|
-
function Ye({ value: e, field: r, ...
|
|
1041
|
+
function Ye({ value: e, field: r, ...a }) {
|
|
1042
1042
|
const s = e != null ? String(e) : "-";
|
|
1043
|
-
return /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${
|
|
1043
|
+
return /* @__PURE__ */ t.jsx("span", { className: `text-sm font-mono text-gray-700 ${a.className || ""}`, children: s });
|
|
1044
1044
|
}
|
|
1045
1045
|
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1046
1046
|
__proto__: null,
|
|
1047
1047
|
AutoNumberField: Ye
|
|
1048
1048
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1049
|
-
function K({ value: e, onChange: r, field:
|
|
1050
|
-
const i = (
|
|
1049
|
+
function K({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1050
|
+
const i = (a || n.schema)?.multiple || !1;
|
|
1051
1051
|
if (s) {
|
|
1052
1052
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
1053
1053
|
const m = Array.isArray(e) ? e : [e];
|
|
@@ -1069,7 +1069,7 @@ function K({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1069
1069
|
} else
|
|
1070
1070
|
r(null);
|
|
1071
1071
|
};
|
|
1072
|
-
return /* @__PURE__ */ t.jsxs("div", { className:
|
|
1072
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n.className, children: [
|
|
1073
1073
|
o.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: o.map((m, h) => {
|
|
1074
1074
|
const x = m.name || m.username || "User", d = x.split(" ").map((f) => f[0]).join("").toUpperCase().slice(0, 2);
|
|
1075
1075
|
return /* @__PURE__ */ t.jsxs(k, { variant: "outline", className: "gap-2 pr-1", children: [
|
|
@@ -1093,8 +1093,8 @@ const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1093
1093
|
__proto__: null,
|
|
1094
1094
|
UserField: K
|
|
1095
1095
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1096
|
-
function qe({ value: e, onChange: r, field:
|
|
1097
|
-
const l =
|
|
1096
|
+
function qe({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1097
|
+
const l = a || n.schema, i = () => e == null ? "" : JSON.stringify(e, null, 2), [o, c] = L(i), [m, h] = L(null);
|
|
1098
1098
|
if (ve(() => {
|
|
1099
1099
|
try {
|
|
1100
1100
|
if (e == null) {
|
|
@@ -1107,7 +1107,7 @@ function qe({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1107
1107
|
c(JSON.stringify(e, null, 2));
|
|
1108
1108
|
}
|
|
1109
1109
|
}, [e, o]), s)
|
|
1110
|
-
return e ? /* @__PURE__ */ t.jsx("pre", { className: O("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40",
|
|
1110
|
+
return e ? /* @__PURE__ */ t.jsx("pre", { className: O("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: "-" });
|
|
1111
1111
|
const x = (d) => {
|
|
1112
1112
|
const f = d.target.value;
|
|
1113
1113
|
if (c(f), h(null), !f.trim()) {
|
|
@@ -1130,8 +1130,8 @@ function qe({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1130
1130
|
placeholder: l?.placeholder || `{
|
|
1131
1131
|
"key": "value"
|
|
1132
1132
|
}`,
|
|
1133
|
-
disabled: s ||
|
|
1134
|
-
className: O("font-mono text-xs", m ? "border-red-500 focus-visible:ring-red-500" : "",
|
|
1133
|
+
disabled: s || n.disabled,
|
|
1134
|
+
className: O("font-mono text-xs", m ? "border-red-500 focus-visible:ring-red-500" : "", n.className),
|
|
1135
1135
|
rows: 6
|
|
1136
1136
|
}
|
|
1137
1137
|
),
|
|
@@ -1142,15 +1142,15 @@ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1142
1142
|
__proto__: null,
|
|
1143
1143
|
ObjectField: qe
|
|
1144
1144
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1145
|
-
function Je({ value: e, field: r, ...
|
|
1146
|
-
const
|
|
1145
|
+
function Je({ value: e, field: r, ...a }) {
|
|
1146
|
+
const n = (r || a.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
1147
1147
|
if (!e || !Array.isArray(e))
|
|
1148
1148
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm text-gray-500", children: "-" });
|
|
1149
1149
|
const l = e.slice(0, 3).map((i) => {
|
|
1150
1150
|
const o = Number(i);
|
|
1151
1151
|
return isNaN(o) ? "0" : o.toFixed(4);
|
|
1152
1152
|
}).join(", ");
|
|
1153
|
-
return /* @__PURE__ */ t.jsxs("div", { className: `text-sm ${
|
|
1153
|
+
return /* @__PURE__ */ t.jsxs("div", { className: `text-sm ${a.className || ""}`, children: [
|
|
1154
1154
|
/* @__PURE__ */ t.jsxs("span", { className: "font-mono text-gray-700", children: [
|
|
1155
1155
|
"[",
|
|
1156
1156
|
l,
|
|
@@ -1158,7 +1158,7 @@ function Je({ value: e, field: r, ...n }) {
|
|
|
1158
1158
|
] }),
|
|
1159
1159
|
/* @__PURE__ */ t.jsxs("span", { className: "text-gray-500 ml-2", children: [
|
|
1160
1160
|
"(",
|
|
1161
|
-
|
|
1161
|
+
n,
|
|
1162
1162
|
"D)"
|
|
1163
1163
|
] })
|
|
1164
1164
|
] });
|
|
@@ -1167,9 +1167,9 @@ const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1167
1167
|
__proto__: null,
|
|
1168
1168
|
VectorField: Je
|
|
1169
1169
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1170
|
-
function Ge({ value: e, field: r, readonly:
|
|
1170
|
+
function Ge({ value: e, field: r, readonly: a, ...s }) {
|
|
1171
1171
|
const l = (r || s.schema)?.columns || [];
|
|
1172
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-gray-500", children: "-" }) :
|
|
1172
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-gray-500", children: "-" }) : a ? /* @__PURE__ */ t.jsx("div", { className: O("text-sm", s.className), children: /* @__PURE__ */ t.jsxs("span", { className: "text-gray-700", children: [
|
|
1173
1173
|
e.length,
|
|
1174
1174
|
" rows"
|
|
1175
1175
|
] }) }) : /* @__PURE__ */ t.jsxs("div", { className: O("border border-gray-200 rounded-md overflow-hidden", s.className), children: [
|
|
@@ -1195,8 +1195,8 @@ const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1195
1195
|
__proto__: null,
|
|
1196
1196
|
GridField: Ge
|
|
1197
1197
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1198
|
-
function We({ value: e, onChange: r, field:
|
|
1199
|
-
const l =
|
|
1198
|
+
function We({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1199
|
+
const l = a || n.schema;
|
|
1200
1200
|
return s ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1201
1201
|
/* @__PURE__ */ t.jsx(
|
|
1202
1202
|
"div",
|
|
@@ -1213,7 +1213,7 @@ function We({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1213
1213
|
type: "color",
|
|
1214
1214
|
value: e || "#000000",
|
|
1215
1215
|
onChange: (i) => r(i.target.value),
|
|
1216
|
-
disabled: s ||
|
|
1216
|
+
disabled: s || n.disabled,
|
|
1217
1217
|
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
1218
1218
|
}
|
|
1219
1219
|
),
|
|
@@ -1224,8 +1224,8 @@ function We({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1224
1224
|
value: e || "",
|
|
1225
1225
|
onChange: (i) => r(i.target.value),
|
|
1226
1226
|
placeholder: l?.placeholder || "#000000",
|
|
1227
|
-
disabled: s ||
|
|
1228
|
-
className:
|
|
1227
|
+
disabled: s || n.disabled,
|
|
1228
|
+
className: n.className,
|
|
1229
1229
|
pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
|
|
1230
1230
|
}
|
|
1231
1231
|
)
|
|
@@ -1235,8 +1235,8 @@ const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1235
1235
|
__proto__: null,
|
|
1236
1236
|
ColorField: We
|
|
1237
1237
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1238
|
-
function Qe({ value: e, onChange: r, field:
|
|
1239
|
-
const l =
|
|
1238
|
+
function Qe({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1239
|
+
const l = a || n.schema, i = l?.min ?? 0, o = l?.max ?? 100, c = l?.step ?? 1;
|
|
1240
1240
|
return s ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1241
1241
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium", children: e ?? i }),
|
|
1242
1242
|
/* @__PURE__ */ t.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -1252,8 +1252,8 @@ function Qe({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1252
1252
|
min: i,
|
|
1253
1253
|
max: o,
|
|
1254
1254
|
step: c,
|
|
1255
|
-
disabled: s ||
|
|
1256
|
-
className:
|
|
1255
|
+
disabled: s || n.disabled,
|
|
1256
|
+
className: n.className
|
|
1257
1257
|
}
|
|
1258
1258
|
),
|
|
1259
1259
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium w-12 text-right", children: e ?? i })
|
|
@@ -1263,9 +1263,9 @@ const fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1263
1263
|
__proto__: null,
|
|
1264
1264
|
SliderField: Qe
|
|
1265
1265
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1266
|
-
function Xe({ value: e, onChange: r, field:
|
|
1267
|
-
const o = (
|
|
1268
|
-
return s ? /* @__PURE__ */ t.jsxs("div", { className: O("flex items-center gap-1",
|
|
1266
|
+
function Xe({ value: e, onChange: r, field: a, readonly: s, className: n, ...l }) {
|
|
1267
|
+
const o = (a || l.schema)?.max ?? 5, c = e ?? 0, [m, h] = P.useState(null), x = m !== null ? m : c;
|
|
1268
|
+
return s ? /* @__PURE__ */ t.jsxs("div", { className: O("flex items-center gap-1", n), children: [
|
|
1269
1269
|
Array.from({ length: o }, (d, f) => /* @__PURE__ */ t.jsx(
|
|
1270
1270
|
de,
|
|
1271
1271
|
{
|
|
@@ -1278,7 +1278,7 @@ function Xe({ value: e, onChange: r, field: n, readonly: s, className: a, ...l }
|
|
|
1278
1278
|
" / ",
|
|
1279
1279
|
o
|
|
1280
1280
|
] })
|
|
1281
|
-
] }) : /* @__PURE__ */ t.jsxs("div", { className: O("flex items-center gap-1",
|
|
1281
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: O("flex items-center gap-1", n), children: [
|
|
1282
1282
|
Array.from({ length: o }, (d, f) => /* @__PURE__ */ t.jsx(
|
|
1283
1283
|
"button",
|
|
1284
1284
|
{
|
|
@@ -1308,16 +1308,16 @@ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1308
1308
|
__proto__: null,
|
|
1309
1309
|
RatingField: Xe
|
|
1310
1310
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1311
|
-
function He({ value: e, onChange: r, field:
|
|
1312
|
-
const l =
|
|
1313
|
-
return s ? /* @__PURE__ */ t.jsx("pre", { className: O("text-sm bg-muted p-2 rounded overflow-x-auto border",
|
|
1311
|
+
function He({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1312
|
+
const l = a || n.schema, i = l?.language ?? "javascript";
|
|
1313
|
+
return s ? /* @__PURE__ */ t.jsx("pre", { className: O("text-sm bg-muted p-2 rounded overflow-x-auto border", n.className), children: /* @__PURE__ */ t.jsx("code", { children: e || "-" }) }) : /* @__PURE__ */ t.jsx(
|
|
1314
1314
|
V,
|
|
1315
1315
|
{
|
|
1316
1316
|
value: e || "",
|
|
1317
1317
|
onChange: (o) => r(o.target.value),
|
|
1318
1318
|
placeholder: l?.placeholder || `// Write ${i} code here...`,
|
|
1319
|
-
disabled: s ||
|
|
1320
|
-
className: O("font-mono text-sm",
|
|
1319
|
+
disabled: s || n.disabled,
|
|
1320
|
+
className: O("font-mono text-sm", n.className),
|
|
1321
1321
|
rows: 12,
|
|
1322
1322
|
spellCheck: !1
|
|
1323
1323
|
}
|
|
@@ -1327,8 +1327,8 @@ const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1327
1327
|
__proto__: null,
|
|
1328
1328
|
CodeField: He
|
|
1329
1329
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1330
|
-
function Ze({ value: e, onChange: r, field:
|
|
1331
|
-
const [l, i] = P.useState(!1), o = P.useRef(null), c =
|
|
1330
|
+
function Ze({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1331
|
+
const [l, i] = P.useState(!1), o = P.useRef(null), c = a || n.schema, m = (d) => {
|
|
1332
1332
|
const f = d.target.files?.[0];
|
|
1333
1333
|
if (!f) return;
|
|
1334
1334
|
if (!f.type.startsWith("image/")) {
|
|
@@ -1391,7 +1391,7 @@ function Ze({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1391
1391
|
variant: "outline",
|
|
1392
1392
|
size: "sm",
|
|
1393
1393
|
onClick: () => o.current?.click(),
|
|
1394
|
-
disabled: s ||
|
|
1394
|
+
disabled: s || n.disabled,
|
|
1395
1395
|
children: [
|
|
1396
1396
|
/* @__PURE__ */ t.jsx(_e, { className: "w-4 h-4 mr-2" }),
|
|
1397
1397
|
e ? "Change" : "Upload",
|
|
@@ -1407,7 +1407,7 @@ const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1407
1407
|
__proto__: null,
|
|
1408
1408
|
AvatarField: Ze
|
|
1409
1409
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1410
|
-
function Ke({ value: e, onChange: r, field:
|
|
1410
|
+
function Ke({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1411
1411
|
const l = e || {}, i = (c, m) => {
|
|
1412
1412
|
r({
|
|
1413
1413
|
...l,
|
|
@@ -1430,8 +1430,8 @@ function Ke({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1430
1430
|
value: l.street || "",
|
|
1431
1431
|
onChange: (c) => i("street", c.target.value),
|
|
1432
1432
|
placeholder: "123 Main St",
|
|
1433
|
-
disabled: s ||
|
|
1434
|
-
className:
|
|
1433
|
+
disabled: s || n.disabled,
|
|
1434
|
+
className: n.className
|
|
1435
1435
|
}
|
|
1436
1436
|
)
|
|
1437
1437
|
] }),
|
|
@@ -1446,7 +1446,7 @@ function Ke({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1446
1446
|
value: l.city || "",
|
|
1447
1447
|
onChange: (c) => i("city", c.target.value),
|
|
1448
1448
|
placeholder: "San Francisco",
|
|
1449
|
-
disabled: s ||
|
|
1449
|
+
disabled: s || n.disabled
|
|
1450
1450
|
}
|
|
1451
1451
|
)
|
|
1452
1452
|
] }),
|
|
@@ -1460,7 +1460,7 @@ function Ke({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1460
1460
|
value: l.state || "",
|
|
1461
1461
|
onChange: (c) => i("state", c.target.value),
|
|
1462
1462
|
placeholder: "CA",
|
|
1463
|
-
disabled: s ||
|
|
1463
|
+
disabled: s || n.disabled
|
|
1464
1464
|
}
|
|
1465
1465
|
)
|
|
1466
1466
|
] })
|
|
@@ -1476,7 +1476,7 @@ function Ke({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1476
1476
|
value: l.zipCode || "",
|
|
1477
1477
|
onChange: (c) => i("zipCode", c.target.value),
|
|
1478
1478
|
placeholder: "94102",
|
|
1479
|
-
disabled: s ||
|
|
1479
|
+
disabled: s || n.disabled
|
|
1480
1480
|
}
|
|
1481
1481
|
)
|
|
1482
1482
|
] }),
|
|
@@ -1490,7 +1490,7 @@ function Ke({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1490
1490
|
value: l.country || "",
|
|
1491
1491
|
onChange: (c) => i("country", c.target.value),
|
|
1492
1492
|
placeholder: "United States",
|
|
1493
|
-
disabled: s ||
|
|
1493
|
+
disabled: s || n.disabled
|
|
1494
1494
|
}
|
|
1495
1495
|
)
|
|
1496
1496
|
] })
|
|
@@ -1501,7 +1501,7 @@ const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1501
1501
|
__proto__: null,
|
|
1502
1502
|
AddressField: Ke
|
|
1503
1503
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1504
|
-
function et({ value: e, onChange: r, field:
|
|
1504
|
+
function et({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1505
1505
|
const [l, i] = P.useState(!1), o = e || {}, c = (d, f) => {
|
|
1506
1506
|
r({
|
|
1507
1507
|
...o,
|
|
@@ -1589,9 +1589,9 @@ function et({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1589
1589
|
value: o.latitude ?? "",
|
|
1590
1590
|
onChange: (d) => c("latitude", d.target.value),
|
|
1591
1591
|
placeholder: "37.7749",
|
|
1592
|
-
disabled: s ||
|
|
1592
|
+
disabled: s || n.disabled,
|
|
1593
1593
|
step: "any",
|
|
1594
|
-
className:
|
|
1594
|
+
className: n.className
|
|
1595
1595
|
}
|
|
1596
1596
|
)
|
|
1597
1597
|
] }),
|
|
@@ -1605,7 +1605,7 @@ function et({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1605
1605
|
value: o.longitude ?? "",
|
|
1606
1606
|
onChange: (d) => c("longitude", d.target.value),
|
|
1607
1607
|
placeholder: "-122.4194",
|
|
1608
|
-
disabled: s ||
|
|
1608
|
+
disabled: s || n.disabled,
|
|
1609
1609
|
step: "any"
|
|
1610
1610
|
}
|
|
1611
1611
|
)
|
|
@@ -1622,8 +1622,8 @@ const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1622
1622
|
__proto__: null,
|
|
1623
1623
|
GeolocationField: et
|
|
1624
1624
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1625
|
-
function tt({ value: e, onChange: r, readonly:
|
|
1626
|
-
const s = te(null), [
|
|
1625
|
+
function tt({ value: e, onChange: r, readonly: a }) {
|
|
1626
|
+
const s = te(null), [n, l] = P.useState(!1), [i, o] = P.useState(!e);
|
|
1627
1627
|
ve(() => {
|
|
1628
1628
|
if (e && s.current) {
|
|
1629
1629
|
const f = s.current.getContext("2d");
|
|
@@ -1636,7 +1636,7 @@ function tt({ value: e, onChange: r, readonly: n }) {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
}, [e]);
|
|
1638
1638
|
const c = (d) => {
|
|
1639
|
-
if (
|
|
1639
|
+
if (a) return;
|
|
1640
1640
|
l(!0), o(!1);
|
|
1641
1641
|
const f = s.current;
|
|
1642
1642
|
if (!f) return;
|
|
@@ -1645,7 +1645,7 @@ function tt({ value: e, onChange: r, readonly: n }) {
|
|
|
1645
1645
|
const N = f.getBoundingClientRect(), T = "touches" in d ? d.touches[0].clientX - N.left : d.clientX - N.left, y = "touches" in d ? d.touches[0].clientY - N.top : d.clientY - N.top;
|
|
1646
1646
|
p.beginPath(), p.moveTo(T, y);
|
|
1647
1647
|
}, m = (d) => {
|
|
1648
|
-
if (!
|
|
1648
|
+
if (!n || a) return;
|
|
1649
1649
|
const f = s.current;
|
|
1650
1650
|
if (!f) return;
|
|
1651
1651
|
const p = f.getContext("2d");
|
|
@@ -1653,7 +1653,7 @@ function tt({ value: e, onChange: r, readonly: n }) {
|
|
|
1653
1653
|
const N = f.getBoundingClientRect(), T = "touches" in d ? d.touches[0].clientX - N.left : d.clientX - N.left, y = "touches" in d ? d.touches[0].clientY - N.top : d.clientY - N.top;
|
|
1654
1654
|
p.lineTo(T, y), p.strokeStyle = "#000", p.lineWidth = 2, p.lineCap = "round", p.lineJoin = "round", p.stroke();
|
|
1655
1655
|
}, h = () => {
|
|
1656
|
-
if (!
|
|
1656
|
+
if (!n) return;
|
|
1657
1657
|
l(!1);
|
|
1658
1658
|
const d = s.current;
|
|
1659
1659
|
if (!d) return;
|
|
@@ -1665,7 +1665,7 @@ function tt({ value: e, onChange: r, readonly: n }) {
|
|
|
1665
1665
|
const f = d.getContext("2d");
|
|
1666
1666
|
f && (f.clearRect(0, 0, d.width, d.height), o(!0), r(""));
|
|
1667
1667
|
};
|
|
1668
|
-
return
|
|
1668
|
+
return a && 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" }) }) : a && !e ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "No signature" }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
1669
1669
|
/* @__PURE__ */ t.jsx("div", { className: "border rounded bg-white", children: /* @__PURE__ */ t.jsx(
|
|
1670
1670
|
"canvas",
|
|
1671
1671
|
{
|
|
@@ -1691,7 +1691,7 @@ function tt({ value: e, onChange: r, readonly: n }) {
|
|
|
1691
1691
|
variant: "outline",
|
|
1692
1692
|
size: "sm",
|
|
1693
1693
|
onClick: x,
|
|
1694
|
-
disabled:
|
|
1694
|
+
disabled: a || i,
|
|
1695
1695
|
children: [
|
|
1696
1696
|
/* @__PURE__ */ t.jsx($t, { className: "w-4 h-4 mr-2" }),
|
|
1697
1697
|
"Clear"
|
|
@@ -1705,8 +1705,8 @@ const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1705
1705
|
__proto__: null,
|
|
1706
1706
|
SignatureField: tt
|
|
1707
1707
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1708
|
-
function rt({ value: e, onChange: r, field:
|
|
1709
|
-
const [l, i] = P.useState(!1), o =
|
|
1708
|
+
function rt({ value: e, onChange: r, field: a, readonly: s, ...n }) {
|
|
1709
|
+
const [l, i] = P.useState(!1), o = a || n.schema, c = (h) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(h)}`, m = () => {
|
|
1710
1710
|
e && navigator.clipboard.writeText(e);
|
|
1711
1711
|
};
|
|
1712
1712
|
return s ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1734,8 +1734,8 @@ function rt({ value: e, onChange: r, field: n, readonly: s, ...a }) {
|
|
|
1734
1734
|
value: e || "",
|
|
1735
1735
|
onChange: (h) => r(h.target.value),
|
|
1736
1736
|
placeholder: o?.placeholder || "Enter text for QR code",
|
|
1737
|
-
disabled: s ||
|
|
1738
|
-
className:
|
|
1737
|
+
disabled: s || n.disabled,
|
|
1738
|
+
className: n.className
|
|
1739
1739
|
}
|
|
1740
1740
|
),
|
|
1741
1741
|
e && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
@@ -1783,12 +1783,12 @@ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1783
1783
|
function st({
|
|
1784
1784
|
value: e,
|
|
1785
1785
|
onChange: r,
|
|
1786
|
-
field:
|
|
1786
|
+
field: a,
|
|
1787
1787
|
readonly: s,
|
|
1788
|
-
className:
|
|
1788
|
+
className: n,
|
|
1789
1789
|
...l
|
|
1790
1790
|
}) {
|
|
1791
|
-
const i = e || [], o =
|
|
1791
|
+
const i = e || [], o = a || l.schema, c = () => {
|
|
1792
1792
|
const x = {
|
|
1793
1793
|
id: `new-${Date.now()}`,
|
|
1794
1794
|
label: "New Related Record"
|
|
@@ -1799,7 +1799,7 @@ function st({
|
|
|
1799
1799
|
}, h = (x) => {
|
|
1800
1800
|
console.log("View detail:", x);
|
|
1801
1801
|
};
|
|
1802
|
-
return s ? /* @__PURE__ */ t.jsxs("div", { className: O("space-y-2",
|
|
1802
|
+
return s ? /* @__PURE__ */ t.jsxs("div", { className: O("space-y-2", n), children: [
|
|
1803
1803
|
i.length === 0 ? /* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: "No related records" }) : i.map((x) => /* @__PURE__ */ t.jsxs(
|
|
1804
1804
|
"div",
|
|
1805
1805
|
{
|
|
@@ -1825,7 +1825,7 @@ function st({
|
|
|
1825
1825
|
" ",
|
|
1826
1826
|
i.length === 1 ? "record" : "records"
|
|
1827
1827
|
] })
|
|
1828
|
-
] }) : /* @__PURE__ */ t.jsxs("div", { className: O("space-y-3",
|
|
1828
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: O("space-y-3", n), children: [
|
|
1829
1829
|
/* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
1830
1830
|
i.map((x) => /* @__PURE__ */ t.jsxs(
|
|
1831
1831
|
"div",
|
|
@@ -1896,13 +1896,13 @@ function vr(e, r = "USD") {
|
|
|
1896
1896
|
return `${r} ${e.toFixed(2)}`;
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
function _r(e, r =
|
|
1900
|
-
return `${(e * 100).toFixed(r)}%`;
|
|
1899
|
+
function _r(e, r = 0) {
|
|
1900
|
+
return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(r)}%`;
|
|
1901
1901
|
}
|
|
1902
1902
|
function Fr(e, r) {
|
|
1903
1903
|
if (!e) return "-";
|
|
1904
|
-
const
|
|
1905
|
-
return isNaN(
|
|
1904
|
+
const a = typeof e == "string" ? new Date(e) : e;
|
|
1905
|
+
return isNaN(a.getTime()) ? "-" : a.toLocaleDateString("en-US", {
|
|
1906
1906
|
year: "numeric",
|
|
1907
1907
|
month: "short",
|
|
1908
1908
|
day: "numeric"
|
|
@@ -1923,19 +1923,38 @@ function A({ value: e }) {
|
|
|
1923
1923
|
return /* @__PURE__ */ t.jsx("span", { className: "truncate", children: e || "-" });
|
|
1924
1924
|
}
|
|
1925
1925
|
function Sr({ value: e, field: r }) {
|
|
1926
|
-
if (e == null) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
1927
|
-
const s = r.precision ?? 0,
|
|
1928
|
-
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums", children:
|
|
1926
|
+
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
1927
|
+
const s = r.precision ?? 0, n = typeof e == "number" ? new Intl.NumberFormat("en-US", { minimumFractionDigits: s, maximumFractionDigits: s }).format(e) : e;
|
|
1928
|
+
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums", children: n });
|
|
1929
1929
|
}
|
|
1930
1930
|
function Cr({ value: e, field: r }) {
|
|
1931
|
-
if (e == null) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
1932
|
-
const s = r.currency || "USD",
|
|
1933
|
-
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums font-medium", children:
|
|
1931
|
+
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
1932
|
+
const s = r.currency || "USD", n = vr(Number(e), s);
|
|
1933
|
+
return /* @__PURE__ */ t.jsx("span", { className: "tabular-nums font-medium whitespace-nowrap", children: n });
|
|
1934
1934
|
}
|
|
1935
1935
|
function Pr({ value: e, field: r }) {
|
|
1936
|
-
if (e == null) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
1937
|
-
const s = r.precision ??
|
|
1938
|
-
return /* @__PURE__ */ t.
|
|
1936
|
+
if (e == null) return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "-" });
|
|
1937
|
+
const s = r.precision ?? 0, n = Number(e), l = _r(n, s), i = n > -1 && n < 1 ? n * 100 : n, o = Math.max(0, Math.min(100, i));
|
|
1938
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1939
|
+
/* @__PURE__ */ t.jsx(
|
|
1940
|
+
"div",
|
|
1941
|
+
{
|
|
1942
|
+
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",
|
|
1943
|
+
role: "progressbar",
|
|
1944
|
+
"aria-valuenow": o,
|
|
1945
|
+
"aria-valuemin": 0,
|
|
1946
|
+
"aria-valuemax": 100,
|
|
1947
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1948
|
+
"div",
|
|
1949
|
+
{
|
|
1950
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
1951
|
+
style: { width: `${o}%` }
|
|
1952
|
+
}
|
|
1953
|
+
)
|
|
1954
|
+
}
|
|
1955
|
+
),
|
|
1956
|
+
/* @__PURE__ */ t.jsx("span", { className: "tabular-nums whitespace-nowrap", children: l })
|
|
1957
|
+
] });
|
|
1939
1958
|
}
|
|
1940
1959
|
function Or({ value: e }) {
|
|
1941
1960
|
return /* @__PURE__ */ t.jsx("div", { className: "flex items-center", children: e ? /* @__PURE__ */ t.jsxs(k, { variant: "outline", className: "bg-green-50 text-green-700 border-green-200 gap-1", children: [
|
|
@@ -1957,7 +1976,7 @@ function Rr({ value: e }) {
|
|
|
1957
1976
|
function q({ value: e, field: r }) {
|
|
1958
1977
|
const s = r.options || [];
|
|
1959
1978
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
1960
|
-
const
|
|
1979
|
+
const n = (c) => {
|
|
1961
1980
|
const m = {
|
|
1962
1981
|
gray: "bg-gray-100 text-gray-800 border-gray-300",
|
|
1963
1982
|
red: "bg-red-100 text-red-800 border-red-300",
|
|
@@ -1973,7 +1992,7 @@ function q({ value: e, field: r }) {
|
|
|
1973
1992
|
};
|
|
1974
1993
|
if (Array.isArray(e))
|
|
1975
1994
|
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((c, m) => {
|
|
1976
|
-
const h = s.find((f) => f.value === c), x = h?.label || c, d =
|
|
1995
|
+
const h = s.find((f) => f.value === c), x = h?.label || c, d = n(h?.color);
|
|
1977
1996
|
return /* @__PURE__ */ t.jsx(
|
|
1978
1997
|
k,
|
|
1979
1998
|
{
|
|
@@ -1984,7 +2003,7 @@ function q({ value: e, field: r }) {
|
|
|
1984
2003
|
m
|
|
1985
2004
|
);
|
|
1986
2005
|
}) });
|
|
1987
|
-
const l = s.find((c) => c.value === e), i = l?.label || e, o =
|
|
2006
|
+
const l = s.find((c) => c.value === e), i = l?.label || e, o = n(l?.color);
|
|
1988
2007
|
return /* @__PURE__ */ t.jsx(
|
|
1989
2008
|
k,
|
|
1990
2009
|
{
|
|
@@ -2046,11 +2065,11 @@ function $r({ value: e }) {
|
|
|
2046
2065
|
function zr({ value: e, field: r }) {
|
|
2047
2066
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2048
2067
|
if (r.multiple, Array.isArray(e)) {
|
|
2049
|
-
const
|
|
2068
|
+
const n = e.length;
|
|
2050
2069
|
return /* @__PURE__ */ t.jsxs("span", { className: "text-sm text-gray-600", children: [
|
|
2051
|
-
|
|
2070
|
+
n,
|
|
2052
2071
|
" ",
|
|
2053
|
-
|
|
2072
|
+
n === 1 ? "file" : "files"
|
|
2054
2073
|
] });
|
|
2055
2074
|
}
|
|
2056
2075
|
const s = e.name || e.original_name || "File";
|
|
@@ -2058,14 +2077,14 @@ function zr({ value: e, field: r }) {
|
|
|
2058
2077
|
}
|
|
2059
2078
|
function Er({ value: e }) {
|
|
2060
2079
|
return e ? Array.isArray(e) ? /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
2061
|
-
e.slice(0, 3).map((r,
|
|
2080
|
+
e.slice(0, 3).map((r, a) => /* @__PURE__ */ t.jsx(
|
|
2062
2081
|
"img",
|
|
2063
2082
|
{
|
|
2064
2083
|
src: r.url || "",
|
|
2065
|
-
alt: r.name || `Image ${
|
|
2084
|
+
alt: r.name || `Image ${a + 1}`,
|
|
2066
2085
|
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
2067
2086
|
},
|
|
2068
|
-
|
|
2087
|
+
a
|
|
2069
2088
|
)),
|
|
2070
2089
|
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: [
|
|
2071
2090
|
"+",
|
|
@@ -2083,7 +2102,7 @@ function Er({ value: e }) {
|
|
|
2083
2102
|
function nt({ value: e }) {
|
|
2084
2103
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2085
2104
|
if (Array.isArray(e))
|
|
2086
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((r,
|
|
2105
|
+
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((r, a) => {
|
|
2087
2106
|
const s = r.name || r.label || r._id || String(r);
|
|
2088
2107
|
return /* @__PURE__ */ t.jsx(
|
|
2089
2108
|
"span",
|
|
@@ -2091,7 +2110,7 @@ function nt({ value: e }) {
|
|
|
2091
2110
|
className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",
|
|
2092
2111
|
children: s
|
|
2093
2112
|
},
|
|
2094
|
-
|
|
2113
|
+
a
|
|
2095
2114
|
);
|
|
2096
2115
|
}) });
|
|
2097
2116
|
if (typeof e == "object" && e !== null) {
|
|
@@ -2107,7 +2126,7 @@ function ye({ value: e }) {
|
|
|
2107
2126
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2108
2127
|
if (Array.isArray(e))
|
|
2109
2128
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
2110
|
-
e.slice(0, 3).map((s,
|
|
2129
|
+
e.slice(0, 3).map((s, n) => {
|
|
2111
2130
|
const l = s.name || s.username || "User", i = l.split(" ").map((o) => o[0]).join("").toUpperCase().slice(0, 2);
|
|
2112
2131
|
return /* @__PURE__ */ t.jsx(
|
|
2113
2132
|
$,
|
|
@@ -2116,7 +2135,7 @@ function ye({ value: e }) {
|
|
|
2116
2135
|
title: l,
|
|
2117
2136
|
children: /* @__PURE__ */ t.jsx(z, { className: "bg-blue-500 text-white text-xs", children: i })
|
|
2118
2137
|
},
|
|
2119
|
-
|
|
2138
|
+
n
|
|
2120
2139
|
);
|
|
2121
2140
|
}),
|
|
2122
2141
|
e.length > 3 && /* @__PURE__ */ t.jsx($, { className: "size-8 border-2 border-white", children: /* @__PURE__ */ t.jsxs(z, { className: "bg-gray-200 text-gray-600 text-xs", children: [
|
|
@@ -2124,9 +2143,9 @@ function ye({ value: e }) {
|
|
|
2124
2143
|
e.length - 3
|
|
2125
2144
|
] }) })
|
|
2126
2145
|
] });
|
|
2127
|
-
const r = e.name || e.username || "User",
|
|
2146
|
+
const r = e.name || e.username || "User", a = r.split(" ").map((s) => s[0]).join("").toUpperCase().slice(0, 2);
|
|
2128
2147
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2129
|
-
/* @__PURE__ */ t.jsx($, { className: "size-8", children: /* @__PURE__ */ t.jsx(z, { className: "bg-blue-500 text-white text-xs", children:
|
|
2148
|
+
/* @__PURE__ */ t.jsx($, { className: "size-8", children: /* @__PURE__ */ t.jsx(z, { className: "bg-blue-500 text-white text-xs", children: a }) }),
|
|
2130
2149
|
/* @__PURE__ */ t.jsx("span", { className: "truncate", children: r })
|
|
2131
2150
|
] });
|
|
2132
2151
|
}
|
|
@@ -2217,10 +2236,10 @@ function qr(e) {
|
|
|
2217
2236
|
if (e < 0 || !Number.isFinite(e) || e === 0)
|
|
2218
2237
|
return "0 B";
|
|
2219
2238
|
const r = ["B", "KB", "MB", "GB", "TB"];
|
|
2220
|
-
let
|
|
2221
|
-
for (;
|
|
2222
|
-
|
|
2223
|
-
return `${
|
|
2239
|
+
let a = e, s = 0;
|
|
2240
|
+
for (; a >= 1024 && s < r.length - 1; )
|
|
2241
|
+
a /= 1024, s++;
|
|
2242
|
+
return `${a.toFixed(s > 0 ? 1 : 0)} ${r[s]}`;
|
|
2224
2243
|
}
|
|
2225
2244
|
function Jr(e) {
|
|
2226
2245
|
const r = {};
|
|
@@ -2250,48 +2269,48 @@ function Jr(e) {
|
|
|
2250
2269
|
function Ne(e, r) {
|
|
2251
2270
|
if (!e) return !0;
|
|
2252
2271
|
if (e.field && e.value !== void 0) {
|
|
2253
|
-
const
|
|
2272
|
+
const a = r[e.field];
|
|
2254
2273
|
if (e.operator === "=" || e.operator === "==")
|
|
2255
|
-
return
|
|
2274
|
+
return a === e.value;
|
|
2256
2275
|
if (e.operator === "!=")
|
|
2257
|
-
return
|
|
2276
|
+
return a !== e.value;
|
|
2258
2277
|
if (e.operator === ">")
|
|
2259
|
-
return
|
|
2278
|
+
return a > e.value;
|
|
2260
2279
|
if (e.operator === ">=")
|
|
2261
|
-
return
|
|
2280
|
+
return a >= e.value;
|
|
2262
2281
|
if (e.operator === "<")
|
|
2263
|
-
return
|
|
2282
|
+
return a < e.value;
|
|
2264
2283
|
if (e.operator === "<=")
|
|
2265
|
-
return
|
|
2284
|
+
return a <= e.value;
|
|
2266
2285
|
if (e.operator === "in")
|
|
2267
|
-
return Array.isArray(e.value) && e.value.includes(
|
|
2286
|
+
return Array.isArray(e.value) && e.value.includes(a);
|
|
2268
2287
|
}
|
|
2269
|
-
return e.and && Array.isArray(e.and) ? e.and.every((
|
|
2288
|
+
return e.and && Array.isArray(e.and) ? e.and.every((a) => Ne(a, r)) : e.or && Array.isArray(e.or) ? e.or.some((a) => Ne(a, r)) : !0;
|
|
2270
2289
|
}
|
|
2271
2290
|
function j(e) {
|
|
2272
|
-
const r = ({ schema:
|
|
2273
|
-
const [i, o] = P.useState(
|
|
2274
|
-
name:
|
|
2275
|
-
label:
|
|
2276
|
-
type:
|
|
2277
|
-
placeholder:
|
|
2278
|
-
required:
|
|
2279
|
-
readonly:
|
|
2280
|
-
help:
|
|
2281
|
-
description:
|
|
2282
|
-
defaultValue:
|
|
2283
|
-
...
|
|
2291
|
+
const r = ({ schema: a, className: s, value: n, ...l }) => {
|
|
2292
|
+
const [i, o] = P.useState(n ?? a?.value ?? ""), c = {
|
|
2293
|
+
name: a?.name || "field",
|
|
2294
|
+
label: a?.label,
|
|
2295
|
+
type: a?.type,
|
|
2296
|
+
placeholder: a?.placeholder,
|
|
2297
|
+
required: a?.required,
|
|
2298
|
+
readonly: a?.readonly || a?.readOnly,
|
|
2299
|
+
help: a?.help,
|
|
2300
|
+
description: a?.description,
|
|
2301
|
+
defaultValue: a?.defaultValue || a?.value,
|
|
2302
|
+
...a
|
|
2284
2303
|
}, m = P.useCallback((x) => {
|
|
2285
2304
|
o(x), l.onChange && l.onChange(x);
|
|
2286
|
-
}, [l]), h =
|
|
2305
|
+
}, [l]), h = a?.readonly || a?.readOnly || !1;
|
|
2287
2306
|
return /* @__PURE__ */ t.jsxs(
|
|
2288
2307
|
"div",
|
|
2289
2308
|
{
|
|
2290
2309
|
className: "grid w-full items-center gap-1.5",
|
|
2291
|
-
"data-obj-id":
|
|
2292
|
-
"data-obj-type":
|
|
2310
|
+
"data-obj-id": a?.id,
|
|
2311
|
+
"data-obj-type": a?.type,
|
|
2293
2312
|
children: [
|
|
2294
|
-
|
|
2313
|
+
a?.label && /* @__PURE__ */ t.jsx("label", { htmlFor: a.id, className: a.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "", children: a.label }),
|
|
2295
2314
|
/* @__PURE__ */ t.jsx(
|
|
2296
2315
|
e,
|
|
2297
2316
|
{
|
|
@@ -2302,7 +2321,7 @@ function j(e) {
|
|
|
2302
2321
|
className: s
|
|
2303
2322
|
}
|
|
2304
2323
|
),
|
|
2305
|
-
|
|
2324
|
+
a?.description && /* @__PURE__ */ t.jsx("p", { className: "text-sm text-gray-500", children: a.description })
|
|
2306
2325
|
]
|
|
2307
2326
|
}
|
|
2308
2327
|
);
|
|
@@ -2364,8 +2383,8 @@ function Mr(e) {
|
|
|
2364
2383
|
console.warn(`Unknown field type: ${e}`);
|
|
2365
2384
|
return;
|
|
2366
2385
|
}
|
|
2367
|
-
const
|
|
2368
|
-
g.register(e,
|
|
2386
|
+
const a = P.lazy(r);
|
|
2387
|
+
g.register(e, a, { namespace: "field" });
|
|
2369
2388
|
}
|
|
2370
2389
|
function Ur() {
|
|
2371
2390
|
Object.keys(at).forEach((e) => {
|