billboard.js 3.4.1 → 3.5.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.
Files changed (75) hide show
  1. package/README.md +4 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +3942 -1467
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +8372 -5306
  7. package/dist/billboard.pkgd.min.js +3 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +29 -13
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +375 -91
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +445 -108
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +339 -73
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +335 -74
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +4236 -3792
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4637 -3889
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4804 -3931
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +4595 -3865
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +4607 -3873
  23. package/dist/theme/datalab.css +1 -1
  24. package/dist/theme/datalab.min.css +1 -1
  25. package/dist/theme/graph.css +1 -1
  26. package/dist/theme/graph.min.css +1 -1
  27. package/dist/theme/insight.css +1 -1
  28. package/dist/theme/insight.min.css +1 -1
  29. package/dist-esm/billboard.js +837 -403
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +47 -75
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +68 -86
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +52 -77
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +49 -76
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +49 -76
  35. package/package.json +39 -39
  36. package/src/Chart/api/chart.ts +4 -1
  37. package/src/Chart/api/data.ts +2 -2
  38. package/src/Chart/api/flow.ts +125 -115
  39. package/src/ChartInternal/Axis/AxisRenderer.ts +29 -3
  40. package/src/ChartInternal/ChartInternal.ts +46 -18
  41. package/src/ChartInternal/data/IData.ts +2 -2
  42. package/src/ChartInternal/data/convert.helper.ts +226 -0
  43. package/src/ChartInternal/data/convert.ts +43 -210
  44. package/src/ChartInternal/data/load.ts +5 -4
  45. package/src/ChartInternal/interactions/zoom.ts +17 -4
  46. package/src/ChartInternal/internals/class.ts +1 -1
  47. package/src/ChartInternal/internals/color.ts +41 -42
  48. package/src/ChartInternal/internals/grid.ts +5 -3
  49. package/src/ChartInternal/internals/legend.ts +21 -6
  50. package/src/ChartInternal/internals/redraw.ts +5 -2
  51. package/src/ChartInternal/internals/scale.ts +3 -1
  52. package/src/ChartInternal/internals/size.axis.ts +5 -2
  53. package/src/ChartInternal/internals/style.ts +54 -0
  54. package/src/ChartInternal/internals/text.ts +118 -18
  55. package/src/ChartInternal/shape/arc.ts +4 -3
  56. package/src/ChartInternal/shape/area.ts +14 -7
  57. package/src/ChartInternal/shape/bar.ts +22 -12
  58. package/src/ChartInternal/shape/line.ts +3 -2
  59. package/src/ChartInternal/shape/point.ts +15 -9
  60. package/src/ChartInternal/shape/polar.ts +1 -1
  61. package/src/Plugin/sparkline/index.ts +22 -11
  62. package/src/Plugin/stanford/index.ts +10 -7
  63. package/src/Plugin/textoverlap/index.ts +4 -1
  64. package/src/config/Options/Options.ts +2 -0
  65. package/src/config/Options/common/boost.ts +31 -0
  66. package/src/config/Options/common/main.ts +15 -1
  67. package/src/config/Options/common/tooltip.ts +1 -1
  68. package/src/config/Options/data/data.ts +11 -3
  69. package/src/config/Options/shape/area.ts +6 -1
  70. package/src/config/Store/State.ts +3 -0
  71. package/src/module/browser.ts +2 -1
  72. package/src/module/generator.ts +18 -16
  73. package/src/module/util.ts +113 -0
  74. package/types/chart.d.ts +2 -2
  75. package/types/options.d.ts +45 -8
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.4.1
8
+ * @version 3.5.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -90,6 +90,12 @@ __webpack_require__.d(__webpack_exports__, {
90
90
  "default": function() { return /* binding */ Sparkline; }
91
91
  });
92
92
 
93
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
94
+ function _newArrowCheck(innerThis, boundThis) {
95
+ if (innerThis !== boundThis) {
96
+ throw new TypeError("Cannot instantiate an arrow function");
97
+ }
98
+ }
93
99
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
94
100
  function _assertThisInitialized(self) {
95
101
  if (self === void 0) {
@@ -100,11 +106,10 @@ function _assertThisInitialized(self) {
100
106
  }
101
107
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
102
108
  function _setPrototypeOf(o, p) {
103
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
109
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
104
110
  o.__proto__ = p;
105
111
  return o;
106
112
  };
107
-
108
113
  return _setPrototypeOf(o, p);
109
114
  }
110
115
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
@@ -293,6 +298,8 @@ var $ZOOM = {
293
298
  };
294
299
  /* harmony default export */ var classes = (_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM));
295
300
  ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
