@mui/x-data-grid 7.18.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 +110 -0
- package/DataGrid/DataGrid.js +5 -0
- package/components/cell/GridCell.js +7 -8
- 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 -1
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- 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/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/keyboardNavigation/utils.d.ts +1 -1
- 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 +3 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +14 -14
- 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/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -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/gridRowSelectionModel.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +20 -1
- package/modern/DataGrid/DataGrid.js +5 -0
- package/modern/components/cell/GridCell.js +7 -8
- 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/columns/gridColumnsUtils.js +3 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/modern/hooks/features/rowSelection/utils.js +156 -1
- package/modern/hooks/features/rows/useGridRows.js +7 -1
- package/modern/hooks/features/scroll/useGridScroll.js +19 -19
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -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/node/DataGrid/DataGrid.js +5 -0
- package/node/components/cell/GridCell.js +7 -8
- 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/columns/gridColumnsUtils.js +3 -2
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +102 -26
- package/node/hooks/features/rowSelection/utils.js +160 -1
- package/node/hooks/features/rows/useGridRows.js +7 -1
- package/node/hooks/features/scroll/useGridScroll.js +19 -19
- package/node/index.js +1 -1
- package/node/internals/index.js +23 -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/package.json +1 -1
- package/utils/createSelector.js +6 -0
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import type { GridRowId, GridRowTreeConfig } from '../../../models/gridRows';
|
|
1
2
|
import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
|
+
import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
|
+
import type { GridRowSelectionPropagation } from '../../../models/gridRowSelectionModel';
|
|
5
|
+
export declare const ROW_SELECTION_PROPAGATION_DEFAULT: GridRowSelectionPropagation;
|
|
6
|
+
export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, {
|
|
7
|
+
isIndeterminate: boolean;
|
|
8
|
+
isChecked: boolean;
|
|
9
|
+
}>;
|
|
2
10
|
export declare function isMultipleRowSelectionEnabled(props: Pick<DataGridProcessedProps, 'signature' | 'disableMultipleRowSelection' | 'checkboxSelection'>): boolean;
|
|
11
|
+
export declare const findRowsToSelect: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, selectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, addRow: (rowId: GridRowId) => void) => void;
|
|
12
|
+
export declare const findRowsToDeselect: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, deselectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, removeRow: (rowId: GridRowId) => void) => void;
|
|
@@ -1,8 +1,163 @@
|
|
|
1
1
|
import { GridSignature } from "../../utils/useGridApiEventHandler.js";
|
|
2
|
+
import { GRID_ROOT_GROUP_ID } from "../rows/gridRowsUtils.js";
|
|
3
|
+
import { gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
|
|
4
|
+
import { gridSortedRowIdsSelector } from "../sorting/gridSortingSelector.js";
|
|
5
|
+
import { selectedIdsLookupSelector } from "./gridRowSelectionSelector.js";
|
|
6
|
+
import { gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
7
|
+
import { createSelector } from "../../../utils/createSelector.js";
|
|
8
|
+
export const ROW_SELECTION_PROPAGATION_DEFAULT = {
|
|
9
|
+
parents: false,
|
|
10
|
+
descendants: false
|
|
11
|
+
};
|
|
12
|
+
function getGridRowGroupSelectableDescendants(apiRef, groupId) {
|
|
13
|
+
const rowTree = gridRowTreeSelector(apiRef);
|
|
14
|
+
const sortedRowIds = gridSortedRowIdsSelector(apiRef);
|
|
15
|
+
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
16
|
+
const groupNode = rowTree[groupId];
|
|
17
|
+
if (!groupNode || groupNode.type !== 'group') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const descendants = [];
|
|
21
|
+
const startIndex = sortedRowIds.findIndex(id => id === groupId) + 1;
|
|
22
|
+
for (let index = startIndex; index < sortedRowIds.length && rowTree[sortedRowIds[index]]?.depth > groupNode.depth; index += 1) {
|
|
23
|
+
const id = sortedRowIds[index];
|
|
24
|
+
if (filteredRowsLookup[id] !== false && apiRef.current.isRowSelectable(id)) {
|
|
25
|
+
descendants.push(id);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return descendants;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// TODO v8: Use `createSelectorV8`
|
|
32
|
+
export function getCheckboxPropsSelector(groupId, autoSelectParents) {
|
|
33
|
+
return createSelector(gridRowTreeSelector, gridSortedRowIdsSelector, gridFilteredRowsLookupSelector, selectedIdsLookupSelector, (rowTree, sortedRowIds, filteredRowsLookup, rowSelectionLookup) => {
|
|
34
|
+
const groupNode = rowTree[groupId];
|
|
35
|
+
if (!groupNode || groupNode.type !== 'group') {
|
|
36
|
+
return {
|
|
37
|
+
isIndeterminate: false,
|
|
38
|
+
isChecked: rowSelectionLookup[groupId] === groupId
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (rowSelectionLookup[groupId] === groupId) {
|
|
42
|
+
return {
|
|
43
|
+
isIndeterminate: false,
|
|
44
|
+
isChecked: true
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
let selectableDescendentsCount = 0;
|
|
48
|
+
let selectedDescendentsCount = 0;
|
|
49
|
+
const startIndex = sortedRowIds.findIndex(id => id === groupId) + 1;
|
|
50
|
+
for (let index = startIndex; index < sortedRowIds.length && rowTree[sortedRowIds[index]]?.depth > groupNode.depth; index += 1) {
|
|
51
|
+
const id = sortedRowIds[index];
|
|
52
|
+
if (filteredRowsLookup[id] !== false) {
|
|
53
|
+
selectableDescendentsCount += 1;
|
|
54
|
+
if (rowSelectionLookup[id] !== undefined) {
|
|
55
|
+
selectedDescendentsCount += 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
isIndeterminate: selectedDescendentsCount > 0 && selectedDescendentsCount < selectableDescendentsCount || selectedDescendentsCount === selectableDescendentsCount && rowSelectionLookup[groupId] === undefined,
|
|
61
|
+
isChecked: autoSelectParents ? selectedDescendentsCount > 0 : rowSelectionLookup[groupId] === groupId
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
2
65
|
export function isMultipleRowSelectionEnabled(props) {
|
|
3
66
|
if (props.signature === GridSignature.DataGrid) {
|
|
4
67
|
// DataGrid Community has multiple row selection enabled only if checkbox selection is enabled.
|
|
5
68
|
return props.checkboxSelection && props.disableMultipleRowSelection !== true;
|
|
6
69
|
}
|
|
7
70
|
return !props.disableMultipleRowSelection;
|
|
8
|
-
}
|
|
71
|
+
}
|
|
72
|
+
const getRowNodeParents = (tree, id) => {
|
|
73
|
+
const parents = [];
|
|
74
|
+
let parent = id;
|
|
75
|
+
while (parent != null && parent !== GRID_ROOT_GROUP_ID) {
|
|
76
|
+
const node = tree[parent];
|
|
77
|
+
if (!node) {
|
|
78
|
+
return parents;
|
|
79
|
+
}
|
|
80
|
+
parents.push(parent);
|
|
81
|
+
parent = node.parent;
|
|
82
|
+
}
|
|
83
|
+
return parents;
|
|
84
|
+
};
|
|
85
|
+
const getFilteredRowNodeSiblings = (tree, filteredRows, id) => {
|
|
86
|
+
const node = tree[id];
|
|
87
|
+
if (!node) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
const parent = node.parent;
|
|
91
|
+
if (parent == null) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
const parentNode = tree[parent];
|
|
95
|
+
return parentNode.children.filter(childId => childId !== id && filteredRows[childId]);
|
|
96
|
+
};
|
|
97
|
+
export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendants, autoSelectParents, addRow) => {
|
|
98
|
+
const filteredRows = gridFilteredRowsLookupSelector(apiRef);
|
|
99
|
+
const selectedIdsLookup = selectedIdsLookupSelector(apiRef);
|
|
100
|
+
const selectedDescendants = new Set([]);
|
|
101
|
+
if (!autoSelectDescendants && !autoSelectParents) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (autoSelectDescendants) {
|
|
105
|
+
const rowNode = tree[selectedRow];
|
|
106
|
+
if (rowNode?.type === 'group') {
|
|
107
|
+
const descendants = getGridRowGroupSelectableDescendants(apiRef, selectedRow);
|
|
108
|
+
descendants.forEach(rowId => {
|
|
109
|
+
addRow(rowId);
|
|
110
|
+
selectedDescendants.add(rowId);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (autoSelectParents) {
|
|
115
|
+
const checkAllDescendantsSelected = rowId => {
|
|
116
|
+
if (selectedIdsLookup[rowId] !== rowId && !selectedDescendants.has(rowId)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const node = tree[rowId];
|
|
120
|
+
if (node?.type !== 'group') {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return node.children.every(checkAllDescendantsSelected);
|
|
124
|
+
};
|
|
125
|
+
const traverseParents = rowId => {
|
|
126
|
+
const siblings = getFilteredRowNodeSiblings(tree, filteredRows, rowId);
|
|
127
|
+
if (siblings.length === 0 || siblings.every(checkAllDescendantsSelected)) {
|
|
128
|
+
const rowNode = tree[rowId];
|
|
129
|
+
const parent = rowNode.parent;
|
|
130
|
+
if (parent != null && parent !== GRID_ROOT_GROUP_ID && apiRef.current.isRowSelectable(parent)) {
|
|
131
|
+
addRow(parent);
|
|
132
|
+
selectedDescendants.add(parent);
|
|
133
|
+
traverseParents(parent);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
traverseParents(selectedRow);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export const findRowsToDeselect = (apiRef, tree, deselectedRow, autoSelectDescendants, autoSelectParents, removeRow) => {
|
|
141
|
+
const selectedIdsLookup = selectedIdsLookupSelector(apiRef);
|
|
142
|
+
if (!autoSelectParents && !autoSelectDescendants) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (autoSelectParents) {
|
|
146
|
+
const allParents = getRowNodeParents(tree, deselectedRow);
|
|
147
|
+
allParents.forEach(parent => {
|
|
148
|
+
const isSelected = selectedIdsLookup[parent] === parent;
|
|
149
|
+
if (isSelected) {
|
|
150
|
+
removeRow(parent);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (autoSelectDescendants) {
|
|
155
|
+
const rowNode = tree[deselectedRow];
|
|
156
|
+
if (rowNode?.type === 'group') {
|
|
157
|
+
const descendants = getGridRowGroupSelectableDescendants(apiRef, deselectedRow);
|
|
158
|
+
descendants.forEach(descendant => {
|
|
159
|
+
removeRow(descendant);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
|
-
export declare const gridRowSpanningHiddenCellsSelector: import("
|
|
3
|
-
export declare const gridRowSpanningSpannedCellsSelector: import("
|
|
4
|
-
export declare const gridRowSpanningHiddenCellsOriginMapSelector: import("
|
|
2
|
+
export declare const gridRowSpanningHiddenCellsSelector: import("../../..").OutputSelector<GridStateCommunity, Record<import("../../..").GridRowId, Record<string, boolean>>>;
|
|
3
|
+
export declare const gridRowSpanningSpannedCellsSelector: import("../../..").OutputSelector<GridStateCommunity, Record<import("../../..").GridRowId, Record<string, number>>>;
|
|
4
|
+
export declare const gridRowSpanningHiddenCellsOriginMapSelector: import("../../..").OutputSelector<GridStateCommunity, Record<number, Record<string, number>>>;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
|
-
export declare const gridRowCountSelector: import("
|
|
3
|
-
export declare const gridRowsLoadingSelector: import("
|
|
4
|
-
export declare const gridTopLevelRowCountSelector: import("
|
|
5
|
-
export declare const gridRowsLookupSelector: import("
|
|
6
|
-
export declare const gridRowsDataRowIdToIdLookupSelector: import("
|
|
7
|
-
export declare const gridRowTreeSelector: import("
|
|
8
|
-
export declare const gridRowGroupsToFetchSelector: import("
|
|
9
|
-
export declare const gridRowGroupingNameSelector: import("
|
|
10
|
-
export declare const gridRowTreeDepthsSelector: import("
|
|
11
|
-
export declare const gridRowMaximumTreeDepthSelector: import("
|
|
12
|
-
export declare const gridDataRowIdsSelector: import("
|
|
2
|
+
export declare const gridRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
3
|
+
export declare const gridRowsLoadingSelector: import("../../..").OutputSelector<GridStateCommunity, boolean | undefined>;
|
|
4
|
+
export declare const gridTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
5
|
+
export declare const gridRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToModelLookup<import("../../..").GridValidRowModel>>;
|
|
6
|
+
export declare const gridRowsDataRowIdToIdLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToIdLookup>;
|
|
7
|
+
export declare const gridRowTreeSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig>;
|
|
8
|
+
export declare const gridRowGroupsToFetchSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[] | undefined>;
|
|
9
|
+
export declare const gridRowGroupingNameSelector: import("../../..").OutputSelector<GridStateCommunity, string>;
|
|
10
|
+
export declare const gridRowTreeDepthsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridTreeDepths>;
|
|
11
|
+
export declare const gridRowMaximumTreeDepthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
12
|
+
export declare const gridDataRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - do not document.
|
|
15
15
|
*/
|
|
16
|
-
export declare const gridAdditionalRowGroupsSelector: import("
|
|
16
|
+
export declare const gridAdditionalRowGroupsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
17
17
|
pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
|
|
18
18
|
} | undefined>;
|
|
19
19
|
/**
|
|
20
20
|
* @ignore - do not document.
|
|
21
21
|
*/
|
|
22
|
-
export declare const gridPinnedRowsSelector: import("
|
|
22
|
+
export declare const gridPinnedRowsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
23
23
|
bottom: {
|
|
24
24
|
id: import("../../..").GridRowId;
|
|
25
25
|
model: import("../../..").GridValidRowModel;
|
|
@@ -32,4 +32,4 @@ export declare const gridPinnedRowsSelector: import("../../../utils/createSelect
|
|
|
32
32
|
/**
|
|
33
33
|
* @ignore - do not document.
|
|
34
34
|
*/
|
|
35
|
-
export declare const gridPinnedRowsCountSelector: import("
|
|
35
|
+
export declare const gridPinnedRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
@@ -3,4 +3,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import { GridStateInitializer } from '../../utils/useGridInitializeState';
|
|
5
5
|
export declare const rowsStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'unstable_dataSource' | 'rows' | 'rowCount' | 'getRowId' | 'loading'>>;
|
|
6
|
-
export declare const useGridRows: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "getRowId" | "rowCount" | "throttleRowsMs" | "signature" | "pagination" | "paginationMode" | "loading">) => void;
|
|
6
|
+
export declare const useGridRows: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "getRowId" | "rowCount" | "throttleRowsMs" | "signature" | "pagination" | "paginationMode" | "loading" | "unstable_dataSource">) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import useLazyRef from '@mui/utils/useLazyRef';
|
|
3
4
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
4
5
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
5
6
|
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from "./gridRowsSelector.js";
|
|
@@ -367,11 +368,16 @@ export const useGridRows = (apiRef, props) => {
|
|
|
367
368
|
throttle: false
|
|
368
369
|
});
|
|
369
370
|
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
371
|
+
const previousDataSource = useLazyRef(() => props.unstable_dataSource);
|
|
370
372
|
const handleStrategyProcessorChange = React.useCallback(methodName => {
|
|
373
|
+
if (props.unstable_dataSource && props.unstable_dataSource !== previousDataSource.current) {
|
|
374
|
+
previousDataSource.current = props.unstable_dataSource;
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
371
377
|
if (methodName === 'rowTreeCreation') {
|
|
372
378
|
groupRows();
|
|
373
379
|
}
|
|
374
|
-
}, [groupRows]);
|
|
380
|
+
}, [groupRows, previousDataSource, props.unstable_dataSource]);
|
|
375
381
|
const handleStrategyActivityChange = React.useCallback(() => {
|
|
376
382
|
// `rowTreeCreation` is the only processor ran when `strategyAvailabilityChange` is fired.
|
|
377
383
|
// All the other processors listen to `rowsSet` which will be published by the `groupRows` method below.
|
|
@@ -14,22 +14,22 @@ import { gridDimensionsSelector } from "../dimensions/index.js";
|
|
|
14
14
|
// Similar to https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
15
15
|
function scrollIntoView(dimensions) {
|
|
16
16
|
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
containerSize,
|
|
18
|
+
scrollPosition,
|
|
19
|
+
elementSize,
|
|
20
|
+
elementOffset
|
|
21
21
|
} = dimensions;
|
|
22
|
-
const
|
|
22
|
+
const elementEnd = elementOffset + elementSize;
|
|
23
23
|
// Always scroll to top when cell is higher than viewport to avoid scroll jump
|
|
24
24
|
// See https://github.com/mui/mui-x/issues/4513 and https://github.com/mui/mui-x/issues/4514
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
25
|
+
if (elementSize > containerSize) {
|
|
26
|
+
return elementOffset;
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
28
|
+
if (elementEnd - containerSize > scrollPosition) {
|
|
29
|
+
return elementEnd - containerSize;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
31
|
+
if (elementOffset < scrollPosition) {
|
|
32
|
+
return elementOffset;
|
|
33
33
|
}
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
@@ -73,10 +73,10 @@ export const useGridScroll = (apiRef, props) => {
|
|
|
73
73
|
}
|
|
74
74
|
// When using RTL, `scrollLeft` becomes negative, so we must ensure that we only compare values.
|
|
75
75
|
scrollCoordinates.left = scrollIntoView({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
containerSize: dimensions.viewportOuterSize.width,
|
|
77
|
+
scrollPosition: Math.abs(virtualScrollerRef.current.scrollLeft),
|
|
78
|
+
elementSize: cellWidth,
|
|
79
|
+
elementOffset: columnPositions[params.colIndex]
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
if (params.rowIndex !== undefined) {
|
|
@@ -86,10 +86,10 @@ export const useGridScroll = (apiRef, props) => {
|
|
|
86
86
|
const elementIndex = !props.pagination ? params.rowIndex : params.rowIndex - page * pageSize;
|
|
87
87
|
const targetOffsetHeight = rowsMeta.positions[elementIndex + 1] ? rowsMeta.positions[elementIndex + 1] - rowsMeta.positions[elementIndex] : rowsMeta.currentPageTotalHeight - rowsMeta.positions[elementIndex];
|
|
88
88
|
scrollCoordinates.top = scrollIntoView({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
containerSize: dimensions.viewportInnerSize.height,
|
|
90
|
+
scrollPosition: virtualScrollerRef.current.scrollTop,
|
|
91
|
+
elementSize: targetOffsetHeight,
|
|
92
|
+
elementOffset: rowsMeta.positions[elementIndex]
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
scrollCoordinates = apiRef.current.unstable_applyPipeProcessors('scrollToIndexes', scrollCoordinates, params);
|
|
@@ -5,17 +5,17 @@ import type { GridValidRowModel, GridRowEntry } from '../../../models/gridRows';
|
|
|
5
5
|
* Get the id of the rows after the sorting process.
|
|
6
6
|
* @category Sorting
|
|
7
7
|
*/
|
|
8
|
-
export declare const gridSortedRowIdsSelector: import("
|
|
8
|
+
export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the id and the model of the rows after the sorting process.
|
|
11
11
|
* @category Sorting
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridSortedRowEntriesSelector: import("
|
|
13
|
+
export declare const gridSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowEntry<GridValidRowModel>[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the current sorting model.
|
|
16
16
|
* @category Sorting
|
|
17
17
|
*/
|
|
18
|
-
export declare const gridSortModelSelector: import("
|
|
18
|
+
export declare const gridSortModelSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortModel>;
|
|
19
19
|
export type GridSortColumnLookup = Record<string, {
|
|
20
20
|
sortDirection: GridSortDirection;
|
|
21
21
|
sortIndex?: number;
|
|
@@ -24,4 +24,4 @@ export type GridSortColumnLookup = Record<string, {
|
|
|
24
24
|
* @category Sorting
|
|
25
25
|
* @ignore - do not document.
|
|
26
26
|
*/
|
|
27
|
-
export declare const gridSortColumnLookupSelector: import("
|
|
27
|
+
export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortColumnLookup>;
|
|
@@ -10,27 +10,27 @@ export declare const gridVirtualizationSelector: (state: GridStateCommunity) =>
|
|
|
10
10
|
* @category Virtualization
|
|
11
11
|
* @deprecated Use `gridVirtualizationColumnEnabledSelector` and `gridVirtualizationRowEnabledSelector`
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridVirtualizationEnabledSelector: import("
|
|
13
|
+
export declare const gridVirtualizationEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the enabled state for column virtualization
|
|
16
16
|
* @category Virtualization
|
|
17
17
|
*/
|
|
18
|
-
export declare const gridVirtualizationColumnEnabledSelector: import("
|
|
18
|
+
export declare const gridVirtualizationColumnEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
19
19
|
/**
|
|
20
20
|
* Get the enabled state for row virtualization
|
|
21
21
|
* @category Virtualization
|
|
22
22
|
*/
|
|
23
|
-
export declare const gridVirtualizationRowEnabledSelector: import("
|
|
23
|
+
export declare const gridVirtualizationRowEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
24
24
|
/**
|
|
25
25
|
* Get the render context
|
|
26
26
|
* @category Virtualization
|
|
27
27
|
* @ignore - do not document.
|
|
28
28
|
*/
|
|
29
|
-
export declare const gridRenderContextSelector: import("
|
|
29
|
+
export declare const gridRenderContextSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRenderContext>;
|
|
30
30
|
/**
|
|
31
31
|
* Get the render context, with only columns filled in.
|
|
32
32
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
33
33
|
* @category Virtualization
|
|
34
34
|
* @ignore - do not document.
|
|
35
35
|
*/
|
|
36
|
-
export declare const gridRenderContextColumnsSelector: import("
|
|
36
|
+
export declare const gridRenderContextColumnsSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnsRenderContext>;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon, GridRowEntry } from '../../models';
|
|
4
4
|
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
5
|
-
rows: GridRowEntry<import("
|
|
5
|
+
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
8
8
|
lastRowIndex: number;
|
|
@@ -16,7 +16,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.M
|
|
|
16
16
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
17
17
|
*/
|
|
18
18
|
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
19
|
-
rows: GridRowEntry<import("
|
|
19
|
+
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
20
20
|
range: {
|
|
21
21
|
firstRowIndex: number;
|
|
22
22
|
lastRowIndex: number;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export type { GridRestoreStatePreProcessingContext } from '../hooks/features/sta
|
|
|
65
65
|
export { useGridVirtualScroller, EMPTY_DETAIL_PANELS, } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
66
66
|
export * from '../hooks/features/virtualization';
|
|
67
67
|
export { useGridColumnResize, columnResizeStateInitializer, } from '../hooks/features/columnResize/useGridColumnResize';
|
|
68
|
+
export { ROW_SELECTION_PROPAGATION_DEFAULT } from '../hooks/features/rowSelection/utils';
|
|
68
69
|
export { useTimeout } from '../hooks/utils/useTimeout';
|
|
69
70
|
export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
70
71
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
package/internals/index.js
CHANGED
|
@@ -53,6 +53,7 @@ export { useGridStatePersistence } from "../hooks/features/statePersistence/useG
|
|
|
53
53
|
export { useGridVirtualScroller, EMPTY_DETAIL_PANELS } from "../hooks/features/virtualization/useGridVirtualScroller.js";
|
|
54
54
|
export * from "../hooks/features/virtualization/index.js";
|
|
55
55
|
export { useGridColumnResize, columnResizeStateInitializer } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
56
|
+
export { ROW_SELECTION_PROPAGATION_DEFAULT } from "../hooks/features/rowSelection/utils.js";
|
|
56
57
|
export { useTimeout } from "../hooks/utils/useTimeout.js";
|
|
57
58
|
export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibleRows.js";
|
|
58
59
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
package/locales/bgBG.js
CHANGED
|
@@ -30,11 +30,10 @@ const bgBGGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'Принтиране',
|
|
31
31
|
toolbarExportExcel: 'Изтегли като Excel',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'Търсене',
|
|
34
|
+
columnsManagementNoColumns: 'Няма колони',
|
|
35
|
+
columnsManagementShowHideAllText: 'Покажи/Скрий Всичко',
|
|
36
|
+
columnsManagementReset: 'Нулирай',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'Добави Филтър',
|
|
40
39
|
filterPanelRemoveAll: 'Премахни всички',
|
|
@@ -48,9 +47,9 @@ const bgBGGrid = {
|
|
|
48
47
|
filterPanelInputPlaceholder: 'Стойност на филтъра',
|
|
49
48
|
// Filter operators text
|
|
50
49
|
filterOperatorContains: 'съдържа',
|
|
51
|
-
|
|
50
|
+
filterOperatorDoesNotContain: 'не съдържа',
|
|
52
51
|
filterOperatorEquals: 'равно',
|
|
53
|
-
|
|
52
|
+
filterOperatorDoesNotEqual: 'не е равно',
|
|
54
53
|
filterOperatorStartsWith: 'започва с',
|
|
55
54
|
filterOperatorEndsWith: 'завършва с',
|
|
56
55
|
filterOperatorIs: 'е',
|
|
@@ -70,9 +69,9 @@ const bgBGGrid = {
|
|
|
70
69
|
'filterOperator<=': '<=',
|
|
71
70
|
// Header filter operators text
|
|
72
71
|
headerFilterOperatorContains: 'Съдържа',
|
|
73
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: 'Не съдържа',
|
|
74
73
|
headerFilterOperatorEquals: 'Равнo',
|
|
75
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: 'Не е равно',
|
|
76
75
|
headerFilterOperatorStartsWith: 'Започва с',
|
|
77
76
|
headerFilterOperatorEndsWith: 'Завършва с',
|
|
78
77
|
headerFilterOperatorIs: 'Равно е на',
|
package/locales/deDE.js
CHANGED
|
@@ -47,9 +47,9 @@ const deDEGrid = {
|
|
|
47
47
|
filterPanelInputPlaceholder: 'Wert filtern',
|
|
48
48
|
// Filter operators text
|
|
49
49
|
filterOperatorContains: 'enthält',
|
|
50
|
-
|
|
50
|
+
filterOperatorDoesNotContain: 'enthält nicht',
|
|
51
51
|
filterOperatorEquals: 'ist gleich',
|
|
52
|
-
|
|
52
|
+
filterOperatorDoesNotEqual: 'ist ungleich',
|
|
53
53
|
filterOperatorStartsWith: 'beginnt mit',
|
|
54
54
|
filterOperatorEndsWith: 'endet mit',
|
|
55
55
|
filterOperatorIs: 'ist',
|
|
@@ -69,9 +69,9 @@ const deDEGrid = {
|
|
|
69
69
|
'filterOperator<=': '<=',
|
|
70
70
|
// Header filter operators text
|
|
71
71
|
headerFilterOperatorContains: 'Enthält',
|
|
72
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: 'Enthält nicht',
|
|
73
73
|
headerFilterOperatorEquals: 'Gleich',
|
|
74
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: 'Ungleich',
|
|
75
75
|
headerFilterOperatorStartsWith: 'Beginnt mit',
|
|
76
76
|
headerFilterOperatorEndsWith: 'Endet mit',
|
|
77
77
|
headerFilterOperatorIs: 'Ist',
|
package/locales/frFR.js
CHANGED
|
@@ -47,9 +47,9 @@ const frFRGrid = {
|
|
|
47
47
|
filterPanelInputPlaceholder: 'Filtrer la valeur',
|
|
48
48
|
// Filter operators text
|
|
49
49
|
filterOperatorContains: 'contient',
|
|
50
|
-
|
|
50
|
+
filterOperatorDoesNotContain: 'ne contient pas',
|
|
51
51
|
filterOperatorEquals: 'est égal à',
|
|
52
|
-
|
|
52
|
+
filterOperatorDoesNotEqual: "n'est pas égal à",
|
|
53
53
|
filterOperatorStartsWith: 'commence par',
|
|
54
54
|
filterOperatorEndsWith: 'se termine par',
|
|
55
55
|
filterOperatorIs: 'est',
|
|
@@ -69,9 +69,9 @@ const frFRGrid = {
|
|
|
69
69
|
'filterOperator<=': '<=',
|
|
70
70
|
// Header filter operators text
|
|
71
71
|
headerFilterOperatorContains: 'Contient',
|
|
72
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: 'Ne contient pas',
|
|
73
73
|
headerFilterOperatorEquals: 'Est égal à',
|
|
74
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: "N'est pas égal à",
|
|
75
75
|
headerFilterOperatorStartsWith: 'Commence par',
|
|
76
76
|
headerFilterOperatorEndsWith: 'Se termine par',
|
|
77
77
|
headerFilterOperatorIs: 'Est',
|
package/locales/hrHR.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const hrHR: import("../
|
|
1
|
+
export declare const hrHR: import("../internals").Localization;
|