@mui/x-data-grid 8.3.0 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +206 -10
  2. package/DataGrid/DataGrid.js +1 -0
  3. package/components/GridApiContext.js +1 -3
  4. package/components/GridColumnUnsortedIcon.js +2 -1
  5. package/components/GridConfigurationContext.js +1 -3
  6. package/components/GridRow.js +1 -0
  7. package/components/cell/GridActionsCell.js +2 -1
  8. package/components/cell/GridBooleanCell.js +3 -1
  9. package/components/cell/GridEditBooleanCell.js +2 -1
  10. package/components/cell/GridEditDateCell.js +2 -1
  11. package/components/cell/GridEditInputCell.js +2 -1
  12. package/components/cell/GridEditSingleSelectCell.js +2 -1
  13. package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -1
  14. package/components/columnHeaders/GridColumnHeaderItem.js +1 -1
  15. package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -0
  16. package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -0
  17. package/components/columnSelection/GridCellCheckboxRenderer.js +4 -2
  18. package/components/containers/GridRootStyles.js +1 -1
  19. package/components/panel/GridPanelContext.js +1 -0
  20. package/components/quickFilter/QuickFilterContext.js +1 -0
  21. package/components/toolbarV8/Toolbar.js +58 -32
  22. package/components/toolbarV8/ToolbarContext.js +1 -0
  23. package/components/toolbarV8/utils.d.ts +5 -0
  24. package/components/toolbarV8/utils.js +23 -0
  25. package/context/GridRootPropsContext.js +1 -3
  26. package/esm/DataGrid/DataGrid.js +1 -0
  27. package/esm/components/GridApiContext.js +1 -3
  28. package/esm/components/GridColumnUnsortedIcon.js +2 -1
  29. package/esm/components/GridConfigurationContext.js +1 -3
  30. package/esm/components/GridRow.js +1 -0
  31. package/esm/components/cell/GridActionsCell.js +2 -1
  32. package/esm/components/cell/GridBooleanCell.js +3 -1
  33. package/esm/components/cell/GridEditBooleanCell.js +2 -1
  34. package/esm/components/cell/GridEditDateCell.js +2 -1
  35. package/esm/components/cell/GridEditInputCell.js +2 -1
  36. package/esm/components/cell/GridEditSingleSelectCell.js +2 -1
  37. package/esm/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -1
  38. package/esm/components/columnHeaders/GridColumnHeaderItem.js +1 -1
  39. package/esm/components/columnHeaders/GridColumnHeaderSeparator.js +1 -0
  40. package/esm/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -0
  41. package/esm/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
  42. package/esm/components/containers/GridRootStyles.js +1 -1
  43. package/esm/components/panel/GridPanelContext.js +1 -0
  44. package/esm/components/quickFilter/QuickFilterContext.js +1 -0
  45. package/esm/components/toolbarV8/Toolbar.js +58 -32
  46. package/esm/components/toolbarV8/ToolbarContext.js +1 -0
  47. package/esm/components/toolbarV8/utils.d.ts +5 -0
  48. package/esm/components/toolbarV8/utils.js +17 -0
  49. package/esm/context/GridRootPropsContext.js +1 -3
  50. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
  51. package/esm/hooks/features/columns/gridColumnsUtils.js +15 -7
  52. package/esm/hooks/features/overlays/useGridOverlays.js +1 -0
  53. package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
  54. package/esm/hooks/features/rowSelection/useGridRowSelection.js +7 -7
  55. package/esm/hooks/features/rowSelection/utils.d.ts +4 -1
  56. package/esm/hooks/features/rowSelection/utils.js +33 -32
  57. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +7 -6
  58. package/esm/hooks/utils/useGridPrivateApiContext.js +1 -3
  59. package/esm/index.d.ts +1 -0
  60. package/esm/index.js +2 -1
  61. package/esm/locales/isIS.js +8 -8
  62. package/esm/locales/koKR.js +68 -76
  63. package/esm/locales/nbNO.js +22 -24
  64. package/esm/material/variables.js +5 -0
  65. package/esm/models/api/gridRowSelectionApi.d.ts +4 -2
  66. package/esm/models/events/gridEventLookup.d.ts +10 -0
  67. package/esm/utils/css/context.js +2 -1
  68. package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
  69. package/hooks/features/columns/gridColumnsUtils.js +15 -7
  70. package/hooks/features/overlays/useGridOverlays.js +1 -0
  71. package/hooks/features/pagination/useGridPaginationModel.js +1 -1
  72. package/hooks/features/rowSelection/useGridRowSelection.js +7 -7
  73. package/hooks/features/rowSelection/utils.d.ts +4 -1
  74. package/hooks/features/rowSelection/utils.js +34 -34
  75. package/hooks/features/virtualization/useGridVirtualScroller.js +7 -6
  76. package/hooks/utils/useGridPrivateApiContext.js +1 -3
  77. package/index.d.ts +1 -0
  78. package/index.js +2 -1
  79. package/locales/isIS.js +8 -8
  80. package/locales/koKR.js +68 -76
  81. package/locales/nbNO.js +22 -24
  82. package/material/variables.js +5 -0
  83. package/models/api/gridRowSelectionApi.d.ts +4 -2
  84. package/models/events/gridEventLookup.d.ts +10 -0
  85. package/package.json +2 -2
  86. package/utils/css/context.js +2 -1
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export const GridPrivateApiContext = /*#__PURE__*/React.createContext(undefined);
3
- if (process.env.NODE_ENV !== 'production') {
4
- GridPrivateApiContext.displayName = 'GridPrivateApiContext';
5
- }
3
+ if (process.env.NODE_ENV !== "production") GridPrivateApiContext.displayName = "GridPrivateApiContext";
6
4
  export function useGridPrivateApiContext() {
7
5
  const privateApiRef = React.useContext(GridPrivateApiContext);
8
6
  if (privateApiRef === undefined) {
package/esm/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { GridApiCommunity } from "./models/api/gridApiCommunity.js";
2
2
  import { GridInitialStateCommunity, GridStateCommunity } from "./models/gridStateCommunity.js";
3
+ import "./material/index.js";
3
4
  export { useGridApiContext } from "./hooks/utils/useGridApiContext.js";
4
5
  export { useGridApiRef } from "./hooks/utils/useGridApiRef.js";
5
6
  export { useGridRootProps } from "./hooks/utils/useGridRootProps.js";
package/esm/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  /**
2
- * @mui/x-data-grid v8.3.0
2
+ * @mui/x-data-grid v8.4.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
+ import "./material/index.js";
8
9
  export { useGridApiContext } from "./hooks/utils/useGridApiContext.js";
9
10
  export { useGridApiRef } from "./hooks/utils/useGridApiRef.js";
10
11
  export { useGridRootProps } from "./hooks/utils/useGridRootProps.js";
@@ -58,11 +58,11 @@ const isISGrid = {
58
58
  filterPanelInputPlaceholder: 'Síu gildi',
59
59
  // Filter operators text
60
60
  filterOperatorContains: 'inniheldur',
61
- // filterOperatorDoesNotContain: 'does not contain',
61
+ filterOperatorDoesNotContain: 'inniheldur ekki',
62
62
  filterOperatorEquals: 'jafnt og',
63
- // filterOperatorDoesNotEqual: 'does not equal',
64
- filterOperatorStartsWith: 'byrjar með',
65
- filterOperatorEndsWith: 'endar með',
63
+ filterOperatorDoesNotEqual: 'ekki jafnt og',
64
+ filterOperatorStartsWith: 'byrjar á',
65
+ filterOperatorEndsWith: 'endar á',
66
66
  filterOperatorIs: 'er líka með',
67
67
  filterOperatorNot: 'er ekki líka með',
68
68
  filterOperatorAfter: 'eftir',
@@ -80,11 +80,11 @@ const isISGrid = {
80
80
  'filterOperator<=': '<=',
81
81
  // Header filter operators text
82
82
  headerFilterOperatorContains: 'Inniheldur',
83
- // headerFilterOperatorDoesNotContain: 'Does not contain',
83
+ headerFilterOperatorDoesNotContain: 'Inniheldur ekki',
84
84
  headerFilterOperatorEquals: 'Jafnt og',
85
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
86
- headerFilterOperatorStartsWith: 'Byrjar með',
87
- headerFilterOperatorEndsWith: 'Endar með',
85
+ headerFilterOperatorDoesNotEqual: 'Ekki jafnt og',
86
+ headerFilterOperatorStartsWith: 'Byrjar á',
87
+ headerFilterOperatorEndsWith: 'Endar á',
88
88
  headerFilterOperatorIs: 'Er jafnt og',
89
89
  headerFilterOperatorNot: 'Er ekki jafnt og',
90
90
  headerFilterOperatorAfter: 'Eftir',
@@ -3,10 +3,9 @@ const koKRGrid = {
3
3
  // Root
4
4
  noRowsLabel: '행이 없습니다.',
5
5
  noResultsOverlayLabel: '결과값이 없습니다.',
6
- // noColumnsOverlayLabel: 'No columns',
7
- // noColumnsOverlayManageColumns: 'Manage columns',
8
- // emptyPivotOverlayLabel: 'Add fields to rows, columns, and values to create a pivot table',
9
-
6
+ noColumnsOverlayLabel: '열이 없습니다',
7
+ noColumnsOverlayManageColumns: ' 관리하기',
8
+ emptyPivotOverlayLabel: '행, 열, 값을 추가하여 피벗 테이블을 만듭니다.',
10
9
  // Density selector toolbar button text
11
10
  toolbarDensity: '행 간격',
12
11
  toolbarDensityLabel: '행 간격',
@@ -33,11 +32,9 @@ const koKRGrid = {
33
32
  toolbarExportPrint: '프린트',
34
33
  toolbarExportExcel: 'Excel로 내보내기',
35
34
  // Toolbar pivot button
36
- // toolbarPivot: 'Pivot',
37
-
35
+ toolbarPivot: '피벗',
38
36
  // Toolbar AI Assistant button
39
- // toolbarAssistant: 'AI Assistant',
40
-
37
+ toolbarAssistant: 'AI 어시스턴트',
41
38
  // Columns management text
42
39
  columnsManagementSearchTitle: '검색',
43
40
  columnsManagementNoColumns: '열이 없습니다.',
@@ -99,15 +96,14 @@ const koKRGrid = {
99
96
  'headerFilterOperator>=': '같거나 더 큰',
100
97
  'headerFilterOperator<': '더 작은',
101
98
  'headerFilterOperator<=': '같거나 더 작은',
102
- // headerFilterClear: 'Clear filter',
103
-
99
+ headerFilterClear: '필터 초기화',
104
100
  // Filter values text
105
101
  filterValueAny: '아무값',
106
102
  filterValueTrue: '참',
107
103
  filterValueFalse: '거짓',
108
104
  // Column menu text
109
105
  columnMenuLabel: '메뉴',
110
- // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
106
+ columnMenuAriaLabel: columnName => `${columnName} 메뉴`,
111
107
  columnMenuShowColumns: '열 표시',
112
108
  columnMenuManageColumns: '열 관리',
113
109
  columnMenuFilter: '필터',
@@ -156,18 +152,18 @@ const koKRGrid = {
156
152
  collapseDetailPanel: '접기',
157
153
  // Pagination
158
154
  paginationRowsPerPage: '페이지 당 행:',
159
- // paginationDisplayedRows: ({
160
- // from,
161
- // to,
162
- // count,
163
- // estimated
164
- // }) => {
165
- // if (!estimated) {
166
- // return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
167
- // }
168
- // const estimatedLabel = estimated && estimated > to ? `around ${estimated}` : `more than ${to}`;
169
- // return `${from}–${to} of ${count !== -1 ? count : estimatedLabel}`;
170
- // },
155
+ paginationDisplayedRows: ({
156
+ from,
157
+ to,
158
+ count,
159
+ estimated
160
+ }) => {
161
+ if (!estimated) {
162
+ return `${from}–${to} of ${count !== -1 ? count : `${to} 이상`}`;
163
+ }
164
+ const estimatedLabel = estimated && estimated > to ? `약 ${estimated}` : `${to} 이상`;
165
+ return `${from}–${to} of ${count !== -1 ? count : estimatedLabel}`;
166
+ },
171
167
  paginationItemAriaLabel: type => {
172
168
  if (type === 'first') {
173
169
  return '첫 번째 페이지로 이동';
@@ -191,61 +187,57 @@ const koKRGrid = {
191
187
  aggregationFunctionLabelMax: '최대값',
192
188
  aggregationFunctionLabelSize: '크기',
193
189
  // Pivot panel
194
- // pivotToggleLabel: 'Pivot',
195
- // pivotRows: 'Rows',
196
- // pivotColumns: 'Columns',
197
- // pivotValues: 'Values',
198
- // pivotCloseButton: 'Close pivot settings',
199
- // pivotSearchButton: 'Search fields',
200
- // pivotSearchControlPlaceholder: 'Search fields',
201
- // pivotSearchControlLabel: 'Search fields',
202
- // pivotSearchControlClear: 'Clear search',
203
- // pivotNoFields: 'No fields',
204
- // pivotMenuMoveUp: 'Move up',
205
- // pivotMenuMoveDown: 'Move down',
206
- // pivotMenuMoveToTop: 'Move to top',
207
- // pivotMenuMoveToBottom: 'Move to bottom',
208
- // pivotMenuRows: 'Rows',
209
- // pivotMenuColumns: 'Columns',
210
- // pivotMenuValues: 'Values',
211
- // pivotMenuOptions: 'Field options',
212
- // pivotMenuAddToRows: 'Add to Rows',
213
- // pivotMenuAddToColumns: 'Add to Columns',
214
- // pivotMenuAddToValues: 'Add to Values',
215
- // pivotMenuRemove: 'Remove',
216
- // pivotDragToRows: 'Drag here to create rows',
217
- // pivotDragToColumns: 'Drag here to create columns',
218
- // pivotDragToValues: 'Drag here to create values',
219
- // pivotYearColumnHeaderName: '(Year)',
220
- // pivotQuarterColumnHeaderName: '(Quarter)',
221
-
190
+ pivotToggleLabel: '피벗',
191
+ pivotRows: '',
192
+ pivotColumns: '',
193
+ pivotValues: '',
194
+ pivotCloseButton: '피벗 설정 닫기',
195
+ pivotSearchButton: '필드 검색',
196
+ pivotSearchControlPlaceholder: '필드 검색',
197
+ pivotSearchControlLabel: '필드 검색',
198
+ pivotSearchControlClear: '검색 초기화',
199
+ pivotNoFields: '필드가 없습니다.',
200
+ pivotMenuMoveUp: '위로 이동',
201
+ pivotMenuMoveDown: '아래로 이동',
202
+ pivotMenuMoveToTop: '위로 이동',
203
+ pivotMenuMoveToBottom: '아래로 이동',
204
+ pivotMenuRows: '',
205
+ pivotMenuColumns: '',
206
+ pivotMenuValues: '',
207
+ pivotMenuOptions: '필드 옵션',
208
+ pivotMenuAddToRows: '행에 추가',
209
+ pivotMenuAddToColumns: '열에 추가',
210
+ pivotMenuAddToValues: '값에 추가',
211
+ pivotMenuRemove: '제거',
212
+ pivotDragToRows: ' 생성',
213
+ pivotDragToColumns: ' 생성',
214
+ pivotDragToValues: ' 생성',
215
+ pivotYearColumnHeaderName: '()',
216
+ pivotQuarterColumnHeaderName: '(분기)',
222
217
  // AI Assistant panel
223
- // aiAssistantPanelTitle: 'AI Assistant',
224
- // aiAssistantPanelClose: 'Close AI Assistant',
225
- // aiAssistantPanelNewConversation: 'New conversation',
226
- // aiAssistantPanelConversationHistory: 'Conversation history',
227
- // aiAssistantPanelEmptyConversation: 'No prompt history',
228
- // aiAssistantSuggestions: 'Suggestions',
229
-
218
+ aiAssistantPanelTitle: 'AI 어시스턴트',
219
+ aiAssistantPanelClose: 'AI 어시스턴트 닫기',
220
+ aiAssistantPanelNewConversation: ' 대화',
221
+ aiAssistantPanelConversationHistory: '대화 기록',
222
+ aiAssistantPanelEmptyConversation: '프롬프트 내역이 없습니다.',
223
+ aiAssistantSuggestions: '제안',
230
224
  // Prompt field
231
225
  promptFieldLabel: '프롬프트 입력',
232
226
  promptFieldPlaceholder: '프롬프트 입력…',
233
227
  promptFieldPlaceholderWithRecording: '프롬프트 입력 또는 녹음…',
234
228
  promptFieldPlaceholderListening: '녹음 중…',
235
- // promptFieldSpeechRecognitionNotSupported: 'Speech recognition is not supported in this browser',
229
+ promptFieldSpeechRecognitionNotSupported: ' 브라우저에서 음성 인식을 지원하지 않습니다.',
236
230
  promptFieldSend: '전송',
237
231
  promptFieldRecord: '녹음',
238
- promptFieldStopRecording: '녹음 정지'
239
-
232
+ promptFieldStopRecording: '녹음 정지',
240
233
  // Prompt
241
- // promptRerun: 'Run again',
242
- // promptProcessing: 'Processing…',
243
- // promptAppliedChanges: 'Applied changes',
244
-
234
+ promptRerun: '다시 실행',
235
+ promptProcessing: '처리 중…',
236
+ promptAppliedChanges: '변경사항 적용하기',
245
237
  // Prompt changes
246
- // promptChangeGroupDescription: (column: string) => `Group by ${column}`,
247
- // promptChangeAggregationLabel: (column: string, aggregation: string) => `${column} (${aggregation})`,
248
- // promptChangeAggregationDescription: (column: string, aggregation: string) => `Aggregate ${column} (${aggregation})`,
238
+ promptChangeGroupDescription: column => `${column} 값으로 그룹 생성`,
239
+ promptChangeAggregationLabel: (column, aggregation) => `${column} (${aggregation})`,
240
+ promptChangeAggregationDescription: (column, aggregation) => `${column} (${aggregation}) 집계`,
249
241
  // promptChangeFilterLabel: (column: string, operator: string, value: string) => {
250
242
  // if (operator === 'is any of') {
251
243
  // return `${column} is any of: ${value}`;
@@ -258,13 +250,13 @@ const koKRGrid = {
258
250
  // }
259
251
  // return `Filter where ${column} ${operator} ${value}`;
260
252
  // },
261
- // promptChangeSortDescription: (column: string, direction: string) => `Sort by ${column} (${direction})`,
262
- // promptChangePivotEnableLabel: 'Pivot',
263
- // promptChangePivotEnableDescription: 'Enable pivot',
264
- // promptChangePivotColumnsLabel: (count: number) => `Columns (${count})`,
265
- // promptChangePivotColumnsDescription: (column: string, direction: string) => `${column}${direction ? ` (${direction})` : ''}`,
266
- // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
267
- // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
268
- // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
253
+ promptChangeSortDescription: (column, direction) => `${column} (${direction}) 기준으로 정렬`,
254
+ promptChangePivotEnableLabel: '피벗',
255
+ promptChangePivotEnableDescription: '피벗 활성화',
256
+ promptChangePivotColumnsLabel: count => `(${count}) 개의 열`,
257
+ promptChangePivotColumnsDescription: (column, direction) => `${column}${direction ? ` (${direction})` : ''}`,
258
+ promptChangePivotRowsLabel: count => `(${count}) 개의 행`,
259
+ promptChangePivotValuesLabel: count => `(${count}) 개의 값`,
260
+ promptChangePivotValuesDescription: (column, aggregation) => `${column} (${aggregation})`
269
261
  };
270
262
  export const koKR = getGridLocalization(koKRGrid);
@@ -3,8 +3,8 @@ const nbNOGrid = {
3
3
  // Root
4
4
  noRowsLabel: 'Ingen rader',
5
5
  noResultsOverlayLabel: 'Fant ingen resultat.',
6
- // noColumnsOverlayLabel: 'No columns',
7
- // noColumnsOverlayManageColumns: 'Manage columns',
6
+ noColumnsOverlayLabel: 'Ingen kolonner',
7
+ noColumnsOverlayManageColumns: 'Velg kolonner',
8
8
  // emptyPivotOverlayLabel: 'Add fields to rows, columns, and values to create a pivot table',
9
9
 
10
10
  // Density selector toolbar button text
@@ -43,8 +43,7 @@ const nbNOGrid = {
43
43
  columnsManagementNoColumns: 'Ingen kolonner',
44
44
  columnsManagementShowHideAllText: 'Vis/skjul alle',
45
45
  columnsManagementReset: 'Nullstill',
46
- // columnsManagementDeleteIconLabel: 'Clear',
47
-
46
+ columnsManagementDeleteIconLabel: 'Tøm',
48
47
  // Filter panel text
49
48
  filterPanelAddFilter: 'Legg til filter',
50
49
  filterPanelRemoveAll: 'Fjern alle',
@@ -58,9 +57,9 @@ const nbNOGrid = {
58
57
  filterPanelInputPlaceholder: 'Filter verdi',
59
58
  // Filter operators text
60
59
  filterOperatorContains: 'inneholder',
61
- // filterOperatorDoesNotContain: 'does not contain',
60
+ filterOperatorDoesNotContain: 'inneholder ikke',
62
61
  filterOperatorEquals: 'er lik',
63
- // filterOperatorDoesNotEqual: 'does not equal',
62
+ filterOperatorDoesNotEqual: 'er ikke lik',
64
63
  filterOperatorStartsWith: 'starter med',
65
64
  filterOperatorEndsWith: 'slutter med',
66
65
  filterOperatorIs: 'er',
@@ -80,9 +79,9 @@ const nbNOGrid = {
80
79
  'filterOperator<=': '<=',
81
80
  // Header filter operators text
82
81
  headerFilterOperatorContains: 'Inneholder',
83
- // headerFilterOperatorDoesNotContain: 'Does not contain',
84
- headerFilterOperatorEquals: 'Lik',
85
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
82
+ headerFilterOperatorDoesNotContain: 'Inneholder ikke',
83
+ headerFilterOperatorEquals: 'Er lik',
84
+ headerFilterOperatorDoesNotEqual: 'Er ikke lik',
86
85
  headerFilterOperatorStartsWith: 'Starter på',
87
86
  headerFilterOperatorEndsWith: 'Slutter på',
88
87
  headerFilterOperatorIs: 'Er',
@@ -100,15 +99,14 @@ const nbNOGrid = {
100
99
  'headerFilterOperator>=': 'Større enn eller lik',
101
100
  'headerFilterOperator<': 'Mindre enn',
102
101
  'headerFilterOperator<=': 'Mindre enn eller lik',
103
- // headerFilterClear: 'Clear filter',
104
-
102
+ headerFilterClear: 'Tøm filter',
105
103
  // Filter values text
106
104
  filterValueAny: 'noen',
107
105
  filterValueTrue: 'sant',
108
106
  filterValueFalse: 'usant',
109
107
  // Column menu text
110
108
  columnMenuLabel: 'Meny',
111
- // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
109
+ columnMenuAriaLabel: columnName => `${columnName} kolonnemeny`,
112
110
  columnMenuShowColumns: 'Vis kolonner',
113
111
  columnMenuManageColumns: 'Administrer kolonner',
114
112
  columnMenuFilter: 'Filter',
@@ -157,18 +155,18 @@ const nbNOGrid = {
157
155
  collapseDetailPanel: 'Kollaps',
158
156
  // Pagination
159
157
  paginationRowsPerPage: 'Rader per side:',
160
- // paginationDisplayedRows: ({
161
- // from,
162
- // to,
163
- // count,
164
- // estimated
165
- // }) => {
166
- // if (!estimated) {
167
- // return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
168
- // }
169
- // const estimatedLabel = estimated && estimated > to ? `around ${estimated}` : `more than ${to}`;
170
- // return `${from}–${to} of ${count !== -1 ? count : estimatedLabel}`;
171
- // },
158
+ paginationDisplayedRows: ({
159
+ from,
160
+ to,
161
+ count,
162
+ estimated
163
+ }) => {
164
+ if (!estimated) {
165
+ return `${from}–${to} av ${count !== -1 ? count : `mer enn ${to}`}`;
166
+ }
167
+ const estimatedLabel = estimated && estimated > to ? `omtrent ${estimated}` : `mer enn ${to}`;
168
+ return `${from}–${to} av ${count !== -1 ? count : estimatedLabel}`;
169
+ },
172
170
  paginationItemAriaLabel: type => {
173
171
  if (type === 'first') {
174
172
  return 'Gå til første side';
@@ -93,5 +93,10 @@ function removeOpacity(color) {
93
93
  return setOpacity(color, 1);
94
94
  }
95
95
  function formatFont(font) {
96
+ // Accounts for disabled typography variants
97
+ // See: https://github.com/mui/mui-x/issues/17812
98
+ if (!font) {
99
+ return undefined;
100
+ }
96
101
  return `${font.fontWeight} ${font.fontSize} / ${font.lineHeight} ${font.fontFamily}`;
97
102
  }
@@ -1,5 +1,6 @@
1
1
  import type { GridRowId, GridRowModel } from "../gridRows.js";
2
2
  import type { GridRowSelectionModel } from "../gridRowSelectionModel.js";
3
+ import { GridControlledStateReasonLookup } from "../events/index.js";
3
4
  /**
4
5
  * The selection API interface that is available in the grid [[apiRef]].
5
6
  */
@@ -34,9 +35,10 @@ export interface GridRowSelectionApi {
34
35
  *
35
36
  * ⚠️ Caution: `setRowSelectionModel` doesn't apply the selection propagation automatically.
36
37
  * Pass model returned by API method `getPropagatedRowSelectionModel` instead to apply the selection propagation.
37
- * @param {gridRowSelectionModel} rowSelectionModel The new row selection model
38
+ * @param {gridRowSelectionModel} rowSelectionModel The new row selection model.
39
+ * @param {string} reason The reason for the state change.
38
40
  */
39
- setRowSelectionModel: (rowSelectionModel: GridRowSelectionModel) => void;
41
+ setRowSelectionModel: (rowSelectionModel: GridRowSelectionModel, reason?: GridControlledStateReasonLookup['rowSelection']) => void;
40
42
  }
41
43
  export interface GridRowMultiSelectionApi {
42
44
  /**
@@ -195,6 +195,15 @@ export interface GridColumnHeaderEventLookup {
195
195
  params: GridColumnHeaderParams;
196
196
  event: React.DragEvent<HTMLElement>;
197
197
  };
198
+ /**
199
+ * Fired when the dragging of a column header ends.
200
+ * Same as `columnHeaderDragEnd`, but also fires when the DOM element is unmounted.
201
+ * @ignore - do not document.
202
+ */
203
+ columnHeaderDragEndNative: {
204
+ params: GridColumnHeaderParams;
205
+ event: DragEvent;
206
+ };
198
207
  /**
199
208
  * Fired when a `dblclick` DOM event happens in the column header separator.
200
209
  * @ignore - do not document.
@@ -400,6 +409,7 @@ export interface GridControlledStateReasonLookup {
400
409
  filter: 'upsertFilterItem' | 'upsertFilterItems' | 'deleteFilterItem' | 'changeLogicOperator' | 'restoreState' | 'removeAllFilterItems';
401
410
  pagination: 'setPaginationModel' | 'stateRestorePreProcessing';
402
411
  rows: 'addSkeletonRows';
412
+ rowSelection: 'singleRowSelection' | 'multipleRowsSelection';
403
413
  }
404
414
  export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEventLookup, GridHeaderFilterEventLookup, GridColumnGroupHeaderEventLookup, GridCellEventLookup, GridControlledStateEventLookup {
405
415
  /**
@@ -9,6 +9,7 @@ const CSSVariablesContext = /*#__PURE__*/React.createContext({
9
9
  href: "/unset"
10
10
  })
11
11
  });
12
+ if (process.env.NODE_ENV !== "production") CSSVariablesContext.displayName = "CSSVariablesContext";
12
13
  export function useCSSVariablesClass() {
13
14
  return React.useContext(CSSVariablesContext).className;
14
15
  }
@@ -49,7 +50,7 @@ export function GridCSSVariablesContext(props) {
49
50
  function variablesToString(variables) {
50
51
  let output = '';
51
52
  for (const key in variables) {
52
- if (Object.hasOwn(variables, key)) {
53
+ if (Object.hasOwn(variables, key) && variables[key] !== undefined) {
53
54
  output += `${key}:${variables[key]};`;
54
55
  }
55
56
  }
@@ -83,7 +83,7 @@ const useGridColumnHeaders = props => {
83
83
  (0, _useGridEvent.useGridEvent)(apiRef, 'columnResizeStart', handleColumnResizeStart);
84
84
  (0, _useGridEvent.useGridEvent)(apiRef, 'columnResizeStop', handleColumnResizeStop);
85
85
  (0, _useGridEvent.useGridEvent)(apiRef, 'columnHeaderDragStart', handleColumnReorderStart);
86
- (0, _useGridEvent.useGridEvent)(apiRef, 'columnHeaderDragEnd', handleColumnReorderStop);
86
+ (0, _useGridEvent.useGridEvent)(apiRef, 'columnHeaderDragEndNative', handleColumnReorderStop);
87
87
 
88
88
  // Helper for computation common between getColumnHeaders and getColumnGroupHeaders
89
89
  const getColumnsToRender = params => {
@@ -121,6 +121,7 @@ const useGridColumnHeaders = props => {
121
121
  })]
122
122
  });
123
123
  };
124
+ if (process.env.NODE_ENV !== "production") getFillers.displayName = "getFillers";
124
125
  const getColumnHeaders = (params, other = {}) => {
125
126
  const {
126
127
  renderedColumns,
@@ -189,6 +190,7 @@ const useGridColumnHeaders = props => {
189
190
  })]
190
191
  });
