@object-ui/plugin-aggrid 0.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.turbo/turbo-build.log +99 -0
  2. package/CHANGELOG.md +16 -0
  3. package/OBJECT_AGGRID_CN.md +483 -0
  4. package/QUICKSTART.md +186 -0
  5. package/README.md +221 -1
  6. package/dist/AddressField-Bntpynvd.js +95 -0
  7. package/dist/AgGridImpl-3Mmf2qrR.js +229 -0
  8. package/dist/AutoNumberField-C1kBJaxh.js +8 -0
  9. package/dist/FileField-BDwbJvor.js +101 -0
  10. package/dist/FormulaField-BXNiyGoh.js +9 -0
  11. package/dist/GeolocationField-Df3yYcM9.js +141 -0
  12. package/dist/GridField-CcjQp4WM.js +29 -0
  13. package/dist/LocationField-BIfN5QIq.js +33 -0
  14. package/dist/MasterDetailField-CAEmxbIT.js +117 -0
  15. package/dist/ObjectAgGridImpl-EjifM4aY.js +28727 -0
  16. package/dist/ObjectField-BpkQpIF-.js +51 -0
  17. package/dist/QRCodeField-VCBewTDG.js +96 -0
  18. package/dist/RichTextField-CyQwSi2C.js +37 -0
  19. package/dist/SignatureField-Cr4tsEbj.js +96 -0
  20. package/dist/SummaryField-CnEJ_GZI.js +9 -0
  21. package/dist/UserField-DJjaVyrV.js +49 -0
  22. package/dist/VectorField-cPYmcKnV.js +25 -0
  23. package/dist/{index-B6NPAFZx.js → index-B87wd1E0.js} +301 -143
  24. package/dist/index.css +1 -1
  25. package/dist/index.js +4 -3
  26. package/dist/index.umd.cjs +225 -2
  27. package/dist/src/AgGridImpl.d.ts +5 -2
  28. package/dist/src/ObjectAgGridImpl.d.ts +6 -0
  29. package/dist/src/VirtualScrolling.d.ts +72 -0
  30. package/dist/src/field-renderers.d.ts +67 -0
  31. package/dist/src/index.d.ts +47 -2
  32. package/dist/src/object-aggrid.types.d.ts +74 -0
  33. package/dist/src/types.d.ts +48 -1
  34. package/package.json +11 -9
  35. package/src/AgGridImpl.tsx +100 -11
  36. package/src/ObjectAgGridImpl.tsx +501 -0
  37. package/src/VirtualScrolling.ts +74 -0
  38. package/src/field-renderers.test.tsx +383 -0
  39. package/src/field-renderers.tsx +224 -0
  40. package/src/index.test.ts +1 -1
  41. package/src/index.tsx +211 -2
  42. package/src/object-aggrid.test.ts +99 -0
  43. package/src/object-aggrid.types.ts +123 -0
  44. package/src/types.ts +57 -1
  45. package/vite.config.ts +13 -0
  46. package/dist/AgGridImpl-DKkq6v1B.js +0 -171
