Skip to content
New issue

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

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

Already on GitHub? # to your account

refactor(module:*): migrate the source code to Angular v10 #5494

Merged
merged 1 commit into from
Jul 2, 2020
Merged
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
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "less"
"style": "less"
},
"@schematics/angular:directive": {
"prefix": "app"
Expand Down
4 changes: 1 addition & 3 deletions components/affix/affix.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import { PlatformModule } from '@angular/cdk/platform';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core/services';

import { NzAffixComponent } from './affix.component';

@NgModule({
declarations: [NzAffixComponent],
exports: [NzAffixComponent],
imports: [CommonModule, PlatformModule],
providers: [SCROLL_SERVICE_PROVIDER]
imports: [CommonModule, PlatformModule]
})
export class NzAffixModule {}
4 changes: 1 addition & 3 deletions components/anchor/anchor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import { PlatformModule } from '@angular/cdk/platform';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { NzAffixModule } from 'ng-zorro-antd/affix';
import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core/services';

import { NzAnchorLinkComponent } from './anchor-link.component';
import { NzAnchorComponent } from './anchor.component';

@NgModule({
declarations: [NzAnchorComponent, NzAnchorLinkComponent],
exports: [NzAnchorComponent, NzAnchorLinkComponent],
imports: [CommonModule, NzAffixModule, PlatformModule],
providers: [SCROLL_SERVICE_PROVIDER]
imports: [CommonModule, NzAffixModule, PlatformModule]
})
export class NzAnchorModule {}
4 changes: 1 addition & 3 deletions components/back-top/back-top.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import { PlatformModule } from '@angular/cdk/platform';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core/services';

import { NzBackTopComponent } from './back-top.component';

@NgModule({
declarations: [NzBackTopComponent],
exports: [NzBackTopComponent],
imports: [CommonModule, PlatformModule],
providers: [SCROLL_SERVICE_PROVIDER]
imports: [CommonModule, PlatformModule]
})
export class NzBackTopModule {}
16 changes: 4 additions & 12 deletions components/core/services/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { DOCUMENT } from '@angular/common';
import { Inject, Injectable, Optional, Provider, SkipSelf } from '@angular/core';
import { Inject, Injectable } from '@angular/core';
import { reqAnimFrame } from 'ng-zorro-antd/core/polyfill';
import { NzSafeAny } from 'ng-zorro-antd/core/types';

Expand All @@ -20,7 +20,9 @@ function easeInOutCubic(t: number, b: number, c: number, d: number): number {
}
}

@Injectable()
@Injectable({
providedIn: 'root'
})
export class NzScrollService {
private doc: Document;

Expand Down Expand Up @@ -103,13 +105,3 @@ export class NzScrollService {
reqAnimFrame(frameFunc);
}
}

export function SCROLL_SERVICE_PROVIDER_FACTORY(doc: Document, scrollService: NzScrollService): NzScrollService {
return scrollService || new NzScrollService(doc);
}

export const SCROLL_SERVICE_PROVIDER: Provider = {
provide: NzScrollService,
useFactory: SCROLL_SERVICE_PROVIDER_FACTORY,
deps: [DOCUMENT, [new Optional(), new SkipSelf(), NzScrollService]]
};
4 changes: 3 additions & 1 deletion components/date-picker/lib/abstract-panel-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { Directive, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { CandyDate } from 'ng-zorro-antd/core/time';
import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n';
import { NzDateMode } from '../standard-types';
import { PanelSelector } from './interface';

@Directive()
// tslint:disable-next-line:directive-class-suffix
export abstract class AbstractPanelHeader implements OnInit, OnChanges {
prefixCls: string = `ant-picker-header`;
selectors: PanelSelector[] = [];
Expand Down
4 changes: 3 additions & 1 deletion components/date-picker/lib/abstract-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, TemplateRef } from '@angular/core';
import { Directive, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, TemplateRef } from '@angular/core';
import { CandyDate } from 'ng-zorro-antd/core/time';
import { FunctionProp, NzSafeAny } from 'ng-zorro-antd/core/types';
import { isNonEmptyString, isTemplateRef } from 'ng-zorro-antd/core/util';
import { DateBodyRow, DateCell } from './interface';

@Directive()
// tslint:disable-next-line:directive-class-suffix
export abstract class AbstractTable implements OnInit, OnChanges {
isTemplateRef = isTemplateRef;
isNonEmptyString = isNonEmptyString;
Expand Down
2 changes: 2 additions & 0 deletions components/timeline/timeline.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
import { Injectable } from '@angular/core';
import { ReplaySubject } from 'rxjs';

@Injectable()
export class TimelineService {
check$ = new ReplaySubject(1);
markForCheck(): void {
Expand Down
8 changes: 7 additions & 1 deletion components/tooltip/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ChangeDetectorRef,
ComponentFactory,
ComponentFactoryResolver,
Directive,
ElementRef,
EventEmitter,
Input,
Expand All @@ -24,13 +25,14 @@ import {
import { warnDeprecation } from 'ng-zorro-antd/core/logger';
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
import { DEFAULT_TOOLTIP_POSITIONS, getPlacementName, POSITION_MAP } from 'ng-zorro-antd/core/overlay';
import { NgClassInterface, NgStyleInterface, NzSafeAny, NzTSType } from 'ng-zorro-antd/core/types';
import { BooleanInput, NgClassInterface, NgStyleInterface, NzSafeAny, NzTSType } from 'ng-zorro-antd/core/types';
import { isNotNil, toBoolean } from 'ng-zorro-antd/core/util';
import { Subject } from 'rxjs';
import { distinctUntilChanged, takeUntil } from 'rxjs/operators';

export type NzTooltipTrigger = 'click' | 'focus' | 'hover' | null;

@Directive()
export abstract class NzTooltipBaseDirective implements OnChanges, OnDestroy, AfterViewInit {
directiveNameTitle?: NzTSType | null;
specificTitle?: NzTSType | null;
Expand Down Expand Up @@ -334,7 +336,11 @@ Please use 'nzTooltipTrigger' instead. The same with 'nz-popover' and 'nz-popcon
}
}

@Directive()
// tslint:disable-next-line:directive-class-suffix
export abstract class NzTooltipBaseComponent implements OnDestroy {
static ngAcceptInputType_nzVisible: BooleanInput;

@ViewChild('overlay', { static: false }) overlay!: CdkConnectedOverlay;

nzVisibleChange = new Subject<boolean>();
Expand Down