@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
|
@@ -5,14 +5,14 @@ import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
|
5
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
6
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
7
7
|
import { gridRowsLookupSelector } from '../rows/gridRowsSelector';
|
|
8
|
-
import { isGridCellRoot } from '../../../utils/domUtils';
|
|
9
8
|
import { gridSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridSelectionSelector';
|
|
10
9
|
import { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';
|
|
10
|
+
import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
|
|
11
11
|
import { gridVisibleSortedRowIdsSelector } from '../filter/gridFilterSelector';
|
|
12
12
|
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
13
13
|
import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
14
|
-
import { isKeyboardEvent } from '../../../utils/keyboardUtils';
|
|
15
|
-
import { getVisibleRows } from '../../utils/useGridVisibleRows';
|
|
14
|
+
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
15
|
+
import { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
16
16
|
|
|
17
17
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
18
18
|
if (selectionModelProp == null) {
|
|
@@ -34,8 +34,10 @@ export const selectionStateInitializer = (state, props) => _extends({}, state, {
|
|
|
34
34
|
selection: getSelectionModelPropValue(props.selectionModel) ?? []
|
|
35
35
|
});
|
|
36
36
|
/**
|
|
37
|
-
* @requires useGridRows (state, method)
|
|
38
|
-
* @requires useGridParamsApi (method)
|
|
37
|
+
* @requires useGridRows (state, method) - can be after
|
|
38
|
+
* @requires useGridParamsApi (method) - can be after
|
|
39
|
+
* @requires useGridFocus (state) - can be after
|
|
40
|
+
* @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
|
|
39
41
|
*/
|
|
40
42
|
|
|
41
43
|
export const useGridSelection = (apiRef, props) => {
|
|
@@ -60,7 +62,8 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
60
62
|
paginationMode
|
|
61
63
|
} = props;
|
|
62
64
|
const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;
|
|
63
|
-
const
|
|
65
|
+
const visibleRows = useGridVisibleRows(apiRef, props);
|
|
66
|
+
const expandMouseRowRangeSelection = React.useCallback(id => {
|
|
64
67
|
let endId = id;
|
|
65
68
|
const startId = lastRowToggled.current ?? id;
|
|
66
69
|
const isSelected = apiRef.current.isRowSelected(id);
|
|
@@ -165,12 +168,13 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
165
168
|
return;
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
logger.debug(`Expanding selection from row ${startId} to row ${endId}`);
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
const
|
|
171
|
+
logger.debug(`Expanding selection from row ${startId} to row ${endId}`); // Using rows from all pages allow to select a range across several pages
|
|
172
|
+
|
|
173
|
+
const allPagesRowIds = gridVisibleSortedRowIdsSelector(apiRef);
|
|
174
|
+
const startIndex = allPagesRowIds.indexOf(startId);
|
|
175
|
+
const endIndex = allPagesRowIds.indexOf(endId);
|
|
172
176
|
const [start, end] = startIndex > endIndex ? [endIndex, startIndex] : [startIndex, endIndex];
|
|
173
|
-
const rowsBetweenStartAndEnd =
|
|
177
|
+
const rowsBetweenStartAndEnd = allPagesRowIds.slice(start, end + 1);
|
|
174
178
|
apiRef.current.selectRows(rowsBetweenStartAndEnd, isSelected, resetSelection);
|
|
175
179
|
}, [apiRef, logger]);
|
|
176
180
|
const selectionApi = {
|
|
@@ -244,11 +248,11 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
244
248
|
}
|
|
245
249
|
|
|
246
250
|
if (event.shiftKey && (canHaveMultipleSelection || checkboxSelection)) {
|
|
247
|
-
|
|
251
|
+
expandMouseRowRangeSelection(params.id);
|
|
248
252
|
} else {
|
|
249
253
|
handleSingleRowSelection(params.id, event);
|
|
250
254
|
}
|
|
251
|
-
}, [disableSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef,
|
|
255
|
+
}, [disableSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);
|
|
252
256
|
const preventSelectionOnShift = React.useCallback((params, event) => {
|
|
253
257
|
if (canHaveMultipleSelection && event.shiftKey) {
|
|
254
258
|
window.getSelection()?.removeAllRanges();
|
|
@@ -256,35 +260,78 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
256
260
|
}, [canHaveMultipleSelection]);
|
|
257
261
|
const handleRowSelectionCheckboxChange = React.useCallback((params, event) => {
|
|
258
262
|
if (event.nativeEvent.shiftKey) {
|
|
259
|
-
|
|
263
|
+
expandMouseRowRangeSelection(params.id);
|
|
260
264
|
} else {
|
|
261
265
|
apiRef.current.selectRow(params.id, params.value);
|
|
262
266
|
}
|
|
263
|
-
}, [apiRef,
|
|
267
|
+
}, [apiRef, expandMouseRowRangeSelection]);
|
|
264
268
|
const handleHeaderSelectionCheckboxChange = React.useCallback(params => {
|
|
265
269
|
const shouldLimitSelectionToCurrentPage = props.checkboxSelectionVisibleOnly && props.pagination;
|
|
266
270
|
const rowsToBeSelected = shouldLimitSelectionToCurrentPage ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridVisibleSortedRowIdsSelector(apiRef);
|
|
267
271
|
apiRef.current.selectRows(rowsToBeSelected, params.value);
|
|
268
272
|
}, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination]);
|
|
269
273
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
270
|
-
//
|
|
274
|
+
// Get the most recent cell mode because it may have been changed by another listener
|
|
275
|
+
if (apiRef.current.getCellMode(params.id, params.field) === GridCellModes.Edit) {
|
|
276
|
+
return;
|
|
277
|
+
} // Ignore portal
|
|
271
278
|
// Do not apply shortcuts if the focus is not on the cell root component
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
274
282
|
return;
|
|
275
|
-
}
|
|
283
|
+
}
|
|
276
284
|
|
|
285
|
+
if (isNavigationKey(event.key) && event.shiftKey) {
|
|
286
|
+
// The cell that has focus after the keyboard navigation
|
|
287
|
+
const focusCell = gridFocusCellSelector(apiRef);
|
|
277
288
|
|
|
278
|
-
|
|
279
|
-
|
|
289
|
+
if (focusCell && focusCell.id !== params.id) {
|
|
290
|
+
event.preventDefault();
|
|
291
|
+
const isNextRowSelected = apiRef.current.isRowSelected(focusCell.id);
|
|
280
292
|
|
|
281
|
-
|
|
282
|
-
|
|
293
|
+
if (!canHaveMultipleSelection) {
|
|
294
|
+
apiRef.current.selectRow(focusCell.id, !isNextRowSelected, true);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const newRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(focusCell.id);
|
|
299
|
+
const previousRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(params.id);
|
|
300
|
+
let start;
|
|
301
|
+
let end;
|
|
302
|
+
|
|
303
|
+
if (newRowIndex > previousRowIndex) {
|
|
304
|
+
if (isNextRowSelected) {
|
|
305
|
+
// We are navigating to the bottom of the page and adding selected rows
|
|
306
|
+
start = previousRowIndex;
|
|
307
|
+
end = newRowIndex - 1;
|
|
308
|
+
} else {
|
|
309
|
+
// We are navigating to the bottom of the page and removing selected rows
|
|
310
|
+
start = previousRowIndex;
|
|
311
|
+
end = newRowIndex;
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
// eslint-disable-next-line no-lonely-if
|
|
315
|
+
if (isNextRowSelected) {
|
|
316
|
+
// We are navigating to the top of the page and removing selected rows
|
|
317
|
+
start = newRowIndex + 1;
|
|
318
|
+
end = previousRowIndex;
|
|
319
|
+
} else {
|
|
320
|
+
// We are navigating to the top of the page and adding selected rows
|
|
321
|
+
start = newRowIndex;
|
|
322
|
+
end = previousRowIndex;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(row => row.id);
|
|
327
|
+
apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
283
330
|
}
|
|
284
331
|
|
|
285
332
|
if (event.key === ' ' && event.shiftKey) {
|
|
286
333
|
event.preventDefault();
|
|
287
|
-
handleSingleRowSelection(
|
|
334
|
+
handleSingleRowSelection(params.id, event);
|
|
288
335
|
return;
|
|
289
336
|
}
|
|
290
337
|
|
|
@@ -292,7 +339,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
292
339
|
event.preventDefault();
|
|
293
340
|
selectRows(apiRef.current.getAllRowIds(), true);
|
|
294
341
|
}
|
|
295
|
-
}, [apiRef, handleSingleRowSelection, selectRows]);
|
|
342
|
+
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
296
343
|
useGridApiEventHandler(apiRef, GridEvents.visibleRowsSet, removeOutdatedSelection);
|
|
297
344
|
useGridApiEventHandler(apiRef, GridEvents.cellClick, handleCellClick);
|
|
298
345
|
useGridApiEventHandler(apiRef, GridEvents.rowSelectionCheckboxChange, handleRowSelectionCheckboxChange);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
-
import {
|
|
4
|
+
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
5
5
|
import { getDataGridUtilityClass } from '../../../constants';
|
|
6
6
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef';
|
|
7
7
|
|
|
@@ -43,5 +43,5 @@ export const useGridSelectionPreProcessors = (apiRef, props) => {
|
|
|
43
43
|
|
|
44
44
|
return columnsState;
|
|
45
45
|
}, [apiRef, classes, props.checkboxSelection]);
|
|
46
|
-
|
|
46
|
+
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateSelectionColumn);
|
|
47
47
|
};
|
|
@@ -12,7 +12,7 @@ import { gridRowIdsSelector, gridRowTreeSelector } from '../rows';
|
|
|
12
12
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
13
13
|
import { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../../core/strategyProcessing';
|
|
14
14
|
import { buildAggregatedSortingApplier, mergeStateWithSortModel, getNextGridSortDirection, sanitizeSortModel } from './gridSortingUtils';
|
|
15
|
-
import {
|
|
15
|
+
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
16
16
|
export const sortingStateInitializer = (state, props) => {
|
|
17
17
|
const sortModel = props.sortModel ?? props.initialState?.sorting?.sortModel ?? [];
|
|
18
18
|
return _extends({}, state, {
|
|
@@ -180,8 +180,8 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
180
180
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
181
181
|
return params.sortRowList(Object.values(rowTree));
|
|
182
182
|
}, [apiRef]);
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
184
|
+
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
185
185
|
useGridRegisterStrategyProcessor(apiRef, GRID_DEFAULT_STRATEGY, 'sorting', flatSortingMethod);
|
|
186
186
|
/**
|
|
187
187
|
* EVENTS
|
|
@@ -2,11 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { useGridApiMethod } from '../../utils';
|
|
3
3
|
export const useGridStatePersistence = apiRef => {
|
|
4
4
|
const exportState = React.useCallback(() => {
|
|
5
|
-
const stateToExport = apiRef.current.
|
|
5
|
+
const stateToExport = apiRef.current.unstable_applyPipeProcessors('exportState', {});
|
|
6
6
|
return stateToExport;
|
|
7
7
|
}, [apiRef]);
|
|
8
8
|
const restoreState = React.useCallback(stateToRestore => {
|
|
9
|
-
const response = apiRef.current.
|
|
9
|
+
const response = apiRef.current.unstable_applyPipeProcessors('restoreState', {
|
|
10
10
|
callbacks: []
|
|
11
11
|
}, {
|
|
12
12
|
stateToRestore
|
package/modern/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { GridVirtualScrollerContent } from '../components/virtualization/GridVir
|
|
|
3
3
|
export { GridVirtualScrollerRenderZone } from '../components/virtualization/GridVirtualScrollerRenderZone';
|
|
4
4
|
export { GridColumnHeaders } from '../components/columnHeaders/GridColumnHeaders';
|
|
5
5
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
6
|
-
export {
|
|
6
|
+
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
7
7
|
export { useGridRegisterStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
8
8
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
9
9
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
@@ -15,8 +15,7 @@ export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
|
15
15
|
export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
16
16
|
export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
17
17
|
export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
|
|
18
|
-
export {
|
|
19
|
-
export { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
|
|
18
|
+
export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
20
19
|
export { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
21
20
|
export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
22
21
|
export { useGridEditing as useGridEditing_new, editingStateInitializer as editingStateInitializer_new } from '../hooks/features/editRows/useGridEditing.new';
|
package/modern/locales/daDK.js
CHANGED
|
@@ -6,7 +6,7 @@ const daDKGrid = {
|
|
|
6
6
|
noResultsOverlayLabel: 'Ingen resultater',
|
|
7
7
|
errorOverlayDefaultLabel: 'Der skete en fejl.',
|
|
8
8
|
// Density selector toolbar button text
|
|
9
|
-
|
|
9
|
+
toolbarDensity: 'Tæthed',
|
|
10
10
|
toolbarDensityLabel: 'Tæthed',
|
|
11
11
|
toolbarDensityCompact: 'Kompakt',
|
|
12
12
|
toolbarDensityStandard: 'Standard',
|
|
@@ -15,7 +15,7 @@ const daDKGrid = {
|
|
|
15
15
|
toolbarColumns: 'Kolonne',
|
|
16
16
|
toolbarColumnsLabel: 'Vælg kolonne',
|
|
17
17
|
// Filters toolbar button text
|
|
18
|
-
|
|
18
|
+
toolbarFilters: 'Filtre',
|
|
19
19
|
toolbarFiltersLabel: 'Vis filtre',
|
|
20
20
|
toolbarFiltersTooltipHide: 'Skjul filtre',
|
|
21
21
|
toolbarFiltersTooltipShow: 'Vis filtre',
|
|
@@ -24,7 +24,7 @@ const daDKGrid = {
|
|
|
24
24
|
// toolbarExport: 'Export',
|
|
25
25
|
toolbarExportLabel: 'Eksporter',
|
|
26
26
|
toolbarExportCSV: 'Download som CSV',
|
|
27
|
-
|
|
27
|
+
toolbarExportPrint: 'Print',
|
|
28
28
|
// Columns panel text
|
|
29
29
|
columnsPanelTextFieldLabel: 'Find kolonne',
|
|
30
30
|
columnsPanelTextFieldPlaceholder: 'Kolonne titel',
|
|
@@ -34,11 +34,11 @@ const daDKGrid = {
|
|
|
34
34
|
// Filter panel text
|
|
35
35
|
filterPanelAddFilter: 'Tilføj filter',
|
|
36
36
|
filterPanelDeleteIconLabel: 'Slet',
|
|
37
|
-
|
|
37
|
+
filterPanelLinkOperator: 'Logisk operator',
|
|
38
38
|
filterPanelOperators: 'Operatorer',
|
|
39
39
|
// TODO v6: rename to filterPanelOperator
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
filterPanelOperatorAnd: 'Og',
|
|
41
|
+
filterPanelOperatorOr: 'Eller',
|
|
42
42
|
filterPanelColumns: 'Kolonne',
|
|
43
43
|
filterPanelInputLabel: 'Værdi',
|
|
44
44
|
filterPanelInputPlaceholder: 'Filter værdi',
|
|
@@ -47,46 +47,46 @@ const daDKGrid = {
|
|
|
47
47
|
filterOperatorEquals: 'Lig med',
|
|
48
48
|
filterOperatorStartsWith: 'Begynder med',
|
|
49
49
|
filterOperatorEndsWith: 'Ender med',
|
|
50
|
-
filterOperatorIs: '
|
|
51
|
-
filterOperatorNot: '
|
|
50
|
+
filterOperatorIs: 'Er lig med',
|
|
51
|
+
filterOperatorNot: 'Er ikke lig med',
|
|
52
52
|
filterOperatorAfter: 'Efter',
|
|
53
53
|
filterOperatorOnOrAfter: 'På eller efter',
|
|
54
54
|
filterOperatorBefore: 'Før',
|
|
55
55
|
filterOperatorOnOrBefore: 'På eller før',
|
|
56
|
-
filterOperatorIsEmpty: 'Indeholder data',
|
|
57
|
-
filterOperatorIsNotEmpty: 'Indeholder
|
|
58
|
-
|
|
56
|
+
filterOperatorIsEmpty: 'Indeholder ikke data',
|
|
57
|
+
filterOperatorIsNotEmpty: 'Indeholder data',
|
|
58
|
+
filterOperatorIsAnyOf: 'indeholder en af',
|
|
59
59
|
// Filter values text
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
filterValueAny: 'hvilken som helst',
|
|
61
|
+
filterValueTrue: 'positiv',
|
|
62
|
+
filterValueFalse: 'negativ',
|
|
63
63
|
// Column menu text
|
|
64
|
-
|
|
64
|
+
columnMenuLabel: 'Menu',
|
|
65
65
|
columnMenuShowColumns: 'Vis Kolonner',
|
|
66
|
-
|
|
66
|
+
columnMenuFilter: 'Filtre',
|
|
67
67
|
columnMenuHideColumn: 'Skjul',
|
|
68
68
|
columnMenuUnsort: 'Fjern sortering',
|
|
69
69
|
columnMenuSortAsc: 'Sorter stigende',
|
|
70
70
|
columnMenuSortDesc: 'Sorter faldende',
|
|
71
71
|
// Column header text
|
|
72
|
-
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} aktive filtre` :
|
|
72
|
+
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} aktive filtre` : `Ét aktivt filter`,
|
|
73
73
|
columnHeaderFiltersLabel: 'Vis filtre',
|
|
74
74
|
columnHeaderSortIconLabel: 'Sorter',
|
|
75
75
|
// Rows selected footer text
|
|
76
|
-
footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} rækker valgt` :
|
|
76
|
+
footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} rækker valgt` : `Én række valgt`,
|
|
77
77
|
// Total row amount footer text
|
|
78
|
-
footerTotalRows: '
|
|
78
|
+
footerTotalRows: 'Antal rækker i alt:',
|
|
79
79
|
// Total visible row amount footer text
|
|
80
80
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} af ${totalCount.toLocaleString()}`,
|
|
81
81
|
// Checkbox selection text
|
|
82
82
|
checkboxSelectionHeaderName: 'Afkrydsningsvalg',
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
checkboxSelectionSelectAllRows: 'Vælg alle rækker',
|
|
84
|
+
checkboxSelectionUnselectAllRows: 'Fravælg alle rækker',
|
|
85
|
+
checkboxSelectionSelectRow: 'Vælg række',
|
|
86
|
+
checkboxSelectionUnselectRow: 'Fravælg række',
|
|
87
87
|
// Boolean cell text
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
booleanCellTrueLabel: 'ja',
|
|
89
|
+
booleanCellFalseLabel: 'nej',
|
|
90
90
|
// Actions cell more text
|
|
91
91
|
actionsCellMore: 'mere',
|
|
92
92
|
// Column pinning text
|
|
@@ -96,13 +96,13 @@ const daDKGrid = {
|
|
|
96
96
|
// Tree Data
|
|
97
97
|
treeDataGroupingHeaderName: 'Gruppering',
|
|
98
98
|
treeDataExpand: 'Vis underelementer',
|
|
99
|
-
treeDataCollapse: 'Skjul underelementer'
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
treeDataCollapse: 'Skjul underelementer',
|
|
100
|
+
// Grouping columns
|
|
101
|
+
groupingColumnHeaderName: 'Gruppér',
|
|
102
|
+
groupColumn: name => `Gruppér efter ${name}`,
|
|
103
|
+
unGroupColumn: name => `Fjern gruppéring efter ${name}`,
|
|
103
104
|
// Master/detail
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
expandDetailPanel: 'Udvid',
|
|
106
|
+
collapseDetailPanel: 'Kollaps'
|
|
107
107
|
};
|
|
108
108
|
export const daDK = getGridLocalization(daDKGrid, daDKCore);
|
|
@@ -63,8 +63,8 @@ var GridEvents;
|
|
|
63
63
|
GridEvents["columnsChange"] = "columnsChange";
|
|
64
64
|
GridEvents["detailPanelsExpandedRowIdsChange"] = "detailPanelsExpandedRowIdsChange";
|
|
65
65
|
GridEvents["pinnedColumnsChange"] = "pinnedColumnsChange";
|
|
66
|
-
GridEvents["
|
|
67
|
-
GridEvents["
|
|
66
|
+
GridEvents["pipeProcessorRegister"] = "pipeProcessorRegister";
|
|
67
|
+
GridEvents["pipeProcessorUnregister"] = "pipeProcessorUnregister";
|
|
68
68
|
GridEvents["activeStrategyProcessorChange"] = "activeStrategyProcessorChange";
|
|
69
69
|
GridEvents["strategyAvailabilityChange"] = "strategyAvailabilityChange";
|
|
70
70
|
GridEvents["sortModelChange"] = "sortModelChange";
|
|
@@ -73,6 +73,8 @@ var GridEvents;
|
|
|
73
73
|
GridEvents["stateChange"] = "stateChange";
|
|
74
74
|
GridEvents["columnVisibilityChange"] = "columnVisibilityChange";
|
|
75
75
|
GridEvents["virtualScrollerContentSizeChange"] = "virtualScrollerContentSizeChange";
|
|
76
|
+
GridEvents["preferencePanelClose"] = "preferencePanelClose";
|
|
77
|
+
GridEvents["preferencePanelOpen"] = "preferencePanelOpen";
|
|
76
78
|
})(GridEvents || (GridEvents = {}));
|
|
77
79
|
|
|
78
80
|
export { GridEvents };
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @deprecated prefer GridRowModel.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The key value object representing the data of a row.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The grid rows total height and row positions.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The type of Id supported by the grid.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The function to retrieve the id of a [[GridRowModel]].
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* An helper function to check if the id provided is valid.
|
|
23
|
-
* @param {GridRowId} id Id as [[GridRowId]].
|
|
24
|
-
* @param {GridRowModel | Partial<GridRowModel>} row Row as [[GridRowModel]].
|
|
25
|
-
* @param {string} detailErrorMessage A custom error message to display for invalid IDs
|
|
26
|
-
*/
|
|
27
|
-
export function checkGridRowIdIsValid(id, row, detailErrorMessage = 'A row was provided without id in the rows prop:') {
|
|
28
|
-
if (id == null) {
|
|
29
|
-
throw new Error(['MUI: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
export {};
|
package/modern/models/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export * from './gridEditRowModel';
|
|
|
5
5
|
export * from './gridFeatureMode';
|
|
6
6
|
export * from './gridFilterItem';
|
|
7
7
|
export * from './gridFilterModel';
|
|
8
|
-
export * from './gridFilterOperator';
|
|
9
8
|
export * from './gridRootContainerRef';
|
|
10
9
|
export * from './gridRenderContextProps';
|
|
11
10
|
export * from './gridRows';
|
|
@@ -23,4 +22,5 @@ export * from './gridExport';
|
|
|
23
22
|
export * from './logger';
|
|
24
23
|
export * from './muiEvent';
|
|
25
24
|
export * from './events';
|
|
26
|
-
export * from './gridSortModel';
|
|
25
|
+
export * from './gridSortModel';
|
|
26
|
+
export * from './gridFilterOperator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,4 +9,5 @@ export * from './gridRowSelectionCheckboxParams';
|
|
|
9
9
|
export * from './gridHeaderSelectionCheckboxParams';
|
|
10
10
|
export * from './gridValueOptionsParams';
|
|
11
11
|
export * from './gridCellParams';
|
|
12
|
-
export * from './gridSortModelParams';
|
|
12
|
+
export * from './gridSortModelParams';
|
|
13
|
+
export * from './gridPreferencePanelParams';
|
|
@@ -521,6 +521,28 @@ DataGridRaw.propTypes = {
|
|
|
521
521
|
*/
|
|
522
522
|
onPageSizeChange: _propTypes.default.func,
|
|
523
523
|
|
|
524
|
+
/**
|
|
525
|
+
* Callback fired when the preferences panel is closed.
|
|
526
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
527
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
528
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
529
|
+
*/
|
|
530
|
+
onPreferencePanelClose: _propTypes.default.func,
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Callback fired when the preferences panel is opened.
|
|
534
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
535
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
536
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
537
|
+
*/
|
|
538
|
+
onPreferencePanelOpen: _propTypes.default.func,
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
542
|
+
* @param {any} error The error thrown.
|
|
543
|
+
*/
|
|
544
|
+
onProcessRowUpdateError: _propTypes.default.func,
|
|
545
|
+
|
|
524
546
|
/**
|
|
525
547
|
* Callback fired when the grid is resized.
|
|
526
548
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
@@ -627,9 +649,10 @@ DataGridRaw.propTypes = {
|
|
|
627
649
|
/**
|
|
628
650
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
629
651
|
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
630
|
-
* @
|
|
631
|
-
* @param {
|
|
632
|
-
* @
|
|
652
|
+
* @template R
|
|
653
|
+
* @param {R} newRow Row object with the new values.
|
|
654
|
+
* @param {R} oldRow Row object with the old values.
|
|
655
|
+
* @returns {Promise<R> | R} The final values to update the row.
|
|
633
656
|
*/
|
|
634
657
|
processRowUpdate: _propTypes.default.func,
|
|
635
658
|
|
|
@@ -654,7 +677,7 @@ DataGridRaw.propTypes = {
|
|
|
654
677
|
/**
|
|
655
678
|
* Set of rows of type [[GridRowsProp]].
|
|
656
679
|
*/
|
|
657
|
-
rows: _propTypes.default.
|
|
680
|
+
rows: _propTypes.default.array.isRequired,
|
|
658
681
|
|
|
659
682
|
/**
|
|
660
683
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
@@ -25,9 +25,7 @@ var _useGridFilter = require("../hooks/features/filter/useGridFilter");
|
|
|
25
25
|
|
|
26
26
|
var _useGridFocus = require("../hooks/features/focus/useGridFocus");
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _useGridKeyboardNavigation = require("../hooks/features/keyboard/useGridKeyboardNavigation");
|
|
28
|
+
var _useGridKeyboardNavigation = require("../hooks/features/keyboardNavigation/useGridKeyboardNavigation");
|
|
31
29
|
|
|
32
30
|
var _useGridPagination = require("../hooks/features/pagination/useGridPagination");
|
|
33
31
|
|
|
@@ -85,6 +83,7 @@ const useDataGridComponent = props => {
|
|
|
85
83
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
|
|
86
84
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
|
|
87
85
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnMenu.columnMenuStateInitializer, apiRef, props);
|
|
86
|
+
(0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
|
|
88
87
|
(0, _useGridSelection.useGridSelection)(apiRef, props);
|
|
89
88
|
(0, _useGridColumns.useGridColumns)(apiRef, props);
|
|
90
89
|
(0, _useGridRows.useGridRows)(apiRef, props);
|
|
@@ -100,8 +99,6 @@ const useDataGridComponent = props => {
|
|
|
100
99
|
(0, _useGridRowsMeta.useGridRowsMeta)(apiRef, props);
|
|
101
100
|
(0, _useGridScroll.useGridScroll)(apiRef, props);
|
|
102
101
|
(0, _useGridColumnMenu.useGridColumnMenu)(apiRef);
|
|
103
|
-
(0, _useGridKeyboard.useGridKeyboard)(apiRef);
|
|
104
|
-
(0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
|
|
105
102
|
(0, _useGridCsvExport.useGridCsvExport)(apiRef);
|
|
106
103
|
(0, _useGridPrintExport.useGridPrintExport)(apiRef, props);
|
|
107
104
|
(0, _useGridClipboard.useGridClipboard)(apiRef);
|
|
@@ -26,7 +26,7 @@ function gridDateFormatter({
|
|
|
26
26
|
return value.toLocaleDateString();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return value;
|
|
29
|
+
return value != null ? value : '';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function gridDateTimeFormatter({
|
|
@@ -36,7 +36,7 @@ function gridDateTimeFormatter({
|
|
|
36
36
|
return value.toLocaleString();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
return value;
|
|
39
|
+
return value != null ? value : '';
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const GRID_DATE_COL_DEF = (0, _extends2.default)({}, _gridStringColDef.GRID_STRING_COL_DEF, {
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridDefaultColumnTypes = exports.DEFAULT_GRID_COL_TYPE_KEY = void 0;
|
|
7
7
|
|
|
8
|
-
var _gridStringColDef = require("
|
|
8
|
+
var _gridStringColDef = require("./gridStringColDef");
|
|
9
9
|
|
|
10
|
-
var _gridNumericColDef = require("
|
|
10
|
+
var _gridNumericColDef = require("./gridNumericColDef");
|
|
11
11
|
|
|
12
|
-
var _gridDateColDef = require("
|
|
12
|
+
var _gridDateColDef = require("./gridDateColDef");
|
|
13
13
|
|
|
14
|
-
var _gridBooleanColDef = require("
|
|
14
|
+
var _gridBooleanColDef = require("./gridBooleanColDef");
|
|
15
15
|
|
|
16
|
-
var _gridSingleSelectColDef = require("
|
|
16
|
+
var _gridSingleSelectColDef = require("./gridSingleSelectColDef");
|
|
17
17
|
|
|
18
|
-
var _gridActionsColDef = require("
|
|
18
|
+
var _gridActionsColDef = require("./gridActionsColDef");
|
|
19
19
|
|
|
20
20
|
const DEFAULT_GRID_COL_TYPE_KEY = '__default__';
|
|
21
21
|
exports.DEFAULT_GRID_COL_TYPE_KEY = DEFAULT_GRID_COL_TYPE_KEY;
|
package/node/colDef/index.js
CHANGED
|
@@ -158,4 +158,17 @@ Object.keys(_gridStringOperators).forEach(function (key) {
|
|
|
158
158
|
return _gridStringOperators[key];
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
var _gridDefaultColumnTypes = require("./gridDefaultColumnTypes");
|
|
164
|
+
|
|
165
|
+
Object.keys(_gridDefaultColumnTypes).forEach(function (key) {
|
|
166
|
+
if (key === "default" || key === "__esModule") return;
|
|
167
|
+
if (key in exports && exports[key] === _gridDefaultColumnTypes[key]) return;
|
|
168
|
+
Object.defineProperty(exports, key, {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _gridDefaultColumnTypes[key];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
161
174
|
});
|
|
@@ -306,7 +306,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
306
306
|
isLastVisible: _propTypes.default.bool,
|
|
307
307
|
lastColumnToRender: _propTypes.default.number.isRequired,
|
|
308
308
|
renderedColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
309
|
-
row: _propTypes.default.
|
|
309
|
+
row: _propTypes.default.any.isRequired,
|
|
310
310
|
rowHeight: _propTypes.default.number.isRequired,
|
|
311
311
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
312
312
|
selected: _propTypes.default.bool.isRequired,
|
|
@@ -222,7 +222,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
222
222
|
className: _propTypes.default.string,
|
|
223
223
|
colIndex: _propTypes.default.number.isRequired,
|
|
224
224
|
field: _propTypes.default.string.isRequired,
|
|
225
|
-
formattedValue: _propTypes.default.
|
|
225
|
+
formattedValue: _propTypes.default.any,
|
|
226
226
|
hasFocus: _propTypes.default.bool,
|
|
227
227
|
height: _propTypes.default.number.isRequired,
|
|
228
228
|
isEditable: _propTypes.default.bool,
|
|
@@ -236,6 +236,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
236
236
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
237
237
|
showRightBorder: _propTypes.default.bool,
|
|
238
238
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
239
|
-
value: _propTypes.default.
|
|
239
|
+
value: _propTypes.default.any,
|
|
240
240
|
width: _propTypes.default.number.isRequired
|
|
241
241
|
} : void 0;
|