import { AsyncValidatorFn } from "@angular/forms"; import { ConstructSliceFromPath, DeepPropsObject, DeepPropType } from "@fretve/global-types"; import { Observable } from "rxjs"; import { DeepRequired } from "ts-essentials"; import { AsyncValidatorSelector, FormStateObserverSelector, FormStateSelector, FormStateSelectorFn } from "../interfaces"; import { ValidFormSlice } from "./interfaces"; import { _createControlField } from "./type.helpers"; declare type PickOr = [T] extends [never] ? Else : [P] extends [never] ? Else : Pick; /** Responsible for constructing type safe forms for a given TForm and TInputState. * @remarks Does not perform runtime checks, primarily used for type safe compilation. */ export declare class DynamicFormBuilder { /** Constructs selectors for TForm and TState that resolve to reactive observables. Used to bind options to form or state. */ bind(formSlice: ValidFormSlice, TFormSlice>[], stateSlice: TStateSlice[], setter: FormStateSelectorFn, TFormSlice>, Partial>, TReturnValue>, onlyOnce?: boolean): FormStateSelector, PickOr, TReturnValue, string, TStateSlice>; /** Constructs selectors for TState that resolve to reactive observables. Used to bind options to state. */ bindState(slice: TSlice, setter?: null, onlyOnce?: boolean): FormStateSelector<{}, PickOr, TInputState[TSlice], string, TSlice>; bindState(slice: TSlice, setter: (state: TInputState[TSlice]) => TReturnValue, onlyOnce?: boolean): FormStateSelector<{}, PickOr, TReturnValue, string, TSlice>; bindState(slice: TSlice[], setter: (state: Pick) => TReturnValue, onlyOnce?: boolean): FormStateSelector<{}, PickOr, TReturnValue, string, TSlice>; /** Constructs selectors for TForm that resolve to reactive observables. Used to bind options to form. */ bindForm(slice: ValidFormSlice, TSlice>, setter?: null, onlyOnce?: boolean): FormStateSelector, any, DeepPropType, string, never>; bindForm(slice: ValidFormSlice, TSlice>, setter: (state: DeepPropType) => TReturnValue, onlyOnce?: boolean): FormStateSelector, any, TReturnValue, string, never>; bindForm(slice: ValidFormSlice, TSlice>[], setter: (state: DeepPropsObject, TSlice>) => TReturnValue, onlyOnce?: boolean): FormStateSelector, any, TReturnValue, string, never>; /** Constructs selectors for TForm and TState with observable setters */ bindObserver(formSlice: ValidFormSlice, TFormSlice>[], stateSlice: TStateSlice[], setter: FormStateSelectorFn, TFormSlice>>, Observable>>, Observable>): FormStateObserverSelector, PickOr, TReturnValue, string, TStateSlice>; /** Constructs an observable selector for TState that returns an async validator. */ asyncValidator(formSlice: ValidFormSlice, TFormSlice>[], stateSlice: TStateSlice[], setter: FormStateSelectorFn, TFormSlice>>, Observable>>, AsyncValidatorFn>): AsyncValidatorSelector, PickOr, string, TStateSlice>; /** Create a function for creating type safe {@link ControlGroupSchema} for a specified TGroup. * @returns A function that creates type safe {@link ControlGroupSchema} for the specified TGroup */ group(): , TGroupComponent extends import("@fretve/global-types").Maybe>> = undefined>(group: import("./interfaces").ControlGroupSchema] ? TGroupComponent : undefined>) => import("./interfaces").ControlGroupSchema] ? TGroupComponent : undefined>; /** Constructs a type safe {@link ControlArraySchema}. */ array: , TArrayComponent extends import("@angular/core").Type> | undefined = undefined>(control: import("./interfaces").ControlArraySchema] ? TArrayComponent : undefined>) => import("./interfaces").ControlArraySchema] ? TArrayComponent : undefined>; /** Constructs a type safe {@link ControlFieldSchema}. */ field: typeof _createControlField; } export {};