@mui/x-data-grid 7.26.0 → 7.27.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 (82) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/DataGrid/DataGrid.js +8 -0
  3. package/DataGrid/useDataGridComponent.js +3 -1
  4. package/colDef/gridCheckboxSelectionColDef.js +2 -1
  5. package/colDef/gridDateColDef.js +3 -2
  6. package/colDef/gridSingleSelectColDef.js +2 -2
  7. package/constants/dataGridPropsDefaultValues.js +1 -0
  8. package/hooks/core/gridPropsSelectors.d.ts +9 -0
  9. package/hooks/core/gridPropsSelectors.js +14 -0
  10. package/hooks/core/index.d.ts +1 -0
  11. package/hooks/core/index.js +1 -1
  12. package/hooks/core/useGridInitialization.js +2 -0
  13. package/hooks/core/useGridProps.d.ts +8 -0
  14. package/hooks/core/useGridProps.js +18 -0
  15. package/hooks/features/clipboard/useGridClipboard.js +1 -1
  16. package/hooks/features/dimensions/useGridDimensions.js +8 -9
  17. package/hooks/features/pagination/useGridPaginationModel.d.ts +1 -1
  18. package/hooks/features/pagination/useGridPaginationModel.js +45 -1
  19. package/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  20. package/hooks/features/rows/useGridRows.js +2 -10
  21. package/hooks/features/sorting/gridSortingUtils.js +2 -1
  22. package/hooks/utils/useGridNativeEventListener.d.ts +0 -1
  23. package/hooks/utils/useGridNativeEventListener.js +12 -22
  24. package/index.js +1 -1
  25. package/internals/index.d.ts +1 -0
  26. package/internals/index.js +1 -0
  27. package/locales/bnBD.d.ts +2 -0
  28. package/locales/bnBD.js +154 -0
  29. package/locales/index.d.ts +1 -0
  30. package/locales/index.js +1 -0
  31. package/locales/plPL.js +31 -35
  32. package/locales/ukUA.js +9 -10
  33. package/models/api/gridRowApi.d.ts +0 -1
  34. package/models/gridStateCommunity.d.ts +8 -0
  35. package/models/props/DataGridProps.d.ts +8 -0
  36. package/modern/DataGrid/DataGrid.js +8 -0
  37. package/modern/DataGrid/useDataGridComponent.js +3 -1
  38. package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
  39. package/modern/colDef/gridDateColDef.js +3 -2
  40. package/modern/colDef/gridSingleSelectColDef.js +2 -2
  41. package/modern/constants/dataGridPropsDefaultValues.js +1 -0
  42. package/modern/hooks/core/gridPropsSelectors.js +14 -0
  43. package/modern/hooks/core/index.js +1 -1
  44. package/modern/hooks/core/useGridInitialization.js +2 -0
  45. package/modern/hooks/core/useGridProps.js +18 -0
  46. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
  47. package/modern/hooks/features/dimensions/useGridDimensions.js +8 -9
  48. package/modern/hooks/features/pagination/useGridPaginationModel.js +45 -1
  49. package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  50. package/modern/hooks/features/rows/useGridRows.js +2 -10
  51. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -1
  52. package/modern/hooks/utils/useGridNativeEventListener.js +12 -22
  53. package/modern/index.js +1 -1
  54. package/modern/internals/index.js +1 -0
  55. package/modern/locales/bnBD.js +154 -0
  56. package/modern/locales/index.js +1 -0
  57. package/modern/locales/plPL.js +31 -35
  58. package/modern/locales/ukUA.js +9 -10
  59. package/node/DataGrid/DataGrid.js +8 -0
  60. package/node/DataGrid/useDataGridComponent.js +3 -1
  61. package/node/colDef/gridCheckboxSelectionColDef.js +2 -1
  62. package/node/colDef/gridDateColDef.js +3 -2
  63. package/node/colDef/gridSingleSelectColDef.js +2 -2
  64. package/node/constants/dataGridPropsDefaultValues.js +1 -0
  65. package/node/hooks/core/gridPropsSelectors.js +20 -0
  66. package/node/hooks/core/index.js +8 -1
  67. package/node/hooks/core/useGridInitialization.js +2 -0
  68. package/node/hooks/core/useGridProps.js +28 -0
  69. package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
  70. package/node/hooks/features/dimensions/useGridDimensions.js +8 -9
  71. package/node/hooks/features/pagination/useGridPaginationModel.js +45 -1
  72. package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  73. package/node/hooks/features/rows/useGridRows.js +2 -10
  74. package/node/hooks/features/sorting/gridSortingUtils.js +2 -1
  75. package/node/hooks/utils/useGridNativeEventListener.js +12 -23
  76. package/node/index.js +1 -1
  77. package/node/internals/index.js +8 -0
  78. package/node/locales/bnBD.js +160 -0
  79. package/node/locales/index.js +11 -0
  80. package/node/locales/plPL.js +31 -35
  81. package/node/locales/ukUA.js +9 -10
  82. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ import { bnBD as bnBDCore } from '@mui/material/locale';
