@mui/x-data-grid 6.18.1 → 7.0.0-alpha.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +558 -1
  2. package/DataGrid/DataGrid.js +0 -10
  3. package/DataGrid/useDataGridProps.js +9 -14
  4. package/colDef/gridActionsColDef.js +1 -2
  5. package/colDef/gridBooleanColDef.js +0 -1
  6. package/colDef/gridBooleanOperators.js +3 -4
  7. package/colDef/gridCheckboxSelectionColDef.js +0 -1
  8. package/colDef/gridDateOperators.js +10 -11
  9. package/colDef/gridNumericColDef.js +1 -3
  10. package/colDef/gridNumericOperators.d.ts +2 -2
  11. package/colDef/gridNumericOperators.js +13 -14
  12. package/colDef/gridSingleSelectOperators.js +5 -6
  13. package/colDef/gridStringColDef.js +1 -3
  14. package/colDef/gridStringOperators.d.ts +2 -2
  15. package/colDef/gridStringOperators.js +11 -12
  16. package/components/toolbar/GridToolbarFilterButton.js +3 -1
  17. package/constants/defaultGridSlotsComponents.js +17 -17
  18. package/hooks/features/export/useGridPrintExport.js +7 -10
  19. package/hooks/features/filter/gridFilterUtils.js +14 -68
  20. package/hooks/features/rows/useGridRows.js +4 -1
  21. package/index.js +1 -1
  22. package/internals/index.d.ts +0 -1
  23. package/internals/index.js +0 -1
  24. package/internals/utils/computeSlots.d.ts +4 -6
  25. package/internals/utils/computeSlots.js +2 -8
  26. package/internals/utils/index.d.ts +0 -1
  27. package/internals/utils/index.js +0 -1
  28. package/internals/utils/useProps.d.ts +1 -8
  29. package/internals/utils/useProps.js +5 -8
  30. package/joy/icons.d.ts +1 -2
  31. package/joy/joySlots.d.ts +1 -2
  32. package/legacy/DataGrid/DataGrid.js +0 -10
  33. package/legacy/DataGrid/useDataGridProps.js +10 -18
  34. package/legacy/colDef/gridActionsColDef.js +1 -2
  35. package/legacy/colDef/gridBooleanColDef.js +0 -1
  36. package/legacy/colDef/gridBooleanOperators.js +3 -4
  37. package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -1
  38. package/legacy/colDef/gridDateOperators.js +10 -11
  39. package/legacy/colDef/gridNumericColDef.js +1 -3
  40. package/legacy/colDef/gridNumericOperators.js +13 -14
  41. package/legacy/colDef/gridSingleSelectOperators.js +5 -6
  42. package/legacy/colDef/gridStringColDef.js +1 -3
  43. package/legacy/colDef/gridStringOperators.js +11 -12
  44. package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
  45. package/legacy/constants/defaultGridSlotsComponents.js +17 -17
  46. package/legacy/hooks/features/export/useGridPrintExport.js +7 -10
  47. package/legacy/hooks/features/filter/gridFilterUtils.js +14 -68
  48. package/legacy/hooks/features/rows/useGridRows.js +2 -1
  49. package/legacy/index.js +1 -1
  50. package/legacy/internals/index.js +0 -1
  51. package/legacy/internals/utils/computeSlots.js +2 -8
  52. package/legacy/internals/utils/index.js +0 -1
  53. package/legacy/internals/utils/useProps.js +5 -6
  54. package/legacy/locales/csCZ.js +2 -2
  55. package/legacy/material/index.js +48 -48
  56. package/locales/csCZ.js +2 -2
  57. package/material/index.js +48 -48
  58. package/models/colDef/gridColDef.d.ts +4 -14
  59. package/models/colDef/index.d.ts +1 -1
  60. package/models/gridFilterOperator.d.ts +4 -16
  61. package/models/gridIconSlotsComponent.d.ts +35 -36
  62. package/models/gridSlotsComponent.d.ts +31 -34
  63. package/models/index.d.ts +1 -1
  64. package/models/props/DataGridProps.d.ts +3 -14
  65. package/modern/DataGrid/DataGrid.js +0 -10
  66. package/modern/DataGrid/useDataGridProps.js +7 -9
  67. package/modern/colDef/gridActionsColDef.js +1 -2
  68. package/modern/colDef/gridBooleanColDef.js +0 -1
  69. package/modern/colDef/gridBooleanOperators.js +3 -4
  70. package/modern/colDef/gridCheckboxSelectionColDef.js +0 -1
  71. package/modern/colDef/gridDateOperators.js +10 -11
  72. package/modern/colDef/gridNumericColDef.js +1 -3
  73. package/modern/colDef/gridNumericOperators.js +13 -14
  74. package/modern/colDef/gridSingleSelectOperators.js +5 -6
  75. package/modern/colDef/gridStringColDef.js +1 -3
  76. package/modern/colDef/gridStringOperators.js +11 -12
  77. package/modern/components/toolbar/GridToolbarFilterButton.js +3 -1
  78. package/modern/constants/defaultGridSlotsComponents.js +17 -17
  79. package/modern/hooks/features/export/useGridPrintExport.js +6 -10
  80. package/modern/hooks/features/filter/gridFilterUtils.js +14 -67
  81. package/modern/hooks/features/rows/useGridRows.js +1 -1
  82. package/modern/index.js +1 -1
  83. package/modern/internals/index.js +0 -1
  84. package/modern/internals/utils/computeSlots.js +2 -8
  85. package/modern/internals/utils/index.js +0 -1
  86. package/modern/internals/utils/useProps.js +5 -8
  87. package/modern/locales/csCZ.js +2 -2
  88. package/modern/material/index.js +48 -48
  89. package/node/DataGrid/DataGrid.js +0 -10
  90. package/node/DataGrid/useDataGridProps.js +6 -8
  91. package/node/colDef/gridActionsColDef.js +1 -2
  92. package/node/colDef/gridBooleanColDef.js +0 -1
  93. package/node/colDef/gridBooleanOperators.js +3 -4
  94. package/node/colDef/gridCheckboxSelectionColDef.js +0 -1
  95. package/node/colDef/gridDateOperators.js +10 -11
  96. package/node/colDef/gridNumericColDef.js +1 -3
  97. package/node/colDef/gridNumericOperators.js +14 -14
  98. package/node/colDef/gridSingleSelectOperators.js +5 -6
  99. package/node/colDef/gridStringColDef.js +1 -3
  100. package/node/colDef/gridStringOperators.js +12 -12
  101. package/node/components/toolbar/GridToolbarFilterButton.js +3 -1
  102. package/node/constants/defaultGridSlotsComponents.js +17 -17
  103. package/node/hooks/features/export/useGridPrintExport.js +5 -9
  104. package/node/hooks/features/filter/gridFilterUtils.js +14 -67
  105. package/node/hooks/features/rows/useGridRows.js +1 -1
  106. package/node/index.js +1 -1
  107. package/node/internals/index.js +1 -13
  108. package/node/internals/utils/computeSlots.js +2 -7
  109. package/node/internals/utils/index.js +0 -11
  110. package/node/internals/utils/useProps.js +4 -8
  111. package/node/locales/csCZ.js +2 -2
  112. package/node/material/index.js +48 -48
  113. package/package.json +1 -1
  114. package/colDef/utils.d.ts +0 -21
  115. package/colDef/utils.js +0 -51
  116. package/internals/utils/slotsMigration.d.ts +0 -4
  117. package/internals/utils/slotsMigration.js +0 -13
  118. package/legacy/colDef/utils.js +0 -51
  119. package/legacy/internals/utils/slotsMigration.js +0 -14
  120. package/modern/colDef/utils.js +0 -51
  121. package/modern/internals/utils/slotsMigration.js +0 -13
  122. package/node/colDef/utils.js +0 -63
  123. package/node/internals/utils/slotsMigration.js +0 -21
