billboard.js 3.6.0 → 3.6.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.
Files changed (39) hide show
  1. package/README.md +13 -77
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +4531 -7081
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +7931 -11567
  7. package/dist/billboard.pkgd.min.js +2 -3
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2121 -2265
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2892 -3502
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3146 -4013
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2921 -3514
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3037 -3835
  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 +54 -38
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
  35. package/package.json +23 -23
  36. package/src/ChartInternal/data/IData.ts +8 -2
  37. package/src/ChartInternal/interactions/eventrect.ts +22 -13
  38. package/src/ChartInternal/interactions/interaction.ts +39 -26
  39. package/types/options.d.ts +7 -0
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0
8
+ * @version 3.6.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -102,7 +102,6 @@ function _defineProperty(obj, key, value) {
102
102
  } else {
103
103
  obj[key] = value;
104
104
  }
105
-
106
105
  return obj;
107
106
  }
108
107
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
@@ -116,7 +115,6 @@ function _assertThisInitialized(self) {
116
115
  if (self === void 0) {
117
116
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
118
117
  }
119
-
120
118
  return self;
121
119
  }
122
120
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
@@ -136,17 +134,14 @@ function _inheritsLoose(subClass, superClass) {
136
134
  }
137
135
  ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
138
136
 
139
-
140
137
  /**
141
138
  * Copyright (c) 2017 ~ present NAVER Corp.
142
139
  * billboard.js project is licensed under the MIT license
143
140
  */
144
-
145
141
  /**
146
142
  * Base class to generate billboard.js plugin
147
143
  * @class Plugin
148
144
  */
149
-
150
145
  /**
151
146
  * Version info string for plugin
152
147
  * @name version
@@ -166,69 +161,57 @@ var Plugin = /*#__PURE__*/function () {
166
161
  if (options === void 0) {
167
162
  options = {};
168
163
  }
169
-
170
164
  this.$$ = void 0;
171
165
  this.options = void 0;
172
166
  this.options = options;
173
167
  }
168
+
174
169
  /**
175
170
  * Lifecycle hook for 'beforeInit' phase.
176
171
  * @private
177
172
  */
178
-
179
-
180
173
  var _proto = Plugin.prototype;
181
-
182
174
  _proto.$beforeInit = function $beforeInit() {}
175
+
183
176
  /**
184
177
  * Lifecycle hook for 'init' phase.
185
178
  * @private
186
- */
187
- ;
188
-
179
+ */;
189
180
  _proto.$init = function $init() {}
181
+
190
182
  /**
191
183
  * Lifecycle hook for 'afterInit' phase.
192
184
  * @private
193
- */
194
- ;
195
-
185
+ */;
196
186
  _proto.$afterInit = function $afterInit() {}
187
+
197
188
  /**
198
189
  * Lifecycle hook for 'redraw' phase.
199
190
  * @private
200
- */
201
- ;
202
-
191
+ */;
203
192
  _proto.$redraw = function $redraw() {}
193
+
204
194
  /**
205
195
  * Lifecycle hook for 'willDestroy' phase.
206
196
  * @private
207
- */
208
- ;
209
-
197
+ */;
210
198
  _proto.$willDestroy = function $willDestroy() {
211
199
  var _this = this;
212
-
213
200
  Object.keys(this).forEach(function (key) {
214
201
  _newArrowCheck(this, _this);
215
-
216
202
  this[key] = null;
217
203
  delete this[key];
218
204
  }.bind(this));
219
205
  };
220
-
221
206
  return Plugin;
222
207
  }();
223
-
224
- Plugin.version = "3.6.0";
208
+ Plugin.version = "3.6.2";
225
209
 
226
210
  ;// CONCATENATED MODULE: ./src/Plugin/tableview/Options.ts
227
211
  /**
228
212
  * Copyright (c) 2021 ~ present NAVER Corp.
229
213
  * billboard.js project is licensed under the MIT license
230
214
  */
231
-
232
215
  /**
233
216
  * TableView plugin option class
234
217
  * @class TableviewOptions
@@ -250,7 +233,6 @@ var Options = function () {
250
233
  * selector: "#table-holder"
251
234
  */
252
235
  selector: undefined,
253
-
254
236
  /**
255
237
  * Set category title text
256
238
  * @name categoryTitle
@@ -261,7 +243,6 @@ var Options = function () {
261
243
  * categoryTitle: "#table-holder"
262
244
  */
263
245
  categoryTitle: "Category",
264
-
265
246
  /**
266
247
  * Set category text format function.
267
248
  * @name categoryFormat
@@ -274,16 +255,13 @@ var Options = function () {
274
255
  */
275
256
  categoryFormat: function categoryFormat(v) {
276
257
  var category = v;
277
-
278
258
  if (this.$$.axis.isCategorized()) {
279
259
  category = this.$$.categoryName(v);
280
260
  } else if (this.$$.axis.isTimeSeries()) {
281
261
  category = v.toLocaleDateString();
282
262
  }
283
-
284
263
  return category;
285
264
  },
286
-
287
265
  /**
288
266
  * Set tableview holder class name.
289
267
  * @name class
@@ -294,7 +272,6 @@ var Options = function () {
294
272
  * class: "table-class-name"
295
273
  */
296
274
  class: undefined,
297
-
298
275
  /**
299
276
  * Set to apply default style(`.bb-tableview`) to tableview element.
300
277
  * @name style
@@ -305,7 +282,6 @@ var Options = function () {
305
282
  * style: false
306
283
  */
307
284
  style: !0,
308
-
309
285
  /**
310
286
  * Set tableview title text.
311
287
  * - **NOTE:** If set [title.text](https://naver.github.io/billboard.js/release/latest/doc/Options.html#.title), will be used when this option value is empty.
@@ -317,7 +293,6 @@ var Options = function () {
317
293
  * title: "Table Title Text"
318
294
  */
319
295
  title: undefined,
320
-
321
296
  /**
322
297
  * Update tableview from data visibility update(ex. legend toggle).
323
298
  * @name updateOnToggle
@@ -331,85 +306,68 @@ var Options = function () {
331
306
  };
332
307
  };
333
308
 
334
-
335
309
  ;// CONCATENATED MODULE: ./src/Plugin/tableview/const.ts
336
310
  /**
337
311
  * Copyright (c) 2021 ~ present NAVER Corp.
338
312
  * billboard.js project is licensed under the MIT license
339
313
  */
340
-
341
314
  /**
342
315
  * Constants values for plugin option
343
316
  * @ignore
344
317
  */
345
318
 
346
319
  var defaultStyle = {
347
- id: "__tableview-style__",
348
- class: "bb-tableview",
349
- 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}"
350
- },
351
- tpl = {
352
- body: "<caption>{=title}</caption>\n\t\t<thead><tr>{=thead}</tr></thead>\n\t\t<tbody>{=tbody}</tbody>",
353
- thead: "<th scope=\"col\">{=title}</th>",
354
- tbodyHeader: "<th scope=\"row\">{=value}</th>",
355
- tbody: "<td>{=value}</td>"
356
- }; // template
320
+ id: "__tableview-style__",
321
+ class: "bb-tableview",
322
+ 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}"
323
+ },
324
+ tpl = {
325
+ body: "<caption>{=title}</caption>\n\t\t<thead><tr>{=thead}</tr></thead>\n\t\t<tbody>{=tbody}</tbody>",
326
+ thead: "<th scope=\"col\">{=title}</th>",
327
+ tbodyHeader: "<th scope=\"row\">{=value}</th>",
328
+ tbody: "<td>{=value}</td>"
329
+ }; // template
357
330
  // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
