@object-ui/plugin-aggrid 3.0.3 → 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 (28) hide show
  1. package/.turbo/turbo-build.log +25 -25
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{AddressField-CUHm7scl.js → AddressField-D2Yli537.js} +1 -1
  4. package/dist/{AgGridImpl-DVyHqLJi.js → AgGridImpl-GwI1UT7v.js} +1 -1
  5. package/dist/{AutoNumberField-twP63aM8.js → AutoNumberField-Y3hL1ZoW.js} +1 -1
  6. package/dist/FileField-BHv22jrG.js +144 -0
  7. package/dist/{FormulaField-CsRwvjVZ.js → FormulaField-B-JSCA7E.js} +1 -1
  8. package/dist/{GeolocationField-DQ_J9TGl.js → GeolocationField-DxnVAm8n.js} +2 -2
  9. package/dist/GridField-7A4mvr7x.js +29 -0
  10. package/dist/{LocationField-C4zcjds3.js → LocationField-o8Z6x8qV.js} +1 -1
  11. package/dist/{MasterDetailField-DybIeqDQ.js → MasterDetailField-CnzHQ-jU.js} +2 -2
  12. package/dist/{ObjectAgGridImpl-CotBxBL9.js → ObjectAgGridImpl-CujXHJ0J.js} +4813 -4707
  13. package/dist/{ObjectField-CVXoKqAF.js → ObjectField-BAVt0fMs.js} +1 -1
  14. package/dist/{QRCodeField-lmARTFQy.js → QRCodeField-VAlAXUkP.js} +2 -2
  15. package/dist/{RichTextField-5ce8qKzb.js → RichTextField-DylJITFH.js} +1 -1
  16. package/dist/{SignatureField-VES1Umvd.js → SignatureField-BrGCC7_j.js} +2 -2
  17. package/dist/{SummaryField-CQsFucuH.js → SummaryField-BPPAEVC6.js} +1 -1
  18. package/dist/{UserField-Dxq9ZQ9l.js → UserField-CWZQprry.js} +2 -2
  19. package/dist/{VectorField-BJoHEqgv.js → VectorField-CIvFEC07.js} +1 -1
  20. package/dist/{index-DSI77JcG.js → index-BfSjmySi.js} +1 -1
  21. package/dist/index.css +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.umd.cjs +86 -81
  24. package/package.json +10 -10
  25. package/src/AgGridImpl.tsx +4 -4
  26. package/src/ObjectAgGridImpl.tsx +11 -3
  27. package/dist/FileField-Cxql0zFQ.js +0 -101
  28. package/dist/GridField-BrF4x9mD.js +0 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-aggrid",
3
- "version": "3.0.3",
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.0.3",
29
- "@object-ui/core": "3.0.3",
30
- "@object-ui/data-objectstack": "3.0.3",
31
- "@object-ui/react": "3.0.3",
32
- "@object-ui/fields": "3.0.3",
33
- "@object-ui/types": "3.0.3"
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",
@@ -39,11 +39,11 @@
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/react": "19.2.13",
42
+ "@types/react": "19.2.14",
43
43
  "@types/react-dom": "19.2.3",
44
44
  "@vitejs/plugin-react": "^5.1.4",
45
- "ag-grid-community": "^32.3.9",
46
- "ag-grid-react": "^32.3.9",
45
+ "ag-grid-react": "^35.1.0",
46
+ "ag-grid-community": "^35.1.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vite": "^7.3.1",
49
49
  "vite-plugin-dts": "^4.5.4"
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React, { useMemo, useRef, useCallback } from 'react';
10
10
  import { AgGridReact } from 'ag-grid-react';
11
- import type { ColDef, GridOptions, GridReadyEvent, CellClickedEvent, RowClickedEvent, SelectionChangedEvent, CellValueChangedEvent, StatusPanelDef, GetContextMenuItemsParams, MenuItemDef } from 'ag-grid-community';
11
+ import type { ColDef, GridOptions, GridReadyEvent, CellClickedEvent, RowClickedEvent, SelectionChangedEvent, CellValueChangedEvent, StatusPanelDef, GetContextMenuItemsParams, MenuItemDef, DefaultMenuItem } from 'ag-grid-community';
12
12
  import type { AgGridCallbacks, ExportConfig, StatusBarConfig, ColumnConfig, ContextMenuConfig, TreeDataConfig, RowGroupingConfig, ExcelExportConfig } from './types';
13
13
 