@@ -1,5 +1,4 @@
1
1
  import { GridFilterInputDate } from '../components/panel/filterPanel/GridFilterInputDate';
2
- import { convertLegacyOperators } from './utils';
3
2
  const dateRegex = /(\d+)-(\d+)-(\d+)/;
4
3
  const dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
5
4
  function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
@@ -22,9 +21,9 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
22
21
  return compareFn(timeToCompare, time);
23
22
  };
24
23
  }
25
- export const getGridDateOperators = showTime => convertLegacyOperators([{
24
+ export const getGridDateOperators = showTime => [{
26
25
  value: 'is',
27
- getApplyFilterFnV7: filterItem => {
26
+ getApplyFilterFn: filterItem => {
28
27
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 === value2, showTime);
29
28
  },
30
29
  InputComponent: GridFilterInputDate,
@@ -33,7 +32,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
33
32
  }
34
33
  }, {
35
34
  value: 'not',
36
- getApplyFilterFnV7: filterItem => {
35
+ getApplyFilterFn: filterItem => {
37
36
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 !== value2, showTime);
38
37
  },
39
38
  InputComponent: GridFilterInputDate,
@@ -42,7 +41,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
42
41
  }
43
42
  }, {
44
43
  value: 'after',
45
- getApplyFilterFnV7: filterItem => {
44
+ getApplyFilterFn: filterItem => {
46
45
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 > value2, showTime);
47
46
  },
48
47
  InputComponent: GridFilterInputDate,
@@ -51,7 +50,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
51
50
  }
52
51
  }, {
53
52
  value: 'onOrAfter',
54
- getApplyFilterFnV7: filterItem => {
53
+ getApplyFilterFn: filterItem => {
55
54
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 >= value2, showTime);
56
55
  },
57
56
  InputComponent: GridFilterInputDate,
@@ -60,7 +59,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
60
59
  }
61
60
  }, {
62
61
  value: 'before',
63
- getApplyFilterFnV7: filterItem => {
62
+ getApplyFilterFn: filterItem => {
64
63
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 < value2, showTime, !showTime);
65
64
  },
66
65
  InputComponent: GridFilterInputDate,
@@ -69,7 +68,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
69
68
  }
