import React from "react"; import BaseControl, { ControlProps } from "./BaseControl"; import { StyledDynamicInput } from "./StyledControls"; import { InputType } from "widgets/InputWidget"; import CodeEditor from "components/editorComponents/CodeEditor"; import { EditorModes, EditorSize, EditorTheme, TabBehaviour, } from "components/editorComponents/CodeEditor/EditorConfig"; export function InputText(props: { label: string; value: string; onChange: (event: React.ChangeEvent | string) => void; evaluatedValue?: any; expected?: string; placeholder?: string; dataTreePath?: string; additionalAutocomplete?: Record>; theme?: EditorTheme; hideEvaluatedValue?: boolean; }) { const { dataTreePath, evaluatedValue, expected, hideEvaluatedValue, onChange, placeholder, value, } = props; return ( ); } class InputTextControl extends BaseControl { render() { const { additionalAutoComplete, dataTreePath, defaultValue, expected, hideEvaluatedValue, label, placeholderText, propertyValue, } = this.props; return ( ); } isNumberType(): boolean { const { inputType } = this.props; switch (inputType) { case "CURRENCY": case "INTEGER": case "NUMBER": case "PHONE_NUMBER": return true; default: return false; } } onTextChange = (event: React.ChangeEvent | string) => { let value = event; if (typeof event !== "string") { value = event.target.value; } this.updateProperty(this.props.propertyName, value); }; static getControlType() { return "INPUT_TEXT"; } } export interface InputControlProps extends ControlProps { placeholderText: string; inputType: InputType; validationMessage?: string; isDisabled?: boolean; defaultValue?: any; } export default InputTextControl;