turbodombuilder - v0.9.22
    Preparing search index...

    Class TurboSelect<ValueType, SecondaryValueType, EntryType>

    TurboSelect

    Base class for creating a selection menu

    Type Parameters

    • ValueType = string
    • SecondaryValueType = string
    • EntryType extends object = HTMLElement

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    config: TurboSelectConfig = ...

    Static configuration object.

    onSelectDelegate: Delegate<
        (b: boolean, entry: EntryType, index: number) => void,
    > = ...
    onEnabledDelegate: Delegate<
        (b: boolean, entry: EntryType, index: number) => void,
    > = ...
    getValue: (entry: EntryType) => ValueType
    getSecondaryValue: (entry: EntryType) => SecondaryValueType
    createEntry: (value: ValueType) => EntryType
    onEntryAdded: (entry: EntryType, index: number) => void
    onEntryRemoved: (entry: EntryType) => void
    forceSelection: boolean
    selectedEntryClasses: string | string[]
    selected: boolean

    Whether the element is selected or not.

    initialized: boolean

    Whether the element was initialized already or not.

    Accessors

    • get values(): ValueType[]

      Returns ValueType[]

      The dropdown's values. Setting it will update the dropdown accordingly.

    • set values(values: ValueType[]): void

      Parameters

      Returns void

    • get selectedEntries(): EntryType[]

      Returns EntryType[]

    • set selectedEntries(value: EntryType[]): void

      Parameters

      Returns void

    • set parent(value: Element): void

      Parameters

      Returns void

    • get inputName(): string

      The dropdown's underlying hidden input. Might be undefined.

      Returns string

    • set inputName(value: string): void

      Parameters

      • value: string

      Returns void

    • set multiSelection(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set onSelect(value: (b: boolean, entry: EntryType, index: number) => void): void

      Parameters

      • value: (b: boolean, entry: EntryType, index: number) => void

      Returns void

    • set onEnabled(
          value: (b: boolean, entry: EntryType, index: number) => void,
      ): void

      Parameters

      • value: (b: boolean, entry: EntryType, index: number) => void

      Returns void

    • get enabledEntries(): EntryType[]

      Returns EntryType[]

    • get enabledValues(): ValueType[]

      Returns ValueType[]

    • get selectedEntry(): EntryType

      Returns EntryType

      The dropdown's currently selected entries

    • get selectedValues(): ValueType[]

      Returns ValueType[]

      The dropdown's currently selected values

    • get selectedValue(): ValueType

      Returns ValueType

    • get stringSelectedValue(): string

      Returns string

    Methods

    • Parameters

      Returns EntryData

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns boolean

    • Parameters

      • value: ValueType | EntryType

        The DropdownEntry (or its string value) to select.

      • selected: boolean = true

      Returns this

      • This Dropdown for chaining.

      Select an entry.

    • Parameters

      • index: number

        The index of the entry to select

      • Optionalpreprocess: (index: number, entriesCount: number, zero?: number) => number = trim

        Callback to execute on the index to preprocess it. Defaults to trim().

      Returns this

      • This Dropdown for chaining.

      Select an entry.

    • Parameters

      Returns number

    • Returns void

    • Returns void

    • Parameters

      Returns void

    • Returns void

    • Returns void

    • Parameters

      • value: boolean

      Returns void

    • Returns void

    • Returns void

    • Protected Function

      getPropertiesValue

      Type Parameters

      • Type

      Parameters

      • propertiesValue: Type

        The actual value; could be null.

      • OptionalconfigFieldName: string

        The field name of the associated value in the static config. Will be returned if the actual value is null.

      • OptionaldefaultValue: Type

        The default fallback value. Will be returned if both the actual and config values are null.

      Returns Type

      Returns the value with some fallback mechanisms on the static config field and a default value.

    • Function

      initialize

      Returns void

      Initializes the element. It sets up the UI by calling the methods setupUIElements, setupUILayout, setupUIListeners, and setupChangedCallbacks (in this order, if they are defined). This function is called automatically in .setProperties() and when instantiating an element via element(). It is called only once per element (as it checks with the reflected initialized flag).

    • Parameters

      • value: any

        The object containing the new configurations.

      Returns void

      Update the class's static configurations. Will only overwrite the set properties.