@mui/x-data-grid-pro 5.17.21 → 5.17.22

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 CHANGED
@@ -3,6 +3,32 @@
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
+ ## v5.17.22
7
+
8
+ _Feb 2, 2023_
9
+
10
+ We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Add Urdu (ur-PK) locale
13
+ - 🌍 Improve French (fr-FR) and Italian (it-IT) locales
14
+ - 🐞 Bugfixes
15
+
16
+ ### `@mui/x-data-grid@v5.17.22` / `@mui/x-data-grid-pro@v5.17.22` / `@mui/x-data-grid-premium@v5.17.22`
17
+
18
+ #### Changes
19
+
20
+ - [DataGrid] Fix an error when deleting pinned row using the buttons in the `actions` column (#7767) @cherniavskii
21
+ - [DataGrid] Fix print preview regression in Chrome browser (#7405) @cherniavskii
22
+ - [l10n] Add Urdu (ur-PK) locale (#7778) @MBilalShafi
23
+ - [l10n] Improve French (fr-FR) locale (#7795) @Vivek-Prajapatii
24
+
25
+ ### `@mui/x-date-pickers@v5.0.17` / `@mui/x-date-pickers-pro@v5.0.17`
26
+
27
+ #### Changes
28
+
29
+ - [TimePicker] Add missing `themeAugmentation` entry (#7732) @LukasTy
30
+ - [l10n] Improve Italian (it-IT) locale (#7761) @simonecervini
31
+
6
32
  ## v5.17.21
7
33
 
8
34
  _Jan 27, 2023_
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
3
3
  import { GridRowEntry, GridRowId, GridRowModel } from '@mui/x-data-grid';
4
4
  import { GridApiPro } from '../../../models/gridApiPro';
5
- import { GridPinnedRowsProp } from './gridRowPinningInterface';
5
+ import type { GridPinnedRowsProp } from './gridRowPinningInterface';
6
6
  declare type GridPinnedRowPosition = keyof GridPinnedRowsProp;
7
7
  export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, isAutoGenerated, }: {
8
8
  groupingParams: GridHydrateRowsValue;
@@ -31,5 +31,10 @@ export declare function addPinnedRow({ groupingParams, rowModel, rowId, position
31
31
  ids: GridRowId[];
32
32
  idToIdLookup: Record<string, GridRowId>;
33
33
  };
34
+ export declare function removePinnedRow({ groupingParams, rowId, apiRef, }: {
35
+ groupingParams: GridHydrateRowsValue;
36
+ rowId: GridRowId;
37
+ apiRef: React.MutableRefObject<GridApiPro>;
38
+ }): void;
34
39
  export declare const useGridRowPinningPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>) => void;
35
40
  export {};
@@ -45,11 +45,28 @@ export function addPinnedRow({
45
45
  })
46
46
  });
47
47
  }
48
+ export function removePinnedRow({
49
+ groupingParams,
50
+ rowId,
51
+ apiRef
52
+ }) {
53
+ const idRowsLookup = _extends({}, groupingParams.idRowsLookup);
54
+
55
+ const tree = _extends({}, groupingParams.tree);
56
+
57
+ delete idRowsLookup[rowId];
58
+ delete tree[rowId];
59
+ delete apiRef.current.unstable_caches.rows.idRowsLookup[rowId];
60
+ delete apiRef.current.unstable_caches.rows.idToIdLookup[rowId];
61
+ }
48
62
  export const useGridRowPinningPreProcessors = apiRef => {
63
+ const previousPinnedRowsCacheRef = React.useRef(null);
49
64
  const addPinnedRows = React.useCallback(groupingParams => {
50
65
  var _pinnedRowsCache$topI, _pinnedRowsCache$bott;
51
66
 
52
67
  const pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
68
+ const previousPinnedRowsCache = previousPinnedRowsCacheRef.current;
69
+ previousPinnedRowsCacheRef.current = pinnedRowsCache;
53
70
 
54
71
  let newGroupingParams = _extends({}, groupingParams, {
55
72
  additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
@@ -58,6 +75,25 @@ export const useGridRowPinningPreProcessors = apiRef => {
58
75
  })
59
76
  });
60
77
 
78
+ if (previousPinnedRowsCache) {
79
+ var _previousPinnedRowsCa, _previousPinnedRowsCa2;
80
+
81
+ (_previousPinnedRowsCa = previousPinnedRowsCache.topIds) == null ? void 0 : _previousPinnedRowsCa.forEach(rowId => {
82
+ removePinnedRow({
83
+ groupingParams: newGroupingParams,
84
+ rowId,
85
+ apiRef
86
+ });
87
+ });
88
+ (_previousPinnedRowsCa2 = previousPinnedRowsCache.bottomIds) == null ? void 0 : _previousPinnedRowsCa2.forEach(rowId => {
89
+ removePinnedRow({
90
+ groupingParams: newGroupingParams,
91
+ rowId,
92
+ apiRef
93
+ });
94
+ });
95
+ }
96
+
61
97
  (_pinnedRowsCache$topI = pinnedRowsCache.topIds) == null ? void 0 : _pinnedRowsCache$topI.forEach(rowId => {
62
98
  newGroupingParams = addPinnedRow({
63
99
  groupingParams: newGroupingParams,
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.21
1
+ /** @license MUI X v5.17.22
2
2
  *
3
3
  * This source code is licensed under the commercial license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -45,11 +45,28 @@ export function addPinnedRow(_ref) {
45
45
  })
46
46
  });
47
47
  }
48
+ export function removePinnedRow(_ref2) {
49
+ var groupingParams = _ref2.groupingParams,
50
+ rowId = _ref2.rowId,
51
+ apiRef = _ref2.apiRef;
52
+
53
+ var idRowsLookup = _extends({}, groupingParams.idRowsLookup);
54
+
55
+ var tree = _extends({}, groupingParams.tree);
56
+
57
+ delete idRowsLookup[rowId];
58
+ delete tree[rowId];
59
+ delete apiRef.current.unstable_caches.rows.idRowsLookup[rowId];
60
+ delete apiRef.current.unstable_caches.rows.idToIdLookup[rowId];
61
+ }
48
62
  export var useGridRowPinningPreProcessors = function useGridRowPinningPreProcessors(apiRef) {
63
+ var previousPinnedRowsCacheRef = React.useRef(null);
49
64
  var addPinnedRows = React.useCallback(function (groupingParams) {
50
65
  var _pinnedRowsCache$topI, _pinnedRowsCache$bott;
51
66
 
52
67
  var pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
68
+ var previousPinnedRowsCache = previousPinnedRowsCacheRef.current;
69
+ previousPinnedRowsCacheRef.current = pinnedRowsCache;
53
70
 
54
71
  var newGroupingParams = _extends({}, groupingParams, {
55
72
  additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
@@ -58,6 +75,25 @@ export var useGridRowPinningPreProcessors = function useGridRowPinningPreProcess
58
75
  })
59
76
  });
60
77
 
78
+ if (previousPinnedRowsCache) {
79
+ var _previousPinnedRowsCa, _previousPinnedRowsCa2;
80
+
81
+ (_previousPinnedRowsCa = previousPinnedRowsCache.topIds) == null ? void 0 : _previousPinnedRowsCa.forEach(function (rowId) {
82
+ removePinnedRow({
83
+ groupingParams: newGroupingParams,
84
+ rowId: rowId,
85
+ apiRef: apiRef
86
+ });
87
+ });
88
+ (_previousPinnedRowsCa2 = previousPinnedRowsCache.bottomIds) == null ? void 0 : _previousPinnedRowsCa2.forEach(function (rowId) {
89
+ removePinnedRow({
90
+ groupingParams: newGroupingParams,
91
+ rowId: rowId,
92
+ apiRef: apiRef
93
+ });
94
+ });
95
+ }
96
+
61
97
  (_pinnedRowsCache$topI = pinnedRowsCache.topIds) == null ? void 0 : _pinnedRowsCache$topI.forEach(function (rowId) {
62
98
  newGroupingParams = addPinnedRow({
63
99
  groupingParams: newGroupingParams,
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.21
1
+ /** @license MUI X v5.17.22
2
2
  *
3
3
  * This source code is licensed under the commercial license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY3NDc1OTYwMDAwMA==";
3
+ var releaseInfo = "MTY3NTI5MjQwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -43,9 +43,26 @@ export function addPinnedRow({
43
43
  })
44
44
  });
45
45
  }
46
+ export function removePinnedRow({
47
+ groupingParams,
48
+ rowId,
49
+ apiRef
50
+ }) {
51
+ const idRowsLookup = _extends({}, groupingParams.idRowsLookup);
52
+
53
+ const tree = _extends({}, groupingParams.tree);
54
+
55
+ delete idRowsLookup[rowId];
56
+ delete tree[rowId];
57
+ delete apiRef.current.unstable_caches.rows.idRowsLookup[rowId];
58
+ delete apiRef.current.unstable_caches.rows.idToIdLookup[rowId];
59
+ }
46
60
  export const useGridRowPinningPreProcessors = apiRef => {
61
+ const previousPinnedRowsCacheRef = React.useRef(null);
47
62
  const addPinnedRows = React.useCallback(groupingParams => {
48
63
  const pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
64
+ const previousPinnedRowsCache = previousPinnedRowsCacheRef.current;
65
+ previousPinnedRowsCacheRef.current = pinnedRowsCache;
49
66
 
50
67
  let newGroupingParams = _extends({}, groupingParams, {
51
68
  additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
@@ -54,6 +71,23 @@ export const useGridRowPinningPreProcessors = apiRef => {
54
71
  })
55
72
  });
56
73
 
74
+ if (previousPinnedRowsCache) {
75
+ previousPinnedRowsCache.topIds?.forEach(rowId => {
76
+ removePinnedRow({
77
+ groupingParams: newGroupingParams,
78
+ rowId,
79
+ apiRef
80
+ });
81
+ });
82
+ previousPinnedRowsCache.bottomIds?.forEach(rowId => {
83
+ removePinnedRow({
84
+ groupingParams: newGroupingParams,
85
+ rowId,
86
+ apiRef
87
+ });
88
+ });
89
+ }
90
+
57
91
  pinnedRowsCache.topIds?.forEach(rowId => {
58
92
  newGroupingParams = addPinnedRow({
59
93
  groupingParams: newGroupingParams,
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.21
1
+ /** @license MUI X v5.17.22
2
2
  *
3
3
  * This source code is licensed under the commercial license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY3NDc1OTYwMDAwMA==";
3
+ const releaseInfo = "MTY3NTI5MjQwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.addPinnedRow = addPinnedRow;
9
+ exports.removePinnedRow = removePinnedRow;
9
10
  exports.useGridRowPinningPreProcessors = void 0;
10
11
 
11
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -61,17 +62,53 @@ function addPinnedRow({
61
62
  });
62
63
  }
63
64
 
65
+ function removePinnedRow({
66
+ groupingParams,
67
+ rowId,
68
+ apiRef
69
+ }) {
70
+ const idRowsLookup = (0, _extends2.default)({}, groupingParams.idRowsLookup);
71
+ const tree = (0, _extends2.default)({}, groupingParams.tree);
72
+ delete idRowsLookup[rowId];
73
+ delete tree[rowId];
74
+ delete apiRef.current.unstable_caches.rows.idRowsLookup[rowId];
75
+ delete apiRef.current.unstable_caches.rows.idToIdLookup[rowId];
76
+ }
77
+
64
78
  const useGridRowPinningPreProcessors = apiRef => {
79
+ const previousPinnedRowsCacheRef = React.useRef(null);
65
80
  const addPinnedRows = React.useCallback(groupingParams => {
66
81
  var _pinnedRowsCache$topI, _pinnedRowsCache$bott;
67
82
 
68
83
  const pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
84
+ const previousPinnedRowsCache = previousPinnedRowsCacheRef.current;
85
+ previousPinnedRowsCacheRef.current = pinnedRowsCache;
69
86
  let newGroupingParams = (0, _extends2.default)({}, groupingParams, {
70
87
  additionalRowGroups: (0, _extends2.default)({}, groupingParams.additionalRowGroups, {
71
88
  // reset pinned rows state
72
89
  pinnedRows: {}
73
90
  })
74
91
  });
92
+
93
+ if (previousPinnedRowsCache) {
94
+ var _previousPinnedRowsCa, _previousPinnedRowsCa2;
95
+
96
+ (_previousPinnedRowsCa = previousPinnedRowsCache.topIds) == null ? void 0 : _previousPinnedRowsCa.forEach(rowId => {
97
+ removePinnedRow({
98
+ groupingParams: newGroupingParams,
99
+ rowId,
100
+ apiRef
101
+ });
102
+ });
103
+ (_previousPinnedRowsCa2 = previousPinnedRowsCache.bottomIds) == null ? void 0 : _previousPinnedRowsCa2.forEach(rowId => {
104
+ removePinnedRow({
105
+ groupingParams: newGroupingParams,
106
+ rowId,
107
+ apiRef
108
+ });
109
+ });
110
+ }
111
+
75
112
  (_pinnedRowsCache$topI = pinnedRowsCache.topIds) == null ? void 0 : _pinnedRowsCache$topI.forEach(rowId => {
76
113
  newGroupingParams = addPinnedRow({
77
114
  groupingParams: newGroupingParams,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.21
1
+ /** @license MUI X v5.17.22
2
2
  *
3
3
  * This source code is licensed under the commercial license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
8
8
  var _utils = require("@mui/utils");
9
9
 
10
10
  const getReleaseInfo = () => {
11
- const releaseInfo = "MTY3NDc1OTYwMDAwMA==";
11
+ const releaseInfo = "MTY3NTI5MjQwMDAwMA==";
12
12
 
13
13
  if (process.env.NODE_ENV !== 'production') {
14
14
  // A simple hack to set the value in the test environment (has no build step).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "5.17.21",
3
+ "version": "5.17.22",
4
4
  "description": "The Pro plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.18.9",
35
35
  "@mui/utils": "^5.10.3",
36
- "@mui/x-data-grid": "5.17.21",
36
+ "@mui/x-data-grid": "5.17.22",
37
37
  "@mui/x-license-pro": "5.17.12",
38
38
  "@types/format-util": "^1.0.2",
39
39
  "clsx": "^1.2.1",
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY3NDc1OTYwMDAwMA==";
3
+ const releaseInfo = "MTY3NTI5MjQwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).