301
+
302
+
296
303
  /**
297
304
  * Copyright (c) 2017 ~ present NAVER Corp.
298
305
  * billboard.js project is licensed under the MIT license
@@ -367,15 +374,17 @@ var Plugin = /*#__PURE__*/function () {
367
374
  var _this = this;
368
375
 
369
376
  Object.keys(this).forEach(function (key) {
370
- _this[key] = null;
371
- delete _this[key];
372
- });
377
+ _newArrowCheck(this, _this);
378
+
379
+ this[key] = null;
380
+ delete this[key];
381
+ }.bind(this));
373
382
  };
374
383
 
375
384
  return Plugin;
376
385
  }();
377
386
 
378
- Plugin.version = "3.4.1";
387
+ Plugin.version = "3.5.0";
379
388
 
380
389
  ;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
381
390
  /**
@@ -413,6 +422,10 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
413
422
  // EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
414
423
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
415
424
  ;// CONCATENATED MODULE: ./src/module/browser.ts
425
+
426
+
427
+ var _this = undefined;
428
+
416
429
  /**
417
430
  * Copyright (c) 2017 ~ present NAVER Corp.
418
431
  * billboard.js project is licensed under the MIT license
@@ -427,25 +440,35 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
427
440
 
428
441
 
429
442
  var win = function () {
443
+ _newArrowCheck(this, _this);
444
+
430
445
  var root = 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;
431
446
  return root || Function("return this")();
432
- }();
447
+ }.bind(undefined)();
433
448
  /* eslint-enable no-new-func, no-undef */
434
449
  // fallback for non-supported environments
435
450
 
436
451
 
437
452
  win.requestIdleCallback = win.requestIdleCallback || function (cb) {
453
+ _newArrowCheck(this, _this);
454
+
438
455
  return setTimeout(cb, 1);
439
- };
456
+ }.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
440
457
 
441
- win.cancelIdleCallback = win.cancelIdleCallback || function (id) {
442
- return clearTimeout(id);
443
- };
458
+
459
+ win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
460
+ _newArrowCheck(this, _this);
461
+
462
+ return setTimeout(cb, 1);
463
+ }.bind(undefined);
444
464
 
445
465
  var doc = win == null ? void 0 : win.document;
446
466
  ;// CONCATENATED MODULE: ./src/module/util.ts
447
467
 
448
468
 
469
+
470
+ var util_this = undefined;
471
+
449
472
  function util_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
450
473
 
451
474
  function util_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? util_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : util_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -461,50 +484,80 @@ function util_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
461
484
 
462
485
 
463
486
  var isValue = function (v) {
487
+ _newArrowCheck(this, util_this);
488
+
464
489
  return v || v === 0;
465
- },
490
+ }.bind(undefined),
466
491
  isFunction = function (v) {
492
+ _newArrowCheck(this, util_this);
493
+
467
494
  return typeof v === "function";
468
- },
495
+ }.bind(undefined),
469
496
  isString = function (v) {
497
+ _newArrowCheck(this, util_this);
498
+
470
499
  return typeof v === "string";
471
- },
500
+ }.bind(undefined),
472
501
  isNumber = function (v) {
502
+ _newArrowCheck(this, util_this);
503
+
473
504
  return typeof v === "number";
474
- },
505
+ }.bind(undefined),
475
506
  isUndefined = function (v) {
507
+ _newArrowCheck(this, util_this);
508
+
476
509
  return typeof v === "undefined";
477
- },
510
+ }.bind(undefined),
478
511
  isDefined = function (v) {
512
+ _newArrowCheck(this, util_this);
513
+
479
514
  return typeof v !== "undefined";
480
- },
515
+ }.bind(undefined),
481
516
  isboolean = function (v) {
517
+ _newArrowCheck(this, util_this);
518
+
482
519
  return typeof v === "boolean";
483
- },
520
+ }.bind(undefined),
484
521
  ceil10 = function (v) {
522
+ _newArrowCheck(this, util_this);
523
+
485
524
  return Math.ceil(v / 10) * 10;
486
- },
525
+ }.bind(undefined),
487
526
  asHalfPixel = function (n) {
527
+ _newArrowCheck(this, util_this);
528
+
488
529
  return Math.ceil(n) + .5;
489
- },
530
+ }.bind(undefined),
490
531
  diffDomain = function (d) {
532
+ _newArrowCheck(this, util_this);
533
+
491
534
  return d[1] - d[0];
492
- },
535
+ }.bind(undefined),
493
536
  isObjectType = function (v) {
537
+ _newArrowCheck(this, util_this);
538
+
494
539
  return typeof v === "object";
495
- },
540
+ }.bind(undefined),
496
541
  isEmpty = function (o) {
542
+ _newArrowCheck(this, util_this);
543
+
497
544
  return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
498
- },
545
+ }.bind(undefined),
499
546
  notEmpty = function (o) {
547
+ _newArrowCheck(this, util_this);
548
+
500
549
  return !isEmpty(o);
501
- },
550
+ }.bind(undefined),
502
551
  isArray = function (arr) {
552
+ _newArrowCheck(this, util_this);
553
+
503
554
  return Array.isArray(arr);
504
- },
555
+ }.bind(undefined),
505
556
  isObject = function (obj) {
557
+ _newArrowCheck(this, util_this);
558
+
506
559
  return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
507
- };
560
+ }.bind(undefined);
508
561
 
