@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,11 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { GridFilterItem } from '../../../models/gridFilterItem';
|
|
3
4
|
import { GridFilterFormProps } from './GridFilterForm';
|
|
5
|
+
import { GridColDef, GridStateColDef } from '../../../models/colDef/gridColDef';
|
|
6
|
+
export interface GetColumnForNewFilterArgs {
|
|
7
|
+
currentFilters: GridFilterItem[];
|
|
8
|
+
columns: GridStateColDef[];
|
|
9
|
+
}
|
|
4
10
|
export interface GridFilterPanelProps extends Pick<GridFilterFormProps, 'linkOperators' | 'columnsSort'> {
|
|
5
11
|
/**
|
|
6
12
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
7
13
|
*/
|
|
8
14
|
sx?: SxProps<Theme>;
|
|
15
|
+
/**
|
|
16
|
+
* Function that returns the next filter item to be picked as default filter.
|
|
17
|
+
* @param {GetColumnForNewFilterArgs} args Currently configured filters and columns.
|
|
18
|
+
* @returns {GridColDef['field']} The field to be used for the next filter.
|
|
19
|
+
*/
|
|
20
|
+
getColumnForNewFilter?: (args: GetColumnForNewFilterArgs) => GridColDef['field'];
|
|
9
21
|
/**
|
|
10
22
|
* Props passed to each filter form.
|
|
11
23
|
*/
|
|
@@ -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 = ["linkOperators", "columnsSort", "filterFormProps", "children"];
|
|
3
|
+
const _excluded = ["linkOperators", "columnsSort", "filterFormProps", "getColumnForNewFilter", "children"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
@@ -16,6 +16,13 @@ import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilt
|
|
|
16
16
|
import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
|
|
20
|
+
const getGridFilter = col => ({
|
|
21
|
+
columnField: col.field,
|
|
22
|
+
operatorValue: col.filterOperators[0].value,
|
|
23
|
+
id: Math.round(Math.random() * 1e5)
|
|
24
|
+
});
|
|
25
|
+
|
|
19
26
|
const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
20
27
|
var _rootProps$components;
|
|
21
28
|
|
|
@@ -28,7 +35,8 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
28
35
|
const {
|
|
29
36
|
linkOperators = [GridLinkOperator.And, GridLinkOperator.Or],
|
|
30
37
|
columnsSort,
|
|
31
|
-
filterFormProps
|
|
38
|
+
filterFormProps,
|
|
39
|
+
getColumnForNewFilter
|
|
32
40
|
} = props,
|
|
33
41
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
34
42
|
|
|
@@ -38,41 +46,71 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
38
46
|
const applyFilterLinkOperator = React.useCallback(operator => {
|
|
39
47
|
apiRef.current.setFilterLinkOperator(operator);
|
|
40
48
|
}, [apiRef]);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const getDefaultFilter = React.useCallback(() => {
|
|
50
|
+
let nextColumnWithOperator;
|
|
51
|
+
|
|
52
|
+
if (getColumnForNewFilter && typeof getColumnForNewFilter === 'function') {
|
|
53
|
+
// To allow override the column for default (first) filter
|
|
54
|
+
const nextColumnFieldName = getColumnForNewFilter({
|
|
55
|
+
currentFilters: (filterModel == null ? void 0 : filterModel.items) || [],
|
|
56
|
+
columns: filterableColumns
|
|
57
|
+
});
|
|
58
|
+
nextColumnWithOperator = filterableColumns.find(({
|
|
59
|
+
field
|
|
60
|
+
}) => field === nextColumnFieldName);
|
|
61
|
+
} else {
|
|
62
|
+
nextColumnWithOperator = filterableColumns.find(colDef => {
|
|
63
|
+
var _colDef$filterOperato;
|
|
64
|
+
|
|
65
|
+
return (_colDef$filterOperato = colDef.filterOperators) == null ? void 0 : _colDef$filterOperato.length;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!nextColumnWithOperator) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
44
72
|
|
|
45
|
-
|
|
73
|
+
return getGridFilter(nextColumnWithOperator);
|
|
74
|
+
}, [filterModel == null ? void 0 : filterModel.items, filterableColumns, getColumnForNewFilter]);
|
|
75
|
+
const getNewFilter = React.useCallback(() => {
|
|
76
|
+
if (getColumnForNewFilter === undefined || typeof getColumnForNewFilter !== 'function') {
|
|
77
|
+
return getDefaultFilter();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const currentFilters = filterModel.items.length ? filterModel.items : [getDefaultFilter()].filter(Boolean); // If no items are there in filterModel, we have to pass defaultFilter
|
|
81
|
+
|
|
82
|
+
const nextColumnFieldName = getColumnForNewFilter({
|
|
83
|
+
currentFilters: currentFilters,
|
|
84
|
+
columns: filterableColumns
|
|
46
85
|
});
|
|
86
|
+
const nextColumnWithOperator = filterableColumns.find(({
|
|
87
|
+
field
|
|
88
|
+
}) => field === nextColumnFieldName);
|
|
47
89
|
|
|
48
|
-
if (!
|
|
90
|
+
if (!nextColumnWithOperator) {
|
|
49
91
|
return null;
|
|
50
92
|
}
|
|
51
93
|
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
operatorValue: firstColumnWithOperator.filterOperators[0].value,
|
|
55
|
-
id: Math.round(Math.random() * 1e5)
|
|
56
|
-
};
|
|
57
|
-
}, [filterableColumns]);
|
|
94
|
+
return getGridFilter(nextColumnWithOperator);
|
|
95
|
+
}, [filterModel.items, filterableColumns, getColumnForNewFilter, getDefaultFilter]);
|
|
58
96
|
const items = React.useMemo(() => {
|
|
59
97
|
if (filterModel.items.length) {
|
|
60
98
|
return filterModel.items;
|
|
61
99
|
}
|
|
62
100
|
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
}, [filterModel.items,
|
|
101
|
+
const defaultFilter = getDefaultFilter();
|
|
102
|
+
return defaultFilter ? [defaultFilter] : [];
|
|
103
|
+
}, [filterModel.items, getDefaultFilter]);
|
|
66
104
|
const hasMultipleFilters = items.length > 1;
|
|
67
105
|
|
|
68
106
|
const addNewFilter = () => {
|
|
69
|
-
const
|
|
107
|
+
const newFilter = getNewFilter();
|
|
70
108
|
|
|
71
|
-
if (!
|
|
109
|
+
if (!newFilter) {
|
|
72
110
|
return;
|
|
73
111
|
}
|
|
74
112
|
|
|
75
|
-
apiRef.current.upsertFilterItems([...items,
|
|
113
|
+
apiRef.current.upsertFilterItems([...items, newFilter]);
|
|
76
114
|
};
|
|
77
115
|
|
|
78
116
|
const deleteFilter = React.useCallback(item => {
|
|
@@ -149,6 +187,13 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
149
187
|
valueInputProps: PropTypes.any
|
|
150
188
|
}),
|
|
151
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Function that returns the next filter item to be picked as default filter.
|
|
192
|
+
* @param {GetColumnForNewFilterArgs} args Currently configured filters and columns.
|
|
193
|
+
* @returns {GridColDef['field']} The field to be used for the next filter.
|
|
194
|
+
*/
|
|
195
|
+
getColumnForNewFilter: PropTypes.func,
|
|
196
|
+
|
|
152
197
|
/**
|
|
153
198
|
* Sets the available logic operators.
|
|
154
199
|
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridRegisterPipeApplier: <Api extends GridApiCommon, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: () => void) => void;
|
|
3
|
+
export declare const useGridRegisterPipeApplier: <Api extends GridApiCommon<any, any>, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: () => void) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPipeProcessor } from './gridPipeProcessingApi';
|
|
4
|
-
export declare const useGridRegisterPipeProcessor: <Api extends GridApiCommon, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: GridPipeProcessor<G>) => void;
|
|
4
|
+
export declare const useGridRegisterPipeProcessor: <Api extends GridApiCommon<any, any>, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: GridPipeProcessor<G>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridStrategyProcessor } from './gridStrategyProcessingApi';
|
|
4
|
-
export declare const useGridRegisterStrategyProcessor: <Api extends GridApiCommon, G extends keyof import("./gridStrategyProcessingApi").GridStrategyProcessingLookup>(apiRef: React.MutableRefObject<Api>, strategyName: string, group: G, processor: GridStrategyProcessor<G>) => void;
|
|
4
|
+
export declare const useGridRegisterStrategyProcessor: <Api extends GridApiCommon<any, any>, G extends keyof import("./gridStrategyProcessingApi").GridStrategyProcessingLookup>(apiRef: React.MutableRefObject<Api>, strategyName: string, group: G, processor: GridStrategyProcessor<G>) => void;
|
|
@@ -4,4 +4,4 @@ import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
|
4
4
|
/**
|
|
5
5
|
* Initialize the technical pieces of the DataGrid (logger, state, ...) that any DataGrid implementation needs
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridInitialization: <Api extends GridApiCommon
|
|
7
|
+
export declare const useGridInitialization: <Api extends GridApiCommon<any, any>>(inputApiRef: React.MutableRefObject<Api> | undefined, props: Pick<DataGridProcessedProps, 'signature' | 'logger' | 'logLevel' | 'error' | 'localeText'>) => React.MutableRefObject<Api>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
4
|
-
export declare const useGridStateInitialization: <Api extends GridApiCommon
|
|
4
|
+
export declare const useGridStateInitialization: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'signature'>) => void;
|
package/hooks/features/{editRows/gridEditRowsSelector.d.ts → editing/gridEditingSelectors.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridEditingSelectors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridEditingSelectors';
|
package/hooks/features/{editRows/useGridCellEditing.new.d.ts → editing/useGridCellEditing.d.ts}
RENAMED
|
File without changes
|
|
@@ -8,7 +8,7 @@ import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
|
8
8
|
import { useGridApiEventHandler, useGridApiOptionHandler, GridSignature } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
11
|
-
import { gridEditRowsStateSelector } from './
|
|
11
|
+
import { gridEditRowsStateSelector } from './gridEditingSelectors';
|
|
12
12
|
import { isPrintableKey } from '../../../utils/keyboardUtils';
|
|
13
13
|
import { buildWarning } from '../../../utils/warning';
|
|
14
14
|
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
@@ -121,7 +121,8 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
121
121
|
|
|
122
122
|
if (reason) {
|
|
123
123
|
const newParams = _extends({}, params, {
|
|
124
|
-
reason
|
|
124
|
+
reason,
|
|
125
|
+
key: event.key
|
|
125
126
|
});
|
|
126
127
|
|
|
127
128
|
apiRef.current.publishEvent('cellEditStart', newParams, event);
|
|
@@ -132,14 +133,21 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
132
133
|
const {
|
|
133
134
|
id,
|
|
134
135
|
field,
|
|
135
|
-
reason
|
|
136
|
+
reason,
|
|
137
|
+
key
|
|
136
138
|
} = params;
|
|
137
139
|
const startCellEditModeParams = {
|
|
138
140
|
id,
|
|
139
141
|
field
|
|
140
142
|
};
|
|
141
143
|
|
|
142
|
-
if (reason === GridCellEditStartReasons.
|
|
144
|
+
if (reason === GridCellEditStartReasons.printableKeyDown) {
|
|
145
|
+
if (React.version.startsWith('18')) {
|
|
146
|
+
startCellEditModeParams.initialValue = key; // In React 17, cleaning the input is enough
|
|
147
|
+
} else {
|
|
148
|
+
startCellEditModeParams.deleteValue = true;
|
|
149
|
+
}
|
|
150
|
+
} else if (reason === GridCellEditStartReasons.deleteKeyDown) {
|
|
143
151
|
startCellEditModeParams.deleteValue = true;
|
|
144
152
|
}
|
|
145
153
|
|
|
@@ -270,10 +278,17 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
270
278
|
const {
|
|
271
279
|
id,
|
|
272
280
|
field,
|
|
273
|
-
deleteValue
|
|
281
|
+
deleteValue,
|
|
282
|
+
initialValue
|
|
274
283
|
} = params;
|
|
284
|
+
let newValue = apiRef.current.getCellValue(id, field);
|
|
285
|
+
|
|
286
|
+
if (deleteValue || initialValue) {
|
|
287
|
+
newValue = deleteValue ? '' : initialValue;
|
|
288
|
+
}
|
|
289
|
+
|
|
275
290
|
const newProps = {
|
|
276
|
-
value:
|
|
291
|
+
value: newValue,
|
|
277
292
|
error: false,
|
|
278
293
|
isProcessingProps: false
|
|
279
294
|
};
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
4
|
-
import { useGridCellEditing } from './useGridCellEditing
|
|
4
|
+
import { useGridCellEditing } from './useGridCellEditing';
|
|
5
5
|
import { GridCellModes, GridEditModes } from '../../../models/gridEditRowModel';
|
|
6
|
-
import { useGridRowEditing } from './useGridRowEditing
|
|
7
|
-
import { gridEditRowsStateSelector } from './
|
|
6
|
+
import { useGridRowEditing } from './useGridRowEditing';
|
|
7
|
+
import { gridEditRowsStateSelector } from './gridEditingSelectors';
|
|
8
8
|
import { isAutoGeneratedRow } from '../rows/gridRowsUtils';
|
|
9
9
|
export const editingStateInitializer = state => _extends({}, state, {
|
|
10
10
|
editRows: {}
|
package/hooks/features/{editRows/useGridRowEditing.new.d.ts → editing/useGridRowEditing.d.ts}
RENAMED
|
File without changes
|
|
@@ -8,7 +8,7 @@ import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
|
8
8
|
import { useGridApiEventHandler, useGridApiOptionHandler, GridSignature } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridEditModes, GridRowModes } from '../../../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
11
|
-
import { gridEditRowsStateSelector } from './
|
|
11
|
+
import { gridEditRowsStateSelector } from './gridEditingSelectors';
|
|
12
12
|
import { isPrintableKey } from '../../../utils/keyboardUtils';
|
|
13
13
|
import { gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
|
|
14
14
|
import { buildWarning } from '../../../utils/warning';
|
|
@@ -181,6 +181,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
181
181
|
|
|
182
182
|
const newParams = _extends({}, rowParams, {
|
|
183
183
|
field: params.field,
|
|
184
|
+
key: event.key,
|
|
184
185
|
reason
|
|
185
186
|
});
|
|
186
187
|
|
|
@@ -192,14 +193,21 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
192
193
|
const {
|
|
193
194
|
id,
|
|
194
195
|
field,
|
|
195
|
-
reason
|
|
196
|
+
reason,
|
|
197
|
+
key
|
|
196
198
|
} = params;
|
|
197
199
|
const startRowEditModeParams = {
|
|
198
200
|
id,
|
|
199
201
|
fieldToFocus: field
|
|
200
202
|
};
|
|
201
203
|
|
|
202
|
-
if (reason === GridRowEditStartReasons.
|
|
204
|
+
if (reason === GridRowEditStartReasons.printableKeyDown) {
|
|
205
|
+
if (React.version.startsWith('18')) {
|
|
206
|
+
startRowEditModeParams.initialValue = key; // In React 17, cleaning the input is enough
|
|
207
|
+
} else {
|
|
208
|
+
startRowEditModeParams.deleteValue = !!field;
|
|
209
|
+
}
|
|
210
|
+
} else if (reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
203
211
|
startRowEditModeParams.deleteValue = !!field;
|
|
204
212
|
}
|
|
205
213
|
|
|
@@ -339,7 +347,8 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
339
347
|
const {
|
|
340
348
|
id,
|
|
341
349
|
fieldToFocus,
|
|
342
|
-
deleteValue
|
|
350
|
+
deleteValue,
|
|
351
|
+
initialValue
|
|
343
352
|
} = params;
|
|
344
353
|
const columnFields = gridColumnFieldsSelector(apiRef);
|
|
345
354
|
const newProps = columnFields.reduce((acc, field) => {
|
|
@@ -349,9 +358,14 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
349
358
|
return acc;
|
|
350
359
|
}
|
|
351
360
|
|
|
352
|
-
|
|
361
|
+
let newValue = apiRef.current.getCellValue(id, field);
|
|
362
|
+
|
|
363
|
+
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
364
|
+
newValue = deleteValue ? '' : initialValue;
|
|
365
|
+
}
|
|
366
|
+
|
|
353
367
|
acc[field] = {
|
|
354
|
-
value:
|
|
368
|
+
value: newValue,
|
|
355
369
|
error: false,
|
|
356
370
|
isProcessingProps: false
|
|
357
371
|
};
|
|
@@ -2,7 +2,7 @@ export * from './columnMenu';
|
|
|
2
2
|
export * from './columns';
|
|
3
3
|
export * from './columnGrouping';
|
|
4
4
|
export * from './density';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './editing';
|
|
6
6
|
export * from './filter';
|
|
7
7
|
export * from './focus';
|
|
8
8
|
export * from './pagination';
|
package/hooks/features/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export * from './columnMenu';
|
|
|
3
3
|
export * from './columns';
|
|
4
4
|
export * from './columnGrouping';
|
|
5
5
|
export * from './density';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './editing';
|
|
7
7
|
export * from './filter';
|
|
8
8
|
export * from './focus';
|
|
9
9
|
export * from './pagination';
|
|
@@ -35,7 +35,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
35
35
|
getRootProps: ({ style, ...other }?: {
|
|
36
36
|
style?: {} | undefined;
|
|
37
37
|
}) => {
|
|
38
|
-
ref:
|
|
38
|
+
ref: ((instance: HTMLDivElement | null) => void) | null;
|
|
39
39
|
onScroll: (event: React.UIEvent) => void;
|
|
40
40
|
onWheel: (event: React.WheelEvent) => void;
|
|
41
41
|
onTouchMove: (event: React.TouchEvent) => void;
|
|
@@ -9,7 +9,7 @@ import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
|
9
9
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
10
10
|
import { gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector } from '../columns/gridColumnsSelector';
|
|
11
11
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
|
|
12
|
-
import { gridEditRowsStateSelector } from '../
|
|
12
|
+
import { gridEditRowsStateSelector } from '../editing/gridEditingSelectors';
|
|
13
13
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
14
14
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
15
15
|
import { clamp } from '../../../utils/utils';
|
|
@@ -3,4 +3,4 @@ import { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `apiRef.current` instead.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useGridApi: <Api extends GridApiCommon
|
|
6
|
+
export declare const useGridApi: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>) => Api;
|
|
@@ -14,8 +14,8 @@ declare enum GridSignature {
|
|
|
14
14
|
interface RegistryContainer {
|
|
15
15
|
registry: CleanupTracking | null;
|
|
16
16
|
}
|
|
17
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
17
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
18
18
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
19
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
19
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
20
20
|
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
21
21
|
export { GridSignature };
|
|
@@ -4,4 +4,4 @@ import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
|
4
4
|
/**
|
|
5
5
|
* Hook that instantiate a [[GridApiRef]].
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => React.MutableRefObject<Api>;
|
|
7
|
+
export declare const useGridApiRef: <Api extends GridApiCommon<any, any> = GridApiCommunity>() => React.MutableRefObject<Api>;
|
|
@@ -6,5 +6,5 @@ declare type DeepPartial<T> = {
|
|
|
6
6
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
7
|
};
|
|
8
8
|
export declare type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, Api extends GridApiCommon = GridApiCommunity> = (state: DeepPartial<Api['state']>, props: P, apiRef: React.MutableRefObject<Api>) => DeepPartial<Api['state']>;
|
|
9
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps<any>>, Api extends GridApiCommon = GridApiCommunity>(initializer: GridStateInitializer<P, Api>, apiRef: React.MutableRefObject<Api>, props: P) => void;
|
|
9
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps<any>>, Api extends GridApiCommon<any, any> = GridApiCommunity>(initializer: GridStateInitializer<P, Api>, apiRef: React.MutableRefObject<Api>, props: P) => void;
|
|
10
10
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../models';
|
|
3
|
-
export declare const useGridNativeEventListener: <Api extends GridApiCommon, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: ((event: HTMLElementEventMap[K]) => any) | undefined, options?: AddEventListenerOptions) => void;
|
|
3
|
+
export declare const useGridNativeEventListener: <Api extends GridApiCommon<any, any>, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: ((event: HTMLElementEventMap[K]) => any) | undefined, options?: AddEventListenerOptions) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { OutputSelector } from '../../utils/createSelector';
|
|
4
|
-
export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef: React.MutableRefObject<Api>, selector: OutputSelector<Api["state"], T> | ((state: Api["state"]) => T)) => T;
|
|
4
|
+
export declare const useGridSelector: <Api extends GridApiCommon<any, any>, T>(apiRef: React.MutableRefObject<Api>, selector: OutputSelector<Api["state"], T> | ((state: Api["state"]) => T)) => T;
|
|
@@ -4,4 +4,4 @@ import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use `apiRef.current.state`, `apiRef.current.setState` and `apiRef.current.forceUpdate` instead.
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridState: <Api extends GridApiCommon = GridApiCommunity>(apiRef: React.MutableRefObject<Api>) => readonly [any, any,
|
|
7
|
+
export declare const useGridState: <Api extends GridApiCommon<any, any> = GridApiCommunity>(apiRef: React.MutableRefObject<Api>) => readonly [any, <S extends any, K extends "filter">(state: S | ((previousState: S) => S), reason?: import("../..").GridControlledStateReasonLookup[K] | undefined) => boolean, () => void];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon, GridRowEntry } from '../../models';
|
|
4
|
-
export declare const getVisibleRows: <Api extends GridApiCommon
|
|
4
|
+
export declare const getVisibleRows: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
|
|
5
5
|
rows: GridRowEntry<import("../../models").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
@@ -15,7 +15,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.M
|
|
|
15
15
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
16
16
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
17
17
|
*/
|
|
18
|
-
export declare const useGridVisibleRows: <Api extends GridApiCommon
|
|
18
|
+
export declare const useGridVisibleRows: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
|
|
19
19
|
rows: GridRowEntry<import("../../models").GridValidRowModel>[];
|
|
20
20
|
range: {
|
|
21
21
|
firstRowIndex: number;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -26,8 +26,7 @@ export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/use
|
|
|
26
26
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
27
27
|
export { useGridPagination, paginationStateInitializer, } from '../hooks/features/pagination/useGridPagination';
|
|
28
28
|
export { useGridPreferencesPanel, preferencePanelStateInitializer, } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
29
|
-
export { useGridEditing
|
|
30
|
-
export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old, } from '../hooks/features/editRows/useGridEditing.old';
|
|
29
|
+
export { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
|
|
31
30
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
32
31
|
export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
33
32
|
export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridRowTreeUpdatedGroupsManager, GridRowTreeUpdateGroupAction, GridPinnedRowsState, } from '../hooks/features/rows/gridRowsInterfaces';
|
package/internals/index.js
CHANGED
|
@@ -22,8 +22,7 @@ export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/use
|
|
|
22
22
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
23
23
|
export { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
24
24
|
export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
25
|
-
export { useGridEditing
|
|
26
|
-
export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old } from '../hooks/features/editRows/useGridEditing.old';
|
|
25
|
+
export { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
|
|
27
26
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
28
27
|
export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
29
28
|
export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
|
|
@@ -198,8 +198,6 @@ DataGridRaw.propTypes = {
|
|
|
198
198
|
*/
|
|
199
199
|
experimentalFeatures: PropTypes.shape({
|
|
200
200
|
columnGrouping: PropTypes.bool,
|
|
201
|
-
newEditingApi: PropTypes.bool,
|
|
202
|
-
preventCommitWhileValidating: PropTypes.bool,
|
|
203
201
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
204
202
|
}),
|
|
205
203
|
|
|
@@ -376,14 +374,6 @@ DataGridRaw.propTypes = {
|
|
|
376
374
|
*/
|
|
377
375
|
onCellDoubleClick: PropTypes.func,
|
|
378
376
|
|
|
379
|
-
/**
|
|
380
|
-
* Callback fired when the cell changes are committed.
|
|
381
|
-
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
|
|
382
|
-
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
|
|
383
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
384
|
-
*/
|
|
385
|
-
onCellEditCommit: PropTypes.func,
|
|
386
|
-
|
|
387
377
|
/**
|
|
388
378
|
* Callback fired when the cell turns to edit mode.
|
|
389
379
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -484,15 +474,6 @@ DataGridRaw.propTypes = {
|
|
|
484
474
|
*/
|
|
485
475
|
onColumnVisibilityModelChange: PropTypes.func,
|
|
486
476
|
|
|
487
|
-
/**
|
|
488
|
-
* Callback fired when the edit cell value changes.
|
|
489
|
-
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
490
|
-
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
491
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
492
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
493
|
-
*/
|
|
494
|
-
onEditCellPropsChange: PropTypes.func,
|
|
495
|
-
|
|
496
477
|
/**
|
|
497
478
|
* Callback fired when the `editRowsModel` changes.
|
|
498
479
|
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
|
|
@@ -679,7 +660,6 @@ DataGridRaw.propTypes = {
|
|
|
679
660
|
|
|
680
661
|
/**
|
|
681
662
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
682
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
683
663
|
* @template R
|
|
684
664
|
* @param {R} newRow Row object with the new values.
|
|
685
665
|
* @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';
|
|
@@ -28,8 +27,6 @@ import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSp
|
|
|
28
27
|
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
29
28
|
import { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
|
|
30
29
|
export var useDataGridComponent = function useDataGridComponent(props) {
|
|
31
|
-
var _props$experimentalFe, _props$experimentalFe2;
|
|
32
|
-
|
|
33
30
|
var apiRef = useGridInitialization(undefined, props);
|
|
34
31
|
/**
|
|
35
32
|
* Register all pre-processors called during state initialization here.
|
|
@@ -46,7 +43,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
46
43
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
47
44
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
48
45
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
49
|
-
useGridInitializeState(
|
|
46
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
50
47
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
51
48
|
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
52
49
|
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
@@ -62,7 +59,6 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
62
59
|
useGridParamsApi(apiRef);
|
|
63
60
|
useGridColumnSpanning(apiRef);
|
|
64
61
|
useGridColumnGrouping(apiRef, props);
|
|
65
|
-
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
66
62
|
useGridEditing(apiRef, props);
|
|
67
63
|
useGridFocus(apiRef, props);
|
|
68
64
|
useGridPreferencesPanel(apiRef, props);
|