UNPKG

ngx-bootstrap

Version:
2 lines 8.3 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("rxjs"),require("@angular/common"),require("ngx-bootstrap/positioning")):"function"==typeof define&&define.amd?define("ngx-bootstrap/tooltip",["exports","@angular/core","ngx-bootstrap/utils","ngx-bootstrap/component-loader","rxjs","@angular/common","ngx-bootstrap/positioning"],e):e((t["ngx-bootstrap"]=t["ngx-bootstrap"]||{},t["ngx-bootstrap"].tooltip={}),t.ng.core,t.utils,t.componentLoader,t.rxjs,t.ng.common,t.positioning)}(this,function(t,r,s,e,p,o,n){"use strict";var l=function(){function t(){this.placement="top",this.triggers="hover focus",this.delay=0}return t.decorators=[{type:r.Injectable}],t}(),c=function(){function t(t){Object.assign(this,t)}return Object.defineProperty(t.prototype,"isBs3",{get:function(){return s.isBs3()},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){this.classMap={"in":!1,fade:!1},this.classMap[this.placement]=!0,this.classMap["tooltip-"+this.placement]=!0,this.classMap["in"]=!0,this.animation&&(this.classMap.fade=!0),this.containerClass&&(this.classMap[this.containerClass]=!0)},t.decorators=[{type:r.Component,args:[{selector:"bs-tooltip-container",changeDetection:r.ChangeDetectionStrategy.OnPush,host:{"[class]":'"tooltip in tooltip-" + placement + " " + "bs-tooltip-" + placement + " " + placement + " " + containerClass',"[class.show]":"!isBs3","[attr.id]":"this.id",role:"tooltip"},template:'\n <div class="tooltip-arrow arrow"></div>\n <div class="tooltip-inner"><ng-content></ng-content></div>\n ',styles:["\n :host.tooltip {\n display: block;\n pointer-events: none;\n }\n :host.bs-tooltip-top .arrow, :host.bs-tooltip-bottom .arrow {\n left: 50%;\n transform: translateX(-50%);\n }\n :host.bs-tooltip-left .arrow, :host.bs-tooltip-right .arrow {\n top: 50%;\n transform: translateY(-50%);\n }\n "]}]}],t.ctorParameters=function(){return[{type:l}]},t}();var u=0,i=function(){function t(t,e,o,n,i){this._renderer=e,this._elementRef=o,this.tooltipId=u++,this.tooltipChange=new r.EventEmitter,this.containerClass="",this.tooltipAnimation=!0,this.tooltipFadeDuration=150,this.ariaDescribedby="tooltip-"+this.tooltipId,this.tooltipStateChanged=new r.EventEmitter,this._tooltip=n.createLoader(this._elementRef,t,this._renderer).provide({provide:l,useValue:i}),Object.assign(this,i),this.onShown=this._tooltip.onShown,this.onHidden=this._tooltip.onHidden}return Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._tooltip.isShown},set:function(t){t?this.show():this.hide()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"htmlContent",{set:function(t){s.warnOnce("tooltipHtml was deprecated, please use `tooltip` instead"),this.tooltip=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_placement",{set:function(t){s.warnOnce("tooltipPlacement was deprecated, please use `placement` instead"),this.placement=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_isOpen",{get:function(){return s.warnOnce("tooltipIsOpen was deprecated, please use `isOpen` instead"),this.isOpen},set:function(t){s.warnOnce("tooltipIsOpen was deprecated, please use `isOpen` instead"),this.isOpen=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_enable",{get:function(){return s.warnOnce("tooltipEnable was deprecated, please use `isDisabled` instead"),this.isDisabled},set:function(t){s.warnOnce("tooltipEnable was deprecated, please use `isDisabled` instead"),this.isDisabled=!t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_appendToBody",{get:function(){return s.warnOnce('tooltipAppendToBody was deprecated, please use `container="body"` instead'),"body"===this.container},set:function(t){s.warnOnce('tooltipAppendToBody was deprecated, please use `container="body"` instead'),this.container=t?"body":this.container},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_popupClass",{set:function(t){s.warnOnce("tooltipClass deprecated")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_tooltipContext",{set:function(t){s.warnOnce("tooltipContext deprecated")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_tooltipPopupDelay",{set:function(t){s.warnOnce("tooltipPopupDelay is deprecated, use `delay` instead"),this.delay=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_tooltipTrigger",{get:function(){return s.warnOnce("tooltipTrigger was deprecated, please use `triggers` instead"),this.triggers},set:function(t){s.warnOnce("tooltipTrigger was deprecated, please use `triggers` instead"),this.triggers=(t||"").toString()},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var e=this;this._tooltip.listen({triggers:this.triggers,show:function(){return e.show()}}),this.tooltipChange.subscribe(function(t){t||e._tooltip.hide()})},t.prototype.toggle=function(){if(this.isOpen)return this.hide();this.show()},t.prototype.show=function(){var t=this;if(!(this.isOpen||this.isDisabled||this._delayTimeoutId)&&this.tooltip){var e=function(){t._delayTimeoutId&&(t._delayTimeoutId=undefined),t._tooltip.attach(c).to(t.container).position({attachment:t.placement}).show({content:t.tooltip,placement:t.placement,containerClass:t.containerClass,id:t.ariaDescribedby})},o=function(){t._tooltipCancelShowFn&&t._tooltipCancelShowFn()};if(this.delay){var n=p.timer(this.delay).subscribe(function(){e(),o()});if(this.triggers){var i=s.parseTriggers(this.triggers);this._tooltipCancelShowFn=this._renderer.listen(this._elementRef.nativeElement,i[0].close,function(){n.unsubscribe(),o()})}}else e()}},t.prototype.hide=function(){var t=this;this._delayTimeoutId&&(clearTimeout(this._delayTimeoutId),this._delayTimeoutId=undefined),this._tooltip.isShown&&(this._tooltip.instance.classMap["in"]=!1,setTimeout(function(){t._tooltip.hide()},this.tooltipFadeDuration))},t.prototype.ngOnDestroy=function(){this._tooltip.dispose()},t.decorators=[{type:r.Directive,args:[{selector:"[tooltip], [tooltipHtml]",exportAs:"bs-tooltip"}]}],t.ctorParameters=function(){return[{type:r.ViewContainerRef},{type:r.Renderer2},{type:r.ElementRef},{type:e.ComponentLoaderFactory},{type:l}]},t.propDecorators={tooltip:[{type:r.Input}],tooltipChange:[{type:r.Output}],placement:[{type:r.Input}],triggers:[{type:r.Input}],container:[{type:r.Input}],containerClass:[{type:r.Input}],isOpen:[{type:r.Input}],isDisabled:[{type:r.Input}],delay:[{type:r.Input}],onShown:[{type:r.Output}],onHidden:[{type:r.Output}],htmlContent:[{type:r.Input,args:["tooltipHtml"]}],_placement:[{type:r.Input,args:["tooltipPlacement"]}],_isOpen:[{type:r.Input,args:["tooltipIsOpen"]}],_enable:[{type:r.Input,args:["tooltipEnable"]}],_appendToBody:[{type:r.Input,args:["tooltipAppendToBody"]}],tooltipAnimation:[{type:r.Input}],_popupClass:[{type:r.Input,args:["tooltipClass"]}],_tooltipContext:[{type:r.Input,args:["tooltipContext"]}],_tooltipPopupDelay:[{type:r.Input,args:["tooltipPopupDelay"]}],tooltipFadeDuration:[{type:r.Input}],_tooltipTrigger:[{type:r.Input,args:["tooltipTrigger"]}],ariaDescribedby:[{type:r.HostBinding,args:["attr.aria-describedby"]}],tooltipStateChanged:[{type:r.Output}]},function a(t,e,o,n){var i,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,n);else for(var p=t.length-1;0<=p;p--)(i=t[p])&&(s=(r<3?i(s):3<r?i(e,o,s):i(e,o))||s);return 3<r&&s&&Object.defineProperty(e,o,s),s}([s.OnChange(),function o(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",Object)],t.prototype,"tooltip",void 0),t}(),a=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[l,e.ComponentLoaderFactory,n.PositioningService]}},t.decorators=[{type:r.NgModule,args:[{imports:[o.CommonModule],declarations:[i,c],exports:[i],entryComponents:[c]}]}],t}();t.TooltipContainerComponent=c,t.TooltipDirective=i,t.TooltipModule=a,t.TooltipConfig=l,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ngx-bootstrap-tooltip.umd.min.js.map