@mui/x-data-grid 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +105 -2
  2. package/DataGrid/DataGrid.js +20 -1
  3. package/DataGrid/useDataGridComponent.js +2 -2
  4. package/DataGrid/useDataGridProps.js +3 -1
  5. package/colDef/gridBooleanColDef.js +19 -1
  6. package/colDef/gridDateColDef.js +6 -2
  7. package/colDef/gridSingleSelectColDef.js +21 -1
  8. package/components/GridPagination.js +3 -1
  9. package/components/base/GridBody.d.ts +1 -0
  10. package/components/base/GridBody.js +6 -3
  11. package/components/containers/GridRootStyles.js +1 -0
  12. package/components/panel/GridPanel.d.ts +2 -1
  13. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  14. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  15. package/components/toolbar/GridToolbarFilterButton.js +3 -1
  16. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +12 -1
  17. package/hooks/features/clipboard/useGridClipboard.d.ts +2 -1
  18. package/hooks/features/clipboard/useGridClipboard.js +43 -26
  19. package/hooks/features/dimensions/useGridDimensions.js +2 -4
  20. package/hooks/features/editing/useGridCellEditing.js +7 -3
  21. package/hooks/features/editing/useGridRowEditing.js +7 -3
  22. package/hooks/features/export/serializers/csvSerializer.d.ts +5 -0
  23. package/hooks/features/export/serializers/csvSerializer.js +46 -6
  24. package/hooks/features/export/useGridCsvExport.d.ts +2 -1
  25. package/hooks/features/export/useGridCsvExport.js +7 -5
  26. package/hooks/features/focus/useGridFocus.js +2 -2
  27. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
  28. package/index.js +1 -1
  29. package/internals/index.d.ts +3 -2
  30. package/internals/index.js +3 -2
  31. package/joy/icons.d.ts +33 -0
  32. package/joy/icons.js +433 -0
  33. package/joy/joySlots.js +254 -42
  34. package/legacy/DataGrid/DataGrid.js +20 -1
  35. package/legacy/DataGrid/useDataGridComponent.js +2 -2
  36. package/legacy/DataGrid/useDataGridProps.js +3 -1
  37. package/legacy/colDef/gridBooleanColDef.js +21 -1
  38. package/legacy/colDef/gridDateColDef.js +10 -2
  39. package/legacy/colDef/gridSingleSelectColDef.js +21 -1
  40. package/legacy/components/GridPagination.js +3 -1
  41. package/legacy/components/base/GridBody.js +6 -3
  42. package/legacy/components/containers/GridRootStyles.js +1 -0
  43. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  44. package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  45. package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
  46. package/legacy/hooks/features/clipboard/useGridClipboard.js +44 -26
  47. package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -4
  48. package/legacy/hooks/features/editing/useGridCellEditing.js +7 -3
  49. package/legacy/hooks/features/editing/useGridRowEditing.js +7 -3
  50. package/legacy/hooks/features/export/serializers/csvSerializer.js +43 -6
  51. package/legacy/hooks/features/export/useGridCsvExport.js +8 -5
  52. package/legacy/hooks/features/focus/useGridFocus.js +2 -2
  53. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -0
  54. package/legacy/index.js +1 -1
  55. package/legacy/internals/index.js +3 -2
  56. package/legacy/joy/icons.js +432 -0
  57. package/legacy/joy/joySlots.js +273 -54
  58. package/legacy/locales/deDE.js +2 -2
  59. package/legacy/locales/frFR.js +6 -6
  60. package/legacy/locales/ptBR.js +1 -1
  61. package/legacy/locales/ukUA.js +8 -9
  62. package/legacy/material/index.js +3 -1
  63. package/legacy/models/api/index.js +0 -1
  64. package/legacy/utils/domUtils.js +14 -1
  65. package/locales/deDE.js +2 -2
  66. package/locales/frFR.js +6 -6
  67. package/locales/ptBR.js +1 -1
  68. package/locales/ukUA.js +8 -9
  69. package/material/index.d.ts +3 -1
  70. package/material/index.js +3 -1
  71. package/models/api/gridApiCommon.d.ts +1 -2
  72. package/models/api/gridCoreApi.d.ts +4 -0
  73. package/models/api/index.d.ts +0 -1
  74. package/models/api/index.js +0 -1
  75. package/models/events/gridEventLookup.d.ts +6 -0
  76. package/models/gridSlotsComponent.d.ts +5 -0
  77. package/models/gridSlotsComponentsProps.d.ts +4 -0
  78. package/models/props/DataGridProps.d.ts +19 -0
  79. package/modern/DataGrid/DataGrid.js +20 -1
  80. package/modern/DataGrid/useDataGridComponent.js +2 -2
  81. package/modern/DataGrid/useDataGridProps.js +3 -1
  82. package/modern/colDef/gridBooleanColDef.js +19 -1
  83. package/modern/colDef/gridDateColDef.js +6 -2
  84. package/modern/colDef/gridSingleSelectColDef.js +21 -1
  85. package/modern/components/GridPagination.js +2 -1
  86. package/modern/components/base/GridBody.js +6 -3
  87. package/modern/components/containers/GridRootStyles.js +1 -0
  88. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  89. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  90. package/modern/components/toolbar/GridToolbarFilterButton.js +3 -1
  91. package/modern/hooks/features/clipboard/useGridClipboard.js +43 -26
  92. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
  93. package/modern/hooks/features/editing/useGridCellEditing.js +7 -3
  94. package/modern/hooks/features/editing/useGridRowEditing.js +7 -3
  95. package/modern/hooks/features/export/serializers/csvSerializer.js +44 -6
  96. package/modern/hooks/features/export/useGridCsvExport.js +7 -5
  97. package/modern/hooks/features/focus/useGridFocus.js +2 -2
  98. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
  99. package/modern/index.js +1 -1
  100. package/modern/internals/index.js +3 -2
  101. package/modern/joy/icons.js +433 -0
  102. package/modern/joy/joySlots.js +248 -41
  103. package/modern/locales/deDE.js +2 -2
  104. package/modern/locales/frFR.js +6 -6
  105. package/modern/locales/ptBR.js +1 -1
  106. package/modern/locales/ukUA.js +8 -9
  107. package/modern/material/index.js +3 -1
  108. package/modern/models/api/index.js +0 -1
  109. package/modern/utils/domUtils.js +13 -1
  110. package/node/DataGrid/DataGrid.js +20 -1
  111. package/node/DataGrid/useDataGridComponent.js +2 -2
  112. package/node/DataGrid/useDataGridProps.js +3 -1
  113. package/node/colDef/gridBooleanColDef.js +19 -1
  114. package/node/colDef/gridDateColDef.js +6 -2
  115. package/node/colDef/gridSingleSelectColDef.js +21 -1
  116. package/node/components/GridPagination.js +2 -1
  117. package/node/components/base/GridBody.js +6 -3
  118. package/node/components/containers/GridRootStyles.js +1 -0
  119. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  120. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  121. package/node/components/toolbar/GridToolbarFilterButton.js +3 -1
  122. package/node/hooks/features/clipboard/useGridClipboard.js +42 -25
  123. package/node/hooks/features/dimensions/useGridDimensions.js +1 -3
  124. package/node/hooks/features/editing/useGridCellEditing.js +7 -3
  125. package/node/hooks/features/editing/useGridRowEditing.js +7 -3
  126. package/node/hooks/features/export/serializers/csvSerializer.js +46 -6
  127. package/node/hooks/features/export/useGridCsvExport.js +6 -3
  128. package/node/hooks/features/focus/useGridFocus.js +2 -2
  129. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
  130. package/node/index.js +1 -1
  131. package/node/internals/index.js +23 -1
  132. package/node/joy/icons.js +471 -0
  133. package/node/joy/joySlots.js +248 -40
  134. package/node/locales/deDE.js +2 -2
  135. package/node/locales/frFR.js +6 -6
  136. package/node/locales/ptBR.js +1 -1
  137. package/node/locales/ukUA.js +8 -9
  138. package/node/material/index.js +3 -1
  139. package/node/models/api/index.js +0 -11
  140. package/node/utils/domUtils.js +15 -1
  141. package/package.json +2 -2
  142. package/utils/domUtils.d.ts +1 -0
  143. package/utils/domUtils.js +13 -1
  144. package/legacy/models/api/gridClipboardApi.js +0 -1
  145. package/models/api/gridClipboardApi.d.ts +0 -11
  146. package/models/api/gridClipboardApi.js +0 -1
  147. package/modern/models/api/gridClipboardApi.js +0 -1
  148. package/node/models/api/gridClipboardApi.js +0 -5
