import Widget from "../../../canvas/widgets/base" import Tools from "../../../canvas/constants/tools" import { removeKeyFromObject } from "../../../utils/common" class SpinBox extends Widget{ static widgetType = "spin_box" constructor(props) { super(props) this.droppableTags = null // disables drops const newAttrs = removeKeyFromObject("layout", this.state.attrs) this.state = { ...this.state, size: { width: 120, height: 40 }, attrs: { ...newAttrs, styling: { ...newAttrs.styling, foregroundColor: { label: "Foreground Color", tool: Tools.COLOR_PICKER, // the tool to display, can be either HTML ELement or a constant string value: "#000", onChange: (value) => { this.setWidgetStyling("color", value) this.setAttrValue("styling.foregroundColor", value) } } }, placeHolder: { label: "PlaceHolder", tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string toolProps: {placeholder: "text", maxLength: 100}, value: "placeholder text", onChange: (value) => this.setAttrValue("placeHolder", value) } } } } componentDidMount(){ super.componentDidMount() this.setAttrValue("styling.backgroundColor", "#fff") this.setWidgetName("Entry") } getToolbarAttrs(){ const toolBarAttrs = super.getToolbarAttrs() return ({ id: this.__id, widgetName: toolBarAttrs.widgetName, placeHolder: this.state.attrs.placeHolder, size: toolBarAttrs.size, ...this.state.attrs, }) } renderContent(){ return (