All files / dashboard/widgets si-link-widget.component.ts

16.66% Statements 1/6
0% Branches 0/2
0% Functions 0/1
20% Lines 1/5

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 40                                          1x                                    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { booleanAttribute, Component, computed, input } from '@angular/core';
import { addIcons, SiIconComponent, elementRight2 } from '@siemens/element-ng/icon';
import { Link, SiLinkDirective } from '@siemens/element-ng/link';
import { SiTranslateModule } from '@siemens/element-translate-ng/translate';
 
import { SiWidgetBaseComponent } from './si-widget-base.component';
 
/**
 * The `<si-link-widget>` supports an easy composition of links and actions
 * with support for skeleton loading indicator.
 */
@Component({
  selector: 'si-link-widget',
  imports: [SiIconComponent, SiLinkDirective, SiTranslateModule],
  templateUrl: './si-link-widget.component.html',
  host: { class: 'si-link-widget' }
})
export class SiLinkWidgetComponent extends SiWidgetBaseComponent<Link[]> {
  /**
   * Option to enable trailing link arrow icons for each link.
   *
   * @defaultValue false
   */
  readonly showLinkIcons = input(false, { transform: booleanAttribute });
  /**
   * The number of skeleton progress indication rows.
   *
   * @defaultValue 3
   */
  readonly numberOfLinks = input(3);
 
  protected readonly ghosts = computed(() => new Array(this.numberOfLinks() ?? 3));
 
  protected readonly icons = addIcons({ elementRight2 });
}