@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.
- package/CHANGELOG.md +105 -2
- package/DataGrid/DataGrid.js +20 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/DataGrid/useDataGridProps.js +3 -1
- package/colDef/gridBooleanColDef.js +19 -1
- package/colDef/gridDateColDef.js +6 -2
- package/colDef/gridSingleSelectColDef.js +21 -1
- package/components/GridPagination.js +3 -1
- package/components/base/GridBody.d.ts +1 -0
- package/components/base/GridBody.js +6 -3
- package/components/containers/GridRootStyles.js +1 -0
- package/components/panel/GridPanel.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +12 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -1
- package/hooks/features/clipboard/useGridClipboard.js +43 -26
- package/hooks/features/dimensions/useGridDimensions.js +2 -4
- package/hooks/features/editing/useGridCellEditing.js +7 -3
- package/hooks/features/editing/useGridRowEditing.js +7 -3
- package/hooks/features/export/serializers/csvSerializer.d.ts +5 -0
- package/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/hooks/features/export/useGridCsvExport.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.js +7 -5
- package/hooks/features/focus/useGridFocus.js +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
- package/index.js +1 -1
- package/internals/index.d.ts +3 -2
- package/internals/index.js +3 -2
- package/joy/icons.d.ts +33 -0
- package/joy/icons.js +433 -0
- package/joy/joySlots.js +254 -42
- package/legacy/DataGrid/DataGrid.js +20 -1
- package/legacy/DataGrid/useDataGridComponent.js +2 -2
- package/legacy/DataGrid/useDataGridProps.js +3 -1
- package/legacy/colDef/gridBooleanColDef.js +21 -1
- package/legacy/colDef/gridDateColDef.js +10 -2
- package/legacy/colDef/gridSingleSelectColDef.js +21 -1
- package/legacy/components/GridPagination.js +3 -1
- package/legacy/components/base/GridBody.js +6 -3
- package/legacy/components/containers/GridRootStyles.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/legacy/hooks/features/clipboard/useGridClipboard.js +44 -26
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -4
- package/legacy/hooks/features/editing/useGridCellEditing.js +7 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -3
- package/legacy/hooks/features/export/serializers/csvSerializer.js +43 -6
- package/legacy/hooks/features/export/useGridCsvExport.js +8 -5
- package/legacy/hooks/features/focus/useGridFocus.js +2 -2
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +3 -2
- package/legacy/joy/icons.js +432 -0
- package/legacy/joy/joySlots.js +273 -54
- package/legacy/locales/deDE.js +2 -2
- package/legacy/locales/frFR.js +6 -6
- package/legacy/locales/ptBR.js +1 -1
- package/legacy/locales/ukUA.js +8 -9
- package/legacy/material/index.js +3 -1
- package/legacy/models/api/index.js +0 -1
- package/legacy/utils/domUtils.js +14 -1
- package/locales/deDE.js +2 -2
- package/locales/frFR.js +6 -6
- package/locales/ptBR.js +1 -1
- package/locales/ukUA.js +8 -9
- package/material/index.d.ts +3 -1
- package/material/index.js +3 -1
- package/models/api/gridApiCommon.d.ts +1 -2
- package/models/api/gridCoreApi.d.ts +4 -0
- package/models/api/index.d.ts +0 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +6 -0
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +19 -0
- package/modern/DataGrid/DataGrid.js +20 -1
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/DataGrid/useDataGridProps.js +3 -1
- package/modern/colDef/gridBooleanColDef.js +19 -1
- package/modern/colDef/gridDateColDef.js +6 -2
- package/modern/colDef/gridSingleSelectColDef.js +21 -1
- package/modern/components/GridPagination.js +2 -1
- package/modern/components/base/GridBody.js +6 -3
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +43 -26
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +7 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -3
- package/modern/hooks/features/export/serializers/csvSerializer.js +44 -6
- package/modern/hooks/features/export/useGridCsvExport.js +7 -5
- package/modern/hooks/features/focus/useGridFocus.js +2 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -2
- package/modern/joy/icons.js +433 -0
- package/modern/joy/joySlots.js +248 -41
- package/modern/locales/deDE.js +2 -2
- package/modern/locales/frFR.js +6 -6
- package/modern/locales/ptBR.js +1 -1
- package/modern/locales/ukUA.js +8 -9
- package/modern/material/index.js +3 -1
- package/modern/models/api/index.js +0 -1
- package/modern/utils/domUtils.js +13 -1
- package/node/DataGrid/DataGrid.js +20 -1
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/DataGrid/useDataGridProps.js +3 -1
- package/node/colDef/gridBooleanColDef.js +19 -1
- package/node/colDef/gridDateColDef.js +6 -2
- package/node/colDef/gridSingleSelectColDef.js +21 -1
- package/node/components/GridPagination.js +2 -1
- package/node/components/base/GridBody.js +6 -3
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +42 -25
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/node/hooks/features/editing/useGridCellEditing.js +7 -3
- package/node/hooks/features/editing/useGridRowEditing.js +7 -3
- package/node/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/node/hooks/features/export/useGridCsvExport.js +6 -3
- package/node/hooks/features/focus/useGridFocus.js +2 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +11 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +23 -1
- package/node/joy/icons.js +471 -0
- package/node/joy/joySlots.js +248 -40
- package/node/locales/deDE.js +2 -2
- package/node/locales/frFR.js +6 -6
- package/node/locales/ptBR.js +1 -1
- package/node/locales/ukUA.js +8 -9
- package/node/material/index.js +3 -1
- package/node/models/api/index.js +0 -11
- package/node/utils/domUtils.js +15 -1
- package/package.json +2 -2
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +13 -1
- package/legacy/models/api/gridClipboardApi.js +0 -1
- package/models/api/gridClipboardApi.d.ts +0 -11
- package/models/api/gridClipboardApi.js +0 -1
- package/modern/models/api/gridClipboardApi.js +0 -1
- package/node/models/api/gridClipboardApi.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,109 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## v6.4.0
|
|
7
|
+
|
|
8
|
+
_May 12, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Introduce clipboard paste support for `DataGridPremium`:
|
|
13
|
+
|
|
14
|
+
https://github.com/mui/mui-x/assets/13808724/abfcb5c6-9db6-4677-9ba7-ae97de441080
|
|
15
|
+
|
|
16
|
+
See [the documentation](https://mui.com/x/react-data-grid/clipboard/#clipboard-paste) for more information
|
|
17
|
+
|
|
18
|
+
- 🌍 Improve French (fr-FR), German (de-DE), Portuguese (pt-BR) and Ukrainian (uk-UA) locales on the data grid
|
|
19
|
+
- 🌍 Add Slovak (sk-SK) locale on the pickers
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
- 📚 Documentation improvements
|
|
22
|
+
|
|
23
|
+
### `@mui/x-data-grid@v6.4.0` / `@mui/x-data-grid-pro@v6.4.0` / `@mui/x-data-grid-premium@v6.4.0`
|
|
24
|
+
|
|
25
|
+
#### Changes
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix DataGrid rendering in JSDOM (#8968) @cherniavskii
|
|
28
|
+
- [DataGrid] Fix layout when rendered inside a parent with `display: grid` (#8577) @cherniavskii
|
|
29
|
+
- [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
|
|
30
|
+
- [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
|
|
31
|
+
- [DataGrid] Extract `baseChip` slot (#8748) @cherniavskii
|
|
32
|
+
- [DataGridPremium] Implement Clipboard import (#7389) @cherniavskii
|
|
33
|
+
- [l10n] Improve French (fr-FR) locale (#8825) @vallereaugabriel
|
|
34
|
+
- [l10n] Improve German (de-DE) locale (#8898) @marcauberer
|
|
35
|
+
- [l10n] Improve Portuguese (pt-BR) locale (#8960) @Sorriso337
|
|
36
|
+
- [l10n] Improve Ukrainian (uk-UA) locale (#8863) @Neonin
|
|
37
|
+
|
|
38
|
+
### `@mui/x-date-pickers@v6.4.0` / `@mui/x-date-pickers-pro@v6.4.0`
|
|
39
|
+
|
|
40
|
+
#### Changes
|
|
41
|
+
|
|
42
|
+
- [pickers] Fix trailing zeros inconsistency in `LuxonAdapter` (#8955) @alexfauquette
|
|
43
|
+
- [pickers] Stop using deprecated adapter methods (#8735) @flaviendelangle
|
|
44
|
+
- [pickers] Strictly type the `adapterLocale` prop of `LocalizationProvider` (#8780) @flaviendelangle
|
|
45
|
+
- [l10n] Add Slovak (sk-SK) locale (#8875) @MatejFacko
|
|
46
|
+
|
|
47
|
+
### Docs
|
|
48
|
+
|
|
49
|
+
- [docs] Fix date pickers typo in the docs (#8939) @richbustos
|
|
50
|
+
- [docs] Fix master detail demo (#8894) @m4theushw
|
|
51
|
+
- [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
|
|
52
|
+
- [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
|
|
56
|
+
- [core] Improve testing of the adapters (#8789) @flaviendelangle
|
|
57
|
+
- [core] Update license key for tests (#8917) @LukasTy
|
|
58
|
+
- [charts] Make introduction docs pages for each chart (#8869) @alexfauquette
|
|
59
|
+
- [charts] Document Tooltip and Highlighs (#8867) @alexfauquette
|
|
60
|
+
- [test] Cover row grouping regression with a unit test (#8870) @cherniavskii
|
|
61
|
+
- [test] Fix flaky regression tests (#8954) @cherniavskii
|
|
62
|
+
|
|
63
|
+
## 6.3.1
|
|
64
|
+
|
|
65
|
+
_May 5, 2023_
|
|
66
|
+
|
|
67
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
68
|
+
|
|
69
|
+
- 🐞 Bugfixes
|
|
70
|
+
- 📚 Documentation improvements
|
|
71
|
+
|
|
72
|
+
### `@mui/x-data-grid@v6.3.1` / `@mui/x-data-grid-pro@v6.3.1` / `@mui/x-data-grid-premium@v6.3.1`
|
|
73
|
+
|
|
74
|
+
#### Changes
|
|
75
|
+
|
|
76
|
+
- [DataGrid] Fix broken filtering in the value formatter demo (#8621) @cherniavskii
|
|
77
|
+
- [DataGrid] Fix falsy filter values not showing in filter button tooltip (#8550) @ithrforu
|
|
78
|
+
- [DataGrid] Fix missing watermark in Pro and Premium packages (#8797) @cherniavskii
|
|
79
|
+
- [DataGrid] Remove unwarranted warning log (#8847) @romgrk
|
|
80
|
+
- [DataGrid] Add Joy UI slots (`Select`, `SelectOption`, `InputLabel`, `FormControl`) (#8747) @cherniavskii
|
|
81
|
+
- [DataGridPremium] Fix expanded groups being collapsed after calling `updateRows` (#8823) @cherniavskii
|
|
82
|
+
|
|
83
|
+
### `@mui/x-date-pickers@v6.3.1` / `@mui/x-date-pickers-pro@v6.3.1`
|
|
84
|
+
|
|
85
|
+
#### Changes
|
|
86
|
+
|
|
87
|
+
- [pickers] Fix `minutesStep` validation prop behavior (#8794) @LukasTy
|
|
88
|
+
- [pickers] Fix time picker `viewRenderers` overriding (#8830) @LukasTy
|
|
89
|
+
- [pickers] Remove last additional character when using LTR (#8848) @alexfauquette
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [docs] Fix controlled mode demo on Editing page (#8800) @yaredtsy
|
|
94
|
+
- [docs] Fix scrolling demo not working with React 18 (#6489) @cherniavskii
|
|
95
|
+
- [docs] Update demo to support agregation on popular feature cell (#8617) @BalaM314
|
|
96
|
+
- [docs] Clarify what `<path>` is (#8764) @alexfauquette
|
|
97
|
+
|
|
98
|
+
### Core
|
|
99
|
+
|
|
100
|
+
- [core] Do not include playground pages in `yarn typescript` script (#8822) @cherniavskii
|
|
101
|
+
- [core] Limit `typescript:ci` step memory limit (#8796) @LukasTy
|
|
102
|
+
- [core] Upgrade monorepo (#8835) @cherniavskii
|
|
103
|
+
- [test] Use `fake` clock on `MobileDateRangePicker` (#8861) @LukasTy
|
|
104
|
+
- [charts] Clean some styling (#8778) @alexfauquette
|
|
105
|
+
- [charts] Improve tooltip (#8792) @alexfauquette
|
|
106
|
+
- [charts] Improvement and docs on axis (#8654) @alexfauquette
|
|
107
|
+
- [charts] Defaultize attributes (#8788) @alexfauquette
|
|
108
|
+
|
|
6
109
|
## 6.3.0
|
|
7
110
|
|
|
8
111
|
_Apr 28, 2023_
|
|
@@ -264,9 +367,9 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
264
367
|
|
|
265
368
|
- [fields] Add missing tokens to `AdapterDateFnsJalali` (#8402) @flaviendelangle
|
|
266
369
|
- [fields] Clean the active date manager (#8370) @flaviendelangle
|
|
267
|
-
- [fields] Cleanup `useFieldState`
|
|
370
|
+
- [fields] Cleanup `useFieldState` (#8292) @flaviendelangle
|
|
268
371
|
- [fields] Only add RTL characters when needed (#8325) @flaviendelangle
|
|
269
|
-
- [pickers] Add support for single input fields in range pickers
|
|
372
|
+
- [pickers] Add support for single input fields in range pickers (#7927) @flaviendelangle
|
|
270
373
|
- [pickers] Allows non token characters in format (#8256) @alexfauquette
|
|
271
374
|
- [pickers] Avoid root imports and move public models to the models folder (#8337) @flaviendelangle
|
|
272
375
|
- [pickers] Update `view` when `views` or `openTo` changes (#8361) @LukasTy
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -68,6 +68,11 @@ DataGridRaw.propTypes = {
|
|
|
68
68
|
* Override or extend the styles applied to the component.
|
|
69
69
|
*/
|
|
70
70
|
classes: PropTypes.object,
|
|
71
|
+
/**
|
|
72
|
+
* The character used to separate cell values when copying to the clipboard.
|
|
73
|
+
* @default '\t'
|
|
74
|
+
*/
|
|
75
|
+
clipboardCopyCellDelimiter: PropTypes.string,
|
|
71
76
|
/**
|
|
72
77
|
* Number of extra columns to be rendered before/after the visible slice.
|
|
73
78
|
* @default 3
|
|
@@ -326,6 +331,11 @@ DataGridRaw.propTypes = {
|
|
|
326
331
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
327
332
|
*/
|
|
328
333
|
onCellModesModelChange: PropTypes.func,
|
|
334
|
+
/**
|
|
335
|
+
* Callback called when the data is copied to the clipboard.
|
|
336
|
+
* @param {string} data The data copied to the clipboard.
|
|
337
|
+
*/
|
|
338
|
+
onClipboardCopy: PropTypes.func,
|
|
329
339
|
/**
|
|
330
340
|
* Callback fired when a click event comes from a column header element.
|
|
331
341
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -611,5 +621,14 @@ DataGridRaw.propTypes = {
|
|
|
611
621
|
/**
|
|
612
622
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
613
623
|
*/
|
|
614
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
624
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
625
|
+
/**
|
|
626
|
+
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
627
|
+
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
628
|
+
* @default: false
|
|
629
|
+
*/
|
|
630
|
+
unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
631
|
+
clipboardExport: PropTypes.bool,
|
|
632
|
+
csvExport: PropTypes.bool
|
|
633
|
+
}), PropTypes.bool])
|
|
615
634
|
};
|
|
@@ -67,9 +67,9 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
67
67
|
useGridRowsMeta(privateApiRef, props);
|
|
68
68
|
useGridScroll(privateApiRef, props);
|
|
69
69
|
useGridColumnMenu(privateApiRef);
|
|
70
|
-
useGridCsvExport(privateApiRef);
|
|
70
|
+
useGridCsvExport(privateApiRef, props);
|
|
71
71
|
useGridPrintExport(privateApiRef, props);
|
|
72
|
-
useGridClipboard(privateApiRef);
|
|
72
|
+
useGridClipboard(privateApiRef, props);
|
|
73
73
|
useGridDimensions(privateApiRef, props);
|
|
74
74
|
useGridEvents(privateApiRef, props);
|
|
75
75
|
useGridStatePersistence(privateApiRef);
|
|
@@ -66,7 +66,9 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
66
66
|
disableColumnReorder: false,
|
|
67
67
|
disableColumnResize: false,
|
|
68
68
|
keepNonExistentRowsSelected: false,
|
|
69
|
-
keepColumnPositionIfDraggedOutside: false
|
|
69
|
+
keepColumnPositionIfDraggedOutside: false,
|
|
70
|
+
unstable_ignoreValueFormatterDuringExport: false,
|
|
71
|
+
clipboardCopyCellDelimiter: '\t'
|
|
70
72
|
};
|
|
71
73
|
const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
|
|
72
74
|
export const useDataGridProps = inProps => {
|
|
@@ -10,6 +10,22 @@ function gridBooleanFormatter({
|
|
|
10
10
|
}) {
|
|
11
11
|
return value ? api.getLocaleText('booleanCellTrueLabel') : api.getLocaleText('booleanCellFalseLabel');
|
|
12
12
|
}
|
|
13
|
+
const stringToBoolean = value => {
|
|
14
|
+
switch (value.toLowerCase().trim()) {
|
|
15
|
+
case 'true':
|
|
16
|
+
case 'yes':
|
|
17
|
+
case '1':
|
|
18
|
+
return true;
|
|
19
|
+
case 'false':
|
|
20
|
+
case 'no':
|
|
21
|
+
case '0':
|
|
22
|
+
case 'null':
|
|
23
|
+
case 'undefined':
|
|
24
|
+
return false;
|
|
25
|
+
default:
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
13
29
|
export const GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
14
30
|
type: 'boolean',
|
|
15
31
|
align: 'center',
|
|
@@ -21,5 +37,7 @@ export const GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
21
37
|
filterOperators: getGridBooleanOperators(),
|
|
22
38
|
getApplyQuickFilterFn: undefined,
|
|
23
39
|
// @ts-ignore
|
|
24
|
-
aggregable: false
|
|
40
|
+
aggregable: false,
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
pastedValueParser: value => stringToBoolean(value)
|
|
25
43
|
});
|
package/colDef/gridDateColDef.js
CHANGED
|
@@ -51,7 +51,9 @@ export const GRID_DATE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
51
51
|
valueFormatter: gridDateFormatter,
|
|
52
52
|
filterOperators: getGridDateOperators(),
|
|
53
53
|
renderEditCell: renderEditDateCell,
|
|
54
|
-
getApplyQuickFilterFn: undefined
|
|
54
|
+
getApplyQuickFilterFn: undefined,
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
pastedValueParser: value => new Date(value)
|
|
55
57
|
});
|
|
56
58
|
export const GRID_DATETIME_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
57
59
|
type: 'dateTime',
|
|
@@ -59,5 +61,7 @@ export const GRID_DATETIME_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
59
61
|
valueFormatter: gridDateTimeFormatter,
|
|
60
62
|
filterOperators: getGridDateOperators(true),
|
|
61
63
|
renderEditCell: renderEditDateCell,
|
|
62
|
-
getApplyQuickFilterFn: undefined
|
|
64
|
+
getApplyQuickFilterFn: undefined,
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
pastedValueParser: value => new Date(value)
|
|
63
67
|
});
|
|
@@ -51,5 +51,25 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
51
51
|
return valueOption ? colDef.getOptionLabel(valueOption) : '';
|
|
52
52
|
},
|
|
53
53
|
renderEditCell: renderEditSingleSelectCell,
|
|
54
|
-
filterOperators: getGridSingleSelectOperators()
|
|
54
|
+
filterOperators: getGridSingleSelectOperators(),
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
pastedValueParser: (value, params) => {
|
|
57
|
+
const colDef = params.colDef;
|
|
58
|
+
const colDefValueOptions = colDef.valueOptions;
|
|
59
|
+
const valueOptions = typeof colDefValueOptions === 'function' ? colDefValueOptions({
|
|
60
|
+
field: colDef.field
|
|
61
|
+
}) : colDefValueOptions || [];
|
|
62
|
+
const getOptionValue = colDef.getOptionValue;
|
|
63
|
+
const valueOption = valueOptions.find(option => {
|
|
64
|
+
if (getOptionValue(option) === value) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
69
|
+
if (valueOption) {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
// do not paste the value if it is not in the valueOptions
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
55
75
|
});
|
|
@@ -43,9 +43,11 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
43
43
|
apiRef.current.setPage(page);
|
|
44
44
|
}, [apiRef]);
|
|
45
45
|
if (process.env.NODE_ENV !== 'production') {
|
|
46
|
+
var _rootProps$pagination, _rootProps$pagination2;
|
|
46
47
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
48
|
const warnedOnceMissingInPageSizeOptions = React.useRef(false);
|
|
48
|
-
|
|
49
|
+
const pageSize = (_rootProps$pagination = (_rootProps$pagination2 = rootProps.paginationModel) == null ? void 0 : _rootProps$pagination2.pageSize) != null ? _rootProps$pagination : paginationModel.pageSize;
|
|
50
|
+
if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !rootProps.pageSizeOptions.includes(pageSize)) {
|
|
49
51
|
console.warn([`MUI: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\``, `Add it to show the pagination select.`].join('\n'));
|
|
50
52
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
51
53
|
}
|
|
@@ -18,7 +18,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
function GridBody(props) {
|
|
19
19
|
const {
|
|
20
20
|
VirtualScrollerComponent,
|
|
21
|
-
ColumnHeadersProps
|
|
21
|
+
ColumnHeadersProps,
|
|
22
|
+
children
|
|
22
23
|
} = props;
|
|
23
24
|
const apiRef = useGridPrivateApiContext();
|
|
24
25
|
const rootProps = useGridRootProps();
|
|
@@ -88,7 +89,8 @@ function GridBody(props) {
|
|
|
88
89
|
apiRef.current.register('private', {
|
|
89
90
|
columnHeadersContainerElementRef: columnsContainerRef,
|
|
90
91
|
columnHeadersElementRef: columnHeadersRef,
|
|
91
|
-
virtualScrollerRef
|
|
92
|
+
virtualScrollerRef,
|
|
93
|
+
mainElementRef: rootRef
|
|
92
94
|
});
|
|
93
95
|
const hasDimensions = !!apiRef.current.getRootDimensions();
|
|
94
96
|
return /*#__PURE__*/_jsxs(GridMainContainer, {
|
|
@@ -119,7 +121,7 @@ function GridBody(props) {
|
|
|
119
121
|
, {
|
|
120
122
|
ref: virtualScrollerRef,
|
|
121
123
|
disableVirtualization: isVirtualizationDisabled
|
|
122
|
-
})]
|
|
124
|
+
}), children]
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
@@ -127,6 +129,7 @@ process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
|
127
129
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
128
130
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
129
131
|
// ----------------------------------------------------------------------
|
|
132
|
+
children: PropTypes.node,
|
|
130
133
|
ColumnHeadersProps: PropTypes.object,
|
|
131
134
|
VirtualScrollerComponent: PropTypes.elementType.isRequired
|
|
132
135
|
} : void 0;
|
|
@@ -16,7 +16,8 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit<import("@mui/base").PopperProps<"div"
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit<import("@mui/base").PopperProps<"div">, "direction"> & {
|
|
20
|
+
component?: React.ElementType<any> | undefined;
|
|
20
21
|
components?: {
|
|
21
22
|
Root?: React.ElementType<any> | undefined;
|
|
22
23
|
} | undefined;
|
|
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
7
|
-
import Chip from '@mui/material/Chip';
|
|
8
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
8
|
import { isSingleSelectColDef } from './filterPanelUtils';
|
|
10
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
@@ -98,7 +97,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
98
97
|
value: filteredValues,
|
|
99
98
|
onChange: handleChange,
|
|
100
99
|
getOptionLabel: getOptionLabel,
|
|
101
|
-
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(
|
|
100
|
+
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
102
101
|
variant: "outlined",
|
|
103
102
|
size: "small",
|
|
104
103
|
label: getOptionLabel(option)
|
|
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
7
|
-
import Chip from '@mui/material/Chip';
|
|
8
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -56,7 +55,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
56
55
|
id: id,
|
|
57
56
|
value: filterValueState,
|
|
58
57
|
onChange: handleChange,
|
|
59
|
-
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(
|
|
58
|
+
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
60
59
|
variant: "outlined",
|
|
61
60
|
size: "small",
|
|
62
61
|
label: option
|
|
@@ -69,7 +69,9 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
69
69
|
children: activeFilters.map((item, index) => _extends({}, lookup[item.field] && /*#__PURE__*/_jsx("li", {
|
|
70
70
|
children: `${lookup[item.field].headerName || item.field}
|
|
71
71
|
${getOperatorLabel(item)}
|
|
72
|
-
${
|
|
72
|
+
${
|
|
73
|
+
// implicit check for null and undefined
|
|
74
|
+
item.value != null ? getFilterItemValue(item) : ''}`
|
|
73
75
|
}, index)))
|
|
74
76
|
})]
|
|
75
77
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridCellIndexCoordinates, GridScrollParams, GridColDef, GridCellCoordinates, GridCellParams } from '../../../models';
|
|
2
|
+
import { GridCellIndexCoordinates, GridScrollParams, GridColDef, GridCellCoordinates, GridCellParams, GridEditMode } from '../../../models';
|
|
3
3
|
import { GridInitialStateCommunity } from '../../../models/gridStateCommunity';
|
|
4
4
|
import { GridExportStateParams, GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
|
|
5
5
|
import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
|
|
@@ -64,6 +64,17 @@ export interface GridPipeProcessingLookup {
|
|
|
64
64
|
cell: GridCellParams | null;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
+
clipboardCopy: {
|
|
68
|
+
value: string;
|
|
69
|
+
};
|
|
70
|
+
canStartEditing: {
|
|
71
|
+
value: boolean;
|
|
72
|
+
context: {
|
|
73
|
+
event: React.KeyboardEvent;
|
|
74
|
+
cellParams: GridCellParams;
|
|
75
|
+
editMode: GridEditMode;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
67
78
|
}
|
|
68
79
|
export type GridPipeProcessor<P extends GridPipeProcessorGroup> = (value: GridPipeProcessingLookup[P]['value'], context: GridPipeProcessingLookup[P] extends {
|
|
69
80
|
context: any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
+
import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
4
|
/**
|
|
4
5
|
* @requires useGridCsvExport (method)
|
|
5
6
|
* @requires useGridSelection (method)
|
|
6
7
|
*/
|
|
7
|
-
export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => void;
|
|
8
|
+
export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_ignoreValueFormatterDuringExport' | 'onClipboardCopy' | 'clipboardCopyCellDelimiter'>) => void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useGridApiOptionHandler, useGridNativeEventListener } from '../../utils';
|
|
3
|
+
import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
|
|
4
|
+
import { serializeCellValue } from '../export/serializers/csvSerializer';
|
|
3
5
|
function writeToClipboardPolyfill(data) {
|
|
4
6
|
const span = document.createElement('span');
|
|
5
7
|
span.style.whiteSpace = 'pre';
|
|
@@ -18,6 +20,15 @@ function writeToClipboardPolyfill(data) {
|
|
|
18
20
|
document.body.removeChild(span);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
function copyToClipboard(data) {
|
|
24
|
+
if (navigator.clipboard) {
|
|
25
|
+
navigator.clipboard.writeText(data).catch(() => {
|
|
26
|
+
writeToClipboardPolyfill(data);
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
writeToClipboardPolyfill(data);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
function hasNativeSelection(element) {
|
|
22
33
|
var _window$getSelection;
|
|
23
34
|
// When getSelection is called on an <iframe> that is not displayed Firefox will return null.
|
|
@@ -38,24 +49,11 @@ function hasNativeSelection(element) {
|
|
|
38
49
|
* @requires useGridCsvExport (method)
|
|
39
50
|
* @requires useGridSelection (method)
|
|
40
51
|
*/
|
|
41
|
-
export const useGridClipboard = apiRef => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const data = apiRef.current.getDataAsCsv({
|
|
47
|
-
includeHeaders: false,
|
|
48
|
-
delimiter: '\t'
|
|
49
|
-
});
|
|
50
|
-
if (navigator.clipboard) {
|
|
51
|
-
navigator.clipboard.writeText(data).catch(() => {
|
|
52
|
-
writeToClipboardPolyfill(data);
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
writeToClipboardPolyfill(data);
|
|
56
|
-
}
|
|
57
|
-
}, [apiRef]);
|
|
58
|
-
const handleKeydown = React.useCallback(event => {
|
|
52
|
+
export const useGridClipboard = (apiRef, props) => {
|
|
53
|
+
const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
|
|
54
|
+
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
55
|
+
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
56
|
+
const handleCopy = React.useCallback(event => {
|
|
59
57
|
const isModifierKeyPressed = event.ctrlKey || event.metaKey;
|
|
60
58
|
// event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
|
|
61
59
|
// be wrong with a Dvorak keyboard (as if pressing J).
|
|
@@ -67,11 +65,30 @@ export const useGridClipboard = apiRef => {
|
|
|
67
65
|
if (hasNativeSelection(event.target)) {
|
|
68
66
|
return;
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
let textToCopy = '';
|
|
69
|
+
const selectedRows = apiRef.current.getSelectedRows();
|
|
70
|
+
if (selectedRows.size > 0) {
|
|
71
|
+
textToCopy = apiRef.current.getDataAsCsv({
|
|
72
|
+
includeHeaders: false,
|
|
73
|
+
// TODO: make it configurable
|
|
74
|
+
delimiter: clipboardCopyCellDelimiter
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
const focusedCell = gridFocusCellSelector(apiRef);
|
|
78
|
+
if (focusedCell) {
|
|
79
|
+
const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
|
|
80
|
+
textToCopy = serializeCellValue(cellParams, {
|
|
81
|
+
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
82
|
+
ignoreValueFormatter
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
textToCopy = apiRef.current.unstable_applyPipeProcessors('clipboardCopy', textToCopy);
|
|
87
|
+
if (textToCopy) {
|
|
88
|
+
copyToClipboard(textToCopy);
|
|
89
|
+
apiRef.current.publishEvent('clipboardCopy', textToCopy);
|
|
90
|
+
}
|
|
91
|
+
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
|
|
92
|
+
useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
|
|
93
|
+
useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
|
|
77
94
|
};
|
|
@@ -10,7 +10,6 @@ import { getVisibleRows } from '../../utils/useGridVisibleRows';
|
|
|
10
10
|
import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
|
|
11
11
|
import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
|
|
12
12
|
import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
|
|
13
|
-
import { gridClasses } from '../../../constants/gridClasses';
|
|
14
13
|
const isTestEnvironment = process.env.NODE_ENV === 'test';
|
|
15
14
|
const hasScroll = ({
|
|
16
15
|
content,
|
|
@@ -151,9 +150,8 @@ export function useGridDimensions(apiRef, props) {
|
|
|
151
150
|
return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
|
|
152
151
|
}, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
|
|
153
152
|
const computeSizeAndPublishResizeEvent = React.useCallback(() => {
|
|
154
|
-
var _apiRef$current$
|
|
155
|
-
const
|
|
156
|
-
const mainEl = rootEl == null ? void 0 : rootEl.querySelector(`.${gridClasses.main}`);
|
|
153
|
+
var _apiRef$current$mainE, _previousSize$current, _previousSize$current2;
|
|
154
|
+
const mainEl = (_apiRef$current$mainE = apiRef.current.mainElementRef) == null ? void 0 : _apiRef$current$mainE.current;
|
|
157
155
|
if (!mainEl) {
|
|
158
156
|
return;
|
|
159
157
|
}
|
|
@@ -90,10 +90,14 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
90
90
|
}
|
|
91
91
|
} else if (params.isEditable) {
|
|
92
92
|
let reason;
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
|
|
94
|
+
event,
|
|
95
|
+
cellParams: params,
|
|
96
|
+
editMode: 'cell'
|
|
97
|
+
});
|
|
98
|
+
if (!canStartEditing) {
|
|
99
|
+
return;
|
|
95
100
|
}
|
|
96
|
-
|
|
97
101
|
if (isPrintableKey(event)) {
|
|
98
102
|
reason = GridCellEditStartReasons.printableKeyDown;
|
|
99
103
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
@@ -144,10 +144,14 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
144
144
|
}
|
|
145
145
|
} else if (params.isEditable) {
|
|
146
146
|
let reason;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
|
|
148
|
+
event,
|
|
149
|
+
cellParams: params,
|
|
150
|
+
editMode: 'row'
|
|
151
|
+
});
|
|
152
|
+
if (!canStartEditing) {
|
|
153
|
+
return;
|
|
149
154
|
}
|
|
150
|
-
|
|
151
155
|
if (isPrintableKey(event)) {
|
|
152
156
|
reason = GridRowEditStartReasons.printableKeyDown;
|
|
153
157
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { GridRowId } from '../../../../models';
|
|
2
2
|
import { GridCellParams } from '../../../../models/params/gridCellParams';
|
|
3
3
|
import { GridStateColDef } from '../../../../models/colDef/gridColDef';
|
|
4
|
+
export declare const serializeCellValue: (cellParams: GridCellParams, options: {
|
|
5
|
+
delimiterCharacter: string;
|
|
6
|
+
ignoreValueFormatter: boolean;
|
|
7
|
+
}) => any;
|
|
4
8
|
interface BuildCSVOptions {
|
|
5
9
|
columns: GridStateColDef[];
|
|
6
10
|
rowIds: GridRowId[];
|
|
7
11
|
getCellParams: (id: GridRowId, field: string) => GridCellParams;
|
|
8
12
|
delimiterCharacter: string;
|
|
9
13
|
includeHeaders: boolean;
|
|
14
|
+
ignoreValueFormatter: boolean;
|
|
10
15
|
}
|
|
11
16
|
export declare function buildCSV(options: BuildCSVOptions): string;
|
|
12
17
|
export {};
|