358
331
  var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
359
332
  // EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
360
333
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
361
334
  ;// CONCATENATED MODULE: ./src/module/browser.ts
362
335
 
363
-
364
336
  var _this = undefined;
365
-
366
337
  /**
367
338
  * Copyright (c) 2017 ~ present NAVER Corp.
368
339
  * billboard.js project is licensed under the MIT license
369
340
  */
370
-
371
341
  /**
372
342
  * Window object
373
343
  * @private
374
344
  */
375
-
376
345
  /* eslint-disable no-new-func, no-undef */
377
346
 
378
-
379
347
  var win = function () {
380
348
  _newArrowCheck(this, _this);
381
-
382
349
  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;
383
350
  return root || Function("return this")();
384
351
  }.bind(undefined)();
385
352
  /* eslint-enable no-new-func, no-undef */
386
- // fallback for non-supported environments
387
-
388
353
 
354
+ // fallback for non-supported environments
389
355
  win.requestIdleCallback = win.requestIdleCallback || function (cb) {
390
356
  _newArrowCheck(this, _this);
391
-
392
357
  return setTimeout(cb, 1);
393
- }.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
394
-
395
-
358
+ }.bind(undefined);
359
+ // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
396
360
  win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
397
361
  _newArrowCheck(this, _this);
398
-
399
362
  return setTimeout(cb, 1);
400
363
  }.bind(undefined);
401
-
402
364
  var doc = win == null ? void 0 : win.document;
403
365
  ;// CONCATENATED MODULE: ./src/module/util.ts
404
366
 
405
367
 
406
-
407
368
  var util_this = undefined;
408
-
409
369
  function 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; }
410
-
411
370
  function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
412
-
413
371
  /**
414
372
  * Copyright (c) 2017 ~ present NAVER Corp.
415
373
  * billboard.js project is licensed under the MIT license
@@ -419,83 +377,66 @@ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i
419
377
 
420
378
 
421
379
 
422
-
423
380
  var isValue = function (v) {
424
- _newArrowCheck(this, util_this);
425
-
426
- return v || v === 0;
427
- }.bind(undefined),
428
- isFunction = function (v) {
429
- _newArrowCheck(this, util_this);
430
-
431
- return typeof v === "function";
432
- }.bind(undefined),
433
- isString = function (v) {
434
- _newArrowCheck(this, util_this);
435
-
436
- return typeof v === "string";
437
- }.bind(undefined),
438
- isNumber = function (v) {
439
- _newArrowCheck(this, util_this);
440
-
441
- return typeof v === "number";
442
- }.bind(undefined),
443
- isUndefined = function (v) {
444
- _newArrowCheck(this, util_this);
445
-
446
- return typeof v === "undefined";
447
- }.bind(undefined),
448
- isDefined = function (v) {
449
- _newArrowCheck(this, util_this);
450
-
451
- return typeof v !== "undefined";
452
- }.bind(undefined),
453
- isboolean = function (v) {
454
- _newArrowCheck(this, util_this);
455
-
456
- return typeof v === "boolean";
457
- }.bind(undefined),
458
- ceil10 = function (v) {
459
- _newArrowCheck(this, util_this);
460
-
461
- return Math.ceil(v / 10) * 10;
462
- }.bind(undefined),
463
- asHalfPixel = function (n) {
464
- _newArrowCheck(this, util_this);
465
-
466
- return Math.ceil(n) + .5;
467
- }.bind(undefined),
468
- diffDomain = function (d) {
469
- _newArrowCheck(this, util_this);
470
-
471
- return d[1] - d[0];
472
- }.bind(undefined),
473
- isObjectType = function (v) {
474
- _newArrowCheck(this, util_this);
475
-
476
- return typeof v === "object";
477
- }.bind(undefined),
478
- isEmpty = function (o) {
479
- _newArrowCheck(this, util_this);
480
-
481
- return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
482
- }.bind(undefined),
483
- notEmpty = function (o) {
484
- _newArrowCheck(this, util_this);
485
-
486
- return !isEmpty(o);
487
- }.bind(undefined),
488
- isArray = function (arr) {
489
- _newArrowCheck(this, util_this);
490
-
491
- return Array.isArray(arr);
492
- }.bind(undefined),
493
- isObject = function (obj) {
494
- _newArrowCheck(this, util_this);
495
-
496
- return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
497
- }.bind(undefined);
498
-
381
+ _newArrowCheck(this, util_this);
382
+ return v || v === 0;
383
+ }.bind(undefined),
384
+ isFunction = function (v) {
385
+ _newArrowCheck(this, util_this);
386
+ return typeof v === "function";
387
+ }.bind(undefined),
388
+ isString = function (v) {
389
+ _newArrowCheck(this, util_this);
390
+ return typeof v === "string";
391
+ }.bind(undefined),
392
+ isNumber = function (v) {
393
+ _newArrowCheck(this, util_this);
394
+ return typeof v === "number";
395
+ }.bind(undefined),
396
+ isUndefined = function (v) {
397
+ _newArrowCheck(this, util_this);
398
+ return typeof v === "undefined";
399
+ }.bind(undefined),
400
+ isDefined = function (v) {
401
+ _newArrowCheck(this, util_this);
402
+ return typeof v !== "undefined";
403
+ }.bind(undefined),
404
+ isboolean = function (v) {
405
+ _newArrowCheck(this, util_this);
406
+ return typeof v === "boolean";
407
+ }.bind(undefined),
408
+ ceil10 = function (v) {
409
+ _newArrowCheck(this, util_this);
410
+ return Math.ceil(v / 10) * 10;
411
+ }.bind(undefined),
412
+ asHalfPixel = function (n) {
413
+ _newArrowCheck(this, util_this);
414
+ return Math.ceil(n) + .5;
415
+ }.bind(undefined),
416
+ diffDomain = function (d) {
417
+ _newArrowCheck(this, util_this);
418
+ return d[1] - d[0];
419
+ }.bind(undefined),
420
+ isObjectType = function (v) {
421
+ _newArrowCheck(this, util_this);
422
+ return typeof v === "object";
423
+ }.bind(undefined),
424
+ isEmpty = function (o) {
425
+ _newArrowCheck(this, util_this);
426
+ return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
427
+ }.bind(undefined),
428
+ notEmpty = function (o) {
429
+ _newArrowCheck(this, util_this);
430
+ return !isEmpty(o);
431
+ }.bind(undefined),
432
+ isArray = function (arr) {
433
+ _newArrowCheck(this, util_this);
434
+ return Array.isArray(arr);
435
+ }.bind(undefined),
436
+ isObject = function (obj) {
437
+ _newArrowCheck(this, util_this);
438
+ return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
439
+ }.bind(undefined);
499
440
  /**
500
441
  * Get specified key value from object
501
442
  * If default value is given, will return if given key value not found
@@ -508,6 +449,7 @@ var isValue = function (v) {
508
449
  function getOption(options, key, defaultValue) {
509
450
  return isDefined(options[key]) ? options[key] : defaultValue;
510
451
  }
452
+
511
453
  /**
512
454
  * Check if value exist in the given object
513
455
  * @param {object} dict Target object to be checked
@@ -515,19 +457,16 @@ function getOption(options, key, defaultValue) {
515
457
  * @returns {boolean}
516
458
  * @private
517
459
  */
