Class Field<TValue, TSharer>

A field of the user input form.

A component shares field (e.g. using @SharedField decorator) to make it accessible by component itself and nested ones. E.g. to add it to form or to manipulate its value.

The field instance is not usable until it is bound to its sharer component. The latter is done automatically when the field is shared by FieldShare.

Type Parameters

  • TValue

    Field value type.

  • TSharer extends object = any

    Field sharer component type.

Hierarchy

Constructors

Accessors

  • get body(): TBody
  • Shareable body.

    Accessing is throws an exception until bound to sharer.

    Returns TBody

  • get control(): undefined | InControl<TValue>
  • Input control of the field, if present.

    Returns undefined | InControl<TValue>

  • get read(): AfterEvent<[TBody]>
  • An AfterEvent keeper of shareable body.

    An [AfterEvent__symbol] method always returns this value.

    Returns AfterEvent<[TBody]>

  • get sharer(): ComponentContext<TSharer>
  • Sharer component context.

    Accessing it throws an exception until bound to sharer.

    Returns ComponentContext<TSharer>

Methods

  • Returns AfterEvent<[undefined | Field.Body<TValue, any>]>

  • Creates a form field by the given field control factory.

    Returns

    New field instance.

    Type Parameters

    • TValue

    • TSharer extends object = any

    Parameters

    • factory: Factory<InControl<TValue>, TValue>

      Field control factory.

    Returns Field<TValue, TSharer>

  • Converts shareable body or its provider to provider that always returns an AfterEvent keeper of shareable body.

    Returns

    Shareable body provider.

    Type Parameters

    • TBody = unknown

      Shareable body type.

    • TSharer extends object = any

      Sharer component type.

    Parameters

    • body: TBody | Provider<TBody, TSharer>

      Either shareable body, or its provider.

    Returns ((this: void, sharer: ComponentContext<TSharer>) => AfterEvent<[TBody]>)

      • (this: void, sharer: ComponentContext<TSharer>): AfterEvent<[TBody]>
      • Converts shareable body or its provider to provider that always returns an AfterEvent keeper of shareable body.

        Returns

        Shareable body provider.

        Parameters

        • this: void
        • sharer: ComponentContext<TSharer>

        Returns AfterEvent<[TBody]>

  • Creates a form field controls provider by the given control factory.

    Returns

    New form field controls provider.

    Type Parameters

    • TValue

    • TSharer extends object = any

    Parameters

    • factory: Factory<InControl<TValue>, TValue>

      Field control factory.

    Returns Field.Provider<TValue, TSharer>

Generated using TypeDoc