@mui/x-data-grid 7.0.0-alpha.2 → 7.0.0-alpha.4
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 +364 -0
- package/DataGrid/DataGrid.d.ts +0 -10
- package/DataGrid/DataGrid.js +11 -23
- package/DataGrid/useDataGridProps.js +1 -1
- package/README.md +0 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/colDef/gridDefaultColumnTypes.d.ts +2 -2
- package/colDef/gridDefaultColumnTypes.js +2 -2
- package/components/GridHeader.js +3 -2
- package/components/GridRow.js +9 -6
- package/components/base/GridOverlays.js +0 -2
- package/components/cell/GridActionsCell.js +0 -1
- package/components/cell/GridCell.js +3 -5
- package/components/cell/GridEditDateCell.js +1 -20
- package/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/components/panel/index.d.ts +0 -1
- package/components/panel/index.js +0 -1
- package/components/virtualization/GridVirtualScroller.js +0 -1
- package/constants/defaultGridSlotsComponents.js +1 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +8 -23
- package/hooks/features/editing/useGridRowEditing.js +7 -22
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridCsvExport.js +1 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
- package/hooks/features/filter/gridFilterUtils.js +7 -4
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -2
- package/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -6
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/hooks/features/rows/useGridRowsMeta.js +0 -1
- package/hooks/features/sorting/useGridSorting.js +6 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/legacy/DataGrid/DataGrid.js +11 -23
- package/legacy/DataGrid/useDataGridProps.js +1 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/legacy/colDef/gridDefaultColumnTypes.js +2 -2
- package/legacy/components/GridHeader.js +3 -2
- package/legacy/components/GridRow.js +9 -6
- package/legacy/components/base/GridOverlays.js +0 -2
- package/legacy/components/cell/GridActionsCell.js +0 -1
- package/legacy/components/cell/GridCell.js +3 -5
- package/legacy/components/cell/GridEditDateCell.js +1 -20
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/legacy/components/panel/index.js +0 -1
- package/legacy/components/virtualization/GridVirtualScroller.js +0 -1
- package/legacy/constants/defaultGridSlotsComponents.js +1 -2
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +8 -23
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -24
- package/legacy/hooks/features/export/useGridCsvExport.js +1 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +7 -4
- package/legacy/hooks/features/filter/useGridFilter.js +2 -2
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -6
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/legacy/hooks/features/rows/useGridRowsMeta.js +0 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +6 -5
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -2
- package/legacy/locales/bgBG.js +33 -37
- package/legacy/locales/coreLocales.js +1 -0
- package/legacy/locales/daDK.js +37 -39
- package/legacy/locales/plPL.js +0 -1
- package/legacy/models/params/gridEditCellParams.js +1 -0
- package/legacy/utils/domUtils.js +10 -1
- package/legacy/utils/utils.js +0 -1
- package/locales/bgBG.js +33 -37
- package/locales/coreLocales.js +1 -0
- package/locales/daDK.js +37 -39
- package/locales/plPL.js +0 -1
- package/models/api/gridEditingApi.d.ts +2 -4
- package/models/api/gridSortApi.d.ts +2 -2
- package/models/colDef/gridColType.d.ts +2 -4
- package/models/gridFilterModel.d.ts +2 -2
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridSlotsComponentsProps.d.ts +0 -3
- package/models/params/gridEditCellParams.d.ts +3 -1
- package/models/params/gridEditCellParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +11 -23
- package/modern/DataGrid/useDataGridProps.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/modern/colDef/gridDefaultColumnTypes.js +2 -2
- package/modern/components/GridHeader.js +2 -1
- package/modern/components/GridRow.js +9 -6
- package/modern/components/base/GridOverlays.js +0 -2
- package/modern/components/cell/GridActionsCell.js +0 -1
- package/modern/components/cell/GridCell.js +2 -4
- package/modern/components/cell/GridEditDateCell.js +1 -20
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/panel/index.js +0 -1
- package/modern/components/virtualization/GridVirtualScroller.js +0 -1
- package/modern/constants/defaultGridSlotsComponents.js +1 -2
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +8 -23
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -22
- package/modern/hooks/features/export/useGridCsvExport.js +1 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +4 -2
- package/modern/hooks/features/filter/useGridFilter.js +2 -2
- package/modern/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -6
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +0 -1
- package/modern/hooks/features/sorting/useGridSorting.js +6 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/locales/bgBG.js +33 -37
- package/modern/locales/coreLocales.js +1 -0
- package/modern/locales/daDK.js +37 -39
- package/modern/locales/plPL.js +0 -1
- package/modern/models/params/gridEditCellParams.js +1 -0
- package/modern/utils/domUtils.js +10 -1
- package/modern/utils/utils.js +0 -1
- package/node/DataGrid/DataGrid.js +11 -23
- package/node/DataGrid/useDataGridProps.js +1 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/node/colDef/gridDefaultColumnTypes.js +2 -2
- package/node/components/GridHeader.js +2 -1
- package/node/components/GridRow.js +8 -5
- package/node/components/base/GridOverlays.js +0 -2
- package/node/components/cell/GridActionsCell.js +0 -1
- package/node/components/cell/GridCell.js +2 -4
- package/node/components/cell/GridEditDateCell.js +1 -20
- package/node/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/panel/index.js +0 -11
- package/node/components/virtualization/GridVirtualScroller.js +0 -1
- package/node/constants/defaultGridSlotsComponents.js +0 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/editing/useGridCellEditing.js +7 -22
- package/node/hooks/features/editing/useGridRowEditing.js +6 -21
- package/node/hooks/features/export/useGridCsvExport.js +1 -1
- package/node/hooks/features/filter/gridFilterUtils.js +6 -3
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/focus/gridFocusStateSelector.js +3 -7
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -7
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +8 -5
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +0 -1
- package/node/hooks/features/sorting/useGridSorting.js +6 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +21 -14
- package/node/locales/bgBG.js +33 -37
- package/node/locales/daDK.js +37 -39
- package/node/locales/plPL.js +0 -1
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/utils/domUtils.js +11 -1
- package/node/utils/utils.js +0 -1
- package/package.json +4 -4
- package/utils/domUtils.d.ts +2 -0
- package/utils/domUtils.js +10 -1
- package/utils/utils.js +0 -1
|
@@ -27,8 +27,8 @@ export interface GridFilterModel {
|
|
|
27
27
|
*/
|
|
28
28
|
quickFilterLogicOperator?: GridLogicOperator;
|
|
29
29
|
/**
|
|
30
|
-
* If `
|
|
31
|
-
* @default
|
|
30
|
+
* If `false`, the quick filter will also consider cell values from hidden columns.
|
|
31
|
+
* @default true
|
|
32
32
|
*/
|
|
33
33
|
quickFilterExcludeHiddenColumns?: boolean;
|
|
34
34
|
}
|
|
@@ -116,11 +116,6 @@ export interface GridSlotsComponent extends GridBaseSlots, GridIconSlotsComponen
|
|
|
116
116
|
* @default null
|
|
117
117
|
*/
|
|
118
118
|
toolbar: React.JSXElementConstructor<any> | null;
|
|
119
|
-
/**
|
|
120
|
-
* PreferencesPanel component rendered inside the Header component.
|
|
121
|
-
* @default GridPreferencesPanel
|
|
122
|
-
*/
|
|
123
|
-
preferencesPanel: React.JSXElementConstructor<any>;
|
|
124
119
|
/**
|
|
125
120
|
* Loading overlay component rendered when the grid is in a loading state.
|
|
126
121
|
* @default GridLoadingOverlay
|
|
@@ -72,8 +72,6 @@ export interface NoRowsOverlayPropsOverrides {
|
|
|
72
72
|
}
|
|
73
73
|
export interface PanelPropsOverrides {
|
|
74
74
|
}
|
|
75
|
-
export interface PreferencesPanelPropsOverrides {
|
|
76
|
-
}
|
|
77
75
|
export interface RowPropsOverrides {
|
|
78
76
|
}
|
|
79
77
|
type SlotProps<Props, Overrides> = Partial<Props & Overrides>;
|
|
@@ -109,7 +107,6 @@ export interface GridSlotsComponentsProps {
|
|
|
109
107
|
noRowsOverlay?: SlotProps<GridOverlayProps, NoRowsOverlayPropsOverrides>;
|
|
110
108
|
pagination?: SlotProps<TablePaginationProps, PaginationPropsOverrides>;
|
|
111
109
|
panel?: SlotProps<GridPanelProps, PanelPropsOverrides>;
|
|
112
|
-
preferencesPanel?: SlotProps<React.HTMLAttributes<HTMLDivElement>, PreferencesPanelPropsOverrides>;
|
|
113
110
|
row?: SlotProps<GridRowProps, RowPropsOverrides>;
|
|
114
111
|
toolbar?: SlotProps<GridToolbarProps, ToolbarPropsOverrides>;
|
|
115
112
|
}
|
|
@@ -29,7 +29,8 @@ declare enum GridCellEditStartReasons {
|
|
|
29
29
|
enterKeyDown = "enterKeyDown",
|
|
30
30
|
cellDoubleClick = "cellDoubleClick",
|
|
31
31
|
printableKeyDown = "printableKeyDown",
|
|
32
|
-
deleteKeyDown = "deleteKeyDown"
|
|
32
|
+
deleteKeyDown = "deleteKeyDown",
|
|
33
|
+
pasteKeyDown = "pasteKeyDown"
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Params passed to the `cellEditStart` event.
|
|
@@ -41,6 +42,7 @@ export interface GridCellEditStartParams<R extends GridValidRowModel = any, V =
|
|
|
41
42
|
reason?: GridCellEditStartReasons;
|
|
42
43
|
/**
|
|
43
44
|
* If the reason is related to a keyboard event, it contains which key was pressed.
|
|
45
|
+
* @deprecated No longer needed.
|
|
44
46
|
*/
|
|
45
47
|
key?: string;
|
|
46
48
|
}
|
|
@@ -6,6 +6,7 @@ var GridCellEditStartReasons = /*#__PURE__*/function (GridCellEditStartReasons)
|
|
|
6
6
|
GridCellEditStartReasons["cellDoubleClick"] = "cellDoubleClick";
|
|
7
7
|
GridCellEditStartReasons["printableKeyDown"] = "printableKeyDown";
|
|
8
8
|
GridCellEditStartReasons["deleteKeyDown"] = "deleteKeyDown";
|
|
9
|
+
GridCellEditStartReasons["pasteKeyDown"] = "pasteKeyDown";
|
|
9
10
|
return GridCellEditStartReasons;
|
|
10
11
|
}(GridCellEditStartReasons || {});
|
|
11
12
|
/**
|
|
@@ -74,6 +74,7 @@ export interface GridRowEditStartParams<R extends GridValidRowModel = any> exten
|
|
|
74
74
|
reason?: GridRowEditStartReasons;
|
|
75
75
|
/**
|
|
76
76
|
* If the reason is related to a keyboard event, it contains which key was pressed.
|
|
77
|
+
* @deprecated No longer needed.
|
|
77
78
|
*/
|
|
78
79
|
key?: string;
|
|
79
80
|
}
|
|
@@ -331,7 +331,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
331
331
|
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
332
332
|
* @default false
|
|
333
333
|
*/
|
|
334
|
-
|
|
334
|
+
ignoreValueFormatterDuringExport: boolean | {
|
|
335
335
|
csvExport?: boolean;
|
|
336
336
|
clipboardExport?: boolean;
|
|
337
337
|
};
|
|
@@ -5,7 +5,7 @@ import { chainPropTypes } from '@mui/utils';
|
|
|
5
5
|
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
|
|
6
6
|
import { GridContextProvider } from '../context/GridContextProvider';
|
|
7
7
|
import { useDataGridComponent } from './useDataGridComponent';
|
|
8
|
-
import { useDataGridProps
|
|
8
|
+
import { useDataGridProps } from './useDataGridProps';
|
|
9
9
|
import { DataGridVirtualScroller } from '../components/DataGridVirtualScroller';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -35,18 +35,6 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
35
35
|
* - [DataGrid API](https://mui.com/x/api/data-grid/data-grid/)
|
|
36
36
|
*/
|
|
37
37
|
export const DataGrid = /*#__PURE__*/React.memo(DataGridRaw);
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Remove at v7
|
|
41
|
-
* @deprecated
|
|
42
|
-
*/
|
|
43
|
-
export const SUBMIT_FILTER_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Remove at v7
|
|
47
|
-
* @deprecated
|
|
48
|
-
*/
|
|
49
|
-
export const SUBMIT_FILTER_DATE_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
|
|
50
38
|
DataGridRaw.propTypes = {
|
|
51
39
|
// ----------------------------- Warning --------------------------------
|
|
52
40
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -274,6 +262,15 @@ DataGridRaw.propTypes = {
|
|
|
274
262
|
* @default false
|
|
275
263
|
*/
|
|
276
264
|
ignoreDiacritics: PropTypes.bool,
|
|
265
|
+
/**
|
|
266
|
+
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
267
|
+
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
268
|
+
* @default false
|
|
269
|
+
*/
|
|
270
|
+
ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
271
|
+
clipboardExport: PropTypes.bool,
|
|
272
|
+
csvExport: PropTypes.bool
|
|
273
|
+
}), PropTypes.bool]),
|
|
277
274
|
/**
|
|
278
275
|
* The initial state of the DataGrid.
|
|
279
276
|
* The data in it will be set in the state on initialization but will not be controlled.
|
|
@@ -666,14 +663,5 @@ DataGridRaw.propTypes = {
|
|
|
666
663
|
/**
|
|
667
664
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
668
665
|
*/
|
|
669
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
670
|
-
/**
|
|
671
|
-
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
672
|
-
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
673
|
-
* @default false
|
|
674
|
-
*/
|
|
675
|
-
unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
676
|
-
clipboardExport: PropTypes.bool,
|
|
677
|
-
csvExport: PropTypes.bool
|
|
678
|
-
}), PropTypes.bool])
|
|
666
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
679
667
|
};
|
|
@@ -68,7 +68,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
68
68
|
disableColumnResize: false,
|
|
69
69
|
keepNonExistentRowsSelected: false,
|
|
70
70
|
keepColumnPositionIfDraggedOutside: false,
|
|
71
|
-
|
|
71
|
+
ignoreValueFormatterDuringExport: false,
|
|
72
72
|
clipboardCopyCellDelimiter: '\t',
|
|
73
73
|
rowPositionsDebounceMs: 166
|
|
74
74
|
};
|
|
@@ -7,8 +7,8 @@ import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
9
9
|
export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
|
|
10
|
+
type: 'custom',
|
|
10
11
|
field: GRID_CHECKBOX_SELECTION_FIELD,
|
|
11
|
-
type: 'checkboxSelection',
|
|
12
12
|
width: 50,
|
|
13
13
|
resizable: false,
|
|
14
14
|
sortable: false,
|
|
@@ -4,7 +4,7 @@ import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from './gridDateColDef';
|
|
|
4
4
|
import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
5
5
|
import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
|
|
6
6
|
import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
|
|
7
|
-
export const DEFAULT_GRID_COL_TYPE_KEY = '
|
|
7
|
+
export const DEFAULT_GRID_COL_TYPE_KEY = 'string';
|
|
8
8
|
export const getGridDefaultColumnTypes = () => {
|
|
9
9
|
const nativeColumnTypes = {
|
|
10
10
|
string: GRID_STRING_COL_DEF,
|
|
@@ -14,7 +14,7 @@ export const getGridDefaultColumnTypes = () => {
|
|
|
14
14
|
boolean: GRID_BOOLEAN_COL_DEF,
|
|
15
15
|
singleSelect: GRID_SINGLE_SELECT_COL_DEF,
|
|
16
16
|
[GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF,
|
|
17
|
-
|
|
17
|
+
custom: GRID_STRING_COL_DEF
|
|
18
18
|
};
|
|
19
19
|
return nativeColumnTypes;
|
|
20
20
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
4
|
+
import { GridPreferencesPanel } from './panel/GridPreferencesPanel';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
7
|
export function GridHeader() {
|
|
7
8
|
const rootProps = useGridRootProps();
|
|
8
9
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
9
|
-
children: [/*#__PURE__*/_jsx(
|
|
10
|
+
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, rootProps.slotProps?.toolbar))]
|
|
10
11
|
});
|
|
11
12
|
}
|
|
@@ -13,7 +13,7 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
|
13
13
|
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
14
14
|
import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
|
|
15
15
|
import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
16
|
-
import { findParentElementFromClassName } from '../utils/domUtils';
|
|
16
|
+
import { findParentElementFromClassName, isEventTargetInPortal } from '../utils/domUtils';
|
|
17
17
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
|
|
18
18
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
19
19
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
@@ -53,7 +53,6 @@ function EmptyCell({
|
|
|
53
53
|
style: style
|
|
54
54
|
}); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
|
|
55
55
|
}
|
|
56
|
-
|
|
57
56
|
const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
58
57
|
const {
|
|
59
58
|
selected,
|
|
@@ -137,9 +136,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
137
136
|
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
138
137
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
139
138
|
// Ignore portal
|
|
140
|
-
|
|
141
|
-
// See https://github.com/mui/material-ui/issues/10534
|
|
142
|
-
if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
|
|
139
|
+
if (isEventTargetInPortal(event)) {
|
|
143
140
|
return;
|
|
144
141
|
}
|
|
145
142
|
|
|
@@ -195,7 +192,13 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
195
192
|
const CellComponent = slots.cell === GridCellV7 ? GridCellV7 : GridCellWrapper;
|
|
196
193
|
const rowReordering = rootProps.rowReordering;
|
|
197
194
|
const getCell = (column, cellProps) => {
|
|
198
|
-
|
|
195
|
+
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
196
|
+
// fixes https://github.com/mui/mui-x/issues/11126
|
|
197
|
+
const isReorderCell = column.field === '__reorder__';
|
|
198
|
+
const isEditingRows = Object.keys(editRowsState).length > 0;
|
|
199
|
+
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
200
|
+
const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
201
|
+
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
199
202
|
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
200
203
|
let cellIsNotVisible = false;
|
|
201
204
|
if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
@@ -31,7 +31,6 @@ const GridOverlayWrapperRoot = styled('div', {
|
|
|
31
31
|
zIndex: overlayType === 'loadingOverlay' ? 5 // Should be above pinned columns, pinned rows, and detail panel
|
|
32
32
|
: 4 // Should be above pinned columns and detail panel
|
|
33
33
|
}));
|
|
34
|
-
|
|
35
34
|
const GridOverlayWrapperInner = styled('div', {
|
|
36
35
|
name: 'MuiDataGrid',
|
|
37
36
|
slot: 'OverlayWrapperInner',
|
|
@@ -62,7 +61,6 @@ function GridOverlayWrapper(props) {
|
|
|
62
61
|
if (rootProps.autoHeight && height === 0) {
|
|
63
62
|
height = getMinimalContentHeight(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
|
|
64
63
|
}
|
|
65
|
-
|
|
66
64
|
const classes = useUtilityClasses(_extends({}, props, {
|
|
67
65
|
classes: rootProps.classes
|
|
68
66
|
}));
|
|
@@ -126,7 +126,6 @@ function GridActionsCell(props) {
|
|
|
126
126
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
127
127
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
128
128
|
}
|
|
129
|
-
|
|
130
129
|
if (newIndex !== focusedButtonIndex) {
|
|
131
130
|
event.preventDefault(); // Prevent scrolling
|
|
132
131
|
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
@@ -242,7 +242,6 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
242
242
|
minHeight: height,
|
|
243
243
|
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
244
244
|
};
|
|
245
|
-
|
|
246
245
|
return cellStyle;
|
|
247
246
|
}, [width, height, isNotVisible]);
|
|
248
247
|
React.useEffect(() => {
|
|
@@ -459,8 +458,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
459
458
|
const cellRef = React.useRef(null);
|
|
460
459
|
const handleRef = useForkRef(ref, cellRef);
|
|
461
460
|
const focusElementRef = React.useRef(null);
|
|
462
|
-
// @ts-expect-error To access `
|
|
463
|
-
const isSelectionMode = rootProps.
|
|
461
|
+
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
462
|
+
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
464
463
|
const ownerState = {
|
|
465
464
|
align,
|
|
466
465
|
showRightBorder,
|
|
@@ -510,7 +509,6 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
510
509
|
minHeight: height,
|
|
511
510
|
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
512
511
|
};
|
|
513
|
-
|
|
514
512
|
return cellStyle;
|
|
515
513
|
}, [width, height, isNotVisible]);
|
|
516
514
|
React.useEffect(() => {
|
|
@@ -63,7 +63,6 @@ function GridEditDateCell(props) {
|
|
|
63
63
|
classes: rootProps.classes
|
|
64
64
|
};
|
|
65
65
|
const classes = useUtilityClasses(ownerState);
|
|
66
|
-
const hasUpdatedEditValueOnMount = React.useRef(false);
|
|
67
66
|
const parseValueToDate = React.useCallback(value => {
|
|
68
67
|
if (value === '') {
|
|
69
68
|
return null;
|
|
@@ -108,26 +107,8 @@ function GridEditDateCell(props) {
|
|
|
108
107
|
inputRef.current.focus();
|
|
109
108
|
}
|
|
110
109
|
}, [hasFocus]);
|
|
111
|
-
const meta = apiRef.current.unstable_getEditCellMeta(id, field);
|
|
112
|
-
const handleInputRef = el => {
|
|
113
|
-
inputRef.current = el;
|
|
114
|
-
if (meta?.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
|
|
115
|
-
const inputValue = inputRef.current.value;
|
|
116
|
-
const parsedDate = parseValueToDate(inputValue);
|
|
117
|
-
setValueState({
|
|
118
|
-
parsed: parsedDate,
|
|
119
|
-
formatted: inputValue
|
|
120
|
-
});
|
|
121
|
-
apiRef.current.setEditCellValue({
|
|
122
|
-
id,
|
|
123
|
-
field,
|
|
124
|
-
value: parsedDate
|
|
125
|
-
});
|
|
126
|
-
hasUpdatedEditValueOnMount.current = true;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
110
|
return /*#__PURE__*/_jsx(StyledInputBase, _extends({
|
|
130
|
-
inputRef:
|
|
111
|
+
inputRef: inputRef,
|
|
131
112
|
fullWidth: true,
|
|
132
113
|
className: classes.root,
|
|
133
114
|
type: isDateTime ? 'datetime-local' : 'date',
|
|
@@ -7,6 +7,7 @@ import { gridColumnGroupsLookupSelector } from '../../hooks/features/columnGroup
|
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
9
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
10
|
+
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const useUtilityClasses = ownerState => {
|
|
12
13
|
const {
|
|
@@ -84,7 +85,7 @@ function GridColumnGroupHeader(props) {
|
|
|
84
85
|
const publish = React.useCallback(eventName => event => {
|
|
85
86
|
// Ignore portal
|
|
86
87
|
// See https://github.com/mui/mui-x/issues/1721
|
|
87
|
-
if (
|
|
88
|
+
if (isEventTargetInPortal(event)) {
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
apiRef.current.publishEvent(eventName, renderParams, event);
|
|
@@ -9,6 +9,7 @@ import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
12
|
+
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const useUtilityClasses = ownerState => {
|
|
@@ -67,7 +68,7 @@ function GridColumnHeaderItem(props) {
|
|
|
67
68
|
const publish = React.useCallback(eventName => event => {
|
|
68
69
|
// Ignore portal
|
|
69
70
|
// See https://github.com/mui/mui-x/issues/1721
|
|
70
|
-
if (
|
|
71
|
+
if (isEventTargetInPortal(event)) {
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
apiRef.current.publishEvent(eventName, apiRef.current.getColumnHeaderParams(colDef.field), event);
|
|
@@ -28,7 +28,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
28
28
|
const onSortMenuItemClick = React.useCallback(event => {
|
|
29
29
|
onClick(event);
|
|
30
30
|
const direction = event.currentTarget.getAttribute('data-value') || null;
|
|
31
|
-
apiRef.current.sortColumn(colDef, direction === sortDirection ? null : direction);
|
|
31
|
+
apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction);
|
|
32
32
|
}, [apiRef, colDef, onClick, sortDirection]);
|
|
33
33
|
if (!colDef || !colDef.sortable || !sortingOrder.some(item => !!item)) {
|
|
34
34
|
return null;
|
|
@@ -176,8 +176,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
176
176
|
// try to keep the same operator when column change
|
|
177
177
|
const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
|
|
178
178
|
|
|
179
|
-
// Erase filter value if the input component is modified
|
|
180
|
-
const eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent;
|
|
179
|
+
// Erase filter value if the input component or filtered column type is modified
|
|
180
|
+
const eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent || column.type !== currentColumn.type;
|
|
181
181
|
applyFilterChanges(_extends({}, item, {
|
|
182
182
|
field,
|
|
183
183
|
operator: newOperator.value,
|
|
@@ -42,7 +42,7 @@ function GridFilterInputValue(props) {
|
|
|
42
42
|
}, [id, applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
|
|
43
43
|
React.useEffect(() => {
|
|
44
44
|
const itemPlusTag = item;
|
|
45
|
-
if (itemPlusTag.fromInput !== id) {
|
|
45
|
+
if (itemPlusTag.fromInput !== id || item.value === undefined) {
|
|
46
46
|
setFilterValueState(String(item.value ?? ''));
|
|
47
47
|
}
|
|
48
48
|
}, [id, item]);
|
|
@@ -29,7 +29,6 @@ const VirtualScrollerRoot = styled('div', {
|
|
|
29
29
|
},
|
|
30
30
|
zIndex: 0 // See https://github.com/mui/mui-x/issues/10547
|
|
31
31
|
});
|
|
32
|
-
|
|
33
32
|
const GridVirtualScroller = /*#__PURE__*/React.forwardRef(function GridVirtualScroller(props, ref) {
|
|
34
33
|
const rootProps = useGridRootProps();
|
|
35
34
|
const classes = useUtilityClasses(rootProps);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel,
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
|
|
3
3
|
import { GridCellV7 } from '../components/cell/GridCell';
|
|
4
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
@@ -17,7 +17,6 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
|
17
17
|
footer: GridFooter,
|
|
18
18
|
footerRowCount: GridRowCount,
|
|
19
19
|
toolbar: null,
|
|
20
|
-
preferencesPanel: GridPreferencesPanel,
|
|
21
20
|
loadingOverlay: GridLoadingOverlay,
|
|
22
21
|
noResultsOverlay: GridNoResultsOverlay,
|
|
23
22
|
noRowsOverlay: GridNoRowsOverlay,
|
|
@@ -49,7 +49,7 @@ function hasNativeSelection(element) {
|
|
|
49
49
|
* @requires useGridSelection (method)
|
|
50
50
|
*/
|
|
51
51
|
export const useGridClipboard = (apiRef, props) => {
|
|
52
|
-
const ignoreValueFormatterProp = props.
|
|
52
|
+
const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
53
53
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
|
|
54
54
|
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
55
55
|
const handleCopy = React.useCallback(event => {
|
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
const _excluded = ["id", "field"],
|
|
5
5
|
_excluded2 = ["id", "field"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -81,7 +81,6 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
81
81
|
reason = event.shiftKey ? GridCellEditStopReasons.shiftTabKeyDown : GridCellEditStopReasons.tabKeyDown;
|
|
82
82
|
event.preventDefault(); // Prevent going to the next element in the tab sequence
|
|
83
83
|
}
|
|
84
|
-
|
|
85
84
|
if (reason) {
|
|
86
85
|
const newParams = _extends({}, params, {
|
|
87
86
|
reason
|
|
@@ -101,7 +100,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
101
100
|
if (isPrintableKey(event)) {
|
|
102
101
|
reason = GridCellEditStartReasons.printableKeyDown;
|
|
103
102
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
104
|
-
reason = GridCellEditStartReasons.
|
|
103
|
+
reason = GridCellEditStartReasons.pasteKeyDown;
|
|
105
104
|
} else if (event.key === 'Enter') {
|
|
106
105
|
reason = GridCellEditStartReasons.enterKeyDown;
|
|
107
106
|
} else if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
@@ -121,24 +120,13 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
121
120
|
const {
|
|
122
121
|
id,
|
|
123
122
|
field,
|
|
124
|
-
reason
|
|
125
|
-
key,
|
|
126
|
-
colDef
|
|
123
|
+
reason
|
|
127
124
|
} = params;
|
|
128
125
|
const startCellEditModeParams = {
|
|
129
126
|
id,
|
|
130
127
|
field
|
|
131
128
|
};
|
|
132
|
-
if (reason === GridCellEditStartReasons.printableKeyDown) {
|
|
133
|
-
if (React.version.startsWith('17')) {
|
|
134
|
-
// In React 17, cleaning the input is enough.
|
|
135
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
136
|
-
startCellEditModeParams.deleteValue = true;
|
|
137
|
-
} else {
|
|
138
|
-
const initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
139
|
-
startCellEditModeParams.initialValue = initialValue;
|
|
140
|
-
}
|
|
141
|
-
} else if (reason === GridCellEditStartReasons.deleteKeyDown) {
|
|
129
|
+
if (reason === GridCellEditStartReasons.printableKeyDown || reason === GridCellEditStartReasons.deleteKeyDown || reason === GridCellEditStartReasons.pasteKeyDown) {
|
|
142
130
|
startCellEditModeParams.deleteValue = true;
|
|
143
131
|
}
|
|
144
132
|
apiRef.current.startCellEditMode(startCellEditModeParams);
|
|
@@ -186,7 +174,6 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
186
174
|
if (props.cellModesModel && isNewModelDifferentFromProp) {
|
|
187
175
|
return; // The prop always win
|
|
188
176
|
}
|
|
189
|
-
|
|
190
177
|
setCellModesModel(newModel);
|
|
191
178
|
cellModesModelRef.current = newModel;
|
|
192
179
|
apiRef.current.publishEvent('cellModesModelChange', newModel);
|
|
@@ -248,17 +235,13 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
248
235
|
initialValue
|
|
249
236
|
} = params;
|
|
250
237
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
251
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
252
|
-
let unstable_updateValueOnRender = false;
|
|
253
238
|
if (deleteValue || initialValue) {
|
|
254
239
|
newValue = deleteValue ? '' : initialValue;
|
|
255
|
-
unstable_updateValueOnRender = true;
|
|
256
240
|
}
|
|
257
241
|
const newProps = {
|
|
258
242
|
value: newValue,
|
|
259
243
|
error: false,
|
|
260
|
-
isProcessingProps: false
|
|
261
|
-
unstable_updateValueOnRender
|
|
244
|
+
isProcessingProps: false
|
|
262
245
|
};
|
|
263
246
|
updateOrDeleteFieldState(id, field, newProps);
|
|
264
247
|
apiRef.current.setCellFocus(id, field);
|
|
@@ -422,7 +405,9 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
422
405
|
updateCellModesModel(cellModesModelProp);
|
|
423
406
|
}
|
|
424
407
|
}, [cellModesModelProp, updateCellModesModel]);
|
|
425
|
-
|
|
408
|
+
|
|
409
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
410
|
+
useEnhancedEffect(() => {
|
|
426
411
|
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
427
412
|
|
|
428
413
|
// Update the ref here because updateStateToStopCellEditMode may change it later
|
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
const _excluded = ["id"],
|
|
5
5
|
_excluded2 = ["id"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridEditModes, GridRowModes } from '../../../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -171,7 +171,6 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
171
171
|
const rowParams = apiRef.current.getRowParams(params.id);
|
|
172
172
|
const newParams = _extends({}, rowParams, {
|
|
173
173
|
field: params.field,
|
|
174
|
-
key: event.key,
|
|
175
174
|
reason
|
|
176
175
|
});
|
|
177
176
|
apiRef.current.publishEvent('rowEditStart', newParams, event);
|
|
@@ -182,24 +181,13 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
182
181
|
const {
|
|
183
182
|
id,
|
|
184
183
|
field,
|
|
185
|
-
reason
|
|
186
|
-
key,
|
|
187
|
-
columns
|
|
184
|
+
reason
|
|
188
185
|
} = params;
|
|
189
186
|
const startRowEditModeParams = {
|
|
190
187
|
id,
|
|
191
188
|
fieldToFocus: field
|
|
192
189
|
};
|
|
193
|
-
if (reason === GridRowEditStartReasons.printableKeyDown) {
|
|
194
|
-
if (React.version.startsWith('17')) {
|
|
195
|
-
// In React 17, cleaning the input is enough.
|
|
196
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
197
|
-
startRowEditModeParams.deleteValue = !!field;
|
|
198
|
-
} else {
|
|
199
|
-
const colDef = columns.find(col => col.field === field);
|
|
200
|
-
startRowEditModeParams.initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
201
|
-
}
|
|
202
|
-
} else if (reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
190
|
+
if (reason === GridRowEditStartReasons.printableKeyDown || reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
203
191
|
startRowEditModeParams.deleteValue = !!field;
|
|
204
192
|
}
|
|
205
193
|
apiRef.current.startRowEditMode(startRowEditModeParams);
|
|
@@ -251,7 +239,6 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
251
239
|
if (props.rowModesModel && isNewModelDifferentFromProp) {
|
|
252
240
|
return; // The prop always win
|
|
253
241
|
}
|
|
254
|
-
|
|
255
242
|
setRowModesModel(newModel);
|
|
256
243
|
rowModesModelRef.current = newModel;
|
|
257
244
|
apiRef.current.publishEvent('rowModesModelChange', newModel);
|
|
@@ -322,17 +309,13 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
322
309
|
return acc;
|
|
323
310
|
}
|
|
324
311
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
325
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
326
|
-
let unstable_updateValueOnRender = false;
|
|
327
312
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
328
313
|
newValue = deleteValue ? '' : initialValue;
|
|
329
|
-
unstable_updateValueOnRender = true;
|
|
330
314
|
}
|
|
331
315
|
acc[field] = {
|
|
332
316
|
value: newValue,
|
|
333
317
|
error: false,
|
|
334
|
-
isProcessingProps: false
|
|
335
|
-
unstable_updateValueOnRender
|
|
318
|
+
isProcessingProps: false
|
|
336
319
|
};
|
|
337
320
|
return acc;
|
|
338
321
|
}, {});
|
|
@@ -552,7 +535,9 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
552
535
|
updateRowModesModel(rowModesModelProp);
|
|
553
536
|
}
|
|
554
537
|
}, [rowModesModelProp, updateRowModesModel]);
|
|
555
|
-
|
|
538
|
+
|
|
539
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
540
|
+
useEnhancedEffect(() => {
|
|
556
541
|
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
557
542
|
|
|
558
543
|
// Update the ref here because updateStateToStopRowEditMode may change it later
|
|
@@ -16,7 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
*/
|
|
17
17
|
export const useGridCsvExport = (apiRef, props) => {
|
|
18
18
|
const logger = useGridLogger(apiRef, 'useGridCsvExport');
|
|
19
|
-
const ignoreValueFormatterProp = props.
|
|
19
|
+
const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
20
20
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.csvExport : ignoreValueFormatterProp) || false;
|
|
21
21
|
const getDataAsCsv = React.useCallback((options = {}) => {
|
|
22
22
|
logger.debug(`Get data as CSV`);
|