Skip to content

Commit 31a9a34

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bubble
2 parents 9659ffd + feb126a commit 31a9a34

17 files changed

Lines changed: 261 additions & 44 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.cursor
66
.claude/settings.local.json
77
.claude/worktrees/
8+
.claude/scheduled_tasks.lock
89
.junie
910

1011
__diff_output__

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@mui/icons-material": "catalog:",
3131
"@mui/base": "^5.0.0-beta.70",
3232
"@mui/internal-core-docs": "catalog:",
33-
"@mui/internal-docs-infra": "^0.11.1-canary.8",
33+
"@mui/internal-docs-infra": "^0.11.1-canary.11",
3434
"@mui/lab": "^9.0.0-beta.3",
3535
"@mui/material": "catalog:",
3636
"@mui/material-nextjs": "^9.0.1",

docs/src/modules/components/overview/pickers/MainDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function MainDemo() {
7777
const brandingTheme = useTheme();
7878
const isMobile = useMediaQuery(brandingTheme.breakpoints.down('sm'));
7979
const isTablet = useMediaQuery(brandingTheme.breakpoints.up('md'));
80-
const isDesktop = useMediaQuery(brandingTheme.breakpoints.up('xl'));
80+
const isDesktop = useMediaQuery(brandingTheme.breakpoints.up('lg'));
8181

8282
const [showCustomTheme, setShowCustomTheme] = React.useState(false);
8383

docs/src/modules/components/overview/pickers/mainDemo/DateRangeWithShortcuts.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ function CustomLayout(props: CustomLayoutProps) {
6666
ownerState={ownerState}
6767
sx={{
6868
overflow: 'auto',
69+
gridAutoColumns: isHorizontal ? 'auto auto auto' : undefined,
6970
[`.${pickersLayoutClasses.shortcuts}`]: isHorizontal
7071
? {
71-
gridColumn: 2,
72+
gridColumn: '2/4',
7273
gridRow: 1,
7374
display: 'flex',
7475
flexGrow: 1,

docs/src/modules/components/overview/pickers/themes/customTheme.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ export const getCustomTheme = (mode: PaletteMode, config: Config): ThemeOptions
327327
}),
328328
root: ({ theme }) => ({
329329
width: theme.mixins.density.width * 7 + theme.mixins.density.spacing * 6,
330+
// `DateRangeCalendar` hard-codes `minWidth: 312` / `minHeight: 240`
331+
// on the day-grid wrapper for the default 36px cells; when this
332+
// composite shrinks them via `theme.mixins.density`, that hard-coded
333+
// floor leaks past the cells and shifts the day grid one column
334+
// right of the weekday header. Track the density values to avoid
335+
// that mismatch.
336+
'& .MuiDayCalendar-slideTransition': {
337+
minWidth: theme.mixins.density.width * 7 + theme.mixins.density.spacing * 6,
338+
minHeight: theme.mixins.density.height * 6 + 4 * 6,
339+
},
330340
}),
331341
weekContainer: ({ theme }) => ({
332342
height: theme.mixins.density.height,

packages/x-data-grid-pro/src/tests/lazyLoader.DataGridPro.test.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@ describe('<DataGridPro /> - Lazy loader', () => {
5858
// Needs layout
5959
it.skipIf(isJSDOM)('should not call onFetchRows if the viewport is fully loaded', () => {
6060
const handleFetchRows = spy();
61-
const rows = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }, { id: 6 }, { id: 7 }];
61+
// The virtualizer renders one row past the visible viewport + buffer (see
62+
// `getIndexesToRender`), so the loaded section must cover that extra row
63+
// to keep the rendered range skeleton-free.
64+
const rows = [
65+
{ id: 1 },
66+
{ id: 2 },
67+
{ id: 3 },
68+
{ id: 4 },
69+
{ id: 5 },
70+
{ id: 6 },
71+
{ id: 7 },
72+
{ id: 8 },
73+
];
6274
render(<TestLazyLoader onFetchRows={handleFetchRows} rowCount={50} rows={rows} />);
6375
expect(handleFetchRows.callCount).to.equal(0);
6476
});

packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,14 @@ describe('<DataGridPro /> - Rows', () => {
453453
const { setProps } = render(
454454
<TestCaseVirtualization nbRows={5} nbCols={2} height={160} rowBufferPx={0} />,
455455
);
456-
expect(getRows()).to.have.length(1);
456+
// `getIndexesToRender` renders one extra row past the visible viewport so
457+
// there is no empty space if the user starts scrolling, hence the +1.
458+
expect(getRows()).to.have.length(2);
457459
setProps({
458460
height: 220,
459461
});
460462
await waitFor(() => {
461-
expect(getRows()).to.have.length(3);
463+
expect(getRows()).to.have.length(4);
462464
});
463465
});
464466

@@ -529,6 +531,9 @@ describe('<DataGridPro /> - Rows', () => {
529531
const n = 2;
530532
const columnWidth = 100;
531533
const columnBufferPx = n * columnWidth;
534+
// `getIndexesToRender` renders one extra column past the visible viewport
535+
// (or past the buffer) so a horizontal scroll does not leave empty space.
536+
const extra = 1;
532537
render(
533538
<TestCaseVirtualization
534539
width={width + border * 2}
@@ -537,12 +542,14 @@ describe('<DataGridPro /> - Rows', () => {
537542
/>,
538543
);
539544
const firstRow = getRow(0);
540-
expect($$(firstRow, '[role="gridcell"]')).to.have.length(Math.floor(width / columnWidth) + n);
545+
expect($$(firstRow, '[role="gridcell"]')).to.have.length(
546+
Math.floor(width / columnWidth) + n + extra,
547+
);
541548
const virtualScroller = document.querySelector('.MuiDataGrid-virtualScroller')!;
542549
await act(async () => virtualScroller.scrollTo({ left: 301 }));
543550
await waitFor(() => {
544551
expect($$(firstRow, '[role="gridcell"]')).to.have.length(
545-
n + 1 + Math.floor(width / columnWidth) + n,
552+
n + 1 + Math.floor(width / columnWidth) + n + extra,
546553
);
547554
});
548555
});

packages/x-data-grid/src/tests/rows.DataGrid.test.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,20 +1078,23 @@ describe('<DataGrid /> - Rows', () => {
10781078
const border = 1;
10791079
const defaultRowHeight = 52;
10801080
const measuredRowHeight = 101;
1081+
// The virtualizer renders one extra row past the visible viewport (see
1082+
// `getIndexesToRender`), so a single-row viewport measures the first
1083+
// two rows; the rest are left at the default height.
1084+
const measuredRowCount = 2;
10811085
render(
10821086
<TestCase
10831087
columnHeaderHeight={columnHeaderHeight}
1084-
height={columnHeaderHeight + 20 + border * 2} // Force to only measure the first row
1088+
height={columnHeaderHeight + 20 + border * 2}
10851089
getBioContentHeight={() => measuredRowHeight}
10861090
getRowHeight={() => 'auto'}
10871091
rowBufferPx={0}
10881092
/>,
10891093
);
10901094
const element = document.querySelector('.MuiDataGrid-contentFiller');
10911095
const expectedHeight =
1092-
measuredRowHeight +
1093-
border + // Measured rows also include the border
1094-
(baselineProps.rows.length - 1) * defaultRowHeight;
1096+
measuredRowCount * (measuredRowHeight + border) + // Measured rows also include the border
1097+
(baselineProps.rows.length - measuredRowCount) * defaultRowHeight;
10951098

10961099
await waitFor(() => {
10971100
expect(element).toHaveComputedStyle({ height: `${expectedHeight}px` });
@@ -1103,20 +1106,24 @@ describe('<DataGrid /> - Rows', () => {
11031106
const border = 1;
11041107
const measuredRowHeight = 100;
11051108
const estimatedRowHeight = 90;
1109+
// See `getIndexesToRender` — a single-row viewport still measures the
1110+
// first two rows because of the trailing render-context safety row.
1111+
const measuredRowCount = 2;
11061112
render(
11071113
<TestCase
11081114
columnHeaderHeight={columnHeaderHeight}
1109-
height={columnHeaderHeight + 20 + border * 2} // Force to only measure the first row
1115+
height={columnHeaderHeight + 20 + border * 2}
11101116
getBioContentHeight={() => measuredRowHeight}
11111117
getEstimatedRowHeight={() => estimatedRowHeight}
11121118
getRowHeight={() => 'auto'}
11131119
rowBufferPx={0}
11141120
/>,
11151121
);
11161122
const element = document.querySelector('.MuiDataGrid-contentFiller');
1117-
const firstRowHeight = measuredRowHeight + border; // Measured rows also include the border
1123+
const measuredHeight = measuredRowHeight + border; // Measured rows also include the border
11181124
const expectedHeight =
1119-
firstRowHeight + (baselineProps.rows.length - 1) * estimatedRowHeight;
1125+
measuredRowCount * measuredHeight +
1126+
(baselineProps.rows.length - measuredRowCount) * estimatedRowHeight;
11201127

11211128
await waitFor(() => {
11221129
expect(element).toHaveComputedStyle({ height: `${expectedHeight}px` });
@@ -1187,8 +1194,11 @@ describe('<DataGrid /> - Rows', () => {
11871194
);
11881195
const virtualScroller = grid('virtualScroller')!;
11891196

1197+
// With one row of viewport, `getIndexesToRender` still renders (and
1198+
// therefore measures) the next row past the visible area, so the first
1199+
// two rows are measured before any scroll happens.
11901200
await waitFor(() => {
1191-
expect(virtualScroller.scrollHeight).to.equal(columnHeaderHeight + 101 + 52 + 52);
1201+
expect(virtualScroller.scrollHeight).to.equal(columnHeaderHeight + 101 + 101 + 52);
11921202
});
11931203

11941204
// It calculates the entire height of the scrollbar whenever the scroll event happens

packages/x-date-pickers/src/PickersTextField/PickersInputBase/PickersInputBase.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export const PickersInputBaseRoot = styled('div', {
6060
position: 'relative',
6161
boxSizing: 'border-box', // Prevent padding issue with fullWidth.
6262
letterSpacing: `${round(0.15 / 16)}em`,
63+
[`&.${pickersInputBaseClasses.disabled}`]: {
64+
color: (theme.vars || theme).palette.action.disabled,
65+
cursor: 'default',
66+
},
6367
variants: [
6468
{
6569
props: { isInputInFullWidth: true },

packages/x-date-pickers/src/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
5353
[`& .${pickersOutlinedInputClasses.notchedOutline}`]: {
5454
borderColor: (theme.vars || theme).palette.action.disabled,
5555
},
56-
'*': {
57-
color: (theme.vars || theme).palette.action.disabled,
58-
},
5956
},
6057
variants: Object.keys((theme.vars ?? theme).palette)
6158
// @ts-ignore

0 commit comments

Comments
 (0)