Class FormShare<TModel, TElt>

A kind of component share containing a user input form.

This class may be inherited to represent a specific type of forms. E.g. to support multiple forms within the same component tree.

Type Parameters

  • TModel = any

    A model type of the form.

  • TElt extends HTMLElement = HTMLElement

    A type of HTML form element.

Hierarchy

  • Share<Form<TModel, TElt>>
    • FormShare

Constructors

  • Constructs new component share.

    Type Parameters

    • TModel = any

    • TElt extends HTMLElement<TElt> = HTMLElement

    Parameters

    • name: string

      A human-readable name of the share.

    • Optional options: Options<Form<TModel, TElt, any>>

      Constructed share options.

    Returns FormShare<TModel, TElt>

Accessors

  • get [toStringTag](): string
  • Returns string

  • get name(): string
  • A human-readable name of the name.

    Returns string

  • get share(): this
  • Refers to itself.

    Returns this

Methods

  • Registers a sharer component.

    The registration is necessary for consumers to be able to find the element bound to sharer by that element's name.

    Returns

    Sharer registration supply. Revokes the sharer registration once cut off.

    Parameters

    • defContext: DefinitionContext<any>

      The definition context of the sharer component.

    • Optional options: Options

      Value sharing options.

    Returns Supply

  • Creates a shared value registrar that shares a value created by the given provider.

    Returns

    New shared value registrar.

    Type Parameters

    • TSharer extends object

      Sharer component type.

    Parameters

    • target: Target<AfterEvent<[Form<TModel, TElt, any>?]>, SharedValue<Form<TModel, TElt, any>> | AfterEvent<SharedValue<Form<TModel, TElt, any>>[]>, ComponentContext<TSharer>>

      Shared value definition target.

    • provider: Provider<Form<TModel, TElt, any>, TSharer>

      Shared value provider.

    Returns Registrar<Form<TModel, TElt, any>>

  • Parameters

    • target: Target<Form<TModel, TElt, any>, any>

    Returns Definition<Form<TModel, TElt, any>>

  • Selects a shared value among candidates.

    It is especially useful when the value shared by multiple sharers.

    By default:

    • Prefers bare value.
    • Prefers the value from SharedValue.Detailed detailed specifier with higher priority (i.e. lesser SharedValue.Details.priority priority value).
    • Prefers the value declared last.

    Returns

    Either selected value, or undefined when not present.

    Parameters

    • Rest ...values: SharedValue<Form<TModel, TElt, any>>[]

      The values shared by sharers. May contain a SharedValue.Detailed detailed value specifiers in addition to pure values.

    Returns undefined | Form<TModel, TElt, any>

  • Shares a value by providing it for the sharer component context.

    Returns

    A builder of shared value for component context.

    Parameters

    • registrar: Registrar<Form<TModel, TElt, any>>

      Shared value registrar.

    Returns void

  • Returns string

  • Locates a shared value for the consuming component.

    Searches among parent elements for the one bound to the sharer component, then obtains the shared value from the sharer's context.

    Returns

    An AfterEvent keeper of the shared value and its sharer context, if found.

    Parameters

    • consumer: ComponentContext<any>

      Consumer component context.

    • Optional options: Options

      Location options.

    Returns AfterEvent<[] | [Form<TModel, TElt, any>, ComponentContext<any>]>

Generated using TypeDoc