@mui/x-data-grid 5.7.0 → 5.8.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 +74 -0
- package/DataGrid/DataGrid.d.ts +8 -3
- package/DataGrid/DataGrid.js +27 -4
- package/DataGrid/useDataGridComponent.js +2 -4
- package/DataGrid/useDataGridProps.d.ts +2 -1
- package/colDef/gridBooleanColDef.d.ts +1 -1
- package/colDef/gridBooleanOperators.d.ts +1 -1
- package/colDef/gridDateColDef.d.ts +5 -9
- package/colDef/gridDateColDef.js +2 -2
- package/colDef/gridDateOperators.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/colDef/gridNumericColDef.d.ts +1 -1
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridStringColDef.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/index.d.ts +1 -0
- package/colDef/index.js +2 -1
- package/components/GridRow.js +1 -1
- package/components/cell/GridCell.d.ts +4 -4
- package/components/cell/GridCell.js +2 -2
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +2 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +12 -0
- package/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/components/columnHeaders/index.d.ts +1 -0
- package/components/columnHeaders/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +29 -17
- package/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/GridPreferencesPanel.js +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +15 -3
- package/hooks/core/index.d.ts +1 -1
- package/hooks/core/{preProcessing/gridPreProcessingApi.d.ts → pipeProcessing/gridPipeProcessingApi.d.ts} +19 -18
- package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/hooks/core/pipeProcessing/index.d.ts +3 -0
- package/hooks/core/pipeProcessing/index.js +3 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +27 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +7 -0
- package/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +27 -16
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -6
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
- package/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/hooks/features/columns/useGridColumns.js +36 -27
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -9
- package/hooks/features/filter/useGridFilter.js +4 -4
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.d.ts +2 -5
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -3
- package/hooks/features/pagination/useGridPage.js +9 -4
- package/hooks/features/pagination/useGridPageSize.js +3 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.js +11 -0
- package/hooks/features/rows/index.d.ts +1 -0
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRows.js +3 -3
- package/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/hooks/features/scroll/useGridScroll.js +4 -13
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -3
- package/hooks/features/selection/useGridSelection.d.ts +4 -2
- package/hooks/features/selection/useGridSelection.js +72 -25
- package/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -3
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -2
- package/hooks/features/sorting/useGridSorting.js +3 -3
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -6
- package/internals/index.js +2 -3
- package/legacy/DataGrid/DataGrid.js +27 -4
- package/legacy/DataGrid/useDataGridComponent.js +2 -4
- package/legacy/colDef/gridDateColDef.js +2 -2
- package/legacy/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/legacy/colDef/index.js +2 -1
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/cell/GridCell.js +2 -2
- package/legacy/components/cell/GridEditInputCell.js +2 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -2
- package/legacy/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/legacy/components/columnHeaders/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/legacy/components/containers/GridRoot.js +34 -17
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/legacy/components/panel/GridPreferencesPanel.js +1 -1
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/legacy/hooks/core/pipeProcessing/index.js +3 -0
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +83 -0
- package/legacy/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/legacy/hooks/core/useGridInitialization.js +2 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/legacy/hooks/features/columns/gridColumnsUtils.js +49 -18
- package/legacy/hooks/features/columns/useGridColumns.js +36 -27
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/useGridFilter.js +4 -4
- package/legacy/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/legacy/hooks/features/pagination/useGridPage.js +11 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +3 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +13 -0
- package/legacy/hooks/features/rows/index.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +5 -5
- package/legacy/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/legacy/hooks/features/scroll/useGridScroll.js +4 -13
- package/legacy/hooks/features/selection/useGridSelection.js +74 -25
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +3 -3
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -3
- package/legacy/locales/daDK.js +36 -32
- package/legacy/models/colDef/index.js +1 -2
- package/legacy/models/events/gridEvents.js +4 -2
- package/legacy/models/gridRows.js +1 -33
- package/legacy/models/index.js +2 -2
- package/{modern/hooks/core/preProcessing/gridPreProcessingApi.js → legacy/models/params/gridPreferencePanelParams.js} +0 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/daDK.js +32 -32
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridEditingApi.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +5 -5
- package/models/api/gridRowApi.d.ts +2 -2
- package/models/colDef/gridColDef.d.ts +33 -28
- package/models/colDef/index.d.ts +0 -1
- package/models/colDef/index.js +1 -2
- package/models/events/gridEventLookup.d.ts +12 -6
- package/models/events/gridEvents.d.ts +11 -5
- package/models/events/gridEvents.js +4 -2
- package/models/gridCell.d.ts +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +3 -2
- package/models/gridRows.d.ts +10 -18
- package/models/gridRows.js +1 -31
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +1 -0
- package/models/gridSortModel.d.ts +3 -4
- package/models/index.d.ts +1 -1
- package/models/index.js +2 -2
- package/models/params/gridCellParams.d.ts +14 -14
- package/models/params/gridColumnHeaderParams.d.ts +3 -2
- package/models/params/gridEditCellParams.d.ts +2 -3
- package/models/params/gridPreferencePanelParams.d.ts +3 -0
- package/models/params/gridPreferencePanelParams.js +1 -0
- package/models/params/gridRowParams.d.ts +7 -8
- package/models/params/gridValueOptionsParams.d.ts +3 -3
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +36 -16
- package/modern/DataGrid/DataGrid.js +27 -4
- package/modern/DataGrid/useDataGridComponent.js +2 -4
- package/modern/colDef/gridDateColDef.js +2 -2
- package/modern/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/modern/colDef/index.js +2 -1
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/cell/GridEditInputCell.js +2 -2
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
- package/modern/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +29 -17
- package/modern/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/modern/components/panel/GridPreferencesPanel.js +1 -1
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/hooks/core/pipeProcessing/gridPipeProcessingApi.js +1 -0
- package/modern/hooks/core/pipeProcessing/index.js +3 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/modern/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/modern/hooks/features/columns/useGridColumns.js +36 -27
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/useGridFilter.js +4 -4
- package/modern/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/modern/hooks/features/pagination/useGridPage.js +9 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +3 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/modern/hooks/features/rows/gridRowsUtils.js +11 -0
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/modern/hooks/features/scroll/useGridScroll.js +4 -9
- package/modern/hooks/features/selection/useGridSelection.js +72 -25
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/modern/hooks/features/sorting/useGridSorting.js +3 -3
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -3
- package/modern/locales/daDK.js +32 -32
- package/modern/models/colDef/index.js +1 -2
- package/modern/models/events/gridEvents.js +4 -2
- package/modern/models/gridRows.js +1 -31
- package/modern/models/index.js +2 -2
- package/modern/models/params/gridPreferencePanelParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +27 -4
- package/node/DataGrid/useDataGridComponent.js +2 -5
- package/node/colDef/gridDateColDef.js +2 -2
- package/node/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/node/colDef/index.js +13 -0
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridCell.js +2 -2
- package/node/components/cell/GridEditInputCell.js +2 -2
- package/node/components/cell/GridEditSingleSelectCell.js +2 -2
- package/node/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +23 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/node/components/columnHeaders/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/node/components/containers/GridRoot.js +28 -17
- package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/node/components/panel/GridPreferencesPanel.js +1 -1
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/node/hooks/core/pipeProcessing/index.js +44 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +93 -0
- package/node/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +4 -4
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +54 -21
- package/node/hooks/features/columns/useGridColumns.js +36 -27
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +24 -7
- package/node/hooks/features/editRows/useGridRowEditing.new.js +24 -7
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/useGridFilter.js +4 -4
- package/node/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +29 -6
- package/node/hooks/features/pagination/useGridPage.js +8 -3
- package/node/hooks/features/pagination/useGridPageSize.js +3 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +20 -5
- package/node/hooks/features/rows/gridRowsUtils.js +18 -0
- package/node/hooks/features/rows/index.js +15 -1
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/node/hooks/features/scroll/useGridScroll.js +3 -13
- package/node/hooks/features/selection/useGridSelection.js +71 -24
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/node/hooks/features/sorting/useGridSorting.js +3 -3
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +4 -12
- package/node/locales/daDK.js +32 -32
- package/node/models/colDef/index.js +0 -13
- package/node/models/events/gridEvents.js +4 -2
- package/node/models/gridRows.js +1 -34
- package/node/models/index.js +13 -13
- package/node/models/params/gridPreferencePanelParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +1 -1
- package/components/columnHeaders/ColumnHeaderFilterIcon.d.ts +0 -5
- package/hooks/core/preProcessing/index.d.ts +0 -3
- package/hooks/core/preProcessing/index.js +0 -3
- package/hooks/core/preProcessing/useGridPreProcessing.d.ts +0 -6
- package/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/hooks/core/preProcessing/useGridRegisterPreProcessor.d.ts +0 -7
- package/hooks/features/keyboard/useGridKeyboard.d.ts +0 -10
- package/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/legacy/hooks/core/preProcessing/index.js +0 -3
- package/legacy/hooks/core/preProcessing/useGridPreProcessing.js +0 -62
- package/legacy/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/modern/hooks/core/preProcessing/index.js +0 -3
- package/modern/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/modern/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/node/hooks/core/preProcessing/index.js +0 -44
- package/node/hooks/core/preProcessing/useGridPreProcessing.js +0 -72
- package/node/hooks/features/keyboard/useGridKeyboard.js +0 -91
|
@@ -151,7 +151,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
151
151
|
* Get the cell value of a row and field.
|
|
152
152
|
* @param {GridRowId} id The row id.
|
|
153
153
|
* @param {string} field The field.
|
|
154
|
-
* @returns {
|
|
154
|
+
* @returns {any} The cell value.
|
|
155
155
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
156
156
|
*/
|
|
157
157
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -176,7 +176,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
176
176
|
/**
|
|
177
177
|
* The row model of the row that the current cell belongs to.
|
|
178
178
|
*/
|
|
179
|
-
row: _propTypes.default.
|
|
179
|
+
row: _propTypes.default.object.isRequired,
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* The node of the row that the current cell belongs to.
|
|
@@ -211,7 +211,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
211
211
|
* Get the cell value of a row and field.
|
|
212
212
|
* @param {GridRowId} id The row id.
|
|
213
213
|
* @param {string} field The field.
|
|
214
|
-
* @returns {
|
|
214
|
+
* @returns {any} The cell value.
|
|
215
215
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
216
216
|
*/
|
|
217
217
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -236,7 +236,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
236
236
|
/**
|
|
237
237
|
* The row model of the row that the current cell belongs to.
|
|
238
238
|
*/
|
|
239
|
-
row: _propTypes.default.
|
|
239
|
+
row: _propTypes.default.object.isRequired,
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* The node of the row that the current cell belongs to.
|
|
@@ -5,12 +5,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.GridColumnHeaderFilterIconButton = GridColumnHeaderFilterIconButton;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
14
16
|
var _material = require("@mui/material");
|
|
15
17
|
|
|
16
18
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
@@ -45,11 +47,13 @@ const useUtilityClasses = ownerState => {
|
|
|
45
47
|
return (0, _material.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
function
|
|
50
|
+
function GridColumnHeaderFilterIconButton(props) {
|
|
49
51
|
var _rootProps$components;
|
|
50
52
|
|
|
51
53
|
const {
|
|
52
|
-
counter
|
|
54
|
+
counter,
|
|
55
|
+
field,
|
|
56
|
+
onClick
|
|
53
57
|
} = props;
|
|
54
58
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
55
59
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -70,7 +74,11 @@ function ColumnHeaderFilterIcon(props) {
|
|
|
70
74
|
} else {
|
|
71
75
|
apiRef.current.showFilterPanel();
|
|
72
76
|
}
|
|
73
|
-
|
|
77
|
+
|
|
78
|
+
if (onClick) {
|
|
79
|
+
onClick(apiRef.current.getColumnHeaderParams(field), event);
|
|
80
|
+
}
|
|
81
|
+
}, [apiRef, field, onClick]);
|
|
74
82
|
|
|
75
83
|
if (!counter) {
|
|
76
84
|
return null;
|
|
@@ -99,4 +107,14 @@ function ColumnHeaderFilterIcon(props) {
|
|
|
99
107
|
}), counter === 1 && iconButton]
|
|
100
108
|
})
|
|
101
109
|
}));
|
|
102
|
-
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButton.propTypes = {
|
|
113
|
+
// ----------------------------- Warning --------------------------------
|
|
114
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
115
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
116
|
+
// ----------------------------------------------------------------------
|
|
117
|
+
counter: _propTypes.default.number,
|
|
118
|
+
field: _propTypes.default.string.isRequired,
|
|
119
|
+
onClick: _propTypes.default.func
|
|
120
|
+
} : void 0;
|
|
@@ -31,8 +31,6 @@ var _GridColumnHeaderSeparator = require("./GridColumnHeaderSeparator");
|
|
|
31
31
|
|
|
32
32
|
var _ColumnHeaderMenuIcon = require("./ColumnHeaderMenuIcon");
|
|
33
33
|
|
|
34
|
-
var _ColumnHeaderFilterIcon = require("./ColumnHeaderFilterIcon");
|
|
35
|
-
|
|
36
34
|
var _GridColumnHeaderMenu = require("../menu/columnMenu/GridColumnHeaderMenu");
|
|
37
35
|
|
|
38
36
|
var _gridClasses = require("../../constants/gridClasses");
|
|
@@ -68,7 +66,7 @@ const useUtilityClasses = ownerState => {
|
|
|
68
66
|
};
|
|
69
67
|
|
|
70
68
|
function GridColumnHeaderItem(props) {
|
|
71
|
-
var _apiRef$current$getRo, _column$sortingOrder, _column$headerName, _rootProps$
|
|
69
|
+
var _apiRef$current$getRo, _column$sortingOrder, _rootProps$components, _column$headerName, _rootProps$components2;
|
|
72
70
|
|
|
73
71
|
const {
|
|
74
72
|
column,
|
|
@@ -167,9 +165,10 @@ function GridColumnHeaderItem(props) {
|
|
|
167
165
|
});
|
|
168
166
|
const sortingOrder = (_column$sortingOrder = column.sortingOrder) != null ? _column$sortingOrder : rootProps.sortingOrder;
|
|
169
167
|
const columnTitleIconButtons = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
170
|
-
children: [!rootProps.disableColumnFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
168
|
+
children: [!rootProps.disableColumnFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.ColumnHeaderFilterIconButton, (0, _extends2.default)({
|
|
169
|
+
field: column.field,
|
|
171
170
|
counter: filterItemsCounter
|
|
172
|
-
}), column.sortable && !column.hideSortIcons && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderSortIcon.GridColumnHeaderSortIcon, {
|
|
171
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.columnHeaderFilterIconButton)), column.sortable && !column.hideSortIcons && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderSortIcon.GridColumnHeaderSortIcon, {
|
|
173
172
|
direction: sortDirection,
|
|
174
173
|
index: sortIndex,
|
|
175
174
|
sortingOrder: sortingOrder
|
|
@@ -234,7 +233,7 @@ function GridColumnHeaderItem(props) {
|
|
|
234
233
|
open: columnMenuOpen,
|
|
235
234
|
target: iconButtonRef.current,
|
|
236
235
|
ContentComponent: rootProps.components.ColumnMenu,
|
|
237
|
-
contentComponentProps: (_rootProps$
|
|
236
|
+
contentComponentProps: (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.columnMenu,
|
|
238
237
|
onExited: handleExited
|
|
239
238
|
})]
|
|
240
239
|
}));
|
|
@@ -43,6 +43,19 @@ Object.keys(_GridColumnHeaderSortIcon).forEach(function (key) {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
var _GridColumnHeaderFilterIconButton = require("./GridColumnHeaderFilterIconButton");
|
|
47
|
+
|
|
48
|
+
Object.keys(_GridColumnHeaderFilterIconButton).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _GridColumnHeaderFilterIconButton[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _GridColumnHeaderFilterIconButton[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
46
59
|
var _GridColumnHeaderTitle = require("./GridColumnHeaderTitle");
|
|
47
60
|
|
|
48
61
|
Object.keys(_GridColumnHeaderTitle).forEach(function (key) {
|
|
@@ -150,7 +150,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
150
150
|
* Get the cell value of a row and field.
|
|
151
151
|
* @param {GridRowId} id The row id.
|
|
152
152
|
* @param {string} field The field.
|
|
153
|
-
* @returns {
|
|
153
|
+
* @returns {any} The cell value.
|
|
154
154
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
155
155
|
*/
|
|
156
156
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -173,7 +173,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
173
173
|
/**
|
|
174
174
|
* The row model of the row that the current cell belongs to.
|
|
175
175
|
*/
|
|
176
|
-
row: _propTypes.default.
|
|
176
|
+
row: _propTypes.default.object.isRequired,
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* The node of the row that the current cell belongs to.
|
|
@@ -19,8 +19,6 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
19
19
|
|
|
20
20
|
var _utils = require("@mui/material/utils");
|
|
21
21
|
|
|
22
|
-
var _NoSsr = _interopRequireDefault(require("@mui/material/NoSsr"));
|
|
23
|
-
|
|
24
22
|
var _GridRootStyles = require("./GridRootStyles");
|
|
25
23
|
|
|
26
24
|
var _gridColumnsSelector = require("../../hooks/features/columns/gridColumnsSelector");
|
|
@@ -57,21 +55,34 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
57
55
|
const totalRowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowCountSelector);
|
|
58
56
|
const rootContainerRef = React.useRef(null);
|
|
59
57
|
const handleRef = (0, _utils.useForkRef)(rootContainerRef, ref);
|
|
60
|
-
apiRef.current.rootElementRef = rootContainerRef;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
58
|
+
apiRef.current.rootElementRef = rootContainerRef; // Our implementation of <NoSsr />
|
|
59
|
+
|
|
60
|
+
const [mountedState, setMountedState] = React.useState(false);
|
|
61
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
62
|
+
setMountedState(true);
|
|
63
|
+
}, []);
|
|
64
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
65
|
+
if (mountedState) {
|
|
66
|
+
apiRef.current.unstable_updateGridDimensionsRef();
|
|
67
|
+
}
|
|
68
|
+
}, [apiRef, mountedState]);
|
|
69
|
+
|
|
70
|
+
if (!mountedState) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRootStyles.GridRootStyles, (0, _extends2.default)({
|
|
75
|
+
ref: handleRef,
|
|
76
|
+
className: (0, _clsx.default)(className, (_rootProps$classes = rootProps.classes) == null ? void 0 : _rootProps$classes.root, _gridClasses.gridClasses.root, rootProps.autoHeight && _gridClasses.gridClasses.autoHeight),
|
|
77
|
+
role: "grid",
|
|
78
|
+
"aria-colcount": visibleColumns.length,
|
|
79
|
+
"aria-rowcount": totalRowCount,
|
|
80
|
+
"aria-multiselectable": !rootProps.disableMultipleSelection,
|
|
81
|
+
"aria-label": rootProps['aria-label'],
|
|
82
|
+
"aria-labelledby": rootProps['aria-labelledby']
|
|
83
|
+
}, other, {
|
|
84
|
+
children: children
|
|
85
|
+
}));
|
|
75
86
|
});
|
|
76
87
|
exports.GridRoot = GridRoot;
|
|
77
88
|
process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
@@ -53,7 +53,7 @@ const GridColumnMenu = /*#__PURE__*/React.forwardRef(function GridColumnMenu(pro
|
|
|
53
53
|
onClick: hideMenu,
|
|
54
54
|
column: currentColumn
|
|
55
55
|
})];
|
|
56
|
-
const preProcessedButtons = apiRef.current.
|
|
56
|
+
const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('columnMenu', defaultButtons, currentColumn);
|
|
57
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnMenuContainer.GridColumnMenuContainer, (0, _extends2.default)({
|
|
58
58
|
ref: ref
|
|
59
59
|
}, props, {
|
|
@@ -36,7 +36,7 @@ const GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridPreferen
|
|
|
36
36
|
const columns = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnDefinitionsSelector);
|
|
37
37
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
38
38
|
const preferencePanelState = (0, _useGridSelector.useGridSelector)(apiRef, _gridPreferencePanelSelector.gridPreferencePanelStateSelector);
|
|
39
|
-
const panelContent = apiRef.current.
|
|
39
|
+
const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, (_preferencePanelState = preferencePanelState.openedPanelValue) != null ? _preferencePanelState : _gridPreferencePanelsValue.GridPreferencePanelsValue.filters);
|
|
40
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.Panel, (0, _extends2.default)({
|
|
41
41
|
ref: ref,
|
|
42
42
|
as: rootProps.components.BasePopper,
|
|
@@ -71,6 +71,7 @@ const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = (0, _extends2.default)({}, DEFAULT_GR
|
|
|
71
71
|
BaseTooltip: _Tooltip.default,
|
|
72
72
|
BasePopper: _Popper.default,
|
|
73
73
|
Cell: _components.GridCell,
|
|
74
|
+
ColumnHeaderFilterIconButton: _components.GridColumnHeaderFilterIconButton,
|
|
74
75
|
ColumnMenu: _components.GridColumnMenu,
|
|
75
76
|
ErrorOverlay: _ErrorOverlay.ErrorOverlay,
|
|
76
77
|
Footer: _components.GridFooter,
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _gridPipeProcessingApi = require("./gridPipeProcessingApi");
|
|
8
|
+
|
|
9
|
+
Object.keys(_gridPipeProcessingApi).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _gridPipeProcessingApi[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _gridPipeProcessingApi[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _useGridPipeProcessing = require("./useGridPipeProcessing");
|
|
21
|
+
|
|
22
|
+
Object.keys(_useGridPipeProcessing).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _useGridPipeProcessing[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _useGridPipeProcessing[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _useGridRegisterPipeProcessor = require("./useGridRegisterPipeProcessor");
|
|
34
|
+
|
|
35
|
+
Object.keys(_useGridRegisterPipeProcessor).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _useGridRegisterPipeProcessor[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _useGridRegisterPipeProcessor[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useGridPipeProcessing = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
|
|
12
|
+
var _toPropertyKey2 = _interopRequireDefault(require("@babel/runtime/helpers/toPropertyKey"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
19
|
+
|
|
20
|
+
var _events = require("../../../models/events");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Implement the Pipeline Pattern
|
|
28
|
+
*
|
|
29
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
30
|
+
*
|
|
31
|
+
* Some plugins contains custom logic to enrich data provided by other plugins or components.
|
|
32
|
+
* For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
|
|
33
|
+
*
|
|
34
|
+
* =====================================================================================================================
|
|
35
|
+
*
|
|
36
|
+
* The plugin containing the custom logic must use:
|
|
37
|
+
*
|
|
38
|
+
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
39
|
+
* When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
|
|
40
|
+
*
|
|
41
|
+
* =====================================================================================================================
|
|
42
|
+
*
|
|
43
|
+
* The plugin or component that needs to enrich its data must use:
|
|
44
|
+
*
|
|
45
|
+
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
46
|
+
*
|
|
47
|
+
* - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
const useGridPipeProcessing = apiRef => {
|
|
51
|
+
const processorsCache = React.useRef({});
|
|
52
|
+
const registerPipeProcessor = React.useCallback((group, id, processor) => {
|
|
53
|
+
if (!processorsCache.current[group]) {
|
|
54
|
+
processorsCache.current[group] = {};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const groupProcessors = processorsCache.current[group];
|
|
58
|
+
const oldProcessor = groupProcessors[id];
|
|
59
|
+
|
|
60
|
+
if (oldProcessor !== processor) {
|
|
61
|
+
processorsCache.current[group] = (0, _extends2.default)({}, groupProcessors, {
|
|
62
|
+
[id]: processor
|
|
63
|
+
});
|
|
64
|
+
apiRef.current.publishEvent(_events.GridEvents.pipeProcessorRegister, group);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return () => {
|
|
68
|
+
const _ref = processorsCache.current[group],
|
|
69
|
+
otherProcessors = (0, _objectWithoutPropertiesLoose2.default)(_ref, [id].map(_toPropertyKey2.default));
|
|
70
|
+
processorsCache.current[group] = otherProcessors;
|
|
71
|
+
apiRef.current.publishEvent(_events.GridEvents.pipeProcessorUnregister, group);
|
|
72
|
+
};
|
|
73
|
+
}, [apiRef]);
|
|
74
|
+
const applyPipeProcessors = React.useCallback((...args) => {
|
|
75
|
+
const [group, value, context] = args;
|
|
76
|
+
|
|
77
|
+
if (!processorsCache.current[group]) {
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const preProcessors = Object.values(processorsCache.current[group]);
|
|
82
|
+
return preProcessors.reduce((acc, preProcessor) => {
|
|
83
|
+
return preProcessor(acc, context);
|
|
84
|
+
}, value);
|
|
85
|
+
}, []);
|
|
86
|
+
const preProcessingApi = {
|
|
87
|
+
unstable_registerPipeProcessor: registerPipeProcessor,
|
|
88
|
+
unstable_applyPipeProcessors: applyPipeProcessors
|
|
89
|
+
};
|
|
90
|
+
(0, _useGridApiMethod.useGridApiMethod)(apiRef, preProcessingApi, 'GridPipeProcessingApi');
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
exports.useGridPipeProcessing = useGridPipeProcessing;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useGridRegisterPipeProcessor = void 0;
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -16,11 +16,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
/**
|
|
17
17
|
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
20
20
|
const cleanup = React.useRef();
|
|
21
21
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
22
22
|
const registerPreProcessor = React.useCallback(() => {
|
|
23
|
-
cleanup.current = apiRef.current.
|
|
23
|
+
cleanup.current = apiRef.current.unstable_registerPipeProcessor(group, id.current, callback);
|
|
24
24
|
}, [apiRef, callback, group]);
|
|
25
25
|
(0, _useFirstRender.useFirstRender)(() => {
|
|
26
26
|
registerPreProcessor();
|
|
@@ -42,4 +42,4 @@ const useGridRegisterPreProcessor = (apiRef, group, callback) => {
|
|
|
42
42
|
}, [registerPreProcessor]);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
exports.
|
|
45
|
+
exports.useGridRegisterPipeProcessor = useGridRegisterPipeProcessor;
|
|
@@ -33,31 +33,42 @@ exports.GRID_STRATEGIES_PROCESSORS = GRID_STRATEGIES_PROCESSORS;
|
|
|
33
33
|
/**
|
|
34
34
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
37
|
+
*
|
|
38
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
39
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
40
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
41
|
+
* but not if the tree data is the current way of grouping rows.
|
|
42
|
+
*
|
|
43
|
+
* =====================================================================================================================
|
|
44
|
+
*
|
|
45
|
+
* The plugin containing the custom logic must use:
|
|
46
|
+
*
|
|
47
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
48
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
41
49
|
*
|
|
42
|
-
* These plugins must use:
|
|
43
|
-
* - `apiRef.current.unstable_registerStrategyProcessor` to register their processors.
|
|
44
50
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
45
51
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* -
|
|
52
|
+
* =====================================================================================================================
|
|
53
|
+
*
|
|
54
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
55
|
+
*
|
|
56
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
51
57
|
*
|
|
52
|
-
* These hooks must use:
|
|
53
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
54
58
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
55
59
|
* Warning: Be careful not to apply the processor several times.
|
|
56
60
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
57
61
|
* So listening to both would most likely run your logic twice.
|
|
58
|
-
*
|
|
62
|
+
*
|
|
63
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
64
|
+
*
|
|
65
|
+
* =====================================================================================================================
|
|
59
66
|
*
|
|
60
67
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
68
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
69
|
+
* - row tree creation algorithm.
|
|
70
|
+
* - sorting algorithm.
|
|
71
|
+
* - filtering algorithm.
|
|
61
72
|
*/
|
|
62
73
|
const useGridStrategyProcessing = apiRef => {
|
|
63
74
|
const availableStrategies = React.useRef(new Map());
|
|
@@ -13,7 +13,7 @@ var _useGridErrorHandler = require("./useGridErrorHandler");
|
|
|
13
13
|
|
|
14
14
|
var _useGridLocaleText = require("./useGridLocaleText");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _pipeProcessing = require("./pipeProcessing");
|
|
17
17
|
|
|
18
18
|
var _strategyProcessing = require("./strategyProcessing");
|
|
19
19
|
|
|
@@ -27,7 +27,7 @@ const useGridInitialization = (inputApiRef, props) => {
|
|
|
27
27
|
(0, _useGridLoggerFactory.useGridLoggerFactory)(apiRef, props);
|
|
28
28
|
(0, _useGridErrorHandler.useGridErrorHandler)(apiRef, props);
|
|
29
29
|
(0, _useGridStateInitialization.useGridStateInitialization)(apiRef, props);
|
|
30
|
-
(0,
|
|
30
|
+
(0, _pipeProcessing.useGridPipeProcessing)(apiRef);
|
|
31
31
|
(0, _strategyProcessing.useGridStrategyProcessing)(apiRef);
|
|
32
32
|
(0, _useGridLocaleText.useGridLocaleText)(apiRef, props);
|
|
33
33
|
return apiRef;
|
|
@@ -144,7 +144,7 @@ const useGridColumnHeaders = props => {
|
|
|
144
144
|
column: column,
|
|
145
145
|
colIndex: columnIndex,
|
|
146
146
|
isResizing: resizeCol === column.field,
|
|
147
|
-
isLastColumn: columnIndex ===
|
|
147
|
+
isLastColumn: columnIndex === visibleColumns.length - 1,
|
|
148
148
|
extendRowFullWidth: !rootProps.disableExtendRowFullWidth,
|
|
149
149
|
hasFocus: hasFocus,
|
|
150
150
|
tabIndex: tabIndex
|