@@ -1,171 +0,0 @@
1
- import { j as u } from "./index-B6NPAFZx.js";
2
- import { useRef as J, useMemo as p, useCallback as i } from "react";
3
- import { AgGridReact as K } from "ag-grid-react";
4
- function Y({
5
- rowData: f = [],
6
- columnDefs: c = [],
7
- gridOptions: v = {},
8
- pagination: x = !1,
9
- paginationPageSize: P = 10,
10
- domLayout: A = "normal",
11
- animateRows: b = !0,
12
- rowSelection: S,
13
- theme: H = "quartz",
14
- height: d = 500,
15
- className: O = "",
16
- editable: m = !1,
17
- editType: j,
18
- singleClickEdit: y = !1,
19
- stopEditingWhenCellsLoseFocus: R = !0,
20
- exportConfig: o,
21
- statusBar: g,
22
- callbacks: t,
23
- columnConfig: a,
24
- enableRangeSelection: z = !1,
25
- enableCharts: E = !1,
26
- contextMenu: l
27
- }) {
28
- const n = J(null), h = p(() => {
29
- if (!g?.enabled) return;
30
- const e = g.aggregations || ["count", "sum", "avg"], s = [];
31
- return e.includes("count") && s.push({ statusPanel: "agAggregationComponent", statusPanelParams: { aggFuncs: ["count"] } }), e.includes("sum") && s.push({ statusPanel: "agAggregationComponent", statusPanelParams: { aggFuncs: ["sum"] } }), e.includes("avg") && s.push({ statusPanel: "agAggregationComponent", statusPanelParams: { aggFuncs: ["avg"] } }), e.includes("min") && s.push({ statusPanel: "agAggregationComponent", statusPanelParams: { aggFuncs: ["min"] } }), e.includes("max") && s.push({ statusPanel: "agAggregationComponent", statusPanelParams: { aggFuncs: ["max"] } }), s;
32
- }, [g]), C = i(() => {
33
- if (!n.current?.api) return;
34
- const e = {
35
- fileName: o?.fileName || "export.csv",
36
- skipColumnHeaders: o?.skipColumnHeaders || !1,
37
- allColumns: o?.allColumns || !1,
38
- onlySelected: o?.onlySelected || !1
39
- };
40
- if (n.current.api.exportDataAsCsv(e), t?.onExport) {
41
- const s = o?.onlySelected ? n.current.api.getSelectedRows() : f;
42
- t.onExport(s || [], "csv");
43
- }
44
- }, [o, t, f]), N = i((e) => {
45
- if (!l?.enabled) return [];
46
- const s = [];
47
- return (l.items || ["copy", "copyWithHeaders", "separator", "export"]).forEach((r) => {
48
- r === "export" ? s.push({
49
- name: "Export CSV",
50
- icon: "<span>📥</span>",
51
- action: () => C()
52
- }) : r === "autoSizeAll" ? s.push({
53
- name: "Auto-size All Columns",
54
- action: () => {
55
- n.current?.api && n.current.api.autoSizeAllColumns();
56
- }
57
- }) : r === "resetColumns" ? s.push({
58
- name: "Reset Columns",
59
- action: () => {
60
- n.current?.api && n.current.api.resetColumnState();
61
- }
62
- }) : s.push(r);
63
- }), l.customItems && (s.length > 0 && s.push("separator"), l.customItems.forEach((r) => {
64
- s.push({
65
- name: r.name,
66
- disabled: r.disabled,
67
- action: () => {
68
- t?.onContextMenuAction && t.onContextMenuAction(r.action, e.node?.data);
69
- }
70
- });
71
- })), s;
72
- }, [l, C, t]), V = i((e) => {
73
- t?.onCellClicked?.(e);
74
- }, [t]), F = i((e) => {
75
- t?.onRowClicked?.(e);
76
- }, [t]), I = i((e) => {
77
- t?.onSelectionChanged?.(e);
78
- }, [t]), w = i((e) => {
79
- t?.onCellValueChanged?.(e);
80
- }, [t]), G = i((e) => {
81
- n.current = e;
82
- }, []), $ = p(() => c ? c.map((e) => {
83
- const s = { ...e };
84
- return m && e.editable !== !1 && (s.editable = !0), a && (a.resizable !== void 0 && e.resizable === void 0 && (s.resizable = a.resizable), a.sortable !== void 0 && e.sortable === void 0 && (s.sortable = a.sortable), a.filterable !== void 0 && e.filter === void 0 && (s.filter = a.filterable)), s;
85
- }) : [], [c, m, a]), q = p(() => ({
86
- ...v,
87
- pagination: x,
88
- paginationPageSize: P,
89
- domLayout: A,
90
- animateRows: b,
91
- rowSelection: S,
92
- editType: j,
93
- singleClickEdit: y,
94
- stopEditingWhenCellsLoseFocus: R,
95
- statusBar: h ? { statusPanels: h } : void 0,
96
- enableRangeSelection: z,
97
- enableCharts: E,
98
- getContextMenuItems: l?.enabled ? N : void 0,
99
- // Default options for better UX
100
- suppressCellFocus: !m,
101
- enableCellTextSelection: !0,
102
- ensureDomOrder: !0,
103
- // Event handlers
104
- onCellClicked: V,
105
- onRowClicked: F,
106
- onSelectionChanged: I,
107
- onCellValueChanged: w,
108
- onGridReady: G
109
- }), [
110
- v,
111
- x,
112
- P,
113
- A,
114
- b,
115
- S,
116
- j,
117
- y,
118
- R,
119
- h,
120
- z,
121
- E,
122
- l,
123
- N,
124
- m,
125
- V,
126
- F,
127
- I,
128
- w,
129
- G
130
- ]), B = p(() => ({
131
- height: typeof d == "number" ? `${d}px` : d,
132
- width: "100%"
133
- }), [d]), D = [
134
- `ag-theme-${H}`,
135
- "rounded-xl",
136
- "border",
137
- "border-border",
138
- "overflow-hidden",
139
- "shadow-lg",
140
- O
141
- ].filter(Boolean).join(" ");
142
- return /* @__PURE__ */ u.jsxs("div", { className: "ag-grid-container", children: [
143
- o?.enabled && /* @__PURE__ */ u.jsx("div", { className: "mb-2 flex gap-2", children: /* @__PURE__ */ u.jsx(
144
- "button",
145
- {
146
- onClick: C,
147
- className: "px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",
148
- children: "Export CSV"
149
- }
150
- ) }),
151
- /* @__PURE__ */ u.jsx(
152
- "div",
153
- {
154
- className: D,
155
- style: B,
156
- children: /* @__PURE__ */ u.jsx(
157
- K,
158
- {
159
- ref: n,
160
- rowData: f,
161
- columnDefs: $,
162
- gridOptions: q
163
- }
164
- )
165
- }
166
- )
167
- ] });
168
- }
169
- export {
170
- Y as default
171
- };