@mui/x-data-grid-premium 6.3.1 → 6.5.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 +113 -0
- package/DataGridPremium/DataGridPremium.js +46 -1
- package/DataGridPremium/useDataGridPremiumComponent.js +7 -3
- package/DataGridPremium/useDataGridPremiumProps.js +8 -13
- package/hooks/features/aggregation/gridAggregationUtils.js +1 -0
- package/hooks/features/cellSelection/useGridCellSelection.d.ts +1 -1
- package/hooks/features/cellSelection/useGridCellSelection.js +29 -1
- package/hooks/features/clipboard/useGridClipboardImport.d.ts +4 -0
- package/hooks/features/clipboard/useGridClipboardImport.js +315 -0
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +46 -1
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +7 -3
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +14 -8
- package/legacy/hooks/features/aggregation/gridAggregationUtils.js +1 -0
- package/legacy/hooks/features/cellSelection/useGridCellSelection.js +30 -1
- package/legacy/hooks/features/clipboard/useGridClipboardImport.js +395 -0
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/legacy/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridPremiumProps.d.ts +30 -6
- package/modern/DataGridPremium/DataGridPremium.js +46 -1
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +7 -3
- package/modern/DataGridPremium/useDataGridPremiumProps.js +8 -13
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +1 -0
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +29 -1
- package/modern/hooks/features/clipboard/useGridClipboardImport.js +313 -0
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +46 -1
- package/node/DataGridPremium/useDataGridPremiumComponent.js +6 -2
- package/node/DataGridPremium/useDataGridPremiumProps.js +7 -12
- package/node/hooks/features/aggregation/gridAggregationUtils.js +1 -0
- package/node/hooks/features/cellSelection/useGridCellSelection.js +28 -0
- package/node/hooks/features/clipboard/useGridClipboardImport.js +323 -0
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/node/index.js +1 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
- package/typeOverloads/modules.d.ts +26 -2
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,119 @@
|
|
|
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.5.0
|
|
7
|
+
|
|
8
|
+
_May 19, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Introduce filtering on column headers for `DataGridPro` and `DataGridPremium`:
|
|
13
|
+
|
|
14
|
+
https://github.com/mui/mui-x/assets/12609561/c4c2bfec-59cf-4cab-932d-dc1983081de9
|
|
15
|
+
|
|
16
|
+
See [the documentation](https://mui.com/x/react-data-grid/filtering/#header-filters) for more information
|
|
17
|
+
|
|
18
|
+
- 🌍 Improve Hebrew (he-IL) and Czech (cs-CZ) locales
|
|
19
|
+
- 📝 Support for editing on pinned rows
|
|
20
|
+
- 🚀 Performance improvements
|
|
21
|
+
- 🐞 Bugfixes
|
|
22
|
+
- 📚 Documentation improvements
|
|
23
|
+
|
|
24
|
+
### `@mui/x-data-grid@6.5.0` / `@mui/x-data-grid-pro@6.5.0` / `@mui/x-data-grid-premium@6.5.0`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [DataGrid] Fix grid size calculation when `.MuiDataGrid-main` has border (#8882) @cherniavskii
|
|
29
|
+
- [DataGridPro] Filtering on Column Header (#7760) @MBilalShafi
|
|
30
|
+
- [DataGridPro] Improve `treeData` and `rowGrouping` performance (#8990) @MBilalShafi
|
|
31
|
+
- [DataGridPro] Support pinned rows editing (#8921) @cherniavskii
|
|
32
|
+
- [l10n] Improve Hebrew (he-IL) locale (#8943) @Itzik-Tech
|
|
33
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
34
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8956) @davidzemancz
|
|
35
|
+
|
|
36
|
+
### `@mui/x-date-pickers@6.5.0` / `@mui/x-date-pickers-pro@6.5.0`
|
|
37
|
+
|
|
38
|
+
#### Changes
|
|
39
|
+
|
|
40
|
+
- [fields] Select the first section instead of last when clicking right of content (#9005) @noraleonte
|
|
41
|
+
- [fields] Refactor prop drilling in fields (#8660) @flaviendelangle
|
|
42
|
+
- [pickers] Allow to render the months before `currentMonth` instead of the one after (#8592) @flaviendelangle
|
|
43
|
+
- [pickers] Fix view management when `openTo` or `views` is modified (#8997) @alexfauquette
|
|
44
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
45
|
+
|
|
46
|
+
### Docs
|
|
47
|
+
|
|
48
|
+
- [docs] Clarify what Controlled / Uncontrolled means (#8926) @flaviendelangle
|
|
49
|
+
- [docs] Fix docs using wrong service worker (#9030) @cherniavskii
|
|
50
|
+
- [docs] Remove prop-types from JS demos (#9008) @flaviendelangle
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- [core] Add assertion about checkbox rerenders (#8974) @oliviertassinari
|
|
55
|
+
- [core] Allow selecting a section by type in field tests (#9009) @flaviendelangle
|
|
56
|
+
- [core] Fix `yarn.lock` (#8988) @flaviendelangle
|
|
57
|
+
- [core] Fix flacky adapter test (#8995) @flaviendelangle
|
|
58
|
+
- [charts] Clean the axis rendering (#8948) @alexfauquette
|
|
59
|
+
- [DataGrid] Memoize root props for better performance (#8942) @romgrk
|
|
60
|
+
- [test] Skip flaky unit tests in JSDOM (#8994) @cherniavskii
|
|
61
|
+
|
|
62
|
+
## v6.4.0
|
|
63
|
+
|
|
64
|
+
_May 12, 2023_
|
|
65
|
+
|
|
66
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
67
|
+
|
|
68
|
+
- 🎁 Introduce clipboard paste support for `DataGridPremium`:
|
|
69
|
+
|
|
70
|
+
https://github.com/mui/mui-x/assets/13808724/abfcb5c6-9db6-4677-9ba7-ae97de441080
|
|
71
|
+
|
|
72
|
+
See [the documentation](https://mui.com/x/react-data-grid/clipboard/#clipboard-paste) for more information
|
|
73
|
+
|
|
74
|
+
- 🌍 Improve French (fr-FR), German (de-DE), Portuguese (pt-BR) and Ukrainian (uk-UA) locales on the data grid
|
|
75
|
+
- 🌍 Add Slovak (sk-SK) locale on the pickers
|
|
76
|
+
- 🐞 Bugfixes
|
|
77
|
+
- 📚 Documentation improvements
|
|
78
|
+
|
|
79
|
+
### `@mui/x-data-grid@v6.4.0` / `@mui/x-data-grid-pro@v6.4.0` / `@mui/x-data-grid-premium@v6.4.0`
|
|
80
|
+
|
|
81
|
+
#### Changes
|
|
82
|
+
|
|
83
|
+
- [DataGrid] Fix DataGrid rendering in JSDOM (#8968) @cherniavskii
|
|
84
|
+
- [DataGrid] Fix layout when rendered inside a parent with `display: grid` (#8577) @cherniavskii
|
|
85
|
+
- [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
|
|
86
|
+
- [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
|
|
87
|
+
- [DataGrid] Extract `baseChip` slot (#8748) @cherniavskii
|
|
88
|
+
- [DataGridPremium] Implement Clipboard import (#7389) @cherniavskii
|
|
89
|
+
- [l10n] Improve French (fr-FR) locale (#8825) @vallereaugabriel
|
|
90
|
+
- [l10n] Improve German (de-DE) locale (#8898) @marcauberer
|
|
91
|
+
- [l10n] Improve Portuguese (pt-BR) locale (#8960) @Sorriso337
|
|
92
|
+
- [l10n] Improve Ukrainian (uk-UA) locale (#8863) @Neonin
|
|
93
|
+
|
|
94
|
+
### `@mui/x-date-pickers@v6.4.0` / `@mui/x-date-pickers-pro@v6.4.0`
|
|
95
|
+
|
|
96
|
+
#### Changes
|
|
97
|
+
|
|
98
|
+
- [pickers] Fix trailing zeros inconsistency in `LuxonAdapter` (#8955) @alexfauquette
|
|
99
|
+
- [pickers] Stop using deprecated adapter methods (#8735) @flaviendelangle
|
|
100
|
+
- [pickers] Strictly type the `adapterLocale` prop of `LocalizationProvider` (#8780) @flaviendelangle
|
|
101
|
+
- [l10n] Add Slovak (sk-SK) locale (#8875) @MatejFacko
|
|
102
|
+
|
|
103
|
+
### Docs
|
|
104
|
+
|
|
105
|
+
- [docs] Fix date pickers typo in the docs (#8939) @richbustos
|
|
106
|
+
- [docs] Fix master detail demo (#8894) @m4theushw
|
|
107
|
+
- [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
|
|
108
|
+
- [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
|
|
109
|
+
|
|
110
|
+
### Core
|
|
111
|
+
|
|
112
|
+
- [core] Improve testing of the adapters (#8789) @flaviendelangle
|
|
113
|
+
- [core] Update license key for tests (#8917) @LukasTy
|
|
114
|
+
- [charts] Make introduction docs pages for each chart (#8869) @alexfauquette
|
|
115
|
+
- [charts] Document Tooltip and Highlighs (#8867) @alexfauquette
|
|
116
|
+
- [test] Cover row grouping regression with a unit test (#8870) @cherniavskii
|
|
117
|
+
- [test] Fix flaky regression tests (#8954) @cherniavskii
|
|
118
|
+
|
|
6
119
|
## 6.3.1
|
|
7
120
|
|
|
8
121
|
_May 5, 2023_
|
|
@@ -106,6 +106,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
106
106
|
* Override or extend the styles applied to the component.
|
|
107
107
|
*/
|
|
108
108
|
classes: PropTypes.object,
|
|
109
|
+
/**
|
|
110
|
+
* The character used to separate cell values when copying to the clipboard.
|
|
111
|
+
* @default '\t'
|
|
112
|
+
*/
|
|
113
|
+
clipboardCopyCellDelimiter: PropTypes.string,
|
|
109
114
|
/**
|
|
110
115
|
* Number of extra columns to be rendered before/after the visible slice.
|
|
111
116
|
* @default 3
|
|
@@ -171,6 +176,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
171
176
|
* @default false
|
|
172
177
|
*/
|
|
173
178
|
disableChildrenSorting: PropTypes.bool,
|
|
179
|
+
/**
|
|
180
|
+
* If `true`, the clipboard paste is disabled.
|
|
181
|
+
* @default false
|
|
182
|
+
*/
|
|
183
|
+
disableClipboardPaste: PropTypes.bool,
|
|
174
184
|
/**
|
|
175
185
|
* If `true`, column filters are disabled.
|
|
176
186
|
* @default false
|
|
@@ -246,6 +256,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
246
256
|
* For each feature, if the flag is not explicitly set to `true`, then the feature is fully disabled, and neither property nor method calls will have any effect.
|
|
247
257
|
*/
|
|
248
258
|
experimentalFeatures: PropTypes.shape({
|
|
259
|
+
clipboardPaste: PropTypes.bool,
|
|
249
260
|
columnGrouping: PropTypes.bool,
|
|
250
261
|
lazyLoading: PropTypes.bool,
|
|
251
262
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
@@ -481,6 +492,19 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
481
492
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
482
493
|
*/
|
|
483
494
|
onCellModesModelChange: PropTypes.func,
|
|
495
|
+
/**
|
|
496
|
+
* Callback called when the data is copied to the clipboard.
|
|
497
|
+
* @param {string} data The data copied to the clipboard.
|
|
498
|
+
*/
|
|
499
|
+
onClipboardCopy: PropTypes.func,
|
|
500
|
+
/**
|
|
501
|
+
* Callback fired when the clipboard paste operation ends.
|
|
502
|
+
*/
|
|
503
|
+
onClipboardPasteEnd: PropTypes.func,
|
|
504
|
+
/**
|
|
505
|
+
* Callback fired when the clipboard paste operation starts.
|
|
506
|
+
*/
|
|
507
|
+
onClipboardPasteStart: PropTypes.func,
|
|
484
508
|
/**
|
|
485
509
|
* Callback fired when a click event comes from a column header element.
|
|
486
510
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -885,10 +909,31 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
885
909
|
* Set the cell selection model of the grid.
|
|
886
910
|
*/
|
|
887
911
|
unstable_cellSelectionModel: PropTypes.object,
|
|
912
|
+
/**
|
|
913
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
914
|
+
* @default false
|
|
915
|
+
*/
|
|
916
|
+
unstable_headerFilters: PropTypes.bool,
|
|
917
|
+
/**
|
|
918
|
+
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
919
|
+
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
920
|
+
* @default: false
|
|
921
|
+
*/
|
|
922
|
+
unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
923
|
+
clipboardExport: PropTypes.bool,
|
|
924
|
+
csvExport: PropTypes.bool
|
|
925
|
+
}), PropTypes.bool]),
|
|
888
926
|
/**
|
|
889
927
|
* Callback fired when the selection state of one or multiple cells changes.
|
|
890
928
|
* @param {GridCellSelectionModel} cellSelectionModel Object in the shape of [[GridCellSelectionModel]] containing the selected cells.
|
|
891
929
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
892
930
|
*/
|
|
893
|
-
unstable_onCellSelectionModelChange: PropTypes.func
|
|
931
|
+
unstable_onCellSelectionModelChange: PropTypes.func,
|
|
932
|
+
/**
|
|
933
|
+
* The function is used to split the pasted text into rows and cells.
|
|
934
|
+
* @param {string} text The text pasted from the clipboard.
|
|
935
|
+
* @returns {string[][] | null} A 2D array of strings. The first dimension is the rows, the second dimension is the columns.
|
|
936
|
+
* @default `(text) => text.split(/\r\n|\n|\r/).map((row) => row.split('\t'))`
|
|
937
|
+
*/
|
|
938
|
+
unstable_splitClipboardPastedText: PropTypes.func
|
|
894
939
|
} : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors } from '@mui/x-data-grid-pro/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, headerFilteringStateInitializer, useGridHeaderFiltering } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
@@ -6,6 +6,7 @@ import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/featur
|
|
|
6
6
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
7
7
|
import { useGridExcelExport } from '../hooks/features/export/useGridExcelExport';
|
|
8
8
|
import { cellSelectionStateInitializer, useGridCellSelection } from '../hooks/features/cellSelection/useGridCellSelection';
|
|
9
|
+
import { useGridClipboardImport } from '../hooks/features/clipboard/useGridClipboardImport';
|
|
9
10
|
export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
10
11
|
const privateApiRef = useGridInitialization(inputApiRef, props);
|
|
11
12
|
|
|
@@ -28,6 +29,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
28
29
|
/**
|
|
29
30
|
* Register all state initializers here.
|
|
30
31
|
*/
|
|
32
|
+
useGridInitializeState(headerFilteringStateInitializer, privateApiRef, props);
|
|
31
33
|
useGridInitializeState(rowGroupingStateInitializer, privateApiRef, props);
|
|
32
34
|
useGridInitializeState(aggregationStateInitializer, privateApiRef, props);
|
|
33
35
|
useGridInitializeState(rowSelectionStateInitializer, privateApiRef, props);
|
|
@@ -50,6 +52,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
50
52
|
useGridInitializeState(columnMenuStateInitializer, privateApiRef, props);
|
|
51
53
|
useGridInitializeState(columnGroupsStateInitializer, privateApiRef, props);
|
|
52
54
|
useGridRowGrouping(privateApiRef, props);
|
|
55
|
+
useGridHeaderFiltering(privateApiRef, props);
|
|
53
56
|
useGridTreeData(privateApiRef);
|
|
54
57
|
useGridAggregation(privateApiRef, props);
|
|
55
58
|
useGridKeyboardNavigation(privateApiRef, props);
|
|
@@ -63,6 +66,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
63
66
|
useGridDetailPanel(privateApiRef, props);
|
|
64
67
|
useGridColumnSpanning(privateApiRef);
|
|
65
68
|
useGridColumnGrouping(privateApiRef, props);
|
|
69
|
+
useGridClipboardImport(privateApiRef, props);
|
|
66
70
|
useGridEditing(privateApiRef, props);
|
|
67
71
|
useGridFocus(privateApiRef, props);
|
|
68
72
|
useGridPreferencesPanel(privateApiRef, props);
|
|
@@ -78,10 +82,10 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
78
82
|
useGridInfiniteLoader(privateApiRef, props);
|
|
79
83
|
useGridLazyLoader(privateApiRef, props);
|
|
80
84
|
useGridColumnMenu(privateApiRef);
|
|
81
|
-
useGridCsvExport(privateApiRef);
|
|
85
|
+
useGridCsvExport(privateApiRef, props);
|
|
82
86
|
useGridPrintExport(privateApiRef, props);
|
|
83
87
|
useGridExcelExport(privateApiRef, props);
|
|
84
|
-
useGridClipboard(privateApiRef);
|
|
88
|
+
useGridClipboard(privateApiRef, props);
|
|
85
89
|
useGridDimensions(privateApiRef, props);
|
|
86
90
|
useGridEvents(privateApiRef, props);
|
|
87
91
|
useGridStatePersistence(privateApiRef);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["components", "componentsProps"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
6
4
|
import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
|
|
7
|
-
import { computeSlots, uncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
|
|
5
|
+
import { computeSlots, useProps, uncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
|
|
8
6
|
import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
|
|
9
7
|
import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridPremiumDefaultSlotsComponents';
|
|
10
8
|
|
|
@@ -18,19 +16,16 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
|
|
|
18
16
|
rowGroupingColumnMode: 'single',
|
|
19
17
|
aggregationFunctions: GRID_AGGREGATION_FUNCTIONS,
|
|
20
18
|
aggregationRowsScope: 'filtered',
|
|
21
|
-
getAggregationPosition: groupNode => groupNode.depth === -1 ? 'footer' : 'inline'
|
|
19
|
+
getAggregationPosition: groupNode => groupNode.depth === -1 ? 'footer' : 'inline',
|
|
20
|
+
disableClipboardPaste: false,
|
|
21
|
+
unstable_splitClipboardPastedText: text => text.split(/\r\n|\n|\r/).map(row => row.split('\t'))
|
|
22
22
|
});
|
|
23
23
|
const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
|
|
24
24
|
export const useDataGridPremiumProps = inProps => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
components,
|
|
31
|
-
componentsProps
|
|
32
|
-
} = _useThemeProps,
|
|
33
|
-
themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
|
|
25
|
+
const [components, componentsProps, themedProps] = useProps(useThemeProps({
|
|
26
|
+
props: inProps,
|
|
27
|
+
name: 'MuiDataGrid'
|
|
28
|
+
}));
|
|
34
29
|
const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
35
30
|
const slots = React.useMemo(() => computeSlots({
|
|
36
31
|
defaultSlots,
|
|
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
|
3
3
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
4
4
|
import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
5
5
|
export declare const cellSelectionStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, 'unstable_cellSelectionModel' | 'initialState'>>;
|
|
6
|
-
export declare const useGridCellSelection: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'unstable_cellSelection' | 'unstable_cellSelectionModel' | 'unstable_onCellSelectionModelChange' | 'pagination' | 'paginationMode'>) => void;
|
|
6
|
+
export declare const useGridCellSelection: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'unstable_cellSelection' | 'unstable_cellSelectionModel' | 'unstable_onCellSelectionModelChange' | 'pagination' | 'paginationMode' | 'unstable_ignoreValueFormatterDuringExport' | 'clipboardCopyCellDelimiter'>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useEventCallback } from '@mui/material/utils';
|
|
4
|
-
import { isNavigationKey, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
import { isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
|
|
5
5
|
import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridRowsDataRowIdToIdLookupSelector, gridClasses, gridFocusCellSelector } from '@mui/x-data-grid-pro';
|
|
6
6
|
import { gridCellSelectionStateSelector } from './gridCellSelectionSelector';
|
|
7
7
|
export const cellSelectionStateInitializer = (state, props) => {
|
|
@@ -17,6 +17,9 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
17
17
|
const visibleRows = useGridVisibleRows(apiRef, props);
|
|
18
18
|
const cellWithVirtualFocus = React.useRef();
|
|
19
19
|
const lastMouseDownCell = React.useRef();
|
|
20
|
+
const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
|
|
21
|
+
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
22
|
+
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
20
23
|
apiRef.current.registerControlState({
|
|
21
24
|
stateId: 'cellSelection',
|
|
22
25
|
propModel: props.unstable_cellSelectionModel,
|
|
@@ -317,7 +320,32 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
317
320
|
}
|
|
318
321
|
return initialValue;
|
|
319
322
|
}, [apiRef, props.unstable_cellSelection, hasClickedValidCellForRangeSelection]);
|
|
323
|
+
const handleClipboardCopy = React.useCallback(value => {
|
|
324
|
+
if (apiRef.current.unstable_getSelectedCellsAsArray().length <= 1) {
|
|
325
|
+
return value;
|
|
326
|
+
}
|
|
327
|
+
const cellSelectionModel = apiRef.current.unstable_getCellSelectionModel();
|
|
328
|
+
const copyData = Object.keys(cellSelectionModel).reduce((acc, rowId) => {
|
|
329
|
+
const fieldsMap = cellSelectionModel[rowId];
|
|
330
|
+
const rowString = Object.keys(fieldsMap).reduce((acc2, field) => {
|
|
331
|
+
let cellData;
|
|
332
|
+
if (fieldsMap[field]) {
|
|
333
|
+
const cellParams = apiRef.current.getCellParams(rowId, field);
|
|
334
|
+
cellData = serializeCellValue(cellParams, {
|
|
335
|
+
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
336
|
+
ignoreValueFormatter
|
|
337
|
+
});
|
|
338
|
+
} else {
|
|
339
|
+
cellData = '';
|
|
340
|
+
}
|
|
341
|
+
return acc2 === '' ? cellData : [acc2, cellData].join(clipboardCopyCellDelimiter);
|
|
342
|
+
}, '');
|
|
343
|
+
return acc === '' ? rowString : [acc, rowString].join('\r\n');
|
|
344
|
+
}, '');
|
|
345
|
+
return copyData;
|
|
346
|
+
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
|
|
320
347
|
useGridRegisterPipeProcessor(apiRef, 'isCellSelected', checkIfCellIsSelected);
|
|
321
348
|
useGridRegisterPipeProcessor(apiRef, 'cellClassName', addClassesToCells);
|
|
322
349
|
useGridRegisterPipeProcessor(apiRef, 'canUpdateFocus', canUpdateFocus);
|
|
350
|
+
useGridRegisterPipeProcessor(apiRef, 'clipboardCopy', handleClipboardCopy);
|
|
323
351
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
3
|
+
import type { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
4
|
+
export declare const useGridClipboardImport: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'pagination' | 'paginationMode' | 'processRowUpdate' | 'onProcessRowUpdateError' | 'getRowId' | 'onClipboardPasteStart' | 'onClipboardPasteEnd' | 'experimentalFeatures' | 'unstable_splitClipboardPastedText' | 'disableClipboardPaste'>) => void;
|