@object-ui/plugin-aggrid 3.1.0 → 3.1.1

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 +12 -0
  3. package/dist/{AddressField-Ca6aSbFW.js → AddressField-D2Yli537.js} +1 -1
  4. package/dist/{AgGridImpl-Brsm5CmH.js → AgGridImpl-GwI1UT7v.js} +1 -1
  5. package/dist/{AutoNumberField-DrGjmfKt.js → AutoNumberField-Y3hL1ZoW.js} +1 -1
  6. package/dist/{FileField-CMfNMmvO.js → FileField-BHv22jrG.js} +2 -2
  7. package/dist/{FormulaField-Cpf8sXXM.js → FormulaField-B-JSCA7E.js} +1 -1
  8. package/dist/{GeolocationField-D-EW8C92.js → GeolocationField-DxnVAm8n.js} +2 -2
  9. package/dist/{GridField--t291OLT.js → GridField-7A4mvr7x.js} +1 -1
  10. package/dist/{LocationField-C5pdO0VY.js → LocationField-o8Z6x8qV.js} +1 -1
  11. package/dist/{MasterDetailField--lQGMhKf.js → MasterDetailField-CnzHQ-jU.js} +2 -2
  12. package/dist/{ObjectAgGridImpl-Cy851etj.js → ObjectAgGridImpl-CujXHJ0J.js} +46 -20
  13. package/dist/{ObjectField-CwbQIROw.js → ObjectField-BAVt0fMs.js} +1 -1
  14. package/dist/{QRCodeField-BksI6bwG.js → QRCodeField-VAlAXUkP.js} +2 -2
  15. package/dist/{RichTextField-DSkfYMMR.js → RichTextField-DylJITFH.js} +1 -1
  16. package/dist/{SignatureField-sBd3qsYZ.js → SignatureField-BrGCC7_j.js} +2 -2
  17. package/dist/{SummaryField-fM-E9oD5.js → SummaryField-BPPAEVC6.js} +1 -1
  18. package/dist/{UserField-lwxkNoSY.js → UserField-CWZQprry.js} +2 -2
  19. package/dist/{VectorField-B5I-CcgP.js → VectorField-CIvFEC07.js} +1 -1
  20. package/dist/{index-Dipgpv5R.js → index-BfSjmySi.js} +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.umd.cjs +1 -1
  23. package/package.json +7 -7
@@ -1,5 +1,5 @@
1
1
 
2
- > @object-ui/plugin-aggrid@3.1.0 build /home/runner/work/objectui/objectui/packages/plugin-aggrid
2
+ > @object-ui/plugin-aggrid@3.1.1 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 20710ms.
75
+ [vite:dts] Declaration files built in 20381ms.
76
76
  
77
77
  dist/index.css 370.94 kB │ gzip: 72.89 kB
78
78
  dist/index.js  0.22 kB │ gzip: 0.16 kB
79
- dist/AutoNumberField-DrGjmfKt.js  0.29 kB │ gzip: 0.25 kB
80
- dist/SummaryField-fM-E9oD5.js  0.49 kB │ gzip: 0.35 kB
81
- dist/FormulaField-Cpf8sXXM.js  0.53 kB │ gzip: 0.37 kB
82
- dist/VectorField-B5I-CcgP.js  0.81 kB │ gzip: 0.43 kB
83
- dist/LocationField-C5pdO0VY.js  0.95 kB │ gzip: 0.53 kB
84
- dist/RichTextField-DSkfYMMR.js  1.19 kB │ gzip: 0.58 kB
85
- dist/ObjectField-CwbQIROw.js  1.65 kB │ gzip: 0.76 kB
86
- dist/GridField--t291OLT.js  1.78 kB │ gzip: 0.67 kB
87
- dist/UserField-lwxkNoSY.js  2.50 kB │ gzip: 0.93 kB
88
- dist/AddressField-Ca6aSbFW.js  3.12 kB │ gzip: 0.75 kB
89
- dist/SignatureField-sBd3qsYZ.js  3.41 kB │ gzip: 1.29 kB
90
- dist/QRCodeField-BksI6bwG.js  3.46 kB │ gzip: 1.24 kB
91
- dist/MasterDetailField--lQGMhKf.js  3.96 kB │ gzip: 1.17 kB
92
- dist/GeolocationField-D-EW8C92.js  4.57 kB │ gzip: 1.51 kB
93
- dist/FileField-CMfNMmvO.js  6.05 kB │ gzip: 2.12 kB
94
- dist/AgGridImpl-Brsm5CmH.js  7.21 kB │ gzip: 2.37 kB
95
- dist/index-Dipgpv5R.js  20.43 kB │ gzip: 5.11 kB
96
- dist/ObjectAgGridImpl-Cy851etj.js 944.88 kB │ gzip: 208.56 kB
79
+ dist/AutoNumberField-Y3hL1ZoW.js  0.29 kB │ gzip: 0.25 kB
80
+ dist/SummaryField-BPPAEVC6.js  0.49 kB │ gzip: 0.35 kB
81
+ dist/FormulaField-B-JSCA7E.js  0.53 kB │ gzip: 0.37 kB
82
+ dist/VectorField-CIvFEC07.js  0.81 kB │ gzip: 0.43 kB
83
+ dist/LocationField-o8Z6x8qV.js  0.95 kB │ gzip: 0.52 kB
84
+ dist/RichTextField-DylJITFH.js  1.19 kB │ gzip: 0.58 kB
85
+ dist/ObjectField-BAVt0fMs.js  1.65 kB │ gzip: 0.76 kB
86
+ dist/GridField-7A4mvr7x.js  1.78 kB │ gzip: 0.67 kB
87
+ dist/UserField-CWZQprry.js  2.50 kB │ gzip: 0.93 kB
88
+ dist/AddressField-D2Yli537.js  3.12 kB │ gzip: 0.75 kB
89
+ dist/SignatureField-BrGCC7_j.js  3.41 kB │ gzip: 1.29 kB
90
+ dist/QRCodeField-VAlAXUkP.js  3.46 kB │ gzip: 1.24 kB
91
+ dist/MasterDetailField-CnzHQ-jU.js  3.96 kB │ gzip: 1.17 kB
92
+ dist/GeolocationField-DxnVAm8n.js  4.57 kB │ gzip: 1.51 kB
93
+ dist/FileField-BHv22jrG.js  6.05 kB │ gzip: 2.13 kB
94
+ dist/AgGridImpl-GwI1UT7v.js  7.21 kB │ gzip: 2.37 kB
95
+ dist/index-BfSjmySi.js  20.43 kB │ gzip: 5.11 kB
96
+ dist/ObjectAgGridImpl-CujXHJ0J.js 945.41 kB │ gzip: 208.75 kB
97
97
  dist/index.css 370.94 kB │ gzip: 72.89 kB
98
- dist/index.umd.cjs 616.38 kB │ gzip: 184.17 kB
99
- ✓ built in 34.79s
98
+ dist/index.umd.cjs 616.78 kB │ gzip: 184.34 kB
99
+ ✓ built in 31.97s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @object-ui/plugin-aggrid
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @object-ui/types@3.1.1
9
+ - @object-ui/components@3.1.1
10
+ - @object-ui/core@3.1.1
11
+ - @object-ui/data-objectstack@3.1.1
12
+ - @object-ui/fields@3.1.1
13
+ - @object-ui/react@3.1.1
14
+
3
15
  ## 3.0.3
4
16
 
5
17
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as f } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as n } from "./index-BfSjmySi.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 s } from "./index-Dipgpv5R.js";
1
+ import { j as s } from "./index-BfSjmySi.js";
2
2
  import { useRef as R, useState as D, useCallback as h } from "react";
3
3
  import { Button as B } from "@object-ui/components";
