u
This commit is contained in:
@@ -60,6 +60,10 @@ class AppDialog extends Component {
|
||||
transitionDuration: _transitionDuration,
|
||||
TransitionProps: _transitionProps,
|
||||
TransitionComponent: _transitionComponent,
|
||||
// Legacy MUI prop (removed in v9) — merge into slotProps.paper instead
|
||||
// of spreading onto Dialog/DOM where it triggers
|
||||
// "React does not recognize the `PaperProps` prop" warnings.
|
||||
PaperProps: legacyPaperProps,
|
||||
disableScrollLock = true,
|
||||
slotProps: userSlotProps,
|
||||
slots: userSlots,
|
||||
@@ -69,6 +73,18 @@ class AppDialog extends Component {
|
||||
void _transitionProps;
|
||||
void _transitionComponent;
|
||||
|
||||
const userPaper = userSlotProps?.paper ?? {};
|
||||
const { sx: userPaperSx, ...restPaper } = userPaper;
|
||||
const { sx: legacyPaperSx, ...restLegacyPaper } = legacyPaperProps ?? {};
|
||||
const toSxArray = (sx) =>
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
Array.isArray(sx) ? sx : sx ? [sx] : [];
|
||||
const mergedPaperSx = [...toSxArray(legacyPaperSx), ...toSxArray(userPaperSx)];
|
||||
const mergedPaper =
|
||||
mergedPaperSx.length > 0
|
||||
? { ...restLegacyPaper, ...restPaper, sx: mergedPaperSx }
|
||||
: { ...restLegacyPaper, ...restPaper };
|
||||
|
||||
const userBackdrop = userSlotProps?.backdrop ?? {};
|
||||
const { sx: userBackdropSx, ...restBackdrop } = userBackdrop;
|
||||
const userTransition = userSlotProps?.transition ?? {};
|
||||
@@ -77,6 +93,7 @@ class AppDialog extends Component {
|
||||
|
||||
const slotProps = {
|
||||
...userSlotProps,
|
||||
paper: mergedPaper,
|
||||
backdrop: {
|
||||
...restBackdrop,
|
||||
sx: [
|
||||
|
||||
Reference in New Issue
Block a user