@object-ui/plugin-aggrid 0.5.0 → 2.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.
Files changed (36) hide show
  1. package/.turbo/turbo-build.log +90 -12
  2. package/CHANGELOG.md +16 -0
  3. package/QUICKSTART.md +1 -1
  4. package/dist/AddressField-Bntpynvd.js +95 -0
  5. package/dist/AgGridImpl-3Mmf2qrR.js +229 -0
  6. package/dist/AutoNumberField-C1kBJaxh.js +8 -0
  7. package/dist/FileField-BDwbJvor.js +101 -0
  8. package/dist/FormulaField-BXNiyGoh.js +9 -0
  9. package/dist/GeolocationField-Df3yYcM9.js +141 -0
  10. package/dist/GridField-CcjQp4WM.js +29 -0
  11. package/dist/LocationField-BIfN5QIq.js +33 -0
  12. package/dist/MasterDetailField-CAEmxbIT.js +117 -0
  13. package/dist/ObjectAgGridImpl-EjifM4aY.js +28727 -0
  14. package/dist/ObjectField-BpkQpIF-.js +51 -0
  15. package/dist/QRCodeField-VCBewTDG.js +96 -0
  16. package/dist/RichTextField-CyQwSi2C.js +37 -0
  17. package/dist/SignatureField-Cr4tsEbj.js +96 -0
  18. package/dist/SummaryField-CnEJ_GZI.js +9 -0
  19. package/dist/UserField-DJjaVyrV.js +49 -0
  20. package/dist/VectorField-cPYmcKnV.js +25 -0
  21. package/dist/{index-CLKYMco3.js → index-B87wd1E0.js} +57 -33
  22. package/dist/index.js +1 -1
  23. package/dist/index.umd.cjs +225 -5
  24. package/dist/src/AgGridImpl.d.ts +5 -2
  25. package/dist/src/field-renderers.d.ts +67 -0
  26. package/dist/src/index.d.ts +5 -2
  27. package/dist/src/types.d.ts +48 -1
  28. package/package.json +8 -7
  29. package/src/AgGridImpl.tsx +95 -10
  30. package/src/ObjectAgGridImpl.tsx +67 -169
  31. package/src/field-renderers.test.tsx +383 -0
  32. package/src/field-renderers.tsx +224 -0
  33. package/src/index.tsx +30 -3
  34. package/src/types.ts +57 -1
  35. package/dist/AgGridImpl-BQ6tBvrq.js +0 -175
  36. package/dist/ObjectAgGridImpl-CGFeGvOH.js +0 -372