2
+ import { getGridLocalization } from "../utils/getGridLocalization.js";
3
+ const bnBDGrid = {
4
+ // Root
5
+ noRowsLabel: 'কোনো সারি নেই',
6
+ noResultsOverlayLabel: 'কোনো ফলাফল পাওয়া যায়নি।',
7
+ // Density selector toolbar button text
8
+ toolbarDensity: 'ঘনত্ব',
9
+ toolbarDensityLabel: 'ঘনত্ব',
10
+ toolbarDensityCompact: 'সংকুচিত',
11
+ toolbarDensityStandard: 'মানক',
12
+ toolbarDensityComfortable: 'স্বাচ্ছন্দ্যদায়ক',
13
+ // Columns selector toolbar button text
14
+ toolbarColumns: 'কলাম',
15
+ toolbarColumnsLabel: 'কলাম নির্বাচন করুন',
16
+ // Filters toolbar button text
17
+ toolbarFilters: 'ফিল্টার',
18
+ toolbarFiltersLabel: 'ফিল্টার দেখান',
19
+ toolbarFiltersTooltipHide: 'ফিল্টার লুকান',
20
+ toolbarFiltersTooltipShow: 'ফিল্টার দেখান',
21
+ toolbarFiltersTooltipActive: count => count !== 1 ? `${count} টি সক্রিয় ফিল্টার` : `${count} টি সক্রিয় ফিল্টার`,
22
+ // Quick filter toolbar field
23
+ toolbarQuickFilterPlaceholder: 'অনুসন্ধান করুন…',
24
+ toolbarQuickFilterLabel: 'অনুসন্ধান',
25
+ toolbarQuickFilterDeleteIconLabel: 'পরিষ্কার করুন',
26
+ // Export selector toolbar button text
27
+ toolbarExport: 'এক্সপোর্ট',
28
+ toolbarExportLabel: 'এক্সপোর্ট',
29
+ toolbarExportCSV: 'CSV হিসাবে ডাউনলোড করুন',
30
+ toolbarExportPrint: 'প্রিন্ট করুন',
31
+ toolbarExportExcel: 'Excel হিসাবে ডাউনলোড করুন',
32
+ // Columns management text
33
+ columnsManagementSearchTitle: 'অনুসন্ধান',
34
+ columnsManagementNoColumns: 'কোনো কলাম নেই',
35
+ columnsManagementShowHideAllText: 'সব দেখান/লুকান',
36
+ columnsManagementReset: 'রিসেট',
37
+ columnsManagementDeleteIconLabel: 'পরিষ্কার',
38
+ // Filter panel text
39
+ filterPanelAddFilter: 'ফিল্টার যোগ করুন',
40
+ filterPanelRemoveAll: 'সব সরান',
41
+ filterPanelDeleteIconLabel: 'মুছুন',
42
+ filterPanelLogicOperator: 'লজিক অপারেটর',
43
+ filterPanelOperator: 'অপারেটর',
44
+ filterPanelOperatorAnd: 'এবং',
45
+ filterPanelOperatorOr: 'অথবা',
46
+ filterPanelColumns: 'কলাম',
47
+ filterPanelInputLabel: 'মান',
48
+ filterPanelInputPlaceholder: 'ফিল্টার মান',
49
+ // Filter operators text
50
+ filterOperatorContains: 'অন্তর্ভুক্ত',
51
+ filterOperatorDoesNotContain: 'অন্তর্ভুক্ত নয়',
52
+ filterOperatorEquals: 'সমান',
53
+ filterOperatorDoesNotEqual: 'সমান নয়',
54
+ filterOperatorStartsWith: 'দিয়ে শুরু হয়',
55
+ filterOperatorEndsWith: 'দিয়ে শেষ হয়',
56
+ filterOperatorIs: 'হচ্ছে',
57
+ filterOperatorNot: 'হচ্ছে না',
58
+ filterOperatorAfter: 'পরবর্তী',
59
+ filterOperatorOnOrAfter: 'এই তারিখ বা পরবর্তী',
60
+ filterOperatorBefore: 'পূর্ববর্তী',
61
+ filterOperatorOnOrBefore: 'এই তারিখ বা পূর্ববর্তী',
62
+ filterOperatorIsEmpty: 'খালি',
63
+ filterOperatorIsNotEmpty: 'খালি নয়',
64
+ filterOperatorIsAnyOf: 'এর যেকোনো একটি',
65
+ 'filterOperator=': '=',
66
+ 'filterOperator!=': '!=',
67
+ 'filterOperator>': '>',
68
+ 'filterOperator>=': '>=',
69
+ 'filterOperator<': '<',
70
+ 'filterOperator<=': '<=',
71
+ // Header filter operators text
72
+ headerFilterOperatorContains: 'অন্তর্ভুক্ত',
73
+ headerFilterOperatorDoesNotContain: 'অন্তর্ভুক্ত নয়',
74
+ headerFilterOperatorEquals: 'সমান',
75
+ headerFilterOperatorDoesNotEqual: 'সমান নয়',
76
+ headerFilterOperatorStartsWith: 'দিয়ে শুরু হয়',
77
+ headerFilterOperatorEndsWith: 'দিয়ে শেষ হয়',
78
+ headerFilterOperatorIs: 'হচ্ছে',
79
+ headerFilterOperatorNot: 'হচ্ছে না',
80
+ headerFilterOperatorAfter: 'পরবর্তী',
81
+ headerFilterOperatorOnOrAfter: 'এই তারিখ বা পরবর্তী',
82
+ headerFilterOperatorBefore: 'পূর্ববর্তী',
83
+ headerFilterOperatorOnOrBefore: 'এই তারিখ বা পূর্ববর্তী',
84
+ headerFilterOperatorIsEmpty: 'খালি',
85
+ headerFilterOperatorIsNotEmpty: 'খালি নয়',
86
+ headerFilterOperatorIsAnyOf: 'এর যেকোনো একটি',
87
+ 'headerFilterOperator=': 'সমান',
88
+ 'headerFilterOperator!=': 'সমান নয়',
89
+ 'headerFilterOperator>': 'বড়',
90
+ 'headerFilterOperator>=': 'বড় বা সমান',
91
+ 'headerFilterOperator<': 'ছোট',
92
+ 'headerFilterOperator<=': 'ছোট বা সমান',
93
+ // Filter values text
94
+ filterValueAny: 'যেকোনো',
95
+ filterValueTrue: 'সত্য',
96
+ filterValueFalse: 'মিথ্যা',
97
+ // Column menu text
98
+ columnMenuLabel: 'মেনু',
99
+ columnMenuShowColumns: 'কলাম দেখান',
100
+ columnMenuManageColumns: 'কলাম পরিচালনা করুন',
101
+ columnMenuFilter: 'ফিল্টার',
102
+ columnMenuHideColumn: 'কলাম লুকান',
103
+ columnMenuUnsort: 'সাজানো বাতিল করুন',
104
+ columnMenuSortAsc: 'ASC অনুযায়ী সাজান',
105
+ columnMenuSortDesc: 'DESC অনুযায়ী সাজান',
106
+ // Column header text
107
+ columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} টি সক্রিয় ফিল্টার` : `${count} টি সক্রিয় ফিল্টার`,
108
+ columnHeaderFiltersLabel: 'ফিল্টার দেখান',
109
+ columnHeaderSortIconLabel: 'সাজান',
110
+ // Rows selected footer text
111
+ footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} টি সারি নির্বাচিত` : `${count.toLocaleString()} টি সারি নির্বাচিত`,
112
+ // Total row amount footer text
113
+ footerTotalRows: 'মোট সারি:',
114
+ // Total visible row amount footer text
115
+ footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} of ${totalCount.toLocaleString()}`,
116
+ // Checkbox selection text
117
+ checkboxSelectionHeaderName: 'চেকবক্স নির্বাচন',
118
+ checkboxSelectionSelectAllRows: 'সব সারি নির্বাচন করুন',
119
+ checkboxSelectionUnselectAllRows: 'সব সারি নির্বাচন বাতিল করুন',
120
+ checkboxSelectionSelectRow: 'সারি নির্বাচন করুন',
121
+ checkboxSelectionUnselectRow: 'সারি নির্বাচন বাতিল করুন',
122
+ // Boolean cell text
123
+ booleanCellTrueLabel: 'হ্যাঁ',
124
+ booleanCellFalseLabel: 'না',
125
+ // Actions cell more text
126
+ actionsCellMore: 'আরও',
127
+ // Column pinning text
128
+ pinToLeft: 'বাঁ দিকে পিন করুন',
129
+ pinToRight: 'ডান দিকে পিন করুন',
130
+ unpin: 'আনপিন করুন',
131
+ // Tree Data
132
+ treeDataGroupingHeaderName: 'গ্রুপ',
133
+ // treeDataExpand: 'see children',
134
+ // treeDataCollapse: 'hide children',
135
+
136
+ // Grouping columns
137
+ groupingColumnHeaderName: 'গ্রুপ',
138
+ groupColumn: name => `${name} অনুসারে গ্রুপ করুন`,
139
+ unGroupColumn: name => `${name} অনুসারে গ্রুপ বন্ধ করুন`,
140
+ // Master/detail
141
+ detailPanelToggle: 'বিস্তারিত প্যানেল টগল করুন',
142
+ expandDetailPanel: 'সম্প্রসারিত করুন',
143
+ collapseDetailPanel: 'সংকুচিত করুন',
144
+ // Row reordering text
145
+ rowReorderingHeaderName: 'সারি পুনর্বিন্যাস',
146
+ // Aggregation
147
+ aggregationMenuItemHeader: 'সংকলন',
148
+ aggregationFunctionLabelSum: 'যোগফল',
149
+ aggregationFunctionLabelAvg: 'গড়',
150
+ aggregationFunctionLabelMin: 'সর্বনিম্ন',
151
+ aggregationFunctionLabelMax: 'সর্বোচ্চ',
152
+ aggregationFunctionLabelSize: 'মাপ'
153
+ };
154
+ export const bnBD = getGridLocalization(bnBDGrid, bnBDCore);
@@ -1,6 +1,7 @@
1
1
  export * from './arSD';
2
2
  export * from './beBY';
3
3
  export * from './bgBG';
4
+ export * from './bnBD';
4
5
  export * from './csCZ';
5
6
  export * from './daDK';
6
7
  export * from './deDE';
package/locales/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  export * from "./arSD.js";
3
3
  export * from "./beBY.js";
4
4
  export * from "./bgBG.js";
5
+ export * from "./bnBD.js";
5
6
  export * from "./csCZ.js";
6
7
  export * from "./daDK.js";
7
8
  export * from "./deDE.js";
package/locales/plPL.js CHANGED
@@ -30,12 +30,11 @@ const plPLGrid = {
30
30
  toolbarExportPrint: 'Drukuj',
31
31
  toolbarExportExcel: 'Pobierz jako plik Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
33
+ columnsManagementSearchTitle: 'Szukaj',
34
+ columnsManagementNoColumns: 'Brak kolumn',
35
+ columnsManagementShowHideAllText: 'Wyświetl/Ukryj wszystkie',
36
+ columnsManagementReset: 'Resetuj',
37
+ columnsManagementDeleteIconLabel: 'Wyczyść',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Dodaj filtr',
41
40
  filterPanelRemoveAll: 'Usuń wszystkie',
@@ -63,13 +62,12 @@ const plPLGrid = {
63
62
  filterOperatorIsEmpty: 'jest pusty',
64
63
  filterOperatorIsNotEmpty: 'nie jest pusty',
65
64
  filterOperatorIsAnyOf: 'jest jednym z',
66
- // 'filterOperator=': '=',
67
- // 'filterOperator!=': '!=',
68
- // 'filterOperator>': '>',
69
- // 'filterOperator>=': '>=',
70
- // 'filterOperator<': '<',
71
- // 'filterOperator<=': '<=',
72
-
65
+ 'filterOperator=': 'równa się',
66
+ 'filterOperator!=': 'nie równa się',
67
+ 'filterOperator>': 'większy niż',
68
+ 'filterOperator>=': 'większy lub równy',
69
+ 'filterOperator<': 'mniejszy niż',
70
+ 'filterOperator<=': 'mniejszy lub równy',
73
71
  // Header filter operators text
74
72
  headerFilterOperatorContains: 'Zawiera',
75
73
  // headerFilterOperatorDoesNotContain: 'Does not contain',
@@ -79,20 +77,19 @@ const plPLGrid = {
79
77
  headerFilterOperatorEndsWith: 'Kończy się na',
80
78
  // headerFilterOperatorIs: 'Is',
81
79
  headerFilterOperatorNot: 'Niepuste',
82
- // headerFilterOperatorAfter: 'Is after',
83
- // headerFilterOperatorOnOrAfter: 'Is on or after',
84
- // headerFilterOperatorBefore: 'Is before',
85
- // headerFilterOperatorOnOrBefore: 'Is on or before',
86
- // headerFilterOperatorIsEmpty: 'Is empty',
87
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
88
- // headerFilterOperatorIsAnyOf: 'Is any of',
89
- // 'headerFilterOperator=': 'Equals',
90
- // 'headerFilterOperator!=': 'Not equals',
91
- // 'headerFilterOperator>': 'Greater than',
92
- // 'headerFilterOperator>=': 'Greater than or equal to',
93
- // 'headerFilterOperator<': 'Less than',
94
- // 'headerFilterOperator<=': 'Less than or equal to',
95
-
80
+ headerFilterOperatorAfter: 'Jest po',
81
+ headerFilterOperatorOnOrAfter: 'Jest w lub po',
82
+ headerFilterOperatorBefore: 'Jest przed',
83
+ headerFilterOperatorOnOrBefore: 'Jest w lub przed',
84
+ headerFilterOperatorIsEmpty: 'Jest pusty',
85
+ headerFilterOperatorIsNotEmpty: 'Nie jest pusty',
86
+ headerFilterOperatorIsAnyOf: 'Is any of',
87
+ 'headerFilterOperator=': 'Równa się',
88
+ 'headerFilterOperator!=': 'Nie równa się',
89
+ 'headerFilterOperator>': 'Większy niż',
90
+ 'headerFilterOperator>=': 'Większy lub równy',
91
+ 'headerFilterOperator<': 'Mniejszy niż',
92
+ 'headerFilterOperator<=': 'Mniejszy lub równy',
96
93
  // Filter values text
97
94
  filterValueAny: 'dowolny',
98
95
  filterValueTrue: 'prawda',
@@ -144,14 +141,13 @@ const plPLGrid = {
144
141
  expandDetailPanel: 'Rozwiń',
145
142
  collapseDetailPanel: 'Zwiń',
146
143
  // Row reordering text
147
- rowReorderingHeaderName: 'Porządkowanie wierszy'
148
-
144
+ rowReorderingHeaderName: 'Porządkowanie wierszy',
149
145
  // Aggregation
150
- // aggregationMenuItemHeader: 'Aggregation',
151
- // aggregationFunctionLabelSum: 'sum',
152
- // aggregationFunctionLabelAvg: 'avg',
153
- // aggregationFunctionLabelMin: 'min',
154
- // aggregationFunctionLabelMax: 'max',
155
- // aggregationFunctionLabelSize: 'size',
146
+ aggregationMenuItemHeader: 'Agregacja',
147
+ aggregationFunctionLabelSum: 'suma',
148
+ aggregationFunctionLabelAvg: 'średnia',
149
+ aggregationFunctionLabelMin: 'minimum',
150
+ aggregationFunctionLabelMax: 'maximum',
151
+ aggregationFunctionLabelSize: 'rozmiar'
156
152
  };
157
153
  export const plPL = getGridLocalization(plPLGrid, plPLCore);
package/locales/ukUA.js CHANGED
@@ -45,12 +45,11 @@ const ukUAGrid = {
45
45
  toolbarExportPrint: 'Друк',
46
46
  toolbarExportExcel: 'Завантажити у форматі Excel',
47
47
  // Columns management text
48
- // columnsManagementSearchTitle: 'Search',
49
- // columnsManagementNoColumns: 'No columns',
50
- // columnsManagementShowHideAllText: 'Show/Hide All',
51
- // columnsManagementReset: 'Reset',
52
- // columnsManagementDeleteIconLabel: 'Clear',
53
-
48
+ columnsManagementSearchTitle: 'Пошук',
49
+ columnsManagementNoColumns: 'Немає стовпців',
50
+ columnsManagementShowHideAllText: 'Показати/Приховати всі',
51
+ columnsManagementReset: 'Скинути',
52
+ columnsManagementDeleteIconLabel: 'Очистити',
54
53
  // Filter panel text
55
54
  filterPanelAddFilter: 'Додати фільтр',
56
55
  filterPanelRemoveAll: 'Видалити всі',
@@ -64,9 +63,9 @@ const ukUAGrid = {
64
63
  filterPanelInputPlaceholder: 'Значення фільтра',
65
64
  // Filter operators text
66
65
  filterOperatorContains: 'містить',
67
- // filterOperatorDoesNotContain: 'does not contain',
66
+ filterOperatorDoesNotContain: 'не містить',
68
67
  filterOperatorEquals: 'дорівнює',
69
- // filterOperatorDoesNotEqual: 'does not equal',
68
+ filterOperatorDoesNotEqual: 'не дорівнює',
70
69
  filterOperatorStartsWith: 'починається з',
71
70
  filterOperatorEndsWith: 'закінчується на',
72
71
  filterOperatorIs: 'дорівнює',
@@ -86,9 +85,9 @@ const ukUAGrid = {
86
85
  'filterOperator<=': '<=',
87
86
  // Header filter operators text
88
87
  headerFilterOperatorContains: 'Містить',
89
- // headerFilterOperatorDoesNotContain: 'Does not contain',
88
+ headerFilterOperatorDoesNotContain: 'Не містить',
90
89
  headerFilterOperatorEquals: 'Дорівнює',
91
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
90
+ headerFilterOperatorDoesNotEqual: 'Не дорівнює',
92
91
  headerFilterOperatorStartsWith: 'Починається з',
93
92
  headerFilterOperatorEndsWith: 'Закінчується на',
94
93
  headerFilterOperatorIs: 'Дорівнює',
@@ -69,7 +69,6 @@ export interface GridRowApi {
69
69
  getRowId: <R extends GridValidRowModel = any>(row: R) => GridRowId;
70
70
  /**
71
71
  * Gets the row node from the internal tree structure.
72
- * TODO rows v6: Rename `getTreeNode`
73
72
  * @param {GridRowId} id The id of the row.
74
73
  * @returns {GridTreeNode} The tree node.
75
74
  */
@@ -1,4 +1,5 @@
1
1
  import type { GridColumnMenuState, GridColumnsInitialState, GridColumnsState, GridColumnsGroupingState, GridColumnPinningState, GridDensityState, GridDimensionsState, GridFilterInitialState, GridFilterState, GridFocusState, GridPaginationInitialState, GridPaginationState, GridPreferencePanelInitialState, GridPreferencePanelState, GridRowsState, GridSortingInitialState, GridSortingState, GridTabIndexState, GridVirtualizationState } from '../hooks';
2
+ import type { DataGridProps } from './props/DataGridProps';
2
3
  import type { GridRowsMetaState } from '../hooks/features/rows/gridRowsMetaState';
3
4
  import type { GridEditingState } from './gridEditRowModel';
4
5
  import { GridHeaderFilteringState } from './gridHeaderFilteringModel';
@@ -7,11 +8,17 @@ import type { GridVisibleRowsLookupState } from '../hooks/features/filter/gridFi
7
8
  import type { GridColumnResizeState } from '../hooks/features/columnResize';
8
9
  import type { GridRowSpanningState } from '../hooks/features/rows/useGridRowSpanning';
9
10
  import type { GridListViewState } from '../hooks/features/listView/useGridListView';
11
+ /**
12
+ * Some props are passed on the state to enable grid selectors to select
13
+ * and react to them.
14
+ */
15
+ type GridStateProps = Pick<DataGridProps, 'getRowId'>;
10
16
  /**
11
17
  * The state of Data Grid.
12
18
  */
13
19
  export interface GridStateCommunity {
14
20
  isRtl: boolean;
21
+ props: GridStateProps;
15
22
  dimensions: GridDimensionsState;
16
23
  rows: GridRowsState;
17
24
  visibleRowsLookup: GridVisibleRowsLookupState;
@@ -50,3 +57,4 @@ export interface GridInitialStateCommunity {
50
57
  left: number;
51
58
  };
52
59
  }
60
+ export {};
@@ -267,6 +267,12 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
267
267
  * @default "client"
268
268
  */
269
269
  paginationMode: GridFeatureMode;
270
+ /**
271
+ * If `true`, the page is set to 0 after each sorting or filtering.
272
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
273
+ * @default false
274
+ */
275
+ resetPageOnSortFilter: boolean;
270
276
  /**
271
277
  * Set of rows of type [[GridRowsProp]].
272
278
  * @default []
@@ -737,6 +743,8 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
737
743
  columns: readonly GridColDef<R>[];
738
744
  /**
739
745
  * Return the id of a given [[GridRowModel]].
746
+ * Ensure the reference of this prop is stable to avoid performance implications.
747
+ * It could be done by either defining the prop outside of the component or by memoizing it.
740
748
  */
741
749
  getRowId?: GridRowIdGetter<R>;
742
750
  /**
@@ -282,6 +282,8 @@ DataGridRaw.propTypes = {
282
282
  getRowHeight: PropTypes.func,
283
283
  /**
284
284
  * Return the id of a given [[GridRowModel]].
285
+ * Ensure the reference of this prop is stable to avoid performance implications.
286
+ * It could be done by either defining the prop outside of the component or by memoizing it.
285
287
  */
286
288
  getRowId: PropTypes.func,
287
289
  /**
@@ -661,6 +663,12 @@ DataGridRaw.propTypes = {
661
663
  * @returns {Promise<R> | R} The final values to update the row.
662
664
  */
663
665
  processRowUpdate: PropTypes.func,
666
+ /**
667
+ * If `true`, the page is set to 0 after each sorting or filtering.
668
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
669
+ * @default false
670
+ */
671
+ resetPageOnSortFilter: PropTypes.bool,
664
672
  /**
665
673
  * The milliseconds throttle delay for resizing the grid.
666
674
  * @default 60
@@ -29,6 +29,7 @@ import { useGridVirtualization, virtualizationStateInitializer } from "../hooks/
29
29
  import { columnResizeStateInitializer, useGridColumnResize } from "../hooks/features/columnResize/useGridColumnResize.js";
30
30
  import { rowSpanningStateInitializer, useGridRowSpanning } from "../hooks/features/rows/useGridRowSpanning.js";
31
31
  import { listViewStateInitializer, useGridListView } from "../hooks/features/listView/useGridListView.js";
32
+ import { propsStateInitializer } from "../hooks/core/useGridProps.js";
32
33
  export const useDataGridComponent = (inputApiRef, props) => {
33
34
  const apiRef = useGridInitialization(inputApiRef, props);
34
35
 
@@ -41,10 +42,11 @@ export const useDataGridComponent = (inputApiRef, props) => {
41
42
  /**
42
43
  * Register all state initializers here.
43
44
  */
45
+ useGridInitializeState(propsStateInitializer, apiRef, props);
44
46
  useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
45
47
  useGridInitializeState(columnsStateInitializer, apiRef, props);
46
- useGridInitializeState(paginationStateInitializer, apiRef, props);
47
48
  useGridInitializeState(rowsStateInitializer, apiRef, props);
49
+ useGridInitializeState(paginationStateInitializer, apiRef, props);
48
50
  useGridInitializeState(editingStateInitializer, apiRef, props);
49
51
  useGridInitializeState(focusStateInitializer, apiRef, props);
50
52
  useGridInitializeState(sortingStateInitializer, apiRef, props);
@@ -4,6 +4,7 @@ import { GridCellCheckboxRenderer } from "../components/columnSelection/GridCell
4
4
  import { GridHeaderCheckbox } from "../components/columnSelection/GridHeaderCheckbox.js";
5
5
  import { selectedIdsLookupSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
6
6
  import { GRID_BOOLEAN_COL_DEF } from "./gridBooleanColDef.js";
7
+ import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
9
10
  export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
@@ -22,7 +23,7 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
22
23
  display: 'flex',
23
24
  valueGetter: (value, row, column, apiRef) => {
24
25
  const selectionLookup = selectedIdsLookupSelector(apiRef);
25
- const rowId = apiRef.current.getRowId(row);
26
+ const rowId = gridRowIdSelector(apiRef.current.state, row);
26
27
  return selectionLookup[rowId] !== undefined;
27
28
  },
28
29
  renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
@@ -3,6 +3,7 @@ import { gridDateComparator } from "../hooks/features/sorting/gridSortingUtils.j
3
3
  import { getGridDateOperators } from "./gridDateOperators.js";
4
4
  import { GRID_STRING_COL_DEF } from "./gridStringColDef.js";
5
5
  import { renderEditDateCell } from "../components/cell/GridEditDateCell.js";
6
+ import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
6
7
  function throwIfNotDateObject({
7
8
  value,
8
9
  columnType,
@@ -17,7 +18,7 @@ export const gridDateFormatter = (value, row, column, apiRef) => {
17
18
  if (!value) {
18
19
  return '';
19
20
  }
20
- const rowId = apiRef.current.getRowId(row);
21
+ const rowId = gridRowIdSelector(apiRef.current.state, row);
21
22
  throwIfNotDateObject({
22
23
  value,
23
24
  columnType: 'date',
@@ -30,7 +31,7 @@ export const gridDateTimeFormatter = (value, row, column, apiRef) => {
30
31
  if (!value) {
31
32
  return '';
32
33
  }
33
- const rowId = apiRef.current.getRowId(row);
34
+ const rowId = gridRowIdSelector(apiRef.current.state, row);
34
35
  throwIfNotDateObject({
35
36
  value,
36
37
  columnType: 'dateTime',
@@ -4,6 +4,7 @@ import { renderEditSingleSelectCell } from "../components/cell/GridEditSingleSel
4
4
  import { getGridSingleSelectOperators } from "./gridSingleSelectOperators.js";
5
5
  import { getValueOptions, isSingleSelectColDef } from "../components/panel/filterPanel/filterPanelUtils.js";
6
6
  import { isObject } from "../utils/utils.js";
7
+ import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
7
8
  const isArrayOfObjects = options => {
8
9
  return typeof options[0] === 'object';
9
10
  };
@@ -18,8 +19,7 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
18
19
  getOptionLabel: defaultGetOptionLabel,
19
20
  getOptionValue: defaultGetOptionValue,
20
21
  valueFormatter(value, row, colDef, apiRef) {
21
- // const { id, field, value, api } = params;
22
- const rowId = apiRef.current.getRowId(row);
22
+ const rowId = gridRowIdSelector(apiRef.current.state, row);
23
23
  if (!isSingleSelectColDef(colDef)) {
24
24
  return '';
25
25
  }
@@ -44,6 +44,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
44
44
  pageSizeOptions: [25, 50, 100],
45
45
  pagination: false,
46
46
  paginationMode: 'client',
47
+ resetPageOnSortFilter: false,
47
48
  resizeThrottleMs: 60,
48
49
  rowBufferPx: 150,
49
50
  rowHeight: 52,
@@ -0,0 +1,14 @@
1
+ import { GRID_ID_AUTOGENERATED } from "../features/rows/gridRowsUtils.js";
2
+
3
+ /**
4
+ * Get the row id for a given row
5
+ * @param state - The grid state
6
+ * @param {GridRowModel} row - The row to get the id for
7
+ * @returns {GridRowId} The row id
8
+ */
9
+ export const gridRowIdSelector = (state, row) => {
10
+ if (GRID_ID_AUTOGENERATED in row) {
11
+ return row[GRID_ID_AUTOGENERATED];
12
+ }
13
+ return state.props.getRowId ? state.props.getRowId(row) : row.id;
14
+ };
@@ -1 +1 @@
1
- export {};
1
+ export { gridRowIdSelector } from "./gridPropsSelectors.js";
@@ -6,6 +6,7 @@ import { useGridLocaleText } from "./useGridLocaleText.js";
6
6
  import { useGridPipeProcessing } from "./pipeProcessing/index.js";
7
7
  import { useGridStrategyProcessing } from "./strategyProcessing/index.js";
8
8
  import { useGridStateInitialization } from "./useGridStateInitialization.js";
9
+ import { useGridProps } from "./useGridProps.js";
9
10
 
10
11
  /**
11
12
  * Initialize the technical pieces of the DataGrid (logger, state, ...) that any DataGrid implementation needs
@@ -13,6 +14,7 @@ import { useGridStateInitialization } from "./useGridStateInitialization.js";
13
14
  export const useGridInitialization = (inputApiRef, props) => {
14
15
  const privateApiRef = useGridApiInitialization(inputApiRef, props);
15
16
  useGridRefs(privateApiRef);
17
+ useGridProps(privateApiRef, props);
16
18
  useGridIsRtl(privateApiRef);
17
19
  useGridLoggerFactory(privateApiRef, props);
18
20
  useGridStateInitialization(privateApiRef);
@@ -0,0 +1,18 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ export const propsStateInitializer = (state, props) => {
4
+ return _extends({}, state, {
5
+ props: {
6
+ getRowId: props.getRowId
7
+ }
8
+ });
9
+ };
10
+ export const useGridProps = (apiRef, props) => {
11
+ React.useEffect(() => {
12
+ apiRef.current.setState(state => _extends({}, state, {
13
+ props: {
14
+ getRowId: props.getRowId
15
+ }
16
+ }));
17
+ }, [apiRef, props.getRowId]);
18
+ };
@@ -91,6 +91,6 @@ export const useGridClipboard = (apiRef, props) => {
91
91
  apiRef.current.publishEvent('clipboardCopy', textToCopy);
92
92
  }
93
93
  }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
94
- useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
94
+ useGridNativeEventListener(apiRef, () => apiRef.current.rootElementRef.current, 'keydown', handleCopy);
95
95
  useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
96
96
  };
@@ -125,8 +125,7 @@ export function useGridDimensions(apiRef, props) {
125
125
  // All the floating point dimensions should be rounded to .1 decimal places to avoid subpixel rendering issues
126
126
  // https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
127
127
  // https://github.com/mui/mui-x/issues/15721
128
- const rootElement = apiRef.current.rootElementRef.current;
129
- const scrollbarSize = measureScrollbarSize(rootElement, props.scrollbarSize);
128
+ const scrollbarSize = measureScrollbarSize(apiRef.current.mainElementRef.current, props.scrollbarSize);
130
129
  const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
131
130
  const topContainerHeight = headersTotalHeight + rowsMeta.pinnedTopRowsTotalHeight;
132
131
  const bottomContainerHeight = rowsMeta.pinnedBottomRowsTotalHeight;
@@ -287,28 +286,28 @@ function getStaticDimensions(props, apiRef, density, pinnedColumnns) {
287
286
  };
288
287
  }
289
288
  const scrollbarSizeCache = new WeakMap();
290
- function measureScrollbarSize(rootElement, scrollbarSize) {
289
+ function measureScrollbarSize(element, scrollbarSize) {
291
290
  if (scrollbarSize !== undefined) {
292
291
  return scrollbarSize;
293
292
  }
294
- if (rootElement === null) {
293
+ if (element === null) {
295
294
  return 0;
296
295
  }
297
- const cachedSize = scrollbarSizeCache.get(rootElement);
296
+ const cachedSize = scrollbarSizeCache.get(element);
298
297
  if (cachedSize !== undefined) {
299
298
  return cachedSize;
300
299
  }
301
- const doc = ownerDocument(rootElement);
300
+ const doc = ownerDocument(element);
302
301
  const scrollDiv = doc.createElement('div');
303
302
  scrollDiv.style.width = '99px';
304
303
  scrollDiv.style.height = '99px';
305
304
  scrollDiv.style.position = 'absolute';
306
305
  scrollDiv.style.overflow = 'scroll';
307
306
  scrollDiv.className = 'scrollDiv';
308
- rootElement.appendChild(scrollDiv);
307
+ element.appendChild(scrollDiv);
309
308
  const size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
310
- rootElement.removeChild(scrollDiv);
311
- scrollbarSizeCache.set(rootElement, size);
309
+ element.removeChild(scrollDiv);
310
+ scrollbarSizeCache.set(element, size);
312
311
  return size;
313
312
  }
314
313
  function areElementSizesEqual(a, b) {