@object-ui/plugin-aggrid 2.0.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.
Files changed (23) hide show
  1. package/.turbo/turbo-build.log +22 -22
  2. package/CHANGELOG.md +22 -0
  3. package/dist/{AddressField-Bntpynvd.js → AddressField-CUHm7scl.js} +1 -1
  4. package/dist/{AgGridImpl-3Mmf2qrR.js → AgGridImpl-DVyHqLJi.js} +1 -1
  5. package/dist/{AutoNumberField-C1kBJaxh.js → AutoNumberField-twP63aM8.js} +1 -1
  6. package/dist/{FileField-BDwbJvor.js → FileField-Cxql0zFQ.js} +2 -2
  7. package/dist/{FormulaField-BXNiyGoh.js → FormulaField-CsRwvjVZ.js} +1 -1
  8. package/dist/{GeolocationField-Df3yYcM9.js → GeolocationField-DQ_J9TGl.js} +2 -2
  9. package/dist/{GridField-CcjQp4WM.js → GridField-BrF4x9mD.js} +1 -1
  10. package/dist/{LocationField-BIfN5QIq.js → LocationField-C4zcjds3.js} +1 -1
  11. package/dist/{MasterDetailField-CAEmxbIT.js → MasterDetailField-DybIeqDQ.js} +2 -2
  12. package/dist/{ObjectAgGridImpl-EjifM4aY.js → ObjectAgGridImpl-CotBxBL9.js} +18 -18
  13. package/dist/{ObjectField-BpkQpIF-.js → ObjectField-CVXoKqAF.js} +1 -1
  14. package/dist/{QRCodeField-VCBewTDG.js → QRCodeField-lmARTFQy.js} +2 -2
  15. package/dist/{RichTextField-CyQwSi2C.js → RichTextField-5ce8qKzb.js} +1 -1
  16. package/dist/{SignatureField-Cr4tsEbj.js → SignatureField-VES1Umvd.js} +3 -3
  17. package/dist/{SummaryField-CnEJ_GZI.js → SummaryField-CQsFucuH.js} +1 -1
  18. package/dist/{UserField-DJjaVyrV.js → UserField-Dxq9ZQ9l.js} +2 -2
  19. package/dist/{VectorField-cPYmcKnV.js → VectorField-BJoHEqgv.js} +1 -1
  20. package/dist/{index-B87wd1E0.js → index-DSI77JcG.js} +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.umd.cjs +1 -1
  23. package/package.json +13 -13
@@ -1,5 +1,5 @@
1
1
 
2
- > @object-ui/plugin-aggrid@2.0.0 build /home/runner/work/objectui/objectui/packages/plugin-aggrid
2
+ > @object-ui/plugin-aggrid@3.0.0 build /home/runner/work/objectui/objectui/packages/plugin-aggrid
3
3
  > vite build
4
4
 
5
5
  vite v7.3.1 building client environment for production...
@@ -72,28 +72,28 @@ rendering chunks...
72
72
  
73
73
  [vite:dts] Start generate declaration files...
74
74
  computing gzip size...
75
- [vite:dts] Declaration files built in 14443ms.
75
+ [vite:dts] Declaration files built in 15637ms.
76
76
  
77
77
  dist/index.css 318.68 kB │ gzip: 61.72 kB
78
78
  dist/index.js  0.22 kB │ gzip: 0.16 kB
79
- dist/AutoNumberField-C1kBJaxh.js  0.29 kB │ gzip: 0.25 kB
80
- dist/SummaryField-CnEJ_GZI.js  0.49 kB │ gzip: 0.36 kB
81
- dist/FormulaField-BXNiyGoh.js  0.53 kB │ gzip: 0.37 kB
82
- dist/VectorField-cPYmcKnV.js  0.81 kB │ gzip: 0.43 kB
83
- dist/LocationField-BIfN5QIq.js  0.95 kB │ gzip: 0.53 kB
84
- dist/RichTextField-CyQwSi2C.js  1.19 kB │ gzip: 0.58 kB
85
- dist/ObjectField-BpkQpIF-.js  1.65 kB │ gzip: 0.76 kB
86
- dist/GridField-CcjQp4WM.js  1.75 kB │ gzip: 0.67 kB
87
- dist/UserField-DJjaVyrV.js  2.50 kB │ gzip: 0.93 kB
88
- dist/AddressField-Bntpynvd.js  3.12 kB │ gzip: 0.75 kB
89
- dist/SignatureField-Cr4tsEbj.js  3.40 kB │ gzip: 1.28 kB
90
- dist/QRCodeField-VCBewTDG.js  3.46 kB │ gzip: 1.24 kB
91
- dist/FileField-BDwbJvor.js  3.59 kB │ gzip: 1.34 kB
92
- dist/MasterDetailField-CAEmxbIT.js  3.96 kB │ gzip: 1.17 kB
93
- dist/GeolocationField-Df3yYcM9.js  4.57 kB │ gzip: 1.51 kB
94
- dist/AgGridImpl-3Mmf2qrR.js  7.21 kB │ gzip: 2.37 kB
95
- dist/index-B87wd1E0.js  20.43 kB │ gzip: 5.11 kB
96
- dist/ObjectAgGridImpl-EjifM4aY.js 941.84 kB │ gzip: 207.85 kB
79
+ dist/AutoNumberField-twP63aM8.js  0.29 kB │ gzip: 0.25 kB
80
+ dist/SummaryField-CQsFucuH.js  0.49 kB │ gzip: 0.36 kB
81
+ dist/FormulaField-CsRwvjVZ.js  0.53 kB │ gzip: 0.37 kB
82
+ dist/VectorField-BJoHEqgv.js  0.81 kB │ gzip: 0.43 kB
83
+ dist/LocationField-C4zcjds3.js  0.95 kB │ gzip: 0.53 kB
84
+ dist/RichTextField-5ce8qKzb.js  1.19 kB │ gzip: 0.58 kB
85
+ dist/ObjectField-CVXoKqAF.js  1.65 kB │ gzip: 0.76 kB
86
+ dist/GridField-BrF4x9mD.js  1.75 kB │ gzip: 0.67 kB
87
+ dist/UserField-Dxq9ZQ9l.js  2.50 kB │ gzip: 0.93 kB
88
+ dist/AddressField-CUHm7scl.js  3.12 kB │ gzip: 0.75 kB
89
+ dist/SignatureField-VES1Umvd.js  3.41 kB │ gzip: 1.29 kB
90
+ dist/QRCodeField-lmARTFQy.js  3.46 kB │ gzip: 1.24 kB
91
+ dist/FileField-Cxql0zFQ.js  3.59 kB │ gzip: 1.35 kB
92
+ dist/MasterDetailField-DybIeqDQ.js  3.96 kB │ gzip: 1.17 kB
93
+ dist/GeolocationField-DQ_J9TGl.js  4.57 kB │ gzip: 1.51 kB
94
+ dist/AgGridImpl-DVyHqLJi.js  7.21 kB │ gzip: 2.37 kB
95
+ dist/index-DSI77JcG.js  20.43 kB │ gzip: 5.11 kB
96
+ dist/ObjectAgGridImpl-CotBxBL9.js 941.84 kB │ gzip: 207.85 kB
97
97
  dist/index.css 318.68 kB │ gzip: 61.72 kB
98
- dist/index.umd.cjs 612.26 kB │ gzip: 182.92 kB
99
- ✓ built in 24.22s
98
+ dist/index.umd.cjs 612.28 kB │ gzip: 182.93 kB
99
+ ✓ built in 25.38s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @object-ui/plugin-aggrid
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 87979c3: Upgrade to @objectstack v3.0.0 and console bundle optimization
8
+ - Upgraded all @objectstack/\* packages from ^2.0.7 to ^3.0.0
9
+ - Breaking change migrations: Hub → Cloud namespace, definePlugin removed, PaginatedResult.value → .records, PaginatedResult.count → .total, client.meta.getObject() → client.meta.getItem()
10
+ - Console bundle optimization: split monolithic 3.7 MB chunk into 17 granular cacheable chunks (95% main entry reduction)
11
+ - Added gzip + brotli pre-compression via vite-plugin-compression2
12
+ - Lazy MSW loading for build:server (~150 KB gzip saved)
13
+ - Added bundle analysis with rollup-plugin-visualizer
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [87979c3]
18
+ - @object-ui/types@3.0.0
19
+ - @object-ui/core@3.0.0
20
+ - @object-ui/react@3.0.0
21
+ - @object-ui/components@3.0.0
22
+ - @object-ui/fields@3.0.0
23
+ - @object-ui/data-objectstack@3.0.0
24
+
3
25
  ## 2.0.0
4
26
 
