@mui/x-data-grid 8.5.1 → 8.5.3

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 (110) hide show
  1. package/CHANGELOG.md +187 -10
  2. package/components/containers/GridRootStyles.d.ts +1 -1
  3. package/components/menu/columnMenu/GridColumnMenuContainer.js +8 -0
  4. package/components/toolbarV8/GridToolbar.js +1 -0
  5. package/components/toolbarV8/Toolbar.d.ts +1 -1
  6. package/esm/components/containers/GridRootStyles.d.ts +1 -1
  7. package/esm/components/menu/columnMenu/GridColumnMenuContainer.js +8 -0
  8. package/esm/components/toolbarV8/GridToolbar.js +1 -0
  9. package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
  10. package/esm/hooks/core/useGridApiInitialization.js +1 -1
  11. package/esm/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +13 -5
  12. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  13. package/esm/hooks/features/columnResize/columnResizeSelector.d.ts +3 -1
  14. package/esm/hooks/features/columns/gridColumnsSelector.d.ts +41 -15
  15. package/esm/hooks/features/columns/gridColumnsUtils.js +3 -1
  16. package/esm/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -2
  17. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +4 -0
  18. package/esm/hooks/features/dataSource/utils.js +1 -1
  19. package/esm/hooks/features/density/densitySelector.d.ts +3 -1
  20. package/esm/hooks/features/dimensions/gridDimensionsSelectors.d.ts +36 -12
  21. package/esm/hooks/features/editing/gridEditingSelectors.d.ts +8 -4
  22. package/esm/hooks/features/filter/gridFilterSelector.d.ts +51 -17
  23. package/esm/hooks/features/filter/gridFilterState.d.ts +2 -1
  24. package/esm/hooks/features/filter/gridFilterState.js +2 -1
  25. package/esm/hooks/features/filter/useGridFilter.js +1 -1
  26. package/esm/hooks/features/focus/gridFocusStateSelector.d.ts +24 -8
  27. package/esm/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +9 -3
  28. package/esm/hooks/features/pagination/gridPaginationSelector.d.ts +35 -19
  29. package/esm/hooks/features/pivoting/gridPivotingSelectors.d.ts +9 -4
  30. package/esm/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +3 -1
  31. package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +9 -3
  32. package/esm/hooks/features/rowSelection/utils.d.ts +5 -3
  33. package/esm/hooks/features/rows/gridRowSpanningSelectors.d.ts +9 -3
  34. package/esm/hooks/features/rows/gridRowsSelector.d.ts +50 -29
  35. package/esm/hooks/features/sorting/gridSortingSelector.d.ts +15 -5
  36. package/esm/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +4 -2
  37. package/esm/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +15 -5
  38. package/esm/hooks/features/virtualization/gridVirtualizationSelectors.js +3 -1
  39. package/esm/hooks/utils/useGridSelector.d.ts +2 -4
  40. package/esm/hooks/utils/useGridSelector.js +2 -2
  41. package/esm/index.js +1 -1
  42. package/esm/internals/demo/TailwindDemoContainer.d.ts +1 -1
  43. package/esm/material/variables.js +1 -2
  44. package/esm/models/api/gridCoreApi.d.ts +1 -1
  45. package/esm/models/gridBaseSlots.d.ts +1 -0
  46. package/esm/models/gridCellClass.d.ts +2 -0
  47. package/esm/models/gridColumnGrouping.d.ts +2 -0
  48. package/esm/models/gridColumnGrouping.js +2 -0
  49. package/esm/models/gridColumnHeaderClass.d.ts +2 -0
  50. package/esm/models/gridRows.d.ts +2 -0
  51. package/esm/models/gridSortModel.d.ts +5 -0
  52. package/esm/models/params/gridRowParams.d.ts +1 -1
  53. package/esm/models/params/gridRowParams.js +1 -1
  54. package/esm/utils/createSelector.d.ts +3 -11
  55. package/esm/utils/createSelector.js +16 -86
  56. package/hooks/core/useGridApiInitialization.js +2 -2
  57. package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +13 -5
  58. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  59. package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -1
  60. package/hooks/features/columns/gridColumnsSelector.d.ts +41 -15
  61. package/hooks/features/columns/gridColumnsUtils.js +3 -1
  62. package/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -2
  63. package/hooks/features/dataSource/useGridDataSourceBase.js +4 -0
  64. package/hooks/features/dataSource/utils.js +1 -1
  65. package/hooks/features/density/densitySelector.d.ts +3 -1
  66. package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +36 -12
  67. package/hooks/features/editing/gridEditingSelectors.d.ts +8 -4
  68. package/hooks/features/filter/gridFilterSelector.d.ts +51 -17
  69. package/hooks/features/filter/gridFilterState.d.ts +2 -1
  70. package/hooks/features/filter/gridFilterState.js +2 -1
  71. package/hooks/features/filter/useGridFilter.js +2 -2
  72. package/hooks/features/focus/gridFocusStateSelector.d.ts +24 -8
  73. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +9 -3
  74. package/hooks/features/pagination/gridPaginationSelector.d.ts +35 -19
  75. package/hooks/features/pivoting/gridPivotingSelectors.d.ts +9 -4
  76. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +3 -1
  77. package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +9 -3
  78. package/hooks/features/rowSelection/utils.d.ts +5 -3
  79. package/hooks/features/rows/gridRowSpanningSelectors.d.ts +9 -3
  80. package/hooks/features/rows/gridRowsSelector.d.ts +50 -29
  81. package/hooks/features/sorting/gridSortingSelector.d.ts +15 -5
  82. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +4 -2
  83. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +15 -5
  84. package/hooks/features/virtualization/gridVirtualizationSelectors.js +3 -1
  85. package/hooks/utils/useGridSelector.d.ts +2 -4
  86. package/hooks/utils/useGridSelector.js +4 -4
  87. package/index.js +1 -1
  88. package/internals/demo/TailwindDemoContainer.d.ts +1 -1
  89. package/material/variables.js +1 -2
  90. package/models/api/gridCoreApi.d.ts +1 -1
  91. package/models/gridBaseSlots.d.ts +1 -0
  92. package/models/gridCellClass.d.ts +2 -0
  93. package/models/gridColumnGrouping.d.ts +2 -0
  94. package/models/gridColumnGrouping.js +2 -0
  95. package/models/gridColumnHeaderClass.d.ts +2 -0
  96. package/models/gridRows.d.ts +2 -0
  97. package/models/gridSortModel.d.ts +5 -0
  98. package/models/params/gridRowParams.d.ts +1 -1
  99. package/models/params/gridRowParams.js +1 -1
  100. package/package.json +3 -4
  101. package/utils/createSelector.d.ts +3 -11
  102. package/utils/createSelector.js +18 -88
  103. package/esm/utils/Store.d.ts +0 -11
  104. package/esm/utils/Store.js +0 -24
  105. package/esm/utils/weakMapMemoize.d.ts +0 -20
  106. package/esm/utils/weakMapMemoize.js +0 -128
  107. package/utils/Store.d.ts +0 -11
  108. package/utils/Store.js +0 -31
  109. package/utils/weakMapMemoize.d.ts +0 -20
  110. package/utils/weakMapMemoize.js +0 -134