509
562
  /**
510
563
  * Get specified key value from object
@@ -528,10 +581,14 @@ function getOption(options, key, defaultValue) {
528
581
 
529
582
 
530
583
  function hasValue(dict, value) {
531
- var found = !1;
584
+ var _this2 = this,
585
+ found = !1;
586
+
532
587
  Object.keys(dict).forEach(function (key) {
588
+ _newArrowCheck(this, _this2);
589
+
533
590
  return dict[key] === value && (found = !0);
534
- });
591
+ }.bind(this));
535
592
  return found;
536
593
  }
537
594
  /**
@@ -561,7 +618,8 @@ function callFn(fn, thisArg) {
561
618
 
562
619
 
563
620
  function endall(transition, cb) {
564
- var n = 0,
621
+ var _this3 = this,
622
+ n = 0,
565
623
  end = function () {
566
624
  for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
567
625
  args[_key2] = arguments[_key2];
@@ -573,8 +631,10 @@ function endall(transition, cb) {
573
631
  // if is transition selection
574
632
  if ("duration" in transition) {
575
633
  transition.each(function () {
634
+ _newArrowCheck(this, _this3);
635
+
576
636
  return ++n;
577
- }).on("end", end);
637
+ }.bind(this)).on("end", end);
578
638
  } else {
579
639
  ++n;
580
640
  transition.call(end);
@@ -602,6 +662,8 @@ function sanitise(str) {
602
662
 
603
663
 
604
664
  function setTextValue(node, text, dy, toMiddle) {
665
+ var _this4 = this;
666
+
605
667
  if (dy === void 0) {
606
668
  dy = [-1, 1];
607
669
  }
@@ -618,8 +680,10 @@ function setTextValue(node, text, dy, toMiddle) {
618
680
  node.text(text);
619
681
  } else {
620
682
  var diff = [node.text(), text].map(function (v) {
683
+ _newArrowCheck(this, _this4);
684
+
621
685
  return v.replace(/[\s\n]/g, "");
622
- });
686
+ }.bind(this));
623
687
 
624
688
  if (diff[0] !== diff[1]) {
625
689
  var multiline = text.split("\n"),
@@ -627,8 +691,10 @@ function setTextValue(node, text, dy, toMiddle) {
627
691
  // reset possible text
628
692
  node.html("");
629
693
  multiline.forEach(function (v, i) {
694
+ _newArrowCheck(this, _this4);
695
+
630
696
  node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
631
- });
697
+ }.bind(this));
632
698
  }
633
699
  }
634
700
  }
@@ -707,11 +773,14 @@ function getPathBox(path) {
707
773
  function getPointer(event, element) {
708
774
  var _ref,
709
775
  touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
710
- pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
776
+ pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
777
+ _this5 = this;
711
778
 
712
779
  return pointer.map(function (v) {
780
+ _newArrowCheck(this, _this5);
781
+
713
782
  return isNaN(v) ? 0 : v;
714
- });
783
+ }.bind(this));
715
784
  }
716
785
  /**
717
786
  * Return brush selection array
@@ -838,7 +907,9 @@ function brushEmpty(ctx) {
838
907
 
839
908
 
840
909
  function deepClone() {
841
- for (var clone = function (v) {
910
+ for (var _this6 = this, clone = function (v) {
911
+ _newArrowCheck(this, _this6);
912
+
842
913
  if (isObject(v) && v.constructor) {
843
914
  var r = new v.constructor();
844
915
 
@@ -850,15 +921,19 @@ function deepClone() {
850
921
  }
851
922
 
852
923
  return v;
853
- }, _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
924
+ }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
854
925
  objectN[_key3] = arguments[_key3];
855
926
  }
856
927
 
857
928
  return objectN.map(function (v) {
929
+ _newArrowCheck(this, _this6);
930
+
858
931
  return clone(v);
859
- }).reduce(function (a, c) {
932
+ }.bind(this)).reduce(function (a, c) {
933
+ _newArrowCheck(this, _this6);
934
+
860
935
  return util_objectSpread(util_objectSpread({}, a), c);
861
- });
936
+ }.bind(this));
862
937
  }
863
938
  /**
864
939
  * Extend target from source object
@@ -870,14 +945,18 @@ function deepClone() {
870
945
 
871
946
 
872
947
  function extend(target, source) {
948
+ var _this7 = this;
949
+
873
950
  if (target === void 0) {
874
951
  target = {};
875
952
  }
876
953
 
877
954
  if (isArray(source)) {
878
955
  source.forEach(function (v) {
956
+ _newArrowCheck(this, _this7);
957
+
879
958
  return extend(target, v);
880
- });
959
+ }.bind(this));
881
960
  } // exclude name with only numbers
882
961
 
883
962
 
@@ -900,8 +979,10 @@ function extend(target, source) {
900
979
 
901
980
 
902
981
  var capitalize = function (str) {
982
+ _newArrowCheck(this, util_this);
983
+
903
984
  return str.charAt(0).toUpperCase() + str.slice(1);
904
- };
985
+ }.bind(undefined);
905
986
  /**
906
987
  * Camelize from kebob style string
907
988
  * @param {string} str Target string
@@ -912,13 +993,17 @@ var capitalize = function (str) {
912
993
 
913
994
 
914
995
  function camelize(str, separator) {
996
+ var _this8 = this;
997
+
915
998
  if (separator === void 0) {
916
999
  separator = "-";
917
1000
  }
918
1001
 
919
1002
  return str.split(separator).map(function (v, i) {
1003
+ _newArrowCheck(this, _this8);
1004
+
920
1005
  return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
921
- }).join("");
1006
+ }.bind(this)).join("");
922
1007
  }
923
1008
  /**
924
1009
  * Convert to array
@@ -929,8 +1014,33 @@ function camelize(str, separator) {
929
1014
 
930
1015
 
931
1016
  var toArray = function (v) {
1017
+ _newArrowCheck(this, util_this);
1018
+
932
1019
  return [].slice.call(v);
933
- };
1020
+ }.bind(undefined);
1021
+ /**
1022
+ * Add CSS rules
1023
+ * @param {object} style Style object
1024
+ * @param {string} selector Selector string
1025
+ * @param {Array} prop Prps arrary
1026
+ * @returns {number} Newely added rule index
1027
+ * @private
1028
+ */
1029
+
1030
+
1031
+ function addCssRules(style, selector, prop) {
1032
+ var _this9 = this,
1033
+ rootSelctor = style.rootSelctor,
1034
+ sheet = style.sheet,
1035
+ getSelector = function (s) {
1036
+ _newArrowCheck(this, _this9);
1037
+
1038
+ return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
1039
+ }.bind(this),
1040
+ rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
1041
+
1042
+ return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
1043
+ }
934
1044
  /**
935
1045
  * Get css rules for specified stylesheets
936
1046
  * @param {Array} styleSheets The stylesheets to get the rules from
@@ -940,8 +1050,12 @@ var toArray = function (v) {
940
1050
 
941
1051
 
942
1052
  function getCssRules(styleSheets) {
943
- var rules = [];
1053
+ var _this10 = this,
1054
+ rules = [];
1055
+
944
1056
  styleSheets.forEach(function (sheet) {
1057
+ _newArrowCheck(this, _this10);
1058
+
945
1059
  try {
946
1060
  if (sheet.cssRules && sheet.cssRules.length) {
947
1061
  rules = rules.concat(toArray(sheet.cssRules));
@@ -949,7 +1063,7 @@ function getCssRules(styleSheets) {
949
1063
  } catch (e) {
950
1064
  console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
951
1065
  }
952
- });
1066
+ }.bind(this));
953
1067
  return rules;
954
1068
  }
955
1069
  /**
@@ -981,13 +1095,19 @@ function getTranslation(node) {
981
1095
 
982
1096
 
983
1097
  function getUnique(data) {
984
- var isDate = data[0] instanceof Date,
1098
+ var _this11 = this,
1099
+ isDate = data[0] instanceof Date,
985
1100
  d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
1101
+ _newArrowCheck(this, _this11);
1102
+
986
1103
  return self.indexOf(v) === i;
987
- });
1104
+ }.bind(this));
1105
+
988
1106
  return isDate ? d.map(function (v) {
1107
+ _newArrowCheck(this, _this11);
1108
+
989
1109
  return new Date(v);
990
- }) : d;
1110
+ }.bind(this)) : d;
991
1111
  }
992
1112
  /**
993
1113
  * Merge array
@@ -998,9 +1118,13 @@ function getUnique(data) {
998
1118
 
999
1119
 
1000
1120
  function mergeArray(arr) {
1121
+ var _this12 = this;
1122
+
1001
1123
  return arr && arr.length ? arr.reduce(function (p, c) {
1124
+ _newArrowCheck(this, _this12);
1125
+
1002
1126
  return p.concat(c);
1003
- }) : [];
1127
+ }.bind(this)) : [];
1004
1128
  }
1005
1129
  /**
1006
1130
  * Merge object returning new object
@@ -1012,7 +1136,7 @@ function mergeArray(arr) {
1012
1136
 
1013
1137
 
1014
1138
  function mergeObj(target) {
1015
- for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1139
+ for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1016
1140
  objectN[_key4 - 1] = arguments[_key4];
1017
1141
  }
1018
1142
 
@@ -1024,6 +1148,8 @@ function mergeObj(target) {
1024
1148
 
1025
1149
  if (isObject(target) && isObject(source)) {
1026
1150
  Object.keys(source).forEach(function (key) {
1151
+ _newArrowCheck(this, _this13);
1152
+
1027
1153
  var value = source[key];
1028
1154
 
1029
1155
  if (isObject(value)) {
@@ -1032,7 +1158,7 @@ function mergeObj(target) {
1032
1158
  } else {
1033
1159
  target[key] = isArray(value) ? value.concat() : value;
1034
1160
  }
1035
- });
1161
+ }.bind(this));
1036
1162
  }
1037
1163
 
1038
1164
  return mergeObj.apply(void 0, [target].concat(objectN));
@@ -1047,6 +1173,8 @@ function mergeObj(target) {
1047
1173
 
1048
1174
 
1049
1175
  function sortValue(data, isAsc) {
1176
+ var _this14 = this;
1177
+
1050
1178
  if (isAsc === void 0) {
1051
1179
  isAsc = !0;
1052
1180
  }
@@ -1055,19 +1183,27 @@ function sortValue(data, isAsc) {
1055
1183
 
1056
1184
  if (data[0] instanceof Date) {
1057
1185
  fn = isAsc ? function (a, b) {
1186
+ _newArrowCheck(this, _this14);
1187
+
1058
1188
  return a - b;
1059
- } : function (a, b) {
1189
+ }.bind(this) : function (a, b) {
1190
+ _newArrowCheck(this, _this14);
1191
+
1060
1192
  return b - a;
1061
- };
1193
+ }.bind(this);
1062
1194
  } else {
1063
1195
  if (isAsc && !data.every(isNaN)) {
1064
1196
  fn = function (a, b) {
1197
+ _newArrowCheck(this, _this14);
1198
+
1065
1199
  return a - b;
1066
- };
1200
+ }.bind(this);
1067
1201
  } else if (!isAsc) {
1068
1202
  fn = function (a, b) {
1203
+ _newArrowCheck(this, _this14);
1204
+
1069
1205
  return a > b && -1 || a < b && 1 || a === b && 0;
1070
- };
1206
+ }.bind(this);
1071
1207
  }
1072
1208
  }
1073
1209
 
@@ -1083,9 +1219,12 @@ function sortValue(data, isAsc) {
1083
1219
 
1084
1220
 
1085
1221
  function getMinMax(type, data) {
1086
- var res = data.filter(function (v) {
1222
+ var _this15 = this,
1223
+ res = data.filter(function (v) {
1224
+ _newArrowCheck(this, _this15);
1225
+
1087
1226
  return notEmpty(v);
1088
- });
1227
+ }.bind(this));
1089
1228
 
1090
1229
  if (res.length) {
1091
1230
  if (isNumber(res[0])) {
@@ -1114,6 +1253,8 @@ var getRange = function (start, end, step) {
1114
1253
  step = 1;
1115
1254
  }
1116
1255
 
1256
+ _newArrowCheck(this, util_this);
1257
+
1117
1258
  var res = [],
1118
1259
  n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1119
1260
 
@@ -1122,10 +1263,16 @@ var getRange = function (start, end, step) {
1122
1263
  }
1123
1264
 
1124
1265
  return res;
1125
- },
1266
+ }.bind(undefined),
1126
1267
  emulateEvent = {
1127
1268
  mouse: function () {
1269
+ var _this16 = this;
1270
+
1271
+ _newArrowCheck(this, util_this);
1272
+
1128
1273
  var getParams = function () {
1274
+ _newArrowCheck(this, _this16);
1275
+
1129
1276
  return {
1130
1277
  bubbles: !1,
1131
1278
  cancelable: !1,
@@ -1134,7 +1281,7 @@ var getRange = function (start, end, step) {
1134
1281
  clientX: 0,
1135
1282
  clientY: 0
1136
1283
  };
1137
- };
1284
+ }.bind(this);
1138
1285
 
1139
1286
  try {
1140
1287
  // eslint-disable-next-line no-new
@@ -1144,8 +1291,10 @@ var getRange = function (start, end, step) {
1144
1291
  params = getParams();
1145
1292
  }
1146
1293
 
1294
+ _newArrowCheck(this, _this16);
1295
+
1147
1296
  el.dispatchEvent(new MouseEvent(eventType, params));
1148
- };
1297
+ }.bind(this);
1149
1298
  } catch (e) {
1150
1299
  // Polyfills DOM4 MouseEvent
1151
1300
  return function (el, eventType, params) {
@@ -1153,15 +1302,19 @@ var getRange = function (start, end, step) {
1153
1302
  params = getParams();
1154
1303
  }
1155
1304
 
1305
+ _newArrowCheck(this, _this16);
1306
+
1156
1307
  var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1157
1308
 
1158
1309
  mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
1159
1310
  params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1160
1311
  el.dispatchEvent(mouseEvent);
1161
- };
1312
+ }.bind(this);
1162
1313
  }
1163
- }(),
1314
+ }.bind(undefined)(),
1164
1315
  touch: function touch(el, eventType, params) {
1316
+ _newArrowCheck(this, util_this);
1317
+
1165
1318
  var touchObj = new Touch(mergeObj({
1166
1319
  identifier: Date.now(),
1167
1320
  target: el,
@@ -1178,7 +1331,7 @@ var getRange = function (start, end, step) {
1178
1331
  targetTouches: [],
1179
1332
  changedTouches: [touchObj]
1180
1333
  }));
1181
- }
1334
+ }.bind(undefined)
1182
1335
  }; // emulate event
1183
1336
 
1184
1337
 
@@ -1250,7 +1403,8 @@ function isTabVisible() {
1250
1403
 
1251
1404
 
1252
1405
  function convertInputType(mouse, touch) {
1253
- var DocumentTouch = win.DocumentTouch,
1406
+ var _this17 = this,
1407
+ DocumentTouch = win.DocumentTouch,
1254
1408
  matchMedia = win.matchMedia,
1255
1409
  navigator = win.navigator,
1256
1410
  hasTouch = !1;
@@ -1278,12 +1432,106 @@ function convertInputType(mouse, touch) {
1278
1432
 
1279
1433
 
1280
1434
  var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1435
+ _newArrowCheck(this, _this17);
1436
+
1281
1437
  return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1282
- }); // fallback to 'mouse' if no input type is detected.
1438
+ }.bind(this)); // fallback to 'mouse' if no input type is detected.
1283
1439
 
1284
1440
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1285
1441
  }
1442
+ /**
1443
+ * Create and run on Web Worker
1444
+ * @param {boolean} useWorker Use Web Worker
1445
+ * @param {Function} fn Function to be executed in worker
1446
+ * @param {Function} callback Callback function to receive result from worker
1447
+ * @param {Array} depsFn Dependency functions to run given function(fn).
1448
+ * @returns {object}
1449
+ * @example
1450
+ * const worker = runWorker(function(arg) {
1451
+ * // do some tasks...
1452
+ * console.log("param:", A(arg));
1453
+ *
1454
+ * return 1234;
1455
+ * }, function(data) {
1456
+ * // callback after worker is done
1457
+ * console.log("result:", data);
1458
+ * },
1459
+ * [function A(){}]
1460
+ * );
1461
+ *
1462
+ * worker(11111);
1463
+ * @private
1464
+ */
1465
+
1466
+
1467
+ function runWorker(useWorker, fn, callback, depsFn) {
1468
+ if (useWorker === void 0) {
1469
+ useWorker = !0;
1470
+ }
1471
+
1472
+ var runFn;
1473
+
1474
+ if (win.Worker && useWorker) {
1475
+ var _depsFn$map$join,
1476
+ blob = new Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fn.toString() + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
1477
+ type: "text/javascript"
1478
+ }),
1479
+ worker = new Worker(URL.createObjectURL(blob));
1480
+
1481
+ runFn = function () {
1482
+ for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1483
+ args[_key5] = arguments[_key5];
1484
+ }
1485
+
1486
+ // trigger worker
1487
+ worker.postMessage(args); // listen worker
1488
+
1489
+ worker.onmessage = function (e) {
1490
+ return callback(e.data);
1491
+ }; // handle error
1492
+
1493
+
1494
+ worker.onerror = function (e) {
1495
+ console.error(e);
1496
+ }; // return new Promise((resolve, reject) => {
1497
+ // worker.onmessage = ({data}) => resolve(data);
1498
+ // worker.onerror = reject;
1499
+ // });
1500
+
1501
+ };
1502
+ } else {
1503
+ runFn = function () {
1504
+ var res = fn.apply(void 0, arguments);
1505
+ callback(res);
1506
+ };
1507
+ }
1508
+
1509
+ return runFn;
1510
+ }
1511
+ /**
1512
+ * Run function until given condition function return true
1513
+ * @param {Function} fn Function to be executed when condition is true
1514
+ * @param {Function} conditionFn Condition function to check if condition is true
1515
+ * @private
1516
+ */
1517
+
1518
+
1519
+ function runUntil(fn, conditionFn) {
1520
+ var _this18 = this;
1521
+
1522
+ if (conditionFn() === !1) {
1523
+ win.requestAnimationFrame(function () {
1524
+ _newArrowCheck(this, _this18);
1525
+
1526
+ return runUntil(fn, conditionFn);
1527
+ }.bind(this));
1528
+ } else {
1529
+ fn();
1530
+ }
1531
+ }
1286
1532
  ;// CONCATENATED MODULE: ./src/config/config.ts
