Class InList<TItem>Abstract

An indexed list of input controls.

Nested controls can be added and removed via controls property.

List value (called model) is an array object formed by nested control values. The item property value is the one of the control with the same index, if present. When model is updated corresponding controls are also updated.

List is available as an aspect of itself and converted controls with the same value.

Type Parameters

  • TItem

    Model item type.

Hierarchy

Constructors

  • Constructs user input control.

    Type Parameters

    • TItem

    Parameters

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

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

      • Optional Readonly aspects?: Aspect<readonly TItem[], readonly TItem[]> | readonly Aspect<(readonly TItem[]), (readonly TItem[])>[]

    Returns InList<TItem>

Properties

controls: InListControls<TItem>

Input list controls.

it: readonly TItem[]

Input value.

on: OnEvent<[readonly TItem[], readonly TItem[]]>

OnEvent sender of value changes.

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

Returns

Value changes sender.

read: AfterEvent<[readonly TItem[]]>

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<[readonly TItem[]]>

  • Returns OnEvent<[readonly TItem[], readonly TItem[]]>

  • 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, readonly TItem[]>[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<[readonly TItem[]]>

      The source value sender or keeper.

    Returns InList<TItem>

    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<[readonly TItem[]]>)

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

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

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

          Returns undefined | EventSupplier<[readonly TItem[]]>

    Returns InList<TItem>

    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 InList<TItem>

    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<readonly TItem[], readonly TItem[]>[]

      Input control aspect converters.

    Returns InControl<readonly TItem[]>

    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<readonly TItem[], TTo>

      Input control converter.

    • Rest ...and: Aspect<readonly TItem[], 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

          • this: void
          • control: InList<TItem>

          Returns void

    Returns InList<TItem>

    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 InList<TItem>

    this control instance.

Generated using TypeDoc