Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "svelte-formup"

Index

Type aliases

EventName

EventName: keyof GlobalEventHandlersEventMap | string

A DOM event. Common events are:

Invalidator

Invalidator<T>: (value?: T) => void

Cleanup logic callback.

Type parameters

  • T

Type declaration

    • (value?: T): void
    • Parameters

      • Optional value: T

      Returns void

Subscriber

Subscriber<T>: (value: T) => void

Callback to inform of a value updates.

Type parameters

  • T

Type declaration

    • (value: T): void
    • Parameters

      • value: T

      Returns void

SvelteAction

SvelteAction<P>: (node: Element, parameters?: P) => SvelteActionResult<P>

A svelte action to be applied on a element

Type parameters

  • P

Type declaration

Unsubscriber

Unsubscriber: () => void

Unsubscribes from value updates.

Type declaration

    • (): void
    • Returns void

Updater

Updater<T>: (value: T) => T

Callback to update a value.

Type parameters

  • T

Type declaration

    • (value: T): T
    • Parameters

      • value: T

      Returns T

Functions

Const formup

  • formup<Values, State>(__namedParameters: { autocomplete: string; classes: ValidityCSSClasses; debounce: number; dirtyOn: string | string[]; getInitialValues: (event?: Event) => Partial<NonNullable<Values>>; onReset: (context: FormupContext<Values, State>, event?: Event) => void; onSubmit: (values: Values, context: FormupContext<Values, State>, event?: Event & { submitter?: HTMLButtonElement | HTMLInputElement }) => void | Promise<void>; schema: FormupSchema<Values, {}>; state: State; validateInitialValues: boolean; validateOn: string | string[] }): FormupContext<Values, State>
  • Creates and registers a new FormupContext using the options and returns it.

    <script>
      import { formup } from 'svelte-formup'
    
      const context = formup(options)
    </script>

    Type parameters

    • Values

    • State

    Parameters

    • __namedParameters: { autocomplete: string; classes: ValidityCSSClasses; debounce: number; dirtyOn: string | string[]; getInitialValues: (event?: Event) => Partial<NonNullable<Values>>; onReset: (context: FormupContext<Values, State>, event?: Event) => void; onSubmit: (values: Values, context: FormupContext<Values, State>, event?: Event & { submitter?: HTMLButtonElement | HTMLInputElement }) => void | Promise<void>; schema: FormupSchema<Values, {}>; state: State; validateInitialValues: boolean; validateOn: string | string[] }
      • autocomplete: string
      • classes: ValidityCSSClasses
      • debounce: number
      • dirtyOn: string | string[]
      • getInitialValues: (event?: Event) => Partial<NonNullable<Values>>
          • (event?: Event): Partial<NonNullable<Values>>
          • Parameters

            • Optional event: Event

            Returns Partial<NonNullable<Values>>

      • onReset: (context: FormupContext<Values, State>, event?: Event) => void
          • Parameters

            Returns void

      • onSubmit: (values: Values, context: FormupContext<Values, State>, event?: Event & { submitter?: HTMLButtonElement | HTMLInputElement }) => void | Promise<void>
          • (values: Values, context: FormupContext<Values, State>, event?: Event & { submitter?: HTMLButtonElement | HTMLInputElement }): void | Promise<void>
          • Parameters

            • values: Values
            • context: FormupContext<Values, State>
            • Optional event: Event & { submitter?: HTMLButtonElement | HTMLInputElement }

            Returns void | Promise<void>

      • schema: FormupSchema<Values, {}>
      • state: State
      • validateInitialValues: boolean
      • validateOn: string | string[]

    Returns FormupContext<Values, State>

Const getFormupContext

  • getFormupContext<Values, State>(): FormupContext<Values, State>
  • Returns the FormupContext.

    <script>
      import { getFormupContext } from 'svelte-formup'
    
      const context = getFormupContext()
    </script>

    Type parameters

    • Values

    • State

    Returns FormupContext<Values, State>

Generated using TypeDoc