@object-ui/plugin-aggrid 4.0.1 → 4.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/AgGridImpl-CAfXf2vU.js +225 -0
  3. package/dist/ObjectAgGridImpl-C-HQaIhp.js +460 -0
  4. package/dist/index.js +21 -16
  5. package/dist/index.umd.cjs +1 -238
  6. package/package.json +7 -7
  7. package/dist/AddressField-CP-8JJvR.js +0 -98
  8. package/dist/AgGridImpl-DiTsK8F6.js +0 -226
  9. package/dist/AutoNumberField-DCL2eUJj.js +0 -14
  10. package/dist/AvatarField-DuaF__ns.js +0 -83
  11. package/dist/BooleanField-0QUz5DOy.js +0 -41
  12. package/dist/CodeField-iTabv7wS.js +0 -23
  13. package/dist/ColorField-R7ZmLj1V.js +0 -38
  14. package/dist/CurrencyField-CEu2SjEj.js +0 -49
  15. package/dist/DateField-DoaPu9GV.js +0 -22
  16. package/dist/DateTimeField-DcKX54zr.js +0 -30
  17. package/dist/EmailField-eYfpFAtE.js +0 -26
  18. package/dist/FileField-DtvoWRK-.js +0 -214
  19. package/dist/FormulaField-DF6-4u2b.js +0 -17
  20. package/dist/GeolocationField-CyzG2dqR.js +0 -161
  21. package/dist/GridField-BFlgbp8W.js +0 -49
  22. package/dist/ImageCropperDialog-BFlbM7vO.js +0 -153
  23. package/dist/ImageField-DoXNtXV_.js +0 -145
  24. package/dist/LocationField-BeYK6K9V.js +0 -36
  25. package/dist/LookupField-DXGCnQ3q.js +0 -1063
  26. package/dist/MasterDetailField-JpmMudRV.js +0 -110
  27. package/dist/NumberField-BYuCxbmU.js +0 -27
  28. package/dist/ObjectAgGridImpl-Bz5whFec.js +0 -20000
  29. package/dist/ObjectField-Dlf_yrMC.js +0 -50
  30. package/dist/PasswordField-40E439oE.js +0 -61
  31. package/dist/PercentField-BvdQEcfn.js +0 -61
  32. package/dist/PhoneField-CBuoC-vs.js +0 -26
  33. package/dist/QRCodeField-CrRsA1vB.js +0 -145
  34. package/dist/RatingField-BVkroiQ4.js +0 -43
  35. package/dist/RichTextField-DEYNcokk.js +0 -33
  36. package/dist/SelectField-K-xoVDss.js +0 -36
  37. package/dist/SignatureField-D0nUx3Cb.js +0 -99
  38. package/dist/SliderField-C2EpGbj8.js +0 -35
  39. package/dist/SummaryField-S6Gt7IDC.js +0 -22
  40. package/dist/TextAreaField-j4eJQ66C.js +0 -125
  41. package/dist/TextField-DccUZtd7.js +0 -30
  42. package/dist/TimeField-CWbpycPt.js +0 -22
  43. package/dist/UrlField-BkPyImh9.js +0 -31
  44. package/dist/UserField-LrhYdvnz.js +0 -77
  45. package/dist/VectorField-Baa_mHsO.js +0 -34
  46. package/dist/check-CBAnx5TO.js +0 -7
  47. package/dist/createLucideIcon-BtZxPlua.js +0 -42
  48. package/dist/crop-2wjrXKXD.js +0 -10
  49. package/dist/dist-BcXWTU-8.js +0 -54
  50. package/dist/index.css +0 -2
  51. package/dist/jsx-runtime-CXSCp6pT.js +0 -180
  52. package/dist/loader-circle-Cxg-xF4u.js +0 -7
  53. package/dist/plus-COkdZ2Fh.js +0 -10
  54. package/dist/rolldown-runtime-CkxV0rQ3.js +0 -14
  55. package/dist/upload-DWhfIa3Y.js +0 -17
  56. package/dist/useFieldTranslation-DtLNhrx3.js +0 -305
  57. package/dist/x-BDi_yYx9.js +0 -10
