@mui/x-data-grid 8.0.0-alpha.12 → 8.0.0-alpha.13
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 +299 -0
- package/DataGrid/DataGrid.js +31 -22
- package/DataGrid/useDataGridProps.js +1 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/components/GridFooter.js +1 -1
- package/components/GridHeader.js +1 -1
- package/components/GridPagination.js +5 -6
- package/components/GridRowCount.js +4 -5
- package/components/GridScrollArea.js +4 -3
- package/components/GridSelectedRowCount.js +5 -6
- package/components/GridShadowScrollArea.d.ts +8 -0
- package/components/GridShadowScrollArea.js +82 -0
- package/components/cell/GridEditInputCell.js +2 -3
- package/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/components/columnsManagement/GridColumnsManagement.js +59 -61
- package/components/containers/GridOverlay.js +6 -8
- package/components/containers/GridRoot.js +4 -2
- package/components/containers/GridRootStyles.d.ts +1 -2
- package/components/containers/GridRootStyles.js +77 -100
- package/components/containers/GridToolbarContainer.js +5 -6
- package/components/menu/GridMenu.js +7 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -3
- package/components/panel/GridPanel.js +18 -20
- package/components/panel/GridPanelContent.js +6 -8
- package/components/panel/GridPanelFooter.js +5 -6
- package/components/panel/GridPanelHeader.js +4 -5
- package/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +20 -45
- package/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/components/virtualization/GridVirtualScrollbar.js +8 -5
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/constants/cssVariables.d.ts +294 -0
- package/constants/cssVariables.js +168 -0
- package/constants/dataGridPropsDefaultValues.js +1 -0
- package/constants/defaultGridSlotsComponents.js +1 -1
- package/constants/gridClasses.d.ts +13 -0
- package/constants/gridClasses.js +1 -1
- package/context/GridContextProvider.js +4 -1
- package/esm/DataGrid/DataGrid.js +31 -22
- package/esm/DataGrid/useDataGridProps.js +1 -1
- package/esm/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/esm/components/GridFooter.js +2 -2
- package/esm/components/GridHeader.js +1 -1
- package/esm/components/GridPagination.js +5 -6
- package/esm/components/GridRowCount.js +4 -5
- package/esm/components/GridScrollArea.js +2 -1
- package/esm/components/GridSelectedRowCount.js +5 -6
- package/esm/components/GridShadowScrollArea.d.ts +8 -0
- package/esm/components/GridShadowScrollArea.js +74 -0
- package/esm/components/cell/GridEditInputCell.js +2 -3
- package/esm/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/esm/components/columnsManagement/GridColumnsManagement.js +60 -62
- package/esm/components/containers/GridOverlay.js +6 -8
- package/esm/components/containers/GridRoot.js +4 -2
- package/esm/components/containers/GridRootStyles.d.ts +1 -2
- package/esm/components/containers/GridRootStyles.js +78 -101
- package/esm/components/containers/GridToolbarContainer.js +5 -6
- package/esm/components/menu/GridMenu.js +7 -6
- package/esm/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
- package/esm/components/panel/GridPanel.js +18 -20
- package/esm/components/panel/GridPanelContent.js +6 -8
- package/esm/components/panel/GridPanelFooter.js +5 -6
- package/esm/components/panel/GridPanelHeader.js +4 -5
- package/esm/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
- package/esm/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/esm/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/esm/components/virtualization/GridVirtualScrollbar.js +3 -1
- package/esm/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/esm/constants/cssVariables.d.ts +294 -0
- package/esm/constants/cssVariables.js +161 -0
- package/esm/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/constants/defaultGridSlotsComponents.js +2 -2
- package/esm/constants/gridClasses.d.ts +13 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/context/GridContextProvider.js +4 -1
- package/esm/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/esm/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/esm/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/esm/hooks/features/columns/gridColumnsSelector.js +8 -0
- package/esm/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/esm/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/esm/hooks/features/columns/index.d.ts +1 -1
- package/esm/hooks/features/columns/index.js +1 -1
- package/esm/hooks/features/columns/useGridColumns.js +4 -2
- package/esm/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/esm/hooks/features/dataSource/gridDataSourceError.js +32 -0
- package/esm/hooks/features/dataSource/index.d.ts +2 -0
- package/esm/hooks/features/dataSource/index.js +2 -0
- package/esm/hooks/features/dataSource/models.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/esm/hooks/features/dimensions/useGridDimensions.js +11 -10
- package/esm/hooks/features/editing/useGridCellEditing.js +2 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +2 -1
- package/esm/hooks/features/export/utils.js +4 -2
- package/esm/hooks/features/focus/useGridFocus.js +3 -2
- package/esm/hooks/features/index.d.ts +1 -1
- package/esm/hooks/features/index.js +1 -1
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +148 -81
- package/esm/hooks/features/rowSelection/utils.d.ts +2 -2
- package/esm/hooks/features/rowSelection/utils.js +11 -11
- package/esm/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/esm/hooks/features/rows/gridRowsUtils.js +8 -0
- package/esm/hooks/features/rows/useGridParamsApi.js +2 -8
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/esm/hooks/features/rows/useGridRows.d.ts +2 -2
- package/esm/hooks/features/rows/useGridRows.js +7 -7
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
- package/esm/hooks/utils/useGridSelector.js +4 -1
- package/esm/hooks/utils/useIsSSR.js +4 -1
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/utils/propValidation.js +1 -1
- package/esm/locales/bnBD.d.ts +2 -0
- package/esm/locales/bnBD.js +167 -0
- package/esm/locales/deDE.js +3 -5
- package/esm/locales/huHU.js +10 -13
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/locales/ruRU.js +17 -21
- package/esm/material/index.d.ts +1 -0
- package/esm/material/index.js +164 -49
- package/esm/material/variables.d.ts +5 -0
- package/esm/material/variables.js +89 -0
- package/esm/models/api/gridRowSelectionApi.d.ts +4 -2
- package/esm/models/api/gridSortApi.d.ts +1 -1
- package/esm/models/configuration/gridConfiguration.d.ts +7 -1
- package/esm/models/gridBaseSlots.d.ts +56 -6
- package/esm/models/gridDataSource.d.ts +9 -4
- package/esm/models/gridRowSelectionManager.d.ts +9 -0
- package/esm/models/gridRowSelectionManager.js +36 -0
- package/esm/models/gridRowSelectionModel.d.ts +4 -2
- package/esm/models/gridSlotsComponent.d.ts +7 -27
- package/esm/models/gridSlotsComponentsProps.d.ts +3 -11
- package/esm/models/gridSortModel.d.ts +1 -1
- package/esm/models/index.d.ts +2 -1
- package/esm/models/index.js +2 -3
- package/esm/models/props/DataGridProps.d.ts +22 -17
- package/esm/utils/css/context.d.ts +14 -0
- package/esm/utils/css/context.js +54 -0
- package/esm/utils/index.d.ts +2 -1
- package/esm/utils/index.js +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +28 -27
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/hooks/features/columns/gridColumnsSelector.js +9 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/hooks/features/columns/index.d.ts +1 -1
- package/hooks/features/columns/index.js +94 -10
- package/hooks/features/columns/useGridColumns.js +4 -2
- package/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/hooks/features/dataSource/gridDataSourceError.js +40 -0
- package/hooks/features/dataSource/index.d.ts +2 -0
- package/hooks/features/dataSource/index.js +25 -0
- package/hooks/features/dataSource/models.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/hooks/features/dimensions/useGridDimensions.js +19 -18
- package/hooks/features/editing/useGridCellEditing.js +10 -9
- package/hooks/features/editing/useGridRowEditing.js +11 -10
- package/hooks/features/export/utils.js +4 -2
- package/hooks/features/focus/useGridFocus.js +8 -7
- package/hooks/features/index.d.ts +1 -1
- package/hooks/features/index.js +11 -28
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/hooks/features/rowSelection/useGridRowSelection.js +146 -79
- package/hooks/features/rowSelection/utils.d.ts +2 -2
- package/hooks/features/rowSelection/utils.js +10 -10
- package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/hooks/features/rows/gridRowsUtils.js +10 -1
- package/hooks/features/rows/useGridParamsApi.js +2 -8
- package/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +7 -7
- package/hooks/features/virtualization/useGridVirtualScroller.js +21 -25
- package/hooks/utils/useGridSelector.js +6 -2
- package/hooks/utils/useIsSSR.js +6 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +15 -0
- package/internals/utils/propValidation.js +1 -1
- package/locales/bnBD.d.ts +2 -0
- package/locales/bnBD.js +173 -0
- package/locales/deDE.js +3 -5
- package/locales/huHU.js +10 -13
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/locales/ruRU.js +17 -21
- package/material/index.d.ts +1 -0
- package/material/index.js +170 -49
- package/material/variables.d.ts +5 -0
- package/material/variables.js +95 -0
- package/models/api/gridRowSelectionApi.d.ts +4 -2
- package/models/api/gridSortApi.d.ts +1 -1
- package/models/configuration/gridConfiguration.d.ts +7 -1
- package/models/gridBaseSlots.d.ts +56 -6
- package/models/gridDataSource.d.ts +9 -4
- package/models/gridRowSelectionManager.d.ts +9 -0
- package/models/gridRowSelectionManager.js +43 -0
- package/models/gridRowSelectionModel.d.ts +4 -2
- package/models/gridSlotsComponent.d.ts +7 -27
- package/models/gridSlotsComponentsProps.d.ts +3 -11
- package/models/gridSortModel.d.ts +1 -1
- package/models/index.d.ts +2 -1
- package/models/index.js +34 -11
- package/models/props/DataGridProps.d.ts +22 -17
- package/modern/DataGrid/DataGrid.js +31 -22
- package/modern/DataGrid/useDataGridProps.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/modern/components/GridFooter.js +2 -2
- package/modern/components/GridHeader.js +1 -1
- package/modern/components/GridPagination.js +5 -6
- package/modern/components/GridRowCount.js +4 -5
- package/modern/components/GridScrollArea.js +2 -1
- package/modern/components/GridSelectedRowCount.js +5 -6
- package/modern/components/GridShadowScrollArea.d.ts +8 -0
- package/modern/components/GridShadowScrollArea.js +74 -0
- package/modern/components/cell/GridEditInputCell.js +2 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/modern/components/columnsManagement/GridColumnsManagement.js +60 -62
- package/modern/components/containers/GridOverlay.js +6 -8
- package/modern/components/containers/GridRoot.js +4 -2
- package/modern/components/containers/GridRootStyles.d.ts +1 -2
- package/modern/components/containers/GridRootStyles.js +78 -101
- package/modern/components/containers/GridToolbarContainer.js +5 -6
- package/modern/components/menu/GridMenu.js +7 -6
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
- package/modern/components/panel/GridPanel.js +18 -20
- package/modern/components/panel/GridPanelContent.js +6 -8
- package/modern/components/panel/GridPanelFooter.js +5 -6
- package/modern/components/panel/GridPanelHeader.js +4 -5
- package/modern/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/modern/components/virtualization/GridVirtualScrollbar.js +3 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/cssVariables.d.ts +294 -0
- package/modern/constants/cssVariables.js +161 -0
- package/modern/constants/dataGridPropsDefaultValues.js +1 -0
- package/modern/constants/defaultGridSlotsComponents.js +2 -2
- package/modern/constants/gridClasses.d.ts +13 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/context/GridContextProvider.js +4 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/modern/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/modern/hooks/features/columns/gridColumnsSelector.js +8 -0
- package/modern/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/modern/hooks/features/columns/index.d.ts +1 -1
- package/modern/hooks/features/columns/index.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +4 -2
- package/modern/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/modern/hooks/features/dataSource/gridDataSourceError.js +32 -0
- package/modern/hooks/features/dataSource/index.d.ts +2 -0
- package/modern/hooks/features/dataSource/index.js +2 -0
- package/modern/hooks/features/dataSource/models.d.ts +1 -1
- package/modern/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/modern/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/modern/hooks/features/dimensions/useGridDimensions.js +11 -10
- package/modern/hooks/features/editing/useGridCellEditing.js +2 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -1
- package/modern/hooks/features/export/utils.js +4 -2
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/index.d.ts +1 -1
- package/modern/hooks/features/index.js +1 -1
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +148 -81
- package/modern/hooks/features/rowSelection/utils.d.ts +2 -2
- package/modern/hooks/features/rowSelection/utils.js +11 -11
- package/modern/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +8 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +2 -8
- package/modern/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/modern/hooks/features/rows/useGridRows.d.ts +2 -2
- package/modern/hooks/features/rows/useGridRows.js +7 -7
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
- package/modern/hooks/utils/useGridSelector.js +4 -1
- package/modern/hooks/utils/useIsSSR.js +4 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.d.ts +2 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/locales/bnBD.d.ts +2 -0
- package/modern/locales/bnBD.js +167 -0
- package/modern/locales/deDE.js +3 -5
- package/modern/locales/huHU.js +10 -13
- package/modern/locales/index.d.ts +1 -0
- package/modern/locales/index.js +1 -0
- package/modern/locales/ruRU.js +17 -21
- package/modern/material/index.d.ts +1 -0
- package/modern/material/index.js +164 -49
- package/modern/material/variables.d.ts +5 -0
- package/modern/material/variables.js +89 -0
- package/modern/models/api/gridRowSelectionApi.d.ts +4 -2
- package/modern/models/api/gridSortApi.d.ts +1 -1
- package/modern/models/configuration/gridConfiguration.d.ts +7 -1
- package/modern/models/gridBaseSlots.d.ts +56 -6
- package/modern/models/gridDataSource.d.ts +9 -4
- package/modern/models/gridRowSelectionManager.d.ts +9 -0
- package/modern/models/gridRowSelectionManager.js +36 -0
- package/modern/models/gridRowSelectionModel.d.ts +4 -2
- package/modern/models/gridSlotsComponent.d.ts +7 -27
- package/modern/models/gridSlotsComponentsProps.d.ts +3 -11
- package/modern/models/gridSortModel.d.ts +1 -1
- package/modern/models/index.d.ts +2 -1
- package/modern/models/index.js +2 -3
- package/modern/models/props/DataGridProps.d.ts +22 -17
- package/modern/utils/css/context.d.ts +14 -0
- package/modern/utils/css/context.js +54 -0
- package/modern/utils/index.d.ts +2 -1
- package/modern/utils/index.js +1 -1
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/css/context.d.ts +14 -0
- package/utils/css/context.js +64 -0
- package/utils/index.d.ts +2 -1
- package/utils/index.js +8 -1
|
@@ -11,9 +11,11 @@ import { GridContextProvider } from "../context/GridContextProvider.js";
|
|
|
11
11
|
import { useDataGridComponent } from "./useDataGridComponent.js";
|
|
12
12
|
import { useDataGridProps } from "./useDataGridProps.js";
|
|
13
13
|
import { propValidatorsDataGrid, validateProps } from "../internals/utils/propValidation.js";
|
|
14
|
+
import { useMaterialCSSVariables } from "../material/variables.js";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const configuration = {
|
|
16
17
|
hooks: {
|
|
18
|
+
useCSSVariables: useMaterialCSSVariables,
|
|
17
19
|
useGridAriaAttributes,
|
|
18
20
|
useGridRowAriaAttributes
|
|
19
21
|
}
|
|
@@ -138,6 +140,21 @@ DataGridRaw.propTypes = {
|
|
|
138
140
|
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
139
141
|
*/
|
|
140
142
|
columnVisibilityModel: PropTypes.object,
|
|
143
|
+
/**
|
|
144
|
+
* The data source object.
|
|
145
|
+
*/
|
|
146
|
+
dataSource: PropTypes.shape({
|
|
147
|
+
getRows: PropTypes.func.isRequired,
|
|
148
|
+
updateRow: PropTypes.func
|
|
149
|
+
}),
|
|
150
|
+
/**
|
|
151
|
+
* Data source cache object.
|
|
152
|
+
*/
|
|
153
|
+
dataSourceCache: PropTypes.shape({
|
|
154
|
+
clear: PropTypes.func.isRequired,
|
|
155
|
+
get: PropTypes.func.isRequired,
|
|
156
|
+
set: PropTypes.func.isRequired
|
|
157
|
+
}),
|
|
141
158
|
/**
|
|
142
159
|
* Set the density of the Data Grid.
|
|
143
160
|
* @default "standard"
|
|
@@ -490,6 +507,11 @@ DataGridRaw.propTypes = {
|
|
|
490
507
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
491
508
|
*/
|
|
492
509
|
onColumnWidthChange: PropTypes.func,
|
|
510
|
+
/**
|
|
511
|
+
* Callback fired when a data source request fails.
|
|
512
|
+
* @param {GridGetRowsError | GridUpdateRowError} error The data source error object.
|
|
513
|
+
*/
|
|
514
|
+
onDataSourceError: PropTypes.func,
|
|
493
515
|
/**
|
|
494
516
|
* Callback fired when the density changes.
|
|
495
517
|
* @param {GridDensity} density New density value.
|
|
@@ -687,7 +709,10 @@ DataGridRaw.propTypes = {
|
|
|
687
709
|
/**
|
|
688
710
|
* Sets the row selection model of the Data Grid.
|
|
689
711
|
*/
|
|
690
|
-
rowSelectionModel: PropTypes
|
|
712
|
+
rowSelectionModel: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
713
|
+
ids: PropTypes.instanceOf(Set).isRequired,
|
|
714
|
+
type: PropTypes.oneOf(['exclude', 'include']).isRequired
|
|
715
|
+
}),
|
|
691
716
|
/**
|
|
692
717
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
693
718
|
* @default "margin"
|
|
@@ -712,6 +737,11 @@ DataGridRaw.propTypes = {
|
|
|
712
737
|
* @default false
|
|
713
738
|
*/
|
|
714
739
|
showColumnVerticalBorder: PropTypes.bool,
|
|
740
|
+
/**
|
|
741
|
+
* If `true`, the toolbar is displayed.
|
|
742
|
+
* @default false
|
|
743
|
+
*/
|
|
744
|
+
showToolbar: PropTypes.bool,
|
|
715
745
|
/**
|
|
716
746
|
* Overridable components props dynamically passed to the component at rendering.
|
|
717
747
|
*/
|
|
@@ -743,27 +773,6 @@ DataGridRaw.propTypes = {
|
|
|
743
773
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
744
774
|
*/
|
|
745
775
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
746
|
-
/**
|
|
747
|
-
* The data source object.
|
|
748
|
-
*/
|
|
749
|
-
unstable_dataSource: PropTypes.shape({
|
|
750
|
-
getRows: PropTypes.func.isRequired,
|
|
751
|
-
updateRow: PropTypes.func
|
|
752
|
-
}),
|
|
753
|
-
/**
|
|
754
|
-
* Data source cache object.
|
|
755
|
-
*/
|
|
756
|
-
unstable_dataSourceCache: PropTypes.shape({
|
|
757
|
-
clear: PropTypes.func.isRequired,
|
|
758
|
-
get: PropTypes.func.isRequired,
|
|
759
|
-
set: PropTypes.func.isRequired
|
|
760
|
-
}),
|
|
761
|
-
/**
|
|
762
|
-
* Callback fired when the data source request fails.
|
|
763
|
-
* @param {Error} error The error object.
|
|
764
|
-
* @param {GridGetRowsParams} params With all properties from [[GridGetRowsParams]].
|
|
765
|
-
*/
|
|
766
|
-
unstable_onDataSourceError: PropTypes.func,
|
|
767
776
|
/**
|
|
768
777
|
* If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
|
|
769
778
|
* By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
|
|
@@ -17,7 +17,7 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
17
17
|
signature: 'DataGrid',
|
|
18
18
|
unstable_listView: false
|
|
19
19
|
};
|
|
20
|
-
const getDataGridForcedProps = themedProps => _extends({}, DATA_GRID_FORCED_PROPS, themedProps.
|
|
20
|
+
const getDataGridForcedProps = themedProps => _extends({}, DATA_GRID_FORCED_PROPS, themedProps.dataSource ? {
|
|
21
21
|
filterMode: 'server',
|
|
22
22
|
sortingMode: 'server',
|
|
23
23
|
paginationMode: 'server'
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GridCellCheckboxRenderer } from "../components/columnSelection/GridCellCheckboxRenderer.js";
|
|
4
4
|
import { GridHeaderCheckbox } from "../components/columnSelection/GridHeaderCheckbox.js";
|
|
5
|
-
import { selectedIdsLookupSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
|
|
6
5
|
import { GRID_BOOLEAN_COL_DEF } from "./gridBooleanColDef.js";
|
|
7
6
|
import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -22,9 +21,8 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
|
|
|
22
21
|
getApplyQuickFilterFn: undefined,
|
|
23
22
|
display: 'flex',
|
|
24
23
|
valueGetter: (value, row, column, apiRef) => {
|
|
25
|
-
const selectionLookup = selectedIdsLookupSelector(apiRef);
|
|
26
24
|
const rowId = gridRowIdSelector(apiRef, row);
|
|
27
|
-
return
|
|
25
|
+
return apiRef.current.isRowSelected(rowId);
|
|
28
26
|
},
|
|
29
27
|
renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
|
|
30
28
|
renderCell: params => /*#__PURE__*/_jsx(GridCellCheckboxRenderer, _extends({}, params))
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
5
5
|
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
6
6
|
import { gridTopLevelRowCountSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
7
|
-
import {
|
|
7
|
+
import { gridRowSelectionCountSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
|
|
8
8
|
import { gridFilteredTopLevelRowCountSelector } from "../hooks/features/filter/gridFilterSelector.js";
|
|
9
9
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
10
10
|
import { GridSelectedRowCount } from "./GridSelectedRowCount.js";
|
|
@@ -15,7 +15,7 @@ const GridFooter = forwardRef(function GridFooter(props, ref) {
|
|
|
15
15
|
const apiRef = useGridApiContext();
|
|
16
16
|
const rootProps = useGridRootProps();
|
|
17
17
|
const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector);
|
|
18
|
-
const selectedRowCount = useGridSelector(apiRef,
|
|
18
|
+
const selectedRowCount = useGridSelector(apiRef, gridRowSelectionCountSelector);
|
|
19
19
|
const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
|
|
20
20
|
const selectedRowCountElement = !rootProps.hideFooterSelectedRowCount && selectedRowCount > 0 ? /*#__PURE__*/_jsx(GridSelectedRowCount, {
|
|
21
21
|
selectedRowCount: selectedRowCount
|
|
@@ -6,6 +6,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
export function GridHeader() {
|
|
7
7
|
const rootProps = useGridRootProps();
|
|
8
8
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
9
|
-
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.
|
|
9
|
+
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.showToolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, rootProps.slotProps?.toolbar))]
|
|
10
10
|
});
|
|
11
11
|
}
|
|
@@ -4,30 +4,29 @@ import { styled } from '@mui/material/styles';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
|
|
6
6
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
7
|
+
import { vars } from "../constants/cssVariables.js";
|
|
7
8
|
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
8
9
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
9
10
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
10
11
|
import { gridPaginationModelSelector, gridPaginationRowCountSelector, gridPageCountSelector } from "../hooks/features/pagination/gridPaginationSelector.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const GridPaginationRoot = styled(TablePagination)(
|
|
13
|
-
theme
|
|
14
|
-
}) => ({
|
|
13
|
+
const GridPaginationRoot = styled(TablePagination)({
|
|
15
14
|
maxHeight: 'calc(100% + 1px)',
|
|
16
15
|
// border width
|
|
17
16
|
flexGrow: 1,
|
|
18
17
|
[`& .${tablePaginationClasses.selectLabel}`]: {
|
|
19
18
|
display: 'none',
|
|
20
|
-
[
|
|
19
|
+
[vars.breakpoints.up('sm')]: {
|
|
21
20
|
display: 'block'
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
23
|
[`& .${tablePaginationClasses.input}`]: {
|
|
25
24
|
display: 'none',
|
|
26
|
-
[
|
|
25
|
+
[vars.breakpoints.up('sm')]: {
|
|
27
26
|
display: 'inline-flex'
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
})
|
|
29
|
+
});
|
|
31
30
|
const wrapLabelDisplayedRows = (labelDisplayedRows, estimated) => {
|
|
32
31
|
return ({
|
|
33
32
|
from,
|
|
@@ -7,6 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { styled } from '@mui/system';
|
|
9
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
|
+
import { vars } from "../constants/cssVariables.js";
|
|
10
11
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
11
12
|
import { getDataGridUtilityClass } from "../constants/gridClasses.js";
|
|
12
13
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
@@ -24,13 +25,11 @@ const GridRowCountRoot = styled('div', {
|
|
|
24
25
|
name: 'MuiDataGrid',
|
|
25
26
|
slot: 'RowCount',
|
|
26
27
|
overridesResolver: (props, styles) => styles.rowCount
|
|
27
|
-
})(
|
|
28
|
-
theme
|
|
29
|
-
}) => ({
|
|
28
|
+
})({
|
|
30
29
|
alignItems: 'center',
|
|
31
30
|
display: 'flex',
|
|
32
|
-
margin:
|
|
33
|
-
})
|
|
31
|
+
margin: vars.spacing(0, 2)
|
|
32
|
+
});
|
|
34
33
|
const GridRowCount = forwardRef(function GridRowCount(props, ref) {
|
|
35
34
|
const {
|
|
36
35
|
className,
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import
|
|
6
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
8
|
import { styled } from '@mui/system';
|
|
8
9
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
9
10
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
@@ -7,6 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { styled } from '@mui/system';
|
|
9
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
|
+
import { vars } from "../constants/cssVariables.js";
|
|
10
11
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
11
12
|
import { getDataGridUtilityClass } from "../constants/gridClasses.js";
|
|
12
13
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
@@ -24,21 +25,19 @@ const GridSelectedRowCountRoot = styled('div', {
|
|
|
24
25
|
name: 'MuiDataGrid',
|
|
25
26
|
slot: 'SelectedRowCount',
|
|
26
27
|
overridesResolver: (props, styles) => styles.selectedRowCount
|
|
27
|
-
})(
|
|
28
|
-
theme
|
|
29
|
-
}) => ({
|
|
28
|
+
})({
|
|
30
29
|
alignItems: 'center',
|
|
31
30
|
display: 'flex',
|
|
32
|
-
margin:
|
|
31
|
+
margin: vars.spacing(0, 2),
|
|
33
32
|
visibility: 'hidden',
|
|
34
33
|
width: 0,
|
|
35
34
|
height: 0,
|
|
36
|
-
[
|
|
35
|
+
[vars.breakpoints.up('sm')]: {
|
|
37
36
|
visibility: 'visible',
|
|
38
37
|
width: 'auto',
|
|
39
38
|
height: 'auto'
|
|
40
39
|
}
|
|
41
|
-
})
|
|
40
|
+
});
|
|
42
41
|
const GridSelectedRowCount = forwardRef(function GridSelectedRowCount(props, ref) {
|
|
43
42
|
const {
|
|
44
43
|
className,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface GridShadowScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Adds scroll shadows above and below content in a scrollable container.
|
|
7
|
+
*/
|
|
8
|
+
export declare function GridShadowScrollArea(props: GridShadowScrollAreaProps): React.JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["children"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled, keyframes } from '@mui/system';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const reveal = keyframes({
|
|
8
|
+
from: {
|
|
9
|
+
opacity: 0
|
|
10
|
+
},
|
|
11
|
+
to: {
|
|
12
|
+
opacity: 1
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const detectScroll = keyframes({
|
|
16
|
+
'from, to': {
|
|
17
|
+
'--scrollable': '" "'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const ShadowScrollArea = styled('div', {
|
|
21
|
+
name: 'MuiDataGrid',
|
|
22
|
+
slot: 'ShadowScrollArea'
|
|
23
|
+
})({
|
|
24
|
+
flex: 1,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
animation: detectScroll,
|
|
28
|
+
animationTimeline: '--scroll-timeline',
|
|
29
|
+
animationFillMode: 'none',
|
|
30
|
+
boxSizing: 'border-box',
|
|
31
|
+
overflow: 'auto',
|
|
32
|
+
scrollTimeline: '--scroll-timeline block',
|
|
33
|
+
'&::before, &::after': {
|
|
34
|
+
content: '""',
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
display: 'block',
|
|
37
|
+
position: 'sticky',
|
|
38
|
+
left: 0,
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: '4px',
|
|
41
|
+
animation: `${reveal} linear both`,
|
|
42
|
+
animationTimeline: '--scroll-timeline',
|
|
43
|
+
// Custom property toggle trick:
|
|
44
|
+
// - Detects if the element is scrollable
|
|
45
|
+
// - https://css-tricks.com/the-css-custom-property-toggle-trick/
|
|
46
|
+
'--visibility-scrollable': 'var(--scrollable) visible',
|
|
47
|
+
'--visibility-not-scrollable': 'hidden',
|
|
48
|
+
visibility: 'var(--visibility-scrollable, var(--visibility-not-scrollable))'
|
|
49
|
+
},
|
|
50
|
+
'&::before': {
|
|
51
|
+
top: 0,
|
|
52
|
+
background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
53
|
+
animationRange: '0 4px'
|
|
54
|
+
},
|
|
55
|
+
'&::after': {
|
|
56
|
+
bottom: 0,
|
|
57
|
+
background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
58
|
+
animationDirection: 'reverse',
|
|
59
|
+
animationRange: 'calc(100% - 4px) 100%'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Adds scroll shadows above and below content in a scrollable container.
|
|
65
|
+
*/
|
|
66
|
+
export function GridShadowScrollArea(props) {
|
|
67
|
+
const {
|
|
68
|
+
children
|
|
69
|
+
} = props,
|
|
70
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
71
|
+
return /*#__PURE__*/_jsx(ShadowScrollArea, _extends({}, rest, {
|
|
72
|
+
children: children
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
@@ -7,6 +7,7 @@ import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect a
|
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
9
|
import { NotRendered } from "../../utils/assert.js";
|
|
10
|
+
import { vars } from "../../constants/cssVariables.js";
|
|
10
11
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
11
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
@@ -23,9 +24,7 @@ const useUtilityClasses = ownerState => {
|
|
|
23
24
|
const GridEditInputCellRoot = styled(NotRendered, {
|
|
24
25
|
name: 'MuiDataGrid',
|
|
25
26
|
slot: 'EditInputCell'
|
|
26
|
-
})(({
|
|
27
|
-
theme
|
|
28
|
-
}) => _extends({}, theme.typography.body2, {
|
|
27
|
+
})(_extends({}, vars.typography.body, {
|
|
29
28
|
padding: '1px 0',
|
|
30
29
|
'& input': {
|
|
31
30
|
padding: '0 16px',
|
|
@@ -14,6 +14,7 @@ import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
|
14
14
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
15
15
|
import { gridExpandedSortedRowIdsSelector } from "../../hooks/features/filter/gridFilterSelector.js";
|
|
16
16
|
import { gridPaginatedVisibleSortedGridRowIdsSelector } from "../../hooks/features/pagination/gridPaginationSelector.js";
|
|
17
|
+
import { createRowSelectionManager } from "../../models/gridRowSelectionManager.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
19
20
|
const {
|
|
@@ -38,39 +39,72 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
|
38
39
|
const visibleRowIds = useGridSelector(apiRef, gridExpandedSortedRowIdsSelector);
|
|
39
40
|
const paginatedVisibleRowIds = useGridSelector(apiRef, gridPaginatedVisibleSortedGridRowIdsSelector);
|
|
40
41
|
const filteredSelection = React.useMemo(() => {
|
|
41
|
-
|
|
42
|
+
const isRowSelectable = rootProps.isRowSelectable;
|
|
43
|
+
if (typeof isRowSelectable !== 'function') {
|
|
42
44
|
return selection;
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
if (selection.type === 'exclude') {
|
|
47
|
+
return selection;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// selection.type === 'include'
|
|
51
|
+
const selectionModel = {
|
|
52
|
+
type: 'include',
|
|
53
|
+
ids: new Set()
|
|
54
|
+
};
|
|
55
|
+
for (const id of selection.ids) {
|
|
45
56
|
if (rootProps.keepNonExistentRowsSelected) {
|
|
46
|
-
|
|
57
|
+
selectionModel.ids.add(id);
|
|
47
58
|
}
|
|
48
59
|
// The row might have been deleted
|
|
49
60
|
if (!apiRef.current.getRow(id)) {
|
|
50
|
-
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (isRowSelectable(apiRef.current.getRowParams(id))) {
|
|
64
|
+
selectionModel.ids.add(id);
|
|
51
65
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [apiRef, rootProps.isRowSelectable,
|
|
66
|
+
}
|
|
67
|
+
return selectionModel;
|
|
68
|
+
}, [apiRef, rootProps.isRowSelectable, rootProps.keepNonExistentRowsSelected, selection]);
|
|
55
69
|
|
|
56
70
|
// All the rows that could be selected / unselected by toggling this checkbox
|
|
57
71
|
const selectionCandidates = React.useMemo(() => {
|
|
58
72
|
const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly ? visibleRowIds : paginatedVisibleRowIds;
|
|
59
73
|
|
|
60
|
-
// Convert to
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
// Convert to a Set to make O(1) checking if a row exists or not
|
|
75
|
+
const candidates = new Set();
|
|
76
|
+
for (let i = 0; i < rowIds.length; i += 1) {
|
|
77
|
+
const id = rowIds[i];
|
|
78
|
+
if (apiRef.current.isRowSelectable(id)) {
|
|
79
|
+
candidates.add(id);
|
|
65
80
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, {});
|
|
81
|
+
}
|
|
82
|
+
return candidates;
|
|
69
83
|
}, [apiRef, rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
|
|
70
84
|
|
|
71
85
|
// Amount of rows selected and that are visible in the current page
|
|
72
|
-
const currentSelectionSize = React.useMemo(() =>
|
|
73
|
-
|
|
86
|
+
const currentSelectionSize = React.useMemo(() => {
|
|
87
|
+
const selectionManager = createRowSelectionManager(filteredSelection);
|
|
88
|
+
let size = 0;
|
|
89
|
+
for (const id of selectionCandidates) {
|
|
90
|
+
if (selectionManager.has(id)) {
|
|
91
|
+
size += 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return size;
|
|
95
|
+
}, [filteredSelection, selectionCandidates]);
|
|
96
|
+
const isIndeterminate = React.useMemo(() => {
|
|
97
|
+
if (filteredSelection.ids.size === 0) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const selectionManager = createRowSelectionManager(filteredSelection);
|
|
101
|
+
for (const rowId of selectionCandidates) {
|
|
102
|
+
if (!selectionManager.has(rowId)) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}, [filteredSelection, selectionCandidates]);
|
|
74
108
|
const isChecked = currentSelectionSize > 0;
|
|
75
109
|
const handleChange = event => {
|
|
76
110
|
const params = {
|
|
@@ -5,14 +5,15 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
7
|
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
8
|
-
import {
|
|
8
|
+
import { vars } from "../../constants/cssVariables.js";
|
|
9
|
+
import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, gridInitialColumnVisibilityModelSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
|
|
9
10
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
10
11
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
11
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
13
|
-
import { useLazyRef } from "../../hooks/utils/useLazyRef.js";
|
|
14
14
|
import { checkColumnVisibilityModelsSame, defaultSearchPredicate } from "./utils.js";
|
|
15
15
|
import { NotRendered } from "../../utils/assert.js";
|
|
16
|
+
import { GridShadowScrollArea } from "../GridShadowScrollArea.js";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const useUtilityClasses = ownerState => {
|
|
18
19
|
const {
|
|
@@ -32,7 +33,7 @@ function GridColumnsManagement(props) {
|
|
|
32
33
|
const apiRef = useGridApiContext();
|
|
33
34
|
const searchInputRef = React.useRef(null);
|
|
34
35
|
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
35
|
-
const initialColumnVisibilityModel =
|
|
36
|
+
const initialColumnVisibilityModel = useGridSelector(apiRef, gridInitialColumnVisibilityModelSelector);
|
|
36
37
|
const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
37
38
|
const rootProps = useGridRootProps();
|
|
38
39
|
const [searchValue, setSearchValue] = React.useState('');
|
|
@@ -132,20 +133,20 @@ function GridColumnsManagement(props) {
|
|
|
132
133
|
type: "search",
|
|
133
134
|
slotProps: {
|
|
134
135
|
input: {
|
|
135
|
-
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.
|
|
136
|
-
|
|
137
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
|
|
136
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {
|
|
137
|
+
fontSize: "small"
|
|
138
138
|
}),
|
|
139
139
|
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
140
|
-
"aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
|
|
141
140
|
size: "small",
|
|
141
|
+
"aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
|
|
142
142
|
style: searchValue ? {
|
|
143
143
|
visibility: 'visible'
|
|
144
144
|
} : {
|
|
145
145
|
visibility: 'hidden'
|
|
146
146
|
},
|
|
147
147
|
tabIndex: -1,
|
|
148
|
-
onClick: handleSearchReset
|
|
148
|
+
onClick: handleSearchReset,
|
|
149
|
+
edge: "end"
|
|
149
150
|
}, rootProps.slotProps?.baseIconButton, {
|
|
150
151
|
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
151
152
|
fontSize: "small"
|
|
@@ -159,25 +160,27 @@ function GridColumnsManagement(props) {
|
|
|
159
160
|
autoComplete: "off",
|
|
160
161
|
fullWidth: true
|
|
161
162
|
}, rootProps.slotProps?.baseTextField, searchInputProps))
|
|
162
|
-
}), /*#__PURE__*/
|
|
163
|
-
className: classes.root,
|
|
163
|
+
}), /*#__PURE__*/_jsx(GridColumnsManagementScrollArea, {
|
|
164
164
|
ownerState: rootProps,
|
|
165
|
-
children:
|
|
166
|
-
className: classes.
|
|
167
|
-
disabled: column.hideable === false,
|
|
168
|
-
checked: columnVisibilityModel[column.field] !== false,
|
|
169
|
-
onClick: toggleColumn,
|
|
170
|
-
name: column.field,
|
|
171
|
-
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined,
|
|
172
|
-
label: column.headerName || column.field,
|
|
173
|
-
size: "medium",
|
|
174
|
-
density: "compact",
|
|
175
|
-
fullWidth: true
|
|
176
|
-
}, rootProps.slotProps?.baseCheckbox), column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
165
|
+
children: /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
166
|
+
className: classes.root,
|
|
177
167
|
ownerState: rootProps,
|
|
178
|
-
children:
|
|
179
|
-
|
|
180
|
-
|
|
168
|
+
children: [currentColumns.map(column => /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
169
|
+
className: classes.row,
|
|
170
|
+
disabled: column.hideable === false,
|
|
171
|
+
checked: columnVisibilityModel[column.field] !== false,
|
|
172
|
+
onClick: toggleColumn,
|
|
173
|
+
name: column.field,
|
|
174
|
+
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined,
|
|
175
|
+
label: column.headerName || column.field,
|
|
176
|
+
density: "compact",
|
|
177
|
+
fullWidth: true
|
|
178
|
+
}, rootProps.slotProps?.baseCheckbox), column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
179
|
+
ownerState: rootProps,
|
|
180
|
+
children: apiRef.current.getLocaleText('columnsManagementNoColumns')
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
}), !disableShowHideToggle || !disableResetButton ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
|
|
181
184
|
ownerState: rootProps,
|
|
182
185
|
className: classes.footer,
|
|
183
186
|
children: [!disableShowHideToggle ? /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
@@ -186,7 +189,8 @@ function GridColumnsManagement(props) {
|
|
|
186
189
|
indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
|
|
187
190
|
onClick: () => toggleAllColumns(!allHideableColumnsVisible),
|
|
188
191
|
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
|
|
189
|
-
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
192
|
+
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
|
|
193
|
+
density: "compact"
|
|
190
194
|
}, rootProps.slotProps?.baseCheckbox)) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
191
195
|
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
192
196
|
disabled: isResetDisabled
|
|
@@ -262,57 +266,51 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
262
266
|
const GridColumnsManagementBody = styled('div', {
|
|
263
267
|
name: 'MuiDataGrid',
|
|
264
268
|
slot: 'ColumnsManagement'
|
|
265
|
-
})(
|
|
266
|
-
theme
|
|
267
|
-
}) => ({
|
|
268
|
-
padding: theme.spacing(0, 2, 1.5),
|
|
269
|
+
})({
|
|
269
270
|
display: 'flex',
|
|
270
271
|
flexDirection: 'column',
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
padding: vars.spacing(0.5, 1.5)
|
|
273
|
+
});
|
|
274
|
+
const GridColumnsManagementScrollArea = styled(GridShadowScrollArea, {
|
|
275
|
+
name: 'MuiDataGrid',
|
|
276
|
+
slot: 'ColumnsManagementScrollArea'
|
|
277
|
+
})({
|
|
278
|
+
maxHeight: 400
|
|
279
|
+
});
|
|
276
280
|
const GridColumnsManagementHeader = styled('div', {
|
|
277
281
|
name: 'MuiDataGrid',
|
|
278
282
|
slot: 'ColumnsManagementHeader'
|
|
279
|
-
})(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}));
|
|
283
|
+
})({
|
|
284
|
+
padding: vars.spacing(1.5, 2),
|
|
285
|
+
borderBottom: `1px solid ${vars.colors.border.base}`
|
|
286
|
+
});
|
|
284
287
|
const SearchInput = styled(NotRendered, {
|
|
285
288
|
name: 'MuiDataGrid',
|
|
286
289
|
slot: 'ColumnsManagementSearchInput'
|
|
287
|
-
})(
|
|
288
|
-
theme
|
|
289
|
-
}) => ({
|
|
290
|
-
[`& .${inputBaseClasses.root}`]: {
|
|
291
|
-
padding: theme.spacing(0, 1.5, 0, 1.5)
|
|
292
|
-
},
|
|
290
|
+
})({
|
|
293
291
|
[`& .${inputBaseClasses.input}::-webkit-search-decoration,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
& .${inputBaseClasses.input}::-webkit-search-cancel-button,
|
|
293
|
+
& .${inputBaseClasses.input}::-webkit-search-results-button,
|
|
294
|
+
& .${inputBaseClasses.input}::-webkit-search-results-decoration`]: {
|
|
297
295
|
/* clears the 'X' icon from Chrome */
|
|
298
296
|
display: 'none'
|
|
299
297
|
}
|
|
300
|
-
})
|
|
298
|
+
});
|
|
301
299
|
const GridColumnsManagementFooter = styled('div', {
|
|
302
300
|
name: 'MuiDataGrid',
|
|
303
301
|
slot: 'ColumnsManagementFooter'
|
|
304
|
-
})(
|
|
305
|
-
|
|
306
|
-
}) => ({
|
|
307
|
-
padding: theme.spacing(0.5, 1, 0.5, 3),
|
|
302
|
+
})({
|
|
303
|
+
padding: vars.spacing(1, 1, 1, 1.5),
|
|
308
304
|
display: 'flex',
|
|
309
305
|
justifyContent: 'space-between',
|
|
310
|
-
borderTop: `1px solid ${
|
|
311
|
-
})
|
|
312
|
-
const GridColumnsManagementEmptyText = styled('div'
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
306
|
+
borderTop: `1px solid ${vars.colors.border.base}`
|
|
307
|
+
});
|
|
308
|
+
const GridColumnsManagementEmptyText = styled('div', {
|
|
309
|
+
name: 'MuiDataGrid',
|
|
310
|
+
slot: 'ColumnsManagementEmptyText'
|
|
311
|
+
})({
|
|
312
|
+
padding: vars.spacing(1, 0),
|
|
313
|
+
alignSelf: 'center',
|
|
314
|
+
fontSize: vars.typography.body.fontSize
|
|
315
|
+
});
|
|
318
316
|
export { GridColumnsManagement };
|