518
-
519
-
520
460
  function hasValue(dict, value) {
521
461
  var _this2 = this,
522
- found = !1;
523
-
462
+ found = !1;
524
463
  Object.keys(dict).forEach(function (key) {
525
464
  _newArrowCheck(this, _this2);
526
-
527
465
  return dict[key] === value && (found = !0);
528
466
  }.bind(this));
529
467
  return found;
530
468
  }
469
+
531
470
  /**
532
471
  * Call function with arguments
533
472
  * @param {Function} fn Function to be called
@@ -536,40 +475,33 @@ function hasValue(dict, value) {
536
475
  * @returns {boolean} true: fn is function, false: fn is not function
537
476
  * @private
538
477
  */
539
-
540
-
541
478
  function callFn(fn, thisArg) {
542
479
  for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
543
480
  args[_key - 2] = arguments[_key];
544
481
  }
545
-
546
482
  isFn && fn.call.apply(fn, [thisArg].concat(args));
547
483
  return isFn;
548
484
  }
485
+
549
486
  /**
550
487
  * Call function after all transitions ends
551
488
  * @param {d3.transition} transition Transition
552
489
  * @param {Fucntion} cb Callback function
553
490
  * @private
554
491
  */
555
-
556
-
557
492
  function endall(transition, cb) {
558
493
  var _this3 = this,
559
- n = 0,
560
- end = function () {
561
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
562
- args[_key2] = arguments[_key2];
563
- }
564
-
565
- --n || cb.apply.apply(cb, [this].concat(args));
566
- };
567
-
494
+ n = 0,
495
+ end = function () {
496
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
497
+ args[_key2] = arguments[_key2];
498
+ }
499
+ --n || cb.apply.apply(cb, [this].concat(args));
500
+ };
568
501
  // if is transition selection
569
502
  if ("duration" in transition) {
570
503
  transition.each(function () {
571
504
  _newArrowCheck(this, _this3);
572
-
573
505
  return ++n;
574
506
  }.bind(this)).on("end", end);
575
507
  } else {
@@ -577,17 +509,17 @@ function endall(transition, cb) {
577
509
  transition.call(end);
578
510
  }
579
511
  }
512
+
580
513
  /**
581
514
  * Replace tag sign to html entity
582
515
  * @param {string} str Target string value
583
516
  * @returns {string}
584
517
  * @private
585
518
  */
586
-
587
-
588
519
  function sanitise(str) {
589
520
  return isString(str) ? str.replace(/</g, "&lt;").replace(/>/g, "&gt;") : str;
590
521
  }
522
+
591
523
  /**
592
524
  * Set text value. If there's multiline add nodes.
593
525
  * @param {d3Selection} node Text node
@@ -596,53 +528,43 @@ function sanitise(str) {
596
528
  * @param {boolean} toMiddle To be alingned vertically middle
597
529
  * @private
598
530
  */
599
-
600
-
601
531
  function setTextValue(node, text, dy, toMiddle) {
602
532
  var _this4 = this;
603
-
604
533
  if (dy === void 0) {
605
534
  dy = [-1, 1];
606
535
  }
607
-
608
536
  if (toMiddle === void 0) {
609
537
  toMiddle = !1;
610
538
  }
611
-
612
539
  if (!node || !isString(text)) {
613
540
  return;
614
541
  }
615
-
616
542
  if (text.indexOf("\n") === -1) {
617
543
  node.text(text);
618
544
  } else {
619
545
  var diff = [node.text(), text].map(function (v) {
620
546
  _newArrowCheck(this, _this4);
621
-
622
547
  return v.replace(/[\s\n]/g, "");
623
548
  }.bind(this));
624
-
625
549
  if (diff[0] !== diff[1]) {
626
550
  var multiline = text.split("\n"),
627
- len = toMiddle ? multiline.length - 1 : 1;
551
+ len = toMiddle ? multiline.length - 1 : 1;
628
552
  // reset possible text
629
553
  node.html("");
630
554
  multiline.forEach(function (v, i) {
631
555
  _newArrowCheck(this, _this4);
632
-
633
556
  node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
634
557
  }.bind(this));
635
558
  }
636
559
  }
637
560
  }
561
+
638
562
  /**
639
563
  * Substitution of SVGPathSeg API polyfill
640
564
  * @param {SVGGraphicsElement} path Target svg element
641
565
  * @returns {Array}
642
566
  * @private
643
567
  */
644
-
645
-
646
568
  function getRectSegList(path) {
647
569
  /*
648
570
  * seg1 ---------- seg2
@@ -652,45 +574,45 @@ function getRectSegList(path) {
652
574
  * seg0 ---------- seg3
653
575
  * */
654
576
  var _path$getBBox = path.getBBox(),
655
- x = _path$getBBox.x,
656
- y = _path$getBBox.y,
657
- width = _path$getBBox.width,
658
- height = _path$getBBox.height;
659
-
577
+ x = _path$getBBox.x,
578
+ y = _path$getBBox.y,
579
+ width = _path$getBBox.width,
580
+ height = _path$getBBox.height;
660
581
  return [{
661
582
  x: x,
662
583
  y: y + height
663
- }, // seg0
584
+ },
585
+ // seg0
664
586
  {
665
587
  x: x,
666
588
  y: y
667
- }, // seg1
589
+ },
590
+ // seg1
668
591
  {
669
592
  x: x + width,
670
593
  y: y
671
- }, // seg2
594
+ },
595
+ // seg2
672
596
  {
673
597
  x: x + width,
674
598
  y: y + height
675
599
  } // seg3
676
600
  ];
677
601
  }
602
+
678
603
  /**
679
604
  * Get svg bounding path box dimension
680
605
  * @param {SVGGraphicsElement} path Target svg element
681
606
  * @returns {object}
682
607
  * @private
683
608
  */
