billboard.js 3.17.1 → 3.17.3
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 -20
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +12 -12
- package/dist/billboard.pkgd.js +2135 -1615
- package/dist/billboard.pkgd.min.js +21 -19
- 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 +23 -5
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +23 -5
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +25 -9
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +23 -5
- 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 +2170 -1645
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -8
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2171 -1646
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -10
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2174 -1651
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -9
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2173 -1648
- 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 +35 -18
- 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 +9 -3
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +27 -6
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +3 -3
- package/src/ChartInternal/data/convert.ts +10 -2
- 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 +32 -7
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.3
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -2459,7 +2459,13 @@ const ceil10 = (v) => Math.ceil(v / 10) * 10;
|
|
|
2459
2459
|
const asHalfPixel = (n) => Math.ceil(n) + 0.5;
|
|
2460
2460
|
const diffDomain = (d) => d[1] - d[0];
|
|
2461
2461
|
const isObjectType = (v) => typeof v === "object";
|
|
2462
|
-
const
|
|
2462
|
+
const isEmptyObject = (obj) => {
|
|
2463
|
+
for (const x in obj) {
|
|
2464
|
+
return false;
|
|
2465
|
+
}
|
|
2466
|
+
return true;
|
|
2467
|
+
};
|
|
2468
|
+
const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && isEmptyObject(o) || isNumber(o) && isNaN(o);
|
|
2463
2469
|
const notEmpty = (o) => !isEmpty(o);
|
|
2464
2470
|
const isArray = (arr) => Array.isArray(arr);
|
|
2465
2471
|
const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
@@ -2488,8 +2494,20 @@ function endall(transition, cb) {
|
|
|
2488
2494
|
transition.call(end);
|
|
2489
2495
|
}
|
|
2490
2496
|
}
|
|
2497
|
+
const dangerousTags = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|svg|math";
|
|
2498
|
+
const sanitizeRx = {
|
|
2499
|
+
tags: new RegExp(
|
|
2500
|
+
`<(${dangerousTags})[\\s\\S]*?>[\\s\\S]*?<\\/\\1>|<(${dangerousTags})[^>]*\\/?>`,
|
|
2501
|
+
"gi"
|
|
2502
|
+
),
|
|
2503
|
+
eventHandlers: /\s*on\w+\s*=\s*["'][^"']*["']|\s*on\w+\s*=\s*[^\s>]+/gi,
|
|
2504
|
+
dangerousUrls: /(href|src|action|formaction|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript):[^"'\s>]*/gi
|
|
2505
|
+
};
|
|
2491
2506
|
function sanitize(str) {
|
|
2492
|
-
|
|
2507
|
+
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
2508
|
+
return str;
|
|
2509
|
+
}
|
|
2510
|
+
return str.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousUrls, '$1=""');
|
|
2493
2511
|
}
|
|
2494
2512
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
2495
2513
|
if (!node || !isString(text)) {
|
|
@@ -2801,7 +2819,7 @@ function tplProcess(tpl, data) {
|
|
|
2801
2819
|
for (const x in data) {
|
|
2802
2820
|
res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
|
|
2803
2821
|
}
|
|
2804
|
-
return res;
|
|
2822
|
+
return sanitize(res);
|
|
2805
2823
|
}
|
|
2806
2824
|
function parseDate(date) {
|
|
2807
2825
|
var _a;
|
|
@@ -3693,10 +3711,7 @@ function setXS(ids, data, params) {
|
|
|
3693
3711
|
*/
|
|
3694
3712
|
convertData(args, callback) {
|
|
3695
3713
|
const { config } = this;
|
|
3696
|
-
const useWorker = (d) =>
|
|
3697
|
-
var _a;
|
|
3698
|
-
return (d == null ? void 0 : d.length) && ((_a = d[0]) == null ? void 0 : _a.length) ? config.boost_useWorker : false;
|
|
3699
|
-
};
|
|
3714
|
+
const useWorker = (d) => (d == null ? void 0 : d.length) && !isEmpty(d[0]) ? config.boost_useWorker : false;
|
|
3700
3715
|
let data = args;
|
|
3701
3716
|
if (args.bindto) {
|
|
3702
3717
|
data = {};
|
|
@@ -5214,12 +5229,10 @@ const schemeCategory10 = [
|
|
|
5214
5229
|
}
|
|
5215
5230
|
ids.forEach((v) => {
|
|
5216
5231
|
const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}${isString(color) ? $$.getTargetSelectorSuffix(color) : ""}`;
|
|
5217
|
-
const colorValue = v === "" ? color : (color == null ? void 0 : color[v]) || "";
|
|
5232
|
+
const colorValue = sanitize(v === "" ? color : (color == null ? void 0 : color[v]) || "");
|
|
5218
5233
|
if (defs.select(`#${id}`).empty()) {
|
|
5219
|
-
defs.append("filter").attr("x", attr.x).attr("y", attr.y).attr("width", attr.width).attr("height", attr.height).attr("id", id).html(
|
|
5220
|
-
|
|
5221
|
-
<feComposite in="SourceGraphic" />`
|
|
5222
|
-
);
|
|
5234
|
+
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}" />
|
|
5235
|
+
<feComposite in="SourceGraphic" />`);
|
|
5223
5236
|
}
|
|
5224
5237
|
});
|
|
5225
5238
|
}
|
|
@@ -5819,7 +5832,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
5819
5832
|
const ids = [];
|
|
5820
5833
|
let html = "";
|
|
5821
5834
|
targets.forEach((v) => {
|
|
5822
|
-
const content = isFunction(template) ? template.
|
|
5835
|
+
const content = isFunction(template) ? sanitize(template.call($$.api, v, $$.color(v), $$.api.data(v)[0].values)) : tplProcess(template, {
|
|
5823
5836
|
COLOR: $$.color(v),
|
|
5824
5837
|
TITLE: v
|
|
5825
5838
|
});
|
|
@@ -8108,7 +8121,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8108
8121
|
if (!datum || datum.current !== dataStr) {
|
|
8109
8122
|
const { index, x } = selectedData.concat().sort()[0];
|
|
8110
8123
|
callFn(config.tooltip_onshow, $$.api, selectedData);
|
|
8111
|
-
tooltip.html($$.getTooltipHTML(
|
|
8124
|
+
tooltip.html(sanitize($$.getTooltipHTML(
|
|
8112
8125
|
selectedData,
|
|
8113
8126
|
// data
|
|
8114
8127
|
$$.axis ? $$.axis.getXAxisTickFormat() : $$.categoryName.bind($$),
|
|
@@ -8117,7 +8130,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8117
8130
|
// defaultValueFormat
|
|
8118
8131
|
$$.color
|
|
8119
8132
|
// color
|
|
8120
|
-
)).style("display", null).style("visibility", null).datum(datum = {
|
|
8133
|
+
))).style("display", null).style("visibility", null).datum(datum = {
|
|
8121
8134
|
index,
|
|
8122
8135
|
x,
|
|
8123
8136
|
current: dataStr,
|
|
@@ -20469,7 +20482,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20469
20482
|
target.setAttribute(name, from.getAttribute(name));
|
|
20470
20483
|
}
|
|
20471
20484
|
};
|
|
20472
|
-
const doc = new DOMParser().parseFromString(point, "image/svg+xml");
|
|
20485
|
+
const doc = new DOMParser().parseFromString(sanitize(point), "image/svg+xml");
|
|
20473
20486
|
const node = doc.documentElement;
|
|
20474
20487
|
const clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase());
|
|
20475
20488
|
clone.id = id;
|
|
@@ -20479,7 +20492,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20479
20492
|
if ((_a = node.childNodes) == null ? void 0 : _a.length) {
|
|
20480
20493
|
const parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone);
|
|
20481
20494
|
if ("innerHTML" in clone) {
|
|
20482
|
-
parent.html(node.innerHTML);
|
|
20495
|
+
parent.html(sanitize(node.innerHTML));
|
|
20483
20496
|
} else {
|
|
20484
20497
|
toArray(node.childNodes).forEach((v) => {
|
|
20485
20498
|
copyAttr(v, parent.append(v.tagName).node());
|
|
@@ -20535,7 +20548,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20535
20548
|
const pointId = $$.getDefsPointId(id);
|
|
20536
20549
|
const defsPoint = $el.defs.select(`#${pointId}`);
|
|
20537
20550
|
if (defsPoint.size() < 1) {
|
|
20538
|
-
insertPointInfoDefs.
|
|
20551
|
+
insertPointInfoDefs.call($$, point, pointId);
|
|
20539
20552
|
}
|
|
20540
20553
|
if (method === "create") {
|
|
20541
20554
|
return (_b = $$.custom) == null ? void 0 : _b.create.bind(context)(element, pointId, ...args);
|
|
@@ -22707,7 +22720,7 @@ const bb = {
|
|
|
22707
22720
|
* bb.version; // "1.0.0"
|
|
22708
22721
|
* @memberof bb
|
|
22709
22722
|
*/
|
|
22710
|
-
version: "3.17.
|
|
22723
|
+
version: "3.17.3",
|
|
22711
22724
|
/**
|
|
22712
22725
|
* Generate chart
|
|
22713
22726
|
* - **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.3
|
|
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}
|