Skip to content

Commit db983cc

Browse files
authored
Merge branch 'master' into fix-picker-popper-paper-owner-state
2 parents cb0f518 + f4f373c commit db983cc

File tree

71 files changed

+605
-578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+605
-578
lines changed

docs/data/charts/funnel/FunnelCurves.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import ChartsUsageDemo from 'docsx/src/modules/components/ChartsUsageDemo';
44
import Stack from '@mui/material/Stack';
55
import { populationByEducationLevelPercentageSeries } from './populationByEducationLevel';
66

7-
const curveTypes = ['bump', 'linear', 'step', 'pyramid', 'step-pyramid'];
7+
const curveTypes = [
8+
'bump',
9+
'linear',
10+
'linear-sharp',
11+
'step',
12+
'pyramid',
13+
'step-pyramid',
14+
];
815

916
export default function FunnelCurves() {
1017
return (

docs/data/charts/funnel/FunnelCurves.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import ChartsUsageDemo from 'docsx/src/modules/components/ChartsUsageDemo';
44
import Stack from '@mui/material/Stack';
55
import { populationByEducationLevelPercentageSeries } from './populationByEducationLevel';
66

7-
const curveTypes = ['bump', 'linear', 'step', 'pyramid', 'step-pyramid'] as const;
7+
const curveTypes = [
8+
'bump',
9+
'linear',
10+
'linear-sharp',
11+
'step',
12+
'pyramid',
13+
'step-pyramid',
14+
] as const;
815

916
export default function FunnelCurves() {
1017
return (

docs/data/charts/funnel/funnel.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ It also accepts a function that receives the data object and should return the l
7272
### Curve interpolation
7373

7474
The interpolation between data points can be customized by the `curve` property.
75-
This property expects one of the following string values, corresponding to the interpolation method: `'linear'`, `'bump'`, `'pyramid'`, `'step'` and `'step-pyramid'`.
75+
This property expects one of the following string values, corresponding to the interpolation method: `'linear'`, `'linear-sharp'`, `'bump'`, `'pyramid'`, `'step'` and `'step-pyramid'`.
7676

7777
This series property adds the option to control the interpolation of a series.
7878

@@ -91,8 +91,8 @@ The border radius of the sections can be customized by the `borderRadius` proper
9191
It accepts a number that represents the radius in pixels.
9292

9393
- The `bump` curve interpolation will not respect the border radius.
94-
- The `linear` and `pyramid` curve respects the border radius to some extent due to the angle of the sections.
95-
- The `step` and `step-pyramid` curve respects the border radius.
94+
- The `linear`, `linear-sharp` and `pyramid` curves respect the border radius to some extent due to the angle of the sections.
95+
- The `step` and `step-pyramid` curves respect the border radius.
9696

9797
To understand how the border radius interacts with the `curve` prop, see the [curve interpolation example](/x/react-charts/funnel/#curve-interpolation) above.
9898

docs/data/data-grid/column-pinning/ColumnPinningWithCheckboxSelection.js renamed to docs/data/data-grid/column-pinning/ColumnPinningAutogeneratedColumns.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
DataGridPro,
66
GridActionsCellItem,
77
GRID_CHECKBOX_SELECTION_COL_DEF,
8+
GRID_REORDER_COL_DEF,
89
} from '@mui/x-data-grid-pro';
910
import {
1011
randomCreatedDate,
@@ -13,16 +14,20 @@ import {
1314
randomUpdatedDate,
1415
} from '@mui/x-data-grid-generator';
1516

16-
export default function ColumnPinningWithCheckboxSelection() {
17+
export default function ColumnPinningAutogeneratedColumns() {
1718
return (
1819
<div style={{ height: 400, width: '100%' }}>
1920
<DataGridPro
2021
rows={rows}
2122
columns={columns}
2223
checkboxSelection
24+
rowReordering
2325
initialState={{
2426
pinnedColumns: {
25-
left: [GRID_CHECKBOX_SELECTION_COL_DEF.field],
27+
left: [
28+
GRID_REORDER_COL_DEF.field,
29+
GRID_CHECKBOX_SELECTION_COL_DEF.field,
30+
],
2631
right: ['actions'],
2732
},
2833
}}

docs/data/data-grid/column-pinning/ColumnPinningWithCheckboxSelection.tsx renamed to docs/data/data-grid/column-pinning/ColumnPinningAutogeneratedColumns.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
GridRowsProp,
88
GridActionsCellItem,
99
GRID_CHECKBOX_SELECTION_COL_DEF,
10+
GRID_REORDER_COL_DEF,
1011
} from '@mui/x-data-grid-pro';
1112
import {
1213
randomCreatedDate,
@@ -15,16 +16,20 @@ import {
1516
randomUpdatedDate,
1617
} from '@mui/x-data-grid-generator';
1718

18-
export default function ColumnPinningWithCheckboxSelection() {
19+
export default function ColumnPinningAutogeneratedColumns() {
1920
return (
2021
<div style={{ height: 400, width: '100%' }}>
2122
<DataGridPro
2223
rows={rows}
2324
columns={columns}
2425
checkboxSelection
26+
rowReordering
2527
initialState={{
2628
pinnedColumns: {
27-
left: [GRID_CHECKBOX_SELECTION_COL_DEF.field],
29+
left: [
30+
GRID_REORDER_COL_DEF.field,
31+
GRID_CHECKBOX_SELECTION_COL_DEF.field,
32+
],
2833
right: ['actions'],
2934
},
3035
}}

docs/data/data-grid/column-pinning/ColumnPinningWithCheckboxSelection.tsx.preview renamed to docs/data/data-grid/column-pinning/ColumnPinningAutogeneratedColumns.tsx.preview

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
rows={rows}
33
columns={columns}
44
checkboxSelection
5+
rowReordering
56
initialState={{
67
pinnedColumns: {
7-
left: [GRID_CHECKBOX_SELECTION_COL_DEF.field],
8+
left: [
9+
GRID_REORDER_COL_DEF.field,
10+
GRID_CHECKBOX_SELECTION_COL_DEF.field,
11+
],
812
right: ['actions'],
913
},
1014
}}

docs/data/data-grid/column-pinning/column-pinning.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ Another alternate option to disable pinning actions on the UI is to disable the
114114

115115
:::
116116

117-
## Pinning the checkbox selection column
117+
## Pinning autogenerated columns
118118

119-
To pin the checkbox column added when using `checkboxSelection`, add `GRID_CHECKBOX_SELECTION_COL_DEF.field` to the list of pinned columns.
119+
Some features add columns to the grid.
120+
Pin those columns by providing their field names to the list of pinned columns.
120121

121-
{{"demo": "ColumnPinningWithCheckboxSelection.js", "bg": "inline"}}
122+
To pin the row reordering column added when using `rowReordering` and checkbox column added when using `checkboxSelection`, add `GRID_REORDER_COL_DEF.field` and `GRID_CHECKBOX_SELECTION_COL_DEF.field` to the list of pinned columns.
123+
124+
{{"demo": "ColumnPinningAutogeneratedColumns.js", "bg": "inline"}}
122125

123126
## Usage with dynamic row height
124127

docs/data/data-grid/row-grouping/row-grouping.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ To display a grouping column for each criterion, set the `rowGroupingColumnMode`
6969
Use the `groupingColDef` prop to customize the rendering of the grouping column.
7070
You can override any property from the column definition (`GridColDef`) interface, with the exceptions of the `field`, the `type`, and the properties related to inline editing.
7171

72+
:::success
73+
For better performance, keep `groupingColDef` prop reference stable between two renders.
74+
:::
75+
7276
{{"demo": "RowGroupingCustomGroupingColDefObject.js", "bg": "inline", "defaultCodeOpen": false}}
7377

7478
By default, when using the object format, the properties are applied to all grouping columns.
@@ -77,11 +81,6 @@ This means that if `rowGroupingColumnMode` is set to `multiple`, then all column
7781
To override properties for specific grouping columns, or to apply different overrides based on the current grouping criteria, you can pass a callback function to `groupingColDef` instead of an object with its config.
7882
The callback is called for each grouping column, and it receives the respective column's fields as parameters.
7983

80-
:::warning
81-
The `groupingColDef` prop, same as `columns` prop, should keep the same reference between two renders.
82-
Otherwise, the grouping column processing can happen multiple times and outside of the required order, resulting in a wrong column placement.
83-
:::
84-
8584
The demo below illustrates this approach to provide buttons for toggling between different grouping criteria:
8685

8786
{{"demo": "RowGroupingCustomGroupingColDefCallback.js", "bg": "inline", "defaultCodeOpen": false}}

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"@babel/preset-typescript": "^7.27.1",
103103
"@mui/internal-docs-utils": "^2.0.1",
104104
"@mui/internal-scripts": "^2.0.8",
105+
"@types/chai": "^5.2.2",
105106
"@types/chance": "^1.1.6",
106107
"@types/d3-scale": "^4.0.9",
107108
"@types/d3-scale-chromatic": "^3.1.0",

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
"@mui/internal-babel-plugin-display-name": "^1.0.0",
8989
"@mui/internal-babel-plugin-resolve-imports": "^2.0.3",
9090
"@mui/internal-bundle-size-checker": "^1.0.4",
91-
"@mui/internal-markdown": "^2.0.5",
92-
"@mui/internal-test-utils": "^2.0.8",
91+
"@mui/internal-markdown": "^2.0.6",
92+
"@mui/internal-test-utils": "^2.0.9",
9393
"@mui/material": "^7.1.1",
9494
"@mui/monorepo": "github:mui/material-ui#8cd3aa5849fe8fc2dd98eccc75366fae364d15f8",
9595
"@mui/utils": "^7.1.1",
@@ -99,6 +99,7 @@
9999
"@playwright/test": "^1.52.0",
100100
"@types/babel__core": "^7.20.5",
101101
"@types/babel__traverse": "^7.20.7",
102+
"@types/chai": "^5.2.2",
102103
"@types/chai-dom": "^1.11.3",
103104
"@types/fs-extra": "^11.0.4",
104105
"@types/karma": "^6.3.9",
@@ -126,7 +127,7 @@
126127
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
127128
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
128129
"babel-plugin-transform-replace-expressions": "^0.2.0",
129-
"chai": "^4.5.0",
130+
"chai": "^5.2.0",
130131
"chai-dom": "^1.12.1",
131132
"compression-webpack-plugin": "^11.1.0",
132133
"concurrently": "^9.1.2",

packages/eslint-plugin-material-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@typescript-eslint/utils": "^8.33.0"
1111
},
1212
"scripts": {
13-
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/eslint-plugin-material-ui/**/*.test.js' --timeout 3000"
13+
"test": "vitest"
1414
},
1515
"repository": {
1616
"type": "git",

packages/eslint-plugin-material-ui/src/rules/no-direct-state-access.test.js renamed to packages/eslint-plugin-material-ui/src/rules/no-direct-state-access.test.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
// The polyfill of `import.meta.url` used in @eslint/eslintrc tests the presence
2-
// of `document` to detect if it's on node or web. However, JSDOM sets `document`
3-
// so it thinks it's on the web and can't import correctly other modules.
4-
// The workaround here resets the `document` to make it detect that it's on node.
5-
// It can removed once this repo became an ESM package.
6-
const originalDocument = global.document;
7-
global.document = undefined;
1+
import { afterAll, it, describe } from 'vitest';
2+
import { RuleTester } from '@typescript-eslint/rule-tester';
3+
import TSESlintParser from '@typescript-eslint/parser';
4+
import path from 'node:path';
5+
import rule from './no-direct-state-access';
86

9-
const path = require('path');
10-
const mocha = require('mocha');
11-
const { RuleTester } = require('@typescript-eslint/rule-tester');
12-
const TSESlintParser = require('@typescript-eslint/parser');
13-
const rule = require('./no-direct-state-access');
14-
15-
RuleTester.afterAll = mocha.after;
7+
RuleTester.afterAll = afterAll;
8+
RuleTester.it = it;
9+
RuleTester.itOnly = it.only;
10+
RuleTester.describe = describe;
1611

1712
const ruleTester = new RuleTester({
1813
languageOptions: {
@@ -26,24 +21,34 @@ const ruleTester = new RuleTester({
2621

2722
ruleTester.run('no-direct-state-access', rule, {
2823
valid: [
29-
`
24+
{
25+
name: 'assigning received grid state to a variable',
26+
code: `
3027
const useCustomHook = (apiRef: GridApiRef) => {
3128
const state = apiRef.current.state;
3229
}
3330
`,
34-
`
31+
},
32+
{
33+
name: 'accessing any state directly',
34+
code: `
3535
const useCustomHook = (api: any) => {
3636
const rows = api.current.state.rows;
3737
}
3838
`,
39-
`
39+
},
40+
{
41+
name: 'passing any state to a function',
42+
code: `
4043
const useCustomHook = (api: any) => {
4144
const rows = gridRowsSelector(api.current.state);
4245
}
4346
`,
47+
},
4448
],
4549
invalid: [
4650
{
51+
name: 'directly accessing variable inside received grid state',
4752
code: `
4853
type GridApiRef = React.MutableRefObject<any>;
4954
const useCustomHook = (apiRef: GridApiRef) => {
@@ -53,6 +58,7 @@ const useCustomHook = (apiRef: GridApiRef) => {
5358
errors: [{ messageId: 'direct-access', line: 4, column: 16 }],
5459
},
5560
{
61+
name: 'directly accessing variable inside grid state from the hook context',
5662
code: `
5763
type GridApiRef = React.MutableRefObject<any>;
5864
const useGridApiContext = (): GridApiRef => { return {} };
@@ -64,6 +70,7 @@ const useCustomHook = () => {
6470
errors: [{ messageId: 'direct-access', line: 6, column: 16 }],
6571
},
6672
{
73+
name: 'destructuring variable from grid state',
6774
code: `
6875
type GridApiRef = React.MutableRefObject<any>;
6976
const useGridApiContext = (): GridApiRef => { return {} };
@@ -76,5 +83,3 @@ const useCustomHook = () => {
7683
},
7784
],
7885
});
79-
80-
global.document = originalDocument;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"jsx": "preserve",
5+
"target": "es5",
6+
"module": "preserve",
7+
"strict": true,
8+
"esModuleInterop": true,
9+
"lib": ["es2015", "es2017", "esnext"],
10+
"experimentalDecorators": true,
11+
"types": ["node"],
12+
"skipLibCheck": true
13+
},
14+
"include": ["src/**/*"]
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
environment: 'node',
6+
},
7+
});

0 commit comments

Comments
 (0)