684
-
685
-
686
609
  function getPathBox(path) {
687
610
  var _path$getBoundingClie = path.getBoundingClientRect(),
688
- width = _path$getBoundingClie.width,
689
- height = _path$getBoundingClie.height,
690
- items = getRectSegList(path),
691
- x = items[0].x,
692
- y = Math.min(items[0].y, items[1].y);
693
-
611
+ width = _path$getBoundingClie.width,
612
+ height = _path$getBoundingClie.height,
613
+ items = getRectSegList(path),
614
+ x = items[0].x,
615
+ y = Math.min(items[0].y, items[1].y);
694
616
  return {
695
617
  x: x,
696
618
  y: y,
@@ -698,6 +620,7 @@ function getPathBox(path) {
698
620
  height: height
699
621
  };
700
622
  }
623
+
701
624
  /**
702
625
  * Get event's current position coordinates
703
626
  * @param {object} event Event object
@@ -705,43 +628,38 @@ function getPathBox(path) {
705
628
  * @returns {Array} [x, y] Coordinates x, y array
706
629
  * @private
707
630
  */
708
-
709
-
710
631
  function getPointer(event, element) {
711
632
  var _ref,
712
- touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
713
- pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
714
- _this5 = this;
715
-
633
+ touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
634
+ pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
635
+ _this5 = this;
716
636
  return pointer.map(function (v) {
717
637
  _newArrowCheck(this, _this5);
718
-
719
638
  return isNaN(v) ? 0 : v;
720
639
  }.bind(this));
721
640
  }
641
+
722
642
  /**
723
643
  * Return brush selection array
724
644
  * @param {object} ctx Current instance
725
645
  * @returns {d3.brushSelection}
726
646
  * @private
727
647
  */
728
-
729
-
730
648
  function getBrushSelection(ctx) {
731
649
  var event = ctx.event,
732
- $el = ctx.$el,
733
- main = $el.subchart.main || $el.main,
734
- selection;
735
-
650
+ $el = ctx.$el,
651
+ main = $el.subchart.main || $el.main,
652
+ selection;
736
653
  // check from event
737
654
  if (event && event.type === "brush") {
738
- selection = event.selection; // check from brush area selection
655
+ selection = event.selection;
656
+ // check from brush area selection
739
657
  } else if (main && (selection = main.select(".bb-brush").node())) {
740
658
  selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
741
659
  }
742
-
743
660
  return selection;
744
661
  }
662
+
745
663
  /**
746
664
  * Get boundingClientRect.
747
665
  * Cache the evaluated value once it was called.
@@ -749,12 +667,11 @@ function getBrushSelection(ctx) {
749
667
  * @returns {object}
750
668
  * @private
751
669
  */
752
-
753
-
754
670
  function getBoundingRect(node) {
755
671
  var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
756
672
  return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
757
673
  }
674
+
758
675
  /**
759
676
  * Retrun random number
760
677
  * @param {boolean} asStr Convert returned value as string
@@ -763,24 +680,20 @@ function getBoundingRect(node) {
763
680
  * @returns {number|string}
764
681
  * @private
765
682
  */
766
-
767
-
768
683
  function getRandom(asStr, min, max) {
769
684
  if (asStr === void 0) {
770
685
  asStr = !0;
771
686
  }
772
-
773
687
  if (min === void 0) {
774
688
  min = 0;
775
689
  }
776
-
777
690
  if (max === void 0) {
778
691
  max = 1e4;
779
692
  }
780
-
781
693
  var rand = Math.floor(Math.random() * (max - min) + min);
782
694
  return asStr ? rand + "" : rand;
783
695
  }
696
+
784
697
  /**
785
698
  * Find index based on binary search
786
699
  * @param {Array} arr Data array
@@ -791,87 +704,71 @@ function getRandom(asStr, min, max) {
791
704
  * @returns {number} Index number
792
705
  * @private
793
706
  */
794
-
795
-
796
707
  function findIndex(arr, v, start, end, isRotated) {
797
708
  if (start > end) {
798
709
  return -1;
799
710
  }
800
-
801
711
  var mid = Math.floor((start + end) / 2),
802
- _arr$mid = arr[mid],
803
- x = _arr$mid.x,
804
- _arr$mid$w = _arr$mid.w,
805
- w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
806
-
712
+ _arr$mid = arr[mid],
713
+ x = _arr$mid.x,
714
+ _arr$mid$w = _arr$mid.w,
715
+ w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
807
716
  if (isRotated) {
808
717
  x = arr[mid].y;
809
718
  w = arr[mid].h;
810
719
  }
811
-
812
720
  if (v >= x && v <= x + w) {
813
721
  return mid;
814
722
  }
815
-
816
723
  return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
817
724
  }
725
+
818
726
  /**
819
727
  * Check if brush is empty
820
728
  * @param {object} ctx Bursh context
821
729
  * @returns {boolean}
822
730
  * @private
823
731
  */
824
-
825
-
826
732
  function brushEmpty(ctx) {
827
733
  var selection = getBrushSelection(ctx);
828
-
829
734
  if (selection) {
830
735
  // brush selected area
831
736
  // two-dimensional: [[x0, y0], [x1, y1]]
832
737
  // one-dimensional: [x0, x1] or [y0, y1]
833
738
  return selection[0] === selection[1];
834
739
  }
835
-
836
740
  return !0;
837
741
  }
742
+
838
743
  /**
839
744
  * Deep copy object
840
745
  * @param {object} objectN Source object
841
746
  * @returns {object} Cloned object
842
747
  * @private
843
748
  */
844
-
845
-
846
749
  function deepClone() {
847
750
  for (var _this6 = this, clone = function (v) {
848
- _newArrowCheck(this, _this6);
849
-
850
- if (isObject(v) && v.constructor) {
851
- var r = new v.constructor();
852
-
853
- for (var k in v) {
854
- r[k] = clone(v[k]);
751
+ _newArrowCheck(this, _this6);
752
+ if (isObject(v) && v.constructor) {
753
+ var r = new v.constructor();
754
+ for (var k in v) {
755
+ r[k] = clone(v[k]);
756
+ }
757
+ return r;
855
758
  }
856
-
857
- return r;
858
- }
859
-
860
- return v;
861
- }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
759
+ return v;
760
+ }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
862
761
  objectN[_key3] = arguments[_key3];
863
762
  }
864
-
865
763
  return objectN.map(function (v) {
866
764
  _newArrowCheck(this, _this6);
867
-
868
765
  return clone(v);
869
766
  }.bind(this)).reduce(function (a, c) {
870
767
  _newArrowCheck(this, _this6);
871
-
872
768
  return _objectSpread(_objectSpread({}, a), c);
873
769
  }.bind(this));
874
770
  }
771
+
875
772
  /**
876
773
  * Extend target from source object
877
774
  * @param {object} target Target object
@@ -879,47 +776,39 @@ function deepClone() {
879
776
  * @returns {object}
880
777
  * @private
881
778
  */
882
-
883
-
884
779
  function extend(target, source) {
885
780
  var _this7 = this;
886
-
887
781
  if (target === void 0) {
888
782
  target = {};
889
783
  }
890
-
891
784
  if (isArray(source)) {
892
785
  source.forEach(function (v) {
893
786
  _newArrowCheck(this, _this7);
894
-
895
787
  return extend(target, v);
896
788
  }.bind(this));
897
- } // exclude name with only numbers
898
-
789
+ }
899
790
 
791
+ // exclude name with only numbers
900
792
  for (var p in source) {
901
793
  if (/^\d+$/.test(p) || p in target) {
902
794
  continue;
903
795
  }
904
-
905
796
  target[p] = source[p];
906
797
  }
907
-
908
798
  return target;
909
799
  }
800
+
910
801
  /**
911
802
  * Return first letter capitalized
912
803
  * @param {string} str Target string
913
804
  * @returns {string} capitalized string
914
805
  * @private
915
806
  */
916
-
917
-
918
807
  var capitalize = function (str) {
919
808
  _newArrowCheck(this, util_this);
920
-
921
809
  return str.charAt(0).toUpperCase() + str.slice(1);
922
810
  }.bind(undefined);
