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

chore: bump to Angular 8.0.0 #3529

Merged
merged 3 commits into from
Jun 11, 2019
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 components/affix/affix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ describe('affix-extra', () => {
`
})
class TestAffixComponent {
@ViewChild(NzAffixComponent)
@ViewChild(NzAffixComponent, { static: true })
nzAffixComponent: NzAffixComponent;
fakeTarget: string | Element | Window | null = null;
newOffset: {};
Expand Down
2 changes: 1 addition & 1 deletion components/affix/nz-affix.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class NzAffixComponent implements OnInit, OnDestroy {

private timeout: number;
private readonly events = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
@ViewChild('fixedEl') private fixedEl: ElementRef;
@ViewChild('fixedEl', { static: false }) private fixedEl: ElementRef;

private readonly placeholderNode: HTMLElement;

Expand Down
2 changes: 1 addition & 1 deletion components/alert/nz-alert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('alert', () => {
`
})
export class NzDemoTestBasicComponent {
@ViewChild('template') template: TemplateRef<void>;
@ViewChild('template', { static: false }) template: TemplateRef<void>;
banner = false;
closeable = false;
closeText: string | TemplateRef<void>;
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/anchor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ describe('anchor', () => {
`
})
export class TestComponent {
@ViewChild(NzAnchorComponent) comp: NzAnchorComponent;
@ViewChild(NzAnchorComponent, { static: false }) comp: NzAnchorComponent;
nzAffix = true;
nzBounds = 5;
nzOffsetTop = 0;
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/nz-anchor-link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class NzAnchorLinkComponent implements OnInit, OnDestroy {
}
}

@ContentChild('nzTemplate') nzTemplate: TemplateRef<void>;
@ContentChild('nzTemplate', { static: false }) nzTemplate: TemplateRef<void>;

constructor(
public elementRef: ElementRef,
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/nz-anchor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const sharpMatcherRegx = /#([^#]+)$/;
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NzAnchorComponent implements OnDestroy, AfterViewInit {
@ViewChild('ink') private ink: ElementRef;
@ViewChild('ink', { static: false }) private ink: ElementRef;

@Input() @InputBoolean() nzAffix = true;
@Input() @InputBoolean() nzShowInkInFixed = false;
Expand Down
8 changes: 4 additions & 4 deletions components/auto-complete/nz-autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ export class NzAutocompleteComponent implements AfterViewInit, OnDestroy {
@ViewChildren(NzAutocompleteOptionComponent) fromDataSourceOptions: QueryList<NzAutocompleteOptionComponent>;

/** cdk-overlay */
@ViewChild(TemplateRef) template: TemplateRef<{}>;
@ViewChild('panel') panel: ElementRef;
@ViewChild('content') content: ElementRef;
@ViewChild(TemplateRef, { static: false }) template: TemplateRef<{}>;
@ViewChild('panel', { static: false }) panel: ElementRef;
@ViewChild('content', { static: false }) content: ElementRef;

private activeItemIndex: number = -1;
private selectionChangeSubscription = Subscription.EMPTY;
private dataSourceChangeSubscription = Subscription.EMPTY;
/** Options changes listener */
readonly optionSelectionChanges: Observable<NzOptionSelectionChange> = defer(() => {
if (this.options) {
return merge(...this.options.map(option => option.selectionChange));
return merge<NzOptionSelectionChange>(...this.options.map(option => option.selectionChange));
}
return this.ngZone.onStable.asObservable().pipe(
take(1),
Expand Down
16 changes: 8 additions & 8 deletions components/auto-complete/nz-autocomplete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,8 @@ class NzTestSimpleAutocompleteComponent {
inputControl = new FormControl();
options: Array<string | number> = ['Burns Bay Road', 'Downing Street', 'Wall Street'];

@ViewChild(NzAutocompleteComponent) panel: NzAutocompleteComponent;
@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteComponent, { static: false }) panel: NzAutocompleteComponent;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;
@ViewChildren(NzAutocompleteOptionComponent) optionComponents: QueryList<NzAutocompleteOptionComponent>;

constructor() {
Expand Down Expand Up @@ -880,8 +880,8 @@ class NzTestAutocompletePropertyComponent {
overlayClassName = '';
overlayStyle = {};
options = ['Burns Bay Road', 'Downing Street', 'Wall Street'];
@ViewChild(NzAutocompleteComponent) panel: NzAutocompleteComponent;
@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteComponent, { static: false }) panel: NzAutocompleteComponent;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;

constructor() {}
}
Expand All @@ -892,7 +892,7 @@ class NzTestAutocompletePropertyComponent {
`
})
class NzTestAutocompleteWithoutPanelComponent {
@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;
}

@Component({
Expand All @@ -906,7 +906,7 @@ class NzTestAutocompleteWithoutPanelComponent {
})
class NzTestAutocompleteWithOnPushDelayComponent implements OnInit {
options: string[] = [];
@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;

ngOnInit(): void {
setTimeout(() => {
Expand Down Expand Up @@ -975,7 +975,7 @@ class NzTestAutocompleteGroupComponent {
}
];

@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;
}

@Component({
Expand All @@ -991,7 +991,7 @@ class NzTestAutocompleteGroupComponent {
class NzTestAutocompleteWithFormComponent {
form: FormGroup;
options = ['Burns Bay Road', 'Downing Street', 'Wall Street'];
@ViewChild(NzAutocompleteTriggerDirective) trigger: NzAutocompleteTriggerDirective;
@ViewChild(NzAutocompleteTriggerDirective, { static: false }) trigger: NzAutocompleteTriggerDirective;

constructor(private fb: FormBuilder) {
this.form = this.fb.group({ formControl: 'Burns' });
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/avatar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('avatar', () => {
styleUrls: ['./style/index.less']
})
class TestAvatarComponent {
@ViewChild('comp') comp: NzAvatarComponent;
@ViewChild('comp', { static: false }) comp: NzAvatarComponent;
nzShape = 'square';
nzSize: string | number = 'large';
nzIcon: string | null = 'anticon anticon-user';
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/nz-avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class NzAvatarComponent implements OnChanges {
hasIcon: boolean = false;
textStyles: {};

@ViewChild('textEl') textEl: ElementRef;
@ViewChild('textEl', { static: false }) textEl: ElementRef;

private el: HTMLElement = this.elementRef.nativeElement;
private prefixCls = 'ant-avatar';
Expand Down
4 changes: 2 additions & 2 deletions components/back-top/back-top.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('Component:nz-back-top', () => {
`
})
class TestBackTopComponent {
@ViewChild(NzBackTopComponent)
@ViewChild(NzBackTopComponent, { static: true })
nzBackTopComponent: NzBackTopComponent;
}

Expand All @@ -217,7 +217,7 @@ class TestBackTopComponent {
`
})
class TestBackTopTemplateComponent {
@ViewChild(NzBackTopComponent)
@ViewChild(NzBackTopComponent, { static: false })
nzBackTopComponent: NzBackTopComponent;
}

Expand Down
2 changes: 1 addition & 1 deletion components/badge/nz-badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class NzBadgeComponent implements OnInit, AfterViewInit, OnChanges {
];
presetColor: string | null = null;
count: number;
@ViewChild('contentElement') contentElement: ElementRef;
@ViewChild('contentElement', { static: false }) contentElement: ElementRef;
@Input() @InputBoolean() nzShowZero = false;
@Input() @InputBoolean() nzShowDot = true;
@Input() @InputBoolean() nzDot = false;
Expand Down
2 changes: 1 addition & 1 deletion components/button/nz-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NzButtonComponent implements AfterContentInit, OnInit, OnDestroy, O
readonly el: HTMLElement = this.elementRef.nativeElement;
private iconElement: HTMLElement;
private iconOnly = false;
@ViewChild('contentElement') contentElement: ElementRef;
@ViewChild('contentElement', { static: true }) contentElement: ElementRef;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is static true required here

@ContentChildren(NzIconDirective, { read: ElementRef }) listOfIconElement: QueryList<ElementRef>;
@HostBinding('attr.nz-wave') nzWave = new NzWaveDirective(
this.ngZone,
Expand Down
8 changes: 4 additions & 4 deletions components/calendar/nz-calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,28 +105,28 @@ export class NzCalendarComponent implements ControlValueAccessor, OnInit {
return !this.fullscreen;
}

@ContentChild(DateCell, { read: TemplateRef })
@ContentChild(DateCell, { static: false, read: TemplateRef })
set dateCellChild(value: TemplateRef<{ $implicit: Date }>) {
if (value) {
this.dateCell = value;
}
}

@ContentChild(DateFullCell, { read: TemplateRef })
@ContentChild(DateFullCell, { static: false, read: TemplateRef })
set dateFullCellChild(value: TemplateRef<{ $implicit: Date }>) {
if (value) {
this.dateFullCell = value;
}
}

@ContentChild(MonthCell, { read: TemplateRef })
@ContentChild(MonthCell, { static: false, read: TemplateRef })
set monthCellChild(value: TemplateRef<{ $implicit: Date }>) {
if (value) {
this.monthCell = value;
}
}

@ContentChild(MonthFullCell, { read: TemplateRef })
@ContentChild(MonthFullCell, { static: false, read: TemplateRef })
set monthFullCellChild(value: TemplateRef<{ $implicit: Date }>) {
if (value) {
this.monthFullCell = value;
Expand Down
2 changes: 1 addition & 1 deletion components/card/nz-card-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ import { ChangeDetectionStrategy, Component, TemplateRef, ViewChild, ViewEncapsu
templateUrl: './nz-card-tab.component.html'
})
export class NzCardTabComponent {
@ViewChild(TemplateRef) template: TemplateRef<void>;
@ViewChild(TemplateRef, { static: false }) template: TemplateRef<void>;
}
2 changes: 1 addition & 1 deletion components/card/nz-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class NzCardComponent {
@Input() nzSize: 'default' | 'small' = 'default';
@Input() nzTitle: string | TemplateRef<void>;
@Input() nzExtra: string | TemplateRef<void>;
@ContentChild(NzCardTabComponent) tab: NzCardTabComponent;
@ContentChild(NzCardTabComponent, { static: false }) tab: NzCardTabComponent;
@ContentChildren(NzCardGridDirective) grids: QueryList<NzCardGridDirective>;

constructor(renderer: Renderer2, elementRef: ElementRef) {
Expand Down
4 changes: 2 additions & 2 deletions components/carousel/nz-carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ import { NzCarouselTransformStrategy } from './strategies/transform-strategy';
export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnDestroy, OnChanges {
@ContentChildren(NzCarouselContentDirective) carouselContents: QueryList<NzCarouselContentDirective>;

@ViewChild('slickList') slickList: ElementRef;
@ViewChild('slickTrack') slickTrack: ElementRef;
@ViewChild('slickList', { static: false }) slickList: ElementRef;
@ViewChild('slickTrack', { static: false }) slickTrack: ElementRef;

@Input() nzDotRender: TemplateRef<{ $implicit: number }>;
@Input() nzEffect: NzCarouselEffects = 'scrollx';
Expand Down
2 changes: 1 addition & 1 deletion components/carousel/nz-carousel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { NzCarouselOpacityStrategy } from './strategies/opacity-strategy';
`
})
export class NzTestCarouselBasicComponent {
@ViewChild(NzCarouselComponent) nzCarouselComponent: NzCarouselComponent;
@ViewChild(NzCarouselComponent, { static: false }) nzCarouselComponent: NzCarouselComponent;
dots = true;
vertical = false;
effect = 'scrollx';
Expand Down
6 changes: 3 additions & 3 deletions components/cascader/nz-cascader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ const defaultDisplayRender = (labels: string[]) => labels.join(' / ');
]
})
export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit, OnDestroy, ControlValueAccessor {
@ViewChild('input') input: ElementRef;
@ViewChild('menu') menu: ElementRef;
@ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay;
@ViewChild('input', { static: false }) input: ElementRef;
@ViewChild('menu', { static: false }) menu: ElementRef;
@ViewChild(CdkConnectedOverlay, { static: false }) overlay: CdkConnectedOverlay;
@ViewChildren(NzCascaderOptionComponent) cascaderItems: QueryList<NzCascaderOptionComponent>;

@Input() @InputBoolean() nzShowInput = true;
Expand Down
6 changes: 3 additions & 3 deletions components/cascader/nz-cascader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2059,8 +2059,8 @@ const options5: any[] = []; // tslint:disable-line:no-any
]
})
export class NzDemoCascaderDefaultComponent {
@ViewChild(NzCascaderComponent) cascader: NzCascaderComponent;
@ViewChild('renderTpl') renderTpl: TemplateRef<any>;
@ViewChild(NzCascaderComponent, { static: true }) cascader: NzCascaderComponent;
@ViewChild('renderTpl', { static: true }) renderTpl: TemplateRef<any>;

public nzOptions: any[] | null = options1;
public values: string[] | number[] | null = null;
Expand Down Expand Up @@ -2119,7 +2119,7 @@ export class NzDemoCascaderDefaultComponent {
]
})
export class NzDemoCascaderLoadDataComponent {
@ViewChild(NzCascaderComponent) cascader: NzCascaderComponent;
@ViewChild(NzCascaderComponent, { static: true }) cascader: NzCascaderComponent;

public nzOptions: any[] | null = null;
public values: string[] | null = null;
Expand Down
4 changes: 2 additions & 2 deletions components/checkbox/nz-checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class NzCheckboxComponent implements OnInit, ControlValueAccessor, OnChan
onChange: (value: any) => void = () => null;
// tslint:disable-next-line:no-any
onTouched: () => any = () => null;
@ViewChild('inputElement') private inputElement: ElementRef;
@ViewChild('contentElement') private contentElement: ElementRef;
@ViewChild('inputElement', { static: true }) private inputElement: ElementRef;
@ViewChild('contentElement', { static: false }) private contentElement: ElementRef;
@Output() readonly nzCheckedChange = new EventEmitter<boolean>();
@Input() nzValue: string;
@Input() @InputBoolean() nzAutoFocus = false;
Expand Down
2 changes: 1 addition & 1 deletion components/checkbox/nz-checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ describe('checkbox', () => {
`
})
export class NzTestCheckboxSingleComponent {
@ViewChild(NzCheckboxComponent) nzCheckboxComponent: NzCheckboxComponent;
@ViewChild(NzCheckboxComponent, { static: false }) nzCheckboxComponent: NzCheckboxComponent;
disabled = false;
autoFocus = false;
checked = false;
Expand Down
2 changes: 1 addition & 1 deletion components/collapse/nz-collapse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe('collapse', () => {
`
})
export class NzTestCollapseBasicComponent {
@ViewChild('headerTemplate') headerTemplate: TemplateRef<void>;
@ViewChild('headerTemplate', { static: false }) headerTemplate: TemplateRef<void>;
accordion = false;
bordered = true;
disabled = false;
Expand Down
10 changes: 7 additions & 3 deletions components/comment/nz-comment-cells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
ComponentFactoryResolver,
Expand Down Expand Up @@ -38,7 +39,7 @@ export class NzCommentContentDirective {}
selector: '[nzCommentActionHost]',
exportAs: 'nzCommentActionHost'
})
export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnInit, OnDestroy {
export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnInit, OnDestroy, AfterViewInit {
@Input() nzCommentActionHost: TemplatePortal | null;

constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef) {
Expand All @@ -47,12 +48,15 @@ export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnI

ngOnInit(): void {
super.ngOnInit();
this.attach(this.nzCommentActionHost);
}

ngOnDestroy(): void {
super.ngOnDestroy();
}

ngAfterViewInit(): void {
this.attach(this.nzCommentActionHost);
}
}

@Component({
Expand All @@ -63,7 +67,7 @@ export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnI
template: '<ng-template><ng-content></ng-content></ng-template>'
})
export class NzCommentActionComponent implements OnInit {
@ViewChild(TemplateRef) implicitContent: TemplateRef<void>;
@ViewChild(TemplateRef, { static: true }) implicitContent: TemplateRef<void>;
private contentPortal: TemplatePortal | null = null;

get content(): TemplatePortal | null {
Expand Down
2 changes: 1 addition & 1 deletion components/core/tree/nz-tree-base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export class NzTreeBaseService implements OnDestroy {
const { clientY } = event;
// to fix firefox undefined
const { top, bottom, height } = event.srcElement
? event.srcElement.getBoundingClientRect()
? (event.srcElement as Element).getBoundingClientRect()
: (event.target as Element).getBoundingClientRect();
const des = Math.max(height * this.DRAG_SIDE_RANGE, this.DRAG_MIN_GAP);

Expand Down
8 changes: 4 additions & 4 deletions components/core/wave/nz-wave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class WaveContainerWithButtonComponent {
isDestroyed = false;
borderColor = 'rgb(0,255,0)';
backgroundColor = 'rgb(255,255,255)';
@ViewChild('trigger') trigger: ElementRef<HTMLElement>;
@ViewChild(NzWaveDirective) wave: NzWaveDirective;
@ViewChild('trigger', { static: false }) trigger: ElementRef<HTMLElement>;
@ViewChild(NzWaveDirective, { static: false }) wave: NzWaveDirective;
}

@Component({
Expand All @@ -282,6 +282,6 @@ class WaveContainerWithExtraNodeComponent {
isDestroyed = false;
borderColor = 'rgb(0,255,0)';
backgroundColor = 'rgb(255,255,255)';
@ViewChild('trigger') trigger: ElementRef<HTMLElement>;
@ViewChild(NzWaveDirective) wave: NzWaveDirective;
@ViewChild('trigger', { static: false }) trigger: ElementRef<HTMLElement>;
@ViewChild(NzWaveDirective, { static: false }) wave: NzWaveDirective;
}
2 changes: 1 addition & 1 deletion components/date-picker/abstract-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export abstract class AbstractPickerComponent implements OnInit, OnChanges, OnDe

@Output() readonly nzOnOpenChange = new EventEmitter<boolean>();

@ViewChild(NzPickerComponent) protected picker: NzPickerComponent;
@ViewChild(NzPickerComponent, { static: true }) protected picker: NzPickerComponent;

isRange: boolean = false; // Indicate whether the value is a range value

Expand Down
Loading