@mui/x-data-grid 7.0.0-beta.5 → 7.0.0-beta.7
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 +252 -50
- package/DataGrid/DataGrid.js +44 -0
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +3 -2
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.js +2 -7
- package/components/GridPinnedRows.d.ts +1 -2
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +9 -26
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/cell/GridCell.d.ts +7 -2
- package/components/cell/GridCell.js +14 -10
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/components/containers/GridRootStyles.js +12 -22
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +11 -4
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- 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/pipeProcessing/useGridPipeProcessing.js +22 -20
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -99
- 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 +563 -0
- package/hooks/features/columns/gridColumnsUtils.js +4 -1
- package/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/hooks/features/editing/useGridCellEditing.js +21 -2
- package/hooks/features/export/useGridPrintExport.js +8 -7
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +30 -7
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -157
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +170 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +97 -0
- package/hooks/features/rows/useGridParamsApi.js +6 -10
- package/hooks/features/scroll/useGridScroll.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +2 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +6 -0
- 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 +2 -2
- package/internals/index.js +2 -2
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/joy/joySlots.js +13 -52
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridCoreApi.d.ts +1 -5
- package/models/api/gridInfiniteLoaderApi.d.ts +6 -0
- package/models/api/gridInfiniteLoaderApi.js +1 -0
- package/models/events/gridEventLookup.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +35 -1
- package/modern/DataGrid/DataGrid.js +44 -0
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +3 -2
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +2 -4
- package/modern/components/GridRow.js +9 -26
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridCell.js +14 -10
- 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/GridRootStyles.js +12 -22
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +11 -4
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +22 -20
- 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 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +21 -2
- package/modern/hooks/features/export/useGridPrintExport.js +8 -7
- 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/rows/useGridParamsApi.js +6 -10
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +2 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -0
- 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 -2
- 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/gridInfiniteLoaderApi.js +1 -0
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +12 -20
- package/modern/utils/domUtils.js +144 -0
- package/node/DataGrid/DataGrid.js +44 -0
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +3 -2
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +1 -3
- package/node/components/GridRow.js +8 -25
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridCell.js +15 -11
- 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/GridRootStyles.js +12 -22
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +11 -4
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +22 -20
- 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 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/node/hooks/features/editing/useGridCellEditing.js +21 -2
- package/node/hooks/features/export/useGridPrintExport.js +8 -7
- 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/rows/useGridParamsApi.js +6 -10
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +2 -2
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +5 -0
- 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 +15 -15
- 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/gridInfiniteLoaderApi.js +5 -0
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +14 -23
- package/node/utils/domUtils.js +155 -0
- package/package.json +2 -2
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.d.ts +0 -1
- package/utils/createSelector.js +12 -22
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +147 -0
- 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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { gridFilteredTopLevelRowCountSelector } from '../filter';
|
|
4
|
+
import { useGridLogger, useGridSelector, useGridApiMethod } from '../../utils';
|
|
5
|
+
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
6
|
+
import { gridPaginationRowCountSelector } from './gridPaginationSelector';
|
|
7
|
+
import { noRowCountInServerMode } from './gridPaginationUtils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @requires useGridFilter (state)
|
|
11
|
+
* @requires useGridDimensions (event) - can be after
|
|
12
|
+
*/
|
|
13
|
+
export const useGridRowCount = (apiRef, props) => {
|
|
14
|
+
var _props$initialState2;
|
|
15
|
+
const logger = useGridLogger(apiRef, 'useGridRowCount');
|
|
16
|
+
const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
|
|
17
|
+
const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
|
|
18
|
+
apiRef.current.registerControlState({
|
|
19
|
+
stateId: 'paginationRowCount',
|
|
20
|
+
propModel: props.rowCount,
|
|
21
|
+
propOnChange: props.onRowCountChange,
|
|
22
|
+
stateSelector: gridPaginationRowCountSelector,
|
|
23
|
+
changeEvent: 'rowCountChange'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* API METHODS
|
|
28
|
+
*/
|
|
29
|
+
const setRowCount = React.useCallback(newRowCount => {
|
|
30
|
+
if (rowCount === newRowCount) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
logger.debug("Setting 'rowCount' to", newRowCount);
|
|
34
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
35
|
+
pagination: _extends({}, state.pagination, {
|
|
36
|
+
rowCount: newRowCount
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
}, [apiRef, logger, rowCount]);
|
|
40
|
+
const paginationRowCountApi = {
|
|
41
|
+
setRowCount
|
|
42
|
+
};
|
|
43
|
+
useGridApiMethod(apiRef, paginationRowCountApi, 'public');
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* PRE-PROCESSING
|
|
47
|
+
*/
|
|
48
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
49
|
+
var _props$initialState;
|
|
50
|
+
const exportedRowCount = gridPaginationRowCountSelector(apiRef);
|
|
51
|
+
const shouldExportRowCount =
|
|
52
|
+
// Always export if the `exportOnlyDirtyModels` property is not activated
|
|
53
|
+
!context.exportOnlyDirtyModels ||
|
|
54
|
+
// Always export if the `rowCount` is controlled
|
|
55
|
+
props.rowCount != null ||
|
|
56
|
+
// Always export if the `rowCount` has been initialized
|
|
57
|
+
((_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.pagination) == null ? void 0 : _props$initialState.rowCount) != null;
|
|
58
|
+
if (!shouldExportRowCount) {
|
|
59
|
+
return prevState;
|
|
60
|
+
}
|
|
61
|
+
return _extends({}, prevState, {
|
|
62
|
+
pagination: _extends({}, prevState.pagination, {
|
|
63
|
+
rowCount: exportedRowCount
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}, [apiRef, props.rowCount, (_props$initialState2 = props.initialState) == null || (_props$initialState2 = _props$initialState2.pagination) == null ? void 0 : _props$initialState2.rowCount]);
|
|
67
|
+
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
68
|
+
var _context$stateToResto;
|
|
69
|
+
const restoredRowCount = (_context$stateToResto = context.stateToRestore.pagination) != null && _context$stateToResto.rowCount ? context.stateToRestore.pagination.rowCount : gridPaginationRowCountSelector(apiRef);
|
|
70
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
71
|
+
pagination: _extends({}, state.pagination, {
|
|
72
|
+
rowCount: restoredRowCount
|
|
73
|
+
})
|
|
74
|
+
}));
|
|
75
|
+
return params;
|
|
76
|
+
}, [apiRef]);
|
|
77
|
+
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
78
|
+
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* EFFECTS
|
|
82
|
+
*/
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
85
|
+
if (props.paginationMode === 'server' && props.rowCount == null) {
|
|
86
|
+
noRowCountInServerMode();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, [props.rowCount, props.paginationMode]);
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
if (props.paginationMode === 'client') {
|
|
92
|
+
apiRef.current.setRowCount(visibleTopLevelRowCount);
|
|
93
|
+
} else if (props.rowCount != null) {
|
|
94
|
+
apiRef.current.setRowCount(props.rowCount);
|
|
95
|
+
}
|
|
96
|
+
}, [apiRef, visibleTopLevelRowCount, props.paginationMode, props.rowCount]);
|
|
97
|
+
};
|
|
@@ -31,12 +31,13 @@ export function useGridParamsApi(apiRef) {
|
|
|
31
31
|
}, [apiRef]);
|
|
32
32
|
const getCellParams = React.useCallback((id, field) => {
|
|
33
33
|
const colDef = apiRef.current.getColumn(field);
|
|
34
|
-
const value = apiRef.current.getCellValue(id, field);
|
|
35
34
|
const row = apiRef.current.getRow(id);
|
|
36
35
|
const rowNode = apiRef.current.getRowNode(id);
|
|
37
36
|
if (!row || !rowNode) {
|
|
38
37
|
throw new MissingRowIdError(`No row with id #${id} found`);
|
|
39
38
|
}
|
|
39
|
+
const rawValue = row[field];
|
|
40
|
+
const value = colDef != null && colDef.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
|
|
40
41
|
const cellFocus = gridFocusCellSelector(apiRef);
|
|
41
42
|
const cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
42
43
|
const params = {
|
|
@@ -60,19 +61,14 @@ export function useGridParamsApi(apiRef) {
|
|
|
60
61
|
}, [apiRef]);
|
|
61
62
|
const getCellValue = React.useCallback((id, field) => {
|
|
62
63
|
const colDef = apiRef.current.getColumn(field);
|
|
63
|
-
if (!colDef || !colDef.valueGetter) {
|
|
64
|
-
const rowModel = apiRef.current.getRow(id);
|
|
65
|
-
if (!rowModel) {
|
|
66
|
-
throw new MissingRowIdError(`No row with id #${id} found`);
|
|
67
|
-
}
|
|
68
|
-
return rowModel[field];
|
|
69
|
-
}
|
|
70
64
|
const row = apiRef.current.getRow(id);
|
|
71
65
|
if (!row) {
|
|
72
66
|
throw new MissingRowIdError(`No row with id #${id} found`);
|
|
73
67
|
}
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
if (!colDef || !colDef.valueGetter) {
|
|
69
|
+
return row[field];
|
|
70
|
+
}
|
|
71
|
+
return colDef.valueGetter(row[colDef.field], row, colDef, apiRef);
|
|
76
72
|
}, [apiRef]);
|
|
77
73
|
const getRowValue = React.useCallback((row, colDef) => {
|
|
78
74
|
const field = colDef.field;
|
|
@@ -45,7 +45,7 @@ function scrollIntoView(dimensions) {
|
|
|
45
45
|
export const useGridScroll = (apiRef, props) => {
|
|
46
46
|
const theme = useTheme();
|
|
47
47
|
const logger = useGridLogger(apiRef, 'useGridScroll');
|
|
48
|
-
const colRef = apiRef.current.
|
|
48
|
+
const colRef = apiRef.current.columnHeadersContainerRef;
|
|
49
49
|
const virtualScrollerRef = apiRef.current.virtualScrollerRef;
|
|
50
50
|
const visibleSortedRows = useGridSelector(apiRef, gridExpandedSortedRowEntriesSelector);
|
|
51
51
|
const scrollToIndexes = React.useCallback(params => {
|
|
@@ -42,7 +42,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
42
42
|
const existingIdx = sortModel.findIndex(c => c.field === field);
|
|
43
43
|
let newSortModel = [...sortModel];
|
|
44
44
|
if (existingIdx > -1) {
|
|
45
|
-
if (
|
|
45
|
+
if ((sortItem == null ? void 0 : sortItem.sort) == null) {
|
|
46
46
|
newSortModel.splice(existingIdx, 1);
|
|
47
47
|
} else {
|
|
48
48
|
newSortModel.splice(existingIdx, 1, sortItem);
|
|
@@ -120,7 +120,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
120
120
|
const sortItem = createSortItem(column, direction);
|
|
121
121
|
let sortModel;
|
|
122
122
|
if (!allowMultipleSorting || props.disableMultipleColumnsSorting) {
|
|
123
|
-
sortModel =
|
|
123
|
+
sortModel = (sortItem == null ? void 0 : sortItem.sort) == null ? [] : [sortItem];
|
|
124
124
|
} else {
|
|
125
125
|
sortModel = upsertSortModel(column.field, sortItem);
|
|
126
126
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
1
|
+
import type { GridColumnsRenderContext } from '../../../models/params/gridScrollParams';
|
|
2
|
+
import type { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
3
3
|
/**
|
|
4
4
|
* Get the columns state
|
|
5
5
|
* @category Virtualization
|
|
@@ -20,11 +20,11 @@ export declare const gridVirtualizationColumnEnabledSelector: import("../../../u
|
|
|
20
20
|
* @category Virtualization
|
|
21
21
|
* @ignore - do not document.
|
|
22
22
|
*/
|
|
23
|
-
export declare const gridRenderContextSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRenderContext>;
|
|
23
|
+
export declare const gridRenderContextSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/params/gridScrollParams").GridRenderContext>;
|
|
24
24
|
/**
|
|
25
25
|
* Get the render context, with only columns filled in.
|
|
26
26
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
27
27
|
* @category Virtualization
|
|
28
28
|
* @ignore - do not document.
|
|
29
29
|
*/
|
|
30
|
-
export declare const gridRenderContextColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity,
|
|
30
|
+
export declare const gridRenderContextColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridColumnsRenderContext>;
|
|
@@ -31,8 +31,6 @@ export const gridRenderContextSelector = createSelector(gridVirtualizationSelect
|
|
|
31
31
|
* @ignore - do not document.
|
|
32
32
|
*/
|
|
33
33
|
export const gridRenderContextColumnsSelector = createSelectorMemoized(state => state.virtualization.renderContext.firstColumnIndex, state => state.virtualization.renderContext.lastColumnIndex, (firstColumnIndex, lastColumnIndex) => ({
|
|
34
|
-
firstRowIndex: -1,
|
|
35
|
-
lastRowIndex: -1,
|
|
36
34
|
firstColumnIndex,
|
|
37
35
|
lastColumnIndex
|
|
38
36
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { GridPinnedRowsPosition } from '../rows/gridRowsInterfaces';
|
|
4
|
-
import { GridRenderContext, GridRowEntry, GridRowId } from '../../../models';
|
|
4
|
+
import type { GridRenderContext, GridColumnsRenderContext, GridRowEntry, GridRowId } from '../../../models';
|
|
5
5
|
export declare const EMPTY_DETAIL_PANELS: Readonly<Map<GridRowId, React.ReactNode>>;
|
|
6
6
|
export type VirtualScroller = ReturnType<typeof useGridVirtualScroller>;
|
|
7
7
|
export declare const useGridVirtualScroller: () => {
|
|
@@ -41,4 +41,4 @@ export declare const useGridVirtualScroller: () => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
export declare function areRenderContextsEqual(context1: GridRenderContext, context2: GridRenderContext): boolean;
|
|
44
|
-
export declare function computeOffsetLeft(columnPositions: number[], renderContext:
|
|
44
|
+
export declare function computeOffsetLeft(columnPositions: number[], renderContext: GridColumnsRenderContext, direction: Theme['direction'], pinnedLeftLength: number): number;
|
|
@@ -274,6 +274,12 @@ export const useGridVirtualScroller = () => {
|
|
|
274
274
|
if (panel) {
|
|
275
275
|
rows.push(panel);
|
|
276
276
|
}
|
|
277
|
+
if (isLastVisible) {
|
|
278
|
+
var _apiRef$current$getIn, _apiRef$current;
|
|
279
|
+
rows.push((_apiRef$current$getIn = (_apiRef$current = apiRef.current).getInfiniteLoadingTriggerElement) == null ? void 0 : _apiRef$current$getIn.call(_apiRef$current, {
|
|
280
|
+
lastRowId: id
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
277
283
|
});
|
|
278
284
|
return rows;
|
|
279
285
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useLazyRef<T, U>(init: (arg?: U) => T, initArg?: U): React.MutableRefObject<T>;
|
|
1
|
+
export { default as useLazyRef } from '@mui/utils/useLazyRef';
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const UNINITIALIZED = {};
|
|
3
|
-
|
|
4
|
-
// See https://github.com/facebook/react/issues/14490 for when to use this.
|
|
5
|
-
export function useLazyRef(init, initArg) {
|
|
6
|
-
const ref = React.useRef(UNINITIALIZED);
|
|
7
|
-
if (ref.current === UNINITIALIZED) {
|
|
8
|
-
ref.current = init(initArg);
|
|
9
|
-
}
|
|
10
|
-
return ref;
|
|
11
|
-
}
|
|
1
|
+
export { default as useLazyRef } from '@mui/utils/useLazyRef';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useOnMount(fn: React.EffectCallback): void;
|
|
1
|
+
export { default as useOnMount } from '@mui/utils/useOnMount';
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const EMPTY = [];
|
|
3
|
-
export function useOnMount(fn) {
|
|
4
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
5
|
-
React.useEffect(fn, EMPTY);
|
|
6
|
-
/* eslint-enable react-hooks/exhaustive-deps */
|
|
7
|
-
}
|
|
1
|
+
export { default as useOnMount } from '@mui/utils/useOnMount';
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
static create(): Timeout;
|
|
3
|
-
currentId: ReturnType<typeof setTimeout> | null;
|
|
4
|
-
/**
|
|
5
|
-
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
6
|
-
*/
|
|
7
|
-
start(delay: number, fn: Function): void;
|
|
8
|
-
clear: () => void;
|
|
9
|
-
disposeEffect: () => () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function useTimeout(): Timeout;
|
|
1
|
+
export { default as useTimeout } from '@mui/utils/useTimeout';
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { useLazyRef } from './useLazyRef';
|
|
4
|
-
import { useOnMount } from './useOnMount';
|
|
5
|
-
export class Timeout {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.currentId = null;
|
|
8
|
-
this.clear = () => {
|
|
9
|
-
if (this.currentId !== null) {
|
|
10
|
-
clearTimeout(this.currentId);
|
|
11
|
-
this.currentId = null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
this.disposeEffect = () => {
|
|
15
|
-
return this.clear;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
static create() {
|
|
19
|
-
return new Timeout();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
23
|
-
*/
|
|
24
|
-
start(delay, fn) {
|
|
25
|
-
this.clear();
|
|
26
|
-
this.currentId = setTimeout(() => {
|
|
27
|
-
this.currentId = null;
|
|
28
|
-
fn();
|
|
29
|
-
}, delay);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function useTimeout() {
|
|
33
|
-
const timeout = useLazyRef(Timeout.create).current;
|
|
34
|
-
useOnMount(timeout.disposeEffect);
|
|
35
|
-
return timeout;
|
|
36
|
-
}
|
|
1
|
+
export { default as useTimeout } from '@mui/utils/useTimeout';
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export type { GridDetailPanelsProps } from '../components/GridDetailPanels';
|
|
|
6
6
|
export type { GridPinnedRowsProps } from '../components/GridPinnedRows';
|
|
7
7
|
export { GridHeaders } from '../components/GridHeaders';
|
|
8
8
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
9
|
-
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
10
9
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
11
10
|
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
12
11
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
@@ -61,6 +60,7 @@ export { useGridStatePersistence } from '../hooks/features/statePersistence/useG
|
|
|
61
60
|
export type { GridRestoreStatePreProcessingContext } from '../hooks/features/statePersistence/gridStatePersistenceInterface';
|
|
62
61
|
export { useGridVirtualScroller, EMPTY_DETAIL_PANELS, } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
63
62
|
export * from '../hooks/features/virtualization';
|
|
63
|
+
export { useGridColumnResize, columnResizeStateInitializer, } from '../hooks/features/columnResize/useGridColumnResize';
|
|
64
64
|
export { useTimeout } from '../hooks/utils/useTimeout';
|
|
65
65
|
export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
66
66
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
@@ -68,7 +68,7 @@ export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState
|
|
|
68
68
|
export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
|
|
69
69
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
70
70
|
export * from '../utils/createControllablePromise';
|
|
71
|
-
export { createSelector, createSelectorMemoized
|
|
71
|
+
export { createSelector, createSelectorMemoized } from '../utils/createSelector';
|
|
72
72
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
|
73
73
|
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
74
74
|
export * from '../utils/utils';
|
package/internals/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export { GridVirtualScrollerContent } from '../components/virtualization/GridVir
|
|
|
3
3
|
export { GridVirtualScrollerRenderZone } from '../components/virtualization/GridVirtualScrollerRenderZone';
|
|
4
4
|
export { GridHeaders } from '../components/GridHeaders';
|
|
5
5
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
6
|
-
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
7
6
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
8
7
|
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
9
8
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
@@ -49,12 +48,13 @@ export { dimensionsStateInitializer, useGridDimensions } from '../hooks/features
|
|
|
49
48
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
50
49
|
export { useGridVirtualScroller, EMPTY_DETAIL_PANELS } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
51
50
|
export * from '../hooks/features/virtualization';
|
|
51
|
+
export { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
52
52
|
export { useTimeout } from '../hooks/utils/useTimeout';
|
|
53
53
|
export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
54
54
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
55
55
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
56
56
|
export * from '../utils/createControllablePromise';
|
|
57
|
-
export { createSelector, createSelectorMemoized
|
|
57
|
+
export { createSelector, createSelectorMemoized } from '../utils/createSelector';
|
|
58
58
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from '../utils/domUtils';
|
|
59
59
|
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
60
60
|
export * from '../utils/utils';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GridPinnedColumnPosition, gridColumnPositionsSelector } from '../../hooks/features/columns';
|
|
2
|
+
import type { GridDimensions } from '../../hooks/features/dimensions';
|
|
3
|
+
export declare const getPinnedCellOffset: (pinnedPosition: GridPinnedColumnPosition | undefined, computedWidth: number, columnIndex: number, columnPositions: ReturnType<typeof gridColumnPositionsSelector>, dimensions: GridDimensions) => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns';
|
|
2
|
+
export const getPinnedCellOffset = (pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions) => {
|
|
3
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
4
|
+
let pinnedOffset;
|
|
5
|
+
switch (pinnedPosition) {
|
|
6
|
+
case GridPinnedColumnPosition.LEFT:
|
|
7
|
+
pinnedOffset = columnPositions[columnIndex];
|
|
8
|
+
break;
|
|
9
|
+
case GridPinnedColumnPosition.RIGHT:
|
|
10
|
+
pinnedOffset = dimensions.columnsTotalWidth - columnPositions[columnIndex] - computedWidth + scrollbarWidth;
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
pinnedOffset = 0;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
return pinnedOffset;
|
|
17
|
+
};
|
package/joy/joySlots.js
CHANGED
|
@@ -4,10 +4,9 @@ const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size",
|
|
|
4
4
|
_excluded2 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
|
|
5
5
|
_excluded3 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
6
6
|
_excluded4 = ["color", "size", "sx", "touchRippleRef"],
|
|
7
|
-
_excluded5 = ["
|
|
8
|
-
_excluded6 = ["
|
|
9
|
-
_excluded7 = ["
|
|
10
|
-
_excluded8 = ["shrink", "variant", "sx"];
|
|
7
|
+
_excluded5 = ["open", "onOpen", "value", "onChange", "size", "color", "variant", "inputProps", "MenuProps", "inputRef", "error", "native", "fullWidth", "labelId"],
|
|
8
|
+
_excluded6 = ["native"],
|
|
9
|
+
_excluded7 = ["shrink", "variant", "sx"];
|
|
11
10
|
import * as React from 'react';
|
|
12
11
|
import JoyCheckbox from '@mui/joy/Checkbox';
|
|
13
12
|
import JoyInput from '@mui/joy/Input';
|
|
@@ -15,7 +14,6 @@ import JoyFormControl from '@mui/joy/FormControl';
|
|
|
15
14
|
import JoyFormLabel from '@mui/joy/FormLabel';
|
|
16
15
|
import JoyButton from '@mui/joy/Button';
|
|
17
16
|
import JoyIconButton from '@mui/joy/IconButton';
|
|
18
|
-
import JoySwitch from '@mui/joy/Switch';
|
|
19
17
|
import JoySelect from '@mui/joy/Select';
|
|
20
18
|
import JoyOption from '@mui/joy/Option';
|
|
21
19
|
import JoyBox from '@mui/joy/Box';
|
|
@@ -156,43 +154,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref)
|
|
|
156
154
|
sx: sx
|
|
157
155
|
}));
|
|
158
156
|
});
|
|
159
|
-
const
|
|
160
|
-
let {
|
|
161
|
-
name,
|
|
162
|
-
color: colorProp,
|
|
163
|
-
edge,
|
|
164
|
-
icon,
|
|
165
|
-
inputProps,
|
|
166
|
-
inputRef,
|
|
167
|
-
size,
|
|
168
|
-
sx,
|
|
169
|
-
onChange,
|
|
170
|
-
onClick
|
|
171
|
-
} = _ref5,
|
|
172
|
-
props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
|
|
173
|
-
return /*#__PURE__*/_jsx(JoySwitch, _extends({}, props, {
|
|
174
|
-
onChange: onChange,
|
|
175
|
-
size: convertSize(size),
|
|
176
|
-
color: convertColor(colorProp),
|
|
177
|
-
ref: ref,
|
|
178
|
-
slotProps: {
|
|
179
|
-
input: _extends({}, inputProps, {
|
|
180
|
-
name,
|
|
181
|
-
onClick: onClick,
|
|
182
|
-
ref: inputRef
|
|
183
|
-
}),
|
|
184
|
-
thumb: {
|
|
185
|
-
children: icon
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
sx: [_extends({}, edge === 'start' && {
|
|
189
|
-
ml: '-8px'
|
|
190
|
-
}, edge === 'end' && {
|
|
191
|
-
mr: '-8px'
|
|
192
|
-
}), ...(Array.isArray(sx) ? sx : [sx])]
|
|
193
|
-
}));
|
|
194
|
-
});
|
|
195
|
-
const Select = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
157
|
+
const Select = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
196
158
|
let {
|
|
197
159
|
open,
|
|
198
160
|
onOpen,
|
|
@@ -204,8 +166,8 @@ const Select = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
204
166
|
MenuProps,
|
|
205
167
|
inputRef,
|
|
206
168
|
labelId
|
|
207
|
-
} =
|
|
208
|
-
props = _objectWithoutPropertiesLoose(
|
|
169
|
+
} = _ref5,
|
|
170
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
|
|
209
171
|
const handleChange = (event, newValue) => {
|
|
210
172
|
if (event && onChange) {
|
|
211
173
|
// Same as in https://github.com/mui/material-ui/blob/e5558282a8f36856aef1299f3a36f3235e92e770/packages/mui-material/src/Select/SelectInput.js#L288-L300
|
|
@@ -257,17 +219,17 @@ const Select = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
257
219
|
}
|
|
258
220
|
}));
|
|
259
221
|
});
|
|
260
|
-
const Option = /*#__PURE__*/React.forwardRef((
|
|
261
|
-
let props = _objectWithoutPropertiesLoose(
|
|
222
|
+
const Option = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
223
|
+
let props = _objectWithoutPropertiesLoose(_ref6, _excluded6);
|
|
262
224
|
return /*#__PURE__*/_jsx(JoyOption, _extends({}, props, {
|
|
263
225
|
ref: ref
|
|
264
226
|
}));
|
|
265
227
|
});
|
|
266
|
-
const InputLabel = /*#__PURE__*/React.forwardRef((
|
|
228
|
+
const InputLabel = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
267
229
|
let {
|
|
268
230
|
sx
|
|
269
|
-
} =
|
|
270
|
-
props = _objectWithoutPropertiesLoose(
|
|
231
|
+
} = _ref7,
|
|
232
|
+
props = _objectWithoutPropertiesLoose(_ref7, _excluded7);
|
|
271
233
|
return /*#__PURE__*/_jsx(JoyFormLabel, _extends({}, props, {
|
|
272
234
|
ref: ref,
|
|
273
235
|
sx: sx
|
|
@@ -296,8 +258,8 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
296
258
|
const paginationModel = gridPaginationModelSelector(apiRef);
|
|
297
259
|
const visibleTopLevelRowCount = gridFilteredTopLevelRowCountSelector(apiRef);
|
|
298
260
|
const rowCount = React.useMemo(() => {
|
|
299
|
-
var
|
|
300
|
-
return (
|
|
261
|
+
var _ref8, _rootProps$rowCount;
|
|
262
|
+
return (_ref8 = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref8 : 0;
|
|
301
263
|
}, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
302
264
|
const lastPage = React.useMemo(() => Math.floor(rowCount / (paginationModel.pageSize || 1)), [rowCount, paginationModel.pageSize]);
|
|
303
265
|
const handlePageChange = React.useCallback(page => {
|
|
@@ -400,7 +362,6 @@ const joySlots = _extends({}, joyIconSlots, {
|
|
|
400
362
|
baseTextField: TextField,
|
|
401
363
|
baseButton: Button,
|
|
402
364
|
baseIconButton: IconButton,
|
|
403
|
-
baseSwitch: Switch,
|
|
404
365
|
baseSelect: Select,
|
|
405
366
|
baseSelectOption: Option,
|
|
406
367
|
baseInputLabel: InputLabel,
|
package/locales/jaJP.js
CHANGED
|
@@ -30,10 +30,9 @@ const jaJPGrid = {
|
|
|
30
30
|
toolbarExportPrint: '印刷',
|
|
31
31
|
toolbarExportExcel: 'Excelダウンロード',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
columnsManagementSearchTitle: '検索',
|
|
34
|
+
columnsManagementNoColumns: 'カラムなし',
|
|
35
|
+
columnsManagementShowHideAllText: 'すべて表示/非表示',
|
|
37
36
|
// Filter panel text
|
|
38
37
|
filterPanelAddFilter: 'フィルター追加',
|
|
39
38
|
filterPanelRemoveAll: 'すべて削除',
|
package/material/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import MUICheckbox from '@mui/material/Checkbox';
|
|
|
3
3
|
import MUITextField from '@mui/material/TextField';
|
|
4
4
|
import MUIFormControl from '@mui/material/FormControl';
|
|
5
5
|
import MUISelect from '@mui/material/Select';
|
|
6
|
-
import MUISwitch from '@mui/material/Switch';
|
|
7
6
|
import MUIButton from '@mui/material/Button';
|
|
8
7
|
import MUIIconButton from '@mui/material/IconButton';
|
|
9
8
|
import MUIInputAdornment from '@mui/material/InputAdornment';
|
|
@@ -56,7 +55,6 @@ const materialSlots = _extends({}, iconSlots, {
|
|
|
56
55
|
baseTextField: MUITextField,
|
|
57
56
|
baseFormControl: MUIFormControl,
|
|
58
57
|
baseSelect: MUISelect,
|
|
59
|
-
baseSwitch: MUISwitch,
|
|
60
58
|
baseButton: MUIButton,
|
|
61
59
|
baseIconButton: MUIIconButton,
|
|
62
60
|
baseInputAdornment: MUIInputAdornment,
|
|
@@ -28,7 +28,8 @@ import { GridColumnGroupingApi } from './gridColumnGroupingApi';
|
|
|
28
28
|
import type { GridInitialStateCommunity, GridStateCommunity } from '../gridStateCommunity';
|
|
29
29
|
import { GridHeaderFilteringApi, GridHeaderFilteringPrivateApi } from './gridHeaderFilteringApi';
|
|
30
30
|
import type { DataGridProcessedProps } from '../props/DataGridProps';
|
|
31
|
-
|
|
31
|
+
import type { GridColumnResizeApi } from '../../hooks/features/columnResize';
|
|
32
|
+
export interface GridApiCommon<GridState extends GridStateCommunity = any, GridInitialState extends GridInitialStateCommunity = any> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi, GridColumnResizeApi {
|
|
32
33
|
}
|
|
33
34
|
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi {
|
|
34
35
|
}
|
|
@@ -67,11 +67,7 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
|
|
|
67
67
|
/**
|
|
68
68
|
* The React ref of the grid column container virtualized div element.
|
|
69
69
|
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The React ref of the grid column headers container element.
|
|
73
|
-
*/
|
|
74
|
-
columnHeadersElementRef?: React.RefObject<HTMLDivElement>;
|
|
70
|
+
columnHeadersContainerRef?: React.RefObject<HTMLDivElement>;
|
|
75
71
|
/**
|
|
76
72
|
* The React ref of the grid header filter row element.
|
|
77
73
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -369,6 +369,12 @@ export interface GridControlledStateEventLookup {
|
|
|
369
369
|
columnVisibilityModelChange: {
|
|
370
370
|
params: GridColumnVisibilityModel;
|
|
371
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Fired when the row count change.
|
|
374
|
+
*/
|
|
375
|
+
rowCountChange: {
|
|
376
|
+
params: number;
|
|
377
|
+
};
|
|
372
378
|
}
|
|
373
379
|
export interface GridControlledStateReasonLookup {
|
|
374
380
|
filter: 'upsertFilterItem' | 'upsertFilterItems' | 'deleteFilterItem' | 'changeLogicOperator' | 'restoreState' | 'removeAllFilterItems';
|
|
@@ -33,11 +33,6 @@ export interface GridBaseSlots {
|
|
|
33
33
|
* @default Select
|
|
34
34
|
*/
|
|
35
35
|
baseSelect: React.JSXElementConstructor<GridSlotProps['baseSelect']>;
|
|
36
|
-
/**
|
|
37
|
-
* The custom Switch component used in the grid.
|
|
38
|
-
* @default Switch
|
|
39
|
-
*/
|
|
40
|
-
baseSwitch: React.JSXElementConstructor<GridSlotProps['baseSwitch']>;
|
|
41
36
|
/**
|
|
42
37
|
* The custom Button component used in the grid.
|
|
43
38
|
* @default Button
|
|
@@ -5,6 +5,7 @@ import type { GridEditingState } from './gridEditRowModel';
|
|
|
5
5
|
import { GridHeaderFilteringState } from './gridHeaderFilteringModel';
|
|
6
6
|
import type { GridRowSelectionModel } from './gridRowSelectionModel';
|
|
7
7
|
import type { GridVisibleRowsLookupState } from '../hooks/features/filter/gridFilterState';
|
|
8
|
+
import type { GridColumnResizeState } from '../hooks/features/columnResize';
|
|
8
9
|
/**
|
|
9
10
|
* The state of `DataGrid`.
|
|
10
11
|
*/
|
|
@@ -29,6 +30,7 @@ export interface GridStateCommunity {
|
|
|
29
30
|
preferencePanel: GridPreferencePanelState;
|
|
30
31
|
density: GridDensityState;
|
|
31
32
|
virtualization: GridVirtualizationState;
|
|
33
|
+
columnResize: GridColumnResizeState;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* The initial state of `DataGrid`.
|