Class InControl<TValue>Abstract

User input control.

Maintains input value and various aspects of the user input, such as input focus, validity, etc.

Type Parameters

  • TValue

    Input value type.

Hierarchy

Constructors

  • Constructs user input control.

    Type Parameters

    • TValue

    Parameters

    • aspects: {
          aspects?: Aspect<TValue, TValue> | readonly Aspect<TValue, TValue>[];
      } = {}

      Input aspects applied by default. These are aspect converters to constructed control from the same-valued one.

      • Optional Readonly aspects?: Aspect<TValue, TValue> | readonly Aspect<TValue, TValue>[]

    Returns InControl<TValue>

Properties

it: TValue

Input value.

on: OnEvent<[TValue, TValue]>

OnEvent sender of value changes.

The [OnEvent__symbol] property is an alias of this one.

Returns

Value changes sender.

read: AfterEvent<[TValue]>

AfterEvent keeper of current value.

The [AfterEvent__symbol] property is an alias of this one.

Returns

Current value keeper.

Accessors

  • get supply(): Supply
  • This control's input supply.

    Releases all control resources when cut off.

    Each control has its own supply. An input supply of converted control depends on the input supply of control it is converted from.

    After this supply cut off the control should no longer be used.

    Returns Supply

Methods

  • Returns AfterEvent<[TValue]>

  • Returns OnEvent<[TValue, TValue]>

  • Retrieves an aspect instance applied to this control.

    If the given aspect is not applied yet, then applies it first.

    Type Parameters

    • TInstance

      Aspect instance type.

    • TKind extends keyof InAspect.Application.Map<unknown, unknown>

      Aspect application kind.

    Parameters

    • aspectKey: Key<TInstance, TKind>

      A key of aspect to apply to this control.

    Returns ReturnType<InAspect.Application.Map<TInstance, TValue>[TKind]>

    An applied aspect instance.

  • Updates the tracked value by the given value supplier.

    If the value is already updated by another supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Parameters

    • supplier: EventSupplier<[TValue]>

      The source value sender or keeper.

    Returns InControl<TValue>

    this instance.

  • Updates the tracked value by value suppliers extracted from events sent by the given supplier.

    If the value is already updated by another value supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Type Parameters

    • TSrcEvent extends any[]

      Source event type.

    Parameters

    • supplier: EventSupplier<TSrcEvent>

      The event supplier to extract value suppliers from.

    • extract: ((this, ...event) => undefined | EventSupplier<[TValue]>)

      A function extracting value supplier from event received from supplier. May return undefined to suspend receiving values.

        • (this, ...event): undefined | EventSupplier<[TValue]>
        • Parameters

          • this: void
          • Rest ...event: TSrcEvent

          Returns undefined | EventSupplier<[TValue]>

    Returns InControl<TValue>

    this instance.

  • Unbinds the tracked value from any value supplier this tracker is updated by.

    If the tracker is not bound then does nothing.

    Parameters

    • Optional reason: unknown

      Arbitrary reason of unbinding the value.

    Returns InControl<TValue>

    this instance.

  • Converts this control to another one without changing its value type.

    The converted aspect may have another value and input aspects.

    Parameters

    • Rest ...by: Aspect<TValue, TValue>[]

      Input control aspect converters.

    Returns InControl<TValue>

    Converted control.

  • Converts this control to another one.

    The converted aspect may have another value and input aspects.

    Type Parameters

    • TTo

      Converted input value type.

    Parameters

    • by: InConverter<TValue, TTo>

      Input control converter.

    • Rest ...and: Aspect<TValue, TTo>[]

      Additional input control aspect converters.

    Returns InControl<TTo>

    Converted control.

  • Performs additional setup of this control.

    Parameters

    • setup: ((this, control) => void)

      A function that accepts this control as its only parameter.

        • (this, control): void
        • Parameters

          Returns void

    Returns InControl<TValue>

    this control instance.

  • Performs additional setup of this control's aspect.

    Type Parameters

    • TInstance

      Aspect instance type.

    • TKind extends keyof InAspect.Application.Map<unknown, unknown>

      Aspect application kind.

    Parameters

    • aspectKey: Key<TInstance, TKind>

      A key of aspect to set up.

    • setup: ((this, aspect, control) => void)

      A function that accepts an applied aspect instance and this control as parameters.

        • (this, aspect, control): void
        • Parameters

          Returns void

    Returns InControl<TValue>

    this control instance.

Generated using TypeDoc