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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 3x 1x | /**
* Copyright (c) Siemens 2016 - 2025
* SPDX-License-Identifier: MIT
*/
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
input,
model
} from '@angular/core';
import { ExtendedStatusType, STATUS_ICON } from '@siemens/element-ng/common';
import { SiIconComponent } from '@siemens/element-ng/icon';
import { SiTranslatePipe, TranslatableString } from '@siemens/element-translate-ng/translate';
@Component({
selector: 'si-summary-widget',
imports: [SiIconComponent, SiTranslatePipe],
templateUrl: './si-summary-widget.component.html',
styleUrl: './si-summary-widget.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SiSummaryWidgetComponent {
/** Status. Alternatively, use {@link icon} and {@link color}. */
readonly status = input<ExtendedStatusType>();
/** Icon token, see {@link https://element.siemens.io/icons/element}. */
readonly icon = input<string>();
/** Color class, see {@link https://element.siemens.io/fundamentals/typography/#color-variants-classes}. */
readonly color = input<string>();
/** Icon token, see {@link https://element.siemens.io/fundamentals/icons/}. */
readonly stackedIcon = input<string>();
/** Color class, see {@link https://element.siemens.io/fundamentals/icons/}. */
readonly stackedColor = input<string>();
/** The label. */
readonly label = input.required<TranslatableString>();
/** Value to display. */
readonly value = input.required<TranslatableString>();
/**
* Selected state, will change when clicked.
* @defaultValue false
*/
readonly selected = model(false);
/**
* Readonly state.
* @defaultValue false
*/
readonly readonly = input(false, { transform: booleanAttribute });
/**
* Disabled state.
* @defaultValue false
*/
readonly disabled = input(false, { transform: booleanAttribute });
protected readonly interactive = computed(() => !this.disabled() && !this.readonly());
protected readonly statusIcon = computed(() => {
const status = this.status();
return status
? STATUS_ICON[status]
: {
icon: this.icon(),
color: this.color(),
stacked: this.stackedIcon(),
stackedColor: this.stackedColor()
};
});
protected toggleSelected(): void {
if (this.interactive()) {
this.selected.set(!this.selected());
}
}
}
|