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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | 1x 55x 55x 55x 55x | /** * Copyright (c) Siemens 2016 - 2025 * SPDX-License-Identifier: MIT */ import { A11yModule } from '@angular/cdk/a11y'; import { CdkMenuTrigger } from '@angular/cdk/menu'; import { NgClass } from '@angular/common'; import { Component, inject, input, OnChanges, OnInit } from '@angular/core'; import { ActivatedRoute, NavigationExtras, RouterLink } from '@angular/router'; import { SiIconComponent } from '@siemens/element-ng/icon'; import { MenuItem, SiMenuModule } from '@siemens/element-ng/menu'; import { SiTranslatePipe, t, TranslatableString } from '@siemens/element-translate-ng/translate'; import { SiWidgetBaseComponent } from '../si-widget-base.component'; /** Base for action items in the timeline widget. */ export interface TimelineWidgetActionBase { /** Label that is shown to the user. */ label: TranslatableString; /** The web font icon class name (e.g. element-settings-outline). */ icon?: string; /** Defines if only the icon is shown in the default navigation bar. */ iconOnly?: boolean; } /** Interface representing an action item in the timeline widget. */ export interface TimelineWidgetActionButton extends TimelineWidgetActionBase { type: 'action'; /** The class name to define the button style */ customClass?: string; /** Action that called when the item action is triggered. */ action: (source: this) => void; } /** Interface representing a router link item in the timeline widget. */ export interface TimeLineWidgetRouterLink extends TimelineWidgetActionBase { type: 'router-link'; /** Link for the angular router. Accepts the same values as {@link RouterLink}. */ routerLink: string | any[]; /** Navigation extras that are passed to the {@link RouterLink}. */ extras?: NavigationExtras; } /** Interface representing a link item in the timeline widget. */ export interface TimeLineWidgetLink extends TimelineWidgetActionBase { type: 'link'; /** The href property of the anchor. */ href: string; /** The target property of the anchor. */ target?: string; } /** Interface representing a menu item in the timeline widget. */ export interface TimelineWidgetMenu { type: 'menu'; menuItems: MenuItem[]; } /** Union type for all possible action items in the timeline widget. */ export type TimelineWidgetItemAction = | TimelineWidgetActionButton | TimeLineWidgetLink | TimeLineWidgetRouterLink | TimelineWidgetMenu; /** * Represents an item in the timeline widget. * Each item may contain a timestamp, a title, an icon, an optional description and optional action elements. * Actions can be buttons, links, router links, or menus. */ export interface SiTimelineWidgetItem { /** * The timestamp of the item. */ timeStamp: TranslatableString; /** * The title of the item. */ title: TranslatableString; /** * Optional translatable description. */ description?: TranslatableString; /** * The icon of the item. */ icon: string; /** * The color of the icon. */ iconColor?: string; /** * The stacked icon of the item. */ stackedIcon?: string; /** * The color of the stacked icon. */ stackedIconColor?: string; /** * The alt text of the icon */ iconAlt?: TranslatableString; /** * The related action of the item */ action?: TimelineWidgetItemAction; } /** * The items of the `<si-timeline-widget>`. */ @Component({ selector: 'si-timeline-widget-item', imports: [ SiIconComponent, SiTranslatePipe, NgClass, A11yModule, RouterLink, SiMenuModule, CdkMenuTrigger ], templateUrl: './si-timeline-widget-item.component.html', host: { role: 'listitem' } }) export class SiTimelineWidgetItemComponent extends SiWidgetBaseComponent<SiTimelineWidgetItem> implements OnInit, OnChanges { /** * Whether to show or hide the description row during skeleton progress indication. * * @defaultValue `true` */ readonly showDescription = input(true); /** * Aria label text for actions button dropdown. */ readonly ariaLabelDropdown = t( () => $localize`:@@SI_DASHBOARD.EXPAND_WIDGET_ACTIONS:Expand actions` ); protected readonly activatedRoute = inject(ActivatedRoute, { optional: true }); } |