@mui/x-data-grid 6.5.0 → 6.6.0
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 +78 -2
- package/DataGrid/DataGrid.js +10 -3
- package/README.md +2 -2
- package/components/GridColumnHeaders.js +4 -9
- package/components/GridHeader.d.ts +2 -2
- package/components/base/GridBody.d.ts +1 -1
- package/components/base/GridFooterPlaceholder.d.ts +2 -2
- package/components/base/GridOverlays.d.ts +2 -2
- package/components/cell/GridActionsCell.d.ts +3 -3
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridBooleanCell.d.ts +1 -1
- package/components/cell/GridEditBooleanCell.d.ts +2 -2
- package/components/cell/GridEditDateCell.d.ts +2 -2
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditSingleSelectCell.d.ts +3 -3
- package/components/cell/GridEditSingleSelectCell.js +5 -5
- package/components/cell/GridSkeletonCell.d.ts +1 -1
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +2 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -2
- package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderTitle.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -3
- package/components/index.d.ts +0 -1
- package/components/index.js +1 -2
- package/components/menu/GridMenu.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.ts +2 -2
- package/components/panel/GridColumnsPanel.d.ts +2 -2
- package/components/panel/GridPanelContent.d.ts +1 -1
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelHeader.d.ts +1 -1
- package/components/panel/GridPreferencesPanel.js +3 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -0
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/components/toolbar/GridToolbarQuickFilter.d.ts +2 -2
- package/context/GridContextProvider.d.ts +1 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +10 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +2 -2
- package/hooks/features/filter/gridFilterSelector.js +2 -2
- package/hooks/features/filter/gridFilterState.d.ts +6 -6
- package/hooks/features/filter/gridFilterState.js +6 -0
- package/hooks/features/filter/useGridFilter.js +29 -9
- package/hooks/features/preferencesPanel/gridPreferencePanelState.d.ts +2 -0
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/index.js +1 -1
- package/internals/utils/useProps.js +21 -1
- package/legacy/DataGrid/DataGrid.js +10 -3
- package/legacy/components/GridColumnHeaders.js +4 -9
- package/legacy/components/cell/GridActionsCell.js +3 -3
- package/legacy/components/cell/GridEditSingleSelectCell.js +5 -5
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/legacy/components/containers/GridRoot.js +1 -3
- package/legacy/components/index.js +1 -2
- package/legacy/components/panel/GridPreferencesPanel.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -0
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +11 -5
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/legacy/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/legacy/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/legacy/hooks/features/filter/gridFilterSelector.js +4 -4
- package/legacy/hooks/features/filter/gridFilterState.js +6 -0
- package/legacy/hooks/features/filter/useGridFilter.js +29 -9
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/legacy/hooks/features/rows/useGridRowsMeta.js +12 -20
- package/legacy/index.js +1 -1
- package/legacy/internals/utils/useProps.js +23 -1
- package/legacy/locales/arSD.js +12 -12
- package/legacy/locales/beBY.js +12 -12
- package/legacy/locales/bgBG.js +12 -12
- package/legacy/locales/csCZ.js +12 -12
- package/legacy/locales/daDK.js +12 -12
- package/legacy/locales/deDE.js +12 -12
- package/legacy/locales/elGR.js +12 -12
- package/legacy/locales/esES.js +12 -12
- package/legacy/locales/faIR.js +12 -12
- package/legacy/locales/fiFI.js +12 -12
- package/legacy/locales/frFR.js +25 -27
- package/legacy/locales/heIL.js +12 -12
- package/legacy/locales/huHU.js +12 -12
- package/legacy/locales/itIT.js +12 -12
- package/legacy/locales/jaJP.js +12 -12
- package/legacy/locales/koKR.js +12 -12
- package/legacy/locales/nbNO.js +12 -12
- package/legacy/locales/nlNL.js +25 -27
- package/legacy/locales/plPL.js +12 -12
- package/legacy/locales/ptBR.js +12 -12
- package/legacy/locales/roRO.js +12 -12
- package/legacy/locales/ruRU.js +12 -12
- package/legacy/locales/skSK.js +12 -12
- package/legacy/locales/svSE.js +12 -12
- package/legacy/locales/trTR.js +12 -12
- package/legacy/locales/ukUA.js +12 -12
- package/legacy/locales/urPK.js +12 -12
- package/legacy/locales/viVN.js +12 -12
- package/legacy/locales/zhCN.js +12 -12
- package/legacy/locales/zhTW.js +12 -12
- package/legacy/models/gridFilterItem.js +1 -1
- package/locales/arSD.js +12 -12
- package/locales/beBY.js +12 -12
- package/locales/bgBG.js +12 -12
- package/locales/csCZ.js +12 -12
- package/locales/daDK.js +12 -12
- package/locales/deDE.js +12 -12
- package/locales/elGR.js +12 -12
- package/locales/esES.js +12 -12
- package/locales/faIR.js +12 -12
- package/locales/fiFI.js +12 -12
- package/locales/frFR.js +25 -27
- package/locales/heIL.js +12 -12
- package/locales/huHU.js +12 -12
- package/locales/itIT.js +12 -12
- package/locales/jaJP.js +12 -12
- package/locales/koKR.js +12 -12
- package/locales/nbNO.js +12 -12
- package/locales/nlNL.js +25 -27
- package/locales/plPL.js +12 -12
- package/locales/ptBR.js +12 -12
- package/locales/roRO.js +12 -12
- package/locales/ruRU.js +12 -12
- package/locales/skSK.js +12 -12
- package/locales/svSE.js +12 -12
- package/locales/trTR.js +12 -12
- package/locales/ukUA.js +12 -12
- package/locales/urPK.js +12 -12
- package/locales/viVN.js +12 -12
- package/locales/zhCN.js +12 -12
- package/locales/zhTW.js +12 -12
- package/material/components/MUISelectOption.d.ts +2 -2
- package/models/api/gridFilterApi.d.ts +3 -1
- package/models/api/gridPreferencesPanelApi.d.ts +3 -1
- package/models/gridFilterItem.d.ts +1 -1
- package/models/gridFilterItem.js +1 -1
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +5 -0
- package/modern/DataGrid/DataGrid.js +10 -3
- package/modern/components/GridColumnHeaders.js +4 -9
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridEditSingleSelectCell.js +5 -5
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/modern/components/containers/GridRoot.js +1 -3
- package/modern/components/index.js +1 -2
- package/modern/components/panel/GridPreferencesPanel.js +3 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -0
- package/modern/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/modern/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/modern/hooks/features/filter/gridFilterSelector.js +2 -2
- package/modern/hooks/features/filter/gridFilterState.js +6 -0
- package/modern/hooks/features/filter/useGridFilter.js +29 -9
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/modern/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/modern/index.js +1 -1
- package/modern/internals/utils/useProps.js +20 -1
- package/modern/locales/arSD.js +12 -12
- package/modern/locales/beBY.js +12 -12
- package/modern/locales/bgBG.js +12 -12
- package/modern/locales/csCZ.js +12 -12
- package/modern/locales/daDK.js +12 -12
- package/modern/locales/deDE.js +12 -12
- package/modern/locales/elGR.js +12 -12
- package/modern/locales/esES.js +12 -12
- package/modern/locales/faIR.js +12 -12
- package/modern/locales/fiFI.js +12 -12
- package/modern/locales/frFR.js +25 -27
- package/modern/locales/heIL.js +12 -12
- package/modern/locales/huHU.js +12 -12
- package/modern/locales/itIT.js +12 -12
- package/modern/locales/jaJP.js +12 -12
- package/modern/locales/koKR.js +12 -12
- package/modern/locales/nbNO.js +12 -12
- package/modern/locales/nlNL.js +25 -27
- package/modern/locales/plPL.js +12 -12
- package/modern/locales/ptBR.js +12 -12
- package/modern/locales/roRO.js +12 -12
- package/modern/locales/ruRU.js +12 -12
- package/modern/locales/skSK.js +12 -12
- package/modern/locales/svSE.js +12 -12
- package/modern/locales/trTR.js +12 -12
- package/modern/locales/ukUA.js +12 -12
- package/modern/locales/urPK.js +12 -12
- package/modern/locales/viVN.js +12 -12
- package/modern/locales/zhCN.js +12 -12
- package/modern/locales/zhTW.js +12 -12
- package/modern/models/gridFilterItem.js +1 -1
- package/node/DataGrid/DataGrid.js +10 -3
- package/node/components/GridColumnHeaders.js +3 -8
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridEditSingleSelectCell.js +5 -5
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +12 -3
- package/node/components/containers/GridRoot.js +1 -3
- package/node/components/index.js +0 -11
- package/node/components/panel/GridPreferencesPanel.js +3 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -0
- package/node/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/node/components/toolbar/GridToolbarFilterButton.js +10 -3
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/node/hooks/features/filter/gridFilterSelector.js +2 -2
- package/node/hooks/features/filter/gridFilterState.js +6 -0
- package/node/hooks/features/filter/useGridFilter.js +30 -10
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/node/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/node/index.js +1 -1
- package/node/internals/utils/useProps.js +20 -1
- package/node/locales/arSD.js +12 -12
- package/node/locales/beBY.js +12 -12
- package/node/locales/bgBG.js +12 -12
- package/node/locales/csCZ.js +12 -12
- package/node/locales/daDK.js +12 -12
- package/node/locales/deDE.js +12 -12
- package/node/locales/elGR.js +12 -12
- package/node/locales/esES.js +12 -12
- package/node/locales/faIR.js +12 -12
- package/node/locales/fiFI.js +12 -12
- package/node/locales/frFR.js +25 -27
- package/node/locales/heIL.js +12 -12
- package/node/locales/huHU.js +12 -12
- package/node/locales/itIT.js +12 -12
- package/node/locales/jaJP.js +12 -12
- package/node/locales/koKR.js +12 -12
- package/node/locales/nbNO.js +12 -12
- package/node/locales/nlNL.js +25 -27
- package/node/locales/plPL.js +12 -12
- package/node/locales/ptBR.js +12 -12
- package/node/locales/roRO.js +12 -12
- package/node/locales/ruRU.js +12 -12
- package/node/locales/skSK.js +12 -12
- package/node/locales/svSE.js +12 -12
- package/node/locales/trTR.js +12 -12
- package/node/locales/ukUA.js +12 -12
- package/node/locales/urPK.js +12 -12
- package/node/locales/viVN.js +12 -12
- package/node/locales/zhCN.js +12 -12
- package/node/locales/zhTW.js +12 -12
- package/node/models/gridFilterItem.js +1 -1
- package/package.json +4 -4
- package/components/GridScrollArea.d.ts +0 -10
- package/components/GridScrollArea.js +0 -117
- package/legacy/components/GridScrollArea.js +0 -119
- package/legacy/lib/createDetectElementResize/index.js +0 -145
- package/lib/createDetectElementResize/index.d.ts +0 -18
- package/lib/createDetectElementResize/index.js +0 -145
- package/lib/createDetectElementResize/types.d.ts +0 -9
- package/modern/components/GridScrollArea.js +0 -117
- package/modern/lib/createDetectElementResize/index.js +0 -145
- package/node/components/GridScrollArea.js +0 -126
- package/node/lib/createDetectElementResize/index.js +0 -151
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { chainPropTypes } from '@mui/utils';
|
|
@@ -14,15 +15,16 @@ var DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref)
|
|
|
14
15
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
15
16
|
privateApiRef: privateApiRef,
|
|
16
17
|
props: props,
|
|
17
|
-
children: /*#__PURE__*/_jsxs(GridRoot, {
|
|
18
|
+
children: /*#__PURE__*/_jsxs(GridRoot, _extends({
|
|
18
19
|
className: props.className,
|
|
19
20
|
style: props.style,
|
|
20
21
|
sx: props.sx,
|
|
21
|
-
ref: ref
|
|
22
|
+
ref: ref
|
|
23
|
+
}, props.forwardedProps, {
|
|
22
24
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
23
25
|
VirtualScrollerComponent: DataGridVirtualScroller
|
|
24
26
|
}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
25
|
-
})
|
|
27
|
+
}))
|
|
26
28
|
});
|
|
27
29
|
});
|
|
28
30
|
export var DataGrid = /*#__PURE__*/React.memo(DataGridRaw);
|
|
@@ -184,6 +186,11 @@ DataGridRaw.propTypes = {
|
|
|
184
186
|
quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
|
|
185
187
|
quickFilterValues: PropTypes.array
|
|
186
188
|
}),
|
|
189
|
+
/**
|
|
190
|
+
* Forwarded props for the grid root element.
|
|
191
|
+
* @ignore - do not document.
|
|
192
|
+
*/
|
|
193
|
+
forwardedProps: PropTypes.object,
|
|
187
194
|
/**
|
|
188
195
|
* Function that applies CSS classes dynamically on cells.
|
|
189
196
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -4,11 +4,10 @@ var _excluded = ["innerRef", "className", "visibleColumns", "sortColumnLookup",
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
7
|
-
import { GridScrollArea } from './GridScrollArea';
|
|
8
7
|
import { GridBaseColumnHeaders } from './columnHeaders/GridBaseColumnHeaders';
|
|
9
8
|
import { GridColumnHeadersInner } from './columnHeaders/GridColumnHeadersInner';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
var GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnsHeaders(props, ref) {
|
|
13
12
|
var innerRef = props.innerRef,
|
|
14
13
|
className = props.className,
|
|
@@ -49,18 +48,14 @@ var GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnsHeader
|
|
|
49
48
|
getInnerProps = _useGridColumnHeaders.getInnerProps,
|
|
50
49
|
getColumnHeaders = _useGridColumnHeaders.getColumnHeaders,
|
|
51
50
|
getColumnGroupHeaders = _useGridColumnHeaders.getColumnGroupHeaders;
|
|
52
|
-
return /*#__PURE__*/
|
|
51
|
+
return /*#__PURE__*/_jsx(GridBaseColumnHeaders, _extends({
|
|
53
52
|
ref: ref
|
|
54
53
|
}, getRootProps(other), {
|
|
55
|
-
children:
|
|
56
|
-
scrollDirection: "left"
|
|
57
|
-
}), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
54
|
+
children: /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
58
55
|
isDragging: isDragging
|
|
59
56
|
}, getInnerProps(), {
|
|
60
57
|
children: [getColumnGroupHeaders(), getColumnHeaders()]
|
|
61
|
-
}))
|
|
62
|
-
scrollDirection: "right"
|
|
63
|
-
})]
|
|
58
|
+
}))
|
|
64
59
|
}));
|
|
65
60
|
});
|
|
66
61
|
process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
|
|
@@ -183,9 +183,9 @@ function GridActionsCell(props) {
|
|
|
183
183
|
ref: buttonRef,
|
|
184
184
|
id: buttonId,
|
|
185
185
|
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
186
|
-
"aria-
|
|
187
|
-
"aria-expanded": open
|
|
188
|
-
"aria-
|
|
186
|
+
"aria-haspopup": "menu",
|
|
187
|
+
"aria-expanded": open,
|
|
188
|
+
"aria-controls": open ? menuId : undefined,
|
|
189
189
|
role: "menuitem",
|
|
190
190
|
size: "small",
|
|
191
191
|
onClick: showMenu,
|
|
@@ -8,6 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
11
|
+
import { GridCellEditStopReasons } from '../../models/params/gridEditCellParams';
|
|
11
12
|
import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
12
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
14
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
@@ -123,11 +124,10 @@ function GridEditSingleSelectCell(props) {
|
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
126
|
-
apiRef.current.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
127
|
+
var params = apiRef.current.getCellParams(id, field);
|
|
128
|
+
apiRef.current.publishEvent('cellEditStop', _extends({}, params, {
|
|
129
|
+
reason: isEscapeKey(event.key) ? GridCellEditStopReasons.escapeKeyDown : GridCellEditStopReasons.cellFocusOut
|
|
130
|
+
}));
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
var handleOpen = function handleOpen(event) {
|
|
@@ -45,9 +45,9 @@ export var ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(function (props) {
|
|
|
45
45
|
"aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
|
|
46
46
|
size: "small",
|
|
47
47
|
onClick: handleMenuIconClick,
|
|
48
|
-
"aria-
|
|
49
|
-
"aria-
|
|
50
|
-
"aria-controls": columnMenuId,
|
|
48
|
+
"aria-haspopup": "menu",
|
|
49
|
+
"aria-expanded": open,
|
|
50
|
+
"aria-controls": open ? columnMenuId : undefined,
|
|
51
51
|
id: columnMenuButtonId
|
|
52
52
|
}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseIconButton, {
|
|
53
53
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
+
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
5
5
|
import Badge from '@mui/material/Badge';
|
|
6
|
+
import { useGridSelector } from '../../hooks';
|
|
6
7
|
import { gridPreferencePanelStateSelector } from '../../hooks/features/preferencesPanel/gridPreferencePanelSelector';
|
|
7
8
|
import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel/gridPreferencePanelsValue';
|
|
8
9
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
@@ -29,6 +30,9 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
29
30
|
classes: rootProps.classes
|
|
30
31
|
});
|
|
31
32
|
var classes = useUtilityClasses(ownerState);
|
|
33
|
+
var preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
34
|
+
var labelId = useId();
|
|
35
|
+
var panelId = useId();
|
|
32
36
|
var toggleFilter = React.useCallback(function (event) {
|
|
33
37
|
event.preventDefault();
|
|
34
38
|
event.stopPropagation();
|
|
@@ -38,21 +42,26 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
38
42
|
if (open && openedPanelValue === GridPreferencePanelsValue.filters) {
|
|
39
43
|
apiRef.current.hideFilterPanel();
|
|
40
44
|
} else {
|
|
41
|
-
apiRef.current.showFilterPanel();
|
|
45
|
+
apiRef.current.showFilterPanel(undefined, panelId, labelId);
|
|
42
46
|
}
|
|
43
47
|
if (onClick) {
|
|
44
48
|
onClick(apiRef.current.getColumnHeaderParams(field), event);
|
|
45
49
|
}
|
|
46
|
-
}, [apiRef, field, onClick]);
|
|
50
|
+
}, [apiRef, field, onClick, panelId, labelId]);
|
|
47
51
|
if (!counter) {
|
|
48
52
|
return null;
|
|
49
53
|
}
|
|
54
|
+
var open = preferencePanel.open && preferencePanel.labelId === labelId;
|
|
50
55
|
var iconButton = /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
56
|
+
id: labelId,
|
|
51
57
|
onClick: toggleFilter,
|
|
52
58
|
color: "default",
|
|
53
59
|
"aria-label": apiRef.current.getLocaleText('columnHeaderFiltersLabel'),
|
|
54
60
|
size: "small",
|
|
55
|
-
tabIndex: -1
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
"aria-haspopup": "menu",
|
|
63
|
+
"aria-expanded": open,
|
|
64
|
+
"aria-controls": open ? panelId : undefined
|
|
56
65
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseIconButton, {
|
|
57
66
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnFilteredIcon, {
|
|
58
67
|
className: classes.icon,
|
|
@@ -64,9 +64,7 @@ var GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
64
64
|
role: "grid",
|
|
65
65
|
"aria-colcount": visibleColumns.length,
|
|
66
66
|
"aria-rowcount": headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
|
|
67
|
-
"aria-multiselectable": !rootProps.disableMultipleRowSelection
|
|
68
|
-
"aria-label": rootProps['aria-label'],
|
|
69
|
-
"aria-labelledby": rootProps['aria-labelledby']
|
|
67
|
+
"aria-multiselectable": !rootProps.disableMultipleRowSelection
|
|
70
68
|
}, other, {
|
|
71
69
|
children: children
|
|
72
70
|
}));
|
|
@@ -17,7 +17,9 @@ export var GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridPre
|
|
|
17
17
|
return /*#__PURE__*/_jsx(rootProps.slots.panel, _extends({
|
|
18
18
|
ref: ref,
|
|
19
19
|
as: rootProps.slots.basePopper,
|
|
20
|
-
open: columns.length > 0 && preferencePanelState.open
|
|
20
|
+
open: columns.length > 0 && preferencePanelState.open,
|
|
21
|
+
id: preferencePanelState.panelId,
|
|
22
|
+
"aria-labelledby": preferencePanelState.labelId
|
|
21
23
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.panel, props, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.basePopper, {
|
|
22
24
|
children: panelContent
|
|
23
25
|
}));
|
|
@@ -119,6 +119,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
119
119
|
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
120
120
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseInputLabel, {
|
|
121
121
|
id: labelId,
|
|
122
|
+
htmlFor: id,
|
|
122
123
|
shrink: true,
|
|
123
124
|
variant: "standard",
|
|
124
125
|
children: label
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["onClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { unstable_useId as useId } from '@mui/material/utils';
|
|
5
6
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
6
7
|
import { gridPreferencePanelStateSelector } from '../../hooks/features/preferencesPanel/gridPreferencePanelSelector';
|
|
7
8
|
import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel/gridPreferencePanelsValue';
|
|
@@ -12,16 +13,16 @@ export var GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
12
13
|
var _rootProps$slotProps;
|
|
13
14
|
var onClick = props.onClick,
|
|
14
15
|
other = _objectWithoutProperties(props, _excluded);
|
|
16
|
+
var columnButtonId = useId();
|
|
17
|
+
var columnPanelId = useId();
|
|
15
18
|
var apiRef = useGridApiContext();
|
|
16
19
|
var rootProps = useGridRootProps();
|
|
17
|
-
var
|
|
18
|
-
open = _useGridSelector.open,
|
|
19
|
-
openedPanelValue = _useGridSelector.openedPanelValue;
|
|
20
|
+
var preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
20
21
|
var showColumns = function showColumns(event) {
|
|
21
|
-
if (open && openedPanelValue === GridPreferencePanelsValue.columns) {
|
|
22
|
+
if (preferencePanel.open && preferencePanel.openedPanelValue === GridPreferencePanelsValue.columns) {
|
|
22
23
|
apiRef.current.hidePreferences();
|
|
23
24
|
} else {
|
|
24
|
-
apiRef.current.showPreferences(GridPreferencePanelsValue.columns);
|
|
25
|
+
apiRef.current.showPreferences(GridPreferencePanelsValue.columns, columnPanelId, columnButtonId);
|
|
25
26
|
}
|
|
26
27
|
onClick == null ? void 0 : onClick(event);
|
|
27
28
|
};
|
|
@@ -30,10 +31,15 @@ export var GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
30
31
|
if (rootProps.disableColumnSelector) {
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
34
|
+
var isOpen = preferencePanel.open && preferencePanel.panelId === columnPanelId;
|
|
33
35
|
return /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
34
36
|
ref: ref,
|
|
37
|
+
id: columnButtonId,
|
|
35
38
|
size: "small",
|
|
36
39
|
"aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
40
|
+
"aria-haspopup": "menu",
|
|
41
|
+
"aria-expanded": isOpen,
|
|
42
|
+
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
37
43
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
38
44
|
}, other, {
|
|
39
45
|
onClick: showColumns
|
|
@@ -102,9 +102,9 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
|
|
|
102
102
|
size: "small",
|
|
103
103
|
startIcon: startIcon,
|
|
104
104
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
105
|
-
"aria-expanded": open ? 'true' : undefined,
|
|
106
105
|
"aria-haspopup": "menu",
|
|
107
|
-
"aria-
|
|
106
|
+
"aria-expanded": open,
|
|
107
|
+
"aria-controls": open ? densityMenuId : undefined,
|
|
108
108
|
id: densityButtonId
|
|
109
109
|
}, other, {
|
|
110
110
|
onClick: handleDensitySelectorOpen
|
|
@@ -19,8 +19,8 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
19
19
|
other = _objectWithoutProperties(props, _excluded);
|
|
20
20
|
var apiRef = useGridApiContext();
|
|
21
21
|
var rootProps = useGridRootProps();
|
|
22
|
-
var
|
|
23
|
-
var
|
|
22
|
+
var exportButtonId = useId();
|
|
23
|
+
var exportMenuId = useId();
|
|
24
24
|
var _React$useState = React.useState(false),
|
|
25
25
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
26
26
|
open = _React$useState2[0],
|
|
@@ -60,11 +60,11 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
60
60
|
ref: handleRef,
|
|
61
61
|
size: "small",
|
|
62
62
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.exportIcon, {}),
|
|
63
|
-
"aria-expanded": open
|
|
63
|
+
"aria-expanded": open,
|
|
64
64
|
"aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
65
65
|
"aria-haspopup": "menu",
|
|
66
|
-
"aria-
|
|
67
|
-
id:
|
|
66
|
+
"aria-controls": open ? exportMenuId : undefined,
|
|
67
|
+
id: exportButtonId
|
|
68
68
|
}, other, {
|
|
69
69
|
onClick: handleMenuOpen
|
|
70
70
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseButton, {
|
|
@@ -75,9 +75,9 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
75
75
|
onClickAway: handleMenuClickAway,
|
|
76
76
|
position: "bottom-start",
|
|
77
77
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
78
|
-
id:
|
|
78
|
+
id: exportMenuId,
|
|
79
79
|
className: gridClasses.menuList,
|
|
80
|
-
"aria-labelledby":
|
|
80
|
+
"aria-labelledby": exportButtonId,
|
|
81
81
|
onKeyDown: handleListKeyDown,
|
|
82
82
|
autoFocusItem: open,
|
|
83
83
|
children: React.Children.map(children, function (child) {
|
|
@@ -4,7 +4,7 @@ var _excluded = ["componentsProps"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
7
|
+
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize, unstable_useId as useId } from '@mui/utils';
|
|
8
8
|
import Badge from '@mui/material/Badge';
|
|
9
9
|
import { gridColumnLookupSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
10
10
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
@@ -26,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
26
26
|
var GridToolbarFilterListRoot = styled('ul', {
|
|
27
27
|
name: 'MuiDataGrid',
|
|
28
28
|
slot: 'ToolbarFilterList',
|
|
29
|
-
overridesResolver: function overridesResolver(
|
|
29
|
+
overridesResolver: function overridesResolver(_props, styles) {
|
|
30
30
|
return styles.toolbarFilterList;
|
|
31
31
|
}
|
|
32
32
|
})(function (_ref) {
|
|
@@ -48,6 +48,8 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
|
|
|
48
48
|
var lookup = useGridSelector(apiRef, gridColumnLookupSelector);
|
|
49
49
|
var preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
50
50
|
var classes = useUtilityClasses(rootProps);
|
|
51
|
+
var filterButtonId = useId();
|
|
52
|
+
var filterPanelId = useId();
|
|
51
53
|
var tooltipContentNode = React.useMemo(function () {
|
|
52
54
|
if (preferencePanel.open) {
|
|
53
55
|
return apiRef.current.getLocaleText('toolbarFiltersTooltipHide');
|
|
@@ -86,9 +88,9 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
|
|
|
86
88
|
var open = preferencePanel.open,
|
|
87
89
|
openedPanelValue = preferencePanel.openedPanelValue;
|
|
88
90
|
if (open && openedPanelValue === GridPreferencePanelsValue.filters) {
|
|
89
|
-
apiRef.current.
|
|
91
|
+
apiRef.current.hidePreferences();
|
|
90
92
|
} else {
|
|
91
|
-
apiRef.current.
|
|
93
|
+
apiRef.current.showPreferences(GridPreferencePanelsValue.filters, filterPanelId, filterButtonId);
|
|
92
94
|
}
|
|
93
95
|
(_buttonProps$onClick = buttonProps.onClick) == null ? void 0 : _buttonProps$onClick.call(buttonProps, event);
|
|
94
96
|
};
|
|
@@ -97,14 +99,19 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
|
|
|
97
99
|
if (rootProps.disableColumnFilter) {
|
|
98
100
|
return null;
|
|
99
101
|
}
|
|
102
|
+
var isOpen = preferencePanel.open && preferencePanel.panelId === filterPanelId;
|
|
100
103
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
101
104
|
title: tooltipContentNode,
|
|
102
105
|
enterDelay: 1000
|
|
103
106
|
}, other, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTooltip, {
|
|
104
107
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
105
108
|
ref: ref,
|
|
109
|
+
id: filterButtonId,
|
|
106
110
|
size: "small",
|
|
107
111
|
"aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
|
|
112
|
+
"aria-controls": isOpen ? filterPanelId : undefined,
|
|
113
|
+
"aria-expanded": isOpen,
|
|
114
|
+
"aria-haspopup": true,
|
|
108
115
|
startIcon: /*#__PURE__*/_jsx(Badge, {
|
|
109
116
|
badgeContent: activeFilters.length,
|
|
110
117
|
color: "primary",
|
|
@@ -7,7 +7,8 @@ export var GRID_DEFAULT_STRATEGY = 'none';
|
|
|
7
7
|
export var GRID_STRATEGIES_PROCESSORS = {
|
|
8
8
|
rowTreeCreation: 'rowTree',
|
|
9
9
|
filtering: 'rowTree',
|
|
10
|
-
sorting: 'rowTree'
|
|
10
|
+
sorting: 'rowTree',
|
|
11
|
+
visibleRowsLookupCreation: 'rowTree'
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
@@ -27,12 +27,12 @@ export var gridQuickFilterValuesSelector = createSelector(gridFilterModelSelecto
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* @category
|
|
30
|
+
* @category Visible rows
|
|
31
31
|
* @ignore - do not document.
|
|
32
32
|
*/
|
|
33
|
-
export var gridVisibleRowsLookupSelector =
|
|
34
|
-
return
|
|
35
|
-
}
|
|
33
|
+
export var gridVisibleRowsLookupSelector = function gridVisibleRowsLookupSelector(state) {
|
|
34
|
+
return state.visibleRowsLookup;
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @category Filtering
|
|
@@ -11,4 +11,10 @@ export var getDefaultGridFilterModel = function getDefaultGridFilterModel() {
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {GridRowId} rowId The id of the row we want to filter.
|
|
13
13
|
* @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Visibility status for each row.
|
|
18
|
+
* A row is visible if it is passing the filters AND if its parents are expanded.
|
|
19
|
+
* If a row is not registered in this lookup, it is visible.
|
|
14
20
|
*/
|
|
@@ -21,11 +21,21 @@ export var filterStateInitializer = function filterStateInitializer(state, props
|
|
|
21
21
|
return _extends({}, state, {
|
|
22
22
|
filter: {
|
|
23
23
|
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef),
|
|
24
|
-
visibleRowsLookup: {},
|
|
25
24
|
filteredDescendantCountLookup: {}
|
|
26
|
-
}
|
|
25
|
+
},
|
|
26
|
+
visibleRowsLookup: {}
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
+
var getVisibleRowsLookup = function getVisibleRowsLookup(params) {
|
|
30
|
+
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` are equals since no row is collapsed.
|
|
31
|
+
return params.filteredRowsLookup;
|
|
32
|
+
};
|
|
33
|
+
function getVisibleRowsLookupState(apiRef, state) {
|
|
34
|
+
return apiRef.current.applyStrategyProcessor('visibleRowsLookupCreation', {
|
|
35
|
+
tree: state.rows.tree,
|
|
36
|
+
filteredRowsLookup: state.filter.filteredRowsLookup
|
|
37
|
+
});
|
|
38
|
+
}
|
|
29
39
|
|
|
30
40
|
/**
|
|
31
41
|
* @requires useGridColumns (method, event)
|
|
@@ -50,9 +60,13 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
50
60
|
isRowMatchingFilters: isRowMatchingFilters,
|
|
51
61
|
filterModel: filterModel != null ? filterModel : getDefaultGridFilterModel()
|
|
52
62
|
});
|
|
53
|
-
|
|
63
|
+
var newState = _extends({}, state, {
|
|
54
64
|
filter: _extends({}, state.filter, filteringResult)
|
|
55
65
|
});
|
|
66
|
+
var visibleRowsLookupState = getVisibleRowsLookupState(apiRef, newState);
|
|
67
|
+
return _extends({}, newState, {
|
|
68
|
+
visibleRowsLookup: visibleRowsLookupState
|
|
69
|
+
});
|
|
56
70
|
});
|
|
57
71
|
apiRef.current.publishEvent('filteredRowsSet');
|
|
58
72
|
}, [props.filterMode, apiRef]);
|
|
@@ -114,7 +128,7 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
114
128
|
items: items
|
|
115
129
|
}), 'deleteFilterItem');
|
|
116
130
|
}, [apiRef]);
|
|
117
|
-
var showFilterPanel = React.useCallback(function (targetColumnField) {
|
|
131
|
+
var showFilterPanel = React.useCallback(function (targetColumnField, panelId, labelId) {
|
|
118
132
|
logger.debug('Displaying filter panel');
|
|
119
133
|
if (targetColumnField) {
|
|
120
134
|
var filterModel = gridFilterModelSelector(apiRef);
|
|
@@ -164,7 +178,7 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
164
178
|
items: newFilterItems
|
|
165
179
|
}));
|
|
166
180
|
}
|
|
167
|
-
apiRef.current.showPreferences(GridPreferencePanelsValue.filters);
|
|
181
|
+
apiRef.current.showPreferences(GridPreferencePanelsValue.filters, panelId, labelId);
|
|
168
182
|
}, [apiRef, logger, props.disableMultipleColumnsFiltering]);
|
|
169
183
|
var hideFilterPanel = React.useCallback(function () {
|
|
170
184
|
logger.debug('Hiding filter panel');
|
|
@@ -272,13 +286,10 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
272
286
|
}
|
|
273
287
|
return {
|
|
274
288
|
filteredRowsLookup: filteredRowsLookup,
|
|
275
|
-
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` are equals since no row is collapsed.
|
|
276
|
-
visibleRowsLookup: filteredRowsLookup,
|
|
277
289
|
filteredDescendantCountLookup: {}
|
|
278
290
|
};
|
|
279
291
|
}
|
|
280
292
|
return {
|
|
281
|
-
visibleRowsLookup: {},
|
|
282
293
|
filteredRowsLookup: {},
|
|
283
294
|
filteredDescendantCountLookup: {}
|
|
284
295
|
};
|
|
@@ -288,6 +299,7 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
288
299
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
289
300
|
useGridRegisterPipeProcessor(apiRef, 'preferencePanel', preferencePanelPreProcessing);
|
|
290
301
|
useGridRegisterStrategyProcessor(apiRef, GRID_DEFAULT_STRATEGY, 'filtering', flatFilteringMethod);
|
|
302
|
+
useGridRegisterStrategyProcessor(apiRef, GRID_DEFAULT_STRATEGY, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
291
303
|
|
|
292
304
|
/**
|
|
293
305
|
* EVENTS
|
|
@@ -310,13 +322,21 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
310
322
|
apiRef.current.unstable_applyFilters();
|
|
311
323
|
}
|
|
312
324
|
}, [apiRef]);
|
|
325
|
+
var updateVisibleRowsLookupState = React.useCallback(function () {
|
|
326
|
+
apiRef.current.setState(function (state) {
|
|
327
|
+
return _extends({}, state, {
|
|
328
|
+
visibleRowsLookup: getVisibleRowsLookupState(apiRef, state)
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
apiRef.current.forceUpdate();
|
|
332
|
+
}, [apiRef]);
|
|
313
333
|
|
|
314
334
|
// Do not call `apiRef.current.forceUpdate` to avoid re-render before updating the sorted rows.
|
|
315
335
|
// Otherwise, the state is not consistent during the render
|
|
316
336
|
useGridApiEventHandler(apiRef, 'rowsSet', updateFilteredRows);
|
|
317
|
-
useGridApiEventHandler(apiRef, 'rowExpansionChange', apiRef.current.unstable_applyFilters);
|
|
318
337
|
useGridApiEventHandler(apiRef, 'columnsChange', handleColumnsChange);
|
|
319
338
|
useGridApiEventHandler(apiRef, 'activeStrategyProcessorChange', handleStrategyProcessorChange);
|
|
339
|
+
useGridApiEventHandler(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
320
340
|
|
|
321
341
|
/**
|
|
322
342
|
* 1ST RENDER
|
|
@@ -56,14 +56,16 @@ export var useGridPreferencesPanel = function useGridPreferencesPanel(apiRef, pr
|
|
|
56
56
|
var hidePreferencesDelayed = React.useCallback(function () {
|
|
57
57
|
hideTimeout.current = setTimeout(hidePreferences, 100);
|
|
58
58
|
}, [hidePreferences]);
|
|
59
|
-
var showPreferences = React.useCallback(function (newValue) {
|
|
59
|
+
var showPreferences = React.useCallback(function (newValue, panelId, labelId) {
|
|
60
60
|
logger.debug('Opening Preferences Panel');
|
|
61
61
|
doNotHidePanel();
|
|
62
62
|
apiRef.current.setState(function (state) {
|
|
63
63
|
return _extends({}, state, {
|
|
64
64
|
preferencePanel: _extends({}, state.preferencePanel, {
|
|
65
65
|
open: true,
|
|
66
|
-
openedPanelValue: newValue
|
|
66
|
+
openedPanelValue: newValue,
|
|
67
|
+
panelId: panelId,
|
|
68
|
+
labelId: labelId
|
|
67
69
|
})
|
|
68
70
|
});
|
|
69
71
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { unstable_debounce as debounce, unstable_capitalize as capitalize } from '@mui/utils';
|
|
@@ -105,20 +104,14 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
105
104
|
} else {
|
|
106
105
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
107
106
|
}
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
acc[key] = size;
|
|
107
|
+
var initialHeights = {};
|
|
108
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
109
|
+
for (var _key in sizes) {
|
|
110
|
+
if (/^base[A-Z]/.test(_key)) {
|
|
111
|
+
initialHeights[_key] = sizes[_key];
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// We use an object to make simple to check if a height is already added or not
|
|
119
|
-
var initialHeights = _extends({}, existingBaseSizes, {
|
|
120
|
-
baseCenter: baseRowHeight
|
|
121
|
-
});
|
|
113
|
+
}
|
|
114
|
+
initialHeights.baseCenter = baseRowHeight;
|
|
122
115
|
if (getRowSpacing) {
|
|
123
116
|
var _spacing$top, _spacing$bottom;
|
|
124
117
|
var indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
@@ -140,16 +133,15 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
140
133
|
var maximumBaseSize = 0;
|
|
141
134
|
var otherSizes = 0;
|
|
142
135
|
var processedSizes = calculateRowProcessedSizes(row);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (/^base[A-Z]/.test(size)) {
|
|
136
|
+
/* eslint-disable-next-line no-restricted-syntax, guard-for-in */
|
|
137
|
+
for (var _key2 in processedSizes) {
|
|
138
|
+
var value = processedSizes[_key2];
|
|
139
|
+
if (/^base[A-Z]/.test(_key2)) {
|
|
148
140
|
maximumBaseSize = value > maximumBaseSize ? value : maximumBaseSize;
|
|
149
141
|
} else {
|
|
150
142
|
otherSizes += value;
|
|
151
143
|
}
|
|
152
|
-
}
|
|
144
|
+
}
|
|
153
145
|
return acc + maximumBaseSize + otherSizes;
|
|
154
146
|
}, 0);
|
|
155
147
|
pinnedRows == null ? void 0 : (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.forEach(function (row) {
|
package/legacy/index.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["components", "componentsProps"];
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
5
|
+
function groupForwardedProps(props) {
|
|
6
|
+
var _props$forwardedProps;
|
|
7
|
+
var keys = Object.keys(props);
|
|
8
|
+
if (!keys.some(function (key) {
|
|
9
|
+
return key.startsWith('aria-') || key.startsWith('data-');
|
|
10
|
+
})) {
|
|
11
|
+
return props;
|
|
12
|
+
}
|
|
13
|
+
var newProps = {};
|
|
14
|
+
var forwardedProps = (_props$forwardedProps = props.forwardedProps) != null ? _props$forwardedProps : {};
|
|
15
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
16
|
+
var _key = keys[i];
|
|
17
|
+
if (_key.startsWith('aria-') || _key.startsWith('data-')) {
|
|
18
|
+
forwardedProps[_key] = props[_key];
|
|
19
|
+
} else {
|
|
20
|
+
newProps[_key] = props[_key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
newProps.forwardedProps = forwardedProps;
|
|
24
|
+
return newProps;
|
|
25
|
+
}
|
|
4
26
|
export function useProps(allProps) {
|
|
5
27
|
return React.useMemo(function () {
|
|
6
28
|
var components = allProps.components,
|
|
7
29
|
componentsProps = allProps.componentsProps,
|
|
8
30
|
themedProps = _objectWithoutProperties(allProps, _excluded);
|
|
9
|
-
return [components, componentsProps, themedProps];
|
|
31
|
+
return [components, componentsProps, groupForwardedProps(themedProps)];
|
|
10
32
|
}, [allProps]);
|
|
11
33
|
}
|