From 3bad71eef7a39eb5356fd743c535ae14f93ea712 Mon Sep 17 00:00:00 2001 From: Tamara Gruszka Date: Thu, 28 Mar 2024 18:16:51 +0100 Subject: [PATCH 1/2] [ACS-7388] transform toolbar to standalone --- .../lib/toolbar/toolbar-divider.component.ts | 21 +++++++++++-------- .../lib/toolbar/toolbar-title.component.ts | 1 + lib/core/src/lib/toolbar/toolbar.component.ts | 5 +++-- lib/core/src/lib/toolbar/toolbar.module.ts | 18 ++-------------- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/lib/core/src/lib/toolbar/toolbar-divider.component.ts b/lib/core/src/lib/toolbar/toolbar-divider.component.ts index 36dee0cf9b2..7dd940b1003 100644 --- a/lib/core/src/lib/toolbar/toolbar-divider.component.ts +++ b/lib/core/src/lib/toolbar/toolbar-divider.component.ts @@ -19,17 +19,20 @@ import { Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/ @Component({ selector: 'adf-toolbar-divider', + standalone: true, template: '
', host: { class: 'adf-toolbar-divider' }, - styles: [` - .adf-toolbar-divider > div { - height: 24px; - width: 1px; - background: rgba(0, 0, 0, 0.26); - margin-left: 5px; - margin-right: 5px; - } - `], + styles: [ + ` + .adf-toolbar-divider > div { + height: 24px; + width: 1px; + background: rgba(0, 0, 0, 0.26); + margin-left: 5px; + margin-right: 5px; + } + ` + ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush }) diff --git a/lib/core/src/lib/toolbar/toolbar-title.component.ts b/lib/core/src/lib/toolbar/toolbar-title.component.ts index d856b4a1270..7221e98fb43 100644 --- a/lib/core/src/lib/toolbar/toolbar-title.component.ts +++ b/lib/core/src/lib/toolbar/toolbar-title.component.ts @@ -19,6 +19,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'adf-toolbar-title', + standalone: true, template: '', host: { class: 'adf-toolbar-title' } }) diff --git a/lib/core/src/lib/toolbar/toolbar.component.ts b/lib/core/src/lib/toolbar/toolbar.component.ts index 11c56e0e270..6d2206f6b12 100644 --- a/lib/core/src/lib/toolbar/toolbar.component.ts +++ b/lib/core/src/lib/toolbar/toolbar.component.ts @@ -17,17 +17,19 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; import { ThemePalette } from '@angular/material/core'; +import { MatToolbarModule } from '@angular/material/toolbar'; @Component({ selector: 'adf-toolbar', + standalone: true, templateUrl: './toolbar.component.html', styleUrls: ['./toolbar.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + imports: [MatToolbarModule], host: { class: 'adf-toolbar' } }) export class ToolbarComponent { - /** Toolbar title. */ @Input() title: string = ''; @@ -35,5 +37,4 @@ export class ToolbarComponent { /** Toolbar color. Can be changed to empty value (default), `primary`, `accent` or `warn`. */ @Input() color: ThemePalette; - } diff --git a/lib/core/src/lib/toolbar/toolbar.module.ts b/lib/core/src/lib/toolbar/toolbar.module.ts index a1ded955563..1eb934fdaf0 100644 --- a/lib/core/src/lib/toolbar/toolbar.module.ts +++ b/lib/core/src/lib/toolbar/toolbar.module.ts @@ -18,27 +18,13 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; -import { MaterialModule } from '../material.module'; import { ToolbarDividerComponent } from './toolbar-divider.component'; import { ToolbarTitleComponent } from './toolbar-title.component'; import { ToolbarComponent } from './toolbar.component'; @NgModule({ - imports: [ - CommonModule, - MaterialModule, - TranslateModule - ], - declarations: [ - ToolbarComponent, - ToolbarTitleComponent, - ToolbarDividerComponent - ], - exports: [ - ToolbarComponent, - ToolbarTitleComponent, - ToolbarDividerComponent - ] + imports: [CommonModule, ToolbarComponent, ToolbarTitleComponent, ToolbarDividerComponent, TranslateModule], + exports: [ToolbarComponent, ToolbarTitleComponent, ToolbarDividerComponent] }) export class ToolbarModule {} From 506bddde5fdfa6d445946ccdbcaf2d15afb59e3e Mon Sep 17 00:00:00 2001 From: Tamara Gruszka Date: Thu, 28 Mar 2024 18:16:51 +0100 Subject: [PATCH 2/2] [ACS-7388] transform toolbar to standalone --- lib/core/src/lib/toolbar/toolbar.component.ts | 4 +++- lib/core/src/lib/toolbar/toolbar.module.ts | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/core/src/lib/toolbar/toolbar.component.ts b/lib/core/src/lib/toolbar/toolbar.component.ts index 6d2206f6b12..a209e606600 100644 --- a/lib/core/src/lib/toolbar/toolbar.component.ts +++ b/lib/core/src/lib/toolbar/toolbar.component.ts @@ -18,6 +18,8 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; import { ThemePalette } from '@angular/material/core'; import { MatToolbarModule } from '@angular/material/toolbar'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgIf } from '@angular/common'; @Component({ selector: 'adf-toolbar', @@ -26,7 +28,7 @@ import { MatToolbarModule } from '@angular/material/toolbar'; styleUrls: ['./toolbar.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, - imports: [MatToolbarModule], + imports: [MatToolbarModule, TranslateModule, NgIf], host: { class: 'adf-toolbar' } }) export class ToolbarComponent { diff --git a/lib/core/src/lib/toolbar/toolbar.module.ts b/lib/core/src/lib/toolbar/toolbar.module.ts index 1eb934fdaf0..8d0c85814a4 100644 --- a/lib/core/src/lib/toolbar/toolbar.module.ts +++ b/lib/core/src/lib/toolbar/toolbar.module.ts @@ -15,16 +15,13 @@ * limitations under the License. */ -import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; - import { ToolbarDividerComponent } from './toolbar-divider.component'; import { ToolbarTitleComponent } from './toolbar-title.component'; import { ToolbarComponent } from './toolbar.component'; @NgModule({ - imports: [CommonModule, ToolbarComponent, ToolbarTitleComponent, ToolbarDividerComponent, TranslateModule], + imports: [ToolbarComponent, ToolbarTitleComponent, ToolbarDividerComponent], exports: [ToolbarComponent, ToolbarTitleComponent, ToolbarDividerComponent] }) export class ToolbarModule {}