Bootstrap

API widget

createWidgetFactory

function

createWidgetFactory<W, T>(widgetName, factory): WidgetFactory<W, T>

Define a widget factory that can be linked with configuration through the provided widget name.

Type Parameters
W

W extends Widget<object, object, object, object>

The type of the widget

T

T extends (config?) => W = (config?) => W

The type of the widget factory function. Useful when the widget factory has a generic.

Parameters
widgetName

string

the widget name, used for configuration injection

factory

T

the widget factory function

Returns

WidgetFactory<W, T>

the widget factory


useWidgetWithConfig

function

useWidgetWithConfig<W>(factory, props, propsConfig?): WidgetSlotContext<W>

Create and attach an agnos-ui/core widget to the current react component.

Type Parameters
W

W extends Widget<object, object, object, object>

The type of the widget.

Parameters
factory

WidgetFactory<W>

the widget factory

props

Partial<WidgetProps<W>> = {}

the props

propsConfig?

PropsConfig<WidgetProps<W>>

the props config

Returns

WidgetSlotContext<W>

the state, api and directives to track and interact with the widget