billboard.js 3.9.4 → 3.10.0-next.2
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/README.md +2 -2
- package/dist/billboard.css +2 -2
- package/dist/billboard.js +2742 -2516
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2936 -2704
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +15 -15
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +205 -186
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +231 -226
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +172 -152
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +161 -142
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/{billboardjs-plugin-bubblecompare.js → billboardjs-plugin-bubblecompare.pkgd.js} +52 -32
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-sparkline.js → billboardjs-plugin-sparkline.pkgd.js} +239 -200
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-stanford.js → billboardjs-plugin-stanford.pkgd.js} +301 -277
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-tableview.js → billboardjs-plugin-tableview.pkgd.js} +206 -166
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-textoverlap.js → billboardjs-plugin-textoverlap.pkgd.js} +308 -278
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +12 -0
- package/dist/theme/dark.css +5 -4
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +5 -4
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +5 -4
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +5 -4
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +718 -509
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -9
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +21 -28
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +17 -11
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +13 -7
- package/package.json +32 -32
- package/src/Chart/api/axis.ts +4 -0
- package/src/Chart/api/category.ts +8 -4
- package/src/Chart/api/export.ts +1 -2
- package/src/Chart/api/subchart.ts +162 -89
- package/src/Chart/api/zoom.ts +69 -79
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +0 -8
- package/src/ChartInternal/data/IData.ts +4 -1
- package/src/ChartInternal/data/convert.helper.ts +1 -15
- package/src/ChartInternal/data/data.ts +8 -2
- package/src/ChartInternal/interactions/eventrect.ts +3 -4
- package/src/ChartInternal/interactions/flow.ts +1 -7
- package/src/ChartInternal/interactions/interaction.ts +11 -5
- package/src/ChartInternal/interactions/subchart.ts +36 -30
- package/src/ChartInternal/interactions/zoom.ts +13 -3
- package/src/ChartInternal/internals/category.ts +2 -2
- package/src/ChartInternal/internals/clip.ts +4 -5
- package/src/ChartInternal/internals/color.ts +49 -23
- package/src/ChartInternal/internals/domain.ts +46 -10
- package/src/ChartInternal/internals/grid.ts +57 -86
- package/src/ChartInternal/internals/redraw.ts +1 -6
- package/src/ChartInternal/internals/region.ts +35 -12
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/text.ts +1 -26
- package/src/ChartInternal/internals/title.ts +10 -48
- package/src/ChartInternal/internals/tooltip.ts +50 -54
- package/src/ChartInternal/shape/arc.ts +2 -2
- package/src/ChartInternal/shape/candlestick.ts +2 -17
- package/src/ChartInternal/shape/point.ts +36 -8
- package/src/ChartInternal/shape/radar.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +50 -4
- package/src/ChartInternal/shape/treemap.ts +2 -2
- package/src/Plugin/bubblecompare/index.ts +1 -1
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/stanford/Elements.ts +10 -2
- package/src/Plugin/stanford/index.ts +1 -24
- package/src/Plugin/tableview/index.ts +2 -2
- package/src/config/Options/axis/x.ts +1 -0
- package/src/config/Options/common/main.ts +12 -2
- package/src/config/Options/common/point.ts +41 -0
- package/src/config/Options/common/tooltip.ts +10 -10
- package/src/config/Options/data/axis.ts +3 -1
- package/src/config/Options/data/data.ts +10 -2
- package/src/config/Options/shape/area.ts +10 -4
- package/src/config/Options/shape/bar.ts +10 -4
- package/src/config/Store/State.ts +3 -0
- package/src/module/Cache.ts +7 -5
- package/src/module/browser.ts +34 -14
- package/src/module/util.ts +8 -4
- package/src/module/worker.ts +24 -13
- package/src/scss/billboard.scss +4 -2
- package/src/scss/theme/dark.scss +4 -2
- package/src/scss/theme/datalab.scss +4 -2
- package/src/scss/theme/graph.scss +4 -2
- package/src/scss/theme/insight.scss +4 -2
- package/types/chart.d.ts +11 -0
- package/types/options.d.ts +9 -3
- package/types/options.shape.d.ts +26 -0
- package/types/types.d.ts +15 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.10.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -182,7 +182,7 @@ function _inheritsLoose(subClass, superClass) {
|
|
|
182
182
|
* @example
|
|
183
183
|
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
let Plugin = /*#__PURE__*/function () {
|
|
186
186
|
/**
|
|
187
187
|
* Constructor
|
|
188
188
|
* @param {Any} options config option object
|
|
@@ -236,7 +236,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
236
236
|
};
|
|
237
237
|
return Plugin;
|
|
238
238
|
}();
|
|
239
|
-
Plugin.version = "3.
|
|
239
|
+
Plugin.version = "3.10.0-next.2";
|
|
240
240
|
|
|
241
241
|
;// CONCATENATED MODULE: ./src/Plugin/tableview/Options.ts
|
|
242
242
|
/**
|
|
@@ -251,7 +251,7 @@ Plugin.version = "3.9.4";
|
|
|
251
251
|
* @returns {TableviewOptions}
|
|
252
252
|
* @private
|
|
253
253
|
*/
|
|
254
|
-
|
|
254
|
+
let Options = function () {
|
|
255
255
|
return {
|
|
256
256
|
/**
|
|
257
257
|
* Set tableview holder selector.
|
|
@@ -285,7 +285,7 @@ var Options = function () {
|
|
|
285
285
|
* categoryFormat: "#table-holder"
|
|
286
286
|
*/
|
|
287
287
|
categoryFormat: function categoryFormat(v) {
|
|
288
|
-
|
|
288
|
+
let category = v;
|
|
289
289
|
if (this.$$.axis.isCategorized()) {
|
|
290
290
|
category = this.$$.categoryName(v);
|
|
291
291
|
} else if (this.$$.axis.isTimeSeries()) {
|
|
@@ -347,7 +347,7 @@ var Options = function () {
|
|
|
347
347
|
* @ignore
|
|
348
348
|
*/
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
const defaultStyle = {
|
|
351
351
|
id: "__tableview-style__",
|
|
352
352
|
class: "bb-tableview",
|
|
353
353
|
rule: ".bb-tableview {\n\t\tborder-collapse:collapse;\n\t\tborder-spacing:0;\n\t\tbackground:#fff;\n\t\tmin-width:100%;\n\t\tmargin-top:10px;\n\t\tfont-family:sans-serif;\n\t\tfont-size:.9em;\n\t}\n\t.bb-tableview tr:hover {\n\t\tbackground:#eef7ff;\n\t}\n\t.bb-tableview thead tr {\n\t\tbackground:#f8f8f8;\n\t}\n\t.bb-tableview caption,.bb-tableview td,.bb-tableview th {\n\t\ttext-align: center;\n\t\tborder:1px solid silver;\n\t\tpadding:.5em;\n\t}\n\t.bb-tableview caption {\n\t\tfont-size:1.1em;\n\t\tfont-weight:700;\n\t\tmargin-bottom: -1px;\n\t}"
|
|
@@ -364,7 +364,6 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
364
364
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
365
365
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
366
366
|
|
|
367
|
-
var _this = undefined;
|
|
368
367
|
/**
|
|
369
368
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
370
369
|
* billboard.js project is licensed under the MIT license
|
|
@@ -375,30 +374,45 @@ var _this = undefined;
|
|
|
375
374
|
*/
|
|
376
375
|
/* eslint-disable no-new-func, no-undef */
|
|
377
376
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Get global object
|
|
380
|
+
* @returns {object} window object
|
|
381
|
+
* @private
|
|
382
|
+
*/
|
|
383
|
+
function getGlobal() {
|
|
384
|
+
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")();
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Get fallback object
|
|
389
|
+
* @param {object} w global object
|
|
390
|
+
* @returns {Array} fallback object array
|
|
391
|
+
* @private
|
|
392
|
+
*/
|
|
393
|
+
function getFallback(w) {
|
|
394
|
+
var _this = this;
|
|
395
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function",
|
|
396
|
+
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function";
|
|
397
|
+
return [hasRAF ? w.requestAnimationFrame : function (cb) {
|
|
386
398
|
_newArrowCheck(this, _this);
|
|
387
399
|
return setTimeout(cb, 1);
|
|
388
|
-
}.bind(
|
|
389
|
-
cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
|
|
400
|
+
}.bind(this), hasRAF ? w.cancelAnimationFrame : function (id) {
|
|
390
401
|
_newArrowCheck(this, _this);
|
|
391
402
|
return clearTimeout(id);
|
|
392
|
-
}.bind(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
doc = win == null ? void 0 : win.document
|
|
396
|
-
|
|
397
|
-
|
|
403
|
+
}.bind(this), hasRIC ? w.requestIdleCallback : requestAnimationFrame, hasRIC ? w.cancelIdleCallback : cancelAnimationFrame];
|
|
404
|
+
}
|
|
405
|
+
const win = getGlobal(),
|
|
406
|
+
doc = win == null ? void 0 : win.document,
|
|
407
|
+
_getFallback = getFallback(win),
|
|
408
|
+
requestAnimationFrame = _getFallback[0],
|
|
409
|
+
cancelAnimationFrame = _getFallback[1],
|
|
410
|
+
requestIdleCallback = _getFallback[2],
|
|
411
|
+
cancelIdleCallback = _getFallback[3];
|
|
398
412
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
399
413
|
|
|
400
414
|
|
|
401
|
-
var
|
|
415
|
+
var _this = undefined;
|
|
402
416
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
403
417
|
function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
404
418
|
/**
|
|
@@ -410,64 +424,64 @@ function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t =
|
|
|
410
424
|
|
|
411
425
|
|
|
412
426
|
|
|
413
|
-
|
|
414
|
-
_newArrowCheck(this,
|
|
427
|
+
const isValue = function (v) {
|
|
428
|
+
_newArrowCheck(this, _this);
|
|
415
429
|
return v || v === 0;
|
|
416
430
|
}.bind(undefined),
|
|
417
431
|
isFunction = function (v) {
|
|
418
|
-
_newArrowCheck(this,
|
|
432
|
+
_newArrowCheck(this, _this);
|
|
419
433
|
return typeof v === "function";
|
|
420
434
|
}.bind(undefined),
|
|
421
435
|
isString = function (v) {
|
|
422
|
-
_newArrowCheck(this,
|
|
436
|
+
_newArrowCheck(this, _this);
|
|
423
437
|
return typeof v === "string";
|
|
424
438
|
}.bind(undefined),
|
|
425
439
|
isNumber = function (v) {
|
|
426
|
-
_newArrowCheck(this,
|
|
440
|
+
_newArrowCheck(this, _this);
|
|
427
441
|
return typeof v === "number";
|
|
428
442
|
}.bind(undefined),
|
|
429
443
|
isUndefined = function (v) {
|
|
430
|
-
_newArrowCheck(this,
|
|
444
|
+
_newArrowCheck(this, _this);
|
|
431
445
|
return typeof v === "undefined";
|
|
432
446
|
}.bind(undefined),
|
|
433
447
|
isDefined = function (v) {
|
|
434
|
-
_newArrowCheck(this,
|
|
448
|
+
_newArrowCheck(this, _this);
|
|
435
449
|
return typeof v !== "undefined";
|
|
436
450
|
}.bind(undefined),
|
|
437
451
|
isboolean = function (v) {
|
|
438
|
-
_newArrowCheck(this,
|
|
452
|
+
_newArrowCheck(this, _this);
|
|
439
453
|
return typeof v === "boolean";
|
|
440
454
|
}.bind(undefined),
|
|
441
455
|
ceil10 = function (v) {
|
|
442
|
-
_newArrowCheck(this,
|
|
456
|
+
_newArrowCheck(this, _this);
|
|
443
457
|
return Math.ceil(v / 10) * 10;
|
|
444
458
|
}.bind(undefined),
|
|
445
459
|
asHalfPixel = function (n) {
|
|
446
|
-
_newArrowCheck(this,
|
|
460
|
+
_newArrowCheck(this, _this);
|
|
447
461
|
return Math.ceil(n) + .5;
|
|
448
462
|
}.bind(undefined),
|
|
449
463
|
diffDomain = function (d) {
|
|
450
|
-
_newArrowCheck(this,
|
|
464
|
+
_newArrowCheck(this, _this);
|
|
451
465
|
return d[1] - d[0];
|
|
452
466
|
}.bind(undefined),
|
|
453
467
|
isObjectType = function (v) {
|
|
454
|
-
_newArrowCheck(this,
|
|
468
|
+
_newArrowCheck(this, _this);
|
|
455
469
|
return typeof v === "object";
|
|
456
470
|
}.bind(undefined),
|
|
457
471
|
isEmpty = function (o) {
|
|
458
|
-
_newArrowCheck(this,
|
|
472
|
+
_newArrowCheck(this, _this);
|
|
459
473
|
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
460
474
|
}.bind(undefined),
|
|
461
475
|
notEmpty = function (o) {
|
|
462
|
-
_newArrowCheck(this,
|
|
476
|
+
_newArrowCheck(this, _this);
|
|
463
477
|
return !isEmpty(o);
|
|
464
478
|
}.bind(undefined),
|
|
465
479
|
isArray = function (arr) {
|
|
466
|
-
_newArrowCheck(this,
|
|
480
|
+
_newArrowCheck(this, _this);
|
|
467
481
|
return Array.isArray(arr);
|
|
468
482
|
}.bind(undefined),
|
|
469
483
|
isObject = function (obj) {
|
|
470
|
-
_newArrowCheck(this,
|
|
484
|
+
_newArrowCheck(this, _this);
|
|
471
485
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
472
486
|
}.bind(undefined);
|
|
473
487
|
/**
|
|
@@ -503,8 +517,8 @@ function getOption(options, key, defaultValue) {
|
|
|
503
517
|
* @private
|
|
504
518
|
*/
|
|
505
519
|
function hasValue(dict, value) {
|
|
506
|
-
var _this2 = this
|
|
507
|
-
|
|
520
|
+
var _this2 = this;
|
|
521
|
+
let found = !1;
|
|
508
522
|
Object.keys(dict).forEach(function (key) {
|
|
509
523
|
_newArrowCheck(this, _this2);
|
|
510
524
|
return dict[key] === value && (found = !0);
|
|
@@ -521,7 +535,7 @@ function hasValue(dict, value) {
|
|
|
521
535
|
* @private
|
|
522
536
|
*/
|
|
523
537
|
function callFn(fn, thisArg) {
|
|
524
|
-
|
|
538
|
+
const isFn = isFunction(fn);
|
|
525
539
|
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
526
540
|
args[_key - 2] = arguments[_key];
|
|
527
541
|
}
|
|
@@ -536,14 +550,15 @@ function callFn(fn, thisArg) {
|
|
|
536
550
|
* @private
|
|
537
551
|
*/
|
|
538
552
|
function endall(transition, cb) {
|
|
539
|
-
var _this3 = this
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
553
|
+
var _this3 = this;
|
|
554
|
+
let n = 0;
|
|
555
|
+
const end = function () {
|
|
556
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
557
|
+
args[_key2] = arguments[_key2];
|
|
558
|
+
}
|
|
559
|
+
--n || cb.apply.apply(cb, [this].concat(args));
|
|
560
|
+
};
|
|
561
|
+
|
|
547
562
|
// if is transition selection
|
|
548
563
|
if ("duration" in transition) {
|
|
549
564
|
transition.each(function () {
|
|
@@ -562,8 +577,8 @@ function endall(transition, cb) {
|
|
|
562
577
|
* @returns {string}
|
|
563
578
|
* @private
|
|
564
579
|
*/
|
|
565
|
-
function
|
|
566
|
-
return isString(str) ? str.replace(
|
|
580
|
+
function sanitize(str) {
|
|
581
|
+
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
567
582
|
}
|
|
568
583
|
|
|
569
584
|
/**
|
|
@@ -588,12 +603,12 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
588
603
|
if (text.indexOf("\n") === -1) {
|
|
589
604
|
node.text(text);
|
|
590
605
|
} else {
|
|
591
|
-
|
|
606
|
+
const diff = [node.text(), text].map(function (v) {
|
|
592
607
|
_newArrowCheck(this, _this4);
|
|
593
608
|
return v.replace(/[\s\n]/g, "");
|
|
594
609
|
}.bind(this));
|
|
595
610
|
if (diff[0] !== diff[1]) {
|
|
596
|
-
|
|
611
|
+
const multiline = text.split("\n"),
|
|
597
612
|
len = toMiddle ? multiline.length - 1 : 1;
|
|
598
613
|
// reset possible text
|
|
599
614
|
node.html("");
|
|
@@ -619,7 +634,7 @@ function getRectSegList(path) {
|
|
|
619
634
|
* | |
|
|
620
635
|
* seg0 ---------- seg3
|
|
621
636
|
* */
|
|
622
|
-
|
|
637
|
+
const _path$getBBox = path.getBBox(),
|
|
623
638
|
x = _path$getBBox.x,
|
|
624
639
|
y = _path$getBBox.y,
|
|
625
640
|
width = _path$getBBox.width,
|
|
@@ -653,7 +668,7 @@ function getRectSegList(path) {
|
|
|
653
668
|
* @private
|
|
654
669
|
*/
|
|
655
670
|
function getPathBox(path) {
|
|
656
|
-
|
|
671
|
+
const _path$getBoundingClie = path.getBoundingClientRect(),
|
|
657
672
|
width = _path$getBoundingClie.width,
|
|
658
673
|
height = _path$getBoundingClie.height,
|
|
659
674
|
items = getRectSegList(path),
|
|
@@ -676,9 +691,12 @@ function getPathBox(path) {
|
|
|
676
691
|
*/
|
|
677
692
|
function getPointer(event, element) {
|
|
678
693
|
var _ref,
|
|
679
|
-
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
680
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
681
694
|
_this5 = this;
|
|
695
|
+
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
696
|
+
let pointer = [0, 0];
|
|
697
|
+
try {
|
|
698
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
699
|
+
} catch (e) {}
|
|
682
700
|
return pointer.map(function (v) {
|
|
683
701
|
_newArrowCheck(this, _this5);
|
|
684
702
|
return isNaN(v) ? 0 : v;
|
|
@@ -692,10 +710,10 @@ function getPointer(event, element) {
|
|
|
692
710
|
* @private
|
|
693
711
|
*/
|
|
694
712
|
function getBrushSelection(ctx) {
|
|
695
|
-
|
|
713
|
+
const event = ctx.event,
|
|
696
714
|
$el = ctx.$el,
|
|
697
715
|
main = $el.subchart.main || $el.main;
|
|
698
|
-
|
|
716
|
+
let selection;
|
|
699
717
|
|
|
700
718
|
// check from event
|
|
701
719
|
if (event && event.type === "brush") {
|
|
@@ -715,7 +733,7 @@ function getBrushSelection(ctx) {
|
|
|
715
733
|
* @private
|
|
716
734
|
*/
|
|
717
735
|
function getBoundingRect(node) {
|
|
718
|
-
|
|
736
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
719
737
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
720
738
|
}
|
|
721
739
|
|
|
@@ -737,7 +755,7 @@ function getRandom(asStr, min, max) {
|
|
|
737
755
|
if (max === void 0) {
|
|
738
756
|
max = 1e4;
|
|
739
757
|
}
|
|
740
|
-
|
|
758
|
+
const crpt = win.crypto || win.msCrypto,
|
|
741
759
|
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
742
760
|
return asStr ? rand + "" : rand;
|
|
743
761
|
}
|
|
@@ -756,8 +774,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
756
774
|
if (start > end) {
|
|
757
775
|
return -1;
|
|
758
776
|
}
|
|
759
|
-
|
|
760
|
-
|
|
777
|
+
const mid = Math.floor((start + end) / 2);
|
|
778
|
+
let _arr$mid = arr[mid],
|
|
761
779
|
x = _arr$mid.x,
|
|
762
780
|
_arr$mid$w = _arr$mid.w,
|
|
763
781
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -778,7 +796,7 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
778
796
|
* @private
|
|
779
797
|
*/
|
|
780
798
|
function brushEmpty(ctx) {
|
|
781
|
-
|
|
799
|
+
const selection = getBrushSelection(ctx);
|
|
782
800
|
if (selection) {
|
|
783
801
|
// brush selected area
|
|
784
802
|
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
@@ -795,17 +813,19 @@ function brushEmpty(ctx) {
|
|
|
795
813
|
* @private
|
|
796
814
|
*/
|
|
797
815
|
function deepClone() {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
return r;
|
|
816
|
+
var _this6 = this;
|
|
817
|
+
const _clone = function clone(v) {
|
|
818
|
+
_newArrowCheck(this, _this6);
|
|
819
|
+
if (isObject(v) && v.constructor) {
|
|
820
|
+
const r = new v.constructor();
|
|
821
|
+
for (const k in v) {
|
|
822
|
+
r[k] = _clone(v[k]);
|
|
806
823
|
}
|
|
807
|
-
return
|
|
808
|
-
}
|
|
824
|
+
return r;
|
|
825
|
+
}
|
|
826
|
+
return v;
|
|
827
|
+
}.bind(this);
|
|
828
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
809
829
|
objectN[_key3] = arguments[_key3];
|
|
810
830
|
}
|
|
811
831
|
return objectN.map(function (v) {
|
|
@@ -837,7 +857,7 @@ function extend(target, source) {
|
|
|
837
857
|
}
|
|
838
858
|
|
|
839
859
|
// exclude name with only numbers
|
|
840
|
-
for (
|
|
860
|
+
for (const p in source) {
|
|
841
861
|
if (/^\d+$/.test(p) || p in target) {
|
|
842
862
|
continue;
|
|
843
863
|
}
|
|
@@ -852,8 +872,8 @@ function extend(target, source) {
|
|
|
852
872
|
* @returns {string} capitalized string
|
|
853
873
|
* @private
|
|
854
874
|
*/
|
|
855
|
-
|
|
856
|
-
_newArrowCheck(this,
|
|
875
|
+
const capitalize = function (str) {
|
|
876
|
+
_newArrowCheck(this, _this);
|
|
857
877
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
858
878
|
}.bind(undefined);
|
|
859
879
|
|
|
@@ -881,8 +901,8 @@ function camelize(str, separator) {
|
|
|
881
901
|
* @returns {Array}
|
|
882
902
|
* @private
|
|
883
903
|
*/
|
|
884
|
-
|
|
885
|
-
_newArrowCheck(this,
|
|
904
|
+
const toArray = function (v) {
|
|
905
|
+
_newArrowCheck(this, _this);
|
|
886
906
|
return [].slice.call(v);
|
|
887
907
|
}.bind(undefined);
|
|
888
908
|
|
|
@@ -895,8 +915,8 @@ var toArray = function (v) {
|
|
|
895
915
|
* @private
|
|
896
916
|
*/
|
|
897
917
|
function addCssRules(style, selector, prop) {
|
|
898
|
-
var _this9 = this
|
|
899
|
-
|
|
918
|
+
var _this9 = this;
|
|
919
|
+
const rootSelctor = style.rootSelctor,
|
|
900
920
|
sheet = style.sheet,
|
|
901
921
|
getSelector = function (s) {
|
|
902
922
|
_newArrowCheck(this, _this9);
|
|
@@ -913,8 +933,8 @@ function addCssRules(style, selector, prop) {
|
|
|
913
933
|
* @private
|
|
914
934
|
*/
|
|
915
935
|
function getCssRules(styleSheets) {
|
|
916
|
-
var _this10 = this
|
|
917
|
-
|
|
936
|
+
var _this10 = this;
|
|
937
|
+
let rules = [];
|
|
918
938
|
styleSheets.forEach(function (sheet) {
|
|
919
939
|
_newArrowCheck(this, _this10);
|
|
920
940
|
try {
|
|
@@ -936,7 +956,7 @@ function getCssRules(styleSheets) {
|
|
|
936
956
|
* @private
|
|
937
957
|
*/
|
|
938
958
|
function getTranslation(node) {
|
|
939
|
-
|
|
959
|
+
const transform = node ? node.transform : null,
|
|
940
960
|
baseVal = transform && transform.baseVal;
|
|
941
961
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
942
962
|
a: 0,
|
|
@@ -955,8 +975,8 @@ function getTranslation(node) {
|
|
|
955
975
|
* @private
|
|
956
976
|
*/
|
|
957
977
|
function getUnique(data) {
|
|
958
|
-
var _this11 = this
|
|
959
|
-
|
|
978
|
+
var _this11 = this;
|
|
979
|
+
const isDate = data[0] instanceof Date,
|
|
960
980
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
961
981
|
_newArrowCheck(this, _this11);
|
|
962
982
|
return self.indexOf(v) === i;
|
|
@@ -995,11 +1015,11 @@ function mergeObj(target) {
|
|
|
995
1015
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
996
1016
|
return target;
|
|
997
1017
|
}
|
|
998
|
-
|
|
1018
|
+
const source = objectN.shift();
|
|
999
1019
|
if (isObject(target) && isObject(source)) {
|
|
1000
1020
|
Object.keys(source).forEach(function (key) {
|
|
1001
1021
|
_newArrowCheck(this, _this13);
|
|
1002
|
-
|
|
1022
|
+
const value = source[key];
|
|
1003
1023
|
if (isObject(value)) {
|
|
1004
1024
|
target[key] || (target[key] = {});
|
|
1005
1025
|
target[key] = mergeObj(target[key], value);
|
|
@@ -1023,7 +1043,7 @@ function sortValue(data, isAsc) {
|
|
|
1023
1043
|
if (isAsc === void 0) {
|
|
1024
1044
|
isAsc = !0;
|
|
1025
1045
|
}
|
|
1026
|
-
|
|
1046
|
+
let fn;
|
|
1027
1047
|
if (data[0] instanceof Date) {
|
|
1028
1048
|
fn = isAsc ? function (a, b) {
|
|
1029
1049
|
_newArrowCheck(this, _this14);
|
|
@@ -1056,11 +1076,11 @@ function sortValue(data, isAsc) {
|
|
|
1056
1076
|
* @private
|
|
1057
1077
|
*/
|
|
1058
1078
|
function getMinMax(type, data) {
|
|
1059
|
-
var _this15 = this
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1079
|
+
var _this15 = this;
|
|
1080
|
+
let res = data.filter(function (v) {
|
|
1081
|
+
_newArrowCheck(this, _this15);
|
|
1082
|
+
return notEmpty(v);
|
|
1083
|
+
}.bind(this));
|
|
1064
1084
|
if (res.length) {
|
|
1065
1085
|
if (isNumber(res[0])) {
|
|
1066
1086
|
res = Math[type].apply(Math, res);
|
|
@@ -1081,14 +1101,14 @@ function getMinMax(type, data) {
|
|
|
1081
1101
|
* @returns {Array}
|
|
1082
1102
|
* @private
|
|
1083
1103
|
*/
|
|
1084
|
-
|
|
1104
|
+
const getRange = function (start, end, step) {
|
|
1085
1105
|
if (step === void 0) {
|
|
1086
1106
|
step = 1;
|
|
1087
1107
|
}
|
|
1088
|
-
_newArrowCheck(this,
|
|
1089
|
-
|
|
1108
|
+
_newArrowCheck(this, _this);
|
|
1109
|
+
const res = [],
|
|
1090
1110
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1091
|
-
for (
|
|
1111
|
+
for (let i = start; i < n; i++) {
|
|
1092
1112
|
res.push(start + i * step);
|
|
1093
1113
|
}
|
|
1094
1114
|
return res;
|
|
@@ -1096,8 +1116,8 @@ var getRange = function (start, end, step) {
|
|
|
1096
1116
|
emulateEvent = {
|
|
1097
1117
|
mouse: function () {
|
|
1098
1118
|
var _this16 = this;
|
|
1099
|
-
_newArrowCheck(this,
|
|
1100
|
-
|
|
1119
|
+
_newArrowCheck(this, _this);
|
|
1120
|
+
const getParams = function () {
|
|
1101
1121
|
_newArrowCheck(this, _this16);
|
|
1102
1122
|
return {
|
|
1103
1123
|
bubbles: !1,
|
|
@@ -1125,7 +1145,7 @@ var getRange = function (start, end, step) {
|
|
|
1125
1145
|
params = getParams();
|
|
1126
1146
|
}
|
|
1127
1147
|
_newArrowCheck(this, _this16);
|
|
1128
|
-
|
|
1148
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
1129
1149
|
|
|
1130
1150
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1131
1151
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
@@ -1136,8 +1156,8 @@ var getRange = function (start, end, step) {
|
|
|
1136
1156
|
}
|
|
1137
1157
|
}.bind(undefined)(),
|
|
1138
1158
|
touch: function touch(el, eventType, params) {
|
|
1139
|
-
_newArrowCheck(this,
|
|
1140
|
-
|
|
1159
|
+
_newArrowCheck(this, _this);
|
|
1160
|
+
const touchObj = new Touch(mergeObj({
|
|
1141
1161
|
identifier: Date.now(),
|
|
1142
1162
|
target: el,
|
|
1143
1163
|
radiusX: 2.5,
|
|
@@ -1163,8 +1183,8 @@ var getRange = function (start, end, step) {
|
|
|
1163
1183
|
* @private
|
|
1164
1184
|
*/
|
|
1165
1185
|
function tplProcess(tpl, data) {
|
|
1166
|
-
|
|
1167
|
-
for (
|
|
1186
|
+
let res = tpl;
|
|
1187
|
+
for (const x in data) {
|
|
1168
1188
|
res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
1169
1189
|
}
|
|
1170
1190
|
return res;
|
|
@@ -1178,13 +1198,14 @@ function tplProcess(tpl, data) {
|
|
|
1178
1198
|
* @private
|
|
1179
1199
|
*/
|
|
1180
1200
|
function parseDate(date) {
|
|
1181
|
-
|
|
1201
|
+
let parsedDate;
|
|
1182
1202
|
if (date instanceof Date) {
|
|
1183
1203
|
parsedDate = date;
|
|
1184
1204
|
} else if (isString(date)) {
|
|
1185
|
-
var _format$dataTime
|
|
1186
|
-
|
|
1205
|
+
var _format$dataTime;
|
|
1206
|
+
const config = this.config,
|
|
1187
1207
|
format = this.format;
|
|
1208
|
+
|
|
1188
1209
|
// if fails to parse, try by new Date()
|
|
1189
1210
|
// https://github.com/naver/billboard.js/issues/1714
|
|
1190
1211
|
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
@@ -1214,11 +1235,11 @@ function isTabVisible() {
|
|
|
1214
1235
|
* @private
|
|
1215
1236
|
*/
|
|
1216
1237
|
function convertInputType(mouse, touch) {
|
|
1217
|
-
var _this17 = this
|
|
1218
|
-
|
|
1238
|
+
var _this17 = this;
|
|
1239
|
+
const DocumentTouch = win.DocumentTouch,
|
|
1219
1240
|
matchMedia = win.matchMedia,
|
|
1220
|
-
navigator = win.navigator
|
|
1221
|
-
|
|
1241
|
+
navigator = win.navigator;
|
|
1242
|
+
let hasTouch = !1;
|
|
1222
1243
|
if (touch) {
|
|
1223
1244
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1224
1245
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
@@ -1234,7 +1255,7 @@ function convertInputType(mouse, touch) {
|
|
|
1234
1255
|
hasTouch = !0;
|
|
1235
1256
|
} else {
|
|
1236
1257
|
// Only as a last resort, fall back to user agent sniffing
|
|
1237
|
-
|
|
1258
|
+
const UA = navigator.userAgent;
|
|
1238
1259
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1239
1260
|
}
|
|
1240
1261
|
}
|
|
@@ -1243,7 +1264,7 @@ function convertInputType(mouse, touch) {
|
|
|
1243
1264
|
// Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
|
|
1244
1265
|
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1245
1266
|
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1246
|
-
|
|
1267
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1247
1268
|
_newArrowCheck(this, _this17);
|
|
1248
1269
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1249
1270
|
}.bind(this));
|
|
@@ -1282,22 +1303,20 @@ function runUntil(fn, conditionFn) {
|
|
|
1282
1303
|
* @private
|
|
1283
1304
|
*/
|
|
1284
1305
|
function loadConfig(config) {
|
|
1285
|
-
var _this = this
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
return undefined;
|
|
1300
|
-
}.bind(this);
|
|
1306
|
+
var _this = this;
|
|
1307
|
+
const thisConfig = this.config;
|
|
1308
|
+
let target, keys, read;
|
|
1309
|
+
const _find = function find() {
|
|
1310
|
+
_newArrowCheck(this, _this);
|
|
1311
|
+
const key = keys.shift();
|
|
1312
|
+
if (key && target && isObjectType(target) && key in target) {
|
|
1313
|
+
target = target[key];
|
|
1314
|
+
return _find();
|
|
1315
|
+
} else if (!key) {
|
|
1316
|
+
return target;
|
|
1317
|
+
}
|
|
1318
|
+
return undefined;
|
|
1319
|
+
}.bind(this);
|
|
1301
1320
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1302
1321
|
_newArrowCheck(this, _this);
|
|
1303
1322
|
target = config;
|
|
@@ -1373,7 +1392,7 @@ function tableview_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
|
|
|
1373
1392
|
* ]
|
|
1374
1393
|
* })
|
|
1375
1394
|
*/
|
|
1376
|
-
|
|
1395
|
+
let TableView = /*#__PURE__*/function (_Plugin) {
|
|
1377
1396
|
_inheritsLoose(TableView, _Plugin);
|
|
1378
1397
|
function TableView(options) {
|
|
1379
1398
|
var _this = _Plugin.call(this, options) || this;
|
|
@@ -1387,26 +1406,26 @@ var TableView = /*#__PURE__*/function (_Plugin) {
|
|
|
1387
1406
|
loadConfig.call(this, this.options);
|
|
1388
1407
|
};
|
|
1389
1408
|
_proto.$init = function $init() {
|
|
1390
|
-
var _element$classList
|
|
1391
|
-
|
|
1409
|
+
var _element$classList;
|
|
1410
|
+
const _this$config = this.config,
|
|
1392
1411
|
className = _this$config.class,
|
|
1393
1412
|
selector = _this$config.selector,
|
|
1394
|
-
style = _this$config.style
|
|
1395
|
-
|
|
1413
|
+
style = _this$config.style;
|
|
1414
|
+
let element = document.querySelector(selector || "." + (className || defaultStyle.class));
|
|
1396
1415
|
if (!element) {
|
|
1397
|
-
|
|
1416
|
+
const chart = this.$$.$el.chart.node();
|
|
1398
1417
|
element = document.createElement("table");
|
|
1399
1418
|
chart.parentNode.insertBefore(element, chart.nextSibling);
|
|
1400
1419
|
}
|
|
1401
1420
|
if (element.tagName !== "TABLE") {
|
|
1402
|
-
|
|
1421
|
+
const table = document.createElement("table");
|
|
1403
1422
|
element.appendChild(table);
|
|
1404
1423
|
element = table;
|
|
1405
1424
|
}
|
|
1406
1425
|
|
|
1407
1426
|
// append default css style
|
|
1408
1427
|
if (style && !document.getElementById(defaultStyle.id)) {
|
|
1409
|
-
|
|
1428
|
+
const s = document.createElement("style");
|
|
1410
1429
|
s.id = defaultStyle.id;
|
|
1411
1430
|
s.innerHTML = defaultStyle.rule;
|
|
1412
1431
|
(document.head || document.getElementsByTagName("head")[0]).appendChild(s);
|
|
@@ -1420,16 +1439,16 @@ var TableView = /*#__PURE__*/function (_Plugin) {
|
|
|
1420
1439
|
* @private
|
|
1421
1440
|
*/;
|
|
1422
1441
|
_proto.generateTable = function generateTable() {
|
|
1423
|
-
var _this2 = this
|
|
1424
|
-
|
|
1442
|
+
var _this2 = this;
|
|
1443
|
+
const $$ = this.$$,
|
|
1425
1444
|
config = this.config,
|
|
1426
1445
|
element = this.element,
|
|
1427
|
-
dataToShow = $$.filterTargetsToShow($$.data.targets)
|
|
1428
|
-
|
|
1446
|
+
dataToShow = $$.filterTargetsToShow($$.data.targets);
|
|
1447
|
+
let thead = tplProcess(tpl.thead, {
|
|
1429
1448
|
title: dataToShow.length ? this.config.categoryTitle : ""
|
|
1430
1449
|
}),
|
|
1431
|
-
tbody = ""
|
|
1432
|
-
|
|
1450
|
+
tbody = "";
|
|
1451
|
+
const rows = [];
|
|
1433
1452
|
dataToShow.forEach(function (v) {
|
|
1434
1453
|
var _this3 = this;
|
|
1435
1454
|
_newArrowCheck(this, _this2);
|
|
@@ -1456,25 +1475,26 @@ var TableView = /*#__PURE__*/function (_Plugin) {
|
|
|
1456
1475
|
});
|
|
1457
1476
|
}.bind(this)).join("") + "</tr>";
|
|
1458
1477
|
}.bind(this));
|
|
1459
|
-
|
|
1478
|
+
const r = tplProcess(tpl.body, tableview_objectSpread(tableview_objectSpread({}, config), {}, {
|
|
1460
1479
|
title: config.title || $$.config.title_text || "",
|
|
1461
1480
|
thead: thead,
|
|
1462
1481
|
tbody: tbody
|
|
1463
|
-
})).replace(
|
|
1482
|
+
})).replace(/(<\/?(script|img)[^>]*>|<[^>]+><\/[^>]+>)/ig, "");
|
|
1464
1483
|
element.innerHTML = r;
|
|
1465
1484
|
};
|
|
1466
1485
|
_proto.$redraw = function $redraw() {
|
|
1467
|
-
|
|
1486
|
+
const state = this.$$.state,
|
|
1468
1487
|
doNotUpdate = state.resizing || !this.config.updateOnToggle && state.toggling;
|
|
1469
1488
|
doNotUpdate || this.generateTable();
|
|
1470
1489
|
};
|
|
1471
1490
|
_proto.$willDestroy = function $willDestroy() {
|
|
1472
|
-
|
|
1491
|
+
var _this$element$parentN;
|
|
1492
|
+
(_this$element$parentN = this.element.parentNode) == null || _this$element$parentN.removeChild(this.element);
|
|
1473
1493
|
|
|
1474
1494
|
// remove default css style when left one chart instance
|
|
1475
1495
|
if (this.$$.charts.length === 1) {
|
|
1476
|
-
var _s$parentNode
|
|
1477
|
-
|
|
1496
|
+
var _s$parentNode;
|
|
1497
|
+
const s = document.getElementById(defaultStyle.id);
|
|
1478
1498
|
s == null || (_s$parentNode = s.parentNode) == null || _s$parentNode.removeChild(s);
|
|
1479
1499
|
}
|
|
1480
1500
|
};
|