@mui/x-data-grid 7.27.3 → 7.28.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 (164) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +1 -1
  3. package/components/cell/GridActionsCell.js +3 -1
  4. package/components/cell/GridCell.js +2 -2
  5. package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -1
  6. package/components/columnSelection/GridHeaderCheckbox.js +2 -2
  7. package/components/containers/GridRootStyles.js +3 -3
  8. package/components/panel/filterPanel/GridFilterInputValue.d.ts +4 -0
  9. package/components/panel/filterPanel/index.d.ts +1 -1
  10. package/components/panel/filterPanel/index.js +1 -1
  11. package/components/virtualization/GridBottomContainer.js +1 -1
  12. package/components/virtualization/GridTopContainer.js +1 -1
  13. package/components/virtualization/GridVirtualScrollbar.js +2 -2
  14. package/constants/localeTextConstants.js +1 -0
  15. package/hooks/features/editing/useGridRowEditing.js +18 -9
  16. package/hooks/features/export/useGridPrintExport.js +4 -4
  17. package/hooks/features/filter/useGridFilter.js +5 -0
  18. package/hooks/features/rowSelection/useGridRowSelection.js +47 -11
  19. package/hooks/features/rowSelection/utils.d.ts +2 -2
  20. package/hooks/features/rowSelection/utils.js +8 -6
  21. package/index.js +1 -1
  22. package/locales/arSD.js +1 -0
  23. package/locales/beBY.js +1 -0
  24. package/locales/bgBG.js +1 -0
  25. package/locales/bnBD.js +1 -0
  26. package/locales/csCZ.js +6 -6
  27. package/locales/daDK.js +1 -0
  28. package/locales/deDE.js +1 -0
  29. package/locales/elGR.js +1 -0
  30. package/locales/esES.js +1 -0
  31. package/locales/faIR.js +1 -0
  32. package/locales/fiFI.js +1 -0
  33. package/locales/frFR.js +1 -0
  34. package/locales/heIL.js +1 -0
  35. package/locales/hrHR.js +1 -0
  36. package/locales/huHU.js +1 -0
  37. package/locales/isIS.js +1 -0
  38. package/locales/itIT.js +1 -0
  39. package/locales/jaJP.js +1 -0
  40. package/locales/koKR.js +2 -1
  41. package/locales/nbNO.js +1 -0
  42. package/locales/nlNL.js +1 -0
  43. package/locales/nnNO.js +1 -0
  44. package/locales/plPL.js +1 -0
  45. package/locales/ptBR.js +1 -0
  46. package/locales/ptPT.js +1 -0
  47. package/locales/roRO.js +1 -0
  48. package/locales/ruRU.js +1 -0
  49. package/locales/skSK.js +7 -7
  50. package/locales/svSE.js +1 -0
  51. package/locales/trTR.js +1 -0
  52. package/locales/ukUA.js +1 -0
  53. package/locales/urPK.js +1 -0
  54. package/locales/viVN.js +1 -0
  55. package/locales/zhCN.js +1 -0
  56. package/locales/zhHK.js +11 -11
  57. package/locales/zhTW.js +10 -10
  58. package/models/api/gridLocaleTextApi.d.ts +1 -0
  59. package/models/api/gridRowSelectionApi.d.ts +15 -4
  60. package/modern/components/cell/GridActionsCell.js +3 -1
  61. package/modern/components/cell/GridCell.js +2 -2
  62. package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -1
  63. package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
  64. package/modern/components/containers/GridRootStyles.js +3 -3
  65. package/modern/components/panel/filterPanel/index.js +1 -1
  66. package/modern/components/virtualization/GridBottomContainer.js +1 -1
  67. package/modern/components/virtualization/GridTopContainer.js +1 -1
  68. package/modern/components/virtualization/GridVirtualScrollbar.js +2 -2
  69. package/modern/constants/localeTextConstants.js +1 -0
  70. package/modern/hooks/features/editing/useGridRowEditing.js +18 -9
  71. package/modern/hooks/features/export/useGridPrintExport.js +4 -4
  72. package/modern/hooks/features/filter/useGridFilter.js +5 -0
  73. package/modern/hooks/features/rowSelection/useGridRowSelection.js +47 -11
  74. package/modern/hooks/features/rowSelection/utils.js +8 -6
  75. package/modern/index.js +1 -1
  76. package/modern/locales/arSD.js +1 -0
  77. package/modern/locales/beBY.js +1 -0
  78. package/modern/locales/bgBG.js +1 -0
  79. package/modern/locales/bnBD.js +1 -0
  80. package/modern/locales/csCZ.js +6 -6
  81. package/modern/locales/daDK.js +1 -0
  82. package/modern/locales/deDE.js +1 -0
  83. package/modern/locales/elGR.js +1 -0
  84. package/modern/locales/esES.js +1 -0
  85. package/modern/locales/faIR.js +1 -0
  86. package/modern/locales/fiFI.js +1 -0
  87. package/modern/locales/frFR.js +1 -0
  88. package/modern/locales/heIL.js +1 -0
  89. package/modern/locales/hrHR.js +1 -0
  90. package/modern/locales/huHU.js +1 -0
  91. package/modern/locales/isIS.js +1 -0
  92. package/modern/locales/itIT.js +1 -0
  93. package/modern/locales/jaJP.js +1 -0
  94. package/modern/locales/koKR.js +2 -1
  95. package/modern/locales/nbNO.js +1 -0
  96. package/modern/locales/nlNL.js +1 -0
  97. package/modern/locales/nnNO.js +1 -0
  98. package/modern/locales/plPL.js +1 -0
  99. package/modern/locales/ptBR.js +1 -0
  100. package/modern/locales/ptPT.js +1 -0
  101. package/modern/locales/roRO.js +1 -0
  102. package/modern/locales/ruRU.js +1 -0
  103. package/modern/locales/skSK.js +7 -7
  104. package/modern/locales/svSE.js +1 -0
  105. package/modern/locales/trTR.js +1 -0
  106. package/modern/locales/ukUA.js +1 -0
  107. package/modern/locales/urPK.js +1 -0
  108. package/modern/locales/viVN.js +1 -0
  109. package/modern/locales/zhCN.js +1 -0
  110. package/modern/locales/zhHK.js +11 -11
  111. package/modern/locales/zhTW.js +10 -10
  112. package/node/components/cell/GridActionsCell.js +3 -1
  113. package/node/components/cell/GridCell.js +2 -2
  114. package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -1
  115. package/node/components/columnSelection/GridHeaderCheckbox.js +2 -2
  116. package/node/components/containers/GridRootStyles.js +3 -3
  117. package/node/components/panel/filterPanel/index.js +7 -11
  118. package/node/components/virtualization/GridBottomContainer.js +1 -1
  119. package/node/components/virtualization/GridTopContainer.js +1 -1
  120. package/node/components/virtualization/GridVirtualScrollbar.js +2 -2
  121. package/node/constants/localeTextConstants.js +1 -0
  122. package/node/hooks/features/editing/useGridRowEditing.js +18 -9
  123. package/node/hooks/features/export/useGridPrintExport.js +4 -4
  124. package/node/hooks/features/filter/useGridFilter.js +5 -0
  125. package/node/hooks/features/rowSelection/useGridRowSelection.js +55 -19
  126. package/node/hooks/features/rowSelection/utils.js +7 -5
  127. package/node/index.js +1 -1
  128. package/node/locales/arSD.js +1 -0
  129. package/node/locales/beBY.js +1 -0
  130. package/node/locales/bgBG.js +1 -0
  131. package/node/locales/bnBD.js +1 -0
  132. package/node/locales/csCZ.js +6 -6
  133. package/node/locales/daDK.js +1 -0
  134. package/node/locales/deDE.js +1 -0
  135. package/node/locales/elGR.js +1 -0
  136. package/node/locales/esES.js +1 -0
  137. package/node/locales/faIR.js +1 -0
  138. package/node/locales/fiFI.js +1 -0
  139. package/node/locales/frFR.js +1 -0
  140. package/node/locales/heIL.js +1 -0
  141. package/node/locales/hrHR.js +1 -0
  142. package/node/locales/huHU.js +1 -0
  143. package/node/locales/isIS.js +1 -0
  144. package/node/locales/itIT.js +1 -0
  145. package/node/locales/jaJP.js +1 -0
  146. package/node/locales/koKR.js +2 -1
  147. package/node/locales/nbNO.js +1 -0
  148. package/node/locales/nlNL.js +1 -0
  149. package/node/locales/nnNO.js +1 -0
  150. package/node/locales/plPL.js +1 -0
  151. package/node/locales/ptBR.js +1 -0
  152. package/node/locales/ptPT.js +1 -0
  153. package/node/locales/roRO.js +1 -0
  154. package/node/locales/ruRU.js +1 -0
  155. package/node/locales/skSK.js +7 -7
  156. package/node/locales/svSE.js +1 -0
  157. package/node/locales/trTR.js +1 -0
  158. package/node/locales/ukUA.js +1 -0
  159. package/node/locales/urPK.js +1 -0
  160. package/node/locales/viVN.js +1 -0
  161. package/node/locales/zhCN.js +1 -0
  162. package/node/locales/zhHK.js +11 -11
  163. package/node/locales/zhTW.js +10 -10
  164. package/package.json +5 -5
