@mui/x-data-grid 8.10.2 → 8.11.1
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 +214 -13
- package/DataGrid/DataGrid.js +4 -2
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/colDef/gridDateColDef.js +7 -0
- package/components/GridColumnSortButton.js +1 -2
- package/components/GridColumnUnsortedIcon.d.ts +2 -3
- package/components/GridRow.js +11 -5
- package/components/cell/GridActionsCell.js +8 -4
- package/components/cell/GridCell.js +1 -1
- package/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +12 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/components/columnsManagement/GridColumnsManagement.js +7 -2
- package/components/containers/GridRootStyles.js +19 -6
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
- package/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
- package/esm/DataGrid/DataGrid.js +4 -2
- package/esm/DataGrid/useDataGridComponent.d.ts +2 -1
- package/esm/DataGrid/useDataGridComponent.js +2 -2
- package/esm/colDef/gridDateColDef.js +7 -0
- package/esm/components/GridColumnSortButton.js +1 -2
- package/esm/components/GridColumnUnsortedIcon.d.ts +2 -3
- package/esm/components/GridRow.js +12 -6
- package/esm/components/cell/GridActionsCell.js +8 -4
- package/esm/components/cell/GridCell.js +1 -1
- package/esm/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/esm/components/columnHeaders/GridColumnHeaderItem.js +12 -3
- package/esm/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/esm/components/columnsManagement/GridColumnsManagement.js +6 -1
- package/esm/components/containers/GridRootStyles.js +19 -6
- package/esm/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
- package/esm/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/filter/gridFilterSelector.d.ts +9 -1
- package/esm/hooks/features/filter/gridFilterSelector.js +12 -0
- package/esm/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/esm/hooks/features/rows/useGridRows.d.ts +2 -1
- package/esm/hooks/features/rows/useGridRows.js +6 -34
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +43 -0
- package/esm/hooks/features/scroll/useGridScroll.js +1 -1
- package/esm/hooks/utils/useGridConfiguration.d.ts +3 -1
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/material/index.js +2 -0
- package/esm/models/api/gridParamsApi.d.ts +3 -3
- package/esm/models/colDef/gridColDef.d.ts +4 -2
- package/esm/models/configuration/gridConfiguration.d.ts +6 -4
- package/esm/models/configuration/gridRowConfiguration.d.ts +11 -1
- package/esm/models/gridIconSlotsComponent.d.ts +6 -0
- package/esm/models/props/DataGridProps.d.ts +1 -1
- package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +9 -1
- package/hooks/features/filter/gridFilterSelector.js +13 -1
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/rows/useGridRows.d.ts +2 -1
- package/hooks/features/rows/useGridRows.js +6 -34
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +52 -0
- package/hooks/features/scroll/useGridScroll.js +1 -1
- package/hooks/utils/useGridConfiguration.d.ts +3 -1
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +15 -0
- package/material/index.js +2 -0
- package/models/api/gridParamsApi.d.ts +3 -3
- package/models/colDef/gridColDef.d.ts +4 -2
- package/models/configuration/gridConfiguration.d.ts +6 -4
- package/models/configuration/gridRowConfiguration.d.ts +11 -1
- package/models/gridIconSlotsComponent.d.ts +6 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/package.json +6 -6
- package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
|
@@ -44,7 +44,7 @@ const rowsStateInitializer = (state, props, apiRef) => {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
exports.rowsStateInitializer = rowsStateInitializer;
|
|
47
|
-
const useGridRows = (apiRef, props) => {
|
|
47
|
+
const useGridRows = (apiRef, props, configuration) => {
|
|
48
48
|
if (process.env.NODE_ENV !== 'production') {
|
|
49
49
|
try {
|
|
50
50
|
// Freeze the `rows` prop so developers have a fast failure if they try to use Array.prototype.push().
|
|
@@ -57,6 +57,11 @@ const useGridRows = (apiRef, props) => {
|
|
|
57
57
|
const lastUpdateMs = React.useRef(Date.now());
|
|
58
58
|
const lastRowCount = React.useRef(props.rowCount);
|
|
59
59
|
const timeout = (0, _useTimeout.useTimeout)();
|
|
60
|
+
|
|
61
|
+
// Get overridable methods from configuration
|
|
62
|
+
const {
|
|
63
|
+
setRowIndex
|
|
64
|
+
} = configuration.hooks.useGridRowsOverridableMethods(apiRef, props);
|
|
60
65
|
const getRow = React.useCallback(id => {
|
|
61
66
|
const model = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef)[id];
|
|
62
67
|
if (model) {
|
|
@@ -234,39 +239,6 @@ const useGridRows = (apiRef, props) => {
|
|
|
234
239
|
}
|
|
235
240
|
return children;
|
|
236
241
|
}, [apiRef]);
|
|
237
|
-
const setRowIndex = React.useCallback((rowId, targetIndex) => {
|
|
238
|
-
const node = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, rowId);
|
|
239
|
-
if (!node) {
|
|
240
|
-
throw new Error(`MUI X: No row with id #${rowId} found.`);
|
|
241
|
-
}
|
|
242
|
-
if (node.parent !== _gridRowsUtils.GRID_ROOT_GROUP_ID) {
|
|
243
|
-
throw new Error(`MUI X: The row reordering do not support reordering of grouped rows yet.`);
|
|
244
|
-
}
|
|
245
|
-
if (node.type !== 'leaf') {
|
|
246
|
-
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
247
|
-
}
|
|
248
|
-
apiRef.current.setState(state => {
|
|
249
|
-
const group = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef)[_gridRowsUtils.GRID_ROOT_GROUP_ID];
|
|
250
|
-
const allRows = group.children;
|
|
251
|
-
const oldIndex = allRows.findIndex(row => row === rowId);
|
|
252
|
-
if (oldIndex === -1 || oldIndex === targetIndex) {
|
|
253
|
-
return state;
|
|
254
|
-
}
|
|
255
|
-
logger.debug(`Moving row ${rowId} to index ${targetIndex}`);
|
|
256
|
-
const updatedRows = [...allRows];
|
|
257
|
-
updatedRows.splice(targetIndex, 0, updatedRows.splice(oldIndex, 1)[0]);
|
|
258
|
-
return (0, _extends2.default)({}, state, {
|
|
259
|
-
rows: (0, _extends2.default)({}, state.rows, {
|
|
260
|
-
tree: (0, _extends2.default)({}, state.rows.tree, {
|
|
261
|
-
[_gridRowsUtils.GRID_ROOT_GROUP_ID]: (0, _extends2.default)({}, group, {
|
|
262
|
-
children: updatedRows
|
|
263
|
-
})
|
|
264
|
-
})
|
|
265
|
-
})
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
apiRef.current.publishEvent('rowsSet');
|
|
269
|
-
}, [apiRef, logger]);
|
|
270
242
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
271
243
|
if (props.signature === _signature.GridSignature.DataGrid && newRows.length > 1) {
|
|
272
244
|
throw new Error(['MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { GridRowId } from "../../../models/gridRows.js";
|
|
3
|
+
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
|
+
export declare const useGridRowsOverridableMethods: (apiRef: RefObject<GridPrivateApiCommunity>) => {
|
|
5
|
+
setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useGridRowsOverridableMethods = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _gridRowsSelector = require("./gridRowsSelector");
|
|
12
|
+
var _gridRowsUtils = require("./gridRowsUtils");
|
|
13
|
+
const useGridRowsOverridableMethods = apiRef => {
|
|
14
|
+
const setRowIndex = React.useCallback((rowId, targetIndex) => {
|
|
15
|
+
const node = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, rowId);
|
|
16
|
+
if (!node) {
|
|
17
|
+
throw new Error(`MUI X: No row with id #${rowId} found.`);
|
|
18
|
+
}
|
|
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
|
+
if (node.type !== 'leaf') {
|
|
25
|
+
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
26
|
+
}
|
|
27
|
+
apiRef.current.setState(state => {
|
|
28
|
+
const group = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef)[_gridRowsUtils.GRID_ROOT_GROUP_ID];
|
|
29
|
+
const allRows = group.children;
|
|
30
|
+
const oldIndex = allRows.findIndex(row => row === rowId);
|
|
31
|
+
if (oldIndex === -1 || oldIndex === targetIndex) {
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
const updatedRows = [...allRows];
|
|
35
|
+
updatedRows.splice(targetIndex, 0, updatedRows.splice(oldIndex, 1)[0]);
|
|
36
|
+
return (0, _extends2.default)({}, state, {
|
|
37
|
+
rows: (0, _extends2.default)({}, state.rows, {
|
|
38
|
+
tree: (0, _extends2.default)({}, state.rows.tree, {
|
|
39
|
+
[_gridRowsUtils.GRID_ROOT_GROUP_ID]: (0, _extends2.default)({}, group, {
|
|
40
|
+
children: updatedRows
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
apiRef.current.publishEvent('rowsSet');
|
|
47
|
+
}, [apiRef]);
|
|
48
|
+
return {
|
|
49
|
+
setRowIndex
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.useGridRowsOverridableMethods = useGridRowsOverridableMethods;
|
|
@@ -99,7 +99,7 @@ const useGridScroll = (apiRef, props) => {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
scrollCoordinates = apiRef.current.unstable_applyPipeProcessors('scrollToIndexes', scrollCoordinates, params);
|
|
102
|
-
if (typeof scrollCoordinates.left !== undefined || typeof scrollCoordinates.top !== undefined) {
|
|
102
|
+
if (typeof scrollCoordinates.left !== 'undefined' || typeof scrollCoordinates.top !== 'undefined') {
|
|
103
103
|
apiRef.current.scroll(scrollCoordinates);
|
|
104
104
|
return true;
|
|
105
105
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { GridConfiguration } from "../../models/configuration/gridConfiguration.js";
|
|
2
|
-
|
|
2
|
+
import type { GridPrivateApiCommon } from "../../models/api/gridApiCommon.js";
|
|
3
|
+
import type { GridPrivateApiCommunity } from "../../models/api/gridApiCommunity.js";
|
|
4
|
+
export declare const useGridConfiguration: <Api extends GridPrivateApiCommon = GridPrivateApiCommunity>() => GridConfiguration<Api>;
|
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 } from "../hooks/features/filter/gridFilterSelector.js";
|
|
44
|
+
export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridExpandedSortedRowIndexLookupSelector } 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,6 +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
58
|
export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
|
|
58
59
|
export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridRowTreeUpdatedGroupsManager, GridRowTreeUpdateGroupAction, GridPinnedRowsState } from "../hooks/features/rows/gridRowsInterfaces.js";
|
|
59
60
|
export { getTreeNodeDescendants, buildRootGroup } from "../hooks/features/rows/gridRowsUtils.js";
|
package/internals/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var _exportNames = {
|
|
|
46
46
|
passFilterLogic: true,
|
|
47
47
|
gridFilteredChildrenCountLookupSelector: true,
|
|
48
48
|
gridExpandedSortedRowTreeLevelPositionLookupSelector: true,
|
|
49
|
+
gridExpandedSortedRowIndexLookupSelector: true,
|
|
49
50
|
useGridFocus: true,
|
|
50
51
|
focusStateInitializer: true,
|
|
51
52
|
useGridKeyboardNavigation: true,
|
|
@@ -62,6 +63,7 @@ var _exportNames = {
|
|
|
62
63
|
rowSpanningStateInitializer: true,
|
|
63
64
|
useGridAriaAttributes: true,
|
|
64
65
|
useGridRowAriaAttributes: true,
|
|
66
|
+
useGridRowsOverridableMethods: true,
|
|
65
67
|
useGridRowsPreProcessors: true,
|
|
66
68
|
getTreeNodeDescendants: true,
|
|
67
69
|
buildRootGroup: true,
|
|
@@ -391,6 +393,12 @@ Object.defineProperty(exports, "gridEditRowsStateSelector", {
|
|
|
391
393
|
return _gridEditingSelectors.gridEditRowsStateSelector;
|
|
392
394
|
}
|
|
393
395
|
});
|
|
396
|
+
Object.defineProperty(exports, "gridExpandedSortedRowIndexLookupSelector", {
|
|
397
|
+
enumerable: true,
|
|
398
|
+
get: function () {
|
|
399
|
+
return _gridFilterSelector.gridExpandedSortedRowIndexLookupSelector;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
394
402
|
Object.defineProperty(exports, "gridExpandedSortedRowTreeLevelPositionLookupSelector", {
|
|
395
403
|
enumerable: true,
|
|
396
404
|
get: function () {
|
|
@@ -769,6 +777,12 @@ Object.defineProperty(exports, "useGridRowsMeta", {
|
|
|
769
777
|
return _useGridRowsMeta.useGridRowsMeta;
|
|
770
778
|
}
|
|
771
779
|
});
|
|
780
|
+
Object.defineProperty(exports, "useGridRowsOverridableMethods", {
|
|
781
|
+
enumerable: true,
|
|
782
|
+
get: function () {
|
|
783
|
+
return _useGridRowsOverridableMethods.useGridRowsOverridableMethods;
|
|
784
|
+
}
|
|
785
|
+
});
|
|
772
786
|
Object.defineProperty(exports, "useGridRowsPreProcessors", {
|
|
773
787
|
enumerable: true,
|
|
774
788
|
get: function () {
|
|
@@ -905,6 +919,7 @@ var _useGridRows = require("../hooks/features/rows/useGridRows");
|
|
|
905
919
|
var _useGridRowSpanning = require("../hooks/features/rows/useGridRowSpanning");
|
|
906
920
|
var _useGridAriaAttributes = require("../hooks/utils/useGridAriaAttributes");
|
|
907
921
|
var _useGridRowAriaAttributes = require("../hooks/features/rows/useGridRowAriaAttributes");
|
|
922
|
+
var _useGridRowsOverridableMethods = require("../hooks/features/rows/useGridRowsOverridableMethods");
|
|
908
923
|
var _useGridRowsPreProcessors = require("../hooks/features/rows/useGridRowsPreProcessors");
|
|
909
924
|
var _gridRowsUtils = require("../hooks/features/rows/gridRowsUtils");
|
|
910
925
|
var _useGridRowsMeta = require("../hooks/features/rows/useGridRowsMeta");
|
package/material/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
|
50
50
|
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
51
51
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
52
52
|
var _icons = require("./icons");
|
|
53
|
+
var _GridColumnUnsortedIcon = require("../components/GridColumnUnsortedIcon");
|
|
53
54
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
54
55
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
55
56
|
require("./augmentation");
|
|
@@ -676,6 +677,7 @@ const iconSlots = {
|
|
|
676
677
|
filterPanelDeleteIcon: _icons.GridCloseIcon,
|
|
677
678
|
columnFilteredIcon: _icons.GridFilterAltIcon,
|
|
678
679
|
columnSelectorIcon: _icons.GridColumnIcon,
|
|
680
|
+
columnUnsortedIcon: _GridColumnUnsortedIcon.GridColumnUnsortedIcon,
|
|
679
681
|
columnSortedAscendingIcon: _icons.GridArrowUpwardIcon,
|
|
680
682
|
columnSortedDescendingIcon: _icons.GridArrowDownwardIcon,
|
|
681
683
|
columnResizeIcon: _icons.GridSeparatorIcon,
|
|
@@ -13,7 +13,7 @@ export interface GridParamsApi {
|
|
|
13
13
|
* @param {string} field The column field.
|
|
14
14
|
* @returns {v} The cell value.
|
|
15
15
|
*/
|
|
16
|
-
getCellValue: <V
|
|
16
|
+
getCellValue: <V = any>(id: GridRowId, field: string) => V;
|
|
17
17
|
/**
|
|
18
18
|
* Gets the cell value.
|
|
19
19
|
* Use it instead of `getCellValue` for better performance if you have `row` and `colDef`.
|
|
@@ -23,7 +23,7 @@ export interface GridParamsApi {
|
|
|
23
23
|
* @returns {v} The cell value.
|
|
24
24
|
* @ignore - do not document
|
|
25
25
|
*/
|
|
26
|
-
getRowValue: <V
|
|
26
|
+
getRowValue: <V = any>(row: GridRowModel, colDef: GridColDef) => V;
|
|
27
27
|
/**
|
|
28
28
|
* Gets the cell formatted value
|
|
29
29
|
* Use it instead of `getCellParams` for better performance if you only need the formatted value.
|
|
@@ -33,7 +33,7 @@ export interface GridParamsApi {
|
|
|
33
33
|
* @returns {v} The cell value.
|
|
34
34
|
* @ignore - do not document
|
|
35
35
|
*/
|
|
36
|
-
getRowFormattedValue: <V
|
|
36
|
+
getRowFormattedValue: <V = any>(row: GridRowModel, colDef: GridColDef) => V;
|
|
37
37
|
/**
|
|
38
38
|
* Gets the [[GridCellParams]] object that is passed as argument in events.
|
|
39
39
|
* @param {GridRowId} id The id of the row.
|
|
@@ -279,14 +279,16 @@ export interface GridSingleSelectColDef<R extends GridValidRowModel = any, V = a
|
|
|
279
279
|
* Used to determine the label displayed for a given value option.
|
|
280
280
|
* @param {ValueOptions} value The current value option.
|
|
281
281
|
* @returns {string} The text to be displayed.
|
|
282
|
+
* @default {defaultGetOptionLabel}
|
|
282
283
|
*/
|
|
283
|
-
getOptionLabel
|
|
284
|
+
getOptionLabel: (value: ValueOptions) => string;
|
|
284
285
|
/**
|
|
285
286
|
* Used to determine the value used for a value option.
|
|
286
287
|
* @param {ValueOptions} value The current value option.
|
|
287
288
|
* @returns {string} The value to be used.
|
|
289
|
+
* @default {defaultGetOptionValue}
|
|
288
290
|
*/
|
|
289
|
-
getOptionValue
|
|
291
|
+
getOptionValue: (value: ValueOptions) => any;
|
|
290
292
|
}
|
|
291
293
|
/**
|
|
292
294
|
* Column Definition interface.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridRowAriaAttributesInternalHook } from "./gridRowConfiguration.js";
|
|
2
|
+
import { GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInternalHook } from "./gridRowConfiguration.js";
|
|
3
3
|
import type { GridCSSVariablesInterface } from "../../constants/cssVariables.js";
|
|
4
4
|
import type { GridRowId } from "../gridRows.js";
|
|
5
|
+
import type { GridPrivateApiCommon } from "../api/gridApiCommon.js";
|
|
6
|
+
import type { GridPrivateApiCommunity } from "../api/gridApiCommunity.js";
|
|
5
7
|
export interface GridAriaAttributesInternalHook {
|
|
6
8
|
useGridAriaAttributes: () => React.HTMLAttributes<HTMLElement>;
|
|
7
9
|
}
|
|
8
|
-
export interface GridInternalHook extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook {
|
|
10
|
+
export interface GridInternalHook<Api> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInternalHook<Api> {
|
|
9
11
|
useCSSVariables: () => {
|
|
10
12
|
id: string;
|
|
11
13
|
variables: GridCSSVariablesInterface;
|
|
@@ -15,6 +17,6 @@ export interface GridInternalHook extends GridAriaAttributesInternalHook, GridRo
|
|
|
15
17
|
value: any;
|
|
16
18
|
} | null;
|
|
17
19
|
}
|
|
18
|
-
export interface GridConfiguration {
|
|
19
|
-
hooks: GridInternalHook
|
|
20
|
+
export interface GridConfiguration<Api extends GridPrivateApiCommon = GridPrivateApiCommunity> {
|
|
21
|
+
hooks: GridInternalHook<Api>;
|
|
20
22
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
3
|
+
import { GridTreeNode, GridRowId } from "../gridRows.js";
|
|
4
|
+
import { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
3
5
|
/**
|
|
4
6
|
* Get the ARIA attributes for a row
|
|
5
7
|
* @param {GridTreeNode} rowNode The row node
|
|
@@ -9,4 +11,12 @@ import { GridTreeNode } from "../gridRows.js";
|
|
|
9
11
|
export type GetRowAriaAttributesFn = (rowNode: GridTreeNode, index: number) => React.HTMLAttributes<HTMLElement>;
|
|
10
12
|
export interface GridRowAriaAttributesInternalHook {
|
|
11
13
|
useGridRowAriaAttributes: () => GetRowAriaAttributesFn;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Overridable row methods interface, these methods could be overriden in a higher plan package.
|
|
17
|
+
*/
|
|
18
|
+
export interface GridRowsOverridableMethodsInternalHook<Api> {
|
|
19
|
+
useGridRowsOverridableMethods: (apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, 'processRowUpdate' | 'onProcessRowUpdateError' | 'dataSource'>) => {
|
|
20
|
+
setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
|
|
21
|
+
};
|
|
12
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconProps } from "./gridBaseSlots.js";
|
|
3
|
+
import type { GridColumnUnsortedIconProps } from "../components/GridColumnUnsortedIcon.js";
|
|
3
4
|
/**
|
|
4
5
|
* Set of icons used in the grid component UI.
|
|
5
6
|
*/
|
|
@@ -34,6 +35,11 @@ export interface GridIconSlotsComponent {
|
|
|
34
35
|
* @default GridColumnIcon
|
|
35
36
|
*/
|
|
36
37
|
columnSelectorIcon: React.JSXElementConstructor<IconProps>;
|
|
38
|
+
/**
|
|
39
|
+
* Icon displayed on the side of the column header title when unsorted.
|
|
40
|
+
* @default GridColumnUnsortedIcon
|
|
41
|
+
*/
|
|
42
|
+
columnUnsortedIcon: React.JSXElementConstructor<GridColumnUnsortedIconProps> | null;
|
|
37
43
|
/**
|
|
38
44
|
* Icon displayed on the side of the column header title when sorted in ascending order.
|
|
39
45
|
* @default GridArrowUpwardIcon
|
|
@@ -787,7 +787,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
787
787
|
rowId: GridRowId;
|
|
788
788
|
}) => Promise<R> | R;
|
|
789
789
|
/**
|
|
790
|
-
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
790
|
+
* Callback called when `processRowUpdate()` throws an error or rejects.
|
|
791
791
|
* @param {any} error The error thrown.
|
|
792
792
|
*/
|
|
793
793
|
onProcessRowUpdateError?: (error: any) => void;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Community plan edition of the MUI X Data Grid components.",
|
|
6
|
-
"main": "./index.js",
|
|
7
6
|
"license": "MIT",
|
|
8
7
|
"bugs": {
|
|
9
8
|
"url": "https://github.com/mui/mui-x/issues"
|
|
@@ -43,8 +42,8 @@
|
|
|
43
42
|
"clsx": "^2.1.1",
|
|
44
43
|
"prop-types": "^15.8.1",
|
|
45
44
|
"use-sync-external-store": "^1.5.0",
|
|
46
|
-
"@mui/x-internals": "8.
|
|
47
|
-
"@mui/x-virtualizer": "0.1.
|
|
45
|
+
"@mui/x-internals": "8.11.1",
|
|
46
|
+
"@mui/x-virtualizer": "0.1.5"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"@emotion/react": "^11.9.0",
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
"node": ">=14.0.0"
|
|
67
66
|
},
|
|
68
67
|
"type": "commonjs",
|
|
68
|
+
"main": "./index.js",
|
|
69
69
|
"types": "./index.d.ts",
|
|
70
70
|
"exports": {
|
|
71
71
|
"./package.json": "./package.json",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"types": "./index.d.ts",
|
|
75
75
|
"default": "./index.js"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
77
|
+
"default": {
|
|
78
78
|
"types": "./esm/index.d.ts",
|
|
79
79
|
"default": "./esm/index.js"
|
|
80
80
|
}
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"types": "./*/index.d.ts",
|
|
85
85
|
"default": "./*/index.js"
|
|
86
86
|
},
|
|
87
|
-
"
|
|
87
|
+
"default": {
|
|
88
88
|
"types": "./esm/*/index.d.ts",
|
|
89
89
|
"default": "./esm/*/index.js"
|
|
90
90
|
}
|
|
@@ -16,8 +16,6 @@ class FinalizationRegistryBasedCleanupTracking {
|
|
|
16
16
|
unregister(unregisterToken) {
|
|
17
17
|
this.registry.unregister(unregisterToken);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line class-methods-use-this
|
|
21
19
|
reset() {}
|
|
22
20
|
}
|
|
23
21
|
exports.FinalizationRegistryBasedCleanupTracking = FinalizationRegistryBasedCleanupTracking;
|