@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
|
@@ -67,6 +67,21 @@ DataGridRaw.propTypes = {
|
|
|
67
67
|
* @default false
|
|
68
68
|
*/
|
|
69
69
|
autoPageSize: PropTypes.bool,
|
|
70
|
+
/**
|
|
71
|
+
* If `true`, columns are autosized after the datagrid is mounted.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
autosizeOnMount: PropTypes.bool,
|
|
75
|
+
/**
|
|
76
|
+
* The options for autosize when user-initiated.
|
|
77
|
+
*/
|
|
78
|
+
autosizeOptions: PropTypes.shape({
|
|
79
|
+
columns: PropTypes.arrayOf(PropTypes.string),
|
|
80
|
+
expand: PropTypes.bool,
|
|
81
|
+
includeHeaders: PropTypes.bool,
|
|
82
|
+
includeOutliers: PropTypes.bool,
|
|
83
|
+
outliersFactor: PropTypes.number
|
|
84
|
+
}),
|
|
70
85
|
/**
|
|
71
86
|
* Controls the modes of the cells.
|
|
72
87
|
*/
|
|
@@ -86,10 +101,10 @@ DataGridRaw.propTypes = {
|
|
|
86
101
|
*/
|
|
87
102
|
clipboardCopyCellDelimiter: PropTypes.string,
|
|
88
103
|
/**
|
|
89
|
-
*
|
|
90
|
-
* @default
|
|
104
|
+
* Column region in pixels to render before/after the viewport
|
|
105
|
+
* @default 150
|
|
91
106
|
*/
|
|
92
|
-
|
|
107
|
+
columnBufferPx: PropTypes.number,
|
|
93
108
|
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
94
109
|
/**
|
|
95
110
|
* Sets the height in pixel of the column headers in the Data Grid.
|
|
@@ -100,11 +115,6 @@ DataGridRaw.propTypes = {
|
|
|
100
115
|
* Set of columns of type [[GridColDef]][].
|
|
101
116
|
*/
|
|
102
117
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
103
|
-
/**
|
|
104
|
-
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
105
|
-
* @default 3
|
|
106
|
-
*/
|
|
107
|
-
columnThreshold: PropTypes.number,
|
|
108
118
|
/**
|
|
109
119
|
* Set the column visibility model of the Data Grid.
|
|
110
120
|
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
@@ -115,6 +125,11 @@ DataGridRaw.propTypes = {
|
|
|
115
125
|
* @default "standard"
|
|
116
126
|
*/
|
|
117
127
|
density: PropTypes.oneOf(['comfortable', 'compact', 'standard']),
|
|
128
|
+
/**
|
|
129
|
+
* If `true`, column autosizing on header separator double-click is disabled.
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
disableAutosize: PropTypes.bool,
|
|
118
133
|
/**
|
|
119
134
|
* If `true`, column filters are disabled.
|
|
120
135
|
* @default false
|
|
@@ -125,6 +140,11 @@ DataGridRaw.propTypes = {
|
|
|
125
140
|
* @default false
|
|
126
141
|
*/
|
|
127
142
|
disableColumnMenu: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* If `true`, resizing columns is disabled.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
disableColumnResize: PropTypes.bool,
|
|
128
148
|
/**
|
|
129
149
|
* If `true`, hiding/showing columns is disabled.
|
|
130
150
|
* @default false
|
|
@@ -422,12 +442,31 @@ DataGridRaw.propTypes = {
|
|
|
422
442
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
423
443
|
*/
|
|
424
444
|
onColumnOrderChange: PropTypes.func,
|
|
445
|
+
/**
|
|
446
|
+
* Callback fired while a column is being resized.
|
|
447
|
+
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
448
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
449
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
450
|
+
*/
|
|
451
|
+
onColumnResize: PropTypes.func,
|
|
425
452
|
/**
|
|
426
453
|
* Callback fired when the column visibility model changes.
|
|
427
454
|
* @param {GridColumnVisibilityModel} model The new model.
|
|
428
455
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
429
456
|
*/
|
|
430
457
|
onColumnVisibilityModelChange: PropTypes.func,
|
|
458
|
+
/**
|
|
459
|
+
* Callback fired when the width of a column is changed.
|
|
460
|
+
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
461
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
462
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
463
|
+
*/
|
|
464
|
+
onColumnWidthChange: PropTypes.func,
|
|
465
|
+
/**
|
|
466
|
+
* Callback fired when the density changes.
|
|
467
|
+
* @param {GridDensity} density New density value.
|
|
468
|
+
*/
|
|
469
|
+
onDensityChange: PropTypes.func,
|
|
431
470
|
/**
|
|
432
471
|
* Callback fired when the Filter model changes before the filters are applied.
|
|
433
472
|
* @param {GridFilterModel} model With all properties from [[GridFilterModel]].
|
|
@@ -488,6 +527,11 @@ DataGridRaw.propTypes = {
|
|
|
488
527
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
489
528
|
*/
|
|
490
529
|
onRowClick: PropTypes.func,
|
|
530
|
+
/**
|
|
531
|
+
* Callback fired when the row count has changed.
|
|
532
|
+
* @param {number} count Updated row count.
|
|
533
|
+
*/
|
|
534
|
+
onRowCountChange: PropTypes.func,
|
|
491
535
|
/**
|
|
492
536
|
* Callback fired when a double click event comes from a row container element.
|
|
493
537
|
* @param {GridRowParams} params With all properties from [[RowParams]].
|
|
@@ -565,10 +609,10 @@ DataGridRaw.propTypes = {
|
|
|
565
609
|
*/
|
|
566
610
|
processRowUpdate: PropTypes.func,
|
|
567
611
|
/**
|
|
568
|
-
*
|
|
569
|
-
* @default
|
|
612
|
+
* Row region in pixels to render before/after the viewport
|
|
613
|
+
* @default 150
|
|
570
614
|
*/
|
|
571
|
-
|
|
615
|
+
rowBufferPx: PropTypes.number,
|
|
572
616
|
/**
|
|
573
617
|
* Set the total number of rows, if it is different from the length of the value `rows` prop.
|
|
574
618
|
* If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
|
|
@@ -592,8 +636,9 @@ DataGridRaw.propTypes = {
|
|
|
592
636
|
rowPositionsDebounceMs: PropTypes.number,
|
|
593
637
|
/**
|
|
594
638
|
* Set of rows of type [[GridRowsProp]].
|
|
639
|
+
* @default []
|
|
595
640
|
*/
|
|
596
|
-
rows: PropTypes.arrayOf(PropTypes.object)
|
|
641
|
+
rows: PropTypes.arrayOf(PropTypes.object),
|
|
597
642
|
/**
|
|
598
643
|
* If `false`, the row selection mode is disabled.
|
|
599
644
|
* @default true
|
|
@@ -608,11 +653,6 @@ DataGridRaw.propTypes = {
|
|
|
608
653
|
* @default "margin"
|
|
609
654
|
*/
|
|
610
655
|
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
611
|
-
/**
|
|
612
|
-
* Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
|
|
613
|
-
* @default 3
|
|
614
|
-
*/
|
|
615
|
-
rowThreshold: PropTypes.number,
|
|
616
656
|
/**
|
|
617
657
|
* Override the height/width of the Data Grid inner scrollbar.
|
|
618
658
|
*/
|
|
@@ -26,6 +26,7 @@ import { useGridStatePersistence } from '../hooks/features/statePersistence/useG
|
|
|
26
26
|
import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
27
27
|
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
28
28
|
import { useGridVirtualization, virtualizationStateInitializer } from '../hooks/features/virtualization';
|
|
29
|
+
import { columnResizeStateInitializer, useGridColumnResize } from '../hooks/features/columnResize/useGridColumnResize';
|
|
29
30
|
export const useDataGridComponent = (inputApiRef, props) => {
|
|
30
31
|
const apiRef = useGridInitialization(inputApiRef, props);
|
|
31
32
|
|
|
@@ -48,6 +49,7 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
48
49
|
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
49
50
|
useGridInitializeState(filterStateInitializer, apiRef, props);
|
|
50
51
|
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
52
|
+
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
|
|
51
53
|
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
52
54
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
53
55
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
@@ -66,6 +68,7 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
66
68
|
useGridFilter(apiRef, props);
|
|
67
69
|
useGridSorting(apiRef, props);
|
|
68
70
|
useGridDensity(apiRef, props);
|
|
71
|
+
useGridColumnResize(apiRef, props);
|
|
69
72
|
useGridPagination(apiRef, props);
|
|
70
73
|
useGridRowsMeta(apiRef, props);
|
|
71
74
|
useGridScroll(apiRef, props);
|
|
@@ -13,7 +13,6 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
13
13
|
pagination: true,
|
|
14
14
|
checkboxSelectionVisibleOnly: false,
|
|
15
15
|
disableColumnReorder: true,
|
|
16
|
-
disableColumnResize: true,
|
|
17
16
|
keepColumnPositionIfDraggedOutside: false,
|
|
18
17
|
signature: 'DataGrid'
|
|
19
18
|
};
|
|
@@ -26,12 +25,10 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
26
25
|
autoPageSize: false,
|
|
27
26
|
checkboxSelection: false,
|
|
28
27
|
checkboxSelectionVisibleOnly: false,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rowThreshold: 3,
|
|
28
|
+
columnBufferPx: 150,
|
|
29
|
+
rowBufferPx: 150,
|
|
30
|
+
rows: [],
|
|
33
31
|
rowSelection: true,
|
|
34
|
-
density: 'standard',
|
|
35
32
|
disableColumnFilter: false,
|
|
36
33
|
disableColumnMenu: false,
|
|
37
34
|
disableColumnSelector: false,
|
|
@@ -70,7 +67,9 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
70
67
|
keepColumnPositionIfDraggedOutside: false,
|
|
71
68
|
ignoreValueFormatterDuringExport: false,
|
|
72
69
|
clipboardCopyCellDelimiter: '\t',
|
|
73
|
-
rowPositionsDebounceMs: 166
|
|
70
|
+
rowPositionsDebounceMs: 166,
|
|
71
|
+
autosizeOnMount: false,
|
|
72
|
+
disableAutosize: false
|
|
74
73
|
};
|
|
75
74
|
const defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
76
75
|
export const useDataGridProps = inProps => {
|
|
@@ -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;
|
|
@@ -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,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,12 +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(() => rootProps.rowCount ?? visibleTopLevelRowCount ?? 0, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
34
|
+
const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
|
|
36
35
|
const lastPage = React.useMemo(() => {
|
|
37
36
|
const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
|
|
38
37
|
return Math.max(0, calculatedValue);
|
|
@@ -81,4 +80,12 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
81
80
|
onPageChange: handlePageChange,
|
|
82
81
|
onRowsPerPageChange: handlePageSizeChange
|
|
83
82
|
}, apiRef.current.getLocaleText('MuiTablePagination'), props));
|
|
84
|
-
});
|
|
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 };
|
|
@@ -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 => {
|
|
@@ -251,21 +252,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
251
252
|
}
|
|
252
253
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
253
254
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
254
|
-
|
|
255
|
-
// FIXME: Why is the switch check exhaustiveness not validated with typescript-eslint?
|
|
256
|
-
// eslint-disable-next-line default-case
|
|
257
|
-
switch (pinnedPosition) {
|
|
258
|
-
case PinnedPosition.LEFT:
|
|
259
|
-
pinnedOffset = columnPositions[indexRelativeToAllColumns];
|
|
260
|
-
break;
|
|
261
|
-
case PinnedPosition.RIGHT:
|
|
262
|
-
pinnedOffset = dimensions.columnsTotalWidth - columnPositions[indexRelativeToAllColumns] - column.computedWidth + scrollbarWidth;
|
|
263
|
-
break;
|
|
264
|
-
case PinnedPosition.NONE:
|
|
265
|
-
case PinnedPosition.VIRTUAL:
|
|
266
|
-
pinnedOffset = 0;
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
255
|
+
const pinnedOffset = getPinnedCellOffset(gridPinnedColumnPositionLookup[pinnedPosition], column.computedWidth, indexRelativeToAllColumns, columnPositions, dimensions);
|
|
269
256
|
if (rowNode?.type === 'skeletonRow') {
|
|
270
257
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
271
258
|
width: width,
|
|
@@ -357,9 +344,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
357
344
|
width: emptyCellWidth
|
|
358
345
|
}), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
359
346
|
role: "presentation",
|
|
360
|
-
|
|
361
|
-
flex: '1'
|
|
362
|
-
}
|
|
347
|
+
className: gridClasses.filler
|
|
363
348
|
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
364
349
|
pinnedRight: pinnedColumns.right.length > 0
|
|
365
350
|
})]
|
|
@@ -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 };
|
|
@@ -128,7 +128,7 @@ function GridActionsCell(props) {
|
|
|
128
128
|
}
|
|
129
129
|
if (newIndex !== focusedButtonIndex) {
|
|
130
130
|
event.preventDefault(); // Prevent scrolling
|
|
131
|
-
event.stopPropagation(); // Don't stop propagation for other keys,
|
|
131
|
+
event.stopPropagation(); // Don't stop propagation for other keys, for example ArrowUp
|
|
132
132
|
setFocusedButtonIndex(newIndex);
|
|
133
133
|
}
|
|
134
134
|
};
|
|
@@ -62,6 +62,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
|
62
62
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
63
63
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
64
64
|
// ----------------------------------------------------------------------
|
|
65
|
+
/**
|
|
66
|
+
* from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component
|
|
67
|
+
*/
|
|
68
|
+
component: PropTypes.elementType,
|
|
65
69
|
icon: PropTypes.element,
|
|
66
70
|
label: PropTypes.string.isRequired,
|
|
67
71
|
showInMenu: PropTypes.bool
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex"];
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "hideDescendantCount"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -76,6 +76,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
76
76
|
* If true, the cell is the active element.
|
|
77
77
|
*/
|
|
78
78
|
hasFocus: PropTypes.bool.isRequired,
|
|
79
|
+
hideDescendantCount: PropTypes.bool,
|
|
79
80
|
/**
|
|
80
81
|
* The grid row id.
|
|
81
82
|
*/
|
|
@@ -105,7 +106,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
105
106
|
const GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
|
|
106
107
|
export { GridBooleanCell };
|
|
107
108
|
export const renderBooleanCell = params => {
|
|
108
|
-
if (isAutoGeneratedRow(params.rowNode)) {
|
|
109
|
+
if (params.field !== '__row_group_by_columns_group__' && isAutoGeneratedRow(params.rowNode)) {
|
|
109
110
|
return '';
|
|
110
111
|
}
|
|
111
112
|
return /*#__PURE__*/_jsx(GridBooleanCell, _extends({}, params));
|
|
@@ -15,6 +15,8 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
15
15
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
16
16
|
import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
17
17
|
import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
|
|
18
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
19
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
18
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
21
|
export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
20
22
|
PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
|
|
@@ -23,6 +25,12 @@ export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
|
23
25
|
PinnedPosition[PinnedPosition["VIRTUAL"] = 3] = "VIRTUAL";
|
|
24
26
|
return PinnedPosition;
|
|
25
27
|
}({});
|
|
28
|
+
export const gridPinnedColumnPositionLookup = {
|
|
29
|
+
[PinnedPosition.LEFT]: GridPinnedColumnPosition.LEFT,
|
|
30
|
+
[PinnedPosition.RIGHT]: GridPinnedColumnPosition.RIGHT,
|
|
31
|
+
[PinnedPosition.NONE]: undefined,
|
|
32
|
+
[PinnedPosition.VIRTUAL]: undefined
|
|
33
|
+
};
|
|
26
34
|
const EMPTY_CELL_PARAMS = {
|
|
27
35
|
id: -1,
|
|
28
36
|
field: '__unset__',
|
|
@@ -153,9 +161,9 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
153
161
|
const focusElementRef = React.useRef(null);
|
|
154
162
|
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
155
163
|
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
156
|
-
const
|
|
157
|
-
const showLeftBorder =
|
|
158
|
-
const showRightBorder =
|
|
164
|
+
const position = gridPinnedColumnPositionLookup[pinnedPosition];
|
|
165
|
+
const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
|
|
166
|
+
const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
|
|
159
167
|
const ownerState = {
|
|
160
168
|
align,
|
|
161
169
|
showLeftBorder,
|
|
@@ -23,6 +23,7 @@ const GridColumnHeadersRoot = styled('div', {
|
|
|
23
23
|
overridesResolver: (props, styles) => styles.columnHeaders
|
|
24
24
|
})({
|
|
25
25
|
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
26
27
|
borderTopLeftRadius: 'var(--unstable_DataGrid-radius)',
|
|
27
28
|
borderTopRightRadius: 'var(--unstable_DataGrid-radius)'
|
|
28
29
|
});
|