@mui/x-data-grid 8.0.0-beta.1 → 8.0.0-beta.3
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 +235 -0
- package/DataGrid/DataGrid.js +10 -2
- package/DataGrid/useDataGridProps.js +1 -1
- package/components/GridRow.js +3 -8
- package/components/GridScrollArea.js +4 -4
- package/components/GridShadowScrollArea.js +43 -35
- package/components/GridSkeletonLoadingOverlay.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +24 -13
- package/components/cell/GridActionsCellItem.js +5 -2
- package/components/cell/GridBooleanCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/columnsManagement/GridColumnsManagement.js +1 -24
- package/components/columnsPanel/ColumnsPanelTrigger.js +4 -129
- package/components/containers/GridToolbarContainer.js +5 -3
- package/components/export/ExportCsv.js +4 -129
- package/components/export/ExportPrint.js +4 -129
- package/components/filterPanel/FilterPanelTrigger.js +4 -129
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/GridPanel.js +1 -1
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/quickFilter/QuickFilter.d.ts +26 -3
- package/components/quickFilter/QuickFilter.js +103 -19
- package/components/quickFilter/QuickFilterClear.js +13 -104
- package/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/components/quickFilter/QuickFilterControl.js +36 -12
- package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/components/quickFilter/QuickFilterTrigger.js +86 -0
- package/components/quickFilter/index.d.ts +2 -1
- package/components/quickFilter/index.js +11 -0
- package/components/toolbar/GridToolbar.js +4 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/components/toolbar/GridToolbarQuickFilter.js +100 -41
- package/components/toolbarV8/GridToolbar.d.ts +6 -1
- package/components/toolbarV8/GridToolbar.js +85 -27
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/toolbarV8/Toolbar.js +78 -23
- package/components/toolbarV8/ToolbarButton.js +37 -114
- package/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/components/virtualization/GridVirtualScrollbar.js +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/constants/cssVariables.d.ts +3 -0
- package/constants/cssVariables.js +2 -1
- package/constants/gridClasses.d.ts +20 -0
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/DataGrid.js +10 -2
- package/esm/DataGrid/useDataGridProps.js +1 -1
- package/esm/components/GridRow.js +4 -9
- package/esm/components/GridScrollArea.js +4 -4
- package/esm/components/GridShadowScrollArea.js +43 -35
- package/esm/components/GridSkeletonLoadingOverlay.js +2 -2
- package/esm/components/cell/GridActionsCellItem.d.ts +24 -13
- package/esm/components/cell/GridActionsCellItem.js +4 -3
- package/esm/components/cell/GridBooleanCell.d.ts +1 -2
- package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/esm/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/esm/components/columnsManagement/GridColumnsManagement.js +1 -24
- package/esm/components/columnsPanel/ColumnsPanelTrigger.js +4 -129
- package/esm/components/containers/GridToolbarContainer.js +5 -3
- package/esm/components/export/ExportCsv.js +4 -129
- package/esm/components/export/ExportPrint.js +4 -129
- package/esm/components/filterPanel/FilterPanelTrigger.js +4 -129
- package/esm/components/panel/GridPanel.d.ts +2 -2
- package/esm/components/panel/GridPanel.js +1 -1
- package/esm/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
- package/esm/components/quickFilter/QuickFilter.js +101 -17
- package/esm/components/quickFilter/QuickFilterClear.js +13 -104
- package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/esm/components/quickFilter/QuickFilterControl.js +36 -12
- package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterTrigger.js +79 -0
- package/esm/components/quickFilter/index.d.ts +2 -1
- package/esm/components/quickFilter/index.js +2 -1
- package/esm/components/toolbar/GridToolbar.js +4 -1
- package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/esm/components/toolbar/GridToolbarQuickFilter.js +101 -44
- package/esm/components/toolbarV8/GridToolbar.d.ts +6 -1
- package/esm/components/toolbarV8/GridToolbar.js +83 -27
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.js +77 -22
- package/esm/components/toolbarV8/ToolbarButton.js +37 -114
- package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/esm/components/virtualization/GridVirtualScrollbar.js +1 -1
- package/esm/components/virtualization/GridVirtualScroller.js +2 -2
- package/esm/constants/cssVariables.d.ts +3 -0
- package/esm/constants/cssVariables.js +2 -1
- package/esm/constants/gridClasses.d.ts +20 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/core/gridCoreSelector.d.ts +1 -1
- package/esm/hooks/core/gridPropsSelectors.d.ts +1 -1
- package/esm/hooks/features/clipboard/useGridClipboard.js +2 -2
- package/esm/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +5 -5
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +4 -4
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/esm/hooks/features/columnMenu/columnMenuSelector.d.ts +1 -1
- package/esm/hooks/features/columnMenu/useGridColumnMenu.js +4 -4
- package/esm/hooks/features/columnResize/columnResizeSelector.d.ts +2 -2
- package/esm/hooks/features/columnResize/useGridColumnResize.js +7 -7
- package/esm/hooks/features/columns/gridColumnsSelector.d.ts +14 -14
- package/esm/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/esm/hooks/features/columns/gridColumnsUtils.js +1 -1
- package/esm/hooks/features/columns/useGridColumnSpanning.js +2 -2
- package/esm/hooks/features/columns/useGridColumns.js +2 -3
- package/esm/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -4
- package/esm/hooks/features/dataSource/useGridDataSource.js +1 -1
- package/esm/hooks/features/density/densitySelector.d.ts +2 -2
- package/esm/hooks/features/dimensions/gridDimensionsSelectors.d.ts +13 -13
- package/esm/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/esm/hooks/features/editing/gridEditingSelectors.d.ts +4 -4
- package/esm/hooks/features/editing/useGridCellEditing.js +8 -8
- package/esm/hooks/features/editing/useGridRowEditing.js +9 -9
- package/esm/hooks/features/events/useGridEvents.js +18 -18
- package/esm/hooks/features/filter/gridFilterSelector.d.ts +18 -18
- package/esm/hooks/features/filter/useGridFilter.js +7 -7
- package/esm/hooks/features/focus/gridFocusStateSelector.d.ts +10 -10
- package/esm/hooks/features/focus/useGridFocus.js +10 -10
- package/esm/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -4
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +6 -6
- package/esm/hooks/features/listView/gridListViewSelectors.d.ts +1 -1
- package/esm/hooks/features/listView/useGridListView.d.ts +4 -4
- package/esm/hooks/features/listView/useGridListView.js +9 -9
- package/esm/hooks/features/pagination/gridPaginationSelector.d.ts +14 -14
- package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -7
- package/esm/hooks/features/pagination/useGridRowCount.js +2 -2
- package/esm/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +2 -2
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +4 -4
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +8 -8
- package/esm/hooks/features/rowSelection/utils.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/esm/hooks/features/rows/gridRowsMetaSelector.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowsSelector.d.ts +21 -20
- package/esm/hooks/features/rows/gridRowsSelector.js +7 -0
- package/esm/hooks/features/rows/useGridParamsApi.js +2 -2
- package/esm/hooks/features/rows/useGridRowSpanning.js +6 -6
- package/esm/hooks/features/rows/useGridRows.js +5 -5
- package/esm/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/esm/hooks/features/scroll/useGridScroll.js +2 -2
- package/esm/hooks/features/sorting/gridSortingSelector.d.ts +5 -5
- package/esm/hooks/features/sorting/useGridSorting.js +6 -6
- package/esm/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +2 -2
- package/esm/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +6 -6
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +19 -8
- package/esm/hooks/utils/index.d.ts +1 -1
- package/esm/hooks/utils/index.js +1 -1
- package/esm/hooks/utils/useGridAriaAttributes.js +6 -0
- package/esm/hooks/utils/{useGridApiEventHandler.d.ts → useGridEvent.d.ts} +2 -2
- package/{modern/hooks/utils/useGridApiEventHandler.js → esm/hooks/utils/useGridEvent.js} +3 -3
- package/esm/hooks/utils/useGridNativeEventListener.js +2 -2
- package/esm/hooks/utils/useGridVisibleRows.d.ts +4 -4
- package/esm/index.js +1 -1
- package/esm/locales/deDE.js +13 -13
- package/esm/material/augmentation.d.ts +74 -0
- package/esm/material/augmentation.js +1 -0
- package/esm/material/index.d.ts +1 -0
- package/esm/material/index.js +262 -141
- package/esm/material/variables.js +2 -0
- package/esm/models/colDef/gridColDef.d.ts +1 -1
- package/esm/models/colDef/index.d.ts +1 -1
- package/esm/models/gridBaseSlots.d.ts +25 -36
- package/esm/models/gridSlotsComponentsProps.d.ts +1 -19
- package/esm/models/props/DataGridProps.d.ts +20 -10
- package/esm/utils/utils.d.ts +0 -27
- package/esm/utils/utils.js +0 -122
- package/hooks/core/gridCoreSelector.d.ts +1 -1
- package/hooks/core/gridPropsSelectors.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +5 -5
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/hooks/features/columnMenu/columnMenuSelector.d.ts +1 -1
- package/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
- package/hooks/features/columnResize/columnResizeSelector.d.ts +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/hooks/features/columns/gridColumnsSelector.d.ts +14 -14
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +2 -2
- package/hooks/features/columns/useGridColumns.js +2 -3
- package/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -4
- package/hooks/features/dataSource/useGridDataSource.js +2 -2
- package/hooks/features/density/densitySelector.d.ts +2 -2
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +13 -13
- package/hooks/features/dimensions/useGridDimensions.js +6 -6
- package/hooks/features/editing/gridEditingSelectors.d.ts +4 -4
- package/hooks/features/editing/useGridCellEditing.js +8 -8
- package/hooks/features/editing/useGridRowEditing.js +9 -9
- package/hooks/features/events/useGridEvents.js +18 -18
- package/hooks/features/filter/gridFilterSelector.d.ts +18 -18
- package/hooks/features/filter/useGridFilter.js +9 -9
- package/hooks/features/focus/gridFocusStateSelector.d.ts +10 -10
- package/hooks/features/focus/useGridFocus.js +10 -10
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -4
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +6 -6
- package/hooks/features/listView/gridListViewSelectors.d.ts +1 -1
- package/hooks/features/listView/useGridListView.d.ts +4 -4
- package/hooks/features/listView/useGridListView.js +9 -9
- package/hooks/features/pagination/gridPaginationSelector.d.ts +14 -14
- package/hooks/features/pagination/useGridPaginationModel.js +7 -7
- package/hooks/features/pagination/useGridRowCount.js +1 -1
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +2 -2
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +4 -4
- package/hooks/features/rowSelection/useGridRowSelection.js +8 -8
- package/hooks/features/rowSelection/utils.d.ts +1 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/hooks/features/rows/gridRowsMetaSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsSelector.d.ts +21 -20
- package/hooks/features/rows/gridRowsSelector.js +8 -1
- package/hooks/features/rows/useGridParamsApi.js +2 -2
- package/hooks/features/rows/useGridRowSpanning.js +6 -6
- package/hooks/features/rows/useGridRows.js +4 -4
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.d.ts +5 -5
- package/hooks/features/sorting/useGridSorting.js +6 -6
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +2 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +6 -6
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +8 -8
- package/hooks/utils/useGridAriaAttributes.js +6 -0
- package/{modern/hooks/utils/useGridApiEventHandler.d.ts → hooks/utils/useGridEvent.d.ts} +2 -2
- package/hooks/utils/{useGridApiEventHandler.js → useGridEvent.js} +5 -5
- package/hooks/utils/useGridNativeEventListener.js +2 -2
- package/hooks/utils/useGridVisibleRows.d.ts +4 -4
- package/index.js +1 -1
- package/locales/deDE.js +13 -13
- package/material/augmentation.d.ts +74 -0
- package/material/augmentation.js +5 -0
- package/material/index.d.ts +1 -0
- package/material/index.js +261 -141
- package/material/variables.js +2 -0
- package/models/colDef/gridColDef.d.ts +1 -1
- package/models/colDef/index.d.ts +1 -1
- package/models/gridBaseSlots.d.ts +25 -36
- package/models/gridSlotsComponentsProps.d.ts +1 -19
- package/models/props/DataGridProps.d.ts +20 -10
- package/modern/DataGrid/DataGrid.js +10 -2
- package/modern/DataGrid/useDataGridProps.js +1 -1
- package/modern/components/GridRow.js +4 -9
- package/modern/components/GridScrollArea.js +4 -4
- package/modern/components/GridShadowScrollArea.js +43 -35
- package/modern/components/GridSkeletonLoadingOverlay.js +2 -2
- package/modern/components/cell/GridActionsCellItem.d.ts +24 -13
- package/modern/components/cell/GridActionsCellItem.js +4 -3
- package/modern/components/cell/GridBooleanCell.d.ts +1 -2
- package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/modern/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/modern/components/columnsManagement/GridColumnsManagement.js +1 -24
- package/modern/components/columnsPanel/ColumnsPanelTrigger.js +4 -129
- package/modern/components/containers/GridToolbarContainer.js +5 -3
- package/modern/components/export/ExportCsv.js +4 -129
- package/modern/components/export/ExportPrint.js +4 -129
- package/modern/components/filterPanel/FilterPanelTrigger.js +4 -129
- package/modern/components/panel/GridPanel.d.ts +2 -2
- package/modern/components/panel/GridPanel.js +1 -1
- package/modern/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
- package/modern/components/quickFilter/QuickFilter.js +101 -17
- package/modern/components/quickFilter/QuickFilterClear.js +13 -104
- package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/modern/components/quickFilter/QuickFilterControl.js +36 -12
- package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterTrigger.js +79 -0
- package/modern/components/quickFilter/index.d.ts +2 -1
- package/modern/components/quickFilter/index.js +2 -1
- package/modern/components/toolbar/GridToolbar.js +4 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/modern/components/toolbar/GridToolbarQuickFilter.js +101 -44
- package/modern/components/toolbarV8/GridToolbar.d.ts +6 -1
- package/modern/components/toolbarV8/GridToolbar.js +83 -27
- package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
- package/modern/components/toolbarV8/Toolbar.js +77 -22
- package/modern/components/toolbarV8/ToolbarButton.js +37 -114
- package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/constants/cssVariables.d.ts +3 -0
- package/modern/constants/cssVariables.js +2 -1
- package/modern/constants/gridClasses.d.ts +20 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/gridCoreSelector.d.ts +1 -1
- package/modern/hooks/core/gridPropsSelectors.d.ts +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +2 -2
- package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +5 -5
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +4 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/modern/hooks/features/columnMenu/columnMenuSelector.d.ts +1 -1
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +4 -4
- package/modern/hooks/features/columnResize/columnResizeSelector.d.ts +2 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +7 -7
- package/modern/hooks/features/columns/gridColumnsSelector.d.ts +14 -14
- package/modern/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +1 -1
- package/modern/hooks/features/columns/useGridColumnSpanning.js +2 -2
- package/modern/hooks/features/columns/useGridColumns.js +2 -3
- package/modern/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -4
- package/modern/hooks/features/dataSource/useGridDataSource.js +1 -1
- package/modern/hooks/features/density/densitySelector.d.ts +2 -2
- package/modern/hooks/features/dimensions/gridDimensionsSelectors.d.ts +13 -13
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/modern/hooks/features/editing/gridEditingSelectors.d.ts +4 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +8 -8
- package/modern/hooks/features/editing/useGridRowEditing.js +9 -9
- package/modern/hooks/features/events/useGridEvents.js +18 -18
- package/modern/hooks/features/filter/gridFilterSelector.d.ts +18 -18
- package/modern/hooks/features/filter/useGridFilter.js +7 -7
- package/modern/hooks/features/focus/gridFocusStateSelector.d.ts +10 -10
- package/modern/hooks/features/focus/useGridFocus.js +10 -10
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -4
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +6 -6
- package/modern/hooks/features/listView/gridListViewSelectors.d.ts +1 -1
- package/modern/hooks/features/listView/useGridListView.d.ts +4 -4
- package/modern/hooks/features/listView/useGridListView.js +9 -9
- package/modern/hooks/features/pagination/gridPaginationSelector.d.ts +14 -14
- package/modern/hooks/features/pagination/useGridPaginationModel.js +7 -7
- package/modern/hooks/features/pagination/useGridRowCount.js +2 -2
- package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +2 -2
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +4 -4
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +8 -8
- package/modern/hooks/features/rowSelection/utils.d.ts +1 -1
- package/modern/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/modern/hooks/features/rows/gridRowsMetaSelector.d.ts +1 -1
- package/modern/hooks/features/rows/gridRowsSelector.d.ts +21 -20
- package/modern/hooks/features/rows/gridRowsSelector.js +7 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +2 -2
- package/modern/hooks/features/rows/useGridRowSpanning.js +6 -6
- package/modern/hooks/features/rows/useGridRows.js +5 -5
- package/modern/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/modern/hooks/features/scroll/useGridScroll.js +2 -2
- package/modern/hooks/features/sorting/gridSortingSelector.d.ts +5 -5
- package/modern/hooks/features/sorting/useGridSorting.js +6 -6
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +2 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +6 -6
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +19 -8
- package/modern/hooks/utils/index.d.ts +1 -1
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridAriaAttributes.js +6 -0
- package/{hooks/utils/useGridApiEventHandler.d.ts → modern/hooks/utils/useGridEvent.d.ts} +2 -2
- package/{esm/hooks/utils/useGridApiEventHandler.js → modern/hooks/utils/useGridEvent.js} +3 -3
- package/modern/hooks/utils/useGridNativeEventListener.js +2 -2
- package/modern/hooks/utils/useGridVisibleRows.d.ts +4 -4
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +13 -13
- package/modern/material/augmentation.d.ts +74 -0
- package/modern/material/augmentation.js +1 -0
- package/modern/material/index.d.ts +1 -0
- package/modern/material/index.js +262 -141
- package/modern/material/variables.js +2 -0
- package/modern/models/colDef/gridColDef.d.ts +1 -1
- package/modern/models/colDef/index.d.ts +1 -1
- package/modern/models/gridBaseSlots.d.ts +25 -36
- package/modern/models/gridSlotsComponentsProps.d.ts +1 -19
- package/modern/models/props/DataGridProps.d.ts +20 -10
- package/modern/utils/utils.d.ts +0 -27
- package/modern/utils/utils.js +0 -122
- package/package.json +6 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/utils.d.ts +0 -27
- package/utils/utils.js +0 -123
|
@@ -47,113 +47,9 @@ process.env.NODE_ENV !== "production" ? ExportPrint.propTypes = {
|
|
|
47
47
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
48
48
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
49
49
|
// ----------------------------------------------------------------------
|
|
50
|
-
/**
|
|
51
|
-
* A ref for imperative actions.
|
|
52
|
-
* It currently only supports `focusVisible()` action.
|
|
53
|
-
*/
|
|
54
|
-
action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
55
|
-
current: PropTypes.shape({
|
|
56
|
-
focusVisible: PropTypes.func.isRequired
|
|
57
|
-
})
|
|
58
|
-
})]),
|
|
59
|
-
/**
|
|
60
|
-
* If `true`, the ripples are centered.
|
|
61
|
-
* They won't start at the cursor interaction position.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
centerRipple: PropTypes.bool,
|
|
65
50
|
className: PropTypes.string,
|
|
66
|
-
/**
|
|
67
|
-
* The color of the component.
|
|
68
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
69
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
70
|
-
* @default 'primary'
|
|
71
|
-
*/
|
|
72
|
-
color: PropTypes.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
|
|
73
|
-
component: PropTypes.elementType,
|
|
74
|
-
/**
|
|
75
|
-
* If `true`, the component is disabled.
|
|
76
|
-
*/
|
|
77
51
|
disabled: PropTypes.bool,
|
|
78
|
-
|
|
79
|
-
* If `true`, no elevation is used.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
disableElevation: PropTypes.bool,
|
|
83
|
-
/**
|
|
84
|
-
* If `true`, the keyboard focus ripple is disabled.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
disableFocusRipple: PropTypes.bool,
|
|
88
|
-
/**
|
|
89
|
-
* If `true`, the ripple effect is disabled.
|
|
90
|
-
*
|
|
91
|
-
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
92
|
-
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
disableRipple: PropTypes.bool,
|
|
96
|
-
/**
|
|
97
|
-
* If `true`, the touch ripple effect is disabled.
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
disableTouchRipple: PropTypes.bool,
|
|
101
|
-
/**
|
|
102
|
-
* Element placed after the children.
|
|
103
|
-
*/
|
|
104
|
-
endIcon: PropTypes.node,
|
|
105
|
-
/**
|
|
106
|
-
* If `true`, the base button will have a keyboard focus ripple.
|
|
107
|
-
* @default false
|
|
108
|
-
*/
|
|
109
|
-
focusRipple: PropTypes.bool,
|
|
110
|
-
/**
|
|
111
|
-
* This prop can help identify which element has keyboard focus.
|
|
112
|
-
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
113
|
-
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
114
|
-
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
115
|
-
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
116
|
-
* if needed.
|
|
117
|
-
*/
|
|
118
|
-
focusVisibleClassName: PropTypes.string,
|
|
119
|
-
/**
|
|
120
|
-
* If `true`, the button will take up the full width of its container.
|
|
121
|
-
* @default false
|
|
122
|
-
*/
|
|
123
|
-
fullWidth: PropTypes.bool,
|
|
124
|
-
/**
|
|
125
|
-
* The URL to link to when the button is clicked.
|
|
126
|
-
* If defined, an `a` element will be used as the root node.
|
|
127
|
-
*/
|
|
128
|
-
href: PropTypes.string,
|
|
129
|
-
/**
|
|
130
|
-
* The component used to render a link when the `href` prop is provided.
|
|
131
|
-
* @default 'a'
|
|
132
|
-
*/
|
|
133
|
-
LinkComponent: PropTypes.elementType,
|
|
134
|
-
/**
|
|
135
|
-
* If `true`, the loading indicator is visible and the button is disabled.
|
|
136
|
-
* If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
|
|
137
|
-
* @default null
|
|
138
|
-
*/
|
|
139
|
-
loading: PropTypes.bool,
|
|
140
|
-
/**
|
|
141
|
-
* Element placed before the children if the button is in loading state.
|
|
142
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
143
|
-
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
144
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
145
|
-
*/
|
|
146
|
-
loadingIndicator: PropTypes.node,
|
|
147
|
-
/**
|
|
148
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
149
|
-
* @default 'center'
|
|
150
|
-
*/
|
|
151
|
-
loadingPosition: PropTypes.oneOf(['center', 'end', 'start']),
|
|
152
|
-
/**
|
|
153
|
-
* Callback fired when the component is focused with a keyboard.
|
|
154
|
-
* We trigger a `onFocus` callback too.
|
|
155
|
-
*/
|
|
156
|
-
onFocusVisible: PropTypes.func,
|
|
52
|
+
id: PropTypes.string,
|
|
157
53
|
/**
|
|
158
54
|
* The options to apply on the Print export.
|
|
159
55
|
* @demos
|
|
@@ -175,33 +71,12 @@ process.env.NODE_ENV !== "production" ? ExportPrint.propTypes = {
|
|
|
175
71
|
* A function to customize rendering of the component.
|
|
176
72
|
*/
|
|
177
73
|
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
178
|
-
|
|
179
|
-
* The size of the component.
|
|
180
|
-
* `small` is equivalent to the dense button styling.
|
|
181
|
-
*/
|
|
74
|
+
role: PropTypes.string,
|
|
182
75
|
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
183
|
-
/**
|
|
184
|
-
* Element placed before the children.
|
|
185
|
-
*/
|
|
186
76
|
startIcon: PropTypes.node,
|
|
187
77
|
style: PropTypes.object,
|
|
188
|
-
/**
|
|
189
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
190
|
-
*/
|
|
191
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
192
78
|
tabIndex: PropTypes.number,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*/
|
|
196
|
-
TouchRippleProps: PropTypes.object,
|
|
197
|
-
/**
|
|
198
|
-
* A ref that points to the `TouchRipple` element.
|
|
199
|
-
*/
|
|
200
|
-
touchRippleRef: PropTypes.any,
|
|
201
|
-
/**
|
|
202
|
-
* The variant to use.
|
|
203
|
-
* @default 'text'
|
|
204
|
-
*/
|
|
205
|
-
variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
|
|
79
|
+
title: PropTypes.string,
|
|
80
|
+
touchRippleRef: PropTypes.any
|
|
206
81
|
} : void 0;
|
|
207
82
|
export { ExportPrint };
|
|
@@ -83,147 +83,22 @@ process.env.NODE_ENV !== "production" ? FilterPanelTrigger.propTypes = {
|
|
|
83
83
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
84
84
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
85
85
|
// ----------------------------------------------------------------------
|
|
86
|
-
/**
|
|
87
|
-
* A ref for imperative actions.
|
|
88
|
-
* It currently only supports `focusVisible()` action.
|
|
89
|
-
*/
|
|
90
|
-
action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
91
|
-
current: PropTypes.shape({
|
|
92
|
-
focusVisible: PropTypes.func.isRequired
|
|
93
|
-
})
|
|
94
|
-
})]),
|
|
95
|
-
/**
|
|
96
|
-
* If `true`, the ripples are centered.
|
|
97
|
-
* They won't start at the cursor interaction position.
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
centerRipple: PropTypes.bool,
|
|
101
86
|
/**
|
|
102
87
|
* A function to customize rendering of the component.
|
|
103
88
|
*/
|
|
104
89
|
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
105
|
-
/**
|
|
106
|
-
* The color of the component.
|
|
107
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
108
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
109
|
-
* @default 'primary'
|
|
110
|
-
*/
|
|
111
|
-
color: PropTypes.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
|
|
112
|
-
component: PropTypes.elementType,
|
|
113
|
-
/**
|
|
114
|
-
* If `true`, the component is disabled.
|
|
115
|
-
*/
|
|
116
90
|
disabled: PropTypes.bool,
|
|
117
|
-
|
|
118
|
-
* If `true`, no elevation is used.
|
|
119
|
-
* @default false
|
|
120
|
-
*/
|
|
121
|
-
disableElevation: PropTypes.bool,
|
|
122
|
-
/**
|
|
123
|
-
* If `true`, the keyboard focus ripple is disabled.
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
disableFocusRipple: PropTypes.bool,
|
|
127
|
-
/**
|
|
128
|
-
* If `true`, the ripple effect is disabled.
|
|
129
|
-
*
|
|
130
|
-
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
131
|
-
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
132
|
-
* @default false
|
|
133
|
-
*/
|
|
134
|
-
disableRipple: PropTypes.bool,
|
|
135
|
-
/**
|
|
136
|
-
* If `true`, the touch ripple effect is disabled.
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
disableTouchRipple: PropTypes.bool,
|
|
140
|
-
/**
|
|
141
|
-
* Element placed after the children.
|
|
142
|
-
*/
|
|
143
|
-
endIcon: PropTypes.node,
|
|
144
|
-
/**
|
|
145
|
-
* If `true`, the base button will have a keyboard focus ripple.
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
focusRipple: PropTypes.bool,
|
|
149
|
-
/**
|
|
150
|
-
* This prop can help identify which element has keyboard focus.
|
|
151
|
-
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
152
|
-
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
153
|
-
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
154
|
-
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
155
|
-
* if needed.
|
|
156
|
-
*/
|
|
157
|
-
focusVisibleClassName: PropTypes.string,
|
|
158
|
-
/**
|
|
159
|
-
* If `true`, the button will take up the full width of its container.
|
|
160
|
-
* @default false
|
|
161
|
-
*/
|
|
162
|
-
fullWidth: PropTypes.bool,
|
|
163
|
-
/**
|
|
164
|
-
* The URL to link to when the button is clicked.
|
|
165
|
-
* If defined, an `a` element will be used as the root node.
|
|
166
|
-
*/
|
|
167
|
-
href: PropTypes.string,
|
|
168
|
-
/**
|
|
169
|
-
* The component used to render a link when the `href` prop is provided.
|
|
170
|
-
* @default 'a'
|
|
171
|
-
*/
|
|
172
|
-
LinkComponent: PropTypes.elementType,
|
|
173
|
-
/**
|
|
174
|
-
* If `true`, the loading indicator is visible and the button is disabled.
|
|
175
|
-
* If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
|
|
176
|
-
* @default null
|
|
177
|
-
*/
|
|
178
|
-
loading: PropTypes.bool,
|
|
179
|
-
/**
|
|
180
|
-
* Element placed before the children if the button is in loading state.
|
|
181
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
182
|
-
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
183
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
184
|
-
*/
|
|
185
|
-
loadingIndicator: PropTypes.node,
|
|
186
|
-
/**
|
|
187
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
188
|
-
* @default 'center'
|
|
189
|
-
*/
|
|
190
|
-
loadingPosition: PropTypes.oneOf(['center', 'end', 'start']),
|
|
191
|
-
/**
|
|
192
|
-
* Callback fired when the component is focused with a keyboard.
|
|
193
|
-
* We trigger a `onFocus` callback too.
|
|
194
|
-
*/
|
|
195
|
-
onFocusVisible: PropTypes.func,
|
|
91
|
+
id: PropTypes.string,
|
|
196
92
|
/**
|
|
197
93
|
* A function to customize rendering of the component.
|
|
198
94
|
*/
|
|
199
95
|
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
200
|
-
|
|
201
|
-
* The size of the component.
|
|
202
|
-
* `small` is equivalent to the dense button styling.
|
|
203
|
-
*/
|
|
96
|
+
role: PropTypes.string,
|
|
204
97
|
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
205
|
-
/**
|
|
206
|
-
* Element placed before the children.
|
|
207
|
-
*/
|
|
208
98
|
startIcon: PropTypes.node,
|
|
209
99
|
style: PropTypes.object,
|
|
210
|
-
/**
|
|
211
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
212
|
-
*/
|
|
213
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
214
100
|
tabIndex: PropTypes.number,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
*/
|
|
218
|
-
TouchRippleProps: PropTypes.object,
|
|
219
|
-
/**
|
|
220
|
-
* A ref that points to the `TouchRipple` element.
|
|
221
|
-
*/
|
|
222
|
-
touchRippleRef: PropTypes.any,
|
|
223
|
-
/**
|
|
224
|
-
* The variant to use.
|
|
225
|
-
* @default 'text'
|
|
226
|
-
*/
|
|
227
|
-
variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
|
|
101
|
+
title: PropTypes.string,
|
|
102
|
+
touchRippleRef: PropTypes.any
|
|
228
103
|
} : void 0;
|
|
229
104
|
export { FilterPanelTrigger };
|
|
@@ -7,7 +7,7 @@ export interface GridPanelClasses {
|
|
|
7
7
|
paper: string;
|
|
8
8
|
}
|
|
9
9
|
export interface GridPanelProps extends Pick<GridSlotProps['basePopper'], 'id' | 'className' | 'target' | 'flip'> {
|
|
10
|
-
ref?: React.Ref<
|
|
10
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* Override or extend the styles applied to the component.
|
|
@@ -16,5 +16,5 @@ export interface GridPanelProps extends Pick<GridSlotProps['basePopper'], 'id' |
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanel: React.ForwardRefExoticComponent<GridPanelProps> | React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<
|
|
19
|
+
declare const GridPanel: React.ForwardRefExoticComponent<GridPanelProps> | React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
20
|
export { GridPanel };
|
|
@@ -68,7 +68,7 @@ const GridPanel = forwardRef((props, ref) => {
|
|
|
68
68
|
return /*#__PURE__*/_jsx(GridPanelRoot, _extends({
|
|
69
69
|
as: rootProps.slots.basePopper,
|
|
70
70
|
ownerState: rootProps,
|
|
71
|
-
placement: "bottom-
|
|
71
|
+
placement: "bottom-end",
|
|
72
72
|
className: clsx(classes.panel, className, variablesClass),
|
|
73
73
|
flip: true,
|
|
74
74
|
onDidShow: onDidShow,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GridColDef, GridSingleSelectColDef } from '../../../models/colDef/gridColDef';
|
|
2
2
|
import type { GridValueOptionsParams } from '../../../models/params/gridValueOptionsParams';
|
|
3
3
|
export declare function isSingleSelectColDef(colDef: GridColDef | null): colDef is GridSingleSelectColDef;
|
|
4
|
-
export declare function getValueOptions(column: GridSingleSelectColDef, additionalParams?: Omit<GridValueOptionsParams, 'field'>): import("
|
|
4
|
+
export declare function getValueOptions(column: GridSingleSelectColDef, additionalParams?: Omit<GridValueOptionsParams, 'field'>): import("@mui/x-data-grid").ValueOptions[] | undefined;
|
|
5
5
|
export declare function getValueFromValueOptions(value: string, valueOptions: any[] | undefined, getOptionValue: NonNullable<GridSingleSelectColDef['getOptionValue']>): any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { QuickFilterState } from "./QuickFilterContext.js";
|
|
3
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
2
4
|
import type { GridFilterModel } from '../../models';
|
|
3
|
-
export type QuickFilterProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
+
export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
|
|
5
6
|
/**
|
|
6
7
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
7
8
|
* @param {string} input The value entered by the user
|
|
@@ -21,10 +22,32 @@ export type QuickFilterProps = {
|
|
|
21
22
|
* @default 150
|
|
22
23
|
*/
|
|
23
24
|
debounceMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The default expanded state of the quick filter control.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
defaultExpanded?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The expanded state of the quick filter control.
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A function to customize rendering of the component.
|
|
36
|
+
*/
|
|
37
|
+
render?: RenderProp<React.ComponentProps<'div'>, QuickFilterState>;
|
|
38
|
+
/**
|
|
39
|
+
* Override or extend the styles applied to the component.
|
|
40
|
+
*/
|
|
41
|
+
className?: string | ((state: QuickFilterState) => string);
|
|
42
|
+
/**
|
|
43
|
+
* Callback function that is called when the quick filter input is expanded or collapsed.
|
|
44
|
+
* @param {boolean} expanded The new expanded state of the quick filter control
|
|
45
|
+
*/
|
|
46
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
24
47
|
};
|
|
25
48
|
/**
|
|
26
49
|
* The top level Quick Filter component that provides context to child components.
|
|
27
|
-
* It
|
|
50
|
+
* It renders a `<div />` element.
|
|
28
51
|
*
|
|
29
52
|
* Demos:
|
|
30
53
|
*
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["render", "className", "parser", "formatter", "debounceMs", "defaultExpanded", "expanded", "onExpandedChange"];
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import PropTypes from 'prop-types';
|
|
3
6
|
import { unstable_debounce as debounce } from '@mui/utils';
|
|
7
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
8
|
+
import useId from '@mui/utils/useId';
|
|
9
|
+
import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
4
10
|
import { QuickFilterContext } from "./QuickFilterContext.js";
|
|
11
|
+
import { useGridComponentRenderer } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
5
12
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
6
13
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
7
14
|
import { gridQuickFilterValuesSelector } from "../../hooks/features/filter/index.js";
|
|
8
15
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
9
|
-
import { isDeepEqual } from "../../utils/utils.js";
|
|
10
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
17
|
const DEFAULT_PARSER = searchText => searchText.split(' ').filter(word => word !== '');
|
|
12
18
|
const DEFAULT_FORMATTER = values => values.join(' ');
|
|
13
19
|
|
|
14
20
|
/**
|
|
15
21
|
* The top level Quick Filter component that provides context to child components.
|
|
16
|
-
* It
|
|
22
|
+
* It renders a `<div />` element.
|
|
17
23
|
*
|
|
18
24
|
* Demos:
|
|
19
25
|
*
|
|
@@ -26,16 +32,38 @@ const DEFAULT_FORMATTER = values => values.join(' ');
|
|
|
26
32
|
function QuickFilter(props) {
|
|
27
33
|
const rootProps = useGridRootProps();
|
|
28
34
|
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
render,
|
|
36
|
+
className,
|
|
37
|
+
parser = DEFAULT_PARSER,
|
|
38
|
+
formatter = DEFAULT_FORMATTER,
|
|
39
|
+
debounceMs = rootProps.filterDebounceMs,
|
|
40
|
+
defaultExpanded,
|
|
41
|
+
expanded,
|
|
42
|
+
onExpandedChange
|
|
43
|
+
} = props,
|
|
44
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
34
45
|
const apiRef = useGridApiContext();
|
|
35
46
|
const controlRef = React.useRef(null);
|
|
36
47
|
const triggerRef = React.useRef(null);
|
|
37
48
|
const quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
|
|
38
49
|
const [value, setValue] = React.useState(formatter(quickFilterValues ?? []));
|
|
50
|
+
const [internalExpanded, setInternalExpanded] = React.useState(defaultExpanded ?? value.length > 0);
|
|
51
|
+
const expandedValue = expanded ?? internalExpanded;
|
|
52
|
+
const state = React.useMemo(() => ({
|
|
53
|
+
value,
|
|
54
|
+
expanded: expandedValue
|
|
55
|
+
}), [value, expandedValue]);
|
|
56
|
+
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
57
|
+
const ref = React.useRef(null);
|
|
58
|
+
const controlId = useId();
|
|
59
|
+
const handleExpandedChange = React.useCallback(newExpanded => {
|
|
60
|
+
if (onExpandedChange) {
|
|
61
|
+
onExpandedChange(newExpanded);
|
|
62
|
+
}
|
|
63
|
+
if (expanded === undefined) {
|
|
64
|
+
setInternalExpanded(newExpanded);
|
|
65
|
+
}
|
|
66
|
+
}, [onExpandedChange, expanded]);
|
|
39
67
|
const prevQuickFilterValuesRef = React.useRef(quickFilterValues);
|
|
40
68
|
React.useEffect(() => {
|
|
41
69
|
if (!isDeepEqual(prevQuickFilterValuesRef.current, quickFilterValues)) {
|
|
@@ -46,6 +74,31 @@ function QuickFilter(props) {
|
|
|
46
74
|
setValue(prevSearchValue => isDeepEqual(parser(prevSearchValue), quickFilterValues) ? prevSearchValue : formatter(quickFilterValues ?? []));
|
|
47
75
|
}
|
|
48
76
|
}, [quickFilterValues, formatter, parser]);
|
|
77
|
+
const isFirstRender = React.useRef(true);
|
|
78
|
+
const previousExpandedValue = React.useRef(expandedValue);
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
if (isFirstRender.current) {
|
|
81
|
+
isFirstRender.current = false;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Ensure the expanded state has actually changed before focusing
|
|
86
|
+
if (previousExpandedValue.current !== expandedValue) {
|
|
87
|
+
if (expandedValue) {
|
|
88
|
+
// Ensures the focus does not interupt CSS transitions and animations on the control
|
|
89
|
+
requestAnimationFrame(() => {
|
|
90
|
+
controlRef.current?.focus({
|
|
91
|
+
preventScroll: true
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
triggerRef.current?.focus({
|
|
96
|
+
preventScroll: true
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
previousExpandedValue.current = expandedValue;
|
|
100
|
+
}
|
|
101
|
+
}, [expandedValue]);
|
|
49
102
|
const setQuickFilterValueDebounced = React.useMemo(() => debounce(newValue => {
|
|
50
103
|
const newQuickFilterValues = parser(newValue);
|
|
51
104
|
prevQuickFilterValuesRef.current = newQuickFilterValues;
|
|
@@ -57,7 +110,7 @@ function QuickFilter(props) {
|
|
|
57
110
|
setValue(newValue);
|
|
58
111
|
setQuickFilterValueDebounced(newValue);
|
|
59
112
|
}, [setQuickFilterValueDebounced]);
|
|
60
|
-
const
|
|
113
|
+
const handleClearValue = React.useCallback(() => {
|
|
61
114
|
setValue('');
|
|
62
115
|
apiRef.current.setQuickFilterValues([]);
|
|
63
116
|
controlRef.current?.focus();
|
|
@@ -65,15 +118,25 @@ function QuickFilter(props) {
|
|
|
65
118
|
const contextValue = React.useMemo(() => ({
|
|
66
119
|
controlRef,
|
|
67
120
|
triggerRef,
|
|
68
|
-
state
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}), [
|
|
121
|
+
state,
|
|
122
|
+
controlId,
|
|
123
|
+
clearValue: handleClearValue,
|
|
124
|
+
onValueChange: handleValueChange,
|
|
125
|
+
onExpandedChange: handleExpandedChange
|
|
126
|
+
}), [controlId, state, handleValueChange, handleClearValue, handleExpandedChange]);
|
|
127
|
+
useEnhancedEffect(() => {
|
|
128
|
+
if (ref.current && triggerRef.current) {
|
|
129
|
+
ref.current.style.setProperty('--trigger-width', `${triggerRef.current?.offsetWidth}px`);
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
const element = useGridComponentRenderer('div', render, _extends({
|
|
133
|
+
className: resolvedClassName
|
|
134
|
+
}, other, {
|
|
135
|
+
ref
|
|
136
|
+
}), state);
|
|
74
137
|
return /*#__PURE__*/_jsx(QuickFilterContext.Provider, {
|
|
75
138
|
value: contextValue,
|
|
76
|
-
children:
|
|
139
|
+
children: element
|
|
77
140
|
});
|
|
78
141
|
}
|
|
79
142
|
process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
|
|
@@ -81,12 +144,24 @@ process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
|
|
|
81
144
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
82
145
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
83
146
|
// ----------------------------------------------------------------------
|
|
84
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Override or extend the styles applied to the component.
|
|
149
|
+
*/
|
|
150
|
+
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
85
151
|
/**
|
|
86
152
|
* The debounce time in milliseconds.
|
|
87
153
|
* @default 150
|
|
88
154
|
*/
|
|
89
155
|
debounceMs: PropTypes.number,
|
|
156
|
+
/**
|
|
157
|
+
* The default expanded state of the quick filter control.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
defaultExpanded: PropTypes.bool,
|
|
161
|
+
/**
|
|
162
|
+
* The expanded state of the quick filter control.
|
|
163
|
+
*/
|
|
164
|
+
expanded: PropTypes.bool,
|
|
90
165
|
/**
|
|
91
166
|
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
92
167
|
* @param {any[]} values The new values passed to the quick filter model
|
|
@@ -94,12 +169,21 @@ process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
|
|
|
94
169
|
* @default (values: string[]) => values.join(' ')
|
|
95
170
|
*/
|
|
96
171
|
formatter: PropTypes.func,
|
|
172
|
+
/**
|
|
173
|
+
* Callback function that is called when the quick filter input is expanded or collapsed.
|
|
174
|
+
* @param {boolean} expanded The new expanded state of the quick filter control
|
|
175
|
+
*/
|
|
176
|
+
onExpandedChange: PropTypes.func,
|
|
97
177
|
/**
|
|
98
178
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
99
179
|
* @param {string} input The value entered by the user
|
|
100
180
|
* @returns {any[]} The array of value on which quick filter is applied
|
|
101
181
|
* @default (searchText: string) => searchText.split(' ').filter((word) => word !== '')
|
|
102
182
|
*/
|
|
103
|
-
parser: PropTypes.func
|
|
183
|
+
parser: PropTypes.func,
|
|
184
|
+
/**
|
|
185
|
+
* A function to customize rendering of the component.
|
|
186
|
+
*/
|
|
187
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
104
188
|
} : void 0;
|
|
105
189
|
export { QuickFilter };
|