Skip to content

Commit

Permalink
fix(module:tooltip): empty judgement (#3993)
Browse files Browse the repository at this point in the history
* fix: empty judgement

* fix: remove useless property

* fix(module:popover): fix propertyName

patch #3909
  • Loading branch information
Wendell authored Aug 13, 2019
1 parent 4d27fb6 commit a853e96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
7 changes: 5 additions & 2 deletions components/popover/nz-popover.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ import { NzTooltipBaseComponentLegacy, NzToolTipComponent } from 'ng-zorro-antd/
export class NzPopoverComponent extends NzToolTipComponent {
_prefix = 'ant-popover-placement';

@Input() @ContentChild('neverUsedTemplate', { static: true }) nzPopoverTitle: NzTSType;
@Input() @ContentChild('nzTemplate', { static: true }) nzPopoverContent: NzTSType;
/**
* Use `neverUsedTemplate` to force `nzTemplate` to be catched by `nzPopoverContent`.
*/
@Input() @ContentChild('neverUsedTemplate', { static: true }) nzTitle: NzTSType;
@Input() @ContentChild('nzTemplate', { static: true }) nzContent: NzTSType;

constructor(cdr: ChangeDetectorRef, @Host() @Optional() public noAnimation?: NzNoAnimationDirective) {
super(cdr, noAnimation);
Expand Down
14 changes: 1 addition & 13 deletions components/tooltip/base/nz-tooltip-base-legacy.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@
*/

import { CdkConnectedOverlay } from '@angular/cdk/overlay';
import {
ChangeDetectorRef,
ContentChild,
EventEmitter,
Host,
Input,
OnChanges,
Optional,
Output,
TemplateRef,
ViewChild
} from '@angular/core';
import { ChangeDetectorRef, EventEmitter, Host, Input, OnChanges, Optional, Output, ViewChild } from '@angular/core';
import { toBoolean, NgStyleInterface, NzNoAnimationDirective, POSITION_MAP } from 'ng-zorro-antd/core';

import { NzTooltipTrigger } from '../nz-tooltip.definitions';
Expand All @@ -42,7 +31,6 @@ import { NzTooltipBaseComponent } from './nz-tooltip-base.component';
export class NzTooltipBaseComponentLegacy extends NzTooltipBaseComponent implements OnChanges {
@ViewChild('overlay', { static: false }) overlay: CdkConnectedOverlay;

@Input() @ContentChild('nzTemplate', { static: true }) contentTitle: string | TemplateRef<void> | null;
@Input() nzOverlayClassName = '';
@Input() nzOverlayStyle: NgStyleInterface = {};
@Input() nzMouseEnterDelay = 0.15; // second
Expand Down
2 changes: 1 addition & 1 deletion components/tooltip/base/nz-tooltip-base.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ export abstract class NzTooltipBaseComponent {
}

private isContentEmpty(): boolean {
return this.nzTitle instanceof TemplateRef ? false : this.nzTitle === '' || !isNotNil(this.nzTitle);
return this.nzContent instanceof TemplateRef ? false : this.nzContent === '' || !isNotNil(this.nzContent);
}
}

0 comments on commit a853e96

Please sign in to comment.