@@ -0,0 +1,141 @@
1
+ import { j as t } from "./index-B87wd1E0.js";
2
+ import f from "react";
3
+ import { Button as n, Label as m, Input as x } from "@object-ui/components";
4
+ import { c as h } from "./ObjectAgGridImpl-EjifM4aY.js";
5
+ const b = [
6
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
7
+ ["line", { x1: "22", x2: "18", y1: "12", y2: "12", key: "l9bcsi" }],
8
+ ["line", { x1: "6", x2: "2", y1: "12", y2: "12", key: "13hhkx" }],
9
+ ["line", { x1: "12", x2: "12", y1: "6", y2: "2", key: "10w3f3" }],
10
+ ["line", { x1: "12", x2: "12", y1: "22", y2: "18", key: "15g9kq" }]
11
+ ], N = h("crosshair", b);
12
+ const v = [
13
+ [
14
+ "path",
15
+ {
16
+ d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
17
+ key: "1r0f0z"
18
+ }
19
+ ],
20
+ ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
21
+ ], g = h("map-pin", v);
22
+ function _({ value: p, onChange: c, field: k, readonly: a, ...s }) {
23
+ const [l, o] = f.useState(!1), i = p || {}, r = (e, u) => {
24
+ c({
25
+ ...i,
26
+ [e]: u ? Number(u) : void 0
27
+ });
28
+ }, y = () => {
29
+ if (!navigator.geolocation) {
30
+ console.error("Geolocation is not supported by this browser");
31
+ return;
32
+ }
33
+ o(!0), navigator.geolocation.getCurrentPosition(
34
+ (e) => {
35
+ c({
36
+ latitude: e.coords.latitude,
37
+ longitude: e.coords.longitude,
38
+ accuracy: e.coords.accuracy
39
+ }), o(!1);
40
+ },
41
+ (e) => {
42
+ console.error("Error getting location:", e.message), o(!1);
43
+ },
44
+ {
45
+ enableHighAccuracy: !0,
46
+ timeout: 5e3,
47
+ maximumAge: 0
48
+ }
49
+ );
50
+ }, j = (e) => !e.latitude || !e.longitude ? "-" : `${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`, d = () => {
51
+ if (!i.latitude || !i.longitude) return;
52
+ const e = `https://www.google.com/maps?q=${i.latitude},${i.longitude}`;
53
+ window.open(e, "_blank");
54
+ };
55
+ return a ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
56
+ /* @__PURE__ */ t.jsx(g, { className: "w-4 h-4 text-muted-foreground" }),
57
+ /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: j(i) }),
58
+ i.latitude && i.longitude && /* @__PURE__ */ t.jsx(
59
+ n,
60
+ {
61
+ type: "button",
62
+ variant: "link",
63
+ size: "sm",
64
+ onClick: d,
65
+ className: "p-0 h-auto",
66
+ children: "View on map"
67
+ }
68
+ )
69
+ ] }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-3", children: [
70
+ /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
71
+ /* @__PURE__ */ t.jsxs(
72
+ n,
73
+ {
74
+ type: "button",
75
+ variant: "outline",
76
+ size: "sm",
77
+ onClick: y,
78
+ disabled: a || l,
79
+ children: [
80
+ /* @__PURE__ */ t.jsx(N, { className: "w-4 h-4 mr-2" }),
81
+ l ? "Getting location..." : "Use Current Location"
82
+ ]
83
+ }
84
+ ),
85
+ i.latitude && i.longitude && /* @__PURE__ */ t.jsxs(
86
+ n,
87
+ {
88
+ type: "button",
89
+ variant: "link",
90
+ size: "sm",
91
+ onClick: d,
92
+ children: [
93
+ /* @__PURE__ */ t.jsx(g, { className: "w-4 h-4 mr-2" }),
94
+ "View on map"
95
+ ]
96
+ }
97
+ )
98
+ ] }),
99
+ /* @__PURE__ */ t.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
100
+ /* @__PURE__ */ t.jsxs("div", { children: [
101
+ /* @__PURE__ */ t.jsx(m, { htmlFor: "latitude", className: "text-xs", children: "Latitude" }),
102
+ /* @__PURE__ */ t.jsx(
103
+ x,
104
+ {
105
+ id: "latitude",
106
+ type: "number",
107
+ value: i.latitude ?? "",
108
+ onChange: (e) => r("latitude", e.target.value),
109
+ placeholder: "37.7749",
110
+ disabled: a || s.disabled,
111
+ step: "any",
112
+ className: s.className
113
+ }
114
+ )
115
+ ] }),
116
+ /* @__PURE__ */ t.jsxs("div", { children: [
117
+ /* @__PURE__ */ t.jsx(m, { htmlFor: "longitude", className: "text-xs", children: "Longitude" }),
118
+ /* @__PURE__ */ t.jsx(
119
+ x,
120
+ {
121
+ id: "longitude",
122
+ type: "number",
123
+ value: i.longitude ?? "",
124
+ onChange: (e) => r("longitude", e.target.value),
125
+ placeholder: "-122.4194",
126
+ disabled: a || s.disabled,
127
+ step: "any"
128
+ }
129
+ )
130
+ ] })
131
+ ] }),
132
+ i.accuracy && /* @__PURE__ */ t.jsxs("p", { className: "text-xs text-muted-foreground", children: [
133
+ "Accuracy: ±",
134
+ i.accuracy.toFixed(0),
135
+ "m"
136
+ ] })
137
+ ] });
138
+ }
139
+ export {
140
+ _ as GeolocationField
141
+ };
@@ -0,0 +1,29 @@
1
+ import { j as e } from "./index-B87wd1E0.js";
2
+ import { cn as l } from "@object-ui/components";
3
+ function g({ value: r, field: n, readonly: m, ...a }) {
4
+ const d = (n || a.schema)?.columns || [];
5
+ return !r || !Array.isArray(r) ? /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500", children: "-" }) : m ? /* @__PURE__ */ e.jsx("div", { className: l("text-sm", a.className), children: /* @__PURE__ */ e.jsxs("span", { className: "text-gray-700", children: [
6
+ r.length,
7
+ " rows"
8
+ ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: l("border border-gray-200 rounded-md overflow-hidden", a.className), children: [
9
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-auto max-h-60", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
10
+ /* @__PURE__ */ e.jsx("thead", { className: "bg-gray-50 border-b border-gray-200", children: /* @__PURE__ */ e.jsx("tr", { children: d.map((s, t) => /* @__PURE__ */ e.jsx(
11
+ "th",
12
+ {
13
+ className: "px-3 py-2 text-left text-xs font-medium text-gray-700",
14
+ children: s.label || s.name
15
+ },
16
+ t
17
+ )) }) }),
18
+ /* @__PURE__ */ e.jsx("tbody", { className: "divide-y divide-gray-200", children: r.slice(0, 5).map((s, t) => /* @__PURE__ */ e.jsx("tr", { className: "hover:bg-gray-50", children: d.map((i, c) => /* @__PURE__ */ e.jsx("td", { className: "px-3 py-2 text-gray-900", children: s[i.name] != null ? String(s[i.name]) : "-" }, c)) }, t)) })
19
+ ] }) }),
20
+ r.length > 5 && /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200", children: [
21
+ "Showing 5 of ",
22
+ r.length,
23
+ " rows"
24
+ ] })
25
+ ] });
26
+ }
27
+ export {
28
+ g as GridField
29
+ };
@@ -0,0 +1,33 @@
1
+ import { j as r } from "./index-B87wd1E0.js";
2
+ import { Input as f } from "@object-ui/components";
3
+ function x({ value: t, onChange: l, field: d, readonly: i, ...a }) {
4
+ const m = d || a.schema, n = t && typeof t == "object" ? `${t.latitude || 0}, ${t.longitude || 0}` : "";
5
+ if (i)
6
+ return /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: n || "-" });
7
+ const u = (p) => {
8
+ const o = p.target.value;
9
+ if (!o.trim()) {
10
+ l(null);
11
+ return;
12
+ }
13
+ const s = o.split(",").map((e) => e.trim());
14
+ if (s.length === 2) {
15
+ const e = parseFloat(s[0]), c = parseFloat(s[1]);
16
+ !isNaN(e) && !isNaN(c) && l({ latitude: e, longitude: c });
17
+ }
18
+ };
19
+ return /* @__PURE__ */ r.jsx(
20
+ f,
21
+ {
22
+ type: "text",
23
+ value: n,
24
+ onChange: u,
25
+ placeholder: m?.placeholder || "latitude, longitude",
26
+ disabled: i || a.disabled,
27
+ className: a.className
28
+ }
29
+ );
30
+ }
31
+ export {
32
+ x as LocationField
33
+ };
@@ -0,0 +1,117 @@
1
+ import { j as e } from "./index-B87wd1E0.js";
2
+ import { Button as a, cn as c, Badge as N } from "@object-ui/components";
3
+ import { c as o, X as f } from "./ObjectAgGridImpl-EjifM4aY.js";
4
+ const g = [
5
+ ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
6
+ ["path", { d: "M10 14 21 3", key: "gplh6r" }],
7
+ ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
8
+ ], i = o("external-link", g);
9
+ const v = [
10
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
11
+ ["path", { d: "M12 5v14", key: "s699le" }]
12
+ ], y = o("plus", v);
13
+ function R({
14
+ value: h,
15
+ onChange: l,
16
+ field: x,
17
+ readonly: m,
18
+ className: n,
19
+ ...d
20
+ }) {
21
+ const t = h || [], u = x || d.schema, p = () => {
22
+ const s = {
23
+ id: `new-${Date.now()}`,
24
+ label: "New Related Record"
25
+ };
26
+ l([...t, s]);
27
+ }, j = (s) => {
28
+ l(t.filter((b) => b.id !== s));
29
+ }, r = (s) => {
30
+ console.log("View detail:", s);
31
+ };
32
+ return m ? /* @__PURE__ */ e.jsxs("div", { className: c("space-y-2", n), children: [
33
+ t.length === 0 ? /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "No related records" }) : t.map((s) => /* @__PURE__ */ e.jsxs(
34
+ "div",
35
+ {
36
+ className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
37
+ children: [
38
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: s.label }),
39
+ /* @__PURE__ */ e.jsx(
40
+ a,
41
+ {
42
+ type: "button",
43
+ variant: "ghost",
44
+ size: "sm",
45
+ onClick: () => r(s),
46
+ children: /* @__PURE__ */ e.jsx(i, { className: "w-4 h-4" })
47
+ }
48
+ )
49
+ ]
50
+ },
51
+ s.id
52
+ )),
53
+ /* @__PURE__ */ e.jsxs("p", { className: "text-xs text-muted-foreground", children: [
54
+ t.length,
55
+ " ",
56
+ t.length === 1 ? "record" : "records"
57
+ ] })
58
+ ] }) : /* @__PURE__ */ e.jsxs("div", { className: c("space-y-3", n), children: [
59
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
60
+ t.map((s) => /* @__PURE__ */ e.jsxs(
61
+ "div",
62
+ {
63
+ className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
64
+ children: [
65
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-1", children: [
66
+ /* @__PURE__ */ e.jsx(N, { variant: "outline", children: s.id }),
67
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm flex-1", children: s.label })
68
+ ] }),
69
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
70
+ /* @__PURE__ */ e.jsx(
71
+ a,
72
+ {
73
+ type: "button",
74
+ variant: "ghost",
75
+ size: "sm",
76
+ onClick: () => r(s),
77
+ children: /* @__PURE__ */ e.jsx(i, { className: "w-4 h-4" })
78
+ }
79
+ ),
80
+ /* @__PURE__ */ e.jsx(
81
+ a,
82
+ {
83
+ type: "button",
84
+ variant: "ghost",
85
+ size: "sm",
86
+ onClick: () => j(s.id),
87
+ disabled: d.disabled,
88
+ children: /* @__PURE__ */ e.jsx(f, { className: "w-4 h-4" })
89
+ }
90
+ )
91
+ ] })
92
+ ]
93
+ },
94
+ s.id
95
+ )),
96
+ t.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20", children: "No related records" })
97
+ ] }),
98
+ /* @__PURE__ */ e.jsxs(
99
+ a,
100
+ {
101
+ type: "button",
102
+ variant: "outline",
103
+ className: "w-full",
104
+ onClick: p,
105
+ disabled: d.disabled,
106
+ children: [
107
+ /* @__PURE__ */ e.jsx(y, { className: "w-4 h-4 mr-2" }),
108
+ "Add ",
109
+ u?.label || "Record"
110
+ ]
111
+ }
112
+ )
113
+ ] });
114
+ }
115
+ export {
116
+ R as MasterDetailField
117
+ };