@@ -1,50 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { useEffect as n, useState as r } from "react";
4
- import { EmptyValue as i, Textarea as a, cn as o } from "@object-ui/components";
5
- //#region ../fields/src/widgets/ObjectField.tsx
6
- var s = /* @__PURE__ */ e({ ObjectField: () => l }), c = t();
7
- function l({ value: e, onChange: t, field: s, readonly: l, ...u }) {
8
- let d = s || u.schema, [f, p] = r(() => e == null ? "" : JSON.stringify(e, null, 2)), [m, h] = r(null);
9
- return n(() => {
10
- try {
11
- if (e == null) {
12
- p("");
13
- return;
14
- }
15
- let t = f ? JSON.parse(f) : null;
16
- JSON.stringify(t) !== JSON.stringify(e) && p(JSON.stringify(e, null, 2));
17
- } catch {
18
- p(JSON.stringify(e, null, 2));
19
- }
20
- }, [e, f]), l ? e ? /* @__PURE__ */ (0, c.jsx)("pre", {
21
- className: o("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", u.className),
22
- children: JSON.stringify(e, null, 2)
23
- }) : /* @__PURE__ */ (0, c.jsx)(i, {}) : /* @__PURE__ */ (0, c.jsxs)("div", {
24
- className: "space-y-1",
25
- children: [/* @__PURE__ */ (0, c.jsx)(a, {
26
- value: f,
27
- onChange: (e) => {
28
- let n = e.target.value;
29
- if (p(n), h(null), !n.trim()) {
30
- t(null);
31
- return;
32
- }
33
- try {
34
- t(JSON.parse(n));
35
- } catch {
36
- h("Invalid JSON");
37
- }
38
- },
39
- placeholder: d?.placeholder || "{\n \"key\": \"value\"\n}",
40
- disabled: l || u.disabled,
41
- className: o("font-mono text-xs", m ? "border-red-500 focus-visible:ring-red-500" : "", u.className),
42
- rows: 6
43
- }), m && /* @__PURE__ */ (0, c.jsx)("p", {
44
- className: "text-xs text-red-500",
45
- children: m
46
- })]
47
- });
48
- }
49
- //#endregion
50
- export { s as t };
@@ -1,61 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./createLucideIcon-BtZxPlua.js";
4
- import { useState as r } from "react";
5
- import { Button as i, Input as a } from "@object-ui/components";
6
- var o = n("eye-off", [
7
- ["path", {
8
- d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
9
- key: "ct8e1f"
10
- }],
11
- ["path", {
12
- d: "M14.084 14.158a3 3 0 0 1-4.242-4.242",
13
- key: "151rxh"
14
- }],
15
- ["path", {
16
- d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
17
- key: "13bj9a"
18
- }],
19
- ["path", {
20
- d: "m2 2 20 20",
21
- key: "1ooewy"
22
- }]
23
- ]), s = n("eye", [["path", {
24
- d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
25
- key: "1nclc0"
26
- }], ["circle", {
27
- cx: "12",
28
- cy: "12",
29
- r: "3",
30
- key: "1v7zrd"
31
- }]]), c = /* @__PURE__ */ e({ PasswordField: () => u }), l = t();
32
- function u({ value: e, onChange: t, field: n, readonly: c, className: u, ...d }) {
33
- let [f, p] = r(!1), m = n || d.schema;
34
- if (c) return /* @__PURE__ */ (0, l.jsx)("span", {
35
- className: "text-sm",
36
- children: "••••••••"
37
- });
38
- let { inputType: h, ...g } = d;
39
- return /* @__PURE__ */ (0, l.jsxs)("div", {
40
- className: "relative",
41
- children: [/* @__PURE__ */ (0, l.jsx)(a, {
42
- ...g,
43
- type: f ? "text" : "password",
44
- value: e || "",
45
- onChange: (e) => t(e.target.value),
46
- placeholder: m?.placeholder,
47
- disabled: c || g.disabled,
48
- className: `pr-10 ${u || ""}`
49
- }), /* @__PURE__ */ (0, l.jsx)(i, {
50
- type: "button",
51
- variant: "ghost",
52
- size: "sm",
53
- className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
54
- onClick: () => p(!f),
55
- tabIndex: -1,
56
- children: f ? /* @__PURE__ */ (0, l.jsx)(o, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ (0, l.jsx)(s, { className: "size-4 text-gray-500" })
57
- })]
58
- });
59
- }
60
- //#endregion
61
- export { c as n, u as t };
@@ -1,61 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import "react";
4
- import { EmptyValue as n, Input as r, Slider as i } from "@object-ui/components";
5
- //#region ../fields/src/widgets/PercentField.tsx
6
- var a = /* @__PURE__ */ e({ PercentField: () => s }), o = t();
7
- function s({ value: e, onChange: t, field: a, readonly: s, errorMessage: c, className: l, ...u }) {
8
- let d = a || u.schema, f = d?.precision ?? 2;
9
- if (s) return e == null ? /* @__PURE__ */ (0, o.jsx)(n, {}) : /* @__PURE__ */ (0, o.jsxs)("span", {
10
- className: "text-sm font-medium tabular-nums",
11
- children: [(e * 100).toFixed(f), "%"]
12
- });
13
- let p = e == null ? "" : e * 100, m = e == null ? 0 : e * 100, h = (e) => {
14
- if (e.target.value === "") {
15
- t(null);
16
- return;
17
- }
18
- let n = parseFloat(e.target.value);
19
- t(isNaN(n) ? null : n / 100);
20
- }, g = (e) => {
21
- if (s || u.disabled) return;
22
- if (!Array.isArray(e) || e.length === 0) {
23
- t(null);
24
- return;
25
- }
26
- let n = e[0];
27
- t(typeof n == "number" ? n / 100 : null);
28
- }, _ = 10 ** -f;
29
- return /* @__PURE__ */ (0, o.jsxs)("div", {
30
- className: "space-y-2",
31
- children: [/* @__PURE__ */ (0, o.jsxs)("div", {
32
- className: "relative",
33
- children: [/* @__PURE__ */ (0, o.jsx)(r, {
34
- ...u,
35
- type: "number",
36
- value: p,
37
- onChange: h,
38
- placeholder: d?.placeholder || "0",
39
- disabled: s || u.disabled,
40
- className: `pr-8 ${l || ""}`,
41
- step: (10 ** -f).toFixed(f),
42
- "aria-invalid": !!c
43
- }), /* @__PURE__ */ (0, o.jsx)("span", {
44
- className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
45
- children: "%"
46
- })]
47
- }), /* @__PURE__ */ (0, o.jsx)(i, {
48
- value: [m],
49
- onValueChange: g,
50
- min: 0,
51
- max: 100,
52
- step: _,
53
- disabled: s || u.disabled,
54
- className: "w-full",
55
- "aria-label": "Percentage",
56
- "data-testid": "percent-slider"
57
- })]
58
- });
59
- }
60
- //#endregion
61
- export { a as n, s as t };
@@ -1,26 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import "react";
4
- import { EmptyValue as n, Input as r } from "@object-ui/components";
5
- //#region ../fields/src/widgets/PhoneField.tsx
6
- var i = /* @__PURE__ */ e({ PhoneField: () => o }), a = t();
7
- function o({ value: e, onChange: t, field: i, readonly: o, errorMessage: s, ...c }) {
8
- let l = i || c.schema;
9
- if (o) return e ? /* @__PURE__ */ (0, a.jsx)("a", {
10
- href: `tel:${e}`,
11
- className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
12
- children: e
13
- }) : /* @__PURE__ */ (0, a.jsx)(n, {});
14
- let { inputType: u, ...d } = c;
15
- return /* @__PURE__ */ (0, a.jsx)(r, {
16
- ...d,
17
- type: "tel",
18
- value: e || "",
19
- onChange: (e) => t(e.target.value),
20
- placeholder: l?.placeholder || "(555) 123-4567",
21
- disabled: o || d.disabled,
22
- "aria-invalid": !!s
23
- });
24
- }
25
- //#endregion
26
- export { i as n, o as t };
@@ -1,145 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./createLucideIcon-BtZxPlua.js";
4
- import r from "react";
5
- import { Button as i, EmptyValue as a, Input as o } from "@object-ui/components";
6
- var s = n("copy", [["rect", {
7
- width: "14",
8
- height: "14",
9
- x: "8",
10
- y: "8",
11
- rx: "2",
12
- ry: "2",
13
- key: "17jyea"
14
- }], ["path", {
15
- d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
16
- key: "zix9uf"
17
- }]]), c = n("qr-code", [
18
- ["rect", {
19
- width: "5",
20
- height: "5",
21
- x: "3",
22
- y: "3",
23
- rx: "1",
24
- key: "1tu5fj"
25
- }],
26
- ["rect", {
27
- width: "5",
28
- height: "5",
29
- x: "16",
30
- y: "3",
31
- rx: "1",
32
- key: "1v8r4q"
33
- }],
34
- ["rect", {
35
- width: "5",
36
- height: "5",
37
- x: "3",
38
- y: "16",
39
- rx: "1",
40
- key: "1x03jg"
41
- }],
42
- ["path", {
43
- d: "M21 16h-3a2 2 0 0 0-2 2v3",
44
- key: "177gqh"
45
- }],
46
- ["path", {
47
- d: "M21 21v.01",
48
- key: "ents32"
49
- }],
50
- ["path", {
51
- d: "M12 7v3a2 2 0 0 1-2 2H7",
52
- key: "8crl2c"
53
- }],
54
- ["path", {
55
- d: "M3 12h.01",
56
- key: "nlz23k"
57
- }],
58
- ["path", {
59
- d: "M12 3h.01",
60
- key: "n36tog"
61
- }],
62
- ["path", {
63
- d: "M12 16v.01",
64
- key: "133mhm"
65
- }],
66
- ["path", {
67
- d: "M16 12h1",
68
- key: "1slzba"
69
- }],
70
- ["path", {
71
- d: "M21 12v.01",
72
- key: "1lwtk9"
73
- }],
74
- ["path", {
75
- d: "M12 21v-1",
76
- key: "1880an"
77
- }]
78
- ]), l = /* @__PURE__ */ e({ QRCodeField: () => d }), u = t();
79
- function d({ value: e, onChange: t, field: n, readonly: l, ...d }) {
80
- let [f, p] = r.useState(!1), m = n || d.schema;
81
- return l ? /* @__PURE__ */ (0, u.jsxs)("div", {
82
- className: "flex items-center gap-3",
83
- children: [/* @__PURE__ */ (0, u.jsx)("span", {
84
- className: "text-sm flex-1 truncate",
85
- children: e || /* @__PURE__ */ (0, u.jsx)(a, {})
86
- }), e && /* @__PURE__ */ (0, u.jsxs)(i, {
87
- type: "button",
88
- variant: "outline",
89
- size: "sm",
90
- onClick: () => p(!f),
91
- children: [
92
- /* @__PURE__ */ (0, u.jsx)(c, { className: "w-4 h-4 mr-2" }),
93
- f ? "Hide" : "Show",
94
- " QR"
95
- ]
96
- })]
97
- }) : /* @__PURE__ */ (0, u.jsxs)("div", {
98
- className: "space-y-3",
99
- children: [
100
- /* @__PURE__ */ (0, u.jsxs)("div", {
101
- className: "flex items-center gap-2",
102
- children: [/* @__PURE__ */ (0, u.jsx)(o, {
103
- type: "text",
104
- value: e || "",
105
- onChange: (e) => t(e.target.value),
106
- placeholder: m?.placeholder || "Enter text for QR code",
107
- disabled: l || d.disabled,
108
- className: d.className
109
- }), e && /* @__PURE__ */ (0, u.jsxs)(u.Fragment, { children: [/* @__PURE__ */ (0, u.jsx)(i, {
110
- type: "button",
111
- variant: "outline",
112
- size: "sm",
113
- onClick: () => {
114
- e && navigator.clipboard.writeText(e);
115
- },
116
- children: /* @__PURE__ */ (0, u.jsx)(s, { className: "w-4 h-4" })
117
- }), /* @__PURE__ */ (0, u.jsx)(i, {
118
- type: "button",
119
- variant: "outline",
120
- size: "sm",
121
- onClick: () => p(!f),
122
- children: /* @__PURE__ */ (0, u.jsx)(c, { className: "w-4 h-4" })
123
- })] })]
124
- }),
125
- f && e && /* @__PURE__ */ (0, u.jsx)("div", {
126
- className: "border rounded p-4 bg-white flex justify-center",
127
- children: /* @__PURE__ */ (0, u.jsx)("img", {
128
- src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(e),
129
- alt: "QR Code",
130
- className: "w-48 h-48"
131
- })
132
- }),
133
- e && /* @__PURE__ */ (0, u.jsxs)("p", {
134
- className: "text-xs text-muted-foreground",
135
- children: [
136
- "QR code contains: ",
137
- e.length,
138
- " characters"
139
- ]
140
- })
141
- ]
142
- });
143
- }
144
- //#endregion
145
- export { s as n, l as t };
@@ -1,43 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./createLucideIcon-BtZxPlua.js";
4
- import r from "react";
5
- import { cn as i } from "@object-ui/components";
6
- var a = n("star", [["path", {
7
- d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
8
- key: "r04s7s"
9
- }]]), o = /* @__PURE__ */ e({ RatingField: () => c }), s = t();
10
- function c({ value: e, onChange: t, field: n, readonly: o, className: c, ...l }) {
11
- let u = (n || l.schema)?.max ?? 5, d = e ?? 0, [f, p] = r.useState(null), m = f === null ? d : f;
12
- return o ? /* @__PURE__ */ (0, s.jsxs)("div", {
13
- className: i("flex items-center gap-1", c),
14
- children: [Array.from({ length: u }, (e, t) => /* @__PURE__ */ (0, s.jsx)(a, { className: `w-5 h-5 ${t < d ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ (0, s.jsxs)("span", {
15
- className: "ml-2 text-sm text-muted-foreground",
16
- children: [
17
- d,
18
- " / ",
19
- u
20
- ]
21
- })]
22
- }) : /* @__PURE__ */ (0, s.jsxs)("div", {
23
- className: i("flex items-center gap-1", c),
24
- children: [Array.from({ length: u }, (e, n) => /* @__PURE__ */ (0, s.jsx)("button", {
25
- type: "button",
26
- onClick: () => t(n + 1),
27
- onMouseEnter: () => p(n + 1),
28
- onMouseLeave: () => p(null),
29
- className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
30
- disabled: o || l.disabled,
31
- children: /* @__PURE__ */ (0, s.jsx)(a, { className: `w-5 h-5 transition-colors ${n < m ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
32
- }, n)), /* @__PURE__ */ (0, s.jsxs)("span", {
33
- className: "ml-2 text-sm text-muted-foreground",
34
- children: [
35
- d,
36
- " / ",
37
- u
38
- ]
39
- })]
40
- });
41
- }
42
- //#endregion
43
- export { o as n, c as t };
@@ -1,33 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import "react";
4
- import { EmptyValue as n, Textarea as r } from "@object-ui/components";
5
- //#region ../fields/src/widgets/RichTextField.tsx
6
- var i = /* @__PURE__ */ e({ RichTextField: () => o }), a = t();
7
- function o({ value: e, onChange: t, field: i, readonly: o, errorMessage: s, ...c }) {
8
- if (o) return /* @__PURE__ */ (0, a.jsx)("div", {
9
- className: "text-sm prose prose-sm max-w-none",
10
- children: e || /* @__PURE__ */ (0, a.jsx)(n, {})
11
- });
12
- let l = i || c.schema, u = l?.rows || 8;
13
- return /* @__PURE__ */ (0, a.jsxs)("div", {
14
- className: "space-y-2",
15
- children: [/* @__PURE__ */ (0, a.jsxs)("div", {
16
- className: "flex items-center justify-between text-xs text-gray-500",
17
- children: [/* @__PURE__ */ (0, a.jsxs)("span", { children: ["Format: ", l?.format || "markdown"] }), /* @__PURE__ */ (0, a.jsx)("span", {
18
- className: "italic",
19
- children: "Rich text editor (basic)"
20
- })]
21
- }), /* @__PURE__ */ (0, a.jsx)(r, {
22
- value: e || "",
23
- onChange: (e) => t(e.target.value),
24
- placeholder: l?.placeholder || "Enter text...",
25
- disabled: o || c.disabled,
26
- rows: u,
27
- className: `font-mono text-sm ${c.className || ""}`,
28
- "aria-invalid": !!s
29
- })]
30
- });
31
- }
32
- //#endregion
33
- export { i as t };
@@ -1,36 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./useFieldTranslation-DtLNhrx3.js";
4
- import "react";
5
- import { EmptyValue as r, Select as i, SelectContent as a, SelectItem as o, SelectTrigger as s, SelectValue as c } from "@object-ui/components";
6
- //#region ../fields/src/widgets/SelectField.tsx
7
- var l = /* @__PURE__ */ e({ SelectField: () => d }), u = t();
8
- function d({ value: e, onChange: t, field: l, readonly: d, ...f }) {
9
- let p = l || f.schema, m = p?.options || [], { t: h } = n();
10
- if (d) {
11
- let t = m.find((t) => t.value === e)?.label || e;
12
- return t ? /* @__PURE__ */ (0, u.jsx)("span", {
13
- className: "text-sm",
14
- children: t
15
- }) : /* @__PURE__ */ (0, u.jsx)(r, {});
16
- }
17
- return /* @__PURE__ */ (0, u.jsxs)(i, {
18
- ...f,
19
- value: e,
20
- onValueChange: t,
21
- disabled: d || f.disabled,
22
- children: [/* @__PURE__ */ (0, u.jsx)(s, {
23
- className: f.className,
24
- id: f.id,
25
- children: /* @__PURE__ */ (0, u.jsx)(c, { placeholder: p?.placeholder || h("common.selectOption") })
26
- }), /* @__PURE__ */ (0, u.jsx)(a, {
27
- position: "popper",
28
- children: m.map((e) => /* @__PURE__ */ (0, u.jsx)(o, {
29
- value: e.value,
30
- children: e.label
31
- }, e.value))
32
- })]
33
- });
34
- }
35
- //#endregion
36
- export { l as n, d as t };
@@ -1,99 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./createLucideIcon-BtZxPlua.js";
4
- import r, { useEffect as i, useRef as a } from "react";
5
- import { Button as o } from "@object-ui/components";
6
- var s = n("eraser", [["path", {
7
- d: "M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",
8
- key: "g5wo59"
9
- }], ["path", {
10
- d: "m5.082 11.09 8.828 8.828",
11
- key: "1wx5vj"
12
- }]]), c = /* @__PURE__ */ e({ SignatureField: () => u }), l = t();
13
- function u({ value: e, onChange: t, readonly: n }) {
14
- let c = a(null), [u, d] = r.useState(!1), [f, p] = r.useState(!e);
15
- i(() => {
16
- if (e && c.current) {
17
- let t = c.current.getContext("2d");
18
- if (t) {
19
- let n = new Image();
20
- n.onload = () => {
21
- t.drawImage(n, 0, 0), p(!1);
22
- }, n.src = e;
23
- }
24
- }
25
- }, [e]);
26
- let m = (e) => {
27
- if (n) return;
28
- d(!0), p(!1);
29
- let t = c.current;
30
- if (!t) return;
31
- let r = t.getContext("2d");
32
- if (!r) return;
33
- let i = t.getBoundingClientRect(), a = "touches" in e ? e.touches[0].clientX - i.left : e.clientX - i.left, o = "touches" in e ? e.touches[0].clientY - i.top : e.clientY - i.top;
34
- r.beginPath(), r.moveTo(a, o);
35
- }, h = (e) => {
36
- if (!u || n) return;
37
- let t = c.current;
38
- if (!t) return;
39
- let r = t.getContext("2d");
40
- if (!r) return;
41
- let i = t.getBoundingClientRect(), a = "touches" in e ? e.touches[0].clientX - i.left : e.clientX - i.left, o = "touches" in e ? e.touches[0].clientY - i.top : e.clientY - i.top;
42
- r.lineTo(a, o), r.strokeStyle = "#000", r.lineWidth = 2, r.lineCap = "round", r.lineJoin = "round", r.stroke();
43
- }, g = () => {
44
- if (!u) return;
45
- d(!1);
46
- let e = c.current;
47
- e && t(e.toDataURL("image/png"));
48
- };
49
- return n && e ? /* @__PURE__ */ (0, l.jsx)("div", {
50
- className: "border rounded p-2 bg-white",
51
- children: /* @__PURE__ */ (0, l.jsx)("img", {
52
- src: e,
53
- alt: "Signature",
54
- loading: "lazy",
55
- className: "max-w-full h-auto"
56
- })
57
- }) : n && !e ? /* @__PURE__ */ (0, l.jsx)("span", {
58
- className: "text-sm text-muted-foreground",
59
- children: "No signature"
60
- }) : /* @__PURE__ */ (0, l.jsxs)("div", {
61
- className: "space-y-2",
62
- children: [/* @__PURE__ */ (0, l.jsx)("div", {
63
- className: "border rounded bg-white",
64
- children: /* @__PURE__ */ (0, l.jsx)("canvas", {
65
- ref: c,
66
- width: 400,
67
- height: 200,
68
- className: "w-full touch-none cursor-crosshair",
69
- onMouseDown: m,
70
- onMouseMove: h,
71
- onMouseUp: g,
72
- onMouseLeave: g,
73
- onTouchStart: m,
74
- onTouchMove: h,
75
- onTouchEnd: g
76
- })
77
- }), /* @__PURE__ */ (0, l.jsxs)("div", {
78
- className: "flex justify-between items-center",
79
- children: [/* @__PURE__ */ (0, l.jsx)("p", {
80
- className: "text-xs text-muted-foreground",
81
- children: f ? "Sign above" : "Signature captured"
82
- }), /* @__PURE__ */ (0, l.jsxs)(o, {
83
- type: "button",
84
- variant: "outline",
85
- size: "sm",
86
- onClick: () => {
87
- let e = c.current;
88
- if (!e) return;
89
- let n = e.getContext("2d");
90
- n && (n.clearRect(0, 0, e.width, e.height), p(!0), t(""));
91
- },
92
- disabled: n || f,
93
- children: [/* @__PURE__ */ (0, l.jsx)(s, { className: "w-4 h-4 mr-2" }), "Clear"]
94
- })]
95
- })]
96
- });
97
- }
98
- //#endregion
99
- export { c as t };
@@ -1,35 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import "react";
4
- import { Slider as n } from "@object-ui/components";
5
- //#region ../fields/src/widgets/SliderField.tsx
6
- var r = /* @__PURE__ */ e({ SliderField: () => a }), i = t();
7
- function a({ value: e, onChange: t, field: r, readonly: a, ...o }) {
8
- let s = r || o.schema, c = s?.min ?? 0, l = s?.max ?? 100, u = s?.step ?? 1;
9
- return a ? /* @__PURE__ */ (0, i.jsxs)("div", {
10
- className: "flex items-center gap-2",
11
- children: [/* @__PURE__ */ (0, i.jsx)("span", {
12
- className: "text-sm font-medium",
13
- children: e ?? c
14
- }), /* @__PURE__ */ (0, i.jsxs)("span", {
15
- className: "text-xs text-muted-foreground",
16
- children: ["/ ", l]
17
- })]
18
- }) : /* @__PURE__ */ (0, i.jsxs)("div", {
19
- className: "flex items-center gap-4",
20
- children: [/* @__PURE__ */ (0, i.jsx)(n, {
21
- value: [e ?? c],
22
- onValueChange: (e) => t(e[0]),
23
- min: c,
24
- max: l,
25
- step: u,
26
- disabled: a || o.disabled,
27
- className: o.className
28
- }), /* @__PURE__ */ (0, i.jsx)("span", {
29
- className: "text-sm font-medium w-12 text-right",
30
- children: e ?? c
31
- })]
32
- });
33
- }
34
- //#endregion
35
- export { r as n, a as t };
@@ -1,22 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import "react";
4
- import { EmptyValue as n } from "@object-ui/components";
5
- //#region ../fields/src/widgets/SummaryField.tsx
6
- var r = /* @__PURE__ */ e({ SummaryField: () => a }), i = t();
7
- function a({ value: e, field: t, ...r }) {
8
- let a = (t || r.schema)?.summary_type || "count";
9
- if (e == null) return /* @__PURE__ */ (0, i.jsx)(n, { className: r.className });
10
- let o;
11
- return o = a === "count" ? String(e) : [
12
- "sum",
13
- "avg",
14
- "min",
15
- "max"
16
- ].includes(a) && typeof e == "number" ? e.toFixed(2) : String(e), /* @__PURE__ */ (0, i.jsx)("span", {
17
- className: `text-sm font-medium tabular-nums text-gray-700 ${r.className || ""}`,
18
- children: o
19
- });
20
- }
21
- //#endregion
22
- export { r as t };