@object-ui/plugin-detail 3.1.2 → 3.1.4
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/.turbo/turbo-build.log +53 -47
- package/CHANGELOG.md +20 -0
- package/dist/AddressField-DBkEyMcG.js +93 -0
- package/dist/AutoNumberField-Baa191z-.js +14 -0
- package/dist/AvatarField-YGj51ozd.js +80 -0
- package/dist/BooleanField-CaA898Tk.js +40 -0
- package/dist/CodeField-BU51nl1L.js +22 -0
- package/dist/ColorField-Cnf6ZM7c.js +37 -0
- package/dist/CurrencyField-Wg-XOId2.js +51 -0
- package/dist/DateField-Cth1ky_m.js +21 -0
- package/dist/DateTimeField-B0m6FhHL.js +32 -0
- package/dist/EmailField-Do7qT_L_.js +28 -0
- package/dist/FileField-aRJAdbQb.js +151 -0
- package/dist/FormulaField-DTMkagFx.js +14 -0
- package/dist/GeolocationField-RqpHWTEv.js +113 -0
- package/dist/GridField-D4IH0cpo.js +51 -0
- package/dist/ImageField-BYCFajjr.js +75 -0
- package/dist/LocationField-Bi_ew9sd.js +35 -0
- package/dist/LookupField-BjwlDPtt.js +902 -0
- package/dist/MasterDetailField-I1A9oEGC.js +94 -0
- package/dist/NumberField-D_NucQlp.js +26 -0
- package/dist/ObjectField-CG-LaM65.js +52 -0
- package/dist/PasswordField-DBtluGJ1.js +35 -0
- package/dist/PercentField-B6sO_J3i.js +63 -0
- package/dist/PhoneField-CcQAWwR6.js +28 -0
- package/dist/QRCodeField-CEjWs-J5.js +72 -0
- package/dist/RatingField-B_Mnr63i.js +39 -0
- package/dist/RichTextField-qOEJl5Ai.js +32 -0
- package/dist/SelectField-C8hWu3gm.js +30 -0
- package/dist/SignatureField-CddhEK9u.js +92 -0
- package/dist/SliderField-Df5hMzNc.js +34 -0
- package/dist/SummaryField-DgiFm-Cr.js +19 -0
- package/dist/TextAreaField-DuriTqsD.js +36 -0
- package/dist/TextField-CGNSl7RU.js +29 -0
- package/dist/TimeField-YO58ctFg.js +21 -0
- package/dist/UrlField-1-BMM1jn.js +33 -0
- package/dist/UserField-B6GqxP_S.js +78 -0
- package/dist/VectorField-BkEjbSt0.js +36 -0
- package/dist/index.js +4092 -33
- package/dist/index.umd.cjs +88 -81
- package/dist/plugin-detail.css +3 -1
- package/dist/src/DetailSection.d.ts +10 -0
- package/dist/src/DetailSection.d.ts.map +1 -1
- package/dist/src/HeaderHighlight.d.ts +2 -0
- package/dist/src/HeaderHighlight.d.ts.map +1 -1
- package/dist/src/RecordChatterPanel.d.ts +2 -0
- package/dist/src/RecordChatterPanel.d.ts.map +1 -1
- package/dist/src/autoLayout.d.ts +10 -3
- package/dist/src/autoLayout.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src-CXr1-vVl.js +77662 -0
- package/package.json +10 -10
- package/src/DetailSection.tsx +40 -1
- package/src/DetailView.tsx +1 -1
- package/src/HeaderHighlight.tsx +22 -1
- package/src/RecordChatterPanel.tsx +6 -1
- package/src/RelatedList.tsx +1 -1
- package/src/__tests__/DetailSection.test.tsx +61 -0
- package/src/__tests__/HeaderHighlight.test.tsx +145 -0
- package/src/__tests__/RecordChatterPanel.test.tsx +38 -0
- package/src/__tests__/RelatedList.test.tsx +3 -3
- package/src/__tests__/autoLayout.test.ts +44 -0
- package/src/autoLayout.ts +25 -8
- package/src/index.tsx +1 -1
- package/dist/AddressField-QBIlXCFl.js +0 -96
- package/dist/AutoNumberField-BxnFqllo.js +0 -8
- package/dist/AvatarField-BEZuQTAH.js +0 -82
- package/dist/BooleanField-doa93aFX.js +0 -37
- package/dist/CodeField-jVV-hIXg.js +0 -21
- package/dist/ColorField-B53qKQGW.js +0 -42
- package/dist/CurrencyField-og0NJ2ax.js +0 -43
- package/dist/DateField-BFx64AtG.js +0 -21
- package/dist/DateTimeField-Cxs2Rx2f.js +0 -28
- package/dist/EmailField-BfcpzRe7.js +0 -31
- package/dist/FileField-KarqvhYm.js +0 -133
- package/dist/FormulaField-CJkkwIK8.js +0 -9
- package/dist/GeolocationField-B5SKZaqn.js +0 -123
- package/dist/GridField-DOotrUTo.js +0 -30
- package/dist/ImageField-Ddotp4u-.js +0 -90
- package/dist/LocationField-tOkQaPIM.js +0 -31
- package/dist/LookupField-DF36GvIP.js +0 -96
- package/dist/MasterDetailField-CpHw3nTE.js +0 -108
- package/dist/NumberField-CzBb2a28.js +0 -26
- package/dist/ObjectField-BoL-JqE4.js +0 -48
- package/dist/PasswordField-DrTzkYgj.js +0 -38
- package/dist/PercentField-B9ZUQ3zE.js +0 -63
- package/dist/PhoneField-Bf9lhpdu.js +0 -31
- package/dist/QRCodeField-PzMpdBKd.js +0 -77
- package/dist/RatingField-CeBMFe8o.js +0 -47
- package/dist/RichTextField-Ch7CHSQ0.js +0 -38
- package/dist/SelectField-f5Nbi02x.js +0 -26
- package/dist/SignatureField-CpxTX2tR.js +0 -85
- package/dist/SliderField-BoZtzgcr.js +0 -30
- package/dist/SummaryField-ugYPYxjP.js +0 -9
- package/dist/TextAreaField-rT1DLnV2.js +0 -39
- package/dist/TextField-CflRxusu.js +0 -32
- package/dist/TimeField-DeVeCpRu.js +0 -21
- package/dist/UrlField-UWKfhP9T.js +0 -33
- package/dist/UserField-Cp2zQDjz.js +0 -49
- package/dist/VectorField-CKg9jdGa.js +0 -25
- package/dist/index-V_WBvcaA.js +0 -100249
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import v from "react";
|
|
3
|
-
import { M as g, B as s, t as N, L as h, I as p } from "./index-V_WBvcaA.js";
|
|
4
|
-
function F({ value: x, onChange: r, field: y, readonly: o, ...n }) {
|
|
5
|
-
const [d, l] = v.useState(!1), t = x || {}, c = (e, m) => {
|
|
6
|
-
r({
|
|
7
|
-
...t,
|
|
8
|
-
[e]: m ? Number(m) : void 0
|
|
9
|
-
});
|
|
10
|
-
}, f = () => {
|
|
11
|
-
if (!navigator.geolocation) {
|
|
12
|
-
console.error("Geolocation is not supported by this browser");
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
l(!0), navigator.geolocation.getCurrentPosition(
|
|
16
|
-
(e) => {
|
|
17
|
-
r({
|
|
18
|
-
latitude: e.coords.latitude,
|
|
19
|
-
longitude: e.coords.longitude,
|
|
20
|
-
accuracy: e.coords.accuracy
|
|
21
|
-
}), l(!1);
|
|
22
|
-
},
|
|
23
|
-
(e) => {
|
|
24
|
-
console.error("Error getting location:", e.message), l(!1);
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
enableHighAccuracy: !0,
|
|
28
|
-
timeout: 5e3,
|
|
29
|
-
maximumAge: 0
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}, b = (e) => !e.latitude || !e.longitude ? "-" : `${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`, u = () => {
|
|
33
|
-
if (!t.latitude || !t.longitude) return;
|
|
34
|
-
const e = `https://www.google.com/maps?q=${t.latitude},${t.longitude}`;
|
|
35
|
-
window.open(e, "_blank");
|
|
36
|
-
};
|
|
37
|
-
return o ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
38
|
-
/* @__PURE__ */ i(g, { className: "w-4 h-4 text-muted-foreground" }),
|
|
39
|
-
/* @__PURE__ */ i("span", { className: "text-sm", children: b(t) }),
|
|
40
|
-
t.latitude && t.longitude && /* @__PURE__ */ i(
|
|
41
|
-
s,
|
|
42
|
-
{
|
|
43
|
-
type: "button",
|
|
44
|
-
variant: "link",
|
|
45
|
-
size: "sm",
|
|
46
|
-
onClick: u,
|
|
47
|
-
className: "p-0 h-auto",
|
|
48
|
-
children: "View on map"
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
] }) : /* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
52
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
53
|
-
/* @__PURE__ */ a(
|
|
54
|
-
s,
|
|
55
|
-
{
|
|
56
|
-
type: "button",
|
|
57
|
-
variant: "outline",
|
|
58
|
-
size: "sm",
|
|
59
|
-
onClick: f,
|
|
60
|
-
disabled: o || d,
|
|
61
|
-
children: [
|
|
62
|
-
/* @__PURE__ */ i(N, { className: "w-4 h-4 mr-2" }),
|
|
63
|
-
d ? "Getting location..." : "Use Current Location"
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
),
|
|
67
|
-
t.latitude && t.longitude && /* @__PURE__ */ a(
|
|
68
|
-
s,
|
|
69
|
-
{
|
|
70
|
-
type: "button",
|
|
71
|
-
variant: "link",
|
|
72
|
-
size: "sm",
|
|
73
|
-
onClick: u,
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ i(g, { className: "w-4 h-4 mr-2" }),
|
|
76
|
-
"View on map"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
] }),
|
|
81
|
-
/* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
82
|
-
/* @__PURE__ */ a("div", { children: [
|
|
83
|
-
/* @__PURE__ */ i(h, { htmlFor: "latitude", className: "text-xs", children: "Latitude" }),
|
|
84
|
-
/* @__PURE__ */ i(
|
|
85
|
-
p,
|
|
86
|
-
{
|
|
87
|
-
id: "latitude",
|
|
88
|
-
type: "number",
|
|
89
|
-
value: t.latitude ?? "",
|
|
90
|
-
onChange: (e) => c("latitude", e.target.value),
|
|
91
|
-
placeholder: "37.7749",
|
|
92
|
-
disabled: o || n.disabled,
|
|
93
|
-
step: "any",
|
|
94
|
-
className: n.className
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ a("div", { children: [
|
|
99
|
-
/* @__PURE__ */ i(h, { htmlFor: "longitude", className: "text-xs", children: "Longitude" }),
|
|
100
|
-
/* @__PURE__ */ i(
|
|
101
|
-
p,
|
|
102
|
-
{
|
|
103
|
-
id: "longitude",
|
|
104
|
-
type: "number",
|
|
105
|
-
value: t.longitude ?? "",
|
|
106
|
-
onChange: (e) => c("longitude", e.target.value),
|
|
107
|
-
placeholder: "-122.4194",
|
|
108
|
-
disabled: o || n.disabled,
|
|
109
|
-
step: "any"
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
] })
|
|
113
|
-
] }),
|
|
114
|
-
t.accuracy && /* @__PURE__ */ a("p", { className: "text-xs text-muted-foreground", children: [
|
|
115
|
-
"Accuracy: ±",
|
|
116
|
-
t.accuracy.toFixed(0),
|
|
117
|
-
"m"
|
|
118
|
-
] })
|
|
119
|
-
] });
|
|
120
|
-
}
|
|
121
|
-
export {
|
|
122
|
-
F as GeolocationField
|
|
123
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { o as i } from "./index-V_WBvcaA.js";
|
|
3
|
-
import "react";
|
|
4
|
-
function f({ value: r, field: l, readonly: m, ...s }) {
|
|
5
|
-
const o = (l || s.schema)?.columns || [];
|
|
6
|
-
return !r || !Array.isArray(r) ? /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "-" }) : m ? /* @__PURE__ */ e("div", { className: i("text-sm", s.className), children: /* @__PURE__ */ t("span", { className: "text-foreground", children: [
|
|
7
|
-
r.length,
|
|
8
|
-
" rows"
|
|
9
|
-
] }) }) : /* @__PURE__ */ t("div", { className: i("border border-border rounded-lg overflow-hidden", s.className), children: [
|
|
10
|
-
/* @__PURE__ */ e("div", { className: "overflow-auto max-h-60", children: /* @__PURE__ */ t("table", { className: "w-full text-sm", children: [
|
|
11
|
-
/* @__PURE__ */ e("thead", { className: "bg-muted border-b border-border", children: /* @__PURE__ */ e("tr", { children: o.map((d, n) => /* @__PURE__ */ e(
|
|
12
|
-
"th",
|
|
13
|
-
{
|
|
14
|
-
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
15
|
-
children: d.label || d.name
|
|
16
|
-
},
|
|
17
|
-
n
|
|
18
|
-
)) }) }),
|
|
19
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: r.slice(0, 5).map((d, n) => /* @__PURE__ */ e("tr", { className: "hover:bg-muted/50 transition-colors", children: o.map((a, c) => /* @__PURE__ */ e("td", { className: "px-3 py-2 text-foreground", children: d[a.name] != null ? String(d[a.name]) : "-" }, c)) }, n)) })
|
|
20
|
-
] }) }),
|
|
21
|
-
r.length > 5 && /* @__PURE__ */ t("div", { className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border", children: [
|
|
22
|
-
"Showing 5 of ",
|
|
23
|
-
r.length,
|
|
24
|
-
" rows"
|
|
25
|
-
] })
|
|
26
|
-
] });
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
f as GridField
|
|
30
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as b } from "react";
|
|
3
|
-
import { B as g, X as j, p as z } from "./index-V_WBvcaA.js";
|
|
4
|
-
function R({ value: s, onChange: n, field: u, readonly: h, ...d }) {
|
|
5
|
-
const p = b(null), m = u || d.schema, o = m?.multiple || !1, f = m?.accept ? m.accept.join(",") : "image/*";
|
|
6
|
-
if (h) {
|
|
7
|
-
if (!s) return /* @__PURE__ */ a("span", { className: "text-sm", children: "-" });
|
|
8
|
-
const r = Array.isArray(s) ? s : [s];
|
|
9
|
-
return /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: r.map((e, c) => /* @__PURE__ */ a(
|
|
10
|
-
"img",
|
|
11
|
-
{
|
|
12
|
-
src: e.url || "",
|
|
13
|
-
alt: e.name || `Image ${c + 1}`,
|
|
14
|
-
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
15
|
-
},
|
|
16
|
-
c
|
|
17
|
-
)) });
|
|
18
|
-
}
|
|
19
|
-
const i = s ? Array.isArray(s) ? s : [s] : [], y = (r) => {
|
|
20
|
-
const e = Array.from(r.target.files || []);
|
|
21
|
-
if (e.length === 0) return;
|
|
22
|
-
const c = e.map((t) => ({
|
|
23
|
-
name: t.name,
|
|
24
|
-
original_name: t.name,
|
|
25
|
-
size: t.size,
|
|
26
|
-
mime_type: t.type,
|
|
27
|
-
// In a real implementation, this would upload the image and return a URL
|
|
28
|
-
url: URL.createObjectURL(t)
|
|
29
|
-
}));
|
|
30
|
-
n(o ? [...i, ...c] : c[0]);
|
|
31
|
-
}, N = (r) => {
|
|
32
|
-
if (o) {
|
|
33
|
-
const e = i.filter((c, t) => t !== r);
|
|
34
|
-
n(e.length > 0 ? e : null);
|
|
35
|
-
} else
|
|
36
|
-
n(null);
|
|
37
|
-
};
|
|
38
|
-
return /* @__PURE__ */ l("div", { className: d.className, children: [
|
|
39
|
-
/* @__PURE__ */ a(
|
|
40
|
-
"input",
|
|
41
|
-
{
|
|
42
|
-
ref: p,
|
|
43
|
-
type: "file",
|
|
44
|
-
multiple: o,
|
|
45
|
-
accept: f,
|
|
46
|
-
onChange: y,
|
|
47
|
-
className: "hidden"
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
51
|
-
i.length > 0 && /* @__PURE__ */ a("div", { className: "grid grid-cols-4 gap-2", children: i.map((r, e) => /* @__PURE__ */ l("div", { className: "relative group", children: [
|
|
52
|
-
/* @__PURE__ */ a(
|
|
53
|
-
"img",
|
|
54
|
-
{
|
|
55
|
-
src: r.url || "",
|
|
56
|
-
alt: r.name || `Image ${e + 1}`,
|
|
57
|
-
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ a(
|
|
61
|
-
g,
|
|
62
|
-
{
|
|
63
|
-
type: "button",
|
|
64
|
-
variant: "destructive",
|
|
65
|
-
size: "sm",
|
|
66
|
-
onClick: () => N(e),
|
|
67
|
-
className: "absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
68
|
-
children: /* @__PURE__ */ a(j, { className: "size-3" })
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }, e)) }),
|
|
72
|
-
/* @__PURE__ */ l(
|
|
73
|
-
g,
|
|
74
|
-
{
|
|
75
|
-
type: "button",
|
|
76
|
-
variant: "outline",
|
|
77
|
-
onClick: () => p.current?.click(),
|
|
78
|
-
className: "w-full",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ a(z, { className: "size-4 mr-2" }),
|
|
81
|
-
i.length > 0 ? "Add More Images" : "Upload Image"
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
] })
|
|
86
|
-
] });
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
R as ImageField
|
|
90
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { I as u } from "./index-V_WBvcaA.js";
|
|
3
|
-
import "react";
|
|
4
|
-
function x({ value: t, onChange: i, field: d, readonly: n, ...a }) {
|
|
5
|
-
const m = d || a.schema, s = t && typeof t == "object" ? `${t.latitude || 0}, ${t.longitude || 0}` : "";
|
|
6
|
-
return n ? /* @__PURE__ */ r("span", { className: "text-sm", children: s || "-" }) : /* @__PURE__ */ r(
|
|
7
|
-
u,
|
|
8
|
-
{
|
|
9
|
-
type: "text",
|
|
10
|
-
value: s,
|
|
11
|
-
onChange: (p) => {
|
|
12
|
-
const o = p.target.value;
|
|
13
|
-
if (!o.trim()) {
|
|
14
|
-
i(null);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const l = o.split(",").map((e) => e.trim());
|
|
18
|
-
if (l.length === 2) {
|
|
19
|
-
const e = parseFloat(l[0]), c = parseFloat(l[1]);
|
|
20
|
-
!isNaN(e) && !isNaN(c) && i({ latitude: e, longitude: c });
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
placeholder: m?.placeholder || "latitude, longitude",
|
|
24
|
-
disabled: n || a.disabled,
|
|
25
|
-
className: a.className
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
x as LocationField
|
|
31
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as y } from "react";
|
|
3
|
-
import { h as u, X as D, D as j, i as k, B, j as C, k as O, l as F, m as I, I as L } from "./index-V_WBvcaA.js";
|
|
4
|
-
function R({ value: s, onChange: n, field: x, readonly: g, ...b }) {
|
|
5
|
-
const [N, f] = y(!1), [h, v] = y(""), c = x || b.schema, o = c?.options || [], i = c.multiple || !1, d = c.display_field || "label", p = o.filter(
|
|
6
|
-
(e) => e.label.toLowerCase().includes(h.toLowerCase())
|
|
7
|
-
), t = i ? (Array.isArray(s) ? s : []).map(
|
|
8
|
-
(e) => o.find((a) => a.value === e)
|
|
9
|
-
).filter(Boolean) : s ? [o.find((e) => e.value === s)].filter(Boolean) : [], w = (e) => {
|
|
10
|
-
if (i) {
|
|
11
|
-
const a = Array.isArray(s) ? s : [], m = a.includes(e.value);
|
|
12
|
-
n(m ? a.filter((A) => A !== e.value) : [...a, e.value]);
|
|
13
|
-
} else
|
|
14
|
-
n(e.value), f(!1);
|
|
15
|
-
}, S = (e) => {
|
|
16
|
-
if (i) {
|
|
17
|
-
const a = Array.isArray(s) ? s : [];
|
|
18
|
-
n(a.filter((m) => m !== e));
|
|
19
|
-
} else
|
|
20
|
-
n(null);
|
|
21
|
-
};
|
|
22
|
-
return g ? t.length ? i ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: t.map((e, a) => /* @__PURE__ */ l(u, { variant: "outline", children: e?.[d] || e?.label }, a)) }) : /* @__PURE__ */ l("span", { className: "text-sm", children: t[0]?.[d] || t[0]?.label }) : /* @__PURE__ */ l("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
23
|
-
t.length > 0 && /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: t.map((e, a) => /* @__PURE__ */ r(
|
|
24
|
-
u,
|
|
25
|
-
{
|
|
26
|
-
variant: "outline",
|
|
27
|
-
className: "gap-1",
|
|
28
|
-
children: [
|
|
29
|
-
e?.[d] || e?.label,
|
|
30
|
-
/* @__PURE__ */ l(
|
|
31
|
-
"button",
|
|
32
|
-
{
|
|
33
|
-
onClick: () => S(e?.value),
|
|
34
|
-
className: "ml-1 hover:text-destructive",
|
|
35
|
-
type: "button",
|
|
36
|
-
"aria-label": `Remove ${e?.[d] || e?.label}`,
|
|
37
|
-
children: /* @__PURE__ */ l(D, { className: "size-3" })
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
a
|
|
43
|
-
)) }),
|
|
44
|
-
/* @__PURE__ */ r(j, { open: N, onOpenChange: f, children: [
|
|
45
|
-
/* @__PURE__ */ l(k, { asChild: !0, children: /* @__PURE__ */ r(
|
|
46
|
-
B,
|
|
47
|
-
{
|
|
48
|
-
variant: "outline",
|
|
49
|
-
className: "w-full justify-start text-left font-normal",
|
|
50
|
-
type: "button",
|
|
51
|
-
children: [
|
|
52
|
-
/* @__PURE__ */ l(C, { className: "mr-2 size-4" }),
|
|
53
|
-
t.length === 0 ? c?.placeholder || "Select..." : i ? `${t.length} selected` : "Change selection"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
) }),
|
|
57
|
-
/* @__PURE__ */ r(O, { className: "max-w-md", children: [
|
|
58
|
-
/* @__PURE__ */ l(F, { children: /* @__PURE__ */ r(I, { children: [
|
|
59
|
-
c?.label || "Select",
|
|
60
|
-
" ",
|
|
61
|
-
i && "(multiple)"
|
|
62
|
-
] }) }),
|
|
63
|
-
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
64
|
-
/* @__PURE__ */ l(
|
|
65
|
-
L,
|
|
66
|
-
{
|
|
67
|
-
placeholder: "Search...",
|
|
68
|
-
value: h,
|
|
69
|
-
onChange: (e) => v(e.target.value),
|
|
70
|
-
className: "w-full"
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ l("div", { className: "max-h-64 overflow-y-auto space-y-1", children: p.length === 0 ? /* @__PURE__ */ l("p", { className: "text-sm text-gray-500 text-center py-4", children: "No options found" }) : p.map((e) => {
|
|
74
|
-
const a = i ? (Array.isArray(s) ? s : []).includes(e.value) : s === e.value;
|
|
75
|
-
return /* @__PURE__ */ r(
|
|
76
|
-
"button",
|
|
77
|
-
{
|
|
78
|
-
onClick: () => w(e),
|
|
79
|
-
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${a ? "bg-blue-50 text-blue-700" : ""}`,
|
|
80
|
-
type: "button",
|
|
81
|
-
children: [
|
|
82
|
-
/* @__PURE__ */ l("span", { children: e.label }),
|
|
83
|
-
a && /* @__PURE__ */ l(u, { variant: "default", className: "ml-2", children: "Selected" })
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
e.value
|
|
87
|
-
);
|
|
88
|
-
}) })
|
|
89
|
-
] })
|
|
90
|
-
] })
|
|
91
|
-
] })
|
|
92
|
-
] });
|
|
93
|
-
}
|
|
94
|
-
export {
|
|
95
|
-
R as LookupField
|
|
96
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { B as d, n as c, o, h as f, X as g, P as v } from "./index-V_WBvcaA.js";
|
|
3
|
-
import "react";
|
|
4
|
-
function j({
|
|
5
|
-
value: m,
|
|
6
|
-
onChange: n,
|
|
7
|
-
field: h,
|
|
8
|
-
readonly: u,
|
|
9
|
-
className: r,
|
|
10
|
-
...l
|
|
11
|
-
}) {
|
|
12
|
-
const a = m || [], b = h || l.schema, x = () => {
|
|
13
|
-
const e = {
|
|
14
|
-
id: `new-${Date.now()}`,
|
|
15
|
-
label: "New Related Record"
|
|
16
|
-
};
|
|
17
|
-
n([...a, e]);
|
|
18
|
-
}, p = (e) => {
|
|
19
|
-
n(a.filter((N) => N.id !== e));
|
|
20
|
-
}, i = (e) => {
|
|
21
|
-
console.log("View detail:", e);
|
|
22
|
-
};
|
|
23
|
-
return u ? /* @__PURE__ */ t("div", { className: o("space-y-2", r), children: [
|
|
24
|
-
a.length === 0 ? /* @__PURE__ */ s("span", { className: "text-sm text-muted-foreground", children: "No related records" }) : a.map((e) => /* @__PURE__ */ t(
|
|
25
|
-
"div",
|
|
26
|
-
{
|
|
27
|
-
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ s("span", { className: "text-sm", children: e.label }),
|
|
30
|
-
/* @__PURE__ */ s(
|
|
31
|
-
d,
|
|
32
|
-
{
|
|
33
|
-
type: "button",
|
|
34
|
-
variant: "ghost",
|
|
35
|
-
size: "sm",
|
|
36
|
-
onClick: () => i(e),
|
|
37
|
-
children: /* @__PURE__ */ s(c, { className: "w-4 h-4" })
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
e.id
|
|
43
|
-
)),
|
|
44
|
-
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: [
|
|
45
|
-
a.length,
|
|
46
|
-
" ",
|
|
47
|
-
a.length === 1 ? "record" : "records"
|
|
48
|
-
] })
|
|
49
|
-
] }) : /* @__PURE__ */ t("div", { className: o("space-y-3", r), children: [
|
|
50
|
-
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
51
|
-
a.map((e) => /* @__PURE__ */ t(
|
|
52
|
-
"div",
|
|
53
|
-
{
|
|
54
|
-
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
55
|
-
children: [
|
|
56
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
57
|
-
/* @__PURE__ */ s(f, { variant: "outline", children: e.id }),
|
|
58
|
-
/* @__PURE__ */ s("span", { className: "text-sm flex-1", children: e.label })
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
|
|
61
|
-
/* @__PURE__ */ s(
|
|
62
|
-
d,
|
|
63
|
-
{
|
|
64
|
-
type: "button",
|
|
65
|
-
variant: "ghost",
|
|
66
|
-
size: "sm",
|
|
67
|
-
onClick: () => i(e),
|
|
68
|
-
children: /* @__PURE__ */ s(c, { className: "w-4 h-4" })
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ s(
|
|
72
|
-
d,
|
|
73
|
-
{
|
|
74
|
-
type: "button",
|
|
75
|
-
variant: "ghost",
|
|
76
|
-
size: "sm",
|
|
77
|
-
onClick: () => p(e.id),
|
|
78
|
-
disabled: l.disabled,
|
|
79
|
-
children: /* @__PURE__ */ s(g, { className: "w-4 h-4" })
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
] })
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
e.id
|
|
86
|
-
)),
|
|
87
|
-
a.length === 0 && /* @__PURE__ */ s("div", { className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20", children: "No related records" })
|
|
88
|
-
] }),
|
|
89
|
-
/* @__PURE__ */ t(
|
|
90
|
-
d,
|
|
91
|
-
{
|
|
92
|
-
type: "button",
|
|
93
|
-
variant: "outline",
|
|
94
|
-
className: "w-full",
|
|
95
|
-
onClick: x,
|
|
96
|
-
disabled: l.disabled,
|
|
97
|
-
children: [
|
|
98
|
-
/* @__PURE__ */ s(v, { className: "w-4 h-4 mr-2" }),
|
|
99
|
-
"Add ",
|
|
100
|
-
b?.label || "Record"
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
j as MasterDetailField
|
|
108
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { I as c } from "./index-V_WBvcaA.js";
|
|
3
|
-
import "react";
|
|
4
|
-
function f({ value: e, onChange: p, field: l, readonly: t, ...n }) {
|
|
5
|
-
if (t)
|
|
6
|
-
return /* @__PURE__ */ a("span", { className: "text-sm", children: e ?? "-" });
|
|
7
|
-
const r = l || n.schema, o = r?.precision, { inputType: u, ...s } = n;
|
|
8
|
-
return /* @__PURE__ */ a(
|
|
9
|
-
c,
|
|
10
|
-
{
|
|
11
|
-
...s,
|
|
12
|
-
type: "number",
|
|
13
|
-
value: e ?? "",
|
|
14
|
-
onChange: (m) => {
|
|
15
|
-
const i = m.target.value;
|
|
16
|
-
p(i === "" ? null : Number(i));
|
|
17
|
-
},
|
|
18
|
-
placeholder: r?.placeholder,
|
|
19
|
-
disabled: t || s.disabled,
|
|
20
|
-
step: o ? Math.pow(10, -o) : "any"
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
f as NumberField
|
|
26
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as s, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import { useState as g, useEffect as S } from "react";
|
|
3
|
-
import { o as m, T as y } from "./index-V_WBvcaA.js";
|
|
4
|
-
function j({ value: r, onChange: o, field: u, readonly: c, ...t }) {
|
|
5
|
-
const N = u || t.schema, h = () => r == null ? "" : JSON.stringify(r, null, 2), [e, n] = g(h), [i, d] = g(null);
|
|
6
|
-
return S(() => {
|
|
7
|
-
try {
|
|
8
|
-
if (r == null) {
|
|
9
|
-
n("");
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const l = e ? JSON.parse(e) : null;
|
|
13
|
-
JSON.stringify(l) !== JSON.stringify(r) && n(JSON.stringify(r, null, 2));
|
|
14
|
-
} catch {
|
|
15
|
-
n(JSON.stringify(r, null, 2));
|
|
16
|
-
}
|
|
17
|
-
}, [r, e]), c ? r ? /* @__PURE__ */ s("pre", { className: m("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", t.className), children: JSON.stringify(r, null, 2) }) : /* @__PURE__ */ s("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ x("div", { className: "space-y-1", children: [
|
|
18
|
-
/* @__PURE__ */ s(
|
|
19
|
-
y,
|
|
20
|
-
{
|
|
21
|
-
value: e,
|
|
22
|
-
onChange: (l) => {
|
|
23
|
-
const a = l.target.value;
|
|
24
|
-
if (n(a), d(null), !a.trim()) {
|
|
25
|
-
o(null);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const f = JSON.parse(a);
|
|
30
|
-
o(f);
|
|
31
|
-
} catch {
|
|
32
|
-
d("Invalid JSON");
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
placeholder: N?.placeholder || `{
|
|
36
|
-
"key": "value"
|
|
37
|
-
}`,
|
|
38
|
-
disabled: c || t.disabled,
|
|
39
|
-
className: m("font-mono text-xs", i ? "border-red-500 focus-visible:ring-red-500" : "", t.className),
|
|
40
|
-
rows: 6
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
i && /* @__PURE__ */ s("p", { className: "text-xs text-red-500", children: i })
|
|
44
|
-
] });
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
j as ObjectField
|
|
48
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as s, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { useState as h } from "react";
|
|
3
|
-
import { I as u, B as f, E as g, g as x } from "./index-V_WBvcaA.js";
|
|
4
|
-
function N({ value: o, onChange: l, field: n, readonly: a, className: i, ...t }) {
|
|
5
|
-
const [e, c] = h(!1), p = n || t.schema;
|
|
6
|
-
if (a)
|
|
7
|
-
return /* @__PURE__ */ s("span", { className: "text-sm", children: "••••••••" });
|
|
8
|
-
const { inputType: y, ...r } = t;
|
|
9
|
-
return /* @__PURE__ */ m("div", { className: "relative", children: [
|
|
10
|
-
/* @__PURE__ */ s(
|
|
11
|
-
u,
|
|
12
|
-
{
|
|
13
|
-
...r,
|
|
14
|
-
type: e ? "text" : "password",
|
|
15
|
-
value: o || "",
|
|
16
|
-
onChange: (d) => l(d.target.value),
|
|
17
|
-
placeholder: p?.placeholder,
|
|
18
|
-
disabled: a || r.disabled,
|
|
19
|
-
className: `pr-10 ${i || ""}`
|
|
20
|
-
}
|
|
21
|
-
),
|
|
22
|
-
/* @__PURE__ */ s(
|
|
23
|
-
f,
|
|
24
|
-
{
|
|
25
|
-
type: "button",
|
|
26
|
-
variant: "ghost",
|
|
27
|
-
size: "sm",
|
|
28
|
-
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
29
|
-
onClick: () => c(!e),
|
|
30
|
-
tabIndex: -1,
|
|
31
|
-
children: e ? /* @__PURE__ */ s(g, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ s(x, { className: "size-4 text-gray-500" })
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
] });
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
N as PasswordField
|
|
38
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as i, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { I as g, f as y } from "./index-V_WBvcaA.js";
|
|
3
|
-
import "react";
|
|
4
|
-
function S({ value: e, onChange: s, field: o, readonly: n, errorMessage: u, className: p, ...a }) {
|
|
5
|
-
const m = o || a.schema, r = m?.precision ?? 2;
|
|
6
|
-
if (n)
|
|
7
|
-
return e == null ? /* @__PURE__ */ i("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ d("span", { className: "text-sm font-medium tabular-nums", children: [
|
|
8
|
-
(e * 100).toFixed(r),
|
|
9
|
-
"%"
|
|
10
|
-
] });
|
|
11
|
-
const h = e != null ? e * 100 : "", f = e != null ? e * 100 : 0, x = (t) => {
|
|
12
|
-
if (t.target.value === "") {
|
|
13
|
-
s(null);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const l = parseFloat(t.target.value), c = isNaN(l) ? null : l / 100;
|
|
17
|
-
s(c);
|
|
18
|
-
}, b = (t) => {
|
|
19
|
-
if (n || a.disabled) return;
|
|
20
|
-
if (!Array.isArray(t) || t.length === 0) {
|
|
21
|
-
s(null);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const l = t[0], c = typeof l == "number" ? l / 100 : null;
|
|
25
|
-
s(c);
|
|
26
|
-
}, N = Math.pow(10, -r);
|
|
27
|
-
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
28
|
-
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
29
|
-
/* @__PURE__ */ i(
|
|
30
|
-
g,
|
|
31
|
-
{
|
|
32
|
-
...a,
|
|
33
|
-
type: "number",
|
|
34
|
-
value: h,
|
|
35
|
-
onChange: x,
|
|
36
|
-
placeholder: m?.placeholder || "0",
|
|
37
|
-
disabled: n || a.disabled,
|
|
38
|
-
className: `pr-8 ${p || ""}`,
|
|
39
|
-
step: Math.pow(10, -r).toFixed(r),
|
|
40
|
-
"aria-invalid": !!u
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ i("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: "%" })
|
|
44
|
-
] }),
|
|
45
|
-
/* @__PURE__ */ i(
|
|
46
|
-
y,
|
|
47
|
-
{
|
|
48
|
-
value: [f],
|
|
49
|
-
onValueChange: b,
|
|
50
|
-
min: 0,
|
|
51
|
-
max: 100,
|
|
52
|
-
step: N,
|
|
53
|
-
disabled: n || a.disabled,
|
|
54
|
-
className: "w-full",
|
|
55
|
-
"aria-label": "Percentage",
|
|
56
|
-
"data-testid": "percent-slider"
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
] });
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
S as PercentField
|
|
63
|
-
};
|