UNPKG

@gavant/ember-validations

Version:

A form validator library using ember-changeset and ember-changeset-validations

92 lines (91 loc) 2.35 kB
import Component from '@glimmer/component'; import { ValidationErr } from 'validated-changeset/dist/types'; interface InputValidatorArgs<T> { errors?: string | string[] | ValidationErr[]; parent: any | T; text?: string; hideErrorText?: boolean; } interface InputValidatorSignature<T> { Args: InputValidatorArgs<T>; Element: HTMLDivElement; Blocks: { default: []; }; } declare class InputValidator<T> extends Component<InputValidatorSignature<T>> { labelClass: string; errorClass: string; hasFocusedOut: boolean; label: boolean; get isInvalid(): any; get hasLabel(): boolean; get hasError(): boolean; get showError(): any; get fieldLabel(): string | undefined; get formattedErrors(): string; /** * Creates an instance of InputValidator. * @param {unknown} owner * @param {InputValidatorArgs<T>} args * @memberof InputValidator */ /** * Creates an instance of InputValidator. * @param {unknown} owner * @param {InputValidatorArgs<T>} args * @memberof InputValidator */ constructor(owner: unknown, args: InputValidatorArgs<T>); /** * On insert, set the label for attribute * * @param {HTMLElement} element * @memberof InputValidator */ /** * On insert, set the label for attribute * * @param {HTMLElement} element * @memberof InputValidator */ onInsert(element: HTMLElement): void; /** * Set focused out value * * @param {boolean} value * @memberof InputValidator */ /** * Set focused out value * * @param {boolean} value * @memberof InputValidator */ setFocusedOut(value: boolean): void; /** * After the changeset is updated, set the focused value * * @memberof InputValidator */ /** * After the changeset is updated, set the focused value * * @memberof InputValidator */ changesetHasChanged(): void; /** * Set label for attribute * * @param {HTMLElement} element * @memberof InputValidator */ /** * Set label for attribute * * @param {HTMLElement} element * @memberof InputValidator */ setLabelForAttribute(element: HTMLElement): void; } export { InputValidator as default };