UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

146 lines (140 loc) 6.12 kB
import { EventEmitter, Directive, ElementRef, ViewContainerRef, ComponentFactoryResolver, Renderer2, Host, Optional, Input, Output, Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, NgModule } from '@angular/core'; import { zoomBigMotion } from 'ng-zorro-antd/core/animation'; import { NzNoAnimationDirective, NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation'; import { Directionality, BidiModule } from '@angular/cdk/bidi'; import { NzTooltipBaseDirective, NzToolTipComponent, isTooltipEmpty, NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { NzOverlayModule } from 'ng-zorro-antd/core/overlay'; /** * 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 */ class NzPopoverDirective extends NzTooltipBaseDirective { constructor(elementRef, hostView, resolver, renderer, noAnimation) { super(elementRef, hostView, resolver, renderer, noAnimation); this.noAnimation = noAnimation; this.trigger = 'hover'; this.placement = 'top'; // tslint:disable-next-line:no-output-rename this.visibleChange = new EventEmitter(); this.componentFactory = this.resolver.resolveComponentFactory(NzPopoverComponent); } } NzPopoverDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-popover]', exportAs: 'nzPopover', host: { '[class.ant-popover-open]': 'visible' } },] } ]; NzPopoverDirective.ctorParameters = () => [ { type: ElementRef }, { type: ViewContainerRef }, { type: ComponentFactoryResolver }, { type: Renderer2 }, { type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] } ]; NzPopoverDirective.propDecorators = { title: [{ type: Input, args: ['nzPopoverTitle',] }], content: [{ type: Input, args: ['nzPopoverContent',] }], directiveTitle: [{ type: Input, args: ['nz-popover',] }], trigger: [{ type: Input, args: ['nzPopoverTrigger',] }], placement: [{ type: Input, args: ['nzPopoverPlacement',] }], origin: [{ type: Input, args: ['nzPopoverOrigin',] }], visible: [{ type: Input, args: ['nzPopoverVisible',] }], mouseEnterDelay: [{ type: Input, args: ['nzPopoverMouseEnterDelay',] }], mouseLeaveDelay: [{ type: Input, args: ['nzPopoverMouseLeaveDelay',] }], overlayClassName: [{ type: Input, args: ['nzPopoverOverlayClassName',] }], overlayStyle: [{ type: Input, args: ['nzPopoverOverlayStyle',] }], visibleChange: [{ type: Output, args: ['nzPopoverVisibleChange',] }] }; class NzPopoverComponent extends NzToolTipComponent { constructor(cdr, directionality, noAnimation) { super(cdr, directionality, noAnimation); this.noAnimation = noAnimation; this._prefix = 'ant-popover'; } isEmpty() { return isTooltipEmpty(this.nzTitle) && isTooltipEmpty(this.nzContent); } } NzPopoverComponent.decorators = [ { type: Component, args: [{ selector: 'nz-popover', exportAs: 'nzPopoverComponent', animations: [zoomBigMotion], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, template: ` <ng-template #overlay="cdkConnectedOverlay" cdkConnectedOverlay nzConnectedOverlay [cdkConnectedOverlayOrigin]="origin" [cdkConnectedOverlayPositions]="_positions" [cdkConnectedOverlayOpen]="_visible" [cdkConnectedOverlayPush]="true" (overlayOutsideClick)="onClickOutside($event)" (detach)="hide()" (positionChange)="onPositionChange($event)" > <div class="ant-popover" [class.ant-popover-rtl]="dir === 'rtl'" [ngClass]="_classMap" [ngStyle]="nzOverlayStyle" [@.disabled]="noAnimation?.nzNoAnimation" [nzNoAnimation]="noAnimation?.nzNoAnimation" [@zoomBigMotion]="'active'" > <div class="ant-popover-content"> <div class="ant-popover-arrow"></div> <div class="ant-popover-inner" role="tooltip"> <div> <div class="ant-popover-title" *ngIf="nzTitle"> <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container> </div> <div class="ant-popover-inner-content"> <ng-container *nzStringTemplateOutlet="nzContent">{{ nzContent }}</ng-container> </div> </div> </div> </div> </div> </ng-template> ` },] } ]; NzPopoverComponent.ctorParameters = () => [ { type: ChangeDetectorRef }, { type: Directionality, decorators: [{ type: Optional }] }, { type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] } ]; /** * 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 */ class NzPopoverModule { } NzPopoverModule.decorators = [ { type: NgModule, args: [{ exports: [NzPopoverDirective, NzPopoverComponent], entryComponents: [NzPopoverComponent], declarations: [NzPopoverDirective, NzPopoverComponent], imports: [BidiModule, CommonModule, OverlayModule, NzOutletModule, NzOverlayModule, NzNoAnimationModule, NzToolTipModule] },] } ]; /** * 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 */ /** * Generated bundle index. Do not edit. */ export { NzPopoverComponent, NzPopoverDirective, NzPopoverModule }; //# sourceMappingURL=ng-zorro-antd-popover.js.map