70
69
  }, {
71
70
  value: 'onOrBefore',
72
- getApplyFilterFnV7: filterItem => {
71
+ getApplyFilterFn: filterItem => {
73
72
  return buildApplyFilterFn(filterItem, (value1, value2) => value1 <= value2, showTime);
74
73
  },
75
74
  InputComponent: GridFilterInputDate,
@@ -78,7 +77,7 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
78
77
  }
79
78
  }, {
80
79
  value: 'isEmpty',
81
- getApplyFilterFnV7: () => {
80
+ getApplyFilterFn: () => {
82
81
  return value => {
83
82
  return value == null;
84
83
  };
@@ -86,10 +85,10 @@ export const getGridDateOperators = showTime => convertLegacyOperators([{
86
85
  requiresFilterValue: false
87
86
  }, {
88
87
  value: 'isNotEmpty',
89
- getApplyFilterFnV7: () => {
88
+ getApplyFilterFn: () => {
90
89
  return value => {
91
90
  return value != null;
92
91
  };
93
92
  },
94
93
  requiresFilterValue: false
95
- }]);
94
+ }];
@@ -3,7 +3,6 @@ import { gridNumberComparator } from '../hooks/features/sorting/gridSortingUtils
3
3
  import { isNumber } from '../utils/utils';
4
4
  import { getGridNumericOperators, getGridNumericQuickFilterFn } from './gridNumericOperators';
5
5
  import { GRID_STRING_COL_DEF } from './gridStringColDef';
6
- import { convertQuickFilterV7ToLegacy } from './utils';
7
6
  export const GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
8
7
  type: 'number',
9
8
  align: 'right',
@@ -14,6 +13,5 @@ export const GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
14
13
  value
15
14
  }) => isNumber(value) ? value.toLocaleString() : value || '',
16
15
  filterOperators: getGridNumericOperators(),
17
- getApplyQuickFilterFn: convertQuickFilterV7ToLegacy(getGridNumericQuickFilterFn),
18
- getApplyQuickFilterFnV7: getGridNumericQuickFilterFn
16
+ getApplyQuickFilterFn: getGridNumericQuickFilterFn
19
17
  });
@@ -1,4 +1,4 @@
1
1
  import { GridFilterOperator } from '../models/gridFilterOperator';
2
- import type { GridApplyQuickFilterV7 } from '../models/colDef/gridColDef';
3
- export declare const getGridNumericQuickFilterFn: (value: any) => GridApplyQuickFilterV7 | null;
2
+ import type { GetApplyQuickFilterFn } from '../models/colDef/gridColDef';
3
+ export declare const getGridNumericQuickFilterFn: GetApplyQuickFilterFn<any, number | string | null>;
4
4
  export declare const getGridNumericOperators: () => GridFilterOperator<any, number | string | null, any>[];
@@ -1,23 +1,22 @@
1
1
  import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
2
2
  import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
3
- import { convertLegacyOperators, tagInternalFilter } from './utils';
4
3
  const parseNumericValue = value => {
5
4
  if (value == null) {
6
5
  return null;
7
6
  }
8
7
  return Number(value);
9
8
  };
