Options
All
  • Public
  • Public/Protected
  • All
Menu

formulr - v0.3.1

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

$FieldSetBuilderChildren

$FieldSetBuilderChildren<ChildBuilders>: object

Type parameters

Type declaration

$FieldSetBuilderDefaultValue

$FieldSetBuilderDefaultValue<ChildBuilders>: Partial<$FieldSetValue<$FieldSetBuilderChildren<ChildBuilders>>>

Type parameters

$FieldSetValue

$FieldSetValue<Children>: object

Type parameters

Type declaration

$MergeProps

$MergeProps<T>:

Type parameters

  • T

Func

Func<Args, R>: function

Type parameters

  • Args: any[]

  • R

Type declaration

    • (...args: Args): R
    • Parameters

      • Rest ...args: Args

      Returns R

IFieldValueProps

Type parameters

  • T

IMaybeError

IMaybeError<T>: IValidateResult<T> | null | undefined

Type parameters

  • T

IUseFieldArray

IUseFieldArray<Item, Child>: [Child[], FieldArrayModel<Item, Child>]

Type parameters

IUseFieldSet

IUseFieldSet<T>: [IFormContext, FieldSetModel<T>]

Type parameters

IValidator

IValidator<T>: IAsyncValidator<T> | ISyncValidator<T>

Type parameters

  • T

IValidators

IValidators<T>: keyof IValidator<T>[]

Type parameters

  • T

Maybe

Maybe<T>: ISome<T> | null | undefined

Type parameters

  • T

Middleware

Middleware<F>: function

Type parameters

  • F

Type declaration

    • (next: F): F
    • Parameters

      • next: F

      Returns F

Variables

Const ASYNC_VALIDATOR

ASYNC_VALIDATOR: unique symbol = Symbol('AsyncValidator')

Const EMAIL_REGEXP

EMAIL_REGEXP: RegExp = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/

Const FIELD_ARRAY_ID

FIELD_ARRAY_ID: unique symbol = Symbol('field-array')

Const FIELD_ID

FIELD_ID: unique symbol = Symbol('field')

Const FORM_ID

FORM_ID: unique symbol = Symbol('form')

Const FormContext

FormContext: Context<null | IFormContext> = createContext<IFormContext | null>(null)

Const FormProvider

FormProvider: ProviderExoticComponent<ProviderProps<null | IFormContext>> = FormContext.Provider

Const MODEL_ID

MODEL_ID: unique symbol = Symbol('model')

Const REF_ID

REF_ID: unique symbol = Symbol('ref')

Const SET_ID

SET_ID: unique symbol = Symbol('set')

Const SOME

SOME: unique symbol = Symbol('some')

Const SYMBOL_REQUIRED

SYMBOL_REQUIRED: unique symbol = Symbol('required')

Const uniqueId

uniqueId: UniqueId = new UniqueId('field')

Functions

FieldSetValue

  • FieldSetValue(__namedParameters: object): null | Element
  • 根据 name 订阅 FieldSet 的值

    Parameters

    • __namedParameters: object
      • children: undefined | null | string | number | false | true | __type | ReactElement<any, string | function | object> | ReactNodeArray | ReactPortal
      • name: string

    Returns null | Element

FieldValue

Const None

  • None(): null

Const Some

  • Some<T>(value: T): ISome<T>

array

  • 创建一个 FieldArray builder

    Type parameters

    Parameters

    • childBuilder: ChildBuilder

      数组元素的 builder 对象,可以是 fieldarray 或者 set 的返回值

    Returns FieldArrayBuilder<ChildBuilder>