@@ -97,6 +97,7 @@ const svSEGrid = {
97
97
  filterValueFalse: 'falskt',
98
98
  // Column menu text
99
99
  columnMenuLabel: 'Meny',
100
+ // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
100
101
  columnMenuShowColumns: 'Visa kolumner',
101
102
  columnMenuManageColumns: 'Hantera kolumner',
102
103
  columnMenuFilter: 'Filtrera',
@@ -96,6 +96,7 @@ const trTRGrid = {
96
96
  filterValueFalse: 'yanlış',
97
97
  // Column menu text
98
98
  columnMenuLabel: 'Menü',
99
+ // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
99
100
  columnMenuShowColumns: 'Sütunları göster',
100
101
  columnMenuManageColumns: 'Sütunları yönet',
101
102
  columnMenuFilter: 'Filtre Ekle',
@@ -111,6 +111,7 @@ const ukUAGrid = {
111
111
  filterValueFalse: 'ні',
112
112
  // Column menu text
113
113
  columnMenuLabel: 'Меню',
114
+ // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
114
115
  columnMenuShowColumns: 'Показати стовпці',
115
116
  columnMenuManageColumns: 'Керування стовпцями',
116
117
  columnMenuFilter: 'Фільтр',
@@ -96,6 +96,7 @@ const urPKGrid = {
96
96
  filterValueFalse: 'غلط',
97
97
  // Column menu text
98
98
  columnMenuLabel: 'مینیو',
99
+ // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
99
100
  columnMenuShowColumns: 'کالم دکھائیں',
100
101
  columnMenuManageColumns: 'کالم مینج کریں',
101
102
  columnMenuFilter: 'فلٹر',
@@ -97,6 +97,7 @@ const viVNGrid = {
97
97
  filterValueFalse: 'Không',
98
98
  // Column menu text
99
99
  columnMenuLabel: 'Danh mục',
100
+ // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
100
101
  columnMenuShowColumns: 'Danh sách cột',
101
102
  columnMenuManageColumns: 'Quản lý cột',
102
103
  columnMenuFilter: 'Bộ lọc',
@@ -96,6 +96,7 @@ const zhCNGrid = {
96
96
  filterValueFalse: '假',
97
97
  // Column menu text
98
98
  columnMenuLabel: '菜单',
99
+ columnMenuAriaLabel: columnName => `${columnName} 列菜单`,
99
100
  columnMenuShowColumns: '显示',
100
101
  columnMenuManageColumns: '管理列',
101
102
  columnMenuFilter: '筛选器',
@@ -30,12 +30,11 @@ const zhHKGrid = {
30
30
  toolbarExportPrint: '列印',
31
31
  toolbarExportExcel: '下載為 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: '搜尋',
34
+ columnsManagementNoColumns: '沒有列',
35
+ columnsManagementShowHideAllText: '顯示/隱藏所有',
36
+ columnsManagementReset: '重置',
37
+ columnsManagementDeleteIconLabel: '清除',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: '新增過濾器',
41
40
  filterPanelRemoveAll: '移除所有',
@@ -49,9 +48,9 @@ const zhHKGrid = {
49
48
  filterPanelInputPlaceholder: '過濾值',
50
49
  // Filter operators text
51
50
  filterOperatorContains: '包含',
52
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: '不包含',
53
52
  filterOperatorEquals: '等於',
54
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: '不等於',
55
54
  filterOperatorStartsWith: '以。。開始',
56
55
  filterOperatorEndsWith: '以。。結束',
57
56
  filterOperatorIs: '是',
@@ -71,9 +70,9 @@ const zhHKGrid = {
71
70
  'filterOperator<=': '<=',
72
71
  // Header filter operators text
73
72
  headerFilterOperatorContains: '包含',
74
- // headerFilterOperatorDoesNotContain: 'Does not contain',
73
+ headerFilterOperatorDoesNotContain: '不包含',
75
74
  headerFilterOperatorEquals: '等於',
76
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
75
+ headerFilterOperatorDoesNotEqual: '不等於',
77
76
  headerFilterOperatorStartsWith: '以。。開始',
78
77
  headerFilterOperatorEndsWith: '以。。結束',
79
78
  headerFilterOperatorIs: '是',
@@ -87,7 +86,7 @@ const zhHKGrid = {
87
86
  headerFilterOperatorIsAnyOf: '是以下任一個',
88
87
  'headerFilterOperator=': '等於',
89
88
  'headerFilterOperator!=': '不等於',
90
- 'headerFilterOperator>': '比...更棒',
89
+ 'headerFilterOperator>': '大於',
91
90
  'headerFilterOperator>=': '大於或等於',
92
91
  'headerFilterOperator<': '少於',
93
92
  'headerFilterOperator<=': '小於或等於',
@@ -97,6 +96,7 @@ const zhHKGrid = {
97
96
  filterValueFalse: '錯誤的',
98
97
  // Column menu text
99
98
  columnMenuLabel: '選單',
99
+ columnMenuAriaLabel: columnName => `${columnName} 欄目選單`,
100
100
  columnMenuShowColumns: '顯示欄目',
101
101
  columnMenuManageColumns: '管理欄目',
102
102
  columnMenuFilter: '篩選',
@@ -30,12 +30,11 @@ const zhTWGrid = {
30
30
  toolbarExportPrint: '列印',
31
31
  toolbarExportExcel: '匯出 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: '搜尋',
34
+ columnsManagementNoColumns: '沒有欄位',
35
+ columnsManagementShowHideAllText: '顯示/隱藏所有',
36
+ columnsManagementReset: '重置',
37
+ columnsManagementDeleteIconLabel: '清除',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: '增加篩選器',
41
40
  filterPanelRemoveAll: '清除所有',
@@ -49,9 +48,9 @@ const zhTWGrid = {
49
48
  filterPanelInputPlaceholder: '篩選值',
50
49
  // Filter operators text
51
50
  filterOperatorContains: '包含',
52
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: '不包含',
53
52
  filterOperatorEquals: '等於',
54
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: '不等於',
55
54
  filterOperatorStartsWith: '以...開頭',
56
55
  filterOperatorEndsWith: '以...結束',
57
56
  filterOperatorIs: '為',
@@ -71,9 +70,9 @@ const zhTWGrid = {
71
70
  'filterOperator<=': '<=',
72
71
  // Header filter operators text
73
72
  headerFilterOperatorContains: '包含',
74
- // headerFilterOperatorDoesNotContain: 'Does not contain',
73
+ headerFilterOperatorDoesNotContain: '不包含',
75
74
  headerFilterOperatorEquals: '等於',
76
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
75
+ headerFilterOperatorDoesNotEqual: '不等於',
77
76
  headerFilterOperatorStartsWith: '以...開頭',
78
77
  headerFilterOperatorEndsWith: '以...結束',
79
78
  headerFilterOperatorIs: '為',
@@ -97,6 +96,7 @@ const zhTWGrid = {
97
96
  filterValueFalse: '假',
98
97
  // Column menu text
99
98
  columnMenuLabel: '選單',
99
+ columnMenuAriaLabel: columnName => `${columnName} 欄位選單`,
100
100
  columnMenuShowColumns: '顯示欄位',
101
101
  columnMenuManageColumns: '管理欄位',
102
102
  columnMenuFilter: '篩選器',
@@ -99,7 +99,9 @@ function GridActionsCell(props) {
99
99
  const hideMenu = () => {
100
100
  setOpen(false);
101
101
  };
102
- const toggleMenu = () => {
102
+ const toggleMenu = event => {
103
+ event.stopPropagation();
104
+ event.preventDefault();
103
105
  if (open) {
104
106
  hideMenu();
105
107
  } else {
@@ -201,9 +201,9 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
201
201
  const isRightPinned = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
202
202
  if (rowSpan > 1) {
203
203
  cellStyle.height = `calc(var(--height) * ${rowSpan})`;
204
- cellStyle.zIndex = 5;
204
+ cellStyle.zIndex = 10;
205
205
  if (isLeftPinned || isRightPinned) {
206
- cellStyle.zIndex = 6;
206
+ cellStyle.zIndex = 40;
207
207
  }
208
208
  }
209
209
  return cellStyle;
@@ -43,6 +43,7 @@ const ColumnHeaderMenuIcon = exports.ColumnHeaderMenuIcon = /*#__PURE__*/React.m
43
43
  event.stopPropagation();
44
44
  apiRef.current.toggleColumnMenu(colDef.field);
45
45
  }, [apiRef, colDef.field]);
46
+ const columnName = colDef.headerName ?? colDef.field;
46
47
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
47
48
  className: classes.root,
48
49
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
@@ -53,7 +54,7 @@ const ColumnHeaderMenuIcon = exports.ColumnHeaderMenuIcon = /*#__PURE__*/React.m
53
54
  ref: iconButtonRef,
54
55
  tabIndex: -1,
55
56
  className: classes.button,
56
- "aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
57
+ "aria-label": apiRef.current.getLocaleText('columnMenuAriaLabel')(columnName),
57
58
  size: "small",
58
59
  onClick: handleMenuIconClick,
59
60
  "aria-haspopup": "menu",
@@ -63,7 +63,7 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = (0, _forwardRef.forwardR
63
63
 
64
64
  // All the rows that could be selected / unselected by toggling this checkbox
65
65
  const selectionCandidates = React.useMemo(() => {
66
- const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly ? visibleRowIds : paginatedVisibleRowIds;
66
+ const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly || rootProps.paginationMode === 'server' ? visibleRowIds : paginatedVisibleRowIds;
67
67
 
68
68
  // Convert to an object to make O(1) checking if a row exists or not
69
69
  // TODO create selector that returns visibleRowIds/paginatedVisibleRowIds as an object
@@ -71,7 +71,7 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = (0, _forwardRef.forwardR
71
71
  acc[id] = true;
72
72
  return acc;
73
73
  }, {});
74
- }, [rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
74
+ }, [rootProps.pagination, rootProps.paginationMode, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
75
75
 
76
76
  // Amount of rows selected and that are visible in the current page
77
77
  const currentSelectionSize = React.useMemo(() => filteredSelection.filter(id => selectionCandidates[id]).length, [filteredSelection, selectionCandidates]);
@@ -492,14 +492,14 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
492
492
  },
493
493
  [`& .${_gridClasses.gridClasses['columnHeader--pinnedLeft']}, & .${_gridClasses.gridClasses['columnHeader--pinnedRight']}`]: {
494
494
  position: 'sticky',
495
- zIndex: 4,
495
+ zIndex: 40,
496
496
  // Should be above the column separator
497
497
  background: 'var(--DataGrid-pinnedBackground)'
498
498
  },
499
499
  [`& .${_gridClasses.gridClasses.columnSeparator}`]: {
500
500
  position: 'absolute',
501
501
  overflow: 'hidden',
502
- zIndex: 3,
502
+ zIndex: 30,
503
503
  display: 'flex',
504
504
  flexDirection: 'column',
505
505
  justifyContent: 'center',
@@ -739,7 +739,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
739
739
  },
740
740
  [`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
741
741
  position: 'sticky',
742
- zIndex: 3,
742
+ zIndex: 30,
743
743
  background: 'var(--DataGrid-pinnedBackground)',
744
744
  '&.Mui-selected': {
745
745
  backgroundColor: pinnedSelectedBackgroundColor
@@ -4,8 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
+ GridFilterInputValue: true,
7
8
  GridFilterPanel: true
8
9
  };
10
+ Object.defineProperty(exports, "GridFilterInputValue", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _GridFilterInputValue.GridFilterInputValue;
14
+ }
15
+ });
9
16
  Object.defineProperty(exports, "GridFilterPanel", {
10
17
  enumerable: true,
11
18
  get: function () {
@@ -25,17 +32,6 @@ Object.keys(_GridFilterForm).forEach(function (key) {
25
32
  });
26
33
  });
27
34
  var _GridFilterInputValue = require("./GridFilterInputValue");
28
- Object.keys(_GridFilterInputValue).forEach(function (key) {
29
- if (key === "default" || key === "__esModule") return;
30
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
- if (key in exports && exports[key] === _GridFilterInputValue[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _GridFilterInputValue[key];
36
- }
37
- });
38
- });
39
35
  var _GridFilterInputDate = require("./GridFilterInputDate");
40
36
  Object.keys(_GridFilterInputDate).forEach(function (key) {
41
37
  if (key === "default" || key === "__esModule") return;
@@ -21,7 +21,7 @@ const useUtilityClasses = () => {
21
21
  };
22
22
  const Element = (0, _system.styled)('div')({
23
23
  position: 'sticky',
24
- zIndex: 4,
24
+ zIndex: 40,
25
25
  bottom: 'calc(var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize))'
26
26
  });
27
27
  function GridBottomContainer(props) {
@@ -21,7 +21,7 @@ const useUtilityClasses = () => {
21
21
  };
22
22
  const Element = (0, _system.styled)('div')({
23
23
  position: 'sticky',
24
- zIndex: 4,
24
+ zIndex: 40,
25
25
  top: 0
26
26
  });
27
27
  function GridTopContainer(props) {
@@ -28,9 +28,9 @@ const useUtilityClasses = (ownerState, position) => {
28
28
  const Scrollbar = (0, _system.styled)('div')({
29
29
  position: 'absolute',
30
30
  display: 'inline-block',
31
- zIndex: 6,
31
+ zIndex: 60,
32
32
  '&:hover': {
33
- zIndex: 7
33
+ zIndex: 70
34
34
  },
35
35
  // In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
36
36
  // their size to be 0px throughout all the calculations, but the floating scrollbar container does need
@@ -100,6 +100,7 @@ const GRID_DEFAULT_LOCALE_TEXT = exports.GRID_DEFAULT_LOCALE_TEXT = {
100
100
  filterValueFalse: 'false',
101
101
  // Column menu text
102
102
  columnMenuLabel: 'Menu',
103
+ columnMenuAriaLabel: columnName => `${columnName} column menu`,
103
104
  columnMenuShowColumns: 'Show columns',
104
105
  columnMenuManageColumns: 'Manage columns',
105
106
  columnMenuFilter: 'Filter',
@@ -29,6 +29,7 @@ const useGridRowEditing = (apiRef, props) => {
29
29
  const [rowModesModel, setRowModesModel] = React.useState({});
30
30
  const rowModesModelRef = React.useRef(rowModesModel);
31
31
  const prevRowModesModel = React.useRef({});
32
+ const prevRowValuesLookup = React.useRef({});
32
33
  const focusTimeout = React.useRef(undefined);
33
34
  const nextFocusedCell = React.useRef(null);
34
35
  const {
@@ -319,6 +320,7 @@ const useGridRowEditing = (apiRef, props) => {
319
320
  deleteValue,
320
321
  initialValue
321
322
  } = params;
323
+ const row = apiRef.current.getRow(id);
322
324
  const columnFields = (0, _gridColumnsSelector.gridColumnFieldsSelector)(apiRef);
323
325
  const newProps = columnFields.reduce((acc, field) => {
324
326
  const cellParams = apiRef.current.getCellParams(id, field);
@@ -341,6 +343,7 @@ const useGridRowEditing = (apiRef, props) => {
341
343
  };
342
344
  return acc;
343
345
  }, {});
346
+ prevRowValuesLookup.current[id] = row;
344
347
  updateOrDeleteRowState(id, newProps);
345
348
  if (fieldToFocus) {
346
349
  apiRef.current.setCellFocus(id, fieldToFocus);
@@ -351,7 +354,7 @@ const useGridRowEditing = (apiRef, props) => {
351
354
  const newValue = deleteValue ? (0, _utils3.getDefaultCellValue)(column) : initialValue ?? value;
352
355
  Promise.resolve(column.preProcessEditCellProps({
353
356
  id,
354
- row: apiRef.current.getRow(id),
357
+ row,
355
358
  props: newProps[field],
356
359
  hasChanged: newValue !== value
357
360
  })).then(processedProps => {
@@ -390,13 +393,14 @@ const useGridRowEditing = (apiRef, props) => {
390
393
  }
391
394
  updateOrDeleteRowState(id, null);
392
395
  updateRowInRowModesModel(id, null);
396
+ delete prevRowValuesLookup.current[id];
393
397
  };
394
398
  if (ignoreModifications) {
395
399
  finishRowEditMode();
396
400
  return;
397
401
  }
398
402
  const editingState = (0, _gridEditingSelectors.gridEditRowsStateSelector)(apiRef.current.state);
399
- const row = apiRef.current.getRow(id);
403
+ const row = prevRowValuesLookup.current[id];
400
404
  const isSomeFieldProcessingProps = Object.values(editingState[id]).some(fieldProps => fieldProps.isProcessingProps);
401
405
  if (isSomeFieldProcessingProps) {
402
406
  prevRowModesModel.current[id].mode = _gridEditRowModel.GridRowModes.Edit;
@@ -413,11 +417,14 @@ const useGridRowEditing = (apiRef, props) => {
413
417
  const rowUpdate = apiRef.current.getRowWithUpdatedValuesFromRowEditing(id);
414
418
  if (processRowUpdate) {
415
419
  const handleError = errorThrown => {
416
- prevRowModesModel.current[id].mode = _gridEditRowModel.GridRowModes.Edit;
417
- // Revert the mode in the rowModesModel prop back to "edit"
418
- updateRowInRowModesModel(id, {
419
- mode: _gridEditRowModel.GridRowModes.Edit
420
- });
420
+ // The row might have been deleted
421
+ if (prevRowModesModel.current[id]) {
422
+ prevRowModesModel.current[id].mode = _gridEditRowModel.GridRowModes.Edit;
423
+ // Revert the mode in the rowModesModel prop back to "edit"
424
+ updateRowInRowModesModel(id, {
425
+ mode: _gridEditRowModel.GridRowModes.Edit
426
+ });
427
+ }
421
428
  if (onProcessRowUpdateError) {
422
429
  onProcessRowUpdateError(errorThrown);
423
430
  } else if (process.env.NODE_ENV !== 'production') {
@@ -548,10 +555,12 @@ const useGridRowEditing = (apiRef, props) => {
548
555
  if (!editingState[id]) {
549
556
  return apiRef.current.getRow(id);
550
557
  }
551
- let rowUpdate = (0, _extends2.default)({}, row);
558
+ let rowUpdate = (0, _extends2.default)({}, prevRowValuesLookup.current[id], row);
552
559
  Object.entries(editingState[id]).forEach(([field, fieldProps]) => {
553
560
  const column = apiRef.current.getColumn(field);
554
- if (column.valueSetter) {
561
+ // Column might have been removed
562
+ // see https://github.com/mui/mui-x/pull/16888
563
+ if (column?.valueSetter) {
555
564
  rowUpdate = column.valueSetter(fieldProps.value, rowUpdate, column, apiRef);
556
565
  } else {
557
566
  rowUpdate[field] = fieldProps.value;
@@ -114,12 +114,13 @@ const useGridPrintExport = (apiRef, props) => {
114
114
  gridClone.style.contain = 'size';
115
115
  let gridToolbarElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.toolbarContainer}`)?.offsetHeight || 0;
116
116
  let gridFooterElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.footerContainer}`)?.offsetHeight || 0;
117
+ const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
117
118
  if (normalizeOptions.hideToolbar) {
118
119
  gridClone.querySelector(`.${_gridClasses.gridClasses.toolbarContainer}`)?.remove();
119
120
  gridToolbarElementHeight = 0;
120
121
  }
121
- if (normalizeOptions.hideFooter) {
122
- gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`)?.remove();
122
+ if (normalizeOptions.hideFooter && gridFooterElement) {
123
+ gridFooterElement.remove();
123
124
  gridFooterElementHeight = 0;
124
125
  }
125
126
 
@@ -128,11 +129,10 @@ const useGridPrintExport = (apiRef, props) => {
128
129
  gridClone.style.height = `${computedTotalHeight}px`;
129
130
  // The height above does not include grid border width, so we need to exclude it
130
131
  gridClone.style.boxSizing = 'content-box';
131
- if (!normalizeOptions.hideFooter) {
132
+ if (!normalizeOptions.hideFooter && gridFooterElement) {
132
133
  // the footer is always being placed at the bottom of the page as if all rows are exported
133
134
  // so if getRowsToExport is being used to only export a subset of rows then we need to
134
135
  // adjust the footer position to be correctly placed at the bottom of the grid
135
- const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
136
136
  gridFooterElement.style.position = 'absolute';
137
137
  gridFooterElement.style.width = '100%';
138
138
  gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
@@ -237,6 +237,11 @@ const useGridFilter = (apiRef, props) => {
237
237
  */
238
238
  const stateExportPreProcessing = React.useCallback((prevState, context) => {
239
239
  const filterModelToExport = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
240
+
241
+ // Remove the additional `fromInput` property from the filter model
242
+ filterModelToExport.items.forEach(item => {
243
+ delete item.fromInput;
244
+ });
240
245
  const shouldExportFilterModel =
241
246
  // Always export if the `exportOnlyDirtyModels` property is not activated
242
247
  !context.exportOnlyDirtyModels ||
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.useGridRowSelection = exports.rowSelectionStateInitializer = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
+ var _utils = require("@mui/material/utils");
11
12
  var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
12
13
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
13
14
  var _useGridLogger = require("../../utils/useGridLogger");
@@ -24,7 +25,7 @@ var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
24
25
  var _constants = require("../../../internals/constants");
25
26
  var _gridClasses = require("../../../constants/gridClasses");
26
27
  var _domUtils = require("../../../utils/domUtils");
27
- var _utils = require("./utils");
28
+ var _utils2 = require("./utils");
28
29
  const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
29
30
  if (selectionModelProp == null) {
30
31
  return selectionModelProp;
@@ -72,7 +73,7 @@ const useGridRowSelection = (apiRef, props) => {
72
73
  disableRowSelectionOnClick,
73
74
  isRowSelectable: propIsRowSelectable
74
75
  } = props;
75
- const canHaveMultipleSelection = (0, _utils.isMultipleRowSelectionEnabled)(props);
76
+ const canHaveMultipleSelection = (0, _utils2.isMultipleRowSelectionEnabled)(props);
76
77
  const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
77
78
  const isNestedData = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowMaximumTreeDepthSelector) > 1;
78
79
  const expandMouseRowRangeSelection = React.useCallback(id => {
@@ -144,7 +145,7 @@ const useGridRowSelection = (apiRef, props) => {
144
145
  if (isSelected) {
145
146
  addRow(id);
146
147
  if (applyAutoSelection) {
147
- (0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
148
+ (0, _utils2.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
148
149
  }
149
150
  }
150
151
  apiRef.current.setRowSelectionModel(newSelection);
@@ -162,10 +163,10 @@ const useGridRowSelection = (apiRef, props) => {
162
163
  if (isSelected) {
163
164
  addRow(id);
164
165
  if (applyAutoSelection) {
165
- (0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
166
+ (0, _utils2.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
166
167
  }
167
168
  } else if (applyAutoSelection) {
168
- (0, _utils.findRowsToDeselect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
169
+ (0, _utils2.findRowsToDeselect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
169
170
  }
170
171
  const isSelectionValid = newSelection.size < 2 || canHaveMultipleSelection;
171
172
  if (isSelectionValid) {
@@ -185,7 +186,7 @@ const useGridRowSelection = (apiRef, props) => {
185
186
  newSelection.add(rowId);
186
187
  };
187
188
  selectableIds.forEach(id => {
188
- (0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
189
+ (0, _utils2.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
189
190
  });
190
191
  }
191
192
  } else {
@@ -207,12 +208,12 @@ const useGridRowSelection = (apiRef, props) => {
207
208
  if (isSelected) {
208
209
  newSelection.add(id);
209
210
  if (applyAutoSelection) {
210
- (0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
211
+ (0, _utils2.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
211
212
  }
212
213
  } else {
213
214
  removeRow(id);
214
215
  if (applyAutoSelection) {
215
- (0, _utils.findRowsToDeselect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
216
+ (0, _utils2.findRowsToDeselect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, removeRow);
216
217
  }
217
218
  }
218
219
  });
@@ -222,6 +223,19 @@ const useGridRowSelection = (apiRef, props) => {
222
223
  apiRef.current.setRowSelectionModel(Array.from(newSelection));
223
224
  }
224
225
  }, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents]);
226
+ const getPropagatedRowSelectionModel = React.useCallback(inputSelectionModel => {
227
+ if (!isNestedData || !applyAutoSelection || inputSelectionModel.length === 0) {
228
+ return inputSelectionModel;
229
+ }
230
+ const propagatedSelectionModel = new Set(inputSelectionModel);
231
+ const addRow = rowId => {
232
+ propagatedSelectionModel.add(rowId);
233
+ };
234
+ for (const id of inputSelectionModel) {
235
+ (0, _utils2.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow, propagatedSelectionModel);
236
+ }
237
+ return Array.from(propagatedSelectionModel);
238
+ }, [apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, isNestedData, applyAutoSelection]);
225
239
  const selectRowRange = React.useCallback(({
226
240
  startId,
227
241
  endId
@@ -248,7 +262,8 @@ const useGridRowSelection = (apiRef, props) => {
248
262
  };
249
263
  const selectionPrivateApi = {
250
264
  selectRows,
251
- selectRowRange
265
+ selectRowRange,
266
+ getPropagatedRowSelectionModel
252
267
  };
253
268
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, selectionPublicApi, 'public');
254
269
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, selectionPrivateApi, props.signature === _useGridApiEventHandler.GridSignature.DataGrid ? 'private' : 'public');
@@ -256,7 +271,11 @@ const useGridRowSelection = (apiRef, props) => {
256
271
  /*
257
272
  * EVENTS
258
273
  */
274
+ const isFirstRender = React.useRef(true);
259
275
  const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
276
+ if (isFirstRender.current) {
277
+ return;
278
+ }
260
279
  const currentSelection = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef.current.state);
261
280
  const rowsLookup = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef);
262
281
  const filteredRowsLookup = (0, _gridFilterSelector.gridFilteredRowsLookupSelector)(apiRef);
@@ -436,8 +455,27 @@ const useGridRowSelection = (apiRef, props) => {
436
455
  selectRows(apiRef.current.getAllRowIds(), true);
437
456
  }
438
457
  }, [apiRef, handleSingleRowSelection, selectRows, canHaveMultipleSelection]);
458
+ const syncControlledState = (0, _utils.useEventCallback)(() => {
459
+ if (!props.rowSelection) {
460
+ apiRef.current.setRowSelectionModel([]);
461
+ return;
462
+ }
463
+ if (propRowSelectionModel === undefined) {
464
+ return;
465
+ }
466
+ if (!applyAutoSelection || !isNestedData || propRowSelectionModel.length === 0) {
467
+ apiRef.current.setRowSelectionModel(propRowSelectionModel);
468
+ return;
469
+ }
470
+ const newSelectionModel = apiRef.current.getPropagatedRowSelectionModel(propRowSelectionModel);
471
+ if (newSelectionModel.length !== propRowSelectionModel.length || !newSelectionModel.every(id => propRowSelectionModel.includes(id))) {
472
+ apiRef.current.setRowSelectionModel(newSelectionModel);
473
+ return;
474
+ }
475
+ apiRef.current.setRowSelectionModel(propRowSelectionModel);
476
+ });
439
477
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', runIfRowSelectionIsEnabled(() => removeOutdatedSelection(true)));
440
- (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', runIfRowSelectionIsEnabled(removeOutdatedSelection));
478
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', runIfRowSelectionIsEnabled(() => removeOutdatedSelection()));
441
479
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'rowClick', runIfRowSelectionIsEnabled(handleRowClick));
442
480
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'rowSelectionCheckboxChange', runIfRowSelectionIsEnabled(handleRowSelectionCheckboxChange));
443
481
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
@@ -448,15 +486,8 @@ const useGridRowSelection = (apiRef, props) => {
448
486
  * EFFECTS
449
487
  */
450
488
  React.useEffect(() => {
451
- if (propRowSelectionModel !== undefined) {
452
- apiRef.current.setRowSelectionModel(propRowSelectionModel);
453
- }
454
- }, [apiRef, propRowSelectionModel, props.rowSelection]);
455
- React.useEffect(() => {
456
- if (!props.rowSelection) {
457
- apiRef.current.setRowSelectionModel([]);
458
- }
459
- }, [apiRef, props.rowSelection]);
489
+ syncControlledState();
490
+ }, [apiRef, propRowSelectionModel, props.rowSelection, syncControlledState]);
460
491
  const isStateControlled = propRowSelectionModel != null;
461
492
  React.useEffect(() => {
462
493
  if (isStateControlled || !props.rowSelection) {
@@ -485,5 +516,10 @@ const useGridRowSelection = (apiRef, props) => {
485
516
  React.useEffect(() => {
486
517
  runIfRowSelectionIsEnabled(removeOutdatedSelection);
487
518
  }, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
519
+ React.useEffect(() => {
520
+ if (isFirstRender.current) {
521
+ isFirstRender.current = false;
522
+ }
523
+ }, []);
488
524
  };
489
525
  exports.useGridRowSelection = useGridRowSelection;