@mui/x-data-grid 8.19.0 → 8.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -0
- package/components/GridRow.js +4 -1
- package/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/components/GridRowDragAndDropOverlay.js +73 -0
- package/components/containers/GridRootStyles.js +16 -39
- package/components/virtualization/GridVirtualScroller.js +5 -3
- package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -16
- package/constants/gridClasses.d.ts +0 -8
- package/constants/gridClasses.js +1 -1
- package/esm/components/GridRow.js +4 -1
- package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/esm/components/GridRowDragAndDropOverlay.js +66 -0
- package/esm/components/containers/GridRootStyles.js +16 -39
- package/esm/components/virtualization/GridVirtualScroller.js +5 -3
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +3 -15
- package/esm/constants/gridClasses.d.ts +0 -8
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/esm/hooks/core/useGridVirtualizer.d.ts +6 -50
- package/esm/hooks/core/useGridVirtualizer.js +10 -9
- package/esm/hooks/features/columnResize/useGridColumnResize.js +17 -8
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/esm/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
- package/esm/hooks/features/filter/index.d.ts +1 -1
- package/esm/hooks/features/filter/index.js +1 -1
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +9 -1
- package/esm/hooks/features/rows/useGridRows.js +3 -1
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/esm/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/esm/hooks/utils/useGridSelector.js +2 -4
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +5 -4
- package/esm/internals/index.js +3 -3
- package/esm/material/index.js +1 -4
- package/esm/models/api/gridRowApi.d.ts +14 -1
- package/esm/models/api/index.d.ts +1 -1
- package/esm/models/api/index.js +0 -1
- package/esm/models/configuration/gridConfiguration.d.ts +2 -2
- package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/hooks/core/useGridVirtualizer.d.ts +6 -50
- package/hooks/core/useGridVirtualizer.js +9 -8
- package/hooks/features/columnResize/useGridColumnResize.js +17 -8
- package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/hooks/features/filter/gridFilterUtils.js +5 -11
- package/hooks/features/filter/index.d.ts +1 -1
- package/hooks/features/filter/index.js +6 -0
- package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +9 -1
- package/hooks/features/rows/useGridRows.js +3 -1
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridSelector.js +2 -4
- package/index.js +1 -1
- package/internals/index.d.ts +5 -4
- package/internals/index.js +16 -9
- package/material/index.js +1 -4
- package/models/api/gridRowApi.d.ts +14 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -11
- package/models/configuration/gridConfiguration.d.ts +2 -2
- package/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/package.json +3 -3
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { GridStateCommunity } from "../../../models/gridStateCommunity.js";
|
|
2
|
+
import type { GridRowId } from "../../../models/gridRows.js";
|
|
2
3
|
export declare const gridRowReorderStateSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, import("./gridRowReorderInterfaces.js").GridRowReorderState>;
|
|
3
4
|
export declare const gridIsRowDragActiveSelector: (args_0: import("react").RefObject<{
|
|
4
5
|
state: GridStateCommunity;
|
|
5
|
-
} | null>) => boolean;
|
|
6
|
+
} | null>) => boolean;
|
|
7
|
+
export declare const gridRowDropTargetSelector: (args_0: import("react").RefObject<{
|
|
8
|
+
state: GridStateCommunity;
|
|
9
|
+
} | null>) => {
|
|
10
|
+
rowId: GridRowId;
|
|
11
|
+
position: import("../../../internals/index.js").RowReorderDropPosition;
|
|
12
|
+
} | {
|
|
13
|
+
rowId: null;
|
|
14
|
+
position: null;
|
|
15
|
+
};
|
|
16
|
+
export declare const gridRowDropTargetRowIdSelector: (args_0: import("react").RefObject<{
|
|
17
|
+
state: GridStateCommunity;
|
|
18
|
+
} | null>) => GridRowId | null;
|
|
19
|
+
export declare const gridRowDropPositionSelector: (args_0: import("react").RefObject<{
|
|
20
|
+
state: GridStateCommunity;
|
|
21
|
+
} | null>, rowId: GridRowId) => import("../../../internals/index.js").RowReorderDropPosition | null;
|
|
22
|
+
export declare const gridDraggedRowIdSelector: (args_0: import("react").RefObject<{
|
|
23
|
+
state: GridStateCommunity;
|
|
24
|
+
} | null>) => GridRowId | null;
|
|
@@ -3,7 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridRowReorderStateSelector = exports.gridIsRowDragActiveSelector = void 0;
|
|
6
|
+
exports.gridRowReorderStateSelector = exports.gridRowDropTargetSelector = exports.gridRowDropTargetRowIdSelector = exports.gridRowDropPositionSelector = exports.gridIsRowDragActiveSelector = exports.gridDraggedRowIdSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
const gridRowReorderStateSelector = exports.gridRowReorderStateSelector = (0, _createSelector.createRootSelector)(state => state.rowReorder);
|
|
9
|
-
const gridIsRowDragActiveSelector = exports.gridIsRowDragActiveSelector = (0, _createSelector.createSelector)(gridRowReorderStateSelector, rowReorder => rowReorder?.isActive ?? false);
|
|
9
|
+
const gridIsRowDragActiveSelector = exports.gridIsRowDragActiveSelector = (0, _createSelector.createSelector)(gridRowReorderStateSelector, rowReorder => rowReorder?.isActive ?? false);
|
|
10
|
+
|
|
11
|
+
// Selector for the entire drop target state
|
|
12
|
+
const gridRowDropTargetSelector = exports.gridRowDropTargetSelector = (0, _createSelector.createSelector)(gridRowReorderStateSelector, rowReorder => rowReorder?.dropTarget ?? {
|
|
13
|
+
rowId: null,
|
|
14
|
+
position: null
|
|
15
|
+
});
|
|
16
|
+
const gridRowDropTargetRowIdSelector = exports.gridRowDropTargetRowIdSelector = (0, _createSelector.createSelector)(gridRowDropTargetSelector, dropTarget => dropTarget.rowId ?? null);
|
|
17
|
+
|
|
18
|
+
// Selector for a specific row's drop position
|
|
19
|
+
const gridRowDropPositionSelector = exports.gridRowDropPositionSelector = (0, _createSelector.createSelector)(gridRowDropTargetSelector, (dropTarget, rowId) => {
|
|
20
|
+
if (dropTarget.rowId === rowId) {
|
|
21
|
+
return dropTarget.position;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Selector for the dragged row ID
|
|
27
|
+
const gridDraggedRowIdSelector = exports.gridDraggedRowIdSelector = (0, _createSelector.createSelector)(gridRowReorderStateSelector, rowReorder => rowReorder?.draggedRowId ?? null);
|
|
@@ -108,6 +108,14 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
108
108
|
const currentModel = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef);
|
|
109
109
|
if (currentModel !== model) {
|
|
110
110
|
logger.debug(`Setting selection model`);
|
|
111
|
+
|
|
112
|
+
// clear the reference to the last selected row if that row is not in the model anymore
|
|
113
|
+
if (lastRowToggled.current !== null) {
|
|
114
|
+
const isInModel = model.ids.has(lastRowToggled.current);
|
|
115
|
+
if (model.type === 'include' && !isInModel || model.type === 'exclude' && isInModel) {
|
|
116
|
+
lastRowToggled.current = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
111
119
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
112
120
|
rowSelection: props.rowSelection ? model : emptyModel
|
|
113
121
|
}), reason);
|
|
@@ -136,7 +144,7 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
136
144
|
return;
|
|
137
145
|
}
|
|
138
146
|
const tree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
139
|
-
lastRowToggled.current = id;
|
|
147
|
+
lastRowToggled.current = isSelected ? id : null;
|
|
140
148
|
if (resetSelection) {
|
|
141
149
|
logger.debug(`Setting selection for row ${id}`);
|
|
142
150
|
const newSelectionModel = {
|
|
@@ -60,7 +60,8 @@ const useGridRows = (apiRef, props, configuration) => {
|
|
|
60
60
|
|
|
61
61
|
// Get overridable methods from configuration
|
|
62
62
|
const {
|
|
63
|
-
setRowIndex
|
|
63
|
+
setRowIndex,
|
|
64
|
+
setRowPosition
|
|
64
65
|
} = configuration.hooks.useGridRowsOverridableMethods(apiRef, props);
|
|
65
66
|
const getRow = React.useCallback(id => {
|
|
66
67
|
const model = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef)[id];
|
|
@@ -345,6 +346,7 @@ const useGridRows = (apiRef, props, configuration) => {
|
|
|
345
346
|
};
|
|
346
347
|
const rowProApi = {
|
|
347
348
|
setRowIndex,
|
|
349
|
+
setRowPosition,
|
|
348
350
|
setRowChildrenExpansion,
|
|
349
351
|
getRowGroupChildren,
|
|
350
352
|
expandAllRows,
|
|
@@ -3,4 +3,5 @@ import { GridRowId } from "../../../models/gridRows.js";
|
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
4
|
export declare const useGridRowsOverridableMethods: (apiRef: RefObject<GridPrivateApiCommunity>) => {
|
|
5
5
|
setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
|
|
6
|
+
setRowPosition: (sourceRowId: GridRowId, targetRowId: GridRowId, position: import("../../../internals/index.js").RowReorderDropPosition) => void | Promise<void>;
|
|
6
7
|
};
|
|
@@ -9,20 +9,69 @@ exports.useGridRowsOverridableMethods = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _gridRowsSelector = require("./gridRowsSelector");
|
|
12
|
+
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
12
13
|
var _gridRowsUtils = require("./gridRowsUtils");
|
|
13
14
|
const useGridRowsOverridableMethods = apiRef => {
|
|
15
|
+
const setRowPosition = React.useCallback((sourceRowId, targetRowId, position) => {
|
|
16
|
+
const sourceNode = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, sourceRowId);
|
|
17
|
+
const targetNode = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, targetRowId);
|
|
18
|
+
if (!sourceNode) {
|
|
19
|
+
throw new Error(`MUI X: No row with id #${sourceRowId} found.`);
|
|
20
|
+
}
|
|
21
|
+
if (!targetNode) {
|
|
22
|
+
throw new Error(`MUI X: No row with id #${targetRowId} found.`);
|
|
23
|
+
}
|
|
24
|
+
if (sourceNode.type !== 'leaf') {
|
|
25
|
+
throw new Error(`MUI X: The row reordering does not support reordering of footer or grouping rows.`);
|
|
26
|
+
}
|
|
27
|
+
if (position === 'inside') {
|
|
28
|
+
throw new Error(`MUI X: The 'inside' position is only supported for tree data. Use 'above' or 'below' for flat data.`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get the target index from the targetRowId using the lookup selector
|
|
32
|
+
const sortedFilteredRowIndexLookup = (0, _gridFilterSelector.gridExpandedSortedRowIndexLookupSelector)(apiRef);
|
|
33
|
+
const targetRowIndexUnadjusted = sortedFilteredRowIndexLookup[targetRowId];
|
|
34
|
+
if (targetRowIndexUnadjusted === undefined) {
|
|
35
|
+
throw new Error(`MUI X: Target row with id #${targetRowId} not found in current view.`);
|
|
36
|
+
}
|
|
37
|
+
const sourceRowIndex = sortedFilteredRowIndexLookup[sourceRowId];
|
|
38
|
+
if (sourceRowIndex === undefined) {
|
|
39
|
+
throw new Error(`MUI X: Source row with id #${sourceRowId} not found in current view.`);
|
|
40
|
+
}
|
|
41
|
+
const dragDirection = targetRowIndexUnadjusted < sourceRowIndex ? 'up' : 'down';
|
|
42
|
+
let targetRowIndex;
|
|
43
|
+
if (dragDirection === 'up') {
|
|
44
|
+
targetRowIndex = position === 'above' ? targetRowIndexUnadjusted : targetRowIndexUnadjusted + 1;
|
|
45
|
+
} else {
|
|
46
|
+
targetRowIndex = position === 'above' ? targetRowIndexUnadjusted - 1 : targetRowIndexUnadjusted;
|
|
47
|
+
}
|
|
48
|
+
if (targetRowIndex === sourceRowIndex) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
apiRef.current.setState(state => {
|
|
52
|
+
const group = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef)[_gridRowsUtils.GRID_ROOT_GROUP_ID];
|
|
53
|
+
const allRows = group.children;
|
|
54
|
+
const updatedRows = [...allRows];
|
|
55
|
+
updatedRows.splice(targetRowIndex, 0, updatedRows.splice(sourceRowIndex, 1)[0]);
|
|
56
|
+
return (0, _extends2.default)({}, state, {
|
|
57
|
+
rows: (0, _extends2.default)({}, state.rows, {
|
|
58
|
+
tree: (0, _extends2.default)({}, state.rows.tree, {
|
|
59
|
+
[_gridRowsUtils.GRID_ROOT_GROUP_ID]: (0, _extends2.default)({}, group, {
|
|
60
|
+
children: updatedRows
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
apiRef.current.publishEvent('rowsSet');
|
|
67
|
+
}, [apiRef]);
|
|
14
68
|
const setRowIndex = React.useCallback((rowId, targetIndex) => {
|
|
15
69
|
const node = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, rowId);
|
|
16
70
|
if (!node) {
|
|
17
71
|
throw new Error(`MUI X: No row with id #${rowId} found.`);
|
|
18
72
|
}
|
|
19
|
-
|
|
20
|
-
// TODO: Remove irrelevant checks
|
|
21
|
-
if (node.parent !== _gridRowsUtils.GRID_ROOT_GROUP_ID) {
|
|
22
|
-
throw new Error(`MUI X: The row reordering do not support reordering of grouped rows yet.`);
|
|
23
|
-
}
|
|
24
73
|
if (node.type !== 'leaf') {
|
|
25
|
-
throw new Error(`MUI X: The row reordering
|
|
74
|
+
throw new Error(`MUI X: The row reordering does not support reordering of footer or grouping rows.`);
|
|
26
75
|
}
|
|
27
76
|
apiRef.current.setState(state => {
|
|
28
77
|
const group = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef)[_gridRowsUtils.GRID_ROOT_GROUP_ID];
|
|
@@ -46,7 +95,8 @@ const useGridRowsOverridableMethods = apiRef => {
|
|
|
46
95
|
apiRef.current.publishEvent('rowsSet');
|
|
47
96
|
}, [apiRef]);
|
|
48
97
|
return {
|
|
49
|
-
setRowIndex
|
|
98
|
+
setRowIndex,
|
|
99
|
+
setRowPosition
|
|
50
100
|
};
|
|
51
101
|
};
|
|
52
102
|
exports.useGridRowsOverridableMethods = useGridRowsOverridableMethods;
|
|
@@ -10,9 +10,7 @@ var _warning = require("@mui/x-internals/warning");
|
|
|
10
10
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
11
11
|
const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
12
12
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
13
|
-
|
|
14
|
-
(0, _warning.warnOnce)(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
|
|
15
|
-
}
|
|
13
|
+
(0, _warning.warnOnce)(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
|
|
16
14
|
return [model[0]];
|
|
17
15
|
}
|
|
18
16
|
return model;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { Virtualization } from '@mui/x-virtualizer';
|
|
2
|
+
import { Virtualization, LayoutDataGridLegacy } from '@mui/x-virtualizer';
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
4
|
import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
|
|
5
5
|
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
6
6
|
type RootProps = DataGridProcessedProps;
|
|
7
|
-
export type GridVirtualizationState = { [K in keyof Virtualization.State['virtualization']]: Virtualization.State['virtualization'][K] };
|
|
7
|
+
export type GridVirtualizationState = { [K in keyof Virtualization.State<LayoutDataGridLegacy>['virtualization']]: Virtualization.State<LayoutDataGridLegacy>['virtualization'][K] };
|
|
8
8
|
export declare const virtualizationStateInitializer: GridStateInitializer<RootProps>;
|
|
9
9
|
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>, rootProps: RootProps): void;
|
|
10
10
|
export {};
|
|
@@ -39,10 +39,8 @@ const createRefs = () => ({
|
|
|
39
39
|
const EMPTY = [];
|
|
40
40
|
const emptyGetSnapshot = () => null;
|
|
41
41
|
function useGridSelector(apiRef, selector, args = undefined, equals = defaultCompare) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
(0, _warning.warnOnce)(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
45
|
-
}
|
|
42
|
+
if (!apiRef.current.state) {
|
|
43
|
+
(0, _warning.warnOnce)(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
46
44
|
}
|
|
47
45
|
const refs = (0, _useLazyRef.useLazyRef)(createRefs);
|
|
48
46
|
const didInit = refs.current.selector !== null;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { useGridPrintExport } from "../hooks/features/export/useGridPrintExport.
|
|
|
41
41
|
export { useGridFilter, filterStateInitializer } from "../hooks/features/filter/useGridFilter.js";
|
|
42
42
|
export { defaultGridFilterLookup } from "../hooks/features/filter/gridFilterState.js";
|
|
43
43
|
export { passFilterLogic } from "../hooks/features/filter/gridFilterUtils.js";
|
|
44
|
-
export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector,
|
|
44
|
+
export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridFilteredSortedDepthRowEntriesSelector } from "../hooks/features/filter/gridFilterSelector.js";
|
|
45
45
|
export { isSingleSelectColDef } from "../components/panel/filterPanel/filterPanelUtils.js";
|
|
46
46
|
export type { GridAggregatedFilterItemApplier, GridAggregatedFilterItemApplierResult } from "../hooks/features/filter/gridFilterState.js";
|
|
47
47
|
export { useGridFocus, focusStateInitializer } from "../hooks/features/focus/useGridFocus.js";
|
|
@@ -54,7 +54,7 @@ export { useGridRows, rowsStateInitializer } from "../hooks/features/rows/useGri
|
|
|
54
54
|
export { useGridRowSpanning, rowSpanningStateInitializer } from "../hooks/features/rows/useGridRowSpanning.js";
|
|
55
55
|
export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
|
|
56
56
|
export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
57
|
-
export { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
|
|
57
|
+
export { useGridRowsOverridableMethods as useGridRowsOverridableMethodsCommunity } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
|
|
58
58
|
export { useGridParamsOverridableMethods } from "../hooks/features/rows/useGridParamsOverridableMethods.js";
|
|
59
59
|
export { useIsCellEditable } from "../hooks/features/editing/useGridCellEditable.js";
|
|
60
60
|
export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
|
|
@@ -66,7 +66,7 @@ export { getRowIdFromRowModel, GRID_ID_AUTOGENERATED, getRowValue } from "../hoo
|
|
|
66
66
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, gridRowSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
67
67
|
export { headerFilteringStateInitializer, useGridHeaderFiltering } from "../hooks/features/headerFiltering/useGridHeaderFiltering.js";
|
|
68
68
|
export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
|
|
69
|
-
export { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
69
|
+
export { gridIsRowDragActiveSelector, gridRowDropPositionSelector, gridRowDropTargetRowIdSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
70
70
|
export type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowReorderInterfaces.js";
|
|
71
71
|
export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
|
|
72
72
|
export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
|
|
@@ -121,4 +121,5 @@ export type { GridConfiguration } from "../models/configuration/gridConfiguratio
|
|
|
121
121
|
export type { CellEditableConditionFn } from "../models/configuration/gridCellEditableConfiguration.js";
|
|
122
122
|
export * from "../hooks/features/pivoting/index.js";
|
|
123
123
|
export { createSvgIcon } from "../material/icons/createSvgIcon.js";
|
|
124
|
-
export { useGridPanelContext } from "../components/panel/GridPanelContext.js";
|
|
124
|
+
export { useGridPanelContext } from "../components/panel/GridPanelContext.js";
|
|
125
|
+
export type { RowReorderDropPosition, RowReorderDragDirection } from "../models/api/gridRowApi.js";
|
package/internals/index.js
CHANGED
|
@@ -46,7 +46,6 @@ var _exportNames = {
|
|
|
46
46
|
passFilterLogic: true,
|
|
47
47
|
gridFilteredChildrenCountLookupSelector: true,
|
|
48
48
|
gridExpandedSortedRowTreeLevelPositionLookupSelector: true,
|
|
49
|
-
gridExpandedSortedRowIndexLookupSelector: true,
|
|
50
49
|
gridFilteredSortedDepthRowEntriesSelector: true,
|
|
51
50
|
useGridFocus: true,
|
|
52
51
|
focusStateInitializer: true,
|
|
@@ -64,7 +63,7 @@ var _exportNames = {
|
|
|
64
63
|
rowSpanningStateInitializer: true,
|
|
65
64
|
useGridAriaAttributes: true,
|
|
66
65
|
useGridRowAriaAttributes: true,
|
|
67
|
-
|
|
66
|
+
useGridRowsOverridableMethodsCommunity: true,
|
|
68
67
|
useGridParamsOverridableMethods: true,
|
|
69
68
|
useIsCellEditable: true,
|
|
70
69
|
useGridRowsPreProcessors: true,
|
|
@@ -85,6 +84,8 @@ var _exportNames = {
|
|
|
85
84
|
useGridRowSelection: true,
|
|
86
85
|
rowSelectionStateInitializer: true,
|
|
87
86
|
gridIsRowDragActiveSelector: true,
|
|
87
|
+
gridRowDropPositionSelector: true,
|
|
88
|
+
gridRowDropTargetRowIdSelector: true,
|
|
88
89
|
useGridRowSelectionPreProcessors: true,
|
|
89
90
|
useGridSorting: true,
|
|
90
91
|
sortingStateInitializer: true,
|
|
@@ -396,12 +397,6 @@ Object.defineProperty(exports, "gridEditRowsStateSelector", {
|
|
|
396
397
|
return _gridEditingSelectors.gridEditRowsStateSelector;
|
|
397
398
|
}
|
|
398
399
|
});
|
|
399
|
-
Object.defineProperty(exports, "gridExpandedSortedRowIndexLookupSelector", {
|
|
400
|
-
enumerable: true,
|
|
401
|
-
get: function () {
|
|
402
|
-
return _gridFilterSelector.gridExpandedSortedRowIndexLookupSelector;
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
400
|
Object.defineProperty(exports, "gridExpandedSortedRowTreeLevelPositionLookupSelector", {
|
|
406
401
|
enumerable: true,
|
|
407
402
|
get: function () {
|
|
@@ -450,6 +445,18 @@ Object.defineProperty(exports, "gridPinnedRowsSelector", {
|
|
|
450
445
|
return _gridRowsSelector.gridPinnedRowsSelector;
|
|
451
446
|
}
|
|
452
447
|
});
|
|
448
|
+
Object.defineProperty(exports, "gridRowDropPositionSelector", {
|
|
449
|
+
enumerable: true,
|
|
450
|
+
get: function () {
|
|
451
|
+
return _gridRowReorderSelector.gridRowDropPositionSelector;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
Object.defineProperty(exports, "gridRowDropTargetRowIdSelector", {
|
|
455
|
+
enumerable: true,
|
|
456
|
+
get: function () {
|
|
457
|
+
return _gridRowReorderSelector.gridRowDropTargetRowIdSelector;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
453
460
|
Object.defineProperty(exports, "gridRowGroupsToFetchSelector", {
|
|
454
461
|
enumerable: true,
|
|
455
462
|
get: function () {
|
|
@@ -792,7 +799,7 @@ Object.defineProperty(exports, "useGridRowsMeta", {
|
|
|
792
799
|
return _useGridRowsMeta.useGridRowsMeta;
|
|
793
800
|
}
|
|
794
801
|
});
|
|
795
|
-
Object.defineProperty(exports, "
|
|
802
|
+
Object.defineProperty(exports, "useGridRowsOverridableMethodsCommunity", {
|
|
796
803
|
enumerable: true,
|
|
797
804
|
get: function () {
|
|
798
805
|
return _useGridRowsOverridableMethods.useGridRowsOverridableMethods;
|
package/material/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from "../gridRows.js";
|
|
2
|
+
export type RowReorderDropPosition = 'above' | 'below' | 'inside';
|
|
3
|
+
export type RowReorderDragDirection = 'up' | 'down';
|
|
2
4
|
export interface GridRowGroupChildrenGetterParams {
|
|
3
5
|
/**
|
|
4
6
|
* The row id of the group
|
|
@@ -96,10 +98,21 @@ export interface GridRowApi {
|
|
|
96
98
|
export interface GridRowProApi {
|
|
97
99
|
/**
|
|
98
100
|
* Moves a row from its original position to the position given by `targetIndex`.
|
|
101
|
+
* Doesn't support tree data ordering. Use `setRowPosition()` instead.
|
|
99
102
|
* @param {GridRowId} rowId The row id
|
|
100
103
|
* @param {number} targetIndex The new position (0-based).
|
|
104
|
+
* @returns {void | Promise<void>} Returns a Promise when async operations are involved (e.g., processRowUpdate)
|
|
105
|
+
* @deprecated Use `setRowPosition()` instead. This method will be removed in the next major version.
|
|
101
106
|
*/
|
|
102
|
-
setRowIndex: (rowId: GridRowId, targetIndex: number) => void
|
|
107
|
+
setRowIndex: (rowId: GridRowId, targetIndex: number) => void | Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Moves a row to a new position relative to another row.
|
|
110
|
+
* @param {GridRowId} sourceRowId The ID of the row to move
|
|
111
|
+
* @param {GridRowId} targetRowId The ID of the row to position relative to
|
|
112
|
+
* @param {DropPosition} position Where to place the source row: 'above', 'below', or 'over' (for tree data)
|
|
113
|
+
* @returns {void | Promise<void>} Returns a Promise when async operations are involved (e.g., processRowUpdate)
|
|
114
|
+
*/
|
|
115
|
+
setRowPosition: (sourceRowId: GridRowId, targetRowId: GridRowId, position: RowReorderDropPosition) => void | Promise<void>;
|
|
103
116
|
/**
|
|
104
117
|
* Gets the rows of a grouping criteria.
|
|
105
118
|
* Only contains the rows provided to the grid, not the rows automatically generated by it.
|
package/models/api/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { GridParamsApi } from "./gridParamsApi.js";
|
|
|
3
3
|
export type { GridCoreApi } from "./gridCoreApi.js";
|
|
4
4
|
export * from "./gridColumnApi.js";
|
|
5
5
|
export * from "./gridDensityApi.js";
|
|
6
|
-
export
|
|
6
|
+
export type { GridRowGroupChildrenGetterParams, GridRowApi, GridRowProApi, GridRowProPrivateApi } from "./gridRowApi.js";
|
|
7
7
|
export type { GridRowsMetaApi } from "./gridRowsMetaApi.js";
|
|
8
8
|
export * from "./gridRowSelectionApi.js";
|
|
9
9
|
export * from "./gridSortApi.js";
|
package/models/api/index.js
CHANGED
|
@@ -25,17 +25,6 @@ Object.keys(_gridDensityApi).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var _gridRowApi = require("./gridRowApi");
|
|
29
|
-
Object.keys(_gridRowApi).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _gridRowApi[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _gridRowApi[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
28
|
var _gridRowSelectionApi = require("./gridRowSelectionApi");
|
|
40
29
|
Object.keys(_gridRowSelectionApi).forEach(function (key) {
|
|
41
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -3,14 +3,14 @@ import type { GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInter
|
|
|
3
3
|
import type { GridAggregationInternalHooks } from "./gridAggregationConfiguration.js";
|
|
4
4
|
import type { GridCellEditableInternalHook } from "./gridCellEditableConfiguration.js";
|
|
5
5
|
import type { GridCSSVariablesInterface } from "../../constants/cssVariables.js";
|
|
6
|
-
import { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
7
6
|
import type { GridPrivateApiCommon } from "../api/gridApiCommon.js";
|
|
8
7
|
import type { GridPrivateApiCommunity } from "../api/gridApiCommunity.js";
|
|
8
|
+
import type { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
9
9
|
import type { GridParamsOverridableMethodsInternalHook } from "./gridParamsConfiguration.js";
|
|
10
10
|
export interface GridAriaAttributesInternalHook {
|
|
11
11
|
useGridAriaAttributes: () => React.HTMLAttributes<HTMLElement>;
|
|
12
12
|
}
|
|
13
|
-
export interface GridInternalHook<Api, Props> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridCellEditableInternalHook<Api, Props>, GridAggregationInternalHooks<Api, Props>, GridRowsOverridableMethodsInternalHook<Api>, GridParamsOverridableMethodsInternalHook<Api> {
|
|
13
|
+
export interface GridInternalHook<Api, Props> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridCellEditableInternalHook<Api, Props>, GridAggregationInternalHooks<Api, Props>, GridRowsOverridableMethodsInternalHook<Api, Props>, GridParamsOverridableMethodsInternalHook<Api> {
|
|
14
14
|
useCSSVariables: () => {
|
|
15
15
|
id: string;
|
|
16
16
|
variables: GridCSSVariablesInterface;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject } from '@mui/x-internals/types';
|
|
3
|
-
import { GridTreeNode
|
|
4
|
-
import {
|
|
3
|
+
import { GridTreeNode } from "../gridRows.js";
|
|
4
|
+
import { GridRowProApi } from "../api/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Get the ARIA attributes for a row
|
|
7
7
|
* @param {GridTreeNode} rowNode The row node
|
|
@@ -15,8 +15,9 @@ export interface GridRowAriaAttributesInternalHook {
|
|
|
15
15
|
/**
|
|
16
16
|
* Overridable row methods interface, these methods could be overriden in a higher plan package.
|
|
17
17
|
*/
|
|
18
|
-
export interface GridRowsOverridableMethodsInternalHook<Api> {
|
|
19
|
-
useGridRowsOverridableMethods: (apiRef: RefObject<Api>, props:
|
|
20
|
-
setRowIndex:
|
|
18
|
+
export interface GridRowsOverridableMethodsInternalHook<Api, Props> {
|
|
19
|
+
useGridRowsOverridableMethods: (apiRef: RefObject<Api>, props: Props) => {
|
|
20
|
+
setRowIndex: GridRowProApi['setRowIndex'];
|
|
21
|
+
setRowPosition: GridRowProApi['setRowPosition'];
|
|
21
22
|
};
|
|
22
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Community plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"use-sync-external-store": "^1.6.0",
|
|
45
|
-
"@mui/x-internals": "8.
|
|
46
|
-
"@mui/x-virtualizer": "0.2.
|
|
45
|
+
"@mui/x-internals": "8.21.0",
|
|
46
|
+
"@mui/x-virtualizer": "0.2.11"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@emotion/react": "^11.9.0",
|