ExtendWidgetAdaptSlotContentProps<
Props
,ExtraProps
,ExtraDirectives
>:Props
extendsWidgetSlotContext
<infer U> ?WidgetSlotContext
<ExtendWidgetProps
<U
,ExtraProps
,ExtraDirectives
>> &Omit
<Props
, keyofWidgetSlotContext
<any
>> :Props
Type to adapt the slot content properties of a widget by extending its props, extra props, and extra directives.
• Props extends Record
<string
, any
>
The original properties of the widget slot context.
• ExtraProps extends object
Additional properties to extend the widget slot context.
• ExtraDirectives extends object
Additional directives to extend the widget slot context.
This type conditionally checks if Props
extends WidgetSlotContext
and, if so, extends the widget slot context
with additional properties and directives while omitting the original widget slot context properties.
ExtendWidgetAdaptSlotWidgetProps<
Props
,ExtraProps
,ExtraDirectives
>:ExtraProps
&{ [K in keyof Props]: IsSlotContent<Props[K]> extends SlotContent<infer U> ? SlotContent<ExtendWidgetAdaptSlotContentProps<U, ExtraProps, ExtraDirectives>> : Props[K] }
Type definition for extending widget properties with additional properties and directives.
This type takes three generic parameters:
Props
: The original properties of the widget.ExtraProps
: Additional properties to be merged with the original properties.ExtraDirectives
: Additional directives to be merged with the original properties.The resulting type combines ExtraProps
with the original Props
. For each property in Props
,
if the property is of type SlotContent
, it will be extended with the additional properties and directives.
• Props
The original properties of the widget.
• ExtraProps extends object
Additional properties to be merged with the original properties.
• ExtraDirectives extends object
Additional directives to be merged with the original properties.
ExtendWidgetInterfaces<
Interfaces
,ExtraInterfaces
>:Interfaces
&ExtraInterfaces
Combines two interface types into a single type.
• Interfaces
The base interface type.
• ExtraInterfaces
The additional interface type to extend the base interface.
extendWidgetProps<
W
,ExtraProps
,ExtraDirectives
>(factory
,extraPropsDefaults
,extraPropsConfig
?,overrideDefaults
?):WidgetFactory
<ExtendWidgetProps
<W
,ExtraProps
,ExtraDirectives
>>
Method to extend the original widget with extra props with validator
• W extends Widget
<object
, object
, object
, object
>
The type of the widget.
• ExtraProps extends object
The type of the additional properties.
• ExtraDirectives extends object
= object
The type of the additional directives (default is an empty object).
• factory: WidgetFactory
<W
>
original widget factory
• extraPropsDefaults: ExtraProps
object containing default value for each extra prop
• extraPropsConfig?: ConfigValidator
<ExtraProps
>
object verifying the type of each extra prop
• overrideDefaults?: Partial
<WidgetState
<W
>>
object overriding some default props of the widget to extend
WidgetFactory
<ExtendWidgetProps
<W
, ExtraProps
, ExtraDirectives
>>
widget factory with the extra props
ExtendWidgetProps<
W
,ExtraProps
,ExtraDirectives
>:Widget
<ExtendWidgetAdaptSlotWidgetProps
<WidgetProps
<W
>,ExtraProps
,ExtraDirectives
>,ExtendWidgetAdaptSlotWidgetProps
<WidgetState
<W
>,ExtraProps
,ExtraDirectives
>,W
["api"
],ExtendWidgetInterfaces
<W
["directives"
],ExtraDirectives
>>
Type extending the original Widget props and state with ExtraProps
• W extends Widget
The base widget type to be extended.
• ExtraProps extends object
Additional properties to be added to the widget.
• ExtraDirectives extends object
= object
Additional directives to be added to the widget. Defaults to an empty object.