2022-01-28 05:02:31 +08:00
|
|
|
(()=>{var t={n:e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const i=flarum.core.compat["admin/app"];var n=t.n(i);const s=flarum.core.compat["common/extend"],a=flarum.core.compat["admin/components/DashboardPage"];var r=t.n(a);function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}const c=flarum.core.compat["admin/components/DashboardWidget"];var h=t.n(c);const u=flarum.core.compat["common/components/SelectDropdown"];var d=t.n(u);const p=flarum.core.compat["common/components/Button"];var f=t.n(p);const v=flarum.core.compat["common/helpers/icon"];var g=t.n(v);const y=flarum.core.compat["common/utils/abbreviateNumber"];var b=t.n(y);function x(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function w(t){var e=t.getBoundingClientRect();return{top:e.top+(document.documentElement.scrollTop||document.body.scrollTop),left:e.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}}x.create=function(t,e){var i=document.createElement(t);for(var n in e){var s=e[n];if("inside"===n)x(s).appendChild(i);else if("around"===n){var a=x(s);a.parentNode.insertBefore(i,a),i.appendChild(a)}else"styles"===n?"object"==typeof s&&Object.keys(s).map((function(t){i.style[t]=s[t]})):n in i?i[n]=s:i.setAttribute(n,s)}return i};var A={margins:{top:10,bottom:10,left:20,right:20},paddings:{top:20,bottom:40,left:30,right:10},baseHeight:240,titleHeight:20,legendHeight:30,titleFontSize:12};function P(t){return t.titleHeight+t.margins.top+t.paddings.top}function k(t){return t.margins.left+t.paddings.left}function M(t){return t.margins.top+t.margins.bottom+t.paddings.top+t.paddings.bottom+t.titleHeight+t.legendHeight}function T(t){return t.margins.left+t.margins.right+t.paddings.left+t.paddings.right}var L=["line","bar"],C=["light-blue","blue","violet","red","orange","yellow","green","light-green","purple","magenta","light-grey","dark-grey"],D={bar:C,line:C,pie:C,percentage:C,heatmap:["#ebedf0","#c6e48b","#7bc96f","#239a3b","#196127"],donut:C},N=Math.PI/180,S=function(){function t(t){var e=t.parent,i=void 0===e?null:e,n=t.colors,s=void 0===n?[]:n;this.parent=i,this.colors=s,this.titleName="",this.titleValue="",this.listValues=[],this.titleValueFirst=0,this.x=0,this.y=0,this.top=0,this.left=0,this.setup()}var e=t.prototype;return e.setup=function(){this.makeTooltip()},e.refresh=function(){this.fill(),this.calcPosition()},e.makeTooltip=function(){var t=this;this.container=x.create("div",{inside:this.parent,className:"graph-svg-tip comparison",innerHTML:'<span class="title"></span>\n\t\t\t\t<ul class="data-point-list"></ul>\n\t\t\t\t<div class="svg-pointer"></div>'}),this.hideTip(),this.title=this.container.querySelector(".title"),this.dataPointList=this.container.querySelector(".data-point-list"),this.parent.addEventListener("mouseleave",(function(){t.hideTip()}))},e.fill=function(){var t,e=this;this.index&&this.container.setAttribute("data-point-index",this.index),t=this.titleValueFirst?"<strong>"+this.titleValue+"</strong>"+this.titleName:this.titleName+"<strong>"+this.titleValue+"</strong>",this.title.innerHTML=t,this.dataPointList.innerHTML="",this.listValues.map((function(t,i){var n=e.colors[i]||"black",s=0===t.formatted||t.formatted?t.formatted:t.value,a=x.create("li",{styles:{"border-top":"3px solid "+n},innerHTML:'<strong style="display: block;">'+(0===s||s?s:"")+"</strong>\n\t\t\t\t\t"+(t.title?t.title:"")});e.dataPointList.appendChild(a)}))},e.calcPosition=function(){var t=this.container.offsetWidth;this.top=this.y-this.container.offsetHeight-5,this.left=this.x-t/2;var e=this.parent.offsetWidth-t,i=this.container.querySelector(".s
|