@mui/x-data-grid 5.12.3 → 5.14.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 +147 -1
- package/DataGrid/DataGrid.js +4 -4
- package/DataGrid/useDataGridComponent.js +1 -1
- package/colDef/gridActionsColDef.js +2 -0
- package/colDef/gridBooleanColDef.js +3 -1
- package/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridDateOperators.js +4 -2
- package/colDef/gridNumericOperators.js +4 -2
- package/colDef/gridStringColDef.d.ts +3 -0
- package/colDef/gridStringColDef.js +6 -0
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/gridStringOperators.js +15 -8
- package/components/GridRow.js +1 -1
- package/components/base/GridOverlays.js +4 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridBooleanCell.d.ts +5 -2
- package/components/cell/GridBooleanCell.js +93 -2
- package/components/cell/GridEditDateCell.js +5 -1
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/components/containers/GridRootStyles.js +10 -0
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +3 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +30 -14
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.js +20 -10
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/constants/gridClasses.d.ts +25 -1
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +8 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
- package/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +13 -6
- package/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/hooks/features/export/utils.d.ts +1 -1
- package/hooks/features/export/utils.js +9 -2
- package/hooks/features/filter/gridFilterUtils.js +6 -0
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +30 -5
- package/hooks/features/pagination/useGridPage.js +4 -3
- package/hooks/features/pagination/useGridPageSize.js +4 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/hooks/features/selection/useGridSelection.js +24 -10
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -0
- package/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +34 -6
- package/hooks/features/statePersistence/gridStatePersistenceInterface.d.ts +12 -1
- package/hooks/features/statePersistence/index.d.ts +1 -1
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/legacy/DataGrid/DataGrid.js +4 -4
- package/legacy/DataGrid/useDataGridComponent.js +1 -1
- package/legacy/colDef/gridActionsColDef.js +2 -0
- package/legacy/colDef/gridBooleanColDef.js +3 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/legacy/colDef/gridDateOperators.js +4 -2
- package/legacy/colDef/gridNumericOperators.js +4 -2
- package/legacy/colDef/gridStringColDef.js +6 -0
- package/legacy/colDef/gridStringOperators.js +17 -7
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/base/GridOverlays.js +4 -1
- package/legacy/components/cell/GridBooleanCell.js +93 -2
- package/legacy/components/cell/GridEditDateCell.js +5 -1
- package/legacy/components/cell/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +6 -1
- package/legacy/components/containers/GridRootStyles.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +22 -7
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/legacy/components/toolbar/GridToolbarExport.js +20 -10
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +8 -1
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/legacy/hooks/features/columns/useGridColumns.js +13 -8
- package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
- package/legacy/hooks/features/export/utils.js +9 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +6 -0
- package/legacy/hooks/features/filter/useGridFilter.js +30 -5
- package/legacy/hooks/features/pagination/useGridPage.js +4 -3
- package/legacy/hooks/features/pagination/useGridPageSize.js +4 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/legacy/hooks/features/rows/useGridRows.js +1 -1
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/legacy/hooks/features/selection/useGridSelection.js +26 -12
- package/legacy/hooks/features/sorting/gridSortingUtils.js +11 -12
- package/legacy/hooks/features/sorting/useGridSorting.js +34 -6
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +22 -12
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridNativeEventListener.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -2
- package/legacy/locales/arSD.js +7 -0
- package/legacy/locales/bgBG.js +7 -0
- package/legacy/locales/csCZ.js +7 -0
- package/legacy/locales/daDK.js +7 -0
- package/legacy/locales/deDE.js +12 -5
- package/legacy/locales/elGR.js +7 -0
- package/legacy/locales/esES.js +7 -0
- package/legacy/locales/faIR.js +7 -0
- package/legacy/locales/fiFI.js +7 -0
- package/legacy/locales/frFR.js +17 -10
- package/legacy/locales/heIL.js +8 -1
- package/legacy/locales/huHU.js +7 -0
- package/legacy/locales/index.js +4 -1
- package/legacy/locales/itIT.js +7 -0
- package/legacy/locales/jaJP.js +8 -1
- package/legacy/locales/koKR.js +7 -0
- package/legacy/locales/nbNO.js +8 -1
- package/legacy/locales/nlNL.js +21 -14
- package/legacy/locales/plPL.js +7 -0
- package/legacy/locales/ptBR.js +17 -10
- package/legacy/locales/roRO.js +135 -0
- package/legacy/locales/ruRU.js +7 -0
- package/legacy/locales/skSK.js +22 -15
- package/legacy/locales/svSE.js +8 -1
- package/legacy/locales/trTR.js +7 -0
- package/legacy/locales/ukUA.js +7 -0
- package/legacy/locales/viVN.js +7 -0
- package/legacy/locales/zhCN.js +7 -0
- package/legacy/locales/zhTW.js +135 -0
- package/legacy/models/events/gridEvents.js +1 -0
- package/legacy/utils/keyboardUtils.js +4 -3
- package/locales/arSD.js +7 -0
- package/locales/bgBG.js +7 -0
- package/locales/csCZ.js +7 -0
- package/locales/daDK.js +7 -0
- package/locales/deDE.js +12 -5
- package/locales/elGR.js +7 -0
- package/locales/esES.js +7 -0
- package/locales/faIR.js +7 -0
- package/locales/fiFI.js +7 -0
- package/locales/frFR.js +17 -10
- package/locales/heIL.js +8 -1
- package/locales/huHU.js +7 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +4 -1
- package/locales/itIT.js +7 -0
- package/locales/jaJP.js +8 -1
- package/locales/koKR.js +7 -0
- package/locales/nbNO.js +8 -1
- package/locales/nlNL.js +21 -14
- package/locales/plPL.js +7 -0
- package/locales/ptBR.js +17 -10
- package/locales/roRO.d.ts +2 -0
- package/locales/roRO.js +123 -0
- package/locales/ruRU.js +7 -0
- package/locales/skSK.js +22 -15
- package/locales/svSE.js +8 -1
- package/locales/trTR.js +7 -0
- package/locales/ukUA.js +7 -0
- package/locales/viVN.js +7 -0
- package/locales/zhCN.js +7 -0
- package/locales/zhTW.d.ts +2 -0
- package/locales/zhTW.js +123 -0
- package/models/api/gridColumnSpanning.d.ts +2 -0
- package/models/api/gridLocaleTextApi.d.ts +8 -2
- package/models/api/gridSelectionApi.d.ts +6 -0
- package/models/events/gridEvents.d.ts +1 -0
- package/models/events/gridEvents.js +1 -0
- package/models/gridFilterOperator.d.ts +6 -0
- package/models/gridRows.d.ts +10 -1
- package/models/params/gridCellParams.d.ts +4 -4
- package/modern/DataGrid/DataGrid.js +4 -4
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/colDef/gridActionsColDef.js +2 -0
- package/modern/colDef/gridBooleanColDef.js +3 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/modern/colDef/gridDateOperators.js +4 -2
- package/modern/colDef/gridNumericOperators.js +4 -2
- package/modern/colDef/gridStringColDef.js +6 -0
- package/modern/colDef/gridStringOperators.js +15 -8
- package/modern/components/GridRow.js +1 -1
- package/modern/components/base/GridOverlays.js +4 -1
- package/modern/components/cell/GridBooleanCell.js +93 -2
- package/modern/components/cell/GridEditDateCell.js +5 -1
- package/modern/components/cell/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/modern/components/containers/GridRootStyles.js +10 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +20 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/modern/components/toolbar/GridToolbarExport.js +20 -10
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +8 -1
- package/modern/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/modern/hooks/features/columns/useGridColumns.js +10 -5
- package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/modern/hooks/features/export/utils.js +5 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +6 -0
- package/modern/hooks/features/filter/useGridFilter.js +25 -4
- package/modern/hooks/features/pagination/useGridPage.js +4 -3
- package/modern/hooks/features/pagination/useGridPageSize.js +4 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +8 -4
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/modern/hooks/features/selection/useGridSelection.js +22 -10
- package/modern/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/modern/hooks/features/sorting/useGridSorting.js +30 -6
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +13 -7
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridNativeEventListener.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/locales/arSD.js +7 -0
- package/modern/locales/bgBG.js +7 -0
- package/modern/locales/csCZ.js +7 -0
- package/modern/locales/daDK.js +7 -0
- package/modern/locales/deDE.js +12 -5
- package/modern/locales/elGR.js +7 -0
- package/modern/locales/esES.js +7 -0
- package/modern/locales/faIR.js +7 -0
- package/modern/locales/fiFI.js +7 -0
- package/modern/locales/frFR.js +17 -10
- package/modern/locales/heIL.js +8 -1
- package/modern/locales/huHU.js +7 -0
- package/modern/locales/index.js +4 -1
- package/modern/locales/itIT.js +7 -0
- package/modern/locales/jaJP.js +8 -1
- package/modern/locales/koKR.js +7 -0
- package/modern/locales/nbNO.js +8 -1
- package/modern/locales/nlNL.js +21 -14
- package/modern/locales/plPL.js +7 -0
- package/modern/locales/ptBR.js +17 -10
- package/modern/locales/roRO.js +123 -0
- package/modern/locales/ruRU.js +7 -0
- package/modern/locales/skSK.js +22 -15
- package/modern/locales/svSE.js +8 -1
- package/modern/locales/trTR.js +7 -0
- package/modern/locales/ukUA.js +7 -0
- package/modern/locales/viVN.js +7 -0
- package/modern/locales/zhCN.js +7 -0
- package/modern/locales/zhTW.js +123 -0
- package/modern/models/events/gridEvents.js +1 -0
- package/modern/utils/keyboardUtils.js +4 -3
- package/node/DataGrid/DataGrid.js +4 -4
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/colDef/gridActionsColDef.js +2 -0
- package/node/colDef/gridBooleanColDef.js +3 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/node/colDef/gridDateOperators.js +4 -2
- package/node/colDef/gridNumericOperators.js +4 -2
- package/node/colDef/gridStringColDef.js +5 -0
- package/node/colDef/gridStringOperators.js +15 -8
- package/node/components/GridRow.js +1 -1
- package/node/components/base/GridOverlays.js +4 -1
- package/node/components/cell/GridBooleanCell.js +93 -2
- package/node/components/cell/GridEditDateCell.js +7 -1
- package/node/components/cell/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/node/components/containers/GridRootStyles.js +10 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +31 -15
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/node/components/toolbar/GridToolbarExport.js +16 -10
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +8 -1
- package/node/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/node/hooks/features/columns/useGridColumns.js +13 -6
- package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/node/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/node/hooks/features/export/utils.js +10 -2
- package/node/hooks/features/filter/gridFilterUtils.js +7 -0
- package/node/hooks/features/filter/useGridFilter.js +30 -5
- package/node/hooks/features/pagination/useGridPage.js +4 -3
- package/node/hooks/features/pagination/useGridPageSize.js +4 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/node/hooks/features/selection/useGridSelection.js +24 -10
- package/node/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/node/hooks/features/sorting/useGridSorting.js +34 -6
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridNativeEventListener.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +18 -0
- package/node/locales/arSD.js +7 -0
- package/node/locales/bgBG.js +7 -0
- package/node/locales/csCZ.js +7 -0
- package/node/locales/daDK.js +7 -0
- package/node/locales/deDE.js +12 -5
- package/node/locales/elGR.js +7 -0
- package/node/locales/esES.js +7 -0
- package/node/locales/faIR.js +7 -0
- package/node/locales/fiFI.js +7 -0
- package/node/locales/frFR.js +17 -10
- package/node/locales/heIL.js +8 -1
- package/node/locales/huHU.js +7 -0
- package/node/locales/index.js +39 -0
- package/node/locales/itIT.js +7 -0
- package/node/locales/jaJP.js +8 -1
- package/node/locales/koKR.js +7 -0
- package/node/locales/nbNO.js +8 -1
- package/node/locales/nlNL.js +21 -14
- package/node/locales/plPL.js +7 -0
- package/node/locales/ptBR.js +17 -10
- package/node/locales/roRO.js +133 -0
- package/node/locales/ruRU.js +7 -0
- package/node/locales/skSK.js +22 -15
- package/node/locales/svSE.js +8 -1
- package/node/locales/trTR.js +7 -0
- package/node/locales/ukUA.js +7 -0
- package/node/locales/viVN.js +7 -0
- package/node/locales/zhCN.js +7 -0
- package/node/locales/zhTW.js +133 -0
- package/node/models/events/gridEvents.js +1 -0
- package/node/utils/keyboardUtils.js +4 -3
- package/package.json +3 -3
- package/utils/getGridLocalization.d.ts +1 -1
- package/utils/keyboardUtils.js +4 -3
|
@@ -97,7 +97,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
97
97
|
const updateRows = React.useCallback(updates => {
|
|
98
98
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
99
99
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
100
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to
|
|
100
|
+
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
101
101
|
} // we remove duplicate updates. A server can batch updates, and send several updates for the same row in one fn call.
|
|
102
102
|
|
|
103
103
|
|
|
@@ -11,7 +11,7 @@ const flatRowTreeCreationMethod = ({
|
|
|
11
11
|
for (let i = 0; i < ids.length; i += 1) {
|
|
12
12
|
const rowId = ids[i];
|
|
13
13
|
|
|
14
|
-
if (previousTree && previousTree[rowId]) {
|
|
14
|
+
if (previousTree && previousTree[rowId] && previousTree[rowId].depth === 0 && previousTree[rowId].parent == null) {
|
|
15
15
|
tree[rowId] = previousTree[rowId];
|
|
16
16
|
} else {
|
|
17
17
|
tree[rowId] = {
|
|
@@ -61,9 +61,9 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
61
61
|
checkboxSelection,
|
|
62
62
|
disableMultipleSelection,
|
|
63
63
|
disableSelectionOnClick,
|
|
64
|
-
isRowSelectable,
|
|
65
64
|
pagination,
|
|
66
|
-
paginationMode
|
|
65
|
+
paginationMode,
|
|
66
|
+
isRowSelectable: propIsRowSelectable
|
|
67
67
|
} = props;
|
|
68
68
|
const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;
|
|
69
69
|
const visibleRows = useGridVisibleRows(apiRef, props);
|
|
@@ -112,9 +112,22 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
112
112
|
}
|
|
113
113
|
}, [apiRef, logger]);
|
|
114
114
|
const isRowSelected = React.useCallback(id => gridSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
|
|
115
|
+
const isRowSelectable = React.useCallback(id => {
|
|
116
|
+
var _apiRef$current$getRo;
|
|
117
|
+
|
|
118
|
+
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (((_apiRef$current$getRo = apiRef.current.getRowNode(id)) == null ? void 0 : _apiRef$current$getRo.position) === 'footer') {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return true;
|
|
127
|
+
}, [apiRef, propIsRowSelectable]);
|
|
115
128
|
const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);
|
|
116
129
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
117
|
-
if (
|
|
130
|
+
if (!apiRef.current.isRowSelectable(id)) {
|
|
118
131
|
return;
|
|
119
132
|
}
|
|
120
133
|
|
|
@@ -138,10 +151,10 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
138
151
|
apiRef.current.setSelectionModel(newSelection);
|
|
139
152
|
}
|
|
140
153
|
}
|
|
141
|
-
}, [apiRef,
|
|
154
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
142
155
|
const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {
|
|
143
156
|
logger.debug(`Setting selection for several rows`);
|
|
144
|
-
const selectableIds =
|
|
157
|
+
const selectableIds = ids.filter(id => apiRef.current.isRowSelectable(id));
|
|
145
158
|
let newSelection;
|
|
146
159
|
|
|
147
160
|
if (resetSelection) {
|
|
@@ -165,7 +178,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
165
178
|
if (isSelectionValid) {
|
|
166
179
|
apiRef.current.setSelectionModel(newSelection);
|
|
167
180
|
}
|
|
168
|
-
}, [apiRef,
|
|
181
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
169
182
|
const selectRowRange = React.useCallback(({
|
|
170
183
|
startId,
|
|
171
184
|
endId
|
|
@@ -189,7 +202,8 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
189
202
|
selectRowRange,
|
|
190
203
|
setSelectionModel,
|
|
191
204
|
getSelectedRows,
|
|
192
|
-
isRowSelected
|
|
205
|
+
isRowSelected,
|
|
206
|
+
isRowSelectable
|
|
193
207
|
};
|
|
194
208
|
useGridApiMethod(apiRef, selectionApi, 'GridSelectionApi');
|
|
195
209
|
/**
|
|
@@ -371,13 +385,13 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
371
385
|
React.useEffect(() => {
|
|
372
386
|
if (isStateControlled) {
|
|
373
387
|
return;
|
|
374
|
-
} // isRowSelectable changed
|
|
388
|
+
} // props.isRowSelectable changed
|
|
375
389
|
|
|
376
390
|
|
|
377
391
|
const currentSelection = gridSelectionStateSelector(apiRef.current.state);
|
|
378
392
|
|
|
379
393
|
if (isRowSelectable) {
|
|
380
|
-
const newSelection = currentSelection.filter(id => isRowSelectable(
|
|
394
|
+
const newSelection = currentSelection.filter(id => isRowSelectable(id));
|
|
381
395
|
|
|
382
396
|
if (newSelection.length < currentSelection.length) {
|
|
383
397
|
apiRef.current.setSelectionModel(newSelection);
|
|
@@ -404,7 +418,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
404
418
|
let isSelectable = true;
|
|
405
419
|
|
|
406
420
|
if (isRowSelectable) {
|
|
407
|
-
isSelectable = isRowSelectable(
|
|
421
|
+
isSelectable = isRowSelectable(id);
|
|
408
422
|
}
|
|
409
423
|
|
|
410
424
|
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|
|
@@ -46,25 +46,24 @@ const parseSortItem = (sortItem, apiRef) => {
|
|
|
46
46
|
comparator
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
+
|
|
49
50
|
/**
|
|
50
51
|
* Compare two rows according to a list of valid sort items.
|
|
51
52
|
* The `row1Params` and `row2Params` must have the same length as `parsedSortItems`,
|
|
52
53
|
* and each of their index must contain the `GridSortCellParams` of the sort item with the same index.
|
|
53
54
|
* @param {GridParsedSortItem[]} parsedSortItems All the sort items with which we want to compare the rows.
|
|
54
|
-
* @param {
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {GridRowAggregatedSortingParams} row1 The node and params of the 1st row for each sort item.
|
|
56
|
+
* @param {GridRowAggregatedSortingParams} row2 The node and params of the 2nd row for each sort item.
|
|
56
57
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const compareRows = (parsedSortItems, row1Params, row2Params) => {
|
|
58
|
+
const compareRows = (parsedSortItems, row1, row2) => {
|
|
60
59
|
return parsedSortItems.reduce((res, item, index) => {
|
|
61
60
|
if (res !== 0) {
|
|
62
61
|
// return the results of the first comparator which distinguish the two rows
|
|
63
62
|
return res;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
const sortCellParams1 =
|
|
67
|
-
const sortCellParams2 =
|
|
65
|
+
const sortCellParams1 = row1.params[index];
|
|
66
|
+
const sortCellParams2 = row2.params[index];
|
|
68
67
|
res = item.comparator(sortCellParams1.value, sortCellParams2.value, sortCellParams1, sortCellParams2);
|
|
69
68
|
return res;
|
|
70
69
|
}, 0);
|
|
@@ -84,10 +83,10 @@ export const buildAggregatedSortingApplier = (sortModel, apiRef) => {
|
|
|
84
83
|
return null;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
return rowList => rowList.map(
|
|
88
|
-
|
|
89
|
-
params: comparatorList.map(el => el.getSortCellParams(
|
|
90
|
-
})).sort((a, b) => compareRows(comparatorList, a
|
|
86
|
+
return rowList => rowList.map(node => ({
|
|
87
|
+
node,
|
|
88
|
+
params: comparatorList.map(el => el.getSortCellParams(node.id))
|
|
89
|
+
})).sort((a, b) => compareRows(comparatorList, a, b)).map(row => row.node.id);
|
|
91
90
|
};
|
|
92
91
|
export const getNextGridSortDirection = (sortingOrder, current) => {
|
|
93
92
|
const currentIdx = sortingOrder.indexOf(current);
|
|
@@ -7,4 +7,4 @@ export declare const sortingStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
7
7
|
* @requires useGridRows (event)
|
|
8
8
|
* @requires useGridColumns (event)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableMultipleColumnsSorting'>) => void;
|
|
10
|
+
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableMultipleColumnsSorting'>) => void;
|
|
@@ -29,6 +29,8 @@ export const sortingStateInitializer = (state, props) => {
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
export const useGridSorting = (apiRef, props) => {
|
|
32
|
+
var _props$initialState3, _props$initialState3$;
|
|
33
|
+
|
|
32
34
|
const logger = useGridLogger(apiRef, 'useGridSorting');
|
|
33
35
|
apiRef.current.unstable_registerControlState({
|
|
34
36
|
stateId: 'sortModel',
|
|
@@ -152,10 +154,17 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
152
154
|
* PRE-PROCESSING
|
|
153
155
|
*/
|
|
154
156
|
|
|
155
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
157
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
158
|
+
var _props$initialState2, _props$initialState2$;
|
|
159
|
+
|
|
156
160
|
const sortModelToExport = gridSortModelSelector(apiRef);
|
|
161
|
+
const shouldExportSortModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
162
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
163
|
+
props.sortModel != null || // Always export if the model has been initialized
|
|
164
|
+
((_props$initialState2 = props.initialState) == null ? void 0 : (_props$initialState2$ = _props$initialState2.sorting) == null ? void 0 : _props$initialState2$.sortModel) != null || // Export if the model is not empty
|
|
165
|
+
sortModelToExport.length > 0;
|
|
157
166
|
|
|
158
|
-
if (
|
|
167
|
+
if (!shouldExportSortModel) {
|
|
159
168
|
return prevState;
|
|
160
169
|
}
|
|
161
170
|
|
|
@@ -164,7 +173,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
164
173
|
sortModel: sortModelToExport
|
|
165
174
|
}
|
|
166
175
|
});
|
|
167
|
-
}, [apiRef]);
|
|
176
|
+
}, [apiRef, props.sortModel, (_props$initialState3 = props.initialState) == null ? void 0 : (_props$initialState3$ = _props$initialState3.sorting) == null ? void 0 : _props$initialState3$.sortModel]);
|
|
168
177
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
169
178
|
var _context$stateToResto;
|
|
170
179
|
|
|
@@ -180,12 +189,31 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
180
189
|
});
|
|
181
190
|
}, [apiRef, props.disableMultipleColumnsSorting]);
|
|
182
191
|
const flatSortingMethod = React.useCallback(params => {
|
|
192
|
+
const rowTree = gridRowTreeSelector(apiRef);
|
|
193
|
+
|
|
183
194
|
if (!params.sortRowList) {
|
|
184
|
-
|
|
195
|
+
const bodyRowIds = [];
|
|
196
|
+
const footerRowIds = [];
|
|
197
|
+
gridRowIdsSelector(apiRef).forEach(rowId => {
|
|
198
|
+
if (rowTree[rowId].position === 'footer') {
|
|
199
|
+
footerRowIds.push(rowId);
|
|
200
|
+
} else {
|
|
201
|
+
bodyRowIds.push(rowId);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return [...bodyRowIds, ...footerRowIds];
|
|
185
205
|
}
|
|
186
206
|
|
|
187
|
-
const
|
|
188
|
-
|
|
207
|
+
const bodyRows = [];
|
|
208
|
+
const footerRowIds = [];
|
|
209
|
+
Object.values(rowTree).forEach(rowNode => {
|
|
210
|
+
if (rowNode.position === 'footer') {
|
|
211
|
+
footerRowIds.push(rowNode.id);
|
|
212
|
+
} else {
|
|
213
|
+
bodyRows.push(rowNode);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
return [...params.sortRowList(bodyRows), ...footerRowIds];
|
|
189
217
|
}, [apiRef]);
|
|
190
218
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
191
219
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
@@ -3,9 +3,10 @@ export interface GridStatePersistenceApi<InitialState extends GridInitialStateCo
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates a serializable object containing the exportable parts of the DataGrid state.
|
|
5
5
|
* These values can then be passed to the `initialState` prop or injected using the `restoreState` method.
|
|
6
|
+
* @param {GridExportStateParams} params With all properties from [[GridExportStateParams]]
|
|
6
7
|
* @returns {GridInitialState} The exported state.
|
|
7
8
|
*/
|
|
8
|
-
exportState: () => InitialState;
|
|
9
|
+
exportState: (params?: GridExportStateParams) => InitialState;
|
|
9
10
|
/**
|
|
10
11
|
* Inject the given values into the state of the DataGrid.
|
|
11
12
|
* @param {GridInitialState} stateToRestore The exported state to restore.
|
|
@@ -19,6 +20,16 @@ export interface GridRestoreStatePreProcessingValue {
|
|
|
19
20
|
*/
|
|
20
21
|
callbacks: (() => void)[];
|
|
21
22
|
}
|
|
23
|
+
export interface GridExportStateParams {
|
|
24
|
+
/**
|
|
25
|
+
* By default, the grid exports all the models.
|
|
26
|
+
* You can switch this property to `true` to only exports models that are either controlled, initialized or modified.
|
|
27
|
+
* For instance, with this property, if you don't control or initialize the `filterModel` and you did not apply any filter, the model won't be exported.
|
|
28
|
+
* Note that the column dimensions are not a model. The grid only exports the dimensions of the modified columns even when `exportOnlyDirtyModels` is false.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
exportOnlyDirtyModels?: boolean;
|
|
32
|
+
}
|
|
22
33
|
export interface GridRestoreStatePreProcessingContext<I extends GridInitialStateCommunity> {
|
|
23
34
|
stateToRestore: I;
|
|
24
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { GridStatePersistenceApi } from './gridStatePersistenceInterface';
|
|
1
|
+
export type { GridStatePersistenceApi, GridExportStateParams, } from './gridStatePersistenceInterface';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiMethod } from '../../utils';
|
|
3
3
|
export const useGridStatePersistence = apiRef => {
|
|
4
|
-
const exportState = React.useCallback(() => {
|
|
5
|
-
const stateToExport = apiRef.current.unstable_applyPipeProcessors('exportState', {});
|
|
4
|
+
const exportState = React.useCallback((params = {}) => {
|
|
5
|
+
const stateToExport = apiRef.current.unstable_applyPipeProcessors('exportState', {}, params);
|
|
6
6
|
return stateToExport;
|
|
7
7
|
}, [apiRef]);
|
|
8
8
|
const restoreState = React.useCallback(stateToRestore => {
|
|
@@ -54,6 +54,8 @@ export const getRenderableIndexes = ({
|
|
|
54
54
|
return [clamp(firstIndex - buffer, minFirstIndex, maxLastIndex), clamp(lastIndex + buffer, minFirstIndex, maxLastIndex)];
|
|
55
55
|
};
|
|
56
56
|
export const useGridVirtualScroller = props => {
|
|
57
|
+
var _currentPage$range3, _currentPage$range4;
|
|
58
|
+
|
|
57
59
|
const apiRef = useGridApiContext();
|
|
58
60
|
const rootProps = useGridRootProps();
|
|
59
61
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
@@ -86,8 +88,17 @@ export const useGridVirtualScroller = props => {
|
|
|
86
88
|
const [containerWidth, setContainerWidth] = React.useState(null);
|
|
87
89
|
const prevTotalWidth = React.useRef(columnsTotalWidth);
|
|
88
90
|
const getNearestIndexToRender = React.useCallback(offset => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
var _currentPage$range, _currentPage$range2;
|
|
92
|
+
|
|
93
|
+
const lastMeasuredIndexRelativeToAllRows = apiRef.current.unstable_getLastMeasuredRowIndex();
|
|
94
|
+
const lastMeasuredIndexRelativeToCurrentPage = lastMeasuredIndexRelativeToAllRows - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
95
|
+
const lastMeasuredIndex = Math.max(0, lastMeasuredIndexRelativeToCurrentPage);
|
|
96
|
+
let allRowsMeasured = lastMeasuredIndex === Infinity;
|
|
97
|
+
|
|
98
|
+
if ((_currentPage$range2 = currentPage.range) != null && _currentPage$range2.lastRowIndex && !allRowsMeasured) {
|
|
99
|
+
// Check if all rows in this page are already measured
|
|
100
|
+
allRowsMeasured = lastMeasuredIndex >= currentPage.range.lastRowIndex;
|
|
101
|
+
}
|
|
91
102
|
|
|
92
103
|
if (allRowsMeasured || rowsMeta.positions[lastMeasuredIndex] >= offset) {
|
|
93
104
|
// If all rows were measured (when no row has "auto" as height) or all rows before the offset
|
|
@@ -100,7 +111,7 @@ export const useGridVirtualScroller = props => {
|
|
|
100
111
|
|
|
101
112
|
|
|
102
113
|
return exponentialSearch(offset, rowsMeta.positions, lastMeasuredIndex);
|
|
103
|
-
}, [apiRef, rowsMeta.positions]);
|
|
114
|
+
}, [apiRef, (_currentPage$range3 = currentPage.range) == null ? void 0 : _currentPage$range3.firstRowIndex, (_currentPage$range4 = currentPage.range) == null ? void 0 : _currentPage$range4.lastRowIndex, rowsMeta.positions]);
|
|
104
115
|
const computeRenderContext = React.useCallback(() => {
|
|
105
116
|
if (disableVirtualization) {
|
|
106
117
|
return {
|
|
@@ -302,7 +313,8 @@ export const useGridVirtualScroller = props => {
|
|
|
302
313
|
apiRef.current.unstable_calculateColSpan({
|
|
303
314
|
rowId: row.id,
|
|
304
315
|
minFirstColumn,
|
|
305
|
-
maxLastColumn
|
|
316
|
+
maxLastColumn,
|
|
317
|
+
columns: visibleColumns
|
|
306
318
|
});
|
|
307
319
|
}
|
|
308
320
|
|
|
@@ -336,10 +348,8 @@ export const useGridVirtualScroller = props => {
|
|
|
336
348
|
|
|
337
349
|
if (selectedRowsLookup[id] == null) {
|
|
338
350
|
isSelected = false;
|
|
339
|
-
} else if (typeof rootProps.isRowSelectable === 'function') {
|
|
340
|
-
isSelected = rootProps.isRowSelectable(apiRef.current.getRowParams(id));
|
|
341
351
|
} else {
|
|
342
|
-
isSelected =
|
|
352
|
+
isSelected = apiRef.current.isRowSelectable(id);
|
|
343
353
|
}
|
|
344
354
|
|
|
345
355
|
rows.push( /*#__PURE__*/_jsx(rootProps.components.Row, _extends({
|
|
@@ -4,7 +4,7 @@ export function useGridApiContext() {
|
|
|
4
4
|
const apiRef = React.useContext(GridApiContext);
|
|
5
5
|
|
|
6
6
|
if (apiRef === undefined) {
|
|
7
|
-
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid or
|
|
7
|
+
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return apiRef;
|
|
@@ -14,8 +14,8 @@ declare enum GridSignature {
|
|
|
14
14
|
interface RegistryContainer {
|
|
15
15
|
registry: CleanupTracking | null;
|
|
16
16
|
}
|
|
17
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions
|
|
17
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
18
18
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
19
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions
|
|
19
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
|
|
20
20
|
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEventsStr>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
21
21
|
export { GridSignature };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiCommon } from '../../models';
|
|
3
|
-
export declare const useGridNativeEventListener: <Api extends GridApiCommon, E extends Event>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => Element | undefined | null), eventName: string, handler?: ((event: E) => any) | undefined, options?: AddEventListenerOptions
|
|
3
|
+
export declare const useGridNativeEventListener: <Api extends GridApiCommon, E extends Event>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => Element | undefined | null), eventName: string, handler?: ((event: E) => any) | undefined, options?: AddEventListenerOptions) => void;
|
|
@@ -20,7 +20,7 @@ export const useGridNativeEventListener = (apiRef, ref, eventName, handler, opti
|
|
|
20
20
|
targetElement = ref && ref.current ? ref.current : null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (targetElement &&
|
|
23
|
+
if (targetElement && eventName && !added) {
|
|
24
24
|
logger.debug(`Binding native ${eventName} event`);
|
|
25
25
|
targetElement.addEventListener(eventName, wrapHandler, options);
|
|
26
26
|
const boundElem = targetElement;
|
|
@@ -4,7 +4,7 @@ export const useGridRootProps = () => {
|
|
|
4
4
|
const contextValue = React.useContext(GridRootPropsContext);
|
|
5
5
|
|
|
6
6
|
if (!contextValue) {
|
|
7
|
-
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid
|
|
7
|
+
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return contextValue;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { GridColumnHeaders } from '../components/columnHeaders/GridColumnHeaders
|
|
|
5
5
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
6
6
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
7
7
|
export type { GridPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
8
|
-
export { useGridRegisterStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
8
|
+
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY, } from '../hooks/core/strategyProcessing';
|
|
9
9
|
export type { GridStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
10
10
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
11
11
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
@@ -48,7 +48,7 @@ export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/ex
|
|
|
48
48
|
export { createSelector, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
49
49
|
export { findParentElementFromClassName } from '../utils/domUtils';
|
|
50
50
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
51
|
-
export { clamp, isDeepEqual } from '../utils/utils';
|
|
51
|
+
export { clamp, isDeepEqual, isNumber, isFunction } from '../utils/utils';
|
|
52
52
|
export { buildWarning } from '../utils/warning';
|
|
53
53
|
export { exportAs } from '../utils/exportAs';
|
|
54
54
|
export type { GridApiCommunity } from '../models/api/gridApiCommunity';
|
package/internals/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { GridVirtualScrollerRenderZone } from '../components/virtualization/Grid
|
|
|
4
4
|
export { GridColumnHeaders } from '../components/columnHeaders/GridColumnHeaders';
|
|
5
5
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
6
6
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
7
|
-
export { useGridRegisterStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
7
|
+
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../hooks/core/strategyProcessing';
|
|
8
8
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
9
9
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
10
10
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
@@ -39,6 +39,6 @@ export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/ex
|
|
|
39
39
|
export { createSelector, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
40
40
|
export { findParentElementFromClassName } from '../utils/domUtils';
|
|
41
41
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
42
|
-
export { clamp, isDeepEqual } from '../utils/utils';
|
|
42
|
+
export { clamp, isDeepEqual, isNumber, isFunction } from '../utils/utils';
|
|
43
43
|
export { buildWarning } from '../utils/warning';
|
|
44
44
|
export { exportAs } from '../utils/exportAs';
|
|
@@ -88,7 +88,7 @@ DataGridRaw.propTypes = {
|
|
|
88
88
|
if (props.columns && props.columns.some(function (column) {
|
|
89
89
|
return column.resizable;
|
|
90
90
|
})) {
|
|
91
|
-
return new Error(["MUI: `column.resizable = true` is not a valid prop.", 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to
|
|
91
|
+
return new Error(["MUI: `column.resizable = true` is not a valid prop.", 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return null;
|
|
@@ -658,14 +658,14 @@ DataGridRaw.propTypes = {
|
|
|
658
658
|
*/
|
|
659
659
|
pageSize: chainPropTypes(PropTypes.number, function (props) {
|
|
660
660
|
if (props.pageSize && props.pageSize > MAX_PAGE_SIZE) {
|
|
661
|
-
return new Error(["MUI: `<DataGrid pageSize={".concat(props.pageSize, "} />` is not a valid prop."), "Only page size below ".concat(MAX_PAGE_SIZE, " is available in the MIT version."), '', 'You need to upgrade to
|
|
661
|
+
return new Error(["MUI: `<DataGrid pageSize={".concat(props.pageSize, "} />` is not a valid prop."), "Only page size below ".concat(MAX_PAGE_SIZE, " is available in the MIT version."), '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
return null;
|
|
665
665
|
}),
|
|
666
666
|
pagination: function pagination(props) {
|
|
667
667
|
if (props.pagination === false) {
|
|
668
|
-
return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to
|
|
668
|
+
return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to disable the pagination.'].join('\n'));
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
return null;
|
|
@@ -745,7 +745,7 @@ DataGridRaw.propTypes = {
|
|
|
745
745
|
*/
|
|
746
746
|
selectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), function (props) {
|
|
747
747
|
if (!props.checkboxSelection && Array.isArray(props.selectionModel) && props.selectionModel.length > 1) {
|
|
748
|
-
return new Error(["MUI: `<DataGrid selectionModel={".concat(JSON.stringify(props.selectionModel), "} />` is not a valid prop."), 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to
|
|
748
|
+
return new Error(["MUI: `<DataGrid selectionModel={".concat(JSON.stringify(props.selectionModel), "} />` is not a valid prop."), 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
749
749
|
}
|
|
750
750
|
|
|
751
751
|
return null;
|
|
@@ -60,7 +60,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
60
60
|
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
61
61
|
useGridEditing(apiRef, props);
|
|
62
62
|
useGridFocus(apiRef, props);
|
|
63
|
-
useGridPreferencesPanel(apiRef);
|
|
63
|
+
useGridPreferencesPanel(apiRef, props);
|
|
64
64
|
useGridFilter(apiRef, props);
|
|
65
65
|
useGridSorting(apiRef, props);
|
|
66
66
|
useGridDensity(apiRef, props);
|
|
@@ -20,5 +20,7 @@ export var GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
20
20
|
sortComparator: gridNumberComparator,
|
|
21
21
|
valueFormatter: gridBooleanFormatter,
|
|
22
22
|
filterOperators: getGridBooleanOperators(),
|
|
23
|
-
getApplyQuickFilterFn: undefined
|
|
23
|
+
getApplyQuickFilterFn: undefined,
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
aggregable: false
|
|
24
26
|
});
|
|
@@ -111,7 +111,8 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
111
111
|
var value = _ref2.value;
|
|
112
112
|
return value == null;
|
|
113
113
|
};
|
|
114
|
-
}
|
|
114
|
+
},
|
|
115
|
+
requiresFilterValue: false
|
|
115
116
|
}, {
|
|
116
117
|
value: 'isNotEmpty',
|
|
117
118
|
getApplyFilterFn: function getApplyFilterFn() {
|
|
@@ -119,6 +120,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
119
120
|
var value = _ref3.value;
|
|
120
121
|
return value != null;
|
|
121
122
|
};
|
|
122
|
-
}
|
|
123
|
+
},
|
|
124
|
+
requiresFilterValue: false
|
|
123
125
|
}];
|
|
124
126
|
};
|
|
@@ -150,7 +150,8 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
150
150
|
var value = _ref8.value;
|
|
151
151
|
return value == null;
|
|
152
152
|
};
|
|
153
|
-
}
|
|
153
|
+
},
|
|
154
|
+
requiresFilterValue: false
|
|
154
155
|
}, {
|
|
155
156
|
value: 'isNotEmpty',
|
|
156
157
|
getApplyFilterFn: function getApplyFilterFn() {
|
|
@@ -158,7 +159,8 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
158
159
|
var value = _ref9.value;
|
|
159
160
|
return value != null;
|
|
160
161
|
};
|
|
161
|
-
}
|
|
162
|
+
},
|
|
163
|
+
requiresFilterValue: false
|
|
162
164
|
}, {
|
|
163
165
|
value: 'isAnyOf',
|
|
164
166
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { renderEditInputCell } from '../components/cell/GridEditInputCell';
|
|
2
2
|
import { gridStringOrNumberComparator } from '../hooks/features/sorting/gridSortingUtils';
|
|
3
3
|
import { getGridStringOperators, getGridStringQuickFilterFn } from './gridStringOperators';
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Move pro and premium properties outside of this Community file
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
export var GRID_STRING_COL_DEF = {
|
|
5
9
|
width: 100,
|
|
6
10
|
minWidth: 50,
|
|
@@ -12,6 +16,8 @@ export var GRID_STRING_COL_DEF = {
|
|
|
12
16
|
filterable: true,
|
|
13
17
|
groupable: true,
|
|
14
18
|
pinnable: true,
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
private_aggregable: true,
|
|
15
21
|
editable: false,
|
|
16
22
|
sortComparator: gridStringOrNumberComparator,
|
|
17
23
|
type: 'string',
|