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 | 1x 112x 112x 112x 112x 112x 112x 112x 112x 11x 3x 3x | /**
* Copyright (c) Siemens 2016 - 2025
* SPDX-License-Identifier: MIT
*/
import { NgClass } from '@angular/common';
import { ChangeDetectionStrategy, Component, HostListener, inject, input } from '@angular/core';
import { SiIconComponent } from '@siemens/element-ng/icon';
import { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';
import { SI_HEADER_WITH_DROPDOWNS } from './si-header.model';
/**
* Creates a dropdown-item. Must be used within an {@link SiHeaderDropdownComponent}.
*/
@Component({
selector: 'si-header-dropdown-item, a[si-header-dropdown-item], button[si-header-dropdown-item]',
imports: [NgClass, SiIconComponent],
templateUrl: './si-header-dropdown-item.component.html',
styleUrl: './si-header-dropdown-item.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'dropdown-item focus-inside'
}
})
export class SiHeaderDropdownItemComponent {
/** Optional icon that will be rendered before the label. */
readonly icon = input<string>();
/** Badge that is rendered after the label. */
readonly badge = input<string | number>();
/** Badge (always red) that is attached to the icon. */
readonly iconBadge = input<string | number>();
/** Color of the badge (not iconBadge). */
readonly badgeColor = input<string>();
/** Whether the icon is checked with a radio or check mark. */
readonly checked = input<'radio' | 'check' | ''>();
protected readonly ownTrigger = inject(SiHeaderDropdownTriggerDirective, {
self: true,
optional: true
});
protected readonly parentTrigger = inject(SiHeaderDropdownTriggerDirective, { skipSelf: true });
protected readonly navbar = inject(SI_HEADER_WITH_DROPDOWNS, { optional: true });
@HostListener('click')
protected click(): void {
if (!this.ownTrigger) {
this.parentTrigger.close({ all: true });
Iif (this.navbar?.onDropdownItemTriggered) {
this.navbar?.onDropdownItemTriggered();
}
}
}
}
|