Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

  • Form

Index

Constructors

constructor

  • new Form<T>(__namedParameters: { model: T; validations?: Partial<{ [ P in string | number | symbol]: FieldValidation<T, T> | Partial<{ [P in keyof T[P]]: FieldValidation<T[P], T[P]> | Partial<{ [P in keyof T[P][P]]: FieldValidation<T[P][P], T[P][P]> | Partial<{ [P in keyof T[P][P][P]]: FieldValidation<...> | Partial<...>; }>; }>; }> }>; onChange?: any; onInit?: any; onSubmit?: any; onSubmitError?: any; onUpdate?: any }): Form<T>
  • Type parameters

    • T

    Parameters

    • __namedParameters: { model: T; validations?: Partial<{ [ P in string | number | symbol]: FieldValidation<T, T> | Partial<{ [P in keyof T[P]]: FieldValidation<T[P], T[P]> | Partial<{ [P in keyof T[P][P]]: FieldValidation<T[P][P], T[P][P]> | Partial<{ [P in keyof T[P][P][P]]: FieldValidation<...> | Partial<...>; }>; }>; }> }>; onChange?: any; onInit?: any; onSubmit?: any; onSubmitError?: any; onUpdate?: any }
      • model: T
      • Optional validations?: Partial<{ [ P in string | number | symbol]: FieldValidation<T, T> | Partial<{ [P in keyof T[P]]: FieldValidation<T[P], T[P]> | Partial<{ [P in keyof T[P][P]]: FieldValidation<T[P][P], T[P][P]> | Partial<{ [P in keyof T[P][P][P]]: FieldValidation<...> | Partial<...>; }>; }>; }> }>
      • onChange?:function
        • onChange(form: Form<T>): void
      • onInit?:function
        • onInit(form: Form<T>): void
      • onSubmit?:function
        • onSubmit(form: Form<T>): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

      • onSubmitError?:function
        • onSubmitError(error: Error): void
        • Parameters

          • error: Error

          Returns void

      • onUpdate?:function
        • onUpdate(): void

    Returns Form<T>

Properties

Private #field

#field: FieldImplementation<T, T>

Private Optional #onChange

#onChange?: (form: Form<T>) => void

Type declaration

    • (form: Form<T>): void
    • Parameters

      Returns void

Private Optional #onUpdate

#onUpdate?: () => void

Type declaration

    • (): void
    • Returns void

Private #validations

#validations: Partial<{ [ P in string | number | symbol]: FieldValidation<T, T> | Partial<{ [P in keyof T[P]]: FieldValidation<T[P], T[P]> | Partial<{ [P in keyof T[P][P]]: FieldValidation<T[P][P], T[P][P]> | Partial<{ [P in keyof T[P][P][P]]: FieldValidation<...> | Partial<...>; }>; }>; }> }>

error

error: undefined | Error

Optional onSubmit

onSubmit?: (form: Form<T>) => void | Promise<void>

Type declaration

    • (form: Form<T>): void | Promise<void>
    • Parameters

      Returns void | Promise<void>

onSubmitError

onSubmitError: undefined | ((error: Error) => void)

submissionStatus

submissionStatus: SubmissionStatus = 'idle'

Accessors

changes

  • get changes(): Partial<T>

dirty

  • get dirty(): boolean

fields

  • get fields(): MappedFields<T>

model

  • get model(): T

touchedValues

  • get touchedValues(): Partial<T>

valid

  • get valid(): boolean

Methods

Private onUpdate

  • onUpdate(): void

reset

  • reset(): void

resetError

  • resetError(): void

submit

  • submit(e?: { preventDefault: any }): Promise<void>
  • Parameters

    • Optional e: { preventDefault: any }
      • preventDefault:function
        • preventDefault(): void

    Returns Promise<void>

touch

  • touch(): void

updateFields

  • updateFields(model: Partial<T>): void
  • Parameters

    • model: Partial<T>

    Returns void

updateOriginalModel

  • updateOriginalModel(value: Partial<T>): void
  • Parameters

    • value: Partial<T>

    Returns void

validate

  • validate(): void

Generated using TypeDoc