@mui/x-data-grid 8.0.0-alpha.2 → 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 +376 -0
- package/DataGrid/DataGrid.js +5 -13
- 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/columnSelection/GridHeaderCheckbox.js +4 -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 -2
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +25 -9
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +3 -6
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- 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/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridRowEditing.js +3 -3
- 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/gridRowsInterfaces.d.ts +1 -8
- package/hooks/features/rows/gridRowsSelector.d.ts +23 -13
- package/hooks/features/rows/gridRowsSelector.js +0 -1
- package/hooks/features/rows/gridRowsUtils.js +0 -9
- package/hooks/features/rows/index.d.ts +1 -1
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/hooks/features/rows/useGridRows.js +16 -18
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- 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 +3 -3
- package/internals/index.js +3 -3
- package/locales/heIL.js +14 -16
- package/locales/roRO.js +18 -20
- package/locales/trTR.js +12 -14
- package/models/api/gridStateApi.d.ts +1 -1
- package/models/controlStateItem.d.ts +2 -2
- package/models/events/gridEventLookup.d.ts +1 -0
- package/models/gridDataSource.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +1 -9
- package/modern/DataGrid/DataGrid.js +5 -13
- 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/columnSelection/GridHeaderCheckbox.js +4 -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 -2
- package/modern/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- package/modern/hooks/core/useGridStateInitialization.js +3 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.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/gridRowsSelector.js +0 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -9
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/modern/hooks/features/rows/useGridRows.js +16 -18
- 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 +3 -3
- package/modern/locales/heIL.js +14 -16
- package/modern/locales/roRO.js +18 -20
- package/modern/locales/trTR.js +12 -14
- package/modern/utils/createSelector.js +1 -120
- package/node/DataGrid/DataGrid.js +5 -13
- 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/columnSelection/GridHeaderCheckbox.js +4 -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 -2
- package/node/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +7 -1
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- package/node/hooks/core/useGridStateInitialization.js +3 -3
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +2 -2
- 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/gridRowsSelector.js +1 -2
- package/node/hooks/features/rows/gridRowsUtils.js +0 -9
- package/node/hooks/features/rows/index.js +0 -7
- package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/node/hooks/features/rows/useGridRows.js +15 -17
- 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 +15 -22
- package/node/locales/heIL.js +14 -16
- package/node/locales/roRO.js +18 -20
- package/node/locales/trTR.js +12 -14
- 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
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import { GridRowTreeCreationParams, GridRowTreeCreationValue, GridRowsState } from '../../features/rows/gridRowsInterfaces';
|
|
2
2
|
import { GridFilteringMethodParams, GridFilteringMethodValue, GridFilterState, GridVisibleRowsLookupState } from '../../features/filter/gridFilterState';
|
|
3
3
|
import { GridSortingMethodParams, GridSortingMethodValue } from '../../features/sorting/gridSortingState';
|
|
4
|
+
import { GridGetRowsParams, GridGetRowsResponse } from '../../../models/gridDataSource';
|
|
4
5
|
export type GridStrategyProcessorName = keyof GridStrategyProcessingLookup;
|
|
5
|
-
export
|
|
6
|
+
export declare enum GridStrategyGroup {
|
|
7
|
+
DataSource = "dataSource",
|
|
8
|
+
RowTree = "rowTree"
|
|
9
|
+
}
|
|
10
|
+
export type GridStrategyGroupValue = `${GridStrategyGroup}`;
|
|
6
11
|
export interface GridStrategyProcessingLookup {
|
|
12
|
+
dataSourceRowsUpdate: {
|
|
13
|
+
group: GridStrategyGroup.DataSource;
|
|
14
|
+
params: {
|
|
15
|
+
response: GridGetRowsResponse;
|
|
16
|
+
fetchParams: GridGetRowsParams;
|
|
17
|
+
} | {
|
|
18
|
+
error: Error;
|
|
19
|
+
fetchParams: GridGetRowsParams;
|
|
20
|
+
};
|
|
21
|
+
value: void;
|
|
22
|
+
};
|
|
7
23
|
rowTreeCreation: {
|
|
8
|
-
group:
|
|
24
|
+
group: GridStrategyGroup.RowTree;
|
|
9
25
|
params: GridRowTreeCreationParams;
|
|
10
26
|
value: GridRowTreeCreationValue;
|
|
11
27
|
};
|
|
12
28
|
filtering: {
|
|
13
|
-
group:
|
|
29
|
+
group: GridStrategyGroup.RowTree;
|
|
14
30
|
params: GridFilteringMethodParams;
|
|
15
31
|
value: GridFilteringMethodValue;
|
|
16
32
|
};
|
|
17
33
|
sorting: {
|
|
18
|
-
group:
|
|
34
|
+
group: GridStrategyGroup.RowTree;
|
|
19
35
|
params: GridSortingMethodParams;
|
|
20
36
|
value: GridSortingMethodValue;
|
|
21
37
|
};
|
|
22
38
|
visibleRowsLookupCreation: {
|
|
23
|
-
group:
|
|
39
|
+
group: GridStrategyGroup.RowTree;
|
|
24
40
|
params: {
|
|
25
41
|
tree: GridRowsState['tree'];
|
|
26
42
|
filteredRowsLookup: GridFilterState['filteredRowsLookup'];
|
|
@@ -42,17 +58,17 @@ export interface GridStrategyProcessingApi {
|
|
|
42
58
|
registerStrategyProcessor: <P extends GridStrategyProcessorName>(strategyName: string, processorName: P, processor: GridStrategyProcessor<P>) => () => void;
|
|
43
59
|
/**
|
|
44
60
|
* Set a callback to know if a strategy is available.
|
|
45
|
-
* @param {
|
|
61
|
+
* @param {GridStrategyGroupValue} strategyGroup The group for which we set strategy availability.
|
|
46
62
|
* @param {string} strategyName The name of the strategy.
|
|
47
63
|
* @param {boolean} callback A callback to know if this strategy is available.
|
|
48
64
|
*/
|
|
49
|
-
setStrategyAvailability: (strategyGroup:
|
|
65
|
+
setStrategyAvailability: (strategyGroup: GridStrategyGroupValue, strategyName: string, callback: () => boolean) => void;
|
|
50
66
|
/**
|
|
51
67
|
* Returns the name of the active strategy of a given strategy group
|
|
52
|
-
* @param {
|
|
68
|
+
* @param {GridStrategyGroupValue} strategyGroup The group from which we want the active strategy.
|
|
53
69
|
* @returns {string} The name of the active strategy.
|
|
54
70
|
*/
|
|
55
|
-
getActiveStrategy: (strategyGroup:
|
|
71
|
+
getActiveStrategy: (strategyGroup: GridStrategyGroupValue) => string;
|
|
56
72
|
/**
|
|
57
73
|
* Run the processor registered for the active strategy.
|
|
58
74
|
* @param {GridStrategyProcessorName} processorName The name of the processor to run.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
|
-
import { GridStrategyProcessorName,
|
|
3
|
+
import { GridStrategyProcessorName, GridStrategyGroupValue } from './gridStrategyProcessingApi';
|
|
4
4
|
export declare const GRID_DEFAULT_STRATEGY = "none";
|
|
5
5
|
export declare const GRID_STRATEGIES_PROCESSORS: {
|
|
6
|
-
[P in GridStrategyProcessorName]:
|
|
6
|
+
[P in GridStrategyProcessorName]: GridStrategyGroupValue;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
@@ -40,9 +40,6 @@ export declare const GRID_STRATEGIES_PROCESSORS: {
|
|
|
40
40
|
* =====================================================================================================================
|
|
41
41
|
*
|
|
42
42
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
43
|
-
*
|
|
44
|
-
* - row tree creation algorithm.
|
|
45
|
-
* - sorting algorithm.
|
|
46
|
-
* - filtering algorithm.
|
|
43
|
+
* There are two active groups named `rowTree` and `dataSource`.
|
|
47
44
|
*/
|
|
48
45
|
export declare const useGridStrategyProcessing: (apiRef: React.MutableRefObject<GridPrivateApiCommon>) => void;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { GridStrategyGroup } from "./gridStrategyProcessingApi.js";
|
|
4
5
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
5
6
|
export const GRID_DEFAULT_STRATEGY = 'none';
|
|
6
7
|
export const GRID_STRATEGIES_PROCESSORS = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
dataSourceRowsUpdate: GridStrategyGroup.DataSource,
|
|
9
|
+
rowTreeCreation: GridStrategyGroup.RowTree,
|
|
10
|
+
filtering: GridStrategyGroup.RowTree,
|
|
11
|
+
sorting: GridStrategyGroup.RowTree,
|
|
12
|
+
visibleRowsLookupCreation: GridStrategyGroup.RowTree
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
@@ -44,10 +46,7 @@ export const GRID_STRATEGIES_PROCESSORS = {
|
|
|
44
46
|
* =====================================================================================================================
|
|
45
47
|
*
|
|
46
48
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
47
|
-
*
|
|
48
|
-
* - row tree creation algorithm.
|
|
49
|
-
* - sorting algorithm.
|
|
50
|
-
* - filtering algorithm.
|
|
49
|
+
* There are two active groups named `rowTree` and `dataSource`.
|
|
51
50
|
*/
|
|
52
51
|
export const useGridStrategyProcessing = apiRef => {
|
|
53
52
|
const availableStrategies = React.useRef(new Map());
|
|
@@ -24,8 +24,8 @@ export const useGridStateInitialization = apiRef => {
|
|
|
24
24
|
const updatedControlStateIds = [];
|
|
25
25
|
Object.keys(controlStateMapRef.current).forEach(stateId => {
|
|
26
26
|
const controlState = controlStateMapRef.current[stateId];
|
|
27
|
-
const oldSubState = controlState.stateSelector(apiRef.current.state, apiRef.current.instanceId);
|
|
28
|
-
const newSubState = controlState.stateSelector(newState, apiRef.current.instanceId);
|
|
27
|
+
const oldSubState = controlState.stateSelector(apiRef.current.state, undefined, apiRef.current.instanceId);
|
|
28
|
+
const newSubState = controlState.stateSelector(newState, undefined, apiRef.current.instanceId);
|
|
29
29
|
if (newSubState === oldSubState) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -57,7 +57,7 @@ export const useGridStateInitialization = apiRef => {
|
|
|
57
57
|
hasPropChanged
|
|
58
58
|
} = updatedControlStateIds[0];
|
|
59
59
|
const controlState = controlStateMapRef.current[stateId];
|
|
60
|
-
const model = controlState.stateSelector(newState, apiRef.current.instanceId);
|
|
60
|
+
const model = controlState.stateSelector(newState, undefined, apiRef.current.instanceId);
|
|
61
61
|
if (controlState.propOnChange && hasPropChanged) {
|
|
62
62
|
controlState.propOnChange(model, {
|
|
63
63
|
reason,
|
|
@@ -4,9 +4,9 @@ import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export declare const gridColumnGroupingSelector: (state: GridStateCommunity) => import("./gridColumnGroupsInterfaces").GridColumnsGroupingState;
|
|
7
|
-
export declare const gridColumnGroupsUnwrappedModelSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
7
|
+
export declare const gridColumnGroupsUnwrappedModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnsGroupingState, {
|
|
8
8
|
[columnField: string]: string[];
|
|
9
9
|
}>;
|
|
10
|
-
export declare const gridColumnGroupsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnGroupLookup>;
|
|
11
|
-
export declare const gridColumnGroupsHeaderStructureSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridGroupingStructure[][]>;
|
|
12
|
-
export declare const gridColumnGroupsHeaderMaxDepthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
10
|
+
export declare const gridColumnGroupsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnsGroupingState, import("./gridColumnGroupsInterfaces").GridColumnGroupLookup>;
|
|
11
|
+
export declare const gridColumnGroupsHeaderStructureSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnsGroupingState, import("./gridColumnGroupsInterfaces").GridGroupingStructure[][]>;
|
|
12
|
+
export declare const gridColumnGroupsHeaderMaxDepthSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnsGroupingState, number>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
2
|
export declare const gridColumnResizeSelector: (state: GridStateCommunity) => import("./columnResizeState").GridColumnResizeState;
|
|
3
|
-
export declare const gridResizingColumnFieldSelector: import("../../..").OutputSelector<GridStateCommunity, string>;
|
|
3
|
+
export declare const gridResizingColumnFieldSelector: import("../../..").OutputSelector<GridStateCommunity, import("./columnResizeState").GridColumnResizeState, string>;
|
|
@@ -491,7 +491,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
491
491
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
492
492
|
const newColumns = columns.map(column => _extends({}, column, {
|
|
493
493
|
width: widthByField[column.field],
|
|
494
|
-
computedWidth: widthByField[column.field]
|
|
494
|
+
computedWidth: widthByField[column.field],
|
|
495
|
+
flex: 0
|
|
495
496
|
}));
|
|
496
497
|
if (options.expand) {
|
|
497
498
|
const visibleColumns = state.orderedFields.map(field => state.lookup[field]).filter(c => state.columnVisibilityModel[c.field] !== false);
|
|
@@ -9,33 +9,33 @@ export declare const gridColumnsStateSelector: (state: GridStateCommunity) => im
|
|
|
9
9
|
* Get an array of column fields in the order rendered on screen.
|
|
10
10
|
* @category Columns
|
|
11
11
|
*/
|
|
12
|
-
export declare const gridColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, string[]>;
|
|
12
|
+
export declare const gridColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnsState, string[]>;
|
|
13
13
|
/**
|
|
14
14
|
* Get the columns as a lookup (an object containing the field for keys and the definition for values).
|
|
15
15
|
* @category Columns
|
|
16
16
|
*/
|
|
17
|
-
export declare const gridColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnLookup>;
|
|
17
|
+
export declare const gridColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnsState, GridColumnLookup>;
|
|
18
18
|
/**
|
|
19
19
|
* Get an array of column definitions in the order rendered on screen..
|
|
20
20
|
* @category Columns
|
|
21
21
|
*/
|
|
22
|
-
export declare const gridColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
22
|
+
export declare const gridColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnLookup, import("../../../internals").GridStateColDef[]>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the column visibility model, containing the visibility status of each column.
|
|
25
25
|
* If a column is not registered in the model, it is visible.
|
|
26
26
|
* @category Visible Columns
|
|
27
27
|
*/
|
|
28
|
-
export declare const gridColumnVisibilityModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnVisibilityModel>;
|
|
28
|
+
export declare const gridColumnVisibilityModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnsState, import("./gridColumnsInterfaces").GridColumnVisibilityModel>;
|
|
29
29
|
/**
|
|
30
30
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
31
31
|
* @category Visible Columns
|
|
32
32
|
*/
|
|
33
|
-
export declare const gridVisibleColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
33
|
+
export declare const gridVisibleColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnVisibilityModel, import("../../../internals").GridStateColDef[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the field of each visible column.
|
|
36
36
|
* @category Visible Columns
|
|
37
37
|
*/
|
|
38
|
-
export declare const gridVisibleColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, string[]>;
|
|
38
|
+
export declare const gridVisibleColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[], string[]>;
|
|
39
39
|
/**
|
|
40
40
|
* Get the visible pinned columns model.
|
|
41
41
|
* @category Visible Columns
|
|
@@ -45,7 +45,7 @@ export declare const gridPinnedColumnsSelector: (state: GridStateCommunity) => G
|
|
|
45
45
|
* Get the visible pinned columns.
|
|
46
46
|
* @category Visible Columns
|
|
47
47
|
*/
|
|
48
|
-
export declare const gridVisiblePinnedColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
48
|
+
export declare const gridVisiblePinnedColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, boolean, {
|
|
49
49
|
left: import("../../../internals").GridStateColDef[];
|
|
50
50
|
right: import("../../../internals").GridStateColDef[];
|
|
51
51
|
}>;
|
|
@@ -53,25 +53,25 @@ export declare const gridVisiblePinnedColumnDefinitionsSelector: import("../../.
|
|
|
53
53
|
* Get the left position in pixel of each visible columns relative to the left of the first column.
|
|
54
54
|
* @category Visible Columns
|
|
55
55
|
*/
|
|
56
|
-
export declare const gridColumnPositionsSelector: import("../../..").OutputSelector<GridStateCommunity, number[]>;
|
|
56
|
+
export declare const gridColumnPositionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[], number[]>;
|
|
57
57
|
/**
|
|
58
58
|
* Get the summed width of all the visible columns.
|
|
59
59
|
* @category Visible Columns
|
|
60
60
|
*/
|
|
61
|
-
export declare const gridColumnsTotalWidthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
61
|
+
export declare const gridColumnsTotalWidthSelector: import("../../..").OutputSelector<GridStateCommunity, number[], number>;
|
|
62
62
|
/**
|
|
63
63
|
* Get the filterable columns as an array.
|
|
64
64
|
* @category Columns
|
|
65
65
|
*/
|
|
66
|
-
export declare const gridFilterableColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
66
|
+
export declare const gridFilterableColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[], import("../../../internals").GridStateColDef[]>;
|
|
67
67
|
/**
|
|
68
68
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
69
69
|
* @category Columns
|
|
70
70
|
*/
|
|
71
|
-
export declare const gridFilterableColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnLookup>;
|
|
71
|
+
export declare const gridFilterableColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[], GridColumnLookup>;
|
|
72
72
|
/**
|
|
73
73
|
* Checks if some column has a colSpan field.
|
|
74
74
|
* @category Columns
|
|
75
75
|
* @ignore - Do not document
|
|
76
76
|
*/
|
|
77
|
-
export declare const gridHasColSpanSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
77
|
+
export declare const gridHasColSpanSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[], boolean>;
|
|
@@ -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>;
|
|
@@ -11,7 +11,7 @@ import { GridEditModes, GridCellModes } from "../../../models/gridEditRowModel.j
|
|
|
11
11
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
12
12
|
import { gridEditRowsStateSelector } from "./gridEditingSelectors.js";
|
|
13
13
|
import { isPrintableKey, isPasteShortcut } from "../../../utils/keyboardUtils.js";
|
|
14
|
-
import {
|
|
14
|
+
import { gridRowsLookupSelector } from "../rows/gridRowsSelector.js";
|
|
15
15
|
import { deepClone } from "../../../utils/utils.js";
|
|
16
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from "../../../models/params/gridEditCellParams.js";
|
|
17
17
|
import { getDefaultCellValue } from "./utils.js";
|
|
@@ -442,7 +442,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
442
442
|
|
|
443
443
|
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
444
444
|
useEnhancedEffect(() => {
|
|
445
|
-
const
|
|
445
|
+
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
446
446
|
|
|
447
447
|
// Update the ref here because updateStateToStopCellEditMode may change it later
|
|
448
448
|
const copyOfPrevCellModes = prevCellModesModel.current;
|
|
@@ -451,7 +451,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
451
451
|
Object.entries(cellModesModel).forEach(([id, fields]) => {
|
|
452
452
|
Object.entries(fields).forEach(([field, params]) => {
|
|
453
453
|
const prevMode = copyOfPrevCellModes[id]?.[field]?.mode || GridCellModes.View;
|
|
454
|
-
const originalId =
|
|
454
|
+
const originalId = apiRef.current.getRowId(rowsLookup[id]) ?? id;
|
|
455
455
|
if (params.mode === GridCellModes.Edit && prevMode === GridCellModes.View) {
|
|
456
456
|
updateStateToStartCellEditMode(_extends({
|
|
457
457
|
id: originalId,
|
|
@@ -12,7 +12,7 @@ import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
|
12
12
|
import { gridEditRowsStateSelector } from "./gridEditingSelectors.js";
|
|
13
13
|
import { isPrintableKey, isPasteShortcut } from "../../../utils/keyboardUtils.js";
|
|
14
14
|
import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from "../columns/gridColumnsSelector.js";
|
|
15
|
-
import {
|
|
15
|
+
import { gridRowsLookupSelector } from "../rows/gridRowsSelector.js";
|
|
16
16
|
import { deepClone } from "../../../utils/utils.js";
|
|
17
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from "../../../models/params/gridRowParams.js";
|
|
18
18
|
import { GRID_ACTIONS_COLUMN_TYPE } from "../../../colDef/index.js";
|
|
@@ -571,7 +571,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
571
571
|
|
|
572
572
|
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
573
573
|
useEnhancedEffect(() => {
|
|
574
|
-
const
|
|
574
|
+
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
575
575
|
|
|
576
576
|
// Update the ref here because updateStateToStopRowEditMode may change it later
|
|
577
577
|
const copyOfPrevRowModesModel = prevRowModesModel.current;
|
|
@@ -583,7 +583,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
583
583
|
mode: GridRowModes.View
|
|
584
584
|
};
|
|
585
585
|
const prevMode = copyOfPrevRowModesModel[id]?.mode || GridRowModes.View;
|
|
586
|
-
const originalId =
|
|
586
|
+
const originalId = apiRef.current.getRowId(rowsLookup[id]) ?? id;
|
|
587
587
|
if (params.mode === GridRowModes.Edit && prevMode === GridRowModes.View) {
|
|
588
588
|
updateStateToStartRowEditMode(_extends({
|
|
589
589
|
id: originalId
|
|
@@ -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) => {
|