811
+
923
812
  /**
924
813
  * Camelize from kebob style string
925
814
  * @param {string} str Target string
@@ -927,34 +816,28 @@ var capitalize = function (str) {
927
816
  * @returns {string} camelized string
928
817
  * @private
929
818
  */
930
-
931
-
932
819
  function camelize(str, separator) {
933
820
  var _this8 = this;
934
-
935
821
  if (separator === void 0) {
936
822
  separator = "-";
937
823
  }
938
-
939
824
  return str.split(separator).map(function (v, i) {
940
825
  _newArrowCheck(this, _this8);
941
-
942
826
  return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
943
827
  }.bind(this)).join("");
944
828
  }
829
+
945
830
  /**
946
831
  * Convert to array
947
832
  * @param {object} v Target to be converted
948
833
  * @returns {Array}
949
834
  * @private
950
835
  */
951
-
952
-
953
836
  var toArray = function (v) {
954
837
  _newArrowCheck(this, util_this);
955
-
956
838
  return [].slice.call(v);
957
839
  }.bind(undefined);
840
+
958
841
  /**
959
842
  * Add CSS rules
960
843
  * @param {object} style Style object
@@ -963,36 +846,29 @@ var toArray = function (v) {
963
846
  * @returns {number} Newely added rule index
964
847
  * @private
965
848
  */
966
-
967
-
968
849
  function addCssRules(style, selector, prop) {
969
850
  var _this9 = this,
970
- rootSelctor = style.rootSelctor,
971
- sheet = style.sheet,
972
- getSelector = function (s) {
973
- _newArrowCheck(this, _this9);
974
-
975
- return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
976
- }.bind(this),
977
- rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
978
-
851
+ rootSelctor = style.rootSelctor,
852
+ sheet = style.sheet,
853
+ getSelector = function (s) {
854
+ _newArrowCheck(this, _this9);
855
+ return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
856
+ }.bind(this),
857
+ rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
979
858
  return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
980
859
  }
860
+
981
861
  /**
982
862
  * Get css rules for specified stylesheets
983
863
  * @param {Array} styleSheets The stylesheets to get the rules from
984
864
  * @returns {Array}
985
865
  * @private
986
866
  */
987
-
988
-
989
867
  function getCssRules(styleSheets) {
990
868
  var _this10 = this,
991
- rules = [];
992
-
869
+ rules = [];
993
870
  styleSheets.forEach(function (sheet) {
994
871
  _newArrowCheck(this, _this10);
995
-
996
872
  try {
997
873
  if (sheet.cssRules && sheet.cssRules.length) {
998
874
  rules = rules.concat(toArray(sheet.cssRules));
@@ -1003,17 +879,16 @@ function getCssRules(styleSheets) {
1003
879
  }.bind(this));
1004
880
  return rules;
1005
881
  }
882
+
1006
883
  /**
1007
884
  * Gets the SVGMatrix of an SVGGElement
1008
885
  * @param {SVGElement} node Node element
1009
886
  * @returns {SVGMatrix} matrix
1010
887
  * @private
1011
888
  */
1012
-
1013
-
1014
889
  function getTranslation(node) {
1015
890
  var transform = node ? node.transform : null,
1016
- baseVal = transform && transform.baseVal;
891
+ baseVal = transform && transform.baseVal;
1017
892
  return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
1018
893
  a: 0,
1019
894
  b: 0,
@@ -1023,46 +898,40 @@ function getTranslation(node) {
1023
898
  f: 0
1024
899
  };
1025
900
  }
901
+
1026
902
  /**
1027
903
  * Get unique value from array
1028
904
  * @param {Array} data Source data
1029
905
  * @returns {Array} Unique array value
1030
906
  * @private
1031
907
  */
1032
-
1033
-
1034
908
  function getUnique(data) {
1035
909
  var _this11 = this,
1036
- isDate = data[0] instanceof Date,
1037
- d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
1038
- _newArrowCheck(this, _this11);
1039
-
1040
- return self.indexOf(v) === i;
1041
- }.bind(this));
1042
-
910
+ isDate = data[0] instanceof Date,
911
+ d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
912
+ _newArrowCheck(this, _this11);
913
+ return self.indexOf(v) === i;
914
+ }.bind(this));
1043
915
  return isDate ? d.map(function (v) {
1044
916
  _newArrowCheck(this, _this11);
1045
-
1046
917
  return new Date(v);
1047
918
  }.bind(this)) : d;
1048
919
  }
920
+
1049
921
  /**
1050
922
  * Merge array
1051
923
  * @param {Array} arr Source array
1052
924
  * @returns {Array}
1053
925
  * @private
1054
926
  */
1055
-
1056
-
1057
927
  function mergeArray(arr) {
1058
928
  var _this12 = this;
1059
-
1060
929
  return arr && arr.length ? arr.reduce(function (p, c) {
1061
930
  _newArrowCheck(this, _this12);
1062
-
1063
931
  return p.concat(c);
1064
932
  }.bind(this)) : [];
1065
933
  }
934
+
1066
935
  /**
1067
936
  * Merge object returning new object
1068
937
  * @param {object} target Target object
@@ -1070,25 +939,18 @@ function mergeArray(arr) {
1070
939
  * @returns {object} merged target object
1071
940
  * @private
1072
941
  */
1073
-
1074
-
1075
942
  function mergeObj(target) {
1076
943
  for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1077
944
  objectN[_key4 - 1] = arguments[_key4];
1078
945
  }
1079
-
1080
946
  if (!objectN.length || objectN.length === 1 && !objectN[0]) {
1081
947
  return target;
1082
948
  }
1083
-
1084
949
  var source = objectN.shift();
1085
-
1086
950
  if (isObject(target) && isObject(source)) {
1087
951
  Object.keys(source).forEach(function (key) {
1088
952
  _newArrowCheck(this, _this13);
1089
-
1090
953
  var value = source[key];
1091
-
1092
954
  if (isObject(value)) {
1093
955
  target[key] || (target[key] = {});
1094
956
  target[key] = mergeObj(target[key], value);
@@ -1097,9 +959,9 @@ function mergeObj(target) {
1097
959
  }
1098
960
  }.bind(this));
1099
961
  }
1100
-
1101
962
  return mergeObj.apply(void 0, [target].concat(objectN));
1102
963
  }
964
+
1103
965
  /**
1104
966
  * Sort value
1105
967
  * @param {Array} data value to be sorted
@@ -1107,45 +969,36 @@ function mergeObj(target) {
1107
969
  * @returns {number|string|Date} sorted date
1108
970
  * @private
1109
971
  */
