@mui/x-data-grid 7.11.0 → 7.11.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 (75) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/components/panel/GridPreferencesPanel.d.ts +1 -1
  3. package/components/panel/GridPreferencesPanel.js +3 -4
  4. package/hooks/core/useGridApiInitialization.js +1 -1
  5. package/hooks/features/editing/useGridCellEditing.js +2 -3
  6. package/hooks/features/editing/useGridRowEditing.js +2 -3
  7. package/hooks/features/export/serializers/csvSerializer.js +7 -8
  8. package/hooks/features/filter/gridFilterUtils.js +12 -9
  9. package/hooks/features/sorting/gridSortingUtils.js +2 -3
  10. package/hooks/utils/useGridApiEventHandler.d.ts +2 -1
  11. package/hooks/utils/useGridApiEventHandler.js +1 -0
  12. package/hooks/utils/useGridSelector.js +2 -3
  13. package/index.js +1 -1
  14. package/internals/index.d.ts +0 -1
  15. package/internals/index.js +0 -1
  16. package/internals/utils/index.d.ts +1 -0
  17. package/internals/utils/index.js +2 -1
  18. package/internals/utils/propValidation.d.ts +0 -1
  19. package/internals/utils/propValidation.js +4 -13
  20. package/internals/utils/warning.d.ts +2 -0
  21. package/internals/utils/warning.js +21 -0
  22. package/locales/deDE.js +1 -2
  23. package/locales/index.d.ts +2 -0
  24. package/locales/index.js +3 -1
  25. package/locales/isIS.d.ts +2 -0
  26. package/locales/isIS.js +149 -0
  27. package/locales/nbNO.js +30 -32
  28. package/locales/nnNO.d.ts +2 -0
  29. package/locales/nnNO.js +148 -0
  30. package/modern/components/panel/GridPreferencesPanel.js +3 -4
  31. package/modern/hooks/core/useGridApiInitialization.js +1 -1
  32. package/modern/hooks/features/editing/useGridCellEditing.js +2 -3
  33. package/modern/hooks/features/editing/useGridRowEditing.js +2 -3
  34. package/modern/hooks/features/export/serializers/csvSerializer.js +7 -8
  35. package/modern/hooks/features/filter/gridFilterUtils.js +12 -9
  36. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -3
  37. package/modern/hooks/utils/useGridApiEventHandler.js +1 -0
  38. package/modern/hooks/utils/useGridSelector.js +2 -3
  39. package/modern/index.js +1 -1
  40. package/modern/internals/index.js +0 -1
  41. package/modern/internals/utils/index.js +2 -1
  42. package/modern/internals/utils/propValidation.js +4 -13
  43. package/modern/internals/utils/warning.js +21 -0
  44. package/modern/locales/deDE.js +1 -2
  45. package/modern/locales/index.js +3 -1
  46. package/modern/locales/isIS.js +149 -0
  47. package/modern/locales/nbNO.js +30 -32
  48. package/modern/locales/nnNO.js +148 -0
  49. package/modern/utils/createSelector.js +2 -3
  50. package/node/components/panel/GridPreferencesPanel.js +4 -5
  51. package/node/hooks/core/useGridApiInitialization.js +1 -1
  52. package/node/hooks/features/editing/useGridCellEditing.js +2 -3
  53. package/node/hooks/features/editing/useGridRowEditing.js +2 -3
  54. package/node/hooks/features/export/serializers/csvSerializer.js +7 -8
  55. package/node/hooks/features/filter/gridFilterUtils.js +12 -9
  56. package/node/hooks/features/sorting/gridSortingUtils.js +2 -3
  57. package/node/hooks/utils/useGridApiEventHandler.js +1 -0
  58. package/node/hooks/utils/useGridSelector.js +2 -3
  59. package/node/index.js +1 -1
  60. package/node/internals/index.js +0 -8
  61. package/node/internals/utils/index.js +11 -0
  62. package/node/internals/utils/propValidation.js +4 -14
  63. package/node/internals/utils/warning.js +28 -0
  64. package/node/locales/deDE.js +1 -2
  65. package/node/locales/index.js +22 -0
  66. package/node/locales/isIS.js +155 -0
  67. package/node/locales/nbNO.js +30 -32
  68. package/node/locales/nnNO.js +154 -0
  69. package/node/utils/createSelector.js +2 -3
  70. package/package.json +4 -4
  71. package/utils/createSelector.js +2 -3
  72. package/modern/utils/warning.js +0 -24
  73. package/node/utils/warning.js +0 -32
  74. package/utils/warning.d.ts +0 -2
  75. package/utils/warning.js +0 -24
