diff --git a/npm/ng-packs/packages/components/chart.js/src/chart.component.ts b/npm/ng-packs/packages/components/chart.js/src/chart.component.ts index 9ab84aedcd..20689f9fba 100644 --- a/npm/ng-packs/packages/components/chart.js/src/chart.component.ts +++ b/npm/ng-packs/packages/components/chart.js/src/chart.component.ts @@ -4,14 +4,13 @@ import { ChangeDetectorRef, Component, ElementRef, - EventEmitter, Input, OnChanges, OnDestroy, - Output, SimpleChanges, ViewChild, - inject + inject, + output, } from '@angular/core'; let Chart: any; @@ -53,9 +52,8 @@ export class ChartComponent implements AfterViewInit, OnDestroy, OnChanges { @Input() responsive = true; - @Output() dataSelect = new EventEmitter(); - - @Output() initialized = new EventEmitter(); + readonly dataSelect = output(); + readonly initialized = output(); @ViewChild('canvas') canvas!: ElementRef; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts index 8669982c9c..66384df760 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts @@ -11,12 +11,12 @@ import { LOCALE_ID, OnChanges, OnDestroy, - Output, PLATFORM_ID, signal, SimpleChanges, TemplateRef, TrackByFunction, + output, contentChild, viewChild } from '@angular/core'; @@ -118,7 +118,7 @@ export class ExtensibleTableComponent implements OnChanges, AfterViewIn @Input() actionsTemplate?: TemplateRef; - @Output() tableActivate = new EventEmitter(); + readonly tableActivate = output(); @Input() selectable = false; @@ -128,18 +128,18 @@ export class ExtensibleTableComponent implements OnChanges, AfterViewIn _selectionType: SelectionType = SelectionType.multiClick; @Input() selected: any[] = []; - @Output() selectionChange = new EventEmitter(); + readonly selectionChange = output(); // Infinite scroll configuration @Input() infiniteScroll = false; @Input() isLoading = false; @Input() scrollThreshold = 10; - @Output() loadMore = new EventEmitter(); + readonly loadMore = output(); @Input() tableHeight: number; @Input() rowDetailTemplate?: TemplateRef>; @Input() rowDetailHeight: string | number = '100%'; - @Output() rowDetailToggle = new EventEmitter(); + readonly rowDetailToggle = output(); readonly rowDetailComponent = contentChild(ExtensibleTableRowDetailComponent); diff --git a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts index 97e0f305d6..03b9533714 100644 --- a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts +++ b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts @@ -7,7 +7,7 @@ import { inject, Input, OnInit, - Output, + output, TemplateRef, ViewEncapsulation, } from '@angular/core'; @@ -63,11 +63,11 @@ export class TreeComponent implements OnInit { readonly menu = contentChild>('menu'); readonly customNodeTemplate = contentChild(TreeNodeTemplateDirective); readonly expandedIconTemplate = contentChild(ExpandedIconTemplateDirective); - @Output() readonly checkedKeysChange = new EventEmitter(); - @Output() readonly expandedKeysChange = new EventEmitter(); - @Output() readonly selectedNodeChange = new EventEmitter(); - @Output() readonly dropOver = new EventEmitter(); - @Output() readonly nzExpandChange = new EventEmitter(); + readonly checkedKeysChange = output(); + readonly expandedKeysChange = output(); + readonly selectedNodeChange = output(); + readonly dropOver = output(); + readonly nzExpandChange = output(); @Input() noAnimation = true; @Input() draggable: boolean; @Input() checkable: boolean; diff --git a/npm/ng-packs/packages/core/src/lib/directives/caps-lock.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/caps-lock.directive.ts index 99bfcebb92..792b671962 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/caps-lock.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/caps-lock.directive.ts @@ -1,10 +1,10 @@ -import { Directive, EventEmitter, HostListener, Output } from '@angular/core'; +import { Directive, HostListener, output } from '@angular/core'; @Directive({ selector: '[abpCapsLock]', }) export class TrackCapsLockDirective { - @Output('abpCapsLock') capsLock = new EventEmitter(); + readonly capsLock = output({ alias: 'abpCapsLock' }); @HostListener('window:keydown', ['$event']) onKeyDown(event: KeyboardEvent): void { diff --git a/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts index 239aed688d..a3fb542d4d 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'; +import { Directive, ElementRef, Input, OnInit, inject, output } from '@angular/core'; import { fromEvent } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { SubscriptionService } from '../services/subscription.service'; @@ -13,7 +13,7 @@ export class InputEventDebounceDirective implements OnInit { @Input() debounce = 300; - @Output('input.debounce') readonly debounceEvent = new EventEmitter(); + readonly debounceEvent = output({ alias: 'input.debounce' }); ngOnInit(): void { const input$ = fromEvent(this.el.nativeElement, 'input').pipe( diff --git a/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts index 879fbdf780..eaeca51e94 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts @@ -1,12 +1,11 @@ -import { - ChangeDetectorRef, - Directive, - ElementRef, - EventEmitter, - Input, - OnInit, - Output, - inject +import { + ChangeDetectorRef, + Directive, + ElementRef, + Input, + OnInit, + inject, + output } from '@angular/core'; import { FormGroupDirective, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { fromEvent } from 'rxjs'; @@ -37,7 +36,7 @@ export class FormSubmitDirective implements OnInit { @Input() markAsDirtyWhenSubmit = true; - @Output() readonly ngSubmit = new EventEmitter(); + readonly ngSubmit = output(); executedNgSubmit = false; diff --git a/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts index 1271f031ba..e4033f9f16 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts @@ -1,4 +1,4 @@ -import { Directive, Output, EventEmitter, ElementRef, AfterViewInit, inject } from '@angular/core'; +import { Directive, ElementRef, AfterViewInit, inject, output } from '@angular/core'; @Directive({ selector: '[abpInit]', @@ -6,7 +6,7 @@ import { Directive, Output, EventEmitter, ElementRef, AfterViewInit, inject } fr export class InitDirective implements AfterViewInit { private elRef = inject(ElementRef); - @Output('abpInit') readonly init = new EventEmitter>(); + readonly init = output>({ alias: 'abpInit' }); ngAfterViewInit() { this.init.emit(this.elRef); diff --git a/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts index a1af9bf07e..2a3c8f0a80 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, EventEmitter, OnInit, Output, inject } from '@angular/core'; +import { Directive, ElementRef, OnInit, inject, output } from '@angular/core'; import { fromEvent } from 'rxjs'; import { SubscriptionService } from '../services/subscription.service'; @@ -10,7 +10,7 @@ export class StopPropagationDirective implements OnInit { private el = inject(ElementRef); private subscription = inject(SubscriptionService); - @Output('click.stop') readonly stopPropEvent = new EventEmitter(); + readonly stopPropEvent = output({ alias: 'click.stop' }); ngOnInit(): void { this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), event => { diff --git a/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts index 08075ee7f4..3cd625cd3c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, Output, inject } from '@angular/core'; +import { Component, Input, inject, output } from '@angular/core'; import { Router } from '@angular/router'; import { createDirectiveFactory, SpectatorDirective } from '@ngneat/spectator/vitest'; import { BehaviorSubject } from 'rxjs'; @@ -18,11 +18,9 @@ class DefaultComponent { @Input() twoWay: boolean; - @Output() - readonly twoWayChange = new EventEmitter(); + readonly twoWayChange = output(); - @Output() - readonly someOutput = new EventEmitter(); + readonly someOutput = output(); setTwoWay(value) { this.twoWay = value; diff --git a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts index 5feac210e5..200e39736b 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, Output, inject, DOCUMENT } from '@angular/core'; +import { Component, Input, inject, DOCUMENT, output } from '@angular/core'; import { NgTemplateOutlet } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ConfigStateService, LocalizationPipe, TrackByService } from '@abp/ng.core'; @@ -103,7 +103,7 @@ export class FeatureManagementComponent } } - @Output() readonly visibleChange = new EventEmitter(); + readonly visibleChange = output(); modalBusy = false; diff --git a/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts b/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts index c04d917515..6337eea163 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from '@angular/core'; +import { EventEmitter, OutputEmitterRef } from '@angular/core'; export namespace FeatureManagement { export interface FeatureManagementComponentInputs { @@ -8,6 +8,6 @@ export namespace FeatureManagement { } export interface FeatureManagementComponentOutputs { - readonly visibleChange: EventEmitter; + readonly visibleChange: EventEmitter | OutputEmitterRef; } } diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts index 635f5ed86b..bc0e98414e 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts @@ -20,13 +20,13 @@ import { computed, DOCUMENT, ElementRef, - EventEmitter, inject, Injector, Input, - Output, + QueryList, signal, TrackByFunction, + output, viewChildren } from '@angular/core'; import { of } from 'rxjs'; @@ -160,7 +160,7 @@ export class PermissionManagementComponent } } - @Output() readonly visibleChange = new EventEmitter(); + readonly visibleChange = output(); selectAllInThisTabsRef = viewChildren>('selectAllInThisTabsRef'); selectAllInAllTabsRef = viewChildren>('selectAllInAllTabsRef'); diff --git a/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts b/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts index 7909de0db9..58d7d95232 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts @@ -1,5 +1,5 @@ import { GetPermissionListResultDto } from '@abp/ng.permission-management/proxy'; -import { EventEmitter } from '@angular/core'; +import { EventEmitter, OutputEmitterRef } from '@angular/core'; export namespace PermissionManagement { export interface State { @@ -14,6 +14,6 @@ export namespace PermissionManagement { } export interface PermissionManagementComponentOutputs { - readonly visibleChange: EventEmitter; + readonly visibleChange: EventEmitter | OutputEmitterRef; } } 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 cd717d1a2d..9a11747b44 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 @@ -2,12 +2,11 @@ import { Component, ElementRef, - EventEmitter, Input, OnInit, - Output, Renderer2, inject, + output, viewChild } from '@angular/core'; import { ABP, StopPropagationDirective } from '@abp/ng.core'; @@ -22,9 +21,9 @@ import { ABP, StopPropagationDirective } from '@abp/ng.core'; [attr.form]="formName" [class]="buttonClass" [disabled]="loading || disabled" - (click.stop)="click.next($event); abpClick.next($event)" - (focus)="focus.next($event); abpFocus.next($event)" - (blur)="blur.next($event); abpBlur.next($event)" + (click.stop)="click.emit($event); abpClick.emit($event)" + (focus)="focus.emit($event); abpFocus.emit($event)" + (blur)="blur.emit($event); abpBlur.emit($event)" > @@ -58,17 +57,17 @@ export class ButtonComponent implements OnInit { @Input() attributes?: ABP.Dictionary; - @Output() readonly click = new EventEmitter(); + readonly click = output(); - @Output() readonly focus = new EventEmitter(); + readonly focus = output(); - @Output() readonly blur = new EventEmitter(); + readonly blur = output(); - @Output() readonly abpClick = new EventEmitter(); + readonly abpClick = output(); - @Output() readonly abpFocus = new EventEmitter(); + readonly abpFocus = output(); - @Output() readonly abpBlur = new EventEmitter(); + readonly abpBlur = output(); readonly buttonRef = viewChild.required>('button'); 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 8da578f9a7..be9c368704 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,4 +1,4 @@ -import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core'; +import { Component, forwardRef, Input, output } from '@angular/core'; import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms'; import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core'; @@ -13,8 +13,8 @@ import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core'; [readonly]="checkboxReadonly" [class]="checkboxClass" [style]="checkboxStyle" - (blur)="checkboxBlur.next()" - (focus)="checkboxFocus.next()" + (blur)="checkboxBlur.emit()" + (focus)="checkboxFocus.emit()" /> @if (label) {