@mui/x-data-grid 5.12.2 → 5.13.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 (177) hide show
  1. package/CHANGELOG.md +160 -6
  2. package/DataGrid/DataGrid.js +4 -4
  3. package/colDef/gridDateOperators.js +4 -2
  4. package/colDef/gridNumericOperators.js +4 -2
  5. package/colDef/gridStringOperators.d.ts +1 -1
  6. package/colDef/gridStringOperators.js +15 -8
  7. package/components/GridRow.js +1 -1
  8. package/components/cell/GridActionsCellItem.d.ts +2 -2
  9. package/components/cell/GridBooleanCell.js +4 -3
  10. package/components/cell/GridEditBooleanCell.js +4 -3
  11. package/components/cell/GridEditDateCell.js +4 -3
  12. package/components/cell/GridEditInputCell.js +4 -3
  13. package/components/cell/GridEditSingleSelectCell.js +9 -7
  14. package/components/panel/GridColumnsPanel.js +1 -1
  15. package/components/panel/GridPanel.d.ts +1 -1
  16. package/components/panel/filterPanel/GridFilterForm.js +11 -4
  17. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  18. package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  19. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +5 -9
  20. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +42 -19
  21. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
  22. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
  23. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  24. package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  25. package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
  26. package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
  27. package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
  28. package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
  29. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  30. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  31. package/hooks/features/dimensions/useGridDimensions.js +28 -15
  32. package/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  33. package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  34. package/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  35. package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  36. package/hooks/features/filter/gridFilterUtils.js +8 -5
  37. package/hooks/features/filter/useGridFilter.js +19 -1
  38. package/hooks/features/rows/useGridRows.js +16 -3
  39. package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  40. package/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
  41. package/hooks/utils/useGridApiContext.js +1 -1
  42. package/hooks/utils/useGridRootProps.js +1 -1
  43. package/index.js +1 -1
  44. package/legacy/DataGrid/DataGrid.js +4 -4
  45. package/legacy/colDef/gridDateOperators.js +4 -2
  46. package/legacy/colDef/gridNumericOperators.js +4 -2
  47. package/legacy/colDef/gridStringOperators.js +17 -7
  48. package/legacy/components/GridRow.js +1 -1
  49. package/legacy/components/cell/GridBooleanCell.js +3 -1
  50. package/legacy/components/cell/GridEditBooleanCell.js +4 -2
  51. package/legacy/components/cell/GridEditDateCell.js +4 -2
  52. package/legacy/components/cell/GridEditInputCell.js +4 -2
  53. package/legacy/components/cell/GridEditSingleSelectCell.js +9 -7
  54. package/legacy/components/panel/GridColumnsPanel.js +3 -1
  55. package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
  56. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  57. package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  58. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +34 -12
  59. package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
  60. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  61. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  62. package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
  63. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  64. package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
  65. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  66. package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
  67. package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
  68. package/legacy/hooks/features/filter/useGridFilter.js +19 -1
  69. package/legacy/hooks/features/rows/useGridRows.js +18 -3
  70. package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  71. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +19 -8
  72. package/legacy/hooks/utils/useGridApiContext.js +1 -1
  73. package/legacy/hooks/utils/useGridRootProps.js +1 -1
  74. package/legacy/index.js +1 -1
  75. package/legacy/locales/deDE.js +4 -4
  76. package/legacy/locales/frFR.js +11 -11
  77. package/legacy/locales/index.js +3 -0
  78. package/legacy/locales/nlNL.js +15 -15
  79. package/legacy/locales/ptBR.js +11 -11
  80. package/legacy/locales/roRO.js +128 -0
  81. package/legacy/locales/skSK.js +16 -16
  82. package/legacy/locales/svSE.js +128 -0
  83. package/legacy/utils/keyboardUtils.js +4 -3
  84. package/locales/deDE.js +4 -4
  85. package/locales/frFR.js +11 -11
  86. package/locales/index.d.ts +3 -0
  87. package/locales/index.js +3 -0
  88. package/locales/nlNL.js +15 -15
  89. package/locales/ptBR.js +11 -11
  90. package/locales/roRO.d.ts +2 -0
  91. package/locales/roRO.js +116 -0
  92. package/locales/skSK.js +16 -16
  93. package/locales/svSE.d.ts +2 -0
  94. package/locales/svSE.js +116 -0
  95. package/models/gridFilterOperator.d.ts +6 -0
  96. package/modern/DataGrid/DataGrid.js +4 -4
  97. package/modern/colDef/gridDateOperators.js +4 -2
  98. package/modern/colDef/gridNumericOperators.js +4 -2
  99. package/modern/colDef/gridStringOperators.js +15 -8
  100. package/modern/components/GridRow.js +1 -1
  101. package/modern/components/cell/GridBooleanCell.js +4 -3
  102. package/modern/components/cell/GridEditBooleanCell.js +4 -3
  103. package/modern/components/cell/GridEditDateCell.js +4 -3
  104. package/modern/components/cell/GridEditInputCell.js +4 -3
  105. package/modern/components/cell/GridEditSingleSelectCell.js +9 -7
  106. package/modern/components/panel/GridColumnsPanel.js +1 -1
  107. package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
  108. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  109. package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  110. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +32 -13
  111. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
  112. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  113. package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  114. package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
  115. package/modern/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  116. package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  117. package/modern/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  118. package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  119. package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
  120. package/modern/hooks/features/filter/useGridFilter.js +17 -1
  121. package/modern/hooks/features/rows/useGridRows.js +16 -3
  122. package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  123. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +10 -3
  124. package/modern/hooks/utils/useGridApiContext.js +1 -1
  125. package/modern/hooks/utils/useGridRootProps.js +1 -1
  126. package/modern/index.js +1 -1
  127. package/modern/locales/deDE.js +4 -4
  128. package/modern/locales/frFR.js +11 -11
  129. package/modern/locales/index.js +3 -0
  130. package/modern/locales/nlNL.js +15 -15
  131. package/modern/locales/ptBR.js +11 -11
  132. package/modern/locales/roRO.js +116 -0
  133. package/modern/locales/skSK.js +16 -16
  134. package/modern/locales/svSE.js +116 -0
  135. package/modern/utils/keyboardUtils.js +4 -3
  136. package/node/DataGrid/DataGrid.js +4 -4
  137. package/node/colDef/gridDateOperators.js +4 -2
  138. package/node/colDef/gridNumericOperators.js +4 -2
  139. package/node/colDef/gridStringOperators.js +15 -8
  140. package/node/components/GridRow.js +1 -1
  141. package/node/components/cell/GridBooleanCell.js +5 -3
  142. package/node/components/cell/GridEditBooleanCell.js +5 -3
  143. package/node/components/cell/GridEditDateCell.js +5 -3
  144. package/node/components/cell/GridEditInputCell.js +5 -3
  145. package/node/components/cell/GridEditSingleSelectCell.js +10 -7
  146. package/node/components/panel/GridColumnsPanel.js +1 -1
  147. package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
  148. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  149. package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  150. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +43 -20
  151. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
  152. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  153. package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  154. package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
  155. package/node/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  156. package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  157. package/node/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  158. package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  159. package/node/hooks/features/filter/gridFilterUtils.js +7 -4
  160. package/node/hooks/features/filter/useGridFilter.js +19 -1
  161. package/node/hooks/features/rows/useGridRows.js +16 -3
  162. package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  163. package/node/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
  164. package/node/hooks/utils/useGridApiContext.js +1 -1
  165. package/node/hooks/utils/useGridRootProps.js +1 -1
  166. package/node/index.js +1 -1
  167. package/node/locales/deDE.js +4 -4
  168. package/node/locales/frFR.js +11 -11
  169. package/node/locales/index.js +39 -0
  170. package/node/locales/nlNL.js +15 -15
  171. package/node/locales/ptBR.js +11 -11
  172. package/node/locales/roRO.js +126 -0
  173. package/node/locales/skSK.js +16 -16
  174. package/node/locales/svSE.js +126 -0
  175. package/node/utils/keyboardUtils.js +4 -3
  176. package/package.json +4 -4
  177. package/utils/keyboardUtils.js +4 -3
