|
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 |
|
|
0 commit comments