Skip to main content

FormContext

Properties

(Mandatory properties are in bold)
PropertiesTypeDescription
addadd<K>(fieldArrayName: K,initialValue: Partial<ArrayElement<PathType<T, K>>>): void
addFieldaddField(field: Field<T>): void
addValidatoraddValidator(fieldName: NestedKeyOf<T>,validatorName: string,validator: Validator): void
callSagacallSaga(sagaName: string,args: any[]): void
clearErrorclearError(fieldName: NestedKeyOf<T>,validatorName: string,compile: boolean): void
clearValidationclearValidation(fieldName: NestedKeyOf<T>,validatorName: undefined | string,code: ValidationCode,compile: boolean): void
clearWarningclearWarning(fieldName: NestedKeyOf<T>,validatorName: string,compile: boolean): void
compileValidationscompileValidations(fieldNames: NestedKeyOf<T> | NestedKeyOf<T>[],force: boolean): void
configFormConfig
constructornew FormService<T>()
decoratordecorator(name: string,options: FormMetadata): FormDecorator
decoratorsAnonymousObject<FormDecorator>
delayLoadingdelayLoading(delay_ms: number): void
disabledisable(fieldOrDecoratorName: string,match: boolean): void
disableValidatordisableValidator(fieldName: NestedKeyOf<T>,validatorName: string): void
enableenable(fieldOrDecoratorName: string,match: boolean): void
enableValidatorenableValidator(fieldName: NestedKeyOf<T>,validatorName: string): void
fieldfield(name: NestedKeyOf<T>,validators: AnonymousObject<Validator>,options: FieldOptions): FieldProps<any>this method is an helper to quickly register a field from a component. It will return
  • name
  • value
  • onChange
  • onFocus
  • onBlur | | fields | AnonymousKeyObject<T, Field<T>> | | | getContainerFieldValidation | getContainerFieldValidation(validations: AnonymousObject<default>,fields: AnonymousKeyObject<T, Field<any>>,prefix: string,touchedOnly: boolean): default | | | getContext | getContext(key: string,defaultValue: any): any | | | getValidation | | | | getValue | getValue(fieldName: ,defaultValue: T): T | | | hasValidation | hasValidation(fieldName: NestedKeyOf<T>,validatorName: string,code: ValidationCode,message: string): boolean | | | hide | hide(fieldOrDecoratorName: string,match: boolean): void | | | initDecorator | initDecorator(name: string,options: FormMetadata): FormDecorator | Register a decorator. Unlike a field, a decorator has no value but can have metadata (like disabled / visible) | | initField | initField(name: NestedKeyOf<T>,validators: AnonymousObject<Validator>,options: FieldOptions): FieldProps<any> | Register a field and return three listeners
  • onChange
  • onFocus
  • onBlur | | initializing | boolean | | | insert | insert(fieldArrayName: NestedKeyOf<T>,index: number,initialValue: ): void | | | isTouched | isTouched(fieldName: NestedKeyOf<T>): boolean | | | listeners | | | | loadInitialValues | loadInitialValues(fetcher: string | ): void | | | metadataChange | AnonymousObject<FormListenerProps[]> | | | obfuscate | obfuscate(value: any,fieldName: string): any | | | offChange | offChange(type: FormListenerType,id: string): void | | | offMetadataChange | offMetadataChange(id: string): void | | | offSubmittingChange | offSubmittingChange(id: string): void | | | offValidationChange | offValidationChange(id: string): void | | | offValueChange | offValueChange(id: string): void | | | onChange | onChange(type: FormListenerType,id: string,listener: FormValueListener | FormValidationListener | FormSubmitListener,watchs: string | string[],once: boolean): void | | | onMetadataChange | onMetadataChange(id: string,listener: FormMetadataListener,watchs: string | string[],once: boolean): void | | | onMount | onMount(): void | | | onSubmittingChange | onSubmittingChange(id: string,listener: FormSubmitListener,once: boolean): void | | | onValidationChange | onValidationChange(id: string,listener: FormValidationListener,watchs: string | string[],once: boolean): void | | | onValueChange | onValueChange(id: string,listener: FormValueListener,watchs: string | string[],once: boolean): void | | | pendingDispatch | | | | prevMetadata | AnonymousObject<FormMetadata> | | | prevSubmitting | boolean | | | prevValidations | AnonymousObject<default> | | | prevValues | AnonymousObject<any> | | | remove | remove(fieldArrayName: NestedKeyOf<T>,index: number): void | | | removeValidator | removeValidator(fieldName: NestedKeyOf<T>,validatorName: string): void | | | reset | reset(): void | | | serializeValidationCode | serializeValidationCode(code: ValidationCode): ValidationStatus | | | setContext | setContext(key: undefined | string,value: any): any | | | setError | setError(fieldName: NestedKeyOf<T>,validatorName: string,message: string,match: boolean): boolean | | | setInitialValues | setInitialValues(values: Partial<T>): void | | | setLoading | setLoading(loading: boolean,fetching: boolean): void | | | setMetadata | setMetadata<K>(fieldOrDecoratorName: string,key: K,value: ,force: boolean): void | | | setMetadatas | setMetadatas(metadatas: AnonymousObject<FormMetadata>): void | | | setOK | setOK(fieldName: NestedKeyOf<T>,validatorName: string): boolean | | | setOrClearValidation | setOrClearValidation(code: ValidationCode,fieldName: NestedKeyOf<T>,validatorName: string,message: string,match: boolean): boolean | | | setPendingValidation | setPendingValidation(fieldName: NestedKeyOf<T>,validatorName: string,pending: boolean): boolean | | | setSubmitting | setSubmitting(submitting: boolean): void | | | setValidation | setValidation(fieldName: NestedKeyOf<T>,validatorName: string,code: ValidationCode,message: string,compile: boolean): void | | | setValue | setValue<K>(fieldName: K,value: PathType<T, K>): void | | | setValues | setValues(values: AnonymousPathObject<T>): void | | | setWarning | setWarning(fieldName: NestedKeyOf<T>,validatorName: string,message: string,match: boolean): boolean | | | show | show(fieldOrDecoratorName: string,match: boolean): void | | | state | FormState<T> | | | submit | submit(): void | | | submittingChange | AnonymousObject<FormListenerProps[]> | | | touch | touch(fieldName: NestedKeyOf<T>): void | | | touchAll | touchAll(): void | | | triggered | AnonymousObject<boolean> | | | validateAll | validateAll(values: AnonymousPathObject<T>): AnonymousKeyObject<T, default> | | | validateAsync | validateAsync(fieldName: NestedKeyOf<T>,validatorName: string,validator: ValidatorAsyncFunction,value: any): void | | | validateSync | validateSync(fieldName: NestedKeyOf<T>,validatorName: string,validator: ValidatorSyncFunction,value: any): void | | | validationChange | AnonymousObject<FormListenerProps[]> | | | valueChange | AnonymousObject<FormListenerProps[]> | |