UNPKG

20.5 kBPlain TextView Raw
1import {RowNode} from "./rowNode";
2import {GridApi} from "../gridApi";
3import {ColumnApi} from "../columnController/columnApi";
4import {Column} from "./column";
5import {IViewportDatasource} from "../interfaces/iViewportDatasource";
6import {ICellRendererComp, ICellRendererFunc} from "../rendering/cellRenderers/iCellRenderer";
7import {ColDef, ColGroupDef, IAggFunc} from "./colDef";
8import {IDatasource} from "../rowModels/iDatasource";
9import {GridCellDef} from "./gridCell";
10import {IDateComp} from "../rendering/dateComponent";
11import {IServerSideDatasource} from "../interfaces/iServerSideDatasource";
12import {CsvExportParams, ProcessCellForExportParams, ProcessHeaderForExportParams} from "../exportParams";
13import {
14 BodyScrollEvent,
15 CellClickedEvent,
16 CellContextMenuEvent,
17 CellDoubleClickedEvent,
18 CellEditingStartedEvent,
19 CellEditingStoppedEvent,
20 CellFocusedEvent,
21 CellMouseDownEvent,
22 CellMouseOutEvent,
23 CellMouseOverEvent,
24 CellValueChangedEvent,
25 ColumnAggFuncChangeRequestEvent,
26 ColumnEverythingChangedEvent,
27 ColumnGroupOpenedEvent,
28 ColumnMovedEvent,
29 ColumnPinnedEvent,
30 ColumnPivotChangedEvent,
31 ColumnPivotChangeRequestEvent,
32 ColumnPivotModeChangedEvent,
33 ColumnResizedEvent,
34 ColumnRowGroupChangedEvent,
35 ColumnRowGroupChangeRequestEvent,
36 ColumnValueChangedEvent,
37 ColumnValueChangeRequestEvent,
38 ColumnVisibleEvent,
39 DisplayedColumnsChangedEvent,
40 DragStartedEvent,
41 DragStoppedEvent,
42 FilterChangedEvent,
43 FilterModifiedEvent,
44 GridColumnsChangedEvent,
45 GridReadyEvent,
46 ModelUpdatedEvent,
47 NewColumnsLoadedEvent,
48 PaginationChangedEvent,
49 PasteStartEvent,
50 PasteEndEvent,
51 PinnedRowDataChangedEvent,
52 RangeSelectionChangedEvent,
53 RowClickedEvent,
54 RowDataChangedEvent,
55 RowDataUpdatedEvent,
56 RowDoubleClickedEvent,
57 RowDragEvent,
58 RowEditingStartedEvent,
59 RowEditingStoppedEvent,
60 RowGroupOpenedEvent,
61 RowSelectedEvent,
62 RowValueChangedEvent,
63 SelectionChangedEvent,
64 SortChangedEvent,
65 ViewportChangedEvent,
66 VirtualColumnsChangedEvent,
67 VirtualRowRemovedEvent
68} from "../events";
69import {IComponent} from "../interfaces/iComponent";
70import {AgGridRegisteredComponentInput} from "../components/framework/componentProvider";
71import {ILoadingOverlayComp} from "../rendering/overlays/loadingOverlayComponent";
72import {INoRowsOverlayComp} from "../rendering/overlays/noRowsOverlayComponent";
73
74/****************************************************************
75 * Don't forget to update ComponentUtil if changing this class. *
76 ****************************************************************/
77export interface GridOptions {
78
79 /****************************************************************
80 * Don't forget to update ComponentUtil if changing this class. PLEASE!*
81 ****************************************************************/
82
83 // set once in init, can never change
84 rowDragManaged?: boolean;
85 suppressRowDrag?: boolean;
86 ensureDomOrder?: boolean;
87 deltaRowDataMode?: boolean;
88 scrollbarWidth?: number;
89 toolPanelSuppressRowGroups?: boolean;
90 toolPanelSuppressValues?: boolean;
91 toolPanelSuppressPivots?: boolean;
92 toolPanelSuppressPivotMode?: boolean;
93 toolPanelSuppressSideButtons?: boolean;
94 toolPanelSuppressColumnFilter?: boolean;
95 toolPanelSuppressColumnSelectAll?: boolean;
96 toolPanelSuppressColumnExpandAll?: boolean;
97 contractColumnSelection?: boolean;
98 suppressRowClickSelection?: boolean;
99 suppressRowHoverHighlight?: boolean;
100 suppressCellSelection?: boolean;
101 sortingOrder?: string[];
102 suppressMultiSort?: boolean;
103 multiSortKey?: string;
104 accentedSort?: boolean;
105 suppressHorizontalScroll?: boolean;
106 suppressTabbing?: boolean;
107 unSortIcon?: boolean;
108 rowBuffer?: number;
109 enableRtl?: boolean;
110 enableColResize?: boolean;
111 colResizeDefault?: string;
112 enableCellExpressions?: boolean;
113 enableSorting?: boolean;
114 enableServerSideSorting?: boolean;
115 enableFilter?: boolean;
116 enableServerSideFilter?: boolean;
117 enableStatusBar?: boolean;
118 alwaysShowStatusBar?: boolean;
119 enableGroupEdit?: boolean;
120 enterMovesDownAfterEdit?: boolean;
121 enterMovesDown?: boolean;
122 suppressMiddleClickScrolls?: boolean;
123 suppressPreventDefaultOnMouseWheel?: boolean;
124 suppressScrollOnNewData?: boolean;
125 suppressMenuHide?: boolean;
126 singleClickEdit?: boolean;
127 suppressClickEdit?: boolean;
128 stopEditingWhenGridLosesFocus?: boolean;
129 debug?: boolean;
130 icons?: any; // should be typed
131 angularCompileRows?: boolean;
132 angularCompileFilters?: boolean;
133 angularCompileHeaders?: boolean;
134 suppressLoadingOverlay?: boolean;
135 suppressNoRowsOverlay?: boolean;
136 suppressAutoSize?: boolean;
137 autoSizePadding?: number;
138 animateRows?: boolean;
139 suppressColumnMoveAnimation?: boolean;
140 suppressMovableColumns?: boolean;
141 suppressDragLeaveHidesColumns?: boolean;
142 suppressMakeColumnVisibleAfterUnGroup?: boolean;
143 suppressParentsInRowNodes?: boolean;
144 suppressFieldDotNotation?: boolean;
145 suppressCopyRowsToClipboard?: boolean;
146 clipboardDeliminator?: string;
147 suppressClipboardPaste?: boolean;
148 suppressAggFuncInHeader?: boolean;
149 suppressAggAtRootLevel?: boolean;
150 suppressFocusAfterRefresh?: boolean;
151 rowModelType?: string;
152 pivotMode?: boolean;
153 pivotTotals?: boolean; //deprecated
154 pivotColumnGroupTotals?: string;
155 pivotRowTotals?: string;
156 suppressEnterpriseResetOnNewColumns?: boolean;
157 enableRangeSelection?: boolean;
158 suppressMultiRangeSelection?: boolean;
159 // enterprise only
160 rowGroupPanelShow?: string;
161 pivotPanelShow?: string;
162 suppressContextMenu?: boolean;
163 allowContextMenuWithControlKey?: boolean;
164 rememberGroupStateWhenNewData?: boolean;
165 viewportRowModelPageSize?: number;
166 viewportRowModelBufferSize?: number;
167 enableCellChangeFlash?: boolean;
168 quickFilterText?: string;
169 cacheQuickFilter?: boolean;
170 aggFuncs?: {[key: string]: IAggFunc};
171 suppressColumnVirtualisation?: boolean;
172 functionsReadOnly?: boolean;
173 functionsPassive?: boolean;
174 maxConcurrentDatasourceRequests?: number;
175 maxBlocksInCache?: number;
176 purgeClosedRowNodes?: boolean;
177 gridAutoHeight?: boolean;
178 domLayout?: string;
179 suppressChangeDetection?: boolean;
180 aggregateOnlyChangedColumns?: boolean;
181 valueCache?: boolean;
182 valueCacheNeverExpires?: boolean;
183 batchUpdateWaitMillis?: number;
184 suppressRowTransform?: boolean;
185
186 cacheOverflowSize?: number;
187 infiniteInitialRowCount?: number;
188 paginationPageSize?: number;
189 cacheBlockSize?: number;
190 paginationAutoPageSize?: boolean;
191 paginationStartPage?: number;
192 suppressPaginationPanel?: boolean;
193
194 pagination?: boolean;
195 editType?: string;
196 suppressTouch?: boolean;
197 suppressAsyncEvents?: boolean;
198 embedFullWidthRows?: boolean;
199 //This is an array of ExcelStyle, but because that class lives on the enterprise project is referenced as any from the client project
200 excelStyles?: any[];
201 floatingFilter?: boolean;
202 suppressExcelExport?: boolean;
203 suppressCsvExport?: boolean;
204
205 // these should really be deprecated, as the user should be using the default
206 // column definitions for specifying column defaults.
207 colWidth?: number;
208 minColWidth?: number;
209 maxColWidth?: number;
210
211 suppressPropertyNamesCheck?: boolean;
212 serverSideSortingAlwaysResets?: boolean;
213
214 /****************************************************************
215 * Don't forget to update ComponentUtil if changing this class. *
216 ****************************************************************/
217
218 // just set once
219 localeText?: any;
220 localeTextFunc?: Function;
221 suppressAnimationFrame?: boolean;
222 /* a map of strings (cellRenderer keys) to cellRenderers (that can be ICellRenderer or ICellRendererFunc) */
223 // cellRenderers?: {[key: string]: {new(): ICellRenderer} | ICellRendererFunc};
224 /* a map of strings (cellEditor keys) to cellEditors */
225 // cellEditors?: {[key: string]: {new(): ICellEditor}};
226 defaultColGroupDef?: ColGroupDef;
227 defaultColDef?: ColDef;
228 defaultExportParams?: CsvExportParams;
229
230 /****************************************************************
231 * Don't forget to update ComponentUtil if changing this class. *
232 ****************************************************************/
233
234 groupSuppressAutoColumn?: boolean;
235 groupSelectsChildren?: boolean;
236 groupSelectsFiltered?: boolean;
237 groupIncludeFooter?: boolean;
238 groupIncludeTotalFooter?: boolean;
239 groupUseEntireRow?: boolean;
240 groupRemoveSingleChildren?: boolean;
241 groupRemoveLowestSingleChildren?: boolean;
242 groupSuppressRow?: boolean;
243 groupHideOpenParents?: boolean;
244 groupMultiAutoColumn?: boolean;
245 groupSuppressBlankHeader?: boolean;
246 //Deprecated in v11.0 substituted by autoGroupColumnDef
247 groupColumnDef?: ColDef;
248 autoGroupColumnDef?: ColDef;
249 // deprecated - should use domLayout
250 forPrint?: boolean;
251 enableOldSetFilterModel?: boolean;
252
253 /****************************************************************
254 * Don't forget to update ComponentUtil if changing this class. *
255 ****************************************************************/
256
257 // changeable, but no immediate impact
258 context?: any;
259 rowStyle?: any;
260 rowClass?: string | string[];
261 groupDefaultExpanded?: number;
262 slaveGrids?: GridOptions[]; // slaveGrids deprecated, replace with alignedGrids
263 alignedGrids?: GridOptions[];
264 rowSelection?: string;
265 rowDeselection?: boolean;
266 rowMultiSelectWithClick?: boolean;
267 isRowSelectable?: IsRowSelectable;
268 overlayLoadingTemplate?: string;
269 overlayNoRowsTemplate?: string;
270 rowHeight?: number;
271 detailRowHeight?: number;
272 popupParent?: HTMLElement;
273
274 masterDetail?: boolean;
275 isRowMaster?: IsRowMaster;
276 detailCellRenderer?: {new(): ICellRendererComp} | ICellRendererFunc | string;
277 detailCellRendererFramework?: any;
278 detailCellRendererParams?: any;
279
280 /****************************************************************
281 * Don't forget to update ComponentUtil if changing this class. *
282 ****************************************************************/
283
284 // changeable with impact
285 rowData?: any[];
286 pinnedTopRowData?: any[];
287 pinnedBottomRowData?: any[];
288 showToolPanel?: boolean;
289 columnDefs?: (ColDef|ColGroupDef)[];
290 columnTypes?: {[key: string]: ColDef};
291 datasource?: IDatasource;
292 viewportDatasource?: IViewportDatasource;
293 serverSideDatasource?: IServerSideDatasource;
294
295 // in properties
296 headerHeight?: number;
297 pivotHeaderHeight?: number;
298 groupHeaderHeight?: number;
299 pivotGroupHeaderHeight?: number;
300 floatingFiltersHeight?: number;
301
302 /****************************************************************
303 * Don't forget to update ComponentUtil if changing this class. *
304 ****************************************************************/
305
306 // callbacks
307 paginationNumberFormatter?: (params: PaginationNumberFormatterParams)=>string;
308 postProcessPopup?: (params: PostProcessPopupParams)=>void;
309 frameworkComponents?: {[p: string]: {new(): any}};
310 components?: {[p: string]: AgGridRegisteredComponentInput<IComponent<any>>};
311 dateComponent?: {new(): IDateComp};
312 dateComponentFramework?: any;
313 groupRowRenderer?: {new(): ICellRendererComp} | ICellRendererFunc | string;
314 groupRowRendererFramework?: any;
315 groupRowRendererParams?: any;
316 groupRowInnerRenderer?: {new(): ICellRendererComp} | ICellRendererFunc | string;
317 groupRowInnerRendererFramework?: any;
318 isExternalFilterPresent?(): boolean;
319 doesExternalFilterPass?(node: RowNode): boolean;
320 getRowStyle?: Function;
321 getRowClass?: (params: any) => (string | string[]);
322 rowClassRules?: { [cssClassName: string]: (Function | string) };
323 getRowHeight?: Function;
324 sendToClipboard?: (params: any)=>void;
325 processDataFromClipboard?: (params: ProcessDataFromClipboardParams)=>string[][];
326 navigateToNextCell?: (params: NavigateToNextCellParams)=>GridCellDef;
327 tabToNextCell?: (params: TabToNextCellParams)=>GridCellDef;
328 getDocument?: ()=> Document;
329 defaultGroupSortComparator?: (nodeA: RowNode, nodeB: RowNode) => number;
330
331 loadingOverlayComponent?: {new(): ILoadingOverlayComp} | string;
332 loadingOverlayComponentFramework?: any;
333 noRowsOverlayComponent?: {new(): INoRowsOverlayComp} | string;
334 noRowsOverlayComponentFramework?: any;
335
336 fullWidthCellRenderer?: {new(): ICellRendererComp} | ICellRendererFunc | string;
337 fullWidthCellRendererFramework?: any;
338 fullWidthCellRendererParams?: any;
339 isFullWidthCell?(rowNode: RowNode): boolean;
340
341 groupRowAggNodes?(nodes: RowNode[]): any;
342 getBusinessKeyForNode?(node: RowNode): string;
343 getNodeChildDetails?: GetNodeChildDetails;
344 getDataPath?: GetDataPath;
345 treeData?: boolean;
346 getContextMenuItems?: GetContextMenuItems;
347 getMainMenuItems?: GetMainMenuItems;
348 getRowNodeId?: GetRowNodeIdFunc;
349 getChildCount?(dataItem: any): number;
350 doesDataFlower?(dataItem: any): boolean;
351 processRowPostCreate?(params: ProcessRowParams): void;
352 processCellForClipboard?(params: ProcessCellForExportParams): any;
353 processHeaderForClipboard?(params: ProcessHeaderForExportParams): any;
354 processCellFromClipboard?(params: ProcessCellForExportParams): any;
355 processSecondaryColDef?(colDef: ColDef): void;
356 processSecondaryColGroupDef?(colGroupDef: ColGroupDef): void;
357 postSort?(nodes: RowNode[]): void;
358
359 /****************************************************************
360 * Don't forget to update ComponentUtil if changing this class. *
361 ****************************************************************/
362
363 // events
364 onColumnEverythingChanged?(event: ColumnEverythingChangedEvent): void;
365 onNewColumnsLoaded?(event: NewColumnsLoadedEvent): void;
366 onColumnPivotModeChanged?(event: ColumnPivotModeChangedEvent): void;
367 onColumnRowGroupChanged?(event: ColumnRowGroupChangedEvent): void;
368 onColumnPivotChanged?(event: ColumnPivotChangedEvent): void;
369 onGridColumnsChanged?(event: GridColumnsChangedEvent): void;
370 onColumnValueChanged?(event: ColumnValueChangedEvent): void;
371 onColumnMoved?(event: ColumnMovedEvent): void;
372 onColumnVisible?(event: ColumnVisibleEvent): void;
373 onColumnPinned?(event: ColumnPinnedEvent): void;
374 onColumnGroupOpened?(event: ColumnGroupOpenedEvent): void;
375 onColumnResized?(event: ColumnResizedEvent): void;
376 onDisplayedColumnsChanged?(event: DisplayedColumnsChangedEvent): void;
377 onVirtualColumnsChanged?(event: VirtualColumnsChangedEvent): void;
378 onRowGroupOpened?(event: RowGroupOpenedEvent): void;
379 onRowDataChanged?(event: RowDataChangedEvent): void;
380 onRowDataUpdated?(event: RowDataUpdatedEvent): void;
381 onPinnedRowDataChanged?(event: PinnedRowDataChangedEvent): void;
382 onRangeSelectionChanged?(event: RangeSelectionChangedEvent): void;
383 onColumnRowGroupChangeRequest?(event: ColumnRowGroupChangeRequestEvent): void;
384 onColumnPivotChangeRequest?(event: ColumnPivotChangeRequestEvent): void;
385 onColumnValueChangeRequest?(event: ColumnValueChangeRequestEvent): void;
386 onColumnAggFuncChangeRequest?(event: ColumnAggFuncChangeRequestEvent): void;
387 onModelUpdated?(event: ModelUpdatedEvent): void;
388 onCellClicked?(event: CellClickedEvent): void;
389 onCellMouseDown?(event: CellMouseDownEvent): void;
390 onCellDoubleClicked?(event: CellDoubleClickedEvent): void;
391 onCellContextMenu?(event: CellContextMenuEvent): void;
392 onCellValueChanged?(event: CellValueChangedEvent): void;
393 onCellMouseOver?(event: CellMouseOverEvent): void;
394 onCellMouseOut?(event: CellMouseOutEvent): void;
395 onRowValueChanged?(event: RowValueChangedEvent): void;
396 onRowEditingStarted?(event: RowEditingStartedEvent): void;
397 onRowEditingStopped?(event: RowEditingStoppedEvent): void;
398 onCellEditingStarted?(event: CellEditingStartedEvent): void;
399 onCellEditingStopped?(event: CellEditingStoppedEvent): void;
400 onCellFocused?(event: CellFocusedEvent): void;
401 onRowSelected?(event: RowSelectedEvent): void;
402 onSelectionChanged?(event: SelectionChangedEvent): void;
403 onFilterChanged?(event: FilterChangedEvent): void;
404 onFilterModified?(event: FilterModifiedEvent): void;
405 onSortChanged?(event: SortChangedEvent): void;
406 onVirtualRowRemoved?(event: VirtualRowRemovedEvent): void;
407 onRowClicked?(event: RowClickedEvent): void;
408 onRowDoubleClicked?(event: RowDoubleClickedEvent): void;
409 onGridReady?(event: GridReadyEvent): void;
410 onViewportChanged?(event: ViewportChangedEvent): void;
411 onDragStarted?(event: DragStartedEvent): void;
412 onDragStopped?(event: DragStoppedEvent): void;
413 onPaginationChanged?(event: PaginationChangedEvent): void;
414 onRowDragEnter?(event: RowDragEvent): void;
415 onRowDragMove?(event: RowDragEvent): void;
416 onRowDragLeave?(event: RowDragEvent): void;
417 onRowDragEnd?(event: RowDragEvent): void;
418 onPasteStart?(event: PasteStartEvent): void;
419 onPasteEnd?(event: PasteEndEvent): void;
420 onBodyScroll?(event: BodyScrollEvent): void;
421 // deprecated
422 onGridSizeChanged?(event: any): void;
423
424 /****************************************************************
425 * Don't forget to update ComponentUtil if changing this class. *
426 ****************************************************************/
427
428 // apis, set by the grid on init
429 api?: GridApi; // change to typed
430 columnApi?: ColumnApi; // change to typed
431}
432
433export interface GetDataPath {
434 (data: any): string[];
435}
436
437// export interface IsGroup {
438// (data: any): boolean;
439// }
440
441export interface GetNodeChildDetails {
442 (dataItem: any): NodeChildDetails;
443}
444
445export interface IsRowMaster {
446 (dataItem: any): boolean;
447}
448
449export interface IsRowSelectable {
450 (node: RowNode): boolean;
451}
452
453export interface NodeChildDetails {
454 group: boolean;
455 children?: any[];
456 expanded?: boolean;
457 field?: string;
458 key?: any;
459}
460
461export interface GetContextMenuItemsParams {
462 defaultItems: string[];
463 column: Column;
464 node: RowNode;
465 value: any;
466 api: GridApi;
467 columnApi: ColumnApi;
468 context: any;
469}
470
471export interface GetContextMenuItems {
472 (params: GetContextMenuItemsParams): (string|MenuItemDef)[];
473}
474
475export interface MenuItemDef {
476 name: string;
477 disabled?: boolean;
478 shortcut?: string;
479 action?: ()=>void;
480 checked?: boolean;
481 icon?: HTMLElement|string;
482 subMenu?: (MenuItemDef|string)[];
483 cssClasses?: string[];
484 tooltip?: string;
485}
486
487export interface GetMainMenuItemsParams {
488 column: Column;
489 api: GridApi;
490 columnApi: ColumnApi;
491 context: any;
492 defaultItems: string[];
493}
494
495export interface GetMainMenuItems {
496 (params: GetMainMenuItemsParams): (string|MenuItemDef)[];
497}
498
499export interface GetRowNodeIdFunc {
500 (data: any): string;
501}
502
503export interface ProcessRowParams {
504 eRow: HTMLElement;
505 ePinnedLeftRow: HTMLElement;
506 ePinnedRightRow: HTMLElement;
507 rowIndex: number;
508 node: RowNode;
509 api: GridApi;
510 columnApi: ColumnApi;
511 addRenderedRowListener: (eventType: string, listener: Function)=>void;
512 context: any;
513}
514
515export interface NavigateToNextCellParams {
516 key: number;
517 previousCellDef: GridCellDef;
518 nextCellDef: GridCellDef;
519 event: KeyboardEvent;
520}
521
522export interface TabToNextCellParams {
523 backwards: boolean;
524 editing: boolean;
525 previousCellDef: GridCellDef;
526 nextCellDef: GridCellDef;
527}
528
529export interface PostProcessPopupParams {
530 // if popup is for a column, this gives the Column
531 column?: Column;
532 // if popup is for a row, this gives the RowNode
533 rowNode?: RowNode;
534 // the popup we are showing
535 ePopup: HTMLElement;
536 // The different types are: 'contextMenu', 'columnMenu', 'aggFuncSelect', 'popupCellEditor'
537 type: string;
538 // if the popup is as a result of a button click (eg menu button), this is the component that the user clicked
539 eventSource?: HTMLElement;
540 // if the popup is as a result of a click or touch, this is the event - eg user showing context menu
541 mouseEvent?: MouseEvent|Touch;
542}
543
544export interface PaginationNumberFormatterParams {
545 value: number;
546}
547
548export interface ProcessDataFromClipboardParams {
549 data: string[][];
550}