@object-ui/plugin-aggrid 3.3.0 → 3.3.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.
- package/CHANGELOG.md +12 -0
- package/README.md +20 -0
- package/dist/AddressField-CP-8JJvR.js +98 -0
- package/dist/{AgGridImpl-DBqxIsko.js → AgGridImpl-DJWnS8p3.js} +1 -1
- package/dist/AutoNumberField-DCL2eUJj.js +14 -0
- package/dist/{AvatarField-C5b9biGa.js → AvatarField-CpFxJRdO.js} +4 -3
- package/dist/{BooleanField-DRzAZhSq.js → BooleanField-Chphr8cB.js} +2 -1
- package/dist/CodeField-BWngVIw1.js +23 -0
- package/dist/ColorField-GygyYArR.js +38 -0
- package/dist/CurrencyField-O8Pn59RO.js +49 -0
- package/dist/DateField-u6U8wmvI.js +22 -0
- package/dist/DateTimeField-D1z1Ovvy.js +30 -0
- package/dist/EmailField-IOcDmGjJ.js +26 -0
- package/dist/FileField-D3mZIrJ1.js +158 -0
- package/dist/FormulaField-MuyWzQx0.js +17 -0
- package/dist/GeolocationField-BfhC7QLw.js +161 -0
- package/dist/GridField-gN34gk4b.js +49 -0
- package/dist/ImageField-BZfSFwmJ.js +75 -0
- package/dist/LocationField-B-zwfw3h.js +36 -0
- package/dist/{LookupField-DoOmbbZF.js → LookupField-Cms1Cu_l.js} +347 -349
- package/dist/{MasterDetailField-BnSPGAtS.js → MasterDetailField-DGUmvg2f.js} +5 -4
- package/dist/NumberField-BV5sKwZ7.js +27 -0
- package/dist/{ObjectAgGridImpl-DrI0aa8t.js → ObjectAgGridImpl-yiHlXYgp.js} +5804 -5804
- package/dist/ObjectField-DJ5s3ciA.js +50 -0
- package/dist/{PasswordField-k5JeKk9f.js → PasswordField-BJboeBJY.js} +3 -2
- package/dist/PercentField-DO3be_bL.js +61 -0
- package/dist/PhoneField-CT6XcO6O.js +26 -0
- package/dist/{QRCodeField-BIrSW1Zr.js → QRCodeField-COLyc5iQ.js} +31 -30
- package/dist/{RatingField-5iMhn2GL.js → RatingField-B2momIna.js} +3 -2
- package/dist/RichTextField-C7qzDPJy.js +33 -0
- package/dist/SelectField-oo6vnNhQ.js +36 -0
- package/dist/{SignatureField-BAMvNrE6.js → SignatureField-DUgoK09r.js} +3 -2
- package/dist/{SliderField-C9IhmjbF.js → SliderField-DrggtBSX.js} +2 -1
- package/dist/SummaryField-DuMsFoY5.js +22 -0
- package/dist/TextAreaField-CLzzmPce.js +37 -0
- package/dist/TextField-CZE7SzK4.js +30 -0
- package/dist/TimeField-Bha4cayv.js +22 -0
- package/dist/UrlField-Dff4WLlN.js +31 -0
- package/dist/UserField-eT5njHwQ.js +77 -0
- package/dist/VectorField-BHe8lDOH.js +34 -0
- package/dist/{image-DlUdeTgT.js → image-DmzU2ETO.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +77 -77
- package/dist/{jsx-runtime-CGDkM_Jn.js → jsx-runtime-CXSCp6pT.js} +30 -39
- package/dist/{plus-BwEV_Q5_.js → plus-bvZ2f9T_.js} +1 -1
- package/dist/rolldown-runtime-CkxV0rQ3.js +14 -0
- package/dist/{upload-DPiohvXv.js → upload-BdzwEMeV.js} +1 -1
- package/dist/{useFieldTranslation-C69OtouR.js → useFieldTranslation-CfXaJRC4.js} +2 -2
- package/dist/{x-BFq2GeQ5.js → x-98xe-fYG.js} +1 -1
- package/package.json +34 -11
- package/.turbo/turbo-build.log +0 -71
- package/OBJECT_AGGRID_CN.md +0 -483
- package/QUICKSTART.md +0 -186
- package/dist/AddressField-DKqaE9pD.js +0 -93
- package/dist/AutoNumberField-0RU2dNKe.js +0 -13
- package/dist/CodeField-RWhnDMyL.js +0 -22
- package/dist/ColorField-B-YAFXdz.js +0 -37
- package/dist/CurrencyField-Bu80a-sI.js +0 -51
- package/dist/DateField-CV-NpLbM.js +0 -21
- package/dist/DateTimeField--YTsgTjw.js +0 -32
- package/dist/EmailField-B-3fWJsH.js +0 -28
- package/dist/FileField-BcGMvBnI.js +0 -160
- package/dist/FormulaField-MQXJZOep.js +0 -13
- package/dist/GeolocationField-D3BrmwqV.js +0 -156
- package/dist/GridField-DHsGo9l2.js +0 -51
- package/dist/ImageField-BBqwJEkk.js +0 -77
- package/dist/LocationField-DSvhU9Dz.js +0 -35
- package/dist/LookupField-KfYQlgUd.js +0 -2
- package/dist/NumberField-Kz4_o5DE.js +0 -26
- package/dist/ObjectField-C1qkl6s4.js +0 -52
- package/dist/PercentField-Dmipqv0I.js +0 -63
- package/dist/PhoneField-Dn4h6V9H.js +0 -28
- package/dist/RichTextField-CN5BRd_7.js +0 -32
- package/dist/SelectField-Bjk_S2zT.js +0 -31
- package/dist/SelectField-CcWvzp9g.js +0 -2
- package/dist/SummaryField-R9RENAZv.js +0 -18
- package/dist/TextAreaField-BY63Nr6-.js +0 -36
- package/dist/TextField-SIw8aMzf.js +0 -29
- package/dist/TimeField-xxziHPjE.js +0 -21
- package/dist/UrlField-Ihk3_ff5.js +0 -33
- package/dist/UserField-BHl6mmIH.js +0 -79
- package/dist/VectorField-Ci167cxr.js +0 -35
- package/src/AgGridImpl.tsx +0 -405
- package/src/ObjectAgGridImpl.tsx +0 -509
- package/src/VirtualScrolling.ts +0 -74
- package/src/ag-grid.d.ts +0 -10
- package/src/field-renderers.test.tsx +0 -383
- package/src/field-renderers.tsx +0 -224
- package/src/index.test.ts +0 -139
- package/src/index.tsx +0 -514
- package/src/object-aggrid.test.ts +0 -99
- package/src/object-aggrid.types.ts +0 -123
- package/src/types.ts +0 -184
- package/tsconfig.json +0 -17
- package/vite.config.ts +0 -64
- /package/dist/{createLucideIcon-BjfZYZey.js → createLucideIcon-C_5JZ35b.js} +0 -0
package/src/AgGridImpl.tsx
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ObjectUI
|
|
3
|
-
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React, { useMemo, useRef, useCallback } from 'react';
|
|
10
|
-
import { AgGridReact } from 'ag-grid-react';
|
|
11
|
-
import type { ColDef, GridOptions, GridReadyEvent, CellClickedEvent, RowClickedEvent, SelectionChangedEvent, CellValueChangedEvent, StatusPanelDef, GetContextMenuItemsParams, MenuItemDef, DefaultMenuItem } from 'ag-grid-community';
|
|
12
|
-
import type { AgGridCallbacks, ExportConfig, StatusBarConfig, ColumnConfig, ContextMenuConfig, TreeDataConfig, RowGroupingConfig, ExcelExportConfig } from './types';
|
|
13
|
-
|
|
14
|
-
export interface AgGridImplProps {
|
|
15
|
-
rowData?: any[];
|
|
16
|
-
columnDefs?: ColDef[];
|
|
17
|
-
gridOptions?: GridOptions;
|
|
18
|
-
pagination?: boolean;
|
|
19
|
-
paginationPageSize?: number;
|
|
20
|
-
domLayout?: 'normal' | 'autoHeight' | 'print';
|
|
21
|
-
animateRows?: boolean;
|
|
22
|
-
rowSelection?: 'single' | 'multiple';
|
|
23
|
-
theme?: 'alpine' | 'balham' | 'material' | 'quartz';
|
|
24
|
-
height?: number | string;
|
|
25
|
-
className?: string;
|
|
26
|
-
editable?: boolean;
|
|
27
|
-
editType?: 'fullRow';
|
|
28
|
-
singleClickEdit?: boolean;
|
|
29
|
-
stopEditingWhenCellsLoseFocus?: boolean;
|
|
30
|
-
exportConfig?: ExportConfig;
|
|
31
|
-
statusBar?: StatusBarConfig;
|
|
32
|
-
callbacks?: AgGridCallbacks;
|
|
33
|
-
columnConfig?: ColumnConfig;
|
|
34
|
-
enableRangeSelection?: boolean;
|
|
35
|
-
enableCharts?: boolean;
|
|
36
|
-
contextMenu?: ContextMenuConfig;
|
|
37
|
-
treeData?: TreeDataConfig;
|
|
38
|
-
rowGrouping?: RowGroupingConfig;
|
|
39
|
-
excelExport?: ExcelExportConfig;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* AgGridImpl - The heavy implementation that imports AG Grid
|
|
44
|
-
* This component is lazy-loaded to avoid including AG Grid in the initial bundle
|
|
45
|
-
*/
|
|
46
|
-
export default function AgGridImpl({
|
|
47
|
-
rowData = [],
|
|
48
|
-
columnDefs = [],
|
|
49
|
-
gridOptions = {},
|
|
50
|
-
pagination = false,
|
|
51
|
-
paginationPageSize = 10,
|
|
52
|
-
domLayout = 'normal',
|
|
53
|
-
animateRows = true,
|
|
54
|
-
rowSelection,
|
|
55
|
-
theme = 'quartz',
|
|
56
|
-
height = 500,
|
|
57
|
-
className = '',
|
|
58
|
-
editable = false,
|
|
59
|
-
editType,
|
|
60
|
-
singleClickEdit = false,
|
|
61
|
-
stopEditingWhenCellsLoseFocus = true,
|
|
62
|
-
exportConfig,
|
|
63
|
-
statusBar,
|
|
64
|
-
callbacks,
|
|
65
|
-
columnConfig,
|
|
66
|
-
enableRangeSelection = false,
|
|
67
|
-
enableCharts = false,
|
|
68
|
-
contextMenu,
|
|
69
|
-
treeData,
|
|
70
|
-
rowGrouping,
|
|
71
|
-
excelExport,
|
|
72
|
-
}: AgGridImplProps) {
|
|
73
|
-
const gridRef = useRef<any>(null);
|
|
74
|
-
|
|
75
|
-
// Build status bar panels
|
|
76
|
-
const statusPanels = useMemo((): StatusPanelDef[] | undefined => {
|
|
77
|
-
if (!statusBar?.enabled) return undefined;
|
|
78
|
-
|
|
79
|
-
const aggregations = statusBar.aggregations || ['count', 'sum', 'avg'];
|
|
80
|
-
const panels: StatusPanelDef[] = [];
|
|
81
|
-
|
|
82
|
-
if (aggregations.includes('count')) {
|
|
83
|
-
panels.push({ statusPanel: 'agAggregationComponent', statusPanelParams: { aggFuncs: ['count'] } });
|
|
84
|
-
}
|
|
85
|
-
if (aggregations.includes('sum')) {
|
|
86
|
-
panels.push({ statusPanel: 'agAggregationComponent', statusPanelParams: { aggFuncs: ['sum'] } });
|
|
87
|
-
}
|
|
88
|
-
if (aggregations.includes('avg')) {
|
|
89
|
-
panels.push({ statusPanel: 'agAggregationComponent', statusPanelParams: { aggFuncs: ['avg'] } });
|
|
90
|
-
}
|
|
91
|
-
if (aggregations.includes('min')) {
|
|
92
|
-
panels.push({ statusPanel: 'agAggregationComponent', statusPanelParams: { aggFuncs: ['min'] } });
|
|
93
|
-
}
|
|
94
|
-
if (aggregations.includes('max')) {
|
|
95
|
-
panels.push({ statusPanel: 'agAggregationComponent', statusPanelParams: { aggFuncs: ['max'] } });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return panels;
|
|
99
|
-
}, [statusBar]);
|
|
100
|
-
|
|
101
|
-
// CSV Export handler
|
|
102
|
-
const handleExportCSV = useCallback(() => {
|
|
103
|
-
if (!gridRef.current?.api) return;
|
|
104
|
-
|
|
105
|
-
const params = {
|
|
106
|
-
fileName: exportConfig?.fileName || 'export.csv',
|
|
107
|
-
skipColumnHeaders: exportConfig?.skipColumnHeaders || false,
|
|
108
|
-
allColumns: exportConfig?.allColumns || false,
|
|
109
|
-
onlySelected: exportConfig?.onlySelected || false,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
gridRef.current.api.exportDataAsCsv(params);
|
|
113
|
-
|
|
114
|
-
if (callbacks?.onExport) {
|
|
115
|
-
const data = exportConfig?.onlySelected
|
|
116
|
-
? gridRef.current.api.getSelectedRows()
|
|
117
|
-
: rowData;
|
|
118
|
-
callbacks.onExport(data || [], 'csv');
|
|
119
|
-
}
|
|
120
|
-
}, [exportConfig, callbacks, rowData]);
|
|
121
|
-
|
|
122
|
-
// Excel-compatible CSV Export handler
|
|
123
|
-
// Exports CSV format which can be opened directly in Excel
|
|
124
|
-
const handleExportExcel = useCallback(() => {
|
|
125
|
-
if (!gridRef.current?.api) return;
|
|
126
|
-
|
|
127
|
-
const fileName = excelExport?.fileName || exportConfig?.fileName || 'export.csv';
|
|
128
|
-
const includeHeaders = excelExport?.includeHeaders !== false;
|
|
129
|
-
|
|
130
|
-
const params = {
|
|
131
|
-
fileName,
|
|
132
|
-
skipColumnHeaders: !includeHeaders,
|
|
133
|
-
allColumns: true,
|
|
134
|
-
onlySelected: excelExport?.onlySelected || false,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
gridRef.current.api.exportDataAsCsv(params);
|
|
138
|
-
|
|
139
|
-
if (callbacks?.onExport) {
|
|
140
|
-
const data = excelExport?.onlySelected
|
|
141
|
-
? gridRef.current.api.getSelectedRows()
|
|
142
|
-
: rowData;
|
|
143
|
-
callbacks.onExport(data || [], 'excel');
|
|
144
|
-
}
|
|
145
|
-
}, [excelExport, exportConfig, callbacks, rowData]);
|
|
146
|
-
|
|
147
|
-
// Context Menu handler
|
|
148
|
-
const getContextMenuItems = useCallback((params: GetContextMenuItemsParams): (DefaultMenuItem | MenuItemDef)[] => {
|
|
149
|
-
if (!contextMenu?.enabled) return [];
|
|
150
|
-
|
|
151
|
-
const items: (DefaultMenuItem | MenuItemDef)[] = [];
|
|
152
|
-
const defaultItems = contextMenu.items || ['copy', 'copyWithHeaders', 'separator', 'export'];
|
|
153
|
-
|
|
154
|
-
defaultItems.forEach(item => {
|
|
155
|
-
if (item === 'export') {
|
|
156
|
-
items.push({
|
|
157
|
-
name: 'Export CSV',
|
|
158
|
-
icon: '<span>📥</span>',
|
|
159
|
-
action: () => handleExportCSV(),
|
|
160
|
-
});
|
|
161
|
-
} else if (item === 'export-excel') {
|
|
162
|
-
items.push({
|
|
163
|
-
name: 'Export Excel (CSV)',
|
|
164
|
-
icon: '<span>📊</span>',
|
|
165
|
-
action: () => handleExportExcel(),
|
|
166
|
-
});
|
|
167
|
-
} else if (item === 'autoSizeAll') {
|
|
168
|
-
items.push({
|
|
169
|
-
name: 'Auto-size All Columns',
|
|
170
|
-
action: () => {
|
|
171
|
-
if (gridRef.current?.api) {
|
|
172
|
-
gridRef.current.api.autoSizeAllColumns();
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
} else if (item === 'resetColumns') {
|
|
177
|
-
items.push({
|
|
178
|
-
name: 'Reset Columns',
|
|
179
|
-
action: () => {
|
|
180
|
-
if (gridRef.current?.api) {
|
|
181
|
-
gridRef.current.api.resetColumnState();
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
} else {
|
|
186
|
-
items.push(item as DefaultMenuItem);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// Add custom items
|
|
191
|
-
if (contextMenu.customItems) {
|
|
192
|
-
if (items.length > 0) {
|
|
193
|
-
items.push('separator');
|
|
194
|
-
}
|
|
195
|
-
contextMenu.customItems.forEach(customItem => {
|
|
196
|
-
items.push({
|
|
197
|
-
name: customItem.name,
|
|
198
|
-
disabled: customItem.disabled,
|
|
199
|
-
action: () => {
|
|
200
|
-
// Trigger dedicated context menu action callback
|
|
201
|
-
if (callbacks?.onContextMenuAction) {
|
|
202
|
-
callbacks.onContextMenuAction(customItem.action, params.node?.data);
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return items;
|
|
210
|
-
}, [contextMenu, handleExportCSV, handleExportExcel, callbacks]);
|
|
211
|
-
|
|
212
|
-
// Event handlers
|
|
213
|
-
const handleCellClicked = useCallback((event: CellClickedEvent) => {
|
|
214
|
-
callbacks?.onCellClicked?.(event);
|
|
215
|
-
}, [callbacks]);
|
|
216
|
-
|
|
217
|
-
const handleRowClicked = useCallback((event: RowClickedEvent) => {
|
|
218
|
-
callbacks?.onRowClicked?.(event);
|
|
219
|
-
}, [callbacks]);
|
|
220
|
-
|
|
221
|
-
const handleSelectionChanged = useCallback((event: SelectionChangedEvent) => {
|
|
222
|
-
callbacks?.onSelectionChanged?.(event);
|
|
223
|
-
}, [callbacks]);
|
|
224
|
-
|
|
225
|
-
const handleCellValueChanged = useCallback((event: CellValueChangedEvent) => {
|
|
226
|
-
callbacks?.onCellValueChanged?.(event);
|
|
227
|
-
}, [callbacks]);
|
|
228
|
-
|
|
229
|
-
const onGridReady = useCallback((params: GridReadyEvent) => {
|
|
230
|
-
gridRef.current = params;
|
|
231
|
-
}, []);
|
|
232
|
-
|
|
233
|
-
// Make columns editable if global editable flag is set
|
|
234
|
-
const processedColumnDefs = useMemo(() => {
|
|
235
|
-
if (!columnDefs) return [];
|
|
236
|
-
|
|
237
|
-
return columnDefs.map(col => {
|
|
238
|
-
const processed: ColDef = { ...col };
|
|
239
|
-
|
|
240
|
-
// Apply editable setting
|
|
241
|
-
if (editable && col.editable !== false) {
|
|
242
|
-
processed.editable = true;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Apply column config defaults
|
|
246
|
-
if (columnConfig) {
|
|
247
|
-
if (columnConfig.resizable !== undefined && col.resizable === undefined) {
|
|
248
|
-
processed.resizable = columnConfig.resizable;
|
|
249
|
-
}
|
|
250
|
-
if (columnConfig.sortable !== undefined && col.sortable === undefined) {
|
|
251
|
-
processed.sortable = columnConfig.sortable;
|
|
252
|
-
}
|
|
253
|
-
if (columnConfig.filterable !== undefined && col.filter === undefined) {
|
|
254
|
-
processed.filter = columnConfig.filterable;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Apply grouping
|
|
259
|
-
if (rowGrouping?.enabled && rowGrouping.groupByFields?.includes(col.field || '')) {
|
|
260
|
-
processed.rowGroup = true;
|
|
261
|
-
processed.hide = true;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Apply aggregation
|
|
265
|
-
if (rowGrouping?.aggregations && col.field && rowGrouping.aggregations[col.field]) {
|
|
266
|
-
processed.aggFunc = rowGrouping.aggregations[col.field];
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return processed;
|
|
270
|
-
});
|
|
271
|
-
}, [columnDefs, editable, columnConfig, rowGrouping]);
|
|
272
|
-
|
|
273
|
-
// Merge grid options with props
|
|
274
|
-
const mergedGridOptions = useMemo(() => ({
|
|
275
|
-
...gridOptions,
|
|
276
|
-
pagination,
|
|
277
|
-
paginationPageSize,
|
|
278
|
-
domLayout,
|
|
279
|
-
animateRows,
|
|
280
|
-
rowSelection,
|
|
281
|
-
editType,
|
|
282
|
-
singleClickEdit,
|
|
283
|
-
stopEditingWhenCellsLoseFocus,
|
|
284
|
-
statusBar: statusPanels ? { statusPanels } : undefined,
|
|
285
|
-
enableRangeSelection,
|
|
286
|
-
enableCharts,
|
|
287
|
-
getContextMenuItems: contextMenu?.enabled ? getContextMenuItems : undefined,
|
|
288
|
-
// Tree data support
|
|
289
|
-
...(treeData?.enabled ? {
|
|
290
|
-
treeData: true,
|
|
291
|
-
getDataPath: treeData.pathField
|
|
292
|
-
? (data: any) => data[treeData.pathField as string]
|
|
293
|
-
: undefined,
|
|
294
|
-
autoGroupColumnDef: {
|
|
295
|
-
headerName: 'Hierarchy',
|
|
296
|
-
minWidth: 250,
|
|
297
|
-
cellRendererParams: {
|
|
298
|
-
suppressCount: false,
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
groupDefaultExpanded: treeData.expandAll ? -1 : (treeData.expandDepth ?? 0),
|
|
302
|
-
} : {}),
|
|
303
|
-
// Row grouping
|
|
304
|
-
...(rowGrouping?.enabled ? {
|
|
305
|
-
groupDefaultExpanded: rowGrouping.groupByFields?.length ? 1 : 0,
|
|
306
|
-
autoGroupColumnDef: {
|
|
307
|
-
minWidth: 200,
|
|
308
|
-
cellRendererParams: {
|
|
309
|
-
suppressCount: !rowGrouping.showRowCount,
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
} : {}),
|
|
313
|
-
// Default options for better UX
|
|
314
|
-
suppressCellFocus: !editable,
|
|
315
|
-
enableCellTextSelection: true,
|
|
316
|
-
ensureDomOrder: true,
|
|
317
|
-
// Virtual scrolling optimizations for large datasets
|
|
318
|
-
rowBuffer: gridOptions.rowBuffer ?? 10,
|
|
319
|
-
debounceVerticalScrollbar: gridOptions.debounceVerticalScrollbar ?? (rowData.length > 1000),
|
|
320
|
-
// Event handlers
|
|
321
|
-
onCellClicked: handleCellClicked,
|
|
322
|
-
onRowClicked: handleRowClicked,
|
|
323
|
-
onSelectionChanged: handleSelectionChanged,
|
|
324
|
-
onCellValueChanged: handleCellValueChanged,
|
|
325
|
-
onGridReady,
|
|
326
|
-
}), [
|
|
327
|
-
gridOptions,
|
|
328
|
-
pagination,
|
|
329
|
-
paginationPageSize,
|
|
330
|
-
domLayout,
|
|
331
|
-
animateRows,
|
|
332
|
-
rowSelection,
|
|
333
|
-
editType,
|
|
334
|
-
singleClickEdit,
|
|
335
|
-
stopEditingWhenCellsLoseFocus,
|
|
336
|
-
statusPanels,
|
|
337
|
-
enableRangeSelection,
|
|
338
|
-
enableCharts,
|
|
339
|
-
contextMenu,
|
|
340
|
-
getContextMenuItems,
|
|
341
|
-
treeData,
|
|
342
|
-
rowGrouping,
|
|
343
|
-
editable,
|
|
344
|
-
rowData.length,
|
|
345
|
-
handleCellClicked,
|
|
346
|
-
handleRowClicked,
|
|
347
|
-
handleSelectionChanged,
|
|
348
|
-
handleCellValueChanged,
|
|
349
|
-
onGridReady,
|
|
350
|
-
]);
|
|
351
|
-
|
|
352
|
-
// Compute container style
|
|
353
|
-
const containerStyle = useMemo(() => ({
|
|
354
|
-
height: typeof height === 'number' ? `${height}px` : height,
|
|
355
|
-
width: '100%',
|
|
356
|
-
}), [height]);
|
|
357
|
-
|
|
358
|
-
// Determine theme class and build complete class list
|
|
359
|
-
const themeClass = `ag-theme-${theme}`;
|
|
360
|
-
const classList = [
|
|
361
|
-
themeClass,
|
|
362
|
-
'rounded-xl',
|
|
363
|
-
'border',
|
|
364
|
-
'border-border',
|
|
365
|
-
'overflow-hidden',
|
|
366
|
-
'shadow-lg',
|
|
367
|
-
className
|
|
368
|
-
].filter(Boolean).join(' ');
|
|
369
|
-
|
|
370
|
-
return (
|
|
371
|
-
<div className="ag-grid-container">
|
|
372
|
-
{(exportConfig?.enabled || excelExport?.enabled) && (
|
|
373
|
-
<div className="mb-2 flex gap-2">
|
|
374
|
-
{exportConfig?.enabled && (
|
|
375
|
-
<button
|
|
376
|
-
onClick={handleExportCSV}
|
|
377
|
-
className="px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors"
|
|
378
|
-
>
|
|
379
|
-
Export CSV
|
|
380
|
-
</button>
|
|
381
|
-
)}
|
|
382
|
-
{excelExport?.enabled && (
|
|
383
|
-
<button
|
|
384
|
-
onClick={handleExportExcel}
|
|
385
|
-
className="px-3 py-1.5 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-md transition-colors"
|
|
386
|
-
>
|
|
387
|
-
Export Excel (CSV)
|
|
388
|
-
</button>
|
|
389
|
-
)}
|
|
390
|
-
</div>
|
|
391
|
-
)}
|
|
392
|
-
<div
|
|
393
|
-
className={classList}
|
|
394
|
-
style={containerStyle}
|
|
395
|
-
>
|
|
396
|
-
<AgGridReact
|
|
397
|
-
ref={gridRef}
|
|
398
|
-
rowData={rowData}
|
|
399
|
-
columnDefs={processedColumnDefs}
|
|
400
|
-
gridOptions={mergedGridOptions}
|
|
401
|
-
/>
|
|
402
|
-
</div>
|
|
403
|
-
</div>
|
|
404
|
-
);
|
|
405
|
-
}
|