From 0f4fd042a541a89540f14281f2eb459700f8c6e2 Mon Sep 17 00:00:00 2001 From: erdemcaygor Date: Mon, 5 May 2025 13:40:47 +0300 Subject: [PATCH] teheme shared module standalone migration --- .../breadcrumb-items/breadcrumb-items.component.ts | 6 ++++-- .../src/lib/components/breadcrumb/breadcrumb.component.ts | 4 +++- .../src/lib/components/button/button.component.ts | 3 ++- .../src/lib/components/checkbox/checkbox.component.ts | 5 +++-- .../lib/components/confirmation/confirmation.component.ts | 4 +++- .../src/lib/components/form-input/form-input.component.ts | 5 +++-- .../http-error-wrapper/http-error-wrapper.component.ts | 6 +++--- .../src/lib/components/loader-bar/loader-bar.component.ts | 3 ++- .../src/lib/components/loading/loading.component.ts | 3 ++- .../src/lib/components/modal/modal-close.directive.ts | 1 - .../src/lib/components/modal/modal.component.ts | 3 ++- .../toast-container/toast-container.component.ts | 4 +++- .../src/lib/components/toast/toast.component.ts | 4 +++- .../theme-shared/src/lib/directives/loading.directive.ts | 1 - .../packages/theme-shared/src/lib/theme-shared.module.ts | 8 +++++--- 15 files changed, 38 insertions(+), 22 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts index d7188f561a..8698f2ddc5 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts @@ -1,10 +1,12 @@ -import { ABP } from '@abp/ng.core'; +import { ABP, CoreModule } from '@abp/ng.core'; import { Component, Input } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; @Component({ - standalone: false, selector: 'abp-breadcrumb-items', templateUrl: './breadcrumb-items.component.html', + imports: [CommonModule, RouterModule, CoreModule], }) export class BreadcrumbItemsComponent { @Input() items: Partial[] = []; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts index bdc38612b3..5f69da8dce 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts @@ -10,13 +10,15 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@ import { Router } from '@angular/router'; import { map, startWith } from 'rxjs/operators'; import { eThemeSharedRouteNames } from '../../enums/route-names'; +import { CommonModule } from '@angular/common'; +import { BreadcrumbItemsComponent } from '../breadcrumb-items/breadcrumb-items.component'; @Component({ - standalone: false, selector: 'abp-breadcrumb', templateUrl: './breadcrumb.component.html', changeDetection: ChangeDetectionStrategy.OnPush, providers: [SubscriptionService], + imports: [CommonModule, BreadcrumbItemsComponent], }) export class BreadcrumbComponent implements OnInit { segments: Partial[] = []; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts index a0005cd5e7..6635dbe9c3 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts @@ -10,9 +10,9 @@ import { Renderer2, ViewChild, } from '@angular/core'; +import { CommonModule } from '@angular/common'; @Component({ - standalone: false, selector: 'abp-button', template: ` `, + imports: [CommonModule], }) export class ButtonComponent implements OnInit { @Input() diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts index 64c3d766e4..494119ed6f 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts @@ -1,9 +1,9 @@ -import { AbstractNgModelComponent } from '@abp/ng.core'; +import { AbstractNgModelComponent, CoreModule } from '@abp/ng.core'; import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; +import { CommonModule } from '@angular/common'; @Component({ - standalone: false, selector: 'abp-checkbox', template: `
@@ -31,6 +31,7 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms'; multi: true, }, ], + imports: [CommonModule, CoreModule], }) export class FormCheckboxComponent extends AbstractNgModelComponent { @Input() label?: string; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts index 493ca44b6b..19ae1203f0 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts @@ -2,12 +2,14 @@ import { Component, Inject } from '@angular/core'; import { ReplaySubject } from 'rxjs'; import { Confirmation } from '../../models/confirmation'; import { CONFIRMATION_ICONS, ConfirmationIcons } from '../../tokens/confirmation-icons.token'; +import { CommonModule } from '@angular/common'; +import { CoreModule } from '@abp/ng.core'; @Component({ - standalone: false, selector: 'abp-confirmation', templateUrl: './confirmation.component.html', styleUrls: ['./confirmation.component.scss'], + imports: [CommonModule, CoreModule], }) export class ConfirmationComponent { constructor(@Inject(CONFIRMATION_ICONS) private icons: ConfirmationIcons) {} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts index 2d7b358b7a..76b9fc6475 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts @@ -1,9 +1,9 @@ -import { AbstractNgModelComponent } from '@abp/ng.core'; +import { AbstractNgModelComponent, CoreModule } from '@abp/ng.core'; import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; +import { CommonModule } from '@angular/common'; @Component({ - standalone: false, selector: 'abp-form-input', template: `
@@ -32,6 +32,7 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms'; multi: true, }, ], + imports: [CommonModule, CoreModule], }) export class FormInputComponent extends AbstractNgModelComponent { @Input() inputId!: string; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts index f45be25d1e..c9f00a8f26 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts @@ -14,18 +14,18 @@ import { DestroyRef, } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { DOCUMENT } from '@angular/common'; +import { CommonModule, DOCUMENT } from '@angular/common'; import { Router } from '@angular/router'; import { fromEvent, Subject } from 'rxjs'; import { debounceTime, filter } from 'rxjs/operators'; -import { LocalizationParam } from '@abp/ng.core'; +import { CoreModule, LocalizationParam } from '@abp/ng.core'; import { ErrorScreenErrorCodes } from '../../models'; @Component({ - standalone: false, selector: 'abp-http-error-wrapper', templateUrl: './http-error-wrapper.component.html', styleUrls: ['http-error-wrapper.component.scss'], + imports: [CommonModule, CoreModule], }) export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestroy { protected readonly destroyRef = inject(DestroyRef); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts index 51aebfdee6..4add50bf21 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts @@ -2,9 +2,9 @@ import { HttpWaitService, RouterWaitService, SubscriptionService } from '@abp/ng import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { combineLatest, Subscription, timer } from 'rxjs'; +import { CommonModule } from '@angular/common'; @Component({ - standalone: false, selector: 'abp-loader-bar', template: `
@@ -21,6 +21,7 @@ import { combineLatest, Subscription, timer } from 'rxjs'; `, styleUrls: ['./loader-bar.component.scss'], providers: [SubscriptionService], + imports: [CommonModule], }) export class LoaderBarComponent implements OnDestroy, OnInit { protected _isLoading!: boolean; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts index 56990be1bc..a1c6ef8d16 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts @@ -1,7 +1,7 @@ import { Component, ViewEncapsulation } from '@angular/core'; +import { CommonModule } from '@angular/common'; @Component({ - standalone: false, selector: 'abp-loading', template: `
@@ -33,5 +33,6 @@ import { Component, ViewEncapsulation } from '@angular/core'; } `, ], + imports: [CommonModule], }) export class LoadingComponent {} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-close.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-close.directive.ts index 8b50174fd9..96455d1151 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-close.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-close.directive.ts @@ -2,7 +2,6 @@ import { Directive, HostListener, Optional } from '@angular/core'; import { ModalComponent } from './modal.component'; @Directive({ - standalone: false, selector: '[abpClose]', }) export class ModalCloseDirective { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index 30c802e387..ea2564c6f9 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -22,15 +22,16 @@ import { ConfirmationService } from '../../services/confirmation.service'; import { SUPPRESS_UNSAVED_CHANGES_WARNING } from '../../tokens/suppress-unsaved-changes-warning.token'; import { ButtonComponent } from '../button/button.component'; import { DismissableModal, ModalDismissMode, ModalRefService } from './modal-ref.service'; +import { CommonModule } from '@angular/common'; export type ModalSize = 'sm' | 'md' | 'lg' | 'xl'; @Component({ - standalone: false, selector: 'abp-modal', templateUrl: './modal.component.html', styleUrls: ['./modal.component.scss'], providers: [SubscriptionService], + imports: [CommonModule], }) export class ModalComponent implements OnInit, OnDestroy, DismissableModal { protected readonly confirmationService = inject(ConfirmationService); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts index 4703a41c17..1be4f3491d 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts @@ -2,13 +2,15 @@ import { Component, HostListener, Input, OnInit } from '@angular/core'; import { ReplaySubject } from 'rxjs'; import { toastInOut } from '../../animations/toast.animations'; import { Toaster } from '../../models/toaster'; +import { CommonModule } from '@angular/common'; +import { ToastComponent } from '../toast/toast.component'; @Component({ - standalone: false, selector: 'abp-toast-container', templateUrl: './toast-container.component.html', styleUrls: ['./toast-container.component.scss'], animations: [toastInOut], + imports: [CommonModule, ToastComponent], }) export class ToastContainerComponent implements OnInit { toasts$!: ReplaySubject; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts index d76790bf54..f1245befc4 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts @@ -1,10 +1,12 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Toaster } from '../../models/toaster'; +import { CommonModule } from '@angular/common'; +import { CoreModule } from '@abp/ng.core'; @Component({ - standalone: false, selector: 'abp-toast', templateUrl: './toast.component.html', styleUrls: ['./toast.component.scss'], + imports: [CommonModule, CoreModule], }) export class ToastComponent implements OnInit { @Input() diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts index e20ef4fa02..f33c8dc6a8 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts @@ -17,7 +17,6 @@ import { take } from 'rxjs/operators'; import { LoadingComponent } from '../components/loading/loading.component'; @Directive({ - standalone: false, selector: '[abpLoading]', }) export class LoadingDirective implements OnInit, OnDestroy { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index 50d179c3a9..69bd529bd3 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -34,7 +34,7 @@ import { AbpVisibleDirective, DisabledDirective } from './directives'; import { FormInputComponent } from './components/form-input/form-input.component'; import { FormCheckboxComponent } from './components/checkbox/checkbox.component'; -const declarationsWithExports = [ +export const THEME_SHARED_COMPONENTS = [ BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, @@ -48,6 +48,7 @@ const declarationsWithExports = [ ModalCloseDirective, FormInputComponent, FormCheckboxComponent, + HttpErrorWrapperComponent, ]; @NgModule({ @@ -63,8 +64,9 @@ const declarationsWithExports = [ NgxDatatableListDirective, DisabledDirective, AbpVisibleDirective, + ...THEME_SHARED_COMPONENTS, ], - declarations: [...declarationsWithExports, HttpErrorWrapperComponent], + declarations: [], exports: [ NgxDatatableModule, NgxValidateCoreModule, @@ -74,7 +76,7 @@ const declarationsWithExports = [ NgxDatatableListDirective, NgxDatatableDefaultDirective, PasswordComponent, - ...declarationsWithExports, + ...THEME_SHARED_COMPONENTS, ], providers: [DatePipe], })