@mui/x-data-grid 8.0.0-alpha.12 → 8.0.0-alpha.14
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 +430 -0
- package/DataGrid/DataGrid.js +31 -22
- package/DataGrid/useDataGridProps.js +1 -1
- package/colDef/gridActionsColDef.js +1 -1
- package/colDef/gridBooleanColDef.js +1 -1
- package/colDef/gridCheckboxSelectionColDef.js +2 -4
- 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 +60 -61
- package/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/components/columnsPanel/ColumnsPanelTrigger.js +209 -0
- package/components/columnsPanel/index.d.ts +1 -0
- package/components/columnsPanel/index.js +16 -0
- 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/export/ExportCsv.d.ts +30 -0
- package/components/export/ExportCsv.js +196 -0
- package/components/export/ExportPrint.d.ts +30 -0
- package/components/export/ExportPrint.js +196 -0
- package/components/export/index.d.ts +2 -0
- package/components/export/index.js +27 -0
- package/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/components/filterPanel/FilterPanelTrigger.js +212 -0
- package/components/filterPanel/index.d.ts +1 -0
- package/components/filterPanel/index.js +16 -0
- package/components/index.d.ts +6 -1
- package/components/index.js +60 -0
- 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/quickFilter/QuickFilter.d.ts +41 -0
- package/components/quickFilter/QuickFilter.js +110 -0
- package/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/components/quickFilter/QuickFilterClear.js +161 -0
- package/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/components/quickFilter/QuickFilterContext.js +17 -0
- package/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/components/quickFilter/QuickFilterControl.js +104 -0
- package/components/quickFilter/index.d.ts +3 -0
- package/components/quickFilter/index.js +38 -0
- package/components/toolbar/GridToolbar.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/components/toolbar/GridToolbarQuickFilter.js +57 -97
- package/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/components/toolbarV8/GridToolbar.js +142 -0
- package/components/toolbarV8/Toolbar.d.ts +32 -0
- package/components/toolbarV8/Toolbar.js +132 -0
- package/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/components/toolbarV8/ToolbarButton.js +179 -0
- package/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/components/toolbarV8/ToolbarContext.js +17 -0
- package/components/toolbarV8/index.d.ts +2 -0
- package/components/toolbarV8/index.js +27 -0
- package/components/virtualization/GridVirtualScrollbar.js +15 -6
- 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 +2 -1
- package/constants/gridClasses.d.ts +17 -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/gridActionsColDef.js +1 -1
- package/esm/colDef/gridBooleanColDef.js +1 -1
- package/esm/colDef/gridCheckboxSelectionColDef.js +2 -4
- 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 +61 -62
- package/esm/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/esm/components/columnsPanel/ColumnsPanelTrigger.js +202 -0
- package/esm/components/columnsPanel/index.d.ts +1 -0
- package/esm/components/columnsPanel/index.js +1 -0
- 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/export/ExportCsv.d.ts +30 -0
- package/esm/components/export/ExportCsv.js +189 -0
- package/esm/components/export/ExportPrint.d.ts +30 -0
- package/esm/components/export/ExportPrint.js +189 -0
- package/esm/components/export/index.d.ts +2 -0
- package/esm/components/export/index.js +2 -0
- package/esm/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/esm/components/filterPanel/FilterPanelTrigger.js +205 -0
- package/esm/components/filterPanel/index.d.ts +1 -0
- package/esm/components/filterPanel/index.js +1 -0
- package/esm/components/index.d.ts +6 -1
- package/esm/components/index.js +6 -1
- 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/quickFilter/QuickFilter.d.ts +41 -0
- package/esm/components/quickFilter/QuickFilter.js +103 -0
- package/esm/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterClear.js +154 -0
- package/esm/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/esm/components/quickFilter/QuickFilterContext.js +9 -0
- package/esm/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterControl.js +97 -0
- package/esm/components/quickFilter/index.d.ts +3 -0
- package/esm/components/quickFilter/index.js +3 -0
- package/esm/components/toolbar/GridToolbar.d.ts +1 -1
- package/esm/components/toolbar/GridToolbar.js +2 -2
- package/esm/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/esm/components/toolbar/GridToolbarQuickFilter.js +59 -97
- package/esm/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/esm/components/toolbarV8/GridToolbar.js +135 -0
- package/esm/components/toolbarV8/Toolbar.d.ts +32 -0
- package/esm/components/toolbarV8/Toolbar.js +125 -0
- package/esm/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/esm/components/toolbarV8/ToolbarButton.js +172 -0
- package/esm/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/esm/components/toolbarV8/ToolbarContext.js +9 -0
- package/esm/components/toolbarV8/index.d.ts +2 -0
- package/esm/components/toolbarV8/index.js +2 -0
- package/esm/components/virtualization/GridVirtualScrollbar.js +10 -2
- 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 -1
- package/esm/constants/gridClasses.d.ts +17 -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/rows/useGridRowsMeta.js +8 -0
- package/esm/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +5 -11
- package/esm/hooks/utils/index.d.ts +2 -1
- package/esm/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/esm/hooks/utils/useGridComponentRenderer.js +36 -0
- 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/demo/TailwindDemoContainer.d.ts +11 -0
- package/esm/internals/demo/TailwindDemoContainer.js +55 -0
- package/esm/internals/demo/index.d.ts +1 -0
- package/esm/internals/demo/index.js +1 -0
- package/esm/internals/index.d.ts +6 -1
- package/esm/internals/index.js +5 -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/icons/index.d.ts +3 -3
- package/esm/material/icons/index.js +6 -6
- package/esm/material/index.d.ts +1 -0
- package/esm/material/index.js +167 -52
- 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 +61 -7
- package/esm/models/gridDataSource.d.ts +9 -4
- package/esm/models/gridIconSlotsComponent.d.ts +1 -1
- 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 -28
- 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/rows/useGridRowsMeta.js +8 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +21 -27
- package/hooks/utils/index.d.ts +2 -1
- package/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/hooks/utils/useGridComponentRenderer.js +44 -0
- package/hooks/utils/useGridSelector.js +6 -2
- package/hooks/utils/useIsSSR.js +6 -2
- package/index.js +1 -1
- package/internals/demo/TailwindDemoContainer.d.ts +11 -0
- package/internals/demo/TailwindDemoContainer.js +63 -0
- package/internals/demo/index.d.ts +1 -0
- package/internals/demo/index.js +12 -0
- package/internals/index.d.ts +6 -1
- package/internals/index.js +43 -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/icons/index.d.ts +3 -3
- package/material/icons/index.js +7 -7
- package/material/index.d.ts +1 -0
- package/material/index.js +172 -51
- 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 +61 -7
- package/models/gridDataSource.d.ts +9 -4
- package/models/gridIconSlotsComponent.d.ts +1 -1
- 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 -28
- 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/gridActionsColDef.js +1 -1
- package/modern/colDef/gridBooleanColDef.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -4
- 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 +61 -62
- package/modern/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/modern/components/columnsPanel/ColumnsPanelTrigger.js +202 -0
- package/modern/components/columnsPanel/index.d.ts +1 -0
- package/modern/components/columnsPanel/index.js +1 -0
- 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/export/ExportCsv.d.ts +30 -0
- package/modern/components/export/ExportCsv.js +189 -0
- package/modern/components/export/ExportPrint.d.ts +30 -0
- package/modern/components/export/ExportPrint.js +189 -0
- package/modern/components/export/index.d.ts +2 -0
- package/modern/components/export/index.js +2 -0
- package/modern/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/modern/components/filterPanel/FilterPanelTrigger.js +205 -0
- package/modern/components/filterPanel/index.d.ts +1 -0
- package/modern/components/filterPanel/index.js +1 -0
- package/modern/components/index.d.ts +6 -1
- package/modern/components/index.js +6 -1
- 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/quickFilter/QuickFilter.d.ts +41 -0
- package/modern/components/quickFilter/QuickFilter.js +103 -0
- package/modern/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterClear.js +154 -0
- package/modern/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/modern/components/quickFilter/QuickFilterContext.js +9 -0
- package/modern/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterControl.js +97 -0
- package/modern/components/quickFilter/index.d.ts +3 -0
- package/modern/components/quickFilter/index.js +3 -0
- package/modern/components/toolbar/GridToolbar.d.ts +1 -1
- package/modern/components/toolbar/GridToolbar.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +59 -97
- package/modern/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/modern/components/toolbarV8/GridToolbar.js +135 -0
- package/modern/components/toolbarV8/Toolbar.d.ts +32 -0
- package/modern/components/toolbarV8/Toolbar.js +125 -0
- package/modern/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/modern/components/toolbarV8/ToolbarButton.js +172 -0
- package/modern/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/modern/components/toolbarV8/ToolbarContext.js +9 -0
- package/modern/components/toolbarV8/index.d.ts +2 -0
- package/modern/components/toolbarV8/index.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollbar.js +10 -2
- 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 -1
- package/modern/constants/gridClasses.d.ts +17 -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/rows/useGridRowsMeta.js +8 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -11
- package/modern/hooks/utils/index.d.ts +2 -1
- package/modern/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/modern/hooks/utils/useGridComponentRenderer.js +36 -0
- 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/demo/TailwindDemoContainer.d.ts +11 -0
- package/modern/internals/demo/TailwindDemoContainer.js +55 -0
- package/modern/internals/demo/index.d.ts +1 -0
- package/modern/internals/demo/index.js +1 -0
- package/modern/internals/index.d.ts +6 -1
- package/modern/internals/index.js +5 -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/icons/index.d.ts +3 -3
- package/modern/material/icons/index.js +6 -6
- package/modern/material/index.d.ts +1 -0
- package/modern/material/index.js +167 -52
- 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 +61 -7
- package/modern/models/gridDataSource.d.ts +9 -4
- package/modern/models/gridIconSlotsComponent.d.ts +1 -1
- 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 -28
- 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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
4
|
import { GridSignature } from "../../../constants/signature.js";
|
|
4
5
|
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
5
6
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
6
7
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
7
8
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
8
9
|
import { gridRowsLookupSelector, gridRowMaximumTreeDepthSelector, gridRowNodeSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
9
|
-
import { gridRowSelectionStateSelector,
|
|
10
|
-
import { gridPaginatedVisibleSortedGridRowIdsSelector } from "../pagination/index.js";
|
|
10
|
+
import { gridRowSelectionManagerSelector, gridRowSelectionStateSelector, gridRowSelectionCountSelector, gridRowSelectionIdsSelector } from "./gridRowSelectionSelector.js";
|
|
11
11
|
import { gridFocusCellSelector } from "../focus/gridFocusStateSelector.js";
|
|
12
|
-
import { gridExpandedSortedRowIdsSelector, gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
|
|
12
|
+
import { gridExpandedSortedRowIdsSelector, gridFilteredRowsLookupSelector, gridFilterModelSelector, gridQuickFilterValuesSelector } from "../filter/gridFilterSelector.js";
|
|
13
13
|
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from "../../../colDef/index.js";
|
|
14
14
|
import { GridCellModes } from "../../../models/gridEditRowModel.js";
|
|
15
15
|
import { isKeyboardEvent, isNavigationKey } from "../../../utils/keyboardUtils.js";
|
|
@@ -18,20 +18,14 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../internals/constants.js"
|
|
|
18
18
|
import { gridClasses } from "../../../constants/gridClasses.js";
|
|
19
19
|
import { isEventTargetInPortal } from "../../../utils/domUtils.js";
|
|
20
20
|
import { isMultipleRowSelectionEnabled, findRowsToSelect, findRowsToDeselect } from "./utils.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return selectionModelProp;
|
|
27
|
-
}
|
|
28
|
-
if (prevSelectionModel && prevSelectionModel[0] === selectionModelProp) {
|
|
29
|
-
return prevSelectionModel;
|
|
30
|
-
}
|
|
31
|
-
return [selectionModelProp];
|
|
21
|
+
import { createRowSelectionManager } from "../../../models/gridRowSelectionManager.js";
|
|
22
|
+
import { gridPaginatedVisibleSortedGridRowIdsSelector } from "../pagination/index.js";
|
|
23
|
+
const emptyModel = {
|
|
24
|
+
type: 'include',
|
|
25
|
+
ids: new Set()
|
|
32
26
|
};
|
|
33
27
|
export const rowSelectionStateInitializer = (state, props) => _extends({}, state, {
|
|
34
|
-
rowSelection: props.rowSelection ?
|
|
28
|
+
rowSelection: props.rowSelection ? props.rowSelectionModel ?? emptyModel : emptyModel
|
|
35
29
|
});
|
|
36
30
|
|
|
37
31
|
/**
|
|
@@ -49,8 +43,8 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
49
43
|
}, [props.rowSelection]);
|
|
50
44
|
const applyAutoSelection = props.signature !== GridSignature.DataGrid && (props.rowSelectionPropagation?.parents || props.rowSelectionPropagation?.descendants);
|
|
51
45
|
const propRowSelectionModel = React.useMemo(() => {
|
|
52
|
-
return
|
|
53
|
-
}, [
|
|
46
|
+
return props.rowSelectionModel;
|
|
47
|
+
}, [props.rowSelectionModel]);
|
|
54
48
|
const lastRowToggled = React.useRef(null);
|
|
55
49
|
apiRef.current.registerControlState({
|
|
56
50
|
stateId: 'rowSelection',
|
|
@@ -90,23 +84,30 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
90
84
|
endId
|
|
91
85
|
}, !isSelected);
|
|
92
86
|
}, [apiRef]);
|
|
87
|
+
const getRowsToBeSelected = useEventCallback(() => {
|
|
88
|
+
const rowsToBeSelected = props.pagination && props.checkboxSelectionVisibleOnly && props.paginationMode === 'client' ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridExpandedSortedRowIdsSelector(apiRef);
|
|
89
|
+
return rowsToBeSelected;
|
|
90
|
+
});
|
|
93
91
|
|
|
94
92
|
/*
|
|
95
93
|
* API METHODS
|
|
96
94
|
*/
|
|
97
95
|
const setRowSelectionModel = React.useCallback(model => {
|
|
98
|
-
if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection &&
|
|
96
|
+
if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection && (model.type !== 'include' || model.ids.size > 1)) {
|
|
99
97
|
throw new Error(['MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
100
98
|
}
|
|
101
99
|
const currentModel = gridRowSelectionStateSelector(apiRef);
|
|
102
100
|
if (currentModel !== model) {
|
|
103
101
|
logger.debug(`Setting selection model`);
|
|
104
102
|
apiRef.current.setState(state => _extends({}, state, {
|
|
105
|
-
rowSelection: props.rowSelection ? model :
|
|
103
|
+
rowSelection: props.rowSelection ? model : emptyModel
|
|
106
104
|
}));
|
|
107
105
|
}
|
|
108
106
|
}, [apiRef, logger, props.rowSelection, props.signature, canHaveMultipleSelection]);
|
|
109
|
-
const isRowSelected = React.useCallback(id =>
|
|
107
|
+
const isRowSelected = React.useCallback(id => {
|
|
108
|
+
const selectionManager = gridRowSelectionManagerSelector(apiRef);
|
|
109
|
+
return selectionManager.has(id);
|
|
110
|
+
}, [apiRef]);
|
|
110
111
|
const isRowSelectable = React.useCallback(id => {
|
|
111
112
|
if (props.rowSelection === false) {
|
|
112
113
|
return false;
|
|
@@ -120,7 +121,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
120
121
|
}
|
|
121
122
|
return true;
|
|
122
123
|
}, [apiRef, props.rowSelection, propIsRowSelectable]);
|
|
123
|
-
const getSelectedRows = React.useCallback(() =>
|
|
124
|
+
const getSelectedRows = React.useCallback(() => gridRowSelectionIdsSelector(apiRef), [apiRef]);
|
|
124
125
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
125
126
|
if (!apiRef.current.isRowSelectable(id)) {
|
|
126
127
|
return;
|
|
@@ -128,9 +129,12 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
128
129
|
lastRowToggled.current = id;
|
|
129
130
|
if (resetSelection) {
|
|
130
131
|
logger.debug(`Setting selection for row ${id}`);
|
|
131
|
-
const
|
|
132
|
+
const newSelectionModel = {
|
|
133
|
+
type: 'include',
|
|
134
|
+
ids: new Set()
|
|
135
|
+
};
|
|
132
136
|
const addRow = rowId => {
|
|
133
|
-
|
|
137
|
+
newSelectionModel.ids.add(rowId);
|
|
134
138
|
};
|
|
135
139
|
if (isSelected) {
|
|
136
140
|
addRow(id);
|
|
@@ -138,17 +142,21 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
138
142
|
findRowsToSelect(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
|
-
apiRef.current.setRowSelectionModel(
|
|
145
|
+
apiRef.current.setRowSelectionModel(newSelectionModel);
|
|
142
146
|
} else {
|
|
143
147
|
logger.debug(`Toggling selection for row ${id}`);
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
148
|
+
const selectionModel = gridRowSelectionStateSelector(apiRef);
|
|
149
|
+
const newSelectionModel = {
|
|
150
|
+
type: selectionModel.type,
|
|
151
|
+
ids: new Set(selectionModel.ids)
|
|
152
|
+
};
|
|
153
|
+
const selectionManager = createRowSelectionManager(newSelectionModel);
|
|
154
|
+
selectionManager.unselect(id);
|
|
147
155
|
const addRow = rowId => {
|
|
148
|
-
|
|
156
|
+
selectionManager.select(rowId);
|
|
149
157
|
};
|
|
150
158
|
const removeRow = rowId => {
|
|
151
|
-
|
|
159
|
+
selectionManager.unselect(rowId);
|
|
152
160
|
};
|
|
153
161
|
if (isSelected) {
|
|
154
162
|
addRow(id);
|
|
@@ -158,45 +166,62 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
158
166
|
} else if (applyAutoSelection) {
|
|
159
167
|
findRowsToDeselect(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
|
|
160
168
|
}
|
|
161
|
-
const isSelectionValid =
|
|
169
|
+
const isSelectionValid = newSelectionModel.type === 'include' && newSelectionModel.ids.size < 2 || canHaveMultipleSelection;
|
|
162
170
|
if (isSelectionValid) {
|
|
163
|
-
apiRef.current.setRowSelectionModel(
|
|
171
|
+
apiRef.current.setRowSelectionModel(newSelectionModel);
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
174
|
}, [apiRef, logger, applyAutoSelection, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, canHaveMultipleSelection]);
|
|
167
175
|
const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {
|
|
168
176
|
logger.debug(`Setting selection for several rows`);
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
if (props.rowSelection === false) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const selectableIds = new Set();
|
|
181
|
+
for (let i = 0; i < ids.length; i += 1) {
|
|
182
|
+
const id = ids[i];
|
|
183
|
+
if (apiRef.current.isRowSelectable(id)) {
|
|
184
|
+
selectableIds.add(id);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const currentSelectionModel = gridRowSelectionStateSelector(apiRef);
|
|
188
|
+
let newSelectionModel;
|
|
171
189
|
if (resetSelection) {
|
|
190
|
+
newSelectionModel = {
|
|
191
|
+
type: 'include',
|
|
192
|
+
ids: selectableIds
|
|
193
|
+
};
|
|
172
194
|
if (isSelected) {
|
|
173
|
-
|
|
195
|
+
const selectionManager = createRowSelectionManager(newSelectionModel);
|
|
174
196
|
if (applyAutoSelection) {
|
|
175
197
|
const addRow = rowId => {
|
|
176
|
-
|
|
198
|
+
selectionManager.select(rowId);
|
|
177
199
|
};
|
|
178
|
-
|
|
200
|
+
for (const id of selectableIds) {
|
|
179
201
|
findRowsToSelect(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
|
|
180
|
-
}
|
|
202
|
+
}
|
|
181
203
|
}
|
|
182
204
|
} else {
|
|
183
|
-
|
|
205
|
+
newSelectionModel.ids = new Set();
|
|
184
206
|
}
|
|
185
|
-
|
|
186
|
-
if (newSelection.size === Object.keys(currentLookup).length && Array.from(newSelection).every(id => currentLookup[id] === id)) {
|
|
207
|
+
if (currentSelectionModel.type === newSelectionModel.type && newSelectionModel.ids.size === currentSelectionModel.ids.size && Array.from(newSelectionModel.ids).every(id => currentSelectionModel.ids.has(id))) {
|
|
187
208
|
return;
|
|
188
209
|
}
|
|
189
210
|
} else {
|
|
190
|
-
|
|
211
|
+
newSelectionModel = {
|
|
212
|
+
type: currentSelectionModel.type,
|
|
213
|
+
ids: new Set(currentSelectionModel.ids)
|
|
214
|
+
};
|
|
215
|
+
const selectionManager = createRowSelectionManager(newSelectionModel);
|
|
191
216
|
const addRow = rowId => {
|
|
192
|
-
|
|
217
|
+
selectionManager.select(rowId);
|
|
193
218
|
};
|
|
194
219
|
const removeRow = rowId => {
|
|
195
|
-
|
|
220
|
+
selectionManager.unselect(rowId);
|
|
196
221
|
};
|
|
197
|
-
|
|
222
|
+
for (const id of selectableIds) {
|
|
198
223
|
if (isSelected) {
|
|
199
|
-
|
|
224
|
+
selectionManager.select(id);
|
|
200
225
|
if (applyAutoSelection) {
|
|
201
226
|
findRowsToSelect(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
|
|
202
227
|
}
|
|
@@ -206,13 +231,13 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
206
231
|
findRowsToDeselect(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
|
|
207
232
|
}
|
|
208
233
|
}
|
|
209
|
-
}
|
|
234
|
+
}
|
|
210
235
|
}
|
|
211
|
-
const isSelectionValid =
|
|
236
|
+
const isSelectionValid = newSelectionModel.type === 'include' && newSelectionModel.ids.size < 2 || canHaveMultipleSelection;
|
|
212
237
|
if (isSelectionValid) {
|
|
213
|
-
apiRef.current.setRowSelectionModel(
|
|
238
|
+
apiRef.current.setRowSelectionModel(newSelectionModel);
|
|
214
239
|
}
|
|
215
|
-
}, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents]);
|
|
240
|
+
}, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, props.rowSelection]);
|
|
216
241
|
const selectRowRange = React.useCallback(({
|
|
217
242
|
startId,
|
|
218
243
|
endId
|
|
@@ -251,57 +276,72 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
251
276
|
const currentSelection = gridRowSelectionStateSelector(apiRef);
|
|
252
277
|
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
253
278
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
254
|
-
|
|
255
|
-
// We clone the existing object to avoid mutating the same object returned by the selector to others part of the project
|
|
256
|
-
const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));
|
|
257
279
|
const isNonExistent = id => {
|
|
258
280
|
if (props.filterMode === 'server') {
|
|
259
281
|
return !rowsLookup[id];
|
|
260
282
|
}
|
|
261
283
|
return !rowsLookup[id] || filteredRowsLookup[id] === false;
|
|
262
284
|
};
|
|
285
|
+
const newSelectionModel = {
|
|
286
|
+
type: currentSelection.type,
|
|
287
|
+
ids: new Set(currentSelection.ids)
|
|
288
|
+
};
|
|
289
|
+
const selectionManager = createRowSelectionManager(newSelectionModel);
|
|
263
290
|
let hasChanged = false;
|
|
264
|
-
|
|
291
|
+
for (const id of currentSelection.ids) {
|
|
265
292
|
if (isNonExistent(id)) {
|
|
266
293
|
if (props.keepNonExistentRowsSelected) {
|
|
267
|
-
|
|
294
|
+
continue;
|
|
268
295
|
}
|
|
269
|
-
|
|
296
|
+
selectionManager.unselect(id);
|
|
270
297
|
hasChanged = true;
|
|
271
|
-
|
|
298
|
+
continue;
|
|
272
299
|
}
|
|
273
300
|
if (!props.rowSelectionPropagation?.parents) {
|
|
274
|
-
|
|
301
|
+
continue;
|
|
275
302
|
}
|
|
276
303
|
const node = tree[id];
|
|
277
|
-
if (node
|
|
304
|
+
if (node?.type === 'group') {
|
|
278
305
|
const isAutoGenerated = node.isAutoGenerated;
|
|
279
306
|
if (isAutoGenerated) {
|
|
280
|
-
|
|
307
|
+
selectionManager.unselect(id);
|
|
281
308
|
hasChanged = true;
|
|
282
|
-
|
|
309
|
+
continue;
|
|
283
310
|
}
|
|
284
311
|
// Keep previously selected tree data parents selected if all their children are filtered out
|
|
285
312
|
if (!node.children.every(childId => filteredRowsLookup[childId] === false)) {
|
|
286
|
-
|
|
313
|
+
selectionManager.unselect(id);
|
|
287
314
|
hasChanged = true;
|
|
288
315
|
}
|
|
289
316
|
}
|
|
290
|
-
}
|
|
317
|
+
}
|
|
291
318
|
|
|
292
319
|
// For nested data, on row tree updation (filtering, adding rows, etc.) when the selection is
|
|
293
320
|
// not empty, we need to re-run scanning of the tree to propagate the selection changes
|
|
294
321
|
// Example: A parent whose de-selected children are filtered out should now be selected
|
|
295
|
-
const shouldReapplyPropagation = isNestedData && props.rowSelectionPropagation?.parents &&
|
|
322
|
+
const shouldReapplyPropagation = isNestedData && props.rowSelectionPropagation?.parents && (newSelectionModel.ids.size > 0 ||
|
|
323
|
+
// In case of exclude selection, newSelectionModel.ids.size === 0 means all rows are selected
|
|
324
|
+
newSelectionModel.type === 'exclude');
|
|
296
325
|
if (hasChanged || shouldReapplyPropagation && !sortModelUpdated) {
|
|
297
|
-
const newSelection = Object.values(selectionLookup);
|
|
298
326
|
if (shouldReapplyPropagation) {
|
|
299
|
-
|
|
327
|
+
if (newSelectionModel.type === 'exclude') {
|
|
328
|
+
const unfilteredSelectedRowIds = getRowsToBeSelected();
|
|
329
|
+
const selectedRowIds = [];
|
|
330
|
+
for (let i = 0; i < unfilteredSelectedRowIds.length; i += 1) {
|
|
331
|
+
const rowId = unfilteredSelectedRowIds[i];
|
|
332
|
+
if ((props.keepNonExistentRowsSelected || !isNonExistent(rowId)) && selectionManager.has(rowId)) {
|
|
333
|
+
selectedRowIds.push(rowId);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
apiRef.current.selectRows(selectedRowIds, true, true);
|
|
337
|
+
} else {
|
|
338
|
+
apiRef.current.selectRows(Array.from(newSelectionModel.ids), true, true);
|
|
339
|
+
}
|
|
300
340
|
} else {
|
|
301
|
-
apiRef.current.setRowSelectionModel(
|
|
341
|
+
apiRef.current.setRowSelectionModel(newSelectionModel);
|
|
302
342
|
}
|
|
303
343
|
}
|
|
304
|
-
}, [apiRef, isNestedData, props.rowSelectionPropagation?.parents, props.keepNonExistentRowsSelected, props.filterMode, tree]);
|
|
344
|
+
}, [apiRef, isNestedData, props.rowSelectionPropagation?.parents, props.keepNonExistentRowsSelected, props.filterMode, tree, getRowsToBeSelected]);
|
|
305
345
|
const handleSingleRowSelection = React.useCallback((id, event) => {
|
|
306
346
|
const hasCtrlKey = event.metaKey || event.ctrlKey;
|
|
307
347
|
|
|
@@ -312,7 +352,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
312
352
|
|
|
313
353
|
const isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);
|
|
314
354
|
const resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;
|
|
315
|
-
const selectedRowsCount = apiRef
|
|
355
|
+
const selectedRowsCount = gridRowSelectionCountSelector(apiRef);
|
|
316
356
|
if (canHaveMultipleSelection && selectedRowsCount > 1 && !hasCtrlKey) {
|
|
317
357
|
apiRef.current.selectRow(id, true, resetSelection);
|
|
318
358
|
} else {
|
|
@@ -361,10 +401,22 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
361
401
|
apiRef.current.selectRow(params.id, params.value, !canHaveMultipleSelection);
|
|
362
402
|
}
|
|
363
403
|
}, [apiRef, expandMouseRowRangeSelection, canHaveMultipleSelection]);
|
|
404
|
+
const toggleAllRows = React.useCallback(value => {
|
|
405
|
+
const filterModel = gridFilterModelSelector(apiRef);
|
|
406
|
+
const quickFilterModel = gridQuickFilterValuesSelector(apiRef);
|
|
407
|
+
const hasFilters = filterModel.items.length > 0 || (quickFilterModel?.length || 0) > 0;
|
|
408
|
+
if (!props.isRowSelectable && !props.checkboxSelectionVisibleOnly && applyAutoSelection && !hasFilters) {
|
|
409
|
+
apiRef.current.setRowSelectionModel({
|
|
410
|
+
type: value ? 'exclude' : 'include',
|
|
411
|
+
ids: new Set()
|
|
412
|
+
});
|
|
413
|
+
} else {
|
|
414
|
+
apiRef.current.selectRows(getRowsToBeSelected(), value);
|
|
415
|
+
}
|
|
416
|
+
}, [apiRef, applyAutoSelection, getRowsToBeSelected, props.checkboxSelectionVisibleOnly, props.isRowSelectable]);
|
|
364
417
|
const handleHeaderSelectionCheckboxChange = React.useCallback(params => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination, props.paginationMode]);
|
|
418
|
+
toggleAllRows(params.value);
|
|
419
|
+
}, [toggleAllRows]);
|
|
368
420
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
369
421
|
// Get the most recent cell mode because it may have been changed by another listener
|
|
370
422
|
if (apiRef.current.getCellMode(params.id, params.field) === GridCellModes.Edit) {
|
|
@@ -413,7 +465,10 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
413
465
|
}
|
|
414
466
|
}
|
|
415
467
|
const visibleRows = getVisibleRows(apiRef);
|
|
416
|
-
const rowsBetweenStartAndEnd =
|
|
468
|
+
const rowsBetweenStartAndEnd = [];
|
|
469
|
+
for (let i = start; i <= end; i += 1) {
|
|
470
|
+
rowsBetweenStartAndEnd.push(visibleRows.rows[i].id);
|
|
471
|
+
}
|
|
417
472
|
apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);
|
|
418
473
|
return;
|
|
419
474
|
}
|
|
@@ -425,9 +480,9 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
425
480
|
}
|
|
426
481
|
if (String.fromCharCode(event.keyCode) === 'A' && (event.ctrlKey || event.metaKey)) {
|
|
427
482
|
event.preventDefault();
|
|
428
|
-
|
|
483
|
+
toggleAllRows(true);
|
|
429
484
|
}
|
|
430
|
-
}, [apiRef,
|
|
485
|
+
}, [apiRef, canHaveMultipleSelection, handleSingleRowSelection, toggleAllRows]);
|
|
431
486
|
useGridApiEventHandler(apiRef, 'sortedRowsSet', runIfRowSelectionIsEnabled(() => removeOutdatedSelection(true)));
|
|
432
487
|
useGridApiEventHandler(apiRef, 'filteredRowsSet', runIfRowSelectionIsEnabled(removeOutdatedSelection));
|
|
433
488
|
useGridApiEventHandler(apiRef, 'rowClick', runIfRowSelectionIsEnabled(handleRowClick));
|
|
@@ -446,7 +501,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
446
501
|
}, [apiRef, propRowSelectionModel, props.rowSelection]);
|
|
447
502
|
React.useEffect(() => {
|
|
448
503
|
if (!props.rowSelection) {
|
|
449
|
-
apiRef.current.setRowSelectionModel(
|
|
504
|
+
apiRef.current.setRowSelectionModel(emptyModel);
|
|
450
505
|
}
|
|
451
506
|
}, [apiRef, props.rowSelection]);
|
|
452
507
|
const isStateControlled = propRowSelectionModel != null;
|
|
@@ -457,10 +512,22 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
457
512
|
|
|
458
513
|
// props.isRowSelectable changed
|
|
459
514
|
const currentSelection = gridRowSelectionStateSelector(apiRef);
|
|
460
|
-
if (isRowSelectable) {
|
|
461
|
-
|
|
462
|
-
if (
|
|
463
|
-
|
|
515
|
+
if (typeof isRowSelectable === 'function') {
|
|
516
|
+
let selectableIds = new Set();
|
|
517
|
+
if (currentSelection.type === 'include') {
|
|
518
|
+
for (const id of currentSelection.ids) {
|
|
519
|
+
if (isRowSelectable(id)) {
|
|
520
|
+
selectableIds.add(id);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
} else {
|
|
524
|
+
selectableIds = new Set(currentSelection.ids);
|
|
525
|
+
}
|
|
526
|
+
if (currentSelection.type === 'include' && selectableIds.size < currentSelection.ids.size) {
|
|
527
|
+
apiRef.current.setRowSelectionModel({
|
|
528
|
+
type: currentSelection.type,
|
|
529
|
+
ids: selectableIds
|
|
530
|
+
});
|
|
464
531
|
}
|
|
465
532
|
}
|
|
466
533
|
}, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
|
|
@@ -469,9 +536,9 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
469
536
|
return;
|
|
470
537
|
}
|
|
471
538
|
const currentSelection = gridRowSelectionStateSelector(apiRef);
|
|
472
|
-
if (!canHaveMultipleSelection && currentSelection.
|
|
539
|
+
if (!canHaveMultipleSelection && (currentSelection.type === 'include' && currentSelection.ids.size > 1 || currentSelection.type === 'exclude')) {
|
|
473
540
|
// See https://github.com/mui/mui-x/issues/8455
|
|
474
|
-
apiRef.current.setRowSelectionModel(
|
|
541
|
+
apiRef.current.setRowSelectionModel(emptyModel);
|
|
475
542
|
}
|
|
476
543
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
|
|
477
544
|
React.useEffect(() => {
|
|
@@ -2,9 +2,9 @@ import { RefObject } from '@mui/x-internals/types';
|
|
|
2
2
|
import type { GridRowId, GridRowTreeConfig } from '../../../models/gridRows';
|
|
3
3
|
import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
4
|
import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
5
|
-
import type
|
|
5
|
+
import { type GridRowSelectionPropagation } from "../../../models/gridRowSelectionModel.js";
|
|
6
6
|
export declare const ROW_SELECTION_PROPAGATION_DEFAULT: GridRowSelectionPropagation;
|
|
7
|
-
export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity,
|
|
7
|
+
export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, import("../../../models/gridRowSelectionManager").RowSelectionManager, {
|
|
8
8
|
isIndeterminate: boolean;
|
|
9
9
|
isChecked: boolean;
|
|
10
10
|
}>;
|
|
@@ -2,7 +2,7 @@ import { GridSignature } from "../../../constants/signature.js";
|
|
|
2
2
|
import { GRID_ROOT_GROUP_ID } from "../rows/gridRowsUtils.js";
|
|
3
3
|
import { gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
|
|
4
4
|
import { gridSortedRowIdsSelector } from "../sorting/gridSortingSelector.js";
|
|
5
|
-
import {
|
|
5
|
+
import { gridRowSelectionManagerSelector } from "./gridRowSelectionSelector.js";
|
|
6
6
|
import { gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
7
7
|
import { createSelector } from "../../../utils/createSelector.js";
|
|
8
8
|
export const ROW_SELECTION_PROPAGATION_DEFAULT = {
|
|
@@ -30,15 +30,15 @@ function getGridRowGroupSelectableDescendants(apiRef, groupId) {
|
|
|
30
30
|
|
|
31
31
|
// TODO v8: Use `createSelectorV8`
|
|
32
32
|
export function getCheckboxPropsSelector(groupId, autoSelectParents) {
|
|
33
|
-
return createSelector(gridRowTreeSelector, gridSortedRowIdsSelector, gridFilteredRowsLookupSelector,
|
|
33
|
+
return createSelector(gridRowTreeSelector, gridSortedRowIdsSelector, gridFilteredRowsLookupSelector, gridRowSelectionManagerSelector, (rowTree, sortedRowIds, filteredRowsLookup, rowSelectionManager) => {
|
|
34
34
|
const groupNode = rowTree[groupId];
|
|
35
35
|
if (!groupNode || groupNode.type !== 'group') {
|
|
36
36
|
return {
|
|
37
37
|
isIndeterminate: false,
|
|
38
|
-
isChecked:
|
|
38
|
+
isChecked: rowSelectionManager.has(groupId)
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
if (
|
|
41
|
+
if (rowSelectionManager.has(groupId)) {
|
|
42
42
|
return {
|
|
43
43
|
isIndeterminate: false,
|
|
44
44
|
isChecked: true
|
|
@@ -51,14 +51,14 @@ export function getCheckboxPropsSelector(groupId, autoSelectParents) {
|
|
|
51
51
|
const id = sortedRowIds[index];
|
|
52
52
|
if (filteredRowsLookup[id] !== false) {
|
|
53
53
|
selectableDescendantsCount += 1;
|
|
54
|
-
if (
|
|
54
|
+
if (rowSelectionManager.has(id)) {
|
|
55
55
|
selectedDescendantsCount += 1;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
|
-
isIndeterminate: selectedDescendantsCount > 0 && (selectedDescendantsCount < selectableDescendantsCount ||
|
|
61
|
-
isChecked: autoSelectParents ? selectedDescendantsCount > 0 :
|
|
60
|
+
isIndeterminate: selectedDescendantsCount > 0 && (selectedDescendantsCount < selectableDescendantsCount || !rowSelectionManager.has(groupId)),
|
|
61
|
+
isChecked: autoSelectParents ? selectedDescendantsCount > 0 : rowSelectionManager.has(groupId)
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -96,7 +96,7 @@ const getFilteredRowNodeSiblings = (tree, filteredRows, id) => {
|
|
|
96
96
|
};
|
|
97
97
|
export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendants, autoSelectParents, addRow) => {
|
|
98
98
|
const filteredRows = gridFilteredRowsLookupSelector(apiRef);
|
|
99
|
-
const
|
|
99
|
+
const rowSelectionManager = gridRowSelectionManagerSelector(apiRef);
|
|
100
100
|
const selectedDescendants = new Set([]);
|
|
101
101
|
if (!autoSelectDescendants && !autoSelectParents) {
|
|
102
102
|
return;
|
|
@@ -113,7 +113,7 @@ export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendant
|
|
|
113
113
|
}
|
|
114
114
|
if (autoSelectParents) {
|
|
115
115
|
const checkAllDescendantsSelected = rowId => {
|
|
116
|
-
if (
|
|
116
|
+
if (!rowSelectionManager.has(rowId) && !selectedDescendants.has(rowId)) {
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
119
|
const node = tree[rowId];
|
|
@@ -138,14 +138,14 @@ export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendant
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
export const findRowsToDeselect = (apiRef, tree, deselectedRow, autoSelectDescendants, autoSelectParents, removeRow) => {
|
|
141
|
-
const
|
|
141
|
+
const rowSelectionManager = gridRowSelectionManagerSelector(apiRef);
|
|
142
142
|
if (!autoSelectParents && !autoSelectDescendants) {
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (autoSelectParents) {
|
|
146
146
|
const allParents = getRowNodeParents(tree, deselectedRow);
|
|
147
147
|
allParents.forEach(parent => {
|
|
148
|
-
const isSelected =
|
|
148
|
+
const isSelected = rowSelectionManager.has(parent);
|
|
149
149
|
if (isSelected) {
|
|
150
150
|
removeRow(parent);
|
|
151
151
|
}
|
|
@@ -61,7 +61,7 @@ export interface GridRowsState {
|
|
|
61
61
|
/**
|
|
62
62
|
* Contains some values of type `GridRowId` that have been requested to be fetched
|
|
63
63
|
* either by `defaultGroupingExpansionDepth` or `isGroupExpandedByDefault` props.
|
|
64
|
-
* Applicable with server-side grouped data and `
|
|
64
|
+
* Applicable with server-side grouped data and `dataSource` only.
|
|
65
65
|
*/
|
|
66
66
|
groupsToFetch?: GridRowId[];
|
|
67
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { GridAutoGeneratedGroupNode, GridAutoGeneratedPinnedRowNode, GridFooterNode, GridGroupNode, GridRowId, GridRowIdGetter, GridRowModel, GridRowModelUpdate, GridRowTreeConfig, GridSkeletonRowNode, GridTreeNode } from "../../../models/index.js";
|
|
2
|
+
import { GridAutoGeneratedGroupNode, GridAutoGeneratedPinnedRowNode, GridColDef, GridFooterNode, GridGroupNode, GridRowId, GridRowIdGetter, GridRowModel, GridRowModelUpdate, GridRowTreeConfig, GridSkeletonRowNode, GridTreeNode, GridValidRowModel } from "../../../models/index.js";
|
|
3
3
|
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
4
4
|
import { GridApiCommunity, GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
5
5
|
import { GridRowsInternalCache, GridRowsState, GridRowTreeCreationParams } from "./gridRowsInterfaces.js";
|
|
@@ -14,6 +14,7 @@ export declare const buildRootGroup: () => GridGroupNode;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): void;
|
|
16
16
|
export declare const getRowIdFromRowModel: (rowModel: GridRowModel, getRowId?: GridRowIdGetter, detailErrorMessage?: string) => GridRowId;
|
|
17
|
+
export declare const getRowValue: (row: GridValidRowModel, colDef: GridColDef, apiRef: RefObject<GridApiCommunity>) => any;
|
|
17
18
|
export declare const createRowsInternalCache: ({
|
|
18
19
|
rows,
|
|
19
20
|
getRowId,
|
|
@@ -31,6 +31,14 @@ export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) =>
|
|
|
31
31
|
checkGridRowIdIsValid(id, rowModel, detailErrorMessage);
|
|
32
32
|
return id;
|
|
33
33
|
};
|
|
34
|
+
export const getRowValue = (row, colDef, apiRef) => {
|
|
35
|
+
const field = colDef.field;
|
|
36
|
+
if (!colDef || !colDef.valueGetter) {
|
|
37
|
+
return row[field];
|
|
38
|
+
}
|
|
39
|
+
const value = row[colDef.field];
|
|
40
|
+
return colDef.valueGetter(value, row, colDef, apiRef);
|
|
41
|
+
};
|
|
34
42
|
export const createRowsInternalCache = ({
|
|
35
43
|
rows,
|
|
36
44
|
getRowId,
|
|
@@ -4,6 +4,7 @@ import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
|
4
4
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from "../focus/gridFocusStateSelector.js";
|
|
5
5
|
import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
|
|
6
6
|
import { gridRowNodeSelector } from "./gridRowsSelector.js";
|
|
7
|
+
import { getRowValue as getRowValueFn } from "./gridRowsUtils.js";
|
|
7
8
|
export class MissingRowIdError extends Error {}
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -88,14 +89,7 @@ export function useGridParamsApi(apiRef, props) {
|
|
|
88
89
|
}
|
|
89
90
|
return colDef.valueGetter(row[colDef.field], row, colDef, apiRef);
|
|
90
91
|
}, [apiRef]);
|
|
91
|
-
const getRowValue = React.useCallback((row, colDef) =>
|
|
92
|
-
const field = colDef.field;
|
|
93
|
-
if (!colDef || !colDef.valueGetter) {
|
|
94
|
-
return row[field];
|
|
95
|
-
}
|
|
96
|
-
const value = row[colDef.field];
|
|
97
|
-
return colDef.valueGetter(value, row, colDef, apiRef);
|
|
98
|
-
}, [apiRef]);
|
|
92
|
+
const getRowValue = React.useCallback((row, colDef) => getRowValueFn(row, colDef, apiRef), [apiRef]);
|
|
99
93
|
const getRowFormattedValue = React.useCallback((row, colDef) => {
|
|
100
94
|
const value = getRowValue(row, colDef);
|
|
101
95
|
if (!colDef || !colDef.valueFormatter) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { selectedIdsLookupSelector } from "../rowSelection/index.js";
|
|
3
2
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
4
3
|
import { gridColumnGroupsHeaderMaxDepthSelector } from "../columnGrouping/gridColumnGroupsSelector.js";
|
|
5
4
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
6
5
|
export const useGridRowAriaAttributes = () => {
|
|
7
6
|
const apiRef = useGridPrivateApiContext();
|
|
8
|
-
const selectedIdsLookup = useGridSelector(apiRef, selectedIdsLookupSelector);
|
|
9
7
|
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
10
8
|
return React.useCallback((rowNode, index) => {
|
|
11
9
|
const ariaAttributes = {};
|
|
12
10
|
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
13
11
|
ariaAttributes['aria-rowindex'] = ariaRowIndex;
|
|
14
12
|
if (apiRef.current.isRowSelectable(rowNode.id)) {
|
|
15
|
-
ariaAttributes['aria-selected'] =
|
|
13
|
+
ariaAttributes['aria-selected'] = apiRef.current.isRowSelected(rowNode.id);
|
|
16
14
|
}
|
|
17
15
|
return ariaAttributes;
|
|
18
|
-
}, [apiRef,
|
|
16
|
+
}, [apiRef, headerGroupingMaxDepth]);
|
|
19
17
|
};
|
|
@@ -2,5 +2,5 @@ import { RefObject } from '@mui/x-internals/types';
|
|
|
2
2
|
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
4
|
import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
|
|
5
|
-
export declare const rowsStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, '
|
|
6
|
-
export declare const useGridRows: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "getRowId" | "rowCount" | "throttleRowsMs" | "signature" | "pagination" | "paginationMode" | "loading" | "
|
|
5
|
+
export declare const rowsStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'dataSource' | 'rows' | 'rowCount' | 'getRowId' | 'loading'>>;
|
|
6
|
+
export declare const useGridRows: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "getRowId" | "rowCount" | "throttleRowsMs" | "signature" | "pagination" | "paginationMode" | "loading" | "dataSource">) => void;
|