41 lines
853 B
TypeScript
41 lines
853 B
TypeScript
import React from "react";
|
|
import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget";
|
|
import { WidgetType } from "../constants/WidgetConstants";
|
|
|
|
class InputWidget extends BaseWidget<InputWidgetProps, WidgetState> {
|
|
getPageView() {
|
|
return <div />;
|
|
}
|
|
|
|
getWidgetType(): WidgetType {
|
|
return "INPUT_WIDGET";
|
|
}
|
|
}
|
|
|
|
export type InputType =
|
|
| "TEXT"
|
|
| "NUMBER"
|
|
| "INTEGER"
|
|
| "PHONE_NUMBER"
|
|
| "EMAIL"
|
|
| "PASSWORD"
|
|
| "CURRENCY"
|
|
| "SEARCH";
|
|
|
|
export interface InputValidator {
|
|
validationRegex: string;
|
|
errorMessage: string;
|
|
}
|
|
export interface InputWidgetProps extends WidgetProps {
|
|
inputType: InputType;
|
|
defaultText?: string;
|
|
placeholderText?: string;
|
|
maxChars?: number;
|
|
label: string;
|
|
inputValidators: InputValidator[];
|
|
focusIndex?: number;
|
|
isAutoFocusEnabled?: boolean;
|
|
}
|
|
|
|
export default InputWidget;
|