@mui/x-data-grid 6.0.0-alpha.2 → 6.0.0-alpha.3
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 +231 -12
- package/DataGrid/DataGrid.js +0 -20
- package/DataGrid/useDataGridComponent.js +2 -6
- package/colDef/gridNumericOperators.d.ts +1 -1
- package/colDef/gridSingleSelectOperators.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +3 -8
- package/components/cell/GridEditSingleSelectCell.js +6 -38
- package/components/panel/filterPanel/GridFilterForm.d.ts +12 -0
- package/components/panel/filterPanel/GridFilterForm.js +29 -7
- package/components/panel/filterPanel/GridFilterPanel.d.ts +12 -0
- package/components/panel/filterPanel/GridFilterPanel.js +64 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridStateInitialization.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/{editRows/gridEditRowsSelector.d.ts → editing/gridEditingSelectors.d.ts} +0 -0
- package/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/hooks/features/editing/index.d.ts +1 -0
- package/hooks/features/editing/index.js +1 -0
- package/hooks/features/{editRows/useGridCellEditing.new.d.ts → editing/useGridCellEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/hooks/features/{editRows/useGridEditing.new.d.ts → editing/useGridEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/hooks/features/{editRows/useGridRowEditing.new.d.ts → editing/useGridRowEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/hooks/features/index.d.ts +1 -1
- package/hooks/features/index.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/hooks/utils/useGridApi.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridState.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +1 -2
- package/internals/index.js +1 -2
- package/legacy/DataGrid/DataGrid.js +0 -20
- package/legacy/DataGrid/useDataGridComponent.js +2 -6
- package/legacy/components/cell/GridEditInputCell.js +3 -8
- package/legacy/components/cell/GridEditSingleSelectCell.js +6 -52
- package/legacy/components/panel/filterPanel/GridFilterForm.js +31 -7
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +67 -18
- package/legacy/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/legacy/hooks/features/editing/index.js +1 -0
- package/legacy/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/legacy/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/legacy/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/legacy/hooks/features/index.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -2
- package/legacy/models/params/gridEditCellParams.js +0 -4
- package/models/api/gridApiCommon.d.ts +2 -5
- package/models/api/gridApiCommunity.d.ts +1 -7
- package/models/api/gridEditingApi.d.ts +36 -121
- package/models/api/index.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +1 -15
- package/models/params/gridEditCellParams.d.ts +4 -17
- package/models/params/gridEditCellParams.js +0 -4
- package/models/params/gridRowParams.d.ts +4 -4
- package/models/props/DataGridProps.d.ts +0 -24
- package/modern/DataGrid/DataGrid.js +0 -20
- package/modern/DataGrid/useDataGridComponent.js +2 -4
- package/modern/components/cell/GridEditInputCell.js +3 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +6 -34
- package/modern/components/panel/filterPanel/GridFilterForm.js +29 -7
- package/modern/components/panel/filterPanel/GridFilterPanel.js +62 -17
- package/modern/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/modern/hooks/features/editing/index.js +1 -0
- package/modern/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/modern/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/modern/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/modern/hooks/features/index.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -2
- package/modern/models/params/gridEditCellParams.js +0 -4
- package/node/DataGrid/DataGrid.js +0 -20
- package/node/DataGrid/useDataGridComponent.js +3 -8
- package/node/components/cell/GridEditInputCell.js +3 -9
- package/node/components/cell/GridEditSingleSelectCell.js +6 -38
- package/node/components/panel/filterPanel/GridFilterForm.js +30 -7
- package/node/components/panel/filterPanel/GridFilterPanel.js +63 -19
- package/node/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/node/hooks/features/{editRows → editing}/index.js +4 -4
- package/node/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +28 -13
- package/node/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +4 -4
- package/node/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +28 -14
- package/node/hooks/features/index.js +4 -4
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +3 -17
- package/node/models/params/gridEditCellParams.js +0 -3
- package/package.json +2 -2
- package/hooks/features/editRows/index.d.ts +0 -1
- package/hooks/features/editRows/index.js +0 -1
- package/hooks/features/editRows/useGridCellEditing.old.d.ts +0 -4
- package/hooks/features/editRows/useGridCellEditing.old.js +0 -359
- package/hooks/features/editRows/useGridEditing.old.d.ts +0 -11
- package/hooks/features/editRows/useGridEditing.old.js +0 -167
- package/hooks/features/editRows/useGridRowEditing.old.d.ts +0 -4
- package/hooks/features/editRows/useGridRowEditing.old.js +0 -334
- package/legacy/hooks/features/editRows/index.js +0 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +0 -411
- package/legacy/hooks/features/editRows/useGridEditing.old.js +0 -184
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +0 -505
- package/modern/hooks/features/editRows/index.js +0 -1
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +0 -355
- package/modern/hooks/features/editRows/useGridEditing.old.js +0 -163
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +0 -326
- package/node/hooks/features/editRows/useGridCellEditing.old.js +0 -380
- package/node/hooks/features/editRows/useGridEditing.old.js +0 -193
- package/node/hooks/features/editRows/useGridRowEditing.old.js +0 -358
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GridCellMode, GridRowMode } from '../gridCell';
|
|
2
|
-
import {
|
|
2
|
+
import { GridCellModes, GridRowModes } from '../gridEditRowModel';
|
|
3
3
|
import { GridRowId, GridRowModel } from '../gridRows';
|
|
4
4
|
import { GridCellParams } from '../params/gridCellParams';
|
|
5
|
-
import {
|
|
5
|
+
import { GridEditCellValueParams } from '../params/gridEditCellParams';
|
|
6
6
|
import { MuiBaseEvent } from '../muiEvent';
|
|
7
7
|
export declare type GridCellModesModelProps = ({
|
|
8
8
|
mode: GridCellModes.View;
|
|
@@ -19,7 +19,7 @@ export declare type GridRowModesModel = Record<GridRowId, GridRowModesModelProps
|
|
|
19
19
|
export interface GridEditCellMeta {
|
|
20
20
|
changeReason?: 'debouncedSetEditCellValue' | 'setEditCellValue';
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface GridEditingSharedApi {
|
|
23
23
|
/**
|
|
24
24
|
* Controls if a cell is editable.
|
|
25
25
|
* @param {GridCellParams} params The cell params.
|
|
@@ -31,7 +31,7 @@ export interface GridNewEditingSharedApi {
|
|
|
31
31
|
* Commonly used inside the edit cell component.
|
|
32
32
|
* @param {GridEditCellValueParams} params Contains the id, field and value to set.
|
|
33
33
|
* @param {React.SyntheticEvent} event The event to pass forward.
|
|
34
|
-
* @returns {Promise<boolean> | void} A promise with the validation status
|
|
34
|
+
* @returns {Promise<boolean> | void} A promise with the validation status.
|
|
35
35
|
*/
|
|
36
36
|
setEditCellValue: (params: GridEditCellValueParams, event?: MuiBaseEvent) => Promise<boolean> | void;
|
|
37
37
|
/**
|
|
@@ -57,116 +57,6 @@ export interface GridNewEditingSharedApi {
|
|
|
57
57
|
*/
|
|
58
58
|
unstable_getEditCellMeta: (id: GridRowId, field: string) => GridEditCellMeta;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* The shared methods used by the cell and row editing API.
|
|
62
|
-
*/
|
|
63
|
-
export interface GridEditingSharedApi {
|
|
64
|
-
/**
|
|
65
|
-
* Set the edit rows model of the grid.
|
|
66
|
-
* @param {GridEditRowsModel} model The new edit rows model.
|
|
67
|
-
* @deprecated Prefer the new editing API.
|
|
68
|
-
*/
|
|
69
|
-
setEditRowsModel: (model: GridEditRowsModel) => void;
|
|
70
|
-
/**
|
|
71
|
-
* Gets the edit rows model of the grid.
|
|
72
|
-
* @returns {GridEditRowsModel} The edit rows model.
|
|
73
|
-
* @deprecated Prefer the new editing API.
|
|
74
|
-
*/
|
|
75
|
-
getEditRowsModel: () => GridEditRowsModel;
|
|
76
|
-
/**
|
|
77
|
-
* Controls if a cell is editable.
|
|
78
|
-
* @param {GridCellParams} params The cell params.
|
|
79
|
-
* @returns {boolean} A boolean value determining if the cell is editable.
|
|
80
|
-
*/
|
|
81
|
-
isCellEditable: (params: GridCellParams) => boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Sets the value of the edit cell.
|
|
84
|
-
* Commonly used inside the edit cell component.
|
|
85
|
-
* @param {GridEditCellValueParams} params Contains the id, field and value to set.
|
|
86
|
-
* @param {React.SyntheticEvent} event The event to pass forward.
|
|
87
|
-
* @returns {Promise<boolean> | void} A promise with the validation status if `preventCommitWhileValidating` is `true`. Otherwise, void.
|
|
88
|
-
*/
|
|
89
|
-
setEditCellValue: (params: GridEditCellValueParams, event?: MuiBaseEvent) => Promise<boolean> | void;
|
|
90
|
-
/**
|
|
91
|
-
* Immediatelly updates the value of the cell, without waiting for the debounce.
|
|
92
|
-
* @param {GridRowId} id The row id.
|
|
93
|
-
* @param {string} field The field to update. If not passed, updates all fields in the given row id.
|
|
94
|
-
* @ignore - do not document.
|
|
95
|
-
*/
|
|
96
|
-
unstable_runPendingEditCellValueMutation: (id: GridRowId, field?: string) => void;
|
|
97
|
-
/**
|
|
98
|
-
* @ignore - do not document.
|
|
99
|
-
*/
|
|
100
|
-
unstable_setEditCellProps: (params: GridEditCellPropsParams) => GridEditCellProps;
|
|
101
|
-
/**
|
|
102
|
-
* @ignore - do not document.
|
|
103
|
-
*/
|
|
104
|
-
unstable_parseValue: (id: GridRowId, field: string, value: any) => any;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* The row editing API interface.
|
|
108
|
-
*/
|
|
109
|
-
export interface GridRowEditingApi extends GridEditingSharedApi {
|
|
110
|
-
/**
|
|
111
|
-
* Sets the mode of a row.
|
|
112
|
-
* @param {GridRowId} id The id of the row.
|
|
113
|
-
* @param {GridRowMode} mode Can be: `"edit"`, `"view"`.
|
|
114
|
-
*/
|
|
115
|
-
setRowMode: (id: GridRowId, mode: GridRowMode) => void;
|
|
116
|
-
/**
|
|
117
|
-
* Gets the mode of a row.
|
|
118
|
-
* @param {GridRowId} id The id of the row.
|
|
119
|
-
* @returns {GridRowMode} Returns `"edit"` or `"view"`.
|
|
120
|
-
*/
|
|
121
|
-
getRowMode: (id: GridRowId) => GridRowMode;
|
|
122
|
-
/**
|
|
123
|
-
* Updates the row corresponding to the given id with the values stored in the edit row model.
|
|
124
|
-
* @param {GridRowId} id The id to commit to.
|
|
125
|
-
* @param {React.SyntheticEvent} event The event to pass forward.
|
|
126
|
-
* @returns {boolean} A boolean indicating if there is an error.
|
|
127
|
-
*/
|
|
128
|
-
commitRowChange: (id: GridRowId, event?: MuiBaseEvent) => boolean | Promise<boolean>;
|
|
129
|
-
/**
|
|
130
|
-
* Updates the value of a cell and calls all `preProcessEditCellProps` if necessary.
|
|
131
|
-
* @param {GridCommitCellChangeParams} params Object with the new value and id and field to update.
|
|
132
|
-
* @returns {Promise<boolean>} Resolves with `true` when all values in the row are valid.
|
|
133
|
-
* @ignore - do not document.
|
|
134
|
-
*/
|
|
135
|
-
unstable_setRowEditingEditCellValue: (params: GridEditCellValueParams) => Promise<boolean>;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* The cell editing API interface.
|
|
139
|
-
*/
|
|
140
|
-
export interface GridCellEditingApi extends GridEditingSharedApi {
|
|
141
|
-
/**
|
|
142
|
-
* Updates the field corresponding to the given id with the value stored in the edit row model.
|
|
143
|
-
* @param {GridCommitCellChangeParams} params The id and field to commit to.
|
|
144
|
-
* @param {React.SyntheticEvent} event The event to pass forward.
|
|
145
|
-
* @returns {boolean} A boolean indicating if there is an error.
|
|
146
|
-
*/
|
|
147
|
-
commitCellChange: (params: GridCommitCellChangeParams, event?: MuiBaseEvent) => boolean | Promise<boolean>;
|
|
148
|
-
/**
|
|
149
|
-
* Sets the mode of a cell.
|
|
150
|
-
* @param {GridRowId} id The id of the row.
|
|
151
|
-
* @param {string} field The field to change the mode.
|
|
152
|
-
* @param {GridCellMode} mode Can be: `"edit"`, `"view"`.
|
|
153
|
-
*/
|
|
154
|
-
setCellMode: (id: GridRowId, field: string, mode: GridCellMode) => void;
|
|
155
|
-
/**
|
|
156
|
-
* Gets the mode of a cell.
|
|
157
|
-
* @param {GridRowId} id The id of the row.
|
|
158
|
-
* @param {string} field The field to get the mode.
|
|
159
|
-
* @returns {GridCellMode} Returns `"edit"` or `"view"`.
|
|
160
|
-
*/
|
|
161
|
-
getCellMode: (id: GridRowId, field: string) => GridCellMode;
|
|
162
|
-
/**
|
|
163
|
-
* Updates the value of a cell and calls `preProcessEditCellProps` if necessary.
|
|
164
|
-
* @param {GridCommitCellChangeParams} params Object with the new value and id and field to update.
|
|
165
|
-
* @returns {Promise<boolean>} Resolves with `true` when the new value is valid.
|
|
166
|
-
* @ignore - do not document.
|
|
167
|
-
*/
|
|
168
|
-
unstable_setCellEditingEditCellValue: (params: GridEditCellValueParams) => Promise<boolean>;
|
|
169
|
-
}
|
|
170
60
|
/**
|
|
171
61
|
* Params passed to `apiRef.current.startCellEditMode`.
|
|
172
62
|
*/
|
|
@@ -183,6 +73,11 @@ export interface GridStartCellEditModeParams {
|
|
|
183
73
|
* If `true`, the value will be deleted before entering the edit mode.
|
|
184
74
|
*/
|
|
185
75
|
deleteValue?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The initial value for the field.
|
|
78
|
+
* If `deleteValue` is also true, this value is not used.
|
|
79
|
+
*/
|
|
80
|
+
initialValue?: any;
|
|
186
81
|
}
|
|
187
82
|
/**
|
|
188
83
|
* Params passed to `apiRef.current.stopCellEditMode`.
|
|
@@ -223,6 +118,11 @@ export interface GridStartRowEditModeParams {
|
|
|
223
118
|
* If `true`, the value in `fieldToFocus` will be deleted before entering the edit mode.
|
|
224
119
|
*/
|
|
225
120
|
deleteValue?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The initial value for the given `fieldToFocus`.
|
|
123
|
+
* If `deleteValue` is also true, this value is not used.
|
|
124
|
+
*/
|
|
125
|
+
initialValue?: string;
|
|
226
126
|
}
|
|
227
127
|
/**
|
|
228
128
|
* Params passed to `apiRef.current.stopRowEditMode`.
|
|
@@ -249,7 +149,17 @@ export interface GridStopRowEditModeParams {
|
|
|
249
149
|
*/
|
|
250
150
|
cellToFocusAfter?: 'none' | 'below' | 'right' | 'left';
|
|
251
151
|
}
|
|
252
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The cell editing API interface.
|
|
154
|
+
*/
|
|
155
|
+
export interface GridCellEditingApi extends GridEditingSharedApi {
|
|
156
|
+
/**
|
|
157
|
+
* Gets the mode of a cell.
|
|
158
|
+
* @param {GridRowId} id The id of the row.
|
|
159
|
+
* @param {string} field The field to get the mode.
|
|
160
|
+
* @returns {GridCellMode} Returns `"edit"` or `"view"`.
|
|
161
|
+
*/
|
|
162
|
+
getCellMode: (id: GridRowId, field: string) => GridCellMode;
|
|
253
163
|
/**
|
|
254
164
|
* Puts the cell corresponding to the given row id and field into edit mode.
|
|
255
165
|
* @param {GridStartCellEditModeParams} params The row id and field of the cell to edit.
|
|
@@ -277,7 +187,16 @@ export interface GridNewCellEditingApi extends GridNewEditingSharedApi, Pick<Gri
|
|
|
277
187
|
*/
|
|
278
188
|
unstable_getRowWithUpdatedValuesFromCellEditing: (id: GridRowId, field: string) => GridRowModel;
|
|
279
189
|
}
|
|
280
|
-
|
|
190
|
+
/**
|
|
191
|
+
* The row editing API interface.
|
|
192
|
+
*/
|
|
193
|
+
export interface GridRowEditingApi extends GridEditingSharedApi {
|
|
194
|
+
/**
|
|
195
|
+
* Gets the mode of a row.
|
|
196
|
+
* @param {GridRowId} id The id of the row.
|
|
197
|
+
* @returns {GridRowMode} Returns `"edit"` or `"view"`.
|
|
198
|
+
*/
|
|
199
|
+
getRowMode: (id: GridRowId) => GridRowMode;
|
|
281
200
|
/**
|
|
282
201
|
* Puts the row corresponding to the given id into edit mode.
|
|
283
202
|
* @param {GridStartCellEditModeParams} params The row id edit.
|
|
@@ -307,9 +226,5 @@ export interface GridNewRowEditingApi extends GridNewEditingSharedApi, Pick<Grid
|
|
|
307
226
|
/**
|
|
308
227
|
* The editing API interface that is available in the grid `apiRef`.
|
|
309
228
|
*/
|
|
310
|
-
export interface GridEditingApi extends GridCellEditingApi, GridRowEditingApi
|
|
311
|
-
}
|
|
312
|
-
export interface GridOldEditingApi extends GridCellEditingApi, GridRowEditingApi {
|
|
313
|
-
}
|
|
314
|
-
export interface GridNewEditingApi extends GridNewCellEditingApi, GridNewRowEditingApi {
|
|
229
|
+
export interface GridEditingApi extends GridCellEditingApi, GridRowEditingApi {
|
|
315
230
|
}
|
package/models/api/index.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export * from './gridCallbackDetails';
|
|
|
21
21
|
export * from './gridScrollApi';
|
|
22
22
|
export * from './gridVirtualScrollerApi';
|
|
23
23
|
export * from './gridApiCommon';
|
|
24
|
-
export type { GridEditingApi,
|
|
24
|
+
export type { GridEditingApi, GridCellModesModel, GridRowModesModel } from './gridEditingApi';
|
|
25
25
|
export declare type GridEditRowApi = GridEditingApi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GridColumnHeaderParams, GridColumnOrderChangeParams, GridColumnResizeParams, GridHeaderSelectionCheckboxParams, GridMenuParams, GridPreferencePanelParams, GridRenderedRowsIntervalChangeParams, GridRowParams, GridRowSelectionCheckboxParams, GridScrollParams } from '../params';
|
|
3
3
|
import { GridCellEditStartParams, GridCellEditStopParams } from '../params/gridEditCellParams';
|
|
4
4
|
import { GridCellParams } from '../params/gridCellParams';
|
|
5
5
|
import type { GridFilterModel } from '../gridFilterModel';
|
|
@@ -433,20 +433,6 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
|
|
|
433
433
|
params: GridCellEditStopParams;
|
|
434
434
|
event: MuiBaseEvent;
|
|
435
435
|
};
|
|
436
|
-
/**
|
|
437
|
-
* Fired when the props of the edit input are committed.
|
|
438
|
-
*/
|
|
439
|
-
cellEditCommit: {
|
|
440
|
-
params: GridCellEditCommitParams;
|
|
441
|
-
event: MuiBaseEvent;
|
|
442
|
-
};
|
|
443
|
-
/**
|
|
444
|
-
* Fired when the props of the edit cell changes.
|
|
445
|
-
*/
|
|
446
|
-
editCellPropsChange: {
|
|
447
|
-
params: GridEditCellPropsParams;
|
|
448
|
-
event: React.SyntheticEvent<HTMLElement> | {};
|
|
449
|
-
};
|
|
450
436
|
/**
|
|
451
437
|
* Fired when the row turns to edit mode.
|
|
452
438
|
*/
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { GridEditCellProps } from '../gridEditRowModel';
|
|
2
1
|
import { GridRowId, GridValidRowModel } from '../gridRows';
|
|
3
2
|
import { GridCellParams } from './gridCellParams';
|
|
4
|
-
export interface GridEditCellPropsParams {
|
|
5
|
-
id: GridRowId;
|
|
6
|
-
field: string;
|
|
7
|
-
props: GridEditCellProps;
|
|
8
|
-
}
|
|
9
3
|
/**
|
|
10
4
|
* Params passed to `apiRef.current.setEditCellValue`.
|
|
11
5
|
*/
|
|
@@ -31,15 +25,6 @@ export interface GridEditCellValueParams {
|
|
|
31
25
|
*/
|
|
32
26
|
unstable_skipValueParser?: boolean;
|
|
33
27
|
}
|
|
34
|
-
export interface GridCommitCellChangeParams {
|
|
35
|
-
id: GridRowId;
|
|
36
|
-
field: string;
|
|
37
|
-
}
|
|
38
|
-
export interface GridCellEditCommitParams {
|
|
39
|
-
id: GridRowId;
|
|
40
|
-
field: string;
|
|
41
|
-
value: any;
|
|
42
|
-
}
|
|
43
28
|
declare enum GridCellEditStartReasons {
|
|
44
29
|
enterKeyDown = "enterKeyDown",
|
|
45
30
|
cellDoubleClick = "cellDoubleClick",
|
|
@@ -52,9 +37,12 @@ declare enum GridCellEditStartReasons {
|
|
|
52
37
|
export interface GridCellEditStartParams<V = any, R extends GridValidRowModel = any, F = V> extends GridCellParams<V, R, F> {
|
|
53
38
|
/**
|
|
54
39
|
* The reason for this event to be triggered.
|
|
55
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
56
40
|
*/
|
|
57
41
|
reason?: GridCellEditStartReasons;
|
|
42
|
+
/**
|
|
43
|
+
* If the reason is related to a keyboard event, it contains which key was pressed.
|
|
44
|
+
*/
|
|
45
|
+
key?: string;
|
|
58
46
|
}
|
|
59
47
|
declare enum GridCellEditStopReasons {
|
|
60
48
|
cellFocusOut = "cellFocusOut",
|
|
@@ -69,7 +57,6 @@ declare enum GridCellEditStopReasons {
|
|
|
69
57
|
export interface GridCellEditStopParams<V = any, R extends GridValidRowModel = any, F = V> extends GridCellParams<V, R, F> {
|
|
70
58
|
/**
|
|
71
59
|
* The reason for this event to be triggered.
|
|
72
|
-
* Only available if `props.experimentalFeatures.newEditingApi: true`.
|
|
73
60
|
*/
|
|
74
61
|
reason?: GridCellEditStopReasons;
|
|
75
62
|
}
|
|
@@ -70,14 +70,16 @@ declare enum GridRowEditStartReasons {
|
|
|
70
70
|
export interface GridRowEditStartParams<R extends GridValidRowModel = any> extends GridRowParams<R> {
|
|
71
71
|
/**
|
|
72
72
|
* Which field triggered this event.
|
|
73
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
74
73
|
*/
|
|
75
74
|
field?: string;
|
|
76
75
|
/**
|
|
77
76
|
* The reason for this event to be triggered.
|
|
78
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
79
77
|
*/
|
|
80
78
|
reason?: GridRowEditStartReasons;
|
|
79
|
+
/**
|
|
80
|
+
* If the reason is related to a keyboard event, it contains which key was pressed.
|
|
81
|
+
*/
|
|
82
|
+
key?: string;
|
|
81
83
|
}
|
|
82
84
|
declare enum GridRowEditStopReasons {
|
|
83
85
|
rowFocusOut = "rowFocusOut",
|
|
@@ -89,12 +91,10 @@ declare enum GridRowEditStopReasons {
|
|
|
89
91
|
export interface GridRowEditStopParams<R extends GridValidRowModel = any> extends GridRowParams<R> {
|
|
90
92
|
/**
|
|
91
93
|
* Which field triggered this event.
|
|
92
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
93
94
|
*/
|
|
94
95
|
field?: string;
|
|
95
96
|
/**
|
|
96
97
|
* The reason for this event to be triggered.
|
|
97
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
98
98
|
*/
|
|
99
99
|
reason?: GridRowEditStopReasons;
|
|
100
100
|
}
|
|
@@ -25,14 +25,6 @@ import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColu
|
|
|
25
25
|
import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
|
|
26
26
|
import { GridColumnGroupingModel } from '../gridColumnGrouping';
|
|
27
27
|
export interface GridExperimentalFeatures {
|
|
28
|
-
/**
|
|
29
|
-
* Will be part of the premium-plan when fully ready.
|
|
30
|
-
*/
|
|
31
|
-
preventCommitWhileValidating: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Enables the new API for cell editing and row editing.
|
|
34
|
-
*/
|
|
35
|
-
newEditingApi: boolean;
|
|
36
28
|
/**
|
|
37
29
|
* Enables the column grouping.
|
|
38
30
|
*/
|
|
@@ -391,21 +383,6 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
391
383
|
* @returns {boolean} A boolean indicating if the cell is selectable.
|
|
392
384
|
*/
|
|
393
385
|
isRowSelectable?: (params: GridRowParams<R>) => boolean;
|
|
394
|
-
/**
|
|
395
|
-
* Callback fired when the edit cell value changes.
|
|
396
|
-
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
397
|
-
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
398
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
399
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
400
|
-
*/
|
|
401
|
-
onEditCellPropsChange?: GridEventListener<'editCellPropsChange'>;
|
|
402
|
-
/**
|
|
403
|
-
* Callback fired when the cell changes are committed.
|
|
404
|
-
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
|
|
405
|
-
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
|
|
406
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
407
|
-
*/
|
|
408
|
-
onCellEditCommit?: GridEventListener<'cellEditCommit'>;
|
|
409
386
|
/**
|
|
410
387
|
* Callback fired when the cell turns to edit mode.
|
|
411
388
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -725,7 +702,6 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
725
702
|
experimentalFeatures?: Partial<GridExperimentalFeatures>;
|
|
726
703
|
/**
|
|
727
704
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
728
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
729
705
|
* @template R
|
|
730
706
|
* @param {R} newRow Row object with the new values.
|
|
731
707
|
* @param {R} oldRow Row object with the old values.
|
|
@@ -196,8 +196,6 @@ DataGridRaw.propTypes = {
|
|
|
196
196
|
*/
|
|
197
197
|
experimentalFeatures: PropTypes.shape({
|
|
198
198
|
columnGrouping: PropTypes.bool,
|
|
199
|
-
newEditingApi: PropTypes.bool,
|
|
200
|
-
preventCommitWhileValidating: PropTypes.bool,
|
|
201
199
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
202
200
|
}),
|
|
203
201
|
|
|
@@ -374,14 +372,6 @@ DataGridRaw.propTypes = {
|
|
|
374
372
|
*/
|
|
375
373
|
onCellDoubleClick: PropTypes.func,
|
|
376
374
|
|
|
377
|
-
/**
|
|
378
|
-
* Callback fired when the cell changes are committed.
|
|
379
|
-
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
|
|
380
|
-
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
|
|
381
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
382
|
-
*/
|
|
383
|
-
onCellEditCommit: PropTypes.func,
|
|
384
|
-
|
|
385
375
|
/**
|
|
386
376
|
* Callback fired when the cell turns to edit mode.
|
|
387
377
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -482,15 +472,6 @@ DataGridRaw.propTypes = {
|
|
|
482
472
|
*/
|
|
483
473
|
onColumnVisibilityModelChange: PropTypes.func,
|
|
484
474
|
|
|
485
|
-
/**
|
|
486
|
-
* Callback fired when the edit cell value changes.
|
|
487
|
-
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
488
|
-
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
489
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
490
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
491
|
-
*/
|
|
492
|
-
onEditCellPropsChange: PropTypes.func,
|
|
493
|
-
|
|
494
475
|
/**
|
|
495
476
|
* Callback fired when the `editRowsModel` changes.
|
|
496
477
|
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
|
|
@@ -677,7 +658,6 @@ DataGridRaw.propTypes = {
|
|
|
677
658
|
|
|
678
659
|
/**
|
|
679
660
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
680
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
681
661
|
* @template R
|
|
682
662
|
* @param {R} newRow Row object with the new values.
|
|
683
663
|
* @param {R} oldRow Row object with the old values.
|
|
@@ -11,8 +11,7 @@ import { focusStateInitializer, useGridFocus } from '../hooks/features/focus/use
|
|
|
11
11
|
import { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
12
12
|
import { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
13
13
|
import { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
14
|
-
import { useGridEditing
|
|
15
|
-
import { useGridEditing as useGridEditing_new, editingStateInitializer as editingStateInitializer_new } from '../hooks/features/editRows/useGridEditing.new';
|
|
14
|
+
import { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
|
|
16
15
|
import { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
17
16
|
import { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
18
17
|
import { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
@@ -44,7 +43,7 @@ export const useDataGridComponent = props => {
|
|
|
44
43
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
45
44
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
46
45
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
47
|
-
useGridInitializeState(
|
|
46
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
48
47
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
49
48
|
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
50
49
|
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
@@ -60,7 +59,6 @@ export const useDataGridComponent = props => {
|
|
|
60
59
|
useGridParamsApi(apiRef);
|
|
61
60
|
useGridColumnSpanning(apiRef);
|
|
62
61
|
useGridColumnGrouping(apiRef, props);
|
|
63
|
-
const useGridEditing = props.experimentalFeatures?.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
64
62
|
useGridEditing(apiRef, props);
|
|
65
63
|
useGridFocus(apiRef, props);
|
|
66
64
|
useGridPreferencesPanel(apiRef, props);
|
|
@@ -10,7 +10,6 @@ import InputBase from '@mui/material/InputBase';
|
|
|
10
10
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridLoadIcon } from '../icons/index';
|
|
13
|
-
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
14
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
|
|
@@ -46,7 +45,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
46
45
|
field,
|
|
47
46
|
colDef,
|
|
48
47
|
hasFocus,
|
|
49
|
-
debounceMs =
|
|
48
|
+
debounceMs = 200,
|
|
50
49
|
isProcessingProps,
|
|
51
50
|
onValueChange
|
|
52
51
|
} = props,
|
|
@@ -69,7 +68,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
69
68
|
const column = apiRef.current.getColumn(field);
|
|
70
69
|
let parsedValue = newValue;
|
|
71
70
|
|
|
72
|
-
if (column.valueParser
|
|
71
|
+
if (column.valueParser) {
|
|
73
72
|
parsedValue = column.valueParser(newValue, apiRef.current.getCellParams(id, field));
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -81,7 +80,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
81
80
|
debounceMs,
|
|
82
81
|
unstable_skipValueParser: true
|
|
83
82
|
}, event);
|
|
84
|
-
}, [apiRef, debounceMs, field, id, onValueChange
|
|
83
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
85
84
|
const meta = apiRef.current.unstable_getEditCellMeta ? apiRef.current.unstable_getEditCellMeta(id, field) : {};
|
|
86
85
|
React.useEffect(() => {
|
|
87
86
|
if (meta.changeReason !== 'debouncedSetEditCellValue') {
|
|
@@ -90,35 +90,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
90
90
|
await onValueChange(event, formattedTargetValue);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
await apiRef.current.setEditCellValue({
|
|
94
94
|
id,
|
|
95
95
|
field,
|
|
96
96
|
value: formattedTargetValue
|
|
97
97
|
}, event);
|
|
98
|
-
|
|
99
|
-
if (rootProps.experimentalFeatures?.newEditingApi) {
|
|
100
|
-
return;
|
|
101
|
-
} // We use isValid === false because the default return is undefined which evaluates to true with !isValid
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (rootProps.editMode === GridEditModes.Row || isValid === false) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
109
|
-
id,
|
|
110
|
-
field
|
|
111
|
-
}, event));
|
|
112
|
-
|
|
113
|
-
if (canCommit) {
|
|
114
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
115
|
-
|
|
116
|
-
if (event.key) {
|
|
117
|
-
// TODO v6: remove once we stop ignoring events fired from portals
|
|
118
|
-
const params = apiRef.current.getCellParams(id, field);
|
|
119
|
-
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
98
|
};
|
|
123
99
|
|
|
124
100
|
const handleClose = (event, reason) => {
|
|
@@ -128,15 +104,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
128
104
|
}
|
|
129
105
|
|
|
130
106
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
} else {
|
|
138
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
139
|
-
}
|
|
107
|
+
apiRef.current.stopCellEditMode({
|
|
108
|
+
id,
|
|
109
|
+
field,
|
|
110
|
+
ignoreModifications: true
|
|
111
|
+
});
|
|
140
112
|
}
|
|
141
113
|
};
|
|
142
114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
|
|
3
|
+
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "filterColumns", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
|
|
4
4
|
_excluded2 = ["InputComponentProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -13,6 +13,7 @@ import { capitalize, unstable_useId as useId } from '@mui/material/utils';
|
|
|
13
13
|
import { styled } from '@mui/material/styles';
|
|
14
14
|
import clsx from 'clsx';
|
|
15
15
|
import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
16
|
+
import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilterSelector';
|
|
16
17
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
17
18
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
18
19
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
@@ -118,6 +119,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
118
119
|
focusElementRef,
|
|
119
120
|
linkOperators = [GridLinkOperator.And, GridLinkOperator.Or],
|
|
120
121
|
columnsSort,
|
|
122
|
+
filterColumns,
|
|
121
123
|
deleteIconProps = {},
|
|
122
124
|
linkOperatorInputProps = {},
|
|
123
125
|
operatorInputProps = {},
|
|
@@ -128,6 +130,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
128
130
|
|
|
129
131
|
const apiRef = useGridApiContext();
|
|
130
132
|
const filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
|
|
133
|
+
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
131
134
|
const columnSelectId = useId();
|
|
132
135
|
const columnSelectLabelId = useId();
|
|
133
136
|
const operatorSelectId = useId();
|
|
@@ -150,18 +153,30 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
150
153
|
} = valueInputProps,
|
|
151
154
|
valueInputPropsOther = _objectWithoutPropertiesLoose(valueInputProps, _excluded2);
|
|
152
155
|
|
|
153
|
-
const
|
|
156
|
+
const filteredColumns = React.useMemo(() => {
|
|
157
|
+
if (filterColumns === undefined || typeof filterColumns !== 'function') {
|
|
158
|
+
return filterableColumns;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const filteredFields = filterColumns({
|
|
162
|
+
field: item.columnField,
|
|
163
|
+
columns: filterableColumns,
|
|
164
|
+
currentFilters: filterModel?.items || []
|
|
165
|
+
});
|
|
166
|
+
return filterableColumns.filter(column => filteredFields.includes(column.field));
|
|
167
|
+
}, [filterColumns, filterModel?.items, filterableColumns, item.columnField]);
|
|
168
|
+
const sortedFilteredColumns = React.useMemo(() => {
|
|
154
169
|
switch (columnsSort) {
|
|
155
170
|
case 'asc':
|
|
156
|
-
return
|
|
171
|
+
return filteredColumns.sort((a, b) => collator.compare(getColumnLabel(a), getColumnLabel(b)));
|
|
157
172
|
|
|
158
173
|
case 'desc':
|
|
159
|
-
return
|
|
174
|
+
return filteredColumns.sort((a, b) => -collator.compare(getColumnLabel(a), getColumnLabel(b)));
|
|
160
175
|
|
|
161
176
|
default:
|
|
162
|
-
return
|
|
177
|
+
return filteredColumns;
|
|
163
178
|
}
|
|
164
|
-
}, [
|
|
179
|
+
}, [filteredColumns, columnsSort]);
|
|
165
180
|
const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
166
181
|
const currentOperator = React.useMemo(() => {
|
|
167
182
|
if (!item.operatorValue || !currentColumn) {
|
|
@@ -286,7 +301,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
286
301
|
onChange: changeColumn,
|
|
287
302
|
native: isBaseSelectNative
|
|
288
303
|
}, rootProps.componentsProps?.baseSelect, {
|
|
289
|
-
children:
|
|
304
|
+
children: sortedFilteredColumns.map(col => /*#__PURE__*/_jsx(OptionComponent, {
|
|
290
305
|
value: col.field,
|
|
291
306
|
children: getColumnLabel(col)
|
|
292
307
|
}, col.field))
|
|
@@ -380,6 +395,13 @@ process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
|
|
|
380
395
|
*/
|
|
381
396
|
disableMultiFilterOperator: PropTypes.bool,
|
|
382
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Allows to filter the columns displayed in the filter form.
|
|
400
|
+
* @param {FilterColumnsArgs} args The columns of the grid and name of field.
|
|
401
|
+
* @returns {GridColDef['field'][]} The filtered fields array.
|
|
402
|
+
*/
|
|
403
|
+
filterColumns: PropTypes.func,
|
|
404
|
+
|
|
383
405
|
/**
|
|
384
406
|
* A ref allowing to set imperative focus.
|
|
385
407
|
* It can be passed to the el
|