14
14
  export interface AgGridImplProps {
@@ -145,10 +145,10 @@ export default function AgGridImpl({
145
145
  }, [excelExport, exportConfig, callbacks, rowData]);
146
146
 
147
147
  // Context Menu handler
148
- const getContextMenuItems = useCallback((params: GetContextMenuItemsParams): (string | MenuItemDef)[] => {
148
+ const getContextMenuItems = useCallback((params: GetContextMenuItemsParams): (DefaultMenuItem | MenuItemDef)[] => {
149
149
  if (!contextMenu?.enabled) return [];
150
150
 
151
- const items: (string | MenuItemDef)[] = [];
151
+ const items: (DefaultMenuItem | MenuItemDef)[] = [];
152
152
  const defaultItems = contextMenu.items || ['copy', 'copyWithHeaders', 'separator', 'export'];
153
153
 
154
154
  defaultItems.forEach(item => {
@@ -183,7 +183,7 @@ export default function AgGridImpl({
183
183
  },
184
184
  });
185
185
  } else {
186
- items.push(item);
186
+ items.push(item as DefaultMenuItem);
187
187
  }
188
188
  });
189
189
 
@@ -18,11 +18,13 @@ import type {
18
18
  StatusPanelDef,
19
19
  GetContextMenuItemsParams,
20
20
  MenuItemDef,
21
+ DefaultMenuItem,
21
22
  } from 'ag-grid-community';
22
23
  import type { FieldMetadata, ObjectSchemaMetadata } from '@object-ui/types';
23
24
  import type { ObjectAgGridImplProps } from './object-aggrid.types';
24
25
  import { FIELD_TYPE_TO_FILTER_TYPE } from './object-aggrid.types';
25
26
  import { createFieldCellRenderer, createFieldCellEditor } from './field-renderers';
27
+ import { buildExpandFields } from '@object-ui/core';
26
28
 
27
29
  /**
28
30
  * ObjectAgGridImpl - Metadata-driven AG Grid implementation
@@ -111,6 +113,12 @@ export default function ObjectAgGridImpl({
111
113
  queryParams.$orderby = sort;
112
114
  }
113
115
 
116
+ // Auto-inject $expand for lookup/master_detail fields
117
+ const expand = buildExpandFields(objectSchema?.fields);
118
+ if (expand.length > 0) {
119
+ queryParams.$expand = expand;
120
+ }
121
+
114
122
  const result = await dataSource.find(objectName, queryParams);
115
123
  setRowData(result.data || []);
116
124
  callbacks?.onDataLoaded?.(result.data || []);
@@ -215,10 +223,10 @@ export default function ObjectAgGridImpl({
215
223
  }, [exportConfig, callbacks, rowData, objectName]);
216
224
 
217
225
  // Context Menu handler
218
- const getContextMenuItems = useCallback((params: GetContextMenuItemsParams): (string | MenuItemDef)[] => {
226
+ const getContextMenuItems = useCallback((params: GetContextMenuItemsParams): (DefaultMenuItem | MenuItemDef)[] => {
219
227
  if (!contextMenu?.enabled) return [];
220
228
 
221
- const items: (string | MenuItemDef)[] = [];
229
+ const items: (DefaultMenuItem | MenuItemDef)[] = [];
222
230
  const defaultItems = contextMenu.items || ['copy', 'copyWithHeaders', 'separator', 'export'];
223
231
 
224
232
  defaultItems.forEach(item => {
@@ -247,7 +255,7 @@ export default function ObjectAgGridImpl({
247
255
  },
248
256
  });
249
257
  } else {
250
- items.push(item);
258
+ items.push(item as DefaultMenuItem);
251
259
  }
252
260
  });
253
261
 
@@ -1,101 +0,0 @@
1
- import { j as e } from "./index-DSI77JcG.js";
2
- import { useRef as y } from "react";
3
- import { Button as p } from "@object-ui/components";
4
- import { c as N, X as g, U as F } from "./ObjectAgGridImpl-CotBxBL9.js";
5
- const z = [
6
- [
7
- "path",
8
- {
9
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
10
- key: "1oefj6"
11
- }
12
- ],
13
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
14
- ], b = N("file", z);
15
- function R({ value: t, onChange: r, field: x, readonly: h, ...o }) {
16
- const d = y(null), c = x || o.schema, m = c?.multiple || !1, f = c?.accept ? c.accept.join(",") : void 0;
17
- if (h) {
18
- if (!t) return /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: "-" });
19
- const a = Array.isArray(t) ? t : [t];
20
- return /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: a.map((s, l) => /* @__PURE__ */ e.jsx("span", { className: "text-sm truncate max-w-xs", children: s.name || s.original_name || "File" }, l)) });
21
- }
22
- const n = t ? Array.isArray(t) ? t : [t] : [], j = (a) => {
23
- const s = Array.from(a.target.files || []);
24
- if (s.length === 0) return;
25
- const l = s.map((i) => ({
26
- name: i.name,
27
- original_name: i.name,
28
- size: i.size,
29
- mime_type: i.type,
30
- // In a real implementation, this would upload the file and return a URL
31
- url: URL.createObjectURL(i)
32
- }));
33
- r(m ? [...n, ...l] : l[0]);
34
- }, u = (a) => {
35
- if (m) {
36
- const s = n.filter((l, i) => i !== a);
37
- r(s.length > 0 ? s : null);
38
- } else
39
- r(null);
40
- };
41
- return /* @__PURE__ */ e.jsxs("div", { className: o.className, children: [
42
- /* @__PURE__ */ e.jsx(
43
- "input",
44
- {
45
- ref: d,
46
- type: "file",
47
- multiple: m,
48
- accept: f,
49
- onChange: j,
50
- className: "hidden"
51
- }
52
- ),
53
- /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
54
- n.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "space-y-1", children: n.map((a, s) => /* @__PURE__ */ e.jsxs(
55
- "div",
56
- {
57
- className: "flex items-center justify-between gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",
58
- children: [
59
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
60
- /* @__PURE__ */ e.jsx(b, { className: "size-4 text-gray-500 flex-shrink-0" }),
61
- /* @__PURE__ */ e.jsx("span", { className: "text-sm truncate", children: a.name || a.original_name || "File" }),
62
- a.size && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-gray-500", children: [
63
- "(",
64
- (a.size / 1024).toFixed(1),
65
- " KB)"
66
- ] })
67
- ] }),
68
- /* @__PURE__ */ e.jsx(
69
- p,
70
- {
71
- type: "button",
72
- variant: "ghost",
73
- size: "sm",
74
- onClick: () => u(s),
75
- className: "h-6 w-6 p-0",
76
- children: /* @__PURE__ */ e.jsx(g, { className: "size-3" })
77
- }
78
- )
79
- ]
80
- },
81
- s
82
- )) }),
83
- /* @__PURE__ */ e.jsxs(
84
- p,
85
- {
86
- type: "button",
87
- variant: "outline",
88
- onClick: () => d.current?.click(),
89
- className: "w-full",
90
- children: [
91
- /* @__PURE__ */ e.jsx(F, { className: "size-4 mr-2" }),
92
- n.length > 0 ? "Add More Files" : "Upload File"
93
- ]
94
- }
95
- )
96
- ] })
97
- ] });
98
- }
99
- export {
100
- R as FileField
101
- };
@@ -1,29 +0,0 @@
1
- import { j as e } from "./index-DSI77JcG.js";
2
- import { cn as l } from "@object-ui/components";
3
- function g({ value: r, field: n, readonly: m, ...a }) {
4
- const d = (n || a.schema)?.columns || [];
5
- return !r || !Array.isArray(r) ? /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500", children: "-" }) : m ? /* @__PURE__ */ e.jsx("div", { className: l("text-sm", a.className), children: /* @__PURE__ */ e.jsxs("span", { className: "text-gray-700", children: [
6
- r.length,
7
- " rows"
8
- ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: l("border border-gray-200 rounded-md overflow-hidden", a.className), children: [
9
- /* @__PURE__ */ e.jsx("div", { className: "overflow-auto max-h-60", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
10
- /* @__PURE__ */ e.jsx("thead", { className: "bg-gray-50 border-b border-gray-200", children: /* @__PURE__ */ e.jsx("tr", { children: d.map((s, t) => /* @__PURE__ */ e.jsx(
11
- "th",
12
- {
13
- className: "px-3 py-2 text-left text-xs font-medium text-gray-700",
14
- children: s.label || s.name
15
- },
16
- t
17
- )) }) }),
18
- /* @__PURE__ */ e.jsx("tbody", { className: "divide-y divide-gray-200", children: r.slice(0, 5).map((s, t) => /* @__PURE__ */ e.jsx("tr", { className: "hover:bg-gray-50", children: d.map((i, c) => /* @__PURE__ */ e.jsx("td", { className: "px-3 py-2 text-gray-900", children: s[i.name] != null ? String(s[i.name]) : "-" }, c)) }, t)) })
19
- ] }) }),
20
- r.length > 5 && /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200", children: [
21
- "Showing 5 of ",
22
- r.length,
23
- " rows"
24
- ] })
25
- ] });
26
- }
27
- export {
28
- g as GridField
29
- };