Skip to content

SiFilteredSearchComponent documentation

import { SiFilteredSearchComponent } from '@siemens/element-ng/filtered-search';

Input Properties

NameTypeDefaultDescription
clearButtonLabel
TranslatableString $localize`:@@SI_FILTERED_SEARCH.CLEAR:Clear`

Clear button aria label. Needed for a11y

colorVariant
BackgroundColorVariant 'base-1'

Color variant to determine component background

criteria
CriterionDefinition[] []

Predefine criteria options.

disabled
boolean false

Disable any interactivity.

disableFreeTextSearch
boolean false

Disables the free text search to only use the criterion for filtering.

disableSelectionByColonAndSemicolon
boolean false

By default, the Filtered Search will treat : as a special character to submit the current input in the freetext and immediately create a criterion. Use this input to disable this behavior.

doSearchOnInputChange
boolean false

If this is set to true, the search triggers for each input (implicit search). By default, the search is triggered when the user submits by pressing the search button or by pressing enter.

exclusiveCriteria
boolean false

Opt-in to search for each criterion only once.

freeTextCriterion
CriterionDefinition | undefined

Criterion definition for free-text pills. When set, free-text values will be added as a pill with this criterion. If not set, free-text pills are disabled.

Enabling this will only emit valueChange events when the free-text pill is created. When the text input is blurred and there is text inside, a free-text pill will be created.

itemCountText
TranslatableString $localize`:@@SI_FILTERED_SEARCH.ITEM_COUNT:{{itemCount}} selected`

Items count text appended to the count in case of multi-selection of values. Translation key, {{itemCount}} in the translation will be replaced with the actual value.

lazyCriterionProvider
((typed: string, searchCriteria?: SearchCriteria) => Observable<CriterionDefinition[]>) | undefined

In addition to lazy loaded value, you can also lazy load the criteria itself

lazyLoadingDebounceTime
number 500

Custom debounce time for lazy loading of criteria data.

lazyValueProvider
((criterionName: string, typed: string | string[]) => Observable<OptionType[]>) | undefined

In many cases, your application defines the criteria, but the values need to be loaded from a server. In this case you can provide a function that returns the possible criterion options as an Observable.

maxCriteria
number | undefined undefined

Limit the number of possible criteria. The default is undefined so that any number of criteria can be used. For example, setting the value to 1 let you only select one criterion that you need to remove before being able to set another one.

maxCriteriaOptions
number 20

Defines the maximum options within one criterion. The default is 20 and 0 means unlimited.

onlySelectValue
boolean false

Limit criterion options to the predefined ones and prevent typing. [onlySelectValue] enforces [strictValue] and [strictCriterion] to true automatically.

optionsInScrollableView
number 10

Defines the number of criteria, criteria values and operators visible at once.

placeholder
string ''

The placeholder for input field.

scrollStrategy
() => ScrollStrategy defaultConnectedOverlayScrollStrategyFactory()

Factory for CDK scroll strategies used by filtered-search overlays.

searchCriteria
SearchCriteria { criteria: [], value: '' }

The current selected search criteria and entered search text.

searchDebounceTime
number 0

Custom debounce time (in mills) to delay the search emission. (Default is 0 as in most cases a users manually triggers a search. Recommended to increase a bit when using doSearchOnInputChange=true)

searchForFreeTextLabel
TranslatableString $localize`:@@SI_FILTERED_SEARCH.SEARCH_FOR_FREE_TEXT:Search for "{{query}}"`

The value to be shown for creating free-text pills. Use the {{query}} placeholder to show the user input in the label.

searchLabel
TranslatableString $localize`:@@SI_FILTERED_SEARCH.SEARCH:Search…`

Search input aria label, Needed by a11y

strictCriterion
boolean false

Limit criteria to the predefined ones.

strictValue
boolean false

Limit criterion options to the predefined ones. [strictValue] enforces [strictCriterion] to true automatically.

submitButtonLabel
TranslatableString $localize`:@@SI_FILTERED_SEARCH.SUBMIT_BUTTON:Apply search criteria`

The accessible label of the search button.

typeaheadOptionsLimit
number 20

Limit on the number of criteria/criteria value to be displayed by the typeahead

Output Properties

NameTypeDescription
doSearch
SearchCriteria

Output callback event that provides an object describing the selected criteria and additional filter text.

