Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99754277
useSlotProps.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
Sun, Jan 26, 11:39
Size
1 KB
Mime Type
text/x-java
Expires
Tue, Jan 28, 11:39 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23818321
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useSlotProps.js
View Options
import
_extends
from
"@babel/runtime/helpers/esm/extends"
;
import
_objectWithoutPropertiesLoose
from
"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"
;
const
_excluded
=
[
"elementType"
,
"externalSlotProps"
,
"ownerState"
];
import
{
unstable_useForkRef
as
useForkRef
}
from
'@mui/utils'
;
import
appendOwnerState
from
'./appendOwnerState'
;
import
mergeSlotProps
from
'./mergeSlotProps'
;
import
resolveComponentProps
from
'./resolveComponentProps'
;
/**
* Builds the props to be passed into the slot of an unstyled component.
* It merges the internal props of the component with the ones supplied by the user, allowing to customize the behavior.
* If the slot component is not a host component, it also merges in the `ownerState`.
*
* @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
*/
export
default
function
useSlotProps
(
parameters
)
{
const
{
elementType
,
externalSlotProps
,
ownerState
}
=
parameters
,
rest
=
_objectWithoutPropertiesLoose
(
parameters
,
_excluded
);
const
resolvedComponentsProps
=
resolveComponentProps
(
externalSlotProps
,
ownerState
);
const
{
props
:
mergedProps
,
internalRef
}
=
mergeSlotProps
(
_extends
({},
rest
,
{
externalSlotProps
:
resolvedComponentsProps
}));
const
ref
=
useForkRef
(
internalRef
,
resolvedComponentsProps
?
.
ref
,
parameters
.
additionalProps
?
.
ref
);
const
props
=
appendOwnerState
(
elementType
,
_extends
({},
mergedProps
,
{
ref
}),
ownerState
);
return
props
;
}
Event Timeline
Log In to Comment