@@ -1,128 +0,0 @@
1
- // Original source:
2
- // - https://github.com/reduxjs/reselect/blob/1c3fc05f041d32cd69c11a7f7deccf0bce6f4598/src/weakMapMemoize.ts
3
-
4
- class StrongRef {
5
- constructor(value) {
6
- this.value = value;
7
- }
8
- deref() {
9
- return this.value;
10
- }
11
- }
12
- const getWeakRef = () => typeof WeakRef === 'undefined' ? StrongRef : WeakRef;
13
- const Ref = /** @__PURE__ */getWeakRef();
14
- const UNTERMINATED = 0;
15
- const TERMINATED = 1;
16
- function createCacheNode() {
17
- return {
18
- s: UNTERMINATED,
19
- v: undefined,
20
- o: null,
21
- p: null
22
- };
23
- }
24
- /**
25
- * Derefences the argument if it is a Ref. Else if it is a value already, return it.
26
- *
27
- * @param r - the object to maybe deref
28
- * @returns The derefenced value if the argument is a Ref, else the argument value itself.
29
- */
30
- function maybeDeref(r) {
31
- if (r instanceof Ref) {
32
- return r.deref();
33
- }
34
- return r;
35
- }
36
-
37
- /**
38
- * Inspired by the `weakMapMemoize` function from the `reselect` library.
39
- *
40
- * @see {@link https://github.com/reduxjs/reselect/blob/1c3fc05f041d32cd69c11a7f7deccf0bce6f4598/src/weakMapMemoize.ts `original source code`}
41
- * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize api docs`}
42
- */
43
- export function weakMapMemoize(func, options = {}) {
44
- let fnNode = createCacheNode();
45
- const {
46
- resultEqualityCheck
47
- } = options;
48
- let lastResult;
49
- let resultsCount = 0;
50
- function memoized() {
51
- let cacheNode = fnNode;
52
- // eslint-disable-next-line prefer-rest-params
53
- const {
54
- length
55
- } = arguments;
56
- for (let i = 0, l = length; i < l; i += 1) {
57
- // eslint-disable-next-line prefer-rest-params
58
- let arg = arguments[i];
59
- if (typeof arg === 'function' || typeof arg === 'object' && arg !== null) {
60
- // Following logic is added over the original `weakMapMemoize` to support the proper memoization of the `GridApiRef`
61
- if ('current' in arg && 'instanceId' in arg.current) {
62
- arg = arg.current.state;
63
- }
64
- // Objects go into a WeakMap
65
- let objectCache = cacheNode.o;
66
- if (objectCache === null) {
67
- objectCache = new WeakMap();
68
- cacheNode.o = objectCache;
69
- }
70
- const objectNode = objectCache.get(arg);
71
- if (objectNode === undefined) {
72
- cacheNode = createCacheNode();
73
- objectCache.set(arg, cacheNode);
74
- } else {
75
- cacheNode = objectNode;
76
- }
77
- } else {
78
- // Primitives go into a regular Map
79
- let primitiveCache = cacheNode.p;
80
- if (primitiveCache === null) {
81
- primitiveCache = new Map();
82
- cacheNode.p = primitiveCache;
83
- }
84
- const primitiveNode = primitiveCache.get(arg);
85
- if (primitiveNode === undefined) {
86
- cacheNode = createCacheNode();
87
- primitiveCache.set(arg, cacheNode);
88
- } else {
89
- cacheNode = primitiveNode;
90
- }
91
- }
92
- }
93
- const terminatedNode = cacheNode;
94
- let result;
95
- if (cacheNode.s === TERMINATED) {
96
- result = cacheNode.v;
97
- } else {
98
- // Allow errors to propagate
99
- // eslint-disable-next-line prefer-spread, prefer-rest-params
100
- result = func.apply(null, arguments);
101
- resultsCount += 1;
102
- if (resultEqualityCheck) {
103
- // Deref lastResult if it is a Ref
104
- const lastResultValue = maybeDeref(lastResult);
105
- if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
106
- result = lastResultValue;
107
- if (resultsCount !== 0) {
108
- resultsCount -= 1;
109
- }
110
- }
111
- const needsWeakRef = typeof result === 'object' && result !== null || typeof result === 'function';
112
- lastResult = needsWeakRef ? /** @__PURE__ */new Ref(result) : result;
113
- }
114
- }
115
- terminatedNode.s = TERMINATED;
116
- terminatedNode.v = result;
117
- return result;
118
- }
119
- memoized.clearCache = () => {
120
- fnNode = createCacheNode();
121
- memoized.resetResultsCount();
122
- };
123
- memoized.resultsCount = () => resultsCount;
124
- memoized.resetResultsCount = () => {
125
- resultsCount = 0;
126
- };
127
- return memoized;
128
- }
package/utils/Store.d.ts DELETED
@@ -1,11 +0,0 @@
1
- type Listener<T> = (value: T) => void;
2
- export declare class Store<T> {
3
- value: T;
4
- listeners: Set<Listener<T>>;
5
- static create<T>(value: T): Store<T>;
6
- constructor(value: T);
7
- subscribe: (fn: Listener<T>) => () => void;
8
- getSnapshot: () => T;
9
- update: (value: T) => void;
10
- }
11
- export {};
package/utils/Store.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Store = void 0;
7
- class Store {
8
- static create(value) {
9
- return new Store(value);
10
- }
11
- constructor(_value) {
12
- this.value = void 0;
13
- this.listeners = void 0;
14
- this.subscribe = fn => {
15
- this.listeners.add(fn);
16
- return () => {
17
- this.listeners.delete(fn);
18
- };
19
- };
20
- this.getSnapshot = () => {
21
- return this.value;
22
- };
23
- this.update = value => {
24
- this.value = value;
25
- this.listeners.forEach(l => l(value));
26
- };
27
- this.value = _value;
28
- this.listeners = new Set();
29
- }
30
- }
31
- exports.Store = Store;
@@ -1,20 +0,0 @@
1
- type AnyNonNullishValue = NonNullable<unknown>;
2
- type Simplify<T> = T extends AnyFunction ? T : { [KeyType in keyof T]: T[KeyType] } & AnyNonNullishValue;
3
- type EqualityFn<T = any> = (a: T, b: T) => boolean;
4
- type DefaultMemoizeFields = {
5
- clearCache: () => void;
6
- resultsCount: () => number;
7
- resetResultsCount: () => void;
8
- };
9
- type AnyFunction = (...args: any[]) => any;
10
- interface WeakMapMemoizeOptions<Result = any> {
11
- resultEqualityCheck?: EqualityFn<Result>;
12
- }
13
- /**
14
- * Inspired by the `weakMapMemoize` function from the `reselect` library.
15
- *
16
- * @see {@link https://github.com/reduxjs/reselect/blob/1c3fc05f041d32cd69c11a7f7deccf0bce6f4598/src/weakMapMemoize.ts `original source code`}
17
- * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize api docs`}
18
- */
19
- export declare function weakMapMemoize<Func extends AnyFunction>(func: Func, options?: WeakMapMemoizeOptions<ReturnType<Func>>): Func & Simplify<DefaultMemoizeFields>;
20
- export {};
@@ -1,134 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.weakMapMemoize = weakMapMemoize;
7
- // Original source:
8
- // - https://github.com/reduxjs/reselect/blob/1c3fc05f041d32cd69c11a7f7deccf0bce6f4598/src/weakMapMemoize.ts
9
-
10
- class StrongRef {
11
- constructor(value) {
12
- this.value = value;
13
- }
14
- deref() {
15
- return this.value;
16
- }
17
- }
18
- const getWeakRef = () => typeof WeakRef === 'undefined' ? StrongRef : WeakRef;
19
- const Ref = /** @__PURE__ */getWeakRef();
20
- const UNTERMINATED = 0;
21
- const TERMINATED = 1;
22
- function createCacheNode() {
23
- return {
24
- s: UNTERMINATED,
25
- v: undefined,
26
- o: null,
27
- p: null
28
- };
29
- }
30
- /**
31
- * Derefences the argument if it is a Ref. Else if it is a value already, return it.
32
- *
33
- * @param r - the object to maybe deref
34
- * @returns The derefenced value if the argument is a Ref, else the argument value itself.
35
- */
36
- function maybeDeref(r) {
37
- if (r instanceof Ref) {
38
- return r.deref();
39
- }
40
- return r;
41
- }
42
-
43
- /**
44
- * Inspired by the `weakMapMemoize` function from the `reselect` library.
45
- *
46
- * @see {@link https://github.com/reduxjs/reselect/blob/1c3fc05f041d32cd69c11a7f7deccf0bce6f4598/src/weakMapMemoize.ts `original source code`}
47
- * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize api docs`}
48
- */
49
- function weakMapMemoize(func, options = {}) {
50
- let fnNode = createCacheNode();
51
- const {
52
- resultEqualityCheck
53
- } = options;
54
- let lastResult;
55
- let resultsCount = 0;
56
- function memoized() {
57
- let cacheNode = fnNode;
58
- // eslint-disable-next-line prefer-rest-params
59
- const {
60
- length
61
- } = arguments;
62
- for (let i = 0, l = length; i < l; i += 1) {
63
- // eslint-disable-next-line prefer-rest-params
64
- let arg = arguments[i];
65
- if (typeof arg === 'function' || typeof arg === 'object' && arg !== null) {
66
- // Following logic is added over the original `weakMapMemoize` to support the proper memoization of the `GridApiRef`
67
- if ('current' in arg && 'instanceId' in arg.current) {
68
- arg = arg.current.state;
69
- }
70
- // Objects go into a WeakMap
71
- let objectCache = cacheNode.o;
72
- if (objectCache === null) {
73
- objectCache = new WeakMap();
74
- cacheNode.o = objectCache;
75
- }
76
- const objectNode = objectCache.get(arg);
77
- if (objectNode === undefined) {
78
- cacheNode = createCacheNode();
79
- objectCache.set(arg, cacheNode);
80
- } else {
81
- cacheNode = objectNode;
82
- }
83
- } else {
84
- // Primitives go into a regular Map
85
- let primitiveCache = cacheNode.p;
86
- if (primitiveCache === null) {
87
- primitiveCache = new Map();
88
- cacheNode.p = primitiveCache;
89
- }
90
- const primitiveNode = primitiveCache.get(arg);
91
- if (primitiveNode === undefined) {
92
- cacheNode = createCacheNode();
93
- primitiveCache.set(arg, cacheNode);
94
- } else {
95
- cacheNode = primitiveNode;
96
- }
97
- }
98
- }
99
- const terminatedNode = cacheNode;
100
- let result;
101
- if (cacheNode.s === TERMINATED) {
102
- result = cacheNode.v;
103
- } else {
104
- // Allow errors to propagate
105
- // eslint-disable-next-line prefer-spread, prefer-rest-params
106
- result = func.apply(null, arguments);
107
- resultsCount += 1;
108
- if (resultEqualityCheck) {
109
- // Deref lastResult if it is a Ref
110
- const lastResultValue = maybeDeref(lastResult);
111
- if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
112
- result = lastResultValue;
113
- if (resultsCount !== 0) {
114
- resultsCount -= 1;
115
- }
116
- }
117
- const needsWeakRef = typeof result === 'object' && result !== null || typeof result === 'function';
118
- lastResult = needsWeakRef ? /** @__PURE__ */new Ref(result) : result;
119
- }
120
- }
121
- terminatedNode.s = TERMINATED;
122
- terminatedNode.v = result;
123
- return result;
124
- }
125
- memoized.clearCache = () => {
126
- fnNode = createCacheNode();
127
- memoized.resetResultsCount();
128
- };
129
- memoized.resultsCount = () => resultsCount;
130
- memoized.resetResultsCount = () => {
131
- resultsCount = 0;
132
- };
133
- return memoized;
134
- }