@@ -1,5 +1,8 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
1
2
  import * as React from 'react';
2
- import { useGridApiMethod, useGridNativeEventListener } from '../../utils';
3
+ import { useGridApiOptionHandler, useGridNativeEventListener } from '../../utils';
4
+ import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
5
+ import { serializeCellValue } from '../export/serializers/csvSerializer';
3
6
  function writeToClipboardPolyfill(data) {
4
7
  var span = document.createElement('span');
5
8
  span.style.whiteSpace = 'pre';
@@ -18,6 +21,15 @@ function writeToClipboardPolyfill(data) {
18
21
  document.body.removeChild(span);
19
22
  }
20
23
  }
24
+ function copyToClipboard(data) {
25
+ if (navigator.clipboard) {
26
+ navigator.clipboard.writeText(data).catch(function () {
27
+ writeToClipboardPolyfill(data);
28
+ });
29
+ } else {
30
+ writeToClipboardPolyfill(data);
31
+ }
32
+ }
21
33
  function hasNativeSelection(element) {
22
34
  var _window$getSelection;
23
35
  // When getSelection is called on an <iframe> that is not displayed Firefox will return null.
@@ -38,24 +50,11 @@ function hasNativeSelection(element) {
38
50
  * @requires useGridCsvExport (method)
39
51
  * @requires useGridSelection (method)
40
52
  */
41
- export var useGridClipboard = function useGridClipboard(apiRef) {
42
- var copySelectedRowsToClipboard = React.useCallback(function () {
43
- if (apiRef.current.getSelectedRows().size === 0) {
44
- return;
45
- }
46
- var data = apiRef.current.getDataAsCsv({
47
- includeHeaders: false,
48
- delimiter: '\t'
49
- });
50
- if (navigator.clipboard) {
51
- navigator.clipboard.writeText(data).catch(function () {
52
- writeToClipboardPolyfill(data);
53
- });
54
- } else {
55
- writeToClipboardPolyfill(data);
56
- }
57
- }, [apiRef]);
58
- var handleKeydown = React.useCallback(function (event) {
53
+ export var useGridClipboard = function useGridClipboard(apiRef, props) {
54
+ var ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
55
+ var ignoreValueFormatter = (_typeof(ignoreValueFormatterProp) === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
56
+ var clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
57
+ var handleCopy = React.useCallback(function (event) {
59
58
  var isModifierKeyPressed = event.ctrlKey || event.metaKey;
60
59
  // event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
61
60
  // be wrong with a Dvorak keyboard (as if pressing J).
@@ -67,11 +66,30 @@ export var useGridClipboard = function useGridClipboard(apiRef) {
67
66
  if (hasNativeSelection(event.target)) {
68
67
  return;
69
68
  }
70
- apiRef.current.unstable_copySelectedRowsToClipboard();
71
- }, [apiRef]);
72
- useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleKeydown);
73
- var clipboardApi = {
74
- unstable_copySelectedRowsToClipboard: copySelectedRowsToClipboard
75
- };
76
- useGridApiMethod(apiRef, clipboardApi, 'public');
69
+ var textToCopy = '';
70
+ var selectedRows = apiRef.current.getSelectedRows();
71
+ if (selectedRows.size > 0) {
72
+ textToCopy = apiRef.current.getDataAsCsv({
73
+ includeHeaders: false,
74
+ // TODO: make it configurable
75
+ delimiter: clipboardCopyCellDelimiter
76
+ });
77
+ } else {
78
+ var focusedCell = gridFocusCellSelector(apiRef);
79
+ if (focusedCell) {
80
+ var cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
81
+ textToCopy = serializeCellValue(cellParams, {
82
+ delimiterCharacter: clipboardCopyCellDelimiter,
83
+ ignoreValueFormatter: ignoreValueFormatter
84
+ });
85
+ }
86
+ }
87
+ textToCopy = apiRef.current.unstable_applyPipeProcessors('clipboardCopy', textToCopy);
88
+ if (textToCopy) {
89
+ copyToClipboard(textToCopy);
90
+ apiRef.current.publishEvent('clipboardCopy', textToCopy);
91
+ }
92
+ }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
93
+ useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
94
+ useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
77
95
  };
@@ -11,7 +11,6 @@ import { getVisibleRows } from '../../utils/useGridVisibleRows';
11
11
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
12
12
  import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
13
13
  import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
14
- import { gridClasses } from '../../../constants/gridClasses';
15
14
  var isTestEnvironment = process.env.NODE_ENV === 'test';
16
15
  var hasScroll = function hasScroll(_ref) {
17
16
  var content = _ref.content,
@@ -158,9 +157,8 @@ export function useGridDimensions(apiRef, props) {
158
157
  return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
159
158
  }, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
160
159
  var computeSizeAndPublishResizeEvent = React.useCallback(function () {
161
- var _apiRef$current$rootE2, _previousSize$current, _previousSize$current2;
162
- var rootEl = (_apiRef$current$rootE2 = apiRef.current.rootElementRef) == null ? void 0 : _apiRef$current$rootE2.current;
163
- var mainEl = rootEl == null ? void 0 : rootEl.querySelector(".".concat(gridClasses.main));
160
+ var _apiRef$current$mainE, _previousSize$current, _previousSize$current2;
161
+ var mainEl = (_apiRef$current$mainE = apiRef.current.mainElementRef) == null ? void 0 : _apiRef$current$mainE.current;
164
162
  if (!mainEl) {
165
163
  return;
166
164
  }
@@ -97,10 +97,14 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
97
97
  }
98
98
  } else if (params.isEditable) {
99
99
  var _reason;
100
- if (event.key === ' ') {
101
- return; // Space scrolls to the last row
100
+ var canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
101
+ event: event,
102
+ cellParams: params,
103
+ editMode: 'cell'
104
+ });
105
+ if (!canStartEditing) {
106
+ return;
102
107
  }
103
-
104
108
  if (isPrintableKey(event)) {
105
109
  _reason = GridCellEditStartReasons.printableKeyDown;
106
110
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
@@ -153,10 +153,14 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
153
153
  }
154
154
  } else if (params.isEditable) {
155
155
  var _reason;
156
- if (event.key === ' ') {
157
- return; // Space scrolls to the last row
156
+ var canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
157
+ event: event,
158
+ cellParams: params,
159
+ editMode: 'row'
160
+ });
161
+ if (!canStartEditing) {
162
+ return;
158
163
  }
159
-
160
164
  if (isPrintableKey(event)) {
161
165
  _reason = GridRowEditStartReasons.printableKeyDown;
162
166
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
@@ -1,6 +1,6 @@
1
1
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
2
2
  import { buildWarning } from '../../../../utils/warning';
3
- var serializeCellValue = function serializeCellValue(value, delimiterCharacter) {
3
+ function sanitizeCellValue(value, delimiterCharacter) {
4
4
  if (typeof value === 'string') {
5
5
  var formattedValue = value.replace(/"/g, '""');
6
6
 
@@ -13,9 +13,36 @@ var serializeCellValue = function serializeCellValue(value, delimiterCharacter)
13
13
  return formattedValue;
14
14
  }
15
15
  return value;
16
+ }
17
+ export var serializeCellValue = function serializeCellValue(cellParams, options) {
18
+ var delimiterCharacter = options.delimiterCharacter,
19
+ ignoreValueFormatter = options.ignoreValueFormatter;
20
+ var value;
21
+ if (ignoreValueFormatter) {
22
+ var _cellParams$value2;
23
+ var columnType = cellParams.colDef.type;
24
+ if (columnType === 'number') {
25
+ value = String(cellParams.value);
26
+ } else if (columnType === 'date' || columnType === 'dateTime') {
27
+ var _cellParams$value;
28
+ value = (_cellParams$value = cellParams.value) == null ? void 0 : _cellParams$value.toISOString();
29
+ } else if (typeof ((_cellParams$value2 = cellParams.value) == null ? void 0 : _cellParams$value2.toString) === 'function') {
30
+ value = cellParams.value.toString();
31
+ } else {
32
+ value = cellParams.value;
33
+ }
34
+ } else {
35
+ value = cellParams.formattedValue;
36
+ }
37
+ return sanitizeCellValue(value, delimiterCharacter);
16
38
  };
17
39
  var objectFormattedValueWarning = buildWarning(['MUI: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
18
- var serializeRow = function serializeRow(id, columns, getCellParams, delimiterCharacter) {
40
+ var serializeRow = function serializeRow(_ref) {
41
+ var id = _ref.id,
42
+ columns = _ref.columns,
43
+ getCellParams = _ref.getCellParams,
44
+ delimiterCharacter = _ref.delimiterCharacter,
45
+ ignoreValueFormatter = _ref.ignoreValueFormatter;
19
46
  return columns.map(function (column) {
20
47
  var cellParams = getCellParams(id, column.field);
21
48
  if (process.env.NODE_ENV !== 'production') {
@@ -23,7 +50,10 @@ var serializeRow = function serializeRow(id, columns, getCellParams, delimiterCh
23
50
  objectFormattedValueWarning();
24
51
  }
25
52
  }
26
- return serializeCellValue(cellParams.formattedValue, delimiterCharacter);
53
+ return serializeCellValue(cellParams, {
54
+ delimiterCharacter: delimiterCharacter,
55
+ ignoreValueFormatter: ignoreValueFormatter
56
+ });
27
57
  });
28
58
  };
29
59
  export function buildCSV(options) {
@@ -31,9 +61,16 @@ export function buildCSV(options) {
31
61
  rowIds = options.rowIds,
32
62
  getCellParams = options.getCellParams,
33
63
  delimiterCharacter = options.delimiterCharacter,
34
- includeHeaders = options.includeHeaders;
64
+ includeHeaders = options.includeHeaders,
65
+ ignoreValueFormatter = options.ignoreValueFormatter;
35
66
  var CSVBody = rowIds.reduce(function (acc, id) {
36
- return "".concat(acc).concat(serializeRow(id, columns, getCellParams, delimiterCharacter).join(delimiterCharacter), "\r\n");
67
+ return "".concat(acc).concat(serializeRow({
68
+ id: id,
69
+ columns: columns,
70
+ getCellParams: getCellParams,
71
+ delimiterCharacter: delimiterCharacter,
72
+ ignoreValueFormatter: ignoreValueFormatter
73
+ }).join(delimiterCharacter), "\r\n");
37
74
  }, '').trim();
38
75
  if (!includeHeaders) {
39
76
  return CSVBody;
@@ -41,7 +78,7 @@ export function buildCSV(options) {
41
78
  var CSVHead = "".concat(columns.filter(function (column) {
42
79
  return column.field !== GRID_CHECKBOX_SELECTION_COL_DEF.field;
43
80
  }).map(function (column) {
44
- return serializeCellValue(column.headerName || column.field, delimiterCharacter);
81
+ return sanitizeCellValue(column.headerName || column.field, delimiterCharacter);
45
82
  }).join(delimiterCharacter), "\r\n");
46
83
  return "".concat(CSVHead).concat(CSVBody).trim();
47
84
  }
@@ -1,4 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
3
  import * as React from 'react';
3
4
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
5
  import { useGridLogger } from '../../utils/useGridLogger';
@@ -7,7 +8,7 @@ import { buildCSV } from './serializers/csvSerializer';
7
8
  import { getColumnsToExport, defaultGetRowsToExport } from './utils';
8
9
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
9
10
  import { GridCsvExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
10
-
11
+ import { jsx as _jsx } from "react/jsx-runtime";
11
12
  /**
12
13
  * @requires useGridColumns (state)
13
14
  * @requires useGridFilter (state)
@@ -15,9 +16,10 @@ import { GridCsvExportMenuItem } from '../../../components/toolbar/GridToolbarEx
15
16
  * @requires useGridSelection (state)
16
17
  * @requires useGridParamsApi (method)
17
18
  */
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
- export var useGridCsvExport = function useGridCsvExport(apiRef) {
19
+ export var useGridCsvExport = function useGridCsvExport(apiRef, props) {
20
20
  var logger = useGridLogger(apiRef, 'useGridCsvExport');
21
+ var ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
22
+ var ignoreValueFormatter = (_typeof(ignoreValueFormatterProp) === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.csvExport : ignoreValueFormatterProp) || false;
21
23
  var getDataAsCsv = React.useCallback(function () {
22
24
  var _options$getRowsToExp, _options$includeHeade;
23
25
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -35,9 +37,10 @@ export var useGridCsvExport = function useGridCsvExport(apiRef) {
35
37
  rowIds: exportedRowIds,
36
38
  getCellParams: apiRef.current.getCellParams,
37
39
  delimiterCharacter: options.delimiter || ',',
38
- includeHeaders: (_options$includeHeade = options.includeHeaders) != null ? _options$includeHeade : true
40
+ includeHeaders: (_options$includeHeade = options.includeHeaders) != null ? _options$includeHeade : true,
41
+ ignoreValueFormatter: ignoreValueFormatter
39
42
  });
40
- }, [logger, apiRef]);
43
+ }, [logger, apiRef, ignoreValueFormatter]);
41
44
  var exportDataAsCsv = React.useCallback(function (options) {
42
45
  logger.debug("Export data as CSV");
43
46
  var csv = getDataAsCsv(options);
@@ -307,9 +307,9 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
307
307
  useGridApiMethod(apiRef, focusPrivateApi, 'private');
308
308
  React.useEffect(function () {
309
309
  var doc = ownerDocument(apiRef.current.rootElementRef.current);
310
- doc.addEventListener('click', handleDocumentClick);
310
+ doc.addEventListener('mouseup', handleDocumentClick);
311
311
  return function () {
312
- doc.removeEventListener('click', handleDocumentClick);
312
+ doc.removeEventListener('mouseup', handleDocumentClick);
313
313
  };
314
314
  }, [apiRef, handleDocumentClick]);
315
315
  useGridApiEventHandler(apiRef, 'columnHeaderBlur', handleBlur);
@@ -15,6 +15,7 @@ import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
15
15
  import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
16
16
  import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
17
17
  import { useGridSelector } from '../../utils/useGridSelector';
18
+ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
18
19
  function enrichPageRowsWithPinnedRows(apiRef, rows) {
19
20
  var pinnedRows = gridPinnedRowsSelector(apiRef) || {};
20
21
  return [].concat(_toConsumableArray(pinnedRows.top || []), _toConsumableArray(rows), _toConsumableArray(pinnedRows.bottom || []));
@@ -450,6 +451,15 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
450
451
  event.preventDefault();
451
452
  }
452
453
  }, [apiRef, currentPageRows, theme.direction, getRowIdFromIndex, goToCell, goToHeader]);
454
+ var checkIfCanStartEditing = React.useCallback(function (initialValue, _ref3) {
455
+ var event = _ref3.event;
456
+ if (event.key === ' ') {
457
+ // Space scrolls to the last row
458
+ return false;
459
+ }
460
+ return initialValue;
461
+ }, []);
462
+ useGridRegisterPipeProcessor(apiRef, 'canStartEditing', checkIfCanStartEditing);
453
463
  useGridApiEventHandler(apiRef, 'columnHeaderKeyDown', handleColumnHeaderKeyDown);
454
464
  useGridApiEventHandler(apiRef, 'columnGroupHeaderKeyDown', handleColumnGroupHeaderKeyDown);
455
465
  useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.3.0
2
+ * @mui/x-data-grid v6.4.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -41,14 +41,15 @@ export { useGridEvents } from '../hooks/features/events/useGridEvents';
41
41
  export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
42
42
  export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
43
43
  export { useGridVirtualScroller, getRenderableIndexes } from '../hooks/features/virtualization/useGridVirtualScroller';
44
- export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
44
+ export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
45
45
  export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
46
46
  export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
47
47
  export { createSelector, unstable_resetCreateSelectorCache } from '../utils/createSelector';
48
- export { findParentElementFromClassName } from '../utils/domUtils';
48
+ export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
49
49
  export { isNavigationKey } from '../utils/keyboardUtils';
50
50
  export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
51
51
  export { buildWarning } from '../utils/warning';
52
52
  export { exportAs } from '../utils/exportAs';
53
53
  export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
54
+ export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
54
55
  export * from './utils';