1533
+
1534
+
1287
1535
  /**
1288
1536
  * Copyright (c) 2017 ~ present NAVER Corp.
1289
1537
  * billboard.js project is licensed under the MIT license
@@ -1296,11 +1544,14 @@ function convertInputType(mouse, touch) {
1296
1544
  * @private
1297
1545
  */
1298
1546
  function loadConfig(config) {
1299
- var thisConfig = this.config,
1547
+ var _this = this,
1548
+ thisConfig = this.config,
1300
1549
  target,
1301
1550
  keys,
1302
1551
  read,
1303
1552
  find = function () {
1553
+ _newArrowCheck(this, _this);
1554
+
1304
1555
  var key = keys.shift();
1305
1556
 
1306
1557
  if (key && target && isObjectType(target) && key in target) {
@@ -1311,9 +1562,11 @@ function loadConfig(config) {
1311
1562
  }
1312
1563
 
1313
1564
  return undefined;
1314
- };
1565
+ }.bind(this);
1315
1566
 
1316
1567
  Object.keys(thisConfig).forEach(function (key) {
1568
+ _newArrowCheck(this, _this);
1569
+
1317
1570
  target = config;
1318
1571
  keys = key.split("_");
1319
1572
  read = find();
@@ -1321,12 +1574,13 @@ function loadConfig(config) {
1321
1574
  if (isDefined(read)) {
1322
1575
  thisConfig[key] = read;
1323
1576
  }
1324
- });
1577
+ }.bind(this));
1325
1578
  }
