Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';

/**
* @experimental
Expand All @@ -11,6 +11,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'si-navbar-vertical-next-divider',
template: '',
styleUrl: './si-navbar-vertical-next-divider.component.scss'
styleUrl: './si-navbar-vertical-next-divider.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SiNavbarVerticalNextDividerComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@angular/cdk/overlay';
import { TemplatePortal } from '@angular/cdk/portal';
import {
ChangeDetectionStrategy,
Component,
ComponentRef,
computed,
Expand Down Expand Up @@ -39,6 +40,7 @@ import { SI_NAVBAR_VERTICAL_NEXT } from './si-navbar-vertical-next.provider';
@Component({
selector: 'si-navbar-flyout-anchor',
template: '',
changeDetection: ChangeDetectionStrategy.Default,
host: { '[attr.aria-owns]': 'groupId()' }
})
class SiNavbarFlyoutAnchorComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MIT
*/
import { CdkTrapFocus } from '@angular/cdk/a11y';
import { Component, computed, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { RouterLinkActive } from '@angular/router';

Expand All @@ -29,6 +29,7 @@ import { SI_NAVBAR_VERTICAL_NEXT } from './si-navbar-vertical-next.provider';
</div>
}`,
styleUrl: './si-navbar-vertical-next-group.component.scss',
changeDetection: ChangeDetectionStrategy.Default,
host: {
role: 'group',
'[id]': 'groupTrigger.groupId',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';

import { SiNavbarVerticalNextDividerComponent } from './si-navbar-vertical-next-divider.component';
import { SI_NAVBAR_VERTICAL_NEXT } from './si-navbar-vertical-next.provider';
Expand All @@ -21,6 +21,7 @@ import { SI_NAVBAR_VERTICAL_NEXT } from './si-navbar-vertical-next.provider';
}
`,
styleUrl: './si-navbar-vertical-next-header.component.scss',
changeDetection: ChangeDetectionStrategy.Default,
host: {
'[class.collapsed]': 'navbar.collapsed()',
'animate.enter': 'component-enter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component, signal } from '@angular/core';
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SiNavbarVerticalNextItemComponent } from './si-navbar-vertical-next-item.component';
Expand All @@ -18,7 +18,8 @@ import { SI_NAVBAR_VERTICAL_NEXT } from './si-navbar-vertical-next.provider';
[icon]="icon()"
>
Test Item
</a>`
</a>`,
changeDetection: ChangeDetectionStrategy.Default
})
class TestHostComponent {
readonly badge = signal<string | number | undefined>(undefined);
Expand All @@ -36,7 +37,8 @@ class TestHostComponent {
[hideBadgeWhenCollapsed]="hideBadgeWhenCollapsed()"
>
Test Item
</a>`
</a>`,
changeDetection: ChangeDetectionStrategy.OnPush
})
class TestHostWithBadgeVisibilityComponent {
readonly badge = signal<string | number | undefined>(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { Component, Injectable, signal } from '@angular/core';
import { ChangeDetectionStrategy, Component, Injectable, signal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter, Router, RouterLink, RouterLinkActive } from '@angular/router';
import {
Expand Down Expand Up @@ -49,7 +49,7 @@ class BreakpointObserverMock implements Partial<BreakpointObserver> {
}
}

@Component({ template: '' })
@Component({ template: '', changeDetection: ChangeDetectionStrategy.OnPush })
class EmptyComponent {}

@Component({
Expand Down Expand Up @@ -155,7 +155,8 @@ class EmptyComponent {}
sub-item2
</a>
</si-navbar-vertical-next-group>
</ng-template>`
</ng-template>`,
changeDetection: ChangeDetectionStrategy.OnPush
})
class TestHostComponent {
readonly textOnly = signal(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';

// We need a component to attach the stylesheet
@Component({
selector: 'si-navbar-vertical-divider',
template: '',
styleUrl: './si-navbar-vertical-divider.component.scss'
styleUrl: './si-navbar-vertical-divider.component.scss',
changeDetection: ChangeDetectionStrategy.Default
})
export class SiNavbarVerticalDividerComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { Overlay } from '@angular/cdk/overlay';
import { TemplatePortal } from '@angular/cdk/portal';
import {
ChangeDetectionStrategy,
Component,
ComponentRef,
computed,
Expand Down Expand Up @@ -34,6 +35,7 @@ import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';
@Component({
selector: 'si-navbar-flyout-anchor',
template: '',
changeDetection: ChangeDetectionStrategy.Default,
host: { '[attr.aria-owns]': 'groupId()' }
})
class SiNavbarFlyoutAnchorComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MIT
*/
import { CdkTrapFocus } from '@angular/cdk/a11y';
import { Component, computed, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { RouterLinkActive } from '@angular/router';

Expand All @@ -27,6 +27,7 @@ import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';
</div>
}`,
styleUrl: './si-navbar-vertical-group.component.scss',
changeDetection: ChangeDetectionStrategy.Default,
host: {
role: 'group',
'[id]': 'groupTrigger.groupId',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';

import { SiNavbarVerticalDividerComponent } from './si-navbar-vertical-divider.component';
import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';
Expand All @@ -20,6 +20,7 @@ import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';
}
`,
styleUrl: './si-navbar-vertical-header.component.scss',
changeDetection: ChangeDetectionStrategy.Default,
host: {
'[class.collapsed]': 'navbar.collapsed()',
'animate.enter': 'component-enter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component, computed, inject, input, model, viewChildren } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
computed,
inject,
input,
model,
viewChildren
} from '@angular/core';
import { MenuItem } from '@siemens/element-ng/common';
import { SiLinkDirective } from '@siemens/element-ng/link';
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
Expand All @@ -25,6 +33,7 @@ import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';
],
templateUrl: './si-navbar-vertical-item-legacy.component.html',
styleUrl: './si-navbar-vertical-item-legacy.component.scss',
changeDetection: ChangeDetectionStrategy.Default,
host: {
'class': 'd-block mb-4'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { Component, signal } from '@angular/core';
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SiNavbarVerticalItemComponent } from './si-navbar-vertical-item.component';
Expand All @@ -11,7 +11,8 @@ import { SI_NAVBAR_VERTICAL } from './si-navbar-vertical.provider';

@Component({
imports: [SiNavbarVerticalItemComponent],
template: `<a class="navbar-vertical-item" [si-navbar-vertical-item]="item()"> Test Item </a> `
template: `<a class="navbar-vertical-item" [si-navbar-vertical-item]="item()"> Test Item </a>`,
changeDetection: ChangeDetectionStrategy.OnPush
})
class TestHostComponent {
readonly item = signal<NavbarVerticalItemLink>({
Expand All @@ -23,7 +24,8 @@ class TestHostComponent {

@Component({
imports: [SiNavbarVerticalItemComponent],
template: `<a class="navbar-vertical-item" [si-navbar-vertical-item]="item()"> Test Item </a> `
template: `<a class="navbar-vertical-item" [si-navbar-vertical-item]="item()"> Test Item </a> `,
changeDetection: ChangeDetectionStrategy.OnPush
})
class TestHostWithBadgeVisibilityComponent {
readonly item = signal<NavbarVerticalItemLink>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NgTemplateOutlet } from '@angular/common';
import {
afterNextRender,
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
Directive,
Expand Down Expand Up @@ -80,6 +81,7 @@ export class SiNavbarVerticalItemGuardDirective {
templateUrl: './si-navbar-vertical.component.html',
styleUrl: './si-navbar-vertical.component.scss',
providers: [{ provide: SI_NAVBAR_VERTICAL, useExisting: SiNavbarVerticalComponent }],
changeDetection: ChangeDetectionStrategy.Default,
host: {
class: 'si-layout-inner',
'[class.nav-collapsed]': 'collapsed()',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { Component, Injectable, signal } from '@angular/core';
import { ChangeDetectionStrategy, Component, Injectable, signal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter, Router } from '@angular/router';
import {
Expand Down Expand Up @@ -42,7 +42,7 @@ class BreakpointObserverMock implements Partial<BreakpointObserver> {
}
}

@Component({ template: '' })
@Component({ template: '', changeDetection: ChangeDetectionStrategy.OnPush })
class EmptyComponent {}

@Component({
Expand All @@ -56,7 +56,8 @@ class EmptyComponent {}
[searchDebounceTime]="0"
(searchEvent)="searchEvent($event)"
(itemsChange)="itemsChange($event)"
/>`
/>`,
changeDetection: ChangeDetectionStrategy.OnPush
})
class TestHostComponent {
readonly items = signal<(MenuItem | NavbarVerticalItem)[]>([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { NgTemplateOutlet } from '@angular/common';
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
DoCheck,
inject,
Expand Down Expand Up @@ -39,6 +40,7 @@ import { SiNavbarPrimaryComponent } from '../si-navbar-primary/si-navbar-primary
SiIconComponent
],
templateUrl: './si-navbar-item.component.html',
changeDetection: ChangeDetectionStrategy.Default,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using ChangeDetectionStrategy.OnPush instead of ChangeDetectionStrategy.Default for SiNavbarItemComponent to align with the project's performance standards and other components in this PR.

Since SiNavbarItemComponent uses signal-based inputs (item, quickAction) and signal queries, it is well-suited for OnPush. If there are any legacy non-signal properties or mutable objects being passed, you can inject ChangeDetectorRef and call markForCheck() where appropriate (e.g., inside ngDoCheck()).

Suggested change
changeDetection: ChangeDetectionStrategy.Default,
changeDetection: ChangeDetectionStrategy.OnPush,
References
  1. Set changeDetection: ChangeDetectionStrategy.OnPush in @component decorator. (link)

host: { class: 'd-contents' }
})
export class SiNavbarItemComponent implements OnInit, DoCheck, OnDestroy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { A11yModule } from '@angular/cdk/a11y';
import { NgTemplateOutlet } from '@angular/common';
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
input,
OnChanges,
Expand Down Expand Up @@ -71,7 +72,8 @@ import { AppItem, AppItemCategory } from './si-navbar-primary.model';
inline-size: auto;
}
`,
providers: [{ provide: SI_HEADER_WITH_DROPDOWNS, useExisting: SiNavbarPrimaryComponent }]
providers: [{ provide: SI_HEADER_WITH_DROPDOWNS, useExisting: SiNavbarPrimaryComponent }],
changeDetection: ChangeDetectionStrategy.Default
})
export class SiNavbarPrimaryComponent implements OnChanges, HeaderWithDropdowns {
/**
Expand Down
Loading