compose

  • compose<Target>(...middlewares: Middleware<Target>[]): (Anonymous function)
  • example middleware

    ```tsx function when(condition: () => boolean | Promise): Middleware<IValidator> { return (next: IValidator) => createAsyncValidator((value, ctx) => { return of(condition()).pipe( switchMap(cond => { if (cond) { return isAsyncValidator(next) ? next.validator(value, ctx) ?? of(null) : of(next(value, ctx)); } return of(null); }), ); }); } }

    const validator = compose(when(() => Math.random() > 0.5))(required('required if random number great then 5'));

    Type parameters

    • Target

    Parameters

    Returns (Anonymous function)

createAsyncValidator

email

  • 限制一个值是合法的 email 地址,规则和 Angular 使用的一致

    Parameters

    • Optional message: undefined | string

      错误信息

    Returns ISyncValidator<string>

field

finalizeWithLast

  • finalizeWithLast<T>(callback: function, defaultValue: T): finalizeWithLastOperatorFunction
  • Type parameters

    • T

    Parameters

    • callback: function
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • defaultValue: T

    Returns finalizeWithLastOperatorFunction

form

  • form<ChildBuilders, Builder, Model>(childBuilders: ChildBuilders): FormBuilder<ChildBuilders, Builder, Model>
  • 创建一个 Form builder,是最顶层的 builder 对象

    Type parameters

    Parameters

    • childBuilders: ChildBuilders

      Form 每个字段对应的 builder 对象,其值可以是 fieldarray 或者 set 的返回值

    Returns FormBuilder<ChildBuilders, Builder, Model>

get

  • get<T>(some: ISome<T>): T

getModelFromContext

  • getModelFromContext<Model>(ctx: IFormContext, name: string | undefined, model: Model | undefined, check: function): Model | null
  • Type parameters

    • Model

    Parameters

    • ctx: IFormContext
    • name: string | undefined
    • model: Model | undefined
    • check: function
        • (m: any): m is Model
        • Parameters

          • m: any

          Returns m is Model

    Returns Model | null

Const id

  • id<T>(it: T): T

isAsyncValidator

  • 判断一个校验函数是否是异步的,异步的校验函数必须使用 createAsyncValidator 创建

    Type parameters

    • T

    Parameters

    Returns validator is IAsyncValidator<T>

isEmptyInputValue

  • isEmptyInputValue(value: any): boolean

isFieldArrayModel

  • isFieldArrayModel<Item, Child>(maybeModel: any): maybeModel is FieldArrayModel<Item, Child>
  • Type parameters

    Parameters

    • maybeModel: any

    Returns maybeModel is FieldArrayModel<Item, Child>

isFieldModel

  • isFieldModel<T>(maybeModel: any): maybeModel is FieldModel<T>
  • Type parameters

    • T

    Parameters

    • maybeModel: any

    Returns maybeModel is FieldModel<T>

isFieldSetModel

  • isFieldSetModel<Children>(maybeModel: any): maybeModel is FieldSetModel<Children>
  • Type parameters

    Parameters

    • maybeModel: any

    Returns maybeModel is FieldSetModel<Children>

isFormModel

  • isFormModel<Children>(maybeModel: any): maybeModel is FormModel<Children>
  • Type parameters

    Parameters

    • maybeModel: any

    Returns maybeModel is FormModel<Children>

isModel

  • isModel<T>(maybeModel: any): maybeModel is BasicModel<T>
  • Type parameters

    • T

    Parameters

    • maybeModel: any

    Returns maybeModel is BasicModel<T>

isModelRef

  • isModelRef<T, P, M>(maybeModelRef: any): maybeModelRef is ModelRef<T, P, M>

isPlainObject

  • isPlainObject(value: unknown): value is object
  • Parameters

    • value: unknown

    Returns value is object

isRequiredValidator

  • isRequiredValidator<T>(validator: IValidator<T>): boolean

isSome

  • isSome<T>(maybe: Maybe<T>): maybe is ISome<T>

isValueFactory

  • isValueFactory<Value>(candidate: Value | function): candidate is function
  • Type parameters

    • Value

    Parameters

    • candidate: Value | function

    Returns candidate is function

last

  • last<T>(arr: T[]): null | T
  • Type parameters

    • T

    Parameters

    • arr: T[]

    Returns null | T

makeChangeHandler

  • makeChangeHandler<Value>(model: FieldModel<Value>, option?: number, callback?: undefined | function): (Anonymous function)
  • 生成一个默认的onChange回调,这个回调会触发model.validate 如果不需要在onChange的时候触发校验,如下即可:

    const onChange = useCallback(value => model.value = value, [model]);

    例如是一个input

    const onChange = useCallback((value: React.ChangeEvent<HTMLInputElement>) => {
      model.value = e.target.value;
    }, [model]);

    可以配合usePipe使用:

    function mapEventToValue(e) {
      return e.target.value;
    }
    function Foo() {
      const onChange = FieldUtils.usePipe(
        mapEventToValue,
        FieldUtils.makeChangeHandler(model),
      );
    }

    Type parameters

    • Value

    Parameters

    • model: FieldModel<Value>
    • Default value option: number = ValidateOption.Default | ValidateOption.ExcludePristine
    • Optional callback: undefined | function

    Returns (Anonymous function)

markForRequired

  • markForRequired<T>(validator: IValidator<T>): void

max

  • max(limit: number, message?: undefined | string): max
  • 限制一个值的最大值

    Parameters

    • limit: number

      允许的最大值(包含自身)

    • Optional message: undefined | string

      错误信息

    Returns max

maxLength

  • maxLength<T>(length: number, message?: undefined | string): ISyncValidator<T>
  • 限制一个值的最大长度,通过 .length 属性判断

    Type parameters

    Parameters

    • length: number

      允许的最大长度(包含自身)

    • Optional message: undefined | string

      错误信息

    Returns ISyncValidator<T>

message

  • message<V>(messagenerator: function): (Anonymous function)

min

  • min(limit: number | string, message?: undefined | string): min
  • 限制一个值的最小值

    Parameters

    • limit: number | string

      允许的最小值(包含自身)

    • Optional message: undefined | string

      错误信息

    Returns min

minLength

  • minLength<T>(length: number, message?: undefined | string): ISyncValidator<T>
  • 限制一个值的最小长度,通过 .length 属性判断

    Type parameters

    Parameters

    • length: number

      允许的最小长度(包含自身)

    • Optional message: undefined | string

      错误信息

    Returns ISyncValidator<T>

multi

  • multi<T, R>(...funcs: function[]): function
  • Type parameters

    • T

    • R

    Parameters

    • Rest ...funcs: function[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

noop

  • noop(): void

or

  • or<T>(maybe: Maybe<T>, def: function): T
  • Type parameters

    • T

    Parameters

    • maybe: Maybe<T>
    • def: function
        • (): T
        • Returns T

    Returns T

pattern

  • pattern(regexp: RegExp, message?: undefined | string): ISyncValidator<string>
  • 限制一个字符串必须匹配一个正则表达式

    Parameters

    • regexp: RegExp

      要匹配的正则表达式

    • Optional message: undefined | string

      错误信息

    Returns ISyncValidator<string>

removeOnUnmount

required

  • 限制一个值不为 null/undefined,并且长度不为零

    Parameters

    • Optional message: undefined | string

      错误信息

    Returns ISyncValidator<any>

requiredTrue

runValidator

set

  • set<ChildBuilders, Builder, Model>(childBuilders: ChildBuilders): FieldSetBuilder<ChildBuilders>
  • 创建一个 FieldSet builder

    Type parameters

    Parameters

    • childBuilders: ChildBuilders

      FieldSet 每个字段对应的 builder 对象,其值可以是 fieldarray 或者 set 的返回值

    Returns FieldSetBuilder<ChildBuilders>

useArrayModel

useCompositionHandler

  • 生成一组 onCompositionStartonCompositionEnd 的回调函数,用于跟踪输入法 composition 的状态, 这个状态会写到 model.isCompositing 字段上。

    Type parameters

    • Value

    • E

    Parameters

    Returns ICompositionHandlers<E>

useEffect$

  • useEffect$<T>(event$: Observable<T>, effect: function): void
  • Type parameters

    • T

    Parameters

    • event$: Observable<T>
    • effect: function
        • (e: T): void
        • Parameters

          • e: T

          Returns void

    Returns void

useField

  • 创建一个 Field

    Type parameters

    • Value

    Parameters

    • field: string | ModelRef<Value, any, FieldModel<Value>>

      字段名,当 FormStrategyView 的时候才能用字段名

    • defaultValue: Value | function

      默认值

    • Optional validators: IValidators<Value>

      field 是字段名的时候,可以传入validator

    Returns FieldModel<Value>

  • 创建一个 Field

    Type parameters

    • Value

    Parameters

    • field: FieldModel<Value>

      Field 对应的 model 对象,用于关联 Field 和 model;当 FormStrategyModel 的时候才能用

    Returns FieldModel<Value>

useFieldArray

  • 创建一个 FieldArray

    Type parameters

    Parameters

    • field: string | ModelRef<keyof Item[], any, FieldArrayModel<Item, Child>>

      字段名,当 FormStrategyView 的时候才能用字段名

    • Optional validators: IValidators<keyof (null | Item)[]>

      field 是字段名的时候,可以传入 validator

    • Optional defaultValue: Item[]

      默认值

    Returns FieldArrayModel<Item, Child>

  • 创建一个 FieldArray

    Type parameters

    Parameters

    • field: FieldArrayModel<Item, Child>

      FieldArray 对应的 model 对象,用于关联 FieldArray 和 model;当 FormStrategyModel 的时候才能用

    Returns FieldArrayModel<Item, Child>

useFieldArrayValue

  • useFieldArrayValue<Item, Child>(field: string | FieldArrayModel<Item, Child>): null | Child[]

useFieldSet

useFieldSetModel

useFieldValue

  • useFieldValue<T>(field: string | FieldModel<T>): T | null

useForm

useFormContext

useMAppend

  • useMAppend<T>(...fns: function[]): function
  • deprecated

    use useMulti instead

    const callback = useMAppend(foo, bar, baz)

    is equal to

    const callback = useCallback(arg => {
      foo(arg);
      bar(arg);
      baz(arg);
    }, [foo, bar, baz])

    Type parameters

    • T

    Parameters

    • Rest ...fns: function[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

useModelAndChildProps

useMulti

  • useMulti<T, R>(func1: function, func2: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, func4: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, func4: function, func5: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, func4: function, func5: function, func6: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, func4: function, func5: function, func6: function, func7: function, deps?: any[]): function
  • useMulti<T, R>(func1: function, func2: function, func3: function, func4: function, func5: function, func6: function, func7: function, func8: function, deps?: any[]): function
  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func4: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func4: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func5: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func4: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func5: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func6: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func4: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func5: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func6: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func7: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

  • Type parameters

    • T

    • R

    Parameters

    • func1: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func2: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func3: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func4: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func5: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func6: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func7: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • func8: function
        • (t: T): R
        • Parameters

          • t: T

          Returns R

    • Optional deps: any[]

    Returns function

      • (t: T): void
      • Parameters

        • t: T

        Returns void

usePipe

  • usePipe<T0, T1, T2>(fn0: function, fn1: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3>(fn0: function, fn1: function, fn2: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3, T4>(fn0: function, fn1: function, fn2: function, fn3: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3, T4, T5>(fn0: function, fn1: function, fn2: function, fn3: function, fn4: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3, T4, T5, T6>(fn0: function, fn1: function, fn2: function, fn3: function, fn4: function, fn5: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3, T4, T5, T6, T7>(fn0: function, fn1: function, fn2: function, fn3: function, fn4: function, fn5: function, fn6: function, deps?: any[]): function
  • usePipe<T0, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: function, fn1: function, fn2: function, fn3: function, fn4: function, fn5: function, fn6: function, fn7: function, deps?: any[]): function
  • const callback = usePipe(foo, bar, baz)

    is equal to

    const callback = useMemo(() => arg => {
     return baz(bar(foo(arg)))
    }, [foo, bar, baz])

    Type parameters

    • T0

    • T1

    • T2

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • Optional deps: any[]

    Returns function

      • (t0: T0): T2
      • Parameters

        • t0: T0

        Returns T2

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • Optional deps: any[]

    Returns function

      • (t0: T0): T3
      • Parameters

        • t0: T0

        Returns T3

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    • T4

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • fn3: function
        • (t3: T3): T4
        • Parameters

          • t3: T3

          Returns T4

    • Optional deps: any[]

    Returns function

      • (t0: T0): T4
      • Parameters

        • t0: T0

        Returns T4

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    • T4

    • T5

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • fn3: function
        • (t3: T3): T4
        • Parameters

          • t3: T3

          Returns T4

    • fn4: function
        • (t4: T4): T5
        • Parameters

          • t4: T4

          Returns T5

    • Optional deps: any[]

    Returns function

      • (t0: T0): T5
      • Parameters

        • t0: T0

        Returns T5

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • fn3: function
        • (t3: T3): T4
        • Parameters

          • t3: T3

          Returns T4

    • fn4: function
        • (t4: T4): T5
        • Parameters

          • t4: T4

          Returns T5

    • fn5: function
        • (t5: T5): T6
        • Parameters

          • t5: T5

          Returns T6

    • Optional deps: any[]

    Returns function

      • (t0: T0): T6
      • Parameters

        • t0: T0

        Returns T6

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • fn3: function
        • (t3: T3): T4
        • Parameters

          • t3: T3

          Returns T4

    • fn4: function
        • (t4: T4): T5
        • Parameters

          • t4: T4

          Returns T5

    • fn5: function
        • (t5: T5): T6
        • Parameters

          • t5: T5

          Returns T6

    • fn6: function
        • (t6: T6): T7
        • Parameters

          • t6: T6

          Returns T7

    • Optional deps: any[]

    Returns function

      • (t0: T0): T7
      • Parameters

        • t0: T0

        Returns T7

  • Type parameters

    • T0

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    • T8

    Parameters

    • fn0: function
        • (t0: T0): T1
        • Parameters

          • t0: T0

          Returns T1

    • fn1: function
        • (t1: T1): T2
        • Parameters

          • t1: T1

          Returns T2

    • fn2: function
        • (t2: T2): T3
        • Parameters

          • t2: T2

          Returns T3

    • fn3: function
        • (t3: T3): T4
        • Parameters

          • t3: T3

          Returns T4

    • fn4: function
        • (t4: T4): T5
        • Parameters

          • t4: T4

          Returns T5

    • fn5: function
        • (t5: T5): T6
        • Parameters

          • t5: T5

          Returns T6

    • fn6: function
        • (t6: T6): T7
        • Parameters

          • t6: T6

          Returns T7

    • fn7: function
        • (t7: T7): T8
        • Parameters

          • t7: T7

          Returns T8

    • Optional deps: any[]

    Returns function

      • (t0: T0): T8
      • Parameters

        • t0: T0

        Returns T8

useValue$

  • useValue$<T>(value$: Observable<T>, initialValue: T): T
  • Type parameters

    • T

    Parameters

    • value$: Observable<T>
    • initialValue: T

    Returns T

validate

  • validate<T>(model: BasicModel<T>): (Anonymous function)
  • 执行 model 上的校验规则对 model 校验

    Type parameters

    • T

    Parameters

    Returns (Anonymous function)

when

  • when<V>(condition: function): (Anonymous function)

whenAsync

  • whenAsync<V>(condition: function): (Anonymous function)
  • ValidatorMiddlewares.when的异步版本,接收异步的条件函数

    Type parameters

    • V

    Parameters

    • condition: function
        • Parameters

          Returns Promise<boolean> | Observable<boolean>

    Returns (Anonymous function)

withMessage

Generated using TypeDoc