@mui/x-data-grid 7.17.0 → 7.19.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 +208 -5
- package/DataGrid/DataGrid.js +16 -1
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +2 -1
- package/components/GridRow.js +1 -0
- package/components/cell/GridCell.js +33 -9
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -1
- package/components/containers/GridRootStyles.js +32 -23
- package/components/containers/GridToolbarContainer.js +1 -1
- package/components/menu/GridMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -1
- package/components/panel/GridPanelContent.js +1 -1
- package/components/panel/GridPanelFooter.js +1 -1
- package/components/panel/GridPanelHeader.js +1 -1
- package/components/panel/GridPanelWrapper.js +1 -1
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/components/virtualization/GridBottomContainer.d.ts +1 -1
- package/components/virtualization/GridBottomContainer.js +18 -1
- package/components/virtualization/GridMainContainer.js +3 -1
- package/components/virtualization/GridTopContainer.d.ts +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/components/virtualization/GridVirtualScroller.js +1 -0
- package/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -19
- package/hooks/features/editing/useGridRowEditing.js +7 -2
- package/hooks/features/editing/utils.d.ts +2 -0
- package/hooks/features/editing/utils.js +15 -0
- package/hooks/features/export/useGridPrintExport.js +2 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/focus/useGridFocus.js +2 -1
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/hooks/features/keyboardNavigation/utils.d.ts +17 -0
- package/hooks/features/keyboardNavigation/utils.js +58 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +9 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/hooks/features/rowSelection/utils.d.ts +10 -0
- package/hooks/features/rowSelection/utils.js +156 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +4 -0
- package/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +10 -0
- package/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/hooks/features/rows/gridRowsSelector.d.ts +14 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +27 -0
- package/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +7 -1
- package/hooks/features/scroll/useGridScroll.js +19 -19
- package/hooks/features/sorting/gridSortingSelector.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/hooks/utils/useGridApiEventHandler.js +0 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +2 -0
- package/locales/bgBG.js +8 -9
- package/locales/deDE.js +4 -4
- package/locales/frFR.js +4 -4
- package/locales/hrHR.d.ts +1 -1
- package/locales/hrHR.js +69 -46
- package/locales/jaJP.js +1 -2
- package/locales/ptPT.d.ts +1 -1
- package/locales/ptPT.js +4 -4
- package/locales/viVN.js +20 -20
- package/locales/zhHK.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +4 -0
- package/models/gridRowSelectionModel.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +30 -1
- package/modern/DataGrid/DataGrid.js +16 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +2 -1
- package/modern/components/GridRow.js +1 -0
- package/modern/components/cell/GridCell.js +33 -9
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/modern/components/containers/GridRoot.js +1 -1
- package/modern/components/containers/GridRootStyles.js +32 -23
- package/modern/components/containers/GridToolbarContainer.js +1 -1
- package/modern/components/menu/GridMenu.js +1 -1
- package/modern/components/panel/GridPanel.js +1 -1
- package/modern/components/panel/GridPanelContent.js +1 -1
- package/modern/components/panel/GridPanelFooter.js +1 -1
- package/modern/components/panel/GridPanelHeader.js +1 -1
- package/modern/components/panel/GridPanelWrapper.js +1 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/modern/components/virtualization/GridBottomContainer.js +18 -1
- package/modern/components/virtualization/GridMainContainer.js +3 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/modern/components/virtualization/GridVirtualScroller.js +1 -0
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/modern/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -19
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -2
- package/modern/hooks/features/editing/utils.js +15 -0
- package/modern/hooks/features/export/useGridPrintExport.js +2 -1
- package/modern/hooks/features/focus/useGridFocus.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/modern/hooks/features/keyboardNavigation/utils.js +58 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/modern/hooks/features/rowSelection/utils.js +156 -1
- package/modern/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/modern/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/modern/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/modern/hooks/features/rows/useGridRows.js +7 -1
- package/modern/hooks/features/scroll/useGridScroll.js +19 -19
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/modern/hooks/utils/useGridApiEventHandler.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/modern/locales/bgBG.js +8 -9
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/frFR.js +4 -4
- package/modern/locales/hrHR.js +69 -46
- package/modern/locales/jaJP.js +1 -2
- package/modern/locales/ptPT.js +4 -4
- package/modern/locales/viVN.js +20 -20
- package/modern/utils/createSelector.js +6 -0
- package/modern/utils/domUtils.js +12 -12
- package/node/DataGrid/DataGrid.js +16 -1
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +2 -1
- package/node/components/GridRow.js +1 -0
- package/node/components/cell/GridCell.js +33 -9
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/node/components/containers/GridRoot.js +1 -1
- package/node/components/containers/GridRootStyles.js +32 -23
- package/node/components/containers/GridToolbarContainer.js +1 -1
- package/node/components/menu/GridMenu.js +1 -1
- package/node/components/panel/GridPanel.js +1 -1
- package/node/components/panel/GridPanelContent.js +1 -1
- package/node/components/panel/GridPanelFooter.js +1 -1
- package/node/components/panel/GridPanelHeader.js +1 -1
- package/node/components/panel/GridPanelWrapper.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/node/components/virtualization/GridBottomContainer.js +18 -1
- package/node/components/virtualization/GridMainContainer.js +3 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/node/components/virtualization/GridVirtualScroller.js +1 -0
- package/node/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/node/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/node/hooks/features/editing/useGridCellEditing.js +3 -19
- package/node/hooks/features/editing/useGridRowEditing.js +7 -2
- package/node/hooks/features/editing/utils.js +22 -0
- package/node/hooks/features/export/useGridPrintExport.js +2 -1
- package/node/hooks/features/focus/useGridFocus.js +2 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +16 -53
- package/node/hooks/features/keyboardNavigation/utils.js +68 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +102 -26
- package/node/hooks/features/rowSelection/utils.js +160 -1
- package/node/hooks/features/rows/gridRowSpanningSelectors.js +11 -0
- package/node/hooks/features/rows/gridRowSpanningUtils.js +52 -0
- package/node/hooks/features/rows/useGridRowSpanning.js +267 -0
- package/node/hooks/features/rows/useGridRows.js +7 -1
- package/node/hooks/features/scroll/useGridScroll.js +19 -19
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/node/hooks/utils/useGridApiEventHandler.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +38 -15
- package/node/locales/bgBG.js +8 -9
- package/node/locales/deDE.js +4 -4
- package/node/locales/frFR.js +4 -4
- package/node/locales/hrHR.js +69 -46
- package/node/locales/jaJP.js +1 -2
- package/node/locales/ptPT.js +4 -4
- package/node/locales/viVN.js +20 -20
- package/node/utils/createSelector.js +6 -0
- package/node/utils/domUtils.js +12 -12
- package/package.json +3 -3
- package/utils/createSelector.js +6 -0
- package/utils/domUtils.d.ts +4 -4
- package/utils/domUtils.js +12 -12
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const getDefaultCellValue = colDef => {
|
|
2
|
+
switch (colDef.type) {
|
|
3
|
+
case 'boolean':
|
|
4
|
+
return false;
|
|
5
|
+
case 'date':
|
|
6
|
+
case 'dateTime':
|
|
7
|
+
case 'number':
|
|
8
|
+
return undefined;
|
|
9
|
+
case 'singleSelect':
|
|
10
|
+
return null;
|
|
11
|
+
case 'string':
|
|
12
|
+
default:
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -38,6 +38,7 @@ function buildPrintWindow(title) {
|
|
|
38
38
|
* @requires useGridParamsApi (method)
|
|
39
39
|
*/
|
|
40
40
|
export const useGridPrintExport = (apiRef, props) => {
|
|
41
|
+
const hasRootReference = apiRef.current.rootElementRef.current !== null;
|
|
41
42
|
const logger = useGridLogger(apiRef, 'useGridPrintExport');
|
|
42
43
|
const doc = React.useRef(null);
|
|
43
44
|
const previousGridState = React.useRef(null);
|
|
@@ -46,7 +47,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
46
47
|
const previousVirtualizationState = React.useRef();
|
|
47
48
|
React.useEffect(() => {
|
|
48
49
|
doc.current = ownerDocument(apiRef.current.rootElementRef.current);
|
|
49
|
-
}, [apiRef]);
|
|
50
|
+
}, [apiRef, hasRootReference]);
|
|
50
51
|
|
|
51
52
|
// Returns a promise because updateColumns triggers state update and
|
|
52
53
|
// the new state needs to be in place before the grid can be sized correctly
|
|
@@ -5,12 +5,12 @@ import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
|
5
5
|
* Get the current filter model.
|
|
6
6
|
* @category Filtering
|
|
7
7
|
*/
|
|
8
|
-
export declare const gridFilterModelSelector: import("
|
|
8
|
+
export declare const gridFilterModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridFilterModel>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the current quick filter values.
|
|
11
11
|
* @category Filtering
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridQuickFilterValuesSelector: import("
|
|
13
|
+
export declare const gridQuickFilterValuesSelector: import("../../..").OutputSelector<GridStateCommunity, any[] | undefined>;
|
|
14
14
|
/**
|
|
15
15
|
* @category Visible rows
|
|
16
16
|
* @ignore - do not document.
|
|
@@ -20,79 +20,79 @@ export declare const gridVisibleRowsLookupSelector: (state: GridStateCommunity)
|
|
|
20
20
|
* @category Filtering
|
|
21
21
|
* @ignore - do not document.
|
|
22
22
|
*/
|
|
23
|
-
export declare const gridFilteredRowsLookupSelector: import("
|
|
23
|
+
export declare const gridFilteredRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, boolean>>;
|
|
24
24
|
/**
|
|
25
25
|
* @category Filtering
|
|
26
26
|
* @ignore - do not document.
|
|
27
27
|
*/
|
|
28
|
-
export declare const gridFilteredChildrenCountLookupSelector: import("
|
|
28
|
+
export declare const gridFilteredChildrenCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
29
29
|
/**
|
|
30
30
|
* @category Filtering
|
|
31
31
|
* @ignore - do not document.
|
|
32
32
|
*/
|
|
33
|
-
export declare const gridFilteredDescendantCountLookupSelector: import("
|
|
33
|
+
export declare const gridFilteredDescendantCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the id and the model of the rows accessible after the filtering process.
|
|
36
36
|
* Does not contain the collapsed children.
|
|
37
37
|
* @category Filtering
|
|
38
38
|
*/
|
|
39
|
-
export declare const gridExpandedSortedRowEntriesSelector: import("
|
|
39
|
+
export declare const gridExpandedSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
40
40
|
/**
|
|
41
41
|
* Get the id of the rows accessible after the filtering process.
|
|
42
42
|
* Does not contain the collapsed children.
|
|
43
43
|
* @category Filtering
|
|
44
44
|
*/
|
|
45
|
-
export declare const gridExpandedSortedRowIdsSelector: import("
|
|
45
|
+
export declare const gridExpandedSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
46
46
|
/**
|
|
47
47
|
* Get the id and the model of the rows accessible after the filtering process.
|
|
48
48
|
* Contains the collapsed children.
|
|
49
49
|
* @category Filtering
|
|
50
50
|
*/
|
|
51
|
-
export declare const gridFilteredSortedRowEntriesSelector: import("
|
|
51
|
+
export declare const gridFilteredSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
52
52
|
/**
|
|
53
53
|
* Get the id of the rows accessible after the filtering process.
|
|
54
54
|
* Contains the collapsed children.
|
|
55
55
|
* @category Filtering
|
|
56
56
|
*/
|
|
57
|
-
export declare const gridFilteredSortedRowIdsSelector: import("
|
|
57
|
+
export declare const gridFilteredSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
58
58
|
/**
|
|
59
59
|
* Get the ids to position in the current tree level lookup of the rows accessible after the filtering process.
|
|
60
60
|
* Does not contain the collapsed children.
|
|
61
61
|
* @category Filtering
|
|
62
62
|
* @ignore - do not document.
|
|
63
63
|
*/
|
|
64
|
-
export declare const gridExpandedSortedRowTreeLevelPositionLookupSelector: import("
|
|
64
|
+
export declare const gridExpandedSortedRowTreeLevelPositionLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
65
65
|
/**
|
|
66
66
|
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
67
67
|
* @category Filtering
|
|
68
68
|
*/
|
|
69
|
-
export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("
|
|
69
|
+
export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
70
70
|
/**
|
|
71
71
|
* Get the amount of rows accessible after the filtering process.
|
|
72
72
|
* @category Filtering
|
|
73
73
|
*/
|
|
74
|
-
export declare const gridExpandedRowCountSelector: import("
|
|
74
|
+
export declare const gridExpandedRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
75
75
|
/**
|
|
76
76
|
* Get the amount of top level rows accessible after the filtering process.
|
|
77
77
|
* @category Filtering
|
|
78
78
|
*/
|
|
79
|
-
export declare const gridFilteredTopLevelRowCountSelector: import("
|
|
79
|
+
export declare const gridFilteredTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
80
80
|
/**
|
|
81
81
|
* Get the amount of rows accessible after the filtering process.
|
|
82
82
|
* Includes top level and descendant rows.
|
|
83
83
|
* @category Filtering
|
|
84
84
|
*/
|
|
85
|
-
export declare const gridFilteredRowCountSelector: import("
|
|
85
|
+
export declare const gridFilteredRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
86
86
|
/**
|
|
87
87
|
* Get the amount of descendant rows accessible after the filtering process.
|
|
88
88
|
* @category Filtering
|
|
89
89
|
*/
|
|
90
|
-
export declare const gridFilteredDescendantRowCountSelector: import("
|
|
90
|
+
export declare const gridFilteredDescendantRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
91
91
|
/**
|
|
92
92
|
* @category Filtering
|
|
93
93
|
* @ignore - do not document.
|
|
94
94
|
*/
|
|
95
|
-
export declare const gridFilterActiveItemsSelector: import("
|
|
95
|
+
export declare const gridFilterActiveItemsSelector: import("../../..").OutputSelector<GridStateCommunity, GridFilterItem[]>;
|
|
96
96
|
export type GridFilterActiveItemsLookup = {
|
|
97
97
|
[field: string]: GridFilterItem[];
|
|
98
98
|
};
|
|
@@ -100,4 +100,4 @@ export type GridFilterActiveItemsLookup = {
|
|
|
100
100
|
* @category Filtering
|
|
101
101
|
* @ignore - do not document.
|
|
102
102
|
*/
|
|
103
|
-
export declare const gridFilterActiveItemsLookupSelector: import("
|
|
103
|
+
export declare const gridFilterActiveItemsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridFilterActiveItemsLookup>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
2
|
import { GridFocusState, GridTabIndexState } from './gridFocusState';
|
|
3
3
|
export declare const gridFocusStateSelector: (state: GridStateCommunity) => GridFocusState;
|
|
4
|
-
export declare const gridFocusCellSelector: import("
|
|
5
|
-
export declare const gridFocusColumnHeaderSelector: import("
|
|
6
|
-
export declare const gridFocusColumnHeaderFilterSelector: import("
|
|
7
|
-
export declare const gridFocusColumnGroupHeaderSelector: import("
|
|
4
|
+
export declare const gridFocusCellSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridCellCoordinates | null>;
|
|
5
|
+
export declare const gridFocusColumnHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
6
|
+
export declare const gridFocusColumnHeaderFilterSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
7
|
+
export declare const gridFocusColumnGroupHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnGroupIdentifier | null>;
|
|
8
8
|
export declare const gridTabIndexStateSelector: (state: GridStateCommunity) => GridTabIndexState;
|
|
9
|
-
export declare const gridTabIndexCellSelector: import("
|
|
10
|
-
export declare const gridTabIndexColumnHeaderSelector: import("
|
|
11
|
-
export declare const gridTabIndexColumnHeaderFilterSelector: import("
|
|
12
|
-
export declare const gridTabIndexColumnGroupHeaderSelector: import("
|
|
9
|
+
export declare const gridTabIndexCellSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridCellCoordinates | null>;
|
|
10
|
+
export declare const gridTabIndexColumnHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
11
|
+
export declare const gridTabIndexColumnHeaderFilterSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
12
|
+
export declare const gridTabIndexColumnGroupHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnGroupIdentifier | null>;
|
|
@@ -34,6 +34,7 @@ export const focusStateInitializer = state => _extends({}, state, {
|
|
|
34
34
|
export const useGridFocus = (apiRef, props) => {
|
|
35
35
|
const logger = useGridLogger(apiRef, 'useGridFocus');
|
|
36
36
|
const lastClickedCell = React.useRef(null);
|
|
37
|
+
const hasRootReference = apiRef.current.rootElementRef.current !== null;
|
|
37
38
|
const publishCellFocusOut = React.useCallback((cell, event) => {
|
|
38
39
|
if (cell) {
|
|
39
40
|
// The row might have been deleted
|
|
@@ -380,7 +381,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
380
381
|
return () => {
|
|
381
382
|
doc.removeEventListener('mouseup', handleDocumentClick);
|
|
382
383
|
};
|
|
383
|
-
}, [apiRef, handleDocumentClick]);
|
|
384
|
+
}, [apiRef, hasRootReference, handleDocumentClick]);
|
|
384
385
|
useGridApiEventHandler(apiRef, 'columnHeaderBlur', handleBlur);
|
|
385
386
|
useGridApiEventHandler(apiRef, 'cellDoubleClick', handleCellDoubleClick);
|
|
386
387
|
useGridApiEventHandler(apiRef, 'cellMouseDown', handleCellMouseDown);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
2
|
export declare const gridHeaderFilteringStateSelector: (state: GridStateCommunity) => import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState;
|
|
3
|
-
export declare const gridHeaderFilteringEnabledSelector: import("
|
|
4
|
-
export declare const gridHeaderFilteringEditFieldSelector: import("
|
|
5
|
-
export declare const gridHeaderFilteringMenuSelector: import("
|
|
3
|
+
export declare const gridHeaderFilteringEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
4
|
+
export declare const gridHeaderFilteringEditFieldSelector: import("../../..").OutputSelector<GridStateCommunity, string | null>;
|
|
5
|
+
export declare const gridHeaderFilteringMenuSelector: import("../../..").OutputSelector<GridStateCommunity, string | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
3
|
-
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.js";
|
|
3
|
+
import { gridVisibleColumnDefinitionsSelector, gridVisibleColumnFieldsSelector } from "../columns/gridColumnsSelector.js";
|
|
4
4
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
5
5
|
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
6
6
|
import { gridExpandedSortedRowEntriesSelector } from "../filter/gridFilterSelector.js";
|
|
@@ -10,50 +10,12 @@ import { gridClasses } from "../../../constants/gridClasses.js";
|
|
|
10
10
|
import { GridCellModes } from "../../../models/gridEditRowModel.js";
|
|
11
11
|
import { isNavigationKey } from "../../../utils/keyboardUtils.js";
|
|
12
12
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../constants/gridDetailPanelToggleField.js";
|
|
13
|
-
import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
|
|
14
13
|
import { gridFocusColumnGroupHeaderSelector } from "../focus/index.js";
|
|
15
14
|
import { gridColumnGroupsHeaderMaxDepthSelector } from "../columnGrouping/gridColumnGroupsSelector.js";
|
|
16
15
|
import { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector } from "../headerFiltering/gridHeaderFilteringSelectors.js";
|
|
17
16
|
import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
|
|
18
17
|
import { isEventTargetInPortal } from "../../../utils/domUtils.js";
|
|
19
|
-
|
|
20
|
-
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
21
|
-
return [...(pinnedRows.top || []), ...rows, ...(pinnedRows.bottom || [])];
|
|
22
|
-
}
|
|
23
|
-
const getLeftColumnIndex = ({
|
|
24
|
-
currentColIndex,
|
|
25
|
-
firstColIndex,
|
|
26
|
-
lastColIndex,
|
|
27
|
-
isRtl
|
|
28
|
-
}) => {
|
|
29
|
-
if (isRtl) {
|
|
30
|
-
if (currentColIndex < lastColIndex) {
|
|
31
|
-
return currentColIndex + 1;
|
|
32
|
-
}
|
|
33
|
-
} else if (!isRtl) {
|
|
34
|
-
if (currentColIndex > firstColIndex) {
|
|
35
|
-
return currentColIndex - 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
const getRightColumnIndex = ({
|
|
41
|
-
currentColIndex,
|
|
42
|
-
firstColIndex,
|
|
43
|
-
lastColIndex,
|
|
44
|
-
isRtl
|
|
45
|
-
}) => {
|
|
46
|
-
if (isRtl) {
|
|
47
|
-
if (currentColIndex > firstColIndex) {
|
|
48
|
-
return currentColIndex - 1;
|
|
49
|
-
}
|
|
50
|
-
} else if (!isRtl) {
|
|
51
|
-
if (currentColIndex < lastColIndex) {
|
|
52
|
-
return currentColIndex + 1;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
};
|
|
18
|
+
import { enrichPageRowsWithPinnedRows, getLeftColumnIndex, getRightColumnIndex, findNonRowSpannedCell } from "./utils.js";
|
|
57
19
|
|
|
58
20
|
/**
|
|
59
21
|
* @requires useGridSorting (method) - can be after
|
|
@@ -73,11 +35,12 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
73
35
|
|
|
74
36
|
/**
|
|
75
37
|
* @param {number} colIndex Index of the column to focus
|
|
76
|
-
* @param {
|
|
38
|
+
* @param {GridRowId} rowId index of the row to focus
|
|
77
39
|
* @param {string} closestColumnToUse Which closest column cell to use when the cell is spanned by `colSpan`.
|
|
40
|
+
* @param {string} rowSpanScanDirection Which direction to search to find the next cell not hidden by `rowSpan`.
|
|
78
41
|
* TODO replace with apiRef.current.moveFocusToRelativeCell()
|
|
79
42
|
*/
|
|
80
|
-
const goToCell = React.useCallback((colIndex, rowId, closestColumnToUse = 'left') => {
|
|
43
|
+
const goToCell = React.useCallback((colIndex, rowId, closestColumnToUse = 'left', rowSpanScanDirection = 'up') => {
|
|
81
44
|
const visibleSortedRows = gridExpandedSortedRowEntriesSelector(apiRef);
|
|
82
45
|
const nextCellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, colIndex);
|
|
83
46
|
if (nextCellColSpanInfo && nextCellColSpanInfo.spannedByColSpan) {
|
|
@@ -87,16 +50,17 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
87
50
|
colIndex = nextCellColSpanInfo.rightVisibleCellIndex;
|
|
88
51
|
}
|
|
89
52
|
}
|
|
53
|
+
const field = gridVisibleColumnFieldsSelector(apiRef)[colIndex];
|
|
54
|
+
const nonRowSpannedRowId = findNonRowSpannedCell(apiRef, rowId, field, rowSpanScanDirection);
|
|
90
55
|
// `scrollToIndexes` requires a rowIndex relative to all visible rows.
|
|
91
56
|
// Those rows do not include pinned rows, but pinned rows do not need scroll anyway.
|
|
92
|
-
const rowIndexRelativeToAllRows = visibleSortedRows.findIndex(row => row.id ===
|
|
57
|
+
const rowIndexRelativeToAllRows = visibleSortedRows.findIndex(row => row.id === nonRowSpannedRowId);
|
|
93
58
|
logger.debug(`Navigating to cell row ${rowIndexRelativeToAllRows}, col ${colIndex}`);
|
|
94
59
|
apiRef.current.scrollToIndexes({
|
|
95
60
|
colIndex,
|
|
96
61
|
rowIndex: rowIndexRelativeToAllRows
|
|
97
62
|
});
|
|
98
|
-
|
|
99
|
-
apiRef.current.setCellFocus(rowId, field);
|
|
63
|
+
apiRef.current.setCellFocus(nonRowSpannedRowId, field);
|
|
100
64
|
}, [apiRef, logger]);
|
|
101
65
|
const goToHeader = React.useCallback((colIndex, event) => {
|
|
102
66
|
logger.debug(`Navigating to header col ${colIndex}`);
|
|
@@ -432,7 +396,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
432
396
|
{
|
|
433
397
|
// "Enter" is only triggered by the row / cell editing feature
|
|
434
398
|
if (rowIndexBefore < lastRowIndexInPage) {
|
|
435
|
-
goToCell(colIndexBefore, getRowIdFromIndex(rowIndexBefore + 1));
|
|
399
|
+
goToCell(colIndexBefore, getRowIdFromIndex(rowIndexBefore + 1), isRtl ? 'right' : 'left', 'down');
|
|
436
400
|
}
|
|
437
401
|
break;
|
|
438
402
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridColDef, GridRowEntry, GridRowId } from '../../../models';
|
|
3
|
+
import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
|
+
export declare function enrichPageRowsWithPinnedRows(apiRef: React.MutableRefObject<GridApiCommunity>, rows: GridRowEntry[]): GridRowEntry<import("../../..").GridValidRowModel>[];
|
|
5
|
+
export declare const getLeftColumnIndex: ({ currentColIndex, firstColIndex, lastColIndex, isRtl, }: {
|
|
6
|
+
currentColIndex: number;
|
|
7
|
+
firstColIndex: number;
|
|
8
|
+
lastColIndex: number;
|
|
9
|
+
isRtl: boolean;
|
|
10
|
+
}) => number | null;
|
|
11
|
+
export declare const getRightColumnIndex: ({ currentColIndex, firstColIndex, lastColIndex, isRtl, }: {
|
|
12
|
+
currentColIndex: number;
|
|
13
|
+
firstColIndex: number;
|
|
14
|
+
lastColIndex: number;
|
|
15
|
+
isRtl: boolean;
|
|
16
|
+
}) => number | null;
|
|
17
|
+
export declare function findNonRowSpannedCell(apiRef: React.MutableRefObject<GridApiCommunity>, rowId: GridRowId, field: GridColDef['field'], rowSpanScanDirection: 'up' | 'down'): GridRowId;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { gridFilteredSortedRowIdsSelector } from "../filter/gridFilterSelector.js";
|
|
2
|
+
import { gridRowSpanningHiddenCellsSelector } from "../rows/gridRowSpanningSelectors.js";
|
|
3
|
+
import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
|
|
4
|
+
export function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
5
|
+
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
6
|
+
return [...(pinnedRows.top || []), ...rows, ...(pinnedRows.bottom || [])];
|
|
7
|
+
}
|
|
8
|
+
export const getLeftColumnIndex = ({
|
|
9
|
+
currentColIndex,
|
|
10
|
+
firstColIndex,
|
|
11
|
+
lastColIndex,
|
|
12
|
+
isRtl
|
|
13
|
+
}) => {
|
|
14
|
+
if (isRtl) {
|
|
15
|
+
if (currentColIndex < lastColIndex) {
|
|
16
|
+
return currentColIndex + 1;
|
|
17
|
+
}
|
|
18
|
+
} else if (!isRtl) {
|
|
19
|
+
if (currentColIndex > firstColIndex) {
|
|
20
|
+
return currentColIndex - 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
export const getRightColumnIndex = ({
|
|
26
|
+
currentColIndex,
|
|
27
|
+
firstColIndex,
|
|
28
|
+
lastColIndex,
|
|
29
|
+
isRtl
|
|
30
|
+
}) => {
|
|
31
|
+
if (isRtl) {
|
|
32
|
+
if (currentColIndex > firstColIndex) {
|
|
33
|
+
return currentColIndex - 1;
|
|
34
|
+
}
|
|
35
|
+
} else if (!isRtl) {
|
|
36
|
+
if (currentColIndex < lastColIndex) {
|
|
37
|
+
return currentColIndex + 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
export function findNonRowSpannedCell(apiRef, rowId, field, rowSpanScanDirection) {
|
|
43
|
+
const rowSpanHiddenCells = gridRowSpanningHiddenCellsSelector(apiRef);
|
|
44
|
+
if (!rowSpanHiddenCells[rowId]?.[field]) {
|
|
45
|
+
return rowId;
|
|
46
|
+
}
|
|
47
|
+
const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef);
|
|
48
|
+
// find closest non row spanned cell in the given `rowSpanScanDirection`
|
|
49
|
+
let nextRowIndex = filteredSortedRowIds.indexOf(rowId) + (rowSpanScanDirection === 'down' ? 1 : -1);
|
|
50
|
+
while (nextRowIndex >= 0 && nextRowIndex < filteredSortedRowIds.length) {
|
|
51
|
+
const nextRowId = filteredSortedRowIds[nextRowIndex];
|
|
52
|
+
if (!rowSpanHiddenCells[nextRowId]?.[field]) {
|
|
53
|
+
return nextRowId;
|
|
54
|
+
}
|
|
55
|
+
nextRowIndex += rowSpanScanDirection === 'down' ? 1 : -1;
|
|
56
|
+
}
|
|
57
|
+
return rowId;
|
|
58
|
+
}
|
|
@@ -8,37 +8,37 @@ export declare const gridPaginationSelector: (state: GridStateCommunity) => impo
|
|
|
8
8
|
* Get the pagination model
|
|
9
9
|
* @category Pagination
|
|
10
10
|
*/
|
|
11
|
-
export declare const gridPaginationModelSelector: import("
|
|
11
|
+
export declare const gridPaginationModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationModel>;
|
|
12
12
|
/**
|
|
13
13
|
* Get the row count
|
|
14
14
|
* @category Pagination
|
|
15
15
|
*/
|
|
16
|
-
export declare const gridPaginationRowCountSelector: import("
|
|
16
|
+
export declare const gridPaginationRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
17
17
|
/**
|
|
18
18
|
* Get the pagination meta
|
|
19
19
|
* @category Pagination
|
|
20
20
|
*/
|
|
21
|
-
export declare const gridPaginationMetaSelector: import("
|
|
21
|
+
export declare const gridPaginationMetaSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationMeta>;
|
|
22
22
|
/**
|
|
23
23
|
* Get the index of the page to render if the pagination is enabled
|
|
24
24
|
* @category Pagination
|
|
25
25
|
*/
|
|
26
|
-
export declare const gridPageSelector: import("
|
|
26
|
+
export declare const gridPageSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
27
27
|
/**
|
|
28
28
|
* Get the maximum amount of rows to display on a single page if the pagination is enabled
|
|
29
29
|
* @category Pagination
|
|
30
30
|
*/
|
|
31
|
-
export declare const gridPageSizeSelector: import("
|
|
31
|
+
export declare const gridPageSizeSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
32
32
|
/**
|
|
33
33
|
* Get the amount of pages needed to display all the rows if the pagination is enabled
|
|
34
34
|
* @category Pagination
|
|
35
35
|
*/
|
|
36
|
-
export declare const gridPageCountSelector: import("
|
|
36
|
+
export declare const gridPageCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
37
37
|
/**
|
|
38
38
|
* Get the index of the first and the last row to include in the current page if the pagination is enabled.
|
|
39
39
|
* @category Pagination
|
|
40
40
|
*/
|
|
41
|
-
export declare const gridPaginationRowRangeSelector: import("
|
|
41
|
+
export declare const gridPaginationRowRangeSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
42
42
|
firstRowIndex: number;
|
|
43
43
|
lastRowIndex: number;
|
|
44
44
|
} | null>;
|
|
@@ -46,9 +46,9 @@ export declare const gridPaginationRowRangeSelector: import("../../../utils/crea
|
|
|
46
46
|
* Get the id and the model of each row to include in the current page if the pagination is enabled.
|
|
47
47
|
* @category Pagination
|
|
48
48
|
*/
|
|
49
|
-
export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("
|
|
49
|
+
export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
50
50
|
/**
|
|
51
51
|
* Get the id of each row to include in the current page if the pagination is enabled.
|
|
52
52
|
* @category Pagination
|
|
53
53
|
*/
|
|
54
|
-
export declare const gridPaginatedVisibleSortedGridRowIdsSelector: import("
|
|
54
|
+
export declare const gridPaginatedVisibleSortedGridRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
2
|
import { GridRowId } from '../../../models/gridRows';
|
|
3
3
|
export declare const gridRowSelectionStateSelector: (state: GridStateCommunity) => import("../../..").GridRowSelectionModel;
|
|
4
|
-
export declare const selectedGridRowsCountSelector: import("
|
|
5
|
-
export declare const selectedGridRowsSelector: import("
|
|
6
|
-
export declare const selectedIdsLookupSelector: import("
|
|
4
|
+
export declare const selectedGridRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
5
|
+
export declare const selectedGridRowsSelector: import("../../..").OutputSelector<GridStateCommunity, Map<GridRowId, import("../../..").GridValidRowModel>>;
|
|
6
|
+
export declare const selectedIdsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, GridRowId>>;
|
|
@@ -9,4 +9,4 @@ export declare const rowSelectionStateInitializer: GridStateInitializer<Pick<Dat
|
|
|
9
9
|
* @requires useGridFocus (state) - can be after
|
|
10
10
|
* @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
|
|
11
11
|
*/
|
|
12
|
-
export declare const useGridRowSelection: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "checkboxSelection" | "rowSelectionModel" | "onRowSelectionModelChange" | "disableMultipleRowSelection" | "disableRowSelectionOnClick" | "isRowSelectable" | "checkboxSelectionVisibleOnly" | "pagination" | "paginationMode" | "classes" | "keepNonExistentRowsSelected" | "rowSelection" | "signature">) => void;
|
|
12
|
+
export declare const useGridRowSelection: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "checkboxSelection" | "rowSelectionModel" | "onRowSelectionModelChange" | "disableMultipleRowSelection" | "disableRowSelectionOnClick" | "isRowSelectable" | "checkboxSelectionVisibleOnly" | "pagination" | "paginationMode" | "classes" | "keepNonExistentRowsSelected" | "rowSelection" | "rowSelectionPropagation" | "signature">) => void;
|