@try-at-software/input-elements
Version:
A package providing different input elements that are extensible and easily configurable for your custom needs.
21 lines (20 loc) • 943 B
TypeScript
import { FormText } from './Components';
import { IInputElement } from './IInputElement';
export interface IValueInputElement<TValue> extends IInputElement {
/**
* The value entered into the input element.
*/
value: TValue;
/**
* Collection of validation rules that are executed whenever the entered value has changed.
* Some input elements may not use this value, e.g. dynamic list input elements should ignore it as every single underlying input element can have unique rules.
*/
validationRules: ValidationRule<TValue>[];
/**
* This method is called every time after the entered value has changed.
* Its main purpose is to call every single validation rule and update the error message if some of them has failed.
* It can be safely called from outside.
*/
validate(): void;
}
export declare type ValidationRule<TValue> = (value: TValue) => FormText;