Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(module:*): remove method parameter decorators #8567

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions components/affix/affix.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ import {
Component,
ElementRef,
EventEmitter,
Inject,
inject,
Input,
NgZone,
OnChanges,
OnDestroy,
OnInit,
Optional,
Output,
Renderer2,
SimpleChanges,
Expand All @@ -32,7 +31,7 @@ import { map, takeUntil, throttleTime } from 'rxjs/operators';
import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { NzScrollService } from 'ng-zorro-antd/core/services';
import { NgStyleInterface, NzSafeAny } from 'ng-zorro-antd/core/types';
import { NgStyleInterface } from 'ng-zorro-antd/core/types';
import { getStyleAsText, numberAttributeWithZeroFallback, shallowEqual } from 'ng-zorro-antd/core/util';

import { AffixRespondEvents } from './respond-events';
Expand Down Expand Up @@ -82,7 +81,7 @@ export class NzAffixComponent implements AfterViewInit, OnChanges, OnDestroy, On
private offsetChanged$ = new ReplaySubject<void>(1);
private destroy$ = new Subject<boolean>();
private timeout?: ReturnType<typeof setTimeout>;
private document: Document;
private document: Document = inject(DOCUMENT);

private get target(): Element | Window {
const el = this.nzTarget;
Expand All @@ -91,19 +90,17 @@ export class NzAffixComponent implements AfterViewInit, OnChanges, OnDestroy, On

constructor(
el: ElementRef,
@Inject(DOCUMENT) doc: NzSafeAny,
public nzConfigService: NzConfigService,
private scrollSrv: NzScrollService,
private ngZone: NgZone,
private platform: Platform,
private renderer: Renderer2,
private nzResizeObserver: NzResizeObserver,
private cdr: ChangeDetectorRef,
@Optional() private directionality: Directionality
private directionality: Directionality
) {
// The wrapper would stay at the original position as a placeholder.
this.placeholderNode = el.nativeElement;
this.document = doc;
}

ngOnInit(): void {
Expand Down
3 changes: 1 addition & 2 deletions components/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
OnChanges,
OnDestroy,
OnInit,
Optional,
Output,
SimpleChanges,
TemplateRef,
Expand Down Expand Up @@ -128,7 +127,7 @@ export class NzAlertComponent implements OnChanges, OnDestroy, OnInit {
constructor(
public nzConfigService: NzConfigService,
private cdr: ChangeDetectorRef,
@Optional() private directionality: Directionality
private directionality: Directionality
) {
this.nzConfigService
.getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME)
Expand Down
10 changes: 5 additions & 5 deletions components/anchor/anchor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Component,
ElementRef,
EventEmitter,
Inject,
inject,
Input,
NgZone,
numberAttribute,
Expand All @@ -31,7 +31,7 @@ import { takeUntil, throttleTime } from 'rxjs/operators';
import { NzAffixModule } from 'ng-zorro-antd/affix';
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { NzScrollService } from 'ng-zorro-antd/core/services';
import { NgStyleInterface, NzDirectionVHType, NzSafeAny } from 'ng-zorro-antd/core/types';
import { NgStyleInterface, NzDirectionVHType } from 'ng-zorro-antd/core/types';
import { numberAttributeWithZeroFallback } from 'ng-zorro-antd/core/util';

import { NzAnchorLinkComponent } from './anchor-link.component';
Expand Down Expand Up @@ -122,9 +122,9 @@ export class NzAnchorComponent implements OnDestroy, AfterViewInit, OnChanges {
private animating = false;
private destroy$ = new Subject<boolean>();
private handleScrollTimeoutID?: ReturnType<typeof setTimeout>;
private doc: Document = inject(DOCUMENT);

constructor(
@Inject(DOCUMENT) private doc: NzSafeAny,
public nzConfigService: NzConfigService,
private scrollSrv: NzScrollService,
private cdr: ChangeDetectorRef,
Expand Down Expand Up @@ -250,7 +250,7 @@ export class NzAnchorComponent implements OnDestroy, AfterViewInit, OnChanges {
}

handleScrollTo(linkComp: NzAnchorLinkComponent): void {
const el = this.doc.querySelector(linkComp.nzHref);
const el = this.doc.querySelector<HTMLElement>(linkComp.nzHref);
if (!el) {
return;
}
Expand Down Expand Up @@ -278,7 +278,7 @@ export class NzAnchorComponent implements OnDestroy, AfterViewInit, OnChanges {
}
if (nzContainer) {
const container = this.nzContainer;
this.container = typeof container === 'string' ? this.doc.querySelector(container) : container;
this.container = typeof container === 'string' ? this.doc.querySelector<HTMLElement>(container)! : container;
this.registerScrollEvent();
}
if (nzCurrentAnchor) {
Expand Down
9 changes: 4 additions & 5 deletions components/auto-complete/autocomplete-option.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
NgZone,
OnDestroy,
OnInit,
Optional,
Output,
ViewEncapsulation,
booleanAttribute
booleanAttribute,
inject
} from '@angular/core';
import { Subject, fromEvent } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';
Expand Down Expand Up @@ -66,15 +66,14 @@ export class NzAutocompleteOptionComponent implements OnInit, OnDestroy {

active = false;
selected = false;
nzAutocompleteOptgroupComponent = inject(NzAutocompleteOptgroupComponent, { optional: true });

private destroy$ = new Subject<void>();

constructor(
private ngZone: NgZone,
private changeDetectorRef: ChangeDetectorRef,
private element: ElementRef<HTMLElement>,
@Optional()
public nzAutocompleteOptgroupComponent: NzAutocompleteOptgroupComponent
private element: ElementRef<HTMLElement>
) {}

ngOnInit(): void {
Expand Down
13 changes: 6 additions & 7 deletions components/auto-complete/autocomplete-trigger.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import {
Directive,
ElementRef,
ExistingProvider,
forwardRef,
Inject,
Input,
NgZone,
OnDestroy,
Optional,
ViewContainerRef
ViewContainerRef,
forwardRef,
inject
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subject, Subscription } from 'rxjs';
Expand Down Expand Up @@ -90,14 +89,14 @@ export class NzAutocompleteTriggerDirective implements AfterViewInit, ControlVal
private selectionChangeSubscription!: Subscription;
private optionsChangeSubscription!: Subscription;
private overlayOutsideClickSubscription!: Subscription;
private document: Document = inject(DOCUMENT);
private nzInputGroupWhitSuffixOrPrefixDirective = inject(NzInputGroupWhitSuffixOrPrefixDirective, { optional: true });

constructor(
private ngZone: NgZone,
private elementRef: ElementRef,
private overlay: Overlay,
private viewContainerRef: ViewContainerRef,
@Optional() private nzInputGroupWhitSuffixOrPrefixDirective: NzInputGroupWhitSuffixOrPrefixDirective,
@Optional() @Inject(DOCUMENT) private document: NzSafeAny
private viewContainerRef: ViewContainerRef
) {}

ngAfterViewInit(): void {
Expand Down
7 changes: 3 additions & 4 deletions components/auto-complete/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import {
ContentChildren,
ElementRef,
EventEmitter,
Host,
Input,
OnChanges,
OnDestroy,
OnInit,
Optional,
Output,
QueryList,
SimpleChanges,
Expand Down Expand Up @@ -168,10 +166,11 @@ export class NzAutocompleteComponent implements AfterContentInit, AfterViewInit,

private afterNextRender$ = inject(NZ_AFTER_NEXT_RENDER$);

noAnimation = inject(NzNoAnimationDirective, { host: true, optional: true });

constructor(
private changeDetectorRef: ChangeDetectorRef,
@Optional() private directionality: Directionality,
@Host() @Optional() public noAnimation?: NzNoAnimationDirective
private directionality: Directionality
) {}

ngOnInit(): void {
Expand Down
10 changes: 4 additions & 6 deletions components/back-top/back-top.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ import {
Component,
ElementRef,
EventEmitter,
Inject,
Input,
NgZone,
OnChanges,
OnDestroy,
OnInit,
Optional,
Output,
SimpleChanges,
TemplateRef,
ViewChild,
ViewEncapsulation,
inject,
numberAttribute
} from '@angular/core';
import { Subject, Subscription, fromEvent } from 'rxjs';
Expand All @@ -32,7 +31,6 @@ import { debounceTime, takeUntil } from 'rxjs/operators';
import { fadeMotion } from 'ng-zorro-antd/core/animation';
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { NzDestroyService, NzScrollService } from 'ng-zorro-antd/core/services';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzIconModule } from 'ng-zorro-antd/icon';

const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'backTop';
Expand Down Expand Up @@ -98,16 +96,16 @@ export class NzBackTopComponent implements OnInit, OnDestroy, OnChanges {
}

private backTopClickSubscription = Subscription.EMPTY;
private doc: Document = inject(DOCUMENT);

constructor(
@Inject(DOCUMENT) private doc: NzSafeAny,
public nzConfigService: NzConfigService,
private scrollSrv: NzScrollService,
private platform: Platform,
private zone: NgZone,
private cdr: ChangeDetectorRef,
private destroy$: NzDestroyService,
@Optional() private directionality: Directionality
private directionality: Directionality
) {
this.dir = this.directionality.value;
}
Expand Down Expand Up @@ -156,7 +154,7 @@ export class NzBackTopComponent implements OnInit, OnDestroy, OnChanges {
ngOnChanges(changes: SimpleChanges): void {
const { nzTarget } = changes;
if (nzTarget) {
this.target = typeof this.nzTarget === 'string' ? this.doc.querySelector(this.nzTarget) : this.nzTarget;
this.target = typeof this.nzTarget === 'string' ? this.doc.querySelector(this.nzTarget) : this.nzTarget!;
this.registerScrollEvent();
}
}
Expand Down
10 changes: 5 additions & 5 deletions components/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ import {
ChangeDetectorRef,
Component,
ElementRef,
Host,
Input,
OnChanges,
OnDestroy,
OnInit,
Optional,
Renderer2,
SimpleChanges,
TemplateRef,
ViewEncapsulation,
booleanAttribute
booleanAttribute,
inject
} from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
Expand Down Expand Up @@ -101,13 +100,14 @@ export class NzBadgeComponent implements OnChanges, OnDestroy, OnInit {
@Input() nzOffset?: [number, number];
@Input() nzSize: NzSizeDSType = 'default';

noAnimation = inject(NzNoAnimationDirective, { host: true, optional: true });

constructor(
public nzConfigService: NzConfigService,
private renderer: Renderer2,
private cdr: ChangeDetectorRef,
private elementRef: ElementRef,
@Optional() private directionality: Directionality,
@Host() @Optional() public noAnimation?: NzNoAnimationDirective
private directionality: Directionality
) {}
ngOnInit(): void {
this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction: Direction) => {
Expand Down
3 changes: 1 addition & 2 deletions components/breadcrumb/breadcrumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Input,
OnDestroy,
OnInit,
Optional,
Renderer2,
TemplateRef,
ViewEncapsulation,
Expand Down Expand Up @@ -73,7 +72,7 @@ export class NzBreadCrumbComponent implements OnInit, OnDestroy, NzBreadcrumb {
private cdr: ChangeDetectorRef,
private elementRef: ElementRef,
private renderer: Renderer2,
@Optional() private directionality: Directionality
private directionality: Directionality
) {}

ngOnInit(): void {
Expand Down
12 changes: 2 additions & 10 deletions components/button/button-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
*/

import { Direction, Directionality } from '@angular/cdk/bidi';
import {
ChangeDetectionStrategy,
Component,
Input,
OnDestroy,
OnInit,
Optional,
ViewEncapsulation
} from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

Expand Down Expand Up @@ -40,7 +32,7 @@ export class NzButtonGroupComponent implements OnDestroy, OnInit {

private destroy$ = new Subject<void>();

constructor(@Optional() private directionality: Directionality) {}
constructor(private directionality: Directionality) {}
ngOnInit(): void {
this.dir = this.directionality.value;
this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction: Direction) => {
Expand Down
3 changes: 1 addition & 2 deletions components/button/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
OnChanges,
OnDestroy,
OnInit,
Optional,
Renderer2,
SimpleChanges,
ViewEncapsulation,
Expand Down Expand Up @@ -117,7 +116,7 @@ export class NzButtonComponent implements OnDestroy, OnChanges, AfterViewInit, A
private cdr: ChangeDetectorRef,
private renderer: Renderer2,
public nzConfigService: NzConfigService,
@Optional() private directionality: Directionality
private directionality: Directionality
) {
this.nzConfigService
.getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME)
Expand Down
3 changes: 1 addition & 2 deletions components/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
OnChanges,
OnDestroy,
OnInit,
Optional,
Output,
SimpleChanges,
TemplateRef,
Expand Down Expand Up @@ -147,7 +146,7 @@ export class NzCalendarComponent implements ControlValueAccessor, OnChanges, OnI

constructor(
private cdr: ChangeDetectorRef,
@Optional() private directionality: Directionality
private directionality: Directionality
) {}

ngOnInit(): void {
Expand Down
3 changes: 1 addition & 2 deletions components/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
Input,
OnDestroy,
OnInit,
Optional,
QueryList,
TemplateRef,
ViewEncapsulation,
Expand Down Expand Up @@ -120,7 +119,7 @@ export class NzCardComponent implements OnDestroy, OnInit {
constructor(
public nzConfigService: NzConfigService,
private cdr: ChangeDetectorRef,
@Optional() private directionality: Directionality
private directionality: Directionality
) {
this.nzConfigService
.getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME)
Expand Down
Loading