5
27
  ### Major Changes
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import { Label as d, Input as r } from "@object-ui/components";
3
3
  function u({ value: n, onChange: o, field: h, readonly: a, ...i }) {
4
4
  const s = n || {}, l = (t, c) => {
@@ -1,4 +1,4 @@
1
- import { j as f } from "./index-B87wd1E0.js";
1
+ import { j as f } from "./index-DSI77JcG.js";
2
2
  import { useRef as Z, useMemo as C, useCallback as d } from "react";
3
3
  import { AgGridReact as _ } from "ag-grid-react";
4
4
  function G({
@@ -1,4 +1,4 @@
1
- import { j as n } from "./index-B87wd1E0.js";
1
+ import { j as n } from "./index-DSI77JcG.js";
2
2
  function a({ value: t, field: o, ...s }) {
3
3
  const e = t != null ? String(t) : "-";
4
4
  return /* @__PURE__ */ n.jsx("span", { className: `text-sm font-mono text-gray-700 ${s.className || ""}`, children: e });
@@ -1,7 +1,7 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import { useRef as y } from "react";
3
3
  import { Button as p } from "@object-ui/components";
4
- import { c as N, X as g, U as F } from "./ObjectAgGridImpl-EjifM4aY.js";
4
+ import { c as N, X as g, U as F } from "./ObjectAgGridImpl-CotBxBL9.js";
5
5
  const z = [
6
6
  [
7
7
  "path",
@@ -1,4 +1,4 @@
1
- import { j as s } from "./index-B87wd1E0.js";
1
+ import { j as s } from "./index-DSI77JcG.js";
2
2
  function m({ value: e, field: o, ...r }) {
3
3
  const n = (o || r.schema)?.return_type || "text";
4
4
  let t = "-";
@@ -1,7 +1,7 @@
1
- import { j as t } from "./index-B87wd1E0.js";
1
+ import { j as t } from "./index-DSI77JcG.js";
2
2
  import f from "react";
3
3
  import { Button as n, Label as m, Input as x } from "@object-ui/components";
4
- import { c as h } from "./ObjectAgGridImpl-EjifM4aY.js";
4
+ import { c as h } from "./ObjectAgGridImpl-CotBxBL9.js";
5
5
  const b = [
6
6
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
7
7
  ["line", { x1: "22", x2: "18", y1: "12", y2: "12", key: "l9bcsi" }],
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import { cn as l } from "@object-ui/components";
3
3
  function g({ value: r, field: n, readonly: m, ...a }) {
4
4
  const d = (n || a.schema)?.columns || [];
@@ -1,4 +1,4 @@
1
- import { j as r } from "./index-B87wd1E0.js";
1
+ import { j as r } from "./index-DSI77JcG.js";
2
2
  import { Input as f } from "@object-ui/components";
3
3
  function x({ value: t, onChange: l, field: d, readonly: i, ...a }) {
4
4
  const m = d || a.schema, n = t && typeof t == "object" ? `${t.latitude || 0}, ${t.longitude || 0}` : "";
@@ -1,6 +1,6 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
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";
3
+ import { c as o, X as f } from "./ObjectAgGridImpl-CotBxBL9.js";
4
4
  const g = [
5
5
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
6
6
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
@@ -1,4 +1,4 @@
1
- import { j as N } from "./index-B87wd1E0.js";
1
+ import { j as N } from "./index-DSI77JcG.js";
2
2
  import fm, { forwardRef as J2, createElement as vb, useId as Z3, useState as qr, useRef as K2, useEffect as H2, useMemo as Gv, useCallback as Br } from "react";
3
3
  import { AgGridReact as L3 } from "ag-grid-react";
4
4
  import $2 from "react-dom";
@@ -28260,36 +28260,36 @@ const ST = {
28260
28260
  currency: () => Promise.resolve().then(() => qE).then((v) => ({ default: v.CurrencyField })),
28261
28261
  percent: () => Promise.resolve().then(() => QE).then((v) => ({ default: v.PercentField })),
28262
28262
  password: () => Promise.resolve().then(() => ZE).then((v) => ({ default: v.PasswordField })),
28263
- markdown: () => import("./RichTextField-CyQwSi2C.js").then((v) => ({ default: v.RichTextField })),
28264
- html: () => import("./RichTextField-CyQwSi2C.js").then((v) => ({ default: v.RichTextField })),
28263
+ markdown: () => import("./RichTextField-5ce8qKzb.js").then((v) => ({ default: v.RichTextField })),
28264
+ html: () => import("./RichTextField-5ce8qKzb.js").then((v) => ({ default: v.RichTextField })),
28265
28265
  lookup: () => Promise.resolve().then(() => GE).then((v) => ({ default: v.LookupField })),
28266
- master_detail: () => import("./MasterDetailField-CAEmxbIT.js").then((v) => ({ default: v.MasterDetailField })),
28266
+ master_detail: () => import("./MasterDetailField-DybIeqDQ.js").then((v) => ({ default: v.MasterDetailField })),
28267
28267
  // File fields
28268
- file: () => import("./FileField-BDwbJvor.js").then((v) => ({ default: v.FileField })),
28268
+ file: () => import("./FileField-Cxql0zFQ.js").then((v) => ({ default: v.FileField })),
28269
28269
  image: () => Promise.resolve().then(() => LE).then((v) => ({ default: v.ImageField })),
28270
28270
  // Location field
28271
- location: () => import("./LocationField-BIfN5QIq.js").then((v) => ({ default: v.LocationField })),
28271
+ location: () => import("./LocationField-C4zcjds3.js").then((v) => ({ default: v.LocationField })),
28272
28272
  // Computed/Read-only fields
28273
- formula: () => import("./FormulaField-BXNiyGoh.js").then((v) => ({ default: v.FormulaField })),
28274
- summary: () => import("./SummaryField-CnEJ_GZI.js").then((v) => ({ default: v.SummaryField })),
28275
- auto_number: () => import("./AutoNumberField-C1kBJaxh.js").then((v) => ({ default: v.AutoNumberField })),
28273
+ formula: () => import("./FormulaField-CsRwvjVZ.js").then((v) => ({ default: v.FormulaField })),
28274
+ summary: () => import("./SummaryField-CQsFucuH.js").then((v) => ({ default: v.SummaryField })),
28275
+ auto_number: () => import("./AutoNumberField-twP63aM8.js").then((v) => ({ default: v.AutoNumberField })),
28276
28276
  // User fields
28277
- user: () => import("./UserField-DJjaVyrV.js").then((v) => ({ default: v.UserField })),
28278
- owner: () => import("./UserField-DJjaVyrV.js").then((v) => ({ default: v.UserField })),
28277
+ user: () => import("./UserField-Dxq9ZQ9l.js").then((v) => ({ default: v.UserField })),
28278
+ owner: () => import("./UserField-Dxq9ZQ9l.js").then((v) => ({ default: v.UserField })),
28279
28279
  // Complex data types
28280
- object: () => import("./ObjectField-BpkQpIF-.js").then((v) => ({ default: v.ObjectField })),
28281
- vector: () => import("./VectorField-cPYmcKnV.js").then((v) => ({ default: v.VectorField })),
28282
- grid: () => import("./GridField-CcjQp4WM.js").then((v) => ({ default: v.GridField })),
28280
+ object: () => import("./ObjectField-CVXoKqAF.js").then((v) => ({ default: v.ObjectField })),
28281
+ vector: () => import("./VectorField-BJoHEqgv.js").then((v) => ({ default: v.VectorField })),
28282
+ grid: () => import("./GridField-BrF4x9mD.js").then((v) => ({ default: v.GridField })),
28283
28283
  // Additional field types from @objectstack/spec
28284
28284
  color: () => Promise.resolve().then(() => wE).then((v) => ({ default: v.ColorField })),
28285
28285
  slider: () => Promise.resolve().then(() => JE).then((v) => ({ default: v.SliderField })),
28286
28286
  rating: () => Promise.resolve().then(() => KE).then((v) => ({ default: v.RatingField })),
28287
28287
  code: () => Promise.resolve().then(() => $E).then((v) => ({ default: v.CodeField })),
28288
28288
  avatar: () => Promise.resolve().then(() => FE).then((v) => ({ default: v.AvatarField })),
28289
- address: () => import("./AddressField-Bntpynvd.js").then((v) => ({ default: v.AddressField })),
28290
- geolocation: () => import("./GeolocationField-Df3yYcM9.js").then((v) => ({ default: v.GeolocationField })),
28291
- signature: () => import("./SignatureField-Cr4tsEbj.js").then((v) => ({ default: v.SignatureField })),
28292
- qrcode: () => import("./QRCodeField-VCBewTDG.js").then((v) => ({ default: v.QRCodeField }))
28289
+ address: () => import("./AddressField-CUHm7scl.js").then((v) => ({ default: v.AddressField })),
28290
+ geolocation: () => import("./GeolocationField-DQ_J9TGl.js").then((v) => ({ default: v.GeolocationField })),
28291
+ signature: () => import("./SignatureField-VES1Umvd.js").then((v) => ({ default: v.SignatureField })),
28292
+ qrcode: () => import("./QRCodeField-lmARTFQy.js").then((v) => ({ default: v.QRCodeField }))
28293
28293
  };
28294
28294
  function IE(v) {
28295
28295
  const Y = ST[v];
@@ -1,4 +1,4 @@
1
- import { j as t } from "./index-B87wd1E0.js";
1
+ import { j as t } from "./index-DSI77JcG.js";
2
2
  import { useState as m, useEffect as h } from "react";
3
3
  import { cn as u, Textarea as y } from "@object-ui/components";
4
4
  function p({ value: r, onChange: c, field: x, readonly: a, ...s }) {
@@ -1,7 +1,7 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import y from "react";
3
3
  import { Button as a, Input as j } from "@object-ui/components";
4
- import { c as d } from "./ObjectAgGridImpl-EjifM4aY.js";
4
+ import { c as d } from "./ObjectAgGridImpl-CotBxBL9.js";
5
5
  const g = [
6
6
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
7
7
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import { Textarea as x } from "@object-ui/components";
3
3
  function f({ value: a, onChange: i, field: c, readonly: r, errorMessage: n, ...s }) {
4
4
  if (r)
@@ -1,7 +1,7 @@
1
- import { j as s } from "./index-B87wd1E0.js";
1
+ import { j as s } from "./index-DSI77JcG.js";
2
2
  import w, { useRef as v, useEffect as N } from "react";
3
3
  import { Button as b } from "@object-ui/components";
4
- import { c as S } from "./ObjectAgGridImpl-EjifM4aY.js";
4
+ import { c as S } from "./ObjectAgGridImpl-CotBxBL9.js";
5
5
  const C = [
6
6
  [
7
7
  "path",
@@ -55,7 +55,7 @@ function k({ value: o, onChange: f, readonly: i }) {
55
55
  const e = t.getContext("2d");
56
56
  e && (e.clearRect(0, 0, t.width, t.height), a(!0), f(""));
57
57
  };
58
- return i && o ? /* @__PURE__ */ s.jsx("div", { className: "border rounded p-2 bg-white", children: /* @__PURE__ */ s.jsx("img", { src: o, alt: "Signature", className: "max-w-full h-auto" }) }) : i && !o ? /* @__PURE__ */ s.jsx("span", { className: "text-sm text-muted-foreground", children: "No signature" }) : /* @__PURE__ */ s.jsxs("div", { className: "space-y-2", children: [
58
+ return i && o ? /* @__PURE__ */ s.jsx("div", { className: "border rounded p-2 bg-white", children: /* @__PURE__ */ s.jsx("img", { src: o, alt: "Signature", loading: "lazy", className: "max-w-full h-auto" }) }) : i && !o ? /* @__PURE__ */ s.jsx("span", { className: "text-sm text-muted-foreground", children: "No signature" }) : /* @__PURE__ */ s.jsxs("div", { className: "space-y-2", children: [
59
59
  /* @__PURE__ */ s.jsx("div", { className: "border rounded bg-white", children: /* @__PURE__ */ s.jsx(
60
60
  "canvas",
61
61
  {
@@ -1,4 +1,4 @@
1
- import { j as i } from "./index-B87wd1E0.js";
1
+ import { j as i } from "./index-DSI77JcG.js";
2
2
  function u({ value: m, field: n, ...s }) {
3
3
  const e = (n || s.schema)?.summary_type || "count";
4
4
  let t = "-";
@@ -1,6 +1,6 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  import { Avatar as c, AvatarFallback as m, Badge as g } from "@object-ui/components";
3
- import { X as N } from "./ObjectAgGridImpl-EjifM4aY.js";
3
+ import { X as N } from "./ObjectAgGridImpl-CotBxBL9.js";
4
4
  function U({ value: s, onChange: o, field: d, readonly: h, ...x }) {
5
5
  const p = (d || x.schema)?.multiple || !1;
6
6
  if (h) {
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-B87wd1E0.js";
1
+ import { j as e } from "./index-DSI77JcG.js";
2
2
  function x({ value: s, field: n, ...r }) {
3
3
  const i = (n || r.schema)?.dimensions || (Array.isArray(s) ? s.length : 0);
4
4
  if (!s || !Array.isArray(s))
@@ -261,7 +261,7 @@ function ue() {
261
261
  return L || (L = 1, process.env.NODE_ENV === "production" ? y.exports = oe() : y.exports = ie()), y.exports;
262
262
  }
263
263
  var s = ue();
264
- const se = w.lazy(() => import("./AgGridImpl-3Mmf2qrR.js")), ce = w.lazy(() => import("./ObjectAgGridImpl-EjifM4aY.js").then((a) => a.O)), q = ({ schema: a }) => /* @__PURE__ */ s.jsx(M, { fallback: /* @__PURE__ */ s.jsx(J, { className: "w-full h-[500px]" }), children: /* @__PURE__ */ s.jsx(
264
+ const se = w.lazy(() => import("./AgGridImpl-DVyHqLJi.js")), ce = w.lazy(() => import("./ObjectAgGridImpl-CotBxBL9.js").then((a) => a.O)), q = ({ schema: a }) => /* @__PURE__ */ s.jsx(M, { fallback: /* @__PURE__ */ s.jsx(J, { className: "w-full h-[500px]" }), children: /* @__PURE__ */ s.jsx(
265
265
  se,
266
266
  {
267
267
  rowData: a.rowData,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as a, O as d, a as m } from "./index-B87wd1E0.js";
1
+ import { A as a, O as d, a as m } from "./index-DSI77JcG.js";
2
2
  import "react";
3
3
  import "@object-ui/core";
4
4
  import "@object-ui/components";
@@ -226,4 +226,4 @@ You might need to use a local HTTP server (instead of file://): https://react.de
226
226
  let root = createRoot(domContainer);
227
227
  root.render(<App />);`),t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=ir(e,1,!1,null,null,a,i,null,o,f,d,Hg),e[ri]=t.current,Ki(e),new s0(t)},hm.hydrateRoot=function(e,t,a){if(!Pe(e))throw Error("Target container is not a DOM element.");r0(e),t===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var i=!1,o="",f=Md,d=_d,h=uy,p=null;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(d=a.onCaughtError),a.onRecoverableError!==void 0&&(h=a.onRecoverableError),a.formState!==void 0&&(p=a.formState)),t=ir(e,1,!0,t,a??null,i,o,p,f,d,h,Hg),t.context=Rg(null),a=t.current,i=Fl(a),i=fc(i),o=pl(i),o.callback=null,cu(a,o,i),nu(i,"hydrateRoot()",null),a=i,t.current.lanes=a,vi(t,a),za(t),e[ri]=t.current,Ki(e),new Xn(t)},hm.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),hm}var jb;function BT(){if(jb)return yp.exports;jb=1;function y(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y)}catch(R){console.error(R)}}}return process.env.NODE_ENV==="production"?(y(),yp.exports=UT()):yp.exports=HT(),yp.exports}var Ub=BT();const Hb=(...y)=>y.filter((R,L,S)=>!!R&&R.trim()!==""&&S.indexOf(R)===L).join(" ").trim();const qT=y=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const YT=y=>y.replace(/^([A-Z])|[\s-_]+(\w)/g,(R,L,S)=>S?S.toUpperCase():L.toLowerCase());const Bb=y=>{const R=YT(y);return R.charAt(0).toUpperCase()+R.slice(1)};var GT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const wT=y=>{for(const R in y)if(R.startsWith("aria-")||R==="role"||R==="title")return!0;return!1};const VT=me.forwardRef(({color:y="currentColor",size:R=24,strokeWidth:L=2,absoluteStrokeWidth:S,className:U="",children:Y,iconNode:V,..._},Z)=>me.createElement("svg",{ref:Z,...GT,width:R,height:R,stroke:y,strokeWidth:S?Number(L)*24/Number(R):L,className:Hb("lucide",U),...!Y&&!wT(_)&&{"aria-hidden":"true"},..._},[...V.map(([ee,se])=>me.createElement(ee,se)),...Array.isArray(Y)?Y:[Y]]));const _a=(y,R)=>{const L=me.forwardRef(({className:S,...U},Y)=>me.createElement(VT,{ref:Y,iconNode:R,className:Hb(`lucide-${qT(Bb(y))}`,`lucide-${y}`,S),...U}));return L.displayName=Bb(y),L};const XT=_a("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const QT=_a("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);const LT=_a("eraser",[["path",{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",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]);const qb=_a("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const ZT=_a("eye-off",[["path",{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",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{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",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const JT=_a("eye",[["path",{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",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const KT=_a("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);const $T=_a("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const Yb=_a("map-pin",[["path",{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",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const FT=_a("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Gb=_a("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);const kT=_a("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const wb=_a("star",[["path",{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",key:"r04s7s"}]]);const Vb=_a("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);const Gr=_a("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Xb({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema;if(S)return b.jsx("span",{className:"text-sm",children:y||"-"});const V=Y?.rows,{inputType:_,...Z}=U;return V&&V>1?b.jsx(ae.Textarea,{...Z,value:y||"",onChange:ee=>R(ee.target.value),placeholder:Y?.placeholder,disabled:S||Z.disabled}):b.jsx(ae.Input,{...Z,type:Y?.type==="password"?"password":"text",value:y||"",onChange:ee=>R(ee.target.value),placeholder:Y?.placeholder,disabled:S||Z.disabled})}const WT=Object.freeze(Object.defineProperty({__proto__:null,TextField:Xb},Symbol.toStringTag,{value:"Module"}));function Qb({value:y,onChange:R,field:L,readonly:S,...U}){if(S)return b.jsx("span",{className:"text-sm",children:y??"-"});const Y=L||U.schema,V=Y?.precision,{inputType:_,...Z}=U;return b.jsx(ae.Input,{...Z,type:"number",value:y??"",onChange:ee=>{const se=ee.target.value;R(se===""?null:Number(se))},placeholder:Y?.placeholder,disabled:S||Z.disabled,step:V?Math.pow(10,-V):"any"})}const IT=Object.freeze(Object.defineProperty({__proto__:null,NumberField:Qb},Symbol.toStringTag,{value:"Module"}));function Lb({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.widget,_=me.useId(),Z=Y?.name||_,ee=Y?.label||"Checkbox";if(S)return b.jsx("span",{className:"text-sm",children:y?"Yes":"No"});const{inputType:se,...J}=U;return V==="checkbox"?b.jsxs("div",{className:"flex items-center space-x-2",children:[b.jsx(ae.Checkbox,{...J,id:Z,checked:!!y,onCheckedChange:w=>R(!!w),disabled:S||J.disabled}),b.jsx(ae.Label,{htmlFor:Z,children:ee})]}):b.jsxs("div",{className:"flex items-center space-x-2",children:[b.jsx(ae.Switch,{...J,id:Z,checked:!!y,onCheckedChange:R,disabled:S||J.disabled}),b.jsx(ae.Label,{htmlFor:Z,children:ee})]})}const PT=Object.freeze(Object.defineProperty({__proto__:null,BooleanField:Lb},Symbol.toStringTag,{value:"Module"}));function Zb({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.options||[];if(S){const _=V.find(Z=>Z.value===y);return b.jsx("span",{className:"text-sm",children:_?.label||y||"-"})}return b.jsxs(ae.Select,{...U,value:y,onValueChange:R,disabled:S||U.disabled,children:[b.jsx(ae.SelectTrigger,{className:U.className,id:U.id,children:b.jsx(ae.SelectValue,{placeholder:Y?.placeholder||"Select an option"})}),b.jsx(ae.SelectContent,{position:"popper",children:V.map(_=>b.jsx(ae.SelectItem,{value:_.value,children:_.label},_.value))})]})}const eE=Object.freeze(Object.defineProperty({__proto__:null,SelectField:Zb},Symbol.toStringTag,{value:"Module"}));function Jb({value:y,onChange:R,field:L,readonly:S,...U}){if(S)return b.jsx("span",{className:"text-sm",children:y?new Date(y).toLocaleDateString():"-"});const{inputType:Y,...V}=U;return b.jsx(ae.Input,{...V,type:"date",value:y||"",onChange:_=>R(_.target.value),disabled:S||V.disabled})}const tE=Object.freeze(Object.defineProperty({__proto__:null,DateField:Jb},Symbol.toStringTag,{value:"Module"}));function Kb({value:y,onChange:R,field:L,readonly:S,errorMessage:U,...Y}){const V=L||Y.schema;if(S)return y?b.jsx("a",{href:`mailto:${y}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:y}):b.jsx("span",{className:"text-sm",children:"-"});const{inputType:_,...Z}=Y;return b.jsx(ae.Input,{...Z,type:"email",value:y||"",onChange:ee=>R(ee.target.value),placeholder:V?.placeholder||"email@example.com",disabled:S||Z.disabled,"aria-invalid":!!U})}const lE=Object.freeze(Object.defineProperty({__proto__:null,EmailField:Kb},Symbol.toStringTag,{value:"Module"}));function $b({value:y,onChange:R,field:L,readonly:S,errorMessage:U,...Y}){const V=L||Y.schema;if(S)return y?b.jsx("a",{href:`tel:${y}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:y}):b.jsx("span",{className:"text-sm",children:"-"});const{inputType:_,...Z}=Y;return b.jsx(ae.Input,{...Z,type:"tel",value:y||"",onChange:ee=>R(ee.target.value),placeholder:V?.placeholder||"(555) 123-4567",disabled:S||Z.disabled,"aria-invalid":!!U})}const aE=Object.freeze(Object.defineProperty({__proto__:null,PhoneField:$b},Symbol.toStringTag,{value:"Module"}));function Fb({value:y,onChange:R,field:L,readonly:S,errorMessage:U,...Y}){const V=L||Y.schema;if(S)return y?y.startsWith("http://")||y.startsWith("https://")?b.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:y}):b.jsx("span",{className:"text-sm",children:y}):b.jsx("span",{className:"text-sm",children:"-"});const{inputType:_,...Z}=Y;return b.jsx(ae.Input,{...Z,type:"url",value:y||"",onChange:ee=>R(ee.target.value),placeholder:V?.placeholder||"https://example.com",disabled:S||Z.disabled,"aria-invalid":!!U})}const nE=Object.freeze(Object.defineProperty({__proto__:null,UrlField:Fb},Symbol.toStringTag,{value:"Module"}));function uE(y,R="USD"){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:R}).format(y)}catch{return`${R} ${y.toFixed(2)}`}}function kb({value:y,onChange:R,field:L,readonly:S,errorMessage:U,className:Y,...V}){const _=L||V.schema,Z=_?.currency||"USD",ee=_?.precision??2;if(S)return y==null?b.jsx("span",{className:"text-sm",children:"-"}):b.jsx("span",{className:"text-sm font-medium tabular-nums",children:uE(Number(y),Z)});const se=J=>{const w=parseFloat(J.target.value);isNaN(w)||R(parseFloat(w.toFixed(ee)))};return b.jsxs("div",{className:"relative",children:[b.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:Z==="USD"?"$":Z}),b.jsx(ae.Input,{...V,type:"number",value:y??"",onChange:J=>{const w=J.target.value===""?null:parseFloat(J.target.value);R(w)},onBlur:se,placeholder:_?.placeholder||"0.00",disabled:S||V.disabled,className:`pl-8 ${Y||""}`,step:Math.pow(10,-ee).toFixed(ee),"aria-invalid":!!U})]})}const iE=Object.freeze(Object.defineProperty({__proto__:null,CurrencyField:kb},Symbol.toStringTag,{value:"Module"}));function Wb({value:y,onChange:R,field:L,readonly:S,errorMessage:U,...Y}){if(S)return b.jsx("div",{className:"text-sm whitespace-pre-wrap",children:y||"-"});const V=L||Y.schema,_=V?.rows||4,Z=V?.max_length,{inputType:ee,...se}=Y;return b.jsxs("div",{className:"relative",children:[b.jsx(ae.Textarea,{...se,value:y||"",onChange:J=>R(J.target.value),placeholder:V?.placeholder,disabled:S||se.disabled,rows:_,maxLength:Z,"aria-invalid":!!U}),Z&&b.jsxs("div",{className:"absolute bottom-2 right-2 text-xs text-gray-400","aria-live":"polite","aria-label":`Character count: ${(y||"").length} of ${Z}`,children:[(y||"").length,"/",Z]})]})}const cE=Object.freeze(Object.defineProperty({__proto__:null,TextAreaField:Wb},Symbol.toStringTag,{value:"Module"}));function oE({value:y,onChange:R,field:L,readonly:S,errorMessage:U,...Y}){if(S)return b.jsx("div",{className:"text-sm prose prose-sm max-w-none",children:y||"-"});const V=L||Y.schema,_=V?.rows||8,Z=V?.format||"markdown";return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[b.jsxs("span",{children:["Format: ",Z]}),b.jsx("span",{className:"italic",children:"Rich text editor (basic)"})]}),b.jsx(ae.Textarea,{value:y||"",onChange:ee=>R(ee.target.value),placeholder:V?.placeholder||"Enter text...",disabled:S||Y.disabled,rows:_,className:`font-mono text-sm ${Y.className||""}`,"aria-invalid":!!U})]})}const Ib=Object.freeze(Object.defineProperty({__proto__:null,RichTextField:oE},Symbol.toStringTag,{value:"Module"}));function Pb({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),[_,Z]=me.useState(""),ee=L||U.schema,se=ee?.options||[],J=ee.multiple||!1,w=ee.display_field||"label",te=se.filter(ie=>ie.label.toLowerCase().includes(_.toLowerCase())),oe=J?(Array.isArray(y)?y:[]).map(ie=>se.find(Be=>Be.value===ie)).filter(Boolean):y?[se.find(ie=>ie.value===y)].filter(Boolean):[],Se=ie=>{if(J){const Be=Array.isArray(y)?y:[],st=Be.includes(ie.value);R(st?Be.filter(we=>we!==ie.value):[...Be,ie.value])}else R(ie.value),V(!1)},Pe=ie=>{if(J){const Be=Array.isArray(y)?y:[];R(Be.filter(st=>st!==ie))}else R(null)};return S?oe.length?J?b.jsx("div",{className:"flex flex-wrap gap-1",children:oe.map((ie,Be)=>b.jsx(ae.Badge,{variant:"outline",children:ie?.[w]||ie?.label},Be))}):b.jsx("span",{className:"text-sm",children:oe[0]?.[w]||oe[0]?.label}):b.jsx("span",{className:"text-sm",children:"-"}):b.jsxs("div",{className:"space-y-2",children:[oe.length>0&&b.jsx("div",{className:"flex flex-wrap gap-1",children:oe.map((ie,Be)=>b.jsxs(ae.Badge,{variant:"outline",className:"gap-1",children:[ie?.[w]||ie?.label,b.jsx("button",{onClick:()=>Pe(ie?.value),className:"ml-1 hover:text-destructive",type:"button","aria-label":`Remove ${ie?.[w]||ie?.label}`,children:b.jsx(Gr,{className:"size-3"})})]},Be))}),b.jsxs(ae.Dialog,{open:Y,onOpenChange:V,children:[b.jsx(ae.DialogTrigger,{asChild:!0,children:b.jsxs(ae.Button,{variant:"outline",className:"w-full justify-start text-left font-normal",type:"button",children:[b.jsx(kT,{className:"mr-2 size-4"}),oe.length===0?ee?.placeholder||"Select...":J?`${oe.length} selected`:"Change selection"]})}),b.jsxs(ae.DialogContent,{className:"max-w-md",children:[b.jsx(ae.DialogHeader,{children:b.jsxs(ae.DialogTitle,{children:[ee?.label||"Select"," ",J&&"(multiple)"]})}),b.jsxs("div",{className:"space-y-4",children:[b.jsx(ae.Input,{placeholder:"Search...",value:_,onChange:ie=>Z(ie.target.value),className:"w-full"}),b.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1",children:te.length===0?b.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No options found"}):te.map(ie=>{const Be=J?(Array.isArray(y)?y:[]).includes(ie.value):y===ie.value;return b.jsxs("button",{onClick:()=>Se(ie),className:`w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${Be?"bg-blue-50 text-blue-700":""}`,type:"button",children:[b.jsx("span",{children:ie.label}),Be&&b.jsx(ae.Badge,{variant:"default",className:"ml-2",children:"Selected"})]},ie.value)})})]})]})]})]})}const fE=Object.freeze(Object.defineProperty({__proto__:null,LookupField:Pb},Symbol.toStringTag,{value:"Module"}));function eS({value:y,onChange:R,field:L,readonly:S,...U}){if(S){if(!y)return b.jsx("span",{className:"text-sm",children:"-"});const _=new Date(y);return b.jsxs("span",{className:"text-sm",children:[_.toLocaleDateString()," ",_.toLocaleTimeString()]})}const{inputType:Y,...V}=U;return b.jsx(ae.Input,{...V,type:"datetime-local",value:y||"",onChange:_=>R(_.target.value),disabled:S||V.disabled})}const sE=Object.freeze(Object.defineProperty({__proto__:null,DateTimeField:eS},Symbol.toStringTag,{value:"Module"}));function tS({value:y,onChange:R,field:L,readonly:S,...U}){if(S)return b.jsx("span",{className:"text-sm",children:y||"-"});const{inputType:Y,...V}=U;return b.jsx(ae.Input,{...V,type:"time",value:y||"",onChange:_=>R(_.target.value),disabled:S||V.disabled})}const rE=Object.freeze(Object.defineProperty({__proto__:null,TimeField:tS},Symbol.toStringTag,{value:"Module"}));function lS({value:y,onChange:R,field:L,readonly:S,errorMessage:U,className:Y,...V}){const _=L||V.schema,Z=_?.precision??2;if(S)return y==null?b.jsx("span",{className:"text-sm",children:"-"}):b.jsxs("span",{className:"text-sm font-medium tabular-nums",children:[(y*100).toFixed(Z),"%"]});const ee=y!=null?y*100:"",se=J=>{if(J.target.value===""){R(null);return}const w=parseFloat(J.target.value),te=isNaN(w)?null:w/100;R(te)};return b.jsxs("div",{className:"relative",children:[b.jsx(ae.Input,{...V,type:"number",value:ee,onChange:se,placeholder:_?.placeholder||"0",disabled:S||V.disabled,className:`pr-8 ${Y||""}`,step:Math.pow(10,-Z).toFixed(Z),"aria-invalid":!!U}),b.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:"%"})]})}const dE=Object.freeze(Object.defineProperty({__proto__:null,PercentField:lS},Symbol.toStringTag,{value:"Module"}));function aS({value:y,onChange:R,field:L,readonly:S,className:U,...Y}){const[V,_]=me.useState(!1),Z=L||Y.schema;if(S)return b.jsx("span",{className:"text-sm",children:"••••••••"});const{inputType:ee,...se}=Y;return b.jsxs("div",{className:"relative",children:[b.jsx(ae.Input,{...se,type:V?"text":"password",value:y||"",onChange:J=>R(J.target.value),placeholder:Z?.placeholder,disabled:S||se.disabled,className:`pr-10 ${U||""}`}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>_(!V),tabIndex:-1,children:V?b.jsx(ZT,{className:"size-4 text-gray-500"}):b.jsx(JT,{className:"size-4 text-gray-500"})})]})}const hE=Object.freeze(Object.defineProperty({__proto__:null,PasswordField:aS},Symbol.toStringTag,{value:"Module"}));function mE({value:y,onChange:R,field:L,readonly:S,...U}){const Y=me.useRef(null),V=L||U.schema,_=V?.multiple||!1,Z=V?.accept?V.accept.join(","):void 0;if(S){if(!y)return b.jsx("span",{className:"text-sm",children:"-"});const w=Array.isArray(y)?y:[y];return b.jsx("div",{className:"flex flex-wrap gap-2",children:w.map((te,oe)=>b.jsx("span",{className:"text-sm truncate max-w-xs",children:te.name||te.original_name||"File"},oe))})}const ee=y?Array.isArray(y)?y:[y]:[],se=w=>{const te=Array.from(w.target.files||[]);if(te.length===0)return;const oe=te.map(Se=>({name:Se.name,original_name:Se.name,size:Se.size,mime_type:Se.type,url:URL.createObjectURL(Se)}));R(_?[...ee,...oe]:oe[0])},J=w=>{if(_){const te=ee.filter((oe,Se)=>Se!==w);R(te.length>0?te:null)}else R(null)};return b.jsxs("div",{className:U.className,children:[b.jsx("input",{ref:Y,type:"file",multiple:_,accept:Z,onChange:se,className:"hidden"}),b.jsxs("div",{className:"space-y-2",children:[ee.length>0&&b.jsx("div",{className:"space-y-1",children:ee.map((w,te)=>b.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",children:[b.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[b.jsx(KT,{className:"size-4 text-gray-500 flex-shrink-0"}),b.jsx("span",{className:"text-sm truncate",children:w.name||w.original_name||"File"}),w.size&&b.jsxs("span",{className:"text-xs text-gray-500",children:["(",(w.size/1024).toFixed(1)," KB)"]})]}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>J(te),className:"h-6 w-6 p-0",children:b.jsx(Gr,{className:"size-3"})})]},te))}),b.jsxs(ae.Button,{type:"button",variant:"outline",onClick:()=>Y.current?.click(),className:"w-full",children:[b.jsx(Vb,{className:"size-4 mr-2"}),ee.length>0?"Add More Files":"Upload File"]})]})]})}const yE=Object.freeze(Object.defineProperty({__proto__:null,FileField:mE},Symbol.toStringTag,{value:"Module"}));function nS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=me.useRef(null),V=L||U.schema,_=V?.multiple||!1,Z=V?.accept?V.accept.join(","):"image/*";if(S){if(!y)return b.jsx("span",{className:"text-sm",children:"-"});const w=Array.isArray(y)?y:[y];return b.jsx("div",{className:"flex flex-wrap gap-2",children:w.map((te,oe)=>b.jsx("img",{src:te.url||"",alt:te.name||`Image ${oe+1}`,className:"size-20 rounded-md object-cover border border-gray-200"},oe))})}const ee=y?Array.isArray(y)?y:[y]:[],se=w=>{const te=Array.from(w.target.files||[]);if(te.length===0)return;const oe=te.map(Se=>({name:Se.name,original_name:Se.name,size:Se.size,mime_type:Se.type,url:URL.createObjectURL(Se)}));R(_?[...ee,...oe]:oe[0])},J=w=>{if(_){const te=ee.filter((oe,Se)=>Se!==w);R(te.length>0?te:null)}else R(null)};return b.jsxs("div",{className:U.className,children:[b.jsx("input",{ref:Y,type:"file",multiple:_,accept:Z,onChange:se,className:"hidden"}),b.jsxs("div",{className:"space-y-2",children:[ee.length>0&&b.jsx("div",{className:"grid grid-cols-4 gap-2",children:ee.map((w,te)=>b.jsxs("div",{className:"relative group",children:[b.jsx("img",{src:w.url||"",alt:w.name||`Image ${te+1}`,className:"size-20 rounded-md object-cover border border-gray-200"}),b.jsx(ae.Button,{type:"button",variant:"destructive",size:"sm",onClick:()=>J(te),className:"absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:b.jsx(Gr,{className:"size-3"})})]},te))}),b.jsxs(ae.Button,{type:"button",variant:"outline",onClick:()=>Y.current?.click(),className:"w-full",children:[b.jsx($T,{className:"size-4 mr-2"}),ee.length>0?"Add More Images":"Upload Image"]})]})]})}const pE=Object.freeze(Object.defineProperty({__proto__:null,ImageField:nS},Symbol.toStringTag,{value:"Module"}));function gE({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=y&&typeof y=="object"?`${y.latitude||0}, ${y.longitude||0}`:"";if(S)return b.jsx("span",{className:"text-sm",children:V||"-"});const _=Z=>{const ee=Z.target.value;if(!ee.trim()){R(null);return}const se=ee.split(",").map(J=>J.trim());if(se.length===2){const J=parseFloat(se[0]),w=parseFloat(se[1]);!isNaN(J)&&!isNaN(w)&&R({latitude:J,longitude:w})}};return b.jsx(ae.Input,{type:"text",value:V,onChange:_,placeholder:Y?.placeholder||"latitude, longitude",disabled:S||U.disabled,className:U.className})}const vE=Object.freeze(Object.defineProperty({__proto__:null,LocationField:gE},Symbol.toStringTag,{value:"Module"}));function bE({value:y,field:R,...L}){const U=(R||L.schema)?.return_type||"text";let Y="-";return y!=null&&(U==="number"||U==="currency"?Y=typeof y=="number"?y.toFixed(2):String(y):U==="boolean"?Y=y?"Yes":"No":U==="date"?Y=new Date(y).toLocaleDateString():Y=String(y)),b.jsx("span",{className:`text-sm font-mono text-gray-700 ${L.className||""}`,children:Y})}const SE=Object.freeze(Object.defineProperty({__proto__:null,FormulaField:bE},Symbol.toStringTag,{value:"Module"}));function TE({value:y,field:R,...L}){const U=(R||L.schema)?.summary_type||"count";let Y="-";return y!=null&&(U==="count"?Y=String(y):["sum","avg","min","max"].includes(U)?Y=typeof y=="number"?y.toFixed(2):String(y):Y=String(y)),b.jsx("span",{className:`text-sm font-medium tabular-nums text-gray-700 ${L.className||""}`,children:Y})}const EE=Object.freeze(Object.defineProperty({__proto__:null,SummaryField:TE},Symbol.toStringTag,{value:"Module"}));function AE({value:y,field:R,...L}){const S=y!=null?String(y):"-";return b.jsx("span",{className:`text-sm font-mono text-gray-700 ${L.className||""}`,children:S})}const zE=Object.freeze(Object.defineProperty({__proto__:null,AutoNumberField:AE},Symbol.toStringTag,{value:"Module"}));function xE({value:y,onChange:R,field:L,readonly:S,...U}){const V=(L||U.schema)?.multiple||!1;if(S){if(!y)return b.jsx("span",{className:"text-sm",children:"-"});const ee=Array.isArray(y)?y:[y];return b.jsxs("div",{className:"flex -space-x-2",children:[ee.slice(0,3).map((se,J)=>{const w=se.name||se.username||"User",te=w.split(" ").map(oe=>oe[0]).join("").toUpperCase().slice(0,2);return b.jsx(ae.Avatar,{className:"size-8 border-2 border-white",title:w,children:b.jsx(ae.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:te})},J)}),ee.length>3&&b.jsx(ae.Avatar,{className:"size-8 border-2 border-white",children:b.jsxs(ae.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",ee.length-3]})})]})}const _=y?Array.isArray(y)?y:[y]:[],Z=ee=>{if(V){const se=_.filter((J,w)=>w!==ee);R(se.length>0?se:null)}else R(null)};return b.jsxs("div",{className:U.className,children:[_.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:_.map((ee,se)=>{const J=ee.name||ee.username||"User",w=J.split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2);return b.jsxs(ae.Badge,{variant:"outline",className:"gap-2 pr-1",children:[b.jsx(ae.Avatar,{className:"size-5",children:b.jsx(ae.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:w})}),b.jsx("span",{className:"text-sm",children:J}),b.jsx("button",{type:"button",onClick:()=>Z(se),className:"ml-1 rounded-full hover:bg-gray-200 p-0.5",children:b.jsx(Gr,{className:"size-3"})})]},se)})}),b.jsx("div",{className:"text-sm text-gray-500 italic",children:"User selection component requires integration with user management system"})]})}const uS=Object.freeze(Object.defineProperty({__proto__:null,UserField:xE},Symbol.toStringTag,{value:"Module"}));function OE({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=()=>y==null?"":JSON.stringify(y,null,2),[_,Z]=me.useState(V),[ee,se]=me.useState(null);if(me.useEffect(()=>{try{if(y==null){Z("");return}const w=_?JSON.parse(_):null;JSON.stringify(w)!==JSON.stringify(y)&&Z(JSON.stringify(y,null,2))}catch{Z(JSON.stringify(y,null,2))}},[y,_]),S)return y?b.jsx("pre",{className:ae.cn("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40",U.className),children:JSON.stringify(y,null,2)}):b.jsx("span",{className:"text-sm",children:"-"});const J=w=>{const te=w.target.value;if(Z(te),se(null),!te.trim()){R(null);return}try{const oe=JSON.parse(te);R(oe)}catch{se("Invalid JSON")}};return b.jsxs("div",{className:"space-y-1",children:[b.jsx(ae.Textarea,{value:_,onChange:J,placeholder:Y?.placeholder||`{
228
228
  "key": "value"
229
- }`,disabled:S||U.disabled,className:ae.cn("font-mono text-xs",ee?"border-red-500 focus-visible:ring-red-500":"",U.className),rows:6}),ee&&b.jsx("p",{className:"text-xs text-red-500",children:ee})]})}const DE=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:OE},Symbol.toStringTag,{value:"Module"}));function CE({value:y,field:R,...L}){const U=(R||L.schema)?.dimensions||(Array.isArray(y)?y.length:0);if(!y||!Array.isArray(y))return b.jsx("span",{className:"text-sm text-gray-500",children:"-"});const Y=y.slice(0,3).map(V=>{const _=Number(V);return isNaN(_)?"0":_.toFixed(4)}).join(", ");return b.jsxs("div",{className:`text-sm ${L.className||""}`,children:[b.jsxs("span",{className:"font-mono text-gray-700",children:["[",Y,"...]"]}),b.jsxs("span",{className:"text-gray-500 ml-2",children:["(",U,"D)"]})]})}const ME=Object.freeze(Object.defineProperty({__proto__:null,VectorField:CE},Symbol.toStringTag,{value:"Module"}));function _E({value:y,field:R,readonly:L,...S}){const Y=(R||S.schema)?.columns||[];return!y||!Array.isArray(y)?b.jsx("span",{className:"text-sm text-gray-500",children:"-"}):L?b.jsx("div",{className:ae.cn("text-sm",S.className),children:b.jsxs("span",{className:"text-gray-700",children:[y.length," rows"]})}):b.jsxs("div",{className:ae.cn("border border-gray-200 rounded-md overflow-hidden",S.className),children:[b.jsx("div",{className:"overflow-auto max-h-60",children:b.jsxs("table",{className:"w-full text-sm",children:[b.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:b.jsx("tr",{children:Y.map((V,_)=>b.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-700",children:V.label||V.name},_))})}),b.jsx("tbody",{className:"divide-y divide-gray-200",children:y.slice(0,5).map((V,_)=>b.jsx("tr",{className:"hover:bg-gray-50",children:Y.map((Z,ee)=>b.jsx("td",{className:"px-3 py-2 text-gray-900",children:V[Z.name]!=null?String(V[Z.name]):"-"},ee))},_))})]})}),y.length>5&&b.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200",children:["Showing 5 of ",y.length," rows"]})]})}const RE=Object.freeze(Object.defineProperty({__proto__:null,GridField:_E},Symbol.toStringTag,{value:"Module"}));function iS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("div",{className:"w-6 h-6 rounded border border-input",style:{backgroundColor:y||"#000000"}}),b.jsx("span",{className:"text-sm",children:y||"-"})]}):b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"color",value:y||"#000000",onChange:V=>R(V.target.value),disabled:S||U.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),b.jsx(ae.Input,{type:"text",value:y||"",onChange:V=>R(V.target.value),placeholder:Y?.placeholder||"#000000",disabled:S||U.disabled,className:U.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const NE=Object.freeze(Object.defineProperty({__proto__:null,ColorField:iS},Symbol.toStringTag,{value:"Module"}));function cS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.min??0,_=Y?.max??100,Z=Y?.step??1;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-medium",children:y??V}),b.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",_]})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx(ae.Slider,{value:[y??V],onValueChange:ee=>R(ee[0]),min:V,max:_,step:Z,disabled:S||U.disabled,className:U.className}),b.jsx("span",{className:"text-sm font-medium w-12 text-right",children:y??V})]})}const jE=Object.freeze(Object.defineProperty({__proto__:null,SliderField:cS},Symbol.toStringTag,{value:"Module"}));function oS({value:y,onChange:R,field:L,readonly:S,className:U,...Y}){const _=(L||Y.schema)?.max??5,Z=y??0,[ee,se]=me.useState(null),J=ee!==null?ee:Z;return S?b.jsxs("div",{className:ae.cn("flex items-center gap-1",U),children:[Array.from({length:_},(w,te)=>b.jsx(wb,{className:`w-5 h-5 ${te<Z?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},te)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]}):b.jsxs("div",{className:ae.cn("flex items-center gap-1",U),children:[Array.from({length:_},(w,te)=>b.jsx("button",{type:"button",onClick:()=>R(te+1),onMouseEnter:()=>se(te+1),onMouseLeave:()=>se(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:S||Y.disabled,children:b.jsx(wb,{className:`w-5 h-5 transition-colors ${te<J?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},te)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]})}const UE=Object.freeze(Object.defineProperty({__proto__:null,RatingField:oS},Symbol.toStringTag,{value:"Module"}));function fS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.language??"javascript";return S?b.jsx("pre",{className:ae.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",U.className),children:b.jsx("code",{children:y||"-"})}):b.jsx(ae.Textarea,{value:y||"",onChange:_=>R(_.target.value),placeholder:Y?.placeholder||`// Write ${V} code here...`,disabled:S||U.disabled,className:ae.cn("font-mono text-sm",U.className),rows:12,spellCheck:!1})}const HE=Object.freeze(Object.defineProperty({__proto__:null,CodeField:fS},Symbol.toStringTag,{value:"Module"}));function sS({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=me.useRef(null),Z=L||U.schema,ee=w=>{const te=w.target.files?.[0];if(!te)return;if(!te.type.startsWith("image/")){console.error("Please select an image file");return}if(te.size>5*1024*1024){console.error("File size must be less than 5MB");return}const oe=new FileReader;oe.onloadend=()=>{R(oe.result)},oe.readAsDataURL(te)},se=()=>{R("")},J=()=>(Z?.defaultName||Z?.label||"User").split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2);return S?b.jsxs(ae.Avatar,{className:"w-16 h-16",children:[y&&b.jsx(ae.AvatarImage,{src:y,alt:Z?.label}),b.jsx(ae.AvatarFallback,{children:J()})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative",onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),children:[b.jsxs(ae.Avatar,{className:"w-16 h-16",children:[y&&b.jsx(ae.AvatarImage,{src:y,alt:Z?.label}),b.jsx(ae.AvatarFallback,{children:J()})]}),!S&&Y&&y&&b.jsx("button",{type:"button",onClick:se,className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",children:b.jsx(Gr,{className:"w-3 h-3"})})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("input",{ref:_,type:"file",accept:"image/*",onChange:ee,className:"hidden"}),b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>_.current?.click(),disabled:S||U.disabled,children:[b.jsx(Vb,{className:"w-4 h-4 mr-2"}),y?"Change":"Upload"," Avatar"]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const BE=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:sS},Symbol.toStringTag,{value:"Module"}));function qE({value:y,onChange:R,field:L,readonly:S,...U}){const Y=y||{},V=(Z,ee)=>{R({...Y,[Z]:ee})},_=Z=>[Z.street,Z.city,[Z.state,Z.zipCode].filter(Boolean).join(" "),Z.country].filter(Boolean).join(", ")||"-";return S?b.jsx("span",{className:"text-sm",children:_(Y)}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),b.jsx(ae.Input,{id:"street",type:"text",value:Y.street||"",onChange:Z=>V("street",Z.target.value),placeholder:"123 Main St",disabled:S||U.disabled,className:U.className})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"city",className:"text-xs",children:"City"}),b.jsx(ae.Input,{id:"city",type:"text",value:Y.city||"",onChange:Z=>V("city",Z.target.value),placeholder:"San Francisco",disabled:S||U.disabled})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),b.jsx(ae.Input,{id:"state",type:"text",value:Y.state||"",onChange:Z=>V("state",Z.target.value),placeholder:"CA",disabled:S||U.disabled})]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),b.jsx(ae.Input,{id:"zipCode",type:"text",value:Y.zipCode||"",onChange:Z=>V("zipCode",Z.target.value),placeholder:"94102",disabled:S||U.disabled})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),b.jsx(ae.Input,{id:"country",type:"text",value:Y.country||"",onChange:Z=>V("country",Z.target.value),placeholder:"United States",disabled:S||U.disabled})]})]})]})}const YE=Object.freeze(Object.defineProperty({__proto__:null,AddressField:qE},Symbol.toStringTag,{value:"Module"}));function GE({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=y||{},Z=(w,te)=>{R({..._,[w]:te?Number(te):void 0})},ee=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}V(!0),navigator.geolocation.getCurrentPosition(w=>{R({latitude:w.coords.latitude,longitude:w.coords.longitude,accuracy:w.coords.accuracy}),V(!1)},w=>{console.error("Error getting location:",w.message),V(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},se=w=>!w.latitude||!w.longitude?"-":`${w.latitude.toFixed(6)}, ${w.longitude.toFixed(6)}`,J=()=>{if(!_.latitude||!_.longitude)return;const w=`https://www.google.com/maps?q=${_.latitude},${_.longitude}`;window.open(w,"_blank")};return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Yb,{className:"w-4 h-4 text-muted-foreground"}),b.jsx("span",{className:"text-sm",children:se(_)}),_.latitude&&_.longitude&&b.jsx(ae.Button,{type:"button",variant:"link",size:"sm",onClick:J,className:"p-0 h-auto",children:"View on map"})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:S||Y,children:[b.jsx(QT,{className:"w-4 h-4 mr-2"}),Y?"Getting location...":"Use Current Location"]}),_.latitude&&_.longitude&&b.jsxs(ae.Button,{type:"button",variant:"link",size:"sm",onClick:J,children:[b.jsx(Yb,{className:"w-4 h-4 mr-2"}),"View on map"]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),b.jsx(ae.Input,{id:"latitude",type:"number",value:_.latitude??"",onChange:w=>Z("latitude",w.target.value),placeholder:"37.7749",disabled:S||U.disabled,step:"any",className:U.className})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),b.jsx(ae.Input,{id:"longitude",type:"number",value:_.longitude??"",onChange:w=>Z("longitude",w.target.value),placeholder:"-122.4194",disabled:S||U.disabled,step:"any"})]})]}),_.accuracy&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",_.accuracy.toFixed(0),"m"]})]})}const wE=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:GE},Symbol.toStringTag,{value:"Module"}));function VE({value:y,onChange:R,readonly:L}){const S=me.useRef(null),[U,Y]=me.useState(!1),[V,_]=me.useState(!y);me.useEffect(()=>{if(y&&S.current){const te=S.current.getContext("2d");if(te){const oe=new Image;oe.onload=()=>{te.drawImage(oe,0,0),_(!1)},oe.src=y}}},[y]);const Z=w=>{if(L)return;Y(!0),_(!1);const te=S.current;if(!te)return;const oe=te.getContext("2d");if(!oe)return;const Se=te.getBoundingClientRect(),Pe="touches"in w?w.touches[0].clientX-Se.left:w.clientX-Se.left,ie="touches"in w?w.touches[0].clientY-Se.top:w.clientY-Se.top;oe.beginPath(),oe.moveTo(Pe,ie)},ee=w=>{if(!U||L)return;const te=S.current;if(!te)return;const oe=te.getContext("2d");if(!oe)return;const Se=te.getBoundingClientRect(),Pe="touches"in w?w.touches[0].clientX-Se.left:w.clientX-Se.left,ie="touches"in w?w.touches[0].clientY-Se.top:w.clientY-Se.top;oe.lineTo(Pe,ie),oe.strokeStyle="#000",oe.lineWidth=2,oe.lineCap="round",oe.lineJoin="round",oe.stroke()},se=()=>{if(!U)return;Y(!1);const w=S.current;if(!w)return;const te=w.toDataURL("image/png");R(te)},J=()=>{const w=S.current;if(!w)return;const te=w.getContext("2d");te&&(te.clearRect(0,0,w.width,w.height),_(!0),R(""))};return L&&y?b.jsx("div",{className:"border rounded p-2 bg-white",children:b.jsx("img",{src:y,alt:"Signature",className:"max-w-full h-auto"})}):L&&!y?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No signature"}):b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"border rounded bg-white",children:b.jsx("canvas",{ref:S,width:400,height:200,className:"w-full touch-none cursor-crosshair",onMouseDown:Z,onMouseMove:ee,onMouseUp:se,onMouseLeave:se,onTouchStart:Z,onTouchMove:ee,onTouchEnd:se})}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:V?"Sign above":"Signature captured"}),b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:J,disabled:L||V,children:[b.jsx(LT,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const XE=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:VE},Symbol.toStringTag,{value:"Module"}));function QE({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=L||U.schema,Z=se=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(se)}`,ee=()=>{y&&navigator.clipboard.writeText(y)};return S?b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("span",{className:"text-sm flex-1 truncate",children:y||"-"}),y&&b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>V(!Y),children:[b.jsx(Gb,{className:"w-4 h-4 mr-2"}),Y?"Hide":"Show"," QR"]})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(ae.Input,{type:"text",value:y||"",onChange:se=>R(se.target.value),placeholder:_?.placeholder||"Enter text for QR code",disabled:S||U.disabled,className:U.className}),y&&b.jsxs(b.Fragment,{children:[b.jsx(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,children:b.jsx(XT,{className:"w-4 h-4"})}),b.jsx(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>V(!Y),children:b.jsx(Gb,{className:"w-4 h-4"})})]})]}),Y&&y&&b.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:b.jsx("img",{src:Z(y),alt:"QR Code",className:"w-48 h-48"})}),y&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",y.length," characters"]})]})}const LE=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:QE},Symbol.toStringTag,{value:"Module"}));function ZE({value:y,onChange:R,field:L,readonly:S,className:U,...Y}){const V=y||[],_=L||Y.schema,Z=()=>{const J={id:`new-${Date.now()}`,label:"New Related Record"};R([...V,J])},ee=J=>{R(V.filter(w=>w.id!==J))},se=J=>{console.log("View detail:",J)};return S?b.jsxs("div",{className:ae.cn("space-y-2",U),children:[V.length===0?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):V.map(J=>b.jsxs("div",{className:"flex items-center justify-between p-2 border rounded hover:bg-muted/50",children:[b.jsx("span",{className:"text-sm",children:J.label}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>se(J),children:b.jsx(qb,{className:"w-4 h-4"})})]},J.id)),b.jsxs("p",{className:"text-xs text-muted-foreground",children:[V.length," ",V.length===1?"record":"records"]})]}):b.jsxs("div",{className:ae.cn("space-y-3",U),children:[b.jsxs("div",{className:"space-y-2",children:[V.map(J=>b.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",children:[b.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[b.jsx(ae.Badge,{variant:"outline",children:J.id}),b.jsx("span",{className:"text-sm flex-1",children:J.label})]}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>se(J),children:b.jsx(qb,{className:"w-4 h-4"})}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>ee(J.id),disabled:Y.disabled,children:b.jsx(Gr,{className:"w-4 h-4"})})]})]},J.id)),V.length===0&&b.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",children:"No related records"})]}),b.jsxs(ae.Button,{type:"button",variant:"outline",className:"w-full",onClick:Z,disabled:Y.disabled,children:[b.jsx(FT,{className:"w-4 h-4 mr-2"}),"Add ",_?.label||"Record"]})]})}const JE=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:ZE},Symbol.toStringTag,{value:"Module"}));function KE({value:y,field:R}){const S=R.options||[];if(!y)return b.jsx("span",{children:"-"});const U=Z=>{const ee={gray:"bg-gray-100 text-gray-800 border-gray-300",red:"bg-red-100 text-red-800 border-red-300",orange:"bg-orange-100 text-orange-800 border-orange-300",yellow:"bg-yellow-100 text-yellow-800 border-yellow-300",green:"bg-green-100 text-green-800 border-green-300",blue:"bg-blue-100 text-blue-800 border-blue-300",indigo:"bg-indigo-100 text-indigo-800 border-indigo-300",purple:"bg-purple-100 text-purple-800 border-purple-300",pink:"bg-pink-100 text-pink-800 border-pink-300"};return ee[Z||"blue"]||ee.blue};if(Array.isArray(y))return b.jsx("div",{className:"flex flex-wrap gap-1",children:y.map((Z,ee)=>{const se=S.find(te=>te.value===Z),J=se?.label||Z,w=U(se?.color);return b.jsx(ae.Badge,{variant:"outline",className:w,children:J},ee)})});const Y=S.find(Z=>Z.value===y),V=Y?.label||y,_=U(Y?.color);return b.jsx(ae.Badge,{variant:"outline",className:_,children:V})}function rS({value:y}){if(!y)return b.jsx("span",{children:"-"});if(Array.isArray(y))return b.jsx("div",{className:"flex flex-wrap gap-1",children:y.map((R,L)=>{const S=R.name||R.label||R._id||String(R);return b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:S},L)})});if(typeof y=="object"&&y!==null){const R=y.name||y.label||y._id||"[Object]";return b.jsx("span",{className:"truncate",children:R})}return b.jsx("span",{className:"truncate",children:String(y)})}const $E=new Map;function Kv(y,R){$E.set(y,R)}Kv("lookup",rS),Kv("master_detail",rS),Kv("select",KE);const dS={text:()=>Promise.resolve().then(()=>WT).then(y=>({default:y.TextField})),textarea:()=>Promise.resolve().then(()=>cE).then(y=>({default:y.TextAreaField})),number:()=>Promise.resolve().then(()=>IT).then(y=>({default:y.NumberField})),boolean:()=>Promise.resolve().then(()=>PT).then(y=>({default:y.BooleanField})),select:()=>Promise.resolve().then(()=>eE).then(y=>({default:y.SelectField})),date:()=>Promise.resolve().then(()=>tE).then(y=>({default:y.DateField})),datetime:()=>Promise.resolve().then(()=>sE).then(y=>({default:y.DateTimeField})),time:()=>Promise.resolve().then(()=>rE).then(y=>({default:y.TimeField})),email:()=>Promise.resolve().then(()=>lE).then(y=>({default:y.EmailField})),phone:()=>Promise.resolve().then(()=>aE).then(y=>({default:y.PhoneField})),url:()=>Promise.resolve().then(()=>nE).then(y=>({default:y.UrlField})),currency:()=>Promise.resolve().then(()=>iE).then(y=>({default:y.CurrencyField})),percent:()=>Promise.resolve().then(()=>dE).then(y=>({default:y.PercentField})),password:()=>Promise.resolve().then(()=>hE).then(y=>({default:y.PasswordField})),markdown:()=>Promise.resolve().then(()=>Ib).then(y=>({default:y.RichTextField})),html:()=>Promise.resolve().then(()=>Ib).then(y=>({default:y.RichTextField})),lookup:()=>Promise.resolve().then(()=>fE).then(y=>({default:y.LookupField})),master_detail:()=>Promise.resolve().then(()=>JE).then(y=>({default:y.MasterDetailField})),file:()=>Promise.resolve().then(()=>yE).then(y=>({default:y.FileField})),image:()=>Promise.resolve().then(()=>pE).then(y=>({default:y.ImageField})),location:()=>Promise.resolve().then(()=>vE).then(y=>({default:y.LocationField})),formula:()=>Promise.resolve().then(()=>SE).then(y=>({default:y.FormulaField})),summary:()=>Promise.resolve().then(()=>EE).then(y=>({default:y.SummaryField})),auto_number:()=>Promise.resolve().then(()=>zE).then(y=>({default:y.AutoNumberField})),user:()=>Promise.resolve().then(()=>uS).then(y=>({default:y.UserField})),owner:()=>Promise.resolve().then(()=>uS).then(y=>({default:y.UserField})),object:()=>Promise.resolve().then(()=>DE).then(y=>({default:y.ObjectField})),vector:()=>Promise.resolve().then(()=>ME).then(y=>({default:y.VectorField})),grid:()=>Promise.resolve().then(()=>RE).then(y=>({default:y.GridField})),color:()=>Promise.resolve().then(()=>NE).then(y=>({default:y.ColorField})),slider:()=>Promise.resolve().then(()=>jE).then(y=>({default:y.SliderField})),rating:()=>Promise.resolve().then(()=>UE).then(y=>({default:y.RatingField})),code:()=>Promise.resolve().then(()=>HE).then(y=>({default:y.CodeField})),avatar:()=>Promise.resolve().then(()=>BE).then(y=>({default:y.AvatarField})),address:()=>Promise.resolve().then(()=>YE).then(y=>({default:y.AddressField})),geolocation:()=>Promise.resolve().then(()=>wE).then(y=>({default:y.GeolocationField})),signature:()=>Promise.resolve().then(()=>XE).then(y=>({default:y.SignatureField})),qrcode:()=>Promise.resolve().then(()=>LE).then(y=>({default:y.QRCodeField}))};function FE(y){const R=dS[y];if(!R){console.warn(`Unknown field type: ${y}`);return}const L=me.lazy(R);Xv.ComponentRegistry.register(y,L,{namespace:"field"})}function kE(){Object.keys(dS).forEach(y=>{FE(y)})}kE();const WE={text:Xb,textarea:Wb,number:Qb,currency:kb,percent:lS,boolean:Lb,select:Zb,date:Jb,datetime:eS,time:tS,email:Kb,phone:$b,url:Fb,password:aS,color:iS,rating:oS,image:nS,avatar:sS,lookup:Pb,slider:cS,code:fS};function $v(y){return WE[y]||null}class IE{eGui;root=null;init(R){const{value:L,field:S}=R,U=$v(S.type);this.eGui=document.createElement("div"),this.eGui.className="field-widget-cell",U?(this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(U,{value:L,onChange:()=>{},field:S,readonly:!0}))):this.eGui.textContent=L!=null?String(L):""}getGui(){return this.eGui}refresh(R){const{value:L,field:S}=R,U=$v(S.type);return U&&this.root?(this.root.render(b.jsx(U,{value:L,onChange:()=>{},field:S,readonly:!0})),!0):this.eGui?(this.eGui.textContent=L!=null?String(L):"",!0):!1}destroy(){this.root&&this.root.unmount()}}class PE{eGui;root=null;currentValue;params;init(R){this.params=R,this.currentValue=R.value;const{field:L}=R,S=$v(L.type);if(this.eGui=document.createElement("div"),this.eGui.className="field-widget-editor",S)this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(S,{value:this.currentValue,onChange:U=>{this.currentValue=U},field:L,readonly:!1}));else{const U=document.createElement("input");U.value=this.currentValue!=null?String(this.currentValue):"",U.className="ag-input-field-input ag-text-field-input",U.addEventListener("input",Y=>{this.currentValue=Y.target.value}),this.eGui.appendChild(U),setTimeout(()=>U.focus(),0)}}getGui(){return this.eGui}getValue(){return this.currentValue}destroy(){this.root&&this.root.unmount()}isPopup(){return["date","datetime","select","lookup","color"].includes(this.params.field.type)}}function eA(y){return class extends IE{init(R){super.init({...R,field:y})}refresh(R){return super.refresh({...R,field:y})}}}function tA(y){return class extends PE{init(R){super.init({...R,field:y})}}}function lA({objectName:y,dataSource:R,fields:L,fieldNames:S,filters:U,sort:Y,pageSize:V=10,pagination:_=!0,domLayout:Z="normal",animateRows:ee=!0,rowSelection:se,theme:J="quartz",height:w=500,className:te="",editable:oe=!1,editType:Se,singleClickEdit:Pe=!1,stopEditingWhenCellsLoseFocus:ie=!0,exportConfig:Be,statusBar:st,callbacks:we,columnConfig:Et,enableRangeSelection:_t=!1,enableCharts:it=!1,contextMenu:Oe}){const Ve=me.useRef(null),[ye,ht]=me.useState(!0),[qe,_e]=me.useState(null),[qt,Ft]=me.useState(null),[M,k]=me.useState([]);me.useEffect(()=>{if(!R){_e(new Error("DataSource is required")),ht(!1);return}(async()=>{try{ht(!0),_e(null);const Ze=await R.getObjectSchema(y);Ft(Ze)}catch(Ze){const Yt=Ze instanceof Error?Ze:new Error(String(Ze));_e(Yt),we?.onDataError?.(Yt)}finally{ht(!1)}})()},[y,R,we]),me.useEffect(()=>{if(!R||!qt)return;(async()=>{try{ht(!0),_e(null);const Ze={$top:V,$skip:0};U&&(Ze.$filter=U),Y&&(Ze.$orderby=Y);const Yt=await R.find(y,Ze);k(Yt.data||[]),we?.onDataLoaded?.(Yt.data||[])}catch(Ze){const Yt=Ze instanceof Error?Ze:new Error(String(Ze));_e(Yt),we?.onDataError?.(Yt)}finally{ht(!1)}})()},[y,R,qt,U,Y,V,we]);const ne=me.useMemo(()=>{if(!qt?.fields)return[];const le=L||Object.values(qt.fields);return(S?le.filter(Yt=>S.includes(Yt.name)):le).map(Yt=>{const Gt={field:Yt.name,headerName:Yt.label||Yt.name,sortable:Yt.sortable!==!1,filter:aA(Yt),editable:oe&&!Yt.readonly};return Et&&(Et.resizable!==void 0&&(Gt.resizable=Et.resizable),Et.sortable!==void 0&&Gt.sortable===void 0&&(Gt.sortable=Et.sortable)),nA(Gt,Yt),Gt})},[qt,L,S,oe,Et]),be=me.useMemo(()=>{if(!st?.enabled)return;const le=st.aggregations||["count","sum","avg"],Ze=[];return le.includes("count")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["count"]}}),le.includes("sum")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["sum"]}}),le.includes("avg")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["avg"]}}),le.includes("min")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["min"]}}),le.includes("max")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["max"]}}),Ze},[st]),ze=me.useCallback(()=>{if(!Ve.current?.api)return;const le={fileName:Be?.fileName||`${y}-export.csv`,skipColumnHeaders:Be?.skipColumnHeaders||!1,allColumns:Be?.allColumns||!1,onlySelected:Be?.onlySelected||!1};if(Ve.current.api.exportDataAsCsv(le),we?.onExport){const Ze=Be?.onlySelected?Ve.current.api.getSelectedRows():M;we.onExport(Ze||[],"csv")}},[Be,we,M,y]),K=me.useCallback(le=>{if(!Oe?.enabled)return[];const Ze=[];return(Oe.items||["copy","copyWithHeaders","separator","export"]).forEach(Gt=>{Gt==="export"?Ze.push({name:"Export CSV",icon:"<span>📥</span>",action:()=>ze()}):Gt==="autoSizeAll"?Ze.push({name:"Auto-size All Columns",action:()=>{Ve.current?.api&&Ve.current.api.autoSizeAllColumns()}}):Gt==="resetColumns"?Ze.push({name:"Reset Columns",action:()=>{Ve.current?.api&&Ve.current.api.resetColumnState()}}):Ze.push(Gt)}),Oe.customItems&&(Ze.length>0&&Ze.push("separator"),Oe.customItems.forEach(Gt=>{Ze.push({name:Gt.name,disabled:Gt.disabled,action:()=>{we?.onContextMenuAction&&we.onContextMenuAction(Gt.action,le.node?.data)}})})),Ze},[Oe,ze,we]),de=me.useCallback(le=>{we?.onCellClicked?.(le)},[we]),pe=me.useCallback(le=>{we?.onRowClicked?.(le)},[we]),ue=me.useCallback(le=>{we?.onSelectionChanged?.(le)},[we]),Ee=me.useCallback(async le=>{if(we?.onCellValueChanged?.(le),R&&le.data&&le.data.id)try{await R.update(y,le.data.id,{[le.colDef.field]:le.newValue})}catch(Ze){console.error("Failed to update record:",Ze),le.node.setDataValue(le.colDef.field,le.oldValue)}},[we,R,y]),Al=me.useCallback(le=>{Ve.current=le},[]),ke=me.useMemo(()=>({pagination:_,paginationPageSize:V,domLayout:Z,animateRows:ee,rowSelection:se,editType:Se,singleClickEdit:Pe,stopEditingWhenCellsLoseFocus:ie,statusBar:be?{statusPanels:be}:void 0,enableRangeSelection:_t,enableCharts:it,getContextMenuItems:Oe?.enabled?K:void 0,suppressCellFocus:!oe,enableCellTextSelection:!0,ensureDomOrder:!0,onCellClicked:de,onRowClicked:pe,onSelectionChanged:ue,onCellValueChanged:Ee,onGridReady:Al}),[_,V,Z,ee,se,Se,Pe,ie,be,_t,it,Oe,K,oe,de,pe,ue,Ee,Al]),Jl=me.useMemo(()=>({height:typeof w=="number"?`${w}px`:w,width:"100%"}),[w]),ic=[`ag-theme-${J}`,"rounded-xl","border","border-border","overflow-hidden","shadow-lg",te].filter(Boolean).join(" ");return ye?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-muted-foreground",children:["Loading ",y,"..."]})}):qe?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-destructive",children:["Error loading data: ",qe.message]})}):b.jsxs("div",{className:"object-aggrid-container",children:[Be?.enabled&&b.jsx("div",{className:"mb-2 flex gap-2",children:b.jsx("button",{onClick:ze,className:"px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",children:"Export CSV"})}),b.jsx("div",{className:ic,style:Jl,children:b.jsx(Eb.AgGridReact,{ref:Ve,rowData:M,columnDefs:ne,gridOptions:ke})})]})}function aA(y){return y.filterable===!1?!1:RT[y.type]||"agTextColumnFilter"}function nA(y,R){if(["text","textarea","number","currency","percent","boolean","select","date","datetime","time","email","phone","url","password","color","rating","image","avatar","lookup","slider","code"].includes(R.type))y.cellRenderer=eA(R),y.editable&&(y.cellEditor=tA(R),["date","datetime","select","lookup","color"].includes(R.type)&&(y.cellEditorPopup=!0));else switch(R.type){case"master_detail":y.valueFormatter=S=>S.value?typeof S.value=="object"?S.value.name||S.value.label||S.value.id||"":String(S.value):"";break;case"object":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Object]",S};break;case"vector":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Vector]",S};break;case"grid":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Grid]",S};break;default:y.valueFormatter=S=>S.value!=null?String(S.value):""}}const uA=Object.freeze(Object.defineProperty({__proto__:null,default:lA},Symbol.toStringTag,{value:"Module"}));bn.AgGridRenderer=Qv,bn.ObjectAgGridRenderer=Lv,bn.aggridComponents=CT,Object.defineProperty(bn,Symbol.toStringTag,{value:"Module"})}));
229
+ }`,disabled:S||U.disabled,className:ae.cn("font-mono text-xs",ee?"border-red-500 focus-visible:ring-red-500":"",U.className),rows:6}),ee&&b.jsx("p",{className:"text-xs text-red-500",children:ee})]})}const DE=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:OE},Symbol.toStringTag,{value:"Module"}));function CE({value:y,field:R,...L}){const U=(R||L.schema)?.dimensions||(Array.isArray(y)?y.length:0);if(!y||!Array.isArray(y))return b.jsx("span",{className:"text-sm text-gray-500",children:"-"});const Y=y.slice(0,3).map(V=>{const _=Number(V);return isNaN(_)?"0":_.toFixed(4)}).join(", ");return b.jsxs("div",{className:`text-sm ${L.className||""}`,children:[b.jsxs("span",{className:"font-mono text-gray-700",children:["[",Y,"...]"]}),b.jsxs("span",{className:"text-gray-500 ml-2",children:["(",U,"D)"]})]})}const ME=Object.freeze(Object.defineProperty({__proto__:null,VectorField:CE},Symbol.toStringTag,{value:"Module"}));function _E({value:y,field:R,readonly:L,...S}){const Y=(R||S.schema)?.columns||[];return!y||!Array.isArray(y)?b.jsx("span",{className:"text-sm text-gray-500",children:"-"}):L?b.jsx("div",{className:ae.cn("text-sm",S.className),children:b.jsxs("span",{className:"text-gray-700",children:[y.length," rows"]})}):b.jsxs("div",{className:ae.cn("border border-gray-200 rounded-md overflow-hidden",S.className),children:[b.jsx("div",{className:"overflow-auto max-h-60",children:b.jsxs("table",{className:"w-full text-sm",children:[b.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:b.jsx("tr",{children:Y.map((V,_)=>b.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-700",children:V.label||V.name},_))})}),b.jsx("tbody",{className:"divide-y divide-gray-200",children:y.slice(0,5).map((V,_)=>b.jsx("tr",{className:"hover:bg-gray-50",children:Y.map((Z,ee)=>b.jsx("td",{className:"px-3 py-2 text-gray-900",children:V[Z.name]!=null?String(V[Z.name]):"-"},ee))},_))})]})}),y.length>5&&b.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200",children:["Showing 5 of ",y.length," rows"]})]})}const RE=Object.freeze(Object.defineProperty({__proto__:null,GridField:_E},Symbol.toStringTag,{value:"Module"}));function iS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("div",{className:"w-6 h-6 rounded border border-input",style:{backgroundColor:y||"#000000"}}),b.jsx("span",{className:"text-sm",children:y||"-"})]}):b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"color",value:y||"#000000",onChange:V=>R(V.target.value),disabled:S||U.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),b.jsx(ae.Input,{type:"text",value:y||"",onChange:V=>R(V.target.value),placeholder:Y?.placeholder||"#000000",disabled:S||U.disabled,className:U.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const NE=Object.freeze(Object.defineProperty({__proto__:null,ColorField:iS},Symbol.toStringTag,{value:"Module"}));function cS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.min??0,_=Y?.max??100,Z=Y?.step??1;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-medium",children:y??V}),b.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",_]})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx(ae.Slider,{value:[y??V],onValueChange:ee=>R(ee[0]),min:V,max:_,step:Z,disabled:S||U.disabled,className:U.className}),b.jsx("span",{className:"text-sm font-medium w-12 text-right",children:y??V})]})}const jE=Object.freeze(Object.defineProperty({__proto__:null,SliderField:cS},Symbol.toStringTag,{value:"Module"}));function oS({value:y,onChange:R,field:L,readonly:S,className:U,...Y}){const _=(L||Y.schema)?.max??5,Z=y??0,[ee,se]=me.useState(null),J=ee!==null?ee:Z;return S?b.jsxs("div",{className:ae.cn("flex items-center gap-1",U),children:[Array.from({length:_},(w,te)=>b.jsx(wb,{className:`w-5 h-5 ${te<Z?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},te)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]}):b.jsxs("div",{className:ae.cn("flex items-center gap-1",U),children:[Array.from({length:_},(w,te)=>b.jsx("button",{type:"button",onClick:()=>R(te+1),onMouseEnter:()=>se(te+1),onMouseLeave:()=>se(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:S||Y.disabled,children:b.jsx(wb,{className:`w-5 h-5 transition-colors ${te<J?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},te)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]})}const UE=Object.freeze(Object.defineProperty({__proto__:null,RatingField:oS},Symbol.toStringTag,{value:"Module"}));function fS({value:y,onChange:R,field:L,readonly:S,...U}){const Y=L||U.schema,V=Y?.language??"javascript";return S?b.jsx("pre",{className:ae.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",U.className),children:b.jsx("code",{children:y||"-"})}):b.jsx(ae.Textarea,{value:y||"",onChange:_=>R(_.target.value),placeholder:Y?.placeholder||`// Write ${V} code here...`,disabled:S||U.disabled,className:ae.cn("font-mono text-sm",U.className),rows:12,spellCheck:!1})}const HE=Object.freeze(Object.defineProperty({__proto__:null,CodeField:fS},Symbol.toStringTag,{value:"Module"}));function sS({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=me.useRef(null),Z=L||U.schema,ee=w=>{const te=w.target.files?.[0];if(!te)return;if(!te.type.startsWith("image/")){console.error("Please select an image file");return}if(te.size>5*1024*1024){console.error("File size must be less than 5MB");return}const oe=new FileReader;oe.onloadend=()=>{R(oe.result)},oe.readAsDataURL(te)},se=()=>{R("")},J=()=>(Z?.defaultName||Z?.label||"User").split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2);return S?b.jsxs(ae.Avatar,{className:"w-16 h-16",children:[y&&b.jsx(ae.AvatarImage,{src:y,alt:Z?.label}),b.jsx(ae.AvatarFallback,{children:J()})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative",onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),children:[b.jsxs(ae.Avatar,{className:"w-16 h-16",children:[y&&b.jsx(ae.AvatarImage,{src:y,alt:Z?.label}),b.jsx(ae.AvatarFallback,{children:J()})]}),!S&&Y&&y&&b.jsx("button",{type:"button",onClick:se,className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",children:b.jsx(Gr,{className:"w-3 h-3"})})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("input",{ref:_,type:"file",accept:"image/*",onChange:ee,className:"hidden"}),b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>_.current?.click(),disabled:S||U.disabled,children:[b.jsx(Vb,{className:"w-4 h-4 mr-2"}),y?"Change":"Upload"," Avatar"]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const BE=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:sS},Symbol.toStringTag,{value:"Module"}));function qE({value:y,onChange:R,field:L,readonly:S,...U}){const Y=y||{},V=(Z,ee)=>{R({...Y,[Z]:ee})},_=Z=>[Z.street,Z.city,[Z.state,Z.zipCode].filter(Boolean).join(" "),Z.country].filter(Boolean).join(", ")||"-";return S?b.jsx("span",{className:"text-sm",children:_(Y)}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),b.jsx(ae.Input,{id:"street",type:"text",value:Y.street||"",onChange:Z=>V("street",Z.target.value),placeholder:"123 Main St",disabled:S||U.disabled,className:U.className})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"city",className:"text-xs",children:"City"}),b.jsx(ae.Input,{id:"city",type:"text",value:Y.city||"",onChange:Z=>V("city",Z.target.value),placeholder:"San Francisco",disabled:S||U.disabled})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),b.jsx(ae.Input,{id:"state",type:"text",value:Y.state||"",onChange:Z=>V("state",Z.target.value),placeholder:"CA",disabled:S||U.disabled})]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),b.jsx(ae.Input,{id:"zipCode",type:"text",value:Y.zipCode||"",onChange:Z=>V("zipCode",Z.target.value),placeholder:"94102",disabled:S||U.disabled})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),b.jsx(ae.Input,{id:"country",type:"text",value:Y.country||"",onChange:Z=>V("country",Z.target.value),placeholder:"United States",disabled:S||U.disabled})]})]})]})}const YE=Object.freeze(Object.defineProperty({__proto__:null,AddressField:qE},Symbol.toStringTag,{value:"Module"}));function GE({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=y||{},Z=(w,te)=>{R({..._,[w]:te?Number(te):void 0})},ee=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}V(!0),navigator.geolocation.getCurrentPosition(w=>{R({latitude:w.coords.latitude,longitude:w.coords.longitude,accuracy:w.coords.accuracy}),V(!1)},w=>{console.error("Error getting location:",w.message),V(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},se=w=>!w.latitude||!w.longitude?"-":`${w.latitude.toFixed(6)}, ${w.longitude.toFixed(6)}`,J=()=>{if(!_.latitude||!_.longitude)return;const w=`https://www.google.com/maps?q=${_.latitude},${_.longitude}`;window.open(w,"_blank")};return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Yb,{className:"w-4 h-4 text-muted-foreground"}),b.jsx("span",{className:"text-sm",children:se(_)}),_.latitude&&_.longitude&&b.jsx(ae.Button,{type:"button",variant:"link",size:"sm",onClick:J,className:"p-0 h-auto",children:"View on map"})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:S||Y,children:[b.jsx(QT,{className:"w-4 h-4 mr-2"}),Y?"Getting location...":"Use Current Location"]}),_.latitude&&_.longitude&&b.jsxs(ae.Button,{type:"button",variant:"link",size:"sm",onClick:J,children:[b.jsx(Yb,{className:"w-4 h-4 mr-2"}),"View on map"]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),b.jsx(ae.Input,{id:"latitude",type:"number",value:_.latitude??"",onChange:w=>Z("latitude",w.target.value),placeholder:"37.7749",disabled:S||U.disabled,step:"any",className:U.className})]}),b.jsxs("div",{children:[b.jsx(ae.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),b.jsx(ae.Input,{id:"longitude",type:"number",value:_.longitude??"",onChange:w=>Z("longitude",w.target.value),placeholder:"-122.4194",disabled:S||U.disabled,step:"any"})]})]}),_.accuracy&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",_.accuracy.toFixed(0),"m"]})]})}const wE=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:GE},Symbol.toStringTag,{value:"Module"}));function VE({value:y,onChange:R,readonly:L}){const S=me.useRef(null),[U,Y]=me.useState(!1),[V,_]=me.useState(!y);me.useEffect(()=>{if(y&&S.current){const te=S.current.getContext("2d");if(te){const oe=new Image;oe.onload=()=>{te.drawImage(oe,0,0),_(!1)},oe.src=y}}},[y]);const Z=w=>{if(L)return;Y(!0),_(!1);const te=S.current;if(!te)return;const oe=te.getContext("2d");if(!oe)return;const Se=te.getBoundingClientRect(),Pe="touches"in w?w.touches[0].clientX-Se.left:w.clientX-Se.left,ie="touches"in w?w.touches[0].clientY-Se.top:w.clientY-Se.top;oe.beginPath(),oe.moveTo(Pe,ie)},ee=w=>{if(!U||L)return;const te=S.current;if(!te)return;const oe=te.getContext("2d");if(!oe)return;const Se=te.getBoundingClientRect(),Pe="touches"in w?w.touches[0].clientX-Se.left:w.clientX-Se.left,ie="touches"in w?w.touches[0].clientY-Se.top:w.clientY-Se.top;oe.lineTo(Pe,ie),oe.strokeStyle="#000",oe.lineWidth=2,oe.lineCap="round",oe.lineJoin="round",oe.stroke()},se=()=>{if(!U)return;Y(!1);const w=S.current;if(!w)return;const te=w.toDataURL("image/png");R(te)},J=()=>{const w=S.current;if(!w)return;const te=w.getContext("2d");te&&(te.clearRect(0,0,w.width,w.height),_(!0),R(""))};return L&&y?b.jsx("div",{className:"border rounded p-2 bg-white",children:b.jsx("img",{src:y,alt:"Signature",loading:"lazy",className:"max-w-full h-auto"})}):L&&!y?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No signature"}):b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"border rounded bg-white",children:b.jsx("canvas",{ref:S,width:400,height:200,className:"w-full touch-none cursor-crosshair",onMouseDown:Z,onMouseMove:ee,onMouseUp:se,onMouseLeave:se,onTouchStart:Z,onTouchMove:ee,onTouchEnd:se})}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:V?"Sign above":"Signature captured"}),b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:J,disabled:L||V,children:[b.jsx(LT,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const XE=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:VE},Symbol.toStringTag,{value:"Module"}));function QE({value:y,onChange:R,field:L,readonly:S,...U}){const[Y,V]=me.useState(!1),_=L||U.schema,Z=se=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(se)}`,ee=()=>{y&&navigator.clipboard.writeText(y)};return S?b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("span",{className:"text-sm flex-1 truncate",children:y||"-"}),y&&b.jsxs(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>V(!Y),children:[b.jsx(Gb,{className:"w-4 h-4 mr-2"}),Y?"Hide":"Show"," QR"]})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(ae.Input,{type:"text",value:y||"",onChange:se=>R(se.target.value),placeholder:_?.placeholder||"Enter text for QR code",disabled:S||U.disabled,className:U.className}),y&&b.jsxs(b.Fragment,{children:[b.jsx(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,children:b.jsx(XT,{className:"w-4 h-4"})}),b.jsx(ae.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>V(!Y),children:b.jsx(Gb,{className:"w-4 h-4"})})]})]}),Y&&y&&b.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:b.jsx("img",{src:Z(y),alt:"QR Code",className:"w-48 h-48"})}),y&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",y.length," characters"]})]})}const LE=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:QE},Symbol.toStringTag,{value:"Module"}));function ZE({value:y,onChange:R,field:L,readonly:S,className:U,...Y}){const V=y||[],_=L||Y.schema,Z=()=>{const J={id:`new-${Date.now()}`,label:"New Related Record"};R([...V,J])},ee=J=>{R(V.filter(w=>w.id!==J))},se=J=>{console.log("View detail:",J)};return S?b.jsxs("div",{className:ae.cn("space-y-2",U),children:[V.length===0?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):V.map(J=>b.jsxs("div",{className:"flex items-center justify-between p-2 border rounded hover:bg-muted/50",children:[b.jsx("span",{className:"text-sm",children:J.label}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>se(J),children:b.jsx(qb,{className:"w-4 h-4"})})]},J.id)),b.jsxs("p",{className:"text-xs text-muted-foreground",children:[V.length," ",V.length===1?"record":"records"]})]}):b.jsxs("div",{className:ae.cn("space-y-3",U),children:[b.jsxs("div",{className:"space-y-2",children:[V.map(J=>b.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",children:[b.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[b.jsx(ae.Badge,{variant:"outline",children:J.id}),b.jsx("span",{className:"text-sm flex-1",children:J.label})]}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>se(J),children:b.jsx(qb,{className:"w-4 h-4"})}),b.jsx(ae.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>ee(J.id),disabled:Y.disabled,children:b.jsx(Gr,{className:"w-4 h-4"})})]})]},J.id)),V.length===0&&b.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",children:"No related records"})]}),b.jsxs(ae.Button,{type:"button",variant:"outline",className:"w-full",onClick:Z,disabled:Y.disabled,children:[b.jsx(FT,{className:"w-4 h-4 mr-2"}),"Add ",_?.label||"Record"]})]})}const JE=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:ZE},Symbol.toStringTag,{value:"Module"}));function KE({value:y,field:R}){const S=R.options||[];if(!y)return b.jsx("span",{children:"-"});const U=Z=>{const ee={gray:"bg-gray-100 text-gray-800 border-gray-300",red:"bg-red-100 text-red-800 border-red-300",orange:"bg-orange-100 text-orange-800 border-orange-300",yellow:"bg-yellow-100 text-yellow-800 border-yellow-300",green:"bg-green-100 text-green-800 border-green-300",blue:"bg-blue-100 text-blue-800 border-blue-300",indigo:"bg-indigo-100 text-indigo-800 border-indigo-300",purple:"bg-purple-100 text-purple-800 border-purple-300",pink:"bg-pink-100 text-pink-800 border-pink-300"};return ee[Z||"blue"]||ee.blue};if(Array.isArray(y))return b.jsx("div",{className:"flex flex-wrap gap-1",children:y.map((Z,ee)=>{const se=S.find(te=>te.value===Z),J=se?.label||Z,w=U(se?.color);return b.jsx(ae.Badge,{variant:"outline",className:w,children:J},ee)})});const Y=S.find(Z=>Z.value===y),V=Y?.label||y,_=U(Y?.color);return b.jsx(ae.Badge,{variant:"outline",className:_,children:V})}function rS({value:y}){if(!y)return b.jsx("span",{children:"-"});if(Array.isArray(y))return b.jsx("div",{className:"flex flex-wrap gap-1",children:y.map((R,L)=>{const S=R.name||R.label||R._id||String(R);return b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:S},L)})});if(typeof y=="object"&&y!==null){const R=y.name||y.label||y._id||"[Object]";return b.jsx("span",{className:"truncate",children:R})}return b.jsx("span",{className:"truncate",children:String(y)})}const $E=new Map;function Kv(y,R){$E.set(y,R)}Kv("lookup",rS),Kv("master_detail",rS),Kv("select",KE);const dS={text:()=>Promise.resolve().then(()=>WT).then(y=>({default:y.TextField})),textarea:()=>Promise.resolve().then(()=>cE).then(y=>({default:y.TextAreaField})),number:()=>Promise.resolve().then(()=>IT).then(y=>({default:y.NumberField})),boolean:()=>Promise.resolve().then(()=>PT).then(y=>({default:y.BooleanField})),select:()=>Promise.resolve().then(()=>eE).then(y=>({default:y.SelectField})),date:()=>Promise.resolve().then(()=>tE).then(y=>({default:y.DateField})),datetime:()=>Promise.resolve().then(()=>sE).then(y=>({default:y.DateTimeField})),time:()=>Promise.resolve().then(()=>rE).then(y=>({default:y.TimeField})),email:()=>Promise.resolve().then(()=>lE).then(y=>({default:y.EmailField})),phone:()=>Promise.resolve().then(()=>aE).then(y=>({default:y.PhoneField})),url:()=>Promise.resolve().then(()=>nE).then(y=>({default:y.UrlField})),currency:()=>Promise.resolve().then(()=>iE).then(y=>({default:y.CurrencyField})),percent:()=>Promise.resolve().then(()=>dE).then(y=>({default:y.PercentField})),password:()=>Promise.resolve().then(()=>hE).then(y=>({default:y.PasswordField})),markdown:()=>Promise.resolve().then(()=>Ib).then(y=>({default:y.RichTextField})),html:()=>Promise.resolve().then(()=>Ib).then(y=>({default:y.RichTextField})),lookup:()=>Promise.resolve().then(()=>fE).then(y=>({default:y.LookupField})),master_detail:()=>Promise.resolve().then(()=>JE).then(y=>({default:y.MasterDetailField})),file:()=>Promise.resolve().then(()=>yE).then(y=>({default:y.FileField})),image:()=>Promise.resolve().then(()=>pE).then(y=>({default:y.ImageField})),location:()=>Promise.resolve().then(()=>vE).then(y=>({default:y.LocationField})),formula:()=>Promise.resolve().then(()=>SE).then(y=>({default:y.FormulaField})),summary:()=>Promise.resolve().then(()=>EE).then(y=>({default:y.SummaryField})),auto_number:()=>Promise.resolve().then(()=>zE).then(y=>({default:y.AutoNumberField})),user:()=>Promise.resolve().then(()=>uS).then(y=>({default:y.UserField})),owner:()=>Promise.resolve().then(()=>uS).then(y=>({default:y.UserField})),object:()=>Promise.resolve().then(()=>DE).then(y=>({default:y.ObjectField})),vector:()=>Promise.resolve().then(()=>ME).then(y=>({default:y.VectorField})),grid:()=>Promise.resolve().then(()=>RE).then(y=>({default:y.GridField})),color:()=>Promise.resolve().then(()=>NE).then(y=>({default:y.ColorField})),slider:()=>Promise.resolve().then(()=>jE).then(y=>({default:y.SliderField})),rating:()=>Promise.resolve().then(()=>UE).then(y=>({default:y.RatingField})),code:()=>Promise.resolve().then(()=>HE).then(y=>({default:y.CodeField})),avatar:()=>Promise.resolve().then(()=>BE).then(y=>({default:y.AvatarField})),address:()=>Promise.resolve().then(()=>YE).then(y=>({default:y.AddressField})),geolocation:()=>Promise.resolve().then(()=>wE).then(y=>({default:y.GeolocationField})),signature:()=>Promise.resolve().then(()=>XE).then(y=>({default:y.SignatureField})),qrcode:()=>Promise.resolve().then(()=>LE).then(y=>({default:y.QRCodeField}))};function FE(y){const R=dS[y];if(!R){console.warn(`Unknown field type: ${y}`);return}const L=me.lazy(R);Xv.ComponentRegistry.register(y,L,{namespace:"field"})}function kE(){Object.keys(dS).forEach(y=>{FE(y)})}kE();const WE={text:Xb,textarea:Wb,number:Qb,currency:kb,percent:lS,boolean:Lb,select:Zb,date:Jb,datetime:eS,time:tS,email:Kb,phone:$b,url:Fb,password:aS,color:iS,rating:oS,image:nS,avatar:sS,lookup:Pb,slider:cS,code:fS};function $v(y){return WE[y]||null}class IE{eGui;root=null;init(R){const{value:L,field:S}=R,U=$v(S.type);this.eGui=document.createElement("div"),this.eGui.className="field-widget-cell",U?(this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(U,{value:L,onChange:()=>{},field:S,readonly:!0}))):this.eGui.textContent=L!=null?String(L):""}getGui(){return this.eGui}refresh(R){const{value:L,field:S}=R,U=$v(S.type);return U&&this.root?(this.root.render(b.jsx(U,{value:L,onChange:()=>{},field:S,readonly:!0})),!0):this.eGui?(this.eGui.textContent=L!=null?String(L):"",!0):!1}destroy(){this.root&&this.root.unmount()}}class PE{eGui;root=null;currentValue;params;init(R){this.params=R,this.currentValue=R.value;const{field:L}=R,S=$v(L.type);if(this.eGui=document.createElement("div"),this.eGui.className="field-widget-editor",S)this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(S,{value:this.currentValue,onChange:U=>{this.currentValue=U},field:L,readonly:!1}));else{const U=document.createElement("input");U.value=this.currentValue!=null?String(this.currentValue):"",U.className="ag-input-field-input ag-text-field-input",U.addEventListener("input",Y=>{this.currentValue=Y.target.value}),this.eGui.appendChild(U),setTimeout(()=>U.focus(),0)}}getGui(){return this.eGui}getValue(){return this.currentValue}destroy(){this.root&&this.root.unmount()}isPopup(){return["date","datetime","select","lookup","color"].includes(this.params.field.type)}}function eA(y){return class extends IE{init(R){super.init({...R,field:y})}refresh(R){return super.refresh({...R,field:y})}}}function tA(y){return class extends PE{init(R){super.init({...R,field:y})}}}function lA({objectName:y,dataSource:R,fields:L,fieldNames:S,filters:U,sort:Y,pageSize:V=10,pagination:_=!0,domLayout:Z="normal",animateRows:ee=!0,rowSelection:se,theme:J="quartz",height:w=500,className:te="",editable:oe=!1,editType:Se,singleClickEdit:Pe=!1,stopEditingWhenCellsLoseFocus:ie=!0,exportConfig:Be,statusBar:st,callbacks:we,columnConfig:Et,enableRangeSelection:_t=!1,enableCharts:it=!1,contextMenu:Oe}){const Ve=me.useRef(null),[ye,ht]=me.useState(!0),[qe,_e]=me.useState(null),[qt,Ft]=me.useState(null),[M,k]=me.useState([]);me.useEffect(()=>{if(!R){_e(new Error("DataSource is required")),ht(!1);return}(async()=>{try{ht(!0),_e(null);const Ze=await R.getObjectSchema(y);Ft(Ze)}catch(Ze){const Yt=Ze instanceof Error?Ze:new Error(String(Ze));_e(Yt),we?.onDataError?.(Yt)}finally{ht(!1)}})()},[y,R,we]),me.useEffect(()=>{if(!R||!qt)return;(async()=>{try{ht(!0),_e(null);const Ze={$top:V,$skip:0};U&&(Ze.$filter=U),Y&&(Ze.$orderby=Y);const Yt=await R.find(y,Ze);k(Yt.data||[]),we?.onDataLoaded?.(Yt.data||[])}catch(Ze){const Yt=Ze instanceof Error?Ze:new Error(String(Ze));_e(Yt),we?.onDataError?.(Yt)}finally{ht(!1)}})()},[y,R,qt,U,Y,V,we]);const ne=me.useMemo(()=>{if(!qt?.fields)return[];const le=L||Object.values(qt.fields);return(S?le.filter(Yt=>S.includes(Yt.name)):le).map(Yt=>{const Gt={field:Yt.name,headerName:Yt.label||Yt.name,sortable:Yt.sortable!==!1,filter:aA(Yt),editable:oe&&!Yt.readonly};return Et&&(Et.resizable!==void 0&&(Gt.resizable=Et.resizable),Et.sortable!==void 0&&Gt.sortable===void 0&&(Gt.sortable=Et.sortable)),nA(Gt,Yt),Gt})},[qt,L,S,oe,Et]),be=me.useMemo(()=>{if(!st?.enabled)return;const le=st.aggregations||["count","sum","avg"],Ze=[];return le.includes("count")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["count"]}}),le.includes("sum")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["sum"]}}),le.includes("avg")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["avg"]}}),le.includes("min")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["min"]}}),le.includes("max")&&Ze.push({statusPanel:"agAggregationComponent",statusPanelParams:{aggFuncs:["max"]}}),Ze},[st]),ze=me.useCallback(()=>{if(!Ve.current?.api)return;const le={fileName:Be?.fileName||`${y}-export.csv`,skipColumnHeaders:Be?.skipColumnHeaders||!1,allColumns:Be?.allColumns||!1,onlySelected:Be?.onlySelected||!1};if(Ve.current.api.exportDataAsCsv(le),we?.onExport){const Ze=Be?.onlySelected?Ve.current.api.getSelectedRows():M;we.onExport(Ze||[],"csv")}},[Be,we,M,y]),K=me.useCallback(le=>{if(!Oe?.enabled)return[];const Ze=[];return(Oe.items||["copy","copyWithHeaders","separator","export"]).forEach(Gt=>{Gt==="export"?Ze.push({name:"Export CSV",icon:"<span>📥</span>",action:()=>ze()}):Gt==="autoSizeAll"?Ze.push({name:"Auto-size All Columns",action:()=>{Ve.current?.api&&Ve.current.api.autoSizeAllColumns()}}):Gt==="resetColumns"?Ze.push({name:"Reset Columns",action:()=>{Ve.current?.api&&Ve.current.api.resetColumnState()}}):Ze.push(Gt)}),Oe.customItems&&(Ze.length>0&&Ze.push("separator"),Oe.customItems.forEach(Gt=>{Ze.push({name:Gt.name,disabled:Gt.disabled,action:()=>{we?.onContextMenuAction&&we.onContextMenuAction(Gt.action,le.node?.data)}})})),Ze},[Oe,ze,we]),de=me.useCallback(le=>{we?.onCellClicked?.(le)},[we]),pe=me.useCallback(le=>{we?.onRowClicked?.(le)},[we]),ue=me.useCallback(le=>{we?.onSelectionChanged?.(le)},[we]),Ee=me.useCallback(async le=>{if(we?.onCellValueChanged?.(le),R&&le.data&&le.data.id)try{await R.update(y,le.data.id,{[le.colDef.field]:le.newValue})}catch(Ze){console.error("Failed to update record:",Ze),le.node.setDataValue(le.colDef.field,le.oldValue)}},[we,R,y]),Al=me.useCallback(le=>{Ve.current=le},[]),ke=me.useMemo(()=>({pagination:_,paginationPageSize:V,domLayout:Z,animateRows:ee,rowSelection:se,editType:Se,singleClickEdit:Pe,stopEditingWhenCellsLoseFocus:ie,statusBar:be?{statusPanels:be}:void 0,enableRangeSelection:_t,enableCharts:it,getContextMenuItems:Oe?.enabled?K:void 0,suppressCellFocus:!oe,enableCellTextSelection:!0,ensureDomOrder:!0,onCellClicked:de,onRowClicked:pe,onSelectionChanged:ue,onCellValueChanged:Ee,onGridReady:Al}),[_,V,Z,ee,se,Se,Pe,ie,be,_t,it,Oe,K,oe,de,pe,ue,Ee,Al]),Jl=me.useMemo(()=>({height:typeof w=="number"?`${w}px`:w,width:"100%"}),[w]),ic=[`ag-theme-${J}`,"rounded-xl","border","border-border","overflow-hidden","shadow-lg",te].filter(Boolean).join(" ");return ye?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-muted-foreground",children:["Loading ",y,"..."]})}):qe?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-destructive",children:["Error loading data: ",qe.message]})}):b.jsxs("div",{className:"object-aggrid-container",children:[Be?.enabled&&b.jsx("div",{className:"mb-2 flex gap-2",children:b.jsx("button",{onClick:ze,className:"px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",children:"Export CSV"})}),b.jsx("div",{className:ic,style:Jl,children:b.jsx(Eb.AgGridReact,{ref:Ve,rowData:M,columnDefs:ne,gridOptions:ke})})]})}function aA(y){return y.filterable===!1?!1:RT[y.type]||"agTextColumnFilter"}function nA(y,R){if(["text","textarea","number","currency","percent","boolean","select","date","datetime","time","email","phone","url","password","color","rating","image","avatar","lookup","slider","code"].includes(R.type))y.cellRenderer=eA(R),y.editable&&(y.cellEditor=tA(R),["date","datetime","select","lookup","color"].includes(R.type)&&(y.cellEditorPopup=!0));else switch(R.type){case"master_detail":y.valueFormatter=S=>S.value?typeof S.value=="object"?S.value.name||S.value.label||S.value.id||"":String(S.value):"";break;case"object":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Object]",S};break;case"vector":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Vector]",S};break;case"grid":y.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Grid]",S};break;default:y.valueFormatter=S=>S.value!=null?String(S.value):""}}const uA=Object.freeze(Object.defineProperty({__proto__:null,default:lA},Symbol.toStringTag,{value:"Module"}));bn.AgGridRenderer=Qv,bn.ObjectAgGridRenderer=Lv,bn.aggridComponents=CT,Object.defineProperty(bn,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-aggrid",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "AG Grid data grid plugin for Object UI, powered by AG Grid Community",
@@ -25,23 +25,23 @@
25
25
  "./style.css": "./dist/index.css"
26
26
  },
27
27
  "dependencies": {
28
- "@object-ui/components": "2.0.0",
29
- "@object-ui/core": "2.0.0",
30
- "@object-ui/fields": "2.0.0",
31
- "@object-ui/react": "2.0.0",
32
- "@object-ui/types": "2.0.0",
33
- "@object-ui/data-objectstack": "2.0.0"
28
+ "@object-ui/components": "3.0.0",
29
+ "@object-ui/core": "3.0.0",
30
+ "@object-ui/data-objectstack": "3.0.0",
31
+ "@object-ui/fields": "3.0.0",
32
+ "@object-ui/react": "3.0.0",
33
+ "@object-ui/types": "3.0.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "react": "^18.0.0 || ^19.0.0",
37
- "react-dom": "^18.0.0 || ^19.0.0",
38
36
  "ag-grid-community": "^32.0.0",
39
- "ag-grid-react": "^32.0.0"
37
+ "ag-grid-react": "^32.0.0",
38
+ "react": "^18.0.0 || ^19.0.0",
39
+ "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/react": "^19.2.13",
43
- "@types/react-dom": "^19.2.3",
44
- "@vitejs/plugin-react": "^5.1.3",
42
+ "@types/react": "19.2.13",
43
+ "@types/react-dom": "19.2.3",
44
+ "@vitejs/plugin-react": "^5.1.4",
45
45
  "ag-grid-community": "^32.3.9",
46
46
  "ag-grid-react": "^32.3.9",
47
47
  "typescript": "^5.9.3",