billboard.js 3.4.0 → 3.5.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +3901 -1451
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +8350 -5297
- package/dist/billboard.pkgd.min.js +3 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +29 -13
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +377 -92
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +447 -109
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +341 -74
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +337 -75
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +4233 -3792
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4635 -3889
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4823 -3937
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +4594 -3866
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +4606 -3874
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +796 -387
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +47 -75
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +68 -86
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +52 -77
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +49 -76
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +49 -76
- package/package.json +40 -40
- package/src/Chart/api/chart.ts +4 -1
- package/src/Chart/api/data.ts +2 -2
- package/src/Chart/api/flow.ts +125 -115
- package/src/ChartInternal/Axis/AxisRenderer.ts +29 -3
- package/src/ChartInternal/ChartInternal.ts +55 -18
- package/src/ChartInternal/data/IData.ts +2 -2
- package/src/ChartInternal/data/convert.helper.ts +226 -0
- package/src/ChartInternal/data/convert.ts +43 -210
- package/src/ChartInternal/data/load.ts +5 -4
- package/src/ChartInternal/interactions/zoom.ts +17 -4
- package/src/ChartInternal/internals/color.ts +59 -36
- package/src/ChartInternal/internals/grid.ts +5 -3
- package/src/ChartInternal/internals/redraw.ts +5 -2
- package/src/ChartInternal/internals/scale.ts +3 -1
- package/src/ChartInternal/internals/size.axis.ts +5 -2
- package/src/ChartInternal/internals/text.ts +118 -17
- package/src/ChartInternal/shape/area.ts +14 -7
- package/src/ChartInternal/shape/bar.ts +19 -10
- package/src/ChartInternal/shape/point.ts +15 -9
- package/src/ChartInternal/shape/polar.ts +1 -1
- package/src/Plugin/sparkline/index.ts +22 -11
- package/src/Plugin/stanford/index.ts +10 -7
- package/src/Plugin/textoverlap/index.ts +4 -1
- package/src/config/Options/Options.ts +2 -0
- package/src/config/Options/common/boost.ts +31 -0
- package/src/config/Options/common/main.ts +15 -1
- package/src/config/Options/common/tooltip.ts +1 -1
- package/src/config/Options/data/data.ts +11 -3
- package/src/config/Options/shape/area.ts +6 -1
- package/src/config/Store/State.ts +3 -0
- package/src/module/browser.ts +2 -1
- package/src/module/generator.ts +18 -16
- package/src/module/util.ts +115 -1
- package/types/chart.d.ts +2 -2
- 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.
|
|
8
|
+
* @version 3.5.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -105,6 +105,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
105
105
|
"default": function() { return /* binding */ TextOverlap; }
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
|
|
109
|
+
function _newArrowCheck(innerThis, boundThis) {
|
|
110
|
+
if (innerThis !== boundThis) {
|
|
111
|
+
throw new TypeError("Cannot instantiate an arrow function");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
108
114
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
109
115
|
function _assertThisInitialized(self) {
|
|
110
116
|
if (self === void 0) {
|
|
@@ -115,11 +121,10 @@ function _assertThisInitialized(self) {
|
|
|
115
121
|
}
|
|
116
122
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
117
123
|
function _setPrototypeOf(o, p) {
|
|
118
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
124
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
119
125
|
o.__proto__ = p;
|
|
120
126
|
return o;
|
|
121
127
|
};
|
|
122
|
-
|
|
123
128
|
return _setPrototypeOf(o, p);
|
|
124
129
|
}
|
|
125
130
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
@@ -153,6 +158,10 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
153
158
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
154
159
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
155
160
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
var _this = undefined;
|
|
164
|
+
|
|
156
165
|
/**
|
|
157
166
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
158
167
|
* billboard.js project is licensed under the MIT license
|
|
@@ -167,25 +176,35 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
|
|
|
167
176
|
|
|
168
177
|
|
|
169
178
|
var win = function () {
|
|
179
|
+
_newArrowCheck(this, _this);
|
|
180
|
+
|
|
170
181
|
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;
|
|
171
182
|
return root || Function("return this")();
|
|
172
|
-
}();
|
|
183
|
+
}.bind(undefined)();
|
|
173
184
|
/* eslint-enable no-new-func, no-undef */
|
|
174
185
|
// fallback for non-supported environments
|
|
175
186
|
|
|
176
187
|
|
|
177
188
|
win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
|
189
|
+
_newArrowCheck(this, _this);
|
|
190
|
+
|
|
178
191
|
return setTimeout(cb, 1);
|
|
179
|
-
};
|
|
192
|
+
}.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
|
|
180
193
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
|
|
195
|
+
win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
|
196
|
+
_newArrowCheck(this, _this);
|
|
197
|
+
|
|
198
|
+
return setTimeout(cb, 1);
|
|
199
|
+
}.bind(undefined);
|
|
184
200
|
|
|
185
201
|
var doc = win == null ? void 0 : win.document;
|
|
186
202
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
187
203
|
|
|
188
204
|
|
|
205
|
+
|
|
206
|
+
var util_this = undefined;
|
|
207
|
+
|
|
189
208
|
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; }
|
|
190
209
|
|
|
191
210
|
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; }
|
|
@@ -201,50 +220,80 @@ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i
|
|
|
201
220
|
|
|
202
221
|
|
|
203
222
|
var isValue = function (v) {
|
|
223
|
+
_newArrowCheck(this, util_this);
|
|
224
|
+
|
|
204
225
|
return v || v === 0;
|
|
205
|
-
},
|
|
226
|
+
}.bind(undefined),
|
|
206
227
|
isFunction = function (v) {
|
|
228
|
+
_newArrowCheck(this, util_this);
|
|
229
|
+
|
|
207
230
|
return typeof v === "function";
|
|
208
|
-
},
|
|
231
|
+
}.bind(undefined),
|
|
209
232
|
isString = function (v) {
|
|
233
|
+
_newArrowCheck(this, util_this);
|
|
234
|
+
|
|
210
235
|
return typeof v === "string";
|
|
211
|
-
},
|
|
236
|
+
}.bind(undefined),
|
|
212
237
|
isNumber = function (v) {
|
|
238
|
+
_newArrowCheck(this, util_this);
|
|
239
|
+
|
|
213
240
|
return typeof v === "number";
|
|
214
|
-
},
|
|
241
|
+
}.bind(undefined),
|
|
215
242
|
isUndefined = function (v) {
|
|
243
|
+
_newArrowCheck(this, util_this);
|
|
244
|
+
|
|
216
245
|
return typeof v === "undefined";
|
|
217
|
-
},
|
|
246
|
+
}.bind(undefined),
|
|
218
247
|
isDefined = function (v) {
|
|
248
|
+
_newArrowCheck(this, util_this);
|
|
249
|
+
|
|
219
250
|
return typeof v !== "undefined";
|
|
220
|
-
},
|
|
251
|
+
}.bind(undefined),
|
|
221
252
|
isboolean = function (v) {
|
|
253
|
+
_newArrowCheck(this, util_this);
|
|
254
|
+
|
|
222
255
|
return typeof v === "boolean";
|
|
223
|
-
},
|
|
256
|
+
}.bind(undefined),
|
|
224
257
|
ceil10 = function (v) {
|
|
258
|
+
_newArrowCheck(this, util_this);
|
|
259
|
+
|
|
225
260
|
return Math.ceil(v / 10) * 10;
|
|
226
|
-
},
|
|
261
|
+
}.bind(undefined),
|
|
227
262
|
asHalfPixel = function (n) {
|
|
263
|
+
_newArrowCheck(this, util_this);
|
|
264
|
+
|
|
228
265
|
return Math.ceil(n) + .5;
|
|
229
|
-
},
|
|
266
|
+
}.bind(undefined),
|
|
230
267
|
diffDomain = function (d) {
|
|
268
|
+
_newArrowCheck(this, util_this);
|
|
269
|
+
|
|
231
270
|
return d[1] - d[0];
|
|
232
|
-
},
|
|
271
|
+
}.bind(undefined),
|
|
233
272
|
isObjectType = function (v) {
|
|
273
|
+
_newArrowCheck(this, util_this);
|
|
274
|
+
|
|
234
275
|
return typeof v === "object";
|
|
235
|
-
},
|
|
276
|
+
}.bind(undefined),
|
|
236
277
|
isEmpty = function (o) {
|
|
278
|
+
_newArrowCheck(this, util_this);
|
|
279
|
+
|
|
237
280
|
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
238
|
-
},
|
|
281
|
+
}.bind(undefined),
|
|
239
282
|
notEmpty = function (o) {
|
|
283
|
+
_newArrowCheck(this, util_this);
|
|
284
|
+
|
|
240
285
|
return !isEmpty(o);
|
|
241
|
-
},
|
|
286
|
+
}.bind(undefined),
|
|
242
287
|
isArray = function (arr) {
|
|
288
|
+
_newArrowCheck(this, util_this);
|
|
289
|
+
|
|
243
290
|
return Array.isArray(arr);
|
|
244
|
-
},
|
|
291
|
+
}.bind(undefined),
|
|
245
292
|
isObject = function (obj) {
|
|
293
|
+
_newArrowCheck(this, util_this);
|
|
294
|
+
|
|
246
295
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
247
|
-
};
|
|
296
|
+
}.bind(undefined);
|
|
248
297
|
|
|
249
298
|
/**
|
|
250
299
|
* Get specified key value from object
|
|
@@ -268,10 +317,14 @@ function getOption(options, key, defaultValue) {
|
|
|
268
317
|
|
|
269
318
|
|
|
270
319
|
function hasValue(dict, value) {
|
|
271
|
-
var
|
|
320
|
+
var _this2 = this,
|
|
321
|
+
found = !1;
|
|
322
|
+
|
|
272
323
|
Object.keys(dict).forEach(function (key) {
|
|
324
|
+
_newArrowCheck(this, _this2);
|
|
325
|
+
|
|
273
326
|
return dict[key] === value && (found = !0);
|
|
274
|
-
});
|
|
327
|
+
}.bind(this));
|
|
275
328
|
return found;
|
|
276
329
|
}
|
|
277
330
|
/**
|
|
@@ -301,7 +354,8 @@ function callFn(fn, thisArg) {
|
|
|
301
354
|
|
|
302
355
|
|
|
303
356
|
function endall(transition, cb) {
|
|
304
|
-
var
|
|
357
|
+
var _this3 = this,
|
|
358
|
+
n = 0,
|
|
305
359
|
end = function () {
|
|
306
360
|
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
307
361
|
args[_key2] = arguments[_key2];
|
|
@@ -313,8 +367,10 @@ function endall(transition, cb) {
|
|
|
313
367
|
// if is transition selection
|
|
314
368
|
if ("duration" in transition) {
|
|
315
369
|
transition.each(function () {
|
|
370
|
+
_newArrowCheck(this, _this3);
|
|
371
|
+
|
|
316
372
|
return ++n;
|
|
317
|
-
}).on("end", end);
|
|
373
|
+
}.bind(this)).on("end", end);
|
|
318
374
|
} else {
|
|
319
375
|
++n;
|
|
320
376
|
transition.call(end);
|
|
@@ -342,6 +398,8 @@ function sanitise(str) {
|
|
|
342
398
|
|
|
343
399
|
|
|
344
400
|
function setTextValue(node, text, dy, toMiddle) {
|
|
401
|
+
var _this4 = this;
|
|
402
|
+
|
|
345
403
|
if (dy === void 0) {
|
|
346
404
|
dy = [-1, 1];
|
|
347
405
|
}
|
|
@@ -358,8 +416,10 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
358
416
|
node.text(text);
|
|
359
417
|
} else {
|
|
360
418
|
var diff = [node.text(), text].map(function (v) {
|
|
419
|
+
_newArrowCheck(this, _this4);
|
|
420
|
+
|
|
361
421
|
return v.replace(/[\s\n]/g, "");
|
|
362
|
-
});
|
|
422
|
+
}.bind(this));
|
|
363
423
|
|
|
364
424
|
if (diff[0] !== diff[1]) {
|
|
365
425
|
var multiline = text.split("\n"),
|
|
@@ -367,8 +427,10 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
367
427
|
// reset possible text
|
|
368
428
|
node.html("");
|
|
369
429
|
multiline.forEach(function (v, i) {
|
|
430
|
+
_newArrowCheck(this, _this4);
|
|
431
|
+
|
|
370
432
|
node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
|
371
|
-
});
|
|
433
|
+
}.bind(this));
|
|
372
434
|
}
|
|
373
435
|
}
|
|
374
436
|
}
|
|
@@ -447,11 +509,14 @@ function getPathBox(path) {
|
|
|
447
509
|
function getPointer(event, element) {
|
|
448
510
|
var _ref,
|
|
449
511
|
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
450
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element)
|
|
512
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
513
|
+
_this5 = this;
|
|
451
514
|
|
|
452
515
|
return pointer.map(function (v) {
|
|
516
|
+
_newArrowCheck(this, _this5);
|
|
517
|
+
|
|
453
518
|
return isNaN(v) ? 0 : v;
|
|
454
|
-
});
|
|
519
|
+
}.bind(this));
|
|
455
520
|
}
|
|
456
521
|
/**
|
|
457
522
|
* Return brush selection array
|
|
@@ -578,7 +643,9 @@ function brushEmpty(ctx) {
|
|
|
578
643
|
|
|
579
644
|
|
|
580
645
|
function deepClone() {
|
|
581
|
-
for (var clone = function (v) {
|
|
646
|
+
for (var _this6 = this, clone = function (v) {
|
|
647
|
+
_newArrowCheck(this, _this6);
|
|
648
|
+
|
|
582
649
|
if (isObject(v) && v.constructor) {
|
|
583
650
|
var r = new v.constructor();
|
|
584
651
|
|
|
@@ -590,15 +657,19 @@ function deepClone() {
|
|
|
590
657
|
}
|
|
591
658
|
|
|
592
659
|
return v;
|
|
593
|
-
}, _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
660
|
+
}.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
594
661
|
objectN[_key3] = arguments[_key3];
|
|
595
662
|
}
|
|
596
663
|
|
|
597
664
|
return objectN.map(function (v) {
|
|
665
|
+
_newArrowCheck(this, _this6);
|
|
666
|
+
|
|
598
667
|
return clone(v);
|
|
599
|
-
}).reduce(function (a, c) {
|
|
668
|
+
}.bind(this)).reduce(function (a, c) {
|
|
669
|
+
_newArrowCheck(this, _this6);
|
|
670
|
+
|
|
600
671
|
return _objectSpread(_objectSpread({}, a), c);
|
|
601
|
-
});
|
|
672
|
+
}.bind(this));
|
|
602
673
|
}
|
|
603
674
|
/**
|
|
604
675
|
* Extend target from source object
|
|
@@ -610,14 +681,18 @@ function deepClone() {
|
|
|
610
681
|
|
|
611
682
|
|
|
612
683
|
function extend(target, source) {
|
|
684
|
+
var _this7 = this;
|
|
685
|
+
|
|
613
686
|
if (target === void 0) {
|
|
614
687
|
target = {};
|
|
615
688
|
}
|
|
616
689
|
|
|
617
690
|
if (isArray(source)) {
|
|
618
691
|
source.forEach(function (v) {
|
|
692
|
+
_newArrowCheck(this, _this7);
|
|
693
|
+
|
|
619
694
|
return extend(target, v);
|
|
620
|
-
});
|
|
695
|
+
}.bind(this));
|
|
621
696
|
} // exclude name with only numbers
|
|
622
697
|
|
|
623
698
|
|
|
@@ -640,8 +715,10 @@ function extend(target, source) {
|
|
|
640
715
|
|
|
641
716
|
|
|
642
717
|
var capitalize = function (str) {
|
|
718
|
+
_newArrowCheck(this, util_this);
|
|
719
|
+
|
|
643
720
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
644
|
-
};
|
|
721
|
+
}.bind(undefined);
|
|
645
722
|
/**
|
|
646
723
|
* Camelize from kebob style string
|
|
647
724
|
* @param {string} str Target string
|
|
@@ -652,13 +729,17 @@ var capitalize = function (str) {
|
|
|
652
729
|
|
|
653
730
|
|
|
654
731
|
function camelize(str, separator) {
|
|
732
|
+
var _this8 = this;
|
|
733
|
+
|
|
655
734
|
if (separator === void 0) {
|
|
656
735
|
separator = "-";
|
|
657
736
|
}
|
|
658
737
|
|
|
659
738
|
return str.split(separator).map(function (v, i) {
|
|
739
|
+
_newArrowCheck(this, _this8);
|
|
740
|
+
|
|
660
741
|
return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
|
661
|
-
}).join("");
|
|
742
|
+
}.bind(this)).join("");
|
|
662
743
|
}
|
|
663
744
|
/**
|
|
664
745
|
* Convert to array
|
|
@@ -669,8 +750,33 @@ function camelize(str, separator) {
|
|
|
669
750
|
|
|
670
751
|
|
|
671
752
|
var toArray = function (v) {
|
|
753
|
+
_newArrowCheck(this, util_this);
|
|
754
|
+
|
|
672
755
|
return [].slice.call(v);
|
|
673
|
-
};
|
|
756
|
+
}.bind(undefined);
|
|
757
|
+
/**
|
|
758
|
+
* Add CSS rules
|
|
759
|
+
* @param {object} style Style object
|
|
760
|
+
* @param {string} selector Selector string
|
|
761
|
+
* @param {Array} prop Prps arrary
|
|
762
|
+
* @returns {number} Newely added rule index
|
|
763
|
+
* @private
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
function addCssRules(style, selector, prop) {
|
|
768
|
+
var _this9 = this,
|
|
769
|
+
rootSelctor = style.rootSelctor,
|
|
770
|
+
sheet = style.sheet,
|
|
771
|
+
getSelector = function (s) {
|
|
772
|
+
_newArrowCheck(this, _this9);
|
|
773
|
+
|
|
774
|
+
return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
|
775
|
+
}.bind(this),
|
|
776
|
+
rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
777
|
+
|
|
778
|
+
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
779
|
+
}
|
|
674
780
|
/**
|
|
675
781
|
* Get css rules for specified stylesheets
|
|
676
782
|
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
@@ -680,8 +786,12 @@ var toArray = function (v) {
|
|
|
680
786
|
|
|
681
787
|
|
|
682
788
|
function getCssRules(styleSheets) {
|
|
683
|
-
var
|
|
789
|
+
var _this10 = this,
|
|
790
|
+
rules = [];
|
|
791
|
+
|
|
684
792
|
styleSheets.forEach(function (sheet) {
|
|
793
|
+
_newArrowCheck(this, _this10);
|
|
794
|
+
|
|
685
795
|
try {
|
|
686
796
|
if (sheet.cssRules && sheet.cssRules.length) {
|
|
687
797
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
@@ -689,7 +799,7 @@ function getCssRules(styleSheets) {
|
|
|
689
799
|
} catch (e) {
|
|
690
800
|
console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
691
801
|
}
|
|
692
|
-
});
|
|
802
|
+
}.bind(this));
|
|
693
803
|
return rules;
|
|
694
804
|
}
|
|
695
805
|
/**
|
|
@@ -721,13 +831,19 @@ function getTranslation(node) {
|
|
|
721
831
|
|
|
722
832
|
|
|
723
833
|
function getUnique(data) {
|
|
724
|
-
var
|
|
834
|
+
var _this11 = this,
|
|
835
|
+
isDate = data[0] instanceof Date,
|
|
725
836
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
837
|
+
_newArrowCheck(this, _this11);
|
|
838
|
+
|
|
726
839
|
return self.indexOf(v) === i;
|
|
727
|
-
});
|
|
840
|
+
}.bind(this));
|
|
841
|
+
|
|
728
842
|
return isDate ? d.map(function (v) {
|
|
843
|
+
_newArrowCheck(this, _this11);
|
|
844
|
+
|
|
729
845
|
return new Date(v);
|
|
730
|
-
}) : d;
|
|
846
|
+
}.bind(this)) : d;
|
|
731
847
|
}
|
|
732
848
|
/**
|
|
733
849
|
* Merge array
|
|
@@ -738,9 +854,13 @@ function getUnique(data) {
|
|
|
738
854
|
|
|
739
855
|
|
|
740
856
|
function mergeArray(arr) {
|
|
857
|
+
var _this12 = this;
|
|
858
|
+
|
|
741
859
|
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
860
|
+
_newArrowCheck(this, _this12);
|
|
861
|
+
|
|
742
862
|
return p.concat(c);
|
|
743
|
-
}) : [];
|
|
863
|
+
}.bind(this)) : [];
|
|
744
864
|
}
|
|
745
865
|
/**
|
|
746
866
|
* Merge object returning new object
|
|
@@ -752,7 +872,7 @@ function mergeArray(arr) {
|
|
|
752
872
|
|
|
753
873
|
|
|
754
874
|
function mergeObj(target) {
|
|
755
|
-
for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
875
|
+
for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
756
876
|
objectN[_key4 - 1] = arguments[_key4];
|
|
757
877
|
}
|
|
758
878
|
|
|
@@ -764,6 +884,8 @@ function mergeObj(target) {
|
|
|
764
884
|
|
|
765
885
|
if (isObject(target) && isObject(source)) {
|
|
766
886
|
Object.keys(source).forEach(function (key) {
|
|
887
|
+
_newArrowCheck(this, _this13);
|
|
888
|
+
|
|
767
889
|
var value = source[key];
|
|
768
890
|
|
|
769
891
|
if (isObject(value)) {
|
|
@@ -772,7 +894,7 @@ function mergeObj(target) {
|
|
|
772
894
|
} else {
|
|
773
895
|
target[key] = isArray(value) ? value.concat() : value;
|
|
774
896
|
}
|
|
775
|
-
});
|
|
897
|
+
}.bind(this));
|
|
776
898
|
}
|
|
777
899
|
|
|
778
900
|
return mergeObj.apply(void 0, [target].concat(objectN));
|
|
@@ -787,6 +909,8 @@ function mergeObj(target) {
|
|
|
787
909
|
|
|
788
910
|
|
|
789
911
|
function sortValue(data, isAsc) {
|
|
912
|
+
var _this14 = this;
|
|
913
|
+
|
|
790
914
|
if (isAsc === void 0) {
|
|
791
915
|
isAsc = !0;
|
|
792
916
|
}
|
|
@@ -795,19 +919,27 @@ function sortValue(data, isAsc) {
|
|
|
795
919
|
|
|
796
920
|
if (data[0] instanceof Date) {
|
|
797
921
|
fn = isAsc ? function (a, b) {
|
|
922
|
+
_newArrowCheck(this, _this14);
|
|
923
|
+
|
|
798
924
|
return a - b;
|
|
799
|
-
} : function (a, b) {
|
|
925
|
+
}.bind(this) : function (a, b) {
|
|
926
|
+
_newArrowCheck(this, _this14);
|
|
927
|
+
|
|
800
928
|
return b - a;
|
|
801
|
-
};
|
|
929
|
+
}.bind(this);
|
|
802
930
|
} else {
|
|
803
931
|
if (isAsc && !data.every(isNaN)) {
|
|
804
932
|
fn = function (a, b) {
|
|
933
|
+
_newArrowCheck(this, _this14);
|
|
934
|
+
|
|
805
935
|
return a - b;
|
|
806
|
-
};
|
|
936
|
+
}.bind(this);
|
|
807
937
|
} else if (!isAsc) {
|
|
808
938
|
fn = function (a, b) {
|
|
939
|
+
_newArrowCheck(this, _this14);
|
|
940
|
+
|
|
809
941
|
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
810
|
-
};
|
|
942
|
+
}.bind(this);
|
|
811
943
|
}
|
|
812
944
|
}
|
|
813
945
|
|
|
@@ -823,9 +955,12 @@ function sortValue(data, isAsc) {
|
|
|
823
955
|
|
|
824
956
|
|
|
825
957
|
function getMinMax(type, data) {
|
|
826
|
-
var
|
|
958
|
+
var _this15 = this,
|
|
959
|
+
res = data.filter(function (v) {
|
|
960
|
+
_newArrowCheck(this, _this15);
|
|
961
|
+
|
|
827
962
|
return notEmpty(v);
|
|
828
|
-
});
|
|
963
|
+
}.bind(this));
|
|
829
964
|
|
|
830
965
|
if (res.length) {
|
|
831
966
|
if (isNumber(res[0])) {
|
|
@@ -854,6 +989,8 @@ var getRange = function (start, end, step) {
|
|
|
854
989
|
step = 1;
|
|
855
990
|
}
|
|
856
991
|
|
|
992
|
+
_newArrowCheck(this, util_this);
|
|
993
|
+
|
|
857
994
|
var res = [],
|
|
858
995
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
859
996
|
|
|
@@ -862,10 +999,16 @@ var getRange = function (start, end, step) {
|
|
|
862
999
|
}
|
|
863
1000
|
|
|
864
1001
|
return res;
|
|
865
|
-
},
|
|
1002
|
+
}.bind(undefined),
|
|
866
1003
|
emulateEvent = {
|
|
867
1004
|
mouse: function () {
|
|
1005
|
+
var _this16 = this;
|
|
1006
|
+
|
|
1007
|
+
_newArrowCheck(this, util_this);
|
|
1008
|
+
|
|
868
1009
|
var getParams = function () {
|
|
1010
|
+
_newArrowCheck(this, _this16);
|
|
1011
|
+
|
|
869
1012
|
return {
|
|
870
1013
|
bubbles: !1,
|
|
871
1014
|
cancelable: !1,
|
|
@@ -874,7 +1017,7 @@ var getRange = function (start, end, step) {
|
|
|
874
1017
|
clientX: 0,
|
|
875
1018
|
clientY: 0
|
|
876
1019
|
};
|
|
877
|
-
};
|
|
1020
|
+
}.bind(this);
|
|
878
1021
|
|
|
879
1022
|
try {
|
|
880
1023
|
// eslint-disable-next-line no-new
|
|
@@ -884,8 +1027,10 @@ var getRange = function (start, end, step) {
|
|
|
884
1027
|
params = getParams();
|
|
885
1028
|
}
|
|
886
1029
|
|
|
1030
|
+
_newArrowCheck(this, _this16);
|
|
1031
|
+
|
|
887
1032
|
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
888
|
-
};
|
|
1033
|
+
}.bind(this);
|
|
889
1034
|
} catch (e) {
|
|
890
1035
|
// Polyfills DOM4 MouseEvent
|
|
891
1036
|
return function (el, eventType, params) {
|
|
@@ -893,15 +1038,19 @@ var getRange = function (start, end, step) {
|
|
|
893
1038
|
params = getParams();
|
|
894
1039
|
}
|
|
895
1040
|
|
|
1041
|
+
_newArrowCheck(this, _this16);
|
|
1042
|
+
|
|
896
1043
|
var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
897
1044
|
|
|
898
1045
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
899
1046
|
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
|
|
900
1047
|
el.dispatchEvent(mouseEvent);
|
|
901
|
-
};
|
|
1048
|
+
}.bind(this);
|
|
902
1049
|
}
|
|
903
|
-
}(),
|
|
1050
|
+
}.bind(undefined)(),
|
|
904
1051
|
touch: function touch(el, eventType, params) {
|
|
1052
|
+
_newArrowCheck(this, util_this);
|
|
1053
|
+
|
|
905
1054
|
var touchObj = new Touch(mergeObj({
|
|
906
1055
|
identifier: Date.now(),
|
|
907
1056
|
target: el,
|
|
@@ -918,7 +1067,7 @@ var getRange = function (start, end, step) {
|
|
|
918
1067
|
targetTouches: [],
|
|
919
1068
|
changedTouches: [touchObj]
|
|
920
1069
|
}));
|
|
921
|
-
}
|
|
1070
|
+
}.bind(undefined)
|
|
922
1071
|
}; // emulate event
|
|
923
1072
|
|
|
924
1073
|
|
|
@@ -990,7 +1139,8 @@ function isTabVisible() {
|
|
|
990
1139
|
|
|
991
1140
|
|
|
992
1141
|
function convertInputType(mouse, touch) {
|
|
993
|
-
var
|
|
1142
|
+
var _this17 = this,
|
|
1143
|
+
DocumentTouch = win.DocumentTouch,
|
|
994
1144
|
matchMedia = win.matchMedia,
|
|
995
1145
|
navigator = win.navigator,
|
|
996
1146
|
hasTouch = !1;
|
|
@@ -1018,11 +1168,106 @@ function convertInputType(mouse, touch) {
|
|
|
1018
1168
|
|
|
1019
1169
|
|
|
1020
1170
|
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1171
|
+
_newArrowCheck(this, _this17);
|
|
1172
|
+
|
|
1021
1173
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1174
|
+
}.bind(this)); // fallback to 'mouse' if no input type is detected.
|
|
1175
|
+
|
|
1176
|
+
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Create and run on Web Worker
|
|
1180
|
+
* @param {boolean} useWorker Use Web Worker
|
|
1181
|
+
* @param {Function} fn Function to be executed in worker
|
|
1182
|
+
* @param {Function} callback Callback function to receive result from worker
|
|
1183
|
+
* @param {Array} depsFn Dependency functions to run given function(fn).
|
|
1184
|
+
* @returns {object}
|
|
1185
|
+
* @example
|
|
1186
|
+
* const worker = runWorker(function(arg) {
|
|
1187
|
+
* // do some tasks...
|
|
1188
|
+
* console.log("param:", A(arg));
|
|
1189
|
+
*
|
|
1190
|
+
* return 1234;
|
|
1191
|
+
* }, function(data) {
|
|
1192
|
+
* // callback after worker is done
|
|
1193
|
+
* console.log("result:", data);
|
|
1194
|
+
* },
|
|
1195
|
+
* [function A(){}]
|
|
1196
|
+
* );
|
|
1197
|
+
*
|
|
1198
|
+
* worker(11111);
|
|
1199
|
+
* @private
|
|
1200
|
+
*/
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
function runWorker(useWorker, fn, callback, depsFn) {
|
|
1204
|
+
if (useWorker === void 0) {
|
|
1205
|
+
useWorker = !0;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
var runFn;
|
|
1209
|
+
|
|
1210
|
+
if (win.Worker && useWorker) {
|
|
1211
|
+
var _depsFn$map$join,
|
|
1212
|
+
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};"], {
|
|
1213
|
+
type: "text/javascript"
|
|
1214
|
+
}),
|
|
1215
|
+
worker = new Worker(URL.createObjectURL(blob));
|
|
1216
|
+
|
|
1217
|
+
runFn = function () {
|
|
1218
|
+
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1219
|
+
args[_key5] = arguments[_key5];
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// trigger worker
|
|
1223
|
+
worker.postMessage(args); // listen worker
|
|
1224
|
+
|
|
1225
|
+
worker.onmessage = function (e) {
|
|
1226
|
+
return callback(e.data);
|
|
1227
|
+
}; // handle error
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
worker.onerror = function (e) {
|
|
1231
|
+
console.error(e);
|
|
1232
|
+
}; // return new Promise((resolve, reject) => {
|
|
1233
|
+
// worker.onmessage = ({data}) => resolve(data);
|
|
1234
|
+
// worker.onerror = reject;
|
|
1235
|
+
// });
|
|
1236
|
+
|
|
1237
|
+
};
|
|
1238
|
+
} else {
|
|
1239
|
+
runFn = function () {
|
|
1240
|
+
var res = fn.apply(void 0, arguments);
|
|
1241
|
+
callback(res);
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
return runFn;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Run function until given condition function return true
|
|
1249
|
+
* @param {Function} fn Function to be executed when condition is true
|
|
1250
|
+
* @param {Function} conditionFn Condition function to check if condition is true
|
|
1251
|
+
* @private
|
|
1252
|
+
*/
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
function runUntil(fn, conditionFn) {
|
|
1256
|
+
var _this18 = this;
|
|
1257
|
+
|
|
1258
|
+
if (conditionFn() === !1) {
|
|
1259
|
+
win.requestAnimationFrame(function () {
|
|
1260
|
+
_newArrowCheck(this, _this18);
|
|
1261
|
+
|
|
1262
|
+
return runUntil(fn, conditionFn);
|
|
1263
|
+
}.bind(this));
|
|
1264
|
+
} else {
|
|
1265
|
+
fn();
|
|
1266
|
+
}
|
|
1024
1267
|
}
|
|
1025
1268
|
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1269
|
+
|
|
1270
|
+
|
|
1026
1271
|
/**
|
|
1027
1272
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1028
1273
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1035,11 +1280,14 @@ function convertInputType(mouse, touch) {
|
|
|
1035
1280
|
* @private
|
|
1036
1281
|
*/
|
|
1037
1282
|
function loadConfig(config) {
|
|
1038
|
-
var
|
|
1283
|
+
var _this = this,
|
|
1284
|
+
thisConfig = this.config,
|
|
1039
1285
|
target,
|
|
1040
1286
|
keys,
|
|
1041
1287
|
read,
|
|
1042
1288
|
find = function () {
|
|
1289
|
+
_newArrowCheck(this, _this);
|
|
1290
|
+
|
|
1043
1291
|
var key = keys.shift();
|
|
1044
1292
|
|
|
1045
1293
|
if (key && target && isObjectType(target) && key in target) {
|
|
@@ -1050,9 +1298,11 @@ function loadConfig(config) {
|
|
|
1050
1298
|
}
|
|
1051
1299
|
|
|
1052
1300
|
return undefined;
|
|
1053
|
-
};
|
|
1301
|
+
}.bind(this);
|
|
1054
1302
|
|
|
1055
1303
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1304
|
+
_newArrowCheck(this, _this);
|
|
1305
|
+
|
|
1056
1306
|
target = config;
|
|
1057
1307
|
keys = key.split("_");
|
|
1058
1308
|
read = find();
|
|
@@ -1060,9 +1310,11 @@ function loadConfig(config) {
|
|
|
1060
1310
|
if (isDefined(read)) {
|
|
1061
1311
|
thisConfig[key] = read;
|
|
1062
1312
|
}
|
|
1063
|
-
});
|
|
1313
|
+
}.bind(this));
|
|
1064
1314
|
}
|
|
1065
1315
|
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
1316
|
+
|
|
1317
|
+
|
|
1066
1318
|
/**
|
|
1067
1319
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1068
1320
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1137,15 +1389,17 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
1137
1389
|
var _this = this;
|
|
1138
1390
|
|
|
1139
1391
|
Object.keys(this).forEach(function (key) {
|
|
1140
|
-
_this
|
|
1141
|
-
|
|
1142
|
-
|
|
1392
|
+
_newArrowCheck(this, _this);
|
|
1393
|
+
|
|
1394
|
+
this[key] = null;
|
|
1395
|
+
delete this[key];
|
|
1396
|
+
}.bind(this));
|
|
1143
1397
|
};
|
|
1144
1398
|
|
|
1145
1399
|
return Plugin;
|
|
1146
1400
|
}();
|
|
1147
1401
|
|
|
1148
|
-
Plugin.version = "3.
|
|
1402
|
+
Plugin.version = "3.5.0-next.2";
|
|
1149
1403
|
|
|
1150
1404
|
;// CONCATENATED MODULE: ./src/Plugin/textoverlap/Options.ts
|
|
1151
1405
|
/**
|
|
@@ -1205,6 +1459,7 @@ var Options = function () {
|
|
|
1205
1459
|
|
|
1206
1460
|
|
|
1207
1461
|
|
|
1462
|
+
|
|
1208
1463
|
/**
|
|
1209
1464
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1210
1465
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1290,15 +1545,18 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1290
1545
|
;
|
|
1291
1546
|
|
|
1292
1547
|
_proto.generateVoronoi = function generateVoronoi(points) {
|
|
1293
|
-
var
|
|
1548
|
+
var _this2 = this,
|
|
1549
|
+
$$ = this.$$,
|
|
1294
1550
|
scale = $$.scale,
|
|
1295
1551
|
_map = ["x", "y"].map(function (v) {
|
|
1552
|
+
_newArrowCheck(this, _this2);
|
|
1553
|
+
|
|
1296
1554
|
return scale[v].domain();
|
|
1297
|
-
}),
|
|
1555
|
+
}.bind(this)),
|
|
1298
1556
|
min = _map[0],
|
|
1299
|
-
max = _map[1]
|
|
1557
|
+
max = _map[1],
|
|
1558
|
+
_ref = [max[0], min[1]];
|
|
1300
1559
|
|
|
1301
|
-
var _ref = [max[0], min[1]];
|
|
1302
1560
|
min[1] = _ref[0];
|
|
1303
1561
|
max[0] = _ref[1];
|
|
1304
1562
|
return external_commonjs_d3_delaunay_commonjs2_d3_delaunay_amd_d3_delaunay_root_d3_.Delaunay.from(points).voronoi([].concat(min, max)); // bounds = [xmin, ymin, xmax, ymax], default value: [0, 0, 960, 500]
|
|
@@ -1311,14 +1569,18 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1311
1569
|
;
|
|
1312
1570
|
|
|
1313
1571
|
_proto.preventLabelOverlap = function preventLabelOverlap(text) {
|
|
1314
|
-
var
|
|
1572
|
+
var _this3 = this,
|
|
1573
|
+
_this$config = this.config,
|
|
1315
1574
|
extent = _this$config.extent,
|
|
1316
1575
|
area = _this$config.area,
|
|
1317
1576
|
points = text.data().map(function (v) {
|
|
1577
|
+
_newArrowCheck(this, _this3);
|
|
1578
|
+
|
|
1318
1579
|
return [v.index, v.value];
|
|
1319
|
-
}),
|
|
1580
|
+
}.bind(this)),
|
|
1320
1581
|
voronoi = this.generateVoronoi(points),
|
|
1321
1582
|
i = 0;
|
|
1583
|
+
|
|
1322
1584
|
text.each(function () {
|
|
1323
1585
|
var cell = voronoi.cellPolygon(i);
|
|
1324
1586
|
|