Skip to content

Commit

Permalink
fix: init
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendell committed Apr 21, 2020
1 parent 8cf34ab commit b102a9a
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ChangeDetectionStrategy, Component, Input, TemplateRef, ViewEncapsulati
`
})
export class NzAutocompleteOptgroupComponent {
@Input() nzLabel: string | TemplateRef<void>;
@Input() nzLabel?: string | TemplateRef<void>;

constructor() {}
}
2 changes: 1 addition & 1 deletion components/auto-complete/autocomplete-option.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class NzAutocompleteOptionComponent {
static ngAcceptInputType_nzDisabled: BooleanInput;

@Input() nzValue: NzSafeAny;
@Input() nzLabel: string;
@Input() nzLabel?: string;
@Input() @InputBoolean() nzDisabled = false;
@Output() readonly selectionChange = new EventEmitter<NzOptionSelectionChange>();
@Output() readonly mouseEntered = new EventEmitter<NzAutocompleteOptionComponent>();
Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/autocomplete-trigger.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
}

if (!this.portal) {
this.portal = new TemplatePortal(this.nzAutocomplete.template, this.viewContainerRef);
this.portal = new TemplatePortal(this.nzAutocomplete.template!, this.viewContainerRef);
}

if (!this.overlayRef) {
Expand Down Expand Up @@ -341,7 +341,7 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
this.nzAutocomplete.clearSelectedOptions(null, true);
if (index !== -1) {
this.nzAutocomplete.setActiveItem(index);
this.nzAutocomplete.activeItem.select(false);
this.nzAutocomplete.activeItem!.select(false);
} else {
this.nzAutocomplete.setActiveItem(this.nzAutocomplete.nzDefaultActiveFirstOption ? 0 : -1);
}
Expand Down
26 changes: 13 additions & 13 deletions components/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ export class NzBadgeComponent implements OnInit, AfterViewInit, OnChanges, OnDes
countArray: number[] = [];
countSingleArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
presetColor: string | null = null;
count: number;
@ViewChild('contentElement', { static: false }) contentElement: ElementRef;
count: number = 0;
@ViewChild('contentElement', { static: false }) contentElement?: ElementRef;
@Input() @InputBoolean() nzShowZero: boolean = false;
@Input() @InputBoolean() nzShowDot = true;
@Input() @InputBoolean() nzDot = false;
@Input() @WithConfig(NZ_CONFIG_COMPONENT_NAME, 99) nzOverflowCount: number;
@Input() nzText: string;
@Input() @WithConfig(NZ_CONFIG_COMPONENT_NAME) nzColor: string;
@Input() nzTitle: string;
@Input() nzStyle: { [key: string]: string };
@Input() nzStatus: NzBadgeStatusType;
@Input() nzCount: number | TemplateRef<void>;
@Input() nzOffset: [number, number];
@Input() @WithConfig(NZ_CONFIG_COMPONENT_NAME) nzOverflowCount: number = 99;
@Input() nzText?: string;
@Input() @WithConfig(NZ_CONFIG_COMPONENT_NAME) nzColor?: string = undefined;
@Input() nzTitle?: string;
@Input() nzStyle?: { [key: string]: string };
@Input() nzStatus?: NzBadgeStatusType;
@Input() nzCount?: number | TemplateRef<void>;
@Input() nzOffset?: [number, number];

checkContent(): void {
this.notWrapper = isEmpty(this.contentElement.nativeElement);
this.notWrapper = isEmpty(this.contentElement?.nativeElement);
if (this.notWrapper) {
this.renderer.addClass(this.elementRef.nativeElement, 'ant-badge-not-a-wrapper');
} else {
Expand Down Expand Up @@ -151,7 +151,7 @@ export class NzBadgeComponent implements OnInit, AfterViewInit, OnChanges, OnDes
});

this.contentObserver
.observe(this.contentElement)
.observe(this.contentElement!)
.pipe(startWith(true), takeUntil(this.destroy$))
.subscribe(() => {
this.checkContent();
Expand All @@ -171,7 +171,7 @@ export class NzBadgeComponent implements OnInit, AfterViewInit, OnChanges, OnDes
this.generateMaxNumberArray();
}
if (nzColor) {
this.presetColor = badgePresetColors.indexOf(this.nzColor) !== -1 ? this.nzColor : null;
this.presetColor = this.nzColor && badgePresetColors.indexOf(this.nzColor) !== -1 ? this.nzColor : null;
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/core/wave/nz-wave-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { NgZone } from '@angular/core';

export class NzWaveRenderer {
private waveTransitionDuration = 400;
private styleForPseudo: HTMLStyleElement | null;
private extraNode: HTMLDivElement | null;
private styleForPseudo: HTMLStyleElement | null = null;
private extraNode: HTMLDivElement | null = null;
private lastTime = 0;
private platform = new Platform();
clickHandler: () => void;
Expand Down
4 changes: 2 additions & 2 deletions components/core/wave/nz-wave.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export function NZ_WAVE_GLOBAL_CONFIG_FACTORY(): NzWaveConfig {
export class NzWaveDirective implements OnInit, OnDestroy {
@Input() nzWaveExtraNode = false;

private waveRenderer: NzWaveRenderer;
private waveRenderer?: NzWaveRenderer;
private waveDisabled: boolean = false;

get disabled(): boolean {
return this.waveDisabled;
}

get rendererRef(): NzWaveRenderer {
get rendererRef(): NzWaveRenderer | undefined {
return this.waveRenderer;
}

Expand Down
2 changes: 1 addition & 1 deletion components/message/message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { NzMessageData, NzMessageDataOptions, NzMessageRef } from './typings';
providedIn: NzMessageServiceModule
})
export class NzMessageService extends NzMNService {
protected container: NzMessageContainerComponent;
protected container?: NzMessageContainerComponent;
protected componentPrefix = 'message-';

constructor(nzSingletonService: NzSingletonService, overlay: Overlay, injector: Injector) {
Expand Down
2 changes: 1 addition & 1 deletion components/select/select-top-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class NzSelectTopControlComponent implements OnChanges {
@Output() readonly animationEnd = new EventEmitter<void>();
@Output() readonly deleteItem = new EventEmitter<NzSelectItemInterface>();
@Output() readonly openChange = new EventEmitter<boolean>();
@ViewChild(NzSelectSearchComponent) nzSelectSearchComponent: NzSelectSearchComponent;
@ViewChild(NzSelectSearchComponent) nzSelectSearchComponent!: NzSelectSearchComponent;
listOfSlicedItem: NzSelectTopControlItemType[] = [];
isShowPlaceholder = true;
isShowSingleLabel = false;
Expand Down
8 changes: 4 additions & 4 deletions scripts/site/_site/doc/app/share/codebox/codebox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import { OnlineIdeService } from '../../online-ide/online-ide.service';
styleUrls: ['./codebox.component.less']
})
export class NzCodeBoxComponent implements OnInit, OnDestroy {
highlightCode: string;
highlightCode?: string;
copied = false;
commandCopied = false;
showIframe: boolean;
simulateIFrame: boolean;
iframe: SafeUrl;
showIframe: boolean = false;
simulateIFrame: boolean = false;
iframe?: SafeUrl;
language = 'zh';
theme = 'default';
destroy$ = new Subject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
`
})
export class NzHighlightComponent implements OnInit {
code: SafeHtml | string;
code: SafeHtml | string = '';
@ViewChild('code', { static: true }) codeElement!: ElementRef;
@Input() nzLanguage?: string;

Expand Down

0 comments on commit b102a9a

Please sign in to comment.