-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathpropCategories.js
More file actions
399 lines (346 loc) · 9.3 KB
/
Copy pathpropCategories.js
File metadata and controls
399 lines (346 loc) · 9.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/**
* Dangerous elements inside column defs: If you pass a string,
* AG Grid will execute it as raw JS. We accept these strings if
* `dangerously_allow_code=true`, otherwise we require
* {function: <string>} and we'll eval & exec it safely.
* https://www.ag-grid.com/react-data-grid/cell-expressions/#column-definition-expressions
**/
export const COLUMN_DANGEROUS_FUNCTIONS = {
valueGetter: 1,
valueFormatter: 1,
valueParser: 1,
valueSetter: 1,
filterValueGetter: 1,
headerValueGetter: 1,
template: 1,
dateParser: 1,
dateFormatter: 1,
};
/**
* Dangerous elements on the grid: If you pass a string,
* AG Grid will execute it as raw JS. We accept these strings if
* `dangerously_allow_code=true`, otherwise we require
* {function: <string>} and we'll eval & exec it safely.
* https://www.ag-grid.com/react-data-grid/cell-expressions/#column-definition-expressions
**/
export const GRID_DANGEROUS_FUNCTIONS = {
overlayLoadingTemplate: 1,
overlayNoRowsTemplate: 1,
};
/**
* Objects in either columns or top-level props with arbitrary keys
* whose values can only be function strings, which we will eval safely
**/
export const OBJ_OF_FUNCTIONS = {
cellClassRules: 1,
rowClassRules: 1,
};
/**
* Possible functions from top-level grid props
* Props in this list can be string constants (NOT eval'd by AG Grid) or functions,
* in which case we require {function: <string>} and we will eval them safely
* https://www.ag-grid.com/react-data-grid/grid-options/
**/
export const GRID_MAYBE_FUNCTIONS = {
// Accessories
getMainMenuItems: 1,
postProcessPopup: 1,
getContextMenuItems: 1,
// Clipboard
processCellForClipboard: 1,
processHeaderForClipboard: 1,
processGroupHeaderForClipboard: 1,
processCellFromClipboard: 1,
sendToClipboard: 1,
processDataFromClipboard: 1,
// Exporting
getCustomContentBelowRow: 1,
shouldRowBeSkipped: 1,
processCellCallback: 1,
processHeaderCallback: 1,
processGroupHeaderCallback: 1,
processRowGroupCallback: 1,
// Filtering
isExternalFilterPresent: 1,
doesExternalFilterPass: 1,
quickFilterParser: 1,
// Integrated Charts
getChartToolbarItems: 1,
createChartContainer: 1,
// Keyboard Navigation
navigateToNextHeader: 1,
tabToNextHeader: 1,
navigateToNextCell: 1,
tabToNextCell: 1,
// Localisation
getLocaleText: 1,
// Miscellaneous
getDocument: 1,
isRowMaster: 1,
// Pagination
paginationNumberFormatter: 1,
// Pivot and Aggregation
processPivotResultColDef: 1,
processPivotResultColGroupDef: 1,
getGroupRowAgg: 1,
// Rendering
getBusinessKeyForNode: 1,
processRowPostCreate: 1,
// Row Drag and Drop
rowDragText: 1,
// Row Grouping
isGroupOpenByDefault: 1,
initialGroupOrderComparator: 1,
// RowModel: Server-Side
getChildCount: 1,
getServerSideGroupLevelParams: 1,
isServerSideGroupOpenByDefault: 1,
isApplyServerSideTransaction: 1,
isServerSideGroup: 1,
getServerSideGroupKey: 1,
// Selection
isRowSelectable: 1,
fillOperation: 1,
checkboxes: 1,
// Sorting
postSortRows: 1,
// Styling
getRowHeight: 1,
getRowStyle: 1,
getRowClass: 1,
isFullWidthRow: 1,
};
/**
* Possible functions from top-level grid props
* Props in this list can be string constants (NOT eval'd by AG Grid) or functions,
* in which case we require {function: <string>} and we will eval them safely
* https://www.ag-grid.com/react-data-grid/grid-options/
**/
export const GRID_MAYBE_FUNCTIONS_NO_PARAMS = {
components: 1,
frameworkComponents: 1,
setPopupParent: 1,
popupParent: 1,
quickFilterMatcher: 1,
// Themeing
theme: 1,
};
/**
* Functions from top-level grid props. Props in this list can ONLY be
* functions, so we accept a string and eval it safely
* https://www.ag-grid.com/react-data-grid/grid-options/
**/
export const GRID_ONLY_FUNCTIONS = {
getRowId: 1,
getDataPath: 1,
};
/**
* Other top-level containers that look like a column def
*/
export const GRID_COLUMN_CONTAINERS = {
defaultColDef: 1,
autoGroupColumnDef: 1,
defaultColGroupDef: 1,
};
/**
* Top-level containers that contain other functions or entire grids
*/
export const GRID_NESTED_FUNCTIONS = {
detailCellRendererParams: 1,
detailGridOptions: 1,
csvExportParams: 1,
defaultCsvExportParams: 1,
rowSelection: 1,
};
/**
* Possible functions from columnDef props
* Props in this list can be string constants (NOT eval'd by AG Grid) or functions,
* in which case we require {function: <string>} and we will eval them safely
* https://www.ag-grid.com/react-data-grid/column-properties/
**/
export const COLUMN_MAYBE_FUNCTIONS_NO_PARAMS = {
cellEditor: 1,
// Columns: Sort
comparator: 1,
pivotComparator: 1,
// filter params custom option
predicate: 1,
// filter
doesFilterPass: 1,
handler: 1,
};
/**
* Possible functions from columnDef props
* Props in this list can be string constants (NOT eval'd by AG Grid) or functions,
* in which case we require {function: <string>} and we will eval them safely
* https://www.ag-grid.com/react-data-grid/column-properties/
**/
export const COLUMN_MAYBE_FUNCTIONS = {
// Columns
keyCreator: 1,
equals: 1,
checkboxSelection: 1,
icons: 1,
suppressNavigable: 1,
suppressKeyboardEvent: 1,
// Columns: Editing
editable: 1,
cellEditorSelector: 1,
// Columns: Events
onCellDoubleClicked: 1,
onCellContextMenu: 1,
// Columns: Filter
getQuickFilterText: 1,
textFormatter: 1,
textMatcher: 1,
numberFormatter: 1,
numberParser: 1,
// Columns: Headers
suppressHeaderKeyboardEvent: 1,
headerCheckboxSelection: 1,
// Columns: Rendering and Styling
cellStyle: 1,
cellClass: 1,
tooltipComponent: 1,
cellRenderer: 1,
cellRendererSelector: 1,
// Columns: Row Dragging
rowDrag: 1,
rowDragText: 1,
dndSource: 1,
dndSourceOnRowDrag: 1,
// Columns: Row Grouping
aggFunc: 1,
initialAggFunc: 1,
// Columns: Spanning
colSpan: 1,
rowSpan: 1,
// Columns: Tooltips
tooltipValueGetter: 1,
// Groups
toolPanelClass: 1,
totalValueGetter: 1,
// Groups: Header
headerClass: 1,
// Header Component Parameters
showColumnMenu: 1,
progressSort: 1,
setSort: 1,
// Header Group Component Parameters
setExpanded: 1,
// In filterParams
filterPlaceholder: 1,
// In dataTypeDefinitions
dataTypeMatcher: 1,
};
/**
* Container objects inside columnDefs that may have other functions
* inside them, listed in other categories
**/
export const COLUMN_NESTED_FUNCTIONS = {
headerComponentParams: 1,
headerGroupComponentParams: 1,
};
/**
* Container objects inside columnDefs that may have other functions
* or may be functions themselves
**/
export const COLUMN_NESTED_OR_OBJ_OF_FUNCTIONS = {
cellRendererParams: 1,
cellEditorParams: 1,
tooltipComponentParams: 1,
};
/**
* Container objects inside columnDefs that may have other functions
* or may be functions themselves no params passed
**/
export const COLUMN_NESTED_OR_OBJ_OF_FUNCTIONS_NO_PARAMS = {
filterParams: 1,
filter: 1,
};
/**
* Container arrays of objects inside columnDefs that may have functions
* inside them, listed in other categories
*/
export const COLUMN_ARRAY_NESTED_FUNCTIONS = {
children: 1,
filterOptions: 1,
filters: 1,
};
/**
* Container function, object of functions, or object of objects inside a property that may have functions
* inside them, listed in other categories
*/
export const OBJ_MAYBE_FUNCTION_OR_MAP_MAYBE_FUNCTIONS = {
dataTypeDefinitions: 1,
aggFuncs: 1,
columnTypes: 1,
};
/**
* Props to pass straight from Dash to AG Grid with no caching or conversion
*/
export const PASSTHRU_PROPS = ['rowData'];
/**
* Props to not send to AG Grid at all
* There are others too, that are already pulled out of `restProps`
* in the render() method, so they don't need to be listed here
*/
export const PROPS_NOT_FOR_AG_GRID = [
'children',
'dashRenderType',
'licenseKey',
'setProps',
'loading_state',
'enableEnterpriseModules',
'parentState',
'persistence',
'persisted_props',
'persistence_type',
'virtualRowData',
'cellValueChanged',
'cellClicked',
'cellDoubleClicked',
'getRowsRequest',
'getRowsResponse',
'getDetailRequest',
'getDetailResponse',
'dangerously_allow_code',
'alignedGrids',
'resetColumnState',
'exportDataAsCsv',
'selectedRows',
'selectAll',
'deselectAll',
'deleteSelectedRows',
'rowTransaction',
'updateColumnState',
'csvExportParams',
'filterModel',
'columnState',
'paginationGoTo',
'columnSize',
'scrollTo',
'eventListeners',
'eventData',
'paginationInfo',
];
/**
* Props to not trigger a render update
*/
export const OMIT_PROP_RENDER = [
'virtualRowData',
'columnState',
'filterModel',
'getRowsRequest',
'getDetailRequest',
'cellValueChanged',
'cellClicked',
'paginationInfo',
'cellRendererData',
'cellDoubleClicked',
'eventData',
];
/**
* States to not trigger a render update
*/
export const OMIT_STATE_RENDER = ['gridColumnApi', 'mounted', 'openGroups'];