interceptDisplayedCriteria
DisplayedCriteriaEventArgs

The interceptor is called when the list of criteria is shown as soon as the user starts typing in the input field. The interceptor's DisplayedCriteriaEventArgs.allow method can be used to filter the list of displayed criteria.

Note: The interceptor is called as long as the searchCriteria does not exceed maxCriteria. Further, the interceptor is not called when using the lazyCriterionProvider.

Example:

<si-filtered-search
  [criteria]="[{ name: 'foo', label: 'Foo' }, { name: 'bar', label: 'Bar' }]"
  (interceptDisplayedCriteria)="$event.allow(
      $event.searchCriteria.criteria.some(s => s.name === 'foo')
        ? $event.criteria.filter(c => c !== 'foo')
        : $event.criteria
    )">
</si-filtered-search>
searchCriteriaChange
SearchCriteria

The current selected search criteria and entered search text.

Attributes and Methods

NameTypeDescription
deleteAllCriteria()
(event?: MouseEvent) => void

Deletes all currently selected criteria and effectively resets the filtered search.

Parameters

Types Documentation

BackgroundColorVariant

'base-1' | 'base-0'
type alias
import type { BackgroundColorVariant } from '@siemens/element-ng/common';

Use this type with filter components colorVariant to render component variants based on background of container

import type { CriterionDefinition } from '@siemens/element-ng/filtered-search';

A CriterionDefinition is the definition of criteria in the SiFilteredSearchComponent. It defines the type and based this further attributes like multiselect and available options.

Properties
  • Optional configuration object for the datepicker.

    datepickerConfig?: Omit<DatepickerInputConfig, "enableDateRange" | "enableTwoMonthDateRange">

  • An optional label, which is used in the user interface.

    label?: TranslatableString

  • Defines whether multi selection of the options is possible in a typeahead. Setting it to true enables the checkbox besides the option values. When multiSelect is true, the value input field will be readonly, allowing user to select the values only from the typeahead.

    multiSelect?: boolean

  • The mandatory name of a criterion.

    name: string

  • Limit criterion options to the predefined ones and prevent typing. onlySelectValue enforces strictValue to true automatically.

    onlySelectValue?: boolean

  • This provides possible operators that the user can select for this criterion.

    operators?: string[]

  • The options provide possible values that the user can select for this criterion.

    options?: OptionType[]

  • Limit criterion options to the predefined ones.

    strictValue?: boolean

  • This provides the value type of the input field.

    validationType?: ValidationType

import type { OptionType } from '@siemens/element-ng/filtered-search';

Type for options

import type { SearchCriteria } from '@siemens/element-ng/filtered-search';

On search, the filtered search component emits a SearchCriteria object. It consists of all user selected criteria and the free text input value.

Properties
  • The selected criteria of the filtered search. Each criteria has a name and a value.

    criteria: CriterionValue[]

  • Additional unstructured free text, which the user entered in the search.

    value: string

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 { DisplayedCriteriaEventArgs } from '@siemens/element-ng/filtered-search';

Event allows to intercept and change the displayed criteria before shown in typeahead.

Properties
Methods
import type { CriterionValue } from '@siemens/element-ng/filtered-search';

A CriterionValue is the input/output value of the SiFilteredSearchComponent, containing the user input.

Properties
  • If the criterion was defined as date or date-time this field will contain the value das js Date.

    dateValue?: Date

  • The mandatory name of a criterion.

    name: string

  • This property holds the selected or entered operator of the criterion.

    operator?: string

  • The value property holds the selected or entered value/values of the criterion. The value can also be passed as an array of strings. When multiSelect is enabled, the items in the value array will be shown as selected values in value input and the typeahead.

    value?: string | string[]

ValidationType

'string' | 'integer' | 'float' | 'date' | 'date-time'
type alias
import type { ValidationType } from '@siemens/element-ng/filtered-search';
import type { DatepickerInputConfig } from '@siemens/element-ng/datepicker';
Properties
import type { OptionCriterion } from '@siemens/element-ng/filtered-search';

It allows to specify a different value between the one which is rendered and the one which is used for the search.

Properties

WeekStart

'monday' | 'saturday' | 'sunday' | undefined
type alias
import type { WeekStart } from '@siemens/element-ng/datepicker';
import type { DatepickerConfig } from '@siemens/element-ng/datepicker';
Properties

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