billboard.js 4.0.0-next.3 → 4.0.0
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 +240 -149
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +20 -20
- package/dist/billboard.pkgd.js +240 -149
- package/dist/billboard.pkgd.min.js +27 -27
- 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 +11 -13
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +11 -13
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +28 -15
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +11 -13
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +9 -9
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +11 -13
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +28 -15
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- 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/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +1 -1
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +1 -1
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +1 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +53 -0
- package/dist-esm/Chart/api/subchart.js +2 -2
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +1 -1
- package/dist-esm/Chart/api/zoom.js +2 -2
- package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +149 -96
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +8 -4
- package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +1 -1
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +2 -2
- package/dist-esm/ChartInternal/interactions/flow.js +1 -1
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
- package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +1 -1
- package/dist-esm/ChartInternal/internals/format.js +1 -1
- package/dist-esm/ChartInternal/internals/grid.js +1 -1
- package/dist-esm/ChartInternal/internals/legend.js +1 -1
- package/dist-esm/ChartInternal/internals/redraw.js +1 -1
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +1 -1
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +1 -1
- package/dist-esm/ChartInternal/internals/text.util.js +1 -1
- package/dist-esm/ChartInternal/internals/title.js +1 -1
- package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +1 -1
- package/dist-esm/ChartInternal/shape/area.js +1 -1
- package/dist-esm/ChartInternal/shape/bar.js +1 -1
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +1 -1
- package/dist-esm/ChartInternal/shape/point.js +1 -1
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +6 -4
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
- package/dist-esm/canvas/CanvasEngine.js +18 -5
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +58 -35
- package/dist-esm/canvas/CanvasTheme.js +1 -1
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +1 -1
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +1 -1
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -13
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +1 -1
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +1 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +17 -2
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +1 -1
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +3 -3
- package/dist-esm/index.canvas.js +2 -1
- package/dist-esm/index.esm.js +2 -1
- package/dist-esm/module/Cache.js +1 -1
- package/dist-esm/module/browser.js +1 -1
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +16 -3
- package/dist-esm/module/generator.js +1 -1
- package/dist-esm/module/sanitize.js +14 -18
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +1 -1
- package/dist-esm/module/util/object.js +7 -4
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +32 -22
- 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 +32 -21
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +37 -11
- package/src/ChartInternal/Axis/AxisRenderer.ts +179 -105
- package/src/ChartInternal/ChartInternal.ts +11 -3
- package/src/ChartInternal/interactions/eventrect.ts +3 -1
- package/src/ChartInternal/shape/shape.ts +5 -3
- package/src/Plugin/tableview/Options.ts +17 -1
- package/src/Plugin/tableview/index.ts +1 -1
- package/src/canvas/CanvasEngine.ts +18 -5
- package/src/canvas/CanvasRenderer.ts +71 -36
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/module/sanitize.ts +13 -20
- package/src/module/util/object.ts +4 -2
- package/src/module/worker.ts +34 -24
- package/types/index.d.ts +0 -3
- package/types/plugin/tableview/options.d.ts +5 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import shapePoint from '../../../ChartInternal/shape/point.js';
|
|
11
11
|
import shapeRadar from '../../../ChartInternal/shape/radar.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import shapePointCommon from '../../../ChartInternal/shape/core/point.js';
|
|
11
11
|
import shapePoint from '../../../ChartInternal/shape/point.js';
|
package/dist-esm/core.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 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import Chart from './Chart/Chart.js';
|
|
11
11
|
import { mergeObj } from './module/util/object.js';
|
|
@@ -18,7 +18,7 @@ import { isObject } from './module/util/type-checks.js';
|
|
|
18
18
|
let defaults = Object.create(null);
|
|
19
19
|
/**
|
|
20
20
|
* @namespace bb
|
|
21
|
-
* @version 4.0.0
|
|
21
|
+
* @version 4.0.0
|
|
22
22
|
*/
|
|
23
23
|
const bb = {
|
|
24
24
|
/**
|
|
@@ -28,7 +28,7 @@ const bb = {
|
|
|
28
28
|
* bb.version; // "1.0.0"
|
|
29
29
|
* @memberof bb
|
|
30
30
|
*/
|
|
31
|
-
version: "4.0.0
|
|
31
|
+
version: "4.0.0",
|
|
32
32
|
/**
|
|
33
33
|
* Generate chart
|
|
34
34
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|
package/dist-esm/index.canvas.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
|
+
import './Chart/api/stubs.js';
|
|
10
11
|
export { area, areaLineRange, areaSpline, areaSplineRange, areaStep, areaStepRange, bar, bubble, candlestick, line, scatter, spline, step, treemap } from './config/resolver/canvasShape.js';
|
|
11
12
|
export { canvas } from './config/resolver/canvas.js';
|
|
12
13
|
export { category } from './config/resolver/category.js';
|
package/dist-esm/index.esm.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
|
+
import './Chart/api/stubs.js';
|
|
10
11
|
export { category } from './config/resolver/category.js';
|
|
11
12
|
export { exportApi } from './config/resolver/export.js';
|
|
12
13
|
export { flow } from './config/resolver/flow.js';
|
package/dist-esm/module/Cache.js
CHANGED
package/dist-esm/module/dsv.js
CHANGED
package/dist-esm/module/error.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
|
-
import { TYPE_METHOD_NEEDED, TYPE } from '../config/const.js';
|
|
10
|
+
import { TYPE_METHOD_NEEDED, TYPE, API_MODULE_NEEDED } from '../config/const.js';
|
|
11
11
|
import { window as win } from './browser.js';
|
|
12
12
|
import { isEmpty } from './util/type-checks.js';
|
|
13
13
|
import { camelize } from './util/object.js';
|
|
@@ -37,6 +37,19 @@ function checkModuleImport(ctx) {
|
|
|
37
37
|
type &&
|
|
38
38
|
logError(`Please, make sure if %c${camelize(type)}`, "module has been imported and specified correctly.", MODULE_IMPORT_DOC);
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Check optional API module import (e.g. export, flow).
|
|
42
|
+
* Invoked by stubs on Chart.prototype when the corresponding resolver module
|
|
43
|
+
* was not imported. Throws a helpful error pointing to the module the user
|
|
44
|
+
* needs to import.
|
|
45
|
+
* @param {string} apiName API name (key of API_MODULE_NEEDED)
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
function checkApiModuleImport(apiName) {
|
|
49
|
+
const moduleName = API_MODULE_NEEDED[apiName];
|
|
50
|
+
moduleName &&
|
|
51
|
+
logError(`Please, make sure if %c${moduleName}`, "module has been imported and specified correctly.", MODULE_IMPORT_DOC);
|
|
52
|
+
}
|
|
40
53
|
/**
|
|
41
54
|
* Log error and throw error
|
|
42
55
|
* @param {string} head Message header
|
|
@@ -55,4 +68,4 @@ function logError(head, tail, info) {
|
|
|
55
68
|
throw Error(`${prefix} ${head.replace(/\%c([a-z-]+)/i, "'$1' ")} ${tail}`);
|
|
56
69
|
}
|
|
57
70
|
|
|
58
|
-
export { checkModuleImport, logError };
|
|
71
|
+
export { checkApiModuleImport, checkModuleImport, logError };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import { requestIdleCallback, window as win, cancelIdleCallback } from './browser.js';
|
|
11
11
|
import { isNumber, isArray } from './util/type-checks.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -213,10 +213,10 @@ function decodeHTMLEntities(str) {
|
|
|
213
213
|
.replace(/&/gi, "&")
|
|
214
214
|
.replace(/"/gi, "\"")
|
|
215
215
|
.replace(/'/gi, "'")
|
|
216
|
-
// Numeric entities (decimal)
|
|
217
|
-
.replace(/&#(\d+)
|
|
218
|
-
// Numeric entities (hex)
|
|
219
|
-
.replace(/&#x([0-9a-f]+)
|
|
216
|
+
// Numeric entities (decimal) - trailing semicolon is optional per HTML5 tokenizer
|
|
217
|
+
.replace(/&#(\d+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 10)))
|
|
218
|
+
// Numeric entities (hex) - trailing semicolon is optional per HTML5 tokenizer
|
|
219
|
+
.replace(/&#x([0-9a-f]+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Check if a URI is safe (whitelist approach)
|
|
@@ -234,20 +234,16 @@ function isSafeURI(uri) {
|
|
|
234
234
|
if (!normalized || normalized.startsWith("#")) {
|
|
235
235
|
return true;
|
|
236
236
|
}
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// Check if protocol is in whitelist
|
|
245
|
-
const colonIndex = normalized.indexOf(":");
|
|
246
|
-
if (colonIndex > 0) {
|
|
247
|
-
const protocol = normalized.substring(0, colonIndex + 1);
|
|
248
|
-
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
237
|
+
// A ':' appearing before the first '/', '?' or '#' denotes a URI scheme.
|
|
238
|
+
// Reject the value unless that scheme is whitelisted - do NOT infer safety
|
|
239
|
+
// merely from the absence of a literal colon (which could be reconstructed
|
|
240
|
+
// from an alternate encoding once assigned to innerHTML).
|
|
241
|
+
const schemeMatch = normalized.match(/^[^/?#]*:/);
|
|
242
|
+
if (schemeMatch) {
|
|
243
|
+
return ALLOWED_URI_PROTOCOLS.has(schemeMatch[0]);
|
|
249
244
|
}
|
|
250
|
-
|
|
245
|
+
// No scheme → relative path / query / fragment only → safe
|
|
246
|
+
return true;
|
|
251
247
|
}
|
|
252
248
|
/**
|
|
253
249
|
* Check if a style value is safe (whitelist approach)
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import { requestAnimationFrame } from '../browser.js';
|
|
11
11
|
import { sanitize } from '../sanitize.js';
|
|
12
|
-
import {
|
|
12
|
+
import { isArray, isObject, isDefined, isFunction, isString, isNumber, notEmpty } from './type-checks.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -25,7 +25,7 @@ import { isObject, isArray, isDefined, isFunction, isString, notEmpty, isNumber
|
|
|
25
25
|
function _forEachValidItem(items, callback) {
|
|
26
26
|
for (let i = 0; i < items.length; i++) {
|
|
27
27
|
const item = items[i];
|
|
28
|
-
if (item) {
|
|
28
|
+
if (item !== null && isDefined(item)) {
|
|
29
29
|
callback(item, i);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -196,7 +196,10 @@ function mergeObj(target, ...objectN) {
|
|
|
196
196
|
Object.keys(source).forEach(key => {
|
|
197
197
|
if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
|
|
198
198
|
const value = source[key];
|
|
199
|
-
if (
|
|
199
|
+
if (value instanceof Date) {
|
|
200
|
+
target[key] = new Date(value.getTime());
|
|
201
|
+
}
|
|
202
|
+
else if (isObject(value)) {
|
|
200
203
|
!target[key] && (target[key] = {});
|
|
201
204
|
target[key] = mergeObj(target[key], value);
|
|
202
205
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import { window as win } from './browser.js';
|
|
11
11
|
|
|
@@ -30,21 +30,26 @@ function getOrCreateWorkerResources(fn, depsFn) {
|
|
|
30
30
|
const depsString = depsFn?.map(String).join(";") ?? "";
|
|
31
31
|
const key = (fnString + depsString).replace(/(function|[\s\W\n])/g, "").substring(0, 30);
|
|
32
32
|
if (!(key in cache)) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
try {
|
|
34
|
+
// Create Blob and Object URL for Web Worker
|
|
35
|
+
const blob = new win.Blob([
|
|
36
|
+
`${depsString}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
self.onmessage=function({data}) {
|
|
39
|
+
const result = (${fnString}).apply(null, data.args);
|
|
40
|
+
self.postMessage({id: data.id, result});
|
|
41
|
+
};`
|
|
42
|
+
], {
|
|
43
|
+
type: "text/javascript"
|
|
44
|
+
});
|
|
45
|
+
cache[key] = {
|
|
46
|
+
src: win.URL.createObjectURL(blob),
|
|
47
|
+
worker: null
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
return { key, src: cache[key].src };
|
|
50
55
|
}
|
|
@@ -62,7 +67,12 @@ function getWorker(key, src) {
|
|
|
62
67
|
return null;
|
|
63
68
|
}
|
|
64
69
|
if (!cached.worker) {
|
|
65
|
-
|
|
70
|
+
try {
|
|
71
|
+
cached.worker = new win.Worker(src);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
66
76
|
// handle error
|
|
67
77
|
if (cached.worker) {
|
|
68
78
|
cached.worker.onerror = function (e) {
|
|
@@ -102,10 +112,10 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
102
112
|
callback(res);
|
|
103
113
|
};
|
|
104
114
|
if (win.Worker && useWorker) {
|
|
105
|
-
const
|
|
106
|
-
const worker = getWorker(key, src);
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
const workerResources = getOrCreateWorkerResources(fn, depsFn);
|
|
116
|
+
const worker = workerResources && getWorker(workerResources.key, workerResources.src);
|
|
117
|
+
if (worker) {
|
|
118
|
+
runFn = function (...args) {
|
|
109
119
|
// workers are cached and shared: match the response by id so concurrent
|
|
110
120
|
// callers don't steal each other's result
|
|
111
121
|
const id = ++messageId;
|
|
@@ -117,8 +127,8 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
117
127
|
};
|
|
118
128
|
worker.addEventListener("message", handler);
|
|
119
129
|
worker.postMessage({ id, args });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
122
132
|
}
|
|
123
133
|
return runFn;
|
|
124
134
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -75,7 +75,7 @@ class Plugin {
|
|
|
75
75
|
$$;
|
|
76
76
|
options;
|
|
77
77
|
config;
|
|
78
|
-
static version = "4.0.0
|
|
78
|
+
static version = "4.0.0";
|
|
79
79
|
/**
|
|
80
80
|
* Constructor
|
|
81
81
|
* @param {Any} options config option object
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -179,7 +179,7 @@ class Plugin {
|
|
|
179
179
|
$$;
|
|
180
180
|
options;
|
|
181
181
|
config;
|
|
182
|
-
static version = "4.0.0
|
|
182
|
+
static version = "4.0.0";
|
|
183
183
|
/**
|
|
184
184
|
* Constructor
|
|
185
185
|
* @param {Any} options config option object
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -248,7 +248,7 @@ class Plugin {
|
|
|
248
248
|
$$;
|
|
249
249
|
options;
|
|
250
250
|
config;
|
|
251
|
-
static version = "4.0.0
|
|
251
|
+
static version = "4.0.0";
|
|
252
252
|
/**
|
|
253
253
|
* Constructor
|
|
254
254
|
* @param {Any} options config option object
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -224,10 +224,10 @@ function decodeHTMLEntities(str) {
|
|
|
224
224
|
.replace(/&/gi, "&")
|
|
225
225
|
.replace(/"/gi, "\"")
|
|
226
226
|
.replace(/'/gi, "'")
|
|
227
|
-
// Numeric entities (decimal)
|
|
228
|
-
.replace(/&#(\d+)
|
|
229
|
-
// Numeric entities (hex)
|
|
230
|
-
.replace(/&#x([0-9a-f]+)
|
|
227
|
+
// Numeric entities (decimal) - trailing semicolon is optional per HTML5 tokenizer
|
|
228
|
+
.replace(/&#(\d+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 10)))
|
|
229
|
+
// Numeric entities (hex) - trailing semicolon is optional per HTML5 tokenizer
|
|
230
|
+
.replace(/&#x([0-9a-f]+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Check if a URI is safe (whitelist approach)
|
|
@@ -245,20 +245,16 @@ function isSafeURI(uri) {
|
|
|
245
245
|
if (!normalized || normalized.startsWith("#")) {
|
|
246
246
|
return true;
|
|
247
247
|
}
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
// Check if protocol is in whitelist
|
|
256
|
-
const colonIndex = normalized.indexOf(":");
|
|
257
|
-
if (colonIndex > 0) {
|
|
258
|
-
const protocol = normalized.substring(0, colonIndex + 1);
|
|
259
|
-
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
248
|
+
// A ':' appearing before the first '/', '?' or '#' denotes a URI scheme.
|
|
249
|
+
// Reject the value unless that scheme is whitelisted - do NOT infer safety
|
|
250
|
+
// merely from the absence of a literal colon (which could be reconstructed
|
|
251
|
+
// from an alternate encoding once assigned to innerHTML).
|
|
252
|
+
const schemeMatch = normalized.match(/^[^/?#]*:/);
|
|
253
|
+
if (schemeMatch) {
|
|
254
|
+
return ALLOWED_URI_PROTOCOLS.has(schemeMatch[0]);
|
|
260
255
|
}
|
|
261
|
-
|
|
256
|
+
// No scheme → relative path / query / fragment only → safe
|
|
257
|
+
return true;
|
|
262
258
|
}
|
|
263
259
|
/**
|
|
264
260
|
* Check if a style value is safe (whitelist approach)
|
|
@@ -534,7 +530,7 @@ class Plugin {
|
|
|
534
530
|
$$;
|
|
535
531
|
options;
|
|
536
532
|
config;
|
|
537
|
-
static version = "4.0.0
|
|
533
|
+
static version = "4.0.0";
|
|
538
534
|
/**
|
|
539
535
|
* Constructor
|
|
540
536
|
* @param {Any} options config option object
|
|
@@ -735,7 +731,22 @@ class Options {
|
|
|
735
731
|
* @example
|
|
736
732
|
* nullString: "N/A"
|
|
737
733
|
*/
|
|
738
|
-
nullString: "-"
|
|
734
|
+
nullString: "-",
|
|
735
|
+
/**
|
|
736
|
+
* Set number format function.
|
|
737
|
+
* @name numberFormat
|
|
738
|
+
* @memberof plugin-tableview
|
|
739
|
+
* @type {function}
|
|
740
|
+
* @returns {string}
|
|
741
|
+
* @default function(v) { // will return formatted value according to locale settings }
|
|
742
|
+
* @example
|
|
743
|
+
* numberFormat: function(v) {
|
|
744
|
+
* return v.toLocaleString();
|
|
745
|
+
* }
|
|
746
|
+
*/
|
|
747
|
+
numberFormat: function (v) {
|
|
748
|
+
return v.toLocaleString();
|
|
749
|
+
}
|
|
739
750
|
};
|
|
740
751
|
}
|
|
741
752
|
}
|
|
@@ -848,7 +859,7 @@ class TableView extends Plugin {
|
|
|
848
859
|
tbody += `<tr>${v.map((d, i) => tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
|
|
849
860
|
value: i === 0 ?
|
|
850
861
|
config.categoryFormat.bind(this)(d) :
|
|
851
|
-
(isNumber(d) ?
|
|
862
|
+
(isNumber(d) ? config.numberFormat.bind(this)(d) : config.nullString)
|
|
852
863
|
})).join("")}</tr>`;
|
|
853
864
|
});
|
|
854
865
|
element.innerHTML = tplProcess(tpl.body, {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -119,7 +119,7 @@ class Plugin {
|
|
|
119
119
|
$$;
|
|
120
120
|
options;
|
|
121
121
|
config;
|
|
122
|
-
static version = "4.0.0
|
|
122
|
+
static version = "4.0.0";
|
|
123
123
|
/**
|
|
124
124
|
* Constructor
|
|
125
125
|
* @param {Any} options config option object
|