191
192
  };
193
+ if (process.env.NODE_ENV !== "production") getColumnHeadersRow.displayName = "getColumnHeadersRow";
192
194
  const getColumnGroupHeaders = ({
193
195
  depth,
194
196
  params
@@ -318,13 +318,21 @@ function getFirstNonSpannedColumnToRender({
318
318
  visibleRows
319
319
  }) {
320
320
  let firstNonSpannedColumnToRender = firstColumnToRender;
321
- for (let i = firstRowToRender; i < lastRowToRender; i += 1) {
322
- const row = visibleRows[i];
323
- if (row) {
324
- const rowId = visibleRows[i].id;
325
- const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, firstColumnToRender);
326
- if (cellColSpanInfo && cellColSpanInfo.spannedByColSpan) {
327
- firstNonSpannedColumnToRender = cellColSpanInfo.leftVisibleCellIndex;
321
+ let foundStableColumn = false;
322
+
323
+ // Keep checking columns until we find one that's not spanned in any visible row
324
+ while (!foundStableColumn && firstNonSpannedColumnToRender >= 0) {
325
+ foundStableColumn = true;
326
+ for (let i = firstRowToRender; i < lastRowToRender; i += 1) {
327
+ const row = visibleRows[i];
328
+ if (row) {
329
+ const rowId = visibleRows[i].id;
330
+ const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, firstNonSpannedColumnToRender);
331
+ if (cellColSpanInfo && cellColSpanInfo.spannedByColSpan && cellColSpanInfo.leftVisibleCellIndex < firstNonSpannedColumnToRender) {
332
+ firstNonSpannedColumnToRender = cellColSpanInfo.leftVisibleCellIndex;
333
+ foundStableColumn = false;
334
+ break; // Check the new column index against the visible rows, because it might be spanned
335
+ }
328
336
  }
329
337
  }
330
338
  }
@@ -68,6 +68,7 @@ const useGridOverlays = () => {
68
68
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Overlay, (0, _extends2.default)({}, overlayProps))
69
69
  }));
70
70
  };
