@mui/x-data-grid 8.11.3 → 8.12.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 (154) hide show
  1. package/CHANGELOG.md +151 -6
  2. package/DataGrid/DataGrid.js +3 -1
  3. package/DataGrid/useDataGridComponent.js +2 -2
  4. package/colDef/gridActionsColDef.js +1 -0
  5. package/colDef/gridBooleanColDef.js +1 -0
  6. package/colDef/gridCheckboxSelectionColDef.js +1 -0
  7. package/colDef/gridStringColDef.js +1 -0
  8. package/components/cell/GridCell.js +7 -5
  9. package/constants/localeTextConstants.js +29 -0
  10. package/esm/DataGrid/DataGrid.js +3 -1
  11. package/esm/DataGrid/useDataGridComponent.js +2 -2
  12. package/esm/colDef/gridActionsColDef.js +1 -0
  13. package/esm/colDef/gridBooleanColDef.js +1 -0
  14. package/esm/colDef/gridCheckboxSelectionColDef.js +1 -0
  15. package/esm/colDef/gridStringColDef.js +1 -0
  16. package/esm/components/cell/GridCell.js +7 -5
  17. package/esm/constants/localeTextConstants.js +29 -0
  18. package/esm/hooks/features/columnResize/useGridColumnResize.js +2 -2
  19. package/esm/hooks/features/columns/useGridColumns.js +21 -4
  20. package/esm/hooks/features/filter/gridFilterSelector.d.ts +12 -4
  21. package/esm/hooks/features/filter/gridFilterSelector.js +21 -4
  22. package/esm/hooks/features/filter/gridFilterState.d.ts +3 -1
  23. package/esm/hooks/features/filter/gridFilterUtils.d.ts +3 -3
  24. package/esm/hooks/features/filter/gridFilterUtils.js +23 -13
  25. package/esm/hooks/features/filter/useGridFilter.d.ts +2 -1
  26. package/esm/hooks/features/filter/useGridFilter.js +7 -5
  27. package/esm/hooks/features/rows/gridRowsSelector.d.ts +3 -0
  28. package/esm/hooks/features/rows/gridRowsSelector.js +4 -0
  29. package/esm/hooks/features/rows/useGridParamsApi.js +16 -7
  30. package/esm/hooks/features/sorting/gridSortingUtils.d.ts +3 -1
  31. package/esm/hooks/features/sorting/gridSortingUtils.js +10 -4
  32. package/esm/hooks/features/sorting/useGridSorting.d.ts +2 -1
  33. package/esm/hooks/features/sorting/useGridSorting.js +4 -3
  34. package/esm/index.js +1 -1
  35. package/esm/internals/index.d.ts +1 -1
  36. package/esm/internals/index.js +1 -1
  37. package/esm/locales/arSD.js +31 -0
  38. package/esm/locales/beBY.js +31 -0
  39. package/esm/locales/bgBG.js +31 -0
  40. package/esm/locales/bnBD.js +31 -0
  41. package/esm/locales/csCZ.js +31 -0
  42. package/esm/locales/daDK.js +31 -0
  43. package/esm/locales/deDE.js +32 -0
  44. package/esm/locales/elGR.js +31 -0
  45. package/esm/locales/esES.js +31 -0
  46. package/esm/locales/faIR.js +31 -0
  47. package/esm/locales/fiFI.js +31 -0
  48. package/esm/locales/frFR.js +32 -2
  49. package/esm/locales/heIL.js +31 -0
  50. package/esm/locales/hrHR.js +31 -0
  51. package/esm/locales/huHU.js +31 -0
  52. package/esm/locales/hyAM.js +31 -0
  53. package/esm/locales/idID.d.ts +1 -1
  54. package/esm/locales/idID.js +32 -0
  55. package/esm/locales/isIS.js +31 -0
  56. package/esm/locales/itIT.js +31 -0
  57. package/esm/locales/jaJP.js +31 -0
  58. package/esm/locales/koKR.js +31 -0
  59. package/esm/locales/nbNO.js +31 -0
  60. package/esm/locales/nlNL.js +31 -0
  61. package/esm/locales/nnNO.js +32 -0
  62. package/esm/locales/plPL.js +31 -0
  63. package/esm/locales/ptBR.js +31 -0
  64. package/esm/locales/ptPT.js +31 -0
  65. package/esm/locales/roRO.js +31 -0
  66. package/esm/locales/ruRU.js +31 -0
  67. package/esm/locales/skSK.js +31 -0
  68. package/esm/locales/svSE.js +31 -0
  69. package/esm/locales/trTR.js +31 -0
  70. package/esm/locales/ukUA.js +31 -0
  71. package/esm/locales/urPK.js +31 -0
  72. package/esm/locales/viVN.js +31 -0
  73. package/esm/locales/zhCN.js +31 -0
  74. package/esm/locales/zhHK.js +31 -0
  75. package/esm/locales/zhTW.js +31 -0
  76. package/esm/material/augmentation.d.ts +8 -0
  77. package/esm/material/index.js +122 -24
  78. package/esm/models/api/gridLocaleTextApi.d.ts +27 -0
  79. package/esm/models/api/gridParamsApi.d.ts +5 -1
  80. package/esm/models/configuration/gridAggregationConfiguration.d.ts +25 -0
  81. package/esm/models/configuration/gridAggregationConfiguration.js +1 -0
  82. package/esm/models/configuration/gridConfiguration.d.ts +6 -9
  83. package/esm/models/gridBaseSlots.d.ts +15 -0
  84. package/esm/models/gridSlotsComponent.d.ts +10 -0
  85. package/esm/models/gridSlotsComponentsProps.d.ts +5 -1
  86. package/hooks/features/columnResize/useGridColumnResize.js +2 -2
  87. package/hooks/features/columns/useGridColumns.js +23 -6
  88. package/hooks/features/filter/gridFilterSelector.d.ts +12 -4
  89. package/hooks/features/filter/gridFilterSelector.js +22 -5
  90. package/hooks/features/filter/gridFilterState.d.ts +3 -1
  91. package/hooks/features/filter/gridFilterUtils.d.ts +3 -3
  92. package/hooks/features/filter/gridFilterUtils.js +23 -13
  93. package/hooks/features/filter/useGridFilter.d.ts +2 -1
  94. package/hooks/features/filter/useGridFilter.js +7 -5
  95. package/hooks/features/rows/gridRowsSelector.d.ts +3 -0
  96. package/hooks/features/rows/gridRowsSelector.js +4 -0
  97. package/hooks/features/rows/useGridParamsApi.js +16 -7
  98. package/hooks/features/sorting/gridSortingUtils.d.ts +3 -1
  99. package/hooks/features/sorting/gridSortingUtils.js +10 -4
  100. package/hooks/features/sorting/useGridSorting.d.ts +2 -1
  101. package/hooks/features/sorting/useGridSorting.js +4 -3
  102. package/index.js +1 -1
  103. package/internals/index.d.ts +1 -1
  104. package/internals/index.js +7 -0
  105. package/locales/arSD.js +31 -0
  106. package/locales/beBY.js +31 -0
  107. package/locales/bgBG.js +31 -0
  108. package/locales/bnBD.js +31 -0
  109. package/locales/csCZ.js +31 -0
  110. package/locales/daDK.js +31 -0
  111. package/locales/deDE.js +32 -0
  112. package/locales/elGR.js +31 -0
  113. package/locales/esES.js +31 -0
  114. package/locales/faIR.js +31 -0
  115. package/locales/fiFI.js +31 -0
  116. package/locales/frFR.js +32 -2
  117. package/locales/heIL.js +31 -0
  118. package/locales/hrHR.js +31 -0
  119. package/locales/huHU.js +31 -0
  120. package/locales/hyAM.js +31 -0
  121. package/locales/idID.d.ts +1 -1
  122. package/locales/idID.js +32 -0
  123. package/locales/isIS.js +31 -0
  124. package/locales/itIT.js +31 -0
  125. package/locales/jaJP.js +31 -0
  126. package/locales/koKR.js +31 -0
  127. package/locales/nbNO.js +31 -0
  128. package/locales/nlNL.js +31 -0
  129. package/locales/nnNO.js +32 -0
  130. package/locales/plPL.js +31 -0
  131. package/locales/ptBR.js +31 -0
  132. package/locales/ptPT.js +31 -0
  133. package/locales/roRO.js +31 -0
  134. package/locales/ruRU.js +31 -0
  135. package/locales/skSK.js +31 -0
  136. package/locales/svSE.js +31 -0
  137. package/locales/trTR.js +31 -0
  138. package/locales/ukUA.js +31 -0
  139. package/locales/urPK.js +31 -0
  140. package/locales/viVN.js +31 -0
  141. package/locales/zhCN.js +31 -0
  142. package/locales/zhHK.js +31 -0
  143. package/locales/zhTW.js +31 -0
  144. package/material/augmentation.d.ts +8 -0
  145. package/material/index.js +122 -24
  146. package/models/api/gridLocaleTextApi.d.ts +27 -0
  147. package/models/api/gridParamsApi.d.ts +5 -1
  148. package/models/configuration/gridAggregationConfiguration.d.ts +25 -0
  149. package/models/configuration/gridAggregationConfiguration.js +5 -0
  150. package/models/configuration/gridConfiguration.d.ts +6 -9
  151. package/models/gridBaseSlots.d.ts +15 -0
  152. package/models/gridSlotsComponent.d.ts +10 -0
  153. package/models/gridSlotsComponentsProps.d.ts +5 -1
  154. package/package.json +3 -3
