Options
All
  • Public
  • Public/Protected
  • All
Menu

mayoiga

Index

Type aliases

Controller<State>: { actions: ActionsCanBePublic<State>; components: { Field: any; Slicer: any }; useInitialize: any; useSelector: any }

Restricted type interface of the form store TODO: more restriction

Type parameters

Type declaration

  • actions: ActionsCanBePublic<State>
  • components: { Field: any; Slicer: any }
    • Field:function
      • Field<Name>(props: FieldProps<State, Name>): null | ReactElement<any, any>
      • Type parameters

        • Name: string | number | symbol

        Parameters

        Returns null | ReactElement<any, any>

    • Slicer:function
      • Slicer<Selected>(props: SliceProps<State, Selected>): null | ReactElement<any, any>
      • Type parameters

        • Selected: readonly unknown[]

        Parameters

        Returns null | ReactElement<any, any>

  • useInitialize:function
    • useInitialize(initialValue: Partial<State>): void
    • Parameters

      • initialValue: Partial<State>

      Returns void

  • useSelector:function
    • useSelector<R>(selector: (state: FullFormState<State>) => R, isEqual?: (prev: R, current: R) => boolean): R
    • Type parameters

      • R

      Parameters

      • selector: (state: FullFormState<State>) => R
      • Optional isEqual: (prev: R, current: R) => boolean
          • (prev: R, current: R): boolean
          • Parameters

            • prev: R
            • current: R

            Returns boolean

      Returns R

FieldProps<State, Name>: { name: Name; children: any }

Type parameters

Type declaration

  • name: Name
  • children:function
    • children(tool: { name: Name; value: State[Name]; onChange: any }, value: State[Name], errorMessage: null | string): ReactNode
    • Parameters

      • tool: { name: Name; value: State[Name]; onChange: any }
        • name: Name
        • value: State[Name]
        • onChange:function
          • onChange(this: void, name: Name, value: State[Name]): void
          • onChange(this: void, e: ChangeEvent<HTMLElement>): void
          • Parameters

            • this: void
            • name: Name
            • value: State[Name]

            Returns void

          • Parameters

            • this: void
            • e: ChangeEvent<HTMLElement>

            Returns void

      • value: State[Name]
      • errorMessage: null | string

      Returns ReactNode

FullFormState<State>: FormStatus & { errors: FormErrors<State>; value: State }

Type parameters

HandleChangeAction<State, R>: <Name>(name: Name, value: State[Name]) => R

Type parameters

Type declaration

    • <Name>(name: Name, value: State[Name]): R
    • Type parameters

      • Name: keyof State

      Parameters

      • name: Name
      • value: State[Name]

      Returns R

SliceProps<State, Selected>: { children: any; selector: any }

Type parameters

Type declaration

StateRestriction: Record<string, any>

Functions

  • createFormHook<StateBeforeValidation, Schema>(initialState: StateBeforeValidation, schema: Schema): FormHook<StateBeforeValidation, Schema>
  • Type parameters

    • StateBeforeValidation

    • Schema: ZodType<any, any, any, Schema>

    Parameters

    • initialState: StateBeforeValidation
    • schema: Schema

    Returns FormHook<StateBeforeValidation, Schema>

  • useFormSlice<State, Sliced>(formController: Controller<State>, selector: (s: FullFormState<State>) => Sliced): readonly [Sliced, ActionsCanBePublic<State>]

Generated using TypeDoc