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
package/dist/billboard.css
CHANGED
package/dist/billboard.js
CHANGED
|
@@ -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
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -2494,8 +2494,28 @@ function endall(transition, cb) {
|
|
|
2494
2494
|
transition.call(end);
|
|
2495
2495
|
}
|
|
2496
2496
|
}
|
|
2497
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
2498
|
+
const sanitizeRx = {
|
|
2499
|
+
tags: new RegExp(
|
|
2500
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
2501
|
+
"gi"
|
|
2502
|
+
),
|
|
2503
|
+
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
2504
|
+
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
2505
|
+
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
2506
|
+
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
2507
|
+
};
|
|
2497
2508
|
function sanitize(str) {
|
|
2498
|
-
|
|
2509
|
+
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
2510
|
+
return str;
|
|
2511
|
+
}
|
|
2512
|
+
let result = str;
|
|
2513
|
+
let prev;
|
|
2514
|
+
do {
|
|
2515
|
+
prev = result;
|
|
2516
|
+
result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
|
|
2517
|
+
} while (result !== prev);
|
|
2518
|
+
return result;
|
|
2499
2519
|
}
|
|
2500
2520
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
2501
2521
|
if (!node || !isString(text)) {
|
|
@@ -2807,7 +2827,7 @@ function tplProcess(tpl, data) {
|
|
|
2807
2827
|
for (const x in data) {
|
|
2808
2828
|
res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
|
|
2809
2829
|
}
|
|
2810
|
-
return res;
|
|
2830
|
+
return sanitize(res);
|
|
2811
2831
|
}
|
|
2812
2832
|
function parseDate(date) {
|
|
2813
2833
|
var _a;
|
|
@@ -5217,12 +5237,10 @@ const schemeCategory10 = [
|
|
|
5217
5237
|
}
|
|
5218
5238
|
ids.forEach((v) => {
|
|
5219
5239
|
const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}${isString(color) ? $$.getTargetSelectorSuffix(color) : ""}`;
|
|
5220
|
-
const colorValue = v === "" ? color : (color == null ? void 0 : color[v]) || "";
|
|
5240
|
+
const colorValue = sanitize(v === "" ? color : (color == null ? void 0 : color[v]) || "");
|
|
5221
5241
|
if (defs.select(`#${id}`).empty()) {
|
|
5222
|
-
defs.append("filter").attr("x", attr.x).attr("y", attr.y).attr("width", attr.width).attr("height", attr.height).attr("id", id).html(
|
|
5223
|
-
|
|
5224
|
-
<feComposite in="SourceGraphic" />`
|
|
5225
|
-
);
|
|
5242
|
+
defs.append("filter").attr("x", attr.x).attr("y", attr.y).attr("width", attr.width).attr("height", attr.height).attr("id", id).html(`<feFlood flood-color="${colorValue}" />
|
|
5243
|
+
<feComposite in="SourceGraphic" />`);
|
|
5226
5244
|
}
|
|
5227
5245
|
});
|
|
5228
5246
|
}
|
|
@@ -5822,7 +5840,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
5822
5840
|
const ids = [];
|
|
5823
5841
|
let html = "";
|
|
5824
5842
|
targets.forEach((v) => {
|
|
5825
|
-
const content = isFunction(template) ? template.
|
|
5843
|
+
const content = isFunction(template) ? sanitize(template.call($$.api, v, $$.color(v), $$.api.data(v)[0].values)) : tplProcess(template, {
|
|
5826
5844
|
COLOR: $$.color(v),
|
|
5827
5845
|
TITLE: v
|
|
5828
5846
|
});
|
|
@@ -8111,7 +8129,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8111
8129
|
if (!datum || datum.current !== dataStr) {
|
|
8112
8130
|
const { index, x } = selectedData.concat().sort()[0];
|
|
8113
8131
|
callFn(config.tooltip_onshow, $$.api, selectedData);
|
|
8114
|
-
tooltip.html($$.getTooltipHTML(
|
|
8132
|
+
tooltip.html(sanitize($$.getTooltipHTML(
|
|
8115
8133
|
selectedData,
|
|
8116
8134
|
// data
|
|
8117
8135
|
$$.axis ? $$.axis.getXAxisTickFormat() : $$.categoryName.bind($$),
|
|
@@ -8120,7 +8138,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8120
8138
|
// defaultValueFormat
|
|
8121
8139
|
$$.color
|
|
8122
8140
|
// color
|
|
8123
|
-
)).style("display", null).style("visibility", null).datum(datum = {
|
|
8141
|
+
))).style("display", null).style("visibility", null).datum(datum = {
|
|
8124
8142
|
index,
|
|
8125
8143
|
x,
|
|
8126
8144
|
current: dataStr,
|
|
@@ -20472,7 +20490,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20472
20490
|
target.setAttribute(name, from.getAttribute(name));
|
|
20473
20491
|
}
|
|
20474
20492
|
};
|
|
20475
|
-
const doc = new DOMParser().parseFromString(point, "image/svg+xml");
|
|
20493
|
+
const doc = new DOMParser().parseFromString(sanitize(point), "image/svg+xml");
|
|
20476
20494
|
const node = doc.documentElement;
|
|
20477
20495
|
const clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase());
|
|
20478
20496
|
clone.id = id;
|
|
@@ -20482,7 +20500,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20482
20500
|
if ((_a = node.childNodes) == null ? void 0 : _a.length) {
|
|
20483
20501
|
const parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone);
|
|
20484
20502
|
if ("innerHTML" in clone) {
|
|
20485
|
-
parent.html(node.innerHTML);
|
|
20503
|
+
parent.html(sanitize(node.innerHTML));
|
|
20486
20504
|
} else {
|
|
20487
20505
|
toArray(node.childNodes).forEach((v) => {
|
|
20488
20506
|
copyAttr(v, parent.append(v.tagName).node());
|
|
@@ -20538,7 +20556,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20538
20556
|
const pointId = $$.getDefsPointId(id);
|
|
20539
20557
|
const defsPoint = $el.defs.select(`#${pointId}`);
|
|
20540
20558
|
if (defsPoint.size() < 1) {
|
|
20541
|
-
insertPointInfoDefs.
|
|
20559
|
+
insertPointInfoDefs.call($$, point, pointId);
|
|
20542
20560
|
}
|
|
20543
20561
|
if (method === "create") {
|
|
20544
20562
|
return (_b = $$.custom) == null ? void 0 : _b.create.bind(context)(element, pointId, ...args);
|
|
@@ -22710,7 +22728,7 @@ const bb = {
|
|
|
22710
22728
|
* bb.version; // "1.0.0"
|
|
22711
22729
|
* @memberof bb
|
|
22712
22730
|
*/
|
|
22713
|
-
version: "3.17.
|
|
22731
|
+
version: "3.17.4",
|
|
22714
22732
|
/**
|
|
22715
22733
|
* Generate chart
|
|
22716
22734
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
package/dist/billboard.min.css
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
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
|
*/.bb svg{font:10px sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}.bb path,.bb line{fill:none;stroke:#000}.bb text,.bb .bb-button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid-focus,.bb-ygrid{shape-rendering:crispEdges}.bb-chart-arcs .bb-needle,.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-chart-funnels path{stroke-width:0}.bb-chart-funnels+.bb-chart-texts text{font-size:13px;fill:#fff}.bb-axis{shape-rendering:crispEdges}.bb-axis .bb-axis-x-tooltip,.bb-axis .bb-axis-y-tooltip,.bb-axis .bb-axis-y2-tooltip{font-size:1em;fill:#fff;white-space:nowrap}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:gray;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-target.bb-focused,.bb-circles.bb-focused{opacity:1}.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step,.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step{stroke-width:2px}.bb-target.bb-defocused,.bb-circles.bb-defocused{opacity:.3!important}.bb-target.bb-defocused .text-overlapping,.bb-circles.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-region rect{fill-opacity:.1}.bb-zoom-brush,.bb-brush .extent{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{z-index:10;user-select:none;transform:translateZ(0)}.bb-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;opacity:.9;box-shadow:7px 7px 12px -9px #777;white-space:nowrap}.bb-tooltip tr{border:1px solid #CCC}.bb-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.bb-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;width:10px;height:10px;margin-right:6px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{font-size:1.15em;cursor:default}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;top:10px;right:10px}.bb-button .bb-zoom-reset{font-size:11px;border:solid 1px #ccc;background-color:#fff;padding:5px;border-radius:5px;cursor:pointer}
|