@mui/x-data-grid 7.0.0-alpha.1 → 7.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 +607 -188
- 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/components/GridHeader.js +3 -2
- package/components/GridPagination.d.ts +2 -2
- package/components/GridRow.js +2 -4
- package/components/cell/GridCell.js +3 -3
- 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/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 -21
- package/hooks/features/editing/useGridRowEditing.js +7 -21
- 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/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/hooks/features/sorting/useGridSorting.js +6 -5
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +11 -23
- package/legacy/DataGrid/useDataGridProps.js +1 -1
- package/legacy/colDef/gridDefaultColumnTypes.js +2 -3
- package/legacy/components/GridHeader.js +3 -2
- package/legacy/components/GridPagination.js +3 -4
- package/legacy/components/GridRow.js +2 -4
- package/legacy/components/cell/GridCell.js +3 -3
- 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/columnHeaders/GridColumnHeadersInner.js +4 -5
- package/legacy/components/containers/GridRootStyles.js +69 -70
- 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/toolbar/GridToolbarQuickFilter.js +4 -5
- package/legacy/constants/defaultGridSlotsComponents.js +1 -2
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +8 -21
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -23
- 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/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +6 -5
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/locales/arSD.js +1 -1
- package/legacy/locales/bgBG.js +33 -37
- package/legacy/locales/heIL.js +1 -2
- package/legacy/models/params/gridEditCellParams.js +1 -0
- package/legacy/utils/domUtils.js +10 -15
- package/locales/arSD.js +1 -1
- package/locales/bgBG.js +33 -37
- package/locales/heIL.js +1 -2
- package/models/api/gridEditingApi.d.ts +2 -4
- package/models/api/gridSortApi.d.ts +2 -2
- 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/components/GridHeader.js +2 -1
- package/modern/components/GridRow.js +2 -4
- package/modern/components/cell/GridCell.js +2 -2
- 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/constants/defaultGridSlotsComponents.js +1 -2
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +8 -21
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -21
- 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/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/modern/hooks/features/sorting/useGridSorting.js +6 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/arSD.js +1 -1
- package/modern/locales/bgBG.js +33 -37
- package/modern/locales/heIL.js +1 -2
- package/modern/models/params/gridEditCellParams.js +1 -0
- package/modern/utils/domUtils.js +10 -15
- package/node/DataGrid/DataGrid.js +11 -23
- package/node/DataGrid/useDataGridProps.js +1 -1
- package/node/components/GridHeader.js +2 -1
- package/node/components/GridRow.js +1 -3
- package/node/components/cell/GridCell.js +2 -2
- 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/constants/defaultGridSlotsComponents.js +0 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/editing/useGridCellEditing.js +7 -20
- package/node/hooks/features/editing/useGridRowEditing.js +6 -20
- 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/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/sorting/useGridSorting.js +6 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/locales/arSD.js +1 -1
- package/node/locales/bgBG.js +33 -37
- package/node/locales/heIL.js +1 -2
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/utils/domUtils.js +11 -18
- package/package.json +6 -5
- package/utils/domUtils.d.ts +2 -3
- package/utils/domUtils.js +10 -15
|
@@ -15,6 +15,7 @@ import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
|
15
15
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
16
16
|
import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
17
17
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
18
|
+
import { isEventTargetInPortal } from '../../../utils/domUtils';
|
|
18
19
|
function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
19
20
|
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
20
21
|
return [...(pinnedRows.top || []), ...rows, ...(pinnedRows.bottom || [])];
|
|
@@ -414,7 +415,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
414
415
|
}, [apiRef, currentPageRows.length, goToHeader, goToGroupHeader, goToCell, getRowIdFromIndex]);
|
|
415
416
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
416
417
|
// Ignore portal
|
|
417
|
-
if (
|
|
418
|
+
if (isEventTargetInPortal(event)) {
|
|
418
419
|
return;
|
|
419
420
|
}
|
|
420
421
|
|
|
@@ -14,6 +14,7 @@ import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
|
14
14
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
16
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
|
+
import { isEventTargetInPortal } from '../../../utils/domUtils';
|
|
17
18
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
18
19
|
if (selectionModelProp == null) {
|
|
19
20
|
return selectionModelProp;
|
|
@@ -289,7 +290,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
289
290
|
|
|
290
291
|
// Ignore portal
|
|
291
292
|
// Do not apply shortcuts if the focus is not on the cell root component
|
|
292
|
-
if (
|
|
293
|
+
if (isEventTargetInPortal(event)) {
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
295
296
|
if (isNavigationKey(event.key) && event.shiftKey) {
|
|
@@ -116,7 +116,8 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
116
116
|
apiRef.current.applySorting();
|
|
117
117
|
}
|
|
118
118
|
}, [apiRef, logger, props.disableMultipleColumnsSorting]);
|
|
119
|
-
const sortColumn = React.useCallback((
|
|
119
|
+
const sortColumn = React.useCallback((field, direction, allowMultipleSorting) => {
|
|
120
|
+
const column = apiRef.current.getColumn(field);
|
|
120
121
|
if (!column.sortable) {
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
@@ -199,17 +200,17 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
199
200
|
* EVENTS
|
|
200
201
|
*/
|
|
201
202
|
const handleColumnHeaderClick = React.useCallback(({
|
|
202
|
-
|
|
203
|
+
field
|
|
203
204
|
}, event) => {
|
|
204
205
|
const allowMultipleSorting = event.shiftKey || event.metaKey || event.ctrlKey;
|
|
205
|
-
sortColumn(
|
|
206
|
+
sortColumn(field, undefined, allowMultipleSorting);
|
|
206
207
|
}, [sortColumn]);
|
|
207
208
|
const handleColumnHeaderKeyDown = React.useCallback(({
|
|
208
|
-
|
|
209
|
+
field
|
|
209
210
|
}, event) => {
|
|
210
211
|
// Ctrl + Enter opens the column menu
|
|
211
212
|
if (isEnterKey(event.key) && !event.ctrlKey && !event.metaKey) {
|
|
212
|
-
sortColumn(
|
|
213
|
+
sortColumn(field, undefined, event.shiftKey);
|
|
213
214
|
}
|
|
214
215
|
}, [sortColumn]);
|
|
215
216
|
const handleColumnsChange = React.useCallback(() => {
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGr
|
|
|
67
67
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
68
68
|
export * from '../utils/createControllablePromise';
|
|
69
69
|
export { createSelector, createSelectorMemoized, unstable_resetCreateSelectorCache, } from '../utils/createSelector';
|
|
70
|
-
export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
|
|
70
|
+
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
|
71
71
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
72
72
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
73
73
|
export { buildWarning } from '../utils/warning';
|
package/internals/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
|
54
54
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
55
55
|
export * from '../utils/createControllablePromise';
|
|
56
56
|
export { createSelector, createSelectorMemoized, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
57
|
-
export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
|
|
57
|
+
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from '../utils/domUtils';
|
|
58
58
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
59
59
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
60
60
|
export { buildWarning } from '../utils/warning';
|
|
@@ -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,14 +7,13 @@ import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
|
|
|
7
7
|
import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
|
|
8
8
|
export var DEFAULT_GRID_COL_TYPE_KEY = '__default__';
|
|
9
9
|
export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
|
|
10
|
-
var
|
|
11
|
-
var nativeColumnTypes = (_nativeColumnTypes = {
|
|
10
|
+
var nativeColumnTypes = _defineProperty(_defineProperty({
|
|
12
11
|
string: GRID_STRING_COL_DEF,
|
|
13
12
|
number: GRID_NUMERIC_COL_DEF,
|
|
14
13
|
date: GRID_DATE_COL_DEF,
|
|
15
14
|
dateTime: GRID_DATETIME_COL_DEF,
|
|
16
15
|
boolean: GRID_BOOLEAN_COL_DEF,
|
|
17
16
|
singleSelect: GRID_SINGLE_SELECT_COL_DEF
|
|
18
|
-
},
|
|
17
|
+
}, GRID_ACTIONS_COLUMN_TYPE, GRID_ACTIONS_COL_DEF), DEFAULT_GRID_COL_TYPE_KEY, GRID_STRING_COL_DEF);
|
|
19
18
|
return nativeColumnTypes;
|
|
20
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
|
}
|
|
@@ -10,17 +10,16 @@ import { gridFilteredTopLevelRowCountSelector } from '../hooks/features/filter';
|
|
|
10
10
|
import { gridPaginationModelSelector } from '../hooks/features/pagination/gridPaginationSelector';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
var GridPaginationRoot = styled(TablePagination)(function (_ref) {
|
|
13
|
-
var _ref2;
|
|
14
13
|
var theme = _ref.theme;
|
|
15
|
-
return
|
|
14
|
+
return _defineProperty(_defineProperty({}, "& .".concat(tablePaginationClasses.selectLabel), _defineProperty({
|
|
16
15
|
display: 'none'
|
|
17
16
|
}, theme.breakpoints.up('sm'), {
|
|
18
17
|
display: 'block'
|
|
19
|
-
})),
|
|
18
|
+
})), "& .".concat(tablePaginationClasses.input), _defineProperty({
|
|
20
19
|
display: 'none'
|
|
21
20
|
}, theme.breakpoints.up('sm'), {
|
|
22
21
|
display: 'inline-flex'
|
|
23
|
-
}))
|
|
22
|
+
}));
|
|
24
23
|
});
|
|
25
24
|
export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
26
25
|
var apiRef = useGridApiContext();
|
|
@@ -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';
|
|
@@ -141,9 +141,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
141
141
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
142
142
|
return function (event) {
|
|
143
143
|
// Ignore portal
|
|
144
|
-
|
|
145
|
-
// See https://github.com/mui/material-ui/issues/10534
|
|
146
|
-
if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
|
|
144
|
+
if (isEventTargetInPortal(event)) {
|
|
147
145
|
return;
|
|
148
146
|
}
|
|
149
147
|
|
|
@@ -387,7 +387,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
387
387
|
} : void 0;
|
|
388
388
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
389
389
|
var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
390
|
-
var _getActions, _ref, _rootProps$
|
|
390
|
+
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment3, _rootProps$experiment4;
|
|
391
391
|
var column = props.column,
|
|
392
392
|
rowId = props.rowId,
|
|
393
393
|
editCellState = props.editCellState,
|
|
@@ -463,8 +463,8 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
463
463
|
var cellRef = React.useRef(null);
|
|
464
464
|
var handleRef = useForkRef(ref, cellRef);
|
|
465
465
|
var focusElementRef = React.useRef(null);
|
|
466
|
-
// @ts-expect-error To access `
|
|
467
|
-
var isSelectionMode = (_rootProps$
|
|
466
|
+
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
467
|
+
var isSelectionMode = (_rootProps$cellSelect = rootProps.cellSelection) != null ? _rootProps$cellSelect : false;
|
|
468
468
|
var ownerState = {
|
|
469
469
|
align: align,
|
|
470
470
|
showRightBorder: showRightBorder,
|
|
@@ -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);
|
|
@@ -26,16 +26,15 @@ var GridColumnHeadersInnerRoot = styled('div', {
|
|
|
26
26
|
return [_defineProperty({}, "&.".concat(gridClasses.columnHeaderDropZone), styles.columnHeaderDropZone), styles.columnHeadersInner];
|
|
27
27
|
}
|
|
28
28
|
})(function () {
|
|
29
|
-
|
|
30
|
-
return _ref2 = {
|
|
29
|
+
return _defineProperty(_defineProperty({
|
|
31
30
|
display: 'flex',
|
|
32
31
|
alignItems: 'flex-start',
|
|
33
32
|
flexDirection: 'column'
|
|
34
|
-
},
|
|
33
|
+
}, "&.".concat(gridClasses.columnHeaderDropZone, " .").concat(gridClasses.columnHeaderDraggableContainer), {
|
|
35
34
|
cursor: 'move'
|
|
36
|
-
}),
|
|
35
|
+
}), "&.".concat(gridClasses['columnHeadersInner--scrollable'], " .").concat(gridClasses.columnHeader, ":last-child"), {
|
|
37
36
|
borderRight: 'none'
|
|
38
|
-
})
|
|
37
|
+
});
|
|
39
38
|
});
|
|
40
39
|
export var GridColumnHeadersInner = /*#__PURE__*/React.forwardRef(function GridColumnHeadersInner(props, ref) {
|
|
41
40
|
var _apiRef$current$getRo, _apiRef$current$getRo2;
|