1326
1579
  ;// CONCATENATED MODULE: ./src/Plugin/sparkline/index.ts
1327
1580
 
1328
1581
 
1329
1582
 
1583
+
1330
1584
  /**
1331
1585
  * Copyright (c) 2021 ~ present NAVER Corp.
1332
1586
  * billboard.js project is licensed under the MIT license
@@ -1443,17 +1697,34 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1443
1697
  };
1444
1698
 
1445
1699
  _proto.overrideOptions = function overrideOptions() {
1446
- var config = this.$$.config;
1700
+ var _this2 = this,
1701
+ config = this.$$.config;
1702
+
1447
1703
  config.legend_show = !1;
1448
1704
  config.resize_auto = !1;
1449
- config.axis_x_show = !1;
1450
- config.axis_x_padding = {
1451
- left: 15,
1452
- right: 15,
1453
- unit: "px"
1454
- };
1705
+ config.axis_x_show = !1; // set default axes padding
1706
+
1707
+ if (config.padding !== !1) {
1708
+ var hasOption = function (o) {
1709
+ _newArrowCheck(this, _this2);
1710
+
1711
+ return Object.keys(o || {}).length > 0;
1712
+ }.bind(this);
1713
+
1714
+ if (hasOption(config.axis_x_padding)) {
1715
+ config.axis_x_padding = {
1716
+ left: 15,
1717
+ right: 15,
1718
+ unit: "px"
1719
+ };
1720
+ }
1721
+
1722
+ if (hasOption(config.axis_y_padding)) {
1723
+ config.axis_y_padding = 5;
1724
+ }
1725
+ }
1726
+
1455
1727
  config.axis_y_show = !1;
1456
- config.axis_y_padding = 5;
1457
1728
 
1458
1729
  if (!config.tooltip_position) {
1459
1730
  config.tooltip_position = function (data, width, height) {
@@ -1478,11 +1749,12 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1478
1749
  };
1479
1750
 
1480
1751
  _proto.$init = function $init() {
1481
- var $$ = this.$$,
1482
- $el = $$.$el;
1752
+ var _$el$tooltip,
1753
+ $el = this.$$.$el;
1754
+
1483
1755
  // make disable-ish main chart element
1484
1756
  $el.chart.style("width", "0").style("height", "0").style("pointer-events", "none");
1485
- document.body.appendChild($el.tooltip.node());
1757
+ ((_$el$tooltip = $el.tooltip) == null ? void 0 : _$el$tooltip.node()) && document.body.appendChild($el.tooltip.node());
1486
1758
  };
1487
1759
 
1488
1760
  _proto.$afterInit = function $afterInit() {
@@ -1498,20 +1770,24 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1498
1770
  ;
1499
1771
 
1500
1772
  _proto.bindEvents = function bindEvents(bind) {
1501
- var _this2 = this;
1773
+ var _this3 = this;
1502
1774
 
1503
1775
  if (bind === void 0) {
1504
1776
  bind = !0;
1505
1777
  }
1506
1778
 
1507
- if (this.$$.config.interaction_enabled) {
1779
+ var config = this.$$.config;
1780
+
1781
+ if (config.interaction_enabled && config.tooltip_show) {
1508
1782
  var method = (bind ? "add" : "remove") + "EventListener";
1509
1783
  this.element.forEach(function (el) {
1784
+ _newArrowCheck(this, _this3);
1785
+
1510
1786
  var svg = el.querySelector("svg");
1511
- svg[method]("mouseover", _this2.overHandler);
1512
- svg[method]("mousemove", _this2.moveHandler);
1513
- svg[method]("mouseout", _this2.outHandler);
1514
- });
1787
+ svg[method]("mouseover", this.overHandler);
1788
+ svg[method]("mousemove", this.moveHandler);
1789
+ svg[method]("mouseout", this.outHandler);
1790
+ }.bind(this));
1515
1791
  }
1516
1792
  };
1517
1793
 
@@ -1523,12 +1799,11 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1523
1799
 
1524
1800
  _proto.moveHandler = function moveHandler(e) {
1525
1801
  var _$$$api$data,
1526
- _data,
1527
1802
  _data$values,
1528
1803
  $$ = this.$$,
1529
1804
  index = $$.getDataIndexFromEvent(e),
1530
1805
  data = (_$$$api$data = $$.api.data(e.target.__id)) == null ? void 0 : _$$$api$data[0],
1531
- d = (_data = data) == null ? void 0 : (_data$values = _data.values) == null ? void 0 : _data$values[index];
1806
+ d = data == null ? void 0 : (_data$values = data.values) == null ? void 0 : _data$values[index];
1532
1807
 
1533
1808
  if (d && !d.name) {
1534
1809
  d.name = d.id;
@@ -1552,7 +1827,8 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1552
1827
  $el = $$.$el,
1553
1828
  el = this.element,
1554
1829
  data = $$.api.data(),
1555
- svgWrapper = (_$el$chart$html$match = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _$el$chart$html$match[0];
1830
+ svgWrapper = (_$el$chart$html$match = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _$el$chart$html$match[0],
1831
+ _this4 = this;
1556
1832
 
1557
1833
  // append sparkline holder if is less than the data length
1558
1834
  if (el.length < data.length) {
@@ -1567,8 +1843,12 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1567
1843
  }
1568
1844
 
1569
1845
  data.map(function (v) {
1846
+ _newArrowCheck(this, _this4);
1847
+
1570
1848
  return v.id;
1571
- }).forEach(function (id, i) {
1849
+ }.bind(this)).forEach(function (id, i) {
1850
+ _newArrowCheck(this, _this4);
1851
+
1572
1852
  var selector = "." + $COMMON.target + "-" + id,
1573
1853
  shape = $el.main.selectAll(selector),
1574
1854
  svg = el[i].querySelector("svg");
@@ -1586,14 +1866,18 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
1586
1866
  shape.style("fill", "none").style("opacity", null);
1587
1867
  svg.innerHTML = "";
1588
1868
  svg.appendChild(shape.node());
1589
- });
1869
+ }.bind(this));
1590
1870
  };
1591
1871
 
1592
1872
  _proto.$willDestroy = function $willDestroy() {
1873
+ var _this5 = this;
1874
+
1593
1875
  this.bindEvents(!1);
1594
1876
  this.element.forEach(function (el) {
1877
+ _newArrowCheck(this, _this5);
1878
+
1595
1879
  el.innerHTML = "";
1596
- });
1880
+ }.bind(this));
1597
1881
  };
1598
1882
 
1599
1883
  return Sparkline;