All files / filter-bar si-filter-pill.component.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                1x       39x     39x     39x           39x     4x      
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { NgClass, NgTemplateOutlet } from '@angular/common';
import { booleanAttribute, Component, input, output } from '@angular/core';
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
 
import { Filter } from './filter';
 
@Component({
  selector: 'si-filter-pill',
  imports: [NgClass, NgTemplateOutlet, SiTranslatePipe],
  templateUrl: './si-filter-pill.component.html',
  styleUrl: './si-filter-pill.component.scss'
})
export class SiFilterPillComponent {
  /**
   * Settings of the filter pill.
   */
  readonly filter = input.required<Filter>();
 
  /** @defaultValue false */
  readonly disabled = input(false, { transform: booleanAttribute });
 
  /** @defaultValue 0 */
  readonly totalPills = input(0);
 
  /**
   * Output callback event which will provide you the name of the deleted filter
   * pill if a filter was deleted.
   */
  readonly deleteFilters = output<Filter>();
 
  protected deleteClicked(): void {
    this.deleteFilters.emit(this.filter());
  }
}