@mui/x-data-grid 8.0.0-alpha.3 → 8.0.0-alpha.4
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 +274 -0
- package/DataGrid/DataGrid.js +5 -5
- package/README.md +1 -1
- package/components/GridRow.js +1 -1
- package/components/cell/GridActionsCell.js +8 -1
- package/components/cell/GridCell.js +1 -1
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanelContent.js +7 -3
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelFooter.js +4 -3
- package/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/constants/dataGridPropsDefaultValues.js +1 -1
- package/hooks/core/useGridStateInitialization.js +3 -3
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/overlays/useGridOverlays.js +3 -1
- package/hooks/features/pagination/gridPaginationSelector.d.ts +15 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/hooks/features/rowSelection/utils.d.ts +1 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +23 -12
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/hooks/features/rows/useGridRows.js +5 -5
- package/hooks/features/sorting/gridSortingSelector.d.ts +10 -5
- package/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/hooks/features/sorting/index.d.ts +2 -1
- package/hooks/features/sorting/index.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/hooks/utils/useGridSelector.d.ts +4 -6
- package/hooks/utils/useGridSelector.js +6 -44
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/locales/roRO.js +18 -20
- package/models/api/gridStateApi.d.ts +1 -1
- package/models/controlStateItem.d.ts +2 -2
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +5 -5
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridActionsCell.js +8 -1
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/panel/GridColumnsPanel.js +1 -2
- package/modern/components/panel/GridPanelContent.js +7 -3
- package/modern/components/panel/GridPanelFooter.js +4 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/modern/constants/dataGridPropsDefaultValues.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +3 -3
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/modern/hooks/features/rows/useGridRows.js +5 -5
- package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/modern/hooks/features/sorting/index.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/hooks/utils/useGridSelector.js +6 -44
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/locales/roRO.js +18 -20
- package/modern/utils/createSelector.js +1 -120
- package/node/DataGrid/DataGrid.js +5 -5
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridActionsCell.js +8 -1
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/panel/GridColumnsPanel.js +1 -2
- package/node/components/panel/GridPanelContent.js +7 -3
- package/node/components/panel/GridPanelFooter.js +5 -4
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/node/constants/dataGridPropsDefaultValues.js +1 -1
- package/node/hooks/core/useGridStateInitialization.js +3 -3
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/overlays/useGridOverlays.js +3 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
- package/node/hooks/features/sorting/index.js +24 -16
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/hooks/utils/useGridSelector.js +8 -47
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -22
- package/node/locales/roRO.js +18 -20
- package/node/utils/createSelector.js +4 -125
- package/package.json +1 -1
- package/utils/createSelector.d.ts +4 -16
- package/utils/createSelector.js +1 -120
|
@@ -3,4 +3,4 @@ import { GridDensity } from '../../../models/gridDensity';
|
|
|
3
3
|
export declare const COMPACT_DENSITY_FACTOR = 0.7;
|
|
4
4
|
export declare const COMFORTABLE_DENSITY_FACTOR = 1.3;
|
|
5
5
|
export declare const gridDensitySelector: (state: GridStateCommunity) => GridDensity;
|
|
6
|
-
export declare const gridDensityFactorSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
6
|
+
export declare const gridDensityFactorSelector: import("../../..").OutputSelector<GridStateCommunity, GridDensity, number>;
|
|
@@ -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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridFilterModel>;
|
|
8
|
+
export declare const gridFilterModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFilterState").GridFilterState, import("../../..").GridFilterModel>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the current quick filter values.
|
|
11
11
|
* @category Filtering
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridQuickFilterValuesSelector: import("../../..").OutputSelector<GridStateCommunity, any[] | undefined>;
|
|
13
|
+
export declare const gridQuickFilterValuesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridFilterModel, 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("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, boolean>>;
|
|
23
|
+
export declare const gridFilteredRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFilterState").GridFilterState, Record<GridRowId, boolean>>;
|
|
24
24
|
/**
|
|
25
25
|
* @category Filtering
|
|
26
26
|
* @ignore - do not document.
|
|
27
27
|
*/
|
|
28
|
-
export declare const gridFilteredChildrenCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
28
|
+
export declare const gridFilteredChildrenCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFilterState").GridFilterState, Record<GridRowId, number>>;
|
|
29
29
|
/**
|
|
30
30
|
* @category Filtering
|
|
31
31
|
* @ignore - do not document.
|
|
32
32
|
*/
|
|
33
|
-
export declare const gridFilteredDescendantCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
33
|
+
export declare const gridFilteredDescendantCountLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridFilterState").GridFilterState, 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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
39
|
+
export declare const gridExpandedSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
45
|
+
export declare const gridExpandedSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
51
|
+
export declare const gridFilteredSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
57
|
+
export declare const gridFilteredSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
64
|
+
export declare const gridExpandedSortedRowTreeLevelPositionLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig, 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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
69
|
+
export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, number, 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
74
|
+
export declare const gridExpandedRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
79
|
+
export declare const gridFilteredTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
85
|
+
export declare const gridFilteredRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
90
|
+
export declare const gridFilteredDescendantRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number, number>;
|
|
91
91
|
/**
|
|
92
92
|
* @category Filtering
|
|
93
93
|
* @ignore - do not document.
|
|
94
94
|
*/
|
|
95
|
-
export declare const gridFilterActiveItemsSelector: import("../../..").OutputSelector<GridStateCommunity, GridFilterItem[]>;
|
|
95
|
+
export declare const gridFilterActiveItemsSelector: import("../../..").OutputSelector<GridStateCommunity, import("..").GridColumnLookup, 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("../../..").OutputSelector<GridStateCommunity, GridFilterActiveItemsLookup>;
|
|
103
|
+
export declare const gridFilterActiveItemsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridFilterItem[], GridFilterActiveItemsLookup>;
|
|
@@ -59,7 +59,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
59
59
|
});
|
|
60
60
|
const updateFilteredRows = React.useCallback(() => {
|
|
61
61
|
apiRef.current.setState(state => {
|
|
62
|
-
const filterModel = gridFilterModelSelector(state, apiRef.current.instanceId);
|
|
62
|
+
const filterModel = gridFilterModelSelector(state, undefined, apiRef.current.instanceId);
|
|
63
63
|
const filterState = apiRef.current.getFilterState(filterModel);
|
|
64
64
|
const newState = _extends({}, state, {
|
|
65
65
|
filter: _extends({}, state.filter, filterState)
|
|
@@ -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("../../..").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>;
|
|
4
|
+
export declare const gridFocusCellSelector: import("../../..").OutputSelector<GridStateCommunity, GridFocusState, import("../../..").GridCellCoordinates | null>;
|
|
5
|
+
export declare const gridFocusColumnHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, GridFocusState, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
6
|
+
export declare const gridFocusColumnHeaderFilterSelector: import("../../..").OutputSelector<GridStateCommunity, GridFocusState, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
7
|
+
export declare const gridFocusColumnGroupHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, GridFocusState, import("./gridFocusState").GridColumnGroupIdentifier | null>;
|
|
8
8
|
export declare const gridTabIndexStateSelector: (state: GridStateCommunity) => GridTabIndexState;
|
|
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>;
|
|
9
|
+
export declare const gridTabIndexCellSelector: import("../../..").OutputSelector<GridStateCommunity, GridTabIndexState, import("../../..").GridCellCoordinates | null>;
|
|
10
|
+
export declare const gridTabIndexColumnHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, GridTabIndexState, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
11
|
+
export declare const gridTabIndexColumnHeaderFilterSelector: import("../../..").OutputSelector<GridStateCommunity, GridTabIndexState, import("./gridFocusState").GridColumnIdentifier | null>;
|
|
12
|
+
export declare const gridTabIndexColumnGroupHeaderSelector: import("../../..").OutputSelector<GridStateCommunity, GridTabIndexState, import("./gridFocusState").GridColumnGroupIdentifier | null>;
|
|
@@ -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("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
4
|
-
export declare const gridHeaderFilteringEditFieldSelector: import("../../..").OutputSelector<GridStateCommunity, string | null>;
|
|
5
|
-
export declare const gridHeaderFilteringMenuSelector: import("../../..").OutputSelector<GridStateCommunity, string | null>;
|
|
3
|
+
export declare const gridHeaderFilteringEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState, boolean>;
|
|
4
|
+
export declare const gridHeaderFilteringEditFieldSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState, string | null>;
|
|
5
|
+
export declare const gridHeaderFilteringMenuSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState, string | null>;
|
|
@@ -5,6 +5,7 @@ import { useGridApiContext } from "../../utils/useGridApiContext.js";
|
|
|
5
5
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
6
6
|
import { gridExpandedRowCountSelector } from "../filter/index.js";
|
|
7
7
|
import { gridRowCountSelector, gridRowsLoadingSelector } from "../rows/index.js";
|
|
8
|
+
import { gridPinnedRowsCountSelector } from "../rows/gridRowsSelector.js";
|
|
8
9
|
import { GridOverlayWrapper } from "../../../components/base/GridOverlays.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
/**
|
|
@@ -16,7 +17,8 @@ export const useGridOverlays = () => {
|
|
|
16
17
|
const rootProps = useGridRootProps();
|
|
17
18
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
18
19
|
const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
|
|
19
|
-
const
|
|
20
|
+
const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
|
|
21
|
+
const noRows = totalRowCount === 0 && pinnedRowsCount === 0;
|
|
20
22
|
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
21
23
|
const showNoRowsOverlay = !loading && noRows;
|
|
22
24
|
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
@@ -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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationModel>;
|
|
11
|
+
export declare const gridPaginationModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridPaginationInterfaces").GridPaginationState, import("../../..").GridPaginationModel>;
|
|
12
12
|
/**
|
|
13
13
|
* Get the row count
|
|
14
14
|
* @category Pagination
|
|
15
15
|
*/
|
|
16
|
-
export declare const gridPaginationRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
16
|
+
export declare const gridPaginationRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridPaginationInterfaces").GridPaginationState, number>;
|
|
17
17
|
/**
|
|
18
18
|
* Get the pagination meta
|
|
19
19
|
* @category Pagination
|
|
20
20
|
*/
|
|
21
|
-
export declare const gridPaginationMetaSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationMeta>;
|
|
21
|
+
export declare const gridPaginationMetaSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridPaginationInterfaces").GridPaginationState, 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
26
|
+
export declare const gridPageSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationModel, 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
31
|
+
export declare const gridPageSizeSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridPaginationModel, 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("../../..").OutputSelector<GridStateCommunity, number>;
|
|
36
|
+
export declare const gridPageCountSelector: import("../../..").OutputSelector<GridStateCommunity, number, 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("../../..").OutputSelector<GridStateCommunity, {
|
|
41
|
+
export declare const gridPaginationRowRangeSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[], {
|
|
42
42
|
firstRowIndex: number;
|
|
43
43
|
lastRowIndex: number;
|
|
44
44
|
} | null>;
|
|
@@ -46,9 +46,15 @@ export declare const gridPaginationRowRangeSelector: import("../../..").OutputSe
|
|
|
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("../../..").OutputSelector<GridStateCommunity,
|
|
49
|
+
export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
50
|
+
firstRowIndex: number;
|
|
51
|
+
lastRowIndex: number;
|
|
52
|
+
} | null, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
|
|
50
53
|
/**
|
|
51
54
|
* Get the id of each row to include in the current page if the pagination is enabled.
|
|
52
55
|
* @category Pagination
|
|
53
56
|
*/
|
|
54
|
-
export declare const gridPaginatedVisibleSortedGridRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity,
|
|
57
|
+
export declare const gridPaginatedVisibleSortedGridRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
58
|
+
firstRowIndex: number;
|
|
59
|
+
lastRowIndex: number;
|
|
60
|
+
} | null, 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("../../..").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>>;
|
|
4
|
+
export declare const selectedGridRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowSelectionModel, number>;
|
|
5
|
+
export declare const selectedGridRowsSelector: import("../../..").OutputSelector<GridStateCommunity, import("..").GridRowIdToModelLookup<import("../../..").GridValidRowModel>, Map<GridRowId, import("../../..").GridValidRowModel>>;
|
|
6
|
+
export declare const selectedIdsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowSelectionModel, Record<GridRowId, GridRowId>>;
|
|
@@ -313,11 +313,12 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
313
313
|
|
|
314
314
|
const isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);
|
|
315
315
|
const resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
apiRef.current.selectRow(id,
|
|
316
|
+
const selectedRowsCount = apiRef.current.getSelectedRows().size;
|
|
317
|
+
if (canHaveMultipleSelection && selectedRowsCount > 1 && !hasCtrlKey) {
|
|
318
|
+
apiRef.current.selectRow(id, true, resetSelection);
|
|
319
319
|
} else {
|
|
320
|
-
apiRef.current.
|
|
320
|
+
const isSelected = apiRef.current.isRowSelected(id);
|
|
321
|
+
apiRef.current.selectRow(id, !isSelected, resetSelection);
|
|
321
322
|
}
|
|
322
323
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
323
324
|
const handleRowClick = React.useCallback((params, event) => {
|
|
@@ -3,7 +3,7 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
|
|
|
3
3
|
import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import type { GridRowSelectionPropagation } from '../../../models/gridRowSelectionModel';
|
|
5
5
|
export declare const ROW_SELECTION_PROPAGATION_DEFAULT: GridRowSelectionPropagation;
|
|
6
|
-
export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, {
|
|
6
|
+
export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, Record<GridRowId, GridRowId>, {
|
|
7
7
|
isIndeterminate: boolean;
|
|
8
8
|
isChecked: boolean;
|
|
9
9
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
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>>>;
|
|
2
|
+
export declare const gridRowSpanningHiddenCellsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<import("../../..").GridRowId, Record<string, boolean>>>;
|
|
3
|
+
export declare const gridRowSpanningSpannedCellsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<import("../../..").GridRowId, Record<string, number>>>;
|
|
4
|
+
export declare const gridRowSpanningHiddenCellsOriginMapSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<number, Record<string, number>>>;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
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 gridRowTreeSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig>;
|
|
7
|
-
export declare const gridRowGroupsToFetchSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[] | undefined>;
|
|
8
|
-
export declare const gridRowGroupingNameSelector: import("../../..").OutputSelector<GridStateCommunity, string>;
|
|
9
|
-
export declare const gridRowTreeDepthsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridTreeDepths>;
|
|
10
|
-
export declare const gridRowMaximumTreeDepthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
11
|
-
export declare const gridDataRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
|
|
2
|
+
export declare const gridRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
|
|
3
|
+
export declare const gridRowsLoadingSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, boolean | undefined>;
|
|
4
|
+
export declare const gridTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
|
|
5
|
+
export declare const gridRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("./gridRowsInterfaces").GridRowIdToModelLookup<import("../../..").GridValidRowModel>>;
|
|
6
|
+
export declare const gridRowTreeSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowTreeConfig>;
|
|
7
|
+
export declare const gridRowGroupsToFetchSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowId[] | undefined>;
|
|
8
|
+
export declare const gridRowGroupingNameSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, string>;
|
|
9
|
+
export declare const gridRowTreeDepthsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("./gridRowsInterfaces").GridTreeDepths>;
|
|
10
|
+
export declare const gridRowMaximumTreeDepthSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
|
|
11
|
+
export declare const gridDataRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowId[]>;
|
|
12
12
|
/**
|
|
13
13
|
* @ignore - do not document.
|
|
14
14
|
*/
|
|
15
|
-
export declare const gridAdditionalRowGroupsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
15
|
+
export declare const gridAdditionalRowGroupsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, {
|
|
16
16
|
pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
|
|
17
17
|
} | undefined>;
|
|
18
18
|
/**
|
|
19
19
|
* @ignore - do not document.
|
|
20
20
|
*/
|
|
21
21
|
export declare const gridPinnedRowsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
22
|
+
pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
|
|
23
|
+
} | undefined, {
|
|
22
24
|
bottom: {
|
|
23
25
|
id: import("../../..").GridRowId;
|
|
24
26
|
model: import("../../..").GridValidRowModel;
|
|
@@ -31,4 +33,13 @@ export declare const gridPinnedRowsSelector: import("../../..").OutputSelector<G
|
|
|
31
33
|
/**
|
|
32
34
|
* @ignore - do not document.
|
|
33
35
|
*/
|
|
34
|
-
export declare const gridPinnedRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity,
|
|
36
|
+
export declare const gridPinnedRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
37
|
+
bottom: {
|
|
38
|
+
id: import("../../..").GridRowId;
|
|
39
|
+
model: import("../../..").GridValidRowModel;
|
|
40
|
+
}[];
|
|
41
|
+
top: {
|
|
42
|
+
id: import("../../..").GridRowId;
|
|
43
|
+
model: import("../../..").GridValidRowModel;
|
|
44
|
+
}[];
|
|
45
|
+
}, number>;
|
|
@@ -24,4 +24,4 @@ export type RowRange = {
|
|
|
24
24
|
* @requires filterStateInitializer (method) - should be initialized before
|
|
25
25
|
*/
|
|
26
26
|
export declare const rowSpanningStateInitializer: GridStateInitializer;
|
|
27
|
-
export declare const useGridRowSpanning: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "
|
|
27
|
+
export declare const useGridRowSpanning: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rowSpanning" | "pagination" | "paginationMode">) => void;
|
|
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
|
|
|
6
6
|
import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
7
7
|
import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
|
|
8
8
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
9
|
+
import { gridRowTreeSelector } from "./gridRowsSelector.js";
|
|
9
10
|
import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
10
11
|
import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
|
|
11
12
|
const EMPTY_STATE = {
|
|
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
35
36
|
if (skippedFields.has(colDef.field)) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
for (let index = rangeToProcess.firstRowIndex; index
|
|
39
|
+
for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
|
|
39
40
|
const row = visibleRows[index];
|
|
40
41
|
if (hiddenCells[row.id]?.[colDef.field]) {
|
|
41
42
|
continue;
|
|
@@ -129,7 +130,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
129
130
|
* @requires filterStateInitializer (method) - should be initialized before
|
|
130
131
|
*/
|
|
131
132
|
export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
132
|
-
if (props.
|
|
133
|
+
if (props.rowSpanning) {
|
|
133
134
|
const rowIds = state.rows.dataRowIds || [];
|
|
134
135
|
const orderedFields = state.columns.orderedFields || [];
|
|
135
136
|
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
|
142
143
|
}
|
|
143
144
|
const rangeToProcess = {
|
|
144
145
|
firstRowIndex: 0,
|
|
145
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
146
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
146
147
|
};
|
|
147
148
|
const rows = rowIds.map(id => ({
|
|
148
149
|
id,
|
|
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
173
174
|
} = useGridVisibleRows(apiRef, props);
|
|
174
175
|
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
175
176
|
const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
177
|
+
const tree = useGridSelector(apiRef, gridRowTreeSelector);
|
|
176
178
|
const processedRange = useLazyRef(() => {
|
|
177
179
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
178
180
|
firstRowIndex: 0,
|
|
179
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
181
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
180
182
|
} : EMPTY_RANGE;
|
|
181
183
|
});
|
|
182
184
|
const lastRange = React.useRef(EMPTY_RANGE);
|
|
@@ -188,7 +190,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
188
190
|
// - The `paginationModel` is updated
|
|
189
191
|
// - The rows are updated
|
|
190
192
|
(resetState = true) => {
|
|
191
|
-
if (!props.
|
|
193
|
+
if (!props.rowSpanning) {
|
|
192
194
|
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
193
195
|
apiRef.current.setState(state => _extends({}, state, {
|
|
194
196
|
rowSpanning: EMPTY_STATE
|
|
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
204
206
|
}
|
|
205
207
|
const rangeToProcess = getUnprocessedRange({
|
|
206
208
|
firstRowIndex: renderContext.firstRowIndex,
|
|
207
|
-
lastRowIndex: Math.min(renderContext.lastRowIndex
|
|
209
|
+
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
|
|
208
210
|
}, processedRange.current);
|
|
209
211
|
if (rangeToProcess === null) {
|
|
210
212
|
return;
|
|
@@ -233,15 +235,21 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
233
235
|
}
|
|
234
236
|
});
|
|
235
237
|
});
|
|
236
|
-
}, [apiRef, props.
|
|
238
|
+
}, [apiRef, props.rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
|
|
237
239
|
const prevRenderContext = React.useRef(renderContext);
|
|
238
240
|
const isFirstRender = React.useRef(true);
|
|
239
241
|
const shouldResetState = React.useRef(false);
|
|
242
|
+
const previousTree = React.useRef(tree);
|
|
240
243
|
React.useEffect(() => {
|
|
241
244
|
const firstRender = isFirstRender.current;
|
|
242
245
|
if (isFirstRender.current) {
|
|
243
246
|
isFirstRender.current = false;
|
|
244
247
|
}
|
|
248
|
+
if (tree !== previousTree.current) {
|
|
249
|
+
previousTree.current = tree;
|
|
250
|
+
updateRowSpanningState(true);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
245
253
|
if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
|
|
246
254
|
lastRange.current = range;
|
|
247
255
|
shouldResetState.current = true;
|
|
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
255
263
|
return;
|
|
256
264
|
}
|
|
257
265
|
updateRowSpanningState();
|
|
258
|
-
}, [updateRowSpanningState, renderContext, range, lastRange]);
|
|
266
|
+
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
259
267
|
};
|
|
@@ -239,7 +239,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
239
239
|
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
240
240
|
}
|
|
241
241
|
apiRef.current.setState(state => {
|
|
242
|
-
const group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
242
|
+
const group = gridRowTreeSelector(state, undefined, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
243
243
|
const allRows = group.children;
|
|
244
244
|
const oldIndex = allRows.findIndex(row => row === rowId);
|
|
245
245
|
if (oldIndex === -1 || oldIndex === targetIndex) {
|
|
@@ -392,10 +392,10 @@ export const useGridRows = (apiRef, props) => {
|
|
|
392
392
|
const applyHydrateRowsProcessor = React.useCallback(() => {
|
|
393
393
|
apiRef.current.setState(state => {
|
|
394
394
|
const response = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
|
|
395
|
-
tree: gridRowTreeSelector(state, apiRef.current.instanceId),
|
|
396
|
-
treeDepths: gridRowTreeDepthsSelector(state, apiRef.current.instanceId),
|
|
397
|
-
dataRowIds: gridDataRowIdsSelector(state, apiRef.current.instanceId),
|
|
398
|
-
dataRowIdToModelLookup: gridRowsLookupSelector(state, apiRef.current.instanceId)
|
|
395
|
+
tree: gridRowTreeSelector(state, undefined, apiRef.current.instanceId),
|
|
396
|
+
treeDepths: gridRowTreeDepthsSelector(state, undefined, apiRef.current.instanceId),
|
|
397
|
+
dataRowIds: gridDataRowIdsSelector(state, undefined, apiRef.current.instanceId),
|
|
398
|
+
dataRowIdToModelLookup: gridRowsLookupSelector(state, undefined, apiRef.current.instanceId)
|
|
399
399
|
});
|
|
400
400
|
return _extends({}, state, {
|
|
401
401
|
rows: _extends({}, state.rows, response, {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { GridSortDirection, GridSortModel } from '../../../models/gridSortModel';
|
|
2
2
|
import type { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
3
|
-
import type { GridValidRowModel, GridRowEntry } from '../../../models/gridRows';
|
|
3
|
+
import type { GridValidRowModel, GridRowEntry, GridRowId } from '../../../models/gridRows';
|
|
4
4
|
/**
|
|
5
5
|
* Get the id of the rows after the sorting process.
|
|
6
6
|
* @category Sorting
|
|
7
7
|
*/
|
|
8
|
-
export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("
|
|
8
|
+
export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridSortingState").GridSortingState, 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("../../..").OutputSelector<GridStateCommunity, GridRowEntry<GridValidRowModel>[]>;
|
|
13
|
+
export declare const gridSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig, GridRowEntry<GridValidRowModel>[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the current sorting model.
|
|
16
16
|
* @category Sorting
|
|
17
17
|
*/
|
|
18
|
-
export declare const gridSortModelSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortModel>;
|
|
18
|
+
export declare const gridSortModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridSortingState").GridSortingState, GridSortModel>;
|
|
19
19
|
export type GridSortColumnLookup = Record<string, {
|
|
20
20
|
sortDirection: GridSortDirection;
|
|
21
21
|
sortIndex?: number;
|
|
@@ -24,4 +24,9 @@ export type GridSortColumnLookup = Record<string, {
|
|
|
24
24
|
* @category Sorting
|
|
25
25
|
* @ignore - do not document.
|
|
26
26
|
*/
|
|
27
|
-
export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortColumnLookup>;
|
|
27
|
+
export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortModel, GridSortColumnLookup>;
|
|
28
|
+
/**
|
|
29
|
+
* @category Sorting
|
|
30
|
+
* @ignore - do not document.
|
|
31
|
+
*/
|
|
32
|
+
export declare const gridSortedRowIndexLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowId[], Record<GridRowId, number>>;
|
|
@@ -55,4 +55,15 @@ export const gridSortColumnLookupSelector = createSelectorMemoized(gridSortModel
|
|
|
55
55
|
return res;
|
|
56
56
|
}, {});
|
|
57
57
|
return result;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @category Sorting
|
|
62
|
+
* @ignore - do not document.
|
|
63
|
+
*/
|
|
64
|
+
export const gridSortedRowIndexLookupSelector = createSelectorMemoized(gridSortedRowIdsSelector, sortedIds => {
|
|
65
|
+
return sortedIds.reduce((acc, id, index) => {
|
|
66
|
+
acc[id] = index;
|
|
67
|
+
return acc;
|
|
68
|
+
}, Object.create(null));
|
|
58
69
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector, } from './gridSortingSelector';
|
|
2
|
+
export type { GridSortColumnLookup } from './gridSortingSelector';
|
|
2
3
|
export type { GridSortingState, GridSortingInitialState } from './gridSortingState';
|
|
3
4
|
export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator, } from './gridSortingUtils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector } from "./gridSortingSelector.js";
|
|
2
2
|
export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator } from "./gridSortingUtils.js";
|
|
@@ -88,7 +88,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
88
88
|
})
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
const sortModel = gridSortModelSelector(state, apiRef.current.instanceId);
|
|
91
|
+
const sortModel = gridSortModelSelector(state, undefined, apiRef.current.instanceId);
|
|
92
92
|
const sortRowList = buildAggregatedSortingApplier(sortModel, apiRef);
|
|
93
93
|
const sortedRows = apiRef.current.applyStrategyProcessor('sorting', {
|
|
94
94
|
sortRowList
|
|
@@ -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("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
13
|
+
export declare const gridVirtualizationEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, boolean>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the enabled state for column virtualization
|
|
16
16
|
* @category Virtualization
|
|
17
17
|
*/
|
|
18
|
-
export declare const gridVirtualizationColumnEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
18
|
+
export declare const gridVirtualizationColumnEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, boolean>;
|
|
19
19
|
/**
|
|
20
20
|
* Get the enabled state for row virtualization
|
|
21
21
|
* @category Virtualization
|
|
22
22
|
*/
|
|
23
|
-
export declare const gridVirtualizationRowEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
23
|
+
export declare const gridVirtualizationRowEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, 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("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRenderContext>;
|
|
29
|
+
export declare const gridRenderContextSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, 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("../../..").OutputSelector<GridStateCommunity, GridColumnsRenderContext>;
|
|
36
|
+
export declare const gridRenderContextColumnsSelector: import("../../..").OutputSelector<GridStateCommunity, number, GridColumnsRenderContext>;
|