71
+ if (process.env.NODE_ENV !== "production") getOverlay.displayName = "getOverlay";
71
72
  return {
72
73
  getOverlay,
73
74
  overlaysProps
@@ -147,7 +147,7 @@ const useGridPaginationModel = (apiRef, props) => {
147
147
  return;
148
148
  }
149
149
  const dimensions = apiRef.current.getRootDimensions();
150
- const maximumPageSizeWithoutScrollBar = Math.floor(dimensions.viewportInnerSize.height / rowHeight);
150
+ const maximumPageSizeWithoutScrollBar = Math.max(1, Math.floor(dimensions.viewportInnerSize.height / rowHeight));
151
151
  apiRef.current.setPageSize(maximumPageSizeWithoutScrollBar);
152
152
  }, [apiRef, props.autoPageSize, rowHeight]);
153
153
  const handleRowCountChange = React.useCallback(newRowCount => {
@@ -101,7 +101,7 @@ const useGridRowSelection = (apiRef, props) => {
101
101
  /*
102
102
  * API METHODS
103
103
  */
104
- const setRowSelectionModel = React.useCallback(model => {
104
+ const setRowSelectionModel = React.useCallback((model, reason) => {
105
105
  if (props.signature === _signature.GridSignature.DataGrid && !canHaveMultipleSelection && (model.type !== 'include' || model.ids.size > 1)) {
106
106
  throw new Error(['MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
107
107
  }
@@ -110,7 +110,7 @@ const useGridRowSelection = (apiRef, props) => {
110
110
  logger.debug(`Setting selection model`);
111
111
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
112
112
  rowSelection: props.rowSelection ? model : emptyModel
113
- }));
113
+ }), reason);
114
114
  }
115
115
  }, [apiRef, logger, props.rowSelection, props.signature, canHaveMultipleSelection]);
116
116
  const isRowSelected = React.useCallback(id => {
@@ -151,7 +151,7 @@ const useGridRowSelection = (apiRef, props) => {
151
151
  (0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
152
152
  }
153
153
  }
154
- apiRef.current.setRowSelectionModel(newSelectionModel);
154
+ apiRef.current.setRowSelectionModel(newSelectionModel, 'singleRowSelection');
155
155
  } else {
156
156
  logger.debug(`Toggling selection for row ${id}`);
157
157
  const selectionModel = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef);
@@ -177,7 +177,7 @@ const useGridRowSelection = (apiRef, props) => {
177
177
  }
178
178
  const isSelectionValid = newSelectionModel.type === 'include' && newSelectionModel.ids.size < 2 || canHaveMultipleSelection;
179
179
  if (isSelectionValid) {
180
- apiRef.current.setRowSelectionModel(newSelectionModel);
180
+ apiRef.current.setRowSelectionModel(newSelectionModel, 'singleRowSelection');
181
181
  }
182
182
  }
183
183
  }, [apiRef, logger, applyAutoSelection, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, canHaveMultipleSelection]);
