UNPKG

@gavant/ember-validations

Version:

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

60 lines (59 loc) 2.25 kB
import Component from '@glimmer/component'; import { WithBoundArgs } from '@glint/template'; import FormValidator from "../index"; import { ValueForChangeset } from "../index"; import { GenericChangeset } from "../../../utilities/create-changeset"; import InputValidator from "../../input-validator/index"; interface FormValidatorChildArgs<C extends GenericChangeset<V>, V = ValueForChangeset<C>> { /** * So this is actually not optional. But due to a limitation with `withBoundArgs` it doesnt pass the correct type information down. * This is a workaround to allow us to not use withBoundArgs but still get the right type information. For all cases I can think of this will be * passed automatically by the parent component and we wont have to worry about it. * * @type {FormValidator<GenericChangeset<unknown>, unknown>} * @memberof FormValidatorChildArgs */ parent?: FormValidator<GenericChangeset<unknown>, unknown>; changeset: C; } interface FormValidatorChildSignature<C extends GenericChangeset<V>, V = ValueForChangeset<C>> { Args: FormValidatorChildArgs<C, V>; Element: HTMLDivElement; Blocks: { default: [ C, { input: WithBoundArgs<typeof InputValidator<C>, 'parent'>; showAllValidationFields: boolean; } ]; }; } declare class FormValidatorChild<C extends GenericChangeset<V>, V = ValueForChangeset<C>> extends Component<FormValidatorChildSignature<C, V>> { showAllValidationFields: boolean; /** * Creates an instance of FormValidatorChild. * @param {unknown} owner * @param {FormValidatorChildArgs<T>} args * @memberof FormValidatorChild */ /** * Creates an instance of FormValidatorChild. * @param {unknown} owner * @param {FormValidatorChildArgs<T>} args * @memberof FormValidatorChild */ constructor(owner: unknown, args: FormValidatorChildArgs<C, V>); /** * Deregister the child from the parent * * @memberof FormValidatorChild */ /** * Deregister the child from the parent * * @memberof FormValidatorChild */ willDestroy(): void; } export { FormValidatorChild as default };