@mui/x-data-grid 7.0.0-beta.6 → 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 +117 -1
- 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/GridRow.d.ts +1 -1
- package/components/GridRow.js +4 -19
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/cell/GridCell.d.ts +7 -0
- package/components/cell/GridCell.js +11 -3
- 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 -20
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- 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/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 +4 -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/scroll/useGridScroll.js +1 -1
- 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/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 +1 -1
- package/internals/index.js +1 -1
- 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 +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- 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 +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- 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/GridRootStyles.js +12 -20
- 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/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 +4 -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/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- 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 +1 -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/utils/cellBorderUtils.js +8 -0
- 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 +3 -18
- package/node/components/GridScrollArea.js +158 -0
- 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/GridRootStyles.js +12 -20
- 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/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 +4 -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/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- 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 -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/utils/cellBorderUtils.js +16 -0
- package/node/utils/domUtils.js +155 -0
- package/package.json +1 -1
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- 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
|
+
};
|
|
@@ -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 => {
|
|
@@ -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;
|
|
@@ -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';
|
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,6 +48,7 @@ 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';
|
|
@@ -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,10 +28,10 @@ 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
|
-
import type {
|
|
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 {
|
|
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 {
|
|
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
|
+
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 {
|
|
35
35
|
}
|
|
36
36
|
export interface GridPrivateApiCommon extends GridApiCommon, GridPrivateOnlyApiCommon<GridApiCommon, GridPrivateApiCommon, DataGridProcessedProps> {
|
|
37
37
|
}
|
|
@@ -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
|
*/
|
|
@@ -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`.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
firstRowIndex: number;
|
|
3
|
-
lastRowIndex: number;
|
|
1
|
+
export interface GridColumnsRenderContext {
|
|
4
2
|
firstColumnIndex: number;
|
|
5
3
|
lastColumnIndex: number;
|
|
6
4
|
}
|
|
5
|
+
export interface GridRenderContext extends GridColumnsRenderContext {
|
|
6
|
+
firstRowIndex: number;
|
|
7
|
+
lastRowIndex: number;
|
|
8
|
+
}
|
|
7
9
|
export interface GridScrollParams {
|
|
8
10
|
left: number;
|
|
9
11
|
top: number;
|
|
@@ -24,6 +24,7 @@ import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColu
|
|
|
24
24
|
import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
|
|
25
25
|
import { GridColumnGroupingModel } from '../gridColumnGrouping';
|
|
26
26
|
import { GridPaginationModel } from '../gridPaginationProps';
|
|
27
|
+
import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
|
|
27
28
|
export interface GridExperimentalFeatures {
|
|
28
29
|
/**
|
|
29
30
|
* Emits a warning if the cell receives focus without also syncing the focus state.
|
|
@@ -46,7 +47,7 @@ export interface DataGridProcessedProps<R extends GridValidRowModel = any> exten
|
|
|
46
47
|
* The props of the `DataGrid` component after the pre-processing phase that the user should not be able to override.
|
|
47
48
|
* Those are usually used in feature-hook for which the pro-plan has more advanced features (eg: multi-sorting, multi-filtering, ...).
|
|
48
49
|
*/
|
|
49
|
-
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | 'disableColumnReorder' | '
|
|
50
|
+
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | 'disableColumnReorder' | 'keepColumnPositionIfDraggedOutside' | 'throttleRowsMs' | 'hideFooterRowCount' | 'pagination' | 'signature';
|
|
50
51
|
/**
|
|
51
52
|
* The `DataGrid` options with a default value that must be merged with the value given through props.
|
|
52
53
|
*/
|
|
@@ -342,6 +343,16 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
342
343
|
* @default 166
|
|
343
344
|
*/
|
|
344
345
|
rowPositionsDebounceMs: number;
|
|
346
|
+
/**
|
|
347
|
+
* If `true`, columns are autosized after the datagrid is mounted.
|
|
348
|
+
* @default false
|
|
349
|
+
*/
|
|
350
|
+
autosizeOnMount: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* If `true`, column autosizing on header separator double-click is disabled.
|
|
353
|
+
* @default false
|
|
354
|
+
*/
|
|
355
|
+
disableAutosize: boolean;
|
|
345
356
|
}
|
|
346
357
|
/**
|
|
347
358
|
* The `DataGrid` props with no default value.
|
|
@@ -559,6 +570,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
559
570
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
560
571
|
*/
|
|
561
572
|
onPaginationModelChange?: (model: GridPaginationModel, details: GridCallbackDetails) => void;
|
|
573
|
+
/**
|
|
574
|
+
* Callback fired when the row count has changed.
|
|
575
|
+
* @param {number} count Updated row count.
|
|
576
|
+
*/
|
|
577
|
+
onRowCountChange?: (count: number) => void;
|
|
562
578
|
/**
|
|
563
579
|
* Callback fired when the preferences panel is closed.
|
|
564
580
|
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
@@ -714,4 +730,22 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
714
730
|
* @param {string} data The data copied to the clipboard.
|
|
715
731
|
*/
|
|
716
732
|
onClipboardCopy?: GridEventListener<'clipboardCopy'>;
|
|
733
|
+
/**
|
|
734
|
+
* The options for autosize when user-initiated.
|
|
735
|
+
*/
|
|
736
|
+
autosizeOptions?: GridAutosizeOptions;
|
|
737
|
+
/**
|
|
738
|
+
* Callback fired while a column is being resized.
|
|
739
|
+
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
740
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
741
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
742
|
+
*/
|
|
743
|
+
onColumnResize?: GridEventListener<'columnResize'>;
|
|
744
|
+
/**
|
|
745
|
+
* Callback fired when the width of a column is changed.
|
|
746
|
+
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
747
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
748
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
749
|
+
*/
|
|
750
|
+
onColumnWidthChange?: GridEventListener<'columnWidthChange'>;
|
|
717
751
|
}
|