1110
-
1111
-
1112
972
  function sortValue(data, isAsc) {
1113
973
  var _this14 = this;
1114
-
1115
974
  if (isAsc === void 0) {
1116
975
  isAsc = !0;
1117
976
  }
1118
-
1119
977
  var fn;
1120
-
1121
978
  if (data[0] instanceof Date) {
1122
979
  fn = isAsc ? function (a, b) {
1123
980
  _newArrowCheck(this, _this14);
1124
-
1125
981
  return a - b;
1126
982
  }.bind(this) : function (a, b) {
1127
983
  _newArrowCheck(this, _this14);
1128
-
1129
984
  return b - a;
1130
985
  }.bind(this);
1131
986
  } else {
1132
987
  if (isAsc && !data.every(isNaN)) {
1133
988
  fn = function (a, b) {
1134
989
  _newArrowCheck(this, _this14);
1135
-
1136
990
  return a - b;
1137
991
  }.bind(this);
1138
992
  } else if (!isAsc) {
1139
993
  fn = function (a, b) {
1140
994
  _newArrowCheck(this, _this14);
1141
-
1142
995
  return a > b && -1 || a < b && 1 || a === b && 0;
1143
996
  }.bind(this);
1144
997
  }
1145
998
  }
1146
-
1147
999
  return data.concat().sort(fn);
1148
1000
  }
1001
+
1149
1002
  /**
1150
1003
  * Get min/max value
1151
1004
  * @param {string} type 'min' or 'max'
@@ -1153,16 +1006,12 @@ function sortValue(data, isAsc) {
1153
1006
  * @returns {number|Date|undefined}
1154
1007
  * @private
1155
1008
  */
1156
-
1157
-
1158
1009
  function getMinMax(type, data) {
1159
1010
  var _this15 = this,
1160
- res = data.filter(function (v) {
1161
- _newArrowCheck(this, _this15);
1162
-
1163
- return notEmpty(v);
1164
- }.bind(this));
1165
-
1011
+ res = data.filter(function (v) {
1012
+ _newArrowCheck(this, _this15);
1013
+ return notEmpty(v);
1014
+ }.bind(this));
1166
1015
  if (res.length) {
1167
1016
  if (isNumber(res[0])) {
1168
1017
  res = Math[type].apply(Math, res);
@@ -1172,9 +1021,9 @@ function getMinMax(type, data) {
1172
1021
  } else {
1173
1022
  res = undefined;
1174
1023
  }
1175
-
1176
1024
  return res;
1177
1025
  }
1026
+
1178
1027
  /**
1179
1028
  * Get range
1180
1029
  * @param {number} start Start number
@@ -1183,95 +1032,80 @@ function getMinMax(type, data) {
1183
1032
  * @returns {Array}
1184
1033
  * @private
1185
1034
  */
1186
-
1187
-
1188
1035
  var getRange = function (start, end, step) {
1189
- if (step === void 0) {
1190
- step = 1;
1191
- }
1192
-
1193
- _newArrowCheck(this, util_this);
1194
-
1195
- var res = [],
1196
- n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1197
-
1198
- for (var i = start; i < n; i++) {
1199
- res.push(start + i * step);
1200
- }
1201
-
1202
- return res;
1203
- }.bind(undefined),
1204
- emulateEvent = {
1205
- mouse: function () {
1206
- var _this16 = this;
1207
-
1036
+ if (step === void 0) {
1037
+ step = 1;
1038
+ }
1208
1039
  _newArrowCheck(this, util_this);
1209
-
1210
- var getParams = function () {
1211
- _newArrowCheck(this, _this16);
1212
-
1213
- return {
1214
- bubbles: !1,
1215
- cancelable: !1,
1216
- screenX: 0,
1217
- screenY: 0,
1218
- clientX: 0,
1219
- clientY: 0
1220
- };
1221
- }.bind(this);
1222
-
1223
- try {
1224
- // eslint-disable-next-line no-new
1225
- new MouseEvent("t");
1226
- return function (el, eventType, params) {
1227
- if (params === void 0) {
1228
- params = getParams();
1229
- }
1230
-
1231
- _newArrowCheck(this, _this16);
1232
-
1233
- el.dispatchEvent(new MouseEvent(eventType, params));
1234
- }.bind(this);
1235
- } catch (e) {
1236
- // Polyfills DOM4 MouseEvent
1237
- return function (el, eventType, params) {
1238
- if (params === void 0) {
1239
- params = getParams();
1240
- }
1241
-
1040
+ var res = [],
1041
+ n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1042
+ for (var i = start; i < n; i++) {
1043
+ res.push(start + i * step);
1044
+ }
1045
+ return res;
1046
+ }.bind(undefined),
1047
+ emulateEvent = {
1048
+ mouse: function () {
1049
+ var _this16 = this;
1050
+ _newArrowCheck(this, util_this);
1051
+ var getParams = function () {
1242
1052
  _newArrowCheck(this, _this16);
1243
-
1244
- var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1245
-
1246
- mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
1247
- params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1248
- el.dispatchEvent(mouseEvent);
1053
+ return {
1054
+ bubbles: !1,
1055
+ cancelable: !1,
1056
+ screenX: 0,
1057
+ screenY: 0,
1058
+ clientX: 0,
1059
+ clientY: 0
1060
+ };
1249
1061
  }.bind(this);
1250
- }
1251
- }.bind(undefined)(),
1252
- touch: function touch(el, eventType, params) {
1253
- _newArrowCheck(this, util_this);
1254
-
1255
- var touchObj = new Touch(mergeObj({
1256
- identifier: Date.now(),
1257
- target: el,
1258
- radiusX: 2.5,
1259
- radiusY: 2.5,
1260
- rotationAngle: 10,
1261
- force: .5
1262
- }, params));
1263
- el.dispatchEvent(new TouchEvent(eventType, {
1264
- cancelable: !0,
1265
- bubbles: !0,
1266
- shiftKey: !0,
1267
- touches: [touchObj],
1268
- targetTouches: [],
1269
- changedTouches: [touchObj]
1270
- }));
1271
- }.bind(undefined)
1272
- }; // emulate event
1273
-
1274
-
1062
+ try {
1063
+ // eslint-disable-next-line no-new
1064
+ new MouseEvent("t");
1065
+ return function (el, eventType, params) {
1066
+ if (params === void 0) {
1067
+ params = getParams();
1068
+ }
1069
+ _newArrowCheck(this, _this16);
1070
+ el.dispatchEvent(new MouseEvent(eventType, params));
1071
+ }.bind(this);
1072
+ } catch (e) {
1073
+ // Polyfills DOM4 MouseEvent
1074
+ return function (el, eventType, params) {
1075
+ if (params === void 0) {
1076
+ params = getParams();
1077
+ }
1078
+ _newArrowCheck(this, _this16);
1079
+ var mouseEvent = doc.createEvent("MouseEvent");
1080
+
1081
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1082
+ mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
1083
+ // the event's mouse click count
1084
+ params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1085
+ el.dispatchEvent(mouseEvent);
1086
+ }.bind(this);
1087
+ }
1088
+ }.bind(undefined)(),
1089
+ touch: function touch(el, eventType, params) {
1090
+ _newArrowCheck(this, util_this);
1091
+ var touchObj = new Touch(mergeObj({
1092
+ identifier: Date.now(),
1093
+ target: el,
1094
+ radiusX: 2.5,
1095
+ radiusY: 2.5,
1096
+ rotationAngle: 10,
1097
+ force: .5
1098
+ }, params));
1099
+ el.dispatchEvent(new TouchEvent(eventType, {
1100
+ cancelable: !0,
1101
+ bubbles: !0,
1102
+ shiftKey: !0,
1103
+ touches: [touchObj],
1104
+ targetTouches: [],
1105
+ changedTouches: [touchObj]
1106
+ }));
1107
+ }.bind(undefined)
1108
+ }; // emulate event
1275
1109
  /**
1276
1110
  * Process the template & return bound string
1277
1111
  * @param {string} tpl Template string
@@ -1281,13 +1115,12 @@ var getRange = function (start, end, step) {
1281
1115
  */
1282
1116
  function tplProcess(tpl, data) {
1283
1117
  var res = tpl;
1284
-
1285
1118
  for (var x in data) {
1286
1119
  res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
1287
1120
  }
1288
-
1289
1121
  return res;
1290
1122
  }
1123
+
1291
1124
  /**
1292
1125
  * Get parsed date value
1293
1126
  * (It must be called in 'ChartInternal' context)
@@ -1295,41 +1128,35 @@ function tplProcess(tpl, data) {
1295
1128
  * @returns {Date}
1296
1129
  * @private
1297
1130
  */
1298
-
1299
-
1300
1131
  function parseDate(date) {
1301
1132
  var parsedDate;
1302
-
1303
1133
  if (date instanceof Date) {
1304
1134
  parsedDate = date;
1305
1135
  } else if (isString(date)) {
1306
1136
  var _format$dataTime,
1307
- config = this.config,
1308
- format = this.format;
1309
-
1137
+ config = this.config,
1138
+ format = this.format;
1310
1139
  // if fails to parse, try by new Date()
1311
1140
  // https://github.com/naver/billboard.js/issues/1714
1312
1141
  parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
1313
1142
  } else if (isNumber(date) && !isNaN(date)) {
1314
1143
  parsedDate = new Date(+date);
1315
1144
  }
1316
-
1317
1145
  if (!parsedDate || isNaN(+parsedDate)) {
1318
1146
  console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
1319
1147
  }
1320
-
1321
1148
  return parsedDate;
1322
1149
  }
1150
+
1323
1151
  /**
1324
1152
  * Return if the current doc is visible or not
1325
1153
  * @returns {boolean}
1326
1154
  * @private
1327
1155
  */
1328
-
1329
-
1330
1156
  function isTabVisible() {
1331
1157
  return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
1332
1158
  }
1159
+
1333
1160
  /**
1334
1161
  * Get the current input type
1335
1162
  * @param {boolean} mouse Config value: interaction.inputType.mouse
@@ -1337,19 +1164,18 @@ function isTabVisible() {
1337
1164
  * @returns {string} "mouse" | "touch" | null
1338
1165
  * @private
1339
1166
  */
1340
-
1341
-
1342
1167
  function convertInputType(mouse, touch) {
1343
1168
  var _this17 = this,
1344
- DocumentTouch = win.DocumentTouch,
1345
- matchMedia = win.matchMedia,
1346
- navigator = win.navigator,
1347
- hasTouch = !1;
1348
-
1169
+ DocumentTouch = win.DocumentTouch,
1170
+ matchMedia = win.matchMedia,
1171
+ navigator = win.navigator,
1172
+ hasTouch = !1;
1349
1173
  if (touch) {
1350
1174
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1351
1175
  if (navigator && "maxTouchPoints" in navigator) {
1352
- hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1176
+ hasTouch = navigator.maxTouchPoints > 0;
1177
+
1178
+ // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1353
1179
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1354
1180
  } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
1355
1181
  hasTouch = !0;
@@ -1363,34 +1189,31 @@ function convertInputType(mouse, touch) {
1363
1189
  hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1364
1190
  }
1365
1191
  }
1366
- } // 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
1192
+ }
1193
+
1194
+ // 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
1367
1195
  // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1368
1196
  // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1369
-
1370
-
1371
1197
  var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1372
1198
  _newArrowCheck(this, _this17);
1373
-
1374
1199
  return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1375
- }.bind(this)); // fallback to 'mouse' if no input type is detected.
1200
+ }.bind(this));
1376
1201
 
