@mui/x-data-grid 7.0.0-beta.6 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +311 -12
- package/DataGrid/DataGrid.js +57 -17
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +6 -7
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +14 -11
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +17 -36
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.d.ts +7 -0
- package/components/cell/GridCell.js +18 -11
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +22 -13
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +26 -12
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +7 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +12 -20
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/constants/gridClasses.d.ts +6 -32
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -101
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/hooks/features/columnResize/columnResizeState.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeState.js +1 -0
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +3 -0
- package/hooks/features/columnResize/index.js +3 -0
- package/hooks/features/columnResize/useGridColumnResize.d.ts +10 -0
- package/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +5 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +7 -10
- package/hooks/features/editing/useGridCellEditing.js +25 -8
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +17 -22
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +23 -5
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +9 -4
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -158
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +94 -0
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +3 -4
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useLazyRef.d.ts +1 -2
- package/hooks/utils/useLazyRef.js +1 -11
- package/hooks/utils/useOnMount.d.ts +1 -2
- package/hooks/utils/useOnMount.js +1 -7
- package/hooks/utils/useTimeout.d.ts +1 -11
- package/hooks/utils/useTimeout.js +1 -36
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +2 -1
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +18 -63
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +13 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +3 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +58 -28
- package/modern/DataGrid/DataGrid.js +57 -17
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +6 -7
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +13 -6
- package/modern/components/GridRow.js +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/cell/GridCell.js +11 -3
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +12 -20
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +184 -97
- package/modern/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/modern/hooks/features/columnResize/columnResizeState.js +1 -0
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +3 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -20
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +22 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/export/useGridPrintExport.js +8 -7
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/modern/hooks/features/pagination/useGridPagination.js +8 -149
- package/modern/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/modern/hooks/features/pagination/useGridRowCount.js +94 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/hooks/utils/useLazyRef.js +1 -11
- package/modern/hooks/utils/useOnMount.js +1 -7
- package/modern/hooks/utils/useTimeout.js +1 -36
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/getPinnedCellOffset.js +17 -0
- package/modern/joy/joySlots.js +11 -50
- package/modern/locales/jaJP.js +3 -4
- package/modern/material/index.js +0 -2
- package/modern/models/api/index.js +0 -1
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +144 -0
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +57 -17
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +6 -7
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +10 -4
- package/node/components/GridRow.js +3 -18
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/cell/GridCell.js +12 -4
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/node/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/containers/GridRootStyles.js +12 -20
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +6 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +190 -103
- package/node/hooks/features/columnResize/columnResizeSelector.js +10 -0
- package/node/hooks/features/columnResize/columnResizeState.js +5 -0
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +16 -0
- package/node/hooks/features/columnResize/index.js +38 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +564 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -21
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/node/hooks/features/editing/useGridCellEditing.js +22 -3
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/export/useGridPrintExport.js +8 -7
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +4 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/useGridPagination.js +9 -153
- package/node/hooks/features/pagination/useGridPaginationModel.js +176 -0
- package/node/hooks/features/pagination/useGridRowCount.js +103 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/hooks/utils/useLazyRef.js +7 -13
- package/node/hooks/utils/useOnMount.js +8 -10
- package/node/hooks/utils/useTimeout.js +7 -37
- package/node/index.js +1 -1
- package/node/internals/index.js +27 -8
- package/node/internals/utils/getPinnedCellOffset.js +24 -0
- package/node/joy/joySlots.js +11 -50
- package/node/locales/jaJP.js +3 -4
- package/node/material/index.js +0 -2
- package/node/models/api/index.js +0 -11
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +155 -0
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +144 -0
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +0 -8
- package/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/node/components/columnHeaders/GridColumnHeadersInner.js +0 -67
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["className", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { refType } from '@mui/utils';
|
|
7
6
|
import { fastMemo } from '../utils/fastMemo';
|
|
8
7
|
import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
9
8
|
import { GridBaseColumnHeaders } from './columnHeaders/GridBaseColumnHeaders';
|
|
10
|
-
import { GridColumnHeadersInner } from './columnHeaders/GridColumnHeadersInner';
|
|
11
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
10
|
const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeaders(props, ref) {
|
|
14
11
|
const {
|
|
15
|
-
innerRef,
|
|
16
12
|
visibleColumns,
|
|
17
13
|
sortColumnLookup,
|
|
18
14
|
filterColumnLookup,
|
|
@@ -28,12 +24,10 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
28
24
|
} = props,
|
|
29
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
30
26
|
const {
|
|
31
|
-
isDragging,
|
|
32
27
|
getInnerProps,
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
getColumnHeadersRow,
|
|
29
|
+
getColumnGroupHeadersRows
|
|
35
30
|
} = useGridColumnHeaders({
|
|
36
|
-
innerRef,
|
|
37
31
|
visibleColumns,
|
|
38
32
|
sortColumnLookup,
|
|
39
33
|
filterColumnLookup,
|
|
@@ -47,14 +41,10 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
47
41
|
columnGroupsHeaderStructure,
|
|
48
42
|
hasOtherElementInTabSequence
|
|
49
43
|
});
|
|
50
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({
|
|
51
45
|
ref: ref
|
|
52
|
-
}, other, {
|
|
53
|
-
children:
|
|
54
|
-
isDragging: isDragging
|
|
55
|
-
}, getInnerProps(), {
|
|
56
|
-
children: [getColumnGroupHeaders(), getColumnHeaders()]
|
|
57
|
-
}))
|
|
46
|
+
}, other, getInnerProps(), {
|
|
47
|
+
children: [getColumnGroupHeadersRows(), getColumnHeadersRow()]
|
|
58
48
|
}));
|
|
59
49
|
});
|
|
60
50
|
process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
|
|
@@ -88,7 +78,6 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
|
|
|
88
78
|
filterColumnLookup: PropTypes.object.isRequired,
|
|
89
79
|
hasOtherElementInTabSequence: PropTypes.bool.isRequired,
|
|
90
80
|
headerGroupingMaxDepth: PropTypes.number.isRequired,
|
|
91
|
-
innerRef: refType,
|
|
92
81
|
sortColumnLookup: PropTypes.object.isRequired,
|
|
93
82
|
visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
94
83
|
} : void 0;
|
package/components/GridFooter.js
CHANGED
|
@@ -12,7 +12,6 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) {
|
|
15
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
16
15
|
const apiRef = useGridApiContext();
|
|
17
16
|
const rootProps = useGridRootProps();
|
|
18
17
|
const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector);
|
|
@@ -21,11 +20,11 @@ const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref)
|
|
|
21
20
|
const selectedRowCountElement = !rootProps.hideFooterSelectedRowCount && selectedRowCount > 0 ? /*#__PURE__*/_jsx(GridSelectedRowCount, {
|
|
22
21
|
selectedRowCount: selectedRowCount
|
|
23
22
|
}) : /*#__PURE__*/_jsx("div", {});
|
|
24
|
-
const rowCountElement = !rootProps.hideFooterRowCount && !rootProps.pagination ? /*#__PURE__*/_jsx(rootProps.slots.footerRowCount, _extends({},
|
|
23
|
+
const rowCountElement = !rootProps.hideFooterRowCount && !rootProps.pagination ? /*#__PURE__*/_jsx(rootProps.slots.footerRowCount, _extends({}, rootProps.slotProps?.footerRowCount, {
|
|
25
24
|
rowCount: totalTopLevelRowCount,
|
|
26
25
|
visibleRowCount: visibleTopLevelRowCount
|
|
27
26
|
})) : null;
|
|
28
|
-
const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.slots.pagination && /*#__PURE__*/_jsx(rootProps.slots.pagination, _extends({},
|
|
27
|
+
const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.slots.pagination && /*#__PURE__*/_jsx(rootProps.slots.pagination, _extends({}, rootProps.slotProps?.pagination));
|
|
29
28
|
return /*#__PURE__*/_jsxs(GridFooterContainer, _extends({
|
|
30
29
|
ref: ref
|
|
31
30
|
}, props, {
|
package/components/GridHeader.js
CHANGED
|
@@ -5,9 +5,8 @@ import { GridPreferencesPanel } from './panel/GridPreferencesPanel';
|
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
export function GridHeader() {
|
|
8
|
-
var _rootProps$slotProps;
|
|
9
8
|
const rootProps = useGridRootProps();
|
|
10
9
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
11
|
-
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({},
|
|
10
|
+
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, rootProps.slotProps?.toolbar))]
|
|
12
11
|
});
|
|
13
12
|
}
|
|
@@ -26,15 +26,12 @@ function GridHeaders() {
|
|
|
26
26
|
const columnVisibility = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
27
27
|
const columnGroupsHeaderStructure = useGridSelector(apiRef, gridColumnGroupsHeaderStructureSelector);
|
|
28
28
|
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null && cellTabIndexState === null);
|
|
29
|
-
const columnHeadersRef = React.useRef(null);
|
|
30
29
|
const columnsContainerRef = React.useRef(null);
|
|
31
30
|
apiRef.current.register('private', {
|
|
32
|
-
|
|
33
|
-
columnHeadersElementRef: columnHeadersRef
|
|
31
|
+
columnHeadersContainerRef: columnsContainerRef
|
|
34
32
|
});
|
|
35
33
|
return /*#__PURE__*/_jsx(rootProps.slots.columnHeaders, {
|
|
36
34
|
ref: columnsContainerRef,
|
|
37
|
-
innerRef: columnHeadersRef,
|
|
38
35
|
visibleColumns: visibleColumns,
|
|
39
36
|
filterColumnLookup: filterColumnLookup,
|
|
40
37
|
sortColumnLookup: sortColumnLookup,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { TablePaginationProps } from '@mui/material/TablePagination';
|
|
3
|
+
interface GridPaginationOwnProps {
|
|
4
|
+
component?: React.ElementType;
|
|
5
|
+
}
|
|
6
|
+
declare const GridPagination: React.ForwardRefExoticComponent<Omit<Partial<Omit<TablePaginationProps, "component">> & GridPaginationOwnProps, "ref"> & React.RefAttributes<unknown>>;
|
|
7
|
+
export { GridPagination };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
|
|
4
5
|
import { styled } from '@mui/material/styles';
|
|
5
6
|
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
6
7
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
7
8
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
8
|
-
import {
|
|
9
|
-
import { gridPaginationModelSelector } from '../hooks/features/pagination/gridPaginationSelector';
|
|
9
|
+
import { gridPaginationModelSelector, gridPaginationRowCountSelector } from '../hooks/features/pagination/gridPaginationSelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const GridPaginationRoot = styled(TablePagination)(({
|
|
12
12
|
theme
|
|
@@ -27,15 +27,11 @@ const GridPaginationRoot = styled(TablePagination)(({
|
|
|
27
27
|
|
|
28
28
|
// A mutable version of a readonly array.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
31
31
|
const apiRef = useGridApiContext();
|
|
32
32
|
const rootProps = useGridRootProps();
|
|
33
33
|
const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
|
|
34
|
-
const
|
|
35
|
-
const rowCount = React.useMemo(() => {
|
|
36
|
-
var _ref, _rootProps$rowCount;
|
|
37
|
-
return (_ref = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref : 0;
|
|
38
|
-
}, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
34
|
+
const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
|
|
39
35
|
const lastPage = React.useMemo(() => {
|
|
40
36
|
const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
|
|
41
37
|
return Math.max(0, calculatedValue);
|
|
@@ -61,10 +57,9 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
61
57
|
return false;
|
|
62
58
|
};
|
|
63
59
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
-
var _rootProps$pagination, _rootProps$pagination2;
|
|
65
60
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
66
61
|
const warnedOnceMissingInPageSizeOptions = React.useRef(false);
|
|
67
|
-
const pageSize =
|
|
62
|
+
const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
|
|
68
63
|
if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
|
|
69
64
|
console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
|
|
70
65
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
@@ -85,4 +80,12 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
85
80
|
onPageChange: handlePageChange,
|
|
86
81
|
onRowsPerPageChange: handlePageSizeChange
|
|
87
82
|
}, apiRef.current.getLocaleText('MuiTablePagination'), props));
|
|
88
|
-
});
|
|
83
|
+
});
|
|
84
|
+
process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
|
|
85
|
+
// ----------------------------- Warning --------------------------------
|
|
86
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
87
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
88
|
+
// ----------------------------------------------------------------------
|
|
89
|
+
component: PropTypes.elementType
|
|
90
|
+
} : void 0;
|
|
91
|
+
export { GridPagination };
|
package/components/GridRow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRowId, GridRowModel } from '../models/gridRows';
|
|
3
|
-
import
|
|
3
|
+
import { GridPinnedColumns } from '../hooks/features/columns';
|
|
4
4
|
import type { GridStateColDef } from '../models/colDef/gridColDef';
|
|
5
5
|
import type { GridRenderContext } from '../models/params/gridScrollParams';
|
|
6
6
|
import type { GridDimensions } from '../hooks/features/dimensions';
|
package/components/GridRow.js
CHANGED
|
@@ -21,8 +21,9 @@ import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSele
|
|
|
21
21
|
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
22
22
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
23
23
|
import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
|
|
24
|
-
import { PinnedPosition } from './cell/GridCell';
|
|
24
|
+
import { PinnedPosition, gridPinnedColumnPositionLookup } from './cell/GridCell';
|
|
25
25
|
import { GridScrollbarFillerCell as ScrollbarFiller } from './GridScrollbarFillerCell';
|
|
26
|
+
import { getPinnedCellOffset } from '../internals/utils/getPinnedCellOffset';
|
|
26
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
29
|
const useUtilityClasses = ownerState => {
|
|
@@ -156,7 +157,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
156
157
|
}, [apiRef, rowId]);
|
|
157
158
|
const publishClick = React.useCallback(event => {
|
|
158
159
|
const cell = findParentElementFromClassName(event.target, gridClasses.cell);
|
|
159
|
-
const field = cell
|
|
160
|
+
const field = cell?.getAttribute('data-field');
|
|
160
161
|
|
|
161
162
|
// Check if the field is available because the cell that fills the empty
|
|
162
163
|
// space of the row has no field.
|
|
@@ -183,7 +184,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
183
184
|
|
|
184
185
|
// User clicked a button from the "actions" column type
|
|
185
186
|
const column = apiRef.current.getColumn(field);
|
|
186
|
-
if (
|
|
187
|
+
if (column?.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
187
188
|
return;
|
|
188
189
|
}
|
|
189
190
|
}
|
|
@@ -198,9 +199,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
198
199
|
const sizes = useGridSelector(apiRef, () => _extends({}, apiRef.current.unstable_getRowInternalSizes(rowId)), objectShallowCompare);
|
|
199
200
|
let minHeight = rowHeight;
|
|
200
201
|
if (minHeight === 'auto' && sizes) {
|
|
201
|
-
var _sizes$baseCenter;
|
|
202
202
|
const numberOfBaseSizes = 1;
|
|
203
|
-
const maximumSize =
|
|
203
|
+
const maximumSize = sizes.baseCenter ?? 0;
|
|
204
204
|
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
205
205
|
minHeight = maximumSize;
|
|
206
206
|
}
|
|
@@ -219,11 +219,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
219
219
|
minHeight,
|
|
220
220
|
'--height': typeof rowHeight === 'number' ? `${rowHeight}px` : rowHeight
|
|
221
221
|
});
|
|
222
|
-
if (sizes
|
|
222
|
+
if (sizes?.spacingTop) {
|
|
223
223
|
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
224
224
|
rowStyle[property] = sizes.spacingTop;
|
|
225
225
|
}
|
|
226
|
-
if (sizes
|
|
226
|
+
if (sizes?.spacingBottom) {
|
|
227
227
|
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
228
228
|
let propertyValue = rowStyle[property];
|
|
229
229
|
// avoid overriding existing value
|
|
@@ -237,8 +237,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
237
237
|
}, [isNotVisible, rowHeight, styleProp, minHeight, sizes, rootProps.rowSpacingType]);
|
|
238
238
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
239
239
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
240
|
-
|
|
241
|
-
const indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
240
|
+
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
242
241
|
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
243
242
|
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
244
243
|
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
@@ -247,38 +246,22 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
247
246
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
248
247
|
}
|
|
249
248
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedPosition.NONE) => {
|
|
250
|
-
var _cellColSpanInfo$cell, _cellColSpanInfo$cell2, _editRowsState$rowId$, _editRowsState$rowId;
|
|
251
249
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
252
|
-
if (cellColSpanInfo
|
|
250
|
+
if (cellColSpanInfo?.spannedByColSpan) {
|
|
253
251
|
return null;
|
|
254
252
|
}
|
|
255
|
-
const width =
|
|
256
|
-
const colSpan =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// eslint-disable-next-line default-case
|
|
260
|
-
switch (pinnedPosition) {
|
|
261
|
-
case PinnedPosition.LEFT:
|
|
262
|
-
pinnedOffset = columnPositions[indexRelativeToAllColumns];
|
|
263
|
-
break;
|
|
264
|
-
case PinnedPosition.RIGHT:
|
|
265
|
-
pinnedOffset = dimensions.columnsTotalWidth - columnPositions[indexRelativeToAllColumns] - column.computedWidth + scrollbarWidth;
|
|
266
|
-
break;
|
|
267
|
-
case PinnedPosition.NONE:
|
|
268
|
-
case PinnedPosition.VIRTUAL:
|
|
269
|
-
pinnedOffset = 0;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
if ((rowNode == null ? void 0 : rowNode.type) === 'skeletonRow') {
|
|
273
|
-
var _column$align;
|
|
253
|
+
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
254
|
+
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
255
|
+
const pinnedOffset = getPinnedCellOffset(gridPinnedColumnPositionLookup[pinnedPosition], column.computedWidth, indexRelativeToAllColumns, columnPositions, dimensions);
|
|
256
|
+
if (rowNode?.type === 'skeletonRow') {
|
|
274
257
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
275
258
|
width: width,
|
|
276
259
|
height: rowHeight,
|
|
277
260
|
field: column.field,
|
|
278
|
-
align:
|
|
261
|
+
align: column.align ?? 'left'
|
|
279
262
|
}, column.field);
|
|
280
263
|
}
|
|
281
|
-
const editCellState =
|
|
264
|
+
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
282
265
|
|
|
283
266
|
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
284
267
|
// fixes https://github.com/mui/mui-x/issues/11126
|
|
@@ -302,7 +285,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
302
285
|
pinnedPosition: pinnedPosition,
|
|
303
286
|
sectionIndex: indexInSection,
|
|
304
287
|
sectionLength: sectionLength
|
|
305
|
-
}, slotProps
|
|
288
|
+
}, slotProps?.cell), column.field);
|
|
306
289
|
};
|
|
307
290
|
|
|
308
291
|
/* Start of rendering */
|
|
@@ -361,9 +344,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
361
344
|
width: emptyCellWidth
|
|
362
345
|
}), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
363
346
|
role: "presentation",
|
|
364
|
-
|
|
365
|
-
flex: '1'
|
|
366
|
-
}
|
|
347
|
+
className: gridClasses.filler
|
|
367
348
|
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
368
349
|
pinnedRight: pinnedColumns.right.length > 0
|
|
369
350
|
})]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ScrollAreaProps {
|
|
3
|
+
scrollDirection: 'left' | 'right';
|
|
4
|
+
}
|
|
5
|
+
declare function GridScrollAreaRaw(props: ScrollAreaProps): React.JSX.Element | null;
|
|
6
|
+
declare namespace GridScrollAreaRaw {
|
|
7
|
+
var propTypes: any;
|
|
8
|
+
}
|
|
9
|
+
declare const GridScrollArea: typeof GridScrollAreaRaw;
|
|
10
|
+
export { GridScrollArea };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
6
|
+
import { styled } from '@mui/system';
|
|
7
|
+
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
8
|
+
import { getDataGridUtilityClass, gridClasses } from '../constants';
|
|
9
|
+
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
10
|
+
import { useGridApiEventHandler } from '../hooks/utils/useGridApiEventHandler';
|
|
11
|
+
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
12
|
+
import { gridDimensionsSelector } from '../hooks/features/dimensions/gridDimensionsSelectors';
|
|
13
|
+
import { gridDensityFactorSelector } from '../hooks/features/density/densitySelector';
|
|
14
|
+
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
15
|
+
import { useTimeout } from '../hooks/utils/useTimeout';
|
|
16
|
+
import { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
17
|
+
import { fastMemo } from '../utils/fastMemo';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const CLIFF = 1;
|
|
20
|
+
const SLOP = 1.5;
|
|
21
|
+
const useUtilityClasses = ownerState => {
|
|
22
|
+
const {
|
|
23
|
+
scrollDirection,
|
|
24
|
+
classes
|
|
25
|
+
} = ownerState;
|
|
26
|
+
const slots = {
|
|
27
|
+
root: ['scrollArea', `scrollArea--${scrollDirection}`]
|
|
28
|
+
};
|
|
29
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
30
|
+
};
|
|
31
|
+
const GridScrollAreaRawRoot = styled('div', {
|
|
32
|
+
name: 'MuiDataGrid',
|
|
33
|
+
slot: 'ScrollArea',
|
|
34
|
+
overridesResolver: (props, styles) => [{
|
|
35
|
+
[`&.${gridClasses['scrollArea--left']}`]: styles['scrollArea--left']
|
|
36
|
+
}, {
|
|
37
|
+
[`&.${gridClasses['scrollArea--right']}`]: styles['scrollArea--right']
|
|
38
|
+
}, styles.scrollArea]
|
|
39
|
+
})(() => ({
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 0,
|
|
42
|
+
zIndex: 101,
|
|
43
|
+
width: 20,
|
|
44
|
+
bottom: 0,
|
|
45
|
+
[`&.${gridClasses['scrollArea--left']}`]: {
|
|
46
|
+
left: 0
|
|
47
|
+
},
|
|
48
|
+
[`&.${gridClasses['scrollArea--right']}`]: {
|
|
49
|
+
right: 0
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
function GridScrollAreaRaw(props) {
|
|
53
|
+
const {
|
|
54
|
+
scrollDirection
|
|
55
|
+
} = props;
|
|
56
|
+
const rootRef = React.useRef(null);
|
|
57
|
+
const apiRef = useGridApiContext();
|
|
58
|
+
const timeout = useTimeout();
|
|
59
|
+
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
60
|
+
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
61
|
+
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
62
|
+
const scrollPosition = React.useRef({
|
|
63
|
+
left: 0,
|
|
64
|
+
top: 0
|
|
65
|
+
});
|
|
66
|
+
const getCanScrollMore = () => {
|
|
67
|
+
if (scrollDirection === 'left') {
|
|
68
|
+
// Only render if the user has not reached yet the start of the list
|
|
69
|
+
return scrollPosition.current.left > 0;
|
|
70
|
+
}
|
|
71
|
+
if (scrollDirection === 'right') {
|
|
72
|
+
// Only render if the user has not reached yet the end of the list
|
|
73
|
+
const maxScrollLeft = columnsTotalWidth - dimensions.viewportInnerSize.width;
|
|
74
|
+
return scrollPosition.current.left < maxScrollLeft;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
};
|
|
78
|
+
const [dragging, setDragging] = React.useState(false);
|
|
79
|
+
const [canScrollMore, setCanScrollMore] = React.useState(getCanScrollMore);
|
|
80
|
+
const rootProps = useGridRootProps();
|
|
81
|
+
const ownerState = _extends({}, rootProps, {
|
|
82
|
+
scrollDirection
|
|
83
|
+
});
|
|
84
|
+
const classes = useUtilityClasses(ownerState);
|
|
85
|
+
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
|
|
86
|
+
const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
|
|
87
|
+
const style = {
|
|
88
|
+
height: headerHeight,
|
|
89
|
+
top: totalHeaderHeight - headerHeight
|
|
90
|
+
};
|
|
91
|
+
if (scrollDirection === 'left') {
|
|
92
|
+
style.left = dimensions.leftPinnedWidth;
|
|
93
|
+
} else if (scrollDirection === 'right') {
|
|
94
|
+
style.right = dimensions.rightPinnedWidth + (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
|
|
95
|
+
}
|
|
96
|
+
const handleScrolling = newScrollPosition => {
|
|
97
|
+
scrollPosition.current = newScrollPosition;
|
|
98
|
+
setCanScrollMore(getCanScrollMore);
|
|
99
|
+
};
|
|
100
|
+
const handleDragOver = useEventCallback(event => {
|
|
101
|
+
let offset;
|
|
102
|
+
|
|
103
|
+
// Prevents showing the forbidden cursor
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
if (scrollDirection === 'left') {
|
|
106
|
+
offset = event.clientX - rootRef.current.getBoundingClientRect().right;
|
|
107
|
+
} else if (scrollDirection === 'right') {
|
|
108
|
+
offset = Math.max(1, event.clientX - rootRef.current.getBoundingClientRect().left);
|
|
109
|
+
} else {
|
|
110
|
+
throw new Error('MUI X: Wrong drag direction');
|
|
111
|
+
}
|
|
112
|
+
offset = (offset - CLIFF) * SLOP + CLIFF;
|
|
113
|
+
|
|
114
|
+
// Avoid freeze and inertia.
|
|
115
|
+
timeout.start(0, () => {
|
|
116
|
+
apiRef.current.scroll({
|
|
117
|
+
left: scrollPosition.current.left + offset,
|
|
118
|
+
top: scrollPosition.current.top
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
const handleColumnHeaderDragStart = useEventCallback(() => {
|
|
123
|
+
setDragging(true);
|
|
124
|
+
});
|
|
125
|
+
const handleColumnHeaderDragEnd = useEventCallback(() => {
|
|
126
|
+
setDragging(false);
|
|
127
|
+
});
|
|
128
|
+
useGridApiEventHandler(apiRef, 'scrollPositionChange', handleScrolling);
|
|
129
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragStart', handleColumnHeaderDragStart);
|
|
130
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', handleColumnHeaderDragEnd);
|
|
131
|
+
if (!dragging || !canScrollMore) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
|
|
135
|
+
ref: rootRef,
|
|
136
|
+
className: clsx(classes.root),
|
|
137
|
+
ownerState: ownerState,
|
|
138
|
+
onDragOver: handleDragOver,
|
|
139
|
+
style: style
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
process.env.NODE_ENV !== "production" ? GridScrollAreaRaw.propTypes = {
|
|
143
|
+
// ----------------------------- Warning --------------------------------
|
|
144
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
145
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
146
|
+
// ----------------------------------------------------------------------
|
|
147
|
+
scrollDirection: PropTypes.oneOf(['left', 'right']).isRequired
|
|
148
|
+
} : void 0;
|
|
149
|
+
const GridScrollArea = fastMemo(GridScrollAreaRaw);
|
|
150
|
+
export { GridScrollArea };
|
|
@@ -3,10 +3,9 @@ import * as React from 'react';
|
|
|
3
3
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
export function GridFooterPlaceholder() {
|
|
6
|
-
var _rootProps$slotProps;
|
|
7
6
|
const rootProps = useGridRootProps();
|
|
8
7
|
if (rootProps.hideFooter) {
|
|
9
8
|
return null;
|
|
10
9
|
}
|
|
11
|
-
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({},
|
|
10
|
+
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, rootProps.slotProps?.footer /* FIXME: typing error */));
|
|
12
11
|
}
|
|
@@ -91,18 +91,15 @@ export function GridOverlays() {
|
|
|
91
91
|
let overlay = null;
|
|
92
92
|
let overlayType = '';
|
|
93
93
|
if (showNoRowsOverlay) {
|
|
94
|
-
|
|
95
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.noRowsOverlay, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.noRowsOverlay));
|
|
94
|
+
overlay = /*#__PURE__*/_jsx(rootProps.slots.noRowsOverlay, _extends({}, rootProps.slotProps?.noRowsOverlay));
|
|
96
95
|
overlayType = 'noRowsOverlay';
|
|
97
96
|
}
|
|
98
97
|
if (showNoResultsOverlay) {
|
|
99
|
-
|
|
100
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.noResultsOverlay, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.noResultsOverlay));
|
|
98
|
+
overlay = /*#__PURE__*/_jsx(rootProps.slots.noResultsOverlay, _extends({}, rootProps.slotProps?.noResultsOverlay));
|
|
101
99
|
overlayType = 'noResultsOverlay';
|
|
102
100
|
}
|
|
103
101
|
if (loading) {
|
|
104
|
-
|
|
105
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.loadingOverlay, _extends({}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.loadingOverlay));
|
|
102
|
+
overlay = /*#__PURE__*/_jsx(rootProps.slots.loadingOverlay, _extends({}, rootProps.slotProps?.loadingOverlay));
|
|
106
103
|
overlayType = 'loadingOverlay';
|
|
107
104
|
}
|
|
108
105
|
if (overlay === null) {
|
|
@@ -14,7 +14,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
16
16
|
function GridActionsCell(props) {
|
|
17
|
-
var _rootProps$slotProps;
|
|
18
17
|
const {
|
|
19
18
|
colDef,
|
|
20
19
|
id,
|
|
@@ -45,7 +44,7 @@ function GridActionsCell(props) {
|
|
|
45
44
|
React.useLayoutEffect(() => {
|
|
46
45
|
if (!hasFocus) {
|
|
47
46
|
Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
|
|
48
|
-
ref
|
|
47
|
+
ref?.stop({}, () => {
|
|
49
48
|
delete touchRippleRefs.current[index];
|
|
50
49
|
});
|
|
51
50
|
});
|
|
@@ -107,7 +106,6 @@ function GridActionsCell(props) {
|
|
|
107
106
|
return;
|
|
108
107
|
}
|
|
109
108
|
const getNewIndex = (index, direction) => {
|
|
110
|
-
var _options;
|
|
111
109
|
if (index < 0 || index > options.length) {
|
|
112
110
|
return index;
|
|
113
111
|
}
|
|
@@ -117,7 +115,7 @@ function GridActionsCell(props) {
|
|
|
117
115
|
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
118
116
|
|
|
119
117
|
// if the button that should receive focus is disabled go one more step
|
|
120
|
-
return
|
|
118
|
+
return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
121
119
|
};
|
|
122
120
|
let newIndex = focusedButtonIndex;
|
|
123
121
|
if (event.key === 'ArrowRight') {
|
|
@@ -130,7 +128,7 @@ function GridActionsCell(props) {
|
|
|
130
128
|
}
|
|
131
129
|
if (newIndex !== focusedButtonIndex) {
|
|
132
130
|
event.preventDefault(); // Prevent scrolling
|
|
133
|
-
event.stopPropagation(); // Don't stop propagation for other keys,
|
|
131
|
+
event.stopPropagation(); // Don't stop propagation for other keys, for example ArrowUp
|
|
134
132
|
setFocusedButtonIndex(newIndex);
|
|
135
133
|
}
|
|
136
134
|
};
|
|
@@ -166,7 +164,7 @@ function GridActionsCell(props) {
|
|
|
166
164
|
onClick: showMenu,
|
|
167
165
|
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
168
166
|
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
|
|
169
|
-
},
|
|
167
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
170
168
|
children: /*#__PURE__*/_jsx(rootProps.slots.moreActionsIcon, {
|
|
171
169
|
fontSize: "small"
|
|
172
170
|
})
|