@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
|
@@ -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 @@ var 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 var DataGrid = /*#__PURE__*/React.memo(DataGridRaw);
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Remove at v7
|
|
41
|
-
* @deprecated
|
|
42
|
-
*/
|
|
43
|
-
export var SUBMIT_FILTER_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Remove at v7
|
|
47
|
-
* @deprecated
|
|
48
|
-
*/
|
|
49
|
-
export var 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 |
|
|
@@ -276,6 +264,15 @@ DataGridRaw.propTypes = {
|
|
|
276
264
|
* @default false
|
|
277
265
|
*/
|
|
278
266
|
ignoreDiacritics: PropTypes.bool,
|
|
267
|
+
/**
|
|
268
|
+
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
269
|
+
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
270
|
+
* @default false
|
|
271
|
+
*/
|
|
272
|
+
ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
273
|
+
clipboardExport: PropTypes.bool,
|
|
274
|
+
csvExport: PropTypes.bool
|
|
275
|
+
}), PropTypes.bool]),
|
|
279
276
|
/**
|
|
280
277
|
* The initial state of the DataGrid.
|
|
281
278
|
* The data in it will be set in the state on initialization but will not be controlled.
|
|
@@ -668,14 +665,5 @@ DataGridRaw.propTypes = {
|
|
|
668
665
|
/**
|
|
669
666
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
670
667
|
*/
|
|
671
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
672
|
-
/**
|
|
673
|
-
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
674
|
-
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
675
|
-
* @default false
|
|
676
|
-
*/
|
|
677
|
-
unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
678
|
-
clipboardExport: PropTypes.bool,
|
|
679
|
-
csvExport: PropTypes.bool
|
|
680
|
-
}), PropTypes.bool])
|
|
668
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
681
669
|
};
|
|
@@ -68,7 +68,7 @@ export var 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 var GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
9
9
|
export var 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,
|
|
@@ -5,7 +5,7 @@ import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from './gridDateColDef';
|
|
|
5
5
|
import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
6
6
|
import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
|
|
7
7
|
import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
|
|
8
|
-
export var DEFAULT_GRID_COL_TYPE_KEY = '
|
|
8
|
+
export var DEFAULT_GRID_COL_TYPE_KEY = 'string';
|
|
9
9
|
export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
|
|
10
10
|
var nativeColumnTypes = _defineProperty(_defineProperty({
|
|
11
11
|
string: GRID_STRING_COL_DEF,
|
|
@@ -14,6 +14,6 @@ export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
|
|
|
14
14
|
dateTime: GRID_DATETIME_COL_DEF,
|
|
15
15
|
boolean: GRID_BOOLEAN_COL_DEF,
|
|
16
16
|
singleSelect: GRID_SINGLE_SELECT_COL_DEF
|
|
17
|
-
}, GRID_ACTIONS_COLUMN_TYPE, GRID_ACTIONS_COL_DEF),
|
|
17
|
+
}, GRID_ACTIONS_COLUMN_TYPE, GRID_ACTIONS_COL_DEF), "custom", GRID_STRING_COL_DEF);
|
|
18
18
|
return nativeColumnTypes;
|
|
19
19
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
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
|
-
var _rootProps$slotProps
|
|
8
|
+
var _rootProps$slotProps;
|
|
8
9
|
var rootProps = useGridRootProps();
|
|
9
10
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
10
|
-
children: [/*#__PURE__*/_jsx(
|
|
11
|
+
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.toolbar))]
|
|
11
12
|
});
|
|
12
13
|
}
|
|
@@ -15,7 +15,7 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
|
15
15
|
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
16
16
|
import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
|
|
17
17
|
import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
18
|
-
import { findParentElementFromClassName } from '../utils/domUtils';
|
|
18
|
+
import { findParentElementFromClassName, isEventTargetInPortal } from '../utils/domUtils';
|
|
19
19
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
|
|
20
20
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
21
21
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
@@ -52,7 +52,6 @@ function EmptyCell(_ref) {
|
|
|
52
52
|
style: style
|
|
53
53
|
}); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
|
|
54
54
|
}
|
|
55
|
-
|
|
56
55
|
var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
57
56
|
var selected = props.selected,
|
|
58
57
|
hovered = props.hovered,
|
|
@@ -141,9 +140,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
141
140
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
142
141
|
return function (event) {
|
|
143
142
|
// Ignore portal
|
|
144
|
-
|
|
145
|
-
// See https://github.com/mui/material-ui/issues/10534
|
|
146
|
-
if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
|
|
143
|
+
if (isEventTargetInPortal(event)) {
|
|
147
144
|
return;
|
|
148
145
|
}
|
|
149
146
|
|
|
@@ -199,7 +196,13 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
199
196
|
var rowReordering = rootProps.rowReordering;
|
|
200
197
|
var getCell = function getCell(column, cellProps) {
|
|
201
198
|
var _editRowsState$rowId$, _editRowsState$rowId;
|
|
202
|
-
|
|
199
|
+
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
200
|
+
// fixes https://github.com/mui/mui-x/issues/11126
|
|
201
|
+
var isReorderCell = column.field === '__reorder__';
|
|
202
|
+
var isEditingRows = Object.keys(editRowsState).length > 0;
|
|
203
|
+
var canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
204
|
+
var canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
205
|
+
var disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
203
206
|
var editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
|
|
204
207
|
var cellIsNotVisible = false;
|
|
205
208
|
if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
@@ -37,7 +37,6 @@ var GridOverlayWrapperRoot = styled('div', {
|
|
|
37
37
|
: 4 // Should be above pinned columns and detail panel
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
|
-
|
|
41
40
|
var GridOverlayWrapperInner = styled('div', {
|
|
42
41
|
name: 'MuiDataGrid',
|
|
43
42
|
slot: 'OverlayWrapperInner',
|
|
@@ -78,7 +77,6 @@ function GridOverlayWrapper(props) {
|
|
|
78
77
|
if (rootProps.autoHeight && height === 0) {
|
|
79
78
|
height = getMinimalContentHeight(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
var classes = useUtilityClasses(_extends({}, props, {
|
|
83
81
|
classes: rootProps.classes
|
|
84
82
|
}));
|
|
@@ -159,7 +159,6 @@ function GridActionsCell(props) {
|
|
|
159
159
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
160
160
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
161
161
|
}
|
|
162
|
-
|
|
163
162
|
if (newIndex !== focusedButtonIndex) {
|
|
164
163
|
event.preventDefault(); // Prevent scrolling
|
|
165
164
|
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
@@ -244,7 +244,6 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
244
244
|
minHeight: height,
|
|
245
245
|
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
246
246
|
};
|
|
247
|
-
|
|
248
247
|
return cellStyle;
|
|
249
248
|
}, [width, height, isNotVisible]);
|
|
250
249
|
React.useEffect(function () {
|
|
@@ -387,7 +386,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
387
386
|
} : void 0;
|
|
388
387
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
389
388
|
var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
390
|
-
var _getActions, _ref, _rootProps$
|
|
389
|
+
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment3, _rootProps$experiment4;
|
|
391
390
|
var column = props.column,
|
|
392
391
|
rowId = props.rowId,
|
|
393
392
|
editCellState = props.editCellState,
|
|
@@ -463,8 +462,8 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
463
462
|
var cellRef = React.useRef(null);
|
|
464
463
|
var handleRef = useForkRef(ref, cellRef);
|
|
465
464
|
var focusElementRef = React.useRef(null);
|
|
466
|
-
// @ts-expect-error To access `
|
|
467
|
-
var isSelectionMode = (_rootProps$
|
|
465
|
+
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
466
|
+
var isSelectionMode = (_rootProps$cellSelect = rootProps.cellSelection) != null ? _rootProps$cellSelect : false;
|
|
468
467
|
var ownerState = {
|
|
469
468
|
align: align,
|
|
470
469
|
showRightBorder: showRightBorder,
|
|
@@ -520,7 +519,6 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
520
519
|
minHeight: height,
|
|
521
520
|
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
522
521
|
};
|
|
523
|
-
|
|
524
522
|
return cellStyle;
|
|
525
523
|
}, [width, height, isNotVisible]);
|
|
526
524
|
React.useEffect(function () {
|
|
@@ -74,7 +74,6 @@ function GridEditDateCell(props) {
|
|
|
74
74
|
classes: rootProps.classes
|
|
75
75
|
};
|
|
76
76
|
var classes = useUtilityClasses(ownerState);
|
|
77
|
-
var hasUpdatedEditValueOnMount = React.useRef(false);
|
|
78
77
|
var parseValueToDate = React.useCallback(function (value) {
|
|
79
78
|
if (value === '') {
|
|
80
79
|
return null;
|
|
@@ -148,26 +147,8 @@ function GridEditDateCell(props) {
|
|
|
148
147
|
inputRef.current.focus();
|
|
149
148
|
}
|
|
150
149
|
}, [hasFocus]);
|
|
151
|
-
var meta = apiRef.current.unstable_getEditCellMeta(id, field);
|
|
152
|
-
var handleInputRef = function handleInputRef(el) {
|
|
153
|
-
inputRef.current = el;
|
|
154
|
-
if (meta != null && meta.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
|
|
155
|
-
var inputValue = inputRef.current.value;
|
|
156
|
-
var parsedDate = parseValueToDate(inputValue);
|
|
157
|
-
setValueState({
|
|
158
|
-
parsed: parsedDate,
|
|
159
|
-
formatted: inputValue
|
|
160
|
-
});
|
|
161
|
-
apiRef.current.setEditCellValue({
|
|
162
|
-
id: id,
|
|
163
|
-
field: field,
|
|
164
|
-
value: parsedDate
|
|
165
|
-
});
|
|
166
|
-
hasUpdatedEditValueOnMount.current = true;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
150
|
return /*#__PURE__*/_jsx(StyledInputBase, _extends({
|
|
170
|
-
inputRef:
|
|
151
|
+
inputRef: inputRef,
|
|
171
152
|
fullWidth: true,
|
|
172
153
|
className: classes.root,
|
|
173
154
|
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
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
12
13
|
var classes = ownerState.classes,
|
|
@@ -85,7 +86,7 @@ function GridColumnGroupHeader(props) {
|
|
|
85
86
|
return function (event) {
|
|
86
87
|
// Ignore portal
|
|
87
88
|
// See https://github.com/mui/mui-x/issues/1721
|
|
88
|
-
if (
|
|
89
|
+
if (isEventTargetInPortal(event)) {
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
92
|
apiRef.current.publishEvent(eventName, renderParams, event);
|
|
@@ -10,6 +10,7 @@ import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
|
10
10
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
13
|
+
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -71,7 +72,7 @@ function GridColumnHeaderItem(props) {
|
|
|
71
72
|
return function (event) {
|
|
72
73
|
// Ignore portal
|
|
73
74
|
// See https://github.com/mui/mui-x/issues/1721
|
|
74
|
-
if (
|
|
75
|
+
if (isEventTargetInPortal(event)) {
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
apiRef.current.publishEvent(eventName, apiRef.current.getColumnHeaderParams(colDef.field), event);
|
|
@@ -29,7 +29,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
29
29
|
var onSortMenuItemClick = React.useCallback(function (event) {
|
|
30
30
|
onClick(event);
|
|
31
31
|
var direction = event.currentTarget.getAttribute('data-value') || null;
|
|
32
|
-
apiRef.current.sortColumn(colDef, direction === sortDirection ? null : direction);
|
|
32
|
+
apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction);
|
|
33
33
|
}, [apiRef, colDef, onClick, sortDirection]);
|
|
34
34
|
if (!colDef || !colDef.sortable || !sortingOrder.some(function (item) {
|
|
35
35
|
return !!item;
|
|
@@ -205,8 +205,8 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
205
205
|
return operator.value === item.operator;
|
|
206
206
|
}) || column.filterOperators[0];
|
|
207
207
|
|
|
208
|
-
// Erase filter value if the input component is modified
|
|
209
|
-
var eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent);
|
|
208
|
+
// Erase filter value if the input component or filtered column type is modified
|
|
209
|
+
var eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent) || column.type !== currentColumn.type;
|
|
210
210
|
applyFilterChanges(_extends({}, item, {
|
|
211
211
|
field: field,
|
|
212
212
|
operator: newOperator.value,
|
|
@@ -47,7 +47,7 @@ function GridFilterInputValue(props) {
|
|
|
47
47
|
}, [id, applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
|
|
48
48
|
React.useEffect(function () {
|
|
49
49
|
var itemPlusTag = item;
|
|
50
|
-
if (itemPlusTag.fromInput !== id) {
|
|
50
|
+
if (itemPlusTag.fromInput !== id || item.value === undefined) {
|
|
51
51
|
var _item$value2;
|
|
52
52
|
setFilterValueState(String((_item$value2 = item.value) != null ? _item$value2 : ''));
|
|
53
53
|
}
|
|
@@ -29,7 +29,6 @@ var VirtualScrollerRoot = styled('div', {
|
|
|
29
29
|
},
|
|
30
30
|
zIndex: 0 // See https://github.com/mui/mui-x/issues/10547
|
|
31
31
|
});
|
|
32
|
-
|
|
33
32
|
var GridVirtualScroller = /*#__PURE__*/React.forwardRef(function GridVirtualScroller(props, ref) {
|
|
34
33
|
var rootProps = useGridRootProps();
|
|
35
34
|
var 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 var 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,
|
|
@@ -51,7 +51,7 @@ function hasNativeSelection(element) {
|
|
|
51
51
|
* @requires useGridSelection (method)
|
|
52
52
|
*/
|
|
53
53
|
export var useGridClipboard = function useGridClipboard(apiRef, props) {
|
|
54
|
-
var ignoreValueFormatterProp = props.
|
|
54
|
+
var ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
55
55
|
var ignoreValueFormatter = (_typeof(ignoreValueFormatterProp) === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
56
56
|
var clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
57
57
|
var handleCopy = React.useCallback(function (event) {
|
|
@@ -8,7 +8,7 @@ var _excluded = ["id", "field"],
|
|
|
8
8
|
_excluded2 = ["id", "field"];
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
11
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
12
12
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
13
13
|
import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
|
|
14
14
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -88,7 +88,6 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
88
88
|
reason = event.shiftKey ? GridCellEditStopReasons.shiftTabKeyDown : GridCellEditStopReasons.tabKeyDown;
|
|
89
89
|
event.preventDefault(); // Prevent going to the next element in the tab sequence
|
|
90
90
|
}
|
|
91
|
-
|
|
92
91
|
if (reason) {
|
|
93
92
|
var newParams = _extends({}, params, {
|
|
94
93
|
reason: reason
|
|
@@ -108,7 +107,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
108
107
|
if (isPrintableKey(event)) {
|
|
109
108
|
_reason = GridCellEditStartReasons.printableKeyDown;
|
|
110
109
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
111
|
-
_reason = GridCellEditStartReasons.
|
|
110
|
+
_reason = GridCellEditStartReasons.pasteKeyDown;
|
|
112
111
|
} else if (event.key === 'Enter') {
|
|
113
112
|
_reason = GridCellEditStartReasons.enterKeyDown;
|
|
114
113
|
} else if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
@@ -127,23 +126,12 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
127
126
|
var handleCellEditStart = React.useCallback(function (params) {
|
|
128
127
|
var id = params.id,
|
|
129
128
|
field = params.field,
|
|
130
|
-
reason = params.reason
|
|
131
|
-
key = params.key,
|
|
132
|
-
colDef = params.colDef;
|
|
129
|
+
reason = params.reason;
|
|
133
130
|
var startCellEditModeParams = {
|
|
134
131
|
id: id,
|
|
135
132
|
field: field
|
|
136
133
|
};
|
|
137
|
-
if (reason === GridCellEditStartReasons.printableKeyDown) {
|
|
138
|
-
if (React.version.startsWith('17')) {
|
|
139
|
-
// In React 17, cleaning the input is enough.
|
|
140
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
141
|
-
startCellEditModeParams.deleteValue = true;
|
|
142
|
-
} else {
|
|
143
|
-
var initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
144
|
-
startCellEditModeParams.initialValue = initialValue;
|
|
145
|
-
}
|
|
146
|
-
} else if (reason === GridCellEditStartReasons.deleteKeyDown) {
|
|
134
|
+
if (reason === GridCellEditStartReasons.printableKeyDown || reason === GridCellEditStartReasons.deleteKeyDown || reason === GridCellEditStartReasons.pasteKeyDown) {
|
|
147
135
|
startCellEditModeParams.deleteValue = true;
|
|
148
136
|
}
|
|
149
137
|
apiRef.current.startCellEditMode(startCellEditModeParams);
|
|
@@ -189,7 +177,6 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
189
177
|
if (props.cellModesModel && isNewModelDifferentFromProp) {
|
|
190
178
|
return; // The prop always win
|
|
191
179
|
}
|
|
192
|
-
|
|
193
180
|
setCellModesModel(newModel);
|
|
194
181
|
cellModesModelRef.current = newModel;
|
|
195
182
|
apiRef.current.publishEvent('cellModesModelChange', newModel);
|
|
@@ -244,17 +231,13 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
244
231
|
deleteValue = params.deleteValue,
|
|
245
232
|
initialValue = params.initialValue;
|
|
246
233
|
var newValue = apiRef.current.getCellValue(id, field);
|
|
247
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
248
|
-
var unstable_updateValueOnRender = false;
|
|
249
234
|
if (deleteValue || initialValue) {
|
|
250
235
|
newValue = deleteValue ? '' : initialValue;
|
|
251
|
-
unstable_updateValueOnRender = true;
|
|
252
236
|
}
|
|
253
237
|
var newProps = {
|
|
254
238
|
value: newValue,
|
|
255
239
|
error: false,
|
|
256
|
-
isProcessingProps: false
|
|
257
|
-
unstable_updateValueOnRender: unstable_updateValueOnRender
|
|
240
|
+
isProcessingProps: false
|
|
258
241
|
};
|
|
259
242
|
updateOrDeleteFieldState(id, field, newProps);
|
|
260
243
|
apiRef.current.setCellFocus(id, field);
|
|
@@ -439,7 +422,9 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
439
422
|
updateCellModesModel(cellModesModelProp);
|
|
440
423
|
}
|
|
441
424
|
}, [cellModesModelProp, updateCellModesModel]);
|
|
442
|
-
|
|
425
|
+
|
|
426
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
427
|
+
useEnhancedEffect(function () {
|
|
443
428
|
var idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
444
429
|
|
|
445
430
|
// Update the ref here because updateStateToStopCellEditMode may change it later
|
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
var _excluded = ["id"],
|
|
7
7
|
_excluded2 = ["id"];
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
9
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
10
10
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
11
11
|
import { GridEditModes, GridRowModes } from '../../../models/gridEditRowModel';
|
|
12
12
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -179,7 +179,6 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
179
179
|
var rowParams = apiRef.current.getRowParams(params.id);
|
|
180
180
|
var _newParams = _extends({}, rowParams, {
|
|
181
181
|
field: params.field,
|
|
182
|
-
key: event.key,
|
|
183
182
|
reason: _reason
|
|
184
183
|
});
|
|
185
184
|
apiRef.current.publishEvent('rowEditStart', _newParams, event);
|
|
@@ -189,25 +188,12 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
189
188
|
var handleRowEditStart = React.useCallback(function (params) {
|
|
190
189
|
var id = params.id,
|
|
191
190
|
field = params.field,
|
|
192
|
-
reason = params.reason
|
|
193
|
-
key = params.key,
|
|
194
|
-
columns = params.columns;
|
|
191
|
+
reason = params.reason;
|
|
195
192
|
var startRowEditModeParams = {
|
|
196
193
|
id: id,
|
|
197
194
|
fieldToFocus: field
|
|
198
195
|
};
|
|
199
|
-
if (reason === GridRowEditStartReasons.printableKeyDown) {
|
|
200
|
-
if (React.version.startsWith('17')) {
|
|
201
|
-
// In React 17, cleaning the input is enough.
|
|
202
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
203
|
-
startRowEditModeParams.deleteValue = !!field;
|
|
204
|
-
} else {
|
|
205
|
-
var colDef = columns.find(function (col) {
|
|
206
|
-
return col.field === field;
|
|
207
|
-
});
|
|
208
|
-
startRowEditModeParams.initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
209
|
-
}
|
|
210
|
-
} else if (reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
196
|
+
if (reason === GridRowEditStartReasons.printableKeyDown || reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
211
197
|
startRowEditModeParams.deleteValue = !!field;
|
|
212
198
|
}
|
|
213
199
|
apiRef.current.startRowEditMode(startRowEditModeParams);
|
|
@@ -257,7 +243,6 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
257
243
|
if (props.rowModesModel && isNewModelDifferentFromProp) {
|
|
258
244
|
return; // The prop always win
|
|
259
245
|
}
|
|
260
|
-
|
|
261
246
|
setRowModesModel(newModel);
|
|
262
247
|
rowModesModelRef.current = newModel;
|
|
263
248
|
apiRef.current.publishEvent('rowModesModelChange', newModel);
|
|
@@ -322,17 +307,13 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
322
307
|
return acc;
|
|
323
308
|
}
|
|
324
309
|
var newValue = apiRef.current.getCellValue(id, field);
|
|
325
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
326
|
-
var unstable_updateValueOnRender = false;
|
|
327
310
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
328
311
|
newValue = deleteValue ? '' : initialValue;
|
|
329
|
-
unstable_updateValueOnRender = true;
|
|
330
312
|
}
|
|
331
313
|
acc[field] = {
|
|
332
314
|
value: newValue,
|
|
333
315
|
error: false,
|
|
334
|
-
isProcessingProps: false
|
|
335
|
-
unstable_updateValueOnRender: unstable_updateValueOnRender
|
|
316
|
+
isProcessingProps: false
|
|
336
317
|
};
|
|
337
318
|
return acc;
|
|
338
319
|
}, {});
|
|
@@ -559,7 +540,9 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
559
540
|
updateRowModesModel(rowModesModelProp);
|
|
560
541
|
}
|
|
561
542
|
}, [rowModesModelProp, updateRowModesModel]);
|
|
562
|
-
|
|
543
|
+
|
|
544
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
545
|
+
useEnhancedEffect(function () {
|
|
563
546
|
var idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
564
547
|
|
|
565
548
|
// Update the ref here because updateStateToStopRowEditMode may change it later
|
|
@@ -18,7 +18,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
*/
|
|
19
19
|
export var useGridCsvExport = function useGridCsvExport(apiRef, props) {
|
|
20
20
|
var logger = useGridLogger(apiRef, 'useGridCsvExport');
|
|
21
|
-
var ignoreValueFormatterProp = props.
|
|
21
|
+
var ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
22
22
|
var ignoreValueFormatter = (_typeof(ignoreValueFormatterProp) === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.csvExport : ignoreValueFormatterProp) || false;
|
|
23
23
|
var getDataAsCsv = React.useCallback(function () {
|
|
24
24
|
var _options$getRowsToExp, _options$includeHeade, _options$includeColum;
|
|
@@ -182,6 +182,10 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
|
|
|
182
182
|
filterItemsApplierId += 1;
|
|
183
183
|
return filterItem;
|
|
184
184
|
};
|
|
185
|
+
export var shouldQuickFilterExcludeHiddenColumns = function shouldQuickFilterExcludeHiddenColumns(filterModel) {
|
|
186
|
+
var _filterModel$quickFil;
|
|
187
|
+
return (_filterModel$quickFil = filterModel.quickFilterExcludeHiddenColumns) != null ? _filterModel$quickFil : true;
|
|
188
|
+
};
|
|
185
189
|
|
|
186
190
|
/**
|
|
187
191
|
* Generates a method to easily check if a row is matching the current quick filter.
|
|
@@ -190,13 +194,12 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
|
|
|
190
194
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
191
195
|
*/
|
|
192
196
|
var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterApplier(filterModel, apiRef) {
|
|
193
|
-
var _filterModel$
|
|
194
|
-
var quickFilterValues = (_filterModel$
|
|
197
|
+
var _filterModel$quickFil2, _filterModel$quickFil3;
|
|
198
|
+
var quickFilterValues = (_filterModel$quickFil2 = (_filterModel$quickFil3 = filterModel.quickFilterValues) == null ? void 0 : _filterModel$quickFil3.filter(Boolean)) != null ? _filterModel$quickFil2 : [];
|
|
195
199
|
if (quickFilterValues.length === 0) {
|
|
196
200
|
return null;
|
|
197
201
|
}
|
|
198
|
-
var
|
|
199
|
-
var columnFields = quickFilterExcludeHiddenColumns ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
202
|
+
var columnFields = shouldQuickFilterExcludeHiddenColumns(filterModel) ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
200
203
|
var appliersPerField = [];
|
|
201
204
|
var ignoreDiacritics = apiRef.current.rootProps.ignoreDiacritics;
|
|
202
205
|
var publicApiRef = getPublicApiRef(apiRef);
|
|
@@ -15,7 +15,7 @@ import { useFirstRender } from '../../utils/useFirstRender';
|
|
|
15
15
|
import { gridRowsLookupSelector } from '../rows';
|
|
16
16
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
17
17
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from '../../core/strategyProcessing';
|
|
18
|
-
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic } from './gridFilterUtils';
|
|
18
|
+
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic, shouldQuickFilterExcludeHiddenColumns } from './gridFilterUtils';
|
|
19
19
|
import { isDeepEqual } from '../../../utils/utils';
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
export var filterStateInitializer = function filterStateInitializer(state, props, apiRef) {
|
|
@@ -354,7 +354,7 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
354
354
|
useGridApiEventHandler(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
355
355
|
useGridApiEventHandler(apiRef, 'columnVisibilityModelChange', function () {
|
|
356
356
|
var filterModel = gridFilterModelSelector(apiRef);
|
|
357
|
-
if (filterModel.quickFilterValues && filterModel
|
|
357
|
+
if (filterModel.quickFilterValues && shouldQuickFilterExcludeHiddenColumns(filterModel)) {
|
|
358
358
|
// re-apply filters because the quick filter results may have changed
|
|
359
359
|
apiRef.current.unstable_applyFilters();
|
|
360
360
|
}
|
|
@@ -8,9 +8,7 @@ export var gridFocusCellSelector = createSelector(gridFocusStateSelector, functi
|
|
|
8
8
|
export var gridFocusColumnHeaderSelector = createSelector(gridFocusStateSelector, function (focusState) {
|
|
9
9
|
return focusState.columnHeader;
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
export var unstable_gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, function (focusState) {
|
|
11
|
+
export var gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, function (focusState) {
|
|
14
12
|
return focusState.columnHeaderFilter;
|
|
15
13
|
});
|
|
16
14
|
|
|
@@ -27,9 +25,7 @@ export var gridTabIndexCellSelector = createSelector(gridTabIndexStateSelector,
|
|
|
27
25
|
export var gridTabIndexColumnHeaderSelector = createSelector(gridTabIndexStateSelector, function (state) {
|
|
28
26
|
return state.columnHeader;
|
|
29
27
|
});
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
32
|
-
export var unstable_gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, function (state) {
|
|
28
|
+
export var gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, function (state) {
|
|
33
29
|
return state.columnHeaderFilter;
|
|
34
30
|
});
|
|
35
31
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
1
|
import { createSelector } from '../../../utils/createSelector';
|
|
3
|
-
export var
|
|
2
|
+
export var gridHeaderFilteringStateSelector = function gridHeaderFilteringStateSelector(state) {
|
|
4
3
|
return state.headerFiltering;
|
|
5
4
|
};
|
|
6
|
-
export var
|
|
5
|
+
export var gridHeaderFilteringEditFieldSelector = createSelector(gridHeaderFilteringStateSelector, function (headerFilteringState) {
|
|
7
6
|
return headerFilteringState.editing;
|
|
8
7
|
});
|
|
9
|
-
export var
|
|
8
|
+
export var gridHeaderFilteringMenuSelector = createSelector(gridHeaderFilteringStateSelector, function (headerFilteringState) {
|
|
10
9
|
return headerFilteringState.menuOpen;
|
|
11
10
|
});
|