1202
+ // fallback to 'mouse' if no input type is detected.
1377
1203
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1378
1204
  }
1205
+
1379
1206
  /**
1380
1207
  * Run function until given condition function return true
1381
1208
  * @param {Function} fn Function to be executed when condition is true
1382
1209
  * @param {Function} conditionFn Condition function to check if condition is true
1383
1210
  * @private
1384
1211
  */
1385
-
1386
-
1387
1212
  function runUntil(fn, conditionFn) {
1388
1213
  var _this18 = this;
1389
-
1390
1214
  if (conditionFn() === !1) {
1391
1215
  win.requestAnimationFrame(function () {
1392
1216
  _newArrowCheck(this, _this18);
1393
-
1394
1217
  return runUntil(fn, conditionFn);
1395
1218
  }.bind(this));
1396
1219
  } else {
@@ -1399,13 +1222,11 @@ function runUntil(fn, conditionFn) {
1399
1222
  }
1400
1223
  ;// CONCATENATED MODULE: ./src/config/config.ts
1401
1224
 
1402
-
1403
1225
  /**
1404
1226
  * Copyright (c) 2017 ~ present NAVER Corp.
1405
1227
  * billboard.js project is licensed under the MIT license
1406
1228
  */
1407
1229
 
1408
-
1409
1230
  /**
1410
1231
  * Load configuration option
1411
1232
  * @param {object} config User's generation config value
@@ -1413,37 +1234,32 @@ function runUntil(fn, conditionFn) {
1413
1234
  */
1414
1235
  function loadConfig(config) {
1415
1236
  var _this = this,
1416
- thisConfig = this.config,
1417
- target,
1418
- keys,
1419
- read,
1420
- find = function () {
1421
- _newArrowCheck(this, _this);
1422
-
1423
- var key = keys.shift();
1424
-
1425
- if (key && target && isObjectType(target) && key in target) {
1426
- target = target[key];
1427
- return find();
1428
- } else if (!key) {
1429
- return target;
1430
- }
1431
-
1432
- return undefined;
1433
- }.bind(this);
1434
-
1237
+ thisConfig = this.config,
1238
+ target,
1239
+ keys,
1240
+ read,
1241
+ find = function () {
1242
+ _newArrowCheck(this, _this);
1243
+ var key = keys.shift();
1244
+ if (key && target && isObjectType(target) && key in target) {
1245
+ target = target[key];
1246
+ return find();
1247
+ } else if (!key) {
1248
+ return target;
1249
+ }
1250
+ return undefined;
1251
+ }.bind(this);
1435
1252
  Object.keys(thisConfig).forEach(function (key) {
1436
1253
  _newArrowCheck(this, _this);
1437
-
1438
1254
  target = config;
1439
1255
  keys = key.split("_");
1440
1256
  read = find();
1441
-
1442
1257
  if (isDefined(read)) {
1443
1258
  thisConfig[key] = read;
1444
1259
  }
1445
- }.bind(this)); // only should run in the ChartInternal context
1260
+ }.bind(this));
1446
1261
 
1262
+ // only should run in the ChartInternal context
1447
1263
  if (this.api) {
1448
1264
  this.state.orgConfig = config;
1449
1265
  }
@@ -1453,11 +1269,8 @@ function loadConfig(config) {
1453
1269
 
1454
1270
 
1455
1271
 
1456
-
1457
1272
  function tableview_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; }
1458
-
1459
1273
  function tableview_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? tableview_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : tableview_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1460
-
1461
1274
  /**
1462
1275
  * Copyright (c) 2021 ~ present NAVER Corp.
1463
1276
  * billboard.js project is licensed under the MIT license
@@ -1467,6 +1280,7 @@ function tableview_objectSpread(target) { for (var i = 1, source; i < arguments.
1467
1280
 
1468
1281
 
1469
1282
 
1283
+
1470
1284
  /**
1471
1285
  * Table view plugin.<br>
1472
1286
  * Generates table view for bound dataset.
@@ -1510,102 +1324,84 @@ function tableview_objectSpread(target) { for (var i = 1, source; i < arguments.
1510
1324
  * ]
1511
1325
  * })
1512
1326
  */
1513
-
1514
1327
  var TableView = /*#__PURE__*/function (_Plugin) {
1515
1328
  _inheritsLoose(TableView, _Plugin);
1516
-
1517
1329
  function TableView(options) {
1518
1330
  var _this = _Plugin.call(this, options) || this;
1519
-
1520
1331
  _this.config = void 0;
1521
1332
  _this.element = void 0;
1522
1333
  _this.config = new Options();
1523
1334
  return _assertThisInitialized(_this) || _assertThisInitialized(_this);
1524
1335
  }
1525
-
1526
1336
  var _proto = TableView.prototype;
1527
-
1528
1337
  _proto.$beforeInit = function $beforeInit() {
1529
1338
  loadConfig.call(this, this.options);
1530
1339
  };
1531
-
1532
1340
  _proto.$init = function $init() {
1533
1341
  var _element$classList,
1534
- _this$config = this.config,
1535
- className = _this$config.class,
1536
- selector = _this$config.selector,
1537
- style = _this$config.style,
1538
- element = document.querySelector(selector || "." + (className || defaultStyle["class"]));
1539
-
1342
+ _this$config = this.config,
1343
+ className = _this$config.class,
1344
+ selector = _this$config.selector,
1345
+ style = _this$config.style,
1346
+ element = document.querySelector(selector || "." + (className || defaultStyle["class"]));
1540
1347
  if (!element) {
1541
1348
  var chart = this.$$.$el.chart.node();
1542
1349
  element = document.createElement("table");
1543
1350
  chart.parentNode.insertBefore(element, chart.nextSibling);
1544
1351
  }
1545
-
1546
1352
  if (element.tagName !== "TABLE") {
1547
1353
  var table = document.createElement("table");
1548
1354
  element.appendChild(table);
1549
1355
  element = table;
1550
- } // append default css style
1551
-
1356
+ }
1552
1357
 
1358
+ // append default css style
1553
1359
  if (style && !document.getElementById(defaultStyle.id)) {
1554
1360
  var s = document.createElement("style");
1555
1361
  s.id = defaultStyle.id;
1556
1362
  s.innerHTML = defaultStyle.rule;
1557
1363
  (document.head || document.getElementsByTagName("head")[0]).appendChild(s);
1558
1364
  }
1559
-
1560
1365
  (_element$classList = element.classList).add.apply(_element$classList, [style && defaultStyle["class"], className].filter(Boolean));
1561
-
1562
1366
  this.element = element;
1563
1367
  }
1368
+
1564
1369
  /**
1565
1370
  * Generate table
1566
1371
  * @private
1567
- */
1568
- ;
1569
-
1372
+ */;
1570
1373
  _proto.generateTable = function generateTable() {
1571
1374
  var _this2 = this,
1572
- $$ = this.$$,
1573
- config = this.config,
1574
- element = this.element,
1575
- dataToShow = $$.filterTargetsToShow($$.data.targets),
1576
- thead = tplProcess(tpl.thead, {
1577
- title: dataToShow.length ? this.config.categoryTitle : ""
1578
- }),
1579
- tbody = "",
1580
- rows = [];
1581
-
1375
+ $$ = this.$$,
1376
+ config = this.config,
1377
+ element = this.element,
1378
+ dataToShow = $$.filterTargetsToShow($$.data.targets),
1379
+ thead = tplProcess(tpl.thead, {
1380
+ title: dataToShow.length ? this.config.categoryTitle : ""
1381
+ }),
1382
+ tbody = "",
1383
+ rows = [];
1582
1384
  dataToShow.forEach(function (v) {
1583
1385
  var _this3 = this;
1584
-
1585
1386
  _newArrowCheck(this, _this2);
1586
-
1587
1387
  thead += tplProcess(tpl.thead, {
1588
1388
  title: v.id
1589
- }); // make up value rows
1389
+ });
1590
1390
 
1391
+ // make up value rows
1591
1392
  v.values.forEach(function (d, i) {
1592
1393
  _newArrowCheck(this, _this3);
1593
-
1594
1394
  if (!rows[i]) {
1595
1395
  rows[i] = [d.x];
1596
1396
  }
1597
-
1598
1397
  rows[i].push(d.value);
1599
1398
  }.bind(this));
1600
1399
  }.bind(this));
