PromucFlow_constructor/app/client/src/widgets/CheckboxWidget.tsx

33 lines
806 B
TypeScript
Raw Normal View History

2019-09-09 09:08:54 +00:00
import React from "react";
import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget";
import { WidgetType } from "../constants/WidgetConstants";
import CheckboxComponent from "../editorComponents/CheckboxComponent";
2019-03-21 12:10:32 +00:00
2019-09-09 09:08:54 +00:00
class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, WidgetState> {
2019-03-21 12:10:32 +00:00
getPageView() {
return (
<CheckboxComponent
style={this.getPositionStyle()}
widgetId={this.props.widgetId}
key={this.props.widgetId}
items={this.props.items}
/>
2019-09-09 09:08:54 +00:00
);
2019-03-21 12:10:32 +00:00
}
getWidgetType(): WidgetType {
2019-09-09 09:08:54 +00:00
return "ICON_WIDGET";
2019-03-21 12:10:32 +00:00
}
}
2019-09-09 09:08:54 +00:00
export interface CheckboxWidgetProps extends WidgetProps {
2019-03-21 12:10:32 +00:00
items: Array<{
2019-08-29 11:22:09 +00:00
label: string;
2019-09-09 09:08:54 +00:00
key: string;
2019-08-29 11:22:09 +00:00
defaultIndeterminate: boolean;
value: number | string;
}>;
2019-03-21 12:10:32 +00:00
}
2019-09-09 09:08:54 +00:00
export default CheckboxWidget;