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

52 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-03-21 12:10:32 +00:00
import * as React from "react"
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
2019-08-29 11:22:09 +00:00
import { WidgetType } from "../constants/WidgetConstants"
2019-03-21 12:10:32 +00:00
import RadioGroupComponent from "../editorComponents/RadioGroupComponent"
import { IOptionProps } from "@blueprintjs/core"
class RadioButtonWidget extends BaseWidget<
2019-08-29 11:22:09 +00:00
RadioGroupWidgetProps,
2019-03-21 12:10:32 +00:00
IWidgetState
> {
getPageView() {
return (
<RadioGroupComponent
style={this.getPositionStyle()}
widgetId={this.props.widgetId}
key={this.props.widgetId}
inline={this.props.inline}
label={this.props.label}
name={this.props.name}
handleRadioChange={this.props.handleRadioChange}
selectedValue={this.props.selectedValue}
items={this.props.items}
disabled={this.props.disabled}
className={this.props.className}
options={this.props.options}
/>
)
}
getWidgetType(): WidgetType {
return "RADIO_GROUP_WIDGET"
}
}
2019-08-29 11:22:09 +00:00
export interface RadioGroupWidgetProps extends IWidgetProps {
label: string;
inline: boolean;
selectedValue: string | number;
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void;
disabled: boolean;
className: string;
name: string;
options: IOptionProps[];
2019-03-21 12:10:32 +00:00
items: Array<{
2019-08-29 11:22:09 +00:00
label: string;
value: number | string;
}>;
2019-03-21 12:10:32 +00:00
}
export default RadioButtonWidget