@@ -0,0 +1,116 @@
1
+ import { svSE as svSECore } from '@mui/material/locale';
2
+ import { getGridLocalization } from '../utils/getGridLocalization';
3
+ const svSEGrid = {
4
+ // Root
5
+ noRowsLabel: 'Inga rader',
6
+ noResultsOverlayLabel: 'Inga resultat funna.',
7
+ errorOverlayDefaultLabel: 'Ett fel uppstod.',
8
+ // Density selector toolbar button text
9
+ toolbarDensity: 'Densitet',
10
+ toolbarDensityLabel: 'Densitet',
11
+ toolbarDensityCompact: 'Kompakt',
12
+ toolbarDensityStandard: 'Standard',
13
+ toolbarDensityComfortable: 'Bekväm',
14
+ // Columns selector toolbar button text
15
+ toolbarColumns: 'Kolumner',
16
+ toolbarColumnsLabel: 'Välj kolumner',
17
+ // Filters toolbar button text
18
+ toolbarFilters: 'Filter',
19
+ toolbarFiltersLabel: 'Visa filter',
20
+ toolbarFiltersTooltipHide: 'Dölj filter',
21
+ toolbarFiltersTooltipShow: 'Visa filter',
22
+ toolbarFiltersTooltipActive: count => count !== 1 ? `${count} aktiva filter` : `${count} aktivt filter`,
23
+ // Quick filter toolbar field
24
+ toolbarQuickFilterPlaceholder: 'Sök...',
25
+ toolbarQuickFilterLabel: 'Sök',
26
+ toolbarQuickFilterDeleteIconLabel: 'Rensa',
27
+ // Export selector toolbar button text
28
+ toolbarExport: 'Exportera',
29
+ toolbarExportLabel: 'Exportera',
30
+ toolbarExportCSV: 'Ladda ner som CSV',
31
+ toolbarExportPrint: 'Skriv ut',
32
+ toolbarExportExcel: 'Ladda ner som Excel',
33
+ // Columns panel text
34
+ columnsPanelTextFieldLabel: 'Hitta kolumn',
35
+ columnsPanelTextFieldPlaceholder: 'Kolumntitel',
36
+ columnsPanelDragIconLabel: 'Ordna om kolumnen',
37
+ columnsPanelShowAllButton: 'Visa alla',
38
+ columnsPanelHideAllButton: 'Dölj alla',
39
+ // Filter panel text
40
+ filterPanelAddFilter: 'Lägg till filter',
41
+ filterPanelDeleteIconLabel: 'Ta bort',
42
+ filterPanelLinkOperator: 'Logisk operatör',
43
+ filterPanelOperators: 'Operatör',
44
+ // TODO v6: rename to filterPanelOperator
45
+ filterPanelOperatorAnd: 'Och',
46
+ filterPanelOperatorOr: 'Eller',
47
+ filterPanelColumns: 'Kolumner',
48
+ filterPanelInputLabel: 'Värde',
49
+ filterPanelInputPlaceholder: 'Filtervärde',
50
+ // Filter operators text
51
+ filterOperatorContains: 'innehåller',
52
+ filterOperatorEquals: 'är lika med',
53
+ filterOperatorStartsWith: 'börjar med',
54
+ filterOperatorEndsWith: 'slutar med',
55
+ filterOperatorIs: 'är',
56
+ filterOperatorNot: 'är inte',
57
+ filterOperatorAfter: 'är efter',
58
+ filterOperatorOnOrAfter: 'är på eller efter',
59
+ filterOperatorBefore: 'är innan',
60
+ filterOperatorOnOrBefore: 'är på eller innan',
61
+ filterOperatorIsEmpty: 'är tom',
62
+ filterOperatorIsNotEmpty: 'är inte tom',
63
+ filterOperatorIsAnyOf: 'är någon av',
64
+ // Filter values text
65
+ filterValueAny: 'något',
66
+ filterValueTrue: 'sant',
67
+ filterValueFalse: 'falskt',
68
+ // Column menu text
69
+ columnMenuLabel: 'Meny',
70
+ columnMenuShowColumns: 'Visa kolumner',
71
+ columnMenuFilter: 'Filtrera',
72
+ columnMenuHideColumn: 'Dölj',
73
+ columnMenuUnsort: 'Osortera',
74
+ columnMenuSortAsc: 'Sortera stigande',
75
+ columnMenuSortDesc: 'Sortera fallande',
76
+ // Column header text
77
+ columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} aktiva filter` : `${count} aktivt filter`,
78
+ columnHeaderFiltersLabel: 'Visa filter',
79
+ columnHeaderSortIconLabel: 'Sortera',
80
+ // Rows selected footer text
81
+ footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} rader markerade` : `${count.toLocaleString()} rad markerad`,
82
+ // Total row amount footer text
83
+ footerTotalRows: 'Totalt antal rader:',
84
+ // Total visible row amount footer text
85
+ footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} av ${totalCount.toLocaleString()}`,
86
+ // Checkbox selection text
87
+ checkboxSelectionHeaderName: 'Markering med kryssruta',
88
+ checkboxSelectionSelectAllRows: 'Markera alla rader',
89
+ checkboxSelectionUnselectAllRows: 'Avmarkera alla rader',
90
+ checkboxSelectionSelectRow: 'Markera rad',
91
+ checkboxSelectionUnselectRow: 'Avmarkera rad',
92
+ // Boolean cell text
93
+ booleanCellTrueLabel: 'ja',
94
+ booleanCellFalseLabel: 'nej',
95
+ // Actions cell more text
96
+ actionsCellMore: 'mer',
97
+ // Column pinning text
98
+ pinToLeft: 'Fäst till vänster',
99
+ pinToRight: 'Fäst till höger',
100
+ unpin: 'Ta bort fäste',
101
+ // Tree Data
102
+ treeDataGroupingHeaderName: 'Grupp',
103
+ treeDataExpand: 'visa underordnade',
104
+ treeDataCollapse: 'dölj underordnade',
105
+ // Grouping columns
106
+ groupingColumnHeaderName: 'Grupp',
107
+ groupColumn: name => `Gruppera efter ${name}`,
108
+ unGroupColumn: name => `Sluta gruppera efter ${name}`,
109
+ // Master/detail
110
+ // detailPanelToggle: 'Detail panel toggle',
111
+ expandDetailPanel: 'Expandera',
112
+ collapseDetailPanel: 'Kollapsa',
113
+ // Row reordering text
114
+ rowReorderingHeaderName: 'Ordna om rader'
115
+ };
116
+ export const svSE = getGridLocalization(svSEGrid, svSECore);
@@ -35,4 +35,10 @@ export interface GridFilterOperator<R extends GridValidRowModel = any, V = any,
35
35
  * The props to pass to the input component in the filter panel for this filter operator.
36
36
  */
37
37
  InputComponentProps?: Record<string, any>;
38
+ /**
39
+ * If `false`, filter operator doesn't require user-entered value to work.
40
+ * Usually should be set to `false` for filter operators that don't have `InputComponent` (for example `isEmpty`)
41
+ * @default true
42
+ */
43
+ requiresFilterValue?: boolean;
38
44
  }
@@ -86,7 +86,7 @@ DataGridRaw.propTypes = {
86
86
  columns: chainPropTypes(PropTypes.array.isRequired, props => {
87
87
  // @ts-ignore because otherwise `build:api` doesn't work
88
88
  if (props.columns && props.columns.some(column => column.resizable)) {
89
- return new Error([`MUI: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to the DataGridPro component to unlock this feature.'].join('\n'));
89
+ return new Error([`MUI: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
90
90
  }
91
91
 
92
92
  return null;
@@ -656,14 +656,14 @@ DataGridRaw.propTypes = {
656
656
  */
657
657
  pageSize: chainPropTypes(PropTypes.number, props => {
658
658
  if (props.pageSize && props.pageSize > MAX_PAGE_SIZE) {
659
- return new Error([`MUI: \`<DataGrid pageSize={${props.pageSize}} />\` is not a valid prop.`, `Only page size below ${MAX_PAGE_SIZE} is available in the MIT version.`, '', 'You need to upgrade to the DataGridPro component to unlock this feature.'].join('\n'));
659
+ return new Error([`MUI: \`<DataGrid pageSize={${props.pageSize}} />\` is not a valid prop.`, `Only page size below ${MAX_PAGE_SIZE} is available in the MIT version.`, '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
660
660
  }
661
661
 
662
662
  return null;
663
663
  }),