@@ -244,7 +244,7 @@ const useGridRowSelection = (apiRef, props) => {
244
244
  }
245
245
  const isSelectionValid = newSelectionModel.type === 'include' && newSelectionModel.ids.size < 2 || canHaveMultipleSelection;
246
246
  if (isSelectionValid) {
247
- apiRef.current.setRowSelectionModel(newSelectionModel);
247
+ apiRef.current.setRowSelectionModel(newSelectionModel, 'multipleRowsSelection');
248
248
  }
249
249
  }, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, props.rowSelection]);
250
250
  const getPropagatedRowSelectionModel = React.useCallback(inputSelectionModel => {
@@ -369,7 +369,7 @@ const useGridRowSelection = (apiRef, props) => {
369
369
  apiRef.current.selectRows(Array.from(newSelectionModel.ids), true, true);
370
370
  }
371
371
  } else {
372
- apiRef.current.setRowSelectionModel(newSelectionModel);
372
+ apiRef.current.setRowSelectionModel(newSelectionModel, 'multipleRowsSelection');
373
373
  }
374
374
  }
375
375
  }, [apiRef, isNestedData, props.rowSelectionPropagation?.parents, props.keepNonExistentRowsSelected, props.filterMode, tree, getRowsToBeSelected]);
@@ -436,7 +436,7 @@ const useGridRowSelection = (apiRef, props) => {
436
436
  const toggleAllRows = React.useCallback(value => {
437
437
  const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
438
438
  const quickFilterModel = (0, _gridFilterSelector.gridQuickFilterValuesSelector)(apiRef);
439
- const hasFilters = filterModel.items.length > 0 || (quickFilterModel?.length || 0) > 0;
439
+ const hasFilters = filterModel.items.length > 0 || quickFilterModel?.some(val => val.length);
440
440
  if (!props.isRowSelectable && !props.checkboxSelectionVisibleOnly && applyAutoSelection && !hasFilters) {
441
441
  apiRef.current.setRowSelectionModel({
442
442
  type: value ? 'exclude' : 'include',
@@ -5,7 +5,10 @@ import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommuni
5
5
  import { type GridRowSelectionPropagation } from "../../../models/gridRowSelectionModel.js";
6
6
  import { type RowSelectionManager } from "../../../models/gridRowSelectionManager.js";
7
7
  export declare const ROW_SELECTION_PROPAGATION_DEFAULT: GridRowSelectionPropagation;
8
- export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("@mui/x-data-grid").OutputSelector<import("../../../models/gridStateCommunity.js").GridStateCommunity, RowSelectionManager, {
8
+ export declare const checkboxPropsSelector: import("@mui/x-data-grid").OutputSelector<import("../../../models/gridStateCommunity.js").GridStateCommunity, {
9
+ groupId: GridRowId;
10
+ autoSelectParents: boolean;
11
+ }, {
9
12
  isIndeterminate: boolean;
10
13
  isChecked: boolean;
11
14
  }>;