Skip to content

Commit 2a4e460

Browse files
committed
chore: output() function migration
1 parent dffebd6 commit 2a4e460

File tree

11 files changed

+34
-68
lines changed

11 files changed

+34
-68
lines changed

libs/cdk/virtual-table/abstract-table-builder-api.directive.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import {
1111
Directive,
1212
effect,
1313
ElementRef,
14-
EventEmitter,
1514
inject,
1615
input,
1716
NgZone,
1817
OnChanges,
1918
OnDestroy,
2019
OnInit,
21-
Output,
20+
output,
2221
QueryList,
2322
SimpleChanges,
2423
ViewChild,
@@ -167,19 +166,13 @@ export abstract class AbstractTableBuilderApi<T>
167166

168167
public readonly isVirtualTable = input(true, {alias: 'is-virtual-table'});
169168

170-
@Output()
171-
public readonly afterRendered = new EventEmitter<boolean>();
172-
173-
@Output()
174-
public readonly schemaChanges = new EventEmitter<TableUpdateSchema>();
169+
public readonly afterRendered = output<boolean>();
170+
public readonly schemaChanges = output<TableUpdateSchema>();
175171

176172
// TODO: should be rename (breaking changes)
177173
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
178-
@Output()
179-
public readonly onChanges = new EventEmitter<Nullable<T[]>>();
180-
181-
@Output()
182-
public readonly sortChanges = new EventEmitter<OrderedField[]>();
174+
public readonly onChanges = output<Nullable<T[]>>();
175+
public readonly sortChanges = output<OrderedField[]>();
183176

184177
@ContentChild(NgxOptions, {static: false})
185178
public columnOptions: Nullable<NgxOptions> = null;

libs/cdk/virtual-table/components/ngx-context-menu/ngx-context-menu-item/ngx-context-menu-item.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import {
44
ChangeDetectorRef,
55
Component,
66
ElementRef,
7-
EventEmitter,
87
inject,
98
input,
109
NgZone,
1110
OnDestroy,
1211
OnInit,
13-
Output,
12+
output,
1413
ViewChild,
1514
ViewEncapsulation,
1615
} from '@angular/core';
@@ -59,8 +58,7 @@ export class NgxContextMenuItem<T = any> implements OnInit, OnDestroy {
5958

6059
// TODO: should be rename (breaking changes)
6160
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
62-
@Output()
63-
public readonly onClick = new EventEmitter<ContextItemEvent>();
61+
public readonly onClick = output<ContextItemEvent>();
6462

6563
@ViewChild('item', {static: false})
6664
public itemRef: Nullable<ElementRef<HTMLDivElement>> = null;

libs/cdk/virtual-table/components/ngx-header/ngx-header.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import {NgClass} from '@angular/common';
22
import {
33
ChangeDetectionStrategy,
44
Component,
5-
EventEmitter,
65
input,
7-
Output,
6+
output,
87
ViewEncapsulation,
98
} from '@angular/core';
109
import {SIGNAL} from '@angular/core/primitives/signals';
@@ -21,8 +20,7 @@ import {TableContentDirective} from '../../directives/table-content.directive';
2120
changeDetection: ChangeDetectionStrategy.OnPush,
2221
})
2322
export class NgxHeader extends TableContentDirective {
24-
@Output()
25-
public readonly expandedChange = new EventEmitter<InputBoolean>();
23+
public readonly expandedChange = output<InputBoolean>();
2624

2725
public readonly expanded = input<boolean, InputBoolean>(true, {
2826
transform: coerceBoolean,

libs/cdk/virtual-table/components/table-tbody/table-tbody.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import {
44
ChangeDetectionStrategy,
55
ChangeDetectorRef,
66
Component,
7-
EventEmitter,
87
inject,
98
input,
109
NgZone,
11-
Output,
10+
output,
1211
ViewEncapsulation,
1312
} from '@angular/core';
1413
import {getValueByPath} from '@angular-ru/cdk/object';
@@ -120,8 +119,7 @@ export class TableTbody<T> {
120119
alias: 'column-schema',
121120
});
122121

123-
@Output()
124-
public readonly changed = new EventEmitter<void>(true);
122+
public readonly changed = output();
125123

126124
public selection = inject(SelectionService<T>);
127125
public contextMenu = inject(ContextMenuService<T>);

libs/cdk/virtual-table/components/table-thead/table-thead.component.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import {NgClass, NgStyle, NgTemplateOutlet, TitleCasePipe} from '@angular/common
33
import {
44
ChangeDetectionStrategy,
55
Component,
6-
EventEmitter,
76
HostListener,
87
inject,
98
input,
10-
Output,
9+
output,
1110
ViewEncapsulation,
1211
} from '@angular/core';
1312
import {fadeInLinearAnimation} from '@angular-ru/cdk/animations';
@@ -61,14 +60,9 @@ export class TableThead<T> {
6160
alias: 'column-schema',
6261
});
6362

64-
@Output()
65-
public readonly resizing = new EventEmitter<ResizeEvent>();
66-
67-
@Output()
68-
public readonly sortByKey = new EventEmitter<string>();
69-
70-
@Output()
71-
public readonly openContextMenu = new EventEmitter<MouseEvent>();
63+
public readonly resizing = output<ResizeEvent>();
64+
public readonly sortByKey = output<string>();
65+
public readonly openContextMenu = output<MouseEvent>();
7266

7367
public orderType: typeof SortOrderType = SortOrderType;
7468
public limit: number = OVERLOAD_WIDTH_TABLE_HEAD_CELL;

libs/cdk/virtual-table/directives/auto-height.directive.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import {
22
Directive,
33
ElementRef,
4-
EventEmitter,
54
inject,
65
input,
76
NgZone,
87
OnChanges,
98
OnDestroy,
109
OnInit,
11-
Output,
10+
output,
1211
SimpleChanges,
1312
} from '@angular/core';
1413
import {Nullable} from '@angular-ru/cdk/typings';
@@ -43,8 +42,7 @@ export class AutoHeight<T> implements OnInit, OnChanges, OnDestroy {
4342

4443
public readonly sourceRef = input<T[]>([]);
4544

46-
@Output()
47-
public readonly recalculatedHeight = new EventEmitter<void>(true);
45+
public readonly recalculatedHeight = output();
4846

4947
public get destroy$(): Subject<boolean> {
5048
return this._destroy$;

libs/cdk/virtual-table/directives/observer-view.directive.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import {
22
AfterViewInit,
33
Directive,
44
ElementRef,
5-
EventEmitter,
65
inject,
76
input,
87
NgZone,
98
OnDestroy,
10-
Output,
9+
output,
1110
} from '@angular/core';
1211
import {Nullable} from '@angular-ru/cdk/typings';
1312
import {isNotNil} from '@angular-ru/cdk/utils';
@@ -25,8 +24,7 @@ export class ObserverView implements AfterViewInit, OnDestroy {
2524

2625
public readonly observerRootMargin = input<string>();
2726

28-
@Output()
29-
public readonly observeVisible = new EventEmitter<boolean>(true);
27+
public readonly observeVisible = output<boolean>();
3028

3129
public ngAfterViewInit(): void {
3230
this.ngZone.runOutsideAngular((): void => {
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
/* eslint-disable @angular-eslint/no-input-rename */
22
import type {Signal} from '@angular/core';
3-
import {
4-
Directive,
5-
EventEmitter,
6-
inject,
7-
input,
8-
Output,
9-
signal,
10-
TemplateRef,
11-
} from '@angular/core';
3+
import {Directive, inject, input, output, signal, TemplateRef} from '@angular/core';
124
import {Nullable, PlainObject} from '@angular-ru/cdk/typings';
135

146
import {TableEvent} from '../../interfaces/table-builder.external';
@@ -29,11 +21,9 @@ export abstract class AbstractTemplateCellCommonDirective<T> {
2921

3022
// TODO: should be rename (breaking changes)
3123
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
32-
@Output()
33-
public readonly onClick = new EventEmitter<TableEvent<T | any, any>>();
24+
public readonly onClick = output<TableEvent<T | any, any>>();
3425

35-
@Output()
36-
public readonly dblClick = new EventEmitter<TableEvent<T | any, any>>();
26+
public readonly dblClick = output<TableEvent<T | any, any>>();
3727

3828
public type: Signal<Nullable<string>> = signal(null);
3929
}

libs/cdk/virtual-table/interfaces/table-builder.external.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {EmbeddedViewRef, EventEmitter, TemplateRef} from '@angular/core';
1+
import type {OutputEmitterRef} from '@angular/core';
2+
import {EmbeddedViewRef, TemplateRef} from '@angular/core';
23
import {ExcelType} from '@angular-ru/cdk/excel';
34
import {DeepPartial, Nullable, PlainObject} from '@angular-ru/cdk/typings';
45

@@ -10,7 +11,7 @@ export enum ImplicitContext {
1011
CELL = 'CELL',
1112
}
1213

13-
export type TableClickEventEmitter<T, K> = Nullable<EventEmitter<TableEvent<T, K>>>;
14+
export type TableClickEventEmitter<T, K> = Nullable<OutputEmitterRef<TableEvent<T, K>>>;
1415

1516
export interface TableCellOptions<T = any> {
1617
class: Nullable<PlainObject | string[] | string>;
@@ -22,8 +23,8 @@ export interface TableCellOptions<T = any> {
2223
height: Nullable<number>;
2324
template?: Nullable<TemplateRef<T>>;
2425
context: ImplicitContext;
25-
onClick: EventEmitter<any>;
26-
dblClick: EventEmitter<any>;
26+
onClick: OutputEmitterRef<any>;
27+
dblClick: OutputEmitterRef<any>;
2728
}
2829

2930
export interface TableHeadCellOptions {

libs/cdk/virtual-table/services/sortable/sortable.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {EventEmitter, inject, Injectable, NgZone} from '@angular/core';
1+
import {inject, Injectable, NgZone, OutputEmitterRef} from '@angular/core';
22
import {Nullable, PlainObjectOf, SortOrderType} from '@angular-ru/cdk/typings';
33
import {isNotNil, isTruthy} from '@angular-ru/cdk/utils';
44
import {WebWorkerThreadService} from '@angular-ru/cdk/webworker';
@@ -14,7 +14,7 @@ export class SortableService<T> {
1414
private readonly zone = inject(NgZone);
1515

1616
private skipInternalSort = false;
17-
private sortChanges: Nullable<EventEmitter<OrderedField[]>> = null;
17+
private sortChanges: Nullable<OutputEmitterRef<OrderedField[]>> = null;
1818
public definition: PlainObjectOf<SortOrderType> = {};
1919
public positionMap: PlainObjectOf<number> = {};
2020
public sortableCount = 0;
@@ -52,7 +52,7 @@ export class SortableService<T> {
5252
this.skipInternalSort = skipInternalSort;
5353
}
5454

55-
public setSortChanges(emitter: EventEmitter<OrderedField[]>): void {
55+
public setSortChanges(emitter: OutputEmitterRef<OrderedField[]>): void {
5656
this.sortChanges = emitter;
5757
}
5858

0 commit comments

Comments
 (0)