664
664
  pagination: props => {
665
665
  if (props.pagination === false) {
666
- return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to the DataGridPro component to disable the pagination.'].join('\n'));
666
+ return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to disable the pagination.'].join('\n'));
667
667
  }
668
668
 
669
669
  return null;
@@ -743,7 +743,7 @@ DataGridRaw.propTypes = {
743
743
  */
744
744
  selectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), props => {
745
745
  if (!props.checkboxSelection && Array.isArray(props.selectionModel) && props.selectionModel.length > 1) {
746
- return new Error([`MUI: \`<DataGrid selectionModel={${JSON.stringify(props.selectionModel)}} />\` is not a valid prop.`, 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to the DataGridPro component to unlock multiple selection.'].join('\n'));
746
+ return new Error([`MUI: \`<DataGrid selectionModel={${JSON.stringify(props.selectionModel)}} />\` is not a valid prop.`, 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
747
747
  }
748
748
 
749
749
  return null;
@@ -91,7 +91,8 @@ export const getGridDateOperators = showTime => [{
91
91
  }) => {
92
92
  return value == null;
93
93
  };
94
- }
94
+ },
95
+ requiresFilterValue: false
95
96
  }, {
96
97
  value: 'isNotEmpty',
97
98
  getApplyFilterFn: () => {
@@ -100,5 +101,6 @@ export const getGridDateOperators = showTime => [{
100
101
  }) => {
101
102
  return value != null;
102
103
  };
103
- }
104
+ },
105
+ requiresFilterValue: false
104
106
  }];
@@ -153,7 +153,8 @@ export const getGridNumericOperators = () => [{
153
153
  }) => {
154
154
  return value == null;
155
155
  };
156
- }
156
+ },
157
+ requiresFilterValue: false
157
158
  }, {
158
159
  value: 'isNotEmpty',
159
160
  getApplyFilterFn: () => {
@@ -162,7 +163,8 @@ export const getGridNumericOperators = () => [{
162
163
  }) => {
163
164
  return value != null;
164
165
  };
165
- }
166
+ },
167
+ requiresFilterValue: false
166
168
  }, {
167
169
  value: 'isAnyOf',
168
170
  getApplyFilterFn: filterItem => {
@@ -13,14 +13,15 @@ export const getGridStringQuickFilterFn = value => {
13
13
  return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
14
14
  };
15
15
  };
16
- export const getGridStringOperators = () => [{
16
+ export const getGridStringOperators = (disableTrim = false) => [{
17
17
  value: 'contains',
18
18
  getApplyFilterFn: filterItem => {
19
19
  if (!filterItem.value) {
20
20
  return null;
21
21
  }
22
22
 
23
- const filterRegex = new RegExp(escapeRegExp(filterItem.value), 'i');
23
+ const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
24
+ const filterRegex = new RegExp(escapeRegExp(filterItemValue), 'i');
24
25
  return ({
25
26
  value
26
27
  }) => {
@@ -35,6 +36,7 @@ export const getGridStringOperators = () => [{
35
36
  return null;
36
37
  }
37
38
 
39
+ const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
38
40
  const collator = new Intl.Collator(undefined, {
39
41
  sensitivity: 'base',
40
42
  usage: 'search'
@@ -42,7 +44,7 @@ export const getGridStringOperators = () => [{
42
44
  return ({
43
45
  value
44
46
  }) => {
45
- return value != null ? collator.compare(filterItem.value, value.toString()) === 0 : false;
47
+ return value != null ? collator.compare(filterItemValue, value.toString()) === 0 : false;
46
48
  };
47
49
  },
48
50
  InputComponent: GridFilterInputValue
@@ -53,7 +55,8 @@ export const getGridStringOperators = () => [{
53
55
  return null;
54
56
  }
55
57
 
56
- const filterRegex = new RegExp(`^${escapeRegExp(filterItem.value)}.*$`, 'i');
58
+ const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
59
+ const filterRegex = new RegExp(`^${escapeRegExp(filterItemValue)}.*$`, 'i');
57
60
  return ({
58
61
  value
59
62
  }) => {
@@ -68,7 +71,8 @@ export const getGridStringOperators = () => [{
68
71
  return null;
69
72
  }
70
73
 
71
- const filterRegex = new RegExp(`.*${escapeRegExp(filterItem.value)}$`, 'i');
74
+ const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
75
+ const filterRegex = new RegExp(`.*${escapeRegExp(filterItemValue)}$`, 'i');
72
76
  return ({
73
77
  value
74
78
  }) => {
@@ -84,7 +88,8 @@ export const getGridStringOperators = () => [{
84
88
  }) => {
85
89
  return value === '' || value == null;
86
90
  };
87
- }
91
+ },
92
+ requiresFilterValue: false
88
93
  }, {
89
94
  value: 'isNotEmpty',
90
95
  getApplyFilterFn: () => {
@@ -93,7 +98,8 @@ export const getGridStringOperators = () => [{
93
98
  }) => {
94
99
  return value !== '' && value != null;
95
100
  };
96
- }
101
+ },
102
+ requiresFilterValue: false
97
103
  }, {
98
104
  value: 'isAnyOf',
99
105
  getApplyFilterFn: filterItem => {
@@ -101,13 +107,14 @@ export const getGridStringOperators = () => [{
101
107
  return null;
102
108
  }
103
109
 
110
+ const filterItemValue = disableTrim ? filterItem.value : filterItem.value.map(val => val.trim());
104
111
  const collator = new Intl.Collator(undefined, {
105
112
  sensitivity: 'base',
106
113
  usage: 'search'
107
114
  });
108
115
  return ({
109
116
  value
110
- }) => value != null ? filterItem.value.some(filterValue => {
117
+ }) => value != null ? filterItemValue.some(filterValue => {
111
118
  return collator.compare(filterValue, value.toString() || '') === 0;
112
119
  }) : false;
113
120
  },
@@ -110,7 +110,7 @@ function GridRow(props) {
110
110
  // Fallback for IE
111
111
  apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
112
112
  }
113
- });
113
+ }, [apiRef, rowHeight, rowId]);
114
114
  React.useLayoutEffect(() => {
115
115
  if (currentPage.range) {
116
116
  // The index prop is relative to the rows from all pages. As example, the index prop of the
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import { unstable_composeClasses as composeClasses } from '@mui/material';
6
6
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
7
7
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
8
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
 
10
11
  const useUtilityClasses = ownerState => {
@@ -19,11 +20,11 @@ const useUtilityClasses = ownerState => {
19
20
 
20
21
  export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
21
22
  const {
22
- value,
23
- api
23
+ value
24
24
  } = props,
25
25
  other = _objectWithoutPropertiesLoose(props, _excluded);
26
26
 
27
+ const apiRef = useGridApiContext();
27
28
  const rootProps = useGridRootProps();
28
29
  const ownerState = {
29
30
  classes: rootProps.classes
@@ -33,7 +34,7 @@ export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
33
34
  return /*#__PURE__*/_jsx(Icon, _extends({
34
35
  fontSize: "small",
35
36
  className: classes.root,
36
- titleAccess: api.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
37
+ titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
37
38
  "data-value": Boolean(value)
38
39
  }, other));
39
40
  });
@@ -8,6 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
8
8
  import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
9
9
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
10
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
 
13
14
  const useUtilityClasses = ownerState => {
@@ -24,7 +25,6 @@ function GridEditBooleanCell(props) {
24
25
  const {
25
26
  id: idProp,
26
27
  value,
27
- api,
28
28
  field,
29
29
  className,
30
30
  hasFocus,
@@ -32,6 +32,7 @@ function GridEditBooleanCell(props) {
32
32
  } = props,
33
33
  other = _objectWithoutPropertiesLoose(props, _excluded);
34
34
 
35
+ const apiRef = useGridApiContext();
35
36
  const inputRef = React.useRef(null);
36
37
  const id = useId();
37
38
  const [valueState, setValueState] = React.useState(value);
@@ -48,12 +49,12 @@ function GridEditBooleanCell(props) {
48
49
  }
49
50
 
50
51
  setValueState(newValue);
51
- await api.setEditCellValue({
52
+ await apiRef.current.setEditCellValue({
52
53
  id: idProp,
53
54
  field,
54
55
  value: newValue
55
56
  }, event);
56
- }, [api, field, idProp, onValueChange]);
57
+ }, [apiRef, field, idProp, onValueChange]);
57
58
  React.useEffect(() => {
58
59
  setValueState(value);
59
60
  }, [value]);
@@ -8,6 +8,7 @@ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/u
8
8
  import InputBase from '@mui/material/InputBase';
9
9
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
10
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
 
13
14
  const useUtilityClasses = ownerState => {
@@ -24,7 +25,6 @@ function GridEditDateCell(props) {
24
25
  const {
25
26
  id,
26
27
  value: valueProp,
27
- api,
28
28
  field,
29
29
  colDef,
30
30
  hasFocus,
@@ -34,6 +34,7 @@ function GridEditDateCell(props) {
34
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
35
35
 
36
36
  const isDateTime = colDef.type === 'dateTime';
37
+ const apiRef = useGridApiContext();
37
38
  const inputRef = React.useRef();
38
39
  const valueTransformed = React.useMemo(() => {
39
40
  let parsedDate;
@@ -93,12 +94,12 @@ function GridEditDateCell(props) {
93
94
  parsed: newParsedDate,
94
95
  formatted: newFormattedDate
95
96
  });
96
- api.setEditCellValue({
97
+ apiRef.current.setEditCellValue({
97
98
  id,
98
99
  field,
99
100
  value: newParsedDate
100
101
  }, event);
101
- }, [api, field, id, onValueChange]);
102
+ }, [apiRef, field, id, onValueChange]);
102
103
  React.useEffect(() => {
103
104
  setValueState(state => {
104
105
  if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
@@ -11,6 +11,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
11
11
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
12
12
  import { GridLoadIcon } from '../icons/index';
13
13
  import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
14
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
 
16
17
  const useUtilityClasses = ownerState => {
@@ -43,7 +44,6 @@ function GridEditInputCell(props) {
43
44
  const {
44
45
  id,
45
46
  value,
46
- api,
47
47
  field,
48
48
  colDef,
49
49
  hasFocus,
@@ -53,6 +53,7 @@ function GridEditInputCell(props) {
53
53
  } = props,
54
54
  other = _objectWithoutPropertiesLoose(props, _excluded);
55
55
 
56
+ const apiRef = useGridApiContext();
56
57
  const inputRef = React.useRef();
57
58
  const [valueState, setValueState] = React.useState(value);
58
59
  const ownerState = {
@@ -67,13 +68,13 @@ function GridEditInputCell(props) {
67
68
  }
68
69
 
69
70
  setValueState(newValue);
70
- api.setEditCellValue({
71
+ apiRef.current.setEditCellValue({
71
72
  id,
72
73
  field,
73
74
  value: newValue,
74
75
  debounceMs
75
76
  }, event);
76
- }, [api, debounceMs, field, id, onValueChange]);
77
+ }, [apiRef, debounceMs, field, id, onValueChange]);
77
78
  React.useEffect(() => {
78
79
  setValueState(value);
79
80
  }, [value]);
@@ -9,6 +9,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
9
9
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
10
10
  import { GridEditModes } from '../../models/gridEditRowModel';
11
11
  import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
12
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
 
14
15
  const renderSingleSelectOptions = (option, OptionComponent) => {
@@ -36,6 +37,7 @@ function GridEditSingleSelectCell(props) {
36
37
  } = props,
37
38
  other = _objectWithoutPropertiesLoose(props, _excluded);
38
39
 
40
+ const apiRef = useGridApiContext();
39
41
  const ref = React.useRef();
40
42
  const inputRef = React.useRef();
41
43
  const rootProps = useGridRootProps();
@@ -82,7 +84,7 @@ function GridEditSingleSelectCell(props) {
82
84
  await onValueChange(event, formattedTargetValue);
83
85
  }
84
86
 
85
- const isValid = await api.setEditCellValue({
87
+ const isValid = await apiRef.current.setEditCellValue({
86
88
  id,
87
89
  field,
88
90
  value: formattedTargetValue
@@ -97,18 +99,18 @@ function GridEditSingleSelectCell(props) {
97
99
  return;
98
100
  }
99
101
 
100
- const canCommit = await Promise.resolve(api.commitCellChange({
102
+ const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
101
103
  id,
102
104
  field
103
105
  }, event));
104
106
 
105
107
  if (canCommit) {
106
- api.setCellMode(id, field, 'view');
108
+ apiRef.current.setCellMode(id, field, 'view');
107
109
 
108
110
  if (event.key) {
109
111
  // TODO v6: remove once we stop ignoring events fired from portals
110
- const params = api.getCellParams(id, field);
111
- api.publishEvent('cellNavigationKeyDown', params, event);
112
+ const params = apiRef.current.getCellParams(id, field);
113
+ apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
112
114
  }
113
115
  }
114
116
  };
@@ -121,13 +123,13 @@ function GridEditSingleSelectCell(props) {
121
123
 
122
124
  if (reason === 'backdropClick' || isEscapeKey(event.key)) {
123
125
  if (rootProps.experimentalFeatures?.newEditingApi) {
124
- api.stopCellEditMode({
126
+ apiRef.current.stopCellEditMode({
125
127
  id,
126
128
  field,
127
129
  ignoreModifications: true
128
130
  });
129
131
  } else {
130
- api.setCellMode(id, field, 'view');
132
+ apiRef.current.setCellMode(id, field, 'view');
131
133
  }
132
134
  }
133
135
  };
@@ -79,7 +79,7 @@ export function GridColumnsPanel(props) {
79
79
  return apiRef.current.setColumnVisibilityModel({});
80
80
  }
81
81
 
82
- return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
82
+ return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(col => col.hideable !== false).map(col => [col.field, false])));
83
83
  } // TODO v6: Remove
84
84
 
85
85
 
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
3
+ const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
4
+ _excluded2 = ["InputComponentProps"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import { unstable_composeClasses as composeClasses } from '@mui/material';
@@ -143,6 +144,12 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
143
144
  const baseSelectProps = rootProps.componentsProps?.baseSelect || {};
144
145
  const isBaseSelectNative = baseSelectProps.native ?? true;
145
146
  const OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
147
+
148
+ const {
149
+ InputComponentProps
150
+ } = valueInputProps,
151
+ valueInputPropsOther = _objectWithoutPropertiesLoose(valueInputProps, _excluded2);
152
+
146
153
  const sortedFilterableColumns = React.useMemo(() => {
147
154
  switch (columnsSort) {
148
155
  case 'asc':
@@ -309,14 +316,14 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
309
316
  })), /*#__PURE__*/_jsx(FilterFormValueInput, _extends({
310
317
  variant: "standard",
311
318
  as: rootProps.components.BaseFormControl
312
- }, baseFormControlProps, valueInputProps, {
313
- className: clsx(classes.valueInput, baseFormControlProps.className, valueInputProps.className),
319
+ }, baseFormControlProps, valueInputPropsOther, {
320
+ className: clsx(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
314
321
  children: currentOperator?.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
315
322
  apiRef: apiRef,
316
323
  item: item,
317
324
  applyValue: applyFilterChanges,
318
325
  focusElementRef: valueRef
319
- }, currentOperator.InputComponentProps)) : null
326
+ }, currentOperator.InputComponentProps, InputComponentProps)) : null
320
327
  }))]
321
328
  }));
322
329
  });
@@ -34,8 +34,8 @@ export function GridFilterInputBoolean(props) {
34
34
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
35
35
  value: filterValueState,
36
36
  onChange: onFilterChange,
37
- variant: "standard",
38
37
  select: true,
38
+ variant: "standard",
39
39
  SelectProps: _extends({
40
40
  native: isSelectNative,
41
41
  displayEmpty: true
@@ -52,8 +52,8 @@ function GridFilterInputDate(props) {
52
52
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
53
53
  value: filterValueState,
54
54
  onChange: onFilterChange,
55
- type: type || 'text',
56
55
  variant: "standard",
56
+ type: type || 'text',
57
57
  InputLabelProps: {
58
58
  shrink: true
59
59
  },
@@ -73,7 +73,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
73
73
  // | These PropTypes are generated from the TypeScript type definitions |
74
74
  // | To update them edit the TypeScript types and run "yarn proptypes" |
75
75
  // ----------------------------------------------------------------------
76
- apiRef: PropTypes.any.isRequired,
76
+ apiRef: PropTypes.shape({
77
+ current: PropTypes.object.isRequired
78
+ }).isRequired,
77
79
  applyValue: PropTypes.func.isRequired,
78
80
  focusElementRef: PropTypes
79
81
  /* @typescript-to-proptypes-ignore */