10
- export const getGridNumericQuickFilterFn = tagInternalFilter(value => {
9
+ export const getGridNumericQuickFilterFn = value => {
11
10
  if (value == null || Number.isNaN(value) || value === '') {
12
11
  return null;
13
12
  }
14
13
  return columnValue => {
15
14
  return parseNumericValue(columnValue) === parseNumericValue(value);
16
15
  };
17
- });
18
- export const getGridNumericOperators = () => convertLegacyOperators([{
16
+ };
17
+ export const getGridNumericOperators = () => [{
19
18
  value: '=',
20
- getApplyFilterFnV7: filterItem => {
19
+ getApplyFilterFn: filterItem => {
21
20
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
22
21
  return null;
23
22
  }
@@ -31,7 +30,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
31
30
  }
32
31
  }, {
33
32
  value: '!=',
34
- getApplyFilterFnV7: filterItem => {
33
+ getApplyFilterFn: filterItem => {
35
34
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
36
35
  return null;
37
36
  }
@@ -45,7 +44,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
45
44
  }
46
45
  }, {
47
46
  value: '>',
48
- getApplyFilterFnV7: filterItem => {
47
+ getApplyFilterFn: filterItem => {
49
48
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
50
49
  return null;
51
50
  }
@@ -62,7 +61,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
62
61
  }
63
62
  }, {
64
63
  value: '>=',
65
- getApplyFilterFnV7: filterItem => {
64
+ getApplyFilterFn: filterItem => {
66
65
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
67
66
  return null;
68
67
  }
@@ -79,7 +78,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
79
78
  }
80
79
  }, {
81
80
  value: '<',
82
- getApplyFilterFnV7: filterItem => {
81
+ getApplyFilterFn: filterItem => {
83
82
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
84
83
  return null;
85
84
  }
@@ -96,7 +95,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
96
95
  }
97
96
  }, {
98
97
  value: '<=',
99
- getApplyFilterFnV7: filterItem => {
98
+ getApplyFilterFn: filterItem => {
100
99
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
101
100
  return null;
102
101
  }
@@ -113,7 +112,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
113
112
  }
114
113
  }, {
115
114
  value: 'isEmpty',
116
- getApplyFilterFnV7: () => {
115
+ getApplyFilterFn: () => {
117
116
  return value => {
118
117
  return value == null;
119
118
  };
@@ -121,7 +120,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
121
120
  requiresFilterValue: false
122
121
  }, {
123
122
  value: 'isNotEmpty',
124
- getApplyFilterFnV7: () => {
123
+ getApplyFilterFn: () => {
125
124
  return value => {
126
125
  return value != null;
127
126
  };
@@ -129,7 +128,7 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
129
128
  requiresFilterValue: false
130
129
  }, {
131
130
  value: 'isAnyOf',
132
- getApplyFilterFnV7: filterItem => {
131
+ getApplyFilterFn: filterItem => {
133
132
  if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
134
133
  return null;
135
134
  }
@@ -141,4 +140,4 @@ export const getGridNumericOperators = () => convertLegacyOperators([{
141
140
  InputComponentProps: {
142
141
  type: 'number'
143
142
  }
144
- }]);
143
+ }];
@@ -1,16 +1,15 @@
1
1
  import { GridFilterInputSingleSelect } from '../components/panel/filterPanel/GridFilterInputSingleSelect';
2
2
  import { GridFilterInputMultipleSingleSelect } from '../components/panel/filterPanel/GridFilterInputMultipleSingleSelect';
3
3
  import { isObject } from '../utils/utils';
4
- import { convertLegacyOperators } from './utils';
5
4
  const parseObjectValue = value => {
6
5
  if (value == null || !isObject(value)) {
7
6
  return value;
8
7
  }
9
8
  return value.value;
10
9
  };
11
- export const getGridSingleSelectOperators = () => convertLegacyOperators([{
10
+ export const getGridSingleSelectOperators = () => [{
12
11
  value: 'is',
13
- getApplyFilterFnV7: filterItem => {
12
+ getApplyFilterFn: filterItem => {
14
13
  if (filterItem.value == null || filterItem.value === '') {
15
14
  return null;
16
15
  }
@@ -19,7 +18,7 @@ export const getGridSingleSelectOperators = () => convertLegacyOperators([{
19
18
  InputComponent: GridFilterInputSingleSelect
20
19
  }, {
21
20
  value: 'not',
22
- getApplyFilterFnV7: filterItem => {
21
+ getApplyFilterFn: filterItem => {
23
22
  if (filterItem.value == null || filterItem.value === '') {
24
23
  return null;
25
24
  }
@@ -28,7 +27,7 @@ export const getGridSingleSelectOperators = () => convertLegacyOperators([{
28
27
  InputComponent: GridFilterInputSingleSelect
29
28
  }, {
30
29
  value: 'isAnyOf',
31
- getApplyFilterFnV7: filterItem => {
30
+ getApplyFilterFn: filterItem => {
32
31
  if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
33
32
  return null;
34
33
  }
@@ -36,4 +35,4 @@ export const getGridSingleSelectOperators = () => convertLegacyOperators([{
36
35
  return value => filterItemValues.includes(parseObjectValue(value));
37
36
  },
38
37
  InputComponent: GridFilterInputMultipleSingleSelect
39
- }]);
38
+ }];
@@ -1,7 +1,6 @@
1
1
  import { renderEditInputCell } from '../components/cell/GridEditInputCell';
2
2
  import { gridStringOrNumberComparator } from '../hooks/features/sorting/gridSortingUtils';
3
3
  import { getGridStringOperators, getGridStringQuickFilterFn } from './gridStringOperators';
4
- import { convertQuickFilterV7ToLegacy } from './utils';
5
4
 
6
5
  /**
7
6
  * TODO: Move pro and premium properties outside of this Community file
@@ -24,6 +23,5 @@ export const GRID_STRING_COL_DEF = {
24
23
  align: 'left',
25
24
  filterOperators: getGridStringOperators(),
26
25
  renderEditCell: renderEditInputCell,
27
- getApplyQuickFilterFn: convertQuickFilterV7ToLegacy(getGridStringQuickFilterFn),
28
- getApplyQuickFilterFnV7: getGridStringQuickFilterFn
26
+ getApplyQuickFilterFn: getGridStringQuickFilterFn
29
27
  };
@@ -1,4 +1,4 @@
1
- import type { GridApplyQuickFilterV7 } from '../models/colDef/gridColDef';
1
+ import type { GetApplyQuickFilterFn } from '../models/colDef/gridColDef';
2
2
  import { GridFilterOperator } from '../models/gridFilterOperator';
3
- export declare const getGridStringQuickFilterFn: (value: any) => GridApplyQuickFilterV7 | null;
3
+ export declare const getGridStringQuickFilterFn: GetApplyQuickFilterFn<any, unknown>;
4
4
  export declare const getGridStringOperators: (disableTrim?: boolean) => GridFilterOperator<any, number | string | null, any>[];
@@ -1,9 +1,8 @@
1
1
  import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
2
2
  import { escapeRegExp } from '../utils/utils';
3
3
  import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
4
- import { convertLegacyOperators, tagInternalFilter } from './utils';
5
4
  import { removeDiacritics } from '../hooks/features/filter/gridFilterUtils';
6
- export const getGridStringQuickFilterFn = tagInternalFilter(value => {
5
+ export const getGridStringQuickFilterFn = value => {
7
6
  if (!value) {
8
7
  return null;
9
8
  }
@@ -15,10 +14,10 @@ export const getGridStringQuickFilterFn = tagInternalFilter(value => {
15
14
  }
16
15
  return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
17
16
  };
18
- });
19
- export const getGridStringOperators = (disableTrim = false) => convertLegacyOperators([{
17
+ };
18
+ export const getGridStringOperators = (disableTrim = false) => [{
20
19
  value: 'contains',
21
- getApplyFilterFnV7: filterItem => {
20
+ getApplyFilterFn: filterItem => {
22
21
  if (!filterItem.value) {
23
22
  return null;
24
23
  }
@@ -31,7 +30,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
31
30
  InputComponent: GridFilterInputValue
32
31
  }, {
33
32
  value: 'equals',
34
- getApplyFilterFnV7: filterItem => {
33
+ getApplyFilterFn: filterItem => {
35
34
  if (!filterItem.value) {
36
35
  return null;
37
36
  }
@@ -47,7 +46,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
47
46
  InputComponent: GridFilterInputValue
48
47
  }, {
49
48
  value: 'startsWith',
50
- getApplyFilterFnV7: filterItem => {
49
+ getApplyFilterFn: filterItem => {
51
50
  if (!filterItem.value) {
52
51
  return null;
53
52
  }
@@ -60,7 +59,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
60
59
  InputComponent: GridFilterInputValue
61
60
  }, {
62
61
  value: 'endsWith',
63
- getApplyFilterFnV7: filterItem => {
62
+ getApplyFilterFn: filterItem => {
64
63
  if (!filterItem.value) {
65
64
  return null;
66
65
  }
@@ -73,7 +72,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
73
72
  InputComponent: GridFilterInputValue
74
73
  }, {
75
74
  value: 'isEmpty',
76
- getApplyFilterFnV7: () => {
75
+ getApplyFilterFn: () => {
77
76
  return value => {
78
77
  return value === '' || value == null;
79
78
  };
@@ -81,7 +80,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
81
80
  requiresFilterValue: false
82
81
  }, {
83
82
  value: 'isNotEmpty',
84
- getApplyFilterFnV7: () => {
83
+ getApplyFilterFn: () => {
85
84
  return value => {
86
85
  return value !== '' && value != null;
87
86
  };
@@ -89,7 +88,7 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
89
88
  requiresFilterValue: false
90
89
  }, {
91
90
  value: 'isAnyOf',
92
- getApplyFilterFnV7: filterItem => {
91
+ getApplyFilterFn: filterItem => {
93
92
  if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
94
93
  return null;
95
94
  }
@@ -103,4 +102,4 @@ export const getGridStringOperators = (disableTrim = false) => convertLegacyOper
103
102
  }) : false;
104
103
  },
105
104
  InputComponent: GridFilterInputMultipleValue
106
- }]);
105
+ }];
@@ -130,6 +130,8 @@ process.env.NODE_ENV !== "production" ? GridToolbarFilterButton.propTypes = {
130
130
  * The props used for each slot inside.
131
131
  * @default {}
132
132
  */
133
- componentsProps: PropTypes.object
133
+ componentsProps: PropTypes.shape({
134
+ button: PropTypes.object
135
+ })
134
136
  } : void 0;
135
137
  export { GridToolbarFilterButton };
@@ -9,21 +9,21 @@ import materialSlots from '../material';
9
9
  // TODO: camelCase these key. It's a private helper now.
10
10
  // Remove then need to call `uncapitalizeObjectKeys`.
11
11
  export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
12
- Cell: GridCellV7,
13
- SkeletonCell: GridSkeletonCell,
14
- ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
15
- ColumnMenu: GridColumnMenu,
16
- ColumnHeaders: GridColumnHeaders,
17
- Footer: GridFooter,
18
- FooterRowCount: GridRowCount,
19
- Toolbar: null,
20
- PreferencesPanel: GridPreferencesPanel,
21
- LoadingOverlay: GridLoadingOverlay,
22
- NoResultsOverlay: GridNoResultsOverlay,
23
- NoRowsOverlay: GridNoRowsOverlay,
24
- Pagination: GridPagination,
25
- FilterPanel: GridFilterPanel,
26
- ColumnsPanel: GridColumnsPanel,
27
- Panel: GridPanel,
28
- Row: GridRow
12
+ cell: GridCellV7,
13
+ skeletonCell: GridSkeletonCell,
14
+ columnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
15
+ columnMenu: GridColumnMenu,
16
+ columnHeaders: GridColumnHeaders,
17
+ footer: GridFooter,
18
+ footerRowCount: GridRowCount,
19
+ toolbar: null,
20
+ preferencesPanel: GridPreferencesPanel,
21
+ loadingOverlay: GridLoadingOverlay,
22
+ noResultsOverlay: GridNoResultsOverlay,
23
+ noRowsOverlay: GridNoRowsOverlay,
24
+ pagination: GridPagination,
25
+ filterPanel: GridFilterPanel,
26
+ columnsPanel: GridColumnsPanel,
27
+ panel: GridPanel,
28
+ row: GridRow
29
29
  });
@@ -7,7 +7,7 @@ import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from
7
7
  import { gridClasses } from '../../../constants/gridClasses';
8
8
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
9
9
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
10
- import { getColumnsToExport } from './utils';
10
+ import { defaultGetRowsToExport, getColumnsToExport } from './utils';
11
11
  import { mergeStateWithPaginationModel } from '../pagination/useGridPagination';
12
12
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
13
13
  import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
@@ -121,12 +121,10 @@ export const useGridPrintExport = (apiRef, props) => {
121
121
  // the footer is always being placed at the bottom of the page as if all rows are exported
122
122
  // so if getRowsToExport is being used to only export a subset of rows then we need to
123
123
  // adjust the footer position to be correctly placed at the bottom of the grid
124
- if (options != null && options.getRowsToExport) {
125
- const gridFooterElement = gridClone.querySelector(`.${gridClasses.footerContainer}`);
126
- gridFooterElement.style.position = 'absolute';
127
- gridFooterElement.style.width = '100%';
128
- gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
129
- }
124
+ const gridFooterElement = gridClone.querySelector(`.${gridClasses.footerContainer}`);
125
+ gridFooterElement.style.position = 'absolute';
126
+ gridFooterElement.style.width = '100%';
127
+ gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
130
128
 
131
129
  // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
132
130
  // prevents us to do it
@@ -210,6 +208,7 @@ export const useGridPrintExport = (apiRef, props) => {
210
208
  previousRows.current = [];
211
209
  }, [apiRef]);
212
210
  const exportDataAsPrint = React.useCallback(async options => {
211
+ var _options$getRowsToExp;
213
212
  logger.debug(`Export data as Print`);
214
213
  if (!apiRef.current.rootElementRef.current) {
215
214
  throw new Error('MUI: No grid root element available.');
@@ -230,9 +229,7 @@ export const useGridPrintExport = (apiRef, props) => {
230
229
  apiRef.current.forceUpdate();
231
230
  }
232
231
  await updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns, options == null ? void 0 : options.includeCheckboxes);
233
- if (options != null && options.getRowsToExport) {
234
- updateGridRowsForPrint(options.getRowsToExport);
235
- }
232
+ updateGridRowsForPrint((_options$getRowsToExp = options == null ? void 0 : options.getRowsToExport) != null ? _options$getRowsToExp : defaultGetRowsToExport);
236
233
  apiRef.current.unstable_setVirtualization(false);
237
234
  await raf(); // wait for the state changes to take action
238
235
  const printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { GridLogicOperator } from '../../../models';
3
- import { GLOBAL_API_REF, isInternalFilter } from '../../../colDef/utils';
4
3
  import { getDefaultGridFilterModel } from './gridFilterState';
5
4
  import { buildWarning } from '../../../utils/warning';
6
5
  import { getPublicApiRef } from '../../../utils/getPublicApiRef';
@@ -109,42 +108,19 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
109
108
  if (!filterOperator) {
110
109
  throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
111
110
  }
112
- const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
113
- const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
114
111
  const publicApiRef = getPublicApiRef(apiRef);
115
- if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
116
- const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
117
- if (typeof applyFilterOnRow !== 'function') {
118
- return null;
119
- }
120
- return {
121
- v7: true,
122
- item: newFilterItem,
123
- fn: row => {
124
- let value = apiRef.current.getRowValue(row, column);
125
- if (ignoreDiacritics) {
126
- value = removeDiacritics(value);
127
- }
128
- return applyFilterOnRow(value, row, column, publicApiRef);
129
- }
130
- };
131
- }
132
112
  const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
133
113
  if (typeof applyFilterOnRow !== 'function') {
134
114
  return null;
135
115
  }
136
116
  return {
137
- v7: false,
138
117
  item: newFilterItem,
139
- fn: rowId => {
140
- const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
141
- GLOBAL_API_REF.current = publicApiRef;
118
+ fn: row => {
119
+ let value = apiRef.current.getRowValue(row, column);
142
120
  if (ignoreDiacritics) {
143
- params.value = removeDiacritics(params.value);
121
+ value = removeDiacritics(value);
144
122
  }
145
- const result = applyFilterOnRow(params);
146
- GLOBAL_API_REF.current = null;
147
- return result;
123
+ return applyFilterOnRow(value, row, column, publicApiRef);
148
124
  }
149
125
  };
150
126
  };
@@ -171,7 +147,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
171
147
  for (let i = 0; i < appliers.length; i += 1) {
172
148
  const applier = appliers[i];
173
149
  if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
174
- resultPerItemId[applier.item.id] = applier.v7 ? applier.fn(row) : applier.fn(apiRef.current.getRowId(row));
150
+ resultPerItemId[applier.item.id] = applier.fn(row);
175
151
  }
176
152
  }
177
153
  return resultPerItemId;
@@ -187,7 +163,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
187
163
  ${appliers.map((applier, i) => `${JSON.stringify(String(applier.item.id))}:
188
164
  !shouldApply${i} ?
189
165
  false :
190
- ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},
166
+ appliers[${i}].fn(row),
191
167
  `).join('\n')}};
192
168
 
193
169
  return result$$;
@@ -222,27 +198,12 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
222
198
  columnFields.forEach(field => {
223
199
  const column = apiRef.current.getColumn(field);
224
200
  const getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
225
- const getApplyQuickFilterFnV7 = column == null ? void 0 : column.getApplyQuickFilterFnV7;
226
- const hasUserFunctionLegacy = !isInternalFilter(getApplyQuickFilterFn);
227
- const hasUserFunctionV7 = !isInternalFilter(getApplyQuickFilterFnV7);
228
- if (getApplyQuickFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
201
+ if (getApplyQuickFilterFn) {
229
202
  appliersPerField.push({
230
203
  column,
231
204
  appliers: quickFilterValues.map(quickFilterValue => {
232
205
  const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
233
206
  return {
234
- v7: true,
235
- fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
236
- };
237
- })
238
- });
239
- } else if (getApplyQuickFilterFn) {
240
- appliersPerField.push({
241
- column,
242
- appliers: quickFilterValues.map(quickFilterValue => {
243
- const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
244
- return {
245
- v7: false,
246
207
  fn: getApplyQuickFilterFn(value, column, publicApiRef)
247
208
  };
248
209
  })
@@ -251,7 +212,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
251
212
  });
252
213
  return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
253
214
  const result = {};
254
- const usedCellParams = {};
255
215
 
256
216
  /* eslint-disable no-restricted-syntax, no-labels */
257
217
  outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
@@ -272,27 +232,13 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
272
232
  if (applier.fn === null) {
273
233
  continue;
274
234
  }
275
- if (applier.v7) {
276
- if (ignoreDiacritics) {
277
- value = removeDiacritics(value);
278
- }
279
- const isMatching = applier.fn(value, row, column, publicApiRef);
280
- if (isMatching) {
281
- result[filterValue] = true;
282
- continue outer;
283
- }
284
- } else {
285
- var _usedCellParams$field;
286
- const cellParams = (_usedCellParams$field = usedCellParams[field]) != null ? _usedCellParams$field : apiRef.current.getCellParams(apiRef.current.getRowId(row), field);
287
- if (ignoreDiacritics) {
288
- cellParams.value = removeDiacritics(cellParams.value);
289
- }
290
- usedCellParams[field] = cellParams;
291
- const isMatching = applier.fn(cellParams);
292
- if (isMatching) {
293
- result[filterValue] = true;
294
- continue outer;
295
- }
235
+ if (ignoreDiacritics) {
236
+ value = removeDiacritics(value);
237
+ }
238
+ const isMatching = applier.fn(value, row, column, publicApiRef);
239
+ if (isMatching) {
240
+ result[filterValue] = true;
241
+ continue outer;
296
242
  }
297
243
  }
298
244
  result[filterValue] = false;
@@ -289,7 +289,10 @@ export const useGridRows = (apiRef, props) => {
289
289
  });
290
290
 
291
291
  // Removes potential remaining skeleton rows from the dataRowIds.
292
- const dataRowIds = rootGroupChildren.filter(childId => tree[childId].type === 'leaf');
292
+ const dataRowIds = rootGroupChildren.filter(childId => {
293
+ var _tree$childId;
294
+ return ((_tree$childId = tree[childId]) == null ? void 0 : _tree$childId.type) === 'leaf';
295
+ });
293
296
  apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
294
297
  apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
295
298
  apiRef.current.setState(state => _extends({}, state, {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.18.1
2
+ * @mui/x-data-grid v7.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -79,5 +79,4 @@ export * from '../hooks/utils/useOnMount';
79
79
  export type { GridApiCommunity } from '../models/api/gridApiCommunity';
80
80
  export type { GridApiCaches } from '../models/gridApiCaches';
81
81
  export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
82
- export * from '../colDef/utils';
83
82
  export * from './utils';
@@ -63,5 +63,4 @@ export * from '../utils/getPublicApiRef';
63
63
  export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
64
64
  export * from '../hooks/utils/useOnMount';
65
65
  export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
66
- export * from '../colDef/utils';
67
66
  export * from './utils';
@@ -1,6 +1,4 @@
1
- import { UncapitalizeObjectKeys } from './slotsMigration';
2
- export declare function computeSlots<SlotComponents extends object>({ defaultSlots, slots, components, }: {
3
- defaultSlots: UncapitalizeObjectKeys<SlotComponents>;
4
- slots?: UncapitalizeObjectKeys<Partial<SlotComponents>>;
5
- components?: Partial<SlotComponents>;
6
- }): UncapitalizeObjectKeys<SlotComponents>;
1
+ export declare function computeSlots<SlotComponents extends object>({ defaultSlots, slots, }: {
2
+ defaultSlots: SlotComponents;
3
+ slots?: Partial<SlotComponents>;
4
+ }): SlotComponents;