Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100090831
extendSxProp.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jan 28, 03:33
Size
1 KB
Mime Type
text/x-java
Expires
Thu, Jan 30, 03:33 (2 d)
Engine
blob
Format
Raw Data
Handle
23873708
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
extendSxProp.js
View Options
import
_extends
from
"@babel/runtime/helpers/esm/extends"
;
import
_objectWithoutPropertiesLoose
from
"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"
;
const
_excluded
=
[
"sx"
];
import
{
isPlainObject
}
from
'@mui/utils'
;
import
defaultSxConfig
from
'./defaultSxConfig'
;
const
splitProps
=
props
=>
{
var
_props$theme$unstable
,
_props$theme
;
const
result
=
{
systemProps
:
{},
otherProps
:
{}
};
const
config
=
(
_props$theme$unstable
=
props
==
null
?
void
0
:
(
_props$theme
=
props
.
theme
)
==
null
?
void
0
:
_props$theme
.
unstable_sxConfig
)
!=
null
?
_props$theme$unstable
:
defaultSxConfig
;
Object
.
keys
(
props
).
forEach
(
prop
=>
{
if
(
config
[
prop
])
{
result
.
systemProps
[
prop
]
=
props
[
prop
];
}
else
{
result
.
otherProps
[
prop
]
=
props
[
prop
];
}
});
return
result
;
};
export
default
function
extendSxProp
(
props
)
{
const
{
sx
:
inSx
}
=
props
,
other
=
_objectWithoutPropertiesLoose
(
props
,
_excluded
);
const
{
systemProps
,
otherProps
}
=
splitProps
(
other
);
let
finalSx
;
if
(
Array
.
isArray
(
inSx
))
{
finalSx
=
[
systemProps
,
...
inSx
];
}
else
if
(
typeof
inSx
===
'function'
)
{
finalSx
=
(...
args
)
=>
{
const
result
=
inSx
(...
args
);
if
(
!
isPlainObject
(
result
))
{
return
systemProps
;
}
return
_extends
({},
systemProps
,
result
);
};
}
else
{
finalSx
=
_extends
({},
systemProps
,
inSx
);
}
return
_extends
({},
otherProps
,
{
sx
:
finalSx
});
}
Event Timeline
Log In to Comment