import React from "react";
import BaseControl, { ControlProps } from "./BaseControl";
import { InputType } from "widgets/InputWidget";
import { ControlType } from "constants/PropertyControlConstants";
import TextField from "components/editorComponents/form/fields/TextField";
export function InputText(props: {
label: string;
value: string;
isValid: boolean;
validationMessage?: string;
placeholder?: string;
dataType?: string;
isRequired?: boolean;
name: string;
}) {
const { name, placeholder, dataType } = props;
return (
);
}
class InputTextControl extends BaseControl {
render() {
const {
validationMessage,
propertyValue,
isValid,
label,
placeholderText,
dataType,
configProperty,
} = 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;
}
}
getType(dataType: InputType | undefined) {
switch (dataType) {
case "PASSWORD":
return "password";
case "NUMBER":
return "number";
default:
return "text";
}
}
getControlType(): ControlType {
return "INPUT_TEXT";
}
}
export interface InputControlProps extends ControlProps {
placeholderText: string;
inputType?: InputType;
dataType?: InputType;
}
export default InputTextControl;