@syncfusion/ej2-svg-base
Advanced tools
Comparing version 16.4.48 to 16.4.52
@@ -9,2 +9,10 @@ # Changelog | ||
- Additional space in tooltip header text is fixed | ||
## 16.4.48 (2019-01-22) | ||
### SvgBase | ||
#### Bug Fixes | ||
- Tooltip text with colon within the bold tag issue fixed | ||
@@ -11,0 +19,0 @@ |
@@ -1,2 +0,11 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],e):e(t.ej={},t.ej2Base)}(this,function(t,e){"use strict";function i(t){var e;switch(t){case"Highcontrast":e={tooltipFill:"#ffffff",tooltipBoldLabel:"#000000",tooltipLightLabel:"#000000",tooltipHeaderLine:"#969696"};break;case"MaterialDark":case"FabricDark":case"BootstrapDark":e={tooltipFill:"#F4F4F4",tooltipBoldLabel:"#282727",tooltipLightLabel:"#333232",tooltipHeaderLine:"#9A9A9A"};break;default:e={tooltipFill:"rgba(0, 8, 22, 0.75)",tooltipBoldLabel:"#ffffff",tooltipLightLabel:"#dbdbdb",tooltipHeaderLine:"#ffffff"}}return e}function o(t,i){var o=document.getElementById("chartmeasuretext");return null===o&&(o=e.createElement("text",{id:"chartmeasuretext"}),document.body.appendChild(o)),o.innerHTML=t,o.style.position="absolute",o.style.fontSize=i.size,o.style.fontWeight=i.fontWeight,o.style.fontStyle=i.fontStyle,o.style.fontFamily=i.fontFamily,o.style.visibility="hidden",o.style.top="-100",o.style.left="0",o.style.whiteSpace="nowrap",o.style.lineHeight="normal",new h(o.clientWidth,o.clientHeight)}function r(t){return document.getElementById(t)}function n(t){var i=r(t);i&&e.remove(i)}function a(t,i,o,r,n,a){var s=new e.SvgRenderer(""),h=function(t,i,o,r,n){var a,s="Path",h=i.width,p=i.height,d=t.x,l=t.y,c=t.x+-h/2,y=t.y+-p/2;switch(o){case"Circle":case"Bubble":s="Ellipse",e.merge(r,{rx:h/2,ry:p/2,cx:d,cy:l});break;case"Cross":a="M "+c+" "+l+" L "+(d+h/2)+" "+l+" M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(r,{d:a});break;case"HorizontalLine":a="M "+c+" "+l+" L "+(d+h/2)+" "+l,e.merge(r,{d:a});break;case"VerticalLine":a="M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(r,{d:a});break;case"Diamond":a="M "+c+" "+l+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+l+" L "+d+" "+(l+p/2)+" L "+c+" "+l+" z",e.merge(r,{d:a});break;case"Rectangle":a="M "+c+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" L "+c+" "+(l+-p/2)+" z",e.merge(r,{d:a});break;case"Triangle":a="M "+c+" "+(l+p/2)+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" z",e.merge(r,{d:a});break;case"InvertedTriangle":a="M "+(d+h/2)+" "+(l-p/2)+" L "+d+" "+(l+p/2)+" L "+(d-h/2)+" "+(l-p/2)+" L "+(d+h/2)+" "+(l-p/2)+" z",e.merge(r,{d:a});break;case"Pentagon":for(var u=void 0,f=void 0,m=0;m<=5;m++)u=h/2*Math.cos(Math.PI/180*(72*m)),f=p/2*Math.sin(Math.PI/180*(72*m)),a=0===m?"M "+(d+u)+" "+(l+f)+" ":a.concat("L "+(d+u)+" "+(l+f)+" ");a=a.concat("Z"),e.merge(r,{d:a});break;case"Image":s="Image",e.merge(r,{href:n,height:p,width:h,x:c,y:y})}return{renderOption:r,functionName:s}}(t,o,i,n,r),p=s["draw"+h.functionName](h.renderOption);return p.setAttribute("aria-label",a),p}var s=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),h=function(){return function(t,e){this.width=t,this.height=e}}(),p=function(){return function(t,e,i,o){this.x=t,this.y=e,this.width=i,this.height=o}}(),d=function(){return function(t,e){this.isRight=e,this.isBottom=t}}(),l=function(){return function(t){this.id=t}}(),c=function(t){function e(e,i,o,r,n,a,s){void 0===a&&(a="");var h=t.call(this,e)||this;return h.transform="",h.baseLine="auto",h.x=i,h.y=o,h.anchor=r,h.text=n,h.transform=a,h.baseLine=s,h}return s(e,t),e}(l),y=function(t){function e(e,i,o,r,n,a,s){var h=t.call(this,e)||this;return h.opacity=n,h.fill=i,h.stroke=r,h["stroke-width"]=o,h["stroke-dasharray"]=a,h.d=s,h}return s(e,t),e}(l),u=function(){return function(t,e){this.x=t,this.y=e}}(),f=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),m=function(t,e,i,o){var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a},g=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(null)],i.prototype,"size",void 0),m([e.Property("")],i.prototype,"color",void 0),m([e.Property("Segoe UI")],i.prototype,"fontFamily",void 0),m([e.Property("Normal")],i.prototype,"fontWeight",void 0),m([e.Property("Normal")],i.prototype,"fontStyle",void 0),m([e.Property(1)],i.prototype,"opacity",void 0),i}(e.ChildProperty),v=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property("")],i.prototype,"color",void 0),m([e.Property(1)],i.prototype,"width",void 0),i}(e.ChildProperty),x=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(0)],i.prototype,"x",void 0),m([e.Property(0)],i.prototype,"y",void 0),m([e.Property(0)],i.prototype,"width",void 0),m([e.Property(0)],i.prototype,"height",void 0),i}(e.ChildProperty),w=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(0)],i.prototype,"x",void 0),m([e.Property(0)],i.prototype,"y",void 0),i}(e.ChildProperty),b=function(t){function s(e,i){return t.call(this,e,i)||this}return f(s,t),s.prototype.preRender=function(){this.initPrivateVariable(),this.removeSVG(),this.createTooltipElement()},s.prototype.initPrivateVariable=function(){this.renderer=new e.SvgRenderer(this.element.id),this.themeStyle=i(this.theme),this.formattedText=[],this.padding=5,this.isFirst=!0,this.markerPoint=[]},s.prototype.removeSVG=function(){var t=document.getElementById(this.element.id+"_svg"),i=document.getElementById(this.element.id+"parent_template");t&&t.parentNode&&e.remove(t),i&&i.parentNode&&e.remove(i)},s.prototype.render=function(){if(this.fadeOuted=!1,this.template)this.updateTemplateFn(),this.createTemplate(this.areaBounds,this.location);else{this.renderText(this.isFirst);var t={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",t);var i=this.renderTooltipElement(this.areaBounds,this.location);this.drawMarker(i.isBottom,i.isRight,this.markerSize)}this.trigger("loaded",{tooltip:this});var o=document.getElementById("chartmeasuretext");o&&e.remove(o)},s.prototype.createTooltipElement=function(){if(this.textElements=[],!this.template||this.shared){var t=this.renderer.createSvg({id:this.element.id+"_svg"});this.element.appendChild(t);var e=this.renderer.createGroup({id:this.element.id+"_group"});t.appendChild(e);var i=this.renderer.drawPath({id:this.element.id+"_path","stroke-width":this.border.width,fill:this.fill||this.themeStyle.tooltipFill,opacity:this.opacity,stroke:this.border.color});e.appendChild(i)}},s.prototype.drawMarker=function(t,e,i){if(this.shapes.length<=0)return null;for(var o,n=0,s=this.renderer.createGroup({id:this.element.id+"_trackball_group"}),p=r(this.element.id+"_group"),d=2*this.marginX+i/2+(e?this.arrowPadding:0),l=0,c=this.shapes;l<c.length;l++){var f=c[l];o=new y(this.element.id+"_Trackball_"+n,this.palette[n],1,"#cccccc",1,null),this.markerPoint[n]&&s.appendChild(a(new u(d,this.markerPoint[n]-this.padding+(t?this.arrowPadding:0)),f,new h(i,i),"",o,null)),n++}p.appendChild(s)},s.prototype.renderTooltipElement=function(t,i){var n,a=r(this.element.id),s=new u(0,0),h=new u(0,0),l=r(this.element.id+"_svg"),c=r(this.element.id+"_group"),y=r(this.element.id+"_path"),f=!1,m=!1,g=!1,v=0,x=0;if(this.tipRadius=1,""!==this.header&&(this.elementSize.height+=this.marginY),this.content.length>1?(n=this.sharedTooltipLocation(t,this.location.x,this.location.y),f=!0):(n=this.tooltipLocation(t,i,s,h),this.inverted?v=(m=n.x<i.x+this.clipBounds.x)?0:this.arrowPadding:(g=!(f=n.y<i.y+this.clipBounds.y),x=f?0:this.arrowPadding)),""!==this.header){var w=o(this.header,this.textStyle).height+2*this.marginY+(g?this.arrowPadding:0),b="M "+(3*this.marginX+(m||f||g?0:this.arrowPadding))+" "+w+"L "+(n.width+(m||f||g?0:this.arrowPadding)-2*this.marginX)+" "+w,P=this.renderer.drawPath({id:this.element.id+"_header_path","stroke-width":1,fill:null,opacity:.8,stroke:this.themeStyle.tooltipHeaderLine,d:b});c.appendChild(P)}var L=this.border.width/2,S=new p(L+v,L+x,n.width-L,n.height-L);if(c.setAttribute("opacity","1"),!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(a,n.x,n.y):this.animateTooltipDiv(a,n),l.setAttribute("height",(n.height+this.border.width+(this.inverted?0:this.arrowPadding)).toString()),l.setAttribute("width",(n.width+this.border.width+(this.inverted?this.arrowPadding:0)).toString()),l.setAttribute("opacity","1"),y.setAttribute("d",function(t,e,i,o,r,n,a,s,h,p,d){var l="",c=i.x,y=i.y,u=i.x+i.width,f=i.y+i.height;return d=d||0,n?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e))).concat(" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f),0!==r&&(l=(l=l.concat(" L "+(o.x+r/2)+" "+f)).concat(" L "+(h+d)+" "+(f+r-d)),l+=" Q "+h+" "+(f+r)+" "+(h-d)+" "+(f+r-d)),l=o.x-r/2>c?l.concat(" L "+(o.x-r/2)+" "+f+" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z"):0===r?l.concat(" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z"):l.concat(" L "+c+" "+(f+e)+" z")):a?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(o.x-r/2)+" "+y)).concat(" L "+(h-d)+" "+(o.y+d)),l=(l=(l+=" Q "+h+" "+o.y+" "+(h+d)+" "+(o.y+d)).concat(" L "+(o.x+r/2)+" "+y+" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e))).concat(" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f+" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z")):s?(l=(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y)).concat(" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e)+" L "+u+" "+(o.y-r/2))).concat(" L "+(u+r-d)+" "+(p-d)),l=(l=(l+=" Q "+(u+r)+" "+p+" "+(u+r-d)+" "+(p+d)).concat(" L "+u+" "+(o.y+r/2)+" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f)).concat(" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z")):(l=(l=l.concat("M "+(c+t)+" "+y+" Q "+c+" "+y+" "+c+" "+(y+e)+" L "+c+" "+(o.y-r/2))).concat(" L "+(c-r+d)+" "+(p-d)),l=(l=(l+=" Q "+(c-r)+" "+p+" "+(c-r+d)+" "+(p+d)).concat(" L "+c+" "+(o.y+r/2)+" L "+c+" "+(f-e)+" Q "+c+" "+f+" "+(c+t)+" "+f)).concat(" L "+(u-t)+" "+f+" Q "+u+" "+f+" "+u+" "+(f-e)+" L "+u+" "+(y+e)+" Q "+u+" "+y+" "+(u-t)+" "+y+" z")),l}(this.rx,this.ry,S,s,this.arrowPadding,f,g,m,h.x,h.y,this.tipRadius)),this.enableShadow){y.setAttribute("filter",e.Browser.isIE?"":"url(#chart_shadow_tooltip)");var _='<filter id="chart_shadow_tooltip" height="130%"><feGaussianBlur in="SourceAlpha" stdDeviation="3"/>';_+='<feOffset dx="3" dy="3" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="0.5"/>',_+='</feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';var T=this.renderer.createDefs();T.setAttribute("id","SVG_tooltip_definition"),c.appendChild(T),T.innerHTML=_}return y.setAttribute("stroke",this.border.color),this.changeText(new u(v,x),g,!m&&!f&&!g,n),new d(g,!m&&!f&&!g)},s.prototype.changeText=function(t,e,i,o){var r=document.getElementById(this.element.id+"_text");e&&r.setAttribute("transform","translate(0,"+this.arrowPadding+")"),i&&r.setAttribute("transform","translate("+this.arrowPadding+" 0)")},s.prototype.findFormattedText=function(){this.formattedText=[],""!==this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim()&&(this.formattedText=this.formattedText.concat(this.header)),this.formattedText=this.formattedText.concat(this.content)},s.prototype.renderText=function(t){var i,a,s,p,d=0,l=0,y=0,u=e.extend({},this.textStyle,null,!0).properties,f=r(this.element.id+"_group"),m="";this.findFormattedText();var g=this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim(),v=""!==g?this.marginY:0,x=!0,w=!0;this.markerPoint=[];var b=this.shapes.length>0?10:0,P=this.shapes.length>0?5:0,L="Normal",S=this.themeStyle.tooltipLightLabel,_=22/parseFloat("13px")*parseFloat(u.size);t||(n(this.element.id+"_text"),n(this.element.id+"_header_path"),n(this.element.id+"_trackball_group"),n("SVG_tooltip_definition"));for(var T=new c(this.element.id+"_text",2*this.marginX,2*this.marginY+2*this.padding+(2===this.marginY?3:0),"start",""),A=function(t,i,o,r){var n,a,s={},h=new e.SvgRenderer("");return s={id:t.id,x:t.x,y:t.y,fill:o,"font-size":i.size,"font-style":i.fontStyle,"font-family":i.fontFamily,"font-weight":i.fontWeight,"text-anchor":t.anchor,transform:t.transform,opacity:i.opacity,"dominant-baseline":t.baseLine},a="string"==typeof t.text?t.text:t.text[0],n=h.createText(s,a),r.appendChild(n),n}(T,u,null,f),C=0,k=this.formattedText.length;C<k;C++){var z=this.formattedText[C].replace(/<(b|strong)>/g,"<b>").replace(/<\/(b|strong)>/g,"</b>").split(/<br.*?>/g);if(""!==z[0]){o(this.formattedText[C],u),0===C&&""!==g||this.markerPoint.push((""!==g?this.marginY:0)+T.y+d);for(var M=0,F=z.length;M<F;M++){y=0,w=!0,d+=_;for(var B=0,R=(i=z[M].replace(/<b>/g,"<br><b>").replace(/<\/b>/g,"</b><br>").replace(/:/g,"<br>:<br>").split("<br>")).length;B<R;B++)s=i[B],/\S/.test(s)||""===s||(s=" "),(!w&&" "===s||""!==s.replace(/<b>/g,"").replace(/<\/b>/g,"").trim())&&(y+=4,w&&!x?(p={x:2*this.marginX+(b+P),dy:_+(w?v:0),fill:""},v=null):p=x&&w?{x:""===g?2*this.marginX+(b+P):2*this.marginX}:{},w=!1,a=this.renderer.createTSpan(p,""),A.appendChild(a),s.indexOf("<b>")>-1?(L="bold",S=this.themeStyle.tooltipBoldLabel,m="font-weight:"+L,u.fontWeight=L,a.setAttribute("fill",this.textStyle.color||S)):(m="bold"===L?"font-weight:"+L:"",u.fontWeight=L,a.setAttribute("fill",this.textStyle.color||S)),s.indexOf("</b>")>-1&&(L="Normal",S=this.themeStyle.tooltipLightLabel),a.textContent=s=s.replace(/<[a-zA-Z\/](.|\n)*?>/g,""),y+=o(s,u).width,""!==m&&a.setAttribute("style",m),x=!1);y-=4,l=Math.max(l,y)}}}this.elementSize=new h(l+(l>0?2*this.marginX:0),d),this.elementSize.width+=b+P;var O=A.childNodes[0];if(""!==g&&O){u.fontWeight="bold";var Q=(this.elementSize.width+2*this.padding)/2-o(g,u).width/2;O.setAttribute("x",Q.toString())}},s.prototype.createTemplate=function(t,i){var o={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",o);var n=document.getElementById(this.element.id),a=n.firstElementChild;if(a&&e.remove(a),o.cancel)e.remove(r(this.element.id+"_tooltip"));else{for(var s=this.templateFn(this.data),p=e.createElement("div",{id:this.element.id+"parent_template"});s&&s.length>0;)p.appendChild(s[0]);n.appendChild(p);var d=this.element.getBoundingClientRect();this.padding=0,this.elementSize=new h(d.width,d.height);var l=this.tooltipLocation(t,i,new u(0,0),new u(0,0));!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(this.element,l.x,l.y):this.animateTooltipDiv(this.element,l)}},s.prototype.sharedTooltipLocation=function(t,e,i){var o=this.elementSize.width+2*this.marginX,r=this.elementSize.height+2*this.marginY,n=new p(e+2*this.padding,i-r-this.padding,o,r);return n.y<t.y&&(n.y+=n.height+2*this.padding),n.x+n.width>t.x+t.width&&(n.x-=n.width+4*this.padding),n},s.prototype.tooltipLocation=function(t,e,i,o){var r=new u(e.x,e.y),n=this.elementSize.width+2*this.marginX,a=this.elementSize.height+2*this.marginY,s=this.offset,h=this.clipBounds.x,d=this.clipBounds.y,l=t.x,c=t.y;return this.inverted?(r=new u(r.x+h+s,r.y+d-this.elementSize.height/2-this.padding),i.y=o.y=a/2,(r.x+n+this.arrowPadding>l+t.width||this.isNegative)&&(r.x=(e.x>t.width?t.width:e.x)+h-s-(n+this.arrowPadding)),r.x<l&&(r.x=(e.x<0?0:e.x)+h+s),r.y<=c&&(i.y-=c-r.y,o.y-=c-r.y,r.y=c),r.y+a>=c+t.height&&(i.y+=r.y+a-(c+t.height),o.y+=r.y+a-(c+t.height),r.y-=r.y+a-(c+t.height)),i.y+this.arrowPadding/2>a-this.ry&&(i.y=a-this.ry-this.arrowPadding/2,o.y=a,this.tipRadius=0),i.y-this.arrowPadding/2<this.ry&&(i.y=this.ry+this.arrowPadding/2,o.y=0,this.tipRadius=0)):(r=new u(r.x+h-this.elementSize.width/2-this.padding,r.y+d-this.elementSize.height-2*this.padding-this.arrowPadding-s),i.x=o.x=n/2,(r.y<c||this.isNegative)&&(r.y=(e.y<0?0:e.y)+d+s),r.y+a+this.arrowPadding>c+t.height&&(r.y=(e.y>t.height?t.height:e.y)+d-this.elementSize.height-2*this.padding-this.arrowPadding-s),o.x=n/2,r.x<l&&(i.x-=l-r.x,o.x-=l-r.x,r.x=l),r.x+n>l+t.width&&(i.x+=r.x+n-(l+t.width),o.x+=r.x+n-(l+t.width),r.x-=r.x+n-(l+t.width)),i.x+this.arrowPadding/2>n-this.rx&&(i.x=n-this.rx-this.arrowPadding/2,o.x=n,this.tipRadius=0),i.x-this.arrowPadding/2<this.rx&&(i.x=this.rx+this.arrowPadding/2,o.x=0,this.tipRadius=0)),new p(r.x,r.y,n,a)},s.prototype.animateTooltipDiv=function(t,i){var o,r=this,n=parseFloat(t.style.left),a=parseFloat(t.style.top);new e.Animation({}).animate(t,{duration:300,progress:function(e){o=e.timeStamp/e.duration,t.style.animation=null,t.style.left=n+o*(i.x-n)+"px",t.style.top=a+o*(i.y-a)+"px"},end:function(e){r.updateDiv(t,i.x,i.y),r.trigger("animationComplete",{tooltip:r})}})},s.prototype.updateDiv=function(t,e,i){t.style.left=e+"px",t.style.top=i+"px"},s.prototype.updateTemplateFn=function(){if(this.template)try{document.querySelectorAll(this.template).length&&(this.templateFn=e.compile(document.querySelector(this.template).innerHTML.trim()))}catch(t){this.templateFn=e.compile(this.template)}},s.prototype.fadeOut=function(){var t=this,i=r(this.element.id);if(i){var o=i.firstChild,n=parseFloat(o.getAttribute("opacity"))||1;new e.Animation({}).animate(o,{duration:200,progress:function(e){t.progressAnimation(o,n,e.timeStamp/e.duration)},end:function(e){t.fadeOuted=!0,t.endAnimation(o)}})}},s.prototype.progressAnimation=function(t,e,i){t.style.animation="",t.setAttribute("opacity",(e-i).toString())},s.prototype.endAnimation=function(t){t.setAttribute("opacity","0"),this.template&&!this.shared&&(t.style.display="none"),this.trigger("animationComplete",{tooltip:this})},s.prototype.getPersistData=function(){return this.addOnPersist([])},s.prototype.getModuleName=function(){return"tooltip"},s.prototype.destroy=function(){t.prototype.destroy.call(this),this.element.classList.remove("e-tooltip")},s.prototype.onPropertyChanged=function(t,e){this.isFirst=!1,this.render()},m([e.Property(!1)],s.prototype,"enable",void 0),m([e.Property(!1)],s.prototype,"shared",void 0),m([e.Property(!0)],s.prototype,"enableShadow",void 0),m([e.Property(null)],s.prototype,"fill",void 0),m([e.Property("")],s.prototype,"header",void 0),m([e.Property(.75)],s.prototype,"opacity",void 0),m([e.Complex({size:"13px",fontWeight:"Normal",color:null,fontStyle:"Normal",fontFamily:"Segoe UI"},g)],s.prototype,"textStyle",void 0),m([e.Property(null)],s.prototype,"template",void 0),m([e.Property(!0)],s.prototype,"enableAnimation",void 0),m([e.Property(!1)],s.prototype,"inverted",void 0),m([e.Property(!1)],s.prototype,"isNegative",void 0),m([e.Complex({color:"#cccccc",width:.5},v)],s.prototype,"border",void 0),m([e.Property([])],s.prototype,"content",void 0),m([e.Property(10)],s.prototype,"markerSize",void 0),m([e.Complex({x:0,y:0},w)],s.prototype,"clipBounds",void 0),m([e.Property([])],s.prototype,"palette",void 0),m([e.Property([])],s.prototype,"shapes",void 0),m([e.Complex({x:0,y:0},w)],s.prototype,"location",void 0),m([e.Property(0)],s.prototype,"offset",void 0),m([e.Property(2)],s.prototype,"rx",void 0),m([e.Property(2)],s.prototype,"ry",void 0),m([e.Property(5)],s.prototype,"marginX",void 0),m([e.Property(5)],s.prototype,"marginY",void 0),m([e.Property(12)],s.prototype,"arrowPadding",void 0),m([e.Property(null)],s.prototype,"data",void 0),m([e.Property("Material")],s.prototype,"theme",void 0),m([e.Complex({x:0,y:0,width:0,height:0},x)],s.prototype,"areaBounds",void 0),m([e.Event()],s.prototype,"tooltipRender",void 0),m([e.Event()],s.prototype,"loaded",void 0),m([e.Event()],s.prototype,"animationComplete",void 0),s=m([e.NotifyPropertyChanges],s)}(e.Component);t.TextStyle=g,t.TooltipBorder=v,t.AreaBounds=x,t.ToolLocation=w,t.Tooltip=b,t.getTooltipThemeColor=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
/*! | ||
* filename: ej2-svg-base.umd.min.js | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
* Use of this code is subject to the terms of our license. | ||
* A copy of the current license can be obtained at any time by e-mailing | ||
* licensing@syncfusion.com. Any infringement will be prosecuted under | ||
* applicable laws. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],e):e(t.ej={},t.ej2Base)}(this,function(t,e){"use strict";function i(t){var e;switch(t){case"Highcontrast":e={tooltipFill:"#ffffff",tooltipBoldLabel:"#000000",tooltipLightLabel:"#000000",tooltipHeaderLine:"#969696"};break;case"MaterialDark":case"FabricDark":case"BootstrapDark":e={tooltipFill:"#F4F4F4",tooltipBoldLabel:"#282727",tooltipLightLabel:"#333232",tooltipHeaderLine:"#9A9A9A"};break;default:e={tooltipFill:"rgba(0, 8, 22, 0.75)",tooltipBoldLabel:"#ffffff",tooltipLightLabel:"#dbdbdb",tooltipHeaderLine:"#ffffff"}}return e}function o(t,i){var o=document.getElementById("chartmeasuretext");return null===o&&(o=e.createElement("text",{id:"chartmeasuretext"}),document.body.appendChild(o)),o.innerHTML=t,o.style.position="absolute",o.style.fontSize=i.size,o.style.fontWeight=i.fontWeight,o.style.fontStyle=i.fontStyle,o.style.fontFamily=i.fontFamily,o.style.visibility="hidden",o.style.top="-100",o.style.left="0",o.style.whiteSpace="nowrap",o.style.lineHeight="normal",new h(o.clientWidth,o.clientHeight)}function r(t){return document.getElementById(t)}function n(t){var i=r(t);i&&e.remove(i)}function a(t,i,o,r,n,a){var s=new e.SvgRenderer(""),h=function(t,i,o,r,n){var a,s="Path",h=i.width,p=i.height,d=t.x,l=t.y,c=t.x+-h/2,y=t.y+-p/2;switch(o){case"Circle":case"Bubble":s="Ellipse",e.merge(r,{rx:h/2,ry:p/2,cx:d,cy:l});break;case"Cross":a="M "+c+" "+l+" L "+(d+h/2)+" "+l+" M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(r,{d:a});break;case"HorizontalLine":a="M "+c+" "+l+" L "+(d+h/2)+" "+l,e.merge(r,{d:a});break;case"VerticalLine":a="M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(r,{d:a});break;case"Diamond":a="M "+c+" "+l+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+l+" L "+d+" "+(l+p/2)+" L "+c+" "+l+" z",e.merge(r,{d:a});break;case"Rectangle":a="M "+c+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" L "+c+" "+(l+-p/2)+" z",e.merge(r,{d:a});break;case"Triangle":a="M "+c+" "+(l+p/2)+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" z",e.merge(r,{d:a});break;case"InvertedTriangle":a="M "+(d+h/2)+" "+(l-p/2)+" L "+d+" "+(l+p/2)+" L "+(d-h/2)+" "+(l-p/2)+" L "+(d+h/2)+" "+(l-p/2)+" z",e.merge(r,{d:a});break;case"Pentagon":for(var u=void 0,f=void 0,m=0;m<=5;m++)u=h/2*Math.cos(Math.PI/180*(72*m)),f=p/2*Math.sin(Math.PI/180*(72*m)),a=0===m?"M "+(d+u)+" "+(l+f)+" ":a.concat("L "+(d+u)+" "+(l+f)+" ");a=a.concat("Z"),e.merge(r,{d:a});break;case"Image":s="Image",e.merge(r,{href:n,height:p,width:h,x:c,y:y})}return{renderOption:r,functionName:s}}(t,o,i,n,r),p=s["draw"+h.functionName](h.renderOption);return p.setAttribute("aria-label",a),p}var s=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),h=function(){return function(t,e){this.width=t,this.height=e}}(),p=function(){return function(t,e,i,o){this.x=t,this.y=e,this.width=i,this.height=o}}(),d=function(){return function(t,e){this.isRight=e,this.isBottom=t}}(),l=function(){return function(t){this.id=t}}(),c=function(t){function e(e,i,o,r,n,a,s){void 0===a&&(a="");var h=t.call(this,e)||this;return h.transform="",h.baseLine="auto",h.x=i,h.y=o,h.anchor=r,h.text=n,h.transform=a,h.baseLine=s,h}return s(e,t),e}(l),y=function(t){function e(e,i,o,r,n,a,s){var h=t.call(this,e)||this;return h.opacity=n,h.fill=i,h.stroke=r,h["stroke-width"]=o,h["stroke-dasharray"]=a,h.d=s,h}return s(e,t),e}(l),u=function(){return function(t,e){this.x=t,this.y=e}}(),f=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),m=function(t,e,i,o){var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a},g=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(null)],i.prototype,"size",void 0),m([e.Property("")],i.prototype,"color",void 0),m([e.Property("Segoe UI")],i.prototype,"fontFamily",void 0),m([e.Property("Normal")],i.prototype,"fontWeight",void 0),m([e.Property("Normal")],i.prototype,"fontStyle",void 0),m([e.Property(1)],i.prototype,"opacity",void 0),i}(e.ChildProperty),v=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property("")],i.prototype,"color",void 0),m([e.Property(1)],i.prototype,"width",void 0),i}(e.ChildProperty),x=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(0)],i.prototype,"x",void 0),m([e.Property(0)],i.prototype,"y",void 0),m([e.Property(0)],i.prototype,"width",void 0),m([e.Property(0)],i.prototype,"height",void 0),i}(e.ChildProperty),w=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return f(i,t),m([e.Property(0)],i.prototype,"x",void 0),m([e.Property(0)],i.prototype,"y",void 0),i}(e.ChildProperty),b=function(t){function s(e,i){return t.call(this,e,i)||this}return f(s,t),s.prototype.preRender=function(){this.initPrivateVariable(),this.removeSVG(),this.createTooltipElement()},s.prototype.initPrivateVariable=function(){this.renderer=new e.SvgRenderer(this.element.id),this.themeStyle=i(this.theme),this.formattedText=[],this.padding=5,this.isFirst=!0,this.markerPoint=[]},s.prototype.removeSVG=function(){var t=document.getElementById(this.element.id+"_svg"),i=document.getElementById(this.element.id+"parent_template");t&&t.parentNode&&e.remove(t),i&&i.parentNode&&e.remove(i)},s.prototype.render=function(){if(this.fadeOuted=!1,this.template)this.updateTemplateFn(),this.createTemplate(this.areaBounds,this.location);else{this.renderText(this.isFirst);var t={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",t);var i=this.renderTooltipElement(this.areaBounds,this.location);this.drawMarker(i.isBottom,i.isRight,this.markerSize)}this.trigger("loaded",{tooltip:this});var o=document.getElementById("chartmeasuretext");o&&e.remove(o)},s.prototype.createTooltipElement=function(){if(this.textElements=[],!this.template||this.shared){var t=this.renderer.createSvg({id:this.element.id+"_svg"});this.element.appendChild(t);var e=this.renderer.createGroup({id:this.element.id+"_group"});t.appendChild(e);var i=this.renderer.drawPath({id:this.element.id+"_path","stroke-width":this.border.width,fill:this.fill||this.themeStyle.tooltipFill,opacity:this.opacity,stroke:this.border.color});e.appendChild(i)}},s.prototype.drawMarker=function(t,e,i){if(this.shapes.length<=0)return null;for(var o,n=0,s=this.renderer.createGroup({id:this.element.id+"_trackball_group"}),p=r(this.element.id+"_group"),d=2*this.marginX+i/2+(e?this.arrowPadding:0),l=0,c=this.shapes;l<c.length;l++){var f=c[l];o=new y(this.element.id+"_Trackball_"+n,this.palette[n],1,"#cccccc",1,null),this.markerPoint[n]&&s.appendChild(a(new u(d,this.markerPoint[n]-this.padding+(t?this.arrowPadding:0)),f,new h(i,i),"",o,null)),n++}p.appendChild(s)},s.prototype.renderTooltipElement=function(t,i){var n,a=r(this.element.id),s=new u(0,0),h=new u(0,0),l=r(this.element.id+"_svg"),c=r(this.element.id+"_group"),y=r(this.element.id+"_path"),f=!1,m=!1,g=!1,v=0,x=0;if(this.tipRadius=1,""!==this.header&&(this.elementSize.height+=this.marginY),this.content.length>1?(n=this.sharedTooltipLocation(t,this.location.x,this.location.y),f=!0):(n=this.tooltipLocation(t,i,s,h),this.inverted?v=(m=n.x<i.x+this.clipBounds.x)?0:this.arrowPadding:(g=!(f=n.y<i.y+this.clipBounds.y),x=f?0:this.arrowPadding)),""!==this.header){var w=o(this.header,this.textStyle).height+2*this.marginY+(g?this.arrowPadding:0),b="M "+(3*this.marginX+(m||f||g?0:this.arrowPadding))+" "+w+"L "+(n.width+(m||f||g?0:this.arrowPadding)-2*this.marginX)+" "+w,P=this.renderer.drawPath({id:this.element.id+"_header_path","stroke-width":1,fill:null,opacity:.8,stroke:this.themeStyle.tooltipHeaderLine,d:b});c.appendChild(P)}var L=this.border.width/2,S=new p(L+v,L+x,n.width-L,n.height-L);if(c.setAttribute("opacity","1"),!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(a,n.x,n.y):this.animateTooltipDiv(a,n),l.setAttribute("height",(n.height+this.border.width+(this.inverted?0:this.arrowPadding)).toString()),l.setAttribute("width",(n.width+this.border.width+(this.inverted?this.arrowPadding:0)).toString()),l.setAttribute("opacity","1"),y.setAttribute("d",function(t,e,i,o,r,n,a,s,h,p,d){var l="",c=i.x,y=i.y,u=i.x+i.width,f=i.y+i.height;return d=d||0,n?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e))).concat(" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f),0!==r&&(l=(l=l.concat(" L "+(o.x+r/2)+" "+f)).concat(" L "+(h+d)+" "+(f+r-d)),l+=" Q "+h+" "+(f+r)+" "+(h-d)+" "+(f+r-d)),l=o.x-r/2>c?l.concat(" L "+(o.x-r/2)+" "+f+" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z"):0===r?l.concat(" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z"):l.concat(" L "+c+" "+(f+e)+" z")):a?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(o.x-r/2)+" "+y)).concat(" L "+(h-d)+" "+(o.y+d)),l=(l=(l+=" Q "+h+" "+o.y+" "+(h+d)+" "+(o.y+d)).concat(" L "+(o.x+r/2)+" "+y+" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e))).concat(" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f+" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z")):s?(l=(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y)).concat(" L "+(u-t)+" "+y+" Q "+u+" "+y+" "+u+" "+(y+e)+" L "+u+" "+(o.y-r/2))).concat(" L "+(u+r-d)+" "+(p-d)),l=(l=(l+=" Q "+(u+r)+" "+p+" "+(u+r-d)+" "+(p+d)).concat(" L "+u+" "+(o.y+r/2)+" L "+u+" "+(f-e)+" Q "+u+" "+f+" "+(u-t)+" "+f)).concat(" L "+(c+t)+" "+f+" Q "+c+" "+f+" "+c+" "+(f-e)+" z")):(l=(l=l.concat("M "+(c+t)+" "+y+" Q "+c+" "+y+" "+c+" "+(y+e)+" L "+c+" "+(o.y-r/2))).concat(" L "+(c-r+d)+" "+(p-d)),l=(l=(l+=" Q "+(c-r)+" "+p+" "+(c-r+d)+" "+(p+d)).concat(" L "+c+" "+(o.y+r/2)+" L "+c+" "+(f-e)+" Q "+c+" "+f+" "+(c+t)+" "+f)).concat(" L "+(u-t)+" "+f+" Q "+u+" "+f+" "+u+" "+(f-e)+" L "+u+" "+(y+e)+" Q "+u+" "+y+" "+(u-t)+" "+y+" z")),l}(this.rx,this.ry,S,s,this.arrowPadding,f,g,m,h.x,h.y,this.tipRadius)),this.enableShadow){y.setAttribute("filter",e.Browser.isIE?"":"url(#chart_shadow_tooltip)");var _='<filter id="chart_shadow_tooltip" height="130%"><feGaussianBlur in="SourceAlpha" stdDeviation="3"/>';_+='<feOffset dx="3" dy="3" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="0.5"/>',_+='</feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';var T=this.renderer.createDefs();T.setAttribute("id","SVG_tooltip_definition"),c.appendChild(T),T.innerHTML=_}return y.setAttribute("stroke",this.border.color),this.changeText(new u(v,x),g,!m&&!f&&!g,n),new d(g,!m&&!f&&!g)},s.prototype.changeText=function(t,e,i,o){var r=document.getElementById(this.element.id+"_text");e&&r.setAttribute("transform","translate(0,"+this.arrowPadding+")"),i&&r.setAttribute("transform","translate("+this.arrowPadding+" 0)")},s.prototype.findFormattedText=function(){this.formattedText=[],""!==this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim()&&(this.formattedText=this.formattedText.concat(this.header)),this.formattedText=this.formattedText.concat(this.content)},s.prototype.renderText=function(t){var i,a,s,p,d=0,l=0,y=0,u=e.extend({},this.textStyle,null,!0).properties,f=r(this.element.id+"_group"),m="";this.findFormattedText();var g=this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim(),v=""!==g?this.marginY:0,x=!0,w=!0;this.markerPoint=[];var b=this.shapes.length>0?10:0,P=this.shapes.length>0?5:0,L="Normal",S=this.themeStyle.tooltipLightLabel,_=22/parseFloat("13px")*parseFloat(u.size);t||(n(this.element.id+"_text"),n(this.element.id+"_header_path"),n(this.element.id+"_trackball_group"),n("SVG_tooltip_definition"));for(var T=new c(this.element.id+"_text",2*this.marginX,2*this.marginY+2*this.padding+(2===this.marginY?3:0),"start",""),A=function(t,i,o,r){var n,a,s={},h=new e.SvgRenderer("");return s={id:t.id,x:t.x,y:t.y,fill:o,"font-size":i.size,"font-style":i.fontStyle,"font-family":i.fontFamily,"font-weight":i.fontWeight,"text-anchor":t.anchor,transform:t.transform,opacity:i.opacity,"dominant-baseline":t.baseLine},a="string"==typeof t.text?t.text:t.text[0],n=h.createText(s,a),r.appendChild(n),n}(T,u,null,f),C=0,k=this.formattedText.length;C<k;C++){var z=this.formattedText[C].replace(/<(b|strong)>/g,"<b>").replace(/<\/(b|strong)>/g,"</b>").split(/<br.*?>/g);if(""!==z[0]){o(this.formattedText[C],u),0===C&&""!==g||this.markerPoint.push((""!==g?this.marginY:0)+T.y+d);for(var M=0,F=z.length;M<F;M++){y=0,w=!0,d+=_;for(var B=0,R=(i=z[M].replace(/<b>/g,"<br><b>").replace(/<\/b>/g,"</b><br>").replace(/:/g,"<br>:<br>").split("<br>")).length;B<R;B++)s=i[B],/\S/.test(s)||""===s||(s=" "),(!w&&" "===s||""!==s.replace(/<b>/g,"").replace(/<\/b>/g,"").trim())&&(y+=" "!==s?4:0,w&&!x?(p={x:2*this.marginX+(b+P),dy:_+(w?v:0),fill:""},v=null):p=x&&w?{x:""===g?2*this.marginX+(b+P):2*this.marginX}:{},w=!1,a=this.renderer.createTSpan(p,""),A.appendChild(a),s.indexOf("<b>")>-1?(L="bold",S=this.themeStyle.tooltipBoldLabel,m="font-weight:"+L,u.fontWeight=L,a.setAttribute("fill",this.textStyle.color||S)):(m="bold"===L?"font-weight:"+L:"",u.fontWeight=L,a.setAttribute("fill",this.textStyle.color||S)),s.indexOf("</b>")>-1&&(L="Normal",S=this.themeStyle.tooltipLightLabel),a.textContent=s=s.replace(/<[a-zA-Z\/](.|\n)*?>/g,""),y+=o(s,u).width,""!==m&&a.setAttribute("style",m),x=!1);y-=4,l=Math.max(l,y)}}}this.elementSize=new h(l+(l>0?2*this.marginX:0),d),this.elementSize.width+=b+P;var O=A.childNodes[0];if(""!==g&&O){u.fontWeight="bold";var Q=(this.elementSize.width+2*this.padding)/2-o(g,u).width/2;O.setAttribute("x",Q.toString())}},s.prototype.createTemplate=function(t,i){var o={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",o);var n=document.getElementById(this.element.id),a=n.firstElementChild;if(a&&e.remove(a),o.cancel)e.remove(r(this.element.id+"_tooltip"));else{for(var s=this.templateFn(this.data),p=e.createElement("div",{id:this.element.id+"parent_template"});s&&s.length>0;)p.appendChild(s[0]);n.appendChild(p);var d=this.element.getBoundingClientRect();this.padding=0,this.elementSize=new h(d.width,d.height);var l=this.tooltipLocation(t,i,new u(0,0),new u(0,0));!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(this.element,l.x,l.y):this.animateTooltipDiv(this.element,l)}},s.prototype.sharedTooltipLocation=function(t,e,i){var o=this.elementSize.width+2*this.marginX,r=this.elementSize.height+2*this.marginY,n=new p(e+2*this.padding,i-r-this.padding,o,r);return n.y<t.y&&(n.y+=n.height+2*this.padding),n.x+n.width>t.x+t.width&&(n.x-=n.width+4*this.padding),n},s.prototype.tooltipLocation=function(t,e,i,o){var r=new u(e.x,e.y),n=this.elementSize.width+2*this.marginX,a=this.elementSize.height+2*this.marginY,s=this.offset,h=this.clipBounds.x,d=this.clipBounds.y,l=t.x,c=t.y;return this.inverted?(r=new u(r.x+h+s,r.y+d-this.elementSize.height/2-this.padding),i.y=o.y=a/2,(r.x+n+this.arrowPadding>l+t.width||this.isNegative)&&(r.x=(e.x>t.width?t.width:e.x)+h-s-(n+this.arrowPadding)),r.x<l&&(r.x=(e.x<0?0:e.x)+h+s),r.y<=c&&(i.y-=c-r.y,o.y-=c-r.y,r.y=c),r.y+a>=c+t.height&&(i.y+=r.y+a-(c+t.height),o.y+=r.y+a-(c+t.height),r.y-=r.y+a-(c+t.height)),i.y+this.arrowPadding/2>a-this.ry&&(i.y=a-this.ry-this.arrowPadding/2,o.y=a,this.tipRadius=0),i.y-this.arrowPadding/2<this.ry&&(i.y=this.ry+this.arrowPadding/2,o.y=0,this.tipRadius=0)):(r=new u(r.x+h-this.elementSize.width/2-this.padding,r.y+d-this.elementSize.height-2*this.padding-this.arrowPadding-s),i.x=o.x=n/2,(r.y<c||this.isNegative)&&(r.y=(e.y<0?0:e.y)+d+s),r.y+a+this.arrowPadding>c+t.height&&(r.y=(e.y>t.height?t.height:e.y)+d-this.elementSize.height-2*this.padding-this.arrowPadding-s),o.x=n/2,r.x<l&&(i.x-=l-r.x,o.x-=l-r.x,r.x=l),r.x+n>l+t.width&&(i.x+=r.x+n-(l+t.width),o.x+=r.x+n-(l+t.width),r.x-=r.x+n-(l+t.width)),i.x+this.arrowPadding/2>n-this.rx&&(i.x=n-this.rx-this.arrowPadding/2,o.x=n,this.tipRadius=0),i.x-this.arrowPadding/2<this.rx&&(i.x=this.rx+this.arrowPadding/2,o.x=0,this.tipRadius=0)),new p(r.x,r.y,n,a)},s.prototype.animateTooltipDiv=function(t,i){var o,r=this,n=parseFloat(t.style.left),a=parseFloat(t.style.top);new e.Animation({}).animate(t,{duration:300,progress:function(e){o=e.timeStamp/e.duration,t.style.animation=null,t.style.left=n+o*(i.x-n)+"px",t.style.top=a+o*(i.y-a)+"px"},end:function(e){r.updateDiv(t,i.x,i.y),r.trigger("animationComplete",{tooltip:r})}})},s.prototype.updateDiv=function(t,e,i){t.style.left=e+"px",t.style.top=i+"px"},s.prototype.updateTemplateFn=function(){if(this.template)try{document.querySelectorAll(this.template).length&&(this.templateFn=e.compile(document.querySelector(this.template).innerHTML.trim()))}catch(t){this.templateFn=e.compile(this.template)}},s.prototype.fadeOut=function(){var t=this,i=r(this.element.id);if(i){var o=i.firstChild,n=parseFloat(o.getAttribute("opacity"))||1;new e.Animation({}).animate(o,{duration:200,progress:function(e){t.progressAnimation(o,n,e.timeStamp/e.duration)},end:function(e){t.fadeOuted=!0,t.endAnimation(o)}})}},s.prototype.progressAnimation=function(t,e,i){t.style.animation="",t.setAttribute("opacity",(e-i).toString())},s.prototype.endAnimation=function(t){t.setAttribute("opacity","0"),this.template&&!this.shared&&(t.style.display="none"),this.trigger("animationComplete",{tooltip:this})},s.prototype.getPersistData=function(){return this.addOnPersist([])},s.prototype.getModuleName=function(){return"tooltip"},s.prototype.destroy=function(){t.prototype.destroy.call(this),this.element.classList.remove("e-tooltip")},s.prototype.onPropertyChanged=function(t,e){this.isFirst=!1,this.render()},m([e.Property(!1)],s.prototype,"enable",void 0),m([e.Property(!1)],s.prototype,"shared",void 0),m([e.Property(!0)],s.prototype,"enableShadow",void 0),m([e.Property(null)],s.prototype,"fill",void 0),m([e.Property("")],s.prototype,"header",void 0),m([e.Property(.75)],s.prototype,"opacity",void 0),m([e.Complex({size:"13px",fontWeight:"Normal",color:null,fontStyle:"Normal",fontFamily:"Segoe UI"},g)],s.prototype,"textStyle",void 0),m([e.Property(null)],s.prototype,"template",void 0),m([e.Property(!0)],s.prototype,"enableAnimation",void 0),m([e.Property(!1)],s.prototype,"inverted",void 0),m([e.Property(!1)],s.prototype,"isNegative",void 0),m([e.Complex({color:"#cccccc",width:.5},v)],s.prototype,"border",void 0),m([e.Property([])],s.prototype,"content",void 0),m([e.Property(10)],s.prototype,"markerSize",void 0),m([e.Complex({x:0,y:0},w)],s.prototype,"clipBounds",void 0),m([e.Property([])],s.prototype,"palette",void 0),m([e.Property([])],s.prototype,"shapes",void 0),m([e.Complex({x:0,y:0},w)],s.prototype,"location",void 0),m([e.Property(0)],s.prototype,"offset",void 0),m([e.Property(2)],s.prototype,"rx",void 0),m([e.Property(2)],s.prototype,"ry",void 0),m([e.Property(5)],s.prototype,"marginX",void 0),m([e.Property(5)],s.prototype,"marginY",void 0),m([e.Property(12)],s.prototype,"arrowPadding",void 0),m([e.Property(null)],s.prototype,"data",void 0),m([e.Property("Material")],s.prototype,"theme",void 0),m([e.Complex({x:0,y:0,width:0,height:0},x)],s.prototype,"areaBounds",void 0),m([e.Event()],s.prototype,"tooltipRender",void 0),m([e.Event()],s.prototype,"loaded",void 0),m([e.Event()],s.prototype,"animationComplete",void 0),s=m([e.NotifyPropertyChanges],s)}(e.Component);t.TextStyle=g,t.TooltipBorder=v,t.AreaBounds=x,t.ToolLocation=w,t.Tooltip=b,t.getTooltipThemeColor=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-svg-base.umd.min.js.map |
@@ -652,3 +652,3 @@ import { Animation, Browser, ChildProperty, Complex, Component, Event, NotifyPropertyChanges, Property, SvgRenderer, compile, createElement, extend, merge, remove } from '@syncfusion/ej2-base'; | ||
if ((!isColumn && line === ' ') || (line.replace(/<b>/g, '').replace(/<\/b>/g, '').trim() !== '')) { | ||
subWidth += spaceWidth; | ||
subWidth += line !== ' ' ? spaceWidth : 0; | ||
if (isColumn && !isRow) { | ||
@@ -655,0 +655,0 @@ tspanOption = { x: (this.marginX * 2) + (markerSize + markerPadding), |
@@ -712,3 +712,3 @@ import { Animation, Browser, ChildProperty, Complex, Component, Event, NotifyPropertyChanges, Property, SvgRenderer, compile, createElement, extend, merge, remove } from '@syncfusion/ej2-base'; | ||
if ((!isColumn && line === ' ') || (line.replace(/<b>/g, '').replace(/<\/b>/g, '').trim() !== '')) { | ||
subWidth += spaceWidth; | ||
subWidth += line !== ' ' ? spaceWidth : 0; | ||
if (isColumn && !isRow) { | ||
@@ -715,0 +715,0 @@ tspanOption = { x: (this.marginX * 2) + (markerSize + markerPadding), |
@@ -1,2 +0,11 @@ | ||
this.ej=this.ej||{},this.ej.svgbase=function(t,e){"use strict";function i(t){var e;switch(t){case"Highcontrast":e={tooltipFill:"#ffffff",tooltipBoldLabel:"#000000",tooltipLightLabel:"#000000",tooltipHeaderLine:"#969696"};break;case"MaterialDark":case"FabricDark":case"BootstrapDark":e={tooltipFill:"#F4F4F4",tooltipBoldLabel:"#282727",tooltipLightLabel:"#333232",tooltipHeaderLine:"#9A9A9A"};break;default:e={tooltipFill:"rgba(0, 8, 22, 0.75)",tooltipBoldLabel:"#ffffff",tooltipLightLabel:"#dbdbdb",tooltipHeaderLine:"#ffffff"}}return e}function r(t,i){var r=document.getElementById("chartmeasuretext");return null===r&&(r=e.createElement("text",{id:"chartmeasuretext"}),document.body.appendChild(r)),r.innerHTML=t,r.style.position="absolute",r.style.fontSize=i.size,r.style.fontWeight=i.fontWeight,r.style.fontStyle=i.fontStyle,r.style.fontFamily=i.fontFamily,r.style.visibility="hidden",r.style.top="-100",r.style.left="0",r.style.whiteSpace="nowrap",r.style.lineHeight="normal",new l(r.clientWidth,r.clientHeight)}function o(t,e,i,r,o,n,a,s,h,p,d){var l="",c=i.x,y=i.y,m=i.x+i.width,u=i.y+i.height;return d=d||0,n?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e))).concat(" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u),0!==o&&(l=(l=l.concat(" L "+(r.x+o/2)+" "+u)).concat(" L "+(h+d)+" "+(u+o-d)),l+=" Q "+h+" "+(u+o)+" "+(h-d)+" "+(u+o-d)),l=r.x-o/2>c?l.concat(" L "+(r.x-o/2)+" "+u+" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z"):0===o?l.concat(" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z"):l.concat(" L "+c+" "+(u+e)+" z")):a?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(r.x-o/2)+" "+y)).concat(" L "+(h-d)+" "+(r.y+d)),l=(l=(l+=" Q "+h+" "+r.y+" "+(h+d)+" "+(r.y+d)).concat(" L "+(r.x+o/2)+" "+y+" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e))).concat(" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u+" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z")):s?(l=(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y)).concat(" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e)+" L "+m+" "+(r.y-o/2))).concat(" L "+(m+o-d)+" "+(p-d)),l=(l=(l+=" Q "+(m+o)+" "+p+" "+(m+o-d)+" "+(p+d)).concat(" L "+m+" "+(r.y+o/2)+" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u)).concat(" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z")):(l=(l=l.concat("M "+(c+t)+" "+y+" Q "+c+" "+y+" "+c+" "+(y+e)+" L "+c+" "+(r.y-o/2))).concat(" L "+(c-o+d)+" "+(p-d)),l=(l=(l+=" Q "+(c-o)+" "+p+" "+(c-o+d)+" "+(p+d)).concat(" L "+c+" "+(r.y+o/2)+" L "+c+" "+(u-e)+" Q "+c+" "+u+" "+(c+t)+" "+u)).concat(" L "+(m-t)+" "+u+" Q "+m+" "+u+" "+m+" "+(u-e)+" L "+m+" "+(y+e)+" Q "+m+" "+y+" "+(m-t)+" "+y+" z")),l}function n(t){return document.getElementById(t)}function a(t){var i=n(t);i&&e.remove(i)}function s(t,i,r,o,n,a){var s=new e.SvgRenderer(""),p=h(t,r,i,n,o),d=s["draw"+p.functionName](p.renderOption);return d.setAttribute("aria-label",a),d}function h(t,i,r,o,n){var a,s="Path",h=i.width,p=i.height,d=t.x,l=t.y,c=t.x+-h/2,y=t.y+-p/2;switch(r){case"Circle":case"Bubble":s="Ellipse",e.merge(o,{rx:h/2,ry:p/2,cx:d,cy:l});break;case"Cross":a="M "+c+" "+l+" L "+(d+h/2)+" "+l+" M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(o,{d:a});break;case"HorizontalLine":a="M "+c+" "+l+" L "+(d+h/2)+" "+l,e.merge(o,{d:a});break;case"VerticalLine":a="M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(o,{d:a});break;case"Diamond":a="M "+c+" "+l+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+l+" L "+d+" "+(l+p/2)+" L "+c+" "+l+" z",e.merge(o,{d:a});break;case"Rectangle":a="M "+c+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" L "+c+" "+(l+-p/2)+" z",e.merge(o,{d:a});break;case"Triangle":a="M "+c+" "+(l+p/2)+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" z",e.merge(o,{d:a});break;case"InvertedTriangle":a="M "+(d+h/2)+" "+(l-p/2)+" L "+d+" "+(l+p/2)+" L "+(d-h/2)+" "+(l-p/2)+" L "+(d+h/2)+" "+(l-p/2)+" z",e.merge(o,{d:a});break;case"Pentagon":for(var m=void 0,u=void 0,f=0;f<=5;f++)m=h/2*Math.cos(Math.PI/180*(72*f)),u=p/2*Math.sin(Math.PI/180*(72*f)),a=0===f?"M "+(d+m)+" "+(l+u)+" ":a.concat("L "+(d+m)+" "+(l+u)+" ");a=a.concat("Z"),e.merge(o,{d:a});break;case"Image":s="Image",e.merge(o,{href:n,height:p,width:h,x:c,y:y})}return{renderOption:o,functionName:s}}function p(t,i,r,o){var n,a,s={},h=new e.SvgRenderer("");return s={id:t.id,x:t.x,y:t.y,fill:r,"font-size":i.size,"font-style":i.fontStyle,"font-family":i.fontFamily,"font-weight":i.fontWeight,"text-anchor":t.anchor,transform:t.transform,opacity:i.opacity,"dominant-baseline":t.baseLine},a="string"==typeof t.text?t.text:t.text[0],n=h.createText(s,a),o.appendChild(n),n}var d=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),l=function(){function t(t,e){this.width=t,this.height=e}return t}(),c=function(){function t(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r}return t}(),y=function(){function t(t,e){this.isRight=e,this.isBottom=t}return t}(),m=function(){function t(t){this.id=t}return t}(),u=function(t){function e(e,i,r,o,n,a,s){void 0===a&&(a="");var h=t.call(this,e)||this;return h.transform="",h.baseLine="auto",h.x=i,h.y=r,h.anchor=o,h.text=n,h.transform=a,h.baseLine=s,h}return d(e,t),e}(m),f=function(t){function e(e,i,r,o,n,a,s){var h=t.call(this,e)||this;return h.opacity=n,h.fill=i,h.stroke=o,h["stroke-width"]=r,h["stroke-dasharray"]=a,h.d=s,h}return d(e,t),e}(m),g=function(){function t(t,e){this.x=t,this.y=e}return t}(),v=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),x=function(t,e,i,r){var o,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a},w=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(null)],i.prototype,"size",void 0),x([e.Property("")],i.prototype,"color",void 0),x([e.Property("Segoe UI")],i.prototype,"fontFamily",void 0),x([e.Property("Normal")],i.prototype,"fontWeight",void 0),x([e.Property("Normal")],i.prototype,"fontStyle",void 0),x([e.Property(1)],i.prototype,"opacity",void 0),i}(e.ChildProperty),b=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property("")],i.prototype,"color",void 0),x([e.Property(1)],i.prototype,"width",void 0),i}(e.ChildProperty),P=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(0)],i.prototype,"x",void 0),x([e.Property(0)],i.prototype,"y",void 0),x([e.Property(0)],i.prototype,"width",void 0),x([e.Property(0)],i.prototype,"height",void 0),i}(e.ChildProperty),L=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(0)],i.prototype,"x",void 0),x([e.Property(0)],i.prototype,"y",void 0),i}(e.ChildProperty),S=function(t){function h(e,i){return t.call(this,e,i)||this}return v(h,t),h.prototype.preRender=function(){this.initPrivateVariable(),this.removeSVG(),this.createTooltipElement()},h.prototype.initPrivateVariable=function(){this.renderer=new e.SvgRenderer(this.element.id),this.themeStyle=i(this.theme),this.formattedText=[],this.padding=5,this.isFirst=!0,this.markerPoint=[]},h.prototype.removeSVG=function(){var t=document.getElementById(this.element.id+"_svg"),i=document.getElementById(this.element.id+"parent_template");t&&t.parentNode&&e.remove(t),i&&i.parentNode&&e.remove(i)},h.prototype.render=function(){if(this.fadeOuted=!1,this.template)this.updateTemplateFn(),this.createTemplate(this.areaBounds,this.location);else{this.renderText(this.isFirst);var t={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",t);var i=this.renderTooltipElement(this.areaBounds,this.location);this.drawMarker(i.isBottom,i.isRight,this.markerSize)}this.trigger("loaded",{tooltip:this});var r=document.getElementById("chartmeasuretext");r&&e.remove(r)},h.prototype.createTooltipElement=function(){if(this.textElements=[],!this.template||this.shared){var t=this.renderer.createSvg({id:this.element.id+"_svg"});this.element.appendChild(t);var e=this.renderer.createGroup({id:this.element.id+"_group"});t.appendChild(e);var i=this.renderer.drawPath({id:this.element.id+"_path","stroke-width":this.border.width,fill:this.fill||this.themeStyle.tooltipFill,opacity:this.opacity,stroke:this.border.color});e.appendChild(i)}},h.prototype.drawMarker=function(t,e,i){if(this.shapes.length<=0)return null;for(var r,o=0,a=this.renderer.createGroup({id:this.element.id+"_trackball_group"}),h=n(this.element.id+"_group"),p=2*this.marginX+i/2+(e?this.arrowPadding:0),d=0,c=this.shapes;d<c.length;d++){var y=c[d];r=new f(this.element.id+"_Trackball_"+o,this.palette[o],1,"#cccccc",1,null),this.markerPoint[o]&&a.appendChild(s(new g(p,this.markerPoint[o]-this.padding+(t?this.arrowPadding:0)),y,new l(i,i),"",r,null)),o++}h.appendChild(a)},h.prototype.renderTooltipElement=function(t,i){var a,s=n(this.element.id),h=new g(0,0),p=new g(0,0),d=n(this.element.id+"_svg"),l=n(this.element.id+"_group"),m=n(this.element.id+"_path"),u=!1,f=!1,v=!1,x=0,w=0;if(this.tipRadius=1,""!==this.header&&(this.elementSize.height+=this.marginY),this.content.length>1?(a=this.sharedTooltipLocation(t,this.location.x,this.location.y),u=!0):(a=this.tooltipLocation(t,i,h,p),this.inverted?x=(f=a.x<i.x+this.clipBounds.x)?0:this.arrowPadding:(v=!(u=a.y<i.y+this.clipBounds.y),w=u?0:this.arrowPadding)),""!==this.header){var b=r(this.header,this.textStyle).height+2*this.marginY+(v?this.arrowPadding:0),P="M "+(3*this.marginX+(f||u||v?0:this.arrowPadding))+" "+b+"L "+(a.width+(f||u||v?0:this.arrowPadding)-2*this.marginX)+" "+b,L=this.renderer.drawPath({id:this.element.id+"_header_path","stroke-width":1,fill:null,opacity:.8,stroke:this.themeStyle.tooltipHeaderLine,d:P});l.appendChild(L)}var S=this.border.width/2,_=new c(S+x,S+w,a.width-S,a.height-S);if(l.setAttribute("opacity","1"),!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(s,a.x,a.y):this.animateTooltipDiv(s,a),d.setAttribute("height",(a.height+this.border.width+(this.inverted?0:this.arrowPadding)).toString()),d.setAttribute("width",(a.width+this.border.width+(this.inverted?this.arrowPadding:0)).toString()),d.setAttribute("opacity","1"),m.setAttribute("d",o(this.rx,this.ry,_,h,this.arrowPadding,u,v,f,p.x,p.y,this.tipRadius)),this.enableShadow){m.setAttribute("filter",e.Browser.isIE?"":"url(#chart_shadow_tooltip)");var T='<filter id="chart_shadow_tooltip" height="130%"><feGaussianBlur in="SourceAlpha" stdDeviation="3"/>';T+='<feOffset dx="3" dy="3" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="0.5"/>',T+='</feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';var A=this.renderer.createDefs();A.setAttribute("id","SVG_tooltip_definition"),l.appendChild(A),A.innerHTML=T}return m.setAttribute("stroke",this.border.color),this.changeText(new g(x,w),v,!f&&!u&&!v,a),new y(v,!f&&!u&&!v)},h.prototype.changeText=function(t,e,i,r){var o=document.getElementById(this.element.id+"_text");e&&o.setAttribute("transform","translate(0,"+this.arrowPadding+")"),i&&o.setAttribute("transform","translate("+this.arrowPadding+" 0)")},h.prototype.findFormattedText=function(){this.formattedText=[],""!==this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim()&&(this.formattedText=this.formattedText.concat(this.header)),this.formattedText=this.formattedText.concat(this.content)},h.prototype.renderText=function(t){var i,o,s,h,d=0,c=0,y=0,m=e.extend({},this.textStyle,null,!0).properties,f=n(this.element.id+"_group"),g="";this.findFormattedText();var v=this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim(),x=""!==v?this.marginY:0,w=!0,b=!0;this.markerPoint=[];var P=this.shapes.length>0?10:0,L=this.shapes.length>0?5:0,S="Normal",_=this.themeStyle.tooltipLightLabel,T=22/parseFloat("13px")*parseFloat(m.size);t||(a(this.element.id+"_text"),a(this.element.id+"_header_path"),a(this.element.id+"_trackball_group"),a("SVG_tooltip_definition"));for(var A=new u(this.element.id+"_text",2*this.marginX,2*this.marginY+2*this.padding+(2===this.marginY?3:0),"start",""),C=p(A,m,null,f),k=0,z=this.formattedText.length;k<z;k++){var F=this.formattedText[k].replace(/<(b|strong)>/g,"<b>").replace(/<\/(b|strong)>/g,"</b>").split(/<br.*?>/g);if(""!==F[0]){r(this.formattedText[k],m),0===k&&""!==v||this.markerPoint.push((""!==v?this.marginY:0)+A.y+d);for(var M=0,B=F.length;M<B;M++){y=0,b=!0,d+=T;for(var R=0,Q=(i=F[M].replace(/<b>/g,"<br><b>").replace(/<\/b>/g,"</b><br>").replace(/:/g,"<br>:<br>").split("<br>")).length;R<Q;R++)s=i[R],/\S/.test(s)||""===s||(s=" "),(!b&&" "===s||""!==s.replace(/<b>/g,"").replace(/<\/b>/g,"").trim())&&(y+=4,b&&!w?(h={x:2*this.marginX+(P+L),dy:T+(b?x:0),fill:""},x=null):h=w&&b?{x:""===v?2*this.marginX+(P+L):2*this.marginX}:{},b=!1,o=this.renderer.createTSpan(h,""),C.appendChild(o),s.indexOf("<b>")>-1?(S="bold",_=this.themeStyle.tooltipBoldLabel,g="font-weight:"+S,m.fontWeight=S,o.setAttribute("fill",this.textStyle.color||_)):(g="bold"===S?"font-weight:"+S:"",m.fontWeight=S,o.setAttribute("fill",this.textStyle.color||_)),s.indexOf("</b>")>-1&&(S="Normal",_=this.themeStyle.tooltipLightLabel),o.textContent=s=s.replace(/<[a-zA-Z\/](.|\n)*?>/g,""),y+=r(s,m).width,""!==g&&o.setAttribute("style",g),w=!1);y-=4,c=Math.max(c,y)}}}this.elementSize=new l(c+(c>0?2*this.marginX:0),d),this.elementSize.width+=P+L;var E=C.childNodes[0];if(""!==v&&E){m.fontWeight="bold";var O=(this.elementSize.width+2*this.padding)/2-r(v,m).width/2;E.setAttribute("x",O.toString())}},h.prototype.createTemplate=function(t,i){var r={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",r);var o=document.getElementById(this.element.id),a=o.firstElementChild;if(a&&e.remove(a),r.cancel)e.remove(n(this.element.id+"_tooltip"));else{for(var s=this.templateFn(this.data),h=e.createElement("div",{id:this.element.id+"parent_template"});s&&s.length>0;)h.appendChild(s[0]);o.appendChild(h);var p=this.element.getBoundingClientRect();this.padding=0,this.elementSize=new l(p.width,p.height);var d=this.tooltipLocation(t,i,new g(0,0),new g(0,0));!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(this.element,d.x,d.y):this.animateTooltipDiv(this.element,d)}},h.prototype.sharedTooltipLocation=function(t,e,i){var r=this.elementSize.width+2*this.marginX,o=this.elementSize.height+2*this.marginY,n=new c(e+2*this.padding,i-o-this.padding,r,o);return n.y<t.y&&(n.y+=n.height+2*this.padding),n.x+n.width>t.x+t.width&&(n.x-=n.width+4*this.padding),n},h.prototype.tooltipLocation=function(t,e,i,r){var o=new g(e.x,e.y),n=this.elementSize.width+2*this.marginX,a=this.elementSize.height+2*this.marginY,s=this.offset,h=this.clipBounds.x,p=this.clipBounds.y,d=t.x,l=t.y;return this.inverted?(o=new g(o.x+h+s,o.y+p-this.elementSize.height/2-this.padding),i.y=r.y=a/2,(o.x+n+this.arrowPadding>d+t.width||this.isNegative)&&(o.x=(e.x>t.width?t.width:e.x)+h-s-(n+this.arrowPadding)),o.x<d&&(o.x=(e.x<0?0:e.x)+h+s),o.y<=l&&(i.y-=l-o.y,r.y-=l-o.y,o.y=l),o.y+a>=l+t.height&&(i.y+=o.y+a-(l+t.height),r.y+=o.y+a-(l+t.height),o.y-=o.y+a-(l+t.height)),i.y+this.arrowPadding/2>a-this.ry&&(i.y=a-this.ry-this.arrowPadding/2,r.y=a,this.tipRadius=0),i.y-this.arrowPadding/2<this.ry&&(i.y=this.ry+this.arrowPadding/2,r.y=0,this.tipRadius=0)):(o=new g(o.x+h-this.elementSize.width/2-this.padding,o.y+p-this.elementSize.height-2*this.padding-this.arrowPadding-s),i.x=r.x=n/2,(o.y<l||this.isNegative)&&(o.y=(e.y<0?0:e.y)+p+s),o.y+a+this.arrowPadding>l+t.height&&(o.y=(e.y>t.height?t.height:e.y)+p-this.elementSize.height-2*this.padding-this.arrowPadding-s),r.x=n/2,o.x<d&&(i.x-=d-o.x,r.x-=d-o.x,o.x=d),o.x+n>d+t.width&&(i.x+=o.x+n-(d+t.width),r.x+=o.x+n-(d+t.width),o.x-=o.x+n-(d+t.width)),i.x+this.arrowPadding/2>n-this.rx&&(i.x=n-this.rx-this.arrowPadding/2,r.x=n,this.tipRadius=0),i.x-this.arrowPadding/2<this.rx&&(i.x=this.rx+this.arrowPadding/2,r.x=0,this.tipRadius=0)),new c(o.x,o.y,n,a)},h.prototype.animateTooltipDiv=function(t,i){var r,o=this,n=parseFloat(t.style.left),a=parseFloat(t.style.top);new e.Animation({}).animate(t,{duration:300,progress:function(e){r=e.timeStamp/e.duration,t.style.animation=null,t.style.left=n+r*(i.x-n)+"px",t.style.top=a+r*(i.y-a)+"px"},end:function(e){o.updateDiv(t,i.x,i.y),o.trigger("animationComplete",{tooltip:o})}})},h.prototype.updateDiv=function(t,e,i){t.style.left=e+"px",t.style.top=i+"px"},h.prototype.updateTemplateFn=function(){if(this.template)try{document.querySelectorAll(this.template).length&&(this.templateFn=e.compile(document.querySelector(this.template).innerHTML.trim()))}catch(t){this.templateFn=e.compile(this.template)}},h.prototype.fadeOut=function(){var t=this,i=n(this.element.id);if(i){var r=i.firstChild,o=parseFloat(r.getAttribute("opacity"))||1;new e.Animation({}).animate(r,{duration:200,progress:function(e){t.progressAnimation(r,o,e.timeStamp/e.duration)},end:function(e){t.fadeOuted=!0,t.endAnimation(r)}})}},h.prototype.progressAnimation=function(t,e,i){t.style.animation="",t.setAttribute("opacity",(e-i).toString())},h.prototype.endAnimation=function(t){t.setAttribute("opacity","0"),this.template&&!this.shared&&(t.style.display="none"),this.trigger("animationComplete",{tooltip:this})},h.prototype.getPersistData=function(){var t=[];return this.addOnPersist(t)},h.prototype.getModuleName=function(){return"tooltip"},h.prototype.destroy=function(){t.prototype.destroy.call(this),this.element.classList.remove("e-tooltip")},h.prototype.onPropertyChanged=function(t,e){this.isFirst=!1,this.render()},x([e.Property(!1)],h.prototype,"enable",void 0),x([e.Property(!1)],h.prototype,"shared",void 0),x([e.Property(!0)],h.prototype,"enableShadow",void 0),x([e.Property(null)],h.prototype,"fill",void 0),x([e.Property("")],h.prototype,"header",void 0),x([e.Property(.75)],h.prototype,"opacity",void 0),x([e.Complex({size:"13px",fontWeight:"Normal",color:null,fontStyle:"Normal",fontFamily:"Segoe UI"},w)],h.prototype,"textStyle",void 0),x([e.Property(null)],h.prototype,"template",void 0),x([e.Property(!0)],h.prototype,"enableAnimation",void 0),x([e.Property(!1)],h.prototype,"inverted",void 0),x([e.Property(!1)],h.prototype,"isNegative",void 0),x([e.Complex({color:"#cccccc",width:.5},b)],h.prototype,"border",void 0),x([e.Property([])],h.prototype,"content",void 0),x([e.Property(10)],h.prototype,"markerSize",void 0),x([e.Complex({x:0,y:0},L)],h.prototype,"clipBounds",void 0),x([e.Property([])],h.prototype,"palette",void 0),x([e.Property([])],h.prototype,"shapes",void 0),x([e.Complex({x:0,y:0},L)],h.prototype,"location",void 0),x([e.Property(0)],h.prototype,"offset",void 0),x([e.Property(2)],h.prototype,"rx",void 0),x([e.Property(2)],h.prototype,"ry",void 0),x([e.Property(5)],h.prototype,"marginX",void 0),x([e.Property(5)],h.prototype,"marginY",void 0),x([e.Property(12)],h.prototype,"arrowPadding",void 0),x([e.Property(null)],h.prototype,"data",void 0),x([e.Property("Material")],h.prototype,"theme",void 0),x([e.Complex({x:0,y:0,width:0,height:0},P)],h.prototype,"areaBounds",void 0),x([e.Event()],h.prototype,"tooltipRender",void 0),x([e.Event()],h.prototype,"loaded",void 0),x([e.Event()],h.prototype,"animationComplete",void 0),h=x([e.NotifyPropertyChanges],h)}(e.Component);return t.TextStyle=w,t.TooltipBorder=b,t.AreaBounds=P,t.ToolLocation=L,t.Tooltip=S,t.getTooltipThemeColor=i,t}({},ej.base),this.ejs=ej; | ||
/*! | ||
* filename: ej2-svg-base.min.js | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
* Use of this code is subject to the terms of our license. | ||
* A copy of the current license can be obtained at any time by e-mailing | ||
* licensing@syncfusion.com. Any infringement will be prosecuted under | ||
* applicable laws. | ||
*/ | ||
this.ej=this.ej||{},this.ej.svgbase=function(t,e){"use strict";function i(t){var e;switch(t){case"Highcontrast":e={tooltipFill:"#ffffff",tooltipBoldLabel:"#000000",tooltipLightLabel:"#000000",tooltipHeaderLine:"#969696"};break;case"MaterialDark":case"FabricDark":case"BootstrapDark":e={tooltipFill:"#F4F4F4",tooltipBoldLabel:"#282727",tooltipLightLabel:"#333232",tooltipHeaderLine:"#9A9A9A"};break;default:e={tooltipFill:"rgba(0, 8, 22, 0.75)",tooltipBoldLabel:"#ffffff",tooltipLightLabel:"#dbdbdb",tooltipHeaderLine:"#ffffff"}}return e}function r(t,i){var r=document.getElementById("chartmeasuretext");return null===r&&(r=e.createElement("text",{id:"chartmeasuretext"}),document.body.appendChild(r)),r.innerHTML=t,r.style.position="absolute",r.style.fontSize=i.size,r.style.fontWeight=i.fontWeight,r.style.fontStyle=i.fontStyle,r.style.fontFamily=i.fontFamily,r.style.visibility="hidden",r.style.top="-100",r.style.left="0",r.style.whiteSpace="nowrap",r.style.lineHeight="normal",new l(r.clientWidth,r.clientHeight)}function o(t,e,i,r,o,n,a,s,h,p,d){var l="",c=i.x,y=i.y,m=i.x+i.width,u=i.y+i.height;return d=d||0,n?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e))).concat(" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u),0!==o&&(l=(l=l.concat(" L "+(r.x+o/2)+" "+u)).concat(" L "+(h+d)+" "+(u+o-d)),l+=" Q "+h+" "+(u+o)+" "+(h-d)+" "+(u+o-d)),l=r.x-o/2>c?l.concat(" L "+(r.x-o/2)+" "+u+" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z"):0===o?l.concat(" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z"):l.concat(" L "+c+" "+(u+e)+" z")):a?(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y+" L "+(r.x-o/2)+" "+y)).concat(" L "+(h-d)+" "+(r.y+d)),l=(l=(l+=" Q "+h+" "+r.y+" "+(h+d)+" "+(r.y+d)).concat(" L "+(r.x+o/2)+" "+y+" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e))).concat(" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u+" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z")):s?(l=(l=(l=l.concat("M "+c+" "+(y+e)+" Q "+c+" "+y+" "+(c+t)+" "+y)).concat(" L "+(m-t)+" "+y+" Q "+m+" "+y+" "+m+" "+(y+e)+" L "+m+" "+(r.y-o/2))).concat(" L "+(m+o-d)+" "+(p-d)),l=(l=(l+=" Q "+(m+o)+" "+p+" "+(m+o-d)+" "+(p+d)).concat(" L "+m+" "+(r.y+o/2)+" L "+m+" "+(u-e)+" Q "+m+" "+u+" "+(m-t)+" "+u)).concat(" L "+(c+t)+" "+u+" Q "+c+" "+u+" "+c+" "+(u-e)+" z")):(l=(l=l.concat("M "+(c+t)+" "+y+" Q "+c+" "+y+" "+c+" "+(y+e)+" L "+c+" "+(r.y-o/2))).concat(" L "+(c-o+d)+" "+(p-d)),l=(l=(l+=" Q "+(c-o)+" "+p+" "+(c-o+d)+" "+(p+d)).concat(" L "+c+" "+(r.y+o/2)+" L "+c+" "+(u-e)+" Q "+c+" "+u+" "+(c+t)+" "+u)).concat(" L "+(m-t)+" "+u+" Q "+m+" "+u+" "+m+" "+(u-e)+" L "+m+" "+(y+e)+" Q "+m+" "+y+" "+(m-t)+" "+y+" z")),l}function n(t){return document.getElementById(t)}function a(t){var i=n(t);i&&e.remove(i)}function s(t,i,r,o,n,a){var s=new e.SvgRenderer(""),p=h(t,r,i,n,o),d=s["draw"+p.functionName](p.renderOption);return d.setAttribute("aria-label",a),d}function h(t,i,r,o,n){var a,s="Path",h=i.width,p=i.height,d=t.x,l=t.y,c=t.x+-h/2,y=t.y+-p/2;switch(r){case"Circle":case"Bubble":s="Ellipse",e.merge(o,{rx:h/2,ry:p/2,cx:d,cy:l});break;case"Cross":a="M "+c+" "+l+" L "+(d+h/2)+" "+l+" M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(o,{d:a});break;case"HorizontalLine":a="M "+c+" "+l+" L "+(d+h/2)+" "+l,e.merge(o,{d:a});break;case"VerticalLine":a="M "+d+" "+(l+p/2)+" L "+d+" "+(l+-p/2),e.merge(o,{d:a});break;case"Diamond":a="M "+c+" "+l+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+l+" L "+d+" "+(l+p/2)+" L "+c+" "+l+" z",e.merge(o,{d:a});break;case"Rectangle":a="M "+c+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" L "+c+" "+(l+-p/2)+" z",e.merge(o,{d:a});break;case"Triangle":a="M "+c+" "+(l+p/2)+" L "+d+" "+(l+-p/2)+" L "+(d+h/2)+" "+(l+p/2)+" L "+c+" "+(l+p/2)+" z",e.merge(o,{d:a});break;case"InvertedTriangle":a="M "+(d+h/2)+" "+(l-p/2)+" L "+d+" "+(l+p/2)+" L "+(d-h/2)+" "+(l-p/2)+" L "+(d+h/2)+" "+(l-p/2)+" z",e.merge(o,{d:a});break;case"Pentagon":for(var m=void 0,u=void 0,f=0;f<=5;f++)m=h/2*Math.cos(Math.PI/180*(72*f)),u=p/2*Math.sin(Math.PI/180*(72*f)),a=0===f?"M "+(d+m)+" "+(l+u)+" ":a.concat("L "+(d+m)+" "+(l+u)+" ");a=a.concat("Z"),e.merge(o,{d:a});break;case"Image":s="Image",e.merge(o,{href:n,height:p,width:h,x:c,y:y})}return{renderOption:o,functionName:s}}function p(t,i,r,o){var n,a,s={},h=new e.SvgRenderer("");return s={id:t.id,x:t.x,y:t.y,fill:r,"font-size":i.size,"font-style":i.fontStyle,"font-family":i.fontFamily,"font-weight":i.fontWeight,"text-anchor":t.anchor,transform:t.transform,opacity:i.opacity,"dominant-baseline":t.baseLine},a="string"==typeof t.text?t.text:t.text[0],n=h.createText(s,a),o.appendChild(n),n}var d=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),l=function(){function t(t,e){this.width=t,this.height=e}return t}(),c=function(){function t(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r}return t}(),y=function(){function t(t,e){this.isRight=e,this.isBottom=t}return t}(),m=function(){function t(t){this.id=t}return t}(),u=function(t){function e(e,i,r,o,n,a,s){void 0===a&&(a="");var h=t.call(this,e)||this;return h.transform="",h.baseLine="auto",h.x=i,h.y=r,h.anchor=o,h.text=n,h.transform=a,h.baseLine=s,h}return d(e,t),e}(m),f=function(t){function e(e,i,r,o,n,a,s){var h=t.call(this,e)||this;return h.opacity=n,h.fill=i,h.stroke=o,h["stroke-width"]=r,h["stroke-dasharray"]=a,h.d=s,h}return d(e,t),e}(m),g=function(){function t(t,e){this.x=t,this.y=e}return t}(),v=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),x=function(t,e,i,r){var o,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a},w=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(null)],i.prototype,"size",void 0),x([e.Property("")],i.prototype,"color",void 0),x([e.Property("Segoe UI")],i.prototype,"fontFamily",void 0),x([e.Property("Normal")],i.prototype,"fontWeight",void 0),x([e.Property("Normal")],i.prototype,"fontStyle",void 0),x([e.Property(1)],i.prototype,"opacity",void 0),i}(e.ChildProperty),b=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property("")],i.prototype,"color",void 0),x([e.Property(1)],i.prototype,"width",void 0),i}(e.ChildProperty),P=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(0)],i.prototype,"x",void 0),x([e.Property(0)],i.prototype,"y",void 0),x([e.Property(0)],i.prototype,"width",void 0),x([e.Property(0)],i.prototype,"height",void 0),i}(e.ChildProperty),L=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return v(i,t),x([e.Property(0)],i.prototype,"x",void 0),x([e.Property(0)],i.prototype,"y",void 0),i}(e.ChildProperty),S=function(t){function h(e,i){return t.call(this,e,i)||this}return v(h,t),h.prototype.preRender=function(){this.initPrivateVariable(),this.removeSVG(),this.createTooltipElement()},h.prototype.initPrivateVariable=function(){this.renderer=new e.SvgRenderer(this.element.id),this.themeStyle=i(this.theme),this.formattedText=[],this.padding=5,this.isFirst=!0,this.markerPoint=[]},h.prototype.removeSVG=function(){var t=document.getElementById(this.element.id+"_svg"),i=document.getElementById(this.element.id+"parent_template");t&&t.parentNode&&e.remove(t),i&&i.parentNode&&e.remove(i)},h.prototype.render=function(){if(this.fadeOuted=!1,this.template)this.updateTemplateFn(),this.createTemplate(this.areaBounds,this.location);else{this.renderText(this.isFirst);var t={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",t);var i=this.renderTooltipElement(this.areaBounds,this.location);this.drawMarker(i.isBottom,i.isRight,this.markerSize)}this.trigger("loaded",{tooltip:this});var r=document.getElementById("chartmeasuretext");r&&e.remove(r)},h.prototype.createTooltipElement=function(){if(this.textElements=[],!this.template||this.shared){var t=this.renderer.createSvg({id:this.element.id+"_svg"});this.element.appendChild(t);var e=this.renderer.createGroup({id:this.element.id+"_group"});t.appendChild(e);var i=this.renderer.drawPath({id:this.element.id+"_path","stroke-width":this.border.width,fill:this.fill||this.themeStyle.tooltipFill,opacity:this.opacity,stroke:this.border.color});e.appendChild(i)}},h.prototype.drawMarker=function(t,e,i){if(this.shapes.length<=0)return null;for(var r,o=0,a=this.renderer.createGroup({id:this.element.id+"_trackball_group"}),h=n(this.element.id+"_group"),p=2*this.marginX+i/2+(e?this.arrowPadding:0),d=0,c=this.shapes;d<c.length;d++){var y=c[d];r=new f(this.element.id+"_Trackball_"+o,this.palette[o],1,"#cccccc",1,null),this.markerPoint[o]&&a.appendChild(s(new g(p,this.markerPoint[o]-this.padding+(t?this.arrowPadding:0)),y,new l(i,i),"",r,null)),o++}h.appendChild(a)},h.prototype.renderTooltipElement=function(t,i){var a,s=n(this.element.id),h=new g(0,0),p=new g(0,0),d=n(this.element.id+"_svg"),l=n(this.element.id+"_group"),m=n(this.element.id+"_path"),u=!1,f=!1,v=!1,x=0,w=0;if(this.tipRadius=1,""!==this.header&&(this.elementSize.height+=this.marginY),this.content.length>1?(a=this.sharedTooltipLocation(t,this.location.x,this.location.y),u=!0):(a=this.tooltipLocation(t,i,h,p),this.inverted?x=(f=a.x<i.x+this.clipBounds.x)?0:this.arrowPadding:(v=!(u=a.y<i.y+this.clipBounds.y),w=u?0:this.arrowPadding)),""!==this.header){var b=r(this.header,this.textStyle).height+2*this.marginY+(v?this.arrowPadding:0),P="M "+(3*this.marginX+(f||u||v?0:this.arrowPadding))+" "+b+"L "+(a.width+(f||u||v?0:this.arrowPadding)-2*this.marginX)+" "+b,L=this.renderer.drawPath({id:this.element.id+"_header_path","stroke-width":1,fill:null,opacity:.8,stroke:this.themeStyle.tooltipHeaderLine,d:P});l.appendChild(L)}var S=this.border.width/2,_=new c(S+x,S+w,a.width-S,a.height-S);if(l.setAttribute("opacity","1"),!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(s,a.x,a.y):this.animateTooltipDiv(s,a),d.setAttribute("height",(a.height+this.border.width+(this.inverted?0:this.arrowPadding)).toString()),d.setAttribute("width",(a.width+this.border.width+(this.inverted?this.arrowPadding:0)).toString()),d.setAttribute("opacity","1"),m.setAttribute("d",o(this.rx,this.ry,_,h,this.arrowPadding,u,v,f,p.x,p.y,this.tipRadius)),this.enableShadow){m.setAttribute("filter",e.Browser.isIE?"":"url(#chart_shadow_tooltip)");var T='<filter id="chart_shadow_tooltip" height="130%"><feGaussianBlur in="SourceAlpha" stdDeviation="3"/>';T+='<feOffset dx="3" dy="3" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="0.5"/>',T+='</feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';var A=this.renderer.createDefs();A.setAttribute("id","SVG_tooltip_definition"),l.appendChild(A),A.innerHTML=T}return m.setAttribute("stroke",this.border.color),this.changeText(new g(x,w),v,!f&&!u&&!v,a),new y(v,!f&&!u&&!v)},h.prototype.changeText=function(t,e,i,r){var o=document.getElementById(this.element.id+"_text");e&&o.setAttribute("transform","translate(0,"+this.arrowPadding+")"),i&&o.setAttribute("transform","translate("+this.arrowPadding+" 0)")},h.prototype.findFormattedText=function(){this.formattedText=[],""!==this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim()&&(this.formattedText=this.formattedText.concat(this.header)),this.formattedText=this.formattedText.concat(this.content)},h.prototype.renderText=function(t){var i,o,s,h,d=0,c=0,y=0,m=e.extend({},this.textStyle,null,!0).properties,f=n(this.element.id+"_group"),g="";this.findFormattedText();var v=this.header.replace(/<b>/g,"").replace(/<\/b>/g,"").trim(),x=""!==v?this.marginY:0,w=!0,b=!0;this.markerPoint=[];var P=this.shapes.length>0?10:0,L=this.shapes.length>0?5:0,S="Normal",_=this.themeStyle.tooltipLightLabel,T=22/parseFloat("13px")*parseFloat(m.size);t||(a(this.element.id+"_text"),a(this.element.id+"_header_path"),a(this.element.id+"_trackball_group"),a("SVG_tooltip_definition"));for(var A=new u(this.element.id+"_text",2*this.marginX,2*this.marginY+2*this.padding+(2===this.marginY?3:0),"start",""),C=p(A,m,null,f),k=0,z=this.formattedText.length;k<z;k++){var F=this.formattedText[k].replace(/<(b|strong)>/g,"<b>").replace(/<\/(b|strong)>/g,"</b>").split(/<br.*?>/g);if(""!==F[0]){r(this.formattedText[k],m),0===k&&""!==v||this.markerPoint.push((""!==v?this.marginY:0)+A.y+d);for(var M=0,B=F.length;M<B;M++){y=0,b=!0,d+=T;for(var R=0,Q=(i=F[M].replace(/<b>/g,"<br><b>").replace(/<\/b>/g,"</b><br>").replace(/:/g,"<br>:<br>").split("<br>")).length;R<Q;R++)s=i[R],/\S/.test(s)||""===s||(s=" "),(!b&&" "===s||""!==s.replace(/<b>/g,"").replace(/<\/b>/g,"").trim())&&(y+=" "!==s?4:0,b&&!w?(h={x:2*this.marginX+(P+L),dy:T+(b?x:0),fill:""},x=null):h=w&&b?{x:""===v?2*this.marginX+(P+L):2*this.marginX}:{},b=!1,o=this.renderer.createTSpan(h,""),C.appendChild(o),s.indexOf("<b>")>-1?(S="bold",_=this.themeStyle.tooltipBoldLabel,g="font-weight:"+S,m.fontWeight=S,o.setAttribute("fill",this.textStyle.color||_)):(g="bold"===S?"font-weight:"+S:"",m.fontWeight=S,o.setAttribute("fill",this.textStyle.color||_)),s.indexOf("</b>")>-1&&(S="Normal",_=this.themeStyle.tooltipLightLabel),o.textContent=s=s.replace(/<[a-zA-Z\/](.|\n)*?>/g,""),y+=r(s,m).width,""!==g&&o.setAttribute("style",g),w=!1);y-=4,c=Math.max(c,y)}}}this.elementSize=new l(c+(c>0?2*this.marginX:0),d),this.elementSize.width+=P+L;var E=C.childNodes[0];if(""!==v&&E){m.fontWeight="bold";var O=(this.elementSize.width+2*this.padding)/2-r(v,m).width/2;E.setAttribute("x",O.toString())}},h.prototype.createTemplate=function(t,i){var r={cancel:!1,name:"tooltipRender",tooltip:this};this.trigger("tooltipRender",r);var o=document.getElementById(this.element.id),a=o.firstElementChild;if(a&&e.remove(a),r.cancel)e.remove(n(this.element.id+"_tooltip"));else{for(var s=this.templateFn(this.data),h=e.createElement("div",{id:this.element.id+"parent_template"});s&&s.length>0;)h.appendChild(s[0]);o.appendChild(h);var p=this.element.getBoundingClientRect();this.padding=0,this.elementSize=new l(p.width,p.height);var d=this.tooltipLocation(t,i,new g(0,0),new g(0,0));!this.enableAnimation||this.shared||this.isFirst?this.updateDiv(this.element,d.x,d.y):this.animateTooltipDiv(this.element,d)}},h.prototype.sharedTooltipLocation=function(t,e,i){var r=this.elementSize.width+2*this.marginX,o=this.elementSize.height+2*this.marginY,n=new c(e+2*this.padding,i-o-this.padding,r,o);return n.y<t.y&&(n.y+=n.height+2*this.padding),n.x+n.width>t.x+t.width&&(n.x-=n.width+4*this.padding),n},h.prototype.tooltipLocation=function(t,e,i,r){var o=new g(e.x,e.y),n=this.elementSize.width+2*this.marginX,a=this.elementSize.height+2*this.marginY,s=this.offset,h=this.clipBounds.x,p=this.clipBounds.y,d=t.x,l=t.y;return this.inverted?(o=new g(o.x+h+s,o.y+p-this.elementSize.height/2-this.padding),i.y=r.y=a/2,(o.x+n+this.arrowPadding>d+t.width||this.isNegative)&&(o.x=(e.x>t.width?t.width:e.x)+h-s-(n+this.arrowPadding)),o.x<d&&(o.x=(e.x<0?0:e.x)+h+s),o.y<=l&&(i.y-=l-o.y,r.y-=l-o.y,o.y=l),o.y+a>=l+t.height&&(i.y+=o.y+a-(l+t.height),r.y+=o.y+a-(l+t.height),o.y-=o.y+a-(l+t.height)),i.y+this.arrowPadding/2>a-this.ry&&(i.y=a-this.ry-this.arrowPadding/2,r.y=a,this.tipRadius=0),i.y-this.arrowPadding/2<this.ry&&(i.y=this.ry+this.arrowPadding/2,r.y=0,this.tipRadius=0)):(o=new g(o.x+h-this.elementSize.width/2-this.padding,o.y+p-this.elementSize.height-2*this.padding-this.arrowPadding-s),i.x=r.x=n/2,(o.y<l||this.isNegative)&&(o.y=(e.y<0?0:e.y)+p+s),o.y+a+this.arrowPadding>l+t.height&&(o.y=(e.y>t.height?t.height:e.y)+p-this.elementSize.height-2*this.padding-this.arrowPadding-s),r.x=n/2,o.x<d&&(i.x-=d-o.x,r.x-=d-o.x,o.x=d),o.x+n>d+t.width&&(i.x+=o.x+n-(d+t.width),r.x+=o.x+n-(d+t.width),o.x-=o.x+n-(d+t.width)),i.x+this.arrowPadding/2>n-this.rx&&(i.x=n-this.rx-this.arrowPadding/2,r.x=n,this.tipRadius=0),i.x-this.arrowPadding/2<this.rx&&(i.x=this.rx+this.arrowPadding/2,r.x=0,this.tipRadius=0)),new c(o.x,o.y,n,a)},h.prototype.animateTooltipDiv=function(t,i){var r,o=this,n=parseFloat(t.style.left),a=parseFloat(t.style.top);new e.Animation({}).animate(t,{duration:300,progress:function(e){r=e.timeStamp/e.duration,t.style.animation=null,t.style.left=n+r*(i.x-n)+"px",t.style.top=a+r*(i.y-a)+"px"},end:function(e){o.updateDiv(t,i.x,i.y),o.trigger("animationComplete",{tooltip:o})}})},h.prototype.updateDiv=function(t,e,i){t.style.left=e+"px",t.style.top=i+"px"},h.prototype.updateTemplateFn=function(){if(this.template)try{document.querySelectorAll(this.template).length&&(this.templateFn=e.compile(document.querySelector(this.template).innerHTML.trim()))}catch(t){this.templateFn=e.compile(this.template)}},h.prototype.fadeOut=function(){var t=this,i=n(this.element.id);if(i){var r=i.firstChild,o=parseFloat(r.getAttribute("opacity"))||1;new e.Animation({}).animate(r,{duration:200,progress:function(e){t.progressAnimation(r,o,e.timeStamp/e.duration)},end:function(e){t.fadeOuted=!0,t.endAnimation(r)}})}},h.prototype.progressAnimation=function(t,e,i){t.style.animation="",t.setAttribute("opacity",(e-i).toString())},h.prototype.endAnimation=function(t){t.setAttribute("opacity","0"),this.template&&!this.shared&&(t.style.display="none"),this.trigger("animationComplete",{tooltip:this})},h.prototype.getPersistData=function(){var t=[];return this.addOnPersist(t)},h.prototype.getModuleName=function(){return"tooltip"},h.prototype.destroy=function(){t.prototype.destroy.call(this),this.element.classList.remove("e-tooltip")},h.prototype.onPropertyChanged=function(t,e){this.isFirst=!1,this.render()},x([e.Property(!1)],h.prototype,"enable",void 0),x([e.Property(!1)],h.prototype,"shared",void 0),x([e.Property(!0)],h.prototype,"enableShadow",void 0),x([e.Property(null)],h.prototype,"fill",void 0),x([e.Property("")],h.prototype,"header",void 0),x([e.Property(.75)],h.prototype,"opacity",void 0),x([e.Complex({size:"13px",fontWeight:"Normal",color:null,fontStyle:"Normal",fontFamily:"Segoe UI"},w)],h.prototype,"textStyle",void 0),x([e.Property(null)],h.prototype,"template",void 0),x([e.Property(!0)],h.prototype,"enableAnimation",void 0),x([e.Property(!1)],h.prototype,"inverted",void 0),x([e.Property(!1)],h.prototype,"isNegative",void 0),x([e.Complex({color:"#cccccc",width:.5},b)],h.prototype,"border",void 0),x([e.Property([])],h.prototype,"content",void 0),x([e.Property(10)],h.prototype,"markerSize",void 0),x([e.Complex({x:0,y:0},L)],h.prototype,"clipBounds",void 0),x([e.Property([])],h.prototype,"palette",void 0),x([e.Property([])],h.prototype,"shapes",void 0),x([e.Complex({x:0,y:0},L)],h.prototype,"location",void 0),x([e.Property(0)],h.prototype,"offset",void 0),x([e.Property(2)],h.prototype,"rx",void 0),x([e.Property(2)],h.prototype,"ry",void 0),x([e.Property(5)],h.prototype,"marginX",void 0),x([e.Property(5)],h.prototype,"marginY",void 0),x([e.Property(12)],h.prototype,"arrowPadding",void 0),x([e.Property(null)],h.prototype,"data",void 0),x([e.Property("Material")],h.prototype,"theme",void 0),x([e.Complex({x:0,y:0,width:0,height:0},P)],h.prototype,"areaBounds",void 0),x([e.Event()],h.prototype,"tooltipRender",void 0),x([e.Event()],h.prototype,"loaded",void 0),x([e.Event()],h.prototype,"animationComplete",void 0),h=x([e.NotifyPropertyChanges],h)}(e.Component);return t.TextStyle=w,t.TooltipBorder=b,t.AreaBounds=P,t.ToolLocation=L,t.Tooltip=S,t.getTooltipThemeColor=i,t}({},ej.base),this.ejs=ej; | ||
//# sourceMappingURL=ej2-svg-base.min.js.map |
@@ -0,1 +1,10 @@ | ||
/*! | ||
* filename: index.d.ts | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
* Use of this code is subject to the terms of our license. | ||
* A copy of the current license can be obtained at any time by e-mailing | ||
* licensing@syncfusion.com. Any infringement will be prosecuted under | ||
* applicable laws. | ||
*/ | ||
import * as _svgbase from '@syncfusion/ej2-svg-base'; | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@syncfusion/ej2-svg-base", | ||
"version": "16.4.48", | ||
"version": "16.4.52", | ||
"description": "Essential JS 2 SVG Base Components", | ||
@@ -8,3 +8,3 @@ "author": "Syncfusion Inc.", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~16.4.47" | ||
"@syncfusion/ej2-base": "~16.4.52" | ||
}, | ||
@@ -11,0 +11,0 @@ "devDependencies": { |
@@ -370,3 +370,3 @@ var __extends = (this && this.__extends) || (function () { | ||
if ((!isColumn && line === ' ') || (line.replace(/<b>/g, '').replace(/<\/b>/g, '').trim() !== '')) { | ||
subWidth += spaceWidth; | ||
subWidth += line !== ' ' ? spaceWidth : 0; | ||
if (isColumn && !isRow) { | ||
@@ -373,0 +373,0 @@ tspanOption = { x: (this.marginX * 2) + (markerSize + markerPadding), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
539732
4202