2019-02-10 16:39:09 +00:00
|
|
|
import BaseWidget, { IWidgetProps } from "../widgets/BaseWidget"
|
2019-02-10 13:06:05 +00:00
|
|
|
import ContainerWidget, {
|
|
|
|
|
IContainerWidgetProps
|
|
|
|
|
} from "../widgets/ContainerWidget"
|
2019-02-10 14:14:58 +00:00
|
|
|
import TextWidget, {
|
|
|
|
|
ITextWidgetProps
|
|
|
|
|
} from "../widgets/TextWidget"
|
2019-02-10 13:06:05 +00:00
|
|
|
import { IContainerProps } from "../editorComponents/ContainerComponent"
|
|
|
|
|
import WidgetFactory from "./WidgetFactory"
|
2019-02-10 14:14:58 +00:00
|
|
|
import { ITextComponentProps } from "../editorComponents/TextComponent";
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2019-02-10 13:21:19 +00:00
|
|
|
class WidgetBuilderRegistry {
|
|
|
|
|
static registerWidgetBuilders() {
|
2019-02-10 14:14:58 +00:00
|
|
|
|
2019-02-10 13:21:19 +00:00
|
|
|
WidgetFactory.registerWidgetBuilder("CONTAINER_WIDGET", {
|
|
|
|
|
buildWidget(
|
2019-02-10 16:39:09 +00:00
|
|
|
widgetData: IContainerWidgetProps<IWidgetProps>
|
|
|
|
|
): BaseWidget<IContainerWidgetProps<IWidgetProps>, IContainerProps> {
|
2019-02-10 13:21:19 +00:00
|
|
|
return new ContainerWidget(widgetData)
|
|
|
|
|
}
|
|
|
|
|
})
|
2019-02-10 14:14:58 +00:00
|
|
|
|
|
|
|
|
WidgetFactory.registerWidgetBuilder("TEXT_WIDGET", {
|
|
|
|
|
buildWidget(
|
|
|
|
|
widgetData: ITextWidgetProps
|
|
|
|
|
): BaseWidget<ITextWidgetProps, ITextComponentProps> {
|
|
|
|
|
return new TextWidget(widgetData)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2019-02-10 13:06:05 +00:00
|
|
|
}
|
2019-02-10 13:21:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default WidgetBuilderRegistry
|