@mui/x-data-grid 8.10.2 → 8.11.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +140 -13
  2. package/DataGrid/DataGrid.js +4 -2
  3. package/DataGrid/useDataGridComponent.d.ts +2 -1
  4. package/DataGrid/useDataGridComponent.js +2 -2
  5. package/colDef/gridDateColDef.js +7 -0
  6. package/components/GridColumnSortButton.js +1 -2
  7. package/components/GridColumnUnsortedIcon.d.ts +2 -3
  8. package/components/GridRow.js +11 -5
  9. package/components/cell/GridActionsCell.js +8 -4
  10. package/components/columnHeaders/GridColumnGroupHeader.js +13 -1
  11. package/components/columnHeaders/GridColumnHeaderItem.js +12 -3
  12. package/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
  13. package/components/columnsManagement/GridColumnsManagement.js +7 -2
  14. package/components/containers/GridRootStyles.js +19 -6
  15. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
  16. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
  17. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
  18. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
  19. package/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
  20. package/esm/DataGrid/DataGrid.js +4 -2
  21. package/esm/DataGrid/useDataGridComponent.d.ts +2 -1
  22. package/esm/DataGrid/useDataGridComponent.js +2 -2
  23. package/esm/colDef/gridDateColDef.js +7 -0
  24. package/esm/components/GridColumnSortButton.js +1 -2
  25. package/esm/components/GridColumnUnsortedIcon.d.ts +2 -3
  26. package/esm/components/GridRow.js +12 -6
  27. package/esm/components/cell/GridActionsCell.js +8 -4
  28. package/esm/components/columnHeaders/GridColumnGroupHeader.js +13 -1
  29. package/esm/components/columnHeaders/GridColumnHeaderItem.js +12 -3
  30. package/esm/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
  31. package/esm/components/columnsManagement/GridColumnsManagement.js +6 -1
  32. package/esm/components/containers/GridRootStyles.js +19 -6
  33. package/esm/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
  34. package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
  35. package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
  36. package/esm/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
  37. package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
  38. package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
  39. package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
  40. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  41. package/esm/hooks/features/filter/gridFilterSelector.d.ts +9 -1
  42. package/esm/hooks/features/filter/gridFilterSelector.js +12 -0
  43. package/esm/hooks/features/pagination/useGridPaginationModel.js +2 -2
  44. package/esm/hooks/features/rows/useGridRows.d.ts +2 -1
  45. package/esm/hooks/features/rows/useGridRows.js +6 -34
  46. package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
  47. package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +43 -0
  48. package/esm/hooks/features/scroll/useGridScroll.js +1 -1
  49. package/esm/hooks/utils/useGridConfiguration.d.ts +3 -1
  50. package/esm/index.js +1 -1
  51. package/esm/internals/index.d.ts +2 -1
  52. package/esm/internals/index.js +2 -1
  53. package/esm/material/index.js +2 -0
  54. package/esm/models/api/gridParamsApi.d.ts +3 -3
  55. package/esm/models/colDef/gridColDef.d.ts +4 -2
  56. package/esm/models/configuration/gridConfiguration.d.ts +6 -4
  57. package/esm/models/configuration/gridRowConfiguration.d.ts +11 -1
  58. package/esm/models/gridIconSlotsComponent.d.ts +6 -0
  59. package/esm/models/props/DataGridProps.d.ts +1 -1
  60. package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
  61. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
  62. package/hooks/features/editing/useGridCellEditing.js +1 -1
  63. package/hooks/features/editing/useGridRowEditing.js +1 -1
  64. package/hooks/features/filter/gridFilterSelector.d.ts +9 -1
  65. package/hooks/features/filter/gridFilterSelector.js +13 -1
  66. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  67. package/hooks/features/rows/useGridRows.d.ts +2 -1
  68. package/hooks/features/rows/useGridRows.js +6 -34
  69. package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
  70. package/hooks/features/rows/useGridRowsOverridableMethods.js +52 -0
  71. package/hooks/features/scroll/useGridScroll.js +1 -1
  72. package/hooks/utils/useGridConfiguration.d.ts +3 -1
  73. package/index.js +1 -1
  74. package/internals/index.d.ts +2 -1
  75. package/internals/index.js +15 -0
  76. package/material/index.js +2 -0
  77. package/models/api/gridParamsApi.d.ts +3 -3
  78. package/models/colDef/gridColDef.d.ts +4 -2
  79. package/models/configuration/gridConfiguration.d.ts +6 -4
  80. package/models/configuration/gridRowConfiguration.d.ts +11 -1
  81. package/models/gridIconSlotsComponent.d.ts +6 -0
  82. package/models/props/DataGridProps.d.ts +1 -1
  83. package/package.json +11 -11
  84. package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.10.2
2
+ * @mui/x-data-grid v8.11.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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";
@@ -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 extends any = any>(id: GridRowId, field: string) => 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 extends any = any>(row: GridRowModel, colDef: GridColDef) => 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 extends any = any>(row: GridRowModel, colDef: GridColDef) => 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?: (value: ValueOptions) => string;
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?: (value: ValueOptions) => any;
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 { GridTreeNode } from "../gridRows.js";
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "8.10.2",
3
+ "version": "8.11.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Community plan edition of the MUI X Data Grid components.",
6
6
  "main": "./index.js",
@@ -43,8 +43,8 @@
43
43
  "clsx": "^2.1.1",
44
44
  "prop-types": "^15.8.1",
45
45
  "use-sync-external-store": "^1.5.0",
46
- "@mui/x-internals": "8.10.2",
47
- "@mui/x-virtualizer": "0.1.3"
46
+ "@mui/x-internals": "8.11.0",
47
+ "@mui/x-virtualizer": "0.1.4"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@emotion/react": "^11.9.0",
@@ -70,23 +70,23 @@
70
70
  "exports": {
71
71
  "./package.json": "./package.json",
72
72
  ".": {
73
- "require": {
74
- "types": "./index.d.ts",
75
- "default": "./index.js"
76
- },
77
73
  "import": {
78
74
  "types": "./esm/index.d.ts",
79
75
  "default": "./esm/index.js"
76
+ },
77
+ "require": {
78
+ "types": "./index.d.ts",
79
+ "default": "./index.js"
80
80
  }
81
81
  },
82
82
  "./*": {
83
- "require": {
84
- "types": "./*/index.d.ts",
85
- "default": "./*/index.js"
86
- },
87
83
  "import": {
88
84
  "types": "./esm/*/index.d.ts",
89
85
  "default": "./esm/*/index.js"
86
+ },
87
+ "require": {
88
+ "types": "./*/index.d.ts",
89
+ "default": "./*/index.js"
90
90
  }
91
91
  },
92
92
  "./esm": null
@@ -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;