@@ -35,6 +35,9 @@ const zhTWGrid = {
35
35
  // Toolbar pivot button
36
36
  // toolbarPivot: 'Pivot',
37
37
 
38
+ // Toolbar charts button
39
+ // toolbarCharts: 'Charts',
40
+
38
41
  // Toolbar AI Assistant button
39
42
  // toolbarAssistant: 'AI Assistant',
40
43
 
@@ -115,6 +118,7 @@ const zhTWGrid = {
115
118
  columnMenuSortAsc: '升序',
116
119
  columnMenuSortDesc: '降序',
117
120
  // columnMenuManagePivot: 'Manage pivot',
121
+ // columnMenuManageCharts: 'Manage charts',
118
122
 
119
123
  // Column header text
120
124
  columnHeaderFiltersTooltipActive: count => `${count} 個篩選器`,
@@ -183,6 +187,7 @@ const zhTWGrid = {
183
187
  rowReorderingHeaderName: '排序',
184
188
  // Aggregation
185
189
  aggregationMenuItemHeader: '集合',
190
+ // aggregationFunctionLabelNone: 'none',
186
191
  aggregationFunctionLabelSum: '總數',
187
192
  aggregationFunctionLabelAvg: '平均數',
188
193
  aggregationFunctionLabelMin: '最小',
@@ -217,6 +222,32 @@ const zhTWGrid = {
217
222
  // pivotYearColumnHeaderName: '(Year)',
218
223
  // pivotQuarterColumnHeaderName: '(Quarter)',
219
224
 
225
+ // Charts configuration panel
226
+ // chartsNoCharts: 'There are no charts available',
227
+ // chartsChartNotSelected: 'Select a chart type to configure its options',
228
+ // chartsTabChart: 'Chart',
229
+ // chartsTabFields: 'Fields',
230
+ // chartsTabCustomize: 'Customize',
231
+ // chartsCloseButton: 'Close charts configuration',
232
+ // chartsSyncButtonLabel: 'Sync chart',
233
+ // chartsSearchPlaceholder: 'Search fields',
234
+ // chartsSearchLabel: 'Search fields',
235
+ // chartsSearchClear: 'Clear search',
236
+ // chartsNoFields: 'No fields',
237
+ // chartsFieldBlocked: 'This field cannot be added to any section',
238
+ // chartsCategories: 'Categories',
239
+ // chartsSeries: 'Series',
240
+ // chartsMenuAddToDimensions: (dimensionLabel: string) => `Add to ${dimensionLabel}`,
241
+ // chartsMenuAddToValues: (valuesLabel: string) => `Add to ${valuesLabel}`,
242
+ // chartsMenuMoveUp: 'Move up',
243
+ // chartsMenuMoveDown: 'Move down',
244
+ // chartsMenuMoveToTop: 'Move to top',
245
+ // chartsMenuMoveToBottom: 'Move to bottom',
246
+ // chartsMenuOptions: 'Field options',
247
+ // chartsMenuRemove: 'Remove',
248
+ // chartsDragToDimensions: (dimensionLabel: string) => `Drag here to use column as ${dimensionLabel}`,
249
+ // chartsDragToValues: (valuesLabel: string) => `Drag here to use column as ${valuesLabel}`,
250
+
220
251
  // AI Assistant panel
221
252
  // aiAssistantPanelTitle: 'AI Assistant',
222
253
  // aiAssistantPanelClose: 'Close AI Assistant',
@@ -17,6 +17,8 @@ import type { TooltipProps } from '@mui/material/Tooltip';
17
17
  import type { InputProps } from '@mui/material/Input';
18
18
  import type { SelectProps } from '@mui/material/Select';
19
19
  import type { SkeletonProps } from '@mui/material/Skeleton';
20
+ import type { ToggleButtonProps } from '@mui/material/ToggleButton';
21
+ import type { TabsProps } from '@mui/material/Tabs';
20
22
  declare module '@mui/x-data-grid' {
21
23
  interface BaseAutocompletePropsOverrides {
22
24
  material?: Partial<AutocompleteProps<string, true, false, true>>;
@@ -54,6 +56,12 @@ declare module '@mui/x-data-grid' {
54
56
  interface BaseButtonPropsOverrides {
55
57
  material?: Partial<ButtonProps>;
56
58
  }
59
+ interface BaseToggleButtonPropsOverrides {
60
+ material?: Partial<ToggleButtonProps>;
61
+ }
62
+ interface BaseTabsPropsOverrides {
63
+ material?: Partial<TabsProps>;
64
+ }
57
65
  interface BaseIconButtonPropsOverrides {
58
66
  material?: Partial<IconButtonProps>;
59
67
  }
@@ -12,16 +12,19 @@ const _excluded = ["id", "label", "labelId", "material", "disabled", "slotProps"
12
12
  _excluded0 = ["material"],
13
13
  _excluded1 = ["material"],
14
14
  _excluded10 = ["material"],
15
- _excluded11 = ["material", "label", "className"],
16
- _excluded12 = ["material"],
17
- _excluded13 = ["inert", "iconStart", "iconEnd", "children", "material"],
18
- _excluded14 = ["slotProps", "material"],
19
- _excluded15 = ["id", "multiple", "freeSolo", "options", "getOptionLabel", "isOptionEqualToValue", "value", "onChange", "label", "placeholder", "slotProps", "material"],
20
- _excluded16 = ["key"],
21
- _excluded17 = ["inputProps", "InputProps", "InputLabelProps"],
22
- _excluded18 = ["slotProps", "material"],
23
- _excluded19 = ["ref", "open", "children", "className", "clickAwayTouchEvent", "clickAwayMouseEvent", "flip", "focusTrap", "onExited", "onClickAway", "onDidShow", "onDidHide", "id", "target", "transition", "placement", "material"],
24
- _excluded20 = ["native"];
15
+ _excluded11 = ["material"],
16
+ _excluded12 = ["material", "label", "className"],
17
+ _excluded13 = ["material"],
18
+ _excluded14 = ["inert", "iconStart", "iconEnd", "children", "material"],
19
+ _excluded15 = ["slotProps", "material"],
20
+ _excluded16 = ["id", "multiple", "freeSolo", "options", "getOptionLabel", "isOptionEqualToValue", "value", "onChange", "label", "placeholder", "slotProps", "material"],
21
+ _excluded17 = ["key"],
22
+ _excluded18 = ["inputProps", "InputProps", "InputLabelProps"],
23
+ _excluded19 = ["slotProps", "material"],
24
+ _excluded20 = ["ref", "open", "children", "className", "clickAwayTouchEvent", "clickAwayMouseEvent", "flip", "focusTrap", "onExited", "onClickAway", "onDidShow", "onDidHide", "id", "target", "transition", "placement", "material"],
25
+ _excluded21 = ["native"],
26
+ _excluded22 = ["children", "value", "active"],
27
+ _excluded23 = ["items", "value", "material"];
25
28
  import * as React from 'react';
26
29
  import clsx from 'clsx';
27
30
  import useForkRef from '@mui/utils/useForkRef';
@@ -56,7 +59,11 @@ import MUIGrow from '@mui/material/Grow';
56
59
  import MUIPaper from '@mui/material/Paper';
57
60
  import MUIInputLabel from '@mui/material/InputLabel';
58
61
  import MUISkeleton from '@mui/material/Skeleton';
62
+ import MUITabs from '@mui/material/Tabs';
63
+ import MUITab from '@mui/material/Tab';
64
+ import MUIToggleButton from '@mui/material/ToggleButton';
59
65
  import { forwardRef } from '@mui/x-internals/forwardRef';
66
+ import useId from '@mui/utils/useId';
60
67
  import { GridAddIcon, GridArrowDownwardIcon, GridArrowUpwardIcon, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridDragIcon, GridExpandMoreIcon, GridFilterAltIcon, GridFilterListIcon, GridKeyboardArrowRight, GridMoreVertIcon, GridRemoveIcon, GridSearchIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon, GridLoadIcon, GridDeleteForeverIcon, GridDownloadIcon } from "./icons/index.js";
61
68
  import { GridColumnUnsortedIcon } from "../components/GridColumnUnsortedIcon.js";
62
69
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
@@ -323,11 +330,30 @@ const BaseButton = forwardRef(function BaseButton(props, ref) {
323
330
  }));
324
331
  });
325
332
  if (process.env.NODE_ENV !== "production") BaseButton.displayName = "BaseButton";
333
+ const StyledToggleButton = styled(MUIToggleButton)(({
334
+ theme
335
+ }) => ({
336
+ gap: theme.spacing(1),
337
+ border: 0
338
+ }));
339
+ const BaseToggleButton = forwardRef(function BaseToggleButton(props, ref) {
340
+ const {
341
+ material
342
+ } = props,
343
+ rest = _objectWithoutPropertiesLoose(props, _excluded9);
344
+ return /*#__PURE__*/_jsx(StyledToggleButton, _extends({
345
+ size: "small",
346
+ color: "primary"
347
+ }, rest, material, {
348
+ ref: ref
349
+ }));
350
+ });
351
+ if (process.env.NODE_ENV !== "production") BaseToggleButton.displayName = "BaseToggleButton";
326
352
  const BaseChip = forwardRef(function BaseChip(props, ref) {
327
353
  const {
328
354
  material
329
355
  } = props,
330
- other = _objectWithoutPropertiesLoose(props, _excluded9);
356
+ other = _objectWithoutPropertiesLoose(props, _excluded0);
331
357
  return /*#__PURE__*/_jsx(MUIChip, _extends({}, other, material, {
332
358
  ref: ref
333
359
  }));
@@ -337,7 +363,7 @@ const BaseIconButton = forwardRef(function BaseIconButton(props, ref) {
337
363
  const {
338
364
  material
339
365
  } = props,
340
- other = _objectWithoutPropertiesLoose(props, _excluded0);
366
+ other = _objectWithoutPropertiesLoose(props, _excluded1);
341
367
  return /*#__PURE__*/_jsx(MUIIconButton, _extends({}, other, material, {
342
368
  ref: ref
343
369
  }));
@@ -347,7 +373,7 @@ const BaseTooltip = forwardRef(function BaseTooltip(props, ref) {
347
373
  const {
348
374
  material
349
375
  } = props,
350
- other = _objectWithoutPropertiesLoose(props, _excluded1);
376
+ other = _objectWithoutPropertiesLoose(props, _excluded10);
351
377
  return /*#__PURE__*/_jsx(MUITooltip, _extends({}, other, material, {
352
378
  ref: ref
353
379
  }));
@@ -357,7 +383,7 @@ const BaseSkeleton = forwardRef(function BaseSkeleton(props, ref) {
357
383
  const {
358
384
  material
359
385
  } = props,
360
- other = _objectWithoutPropertiesLoose(props, _excluded10);
386
+ other = _objectWithoutPropertiesLoose(props, _excluded11);
361
387
  return /*#__PURE__*/_jsx(MUISkeleton, _extends({}, other, material, {
362
388
  ref: ref
363
389
  }));
@@ -369,7 +395,7 @@ const BaseSwitch = forwardRef(function BaseSwitch(props, ref) {
369
395
  label,
370
396
  className
371
397
  } = props,
372
- other = _objectWithoutPropertiesLoose(props, _excluded11);
398
+ other = _objectWithoutPropertiesLoose(props, _excluded12);
373
399
  if (!label) {
374
400
  return /*#__PURE__*/_jsx(MUISwitch, _extends({}, other, material, {
375
401
  className: className,
@@ -389,7 +415,7 @@ const BaseMenuList = forwardRef(function BaseMenuList(props, ref) {
389
415
  const {
390
416
  material
391
417
  } = props,
392
- other = _objectWithoutPropertiesLoose(props, _excluded12);
418
+ other = _objectWithoutPropertiesLoose(props, _excluded13);
393
419
  return /*#__PURE__*/_jsx(MUIMenuList, _extends({}, other, material, {
394
420
  ref: ref
395
421
  }));
@@ -403,7 +429,7 @@ function BaseMenuItem(props) {
403
429
  children,
404
430
  material
405
431
  } = props,
406
- other = _objectWithoutPropertiesLoose(props, _excluded13);
432
+ other = _objectWithoutPropertiesLoose(props, _excluded14);
407
433
  if (inert) {
408
434
  other.disableRipple = true;
409
435
  }
@@ -422,7 +448,7 @@ function BaseTextField(props) {
422
448
  slotProps,
423
449
  material
424
450
  } = props,
425
- other = _objectWithoutPropertiesLoose(props, _excluded14);
451
+ other = _objectWithoutPropertiesLoose(props, _excluded15);
426
452
  return /*#__PURE__*/_jsx(MUITextField, _extends({
427
453
  variant: "outlined"
428
454
  }, other, material, {
@@ -449,7 +475,7 @@ function BaseAutocomplete(props) {
449
475
  slotProps,
450
476
  material
451
477
  } = props,
452
- other = _objectWithoutPropertiesLoose(props, _excluded15);
478
+ other = _objectWithoutPropertiesLoose(props, _excluded16);
453
479
  return /*#__PURE__*/_jsx(MUIAutocomplete, _extends({
454
480
  id: id,
455
481
  multiple: multiple,
@@ -466,7 +492,7 @@ function BaseAutocomplete(props) {
466
492
  {
467
493
  key
468
494
  } = _getTagProps,
469
- tagProps = _objectWithoutPropertiesLoose(_getTagProps, _excluded16);
495
+ tagProps = _objectWithoutPropertiesLoose(_getTagProps, _excluded17);
470
496
  return /*#__PURE__*/_jsx(MUIChip, _extends({
471
497
  variant: "outlined",
472
498
  size: "small",
@@ -479,7 +505,7 @@ function BaseAutocomplete(props) {
479
505
  InputProps,
480
506
  InputLabelProps
481
507
  } = params,
482
- inputRest = _objectWithoutPropertiesLoose(params, _excluded17);
508
+ inputRest = _objectWithoutPropertiesLoose(params, _excluded18);
483
509
  return /*#__PURE__*/_jsx(MUITextField, _extends({}, inputRest, {
484
510
  label: label,
485
511
  placeholder: placeholder,
@@ -503,7 +529,7 @@ function transformInputProps(props, wrapAdornments = true) {
503
529
  slotProps,
504
530
  material
505
531
  } = props,
506
- other = _objectWithoutPropertiesLoose(props, _excluded18);
532
+ other = _objectWithoutPropertiesLoose(props, _excluded19);
507
533
  const result = other;
508
534
  if (wrapAdornments) {
509
535
  if (result.startAdornment) {
@@ -552,7 +578,7 @@ function BasePopper(props) {
552
578
  placement,
553
579
  material
554
580
  } = props,
555
- other = _objectWithoutPropertiesLoose(props, _excluded19);
581
+ other = _objectWithoutPropertiesLoose(props, _excluded20);
556
582
  const modifiers = React.useMemo(() => {
557
583
  const result = [{
558
584
  name: 'preventOverflow',
@@ -650,12 +676,82 @@ function BaseSelectOption(_ref) {
650
676
  let {
651
677
  native
652
678
  } = _ref,
653
- props = _objectWithoutPropertiesLoose(_ref, _excluded20);
679
+ props = _objectWithoutPropertiesLoose(_ref, _excluded21);
654
680
  if (native) {
655
681
  return /*#__PURE__*/_jsx("option", _extends({}, props));
656
682
  }
657
683
  return /*#__PURE__*/_jsx(MUIMenuItem, _extends({}, props));
658
684
  }
685
+ const StyledTabs = styled(MUITabs, {
686
+ name: 'MuiDataGrid',
687
+ slot: 'Tabs'
688
+ })(({
689
+ theme
690
+ }) => ({
691
+ borderBottom: `1px solid ${theme.palette.divider}`
692
+ }));
693
+ const StyledTab = styled(MUITab, {
694
+ name: 'MuiDataGrid',
695
+ slot: 'Tab'
696
+ })({
697
+ flex: 1,
698
+ minWidth: 'fit-content'
699
+ });
700
+ const StyledTabPanel = styled('div', {
701
+ name: 'MuiDataGrid',
702
+ slot: 'TabPanel'
703
+ })({
704
+ flex: 1,
705
+ display: 'flex',
706
+ flexDirection: 'column',
707
+ overflow: 'hidden'
708
+ });
709
+ function TabPanel(props) {
710
+ const {
711
+ children,
712
+ active
713
+ } = props,
714
+ other = _objectWithoutPropertiesLoose(props, _excluded22);
715
+ return /*#__PURE__*/_jsx(StyledTabPanel, _extends({
716
+ role: "tabpanel",
717
+ style: {
718
+ display: active ? 'flex' : 'none'
719
+ }
720
+ }, other, {
721
+ children: children
722
+ }));
723
+ }
724
+ function BaseTabs(_ref2) {
725
+ let {
726
+ items,
727
+ value,
728
+ material
729
+ } = _ref2,
730
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded23);
731
+ const id = useId();
732
+ const labelId = `${id}-tab-${value}`;
733
+ const panelId = `${id}-tabpanel-${value}`;
734
+ return /*#__PURE__*/_jsxs(React.Fragment, {
735
+ children: [/*#__PURE__*/_jsx(StyledTabs, _extends({}, props, {
736
+ value: value,
737
+ variant: "scrollable",
738
+ scrollButtons: "auto"
739
+ }, material, {
740
+ children: items.map(item => /*#__PURE__*/_jsx(StyledTab, {
741
+ value: item.value,
742
+ label: item.label,
743
+ id: labelId,
744
+ "aria-controls": panelId
745
+ }, item.value))
746
+ })), items.map(item => /*#__PURE__*/_jsx(TabPanel, {
747
+ value: item.value,
748
+ active: value === item.value,
749
+ id: panelId,
750
+ "aria-labelledby": labelId,
751
+ children: item.children
752
+ }, item.value))]
753
+ });
754
+ }
659
755
  const iconSlots = {
660
756
  booleanCellTrueIcon: GridCheckIcon,
661
757
  booleanCellFalseIcon: GridCloseIcon,
@@ -709,7 +805,9 @@ const baseSlots = {
709
805
  baseTextField: BaseTextField,
710
806
  baseButton: BaseButton,
711
807
  baseIconButton: BaseIconButton,
808
+ baseToggleButton: BaseToggleButton,
712
809
  baseTooltip: BaseTooltip,
810
+ baseTabs: BaseTabs,
713
811
  basePagination: BasePagination,
714
812
  basePopper: BasePopper,
715
813
  baseSelect: BaseSelect,
@@ -30,6 +30,7 @@ export interface GridLocaleText {
30
30
  toolbarExportPrint: React.ReactNode;
31
31
  toolbarExportExcel: string;
32
32
  toolbarPivot: string;
33
+ toolbarCharts: string;
33
34
  toolbarAssistant: React.ReactNode;
34
35
  columnsManagementSearchTitle: string;
35
36
  columnsManagementNoColumns: string;
@@ -102,6 +103,7 @@ export interface GridLocaleText {
102
103
  columnMenuSortAsc: React.ReactNode | ((colDef: GridColDef) => React.ReactNode);
103
104
  columnMenuSortDesc: React.ReactNode | ((colDef: GridColDef) => React.ReactNode);
104
105
  columnMenuManagePivot: string;
106
+ columnMenuManageCharts: string;
105
107
  columnHeaderFiltersTooltipActive: (count: number) => React.ReactNode;
106
108
  columnHeaderFiltersLabel: string;
107
109
  columnHeaderSortIconLabel: string;
@@ -130,6 +132,7 @@ export interface GridLocaleText {
130
132
  collapseDetailPanel: string;
131
133
  rowReorderingHeaderName: string;
132
134
  aggregationMenuItemHeader: string;
135
+ aggregationFunctionLabelNone: string;
133
136
  aggregationFunctionLabelSum: string;
134
137
  aggregationFunctionLabelAvg: string;
135
138
  aggregationFunctionLabelMin: string;
@@ -170,6 +173,30 @@ export interface GridLocaleText {
170
173
  pivotDragToValues: string;
171
174
  pivotYearColumnHeaderName: string;
172
175
  pivotQuarterColumnHeaderName: string;
176
+ chartsNoCharts: string;
177
+ chartsChartNotSelected: string;
178
+ chartsTabChart: string;
179
+ chartsTabFields: string;
180
+ chartsTabCustomize: string;
181
+ chartsCloseButton: string;
182
+ chartsSyncButtonLabel: string;
183
+ chartsSearchPlaceholder: string;
184
+ chartsSearchLabel: string;
185
+ chartsSearchClear: string;
186
+ chartsNoFields: string;
187
+ chartsFieldBlocked: string;
188
+ chartsCategories: string;
189
+ chartsSeries: string;
190
+ chartsMenuAddToDimensions: (dimensionLabel: string) => string;
191
+ chartsMenuAddToValues: (valuesLabel: string) => string;
192
+ chartsMenuMoveUp: string;
193
+ chartsMenuMoveDown: string;
194
+ chartsMenuMoveToTop: string;
195
+ chartsMenuMoveToBottom: string;
196
+ chartsMenuOptions: string;
197
+ chartsMenuRemove: string;
198
+ chartsDragToDimensions: (dimensionLabel: string) => string;
199
+ chartsDragToValues: (valuesLabel: string) => string;
173
200
  aiAssistantPanelTitle: string;
174
201
  aiAssistantPanelClose: string;
175
202
  aiAssistantPanelConversationHistory: string;
@@ -96,12 +96,16 @@ export interface GridParamsPrivateApi {
96
96
  colDef,
97
97
  hasFocus,
98
98
  rowNode,
99
- tabIndex
99
+ tabIndex,
100
+ value,
101
+ formattedValue
100
102
  }: {
101
103
  cellMode: GridCellMode;
102
104
  colDef: GridStateColDef;
103
105
  hasFocus: boolean;
104
106
  rowNode: N;
105
107
  tabIndex: 0 | -1;
108
+ value?: V;
109
+ formattedValue?: F;
106
110
  }) => GridCellParams<R, V, F, N>;
107
111
  }
@@ -0,0 +1,25 @@
1
+ import { RefObject } from '@mui/x-internals/types';
2
+ import type { GridRowId, GridRowModel } from "../gridRows.js";
3
+ import { GridColDef } from "../colDef/index.js";
4
+ /**
5
+ * Get the cell aggregation result
6
+ * @param {GridRowId} id The row id
7
+ * @param {string} field The field
8
+ * @returns { { position: 'footer' | 'inline'; value: any } | null } The cell aggregation result
9
+ */
10
+ export type GetCellAggregationResultFn = (id: GridRowId, field: string) => {
11
+ position: 'footer' | 'inline';
12
+ value: any;
13
+ formattedValue?: any;
14
+ } | null;
15
+ export type SortValueGetterFn = (id: GridRowId, field: string) => any;
16
+ export type FilterValueGetterFn = (row: GridRowModel, colDef: GridColDef) => any;
17
+ export interface GridAggregationInternalHooks<Api, Props> {
18
+ useCellAggregationResult: GetCellAggregationResultFn;
19
+ /**
20
+ * @param {RefObject<Api>} apiRef The API reference
21
+ * @returns {SortValueGetterFn} The function to get the value to sort by
22
+ */
23
+ useSortValueGetter: (apiRef: RefObject<Api>) => SortValueGetterFn;
24
+ useFilterValueGetter: (apiRef: RefObject<Api>, props: Props) => FilterValueGetterFn;
25
+ }
@@ -1,22 +1,19 @@
1
1
  import * as React from 'react';
2
- import { GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInternalHook } from "./gridRowConfiguration.js";
2
+ import type { GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInternalHook } from "./gridRowConfiguration.js";
3
+ import type { GridAggregationInternalHooks } from "./gridAggregationConfiguration.js";
3
4
  import type { GridCSSVariablesInterface } from "../../constants/cssVariables.js";
4
- import type { GridRowId } from "../gridRows.js";
5
+ import { DataGridProcessedProps } from "../props/DataGridProps.js";
5
6
  import type { GridPrivateApiCommon } from "../api/gridApiCommon.js";
6
7
  import type { GridPrivateApiCommunity } from "../api/gridApiCommunity.js";
7
8
  export interface GridAriaAttributesInternalHook {
8
9
  useGridAriaAttributes: () => React.HTMLAttributes<HTMLElement>;
9
10
  }
10
- export interface GridInternalHook<Api> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInternalHook<Api> {
11
+ export interface GridInternalHook<Api, Props> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridAggregationInternalHooks<Api, Props>, GridRowsOverridableMethodsInternalHook<Api> {
11
12
  useCSSVariables: () => {
12
13
  id: string;
13
14
  variables: GridCSSVariablesInterface;
14
15
  };
15
- useCellAggregationResult: (id: GridRowId, field: string) => {
16
- position: 'footer' | 'inline';
17
- value: any;
18
- } | null;
19
16
  }
20
- export interface GridConfiguration<Api extends GridPrivateApiCommon = GridPrivateApiCommunity> {
21
- hooks: GridInternalHook<Api>;
17
+ export interface GridConfiguration<Api extends GridPrivateApiCommon = GridPrivateApiCommunity, Props = DataGridProcessedProps> {
18
+ hooks: GridInternalHook<Api, Props>;
22
19
  }
@@ -116,6 +116,10 @@ export type IconButtonProps = Omit<ButtonProps, 'startIcon'> & {
116
116
  color?: 'default' | 'inherit' | 'primary';
117
117
  edge?: 'start' | 'end' | false;
118
118
  };
119
+ export type ToggleButtonProps = CommonProps & {
120
+ selected?: boolean;
121
+ value: string;
122
+ };
119
123
  export type DividerProps = {
120
124
  className?: string;
121
125
  orientation?: 'horizontal' | 'vertical';
@@ -236,6 +240,17 @@ export type SwitchProps = CommonProps & {
236
240
  onChange?: React.ChangeEventHandler;
237
241
  size?: 'small' | 'medium';
238
242
  label?: React.ReactNode;
243
+ disabled?: boolean;
244
+ title?: string;
245
+ };
246
+ export type TabsProps = Omit<CommonProps, 'onChange'> & {
247
+ items: {
248
+ value: string;
249
+ label: string;
250
+ children: React.ReactNode;
251
+ }[];
252
+ value: string;
253
+ onChange: (event: React.SyntheticEvent, value: string) => void;
239
254
  };
240
255
  export type TextFieldProps = CommonProps & {
241
256
  role?: string;
@@ -73,6 +73,11 @@ export interface GridBaseSlots {
73
73
  * @default Input
74
74
  */
75
75
  baseInput: React.JSXElementConstructor<GridSlotProps['baseInput']>;
76
+ /**
77
+ * The custom ToggleButton component used in the grid.
78
+ * @default ToggleButton
79
+ */
80
+ baseToggleButton: React.JSXElementConstructor<GridSlotProps['baseToggleButton']>;
76
81
  /**
77
82
  * The custom Tooltip component used in the grid.
78
83
  * @default Tooltip
@@ -103,6 +108,11 @@ export interface GridBaseSlots {
103
108
  * @default Switch
104
109
  */
105
110
  baseSwitch: React.JSXElementConstructor<GridSlotProps['baseSwitch']>;
111
+ /**
112
+ * The custom Tabs component used in the grid.
113
+ * @default Tabs
114
+ */
115
+ baseTabs: React.JSXElementConstructor<GridSlotProps['baseTabs']>;
106
116
  }
107
117
  /**
108
118
  * Grid components React prop interface containing all the overridable components.
@@ -18,7 +18,7 @@ import type { GridLoadingOverlayProps } from "../components/GridLoadingOverlay.j
18
18
  import type { GridRowCountProps } from "../components/GridRowCount.js";
19
19
  import type { GridColumnHeaderSortIconProps } from "../components/columnHeaders/GridColumnHeaderSortIcon.js";
20
20
  import type { GridBottomContainerProps } from "../components/virtualization/GridBottomContainer.js";
21
- import type { AutocompleteProps, BadgeProps, ButtonProps, CheckboxProps, ChipProps, CircularProgressProps, DividerProps, IconButtonProps, InputProps, LinearProgressProps, MenuListProps, MenuItemProps, PaginationProps, PopperProps, SelectProps, SelectOptionProps, SkeletonProps, SwitchProps, TooltipProps, TextFieldProps, IconProps } from "./gridBaseSlots.js";
21
+ import type { AutocompleteProps, BadgeProps, ButtonProps, CheckboxProps, ChipProps, CircularProgressProps, DividerProps, IconButtonProps, InputProps, LinearProgressProps, MenuListProps, MenuItemProps, PaginationProps, PopperProps, SelectProps, SelectOptionProps, SkeletonProps, SwitchProps, TooltipProps, TextFieldProps, IconProps, TabsProps, ToggleButtonProps } from "./gridBaseSlots.js";
22
22
  type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
23
23
  type MainProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
24
24
  export interface BaseAutocompletePropsOverrides {}
@@ -30,6 +30,7 @@ export interface BaseDividerPropsOverrides {}
30
30
  export interface BaseLinearProgressPropsOverrides {}
31
31
  export interface BaseMenuListPropsOverrides {}
32
32
  export interface BaseMenuItemPropsOverrides {}
33
+ export interface BaseTabsPropsOverrides {}
33
34
  export interface BaseTextFieldPropsOverrides {}
34
35
  export interface BaseSelectPropsOverrides {}
35
36
  export interface BaseSwitchPropsOverrides {}
@@ -43,6 +44,7 @@ export interface BaseInputLabelPropsOverrides {}
43
44
  export interface BaseSelectOptionPropsOverrides {}
44
45
  export interface BaseSkeletonPropsOverrides {}
45
46
  export interface BaseIconPropsOverrides {}
47
+ export interface BaseToggleButtonPropsOverrides {}
46
48
  export interface CellPropsOverrides {}
47
49
  export interface ToolbarPropsOverrides {}
48
50
  export interface ColumnHeaderFilterIconButtonPropsOverrides {}
@@ -74,10 +76,12 @@ interface BaseSlotProps {
74
76
  baseLinearProgress: LinearProgressProps & BaseLinearProgressPropsOverrides;
75
77
  baseMenuList: MenuListProps & BaseMenuListPropsOverrides;
76
78
  baseMenuItem: MenuItemProps & BaseMenuItemPropsOverrides;
79
+ baseTabs: TabsProps & BaseTabsPropsOverrides;
77
80
  baseTextField: TextFieldProps & BaseTextFieldPropsOverrides;
78
81
  baseSwitch: SwitchProps & BaseSwitchPropsOverrides;
79
82
  baseButton: ButtonProps & BaseButtonPropsOverrides;
80
83
  baseIconButton: IconButtonProps & BaseIconButtonPropsOverrides;
84
+ baseToggleButton: ToggleButtonProps & BaseToggleButtonPropsOverrides;
81
85
  basePagination: PaginationProps & BasePaginationPropsOverrides;
82
86
  basePopper: PopperProps & BasePopperPropsOverrides;
83
87
  baseTooltip: TooltipProps & BaseTooltipPropsOverrides;
@@ -48,7 +48,7 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeD
48
48
  } else {
49
49
  newWidth += columnBounds.right - clickX;
50
50
  }
51
- return newWidth;
51
+ return Math.round(newWidth);
52
52
  }
53
53
  function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
54
54
  if (resizeDirection === 'Left') {
@@ -569,5 +569,5 @@ function updateProperty(element, property, delta) {
569
569
  if (!element) {
570
570
  return;
571
571
  }
572
- element.style[property] = `${parseInt(element.style[property], 10) + delta}px`;
572
+ element.style[property] = `${Math.round(parseFloat(element.style[property])) + delta}px`;
573
573
  }
@@ -19,7 +19,7 @@ var _pipeProcessing = require("../../core/pipeProcessing");
19
19
  var _gridColumnsInterfaces = require("./gridColumnsInterfaces");
20
20
  var _gridColumnsUtils = require("./gridColumnsUtils");
21
21
  var _preferencesPanel = require("../preferencesPanel");
22
- var _pivoting = require("../pivoting");
22
+ var _gridPivotingSelectors = require("../pivoting/gridPivotingSelectors");
23
23
  var _jsxRuntime = require("react/jsx-runtime");
24
24
  const columnsStateInitializer = (state, props, apiRef) => {
25
25
  apiRef.current.caches.columns = {
@@ -91,13 +91,30 @@ function useGridColumns(apiRef, props) {
91
91
  }
92
92
  }, [apiRef]);
93
93
  const updateColumns = React.useCallback(columns => {
94
- if ((0, _pivoting.gridPivotActiveSelector)(apiRef)) {
95
- apiRef.current.updateNonPivotColumns(columns);
96
- return;
94
+ let columnsToUpdate = columns;
95
+ if ((0, _gridPivotingSelectors.gridPivotActiveSelector)(apiRef)) {
96
+ const nonPivotColumns = [];
97
+ const pivotColumns = [];
98
+ const pivotInitialColumns = (0, _gridPivotingSelectors.gridPivotInitialColumnsSelector)(apiRef);
99
+ columns.forEach(column => {
100
+ const isNonPivotColumn = pivotInitialColumns.has(column.field);
101
+ if (isNonPivotColumn) {
102
+ nonPivotColumns.push(column);
103
+ } else {
104
+ pivotColumns.push(column);
105
+ }
106
+ });
107
+ if (nonPivotColumns.length > 0) {
108
+ apiRef.current.updateNonPivotColumns(nonPivotColumns);
109
+ }
110
+ if (pivotColumns.length === 0) {
111
+ return;
112
+ }
113
+ columnsToUpdate = pivotColumns;
97
114
  }
98
115
  const columnsState = (0, _gridColumnsUtils.createColumnsState)({
99
116
  apiRef,
100
- columnsToUpsert: columns,
117
+ columnsToUpsert: columnsToUpdate,
101
118
  initialState: undefined,
102
119
  keepOnlyColumnsToUpsert: false,
103
120
  updateInitialVisibilityModel: true
@@ -262,7 +279,7 @@ function useGridColumns(apiRef, props) {
262
279
  return initialValue;
263
280
  }, [props.slots.columnsPanel, props.slotProps?.columnsPanel]);
264
281
  const addColumnMenuItems = React.useCallback(columnMenuItems => {
265
- const isPivotActive = (0, _pivoting.gridPivotActiveSelector)(apiRef);
282
+ const isPivotActive = (0, _gridPivotingSelectors.gridPivotActiveSelector)(apiRef);
266
283
  if (props.disableColumnSelector || isPivotActive) {
267
284
  return columnMenuItems;
268
285
  }