4
- import { c as E, U as M, I as P, X as U } from "./ObjectAgGridImpl-Cy851etj.js";
4
+ import { c as E, U as M, I as P, X as U } from "./ObjectAgGridImpl-CujXHJ0J.js";
5
5
  const $ = [
6
6
  [
7
7
  "path",
@@ -1,4 +1,4 @@
1
- import { j as s } from "./index-Dipgpv5R.js";
1
+ import { j as s } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as t } from "./index-BfSjmySi.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-Cy851etj.js";
4
+ import { c as h } from "./ObjectAgGridImpl-CujXHJ0J.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.js";
2
2
  import { cn as a } from "@object-ui/components";
3
3
  function u({ value: r, field: i, readonly: l, ...d }) {
4
4
  const n = (i || d.schema)?.columns || [];
@@ -1,4 +1,4 @@
1
- import { j as r } from "./index-Dipgpv5R.js";
1
+ import { j as r } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.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-Cy851etj.js";
3
+ import { c as o, X as f } from "./ObjectAgGridImpl-CujXHJ0J.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 x } from "./index-Dipgpv5R.js";
1
+ import { j as x } from "./index-BfSjmySi.js";
2
2
  import fm, { forwardRef as $2, createElement as Tb, useId as $3, useState as qr, useRef as F2, useEffect as j2, useMemo as Qv, useCallback as Br } from "react";
3
3
  import { AgGridReact as F3 } from "ag-grid-react";
4
4
  import W2 from "react-dom";
@@ -28203,13 +28203,39 @@ function J2(v) {
28203
28203
  return v.replace(/[_-]/g, " ").replace(/\b\w/g, (Y) => Y.toUpperCase());
28204
28204
  }
28205
28205
  const tE = {
28206
+ // Priority values
28206
28207
  critical: "red",
28207
28208
  urgent: "red",
28208
28209
  high: "orange",
28209
28210
  medium: "yellow",
28210
28211
  normal: "blue",
28211
28212
  low: "gray",
28212
- none: "gray"
28213
+ none: "gray",
28214
+ // Status values
28215
+ paid: "green",
28216
+ completed: "green",
28217
+ done: "green",
28218
+ active: "green",
28219
+ approved: "green",
28220
+ resolved: "green",
28221
+ pending: "yellow",
28222
+ waiting: "yellow",
28223
+ on_hold: "yellow",
28224
+ shipped: "blue",
28225
+ in_progress: "blue",
28226
+ open: "blue",
28227
+ processing: "blue",
28228
+ draft: "gray",
28229
+ new: "gray",
28230
+ inactive: "gray",
28231
+ closed: "gray",
28232
+ cancelled: "red",
28233
+ canceled: "red",
28234
+ rejected: "red",
28235
+ failed: "red",
28236
+ overdue: "red",
28237
+ delivered: "purple",
28238
+ archived: "indigo"
28213
28239
  }, lE = {
28214
28240
  gray: "bg-gray-100 text-gray-800 border-gray-300",
28215
28241
  red: "bg-red-100 text-red-800 border-red-300",
@@ -28222,7 +28248,7 @@ const tE = {
28222
28248
  pink: "bg-pink-100 text-pink-800 border-pink-300"
28223
28249
  };
28224
28250
  function K2(v, Y) {
28225
- const W = v || (Y ? tE[String(Y).toLowerCase()] : void 0);
28251
+ const W = v || (Y ? tE[String(Y).toLowerCase().replace(/[\s-]/g, "_")] : void 0);
28226
28252
  return lE[W || ""] || "bg-muted text-muted-foreground border-border";
28227
28253
  }
28228
28254
  function AT({ value: v, field: Y }) {
@@ -28337,36 +28363,36 @@ const DT = {
28337
28363
  currency: () => Promise.resolve().then(() => QA).then((v) => ({ default: v.CurrencyField })),
28338
28364
  percent: () => Promise.resolve().then(() => KA).then((v) => ({ default: v.PercentField })),
28339
28365
  password: () => Promise.resolve().then(() => $A).then((v) => ({ default: v.PasswordField })),
28340
- markdown: () => import("./RichTextField-DSkfYMMR.js").then((v) => ({ default: v.RichTextField })),
28341
- html: () => import("./RichTextField-DSkfYMMR.js").then((v) => ({ default: v.RichTextField })),
28366
+ markdown: () => import("./RichTextField-DylJITFH.js").then((v) => ({ default: v.RichTextField })),
28367
+ html: () => import("./RichTextField-DylJITFH.js").then((v) => ({ default: v.RichTextField })),
28342
28368
  lookup: () => Promise.resolve().then(() => LA).then((v) => ({ default: v.LookupField })),
28343
- master_detail: () => import("./MasterDetailField--lQGMhKf.js").then((v) => ({ default: v.MasterDetailField })),
28369
+ master_detail: () => import("./MasterDetailField-CnzHQ-jU.js").then((v) => ({ default: v.MasterDetailField })),
28344
28370
  // File fields
28345
- file: () => import("./FileField-CMfNMmvO.js").then((v) => ({ default: v.FileField })),
28371
+ file: () => import("./FileField-BHv22jrG.js").then((v) => ({ default: v.FileField })),
28346
28372
  image: () => Promise.resolve().then(() => FA).then((v) => ({ default: v.ImageField })),
28347
28373
  // Location field
28348
- location: () => import("./LocationField-C5pdO0VY.js").then((v) => ({ default: v.LocationField })),
28374
+ location: () => import("./LocationField-o8Z6x8qV.js").then((v) => ({ default: v.LocationField })),
28349
28375
  // Computed/Read-only fields
28350
- formula: () => import("./FormulaField-Cpf8sXXM.js").then((v) => ({ default: v.FormulaField })),
28351
- summary: () => import("./SummaryField-fM-E9oD5.js").then((v) => ({ default: v.SummaryField })),
28352
- auto_number: () => import("./AutoNumberField-DrGjmfKt.js").then((v) => ({ default: v.AutoNumberField })),
28376
+ formula: () => import("./FormulaField-B-JSCA7E.js").then((v) => ({ default: v.FormulaField })),
28377
+ summary: () => import("./SummaryField-BPPAEVC6.js").then((v) => ({ default: v.SummaryField })),
28378
+ auto_number: () => import("./AutoNumberField-Y3hL1ZoW.js").then((v) => ({ default: v.AutoNumberField })),
28353
28379
  // User fields
28354
- user: () => import("./UserField-lwxkNoSY.js").then((v) => ({ default: v.UserField })),
28355
- owner: () => import("./UserField-lwxkNoSY.js").then((v) => ({ default: v.UserField })),
28380
+ user: () => import("./UserField-CWZQprry.js").then((v) => ({ default: v.UserField })),
28381
+ owner: () => import("./UserField-CWZQprry.js").then((v) => ({ default: v.UserField })),
28356
28382
  // Complex data types
28357
- object: () => import("./ObjectField-CwbQIROw.js").then((v) => ({ default: v.ObjectField })),
28358
- vector: () => import("./VectorField-B5I-CcgP.js").then((v) => ({ default: v.VectorField })),
28359
- grid: () => import("./GridField--t291OLT.js").then((v) => ({ default: v.GridField })),
28383
+ object: () => import("./ObjectField-BAVt0fMs.js").then((v) => ({ default: v.ObjectField })),
28384
+ vector: () => import("./VectorField-CIvFEC07.js").then((v) => ({ default: v.VectorField })),
28385
+ grid: () => import("./GridField-7A4mvr7x.js").then((v) => ({ default: v.GridField })),
28360
28386
  // Additional field types from @objectstack/spec
28361
28387
  color: () => Promise.resolve().then(() => WA).then((v) => ({ default: v.ColorField })),
28362
28388
  slider: () => Promise.resolve().then(() => kA).then((v) => ({ default: v.SliderField })),
28363
28389
  rating: () => Promise.resolve().then(() => IA).then((v) => ({ default: v.RatingField })),
28364
28390
  code: () => Promise.resolve().then(() => PA).then((v) => ({ default: v.CodeField })),
28365
28391
  avatar: () => Promise.resolve().then(() => eE).then((v) => ({ default: v.AvatarField })),
28366
- address: () => import("./AddressField-Ca6aSbFW.js").then((v) => ({ default: v.AddressField })),
28367
- geolocation: () => import("./GeolocationField-D-EW8C92.js").then((v) => ({ default: v.GeolocationField })),
28368
- signature: () => import("./SignatureField-sBd3qsYZ.js").then((v) => ({ default: v.SignatureField })),
28369
- qrcode: () => import("./QRCodeField-BksI6bwG.js").then((v) => ({ default: v.QRCodeField }))
28392
+ address: () => import("./AddressField-D2Yli537.js").then((v) => ({ default: v.AddressField })),
28393
+ geolocation: () => import("./GeolocationField-DxnVAm8n.js").then((v) => ({ default: v.GeolocationField })),
28394
+ signature: () => import("./SignatureField-BrGCC7_j.js").then((v) => ({ default: v.SignatureField })),
28395
+ qrcode: () => import("./QRCodeField-VAlAXUkP.js").then((v) => ({ default: v.QRCodeField }))
28370
28396
  };
28371
28397
  function nE(v) {
28372
28398
  const Y = DT[v];
@@ -1,4 +1,4 @@
1
- import { j as t } from "./index-Dipgpv5R.js";
1
+ import { j as t } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.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-Cy851etj.js";
4
+ import { c as d } from "./ObjectAgGridImpl-CujXHJ0J.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as s } from "./index-BfSjmySi.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-Cy851etj.js";
4
+ import { c as S } from "./ObjectAgGridImpl-CujXHJ0J.js";
5
5
  const C = [
6
6
  [
7
7
  "path",
@@ -1,4 +1,4 @@
1
- import { j as i } from "./index-Dipgpv5R.js";
1
+ import { j as i } from "./index-BfSjmySi.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.js";
2
2
  import { Avatar as c, AvatarFallback as m, Badge as g } from "@object-ui/components";
3
- import { X as N } from "./ObjectAgGridImpl-Cy851etj.js";
3
+ import { X as N } from "./ObjectAgGridImpl-CujXHJ0J.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-Dipgpv5R.js";
1
+ import { j as e } from "./index-BfSjmySi.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-Brsm5CmH.js")), ce = w.lazy(() => import("./ObjectAgGridImpl-Cy851etj.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-GwI1UT7v.js")), ce = w.lazy(() => import("./ObjectAgGridImpl-CujXHJ0J.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-Dipgpv5R.js";
1
+ import { A as a, O as d, a as m } from "./index-BfSjmySi.js";
2
2
  import "react";
3
3
  import "@object-ui/core";
4
4
  import "@object-ui/components";
@@ -231,4 +231,4 @@ You might need to use a local HTTP server (instead of file://): https://react.de
231
231
  ${fe?"border-primary bg-primary/5 text-primary":"border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
232
232
  `,role:"button",tabIndex:0,onKeyDown:ge=>{(ge.key==="Enter"||ge.key===" ")&&(ge.preventDefault(),H.current?.click())},children:[b.jsx(Xb,{className:`size-8 ${fe?"text-primary":"text-muted-foreground"}`}),b.jsxs("div",{className:"text-center",children:[b.jsx("p",{className:"text-sm font-medium",children:fe?"Drop files here":"Drag & drop files here"}),b.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"or click to browse"})]})]}),L.length>0&&b.jsx("div",{className:"space-y-0.5",children:L.map((ge,Me)=>b.jsx("p",{className:"text-xs text-destructive",children:ge},Me))}),ce.length>0&&b.jsx("div",{className:"space-y-1",children:ce.map((ge,Me)=>b.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",children:[b.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[yt(ge)&&ge.url?b.jsx("img",{src:ge.url,alt:ge.name,className:"size-8 object-cover rounded flex-shrink-0"}):yt(ge)?b.jsx(Yb,{className:"size-4 text-muted-foreground flex-shrink-0"}):b.jsx(IT,{className:"size-4 text-muted-foreground flex-shrink-0"}),b.jsx("span",{className:"text-sm truncate",children:ge.name||ge.original_name||"File"}),ge.size&&b.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(ge.size/1024).toFixed(1)," KB)"]})]}),b.jsx(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:ve=>{ve.stopPropagation(),Xe(Me)},className:"h-6 w-6 p-0",children:b.jsx(Gr,{className:"size-3"})})]},Me))})]})]})}const bE=Object.freeze(Object.defineProperty({__proto__:null,FileField:vE},Symbol.toStringTag,{value:"Module"}));function uS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=me.useRef(null),G=Q||j.schema,_=G?.multiple||!1,Z=G?.accept?G.accept.join(","):"image/*";if(S){if(!m)return b.jsx("span",{className:"text-sm",children:"-"});const L=Array.isArray(m)?m:[m];return b.jsx("div",{className:"flex flex-wrap gap-2",children:L.map((ue,ce)=>b.jsx("img",{src:ue.url||"",alt:ue.name||`Image ${ce+1}`,className:"size-20 rounded-md object-cover border border-gray-200"},ce))})}const ee=m?Array.isArray(m)?m:[m]:[],fe=L=>{const ue=Array.from(L.target.files||[]);if(ue.length===0)return;const ce=ue.map(Se=>({name:Se.name,original_name:Se.name,size:Se.size,mime_type:Se.type,url:URL.createObjectURL(Se)}));R(_?[...ee,...ce]:ce[0])},J=L=>{if(_){const ue=ee.filter((ce,Se)=>Se!==L);R(ue.length>0?ue:null)}else R(null)};return b.jsxs("div",{className:j.className,children:[b.jsx("input",{ref:H,type:"file",multiple:_,accept:Z,onChange:fe,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((L,ue)=>b.jsxs("div",{className:"relative group",children:[b.jsx("img",{src:L.url||"",alt:L.name||`Image ${ue+1}`,className:"size-20 rounded-md object-cover border border-gray-200"}),b.jsx(te.Button,{type:"button",variant:"destructive",size:"sm",onClick:()=>J(ue),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"})})]},ue))}),b.jsxs(te.Button,{type:"button",variant:"outline",onClick:()=>H.current?.click(),className:"w-full",children:[b.jsx(Yb,{className:"size-4 mr-2"}),ee.length>0?"Add More Images":"Upload Image"]})]})]})}const SE=Object.freeze(Object.defineProperty({__proto__:null,ImageField:uS},Symbol.toStringTag,{value:"Module"}));function TE({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=m&&typeof m=="object"?`${m.latitude||0}, ${m.longitude||0}`:"";if(S)return b.jsx("span",{className:"text-sm",children:G||"-"});const _=Z=>{const ee=Z.target.value;if(!ee.trim()){R(null);return}const fe=ee.split(",").map(J=>J.trim());if(fe.length===2){const J=parseFloat(fe[0]),L=parseFloat(fe[1]);!isNaN(J)&&!isNaN(L)&&R({latitude:J,longitude:L})}};return b.jsx(te.Input,{type:"text",value:G,onChange:_,placeholder:H?.placeholder||"latitude, longitude",disabled:S||j.disabled,className:j.className})}const EE=Object.freeze(Object.defineProperty({__proto__:null,LocationField:TE},Symbol.toStringTag,{value:"Module"}));function AE({value:m,field:R,...Q}){const j=(R||Q.schema)?.return_type||"text";let H="-";return m!=null&&(j==="number"||j==="currency"?H=typeof m=="number"?m.toFixed(2):String(m):j==="boolean"?H=m?"Yes":"No":j==="date"?H=new Date(m).toLocaleDateString():H=String(m)),b.jsx("span",{className:`text-sm font-mono text-gray-700 ${Q.className||""}`,children:H})}const xE=Object.freeze(Object.defineProperty({__proto__:null,FormulaField:AE},Symbol.toStringTag,{value:"Module"}));function zE({value:m,field:R,...Q}){const j=(R||Q.schema)?.summary_type||"count";let H="-";return m!=null&&(j==="count"?H=String(m):["sum","avg","min","max"].includes(j)?H=typeof m=="number"?m.toFixed(2):String(m):H=String(m)),b.jsx("span",{className:`text-sm font-medium tabular-nums text-gray-700 ${Q.className||""}`,children:H})}const OE=Object.freeze(Object.defineProperty({__proto__:null,SummaryField:zE},Symbol.toStringTag,{value:"Module"}));function DE({value:m,field:R,...Q}){const S=m!=null?String(m):"-";return b.jsx("span",{className:`text-sm font-mono text-gray-700 ${Q.className||""}`,children:S})}const CE=Object.freeze(Object.defineProperty({__proto__:null,AutoNumberField:DE},Symbol.toStringTag,{value:"Module"}));function ME({value:m,onChange:R,field:Q,readonly:S,...j}){const G=(Q||j.schema)?.multiple||!1;if(S){if(!m)return b.jsx("span",{className:"text-sm",children:"-"});const ee=Array.isArray(m)?m:[m];return b.jsxs("div",{className:"flex -space-x-2",children:[ee.slice(0,3).map((fe,J)=>{const L=fe.name||fe.username||"User",ue=L.split(" ").map(ce=>ce[0]).join("").toUpperCase().slice(0,2);return b.jsx(te.Avatar,{className:"size-8 border-2 border-white",title:L,children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:ue})},J)}),ee.length>3&&b.jsx(te.Avatar,{className:"size-8 border-2 border-white",children:b.jsxs(te.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",ee.length-3]})})]})}const _=m?Array.isArray(m)?m:[m]:[],Z=ee=>{if(G){const fe=_.filter((J,L)=>L!==ee);R(fe.length>0?fe:null)}else R(null)};return b.jsxs("div",{className:j.className,children:[_.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:_.map((ee,fe)=>{const J=ee.name||ee.username||"User",L=J.split(" ").map(ue=>ue[0]).join("").toUpperCase().slice(0,2);return b.jsxs(te.Badge,{variant:"outline",className:"gap-2 pr-1",children:[b.jsx(te.Avatar,{className:"size-5",children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:L})}),b.jsx("span",{className:"text-sm",children:J}),b.jsx("button",{type:"button",onClick:()=>Z(fe),className:"ml-1 rounded-full hover:bg-gray-200 p-0.5",children:b.jsx(Gr,{className:"size-3"})})]},fe)})}),b.jsx("div",{className:"text-sm text-gray-500 italic",children:"User selection component requires integration with user management system"})]})}const iS=Object.freeze(Object.defineProperty({__proto__:null,UserField:ME},Symbol.toStringTag,{value:"Module"}));function _E({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=()=>m==null?"":JSON.stringify(m,null,2),[_,Z]=me.useState(G),[ee,fe]=me.useState(null);if(me.useEffect(()=>{try{if(m==null){Z("");return}const L=_?JSON.parse(_):null;JSON.stringify(L)!==JSON.stringify(m)&&Z(JSON.stringify(m,null,2))}catch{Z(JSON.stringify(m,null,2))}},[m,_]),S)return m?b.jsx("pre",{className:te.cn("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40",j.className),children:JSON.stringify(m,null,2)}):b.jsx("span",{className:"text-sm",children:"-"});const J=L=>{const ue=L.target.value;if(Z(ue),fe(null),!ue.trim()){R(null);return}try{const ce=JSON.parse(ue);R(ce)}catch{fe("Invalid JSON")}};return b.jsxs("div",{className:"space-y-1",children:[b.jsx(te.Textarea,{value:_,onChange:J,placeholder:H?.placeholder||`{
233
233
  "key": "value"
234
- }`,disabled:S||j.disabled,className:te.cn("font-mono text-xs",ee?"border-red-500 focus-visible:ring-red-500":"",j.className),rows:6}),ee&&b.jsx("p",{className:"text-xs text-red-500",children:ee})]})}const RE=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:_E},Symbol.toStringTag,{value:"Module"}));function jE({value:m,field:R,...Q}){const j=(R||Q.schema)?.dimensions||(Array.isArray(m)?m.length:0);if(!m||!Array.isArray(m))return b.jsx("span",{className:"text-sm text-gray-500",children:"-"});const H=m.slice(0,3).map(G=>{const _=Number(G);return isNaN(_)?"0":_.toFixed(4)}).join(", ");return b.jsxs("div",{className:`text-sm ${Q.className||""}`,children:[b.jsxs("span",{className:"font-mono text-gray-700",children:["[",H,"...]"]}),b.jsxs("span",{className:"text-gray-500 ml-2",children:["(",j,"D)"]})]})}const NE=Object.freeze(Object.defineProperty({__proto__:null,VectorField:jE},Symbol.toStringTag,{value:"Module"}));function UE({value:m,field:R,readonly:Q,...S}){const H=(R||S.schema)?.columns||[];return!m||!Array.isArray(m)?b.jsx("span",{className:"text-sm text-muted-foreground",children:"-"}):Q?b.jsx("div",{className:te.cn("text-sm",S.className),children:b.jsxs("span",{className:"text-foreground",children:[m.length," rows"]})}):b.jsxs("div",{className:te.cn("border border-border rounded-lg 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-muted border-b border-border",children:b.jsx("tr",{children:H.map((G,_)=>b.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground",children:G.label||G.name},_))})}),b.jsx("tbody",{className:"divide-y divide-border",children:m.slice(0,5).map((G,_)=>b.jsx("tr",{className:"hover:bg-muted/50 transition-colors",children:H.map((Z,ee)=>b.jsx("td",{className:"px-3 py-2 text-foreground",children:G[Z.name]!=null?String(G[Z.name]):"-"},ee))},_))})]})}),m.length>5&&b.jsxs("div",{className:"bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",children:["Showing 5 of ",m.length," rows"]})]})}const HE=Object.freeze(Object.defineProperty({__proto__:null,GridField:UE},Symbol.toStringTag,{value:"Module"}));function cS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.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:m||"#000000"}}),b.jsx("span",{className:"text-sm",children:m||"-"})]}):b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"color",value:m||"#000000",onChange:G=>R(G.target.value),disabled:S||j.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),b.jsx(te.Input,{type:"text",value:m||"",onChange:G=>R(G.target.value),placeholder:H?.placeholder||"#000000",disabled:S||j.disabled,className:j.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const BE=Object.freeze(Object.defineProperty({__proto__:null,ColorField:cS},Symbol.toStringTag,{value:"Module"}));function oS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=H?.min??0,_=H?.max??100,Z=H?.step??1;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-medium",children:m??G}),b.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",_]})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx(te.Slider,{value:[m??G],onValueChange:ee=>R(ee[0]),min:G,max:_,step:Z,disabled:S||j.disabled,className:j.className}),b.jsx("span",{className:"text-sm font-medium w-12 text-right",children:m??G})]})}const qE=Object.freeze(Object.defineProperty({__proto__:null,SliderField:oS},Symbol.toStringTag,{value:"Module"}));function sS({value:m,onChange:R,field:Q,readonly:S,className:j,...H}){const _=(Q||H.schema)?.max??5,Z=m??0,[ee,fe]=me.useState(null),J=ee!==null?ee:Z;return S?b.jsxs("div",{className:te.cn("flex items-center gap-1",j),children:[Array.from({length:_},(L,ue)=>b.jsx(Vb,{className:`w-5 h-5 ${ue<Z?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},ue)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]}):b.jsxs("div",{className:te.cn("flex items-center gap-1",j),children:[Array.from({length:_},(L,ue)=>b.jsx("button",{type:"button",onClick:()=>R(ue+1),onMouseEnter:()=>fe(ue+1),onMouseLeave:()=>fe(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:S||H.disabled,children:b.jsx(Vb,{className:`w-5 h-5 transition-colors ${ue<J?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},ue)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]})}const YE=Object.freeze(Object.defineProperty({__proto__:null,RatingField:sS},Symbol.toStringTag,{value:"Module"}));function fS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=H?.language??"javascript";return S?b.jsx("pre",{className:te.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",j.className),children:b.jsx("code",{children:m||"-"})}):b.jsx(te.Textarea,{value:m||"",onChange:_=>R(_.target.value),placeholder:H?.placeholder||`// Write ${G} code here...`,disabled:S||j.disabled,className:te.cn("font-mono text-sm",j.className),rows:12,spellCheck:!1})}const GE=Object.freeze(Object.defineProperty({__proto__:null,CodeField:fS},Symbol.toStringTag,{value:"Module"}));function rS({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=me.useRef(null),Z=Q||j.schema,ee=L=>{const ue=L.target.files?.[0];if(!ue)return;if(!ue.type.startsWith("image/")){console.error("Please select an image file");return}if(ue.size>5*1024*1024){console.error("File size must be less than 5MB");return}const ce=new FileReader;ce.onloadend=()=>{R(ce.result)},ce.readAsDataURL(ue)},fe=()=>{R("")},J=()=>(Z?.defaultName||Z?.label||"User").split(" ").map(ue=>ue[0]).join("").toUpperCase().slice(0,2);return S?b.jsxs(te.Avatar,{className:"w-16 h-16",children:[m&&b.jsx(te.AvatarImage,{src:m,alt:Z?.label}),b.jsx(te.AvatarFallback,{children:J()})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative",onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),children:[b.jsxs(te.Avatar,{className:"w-16 h-16",children:[m&&b.jsx(te.AvatarImage,{src:m,alt:Z?.label}),b.jsx(te.AvatarFallback,{children:J()})]}),!S&&H&&m&&b.jsx("button",{type:"button",onClick:fe,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(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>_.current?.click(),disabled:S||j.disabled,children:[b.jsx(Xb,{className:"w-4 h-4 mr-2"}),m?"Change":"Upload"," Avatar"]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const wE=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:rS},Symbol.toStringTag,{value:"Module"}));function VE({value:m,onChange:R,field:Q,readonly:S,...j}){const H=m||{},G=(Z,ee)=>{R({...H,[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:_(H)}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),b.jsx(te.Input,{id:"street",type:"text",value:H.street||"",onChange:Z=>G("street",Z.target.value),placeholder:"123 Main St",disabled:S||j.disabled,className:j.className})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"city",className:"text-xs",children:"City"}),b.jsx(te.Input,{id:"city",type:"text",value:H.city||"",onChange:Z=>G("city",Z.target.value),placeholder:"San Francisco",disabled:S||j.disabled})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),b.jsx(te.Input,{id:"state",type:"text",value:H.state||"",onChange:Z=>G("state",Z.target.value),placeholder:"CA",disabled:S||j.disabled})]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),b.jsx(te.Input,{id:"zipCode",type:"text",value:H.zipCode||"",onChange:Z=>G("zipCode",Z.target.value),placeholder:"94102",disabled:S||j.disabled})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),b.jsx(te.Input,{id:"country",type:"text",value:H.country||"",onChange:Z=>G("country",Z.target.value),placeholder:"United States",disabled:S||j.disabled})]})]})]})}const XE=Object.freeze(Object.defineProperty({__proto__:null,AddressField:VE},Symbol.toStringTag,{value:"Module"}));function QE({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=m||{},Z=(L,ue)=>{R({..._,[L]:ue?Number(ue):void 0})},ee=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}G(!0),navigator.geolocation.getCurrentPosition(L=>{R({latitude:L.coords.latitude,longitude:L.coords.longitude,accuracy:L.coords.accuracy}),G(!1)},L=>{console.error("Error getting location:",L.message),G(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},fe=L=>!L.latitude||!L.longitude?"-":`${L.latitude.toFixed(6)}, ${L.longitude.toFixed(6)}`,J=()=>{if(!_.latitude||!_.longitude)return;const L=`https://www.google.com/maps?q=${_.latitude},${_.longitude}`;window.open(L,"_blank")};return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Gb,{className:"w-4 h-4 text-muted-foreground"}),b.jsx("span",{className:"text-sm",children:fe(_)}),_.latitude&&_.longitude&&b.jsx(te.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(te.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:S||H,children:[b.jsx($T,{className:"w-4 h-4 mr-2"}),H?"Getting location...":"Use Current Location"]}),_.latitude&&_.longitude&&b.jsxs(te.Button,{type:"button",variant:"link",size:"sm",onClick:J,children:[b.jsx(Gb,{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(te.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),b.jsx(te.Input,{id:"latitude",type:"number",value:_.latitude??"",onChange:L=>Z("latitude",L.target.value),placeholder:"37.7749",disabled:S||j.disabled,step:"any",className:j.className})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),b.jsx(te.Input,{id:"longitude",type:"number",value:_.longitude??"",onChange:L=>Z("longitude",L.target.value),placeholder:"-122.4194",disabled:S||j.disabled,step:"any"})]})]}),_.accuracy&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",_.accuracy.toFixed(0),"m"]})]})}const LE=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:QE},Symbol.toStringTag,{value:"Module"}));function ZE({value:m,onChange:R,readonly:Q}){const S=me.useRef(null),[j,H]=me.useState(!1),[G,_]=me.useState(!m);me.useEffect(()=>{if(m&&S.current){const ue=S.current.getContext("2d");if(ue){const ce=new Image;ce.onload=()=>{ue.drawImage(ce,0,0),_(!1)},ce.src=m}}},[m]);const Z=L=>{if(Q)return;H(!0),_(!1);const ue=S.current;if(!ue)return;const ce=ue.getContext("2d");if(!ce)return;const Se=ue.getBoundingClientRect(),Ve="touches"in L?L.touches[0].clientX-Se.left:L.clientX-Se.left,ie="touches"in L?L.touches[0].clientY-Se.top:L.clientY-Se.top;ce.beginPath(),ce.moveTo(Ve,ie)},ee=L=>{if(!j||Q)return;const ue=S.current;if(!ue)return;const ce=ue.getContext("2d");if(!ce)return;const Se=ue.getBoundingClientRect(),Ve="touches"in L?L.touches[0].clientX-Se.left:L.clientX-Se.left,ie="touches"in L?L.touches[0].clientY-Se.top:L.clientY-Se.top;ce.lineTo(Ve,ie),ce.strokeStyle="#000",ce.lineWidth=2,ce.lineCap="round",ce.lineJoin="round",ce.stroke()},fe=()=>{if(!j)return;H(!1);const L=S.current;if(!L)return;const ue=L.toDataURL("image/png");R(ue)},J=()=>{const L=S.current;if(!L)return;const ue=L.getContext("2d");ue&&(ue.clearRect(0,0,L.width,L.height),_(!0),R(""))};return Q&&m?b.jsx("div",{className:"border rounded p-2 bg-white",children:b.jsx("img",{src:m,alt:"Signature",loading:"lazy",className:"max-w-full h-auto"})}):Q&&!m?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:fe,onMouseLeave:fe,onTouchStart:Z,onTouchMove:ee,onTouchEnd:fe})}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:G?"Sign above":"Signature captured"}),b.jsxs(te.Button,{type:"button",variant:"outline",size:"sm",onClick:J,disabled:Q||G,children:[b.jsx(FT,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const JE=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:ZE},Symbol.toStringTag,{value:"Module"}));function KE({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=Q||j.schema,Z=fe=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(fe)}`,ee=()=>{m&&navigator.clipboard.writeText(m)};return S?b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("span",{className:"text-sm flex-1 truncate",children:m||"-"}),m&&b.jsxs(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!H),children:[b.jsx(wb,{className:"w-4 h-4 mr-2"}),H?"Hide":"Show"," QR"]})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(te.Input,{type:"text",value:m||"",onChange:fe=>R(fe.target.value),placeholder:_?.placeholder||"Enter text for QR code",disabled:S||j.disabled,className:j.className}),m&&b.jsxs(b.Fragment,{children:[b.jsx(te.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,children:b.jsx(KT,{className:"w-4 h-4"})}),b.jsx(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!H),children:b.jsx(wb,{className:"w-4 h-4"})})]})]}),H&&m&&b.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:b.jsx("img",{src:Z(m),alt:"QR Code",className:"w-48 h-48"})}),m&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",m.length," characters"]})]})}const $E=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:KE},Symbol.toStringTag,{value:"Module"}));function FE({value:m,onChange:R,field:Q,readonly:S,className:j,...H}){const G=m||[],_=Q||H.schema,Z=()=>{const J={id:`new-${Date.now()}`,label:"New Related Record"};R([...G,J])},ee=J=>{R(G.filter(L=>L.id!==J))},fe=J=>{console.log("View detail:",J)};return S?b.jsxs("div",{className:te.cn("space-y-2",j),children:[G.length===0?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):G.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(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(J),children:b.jsx(qb,{className:"w-4 h-4"})})]},J.id)),b.jsxs("p",{className:"text-xs text-muted-foreground",children:[G.length," ",G.length===1?"record":"records"]})]}):b.jsxs("div",{className:te.cn("space-y-3",j),children:[b.jsxs("div",{className:"space-y-2",children:[G.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(te.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(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(J),children:b.jsx(qb,{className:"w-4 h-4"})}),b.jsx(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>ee(J.id),disabled:H.disabled,children:b.jsx(Gr,{className:"w-4 h-4"})})]})]},J.id)),G.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(te.Button,{type:"button",variant:"outline",className:"w-full",onClick:Z,disabled:H.disabled,children:[b.jsx(PT,{className:"w-4 h-4 mr-2"}),"Add ",_?.label||"Record"]})]})}const kE=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:FE},Symbol.toStringTag,{value:"Module"}));function dS(m){return m.replace(/[_-]/g," ").replace(/\b\w/g,R=>R.toUpperCase())}const WE={critical:"red",urgent:"red",high:"orange",medium:"yellow",normal:"blue",low:"gray",none:"gray"},IE={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"};function hS(m,R){const Q=m||(R?WE[String(R).toLowerCase()]:void 0);return IE[Q||""]||"bg-muted text-muted-foreground border-border"}function mS({value:m,field:R}){const S=R.options||[];if(!m)return b.jsx("span",{children:"-"});if(Array.isArray(m))return b.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((_,Z)=>{const ee=S.find(L=>L.value===_),fe=ee?.label||dS(String(_)),J=hS(ee?.color,_);return b.jsx(te.Badge,{variant:"outline",className:J,children:fe},Z)})});const j=S.find(_=>_.value===m),H=j?.label||dS(String(m)),G=hS(j?.color,m);return b.jsx(te.Badge,{variant:"outline",className:G,children:H})}function yS({value:m,field:R}){if(m==null||m==="")return b.jsx("span",{children:"-"});const Q=R.options||[],S=j=>{if(Q.length>0){const H=Q.find(G=>String(G.value)===String(j));if(H)return H.label}return String(j)};if(Array.isArray(m))return b.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((j,H)=>{let G;return j!=null&&typeof j=="object"?G=j.name||j.label||j._id||String(j):G=S(j),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:G},H)})});if(typeof m=="object"&&m!==null){const j=m.name||m.label||m._id||"[Object]";return b.jsx("span",{className:"truncate",children:j})}return b.jsx("span",{className:"truncate",children:S(m)})}function pS({value:m}){if(!m)return b.jsx("span",{children:"-"});if(typeof m!="object")return b.jsx("span",{className:"truncate",children:String(m)});if(Array.isArray(m))return b.jsxs("div",{className:"flex -space-x-2",children:[m.slice(0,3).map((S,j)=>{if(typeof S!="object"||S===null)return b.jsx("span",{className:"truncate text-sm",children:String(S)},j);const H=S.name||S.username||"User",G=H.split(" ").map(_=>_[0]).join("").toUpperCase().slice(0,2);return b.jsx(te.Avatar,{className:"size-8 border-2 border-white",title:H,children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:G})},j)}),m.length>3&&b.jsx(te.Avatar,{className:"size-8 border-2 border-white",children:b.jsxs(te.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",m.length-3]})})]});const R=m.name||m.username||"User",Q=R.split(" ").map(S=>S[0]).join("").toUpperCase().slice(0,2);return b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(te.Avatar,{className:"size-8",children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:Q})}),b.jsx("span",{className:"truncate",children:R})]})}const PE=new Map;function wr(m,R){PE.set(m,R)}wr("lookup",yS),wr("master_detail",yS),wr("select",mS),wr("status",mS),wr("user",pS),wr("owner",pS);const gS={text:()=>Promise.resolve().then(()=>tE).then(m=>({default:m.TextField})),textarea:()=>Promise.resolve().then(()=>rE).then(m=>({default:m.TextAreaField})),number:()=>Promise.resolve().then(()=>lE).then(m=>({default:m.NumberField})),boolean:()=>Promise.resolve().then(()=>aE).then(m=>({default:m.BooleanField})),select:()=>Promise.resolve().then(()=>nE).then(m=>({default:m.SelectField})),date:()=>Promise.resolve().then(()=>uE).then(m=>({default:m.DateField})),datetime:()=>Promise.resolve().then(()=>mE).then(m=>({default:m.DateTimeField})),time:()=>Promise.resolve().then(()=>yE).then(m=>({default:m.TimeField})),email:()=>Promise.resolve().then(()=>iE).then(m=>({default:m.EmailField})),phone:()=>Promise.resolve().then(()=>cE).then(m=>({default:m.PhoneField})),url:()=>Promise.resolve().then(()=>oE).then(m=>({default:m.UrlField})),currency:()=>Promise.resolve().then(()=>fE).then(m=>({default:m.CurrencyField})),percent:()=>Promise.resolve().then(()=>pE).then(m=>({default:m.PercentField})),password:()=>Promise.resolve().then(()=>gE).then(m=>({default:m.PasswordField})),markdown:()=>Promise.resolve().then(()=>Pb).then(m=>({default:m.RichTextField})),html:()=>Promise.resolve().then(()=>Pb).then(m=>({default:m.RichTextField})),lookup:()=>Promise.resolve().then(()=>hE).then(m=>({default:m.LookupField})),master_detail:()=>Promise.resolve().then(()=>kE).then(m=>({default:m.MasterDetailField})),file:()=>Promise.resolve().then(()=>bE).then(m=>({default:m.FileField})),image:()=>Promise.resolve().then(()=>SE).then(m=>({default:m.ImageField})),location:()=>Promise.resolve().then(()=>EE).then(m=>({default:m.LocationField})),formula:()=>Promise.resolve().then(()=>xE).then(m=>({default:m.FormulaField})),summary:()=>Promise.resolve().then(()=>OE).then(m=>({default:m.SummaryField})),auto_number:()=>Promise.resolve().then(()=>CE).then(m=>({default:m.AutoNumberField})),user:()=>Promise.resolve().then(()=>iS).then(m=>({default:m.UserField})),owner:()=>Promise.resolve().then(()=>iS).then(m=>({default:m.UserField})),object:()=>Promise.resolve().then(()=>RE).then(m=>({default:m.ObjectField})),vector:()=>Promise.resolve().then(()=>NE).then(m=>({default:m.VectorField})),grid:()=>Promise.resolve().then(()=>HE).then(m=>({default:m.GridField})),color:()=>Promise.resolve().then(()=>BE).then(m=>({default:m.ColorField})),slider:()=>Promise.resolve().then(()=>qE).then(m=>({default:m.SliderField})),rating:()=>Promise.resolve().then(()=>YE).then(m=>({default:m.RatingField})),code:()=>Promise.resolve().then(()=>GE).then(m=>({default:m.CodeField})),avatar:()=>Promise.resolve().then(()=>wE).then(m=>({default:m.AvatarField})),address:()=>Promise.resolve().then(()=>XE).then(m=>({default:m.AddressField})),geolocation:()=>Promise.resolve().then(()=>LE).then(m=>({default:m.GeolocationField})),signature:()=>Promise.resolve().then(()=>JE).then(m=>({default:m.SignatureField})),qrcode:()=>Promise.resolve().then(()=>$E).then(m=>({default:m.QRCodeField}))};function eA(m){const R=gS[m];if(!R){console.warn(`Unknown field type: ${m}`);return}const Q=me.lazy(R);yp.ComponentRegistry.register(m,Q,{namespace:"field"})}function tA(){Object.keys(gS).forEach(m=>{eA(m)})}tA();const lA={text:Qb,textarea:Ib,number:Lb,currency:Wb,percent:aS,boolean:Zb,select:Jb,date:Kb,datetime:tS,time:lS,email:$b,phone:Fb,url:kb,password:nS,color:cS,rating:sS,image:uS,avatar:rS,lookup:eS,slider:oS,code:fS};function $v(m){return lA[m]||null}class aA{eGui;root=null;init(R){const{value:Q,field:S}=R,j=$v(S.type);this.eGui=document.createElement("div"),this.eGui.className="field-widget-cell",j?(this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(j,{value:Q,onChange:()=>{},field:S,readonly:!0}))):this.eGui.textContent=Q!=null?String(Q):""}getGui(){return this.eGui}refresh(R){const{value:Q,field:S}=R,j=$v(S.type);return j&&this.root?(this.root.render(b.jsx(j,{value:Q,onChange:()=>{},field:S,readonly:!0})),!0):this.eGui?(this.eGui.textContent=Q!=null?String(Q):"",!0):!1}destroy(){this.root&&this.root.unmount()}}class nA{eGui;root=null;currentValue;params;init(R){this.params=R,this.currentValue=R.value;const{field:Q}=R,S=$v(Q.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:j=>{this.currentValue=j},field:Q,readonly:!1}));else{const j=document.createElement("input");j.value=this.currentValue!=null?String(this.currentValue):"",j.className="ag-input-field-input ag-text-field-input",j.addEventListener("input",H=>{this.currentValue=H.target.value}),this.eGui.appendChild(j),setTimeout(()=>j.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 uA(m){return class extends aA{init(R){super.init({...R,field:m})}refresh(R){return super.refresh({...R,field:m})}}}function iA(m){return class extends nA{init(R){super.init({...R,field:m})}}}function cA({objectName:m,dataSource:R,fields:Q,fieldNames:S,filters:j,sort:H,pageSize:G=10,pagination:_=!0,domLayout:Z="normal",animateRows:ee=!0,rowSelection:fe,theme:J="quartz",height:L=500,className:ue="",editable:ce=!1,editType:Se,singleClickEdit:Ve=!1,stopEditingWhenCellsLoseFocus:ie=!0,exportConfig:qe,statusBar:st,callbacks:Xe,columnConfig:yt,enableRangeSelection:ge=!1,enableCharts:Me=!1,contextMenu:ve}){const Ne=me.useRef(null),[se,ut]=me.useState(!0),[He,Ce]=me.useState(null),[jt,Ft]=me.useState(null),[M,k]=me.useState([]);me.useEffect(()=>{if(!R){Ce(new Error("DataSource is required")),ut(!1);return}(async()=>{try{ut(!0),Ce(null);const Ze=await R.getObjectSchema(m);Ft(Ze)}catch(Ze){const Gt=Ze instanceof Error?Ze:new Error(String(Ze));Ce(Gt),Xe?.onDataError?.(Gt)}finally{ut(!1)}})()},[m,R,Xe]),me.useEffect(()=>{if(!R||!jt)return;(async()=>{try{ut(!0),Ce(null);const Ze={$top:G,$skip:0};j&&(Ze.$filter=j),H&&(Ze.$orderby=H);const Gt=yp.buildExpandFields(jt?.fields);Gt.length>0&&(Ze.$expand=Gt);const xt=await R.find(m,Ze);k(xt.data||[]),Xe?.onDataLoaded?.(xt.data||[])}catch(Ze){const Gt=Ze instanceof Error?Ze:new Error(String(Ze));Ce(Gt),Xe?.onDataError?.(Gt)}finally{ut(!1)}})()},[m,R,jt,j,H,G,Xe]);const ae=me.useMemo(()=>{if(!jt?.fields)return[];const le=Q||Object.values(jt.fields);return(S?le.filter(Gt=>S.includes(Gt.name)):le).map(Gt=>{const xt={field:Gt.name,headerName:Gt.label||Gt.name,sortable:Gt.sortable!==!1,filter:oA(Gt),editable:ce&&!Gt.readonly};return yt&&(yt.resizable!==void 0&&(xt.resizable=yt.resizable),yt.sortable!==void 0&&xt.sortable===void 0&&(xt.sortable=yt.sortable)),sA(xt,Gt),xt})},[jt,Q,S,ce,yt]),Ee=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]),Oe=me.useCallback(()=>{if(!Ne.current?.api)return;const le={fileName:qe?.fileName||`${m}-export.csv`,skipColumnHeaders:qe?.skipColumnHeaders||!1,allColumns:qe?.allColumns||!1,onlySelected:qe?.onlySelected||!1};if(Ne.current.api.exportDataAsCsv(le),Xe?.onExport){const Ze=qe?.onlySelected?Ne.current.api.getSelectedRows():M;Xe.onExport(Ze||[],"csv")}},[qe,Xe,M,m]),K=me.useCallback(le=>{if(!ve?.enabled)return[];const Ze=[];return(ve.items||["copy","copyWithHeaders","separator","export"]).forEach(xt=>{xt==="export"?Ze.push({name:"Export CSV",icon:"<span>📥</span>",action:()=>Oe()}):xt==="autoSizeAll"?Ze.push({name:"Auto-size All Columns",action:()=>{Ne.current?.api&&Ne.current.api.autoSizeAllColumns()}}):xt==="resetColumns"?Ze.push({name:"Reset Columns",action:()=>{Ne.current?.api&&Ne.current.api.resetColumnState()}}):Ze.push(xt)}),ve.customItems&&(Ze.length>0&&Ze.push("separator"),ve.customItems.forEach(xt=>{Ze.push({name:xt.name,disabled:xt.disabled,action:()=>{Xe?.onContextMenuAction&&Xe.onContextMenuAction(xt.action,le.node?.data)}})})),Ze},[ve,Oe,Xe]),he=me.useCallback(le=>{Xe?.onCellClicked?.(le)},[Xe]),pe=me.useCallback(le=>{Xe?.onRowClicked?.(le)},[Xe]),ne=me.useCallback(le=>{Xe?.onSelectionChanged?.(le)},[Xe]),xe=me.useCallback(async le=>{if(Xe?.onCellValueChanged?.(le),R&&le.data&&le.data.id)try{await R.update(m,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)}},[Xe,R,m]),Al=me.useCallback(le=>{Ne.current=le},[]),Pe=me.useMemo(()=>({pagination:_,paginationPageSize:G,domLayout:Z,animateRows:ee,rowSelection:fe,editType:Se,singleClickEdit:Ve,stopEditingWhenCellsLoseFocus:ie,statusBar:Ee?{statusPanels:Ee}:void 0,enableRangeSelection:ge,enableCharts:Me,getContextMenuItems:ve?.enabled?K:void 0,suppressCellFocus:!ce,enableCellTextSelection:!0,ensureDomOrder:!0,onCellClicked:he,onRowClicked:pe,onSelectionChanged:ne,onCellValueChanged:xe,onGridReady:Al}),[_,G,Z,ee,fe,Se,Ve,ie,Ee,ge,Me,ve,K,ce,he,pe,ne,xe,Al]),Jl=me.useMemo(()=>({height:typeof L=="number"?`${L}px`:L,width:"100%"}),[L]),ic=[`ag-theme-${J}`,"rounded-xl","border","border-border","overflow-hidden","shadow-lg",ue].filter(Boolean).join(" ");return se?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-muted-foreground",children:["Loading ",m,"..."]})}):He?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-destructive",children:["Error loading data: ",He.message]})}):b.jsxs("div",{className:"object-aggrid-container",children:[qe?.enabled&&b.jsx("div",{className:"mb-2 flex gap-2",children:b.jsx("button",{onClick:Oe,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:Ne,rowData:M,columnDefs:ae,gridOptions:Pe})})]})}function oA(m){return m.filterable===!1?!1:BT[m.type]||"agTextColumnFilter"}function sA(m,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))m.cellRenderer=uA(R),m.editable&&(m.cellEditor=iA(R),["date","datetime","select","lookup","color"].includes(R.type)&&(m.cellEditorPopup=!0));else switch(R.type){case"master_detail":m.valueFormatter=S=>S.value?typeof S.value=="object"?S.value.name||S.value.label||S.value.id||"":String(S.value):"";break;case"object":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Object]",S};break;case"vector":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Vector]",S};break;case"grid":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Grid]",S};break;default:m.valueFormatter=S=>S.value!=null?String(S.value):""}}const fA=Object.freeze(Object.defineProperty({__proto__:null,default:cA},Symbol.toStringTag,{value:"Module"}));bn.AgGridRenderer=Lv,bn.ObjectAgGridRenderer=Zv,bn.aggridComponents=NT,Object.defineProperty(bn,Symbol.toStringTag,{value:"Module"})}));
234
+ }`,disabled:S||j.disabled,className:te.cn("font-mono text-xs",ee?"border-red-500 focus-visible:ring-red-500":"",j.className),rows:6}),ee&&b.jsx("p",{className:"text-xs text-red-500",children:ee})]})}const RE=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:_E},Symbol.toStringTag,{value:"Module"}));function jE({value:m,field:R,...Q}){const j=(R||Q.schema)?.dimensions||(Array.isArray(m)?m.length:0);if(!m||!Array.isArray(m))return b.jsx("span",{className:"text-sm text-gray-500",children:"-"});const H=m.slice(0,3).map(G=>{const _=Number(G);return isNaN(_)?"0":_.toFixed(4)}).join(", ");return b.jsxs("div",{className:`text-sm ${Q.className||""}`,children:[b.jsxs("span",{className:"font-mono text-gray-700",children:["[",H,"...]"]}),b.jsxs("span",{className:"text-gray-500 ml-2",children:["(",j,"D)"]})]})}const NE=Object.freeze(Object.defineProperty({__proto__:null,VectorField:jE},Symbol.toStringTag,{value:"Module"}));function UE({value:m,field:R,readonly:Q,...S}){const H=(R||S.schema)?.columns||[];return!m||!Array.isArray(m)?b.jsx("span",{className:"text-sm text-muted-foreground",children:"-"}):Q?b.jsx("div",{className:te.cn("text-sm",S.className),children:b.jsxs("span",{className:"text-foreground",children:[m.length," rows"]})}):b.jsxs("div",{className:te.cn("border border-border rounded-lg 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-muted border-b border-border",children:b.jsx("tr",{children:H.map((G,_)=>b.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground",children:G.label||G.name},_))})}),b.jsx("tbody",{className:"divide-y divide-border",children:m.slice(0,5).map((G,_)=>b.jsx("tr",{className:"hover:bg-muted/50 transition-colors",children:H.map((Z,ee)=>b.jsx("td",{className:"px-3 py-2 text-foreground",children:G[Z.name]!=null?String(G[Z.name]):"-"},ee))},_))})]})}),m.length>5&&b.jsxs("div",{className:"bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",children:["Showing 5 of ",m.length," rows"]})]})}const HE=Object.freeze(Object.defineProperty({__proto__:null,GridField:UE},Symbol.toStringTag,{value:"Module"}));function cS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.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:m||"#000000"}}),b.jsx("span",{className:"text-sm",children:m||"-"})]}):b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"color",value:m||"#000000",onChange:G=>R(G.target.value),disabled:S||j.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),b.jsx(te.Input,{type:"text",value:m||"",onChange:G=>R(G.target.value),placeholder:H?.placeholder||"#000000",disabled:S||j.disabled,className:j.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const BE=Object.freeze(Object.defineProperty({__proto__:null,ColorField:cS},Symbol.toStringTag,{value:"Module"}));function oS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=H?.min??0,_=H?.max??100,Z=H?.step??1;return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-medium",children:m??G}),b.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",_]})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx(te.Slider,{value:[m??G],onValueChange:ee=>R(ee[0]),min:G,max:_,step:Z,disabled:S||j.disabled,className:j.className}),b.jsx("span",{className:"text-sm font-medium w-12 text-right",children:m??G})]})}const qE=Object.freeze(Object.defineProperty({__proto__:null,SliderField:oS},Symbol.toStringTag,{value:"Module"}));function sS({value:m,onChange:R,field:Q,readonly:S,className:j,...H}){const _=(Q||H.schema)?.max??5,Z=m??0,[ee,fe]=me.useState(null),J=ee!==null?ee:Z;return S?b.jsxs("div",{className:te.cn("flex items-center gap-1",j),children:[Array.from({length:_},(L,ue)=>b.jsx(Vb,{className:`w-5 h-5 ${ue<Z?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},ue)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]}):b.jsxs("div",{className:te.cn("flex items-center gap-1",j),children:[Array.from({length:_},(L,ue)=>b.jsx("button",{type:"button",onClick:()=>R(ue+1),onMouseEnter:()=>fe(ue+1),onMouseLeave:()=>fe(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:S||H.disabled,children:b.jsx(Vb,{className:`w-5 h-5 transition-colors ${ue<J?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},ue)),b.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[Z," / ",_]})]})}const YE=Object.freeze(Object.defineProperty({__proto__:null,RatingField:sS},Symbol.toStringTag,{value:"Module"}));function fS({value:m,onChange:R,field:Q,readonly:S,...j}){const H=Q||j.schema,G=H?.language??"javascript";return S?b.jsx("pre",{className:te.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",j.className),children:b.jsx("code",{children:m||"-"})}):b.jsx(te.Textarea,{value:m||"",onChange:_=>R(_.target.value),placeholder:H?.placeholder||`// Write ${G} code here...`,disabled:S||j.disabled,className:te.cn("font-mono text-sm",j.className),rows:12,spellCheck:!1})}const GE=Object.freeze(Object.defineProperty({__proto__:null,CodeField:fS},Symbol.toStringTag,{value:"Module"}));function rS({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=me.useRef(null),Z=Q||j.schema,ee=L=>{const ue=L.target.files?.[0];if(!ue)return;if(!ue.type.startsWith("image/")){console.error("Please select an image file");return}if(ue.size>5*1024*1024){console.error("File size must be less than 5MB");return}const ce=new FileReader;ce.onloadend=()=>{R(ce.result)},ce.readAsDataURL(ue)},fe=()=>{R("")},J=()=>(Z?.defaultName||Z?.label||"User").split(" ").map(ue=>ue[0]).join("").toUpperCase().slice(0,2);return S?b.jsxs(te.Avatar,{className:"w-16 h-16",children:[m&&b.jsx(te.AvatarImage,{src:m,alt:Z?.label}),b.jsx(te.AvatarFallback,{children:J()})]}):b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative",onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),children:[b.jsxs(te.Avatar,{className:"w-16 h-16",children:[m&&b.jsx(te.AvatarImage,{src:m,alt:Z?.label}),b.jsx(te.AvatarFallback,{children:J()})]}),!S&&H&&m&&b.jsx("button",{type:"button",onClick:fe,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(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>_.current?.click(),disabled:S||j.disabled,children:[b.jsx(Xb,{className:"w-4 h-4 mr-2"}),m?"Change":"Upload"," Avatar"]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const wE=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:rS},Symbol.toStringTag,{value:"Module"}));function VE({value:m,onChange:R,field:Q,readonly:S,...j}){const H=m||{},G=(Z,ee)=>{R({...H,[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:_(H)}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),b.jsx(te.Input,{id:"street",type:"text",value:H.street||"",onChange:Z=>G("street",Z.target.value),placeholder:"123 Main St",disabled:S||j.disabled,className:j.className})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"city",className:"text-xs",children:"City"}),b.jsx(te.Input,{id:"city",type:"text",value:H.city||"",onChange:Z=>G("city",Z.target.value),placeholder:"San Francisco",disabled:S||j.disabled})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),b.jsx(te.Input,{id:"state",type:"text",value:H.state||"",onChange:Z=>G("state",Z.target.value),placeholder:"CA",disabled:S||j.disabled})]})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),b.jsx(te.Input,{id:"zipCode",type:"text",value:H.zipCode||"",onChange:Z=>G("zipCode",Z.target.value),placeholder:"94102",disabled:S||j.disabled})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),b.jsx(te.Input,{id:"country",type:"text",value:H.country||"",onChange:Z=>G("country",Z.target.value),placeholder:"United States",disabled:S||j.disabled})]})]})]})}const XE=Object.freeze(Object.defineProperty({__proto__:null,AddressField:VE},Symbol.toStringTag,{value:"Module"}));function QE({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=m||{},Z=(L,ue)=>{R({..._,[L]:ue?Number(ue):void 0})},ee=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}G(!0),navigator.geolocation.getCurrentPosition(L=>{R({latitude:L.coords.latitude,longitude:L.coords.longitude,accuracy:L.coords.accuracy}),G(!1)},L=>{console.error("Error getting location:",L.message),G(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},fe=L=>!L.latitude||!L.longitude?"-":`${L.latitude.toFixed(6)}, ${L.longitude.toFixed(6)}`,J=()=>{if(!_.latitude||!_.longitude)return;const L=`https://www.google.com/maps?q=${_.latitude},${_.longitude}`;window.open(L,"_blank")};return S?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Gb,{className:"w-4 h-4 text-muted-foreground"}),b.jsx("span",{className:"text-sm",children:fe(_)}),_.latitude&&_.longitude&&b.jsx(te.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(te.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:S||H,children:[b.jsx($T,{className:"w-4 h-4 mr-2"}),H?"Getting location...":"Use Current Location"]}),_.latitude&&_.longitude&&b.jsxs(te.Button,{type:"button",variant:"link",size:"sm",onClick:J,children:[b.jsx(Gb,{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(te.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),b.jsx(te.Input,{id:"latitude",type:"number",value:_.latitude??"",onChange:L=>Z("latitude",L.target.value),placeholder:"37.7749",disabled:S||j.disabled,step:"any",className:j.className})]}),b.jsxs("div",{children:[b.jsx(te.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),b.jsx(te.Input,{id:"longitude",type:"number",value:_.longitude??"",onChange:L=>Z("longitude",L.target.value),placeholder:"-122.4194",disabled:S||j.disabled,step:"any"})]})]}),_.accuracy&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",_.accuracy.toFixed(0),"m"]})]})}const LE=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:QE},Symbol.toStringTag,{value:"Module"}));function ZE({value:m,onChange:R,readonly:Q}){const S=me.useRef(null),[j,H]=me.useState(!1),[G,_]=me.useState(!m);me.useEffect(()=>{if(m&&S.current){const ue=S.current.getContext("2d");if(ue){const ce=new Image;ce.onload=()=>{ue.drawImage(ce,0,0),_(!1)},ce.src=m}}},[m]);const Z=L=>{if(Q)return;H(!0),_(!1);const ue=S.current;if(!ue)return;const ce=ue.getContext("2d");if(!ce)return;const Se=ue.getBoundingClientRect(),Ve="touches"in L?L.touches[0].clientX-Se.left:L.clientX-Se.left,ie="touches"in L?L.touches[0].clientY-Se.top:L.clientY-Se.top;ce.beginPath(),ce.moveTo(Ve,ie)},ee=L=>{if(!j||Q)return;const ue=S.current;if(!ue)return;const ce=ue.getContext("2d");if(!ce)return;const Se=ue.getBoundingClientRect(),Ve="touches"in L?L.touches[0].clientX-Se.left:L.clientX-Se.left,ie="touches"in L?L.touches[0].clientY-Se.top:L.clientY-Se.top;ce.lineTo(Ve,ie),ce.strokeStyle="#000",ce.lineWidth=2,ce.lineCap="round",ce.lineJoin="round",ce.stroke()},fe=()=>{if(!j)return;H(!1);const L=S.current;if(!L)return;const ue=L.toDataURL("image/png");R(ue)},J=()=>{const L=S.current;if(!L)return;const ue=L.getContext("2d");ue&&(ue.clearRect(0,0,L.width,L.height),_(!0),R(""))};return Q&&m?b.jsx("div",{className:"border rounded p-2 bg-white",children:b.jsx("img",{src:m,alt:"Signature",loading:"lazy",className:"max-w-full h-auto"})}):Q&&!m?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:fe,onMouseLeave:fe,onTouchStart:Z,onTouchMove:ee,onTouchEnd:fe})}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:G?"Sign above":"Signature captured"}),b.jsxs(te.Button,{type:"button",variant:"outline",size:"sm",onClick:J,disabled:Q||G,children:[b.jsx(FT,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const JE=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:ZE},Symbol.toStringTag,{value:"Module"}));function KE({value:m,onChange:R,field:Q,readonly:S,...j}){const[H,G]=me.useState(!1),_=Q||j.schema,Z=fe=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(fe)}`,ee=()=>{m&&navigator.clipboard.writeText(m)};return S?b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("span",{className:"text-sm flex-1 truncate",children:m||"-"}),m&&b.jsxs(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!H),children:[b.jsx(wb,{className:"w-4 h-4 mr-2"}),H?"Hide":"Show"," QR"]})]}):b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(te.Input,{type:"text",value:m||"",onChange:fe=>R(fe.target.value),placeholder:_?.placeholder||"Enter text for QR code",disabled:S||j.disabled,className:j.className}),m&&b.jsxs(b.Fragment,{children:[b.jsx(te.Button,{type:"button",variant:"outline",size:"sm",onClick:ee,children:b.jsx(KT,{className:"w-4 h-4"})}),b.jsx(te.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!H),children:b.jsx(wb,{className:"w-4 h-4"})})]})]}),H&&m&&b.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:b.jsx("img",{src:Z(m),alt:"QR Code",className:"w-48 h-48"})}),m&&b.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",m.length," characters"]})]})}const $E=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:KE},Symbol.toStringTag,{value:"Module"}));function FE({value:m,onChange:R,field:Q,readonly:S,className:j,...H}){const G=m||[],_=Q||H.schema,Z=()=>{const J={id:`new-${Date.now()}`,label:"New Related Record"};R([...G,J])},ee=J=>{R(G.filter(L=>L.id!==J))},fe=J=>{console.log("View detail:",J)};return S?b.jsxs("div",{className:te.cn("space-y-2",j),children:[G.length===0?b.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):G.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(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(J),children:b.jsx(qb,{className:"w-4 h-4"})})]},J.id)),b.jsxs("p",{className:"text-xs text-muted-foreground",children:[G.length," ",G.length===1?"record":"records"]})]}):b.jsxs("div",{className:te.cn("space-y-3",j),children:[b.jsxs("div",{className:"space-y-2",children:[G.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(te.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(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(J),children:b.jsx(qb,{className:"w-4 h-4"})}),b.jsx(te.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>ee(J.id),disabled:H.disabled,children:b.jsx(Gr,{className:"w-4 h-4"})})]})]},J.id)),G.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(te.Button,{type:"button",variant:"outline",className:"w-full",onClick:Z,disabled:H.disabled,children:[b.jsx(PT,{className:"w-4 h-4 mr-2"}),"Add ",_?.label||"Record"]})]})}const kE=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:FE},Symbol.toStringTag,{value:"Module"}));function dS(m){return m.replace(/[_-]/g," ").replace(/\b\w/g,R=>R.toUpperCase())}const WE={critical:"red",urgent:"red",high:"orange",medium:"yellow",normal:"blue",low:"gray",none:"gray",paid:"green",completed:"green",done:"green",active:"green",approved:"green",resolved:"green",pending:"yellow",waiting:"yellow",on_hold:"yellow",shipped:"blue",in_progress:"blue",open:"blue",processing:"blue",draft:"gray",new:"gray",inactive:"gray",closed:"gray",cancelled:"red",canceled:"red",rejected:"red",failed:"red",overdue:"red",delivered:"purple",archived:"indigo"},IE={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"};function hS(m,R){const Q=m||(R?WE[String(R).toLowerCase().replace(/[\s-]/g,"_")]:void 0);return IE[Q||""]||"bg-muted text-muted-foreground border-border"}function mS({value:m,field:R}){const S=R.options||[];if(!m)return b.jsx("span",{children:"-"});if(Array.isArray(m))return b.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((_,Z)=>{const ee=S.find(L=>L.value===_),fe=ee?.label||dS(String(_)),J=hS(ee?.color,_);return b.jsx(te.Badge,{variant:"outline",className:J,children:fe},Z)})});const j=S.find(_=>_.value===m),H=j?.label||dS(String(m)),G=hS(j?.color,m);return b.jsx(te.Badge,{variant:"outline",className:G,children:H})}function yS({value:m,field:R}){if(m==null||m==="")return b.jsx("span",{children:"-"});const Q=R.options||[],S=j=>{if(Q.length>0){const H=Q.find(G=>String(G.value)===String(j));if(H)return H.label}return String(j)};if(Array.isArray(m))return b.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((j,H)=>{let G;return j!=null&&typeof j=="object"?G=j.name||j.label||j._id||String(j):G=S(j),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:G},H)})});if(typeof m=="object"&&m!==null){const j=m.name||m.label||m._id||"[Object]";return b.jsx("span",{className:"truncate",children:j})}return b.jsx("span",{className:"truncate",children:S(m)})}function pS({value:m}){if(!m)return b.jsx("span",{children:"-"});if(typeof m!="object")return b.jsx("span",{className:"truncate",children:String(m)});if(Array.isArray(m))return b.jsxs("div",{className:"flex -space-x-2",children:[m.slice(0,3).map((S,j)=>{if(typeof S!="object"||S===null)return b.jsx("span",{className:"truncate text-sm",children:String(S)},j);const H=S.name||S.username||"User",G=H.split(" ").map(_=>_[0]).join("").toUpperCase().slice(0,2);return b.jsx(te.Avatar,{className:"size-8 border-2 border-white",title:H,children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:G})},j)}),m.length>3&&b.jsx(te.Avatar,{className:"size-8 border-2 border-white",children:b.jsxs(te.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",m.length-3]})})]});const R=m.name||m.username||"User",Q=R.split(" ").map(S=>S[0]).join("").toUpperCase().slice(0,2);return b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(te.Avatar,{className:"size-8",children:b.jsx(te.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:Q})}),b.jsx("span",{className:"truncate",children:R})]})}const PE=new Map;function wr(m,R){PE.set(m,R)}wr("lookup",yS),wr("master_detail",yS),wr("select",mS),wr("status",mS),wr("user",pS),wr("owner",pS);const gS={text:()=>Promise.resolve().then(()=>tE).then(m=>({default:m.TextField})),textarea:()=>Promise.resolve().then(()=>rE).then(m=>({default:m.TextAreaField})),number:()=>Promise.resolve().then(()=>lE).then(m=>({default:m.NumberField})),boolean:()=>Promise.resolve().then(()=>aE).then(m=>({default:m.BooleanField})),select:()=>Promise.resolve().then(()=>nE).then(m=>({default:m.SelectField})),date:()=>Promise.resolve().then(()=>uE).then(m=>({default:m.DateField})),datetime:()=>Promise.resolve().then(()=>mE).then(m=>({default:m.DateTimeField})),time:()=>Promise.resolve().then(()=>yE).then(m=>({default:m.TimeField})),email:()=>Promise.resolve().then(()=>iE).then(m=>({default:m.EmailField})),phone:()=>Promise.resolve().then(()=>cE).then(m=>({default:m.PhoneField})),url:()=>Promise.resolve().then(()=>oE).then(m=>({default:m.UrlField})),currency:()=>Promise.resolve().then(()=>fE).then(m=>({default:m.CurrencyField})),percent:()=>Promise.resolve().then(()=>pE).then(m=>({default:m.PercentField})),password:()=>Promise.resolve().then(()=>gE).then(m=>({default:m.PasswordField})),markdown:()=>Promise.resolve().then(()=>Pb).then(m=>({default:m.RichTextField})),html:()=>Promise.resolve().then(()=>Pb).then(m=>({default:m.RichTextField})),lookup:()=>Promise.resolve().then(()=>hE).then(m=>({default:m.LookupField})),master_detail:()=>Promise.resolve().then(()=>kE).then(m=>({default:m.MasterDetailField})),file:()=>Promise.resolve().then(()=>bE).then(m=>({default:m.FileField})),image:()=>Promise.resolve().then(()=>SE).then(m=>({default:m.ImageField})),location:()=>Promise.resolve().then(()=>EE).then(m=>({default:m.LocationField})),formula:()=>Promise.resolve().then(()=>xE).then(m=>({default:m.FormulaField})),summary:()=>Promise.resolve().then(()=>OE).then(m=>({default:m.SummaryField})),auto_number:()=>Promise.resolve().then(()=>CE).then(m=>({default:m.AutoNumberField})),user:()=>Promise.resolve().then(()=>iS).then(m=>({default:m.UserField})),owner:()=>Promise.resolve().then(()=>iS).then(m=>({default:m.UserField})),object:()=>Promise.resolve().then(()=>RE).then(m=>({default:m.ObjectField})),vector:()=>Promise.resolve().then(()=>NE).then(m=>({default:m.VectorField})),grid:()=>Promise.resolve().then(()=>HE).then(m=>({default:m.GridField})),color:()=>Promise.resolve().then(()=>BE).then(m=>({default:m.ColorField})),slider:()=>Promise.resolve().then(()=>qE).then(m=>({default:m.SliderField})),rating:()=>Promise.resolve().then(()=>YE).then(m=>({default:m.RatingField})),code:()=>Promise.resolve().then(()=>GE).then(m=>({default:m.CodeField})),avatar:()=>Promise.resolve().then(()=>wE).then(m=>({default:m.AvatarField})),address:()=>Promise.resolve().then(()=>XE).then(m=>({default:m.AddressField})),geolocation:()=>Promise.resolve().then(()=>LE).then(m=>({default:m.GeolocationField})),signature:()=>Promise.resolve().then(()=>JE).then(m=>({default:m.SignatureField})),qrcode:()=>Promise.resolve().then(()=>$E).then(m=>({default:m.QRCodeField}))};function eA(m){const R=gS[m];if(!R){console.warn(`Unknown field type: ${m}`);return}const Q=me.lazy(R);yp.ComponentRegistry.register(m,Q,{namespace:"field"})}function tA(){Object.keys(gS).forEach(m=>{eA(m)})}tA();const lA={text:Qb,textarea:Ib,number:Lb,currency:Wb,percent:aS,boolean:Zb,select:Jb,date:Kb,datetime:tS,time:lS,email:$b,phone:Fb,url:kb,password:nS,color:cS,rating:sS,image:uS,avatar:rS,lookup:eS,slider:oS,code:fS};function $v(m){return lA[m]||null}class aA{eGui;root=null;init(R){const{value:Q,field:S}=R,j=$v(S.type);this.eGui=document.createElement("div"),this.eGui.className="field-widget-cell",j?(this.root=Ub.createRoot(this.eGui),this.root.render(b.jsx(j,{value:Q,onChange:()=>{},field:S,readonly:!0}))):this.eGui.textContent=Q!=null?String(Q):""}getGui(){return this.eGui}refresh(R){const{value:Q,field:S}=R,j=$v(S.type);return j&&this.root?(this.root.render(b.jsx(j,{value:Q,onChange:()=>{},field:S,readonly:!0})),!0):this.eGui?(this.eGui.textContent=Q!=null?String(Q):"",!0):!1}destroy(){this.root&&this.root.unmount()}}class nA{eGui;root=null;currentValue;params;init(R){this.params=R,this.currentValue=R.value;const{field:Q}=R,S=$v(Q.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:j=>{this.currentValue=j},field:Q,readonly:!1}));else{const j=document.createElement("input");j.value=this.currentValue!=null?String(this.currentValue):"",j.className="ag-input-field-input ag-text-field-input",j.addEventListener("input",H=>{this.currentValue=H.target.value}),this.eGui.appendChild(j),setTimeout(()=>j.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 uA(m){return class extends aA{init(R){super.init({...R,field:m})}refresh(R){return super.refresh({...R,field:m})}}}function iA(m){return class extends nA{init(R){super.init({...R,field:m})}}}function cA({objectName:m,dataSource:R,fields:Q,fieldNames:S,filters:j,sort:H,pageSize:G=10,pagination:_=!0,domLayout:Z="normal",animateRows:ee=!0,rowSelection:fe,theme:J="quartz",height:L=500,className:ue="",editable:ce=!1,editType:Se,singleClickEdit:Ve=!1,stopEditingWhenCellsLoseFocus:ie=!0,exportConfig:qe,statusBar:st,callbacks:Xe,columnConfig:yt,enableRangeSelection:ge=!1,enableCharts:Me=!1,contextMenu:ve}){const Ne=me.useRef(null),[se,ut]=me.useState(!0),[He,Ce]=me.useState(null),[jt,Ft]=me.useState(null),[M,k]=me.useState([]);me.useEffect(()=>{if(!R){Ce(new Error("DataSource is required")),ut(!1);return}(async()=>{try{ut(!0),Ce(null);const Ze=await R.getObjectSchema(m);Ft(Ze)}catch(Ze){const Gt=Ze instanceof Error?Ze:new Error(String(Ze));Ce(Gt),Xe?.onDataError?.(Gt)}finally{ut(!1)}})()},[m,R,Xe]),me.useEffect(()=>{if(!R||!jt)return;(async()=>{try{ut(!0),Ce(null);const Ze={$top:G,$skip:0};j&&(Ze.$filter=j),H&&(Ze.$orderby=H);const Gt=yp.buildExpandFields(jt?.fields);Gt.length>0&&(Ze.$expand=Gt);const xt=await R.find(m,Ze);k(xt.data||[]),Xe?.onDataLoaded?.(xt.data||[])}catch(Ze){const Gt=Ze instanceof Error?Ze:new Error(String(Ze));Ce(Gt),Xe?.onDataError?.(Gt)}finally{ut(!1)}})()},[m,R,jt,j,H,G,Xe]);const ae=me.useMemo(()=>{if(!jt?.fields)return[];const le=Q||Object.values(jt.fields);return(S?le.filter(Gt=>S.includes(Gt.name)):le).map(Gt=>{const xt={field:Gt.name,headerName:Gt.label||Gt.name,sortable:Gt.sortable!==!1,filter:oA(Gt),editable:ce&&!Gt.readonly};return yt&&(yt.resizable!==void 0&&(xt.resizable=yt.resizable),yt.sortable!==void 0&&xt.sortable===void 0&&(xt.sortable=yt.sortable)),sA(xt,Gt),xt})},[jt,Q,S,ce,yt]),Ee=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]),Oe=me.useCallback(()=>{if(!Ne.current?.api)return;const le={fileName:qe?.fileName||`${m}-export.csv`,skipColumnHeaders:qe?.skipColumnHeaders||!1,allColumns:qe?.allColumns||!1,onlySelected:qe?.onlySelected||!1};if(Ne.current.api.exportDataAsCsv(le),Xe?.onExport){const Ze=qe?.onlySelected?Ne.current.api.getSelectedRows():M;Xe.onExport(Ze||[],"csv")}},[qe,Xe,M,m]),K=me.useCallback(le=>{if(!ve?.enabled)return[];const Ze=[];return(ve.items||["copy","copyWithHeaders","separator","export"]).forEach(xt=>{xt==="export"?Ze.push({name:"Export CSV",icon:"<span>📥</span>",action:()=>Oe()}):xt==="autoSizeAll"?Ze.push({name:"Auto-size All Columns",action:()=>{Ne.current?.api&&Ne.current.api.autoSizeAllColumns()}}):xt==="resetColumns"?Ze.push({name:"Reset Columns",action:()=>{Ne.current?.api&&Ne.current.api.resetColumnState()}}):Ze.push(xt)}),ve.customItems&&(Ze.length>0&&Ze.push("separator"),ve.customItems.forEach(xt=>{Ze.push({name:xt.name,disabled:xt.disabled,action:()=>{Xe?.onContextMenuAction&&Xe.onContextMenuAction(xt.action,le.node?.data)}})})),Ze},[ve,Oe,Xe]),he=me.useCallback(le=>{Xe?.onCellClicked?.(le)},[Xe]),pe=me.useCallback(le=>{Xe?.onRowClicked?.(le)},[Xe]),ne=me.useCallback(le=>{Xe?.onSelectionChanged?.(le)},[Xe]),xe=me.useCallback(async le=>{if(Xe?.onCellValueChanged?.(le),R&&le.data&&le.data.id)try{await R.update(m,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)}},[Xe,R,m]),Al=me.useCallback(le=>{Ne.current=le},[]),Pe=me.useMemo(()=>({pagination:_,paginationPageSize:G,domLayout:Z,animateRows:ee,rowSelection:fe,editType:Se,singleClickEdit:Ve,stopEditingWhenCellsLoseFocus:ie,statusBar:Ee?{statusPanels:Ee}:void 0,enableRangeSelection:ge,enableCharts:Me,getContextMenuItems:ve?.enabled?K:void 0,suppressCellFocus:!ce,enableCellTextSelection:!0,ensureDomOrder:!0,onCellClicked:he,onRowClicked:pe,onSelectionChanged:ne,onCellValueChanged:xe,onGridReady:Al}),[_,G,Z,ee,fe,Se,Ve,ie,Ee,ge,Me,ve,K,ce,he,pe,ne,xe,Al]),Jl=me.useMemo(()=>({height:typeof L=="number"?`${L}px`:L,width:"100%"}),[L]),ic=[`ag-theme-${J}`,"rounded-xl","border","border-border","overflow-hidden","shadow-lg",ue].filter(Boolean).join(" ");return se?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-muted-foreground",children:["Loading ",m,"..."]})}):He?b.jsx("div",{className:"flex items-center justify-center",style:Jl,children:b.jsxs("div",{className:"text-destructive",children:["Error loading data: ",He.message]})}):b.jsxs("div",{className:"object-aggrid-container",children:[qe?.enabled&&b.jsx("div",{className:"mb-2 flex gap-2",children:b.jsx("button",{onClick:Oe,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:Ne,rowData:M,columnDefs:ae,gridOptions:Pe})})]})}function oA(m){return m.filterable===!1?!1:BT[m.type]||"agTextColumnFilter"}function sA(m,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))m.cellRenderer=uA(R),m.editable&&(m.cellEditor=iA(R),["date","datetime","select","lookup","color"].includes(R.type)&&(m.cellEditorPopup=!0));else switch(R.type){case"master_detail":m.valueFormatter=S=>S.value?typeof S.value=="object"?S.value.name||S.value.label||S.value.id||"":String(S.value):"";break;case"object":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Object]",S};break;case"vector":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Vector]",S};break;case"grid":m.cellRenderer=()=>{const S=document.createElement("span");return S.className="text-gray-500 italic",S.textContent="[Grid]",S};break;default:m.valueFormatter=S=>S.value!=null?String(S.value):""}}const fA=Object.freeze(Object.defineProperty({__proto__:null,default:cA},Symbol.toStringTag,{value:"Module"}));bn.AgGridRenderer=Lv,bn.ObjectAgGridRenderer=Zv,bn.aggridComponents=NT,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": "3.1.0",
3
+ "version": "3.1.1",
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,12 +25,12 @@
25
25
  "./style.css": "./dist/index.css"
26
26
  },
27
27
  "dependencies": {
28
- "@object-ui/components": "3.1.0",
29
- "@object-ui/core": "3.1.0",
30
- "@object-ui/data-objectstack": "3.1.0",
31
- "@object-ui/fields": "3.1.0",
32
- "@object-ui/react": "3.1.0",
33
- "@object-ui/types": "3.1.0"
28
+ "@object-ui/components": "3.1.1",
29
+ "@object-ui/data-objectstack": "3.1.1",
30
+ "@object-ui/fields": "3.1.1",
31
+ "@object-ui/react": "3.1.1",
32
+ "@object-ui/types": "3.1.1",
33
+ "@object-ui/core": "3.1.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "ag-grid-community": "^32.0.0",