File

core/data-grid/data-grid.model.ts

Description

Defines an interface for a mapper function that maps a FormlyFieldConfig to a FilterChip.

Index

Properties

Properties

fieldType
fieldType: string[] | string
Type : string[] | string

The type or types of the FormlyFieldConfig that this mapper applies to.

map
map: function
Type : function

Maps a FormlyFieldConfig and a FilterChip to an Observable of a FilterChip.

This function extends the provided FilterChip object with additional properties based on the information in the FormlyFieldConfig. The mapping process depends on the specific implementation of the FilterMapper.

If undefined is returned an error is thrown and the chip is not visualized.

Example :
// Example implementation of `map` function in a `FilterMapper`
map(field: FormlyFieldConfig, filter: FilterChip): Observable<FilterChip> {
  if (this.fieldType.includes(field.type.toString())) {
    return toObservable(field.templateOptions.options).pipe(
      map(options => {
        const object = options.find(option => option.value === get(filter.externalFilterQuery, filter.path));
        return {
          ...filter,
          value: object,
          displayValue: object?.label
        };
      })
    );
  }
}

results matching ""

    No results matching ""