1601
1400
  rows.forEach(function (v) {
1602
1401
  var _this4 = this;
1603
-
1604
1402
  _newArrowCheck(this, _this2);
1605
-
1606
1403
  tbody += "<tr>" + v.map(function (d, i) {
1607
1404
  _newArrowCheck(this, _this4);
1608
-
1609
1405
  return tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
1610
1406
  value: i === 0 ? config.categoryFormat.bind(this)(d) : isNumber(d) ? d.toLocaleString() : ""
1611
1407
  });
@@ -1618,28 +1414,24 @@ var TableView = /*#__PURE__*/function (_Plugin) {
1618
1414
  })).replace(/<[^>]+><\/[^>]+>/g, "");
1619
1415
  element.innerHTML = r;
1620
1416
  };
1621
-
1622
1417
  _proto.$redraw = function $redraw() {
1623
1418
  var state = this.$$.state,
1624
- doNotUpdate = state.resizing || !this.config.updateOnToggle && state.toggling;
1419
+ doNotUpdate = state.resizing || !this.config.updateOnToggle && state.toggling;
1625
1420
  doNotUpdate || this.generateTable();
1626
1421
  };
1627
-
1628
1422
  _proto.$willDestroy = function $willDestroy() {
1629
- this.element.parentNode.removeChild(this.element); // remove default css style when left one chart instance
1423
+ this.element.parentNode.removeChild(this.element);
1630
1424
 
1425
+ // remove default css style when left one chart instance
1631
1426
  if (this.$$.charts.length === 1) {
1632
1427
  var _s$parentNode,
1633
- s = document.getElementById(defaultStyle.id);
1634
-
1428
+ s = document.getElementById(defaultStyle.id);
1635
1429
  s == null ? void 0 : (_s$parentNode = s.parentNode) == null ? void 0 : _s$parentNode.removeChild(s);
1636
1430
  }
1637
1431
  };
1638
-
1639
1432
  return TableView;
1640
1433
  }(Plugin);
1641
1434
 
1642
-
1643
1435
  }();
1644
1436
  __webpack_exports__ = __webpack_exports__["default"];
1645
1437
  /******/ return __webpack_exports__;