@hpcc-js/html 3.3.19 → 3.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +829 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +9 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,830 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,o)=>t(e,"name",{value:o,configurable:!0}),o=(e,o,i)=>((e,o,i)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i)(e,"symbol"!=typeof o?o+"":o,i);import{HTMLWidget as i,select as r,format as s}from"@hpcc-js/common";import{scopedLogger as l}from"@hpcc-js/util";import{React as n}from"@hpcc-js/react";const h="@hpcc-js/html",a="3.3.19",p="3.24.0",d=class _HTMLTooltip extends i{_triggerElement;_contentNode;_prevContentNode;_tooltipElement;_arrowElement;_tooltipHTMLCallback=/* @__PURE__ */e(t=>"<b>_tooltipHTMLCallback is undefined</b>","_tooltipHTMLCallback");_logger=l("html/HTMLTooltip");constructor(){super(),this.visible(!1)}tooltipHTML(t){return this._tooltipHTMLCallback=t,this}tooltipContent(t){return arguments.length?(this._contentNode=t,this):this._contentNode}triggerElement(t){return this._triggerElement=t,this}enter(t,e){super.enter(t,e);const o=r("body");this._tooltipElement=o.append("div").attr("class","tooltip-div").style("z-index","2147483638").style("position","fixed"),this._arrowElement=o.append("div").attr("class","arrow-div").style("z-index","2147483638").style("position","fixed")}update(t,e){if(super.update(t,e),this._contentNode!==this._prevContentNode){const t=this._tooltipElement.node();[...t.querySelectorAll("*")].map(t=>t.__data__).filter(t=>t).forEach(t=>{"function"==typeof t.target&&t.target(null),"function"==typeof t.exit&&t.exit()}),t.innerHTML="",t.appendChild(this._contentNode),this._prevContentNode=this._contentNode}if(this._contentNode?this.onShowContent(this._contentNode):this._tooltipElement.html(()=>this._tooltipHTMLCallback(this.data())),this.fitContent()){this._tooltipElement.style("width","auto").style("height","auto").style("padding","0px").style("box-sizing","content-box");const t=this._tooltipElement.node().getBoundingClientRect();this.tooltipWidth_default(t.width),this.tooltipHeight_default(t.height)}this._closing=!1,this._tooltipElement.style("background-color",this.tooltipColor()).style("color",this.fontColor()).style("width",this.tooltipWidth()+"px").style("height",this.tooltipHeight()+"px").style("opacity",1).style("padding",this.padding()+"px").style("pointer-events",this.enablePointerEvents()?"all":"none").style("box-sizing","content-box"),this._arrowElement.style("opacity",1).style("pointer-events","none"),this.updateTooltipPosition()}onShowContent(t){}updateTooltipPosition(){const t=this.calcReferenceBBox(),e=this.calcTooltipDirection(t),o=t[e];return this._tooltipElement.style("top",o.y+"px").style("left",o.x+"px"),this.setArrowPosition(o,e),o}calcTooltipDirection(t){const e=Object.keys(t),o=this.direction();e.sort((t,e)=>t===o?-1:1);const i={top:0,left:0,width:window.innerWidth,height:window.innerHeight};for(let r=0;r<e.length;r++){const o={top:t[e[r]].y,left:t[e[r]].x,width:this.tooltipWidth(),height:this.tooltipHeight()};if(this.rectFits(o,i))return e[r]}return this._logger.warning(`Tooltip doesn't fit in the window for any of the directions. Defaulting to '${o}'`),this._logger.debug(i),this._logger.debug({top:t[o].y,left:t[o].x,width:this.tooltipWidth(),height:this.tooltipHeight()}),o}rectFits(t,e){return t.top>=e.top&&t.left>=e.left&&t.width+t.left<=e.width+e.left&&t.height+t.top<=e.height+e.top}setArrowPosition(t,e){let o,i,r="border-top-color";switch(this._arrowElement.style("border",`${this.arrowHeight()}px solid ${this.tooltipColor()}`).style("border-top-color","transparent").style("border-right-color","transparent").style("border-bottom-color","transparent").style("border-left-color","transparent"),e){case"n":o=t.y+this.tooltipHeight()+2*this.padding(),i=t.x+this.tooltipWidth()/2-this.arrowWidth()/2+this.padding(),r="border-top-color",this._arrowElement.style("border-top-width",`${this.arrowHeight()}px`).style("border-bottom-width","0px").style("border-left-width",this.arrowWidth()/2+"px").style("border-right-width",this.arrowWidth()/2+"px");break;case"s":o=t.y-this.arrowHeight(),i=t.x+this.padding()+this.tooltipWidth()/2-this.arrowWidth()/2,r="border-bottom-color",this._arrowElement.style("border-top-width","0px").style("border-bottom-width",`${this.arrowHeight()}px`).style("border-left-width",this.arrowWidth()/2+"px").style("border-right-width",this.arrowWidth()/2+"px");break;case"e":o=t.y+this.tooltipHeight()/2+this.padding()-this.arrowWidth()/2,i=t.x-this.arrowHeight(),r="border-right-color",this._arrowElement.style("border-top-width",this.arrowWidth()/2+"px").style("border-bottom-width",this.arrowWidth()/2+"px").style("border-left-width","0px").style("border-right-width",`${this.arrowHeight()}px`);break;case"w":o=t.y+this.tooltipHeight()/2-this.arrowWidth()/2+this.padding(),i=t.x+this.tooltipWidth()+2*this.padding(),r="border-left-color",this._arrowElement.style("border-top-width",this.arrowWidth()/2+"px").style("border-bottom-width",this.arrowWidth()/2+"px").style("border-left-width",`${this.arrowHeight()}px`).style("border-right-width","0px")}return void 0!==o&&void 0!==i?this._arrowElement.style("top",o+"px").style("left",i+"px").style(r,this.tooltipColor()).style("opacity",1):this._arrowElement.style("opacity",0),t}getReferenceNode(){return this._triggerElement?this._triggerElement.node():this.element().node().parentNode.parentNode}_cursorLoc;calcReferenceBBox(){const t=this.getReferenceNode();let{top:e,left:o,width:i,height:r}=t.getBoundingClientRect();const s=this.tooltipWidth(),l=this.tooltipHeight(),n=s/2,h=l/2,a=this.arrowHeight(),p=this.padding(),d=2*p;this.followCursor()&&this._cursorLoc&&(o=this._cursorLoc[0],e=this._cursorLoc[1],i=1,r=1);return{n:{x:o+i/2-n-p,y:e-l-a-d},e:{x:o+i+a,y:e+r/2-h-p},s:{x:o+i/2-n-p,y:e+r+a},w:{x:o-s-a-d,y:e+r/2-h-p},nw:{x:o-s-d,y:e-l-d},ne:{x:o+i,y:e-l-d},se:{x:o+i,y:e+r},sw:{x:o-s-d,y:e+r}}}_closing=!1;mouseout(){this._closing=!0,this._tooltipElement.on("mouseover",()=>{this._closing=!1}),this._tooltipElement.on("mouseout",()=>{this.mouseout()}),setTimeout(()=>{this._closing&&this.visible(!1)},this.closeDelay())}visible(t){return arguments.length?(this._arrowElement&&(this._arrowElement.style("visibility",t?"visible":"hidden"),this._tooltipElement.style("visibility",t?"visible":"hidden")),super.visible(t),this):super.visible()}exit(t,e){this._arrowElement&&(this._arrowElement.remove(),this._tooltipElement.remove()),super.exit(t,e)}};e(d,"HTMLTooltip");let c=d;c.prototype._class+=" html_HTMLTooltip",c.prototype.publish("fitContent",!1,"boolean","If true, tooltip will grow to fit its html content"),c.prototype.publish("followCursor",!1,"boolean","If true, tooltip will display relative to cursor location"),c.prototype.publish("closeDelay",400,"number","Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)"),c.prototype.publish("direction","n","set","Direction in which to display the tooltip",["n","s","e","w","ne","nw","se","sw"]),c.prototype.publish("padding",8,"number","Padding (pixels)"),c.prototype.publish("arrowWidth",16,"number","Width (or height depending on direction) of the tooltip arrow (pixels)"),c.prototype.publish("arrowHeight",8,"number","Height (or width depending on direction) of the tooltip arrow (pixels)"),c.prototype.publish("fontColor","#FFF","html-color","The default font color for text in the tooltip"),c.prototype.publish("tooltipColor","#000000EE","html-color","Background color of the tooltip"),c.prototype.publish("tooltipWidth",200,"number","Width of the tooltip (not including arrow) (pixels)"),c.prototype.publish("tooltipHeight",200,"number","Height of the tooltip (not including arrow) (pixels)"),c.prototype.publish("enablePointerEvents",!1,"boolean","If true, the 'pointer-events: all' style will be used");const u=class _SimpleTable extends i{_table;_tbody;_thead;_theadRow;constructor(){super()}transformData(){return this.data()}enter(t,e){super.enter(t,e),this._table=e.append("table"),this._thead=this._table.append("thead"),this._theadRow=this._thead.append("tr"),this._tbody=this._table.append("tbody")}update(t,e){super.update(t,e),this._table.style("width",this.autoWidth()?"auto":"100%");const o=this._theadRow.selectAll("th").data(this.columns());o.enter().append("th").attr("class",(t,e)=>`th-${e}`).merge(o).text(t=>t.toString()),o.exit().remove();const i=this._tbody.selectAll("tr").data(this.transformData());i.enter().append("tr").merge(i).each(function(t){const e=r(this).selectAll("td").data(t);e.enter().append("td").attr("class",(t,e)=>`col-${e}`).merge(e).text(t=>t.toString()),e.exit().remove()}),i.exit().remove()}};e(u,"SimpleTable");let g=u;g.prototype._class+=" html_SimpleTable",g.prototype.publish("autoWidth",!1,"boolean","If true, table width will be set to 'auto'. If false, the width is set to '100%'");const y=class _StyledTable extends g{constructor(){super()}applyStyleObject(t,e){Object.keys(e).forEach(o=>{t.style(o,e[o])})}update(t,e){super.update(t,e),e.selectAll("tr,th,td").attr("style","").style("font-family",this.fontFamily()).style("color",this.fontColor()),this.theadColumnStyles().forEach((t,o)=>{this.applyStyleObject(e.select(`.th-${o}`),t)}),this.tbodyColumnStyles().forEach((t,o)=>{this.applyStyleObject(e.selectAll(`.col-${o}`),t)});const o=Object.keys(this.evenRowStyles()).length>0,i=Object.keys(this.lastRowStyles()).length>0,r=e.selectAll("tbody > tr");if(o){const t=r.select(function(t,e){return e%2?this:null});this.applyStyleObject(t,this.evenRowStyles())}if(i){const t=r.select(function(t,e,o){return e===o.length-1?this:null});this.applyStyleObject(t,this.lastRowStyles())}}};e(y,"StyledTable");let b=y;b.prototype._class+=" html_StyledTable",b.prototype.publish("fontFamily","Verdana","string","Base font-family used within the table"),b.prototype.publish("fontColor","#333","string","Base font color used within the table"),b.prototype.publish("theadColumnStyles",[],"array",'Array of objects containing styles for the thead columns (ex: [{"color":"red"},{"color":"blue"}])'),b.prototype.publish("tbodyColumnStyles",[],"array",'Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])'),b.prototype.publish("lastRowStyles",{},"object",'Object containing styles for the last row (ex: {"color":"red"})'),b.prototype.publish("evenRowStyles",{},"object",'Object containing styles for even rows (ex: {"background-color":"#AAA"})');const m=class _BreakdownTable extends b{_tooltip;constructor(){super()}transformData(){const t=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount();return this.breakdownData(t)}breakdownData(t){const e=this.data().length,o=this.data().reduce((t,e)=>t+e[1],0),i=[];let r=0;this.data().sort((t,e)=>t[1]>e[1]?-1:1);const s=e-t>0;if(this.data().filter((e,o)=>!s||o<t-1).forEach(t=>{const e=Math.round(t[1]/o*100);r+=e,i.push([t[0],e+"%"])}),s){const o=`${this.otherLabel()} (${e-t+1})`,s="~"+(100-r)+"%";i.push([o,s])}return i}calculateRowCount(){const t=this.columns().length>0?this.thFontSize()+5:0,e=this.fontSize()+5,o=this.height()-t;return Math.floor(o/e)}enter(t,e){super.enter(t,e),this._tooltip=(new c).target(t),this._tooltip.tooltipHTML(t=>{const e=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount(),o=Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).height))??this.fontSize(),i=Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).width)),r=2*(i+30)+2*this._tooltip.padding(),s=o*Math.ceil((t.length-e)/2)+2*this._tooltip.padding();this._tooltip.tooltipWidth(r),this._tooltip.tooltipHeight(s);const l=this.breakdownData(this.data().length).slice(e-1);return`<div style="\n width: 100%;\n height: 100%;\n font-size: ${this.fontSize()}px;\n ">${l.map(t=>`<div style="\n float:left;\n width:${Math.floor(49.5)}%;\n ">${t[0]}: ${t[1]}</div>`).join("")}</div>`})}update(t,e){this.theadColumnStyles_default([{color:this.thFirstColor(),"font-size":this.thFontSize()+"px","font-weight":this.thFontWeight(),"text-align":this.labelAlignment(),width:"auto",padding:"0px"},{width:"1%","font-size":this.thFontSize()+"px","font-weight":this.thFontWeight(),"text-align":this.percentageAlignment(),padding:"0px"}]),this.tbodyColumnStyles_default([{color:this.topLabelColor(),"font-size":this.fontSize()+"px","font-weight":"normal","text-align":this.labelAlignment(),width:"auto",padding:"0px"},{color:this.topPercentageColor(),"font-size":this.fontSize()+"px","font-weight":"normal","text-align":this.percentageAlignment(),width:"1%",padding:"0px"}]),this.lastRowStyles_default([{color:this.otherLabelColor(),"font-size":this.fontSize()+"px","font-weight":this.otherLabelBold()?"bold":"normal","text-align":this.labelAlignment(),width:"auto",padding:"0px"},{color:this.otherLabelColor(),"font-size":this.fontSize()+"px","font-weight":this.otherPercentageBold()?"bold":"normal","text-align":this.percentageAlignment(),width:"1%",padding:"0px"}]),super.update(t,e);if((this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount())<this.data().length){const t=e.select("tbody > tr:last-child"),o=this;t.on("mouseout.tooltip",e=>{o._tooltip._triggerElement=t,o._tooltip.visible(!1).render()}).on("mouseenter.tooltip",e=>{o._tooltip._triggerElement=t,o._tooltip.direction("n").data(o.data()).visible(!0).render()})}}};e(m,"BreakdownTable");let f=m;f.prototype._class+=" html_BreakdownTable",f.prototype.publish("useCalculatedRowCount",!0,"boolean","If true, rowCount will be calculated and its default will be overwritten"),f.prototype.publish("rowCount",5,"number","Number of total rows to display (including the 'other' row)",void 0,{disable:/* @__PURE__ */e(t=>t.useCalculatedRowCount(),"disable")}),f.prototype.publish("fontSize",14,"number","Font size (pixels)"),f.prototype.publish("labelAlignment","left","set","Alignment of the label column text",["left","center","right"]),f.prototype.publish("percentageAlignment","center","set","Alignment of the percentage column text",["left","center","right"]),f.prototype.publish("topLabelColor","#333","html-color","Color of displayed 'top' labels"),f.prototype.publish("topPercentageColor","#1A99D5","html-color","Color of displayed 'top' percentages"),f.prototype.publish("topPercentageBold",!0,"html-color","If true, the 'top' percentages will be bold"),f.prototype.publish("otherLabel","Other","string","Label text for the 'other' row"),f.prototype.publish("otherLabelColor","#AAA","html-color","Color of the 'other' label"),f.prototype.publish("otherLabelBold",!1,"html-color","If true, the 'other' label will be bold"),f.prototype.publish("otherPercentageColor","#AAA","html-color","Color of the 'other' percentage"),f.prototype.publish("otherPercentageBold",!1,"html-color","If true, the 'other' percentage will be bold"),f.prototype.publish("thFontWeight","bold","string","Font weight for th elements"),f.prototype.publish("thFontSize",26,"number","Font size for th elements"),f.prototype.publish("thFirstColor","#333","html-color","Text color of the first th element"),f.prototype.publish("thLastColor","#333","html-color","Text color of the last th element");const _=class _JSXWidget extends i{rootNode;jsxRender(t,e){this.rootNode=n.render(t,e,this.rootNode)}};e(_,"JSXWidget"),o(_,"Component",n.Component),o(_,"createElement",n.createElement);let w=_;w.prototype._class+=" html_JSXWidget";const x=class _VNode{_attrs;_children;constructor(t,e){this._attrs=t,this._children=e}type(){return"div"}attrs(){return this._attrs}attr(t){return this._attrs[t]}children(){return this._children}update(t){for(const e in this._attrs)t.attr(e,this._attrs[e])}render(t){const e=t.selectAll(`${t.node().tagName} > *`).data([this]);return e.exit().remove(),e.enter().append(this.type()).attr("reactd3",0).merge(e).each(function(t){const e=r(this);t.update(e),t.renderChildren(e)})}renderChildren(t){const e=t.selectAll(`${t.node().tagName} > *`).data(this._children);return e.exit().remove(),e.enter().append(t=>document.createElement(t.type())).attr("reactd3",(t,e)=>e).merge(e).each(function(t){const e=r(this);t.update(e),t.renderChildren(e)})}};e(x,"VNode");let C=x;const v=class _ConstVNode extends C{_type;constructor(t,e,o){super(e,o),this._type=t}type(){return this._type}};e(v,"ConstVNode");let S=v;const E=class _TextVNode extends C{_text;constructor(t){super({},[]),this._text=t}type(){return"span"}update(t){super.update(t),t.text(this._text)}};e(E,"TextVNode");let T=E;function W(t){return"function"==typeof t}function R(t){return t.prototype&&t.prototype instanceof C}e(W,"isReactFn"),e(R,"isIVNode");const A=class _ReactD3{static createElement(t,e,...o){return R(t)?new t(e):W(t)?t(e):new S(t,e,o.map(t=>"string"==typeof t?new T(t):t))}static render(t,e){t.render(e)}};e(A,"ReactD3");let B=A;var F;F={__e:/* @__PURE__ */e(function(t,e,o,i){for(var r,s,l;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&null!=s.getDerivedStateFromError&&(r.setState(s.getDerivedStateFromError(t)),l=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(t,i||{}),l=r.__d),l)return r.__E=r}catch(n){t=n}throw t},"__e")},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Math.random().toString(8);var k=0;function H(t,e,o,i,r,s){e||(e={});var l,n,h=e;if("ref"in h)for(n in h={},e)"ref"==n?l=e[n]:h[n]=e[n];var a={type:t,props:h,key:o,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--k,__i:-1,__u:0,__source:r,__self:s};return F.vnode&&F.vnode(a),a}e(H,"u");const z=class _VizComponent extends w.Component{widget;refreshProps(){for(const t in this.props)this.widget[t]&&"function"==typeof this.widget[t]&&this.widget[t](this.props[t])}componentDidMount(){this.widget=(new this.props.type).target(this.base),this.refreshProps(),this.widget.render()}componentWillUnmount(){this.widget.target(null).render()}render(){/* @__PURE__ */
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { HTMLWidget as t, format as n, select as r } from "@hpcc-js/common";
|
|
2
|
+
import { scopedLogger as i } from "@hpcc-js/util";
|
|
3
|
+
import { React as a } from "@hpcc-js/react";
|
|
4
|
+
//#region \0rolldown/runtime.js
|
|
5
|
+
var o = "@hpcc-js/html", s = "3.3.20", c = "3.25.1", HTMLTooltip = class extends t {
|
|
6
|
+
_triggerElement;
|
|
7
|
+
_contentNode;
|
|
8
|
+
_prevContentNode;
|
|
9
|
+
_tooltipElement;
|
|
10
|
+
_arrowElement;
|
|
11
|
+
_tooltipHTMLCallback = (t) => "<b>_tooltipHTMLCallback is undefined</b>";
|
|
12
|
+
_logger = i("html/HTMLTooltip");
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this.visible(!1);
|
|
15
|
+
}
|
|
16
|
+
tooltipHTML(t) {
|
|
17
|
+
return this._tooltipHTMLCallback = t, this;
|
|
18
|
+
}
|
|
19
|
+
tooltipContent(t) {
|
|
20
|
+
return arguments.length ? (this._contentNode = t, this) : this._contentNode;
|
|
21
|
+
}
|
|
22
|
+
triggerElement(t) {
|
|
23
|
+
return this._triggerElement = t, this;
|
|
24
|
+
}
|
|
25
|
+
enter(t, n) {
|
|
26
|
+
super.enter(t, n);
|
|
27
|
+
let i = r("body");
|
|
28
|
+
this._tooltipElement = i.append("div").attr("class", "tooltip-div").style("z-index", "2147483638").style("position", "fixed"), this._arrowElement = i.append("div").attr("class", "arrow-div").style("z-index", "2147483638").style("position", "fixed");
|
|
29
|
+
}
|
|
30
|
+
update(t, n) {
|
|
31
|
+
if (super.update(t, n), this._contentNode !== this._prevContentNode) {
|
|
32
|
+
let t = this._tooltipElement.node();
|
|
33
|
+
[...t.querySelectorAll("*")].map((t) => t.__data__).filter((t) => t).forEach((t) => {
|
|
34
|
+
typeof t.target == "function" && t.target(null), typeof t.exit == "function" && t.exit();
|
|
35
|
+
}), t.innerHTML = "", t.appendChild(this._contentNode), this._prevContentNode = this._contentNode;
|
|
36
|
+
}
|
|
37
|
+
if (this._contentNode ? this.onShowContent(this._contentNode) : this._tooltipElement.html(() => this._tooltipHTMLCallback(this.data())), this.fitContent()) {
|
|
38
|
+
this._tooltipElement.style("width", "auto").style("height", "auto").style("padding", "0px").style("box-sizing", "content-box");
|
|
39
|
+
let t = this._tooltipElement.node().getBoundingClientRect();
|
|
40
|
+
this.tooltipWidth_default(t.width), this.tooltipHeight_default(t.height);
|
|
41
|
+
}
|
|
42
|
+
this._closing = !1, this._tooltipElement.style("background-color", this.tooltipColor()).style("color", this.fontColor()).style("width", this.tooltipWidth() + "px").style("height", this.tooltipHeight() + "px").style("opacity", 1).style("padding", this.padding() + "px").style("pointer-events", this.enablePointerEvents() ? "all" : "none").style("box-sizing", "content-box"), this._arrowElement.style("opacity", 1).style("pointer-events", "none"), this.updateTooltipPosition();
|
|
43
|
+
}
|
|
44
|
+
onShowContent(t) {}
|
|
45
|
+
updateTooltipPosition() {
|
|
46
|
+
let t = this.calcReferenceBBox(), n = this.calcTooltipDirection(t), r = t[n];
|
|
47
|
+
return this._tooltipElement.style("top", r.y + "px").style("left", r.x + "px"), this.setArrowPosition(r, n), r;
|
|
48
|
+
}
|
|
49
|
+
calcTooltipDirection(t) {
|
|
50
|
+
let n = Object.keys(t), r = this.direction();
|
|
51
|
+
n.sort((t, n) => t === r ? -1 : 1);
|
|
52
|
+
let i = {
|
|
53
|
+
top: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
width: window.innerWidth,
|
|
56
|
+
height: window.innerHeight
|
|
57
|
+
};
|
|
58
|
+
for (let r = 0; r < n.length; r++) {
|
|
59
|
+
let a = {
|
|
60
|
+
top: t[n[r]].y,
|
|
61
|
+
left: t[n[r]].x,
|
|
62
|
+
width: this.tooltipWidth(),
|
|
63
|
+
height: this.tooltipHeight()
|
|
64
|
+
};
|
|
65
|
+
if (this.rectFits(a, i)) return n[r];
|
|
66
|
+
}
|
|
67
|
+
return this._logger.warning(`Tooltip doesn't fit in the window for any of the directions. Defaulting to '${r}'`), this._logger.debug(i), this._logger.debug({
|
|
68
|
+
top: t[r].y,
|
|
69
|
+
left: t[r].x,
|
|
70
|
+
width: this.tooltipWidth(),
|
|
71
|
+
height: this.tooltipHeight()
|
|
72
|
+
}), r;
|
|
73
|
+
}
|
|
74
|
+
rectFits(t, n) {
|
|
75
|
+
return t.top >= n.top && t.left >= n.left && t.width + t.left <= n.width + n.left && t.height + t.top <= n.height + n.top;
|
|
76
|
+
}
|
|
77
|
+
setArrowPosition(t, n) {
|
|
78
|
+
let r, i, a = "border-top-color";
|
|
79
|
+
switch (this._arrowElement.style("border", `${this.arrowHeight()}px solid ${this.tooltipColor()}`).style("border-top-color", "transparent").style("border-right-color", "transparent").style("border-bottom-color", "transparent").style("border-left-color", "transparent"), n) {
|
|
80
|
+
case "n":
|
|
81
|
+
r = t.y + this.tooltipHeight() + this.padding() * 2, i = t.x + this.tooltipWidth() / 2 - this.arrowWidth() / 2 + this.padding(), a = "border-top-color", this._arrowElement.style("border-top-width", `${this.arrowHeight()}px`).style("border-bottom-width", "0px").style("border-left-width", `${this.arrowWidth() / 2}px`).style("border-right-width", `${this.arrowWidth() / 2}px`);
|
|
82
|
+
break;
|
|
83
|
+
case "s":
|
|
84
|
+
r = t.y - this.arrowHeight(), i = t.x + this.padding() + this.tooltipWidth() / 2 - this.arrowWidth() / 2, a = "border-bottom-color", this._arrowElement.style("border-top-width", "0px").style("border-bottom-width", `${this.arrowHeight()}px`).style("border-left-width", `${this.arrowWidth() / 2}px`).style("border-right-width", `${this.arrowWidth() / 2}px`);
|
|
85
|
+
break;
|
|
86
|
+
case "e":
|
|
87
|
+
r = t.y + this.tooltipHeight() / 2 + this.padding() - this.arrowWidth() / 2, i = t.x - this.arrowHeight(), a = "border-right-color", this._arrowElement.style("border-top-width", `${this.arrowWidth() / 2}px`).style("border-bottom-width", `${this.arrowWidth() / 2}px`).style("border-left-width", "0px").style("border-right-width", `${this.arrowHeight()}px`);
|
|
88
|
+
break;
|
|
89
|
+
case "w":
|
|
90
|
+
r = t.y + this.tooltipHeight() / 2 - this.arrowWidth() / 2 + this.padding(), i = t.x + this.tooltipWidth() + this.padding() * 2, a = "border-left-color", this._arrowElement.style("border-top-width", `${this.arrowWidth() / 2}px`).style("border-bottom-width", `${this.arrowWidth() / 2}px`).style("border-left-width", `${this.arrowHeight()}px`).style("border-right-width", "0px");
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return r !== void 0 && i !== void 0 ? this._arrowElement.style("top", r + "px").style("left", i + "px").style(a, this.tooltipColor()).style("opacity", 1) : this._arrowElement.style("opacity", 0), t;
|
|
94
|
+
}
|
|
95
|
+
getReferenceNode() {
|
|
96
|
+
return this._triggerElement ? this._triggerElement.node() : this.element().node().parentNode.parentNode;
|
|
97
|
+
}
|
|
98
|
+
_cursorLoc;
|
|
99
|
+
calcReferenceBBox() {
|
|
100
|
+
let { top: t, left: n, width: r, height: i } = this.getReferenceNode().getBoundingClientRect(), a = this.tooltipWidth(), o = this.tooltipHeight(), s = a / 2, c = o / 2, l = this.arrowHeight(), d = this.padding(), f = d * 2;
|
|
101
|
+
return this.followCursor() && this._cursorLoc && (n = this._cursorLoc[0], t = this._cursorLoc[1], r = 1, i = 1), {
|
|
102
|
+
n: {
|
|
103
|
+
x: n + r / 2 - s - d,
|
|
104
|
+
y: t - o - l - f
|
|
105
|
+
},
|
|
106
|
+
e: {
|
|
107
|
+
x: n + r + l,
|
|
108
|
+
y: t + i / 2 - c - d
|
|
109
|
+
},
|
|
110
|
+
s: {
|
|
111
|
+
x: n + r / 2 - s - d,
|
|
112
|
+
y: t + i + l
|
|
113
|
+
},
|
|
114
|
+
w: {
|
|
115
|
+
x: n - a - l - f,
|
|
116
|
+
y: t + i / 2 - c - d
|
|
117
|
+
},
|
|
118
|
+
nw: {
|
|
119
|
+
x: n - a - f,
|
|
120
|
+
y: t - o - f
|
|
121
|
+
},
|
|
122
|
+
ne: {
|
|
123
|
+
x: n + r,
|
|
124
|
+
y: t - o - f
|
|
125
|
+
},
|
|
126
|
+
se: {
|
|
127
|
+
x: n + r,
|
|
128
|
+
y: t + i
|
|
129
|
+
},
|
|
130
|
+
sw: {
|
|
131
|
+
x: n - a - f,
|
|
132
|
+
y: t + i
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
_closing = !1;
|
|
137
|
+
mouseout() {
|
|
138
|
+
this._closing = !0, this._tooltipElement.on("mouseover", () => {
|
|
139
|
+
this._closing = !1;
|
|
140
|
+
}), this._tooltipElement.on("mouseout", () => {
|
|
141
|
+
this.mouseout();
|
|
142
|
+
}), setTimeout(() => {
|
|
143
|
+
this._closing && this.visible(!1);
|
|
144
|
+
}, this.closeDelay());
|
|
145
|
+
}
|
|
146
|
+
visible(t) {
|
|
147
|
+
return arguments.length ? (this._arrowElement && (this._arrowElement.style("visibility", t ? "visible" : "hidden"), this._tooltipElement.style("visibility", t ? "visible" : "hidden")), super.visible(t), this) : super.visible();
|
|
148
|
+
}
|
|
149
|
+
exit(t, n) {
|
|
150
|
+
this._arrowElement && (this._arrowElement.remove(), this._tooltipElement.remove()), super.exit(t, n);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
HTMLTooltip.prototype._class += " html_HTMLTooltip", HTMLTooltip.prototype.publish("fitContent", !1, "boolean", "If true, tooltip will grow to fit its html content"), HTMLTooltip.prototype.publish("followCursor", !1, "boolean", "If true, tooltip will display relative to cursor location"), HTMLTooltip.prototype.publish("closeDelay", 400, "number", "Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)"), HTMLTooltip.prototype.publish("direction", "n", "set", "Direction in which to display the tooltip", [
|
|
154
|
+
"n",
|
|
155
|
+
"s",
|
|
156
|
+
"e",
|
|
157
|
+
"w",
|
|
158
|
+
"ne",
|
|
159
|
+
"nw",
|
|
160
|
+
"se",
|
|
161
|
+
"sw"
|
|
162
|
+
]), HTMLTooltip.prototype.publish("padding", 8, "number", "Padding (pixels)"), HTMLTooltip.prototype.publish("arrowWidth", 16, "number", "Width (or height depending on direction) of the tooltip arrow (pixels)"), HTMLTooltip.prototype.publish("arrowHeight", 8, "number", "Height (or width depending on direction) of the tooltip arrow (pixels)"), HTMLTooltip.prototype.publish("fontColor", "#FFF", "html-color", "The default font color for text in the tooltip"), HTMLTooltip.prototype.publish("tooltipColor", "#000000EE", "html-color", "Background color of the tooltip"), HTMLTooltip.prototype.publish("tooltipWidth", 200, "number", "Width of the tooltip (not including arrow) (pixels)"), HTMLTooltip.prototype.publish("tooltipHeight", 200, "number", "Height of the tooltip (not including arrow) (pixels)"), HTMLTooltip.prototype.publish("enablePointerEvents", !1, "boolean", "If true, the 'pointer-events: all' style will be used");
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/SimpleTable.ts
|
|
165
|
+
var SimpleTable = class extends t {
|
|
166
|
+
_table;
|
|
167
|
+
_tbody;
|
|
168
|
+
_thead;
|
|
169
|
+
_theadRow;
|
|
170
|
+
constructor() {
|
|
171
|
+
super();
|
|
172
|
+
}
|
|
173
|
+
transformData() {
|
|
174
|
+
return this.data();
|
|
175
|
+
}
|
|
176
|
+
enter(t, n) {
|
|
177
|
+
super.enter(t, n), this._table = n.append("table"), this._thead = this._table.append("thead"), this._theadRow = this._thead.append("tr"), this._tbody = this._table.append("tbody");
|
|
178
|
+
}
|
|
179
|
+
update(t, n) {
|
|
180
|
+
super.update(t, n), this._table.style("width", this.autoWidth() ? "auto" : "100%");
|
|
181
|
+
let i = this._theadRow.selectAll("th").data(this.columns());
|
|
182
|
+
i.enter().append("th").attr("class", (t, n) => `th-${n}`).merge(i).text((t) => t.toString()), i.exit().remove();
|
|
183
|
+
let a = this._tbody.selectAll("tr").data(this.transformData());
|
|
184
|
+
a.enter().append("tr").merge(a).each(function(t) {
|
|
185
|
+
let n = r(this).selectAll("td").data(t);
|
|
186
|
+
n.enter().append("td").attr("class", (t, n) => `col-${n}`).merge(n).text((t) => t.toString()), n.exit().remove();
|
|
187
|
+
}), a.exit().remove();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
SimpleTable.prototype._class += " html_SimpleTable", SimpleTable.prototype.publish("autoWidth", !1, "boolean", "If true, table width will be set to 'auto'. If false, the width is set to '100%'");
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/StyledTable.ts
|
|
193
|
+
var StyledTable = class extends SimpleTable {
|
|
194
|
+
constructor() {
|
|
195
|
+
super();
|
|
196
|
+
}
|
|
197
|
+
applyStyleObject(t, n) {
|
|
198
|
+
Object.keys(n).forEach((r) => {
|
|
199
|
+
t.style(r, n[r]);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
update(t, n) {
|
|
203
|
+
super.update(t, n), n.selectAll("tr,th,td").attr("style", "").style("font-family", this.fontFamily()).style("color", this.fontColor()), this.theadColumnStyles().forEach((t, r) => {
|
|
204
|
+
this.applyStyleObject(n.select(`.th-${r}`), t);
|
|
205
|
+
}), this.tbodyColumnStyles().forEach((t, r) => {
|
|
206
|
+
this.applyStyleObject(n.selectAll(`.col-${r}`), t);
|
|
207
|
+
});
|
|
208
|
+
let r = Object.keys(this.evenRowStyles()).length > 0, i = Object.keys(this.lastRowStyles()).length > 0, a = n.selectAll("tbody > tr");
|
|
209
|
+
if (r) {
|
|
210
|
+
let t = a.select(function(t, n) {
|
|
211
|
+
return n % 2 ? this : null;
|
|
212
|
+
});
|
|
213
|
+
this.applyStyleObject(t, this.evenRowStyles());
|
|
214
|
+
}
|
|
215
|
+
if (i) {
|
|
216
|
+
let t = a.select(function(t, n, r) {
|
|
217
|
+
return n === r.length - 1 ? this : null;
|
|
218
|
+
});
|
|
219
|
+
this.applyStyleObject(t, this.lastRowStyles());
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
StyledTable.prototype._class += " html_StyledTable", StyledTable.prototype.publish("fontFamily", "Verdana", "string", "Base font-family used within the table"), StyledTable.prototype.publish("fontColor", "#333", "string", "Base font color used within the table"), StyledTable.prototype.publish("theadColumnStyles", [], "array", "Array of objects containing styles for the thead columns (ex: [{\"color\":\"red\"},{\"color\":\"blue\"}])"), StyledTable.prototype.publish("tbodyColumnStyles", [], "array", "Array of objects containing styles for the tbody columns (ex: [{\"color\":\"red\"},{\"color\":\"blue\"}])"), StyledTable.prototype.publish("lastRowStyles", {}, "object", "Object containing styles for the last row (ex: {\"color\":\"red\"})"), StyledTable.prototype.publish("evenRowStyles", {}, "object", "Object containing styles for even rows (ex: {\"background-color\":\"#AAA\"})");
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/BreakdownTable.ts
|
|
226
|
+
var BreakdownTable = class extends StyledTable {
|
|
227
|
+
_tooltip;
|
|
228
|
+
constructor() {
|
|
229
|
+
super();
|
|
230
|
+
}
|
|
231
|
+
transformData() {
|
|
232
|
+
let t = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
|
|
233
|
+
return this.breakdownData(t);
|
|
234
|
+
}
|
|
235
|
+
breakdownData(t) {
|
|
236
|
+
let n = this.data().length, r = this.data().reduce((t, n) => t + n[1], 0), i = [], a = 0;
|
|
237
|
+
this.data().sort((t, n) => t[1] > n[1] ? -1 : 1);
|
|
238
|
+
let o = n - t > 0;
|
|
239
|
+
if (this.data().filter((n, r) => o ? r < t - 1 : !0).forEach((t) => {
|
|
240
|
+
let n = Math.round(t[1] / r * 100);
|
|
241
|
+
a += n, i.push([t[0], n + "%"]);
|
|
242
|
+
}), o) {
|
|
243
|
+
let r = `${this.otherLabel()} (${n - t + 1})`, o = "~" + (100 - a) + "%";
|
|
244
|
+
i.push([r, o]);
|
|
245
|
+
}
|
|
246
|
+
return i;
|
|
247
|
+
}
|
|
248
|
+
calculateRowCount() {
|
|
249
|
+
let t = this.columns().length > 0 ? this.thFontSize() + 5 : 0, n = this.fontSize() + 5, r = this.height() - t;
|
|
250
|
+
return Math.floor(r / n);
|
|
251
|
+
}
|
|
252
|
+
enter(t, n) {
|
|
253
|
+
super.enter(t, n), this._tooltip = new HTMLTooltip().target(t), this._tooltip.tooltipHTML((t) => {
|
|
254
|
+
let n = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount(), r = Math.max(...t.map((t) => this.textSize(t[0], this.fontFamily(), this.fontSize()).height)) ?? this.fontSize(), i = 2 * (Math.max(...t.map((t) => this.textSize(t[0], this.fontFamily(), this.fontSize()).width)) + 30) + this._tooltip.padding() * 2, a = r * Math.ceil((t.length - n) / 2) + this._tooltip.padding() * 2;
|
|
255
|
+
this._tooltip.tooltipWidth(i), this._tooltip.tooltipHeight(a);
|
|
256
|
+
let o = this.breakdownData(this.data().length).slice(n - 1);
|
|
257
|
+
return `<div style="
|
|
258
|
+
width: 100%;
|
|
259
|
+
height: 100%;
|
|
260
|
+
font-size: ${this.fontSize()}px;
|
|
261
|
+
">${o.map((t) => `<div style="
|
|
262
|
+
float:left;
|
|
263
|
+
width:49%;
|
|
264
|
+
">${t[0]}: ${t[1]}</div>`).join("")}</div>`;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
update(t, n) {
|
|
268
|
+
if (this.theadColumnStyles_default([{
|
|
269
|
+
color: this.thFirstColor(),
|
|
270
|
+
"font-size": this.thFontSize() + "px",
|
|
271
|
+
"font-weight": this.thFontWeight(),
|
|
272
|
+
"text-align": this.labelAlignment(),
|
|
273
|
+
width: "auto",
|
|
274
|
+
padding: "0px"
|
|
275
|
+
}, {
|
|
276
|
+
width: "1%",
|
|
277
|
+
"font-size": this.thFontSize() + "px",
|
|
278
|
+
"font-weight": this.thFontWeight(),
|
|
279
|
+
"text-align": this.percentageAlignment(),
|
|
280
|
+
padding: "0px"
|
|
281
|
+
}]), this.tbodyColumnStyles_default([{
|
|
282
|
+
color: this.topLabelColor(),
|
|
283
|
+
"font-size": this.fontSize() + "px",
|
|
284
|
+
"font-weight": "normal",
|
|
285
|
+
"text-align": this.labelAlignment(),
|
|
286
|
+
width: "auto",
|
|
287
|
+
padding: "0px"
|
|
288
|
+
}, {
|
|
289
|
+
color: this.topPercentageColor(),
|
|
290
|
+
"font-size": this.fontSize() + "px",
|
|
291
|
+
"font-weight": "normal",
|
|
292
|
+
"text-align": this.percentageAlignment(),
|
|
293
|
+
width: "1%",
|
|
294
|
+
padding: "0px"
|
|
295
|
+
}]), this.lastRowStyles_default([{
|
|
296
|
+
color: this.otherLabelColor(),
|
|
297
|
+
"font-size": this.fontSize() + "px",
|
|
298
|
+
"font-weight": this.otherLabelBold() ? "bold" : "normal",
|
|
299
|
+
"text-align": this.labelAlignment(),
|
|
300
|
+
width: "auto",
|
|
301
|
+
padding: "0px"
|
|
302
|
+
}, {
|
|
303
|
+
color: this.otherLabelColor(),
|
|
304
|
+
"font-size": this.fontSize() + "px",
|
|
305
|
+
"font-weight": this.otherPercentageBold() ? "bold" : "normal",
|
|
306
|
+
"text-align": this.percentageAlignment(),
|
|
307
|
+
width: "1%",
|
|
308
|
+
padding: "0px"
|
|
309
|
+
}]), super.update(t, n), (this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount()) < this.data().length) {
|
|
310
|
+
let t = n.select("tbody > tr:last-child"), r = this;
|
|
311
|
+
t.on("mouseout.tooltip", (n) => {
|
|
312
|
+
r._tooltip._triggerElement = t, r._tooltip.visible(!1).render();
|
|
313
|
+
}).on("mouseenter.tooltip", (n) => {
|
|
314
|
+
r._tooltip._triggerElement = t, r._tooltip.direction("n").data(r.data()).visible(!0).render();
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
BreakdownTable.prototype._class += " html_BreakdownTable", BreakdownTable.prototype.publish("useCalculatedRowCount", !0, "boolean", "If true, rowCount will be calculated and its default will be overwritten"), BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", void 0, { disable: (t) => t.useCalculatedRowCount() }), BreakdownTable.prototype.publish("fontSize", 14, "number", "Font size (pixels)"), BreakdownTable.prototype.publish("labelAlignment", "left", "set", "Alignment of the label column text", [
|
|
320
|
+
"left",
|
|
321
|
+
"center",
|
|
322
|
+
"right"
|
|
323
|
+
]), BreakdownTable.prototype.publish("percentageAlignment", "center", "set", "Alignment of the percentage column text", [
|
|
324
|
+
"left",
|
|
325
|
+
"center",
|
|
326
|
+
"right"
|
|
327
|
+
]), BreakdownTable.prototype.publish("topLabelColor", "#333", "html-color", "Color of displayed 'top' labels"), BreakdownTable.prototype.publish("topPercentageColor", "#1A99D5", "html-color", "Color of displayed 'top' percentages"), BreakdownTable.prototype.publish("topPercentageBold", !0, "html-color", "If true, the 'top' percentages will be bold"), BreakdownTable.prototype.publish("otherLabel", "Other", "string", "Label text for the 'other' row"), BreakdownTable.prototype.publish("otherLabelColor", "#AAA", "html-color", "Color of the 'other' label"), BreakdownTable.prototype.publish("otherLabelBold", !1, "html-color", "If true, the 'other' label will be bold"), BreakdownTable.prototype.publish("otherPercentageColor", "#AAA", "html-color", "Color of the 'other' percentage"), BreakdownTable.prototype.publish("otherPercentageBold", !1, "html-color", "If true, the 'other' percentage will be bold"), BreakdownTable.prototype.publish("thFontWeight", "bold", "string", "Font weight for th elements"), BreakdownTable.prototype.publish("thFontSize", 26, "number", "Font size for th elements"), BreakdownTable.prototype.publish("thFirstColor", "#333", "html-color", "Text color of the first th element"), BreakdownTable.prototype.publish("thLastColor", "#333", "html-color", "Text color of the last th element");
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/JSXWidget.ts
|
|
330
|
+
var JSXWidget = class extends t {
|
|
331
|
+
static Component = a.Component;
|
|
332
|
+
static createElement = a.createElement;
|
|
333
|
+
rootNode;
|
|
334
|
+
jsxRender(t, n) {
|
|
335
|
+
this.rootNode = a.render(t, n, this.rootNode);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
JSXWidget.prototype._class += " html_JSXWidget";
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/reactD3.ts
|
|
341
|
+
var VNode = class {
|
|
342
|
+
_attrs;
|
|
343
|
+
_children;
|
|
344
|
+
constructor(t, n) {
|
|
345
|
+
this._attrs = t, this._children = n;
|
|
346
|
+
}
|
|
347
|
+
type() {
|
|
348
|
+
return "div";
|
|
349
|
+
}
|
|
350
|
+
attrs() {
|
|
351
|
+
return this._attrs;
|
|
352
|
+
}
|
|
353
|
+
attr(t) {
|
|
354
|
+
return this._attrs[t];
|
|
355
|
+
}
|
|
356
|
+
children() {
|
|
357
|
+
return this._children;
|
|
358
|
+
}
|
|
359
|
+
update(t) {
|
|
360
|
+
for (let n in this._attrs) t.attr(n, this._attrs[n]);
|
|
361
|
+
}
|
|
362
|
+
render(t) {
|
|
363
|
+
let n = t.selectAll(`${t.node().tagName} > *`).data([this]);
|
|
364
|
+
return n.exit().remove(), n.enter().append(this.type()).attr("reactd3", 0).merge(n).each(function(t) {
|
|
365
|
+
let n = r(this);
|
|
366
|
+
t.update(n), t.renderChildren(n);
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
renderChildren(t) {
|
|
370
|
+
let n = t.selectAll(`${t.node().tagName} > *`).data(this._children);
|
|
371
|
+
return n.exit().remove(), n.enter().append((t) => document.createElement(t.type())).attr("reactd3", (t, n) => n).merge(n).each(function(t) {
|
|
372
|
+
let n = r(this);
|
|
373
|
+
t.update(n), t.renderChildren(n);
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}, ConstVNode = class extends VNode {
|
|
377
|
+
_type;
|
|
378
|
+
constructor(t, n, r) {
|
|
379
|
+
super(n, r), this._type = t;
|
|
380
|
+
}
|
|
381
|
+
type() {
|
|
382
|
+
return this._type;
|
|
383
|
+
}
|
|
384
|
+
}, TextVNode = class extends VNode {
|
|
385
|
+
_text;
|
|
386
|
+
constructor(t) {
|
|
387
|
+
super({}, []), this._text = t;
|
|
388
|
+
}
|
|
389
|
+
type() {
|
|
390
|
+
return "span";
|
|
391
|
+
}
|
|
392
|
+
update(t) {
|
|
393
|
+
super.update(t), t.text(this._text);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function isReactFn(t) {
|
|
397
|
+
return typeof t == "function";
|
|
398
|
+
}
|
|
399
|
+
function isIVNode(t) {
|
|
400
|
+
return t.prototype && t.prototype instanceof VNode;
|
|
401
|
+
}
|
|
402
|
+
var ReactD3 = class {
|
|
403
|
+
static createElement(t, n, ...r) {
|
|
404
|
+
return isIVNode(t) ? new t(n) : isReactFn(t) ? t(n) : new ConstVNode(t, n, r.map((t) => typeof t == "string" ? new TextVNode(t) : t));
|
|
405
|
+
}
|
|
406
|
+
static render(t, n) {
|
|
407
|
+
t.render(n);
|
|
408
|
+
}
|
|
409
|
+
}, l, d, f, p, h, g, e, _, v, y, w, k, M, F, R = {}, U = [], W = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Y = Array.isArray;
|
|
410
|
+
function m(t, n) {
|
|
411
|
+
for (var r in n) t[r] = n[r];
|
|
412
|
+
return t;
|
|
413
|
+
}
|
|
414
|
+
function b(t) {
|
|
415
|
+
t && t.parentNode && t.parentNode.removeChild(t);
|
|
416
|
+
}
|
|
417
|
+
function x(t, n, r, i, a) {
|
|
418
|
+
var o = {
|
|
419
|
+
type: t,
|
|
420
|
+
props: n,
|
|
421
|
+
key: r,
|
|
422
|
+
ref: i,
|
|
423
|
+
__k: null,
|
|
424
|
+
__: null,
|
|
425
|
+
__b: 0,
|
|
426
|
+
__e: null,
|
|
427
|
+
__c: null,
|
|
428
|
+
constructor: void 0,
|
|
429
|
+
__v: a ?? ++f,
|
|
430
|
+
__i: -1,
|
|
431
|
+
__u: 0
|
|
432
|
+
};
|
|
433
|
+
return a == null && d.vnode != null && d.vnode(o), o;
|
|
434
|
+
}
|
|
435
|
+
function S(t) {
|
|
436
|
+
return t.children;
|
|
437
|
+
}
|
|
438
|
+
function C(t, n) {
|
|
439
|
+
this.props = t, this.context = n;
|
|
440
|
+
}
|
|
441
|
+
function $(t, n) {
|
|
442
|
+
if (n == null) return t.__ ? $(t.__, t.__i + 1) : null;
|
|
443
|
+
for (var r; n < t.__k.length; n++) if ((r = t.__k[n]) != null && r.__e != null) return r.__e;
|
|
444
|
+
return typeof t.type == "function" ? $(t) : null;
|
|
445
|
+
}
|
|
446
|
+
function I(t) {
|
|
447
|
+
if (t.__P && t.__d) {
|
|
448
|
+
var n = t.__v, r = n.__e, i = [], a = [], o = m({}, n);
|
|
449
|
+
o.__v = n.__v + 1, d.vnode && d.vnode(o), q(t.__P, o, n, t.__n, t.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? $(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, D(i, o, a), n.__e = n.__ = null, o.__e != r && P(o);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function P(t) {
|
|
453
|
+
if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(n) {
|
|
454
|
+
if (n != null && n.__e != null) return t.__e = t.__c.base = n.__e;
|
|
455
|
+
}), P(t);
|
|
456
|
+
}
|
|
457
|
+
function A(t) {
|
|
458
|
+
(!t.__d && (t.__d = !0) && p.push(t) && !H.__r++ || h != d.debounceRendering) && ((h = d.debounceRendering) || g)(H);
|
|
459
|
+
}
|
|
460
|
+
function H() {
|
|
461
|
+
try {
|
|
462
|
+
for (var t, n = 1; p.length;) p.length > n && p.sort(e), t = p.shift(), n = p.length, I(t);
|
|
463
|
+
} finally {
|
|
464
|
+
p.length = H.__r = 0;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function L(t, n, r, i, a, o, s, c, l, d, f) {
|
|
468
|
+
var p, h, g, _, v, y, w, k = i && i.__k || U, M = n.length;
|
|
469
|
+
for (l = T(r, n, k, l, M), p = 0; p < M; p++) (g = r.__k[p]) != null && (h = g.__i != -1 && k[g.__i] || R, g.__i = p, y = q(t, g, h, a, o, s, c, l, d, f), _ = g.__e, g.ref && h.ref != g.ref && (h.ref && J(h.ref, null, g), f.push(g.ref, g.__c || _, g)), v == null && _ != null && (v = _), (w = !!(4 & g.__u)) || h.__k === g.__k ? (l = j(g, l, t, w), w && h.__e && (h.__e = null)) : typeof g.type == "function" && y !== void 0 ? l = y : _ && (l = _.nextSibling), g.__u &= -7);
|
|
470
|
+
return r.__e = v, l;
|
|
471
|
+
}
|
|
472
|
+
function T(t, n, r, i, a) {
|
|
473
|
+
var o, s, c, l, d, f = r.length, p = f, h = 0;
|
|
474
|
+
for (t.__k = Array(a), o = 0; o < a; o++) (s = n[o]) != null && typeof s != "boolean" && typeof s != "function" ? (typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? s = t.__k[o] = x(null, s, null, null, null) : Y(s) ? s = t.__k[o] = x(S, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? s = t.__k[o] = x(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : t.__k[o] = s, l = o + h, s.__ = t, s.__b = t.__b + 1, c = null, (d = s.__i = O(s, r, l, p)) != -1 && (p--, (c = r[d]) && (c.__u |= 2)), c == null || c.__v == null ? (d == -1 && (a > f ? h-- : a < f && h++), typeof s.type != "function" && (s.__u |= 4)) : d != l && (d == l - 1 ? h-- : d == l + 1 ? h++ : (d > l ? h-- : h++, s.__u |= 4))) : t.__k[o] = null;
|
|
475
|
+
if (p) for (o = 0; o < f; o++) (c = r[o]) != null && !(2 & c.__u) && (c.__e == i && (i = $(c)), K(c, c));
|
|
476
|
+
return i;
|
|
477
|
+
}
|
|
478
|
+
function j(t, n, r, i) {
|
|
479
|
+
var a, o;
|
|
480
|
+
if (typeof t.type == "function") {
|
|
481
|
+
for (a = t.__k, o = 0; a && o < a.length; o++) a[o] && (a[o].__ = t, n = j(a[o], n, r, i));
|
|
482
|
+
return n;
|
|
483
|
+
}
|
|
484
|
+
t.__e != n && (i && (n && t.type && !n.parentNode && (n = $(t)), r.insertBefore(t.__e, n || null)), n = t.__e);
|
|
485
|
+
do
|
|
486
|
+
n &&= n.nextSibling;
|
|
487
|
+
while (n != null && n.nodeType == 8);
|
|
488
|
+
return n;
|
|
489
|
+
}
|
|
490
|
+
function O(t, n, r, i) {
|
|
491
|
+
var a, o, s, c = t.key, l = t.type, d = n[r], f = d != null && (2 & d.__u) == 0;
|
|
492
|
+
if (d === null && c == null || f && c == d.key && l == d.type) return r;
|
|
493
|
+
if (i > +!!f) {
|
|
494
|
+
for (a = r - 1, o = r + 1; a >= 0 || o < n.length;) if ((d = n[s = a >= 0 ? a-- : o++]) != null && !(2 & d.__u) && c == d.key && l == d.type) return s;
|
|
495
|
+
}
|
|
496
|
+
return -1;
|
|
497
|
+
}
|
|
498
|
+
function z(t, n, r) {
|
|
499
|
+
n[0] == "-" ? t.setProperty(n, r ?? "") : t[n] = r == null ? "" : typeof r != "number" || W.test(n) ? r : r + "px";
|
|
500
|
+
}
|
|
501
|
+
function N(t, n, r, i, a) {
|
|
502
|
+
var o, s;
|
|
503
|
+
n: if (n == "style") if (typeof r == "string") t.style.cssText = r;
|
|
504
|
+
else {
|
|
505
|
+
if (typeof i == "string" && (t.style.cssText = i = ""), i) for (n in i) r && n in r || z(t.style, n, "");
|
|
506
|
+
if (r) for (n in r) i && r[n] == i[n] || z(t.style, n, r[n]);
|
|
507
|
+
}
|
|
508
|
+
else if (n[0] == "o" && n[1] == "n") o = n != (n = n.replace(w, "$1")), s = n.toLowerCase(), n = s in t || n == "onFocusOut" || n == "onFocusIn" ? s.slice(2) : n.slice(2), t.l ||= {}, t.l[n + o] = r, r ? i ? r[y] = i[y] : (r[y] = k, t.addEventListener(n, o ? F : M, o)) : t.removeEventListener(n, o ? F : M, o);
|
|
509
|
+
else {
|
|
510
|
+
if (a == "http://www.w3.org/2000/svg") n = n.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
511
|
+
else if (n != "width" && n != "height" && n != "href" && n != "list" && n != "form" && n != "tabIndex" && n != "download" && n != "rowSpan" && n != "colSpan" && n != "role" && n != "popover" && n in t) try {
|
|
512
|
+
t[n] = r ?? "";
|
|
513
|
+
break n;
|
|
514
|
+
} catch {}
|
|
515
|
+
typeof r == "function" || (r == null || !1 === r && n[4] != "-" ? t.removeAttribute(n) : t.setAttribute(n, n == "popover" && r == 1 ? "" : r));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function V(t) {
|
|
519
|
+
return function(n) {
|
|
520
|
+
if (this.l) {
|
|
521
|
+
var r = this.l[n.type + t];
|
|
522
|
+
if (n[v] == null) n[v] = k++;
|
|
523
|
+
else if (n[v] < r[y]) return;
|
|
524
|
+
return r(d.event ? d.event(n) : n);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function q(t, n, r, i, a, o, s, c, l, f) {
|
|
529
|
+
var p, h, g, _, v, y, w, k, M, F, R, W, ee, X, te, Z = n.type;
|
|
530
|
+
if (n.constructor !== void 0) return null;
|
|
531
|
+
128 & r.__u && (l = !!(32 & r.__u), o = [c = n.__e = r.__e]), (p = d.__b) && p(n);
|
|
532
|
+
n: if (typeof Z == "function") try {
|
|
533
|
+
if (k = n.props, M = Z.prototype && Z.prototype.render, F = (p = Z.contextType) && i[p.__c], R = p ? F ? F.props.value : p.__ : i, r.__c ? w = (h = n.__c = r.__c).__ = h.__E : (M ? n.__c = h = new Z(k, R) : (n.__c = h = new C(k, R), h.constructor = Z, h.render = Q), F && F.sub(h), h.state ||= {}, h.__n = i, g = h.__d = !0, h.__h = [], h._sb = []), M && h.__s == null && (h.__s = h.state), M && Z.getDerivedStateFromProps != null && (h.__s == h.state && (h.__s = m({}, h.__s)), m(h.__s, Z.getDerivedStateFromProps(k, h.__s))), _ = h.props, v = h.state, h.__v = n, g) M && Z.getDerivedStateFromProps == null && h.componentWillMount != null && h.componentWillMount(), M && h.componentDidMount != null && h.__h.push(h.componentDidMount);
|
|
534
|
+
else {
|
|
535
|
+
if (M && Z.getDerivedStateFromProps == null && k !== _ && h.componentWillReceiveProps != null && h.componentWillReceiveProps(k, R), n.__v == r.__v || !h.__e && h.shouldComponentUpdate != null && !1 === h.shouldComponentUpdate(k, h.__s, R)) {
|
|
536
|
+
n.__v != r.__v && (h.props = k, h.state = h.__s, h.__d = !1), n.__e = r.__e, n.__k = r.__k, n.__k.some(function(t) {
|
|
537
|
+
t && (t.__ = n);
|
|
538
|
+
}), U.push.apply(h.__h, h._sb), h._sb = [], h.__h.length && s.push(h);
|
|
539
|
+
break n;
|
|
540
|
+
}
|
|
541
|
+
h.componentWillUpdate != null && h.componentWillUpdate(k, h.__s, R), M && h.componentDidUpdate != null && h.__h.push(function() {
|
|
542
|
+
h.componentDidUpdate(_, v, y);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
if (h.context = R, h.props = k, h.__P = t, h.__e = !1, W = d.__r, ee = 0, M) h.state = h.__s, h.__d = !1, W && W(n), p = h.render(h.props, h.state, h.context), U.push.apply(h.__h, h._sb), h._sb = [];
|
|
546
|
+
else do
|
|
547
|
+
h.__d = !1, W && W(n), p = h.render(h.props, h.state, h.context), h.state = h.__s;
|
|
548
|
+
while (h.__d && ++ee < 25);
|
|
549
|
+
h.state = h.__s, h.getChildContext != null && (i = m(m({}, i), h.getChildContext())), M && !g && h.getSnapshotBeforeUpdate != null && (y = h.getSnapshotBeforeUpdate(_, v)), X = p != null && p.type === S && p.key == null ? E(p.props.children) : p, c = L(t, Y(X) ? X : [X], n, r, i, a, o, s, c, l, f), h.base = n.__e, n.__u &= -161, h.__h.length && s.push(h), w && (h.__E = h.__ = null);
|
|
550
|
+
} catch (t) {
|
|
551
|
+
if (n.__v = null, l || o != null) if (t.then) {
|
|
552
|
+
for (n.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
|
|
553
|
+
o[o.indexOf(c)] = null, n.__e = c;
|
|
554
|
+
} else {
|
|
555
|
+
for (te = o.length; te--;) b(o[te]);
|
|
556
|
+
B(n);
|
|
557
|
+
}
|
|
558
|
+
else n.__e = r.__e, n.__k = r.__k, t.then || B(n);
|
|
559
|
+
d.__e(t, n, r);
|
|
560
|
+
}
|
|
561
|
+
else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e = G(r.__e, n, r, i, a, o, s, l, f);
|
|
562
|
+
return (p = d.diffed) && p(n), 128 & n.__u ? void 0 : c;
|
|
563
|
+
}
|
|
564
|
+
function B(t) {
|
|
565
|
+
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(B));
|
|
566
|
+
}
|
|
567
|
+
function D(t, n, r) {
|
|
568
|
+
for (var i = 0; i < r.length; i++) J(r[i], r[++i], r[++i]);
|
|
569
|
+
d.__c && d.__c(n, t), t.some(function(n) {
|
|
570
|
+
try {
|
|
571
|
+
t = n.__h, n.__h = [], t.some(function(t) {
|
|
572
|
+
t.call(n);
|
|
573
|
+
});
|
|
574
|
+
} catch (t) {
|
|
575
|
+
d.__e(t, n.__v);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
function E(t) {
|
|
580
|
+
return typeof t != "object" || !t || t.__b > 0 ? t : Y(t) ? t.map(E) : t.constructor === void 0 ? m({}, t) : null;
|
|
581
|
+
}
|
|
582
|
+
function G(t, n, r, i, a, o, s, c, f) {
|
|
583
|
+
var p, h, g, _, v, y, w, k = r.props || R, M = n.props, F = n.type;
|
|
584
|
+
if (F == "svg" ? a = "http://www.w3.org/2000/svg" : F == "math" ? a = "http://www.w3.org/1998/Math/MathML" : a ||= "http://www.w3.org/1999/xhtml", o != null) {
|
|
585
|
+
for (p = 0; p < o.length; p++) if ((v = o[p]) && "setAttribute" in v == !!F && (F ? v.localName == F : v.nodeType == 3)) {
|
|
586
|
+
t = v, o[p] = null;
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (t == null) {
|
|
591
|
+
if (F == null) return document.createTextNode(M);
|
|
592
|
+
t = document.createElementNS(a, F, M.is && M), c &&= (d.__m && d.__m(n, o), !1), o = null;
|
|
593
|
+
}
|
|
594
|
+
if (F == null) k === M || c && t.data == M || (t.data = M);
|
|
595
|
+
else {
|
|
596
|
+
if (o = F == "textarea" && M.defaultValue != null ? null : o && l.call(t.childNodes), !c && o != null) for (k = {}, p = 0; p < t.attributes.length; p++) k[(v = t.attributes[p]).name] = v.value;
|
|
597
|
+
for (p in k) v = k[p], p == "dangerouslySetInnerHTML" ? g = v : p == "children" || p in M || p == "value" && "defaultValue" in M || p == "checked" && "defaultChecked" in M || N(t, p, null, v, a);
|
|
598
|
+
for (p in M) v = M[p], p == "children" ? _ = v : p == "dangerouslySetInnerHTML" ? h = v : p == "value" ? y = v : p == "checked" ? w = v : c && typeof v != "function" || k[p] === v || N(t, p, v, k[p], a);
|
|
599
|
+
if (h) c || g && (h.__html == g.__html || h.__html == t.innerHTML) || (t.innerHTML = h.__html), n.__k = [];
|
|
600
|
+
else if (g && (t.innerHTML = ""), L(n.type == "template" ? t.content : t, Y(_) ? _ : [_], n, r, i, F == "foreignObject" ? "http://www.w3.org/1999/xhtml" : a, o, s, o ? o[0] : r.__k && $(r, 0), c, f), o != null) for (p = o.length; p--;) b(o[p]);
|
|
601
|
+
c && F != "textarea" || (p = "value", F == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || F == "progress" && !y || F == "option" && y != k[p]) && N(t, p, y, k[p], a), p = "checked", w != null && w != t[p] && N(t, p, w, k[p], a));
|
|
602
|
+
}
|
|
603
|
+
return t;
|
|
604
|
+
}
|
|
605
|
+
function J(t, n, r) {
|
|
606
|
+
try {
|
|
607
|
+
if (typeof t == "function") {
|
|
608
|
+
var i = typeof t.__u == "function";
|
|
609
|
+
i && t.__u(), i && n == null || (t.__u = t(n));
|
|
610
|
+
} else t.current = n;
|
|
611
|
+
} catch (t) {
|
|
612
|
+
d.__e(t, r);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function K(t, n, r) {
|
|
616
|
+
var i, a;
|
|
617
|
+
if (d.unmount && d.unmount(t), (i = t.ref) && (i.current && i.current != t.__e || J(i, null, n)), (i = t.__c) != null) {
|
|
618
|
+
if (i.componentWillUnmount) try {
|
|
619
|
+
i.componentWillUnmount();
|
|
620
|
+
} catch (t) {
|
|
621
|
+
d.__e(t, n);
|
|
622
|
+
}
|
|
623
|
+
i.base = i.__P = null;
|
|
624
|
+
}
|
|
625
|
+
if (i = t.__k) for (a = 0; a < i.length; a++) i[a] && K(i[a], n, r || typeof t.type != "function");
|
|
626
|
+
r || b(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
627
|
+
}
|
|
628
|
+
function Q(t, n, r) {
|
|
629
|
+
return this.constructor(t, r);
|
|
630
|
+
}
|
|
631
|
+
l = U.slice, d = { __e: function(t, n, r, i) {
|
|
632
|
+
for (var a, o, s; n = n.__;) if ((a = n.__c) && !a.__) try {
|
|
633
|
+
if ((o = a.constructor) && o.getDerivedStateFromError != null && (a.setState(o.getDerivedStateFromError(t)), s = a.__d), a.componentDidCatch != null && (a.componentDidCatch(t, i || {}), s = a.__d), s) return a.__E = a;
|
|
634
|
+
} catch (n) {
|
|
635
|
+
t = n;
|
|
636
|
+
}
|
|
637
|
+
throw t;
|
|
638
|
+
} }, f = 0, C.prototype.setState = function(t, n) {
|
|
639
|
+
var r = this.__s != null && this.__s != this.state ? this.__s : this.__s = m({}, this.state);
|
|
640
|
+
typeof t == "function" && (t = t(m({}, r), this.props)), t && m(r, t), t != null && this.__v && (n && this._sb.push(n), A(this));
|
|
641
|
+
}, C.prototype.forceUpdate = function(t) {
|
|
642
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), A(this));
|
|
643
|
+
}, C.prototype.render = S, p = [], g = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(t, n) {
|
|
644
|
+
return t.__v.__b - n.__v.__b;
|
|
645
|
+
}, H.__r = 0, _ = Math.random().toString(8), v = "__d" + _, y = "__a" + _, w = /(PointerCapture)$|Capture$/i, k = 0, M = V(!1), F = V(!0);
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region ../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
648
|
+
var ee = 0;
|
|
649
|
+
Array.isArray;
|
|
650
|
+
function u(t, n, r, i, a, o) {
|
|
651
|
+
n ||= {};
|
|
652
|
+
var s, c, l = n;
|
|
653
|
+
if ("ref" in l) for (c in l = {}, n) c == "ref" ? s = n[c] : l[c] = n[c];
|
|
654
|
+
var f = {
|
|
655
|
+
type: t,
|
|
656
|
+
props: l,
|
|
657
|
+
key: r,
|
|
658
|
+
ref: s,
|
|
659
|
+
__k: null,
|
|
660
|
+
__: null,
|
|
661
|
+
__b: 0,
|
|
662
|
+
__e: null,
|
|
663
|
+
__c: null,
|
|
664
|
+
constructor: void 0,
|
|
665
|
+
__v: --ee,
|
|
666
|
+
__i: -1,
|
|
667
|
+
__u: 0,
|
|
668
|
+
__source: a,
|
|
669
|
+
__self: o
|
|
670
|
+
};
|
|
671
|
+
if (typeof t == "function" && (s = t.defaultProps)) for (c in s) l[c] === void 0 && (l[c] = s[c]);
|
|
672
|
+
return d.vnode && d.vnode(f), f;
|
|
673
|
+
}
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region src/VizComponent.tsx
|
|
676
|
+
var VizComponent = class extends JSXWidget.Component {
|
|
677
|
+
widget;
|
|
678
|
+
refreshProps() {
|
|
679
|
+
for (let t in this.props) this.widget[t] && typeof this.widget[t] == "function" && this.widget[t](this.props[t]);
|
|
680
|
+
}
|
|
681
|
+
componentDidMount() {
|
|
682
|
+
this.widget = new this.props.type().target(this.base), this.refreshProps(), this.widget.render();
|
|
683
|
+
}
|
|
684
|
+
componentWillUnmount() {
|
|
685
|
+
this.widget.target(null).render();
|
|
686
|
+
}
|
|
687
|
+
render() {
|
|
688
|
+
return /* @__PURE__ */ u("div", { style: this.props.style });
|
|
689
|
+
}
|
|
690
|
+
componentDidUpdate() {
|
|
691
|
+
this.refreshProps(), this.widget.render();
|
|
692
|
+
}
|
|
693
|
+
}, VizInstance = class extends JSXWidget.Component {
|
|
694
|
+
widget;
|
|
695
|
+
refreshProps() {
|
|
696
|
+
for (let t in this.props) this.widget[t] && typeof this.widget[t] == "function" && this.widget[t](this.props[t]);
|
|
697
|
+
}
|
|
698
|
+
componentDidMount() {
|
|
699
|
+
this.widget = this.props.instance.target(this.base), this.refreshProps(), this.widget.render();
|
|
700
|
+
}
|
|
701
|
+
componentWillUnmount() {
|
|
702
|
+
this.widget.target(null).render();
|
|
703
|
+
}
|
|
704
|
+
render() {
|
|
705
|
+
return /* @__PURE__ */ u("div", { style: this.props.style });
|
|
706
|
+
}
|
|
707
|
+
componentDidUpdate() {
|
|
708
|
+
this.refreshProps(), this.widget.render();
|
|
709
|
+
}
|
|
710
|
+
}, StatsTable = class extends StyledTable {
|
|
711
|
+
transformData() {
|
|
712
|
+
let t = [[
|
|
713
|
+
"Total",
|
|
714
|
+
0,
|
|
715
|
+
0
|
|
716
|
+
]], r = this.data();
|
|
717
|
+
return r.forEach((n) => {
|
|
718
|
+
t[0][1] += n[1], t[0][2] += n[2];
|
|
719
|
+
}), r.concat(t).map((t) => [
|
|
720
|
+
t[0],
|
|
721
|
+
this.secondColumnFormat_exists() ? n(this.secondColumnFormat())(t[1]) : t[1],
|
|
722
|
+
this.thirdColumnFormat_exists() ? n(this.thirdColumnFormat())(t[2]) : t[2]
|
|
723
|
+
]);
|
|
724
|
+
}
|
|
725
|
+
update(t, n) {
|
|
726
|
+
this.tbodyColumnStyles_default([
|
|
727
|
+
{
|
|
728
|
+
"font-weight": "bold",
|
|
729
|
+
width: this.firstColumnWidth(),
|
|
730
|
+
"text-align": "left"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
width: this.secondColumnWidth(),
|
|
734
|
+
"text-align": "right"
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
width: this.thirdColumnWidth(),
|
|
738
|
+
"text-align": "right"
|
|
739
|
+
}
|
|
740
|
+
]), this.evenRowStyles_default([
|
|
741
|
+
{
|
|
742
|
+
"font-weight": "bold",
|
|
743
|
+
width: this.firstColumnWidth(),
|
|
744
|
+
"text-align": "left",
|
|
745
|
+
"font-color": this.evenRowFontColor(),
|
|
746
|
+
"background-color": this.evenRowBackgroundColor()
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
width: this.secondColumnWidth(),
|
|
750
|
+
"text-align": "right",
|
|
751
|
+
"font-color": this.evenRowFontColor(),
|
|
752
|
+
"background-color": this.evenRowBackgroundColor()
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
width: this.thirdColumnWidth(),
|
|
756
|
+
"text-align": "right",
|
|
757
|
+
"font-color": this.evenRowFontColor(),
|
|
758
|
+
"background-color": this.evenRowBackgroundColor()
|
|
759
|
+
}
|
|
760
|
+
]), this.lastRowStyles_default({ "font-weight": "bold" }), super.update(t, n);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
StatsTable.prototype._class += " html_StatsTable", StatsTable.prototype.publish("labelColor", "#333", "html-color", "Color of the text in the first column"), StatsTable.prototype.publish("primaryValueColor", "#333", "html-color", "Color of the text in the second column"), StatsTable.prototype.publish("secondaryValueColor", "#333", "html-color", "Color of the text in the third column"), StatsTable.prototype.publish("evenRowBackgroundColor", "#333", "html-color", "Background color of the even rows"), StatsTable.prototype.publish("evenRowFontColor", "#333", "html-color", "Font color of the even rows"), StatsTable.prototype.publish("firstColumnWidth", "auto", "string", "CSS style applied as the 'width' for the first column (ex: 40px)"), StatsTable.prototype.publish("secondColumnWidth", "1%", "string", "CSS style applied as the 'width' for the second column (ex: 40px)"), StatsTable.prototype.publish("thirdColumnWidth", "1%", "string", "CSS style applied as the 'width' for the third column (ex: 40px)"), StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", void 0, { optional: !0 }), StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", void 0, { optional: !0 });
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/TitleBar.ts
|
|
766
|
+
var Item = class extends t {
|
|
767
|
+
_owner;
|
|
768
|
+
constructor(t) {
|
|
769
|
+
super(), this._owner = t, this._tag = "a";
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
Item.prototype._class += " html_Item";
|
|
773
|
+
var Button = class extends Item {
|
|
774
|
+
_icon;
|
|
775
|
+
constructor(t, n) {
|
|
776
|
+
super(t), this._icon = n;
|
|
777
|
+
}
|
|
778
|
+
icon() {
|
|
779
|
+
return this._icon;
|
|
780
|
+
}
|
|
781
|
+
enter(t, n) {
|
|
782
|
+
super.enter(t, n), n.attr("href", "#").on("click", (t, n, r) => this._owner.titleBarClick(this, t, n, r)).append("i").attr("class", `fa ${this._icon} fa-lg fa-fw`);
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
Button.prototype._class += " html_Button";
|
|
786
|
+
var ToggleButton = class extends Button {
|
|
787
|
+
enter(t, n) {
|
|
788
|
+
n.on("click.sel", (t, n, r) => {
|
|
789
|
+
this.selected(!this.selected()), this.render();
|
|
790
|
+
}), super.enter(t, n);
|
|
791
|
+
}
|
|
792
|
+
update(t, n) {
|
|
793
|
+
super.update(t, n), this._element.classed("selected", this.selected());
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
ToggleButton.prototype._class += " html_ToggleButton", ToggleButton.prototype.publish("selected", !1, "boolean");
|
|
797
|
+
var Spacer = class extends Item {
|
|
798
|
+
enter(t, n) {
|
|
799
|
+
super.enter(t, n), n.attr("class", "spacer").attr("href", "#").append("i");
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
Spacer.prototype._class += " html_Spacer";
|
|
803
|
+
var TitleBar = class extends JSXWidget {
|
|
804
|
+
_divMain;
|
|
805
|
+
_divIconBar;
|
|
806
|
+
_divTitle;
|
|
807
|
+
constructor() {
|
|
808
|
+
super();
|
|
809
|
+
}
|
|
810
|
+
enter(t, n) {
|
|
811
|
+
super.enter(t, n), this._divMain = n.append("div").attr("class", "main"), this._divIconBar = this._divMain.append("div").attr("class", "icon-bar"), this._divTitle = this._divMain.append("div").attr("class", "title");
|
|
812
|
+
}
|
|
813
|
+
update(t, n) {
|
|
814
|
+
super.update(t, n), this._divTitle.text(this.title());
|
|
815
|
+
let r = this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());
|
|
816
|
+
r.enter().append("div").attr("class", "icon-bar-item").each(function(t) {
|
|
817
|
+
t.target(this);
|
|
818
|
+
}).merge(r).each(function(t) {
|
|
819
|
+
t.render();
|
|
820
|
+
}), r.exit().each(function(t) {
|
|
821
|
+
t.target(null);
|
|
822
|
+
}).remove(), r.order();
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
TitleBar.prototype._class += " html_TitleBar", TitleBar.prototype.publish("title", "", "string"), TitleBar.prototype.publish("buttons", [], "widgetArray");
|
|
826
|
+
//#endregion
|
|
827
|
+
export { c as BUILD_VERSION, BreakdownTable, Button, HTMLTooltip, Item, JSXWidget, o as PKG_NAME, s as PKG_VERSION, ReactD3, SimpleTable, Spacer, StatsTable, StyledTable, TitleBar, ToggleButton, VNode, VizComponent, VizInstance };
|
|
828
|
+
|
|
4
829
|
//# sourceMappingURL=index.js.map
|
|
5
|
-
|
|
830
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`#wrap{width:100%}#left,#right{padding:5px}#left{text-align:left;text-overflow:ellipsis;white-space:nowrap;background-color:red;display:block;overflow:hidden}#right{float:right;text-align:right;white-space:nowrap;background-color:orange}.html_TitleBar>.main{width:100%;display:block}.html_TitleBar .title{text-align:left;text-overflow:ellipsis;white-space:nowrap;padding:4px;font-size:20px;font-weight:700;display:block;overflow:hidden}.html_TitleBar .icon-bar{float:right;text-align:right;white-space:nowrap;padding:4px;line-height:28px}.html_TitleBar .icon-bar-item,.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{text-align:center;color:#a9a9a9;padding-top:4px;padding-bottom:4px;transition:all .3s}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{text-align:center;color:none;padding-top:2px;padding-bottom:0;padding-left:8px}.html_TitleBar .icon-bar a.spacer:hover{background-color:#0000}.html_TitleBar .icon-bar .active{background-color:#4caf50}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|