@mui/x-data-grid 7.29.5 → 7.29.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +3 -3
- package/hooks/features/columns/gridColumnsSelector.d.ts +9 -0
- package/hooks/features/columns/gridColumnsSelector.js +9 -2
- package/hooks/features/columns/index.d.ts +1 -1
- package/hooks/features/columns/index.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +9 -5
- package/index.js +1 -1
- package/models/params/gridScrollParams.d.ts +4 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +3 -3
- package/modern/hooks/features/columns/gridColumnsSelector.js +9 -2
- package/modern/hooks/features/columns/index.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +9 -5
- package/modern/index.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +3 -3
- package/node/hooks/features/columns/gridColumnsSelector.js +11 -4
- package/node/hooks/features/columns/index.js +94 -10
- package/node/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +9 -5
- package/node/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,72 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## v7.29.7
|
|
7
|
+
|
|
8
|
+
<!-- generated comparing v7.29.6..v7.x -->
|
|
9
|
+
|
|
10
|
+
_Jun 26, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 4 contributors who made this release possible.
|
|
13
|
+
|
|
14
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
15
|
+
@alisasanib
|
|
16
|
+
|
|
17
|
+
Following are all team members who have contributed to this release:
|
|
18
|
+
@mapache-salvaje, @arminmeh, @michelengelen
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.29.7`
|
|
23
|
+
|
|
24
|
+
Internal changes.
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@7.29.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@7.29.7`, plus:
|
|
29
|
+
|
|
30
|
+
- [DataGridPro] Fix pinned columns order in column management (#18053) @alisasanib
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid-premium@7.29.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
33
|
+
|
|
34
|
+
Same changes as in `@mui/x-data-grid-pro@7.29.7`.
|
|
35
|
+
|
|
36
|
+
### Docs
|
|
37
|
+
|
|
38
|
+
- [docs] Revise the Row Grouping doc (#17494) @mapache-salvaje
|
|
39
|
+
- [docs] Document `GridRenderContext` (#18501) @arminmeh
|
|
40
|
+
- [docs] Prevent stale rows from appearing on sort and filter change in the lazy loading demo (#18463) @arminmeh
|
|
41
|
+
|
|
42
|
+
### Miscellaneous
|
|
43
|
+
|
|
44
|
+
- [infra] Add automated release PR creation script (#18450) @michelengelen
|
|
45
|
+
|
|
46
|
+
## 7.29.6
|
|
47
|
+
|
|
48
|
+
_Jun 6, 2025_
|
|
49
|
+
|
|
50
|
+
We'd like to extend a big thank you to @arminmeh, who made this release possible.
|
|
51
|
+
|
|
52
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
53
|
+
|
|
54
|
+
### Data Grid
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-data-grid@7.29.6`
|
|
57
|
+
|
|
58
|
+
- [DataGrid] Keep pipe pre-processors execution order when callback reference changes (#18217) @arminmeh
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-data-grid-pro@7.29.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
61
|
+
|
|
62
|
+
Same changes as in `@mui/x-data-grid@7.29.6`.
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-data-grid-premium@7.29.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-data-grid-pro@7.29.6`.
|
|
67
|
+
|
|
68
|
+
### Docs
|
|
69
|
+
|
|
70
|
+
- [docs] Keep `groupingColDef` reference stable in the grid demos (#17549) @arminmeh
|
|
71
|
+
|
|
6
72
|
## 7.29.5
|
|
7
73
|
|
|
8
74
|
_May 29, 2025_
|
|
@@ -56,12 +56,12 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
56
56
|
const oldProcessor = groupCache.processors.get(id);
|
|
57
57
|
if (oldProcessor !== processor) {
|
|
58
58
|
groupCache.processors.set(id, processor);
|
|
59
|
-
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
59
|
+
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
60
60
|
runAppliers(groupCache);
|
|
61
61
|
}
|
|
62
62
|
return () => {
|
|
63
|
-
cache.current[group].processors.
|
|
64
|
-
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
63
|
+
cache.current[group].processors.set(id, null);
|
|
64
|
+
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
65
65
|
};
|
|
66
66
|
}, [runAppliers]);
|
|
67
67
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
@@ -41,6 +41,15 @@ export declare const gridVisibleColumnFieldsSelector: import("../../..").OutputS
|
|
|
41
41
|
* @category Visible Columns
|
|
42
42
|
*/
|
|
43
43
|
export declare const gridPinnedColumnsSelector: (state: GridStateCommunity) => GridPinnedColumnFields;
|
|
44
|
+
/**
|
|
45
|
+
* Get all existing pinned columns. Place the columns on the side that depends on the rtl state.
|
|
46
|
+
* @category Pinned Columns
|
|
47
|
+
* @ignore - Do not document
|
|
48
|
+
*/
|
|
49
|
+
export declare const gridExistingPinnedColumnSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
50
|
+
left: string[];
|
|
51
|
+
right: string[];
|
|
52
|
+
}>;
|
|
44
53
|
/**
|
|
45
54
|
* Get the visible pinned columns.
|
|
46
55
|
* @category Visible Columns
|
|
@@ -51,19 +51,26 @@ export const gridVisibleColumnFieldsSelector = createSelectorMemoized(gridVisibl
|
|
|
51
51
|
*/
|
|
52
52
|
export const gridPinnedColumnsSelector = state => state.pinnedColumns;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Get all existing pinned columns. Place the columns on the side that depends on the rtl state.
|
|
56
|
+
* @category Pinned Columns
|
|
57
|
+
* @ignore - Do not document
|
|
58
|
+
*/
|
|
59
|
+
export const gridExistingPinnedColumnSelector = createSelectorMemoized(gridPinnedColumnsSelector, gridColumnFieldsSelector, gridIsRtlSelector, (model, orderedFields, isRtl) => filterMissingColumns(model, orderedFields, isRtl));
|
|
60
|
+
|
|
54
61
|
/**
|
|
55
62
|
* Get the visible pinned columns.
|
|
56
63
|
* @category Visible Columns
|
|
57
64
|
*/
|
|
58
65
|
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
59
|
-
const visiblePinnedFields =
|
|
66
|
+
const visiblePinnedFields = filterMissingColumns(model, visibleColumnFields, isRtl);
|
|
60
67
|
const visiblePinnedColumns = {
|
|
61
68
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
62
69
|
right: visiblePinnedFields.right.map(field => columnsState.lookup[field])
|
|
63
70
|
};
|
|
64
71
|
return visiblePinnedColumns;
|
|
65
72
|
});
|
|
66
|
-
function
|
|
73
|
+
function filterMissingColumns(pinnedColumns, columns, invert) {
|
|
67
74
|
if (!Array.isArray(pinnedColumns.left) && !Array.isArray(pinnedColumns.right)) {
|
|
68
75
|
return EMPTY_PINNED_COLUMN_FIELDS;
|
|
69
76
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridColumnsStateSelector, gridColumnFieldsSelector, gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnDefinitionsSelector, gridVisibleColumnDefinitionsSelector, gridVisibleColumnFieldsSelector, gridPinnedColumnsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridFilterableColumnDefinitionsSelector, gridFilterableColumnLookupSelector, gridHasColSpanSelector, } from './gridColumnsSelector';
|
|
2
2
|
export * from './gridColumnsInterfaces';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridColumnsStateSelector, gridColumnFieldsSelector, gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnDefinitionsSelector, gridVisibleColumnDefinitionsSelector, gridVisibleColumnFieldsSelector, gridPinnedColumnsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridFilterableColumnDefinitionsSelector, gridFilterableColumnLookupSelector, gridHasColSpanSelector } from "./gridColumnsSelector.js";
|
|
2
2
|
export * from "./gridColumnsInterfaces.js";
|
|
@@ -28,17 +28,21 @@ export const useGridRowSelectionPreProcessors = (apiRef, props) => {
|
|
|
28
28
|
headerName: apiRef.current.getLocaleText('checkboxSelectionHeaderName')
|
|
29
29
|
});
|
|
30
30
|
const shouldHaveSelectionColumn = props.checkboxSelection;
|
|
31
|
-
const
|
|
32
|
-
if (shouldHaveSelectionColumn && !
|
|
31
|
+
const hasSelectionColumn = columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] != null;
|
|
32
|
+
if (shouldHaveSelectionColumn && !hasSelectionColumn) {
|
|
33
33
|
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
|
|
34
34
|
columnsState.orderedFields = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields];
|
|
35
|
-
} else if (!shouldHaveSelectionColumn &&
|
|
35
|
+
} else if (!shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
36
36
|
delete columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD];
|
|
37
37
|
columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD);
|
|
38
|
-
} else if (shouldHaveSelectionColumn &&
|
|
38
|
+
} else if (shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
39
39
|
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = _extends({}, selectionColumn, columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD]);
|
|
40
|
+
// If the column is not in the columns array (not a custom selection column), move it to the beginning of the column order
|
|
41
|
+
if (!props.columns.some(col => col.field === GRID_CHECKBOX_SELECTION_FIELD)) {
|
|
42
|
+
columnsState.orderedFields = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD)];
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
return columnsState;
|
|
42
|
-
}, [apiRef, classes, props.checkboxSelection]);
|
|
46
|
+
}, [apiRef, classes, props.columns, props.checkboxSelection]);
|
|
43
47
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateSelectionColumn);
|
|
44
48
|
};
|
package/index.js
CHANGED
|
@@ -2,6 +2,10 @@ export interface GridColumnsRenderContext {
|
|
|
2
2
|
firstColumnIndex: number;
|
|
3
3
|
lastColumnIndex: number;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Provides the current render context range for rows and columns.
|
|
7
|
+
* End index is exclusive - [firstRowIndex, lastRowIndex) and [firstColumnIndex, lastColumnIndex)
|
|
8
|
+
*/
|
|
5
9
|
export interface GridRenderContext extends GridColumnsRenderContext {
|
|
6
10
|
firstRowIndex: number;
|
|
7
11
|
lastRowIndex: number;
|
|
@@ -56,12 +56,12 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
56
56
|
const oldProcessor = groupCache.processors.get(id);
|
|
57
57
|
if (oldProcessor !== processor) {
|
|
58
58
|
groupCache.processors.set(id, processor);
|
|
59
|
-
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
59
|
+
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
60
60
|
runAppliers(groupCache);
|
|
61
61
|
}
|
|
62
62
|
return () => {
|
|
63
|
-
cache.current[group].processors.
|
|
64
|
-
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
63
|
+
cache.current[group].processors.set(id, null);
|
|
64
|
+
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
65
65
|
};
|
|
66
66
|
}, [runAppliers]);
|
|
67
67
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
@@ -51,19 +51,26 @@ export const gridVisibleColumnFieldsSelector = createSelectorMemoized(gridVisibl
|
|
|
51
51
|
*/
|
|
52
52
|
export const gridPinnedColumnsSelector = state => state.pinnedColumns;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Get all existing pinned columns. Place the columns on the side that depends on the rtl state.
|
|
56
|
+
* @category Pinned Columns
|
|
57
|
+
* @ignore - Do not document
|
|
58
|
+
*/
|
|
59
|
+
export const gridExistingPinnedColumnSelector = createSelectorMemoized(gridPinnedColumnsSelector, gridColumnFieldsSelector, gridIsRtlSelector, (model, orderedFields, isRtl) => filterMissingColumns(model, orderedFields, isRtl));
|
|
60
|
+
|
|
54
61
|
/**
|
|
55
62
|
* Get the visible pinned columns.
|
|
56
63
|
* @category Visible Columns
|
|
57
64
|
*/
|
|
58
65
|
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
59
|
-
const visiblePinnedFields =
|
|
66
|
+
const visiblePinnedFields = filterMissingColumns(model, visibleColumnFields, isRtl);
|
|
60
67
|
const visiblePinnedColumns = {
|
|
61
68
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
62
69
|
right: visiblePinnedFields.right.map(field => columnsState.lookup[field])
|
|
63
70
|
};
|
|
64
71
|
return visiblePinnedColumns;
|
|
65
72
|
});
|
|
66
|
-
function
|
|
73
|
+
function filterMissingColumns(pinnedColumns, columns, invert) {
|
|
67
74
|
if (!Array.isArray(pinnedColumns.left) && !Array.isArray(pinnedColumns.right)) {
|
|
68
75
|
return EMPTY_PINNED_COLUMN_FIELDS;
|
|
69
76
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridColumnsStateSelector, gridColumnFieldsSelector, gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnDefinitionsSelector, gridVisibleColumnDefinitionsSelector, gridVisibleColumnFieldsSelector, gridPinnedColumnsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridFilterableColumnDefinitionsSelector, gridFilterableColumnLookupSelector, gridHasColSpanSelector } from "./gridColumnsSelector.js";
|
|
2
2
|
export * from "./gridColumnsInterfaces.js";
|
|
@@ -28,17 +28,21 @@ export const useGridRowSelectionPreProcessors = (apiRef, props) => {
|
|
|
28
28
|
headerName: apiRef.current.getLocaleText('checkboxSelectionHeaderName')
|
|
29
29
|
});
|
|
30
30
|
const shouldHaveSelectionColumn = props.checkboxSelection;
|
|
31
|
-
const
|
|
32
|
-
if (shouldHaveSelectionColumn && !
|
|
31
|
+
const hasSelectionColumn = columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] != null;
|
|
32
|
+
if (shouldHaveSelectionColumn && !hasSelectionColumn) {
|
|
33
33
|
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
|
|
34
34
|
columnsState.orderedFields = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields];
|
|
35
|
-
} else if (!shouldHaveSelectionColumn &&
|
|
35
|
+
} else if (!shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
36
36
|
delete columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD];
|
|
37
37
|
columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD);
|
|
38
|
-
} else if (shouldHaveSelectionColumn &&
|
|
38
|
+
} else if (shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
39
39
|
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = _extends({}, selectionColumn, columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD]);
|
|
40
|
+
// If the column is not in the columns array (not a custom selection column), move it to the beginning of the column order
|
|
41
|
+
if (!props.columns.some(col => col.field === GRID_CHECKBOX_SELECTION_FIELD)) {
|
|
42
|
+
columnsState.orderedFields = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD)];
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
return columnsState;
|
|
42
|
-
}, [apiRef, classes, props.checkboxSelection]);
|
|
46
|
+
}, [apiRef, classes, props.columns, props.checkboxSelection]);
|
|
43
47
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateSelectionColumn);
|
|
44
48
|
};
|
package/modern/index.js
CHANGED
|
@@ -64,12 +64,12 @@ const useGridPipeProcessing = apiRef => {
|
|
|
64
64
|
const oldProcessor = groupCache.processors.get(id);
|
|
65
65
|
if (oldProcessor !== processor) {
|
|
66
66
|
groupCache.processors.set(id, processor);
|
|
67
|
-
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
67
|
+
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
68
68
|
runAppliers(groupCache);
|
|
69
69
|
}
|
|
70
70
|
return () => {
|
|
71
|
-
cache.current[group].processors.
|
|
72
|
-
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
71
|
+
cache.current[group].processors.set(id, null);
|
|
72
|
+
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
73
73
|
};
|
|
74
74
|
}, [runAppliers]);
|
|
75
75
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisibleColumnFieldsSelector = exports.gridVisibleColumnDefinitionsSelector = exports.gridPinnedColumnsSelector = exports.gridHasColSpanSelector = exports.gridFilterableColumnLookupSelector = exports.gridFilterableColumnDefinitionsSelector = exports.gridColumnsStateSelector = exports.gridColumnVisibilityModelSelector = exports.gridColumnPositionsSelector = exports.gridColumnLookupSelector = exports.gridColumnFieldsSelector = exports.gridColumnDefinitionsSelector = void 0;
|
|
6
|
+
exports.gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisibleColumnFieldsSelector = exports.gridVisibleColumnDefinitionsSelector = exports.gridPinnedColumnsSelector = exports.gridHasColSpanSelector = exports.gridFilterableColumnLookupSelector = exports.gridFilterableColumnDefinitionsSelector = exports.gridExistingPinnedColumnSelector = exports.gridColumnsStateSelector = exports.gridColumnVisibilityModelSelector = exports.gridColumnPositionsSelector = exports.gridColumnLookupSelector = exports.gridColumnFieldsSelector = exports.gridColumnDefinitionsSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridColumnsInterfaces = require("./gridColumnsInterfaces");
|
|
9
9
|
var _gridCoreSelector = require("../../core/gridCoreSelector");
|
|
@@ -57,20 +57,27 @@ const gridVisibleColumnFieldsSelector = exports.gridVisibleColumnFieldsSelector
|
|
|
57
57
|
*/
|
|
58
58
|
const gridPinnedColumnsSelector = state => state.pinnedColumns;
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Get all existing pinned columns. Place the columns on the side that depends on the rtl state.
|
|
62
|
+
* @category Pinned Columns
|
|
63
|
+
* @ignore - Do not document
|
|
64
|
+
*/
|
|
65
|
+
exports.gridPinnedColumnsSelector = gridPinnedColumnsSelector;
|
|
66
|
+
const gridExistingPinnedColumnSelector = exports.gridExistingPinnedColumnSelector = (0, _createSelector.createSelectorMemoized)(gridPinnedColumnsSelector, gridColumnFieldsSelector, _gridCoreSelector.gridIsRtlSelector, (model, orderedFields, isRtl) => filterMissingColumns(model, orderedFields, isRtl));
|
|
67
|
+
|
|
60
68
|
/**
|
|
61
69
|
* Get the visible pinned columns.
|
|
62
70
|
* @category Visible Columns
|
|
63
71
|
*/
|
|
64
|
-
exports.gridPinnedColumnsSelector = gridPinnedColumnsSelector;
|
|
65
72
|
const gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisiblePinnedColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, _gridCoreSelector.gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
66
|
-
const visiblePinnedFields =
|
|
73
|
+
const visiblePinnedFields = filterMissingColumns(model, visibleColumnFields, isRtl);
|
|
67
74
|
const visiblePinnedColumns = {
|
|
68
75
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
69
76
|
right: visiblePinnedFields.right.map(field => columnsState.lookup[field])
|
|
70
77
|
};
|
|
71
78
|
return visiblePinnedColumns;
|
|
72
79
|
});
|
|
73
|
-
function
|
|
80
|
+
function filterMissingColumns(pinnedColumns, columns, invert) {
|
|
74
81
|
if (!Array.isArray(pinnedColumns.left) && !Array.isArray(pinnedColumns.right)) {
|
|
75
82
|
return _gridColumnsInterfaces.EMPTY_PINNED_COLUMN_FIELDS;
|
|
76
83
|
}
|
|
@@ -3,20 +3,104 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
gridColumnsStateSelector: true,
|
|
8
|
+
gridColumnFieldsSelector: true,
|
|
9
|
+
gridColumnLookupSelector: true,
|
|
10
|
+
gridColumnVisibilityModelSelector: true,
|
|
11
|
+
gridColumnDefinitionsSelector: true,
|
|
12
|
+
gridVisibleColumnDefinitionsSelector: true,
|
|
13
|
+
gridVisibleColumnFieldsSelector: true,
|
|
14
|
+
gridPinnedColumnsSelector: true,
|
|
15
|
+
gridVisiblePinnedColumnDefinitionsSelector: true,
|
|
16
|
+
gridColumnPositionsSelector: true,
|
|
17
|
+
gridFilterableColumnDefinitionsSelector: true,
|
|
18
|
+
gridFilterableColumnLookupSelector: true,
|
|
19
|
+
gridHasColSpanSelector: true
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "gridColumnDefinitionsSelector", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _gridColumnsSelector.gridColumnDefinitionsSelector;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "gridColumnFieldsSelector", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _gridColumnsSelector.gridColumnFieldsSelector;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "gridColumnLookupSelector", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _gridColumnsSelector.gridColumnLookupSelector;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "gridColumnPositionsSelector", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _gridColumnsSelector.gridColumnPositionsSelector;
|
|
43
|
+
}
|
|
16
44
|
});
|
|
45
|
+
Object.defineProperty(exports, "gridColumnVisibilityModelSelector", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return _gridColumnsSelector.gridColumnVisibilityModelSelector;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "gridColumnsStateSelector", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _gridColumnsSelector.gridColumnsStateSelector;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "gridFilterableColumnDefinitionsSelector", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () {
|
|
60
|
+
return _gridColumnsSelector.gridFilterableColumnDefinitionsSelector;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "gridFilterableColumnLookupSelector", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _gridColumnsSelector.gridFilterableColumnLookupSelector;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "gridHasColSpanSelector", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () {
|
|
72
|
+
return _gridColumnsSelector.gridHasColSpanSelector;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "gridPinnedColumnsSelector", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return _gridColumnsSelector.gridPinnedColumnsSelector;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, "gridVisibleColumnDefinitionsSelector", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return _gridColumnsSelector.gridVisibleColumnDefinitionsSelector;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "gridVisibleColumnFieldsSelector", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _gridColumnsSelector.gridVisibleColumnFieldsSelector;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, "gridVisiblePinnedColumnDefinitionsSelector", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () {
|
|
96
|
+
return _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
var _gridColumnsSelector = require("./gridColumnsSelector");
|
|
17
100
|
var _gridColumnsInterfaces = require("./gridColumnsInterfaces");
|
|
18
101
|
Object.keys(_gridColumnsInterfaces).forEach(function (key) {
|
|
19
102
|
if (key === "default" || key === "__esModule") return;
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
104
|
if (key in exports && exports[key] === _gridColumnsInterfaces[key]) return;
|
|
21
105
|
Object.defineProperty(exports, key, {
|
|
22
106
|
enumerable: true,
|
|
@@ -36,18 +36,22 @@ const useGridRowSelectionPreProcessors = (apiRef, props) => {
|
|
|
36
36
|
headerName: apiRef.current.getLocaleText('checkboxSelectionHeaderName')
|
|
37
37
|
});
|
|
38
38
|
const shouldHaveSelectionColumn = props.checkboxSelection;
|
|
39
|
-
const
|
|
40
|
-
if (shouldHaveSelectionColumn && !
|
|
39
|
+
const hasSelectionColumn = columnsState.lookup[_colDef.GRID_CHECKBOX_SELECTION_FIELD] != null;
|
|
40
|
+
if (shouldHaveSelectionColumn && !hasSelectionColumn) {
|
|
41
41
|
columnsState.lookup[_colDef.GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
|
|
42
42
|
columnsState.orderedFields = [_colDef.GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields];
|
|
43
|
-
} else if (!shouldHaveSelectionColumn &&
|
|
43
|
+
} else if (!shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
44
44
|
delete columnsState.lookup[_colDef.GRID_CHECKBOX_SELECTION_FIELD];
|
|
45
45
|
columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== _colDef.GRID_CHECKBOX_SELECTION_FIELD);
|
|
46
|
-
} else if (shouldHaveSelectionColumn &&
|
|
46
|
+
} else if (shouldHaveSelectionColumn && hasSelectionColumn) {
|
|
47
47
|
columnsState.lookup[_colDef.GRID_CHECKBOX_SELECTION_FIELD] = (0, _extends2.default)({}, selectionColumn, columnsState.lookup[_colDef.GRID_CHECKBOX_SELECTION_FIELD]);
|
|
48
|
+
// If the column is not in the columns array (not a custom selection column), move it to the beginning of the column order
|
|
49
|
+
if (!props.columns.some(col => col.field === _colDef.GRID_CHECKBOX_SELECTION_FIELD)) {
|
|
50
|
+
columnsState.orderedFields = [_colDef.GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.orderedFields.filter(field => field !== _colDef.GRID_CHECKBOX_SELECTION_FIELD)];
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
return columnsState;
|
|
50
|
-
}, [apiRef, classes, props.checkboxSelection]);
|
|
54
|
+
}, [apiRef, classes, props.columns, props.checkboxSelection]);
|
|
51
55
|
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', updateSelectionColumn);
|
|
52
56
|
};
|
|
53
57
|
exports.useGridRowSelectionPreProcessors = useGridRowSelectionPreProcessors;
|
package/node/index.js
CHANGED