UNPKG

ngx-bootstrap

Version:
2 lines 4.12 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ngx-bootstrap/utils"),require("ngx-bootstrap/component-loader"),require("@angular/common"),require("ngx-bootstrap/positioning")):"function"==typeof define&&define.amd?define("ngx-bootstrap/popover",["exports","@angular/core","ngx-bootstrap/utils","ngx-bootstrap/component-loader","@angular/common","ngx-bootstrap/positioning"],e):e((t["ngx-bootstrap"]=t["ngx-bootstrap"]||{},t["ngx-bootstrap"].popover={}),t.ng.core,t.utils,t.componentLoader,t.ng.common,t.positioning)}(this,function(t,e,o,n,r,i){"use strict";var p=function(){function t(){this.placement="top",this.triggers="click",this.outsideClick=!1}return t.decorators=[{type:e.Injectable}],t}(),s=function(){function t(t){Object.assign(this,t)}return Object.defineProperty(t.prototype,"isBs3",{get:function(){return o.isBs3()},enumerable:!0,configurable:!0}),t.decorators=[{type:e.Component,args:[{selector:"popover-container",changeDetection:e.ChangeDetectionStrategy.OnPush,host:{"[class]":'"popover in popover-" + placement + " " + "bs-popover-" + placement + " " + placement + " " + containerClass',"[class.show]":"!isBs3",role:"tooltip",style:"display:block;"},template:'<div class="popover-arrow arrow"></div>\n<h3 class="popover-title popover-header" *ngIf="title">{{ title }}</h3>\n<div class="popover-content popover-body">\n <ng-content></ng-content>\n</div>\n',styles:["\n :host.bs-popover-top .arrow, :host.bs-popover-bottom .arrow {\n left: 50%;\n transform: translateX(-50%);\n }\n :host.bs-popover-left .arrow, :host.bs-popover-right .arrow {\n top: 50%;\n transform: translateY(-50%);\n }\n "]}]}],t.ctorParameters=function(){return[{type:p}]},t.propDecorators={placement:[{type:e.Input}],title:[{type:e.Input}]},t}(),a=function(){function t(e,t,o,n,r){this.outsideClick=!1,this.containerClass="",this._isInited=!1,this._popover=r.createLoader(e,o,t).provide({provide:p,useValue:n}),Object.assign(this,n),this.onShown=this._popover.onShown,this.onHidden=this._popover.onHidden,"undefined"!=typeof window&&e.nativeElement.addEventListener("click",function(){try{e.nativeElement.focus()}catch(t){return}})}return Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._popover.isShown},set:function(t){t?this.show():this.hide()},enumerable:!0,configurable:!0}),t.prototype.show=function(){!this._popover.isShown&&this.popover&&(this._popover.attach(s).to(this.container).position({attachment:this.placement}).show({content:this.popover,context:this.popoverContext,placement:this.placement,title:this.popoverTitle,containerClass:this.containerClass}),this.isOpen=!0)},t.prototype.hide=function(){this.isOpen&&(this._popover.hide(),this.isOpen=!1)},t.prototype.toggle=function(){if(this.isOpen)return this.hide();this.show()},t.prototype.ngOnInit=function(){var t=this;this._isInited||(this._isInited=!0,this._popover.listen({triggers:this.triggers,outsideClick:this.outsideClick,show:function(){return t.show()}}))},t.prototype.ngOnDestroy=function(){this._popover.dispose()},t.decorators=[{type:e.Directive,args:[{selector:"[popover]",exportAs:"bs-popover"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:e.ViewContainerRef},{type:p},{type:n.ComponentLoaderFactory}]},t.propDecorators={popover:[{type:e.Input}],popoverContext:[{type:e.Input}],popoverTitle:[{type:e.Input}],placement:[{type:e.Input}],outsideClick:[{type:e.Input}],triggers:[{type:e.Input}],container:[{type:e.Input}],containerClass:[{type:e.Input}],isOpen:[{type:e.Input}],onShown:[{type:e.Output}],onHidden:[{type:e.Output}]},t}(),c=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[p,n.ComponentLoaderFactory,i.PositioningService]}},t.decorators=[{type:e.NgModule,args:[{imports:[r.CommonModule],declarations:[a,s],exports:[a],entryComponents:[s]}]}],t}();t.PopoverDirective=a,t.PopoverModule=c,t.PopoverConfig=p,t.PopoverContainerComponent=s,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ngx-bootstrap-popover.umd.min.js.map