From 367dfd104a399a1b0c34e684b2aabd9847c03a24 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Tue, 19 Nov 2024 11:58:59 +0300 Subject: [PATCH 1/2] update: `theme-shared` package for preventing possible injection context errors --- .../src/lib/services/abstract-menu.service.ts | 8 ++++++-- .../theme-shared/src/lib/services/toaster.service.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/abstract-menu.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/abstract-menu.service.ts index 4c3137b332..1af504f0ee 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/abstract-menu.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/abstract-menu.service.ts @@ -1,12 +1,12 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { NavItem } from '../models/nav-item'; import { inject, Type } from '@angular/core'; -import { SORT_COMPARE_FUNC } from '@abp/ng.core'; +import { SORT_COMPARE_FUNC, SortableItem } from '@abp/ng.core'; export abstract class AbstractMenuService { protected abstract baseClass: Type; - protected readonly sortFn = inject(SORT_COMPARE_FUNC); + protected readonly sortFn: (a: SortableItem, b: SortableItem) => number; protected _items$ = new BehaviorSubject([]); @@ -18,6 +18,10 @@ export abstract class AbstractMenuService { return this._items$.asObservable(); } + constructor() { + this.sortFn = inject(SORT_COMPARE_FUNC); + } + addItems(newItems: T[]) { const items = [...this.items]; newItems.forEach(item => { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts index 9b45be4d1b..7b5496d879 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts @@ -4,7 +4,7 @@ import { PROJECTION_STRATEGY, Strict, } from '@abp/ng.core'; -import { ComponentRef, Injectable } from '@angular/core'; +import { ComponentRef, inject, Injectable } from '@angular/core'; import { ReplaySubject } from 'rxjs'; import { ToastContainerComponent } from '../components/toast-container/toast-container.component'; import { Toaster } from '../models'; @@ -20,8 +20,7 @@ export class ToasterService implements ToasterContract { private toasts = [] as Toaster.Toast[]; private containerComponentRef!: ComponentRef; - - constructor(private contentProjectionService: ContentProjectionService) {} + private contentProjectionService: ContentProjectionService; private setContainer() { this.containerComponentRef = this.contentProjectionService.projectContent( @@ -34,6 +33,10 @@ export class ToasterService implements ToasterContract { this.containerComponentRef.changeDetectorRef.detectChanges(); } + constructor() { + this.contentProjectionService = inject(ContentProjectionService); + } + /** * Creates an info toast with given parameters. * @param message Content of the toast From 68714ffe5af7663532b9ab14456fc4c303e00cb0 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Tue, 19 Nov 2024 12:00:14 +0300 Subject: [PATCH 2/2] update: `components` package for preventing possible null `firstCreatePass` error --- npm/ng-packs/packages/components/page/src/page.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/components/page/src/page.component.ts b/npm/ng-packs/packages/components/page/src/page.component.ts index d0a48b145c..06a8e3af6d 100644 --- a/npm/ng-packs/packages/components/page/src/page.component.ts +++ b/npm/ng-packs/packages/components/page/src/page.component.ts @@ -45,7 +45,8 @@ export class PageComponent { this.breadcrumb || this.customTitle || this.customBreadcrumb || - this.customToolbar + this.customToolbar || + this.pageParts ); } }