@mui/x-data-grid 8.0.0-alpha.12 → 8.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +299 -0
- package/DataGrid/DataGrid.js +31 -22
- package/DataGrid/useDataGridProps.js +1 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/components/GridFooter.js +1 -1
- package/components/GridHeader.js +1 -1
- package/components/GridPagination.js +5 -6
- package/components/GridRowCount.js +4 -5
- package/components/GridScrollArea.js +4 -3
- package/components/GridSelectedRowCount.js +5 -6
- package/components/GridShadowScrollArea.d.ts +8 -0
- package/components/GridShadowScrollArea.js +82 -0
- package/components/cell/GridEditInputCell.js +2 -3
- package/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/components/columnsManagement/GridColumnsManagement.js +59 -61
- package/components/containers/GridOverlay.js +6 -8
- package/components/containers/GridRoot.js +4 -2
- package/components/containers/GridRootStyles.d.ts +1 -2
- package/components/containers/GridRootStyles.js +77 -100
- package/components/containers/GridToolbarContainer.js +5 -6
- package/components/menu/GridMenu.js +7 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -3
- package/components/panel/GridPanel.js +18 -20
- package/components/panel/GridPanelContent.js +6 -8
- package/components/panel/GridPanelFooter.js +5 -6
- package/components/panel/GridPanelHeader.js +4 -5
- package/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +20 -45
- package/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/components/virtualization/GridVirtualScrollbar.js +8 -5
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/constants/cssVariables.d.ts +294 -0
- package/constants/cssVariables.js +168 -0
- package/constants/dataGridPropsDefaultValues.js +1 -0
- package/constants/defaultGridSlotsComponents.js +1 -1
- package/constants/gridClasses.d.ts +13 -0
- package/constants/gridClasses.js +1 -1
- package/context/GridContextProvider.js +4 -1
- package/esm/DataGrid/DataGrid.js +31 -22
- package/esm/DataGrid/useDataGridProps.js +1 -1
- package/esm/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/esm/components/GridFooter.js +2 -2
- package/esm/components/GridHeader.js +1 -1
- package/esm/components/GridPagination.js +5 -6
- package/esm/components/GridRowCount.js +4 -5
- package/esm/components/GridScrollArea.js +2 -1
- package/esm/components/GridSelectedRowCount.js +5 -6
- package/esm/components/GridShadowScrollArea.d.ts +8 -0
- package/esm/components/GridShadowScrollArea.js +74 -0
- package/esm/components/cell/GridEditInputCell.js +2 -3
- package/esm/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/esm/components/columnsManagement/GridColumnsManagement.js +60 -62
- package/esm/components/containers/GridOverlay.js +6 -8
- package/esm/components/containers/GridRoot.js +4 -2
- package/esm/components/containers/GridRootStyles.d.ts +1 -2
- package/esm/components/containers/GridRootStyles.js +78 -101
- package/esm/components/containers/GridToolbarContainer.js +5 -6
- package/esm/components/menu/GridMenu.js +7 -6
- package/esm/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
- package/esm/components/panel/GridPanel.js +18 -20
- package/esm/components/panel/GridPanelContent.js +6 -8
- package/esm/components/panel/GridPanelFooter.js +5 -6
- package/esm/components/panel/GridPanelHeader.js +4 -5
- package/esm/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
- package/esm/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/esm/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/esm/components/virtualization/GridVirtualScrollbar.js +3 -1
- package/esm/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/esm/constants/cssVariables.d.ts +294 -0
- package/esm/constants/cssVariables.js +161 -0
- package/esm/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/constants/defaultGridSlotsComponents.js +2 -2
- package/esm/constants/gridClasses.d.ts +13 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/context/GridContextProvider.js +4 -1
- package/esm/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/esm/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/esm/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/esm/hooks/features/columns/gridColumnsSelector.js +8 -0
- package/esm/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/esm/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/esm/hooks/features/columns/index.d.ts +1 -1
- package/esm/hooks/features/columns/index.js +1 -1
- package/esm/hooks/features/columns/useGridColumns.js +4 -2
- package/esm/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/esm/hooks/features/dataSource/gridDataSourceError.js +32 -0
- package/esm/hooks/features/dataSource/index.d.ts +2 -0
- package/esm/hooks/features/dataSource/index.js +2 -0
- package/esm/hooks/features/dataSource/models.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/esm/hooks/features/dimensions/useGridDimensions.js +11 -10
- package/esm/hooks/features/editing/useGridCellEditing.js +2 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +2 -1
- package/esm/hooks/features/export/utils.js +4 -2
- package/esm/hooks/features/focus/useGridFocus.js +3 -2
- package/esm/hooks/features/index.d.ts +1 -1
- package/esm/hooks/features/index.js +1 -1
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +148 -81
- package/esm/hooks/features/rowSelection/utils.d.ts +2 -2
- package/esm/hooks/features/rowSelection/utils.js +11 -11
- package/esm/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/esm/hooks/features/rows/gridRowsUtils.js +8 -0
- package/esm/hooks/features/rows/useGridParamsApi.js +2 -8
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/esm/hooks/features/rows/useGridRows.d.ts +2 -2
- package/esm/hooks/features/rows/useGridRows.js +7 -7
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
- package/esm/hooks/utils/useGridSelector.js +4 -1
- package/esm/hooks/utils/useIsSSR.js +4 -1
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/utils/propValidation.js +1 -1
- package/esm/locales/bnBD.d.ts +2 -0
- package/esm/locales/bnBD.js +167 -0
- package/esm/locales/deDE.js +3 -5
- package/esm/locales/huHU.js +10 -13
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/locales/ruRU.js +17 -21
- package/esm/material/index.d.ts +1 -0
- package/esm/material/index.js +164 -49
- package/esm/material/variables.d.ts +5 -0
- package/esm/material/variables.js +89 -0
- package/esm/models/api/gridRowSelectionApi.d.ts +4 -2
- package/esm/models/api/gridSortApi.d.ts +1 -1
- package/esm/models/configuration/gridConfiguration.d.ts +7 -1
- package/esm/models/gridBaseSlots.d.ts +56 -6
- package/esm/models/gridDataSource.d.ts +9 -4
- package/esm/models/gridRowSelectionManager.d.ts +9 -0
- package/esm/models/gridRowSelectionManager.js +36 -0
- package/esm/models/gridRowSelectionModel.d.ts +4 -2
- package/esm/models/gridSlotsComponent.d.ts +7 -27
- package/esm/models/gridSlotsComponentsProps.d.ts +3 -11
- package/esm/models/gridSortModel.d.ts +1 -1
- package/esm/models/index.d.ts +2 -1
- package/esm/models/index.js +2 -3
- package/esm/models/props/DataGridProps.d.ts +22 -17
- package/esm/utils/css/context.d.ts +14 -0
- package/esm/utils/css/context.js +54 -0
- package/esm/utils/index.d.ts +2 -1
- package/esm/utils/index.js +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +28 -27
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/hooks/features/columns/gridColumnsSelector.js +9 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/hooks/features/columns/index.d.ts +1 -1
- package/hooks/features/columns/index.js +94 -10
- package/hooks/features/columns/useGridColumns.js +4 -2
- package/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/hooks/features/dataSource/gridDataSourceError.js +40 -0
- package/hooks/features/dataSource/index.d.ts +2 -0
- package/hooks/features/dataSource/index.js +25 -0
- package/hooks/features/dataSource/models.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/hooks/features/dimensions/useGridDimensions.js +19 -18
- package/hooks/features/editing/useGridCellEditing.js +10 -9
- package/hooks/features/editing/useGridRowEditing.js +11 -10
- package/hooks/features/export/utils.js +4 -2
- package/hooks/features/focus/useGridFocus.js +8 -7
- package/hooks/features/index.d.ts +1 -1
- package/hooks/features/index.js +11 -28
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/hooks/features/rowSelection/useGridRowSelection.js +146 -79
- package/hooks/features/rowSelection/utils.d.ts +2 -2
- package/hooks/features/rowSelection/utils.js +10 -10
- package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/hooks/features/rows/gridRowsUtils.js +10 -1
- package/hooks/features/rows/useGridParamsApi.js +2 -8
- package/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +7 -7
- package/hooks/features/virtualization/useGridVirtualScroller.js +21 -25
- package/hooks/utils/useGridSelector.js +6 -2
- package/hooks/utils/useIsSSR.js +6 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +15 -0
- package/internals/utils/propValidation.js +1 -1
- package/locales/bnBD.d.ts +2 -0
- package/locales/bnBD.js +173 -0
- package/locales/deDE.js +3 -5
- package/locales/huHU.js +10 -13
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/locales/ruRU.js +17 -21
- package/material/index.d.ts +1 -0
- package/material/index.js +170 -49
- package/material/variables.d.ts +5 -0
- package/material/variables.js +95 -0
- package/models/api/gridRowSelectionApi.d.ts +4 -2
- package/models/api/gridSortApi.d.ts +1 -1
- package/models/configuration/gridConfiguration.d.ts +7 -1
- package/models/gridBaseSlots.d.ts +56 -6
- package/models/gridDataSource.d.ts +9 -4
- package/models/gridRowSelectionManager.d.ts +9 -0
- package/models/gridRowSelectionManager.js +43 -0
- package/models/gridRowSelectionModel.d.ts +4 -2
- package/models/gridSlotsComponent.d.ts +7 -27
- package/models/gridSlotsComponentsProps.d.ts +3 -11
- package/models/gridSortModel.d.ts +1 -1
- package/models/index.d.ts +2 -1
- package/models/index.js +34 -11
- package/models/props/DataGridProps.d.ts +22 -17
- package/modern/DataGrid/DataGrid.js +31 -22
- package/modern/DataGrid/useDataGridProps.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -3
- package/modern/components/GridFooter.js +2 -2
- package/modern/components/GridHeader.js +1 -1
- package/modern/components/GridPagination.js +5 -6
- package/modern/components/GridRowCount.js +4 -5
- package/modern/components/GridScrollArea.js +2 -1
- package/modern/components/GridSelectedRowCount.js +5 -6
- package/modern/components/GridShadowScrollArea.d.ts +8 -0
- package/modern/components/GridShadowScrollArea.js +74 -0
- package/modern/components/cell/GridEditInputCell.js +2 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +51 -17
- package/modern/components/columnsManagement/GridColumnsManagement.js +60 -62
- package/modern/components/containers/GridOverlay.js +6 -8
- package/modern/components/containers/GridRoot.js +4 -2
- package/modern/components/containers/GridRootStyles.d.ts +1 -2
- package/modern/components/containers/GridRootStyles.js +78 -101
- package/modern/components/containers/GridToolbarContainer.js +5 -6
- package/modern/components/menu/GridMenu.js +7 -6
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
- package/modern/components/panel/GridPanel.js +18 -20
- package/modern/components/panel/GridPanelContent.js +6 -8
- package/modern/components/panel/GridPanelFooter.js +5 -6
- package/modern/components/panel/GridPanelHeader.js +4 -5
- package/modern/components/panel/filterPanel/GridFilterForm.js +13 -20
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +3 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +5 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +23 -30
- package/modern/components/virtualization/GridVirtualScrollbar.js +3 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/cssVariables.d.ts +294 -0
- package/modern/constants/cssVariables.js +161 -0
- package/modern/constants/dataGridPropsDefaultValues.js +1 -0
- package/modern/constants/defaultGridSlotsComponents.js +2 -2
- package/modern/constants/gridClasses.d.ts +13 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/context/GridContextProvider.js +4 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
- package/modern/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
- package/modern/hooks/features/columns/gridColumnsSelector.js +8 -0
- package/modern/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +6 -3
- package/modern/hooks/features/columns/index.d.ts +1 -1
- package/modern/hooks/features/columns/index.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +4 -2
- package/modern/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
- package/modern/hooks/features/dataSource/gridDataSourceError.js +32 -0
- package/modern/hooks/features/dataSource/index.d.ts +2 -0
- package/modern/hooks/features/dataSource/index.js +2 -0
- package/modern/hooks/features/dataSource/models.d.ts +1 -1
- package/modern/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/modern/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
- package/modern/hooks/features/dimensions/useGridDimensions.js +11 -10
- package/modern/hooks/features/editing/useGridCellEditing.js +2 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -1
- package/modern/hooks/features/export/utils.js +4 -2
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/index.d.ts +1 -1
- package/modern/hooks/features/index.js +1 -1
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +148 -81
- package/modern/hooks/features/rowSelection/utils.d.ts +2 -2
- package/modern/hooks/features/rowSelection/utils.js +11 -11
- package/modern/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +8 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +2 -8
- package/modern/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
- package/modern/hooks/features/rows/useGridRows.d.ts +2 -2
- package/modern/hooks/features/rows/useGridRows.js +7 -7
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
- package/modern/hooks/utils/useGridSelector.js +4 -1
- package/modern/hooks/utils/useIsSSR.js +4 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.d.ts +2 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/locales/bnBD.d.ts +2 -0
- package/modern/locales/bnBD.js +167 -0
- package/modern/locales/deDE.js +3 -5
- package/modern/locales/huHU.js +10 -13
- package/modern/locales/index.d.ts +1 -0
- package/modern/locales/index.js +1 -0
- package/modern/locales/ruRU.js +17 -21
- package/modern/material/index.d.ts +1 -0
- package/modern/material/index.js +164 -49
- package/modern/material/variables.d.ts +5 -0
- package/modern/material/variables.js +89 -0
- package/modern/models/api/gridRowSelectionApi.d.ts +4 -2
- package/modern/models/api/gridSortApi.d.ts +1 -1
- package/modern/models/configuration/gridConfiguration.d.ts +7 -1
- package/modern/models/gridBaseSlots.d.ts +56 -6
- package/modern/models/gridDataSource.d.ts +9 -4
- package/modern/models/gridRowSelectionManager.d.ts +9 -0
- package/modern/models/gridRowSelectionManager.js +36 -0
- package/modern/models/gridRowSelectionModel.d.ts +4 -2
- package/modern/models/gridSlotsComponent.d.ts +7 -27
- package/modern/models/gridSlotsComponentsProps.d.ts +3 -11
- package/modern/models/gridSortModel.d.ts +1 -1
- package/modern/models/index.d.ts +2 -1
- package/modern/models/index.js +2 -3
- package/modern/models/props/DataGridProps.d.ts +22 -17
- package/modern/utils/css/context.d.ts +14 -0
- package/modern/utils/css/context.js +54 -0
- package/modern/utils/index.d.ts +2 -1
- package/modern/utils/index.js +1 -1
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/css/context.d.ts +14 -0
- package/utils/css/context.js +64 -0
- package/utils/index.d.ts +2 -1
- package/utils/index.js +8 -1
package/esm/material/index.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["id", "label", "labelId", "disabled", "slotProps", "onChange", "onKeyDown", "onOpen", "onClose", "size", "style", "fullWidth"],
|
|
4
|
-
_excluded2 = ["autoFocus", "label", "fullWidth", "slotProps", "className"
|
|
4
|
+
_excluded2 = ["autoFocus", "label", "fullWidth", "slotProps", "className"],
|
|
5
5
|
_excluded3 = ["inert", "iconStart", "iconEnd", "children"],
|
|
6
6
|
_excluded4 = ["slotProps"],
|
|
7
|
-
_excluded5 = ["slotProps"],
|
|
8
|
-
_excluded6 = ["
|
|
7
|
+
_excluded5 = ["id", "multiple", "freeSolo", "options", "getOptionLabel", "isOptionEqualToValue", "value", "onChange", "label", "placeholder", "slotProps"],
|
|
8
|
+
_excluded6 = ["key"],
|
|
9
|
+
_excluded7 = ["inputProps", "InputProps", "InputLabelProps"],
|
|
10
|
+
_excluded8 = ["slotProps"],
|
|
11
|
+
_excluded9 = ["native"];
|
|
9
12
|
import * as React from 'react';
|
|
10
13
|
import useForkRef from '@mui/utils/useForkRef';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import MUIAutocomplete from '@mui/material/Autocomplete';
|
|
11
16
|
import MUIBadge from '@mui/material/Badge';
|
|
12
17
|
import MUICheckbox from '@mui/material/Checkbox';
|
|
13
18
|
import MUIChip from '@mui/material/Chip';
|
|
@@ -22,12 +27,12 @@ import MUIMenuList from '@mui/material/MenuList';
|
|
|
22
27
|
import MUIMenuItem from '@mui/material/MenuItem';
|
|
23
28
|
import MUITextField from '@mui/material/TextField';
|
|
24
29
|
import MUIFormControl from '@mui/material/FormControl';
|
|
25
|
-
import MUIFormControlLabel from '@mui/material/FormControlLabel';
|
|
30
|
+
import MUIFormControlLabel, { formControlLabelClasses } from '@mui/material/FormControlLabel';
|
|
26
31
|
import MUISelect from '@mui/material/Select';
|
|
27
32
|
import MUISwitch from '@mui/material/Switch';
|
|
28
33
|
import MUIButton from '@mui/material/Button';
|
|
29
|
-
import MUIIconButton from '@mui/material/IconButton';
|
|
30
|
-
import MUIInputAdornment from '@mui/material/InputAdornment';
|
|
34
|
+
import MUIIconButton, { iconButtonClasses } from '@mui/material/IconButton';
|
|
35
|
+
import MUIInputAdornment, { inputAdornmentClasses } from '@mui/material/InputAdornment';
|
|
31
36
|
import MUITooltip from '@mui/material/Tooltip';
|
|
32
37
|
import MUIPopper from '@mui/material/Popper';
|
|
33
38
|
import MUIClickAwayListener from '@mui/material/ClickAwayListener';
|
|
@@ -40,9 +45,47 @@ import { GridColumnUnsortedIcon } from "./icons/GridColumnUnsortedIcon.js";
|
|
|
40
45
|
import { GridAddIcon, GridArrowDownwardIcon, GridArrowUpwardIcon, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridDragIcon, GridExpandMoreIcon, GridFilterAltIcon, GridFilterListIcon, GridKeyboardArrowRight, GridMoreVertIcon, GridRemoveIcon, GridSaveAltIcon, GridSearchIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon, GridLoadIcon, GridDeleteForeverIcon } from "./icons/index.js";
|
|
41
46
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
42
47
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
48
|
+
export { useMaterialCSSVariables } from "./variables.js";
|
|
43
49
|
const ClickAwayListener = forwardRef(MUIClickAwayListener);
|
|
50
|
+
const InputAdornment = styled(MUIInputAdornment)({
|
|
51
|
+
[`&.${inputAdornmentClasses.positionEnd} .${iconButtonClasses.sizeSmall}`]: {
|
|
52
|
+
marginRight: '-7px'
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const FormControlLabel = styled(MUIFormControlLabel, {
|
|
56
|
+
shouldForwardProp: prop => prop !== 'fullWidth'
|
|
57
|
+
})(({
|
|
58
|
+
theme
|
|
59
|
+
}) => ({
|
|
60
|
+
gap: theme.spacing(0.5),
|
|
61
|
+
margin: 0,
|
|
62
|
+
[`& .${formControlLabelClasses.label}`]: {
|
|
63
|
+
fontSize: theme.typography.pxToRem(14)
|
|
64
|
+
},
|
|
65
|
+
variants: [{
|
|
66
|
+
props: {
|
|
67
|
+
fullWidth: true
|
|
68
|
+
},
|
|
69
|
+
style: {
|
|
70
|
+
width: '100%'
|
|
71
|
+
}
|
|
72
|
+
}]
|
|
73
|
+
}));
|
|
74
|
+
const Checkbox = styled(MUICheckbox, {
|
|
75
|
+
shouldForwardProp: prop => prop !== 'density'
|
|
76
|
+
})(({
|
|
77
|
+
theme
|
|
78
|
+
}) => ({
|
|
79
|
+
variants: [{
|
|
80
|
+
props: {
|
|
81
|
+
density: 'compact'
|
|
82
|
+
},
|
|
83
|
+
style: {
|
|
84
|
+
padding: theme.spacing(0.5)
|
|
85
|
+
}
|
|
86
|
+
}]
|
|
87
|
+
}));
|
|
44
88
|
const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
45
|
-
const rootProps = useGridRootProps();
|
|
46
89
|
const {
|
|
47
90
|
id,
|
|
48
91
|
label,
|
|
@@ -58,21 +101,27 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
58
101
|
fullWidth
|
|
59
102
|
} = props,
|
|
60
103
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
61
|
-
|
|
104
|
+
const menuProps = {
|
|
105
|
+
PaperProps: {
|
|
106
|
+
onKeyDown
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (onClose) {
|
|
110
|
+
menuProps.onClose = onClose;
|
|
111
|
+
}
|
|
112
|
+
return /*#__PURE__*/_jsxs(MUIFormControl, {
|
|
62
113
|
size: size,
|
|
63
114
|
fullWidth: fullWidth,
|
|
64
115
|
style: style,
|
|
65
|
-
disabled: disabled
|
|
66
|
-
}, rootProps.slotProps?.baseFormControl, {
|
|
116
|
+
disabled: disabled,
|
|
67
117
|
ref: ref,
|
|
68
|
-
children: [/*#__PURE__*/_jsx(MUIInputLabel,
|
|
118
|
+
children: [/*#__PURE__*/_jsx(MUIInputLabel, {
|
|
69
119
|
id: labelId,
|
|
70
120
|
htmlFor: id,
|
|
71
121
|
shrink: true,
|
|
72
|
-
variant: "outlined"
|
|
73
|
-
}, rootProps.slotProps?.baseInputLabel, {
|
|
122
|
+
variant: "outlined",
|
|
74
123
|
children: label
|
|
75
|
-
})
|
|
124
|
+
}), /*#__PURE__*/_jsx(MUISelect, _extends({
|
|
76
125
|
id: id,
|
|
77
126
|
labelId: labelId,
|
|
78
127
|
label: label,
|
|
@@ -83,15 +132,10 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
83
132
|
notched: true,
|
|
84
133
|
inputProps: slotProps?.htmlInput,
|
|
85
134
|
onOpen: onOpen,
|
|
86
|
-
MenuProps:
|
|
87
|
-
onClose,
|
|
88
|
-
PaperProps: {
|
|
89
|
-
onKeyDown
|
|
90
|
-
}
|
|
91
|
-
},
|
|
135
|
+
MenuProps: menuProps,
|
|
92
136
|
size: size
|
|
93
137
|
}))]
|
|
94
|
-
})
|
|
138
|
+
});
|
|
95
139
|
});
|
|
96
140
|
|
|
97
141
|
/* eslint-disable material-ui/disallow-react-api-in-server-components */
|
|
@@ -135,6 +179,7 @@ const iconSlots = {
|
|
|
135
179
|
menuItemCheckIcon: GridCheckIcon
|
|
136
180
|
};
|
|
137
181
|
const baseSlots = {
|
|
182
|
+
baseAutocomplete: BaseAutocomplete,
|
|
138
183
|
baseBadge: MUIBadge,
|
|
139
184
|
baseCheckbox: /*#__PURE__*/React.forwardRef(BaseCheckbox),
|
|
140
185
|
baseCircularProgress: MUICircularProgress,
|
|
@@ -144,38 +189,29 @@ const baseSlots = {
|
|
|
144
189
|
baseMenuList: BaseMenuList,
|
|
145
190
|
baseMenuItem: BaseMenuItem,
|
|
146
191
|
baseTextField: BaseTextField,
|
|
147
|
-
baseFormControl: MUIFormControl,
|
|
148
192
|
baseButton: MUIButton,
|
|
149
193
|
baseIconButton: MUIIconButton,
|
|
150
|
-
baseInputAdornment: MUIInputAdornment,
|
|
151
194
|
baseTooltip: MUITooltip,
|
|
152
195
|
basePopper: BasePopper,
|
|
153
|
-
baseInputLabel: MUIInputLabel,
|
|
154
196
|
baseSelect: BaseSelect,
|
|
155
197
|
baseSelectOption: BaseSelectOption,
|
|
156
198
|
baseSkeleton: MUISkeleton,
|
|
157
|
-
baseSwitch: MUISwitch
|
|
158
|
-
baseChip: MUIChip
|
|
199
|
+
baseSwitch: MUISwitch
|
|
159
200
|
};
|
|
160
201
|
const materialSlots = _extends({}, baseSlots, iconSlots);
|
|
161
202
|
export default materialSlots;
|
|
162
|
-
const CHECKBOX_COMPACT = {
|
|
163
|
-
p: 0.5
|
|
164
|
-
};
|
|
165
203
|
function BaseCheckbox(props, ref) {
|
|
166
204
|
const {
|
|
167
205
|
autoFocus,
|
|
168
206
|
label,
|
|
169
207
|
fullWidth,
|
|
170
208
|
slotProps,
|
|
171
|
-
className
|
|
172
|
-
density
|
|
209
|
+
className
|
|
173
210
|
} = props,
|
|
174
211
|
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
175
212
|
const elementRef = React.useRef(null);
|
|
176
213
|
const handleRef = useForkRef(elementRef, ref);
|
|
177
214
|
const rippleRef = React.useRef(null);
|
|
178
|
-
const sx = density === 'compact' ? CHECKBOX_COMPACT : undefined;
|
|
179
215
|
React.useEffect(() => {
|
|
180
216
|
if (autoFocus) {
|
|
181
217
|
const input = elementRef.current?.querySelector('input');
|
|
@@ -189,27 +225,22 @@ function BaseCheckbox(props, ref) {
|
|
|
189
225
|
}
|
|
190
226
|
}, [autoFocus]);
|
|
191
227
|
if (!label) {
|
|
192
|
-
return /*#__PURE__*/_jsx(
|
|
228
|
+
return /*#__PURE__*/_jsx(Checkbox, _extends({}, other, {
|
|
193
229
|
className: className,
|
|
194
230
|
inputProps: slotProps?.htmlInput,
|
|
195
231
|
ref: handleRef,
|
|
196
|
-
sx: sx,
|
|
197
232
|
touchRippleRef: rippleRef
|
|
198
233
|
}));
|
|
199
234
|
}
|
|
200
|
-
return /*#__PURE__*/_jsx(
|
|
235
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
201
236
|
className: className,
|
|
202
|
-
control: /*#__PURE__*/_jsx(
|
|
237
|
+
control: /*#__PURE__*/_jsx(Checkbox, _extends({}, other, {
|
|
203
238
|
inputProps: slotProps?.htmlInput,
|
|
204
239
|
ref: handleRef,
|
|
205
|
-
sx: sx,
|
|
206
240
|
touchRippleRef: rippleRef
|
|
207
241
|
})),
|
|
208
242
|
label: label,
|
|
209
|
-
|
|
210
|
-
width: '100%',
|
|
211
|
-
margin: 0
|
|
212
|
-
} : undefined
|
|
243
|
+
fullWidth: fullWidth
|
|
213
244
|
});
|
|
214
245
|
}
|
|
215
246
|
function BaseMenuList(props) {
|
|
@@ -245,20 +276,102 @@ function BaseTextField(props) {
|
|
|
245
276
|
variant: "outlined"
|
|
246
277
|
}, rest, {
|
|
247
278
|
inputProps: slotProps?.htmlInput,
|
|
248
|
-
InputProps: slotProps?.input,
|
|
279
|
+
InputProps: transformInputProps(slotProps?.input),
|
|
249
280
|
InputLabelProps: _extends({
|
|
250
281
|
shrink: true
|
|
251
282
|
}, slotProps?.inputLabel)
|
|
252
283
|
}));
|
|
253
284
|
}
|
|
254
|
-
function
|
|
285
|
+
function BaseAutocomplete(props) {
|
|
286
|
+
const rootProps = useGridRootProps();
|
|
255
287
|
const {
|
|
288
|
+
id,
|
|
289
|
+
multiple,
|
|
290
|
+
freeSolo,
|
|
291
|
+
options,
|
|
292
|
+
getOptionLabel,
|
|
293
|
+
isOptionEqualToValue,
|
|
294
|
+
value,
|
|
295
|
+
onChange,
|
|
296
|
+
label,
|
|
297
|
+
placeholder,
|
|
256
298
|
slotProps
|
|
257
299
|
} = props,
|
|
258
300
|
rest = _objectWithoutPropertiesLoose(props, _excluded5);
|
|
259
|
-
return /*#__PURE__*/_jsx(
|
|
260
|
-
|
|
261
|
-
|
|
301
|
+
return /*#__PURE__*/_jsx(MUIAutocomplete, _extends({
|
|
302
|
+
id: id,
|
|
303
|
+
multiple: multiple,
|
|
304
|
+
freeSolo: freeSolo,
|
|
305
|
+
options: options,
|
|
306
|
+
getOptionLabel: getOptionLabel,
|
|
307
|
+
isOptionEqualToValue: isOptionEqualToValue,
|
|
308
|
+
value: value,
|
|
309
|
+
onChange: onChange,
|
|
310
|
+
renderTags: (currentValue, getTagProps) => currentValue.map((option, index) => {
|
|
311
|
+
const _getTagProps = getTagProps({
|
|
312
|
+
index
|
|
313
|
+
}),
|
|
314
|
+
{
|
|
315
|
+
key
|
|
316
|
+
} = _getTagProps,
|
|
317
|
+
tagProps = _objectWithoutPropertiesLoose(_getTagProps, _excluded6);
|
|
318
|
+
return /*#__PURE__*/_jsx(MUIChip, _extends({
|
|
319
|
+
variant: "outlined",
|
|
320
|
+
size: "small",
|
|
321
|
+
label: typeof option === 'string' ? option : getOptionLabel?.(option)
|
|
322
|
+
}, tagProps), key);
|
|
323
|
+
}),
|
|
324
|
+
renderInput: params => {
|
|
325
|
+
const {
|
|
326
|
+
inputProps,
|
|
327
|
+
InputProps,
|
|
328
|
+
InputLabelProps
|
|
329
|
+
} = params,
|
|
330
|
+
inputRest = _objectWithoutPropertiesLoose(params, _excluded7);
|
|
331
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, inputRest, {
|
|
332
|
+
label: label,
|
|
333
|
+
placeholder: placeholder,
|
|
334
|
+
slotProps: {
|
|
335
|
+
input: InputProps,
|
|
336
|
+
inputLabel: InputLabelProps,
|
|
337
|
+
htmlInput: inputProps
|
|
338
|
+
}
|
|
339
|
+
}, slotProps?.textField, rootProps.slotProps?.baseTextField));
|
|
340
|
+
}
|
|
341
|
+
}, rest));
|
|
342
|
+
}
|
|
343
|
+
function BaseInput(props) {
|
|
344
|
+
return /*#__PURE__*/_jsx(MUIInputBase, _extends({}, transformInputProps(props)));
|
|
345
|
+
}
|
|
346
|
+
function transformInputProps(props) {
|
|
347
|
+
if (!props) {
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
const {
|
|
351
|
+
slotProps
|
|
352
|
+
} = props,
|
|
353
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded8);
|
|
354
|
+
const result = rest;
|
|
355
|
+
if (result.startAdornment) {
|
|
356
|
+
result.startAdornment = /*#__PURE__*/_jsx(InputAdornment, {
|
|
357
|
+
position: "start",
|
|
358
|
+
children: result.startAdornment
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (result.endAdornment) {
|
|
362
|
+
result.endAdornment = /*#__PURE__*/_jsx(InputAdornment, {
|
|
363
|
+
position: "end",
|
|
364
|
+
children: result.endAdornment
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (slotProps?.htmlInput) {
|
|
368
|
+
if (result.inputProps) {
|
|
369
|
+
result.inputProps = _extends({}, result.inputProps, slotProps?.htmlInput);
|
|
370
|
+
} else {
|
|
371
|
+
result.inputProps = slotProps?.htmlInput;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return result;
|
|
262
375
|
}
|
|
263
376
|
const transformOrigin = {
|
|
264
377
|
'bottom-start': 'top left',
|
|
@@ -353,15 +466,17 @@ function focusTrapWrapper(props, content) {
|
|
|
353
466
|
return /*#__PURE__*/_jsx(MUIFocusTrap, {
|
|
354
467
|
open: true,
|
|
355
468
|
disableEnforceFocus: true,
|
|
356
|
-
|
|
357
|
-
|
|
469
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
470
|
+
tabIndex: -1,
|
|
471
|
+
children: content
|
|
472
|
+
})
|
|
358
473
|
});
|
|
359
474
|
}
|
|
360
475
|
function BaseSelectOption(_ref) {
|
|
361
476
|
let {
|
|
362
477
|
native
|
|
363
478
|
} = _ref,
|
|
364
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
479
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded9);
|
|
365
480
|
if (native) {
|
|
366
481
|
return /*#__PURE__*/_jsx("option", _extends({}, props));
|
|
367
482
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { alpha, darken, lighten } from '@mui/material/styles';
|
|
3
|
+
import { useTheme } from '@mui/material/styles';
|
|
4
|
+
import { hash } from '@mui/x-internals/hash';
|
|
5
|
+
import { vars } from "../constants/cssVariables.js";
|
|
6
|
+
export function useMaterialCSSVariables() {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
return React.useMemo(() => {
|
|
9
|
+
const id = hash(JSON.stringify(theme));
|
|
10
|
+
const variables = transformTheme(theme);
|
|
11
|
+
return {
|
|
12
|
+
id,
|
|
13
|
+
variables
|
|
14
|
+
};
|
|
15
|
+
}, [theme]);
|
|
16
|
+
}
|
|
17
|
+
function transformTheme(t) {
|
|
18
|
+
const borderColor = getBorderColor(t);
|
|
19
|
+
const dataGridPalette = t.palette.DataGrid; // FIXME: docs typecheck error
|
|
20
|
+
|
|
21
|
+
const backgroundBase = dataGridPalette?.bg ?? (t.vars || t).palette.background.default;
|
|
22
|
+
const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
|
|
23
|
+
const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
|
|
24
|
+
const backgroundBackdrop = t.vars ? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})` : alpha(t.palette.background.default, t.palette.action.disabledOpacity);
|
|
25
|
+
const selectedColor = t.vars ? `rgb(${t.vars.palette.primary.mainChannel})` : t.palette.primary.main;
|
|
26
|
+
const k = vars.keys;
|
|
27
|
+
return {
|
|
28
|
+
[k.spacingUnit]: t.spacing(1),
|
|
29
|
+
[k.colors.border.base]: borderColor,
|
|
30
|
+
[k.colors.background.base]: backgroundBase,
|
|
31
|
+
[k.colors.background.overlay]: t.palette.mode === 'dark' ? `color-mix(in srgb, ${t.palette.background.paper} 95%, #fff)` : t.palette.background.paper,
|
|
32
|
+
[k.colors.background.backdrop]: backgroundBackdrop,
|
|
33
|
+
[k.colors.foreground.base]: t.palette.text.primary,
|
|
34
|
+
[k.colors.foreground.muted]: t.palette.text.secondary,
|
|
35
|
+
[k.colors.foreground.accent]: t.palette.primary.dark,
|
|
36
|
+
[k.colors.foreground.disabled]: t.palette.text.disabled,
|
|
37
|
+
[k.colors.interactive.hover]: removeOpacity(t.palette.action.hover),
|
|
38
|
+
[k.colors.interactive.hoverOpacity]: t.palette.action.hoverOpacity,
|
|
39
|
+
[k.colors.interactive.focus]: removeOpacity(t.palette.primary.main),
|
|
40
|
+
[k.colors.interactive.focusOpacity]: t.palette.action.focusOpacity,
|
|
41
|
+
[k.colors.interactive.disabled]: removeOpacity(t.palette.action.disabled),
|
|
42
|
+
[k.colors.interactive.disabledOpacity]: t.palette.action.disabledOpacity,
|
|
43
|
+
[k.colors.interactive.selected]: selectedColor,
|
|
44
|
+
[k.colors.interactive.selectedOpacity]: t.palette.action.selectedOpacity,
|
|
45
|
+
[k.header.background.base]: backgroundHeader,
|
|
46
|
+
[k.cell.background.pinned]: backgroundPinned,
|
|
47
|
+
[k.radius.base]: typeof t.shape.borderRadius === 'number' ? `${t.shape.borderRadius}px` : t.shape.borderRadius,
|
|
48
|
+
[k.typography.fontFamily.base]: t.typography.fontFamily,
|
|
49
|
+
[k.typography.fontWeight.light]: t.typography.fontWeightLight,
|
|
50
|
+
[k.typography.fontWeight.regular]: t.typography.fontWeightRegular,
|
|
51
|
+
[k.typography.fontWeight.medium]: t.typography.fontWeightMedium,
|
|
52
|
+
[k.typography.fontWeight.bold]: t.typography.fontWeightBold,
|
|
53
|
+
[k.typography.body.fontFamily]: t.typography.body2.fontFamily,
|
|
54
|
+
[k.typography.body.fontSize]: t.typography.body2.fontSize,
|
|
55
|
+
[k.typography.body.fontWeight]: t.typography.body2.fontWeight,
|
|
56
|
+
[k.typography.body.letterSpacing]: t.typography.body2.letterSpacing,
|
|
57
|
+
[k.typography.body.lineHeight]: t.typography.body2.lineHeight,
|
|
58
|
+
[k.typography.small.fontFamily]: t.typography.caption.fontFamily,
|
|
59
|
+
[k.typography.small.fontSize]: t.typography.caption.fontSize,
|
|
60
|
+
[k.typography.small.fontWeight]: t.typography.caption.fontWeight,
|
|
61
|
+
[k.typography.small.letterSpacing]: t.typography.caption.letterSpacing,
|
|
62
|
+
[k.typography.small.lineHeight]: t.typography.caption.lineHeight,
|
|
63
|
+
[k.transitions.easing.easeIn]: t.transitions.easing.easeIn,
|
|
64
|
+
[k.transitions.easing.easeOut]: t.transitions.easing.easeOut,
|
|
65
|
+
[k.transitions.easing.easeInOut]: t.transitions.easing.easeInOut,
|
|
66
|
+
[k.transitions.duration.short]: `${t.transitions.duration.shorter}ms`,
|
|
67
|
+
[k.transitions.duration.base]: `${t.transitions.duration.short}ms`,
|
|
68
|
+
[k.transitions.duration.long]: `${t.transitions.duration.standard}ms`,
|
|
69
|
+
[k.shadows.base]: t.shadows[2],
|
|
70
|
+
[k.shadows.overlay]: t.shadows[8],
|
|
71
|
+
[k.zIndex.panel]: t.zIndex.modal,
|
|
72
|
+
[k.zIndex.menu]: t.zIndex.modal
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function getBorderColor(theme) {
|
|
76
|
+
if (theme.vars) {
|
|
77
|
+
return theme.vars.palette.TableCell.border;
|
|
78
|
+
}
|
|
79
|
+
if (theme.palette.mode === 'light') {
|
|
80
|
+
return lighten(alpha(theme.palette.divider, 1), 0.88);
|
|
81
|
+
}
|
|
82
|
+
return darken(alpha(theme.palette.divider, 1), 0.68);
|
|
83
|
+
}
|
|
84
|
+
function setOpacity(color, opacity) {
|
|
85
|
+
return `rgba(from ${color} r g b / ${opacity})`;
|
|
86
|
+
}
|
|
87
|
+
function removeOpacity(color) {
|
|
88
|
+
return setOpacity(color, 1);
|
|
89
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GridRowId, GridRowModel } from
|
|
1
|
+
import type { GridRowId, GridRowModel } from '../gridRows';
|
|
2
|
+
import type { GridRowSelectionModel } from '../gridRowSelectionModel';
|
|
2
3
|
/**
|
|
3
4
|
* The selection API interface that is available in the grid [[apiRef]].
|
|
4
5
|
*/
|
|
@@ -25,6 +26,7 @@ export interface GridRowSelectionApi {
|
|
|
25
26
|
/**
|
|
26
27
|
* Returns an array of the selected rows.
|
|
27
28
|
* @returns {Map<GridRowId, GridRowModel>} A `Map` with the selected rows.
|
|
29
|
+
* @deprecated Use `gridRowSelectionIdsSelector`, `gridRowSelectionCountSelector`, or `gridRowSelectionManagerSelector` instead.
|
|
28
30
|
*/
|
|
29
31
|
getSelectedRows: () => Map<GridRowId, GridRowModel>;
|
|
30
32
|
/**
|
|
@@ -32,7 +34,7 @@ export interface GridRowSelectionApi {
|
|
|
32
34
|
* Any row already selected will be unselected.
|
|
33
35
|
* @param {readonly GridRowId[]} rowIds The row ids to select.
|
|
34
36
|
*/
|
|
35
|
-
setRowSelectionModel: (rowIds:
|
|
37
|
+
setRowSelectionModel: (rowIds: GridRowSelectionModel) => void;
|
|
36
38
|
}
|
|
37
39
|
export interface GridRowMultiSelectionApi {
|
|
38
40
|
/**
|
|
@@ -23,7 +23,7 @@ export interface GridSortApi {
|
|
|
23
23
|
* Sorts a column.
|
|
24
24
|
* @param {GridColDef['field']} field The field identifier of the column to be sorted.
|
|
25
25
|
* @param {GridSortDirection} direction The direction to be sorted. By default, the next in the `sortingOrder` prop.
|
|
26
|
-
* @param {boolean} allowMultipleSorting Whether to keep the existing [
|
|
26
|
+
* @param {boolean} allowMultipleSorting Whether to keep the existing [GridSortModel]. Default is `false`.
|
|
27
27
|
*/
|
|
28
28
|
sortColumn: (field: GridColDef['field'], direction?: GridSortDirection, allowMultipleSorting?: boolean) => void;
|
|
29
29
|
/**
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRowAriaAttributesInternalHook } from "./gridRowConfiguration.js";
|
|
3
|
+
import type { GridCSSVariablesInterface } from '../../constants/cssVariables';
|
|
3
4
|
export interface GridAriaAttributesInternalHook {
|
|
4
5
|
useGridAriaAttributes: () => React.HTMLAttributes<HTMLElement>;
|
|
5
6
|
}
|
|
6
|
-
export interface GridInternalHook extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook {
|
|
7
|
+
export interface GridInternalHook extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook {
|
|
8
|
+
useCSSVariables: () => {
|
|
9
|
+
id: string;
|
|
10
|
+
variables: GridCSSVariablesInterface;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
7
13
|
export interface GridConfiguration {
|
|
8
14
|
hooks: GridInternalHook;
|
|
9
15
|
}
|
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
type Ref<T = HTMLElement> = React.RefCallback<T | null> | React.RefObject<T | null> | null;
|
|
2
|
+
export interface AutocompleteFilterOptionsState<Value> {
|
|
3
|
+
inputValue: string;
|
|
4
|
+
getOptionLabel: (option: Value) => string;
|
|
5
|
+
}
|
|
6
|
+
type AcValueMap<FreeSolo> = FreeSolo extends true ? string : never;
|
|
7
|
+
type AcValue<Value, Multiple, DisableClearable, FreeSolo> = Multiple extends true ? Array<Value | AcValueMap<FreeSolo>> : DisableClearable extends true ? NonNullable<Value | AcValueMap<FreeSolo>> : Value | null | AcValueMap<FreeSolo>;
|
|
8
|
+
export type AutocompleteProps<Value = string, Multiple extends boolean = false, DisableClearable extends boolean = false, FreeSolo extends boolean = false> = {
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Allow multiple selection. */
|
|
11
|
+
multiple?: Multiple;
|
|
12
|
+
/** Allow to add new options. */
|
|
13
|
+
freeSolo?: FreeSolo;
|
|
14
|
+
value?: AcValue<Value, Multiple, DisableClearable, FreeSolo>;
|
|
15
|
+
options: ReadonlyArray<Value>;
|
|
16
|
+
/**
|
|
17
|
+
* Used to determine the string value for a given option.
|
|
18
|
+
* It's used to fill the input (and the list box options if `renderOption` is not provided).
|
|
19
|
+
*
|
|
20
|
+
* If used in free solo mode, it must accept both the type of the options and a string.
|
|
21
|
+
*
|
|
22
|
+
* @param {Value} option The option
|
|
23
|
+
* @returns {string} The label
|
|
24
|
+
* @default (option) => option.label ?? option
|
|
25
|
+
*/
|
|
26
|
+
getOptionLabel?: (option: Value | AcValueMap<FreeSolo>) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Used to determine if the option represents the given value.
|
|
29
|
+
* Uses strict equality by default.
|
|
30
|
+
* ⚠️ Both arguments need to be handled, an option can only match with one value.
|
|
31
|
+
*
|
|
32
|
+
* @param {Value} option The option to test.
|
|
33
|
+
* @param {Value} value The value to test against.
|
|
34
|
+
* @returns {boolean} true if value matches
|
|
35
|
+
*/
|
|
36
|
+
isOptionEqualToValue?: (option: Value, value: Value) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Callback fired when the value changes.
|
|
39
|
+
*
|
|
40
|
+
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
41
|
+
* @param {Value|Value[]} value The new value of the component.
|
|
42
|
+
*/
|
|
43
|
+
onChange?: (event: React.SyntheticEvent, value: AcValue<Value, Multiple, DisableClearable, FreeSolo>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Callback fired when the input value changes.
|
|
46
|
+
*
|
|
47
|
+
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
48
|
+
* @param {string} value The new value of the input.
|
|
49
|
+
*/
|
|
50
|
+
onInputChange?: (event: React.SyntheticEvent, value: string) => void;
|
|
51
|
+
label?: React.ReactNode;
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
slotProps?: {
|
|
54
|
+
textField: TextFieldProps;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
2
57
|
export type BadgeProps = {
|
|
3
58
|
badgeContent?: React.ReactNode;
|
|
4
59
|
children: React.ReactNode;
|
|
@@ -90,7 +145,6 @@ export type PopperProps = {
|
|
|
90
145
|
clickAwayMouseEvent?: false | ClickAwayMouseEventHandler;
|
|
91
146
|
flip?: boolean;
|
|
92
147
|
focusTrap?: boolean;
|
|
93
|
-
focusTrapEnabled?: boolean;
|
|
94
148
|
onExited?: (node: HTMLElement | null) => void;
|
|
95
149
|
onClickAway?: (event: MouseEvent | TouchEvent) => void;
|
|
96
150
|
onDidShow?: () => void;
|
|
@@ -184,11 +238,7 @@ export type TextFieldProps = {
|
|
|
184
238
|
placeholder?: string;
|
|
185
239
|
size?: 'small' | 'medium';
|
|
186
240
|
slotProps?: {
|
|
187
|
-
input?:
|
|
188
|
-
disabled?: boolean;
|
|
189
|
-
endAdornment?: React.ReactNode;
|
|
190
|
-
startAdornment?: React.ReactNode;
|
|
191
|
-
};
|
|
241
|
+
input?: Partial<InputProps>;
|
|
192
242
|
inputLabel?: {};
|
|
193
243
|
htmlInput?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
194
244
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GridSortModel, GridFilterModel, GridRowModel, GridPaginationModel } from '.';
|
|
1
|
+
import type { GridSortModel, GridFilterModel, GridRowModel, GridPaginationModel, GridRowId } from '.';
|
|
2
2
|
export interface GridGetRowsParams {
|
|
3
3
|
sortModel: GridSortModel;
|
|
4
4
|
filterModel: GridFilterModel;
|
|
@@ -15,6 +15,11 @@ export interface GridGetRowsParams {
|
|
|
15
15
|
*/
|
|
16
16
|
end: number;
|
|
17
17
|
}
|
|
18
|
+
export interface GridUpdateRowParams {
|
|
19
|
+
rowId: GridRowId;
|
|
20
|
+
updatedRow: GridRowModel;
|
|
21
|
+
previousRow: GridRowModel;
|
|
22
|
+
}
|
|
18
23
|
export interface GridGetRowsResponse {
|
|
19
24
|
rows: GridRowModel[];
|
|
20
25
|
/**
|
|
@@ -39,11 +44,11 @@ export interface GridDataSource {
|
|
|
39
44
|
*/
|
|
40
45
|
getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
|
|
41
46
|
/**
|
|
42
|
-
* This method will be called when the user updates a row
|
|
43
|
-
* @param {
|
|
47
|
+
* This method will be called when the user updates a row.
|
|
48
|
+
* @param {GridUpdateRowParams} params The parameters required to update the row.
|
|
44
49
|
* @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache.
|
|
45
50
|
*/
|
|
46
|
-
updateRow?(
|
|
51
|
+
updateRow?(params: GridUpdateRowParams): Promise<any>;
|
|
47
52
|
}
|
|
48
53
|
export interface GridDataSourceCache {
|
|
49
54
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GridRowId } from './gridRows';
|
|
2
|
+
import type { GridRowSelectionModel } from './gridRowSelectionModel';
|
|
3
|
+
export interface RowSelectionManager {
|
|
4
|
+
data: Set<GridRowId>;
|
|
5
|
+
has(id: GridRowId): boolean;
|
|
6
|
+
select(id: GridRowId): void;
|
|
7
|
+
unselect(id: GridRowId): void;
|
|
8
|
+
}
|
|
9
|
+
export declare const createRowSelectionManager: (model: GridRowSelectionModel) => RowSelectionManager;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class IncludeManager {
|
|
2
|
+
constructor(model) {
|
|
3
|
+
this.data = void 0;
|
|
4
|
+
this.data = model.ids;
|
|
5
|
+
}
|
|
6
|
+
has(id) {
|
|
7
|
+
return this.data.has(id);
|
|
8
|
+
}
|
|
9
|
+
select(id) {
|
|
10
|
+
this.data.add(id);
|
|
11
|
+
}
|
|
12
|
+
unselect(id) {
|
|
13
|
+
this.data.delete(id);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class ExcludeManager {
|
|
17
|
+
constructor(model) {
|
|
18
|
+
this.data = void 0;
|
|
19
|
+
this.data = model.ids;
|
|
20
|
+
}
|
|
21
|
+
has(id) {
|
|
22
|
+
return !this.data.has(id);
|
|
23
|
+
}
|
|
24
|
+
select(id) {
|
|
25
|
+
this.data.delete(id);
|
|
26
|
+
}
|
|
27
|
+
unselect(id) {
|
|
28
|
+
this.data.add(id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const createRowSelectionManager = model => {
|
|
32
|
+
if (model.type === 'include') {
|
|
33
|
+
return new IncludeManager(model);
|
|
34
|
+
}
|
|
35
|
+
return new ExcludeManager(model);
|
|
36
|
+
};
|
|
@@ -3,5 +3,7 @@ export type GridRowSelectionPropagation = {
|
|
|
3
3
|
descendants?: boolean;
|
|
4
4
|
parents?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
7
|
-
|
|
6
|
+
export type GridRowSelectionModel = {
|
|
7
|
+
type: 'include' | 'exclude';
|
|
8
|
+
ids: Set<GridRowId>;
|
|
9
|
+
};
|