@duoduo-oba/ng-devui
Version:
DevUI components based on Angular
2 lines • 7.06 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("ng-devui/position"),require("rxjs"),require("ng-devui/utils"),require("ng-devui/portal"),require("ng-devui/overlay-container"),require("ng-devui/window-ref")):"function"==typeof define&&define.amd?define("ng-devui/tooltip",["exports","@angular/core","@angular/common","ng-devui/position","rxjs","ng-devui/utils","ng-devui/portal","ng-devui/overlay-container","ng-devui/window-ref"],e):e(((t=t||self)["ng-devui"]=t["ng-devui"]||{},t["ng-devui"].tooltip={}),t.ng.core,t.ng.common,t["ng-devui"].position,t.rxjs,t["ng-devui"].utils,t["ng-devui"].portal,t["ng-devui"]["overlay-container"],t["ng-devui"]["window-ref"])}(this,(function(t,e,o,i,n,r,s,p,l){"use strict";var a=function(){function t(t,e,o){this.positionService=t,this.tooltip=e,this.renderer2=o,this.position="bottom",this.showAnimate=!1,this.animateState=this.showAnimate?"void":"visible",this.display="block"}return Object.defineProperty(t.prototype,"class",{get:function(){return"devui-tooltip "+this.position},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this.animateState},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){var t=this;this.updatePosition(),this.scrollElement=this.positionService.getScrollParent(this.triggerElementRef.nativeElement),this._onScroll=n.fromEvent(this.scrollElement||window,"scroll").subscribe((function(){t.updatePosition()}))},t.prototype.ngOnDestroy=function(){this._onScroll&&this._onScroll.unsubscribe()},t.prototype.onShow=function(){this.animateState=this.position},t.prototype.onHide=function(){this.animateState="void"},t.prototype.onHidden=function(){},t.prototype.onAnimationEnd=function(t){"void"===t.toState&&this.onHidden()},t.prototype.updatePosition=function(){this.renderer2.setStyle(this.tooltip.nativeElement,"visibility","hidden"),this.renderer2.setStyle(this.tooltip.nativeElement,"transform","translate(0, -99999px)");var t=this.positionService.positionElements(this.triggerElementRef.nativeElement,this.tooltip.nativeElement,this.position,!0);this.renderer2.setStyle(this.tooltip.nativeElement,"left",t.left+"px"),this.renderer2.setStyle(this.tooltip.nativeElement,"top",t.top+"px"),this.renderer2.setStyle(this.tooltip.nativeElement,"visibility",null),this.renderer2.setStyle(this.tooltip.nativeElement,"transform",null)},t.decorators=[{type:e.Component,args:[{selector:"d-tooltip",template:'<div class="devui-tooltip-arrow"></div>\r\n<div class="devui-tooltip-inner" [innerHTML]="content"></div>\r\n',animations:[r.directionFadeInOut],styles:[":host-context(.devui-tooltip){position:absolute;z-index:1070;display:block;font-style:normal;font-weight:400;line-height:1.42857143;line-break:auto;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;font-size:12px;opacity:1}:host-context(.devui-tooltip).top{margin-top:-5px;padding:0;box-shadow:-5px 5px 20px 0 rgba(37,43,58,.2)}:host-context(.devui-tooltip).top .devui-tooltip-arrow{bottom:-5px;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#464d6e}:host-context(.devui-tooltip).bottom{margin-top:5px;padding:0;box-shadow:5px -5px 20px 0 rgba(37,43,58,.2)}:host-context(.devui-tooltip).bottom .devui-tooltip-arrow{top:-5px;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#464d6e}:host-context(.devui-tooltip).left{margin-left:-5px;padding:0;box-shadow:5px -5px 20px 0 rgba(37,43,58,.2)}:host-context(.devui-tooltip).left .devui-tooltip-arrow{top:50%;right:-5px;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#464d6e}:host-context(.devui-tooltip).right{margin-left:5px;padding:0;box-shadow:-5px 5px 20px 0 rgba(37,43,58,.2)}:host-context(.devui-tooltip).right .devui-tooltip-arrow{top:50%;left:-5px;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#464d6e}:host-context(.devui-tooltip) .devui-tooltip-inner{max-width:200px;padding:5px 10px;font-size:14px;color:#dfe1e6;letter-spacing:0;line-height:20px;background:#464d6e;box-shadow:none;overflow-wrap:break-word;text-align:start}:host-context(.devui-tooltip) .devui-tooltip-arrow{display:block;position:absolute;width:0;height:0;border-color:transparent;border-style:solid}"]}]}],t.ctorParameters=function(){return[{type:i.PositionService},{type:e.ElementRef},{type:e.Renderer2}]},t.propDecorators={content:[{type:e.Input}],position:[{type:e.Input}],triggerElementRef:[{type:e.Input}],showAnimate:[{type:e.Input}],display:[{type:e.HostBinding,args:["style.display"]}],class:[{type:e.HostBinding,args:["class"]}],state:[{type:e.HostBinding,args:["@directionFadeInOut"]}],onAnimationEnd:[{type:e.HostListener,args:["@directionFadeInOut.done",["$event"]]}]},t}();var d=function(){function t(t,e,o){this.triggerElementRef=t,this.overlayContainerRef=e,this.componentFactoryResolver=o,this.position="bottom"}return t.prototype.onMouseEnter=function(){this.show()},t.prototype.onMouseLeave=function(){this.hide()},t.prototype.onFocus=function(){this.show()},t.prototype.onBlur=function(){this.hide()},t.prototype.createTooltip=function(){this.tooltipComponentRef=this.overlayContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(a)),Object.assign(this.tooltipComponentRef.instance,{content:this.content,position:this.position,showAnimate:this.showAnimate,triggerElementRef:this.triggerElementRef})},t.prototype.show=function(){this.content&&(this.tooltipComponentRef&&this.destroy(),this.createTooltip(),this.showAnimate&&this.tooltipComponentRef.instance.onShow())},t.prototype.destroy=function(){this.tooltipComponentRef&&(this.tooltipComponentRef.destroy(),this.tooltipComponentRef=null)},t.prototype.hide=function(){var t=this;if(this.tooltipComponentRef){if(this.tooltipComponentRef.instance.onHide(),!this.showAnimate)return void this.destroy();this.tooltipComponentRef.instance.onHidden=function(){t.destroy()}}},t.prototype.ngOnDestroy=function(){this.destroy()},t.decorators=[{type:e.Directive,args:[{selector:"[dTooltip]",exportAs:"dTooltip"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:p.OverlayContainerRef},{type:e.ComponentFactoryResolver}]},t.propDecorators={content:[{type:e.Input}],position:[{type:e.Input}],showAnimate:[{type:e.Input}],onMouseEnter:[{type:e.HostListener,args:["mouseenter"]}],onMouseLeave:[{type:e.HostListener,args:["mouseleave"]}],onFocus:[{type:e.HostListener,args:["focus"]}],onBlur:[{type:e.HostListener,args:["blur"]}]},t}();var u=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[o.CommonModule,s.PortalModule,i.PositioningModule],exports:[a,d],declarations:[a,d],providers:[l.WindowRef,l.DocumentRef,p.OverlayContainerRef],entryComponents:[a]}]}],t}();t.TooltipComponent=a,t.TooltipDirective=d,t.TooltipModule=u,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-devui-tooltip.umd.min.js.map