package/CHANGELOG.md CHANGED
@@ -3,6 +3,90 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.11.1
7
+
8
+ _Jul 25, 2024_
9
+
10
+ We'd like to offer a big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🔎 Allow `Zoom` to be controllable for charts (#13858) @JCQuintas
13
+ - 🌍 Add Icelandic (is-IS) and Norwegian Nynorsk (nn-NO) locales on the Data Grid
14
+ - 🌍 Improve Norwegian Bokmål (nb-NO) and German (de-DE) locales on the Data Grid
15
+ - 🌍 Add Norwegian Nynorsk (nn-NO) locale on the Date and Time Pickers
16
+ - 🐞 Bugfixes
17
+ - 📚 Documentation improvements
18
+
19
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@7.11.1`
24
+
25
+ - [DataGrid] Remove dead code in internal `GridPreferencesPanel` (#13934) @k-rajat19
26
+ - [DataGrid] Do not miss to escape formulas in CSV export (#13888) @arminmeh
27
+ - [l10n] Add Icelandic (is-IS) locale (#13283) @magnimarels
28
+ - [l10n] Add Norwegian nynorsk (nn-NO) locale and improve Norwegian bokmål (nb-NO) locale (#13588) @AnderzL7
29
+ - [l10n] Improve German (de-DE) locale (#13910) @lhilgert9
30
+
31
+ #### `@mui/x-data-grid-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
32
+
33
+ Same changes as in `@mui/x-data-grid@7.11.1`.
34
+
35
+ #### `@mui/x-data-grid-premium@7.11.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@7.11.1`, plus:
38
+
39
+ - [DataGridPremium] Pass the `api` object to events (#13893) @pcorpet
40
+ - [DataGridPremium] Fix paste to selected cells (#13967) @romgrk
41
+
42
+ ### Date and Time Pickers
43
+
44
+ #### `@mui/x-date-pickers@7.11.1`
45
+
46
+ - [fields] Prevent keyboard editing when disabled (#13900) @arthurbalduini
47
+ - [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) @AnderzL7
48
+
49
+ #### `@mui/x-date-pickers-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@7.11.1`.
52
+
53
+ ### Charts
54
+
55
+ #### `@mui/x-charts@7.11.1`
56
+
57
+ - [charts] Add `ownerState` function to `slotProps` typing when available (#13965) @alexfauquette
58
+ - [charts] Allow `Zoom` to be controllable (#13858) @JCQuintas
59
+ - [charts] Deprecate `xAxisKey` /`zAxisKey` in favor of `xAxisId`/`zAxisId` (#13940) @alexfauquette
60
+ - [charts] Hide empty arcs in the PieChart (#13897) @alexfauquette
61
+ - [charts] Limit the trigger of exit charts (#13682) @alexfauquette
62
+
63
+ ### Tree View
64
+
65
+ #### `@mui/x-tree-view@7.11.1`
66
+
67
+ - [TreeView] Allow the plugins to enrich the props passed to the item slots (#13953) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Bump pnpm priority as a package manager (#13894) @oliviertassinari
72
+ - [docs] Explicitly mark charts pro as not released (#13905) @alexfauquette
73
+ - [docs] Fix dot consistency a11y table @oliviertassinari
74
+ - [docs] Fix some typos in charts docs (#13906) @cratiu222
75
+ - [docs] Fix spelling (#13902) @nnsW3
76
+ - [docs] Improve error message when moving between plans (#13874) @oliviertassinari
77
+ - [docs] Update `SparkLineChart` reference not being correctly capitalised (#13960) @duckboy81
78
+ - [docs] Fix scroll demos disorientation (#13909) @oliviertassinari
79
+
80
+ ### Core
81
+
82
+ - [core] Add `@mui/material-nextjs` to `MUI Core` renovate group (#13966) @LukasTy
83
+ - [core] Remove warning message in production (#13911) @oliviertassinari
84
+ - [code-infra] Reuse `useReactVersion` script from the monorepo (#13710) @cherniavskii
85
+ - [infra] Adds order id validation action (#13957) @michelengelen
86
+ - [infra] Fix order id validator action (#13971) @michelengelen
87
+ - [infra] Fix regex in order id validation (#13976) @michelengelen
88
+ - [infra] Issue template improvement (#13954) @michelengelen
89
+
6
90
  ## 7.11.0
7
91
 
8
92
  _Jul 18, 2024_
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare const GridPreferencesPanel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
2
+ export declare function GridPreferencesPanel(): React.JSX.Element;
@@ -7,19 +7,18 @@ import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel
7
7
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
8
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
- export const GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridPreferencesPanel(props, ref) {
10
+ export function GridPreferencesPanel() {
11
11
  const apiRef = useGridApiContext();
12
12
  const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
13
13
  const rootProps = useGridRootProps();
14
14
  const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
15
15
  const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters);
16
16
  return /*#__PURE__*/_jsx(rootProps.slots.panel, _extends({
17
- ref: ref,
18
17
  as: rootProps.slots.basePopper,
19
18
  open: columns.length > 0 && preferencePanelState.open,
20
19
  id: preferencePanelState.panelId,
21
20
  "aria-labelledby": preferencePanelState.labelId
22
- }, rootProps.slotProps?.panel, props, rootProps.slotProps?.basePopper, {
21
+ }, rootProps.slotProps?.panel, rootProps.slotProps?.basePopper, {
23
22
  children: panelContent
24
23
  }));
25
- });
24
+ }
@@ -82,7 +82,7 @@ export function useGridApiInitialization(inputApiRef, props) {
82
82
  if (isSyntheticEvent(event) && event.isPropagationStopped()) {
83
83
  return;
84
84
  }
85
- const details = props.signature === GridSignature.DataGridPro ? {
85
+ const details = props.signature === GridSignature.DataGridPro || props.signature === GridSignature.DataGridPremium ? {
86
86
  api: privateApiRef.current.getPublicApi()
87
87
  } : {};
88
88
  privateApiRef.current.eventManager.emit(name, params, event, details);
@@ -10,11 +10,10 @@ import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
10
10
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
11
11
  import { gridEditRowsStateSelector } from './gridEditingSelectors';
12
12
  import { isPrintableKey, isPasteShortcut } from '../../../utils/keyboardUtils';
13
- import { buildWarning } from '../../../utils/warning';
13
+ import { warnOnce } from '../../../internals/utils/warning';
14
14
  import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
15
15
  import { deepClone } from '../../../utils/utils';
16
16
  import { GridCellEditStartReasons, GridCellEditStopReasons } from '../../../models/params/gridEditCellParams';
17
- const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
18
17
  export const useGridCellEditing = (apiRef, props) => {
19
18
  const [cellModesModel, setCellModesModel] = React.useState({});
20
19
  const cellModesModelRef = React.useRef(cellModesModel);
@@ -336,7 +335,7 @@ export const useGridCellEditing = (apiRef, props) => {
336
335
  if (onProcessRowUpdateError) {
337
336
  onProcessRowUpdateError(errorThrown);
338
337
  } else if (process.env.NODE_ENV !== 'production') {
339
- missingOnProcessRowUpdateErrorWarning();
338
+ warnOnce(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
340
339
  }
341
340
  };
342
341
  try {
@@ -11,12 +11,11 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
11
11
  import { gridEditRowsStateSelector } from './gridEditingSelectors';
12
12
  import { isPrintableKey, isPasteShortcut } from '../../../utils/keyboardUtils';
13
13
  import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from '../columns/gridColumnsSelector';
14
- import { buildWarning } from '../../../utils/warning';
14
+ import { warnOnce } from '../../../internals/utils/warning';
15
15
  import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
16
16
  import { deepClone } from '../../../utils/utils';
17
17
  import { GridRowEditStopReasons, GridRowEditStartReasons } from '../../../models/params/gridRowParams';
18
18
  import { GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
19
- const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
20
19
  export const useGridRowEditing = (apiRef, props) => {
21
20
  const [rowModesModel, setRowModesModel] = React.useState({});
22
21
  const rowModesModelRef = React.useRef(rowModesModel);
@@ -389,7 +388,7 @@ export const useGridRowEditing = (apiRef, props) => {
389
388
  if (onProcessRowUpdateError) {
390
389
  onProcessRowUpdateError(errorThrown);
391
390
  } else if (process.env.NODE_ENV !== 'production') {
392
- missingOnProcessRowUpdateErrorWarning();
391
+ warnOnce(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
393
392
  }
394
393
  };
395
394
  try {
@@ -1,19 +1,19 @@
1
1
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
2
- import { buildWarning } from '../../../../utils/warning';
2
+ import { warnOnce } from '../../../../internals/utils/warning';
3
3
  function sanitizeCellValue(value, csvOptions) {
4
4
  const valueStr = typeof value === 'string' ? value : `${value}`;
5
5
  if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
6
6
  const escapedValue = valueStr.replace(/"/g, '""');
7
- // Make sure value containing delimiter or line break won't be split into multiple cells
8
- if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => valueStr.includes(delimiter))) {
9
- return `"${escapedValue}"`;
10
- }
11
7
  if (csvOptions.escapeFormulas) {
12
8
  // See https://owasp.org/www-community/attacks/CSV_Injection
13
9
  if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
14
- return `'${escapedValue}`;
10
+ return `"'${escapedValue}"`;
15
11
  }
16
12
  }
13
+ // Make sure value containing delimiter or line break won't be split into multiple cells
14
+ if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => valueStr.includes(delimiter))) {
15
+ return `"${escapedValue}"`;
16
+ }
17
17
  return escapedValue;
18
18
  }
19
19
  return valueStr;
@@ -40,7 +40,6 @@ export const serializeCellValue = (cellParams, options) => {
40
40
  }
41
41
  return sanitizeCellValue(value, csvOptions);
42
42
  };
43
- const objectFormattedValueWarning = buildWarning(['MUI X: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
44
43
  class CSVRow {
45
44
  constructor(options) {
46
45
  this.options = void 0;
@@ -79,7 +78,7 @@ const serializeRow = ({
79
78
  const cellParams = getCellParams(id, column.field);
80
79
  if (process.env.NODE_ENV !== 'production') {
81
80
  if (String(cellParams.formattedValue) === '[object Object]') {
82
- objectFormattedValueWarning();
81
+ warnOnce(['MUI X: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
83
82
  }
84
83
  }
85
84
  row.addValue(serializeCellValue(cellParams, {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { GridLogicOperator } from '../../../models';
3
3
  import { getDefaultGridFilterModel } from './gridFilterState';
4
- import { buildWarning } from '../../../utils/warning';
4
+ import { warnOnce } from '../../../internals/utils/warning';
5
5
  import { getPublicApiRef } from '../../../utils/getPublicApiRef';
6
6
  import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
7
7
  let hasEval;
@@ -36,25 +36,28 @@ export const cleanFilterItem = (item, apiRef) => {
36
36
  }
37
37
  return cleanItem;
38
38
  };
39
- const filterModelDisableMultiColumnsFilteringWarning = buildWarning(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
40
- const filterModelMissingItemIdWarning = buildWarning('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
41
- const filterModelMissingItemOperatorWarning = buildWarning('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
42
39
  export const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiRef) => {
43
40
  const hasSeveralItems = model.items.length > 1;
44
41
  let items;
45
42
  if (hasSeveralItems && disableMultipleColumnsFiltering) {
46
- filterModelDisableMultiColumnsFilteringWarning();
43
+ if (process.env.NODE_ENV !== 'production') {
44
+ warnOnce(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
45
+ }
47
46
  items = [model.items[0]];
48
47
  } else {
49
48
  items = model.items;
50
49
  }
51
50
  const hasItemsWithoutIds = hasSeveralItems && items.some(item => item.id == null);
52
51
  const hasItemWithoutOperator = items.some(item => item.operator == null);
53
- if (hasItemsWithoutIds) {
54
- filterModelMissingItemIdWarning();
52
+ if (process.env.NODE_ENV !== 'production') {
53
+ if (hasItemsWithoutIds) {
54
+ warnOnce('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
55
+ }
55
56
  }
56
- if (hasItemWithoutOperator) {
57
- filterModelMissingItemOperatorWarning();
57
+ if (process.env.NODE_ENV !== 'production') {
58
+ if (hasItemWithoutOperator) {
59
+ warnOnce('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
60
+ }
58
61
  }
59
62
  if (hasItemWithoutOperator || hasItemsWithoutIds) {
60
63
  return _extends({}, model, {
@@ -1,10 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { buildWarning } from '../../../utils/warning';
3
- const sortModelDisableMultiColumnsSortingWarning = buildWarning(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
2
+ import { warnOnce } from '../../../internals/utils/warning';
4
3
  export const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
5
4
  if (disableMultipleColumnsSorting && model.length > 1) {
6
5
  if (process.env.NODE_ENV !== 'production') {
7
- sortModelDisableMultiColumnsSortingWarning();
6
+ warnOnce(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
8
7
  }
9
8
  return [model[0]];
10
9
  }
@@ -9,7 +9,8 @@ import type { GridApiCommon } from '../../models';
9
9
  */
10
10
  declare enum GridSignature {
11
11
  DataGrid = "DataGrid",
12
- DataGridPro = "DataGridPro"
12
+ DataGridPro = "DataGridPro",
13
+ DataGridPremium = "DataGridPremium"
13
14
  }
14
15
  interface RegistryContainer {
15
16
  registry: CleanupTracking | null;
@@ -8,6 +8,7 @@ import { FinalizationRegistryBasedCleanupTracking } from '../../utils/cleanupTra
8
8
  var GridSignature = /*#__PURE__*/function (GridSignature) {
9
9
  GridSignature["DataGrid"] = "DataGrid";
10
10
  GridSignature["DataGridPro"] = "DataGridPro";
11
+ GridSignature["DataGridPremium"] = "DataGridPremium";
11
12
  return GridSignature;
12
13
  }(GridSignature || {});
13
14
  // We use class to make it easier to detect in heap snapshots by name
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { useLazyRef } from './useLazyRef';
3
3
  import { useOnMount } from './useOnMount';
4
- import { buildWarning } from '../../utils/warning';
4
+ import { warnOnce } from '../../internals/utils/warning';
5
5
  import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
6
- const stateNotInitializedWarning = buildWarning(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
7
6
  function isOutputSelector(selector) {
8
7
  return selector.acceptsApiRef;
9
8
  }
@@ -23,7 +22,7 @@ const createRefs = () => ({
23
22
  export const useGridSelector = (apiRef, selector, equals = defaultCompare) => {
24
23
  if (process.env.NODE_ENV !== 'production') {
25
24
  if (!apiRef.current.state) {
26
- stateNotInitializedWarning();
25
+ warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
27
26
  }
28
27
  }
29
28
  const refs = useLazyRef(createRefs);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.11.0
2
+ * @mui/x-data-grid v7.11.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -75,7 +75,6 @@ export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal
75
75
  export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
76
76
  export * from '../utils/utils';
77
77
  export * from '../utils/fastMemo';
78
- export { buildWarning } from '../utils/warning';
79
78
  export { exportAs } from '../utils/exportAs';
80
79
  export * from '../utils/getPublicApiRef';
81
80
  export * from '../utils/cellBorderUtils';
@@ -60,7 +60,6 @@ export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal
60
60
  export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
61
61
  export * from '../utils/utils';
62
62
  export * from '../utils/fastMemo';
63
- export { buildWarning } from '../utils/warning';
64
63
  export { exportAs } from '../utils/exportAs';
65
64
  export * from '../utils/getPublicApiRef';
66
65
  export * from '../utils/cellBorderUtils';
@@ -1,3 +1,4 @@
1
1
  export * from './computeSlots';
2
2
  export * from './useProps';
3
3
  export * from './propValidation';
4
+ export * from './warning';
@@ -1,3 +1,4 @@
1
1
  export * from './computeSlots';
2
2
  export * from './useProps';
3
- export * from './propValidation';
3
+ export * from './propValidation';
4
+ export * from './warning';
@@ -2,4 +2,3 @@ import { DataGridProcessedProps } from '../../models/props/DataGridProps';
2
2
  export type PropValidator<TProps> = (props: TProps) => string | undefined;
3
3
  export declare const propValidatorsDataGrid: PropValidator<DataGridProcessedProps>[];
4
4
  export declare function validateProps<TProps>(props: TProps, validators: PropValidator<TProps>[]): void;
5
- export declare function clearWarningsCache(): void;
@@ -1,21 +1,12 @@
1
+ import { warnOnce } from './warning';
1
2
  import { isNumber } from '../../utils/utils';
2
3
  import { GridSignature } from '../../hooks/utils/useGridApiEventHandler';
3
4
  export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.paginationMode === 'client' && props.paginationMeta != null && ['MUI X: Usage of the `paginationMeta` prop with client-side pagination (`paginationMode="client"`) has no effect.', '`paginationMeta` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && ['MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect.', '`rowCount` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.paginationMode === 'server' && props.rowCount == null && !props.unstable_dataSource && ["MUI X: The `rowCount` prop must be passed using `paginationMode='server'`", 'For more detail, see http://mui.com/components/data-grid/pagination/#index-based-pagination'].join('\n') || undefined];
4
- const warnedOnceCache = new Set();
5
- function warnOnce(message) {
6
- if (!warnedOnceCache.has(message)) {
7
- console.error(message);
8
- warnedOnceCache.add(message);
9
- }
10
- }
11
5
  export function validateProps(props, validators) {
12
6
  validators.forEach(validator => {
13
- const warning = validator(props);
14
- if (warning) {
15
- warnOnce(warning);
7
+ const message = validator(props);
8
+ if (message) {
9
+ warnOnce(message, 'error');
16
10
  }
17
11
  });
18
- }
19
- export function clearWarningsCache() {
20
- warnedOnceCache.clear();
21
12
  }
@@ -0,0 +1,2 @@
1
+ export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
2
+ export declare function clearWarningsCache(): void;
@@ -0,0 +1,21 @@
1
+ const warnedOnceCache = new Set();
2
+
3
+ // TODO move to @mui/x-internals
4
+ // TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
5
+ export function warnOnce(message, gravity = 'warning') {
6
+ if (process.env.NODE_ENV === 'production') {
7
+ return;
8
+ }
9
+ const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
10
+ if (!warnedOnceCache.has(cleanMessage)) {
11
+ warnedOnceCache.add(cleanMessage);
12
+ if (gravity === 'error') {
13
+ console.error(cleanMessage);
14
+ } else {
15
+ console.warn(cleanMessage);
16
+ }
17
+ }
18
+ }
19
+ export function clearWarningsCache() {
20
+ warnedOnceCache.clear();
21
+ }
package/locales/deDE.js CHANGED
@@ -33,8 +33,7 @@ const deDEGrid = {
33
33
  columnsManagementSearchTitle: 'Suche',
34
34
  columnsManagementNoColumns: 'Keine Spalten',
35
35
  columnsManagementShowHideAllText: 'Alle anzeigen/verbergen',
36
- // columnsManagementReset: 'Reset',
37
-
36
+ columnsManagementReset: 'Zurücksetzen',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'Filter hinzufügen',
40
39
  filterPanelRemoveAll: 'Alle entfernen',
@@ -17,6 +17,7 @@ export * from './jaJP';
17
17
  export * from './koKR';
18
18
  export * from './nbNO';
19
19
  export * from './nlNL';
20
+ export * from './nnNO';
20
21
  export * from './plPL';
21
22
  export * from './ptBR';
22
23
  export * from './roRO';
@@ -32,3 +33,4 @@ export * from './zhTW';
32
33
  export * from './hrHR';
33
34
  export * from './ptPT';
34
35
  export * from './zhHK';
36
+ export * from './isIS';
package/locales/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './jaJP';
18
18
  export * from './koKR';
19
19
  export * from './nbNO';
20
20
  export * from './nlNL';
21
+ export * from './nnNO';
21
22
  export * from './plPL';
22
23
  export * from './ptBR';
23
24
  export * from './roRO';
@@ -32,4 +33,5 @@ export * from './zhCN';
32
33
  export * from './zhTW';
33
34
  export * from './hrHR';
34
35
  export * from './ptPT';
35
- export * from './zhHK';
36
+ export * from './zhHK';
37
+ export * from './isIS';
@@ -0,0 +1,2 @@
1
+ import { Localization } from '../utils/getGridLocalization';
2
+ export declare const isIS: Localization;
@@ -0,0 +1,149 @@
1
+ import { isIS as isISCore } from '@mui/material/locale';
2
+ import { getGridLocalization } from '../utils/getGridLocalization';
3
+ const isISGrid = {
4
+ // Root
5
+ noRowsLabel: 'Engar raðir',
6
+ noResultsOverlayLabel: 'Engar niðurstöður',
7
+ // Density selector toolbar button text
8
+ toolbarDensity: 'Þéttleiki',
9
+ toolbarDensityLabel: 'Þéttleiki',
10
+ toolbarDensityCompact: 'Þétt',
11
+ toolbarDensityStandard: 'Staðlað',
12
+ toolbarDensityComfortable: 'Rúmlegt',
13
+ // Columns selector toolbar button text
14
+ toolbarColumns: 'Dálkar',
15
+ toolbarColumnsLabel: 'Veldu dálka',
16
+ // Filters toolbar button text
17
+ toolbarFilters: 'Sía',
18
+ toolbarFiltersLabel: 'Sjá síur',
19
+ toolbarFiltersTooltipHide: 'Fela síur',
20
+ toolbarFiltersTooltipShow: 'Sjá síur',
21
+ toolbarFiltersTooltipActive: count => count !== 1 ? `${count} virk sía` : `${count} virkar síur`,
22
+ // Quick filter toolbar field
23
+ toolbarQuickFilterPlaceholder: 'Leita…',
24
+ toolbarQuickFilterLabel: 'Leita',
25
+ toolbarQuickFilterDeleteIconLabel: 'Eyða',
26
+ // Export selector toolbar button text
27
+ toolbarExport: 'Flytja út',
28
+ toolbarExportLabel: 'Flytja út',
29
+ toolbarExportCSV: 'Hlaða niður sem CSV',
30
+ toolbarExportPrint: 'Prenta',
31
+ toolbarExportExcel: 'Hlaða niður sem Excel',
32
+ // Columns management text
33
+ // columnsManagementSearchTitle: 'Search',
34
+ // columnsManagementNoColumns: 'No columns',
35
+ // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
37
+
38
+ // Filter panel text
39
+ filterPanelAddFilter: 'Bæta síu',
40
+ filterPanelRemoveAll: 'Fjarlægja alla',
41
+ filterPanelDeleteIconLabel: 'Eyða',
42
+ filterPanelLogicOperator: 'Rökvirkir',
43
+ filterPanelOperator: 'Virkir',
44
+ filterPanelOperatorAnd: 'Og',
45
+ filterPanelOperatorOr: 'Eða',
46
+ filterPanelColumns: 'Dálkar',
47
+ filterPanelInputLabel: 'Gildi',
48
+ filterPanelInputPlaceholder: 'Síu gildi',
49
+ // Filter operators text
50
+ filterOperatorContains: 'inniheldur',
51
+ filterOperatorEquals: 'jafnt og',
52
+ filterOperatorStartsWith: 'byrjar með',
53
+ filterOperatorEndsWith: 'endar með',
54
+ filterOperatorIs: 'er líka með',
55
+ filterOperatorNot: 'er ekki líka með',
56
+ filterOperatorAfter: 'eftir',
57
+ filterOperatorOnOrAfter: 'á eða eftir',
58
+ filterOperatorBefore: 'fyrir',
59
+ filterOperatorOnOrBefore: 'á eða fyrir',
60
+ filterOperatorIsEmpty: 'inniheldur ekki gögn',
61
+ filterOperatorIsNotEmpty: 'inniheldur gögn',
62
+ filterOperatorIsAnyOf: 'inniheldur einn af',
63
+ 'filterOperator=': '=',
64
+ 'filterOperator!=': '!=',
65
+ 'filterOperator>': '>',
66
+ 'filterOperator>=': '>=',
67
+ 'filterOperator<': '<',
68
+ 'filterOperator<=': '<=',
69
+ // Header filter operators text
70
+ headerFilterOperatorContains: 'Inniheldur',
71
+ headerFilterOperatorEquals: 'Jafnt og',
72
+ headerFilterOperatorStartsWith: 'Byrjar með',
73
+ headerFilterOperatorEndsWith: 'Endar með',
74
+ headerFilterOperatorIs: 'Er jafnt og',
75
+ headerFilterOperatorNot: 'Er ekki jafnt og',
76
+ headerFilterOperatorAfter: 'Eftir',
77
+ headerFilterOperatorOnOrAfter: 'Á eða eftir',
78
+ headerFilterOperatorBefore: 'Fyrir',
79
+ headerFilterOperatorOnOrBefore: 'Á eða fyrir',
80
+ headerFilterOperatorIsEmpty: 'Inniheldur ekki gögn',
81
+ headerFilterOperatorIsNotEmpty: 'Inniheldur gögn',
82
+ headerFilterOperatorIsAnyOf: 'Inniheldur einn af',
83
+ 'headerFilterOperator=': 'Jafnt og',
84
+ 'headerFilterOperator!=': 'Ekki jafnt og',
85
+ 'headerFilterOperator>': 'Stærra en',
86
+ 'headerFilterOperator>=': 'Stærra en eða jafnt og',
87
+ 'headerFilterOperator<': 'Minna en',
88
+ 'headerFilterOperator<=': 'Minna en eða jafnt og',
89
+ // Filter values text
90
+ filterValueAny: 'hvað sem er',
91
+ filterValueTrue: 'satt',
92
+ filterValueFalse: 'falskt',
93
+ // Column menu text
94
+ columnMenuLabel: 'Valmynd',
95
+ columnMenuShowColumns: 'Sýna dálka',
96
+ columnMenuManageColumns: 'Stjórna dálkum',
97
+ columnMenuFilter: 'Síur',
98
+ columnMenuHideColumn: 'Fela dálka',
99
+ columnMenuUnsort: 'Fjarlægja röðun',
100
+ columnMenuSortAsc: 'Raða hækkandi',
101
+ columnMenuSortDesc: 'Raða lækkandi',
102
+ // Column header text
103
+ columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} virkar síur` : `Ein virk sía`,
104
+ columnHeaderFiltersLabel: 'Sýna síur',
105
+ columnHeaderSortIconLabel: 'Raða',
106
+ // Rows selected footer text
107
+ footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} raðir valdar` : `Ein röð valin`,
108
+ // Total row amount footer text
109
+ footerTotalRows: 'Heildarfjöldi lína:',
110
+ // Total visible row amount footer text
111
+ footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} af ${totalCount.toLocaleString()}`,
112
+ // Checkbox selection text
113
+ checkboxSelectionHeaderName: 'Val á gátreit',
114
+ checkboxSelectionSelectAllRows: 'Velja allar raðir',
115
+ checkboxSelectionUnselectAllRows: 'Afvelja allar raðir',
116
+ checkboxSelectionSelectRow: 'Velja röð',
117
+ checkboxSelectionUnselectRow: 'Afvelja röð',
118
+ // Boolean cell text
119
+ booleanCellTrueLabel: 'já',
120
+ booleanCellFalseLabel: 'nei',
121
+ // Actions cell more text
122
+ actionsCellMore: 'meira',
123
+ // Column pinning text
124
+ pinToLeft: 'Festa til vinstri',
125
+ pinToRight: 'Festa til hægri',
126
+ unpin: 'Losa um',
127
+ // Tree Data
128
+ treeDataGroupingHeaderName: 'Hópur',
129
+ treeDataExpand: 'Sýna undirliði',
130
+ treeDataCollapse: 'Fela undirliði',
131
+ // Grouping columns
132
+ groupingColumnHeaderName: 'Hópur',
133
+ groupColumn: name => `Hópa eftir ${name}`,
134
+ unGroupColumn: name => `Fjarlægja hópun eftir ${name}`,
135
+ // Master/detail
136
+ detailPanelToggle: 'Stækka/minnka smáatriðaspjald',
137
+ expandDetailPanel: 'Stækka',
138
+ collapseDetailPanel: 'Minnka',
139
+ // Row reordering text
140
+ rowReorderingHeaderName: 'Endurröðun raða',
141
+ // Aggregation
142
+ aggregationMenuItemHeader: 'Samsafn',
143
+ aggregationFunctionLabelSum: 'sum',
144
+ aggregationFunctionLabelAvg: 'avg',
145
+ aggregationFunctionLabelMin: 'min',
146
+ aggregationFunctionLabelMax: 'max',
147
+ aggregationFunctionLabelSize: 'stærð'
148
+ };
149
+ export const isIS = getGridLocalization(isISGrid, isISCore);