All files / dashboard/widgets si-value-widget-body.component.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/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 41 42                                      1x             1x       1x       1x         1x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { Component, input, OnInit } from '@angular/core';
import { EntityStatusType } from '@siemens/element-ng/common';
import { SiIconComponent, SiStatusIconComponent } from '@siemens/element-ng/icon';
import { SiTranslateModule, TranslatableString } from '@siemens/element-translate-ng/translate';
 
import { SiWidgetBaseComponent } from './si-widget-base.component';
 
/**
 * The body of the `<si-value-widget>`. Useful for compositions.
 */
@Component({
  selector: 'si-value-widget-body',
  imports: [SiIconComponent, SiStatusIconComponent, SiTranslateModule],
  templateUrl: './si-value-widget-body.component.html'
})
export class SiValueWidgetBodyComponent
  extends SiWidgetBaseComponent<TranslatableString>
  implements OnInit
{
  /**
   * The unit of the value (e.g. kWh or users). Only visible if `value` is available.
   */
  readonly unit = input<TranslatableString>();
  /**
   * The element icon name. Only visible if `value` is available.
   */
  readonly icon = input<string>();
  /**
   * Show a status icon instead of the {@link icon}.
   */
  readonly status = input<EntityStatusType>();
  /**
   * Short description of the value. A description is mandatory
   * to show an icon. Only visible if `value` is available.
   */
  readonly description = input<TranslatableString>();
}