Skip to content

SelectOptionSource Type documentation

TypeScript declaration

import type { SelectOptionSource } from '@siemens/element-ng/select';

An interface to define a lazy option source for the SiSelectComponent.

Methods
  • compareOptions? (a: SelectOption<TValue>, b: SelectOption<TValue>) => number

    This function is used to sort options.

    It is only called if the si-select was able to find all options without querying the option source.

    Parameters
  • getAllOptions? () => Observable<SelectItem<TValue>[]>

    Get all available options. If provided, this will be called when no filter value is provided. Otherwise, si-select will only show the selected values.

    This function must be implemented if this source is used on a select without a filter.

  • getOptionsForSearch? (search: string) => Observable<SelectItem<TValue>[]>

    Find options for a search value. It will never be called with an empty search value.

    This function must be implemented if this source is used on a si-select with a filter.

    Parameters
  • getOptionsForValues (values: TValue[]) => Observable<SelectOption<TValue>[]>

    Get options for the provided values. This is basically a resolver function, that resolves values to options.

    Parameters
    • • values that should be resolved to an option.

      values: TValue[]

  • valuesEqual? (optionA: TValue, optionB: TValue) => boolean

    Function to check if two values are equal.

    This function must be implemented if the check on reference equality is not enough. For instance, when using objects as value.

    Parameters

Types Documentation

SelectItem

type SelectItem<T> = SelectGroup<T> | SelectOption<T>
type alias
import type { SelectItem } from '@siemens/element-ng/select';

Alias for SelectOption or SelectGroup

import type { SelectOption } from '@siemens/element-ng/select';

A select option

Properties
  • Whether this option is disabled.

    disabled?: boolean

  • An optional icon.

    icon?: string

  • The color of an icon.

    iconColor?: string

  • A label to be shown for this option. Is optional if a custom template is provided or if the value should directly be rendered.

    label?: TranslatableString

  • An optional stacked icon.

    stackedIcon?: string

  • The color of a stacked icon.

    stackedIconColor?: string

  • Defines this to be an option.

    type: "option"

  • Used for typeahead functionality when filtering is disabled. If provided, this will be used, otherwise the innerText of the rendered element.

    typeaheadLabel?: TranslatableString

  • The value if this option. It will be used for formControls and the value property of this si-select. The value will internally be checked on equality by using ===. So an app should either use string or ensure that same values are referentially equal.

    value: T

import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';

Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.

import type { SelectGroup } from '@siemens/element-ng/select';

A select option group

Properties

Except where otherwise noted, content on this site is licensed under MIT License.