billboard.js 3.17.2 → 3.17.4
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/billboard.css +1 -1
- package/dist/billboard.js +33 -15
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +12 -12
- package/dist/billboard.pkgd.js +2143 -1618
- package/dist/billboard.pkgd.min.js +20 -18
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +24 -4
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +24 -4
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +26 -8
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +24 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2168 -1661
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -6
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2186 -1659
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -8
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2195 -1668
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -10
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2190 -1665
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -9
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2189 -1662
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -8
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +37 -16
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +37 -6
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +3 -3
- package/src/ChartInternal/internals/color.ts +4 -6
- package/src/ChartInternal/internals/legend.ts +2 -1
- package/src/ChartInternal/internals/tooltip.ts +2 -2
- package/src/ChartInternal/shape/point.common.ts +4 -4
- package/src/Plugin/tableview/index.ts +2 -5
- package/src/module/util.ts +35 -6
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.17.
|
|
8
|
+
* @version 3.17.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -206,8 +206,28 @@ function endall(transition, cb) {
|
|
|
206
206
|
transition.call(end);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
210
|
+
const sanitizeRx = {
|
|
211
|
+
tags: new RegExp(
|
|
212
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
213
|
+
"gi"
|
|
214
|
+
),
|
|
215
|
+
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
216
|
+
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
217
|
+
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
218
|
+
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
219
|
+
};
|
|
209
220
|
function sanitize(str) {
|
|
210
|
-
|
|
221
|
+
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
222
|
+
return str;
|
|
223
|
+
}
|
|
224
|
+
let result = str;
|
|
225
|
+
let prev;
|
|
226
|
+
do {
|
|
227
|
+
prev = result;
|
|
228
|
+
result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
|
|
229
|
+
} while (result !== prev);
|
|
230
|
+
return result;
|
|
211
231
|
}
|
|
212
232
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
213
233
|
if (!node || !isString(text)) {
|
|
@@ -519,7 +539,7 @@ function tplProcess(tpl, data) {
|
|
|
519
539
|
for (const x in data) {
|
|
520
540
|
res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
|
|
521
541
|
}
|
|
522
|
-
return res;
|
|
542
|
+
return sanitize(res);
|
|
523
543
|
}
|
|
524
544
|
function parseDate(date) {
|
|
525
545
|
var _a;
|
|
@@ -679,7 +699,7 @@ class Plugin {
|
|
|
679
699
|
});
|
|
680
700
|
}
|
|
681
701
|
}
|
|
682
|
-
__publicField(Plugin, "version", "3.17.
|
|
702
|
+
__publicField(Plugin, "version", "3.17.4");
|
|
683
703
|
|
|
684
704
|
;// ./src/Plugin/textoverlap/Options.ts
|
|
685
705
|
class Options {
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.17.
|
|
8
|
+
* @version 3.17.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(l,u){typeof exports=="object"&&typeof module=="object"?module.exports=u(require("d3-delaunay"),require("d3-polygon"),require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-delaunay","d3-polygon","d3-brush","d3-selection"],u):typeof exports=="object"?exports.bb=u(require("d3-delaunay"),require("d3-polygon"),require("d3-brush"),require("d3-selection")):(l.bb=l.bb||{},l.bb.plugin=l.bb.plugin||{},l.bb.plugin.textoverlap=u(l.d3,l.d3,l.d3,l.d3))})(this,function(
|
|
12
|
-
`)===-1)e.text(t);else{const r=[e.text(),t].map(
|
|
13
|
-
`),
|
|
11
|
+
*/(function(l,u){typeof exports=="object"&&typeof module=="object"?module.exports=u(require("d3-delaunay"),require("d3-polygon"),require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-delaunay","d3-polygon","d3-brush","d3-selection"],u):typeof exports=="object"?exports.bb=u(require("d3-delaunay"),require("d3-polygon"),require("d3-brush"),require("d3-selection")):(l.bb=l.bb||{},l.bb.plugin=l.bb.plugin||{},l.bb.plugin.textoverlap=u(l.d3,l.d3,l.d3,l.d3))})(this,function(O,l,u,q){return(function(){"use strict";var I={263:(function(e){e.exports=l}),348:(function(e){e.exports=O}),747:(function(e){e.exports=q}),853:(function(e){e.exports=u})},P={};function a(e){var t=P[e];if(t!==void 0)return t.exports;var n=P[e]={exports:{}};return I[e](n,n.exports,a),n.exports}(function(){a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var b={};a.d(b,{default:function(){return ae}});var B=a(348),E=a(263),_e=a(853),ge=a(747);function F(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function N(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",o=s=>setTimeout(s,1),r=s=>clearTimeout(s);return[t?e.requestAnimationFrame:o,t?e.cancelAnimationFrame:r,n?e.requestIdleCallback:o,n?e.cancelIdleCallback:r]}const m=F(),V=m==null?void 0:m.document,[ye,xe,ve,we]=N(m);var U=Object.defineProperty,$=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,j=(e,t,n)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))X.call(t,n)&&j(e,n,t[n]);if($)for(var n of $(t))Y.call(t,n)&&j(e,n,t[n]);return e};const Oe=e=>e||e===0,L=e=>typeof e=="function",f=e=>typeof e=="string",_=e=>typeof e=="number",z=e=>typeof e=="undefined",A=e=>typeof e!="undefined",Pe=e=>typeof e=="boolean",Ee=e=>Math.ceil(e/10)*10,$e=e=>Math.ceil(e)+.5,je=e=>e[1]-e[0],g=e=>typeof e=="object",G=e=>{for(const t in e)return!1;return!0},H=e=>z(e)||e===null||f(e)&&e.length===0||g(e)&&!(e instanceof Date)&&G(e)||_(e)&&isNaN(e),k=e=>!H(e),y=e=>Array.isArray(e),p=e=>e&&!(e!=null&&e.nodeType)&&g(e)&&!y(e);function Te(e,t,n){return A(e[t])?e[t]:n}function Ae(e,t){let n=!1;return Object.keys(e).forEach(o=>e[o]===t&&(n=!0)),n}function Me(e,t,...n){const o=L(e);return o&&e.call(t,...n),o}function Ce(e,t){let n=0;const o=function(...r){!--n&&t.apply(this,...r)};"duration"in e?e.each(()=>++n).on("end",o):(++n,e.call(o))}const M="script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex",x={tags:new RegExp(`<(${M})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${M})\\s*>)?`,"gi"),eventHandlers:/[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,dangerousURIs:/(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi};function K(e){if(!f(e)||!e||e.indexOf("<")===-1)return e;let t=e,n;do n=t,t=t.replace(x.tags,"").replace(x.eventHandlers,"").replace(x.dangerousURIs,'$1=""');while(t!==n);return t}function De(e,t,n=[-1,1],o=!1){if(!(!e||!f(t)))if(t.indexOf(`
|
|
12
|
+
`)===-1)e.text(t);else{const r=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(r[0]!==r[1]){const s=t.split(`
|
|
13
|
+
`),i=o?s.length-1:1;e.html(""),s.forEach((c,d)=>{e.append("tspan").attr("x",0).attr("dy",`${d===0?n[0]*i:n[1]}em`).text(c)})}}}function W(e){const{x:t,y:n,width:o,height:r}=e.getBBox();return[{x:t,y:n+r},{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r}]}function Re(e){const{width:t,height:n}=D(e),o=W(e),r=o[0].x,s=Math.min(o[0].y,o[1].y);return{x:r,y:s,width:t,height:n}}function Se(e,t){var n;const o=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let r=[0,0];try{r=d3Pointer(o||e,t)}catch(s){}return r.map(s=>isNaN(s)?0:s)}function J(e){const{event:t,$el:n}=e,o=n.subchart.main||n.main;let r;return t&&t.type==="brush"?r=t.selection:o&&(r=o.select(".bb-brush").node())&&(r=d3BrushSelection(r)),r}function C(e,t,n=!1){const o=r=>r[e?"getBoundingClientRect":"getBBox"]();return n?o(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=o(t):t.rect}function D(e,t=!1){return C(!0,e,t)}function qe(e,t=!1){return C(!1,e,t)}function Ie(e=!0,t=0,n=1e4){const o=window.crypto||window.msCrypto,r=o?t+o.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(r):r}function R(e,t,n,o,r){if(n>o)return-1;const s=Math.floor((n+o)/2);let{x:i,w:c=0}=e[s];return r&&(i=e[s].y,c=e[s].h),t>=i&&t<=i+c?s:t<i?R(e,t,n,s-1,r):R(e,t,s+1,o,r)}function Be(e){const t=J(e);return t?t[0]===t[1]:!0}function Fe(...e){const t=n=>{if(p(n)&&n.constructor){const o=new n.constructor;for(const r in n)o[r]=t(n[r]);return o}return n};return e.map(n=>t(n)).reduce((n,o)=>T(T({},n),o))}function Q(e={},t){y(t)&&t.forEach(n=>Q(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const Ne=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ve(e,t="-"){return e.split(t).map((n,o)=>o?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Z=e=>[].slice.call(e);function Ue(e,t,n){const{rootSelector:o="",sheet:r}=e,i=`${o} ${(c=>c.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return r[r.insertRule?"insertRule":"addRule"](i,r.cssRules.length)}function Xe(e){let t=[];return e.forEach(n=>{var o;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Z(n.cssRules)))}catch(r){(o=window.console)==null||o.warn(`Error while reading rules from ${n.href}: ${r.toString()}`)}}),t}function Ye(e){var t,n,o,r,s,i;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((o=e.scrollLeft)!=null?o:0),y:((s=(r=window.pageYOffset)!=null?r:window.scrollY)!=null?s:0)+((i=e.scrollTop)!=null?i:0)}}function Le(e,t=0,n=0,o=!0){const r=new DOMPoint(t,n),s=e.getScreenCTM(),i=r.matrixTransform(o?s==null?void 0:s.inverse():s);if(o===!1){const c=D(e);i.x-=c.x,i.y-=c.y}return i}function ze(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Ge(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((o,r,s)=>s.indexOf(o)===r);return t?n.map(o=>new Date(o)):n}function He(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function v(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return p(e)&&p(n)&&Object.keys(n).forEach(o=>{if(!/^(__proto__|constructor|prototype)$/i.test(o)){const r=n[o];p(r)?(!e[o]&&(e[o]={}),e[o]=v(e[o],r)):e[o]=y(r)?r.concat():r}}),v(e,...t)}function ee(e,t=!0){let n;return e[0]instanceof Date?n=t?(o,r)=>o-r:(o,r)=>r-o:t&&!e.every(isNaN)?n=(o,r)=>o-r:t||(n=(o,r)=>o>r&&-1||o<r&&1||o===r&&0),e.concat().sort(n)}function ke(e,t){let n=t.filter(o=>k(o));return n.length?_(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=ee(n,e==="min")[0]):n=void 0,n}const Ke=(e,t,n=1)=>{const o=[],r=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=e;s<r;s++)o.push(e+s*n);return o},We={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,o=e())=>{t.dispatchEvent(new MouseEvent(n,o))}}catch(t){return(n,o,r=e())=>{const s=V.createEvent("MouseEvent");s.initMouseEvent(o,r.bubbles,r.cancelable,m,0,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const o=new Touch(v({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[o],targetTouches:[],changedTouches:[o]}))}};function Je(e,t){let n=e;for(const o in t)n=n.replace(new RegExp(`{=${o}}`,"g"),t[o]);return K(n)}function Qe(e){var t;let n;if(e instanceof Date)n=e;else if(f(e)){const{config:o,format:r}=this;n=(t=r.dataTime(o.data_xFormat)(e))!=null?t:new Date(e)}else _(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function Ze(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function et(e,t,n=!1){const o=!!e.node;let r=!1;for(const[s,i]of Object.entries(t))if(r=o?e.style(s)===i:e.style[s]===i,n===!1&&r)break;return r}function tt(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function nt(e,t){const{DocumentTouch:n,matchMedia:o,navigator:r}=window,s=o==null?void 0:o("(pointer:coarse)").matches;let i=!1;if(t)if(r&&"maxTouchPoints"in r)i=r.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)i=!0;else if(s)i=!0;else{const d=r.userAgent;i=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(d)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(d)}return e&&!s&&(o==null?void 0:o("(pointer:fine)").matches)&&"mouse"||i&&"touch"||"mouse"}function te(e,t){t()===!1?requestAnimationFrame(()=>te(e,t)):e()}function ot(e){if(p(e)&&!f(e)){const i=e;return{top:i.top||0,right:i.right||0,bottom:i.bottom||0,left:i.left||0}}const t=(f(e)?e.trim().split(/\s+/):[e]).map(i=>+i||0),[n,o=n,r=n,s=o]=t;return{top:n,right:o,bottom:r,left:s}}function ne(e){const t=this.config;let n,o,r;const s=()=>{const i=o.shift();if(i&&n&&g(n)&&i in n)return n=n[i],s();if(!i)return n};Object.keys(t).forEach(i=>{n=e,o=i.split("_"),r=s(),A(r)&&(t[i]=r)}),this.api&&(this.state.orgConfig=e)}var oe=Object.defineProperty,re=(e,t,n)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);class S{constructor(t={}){w(this,"$$"),w(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}w(S,"version","3.17.4");class se{constructor(){return{selector:void 0,extent:1,area:0}}}var ie=Object.defineProperty,ce=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,le=(e,t,n)=>ce(e,typeof t!="symbol"?t+"":t,n);class ae extends S{constructor(t){return super(t),le(this,"config"),this.config=new se,this}$init(){ne.call(this,this.options)}$redraw(){const{$$:{$el:t},config:{selector:n}}=this,o=n?t.main.selectAll(n):t.text;!o.empty()&&this.preventLabelOverlap(o)}generateVoronoi(t){const{$$:n}=this,{scale:o}=n,[r,s]=["x","y"].map(i=>o[i].domain());return[r[1],s[0]]=[s[0],r[1]],B.Delaunay.from(t).voronoi([...r,...s])}preventLabelOverlap(t){const{extent:n,area:o}=this.config,r=t.data().map(c=>[c.index,c.value]),s=this.generateVoronoi(r);let i=0;t.each(function(){const c=s.cellPolygon(i);if(c&&this){const[d,ue]=r[i],[fe,de]=(0,E.polygonCentroid)(c),pe=Math.abs((0,E.polygonArea)(c)),h=Math.round(Math.atan2(de-ue,fe-d)/Math.PI*2),he=n*(h===0?1:-1),be=h===-1?-n:n+5,me=Math.abs(h)===1?"middle":h===0?"start":"end";this.style.display=pe<o?"none":"",this.setAttribute("text-anchor",me),this.setAttribute("dy",`0.${h===1?71:35}em`),this.setAttribute("transform",`translate(${he}, ${be})`)}i++})}}return b=b.default,b})()});
|