billboard.js 3.9.3 → 3.10.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/billboard.css +2 -2
- package/dist/billboard.js +2687 -2541
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +3493 -3331
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +15 -15
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +215 -196
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +244 -239
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +184 -164
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +170 -151
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/{billboardjs-plugin-bubblecompare.js → billboardjs-plugin-bubblecompare.pkgd.js} +664 -634
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-sparkline.js → billboardjs-plugin-sparkline.pkgd.js} +861 -812
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-stanford.js → billboardjs-plugin-stanford.pkgd.js} +926 -892
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-tableview.js → billboardjs-plugin-tableview.pkgd.js} +830 -780
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-textoverlap.js → billboardjs-plugin-textoverlap.pkgd.js} +929 -889
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +12 -0
- package/dist/theme/dark.css +5 -4
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +5 -4
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +5 -4
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +5 -4
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +591 -462
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +13 -7
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +21 -28
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +17 -11
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +13 -7
- package/package.json +27 -27
- package/src/Chart/api/axis.ts +4 -0
- package/src/Chart/api/category.ts +8 -4
- package/src/Chart/api/export.ts +1 -2
- package/src/Chart/api/subchart.ts +162 -89
- package/src/Chart/api/zoom.ts +69 -79
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +0 -8
- package/src/ChartInternal/data/IData.ts +4 -1
- package/src/ChartInternal/data/convert.helper.ts +1 -15
- package/src/ChartInternal/data/data.ts +8 -2
- package/src/ChartInternal/interactions/eventrect.ts +0 -1
- package/src/ChartInternal/interactions/flow.ts +1 -7
- package/src/ChartInternal/interactions/interaction.ts +10 -4
- package/src/ChartInternal/interactions/subchart.ts +36 -30
- package/src/ChartInternal/interactions/zoom.ts +13 -3
- package/src/ChartInternal/internals/category.ts +2 -2
- package/src/ChartInternal/internals/clip.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +46 -10
- package/src/ChartInternal/internals/grid.ts +57 -86
- package/src/ChartInternal/internals/redraw.ts +0 -5
- package/src/ChartInternal/internals/region.ts +35 -12
- package/src/ChartInternal/internals/text.ts +1 -26
- package/src/ChartInternal/internals/title.ts +10 -48
- package/src/ChartInternal/internals/tooltip.ts +47 -51
- package/src/ChartInternal/shape/arc.ts +2 -2
- package/src/ChartInternal/shape/candlestick.ts +2 -17
- package/src/ChartInternal/shape/shape.ts +50 -4
- package/src/ChartInternal/shape/treemap.ts +2 -2
- package/src/Plugin/bubblecompare/index.ts +1 -1
- package/src/Plugin/stanford/Elements.ts +10 -2
- package/src/Plugin/stanford/index.ts +1 -24
- package/src/Plugin/tableview/index.ts +2 -2
- package/src/config/Options/axis/x.ts +1 -0
- package/src/config/Options/common/main.ts +12 -2
- package/src/config/Options/common/tooltip.ts +10 -10
- package/src/config/Options/data/axis.ts +3 -1
- package/src/config/Options/data/data.ts +10 -2
- package/src/config/Store/State.ts +3 -0
- package/src/module/Cache.ts +7 -5
- package/src/module/browser.ts +34 -14
- package/src/module/util.ts +8 -4
- package/src/module/worker.ts +24 -13
- package/src/scss/billboard.scss +4 -2
- package/src/scss/theme/dark.scss +4 -2
- package/src/scss/theme/datalab.scss +4 -2
- package/src/scss/theme/graph.scss +4 -2
- package/src/scss/theme/insight.scss +4 -2
- package/types/chart.d.ts +11 -0
- package/types/options.d.ts +3 -3
- package/types/types.d.ts +15 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.10.0-next.1
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -119,14 +119,14 @@ function _inheritsLoose(subClass, superClass) {
|
|
|
119
119
|
_setPrototypeOf(subClass, superClass);
|
|
120
120
|
}
|
|
121
121
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
122
|
-
function _typeof(
|
|
122
|
+
function _typeof(o) {
|
|
123
123
|
"@babel/helpers - typeof";
|
|
124
124
|
|
|
125
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
126
|
-
return typeof
|
|
127
|
-
} : function (
|
|
128
|
-
return
|
|
129
|
-
}, _typeof(
|
|
125
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
126
|
+
return typeof o;
|
|
127
|
+
} : function (o) {
|
|
128
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
129
|
+
}, _typeof(o);
|
|
130
130
|
}
|
|
131
131
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
132
132
|
|
|
@@ -165,8 +165,8 @@ function _defineProperty(obj, key, value) {
|
|
|
165
165
|
}
|
|
166
166
|
;// CONCATENATED MODULE: ./src/config/classes.ts
|
|
167
167
|
|
|
168
|
-
function ownKeys(
|
|
169
|
-
function _objectSpread(
|
|
168
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
169
|
+
function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
170
170
|
/**
|
|
171
171
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
172
172
|
* billboard.js project is licensed under the MIT license
|
|
@@ -175,7 +175,7 @@ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i
|
|
|
175
175
|
* CSS class names definition
|
|
176
176
|
* @private
|
|
177
177
|
*/
|
|
178
|
-
|
|
178
|
+
const $COMMON = {
|
|
179
179
|
button: "bb-button",
|
|
180
180
|
chart: "bb-chart",
|
|
181
181
|
empty: "bb-empty",
|
|
@@ -183,7 +183,7 @@ var $COMMON = {
|
|
|
183
183
|
target: "bb-target",
|
|
184
184
|
EXPANDED: "_expanded_"
|
|
185
185
|
};
|
|
186
|
-
|
|
186
|
+
const $ARC = {
|
|
187
187
|
arc: "bb-arc",
|
|
188
188
|
arcLabelLine: "bb-arc-label-line",
|
|
189
189
|
arcs: "bb-arcs",
|
|
@@ -193,11 +193,11 @@ var $ARC = {
|
|
|
193
193
|
chartArcsTitle: "bb-chart-arcs-title",
|
|
194
194
|
needle: "bb-needle"
|
|
195
195
|
};
|
|
196
|
-
|
|
196
|
+
const $AREA = {
|
|
197
197
|
area: "bb-area",
|
|
198
198
|
areas: "bb-areas"
|
|
199
199
|
};
|
|
200
|
-
|
|
200
|
+
const $AXIS = {
|
|
201
201
|
axis: "bb-axis",
|
|
202
202
|
axisX: "bb-axis-x",
|
|
203
203
|
axisXLabel: "bb-axis-x-label",
|
|
@@ -206,13 +206,13 @@ var $AXIS = {
|
|
|
206
206
|
axisY2Label: "bb-axis-y2-label",
|
|
207
207
|
axisYLabel: "bb-axis-y-label"
|
|
208
208
|
};
|
|
209
|
-
|
|
209
|
+
const $BAR = {
|
|
210
210
|
bar: "bb-bar",
|
|
211
211
|
bars: "bb-bars",
|
|
212
212
|
chartBar: "bb-chart-bar",
|
|
213
213
|
chartBars: "bb-chart-bars"
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
const $CANDLESTICK = {
|
|
216
216
|
candlestick: "bb-candlestick",
|
|
217
217
|
candlesticks: "bb-candlesticks",
|
|
218
218
|
chartCandlestick: "bb-chart-candlestick",
|
|
@@ -220,27 +220,27 @@ var $CANDLESTICK = {
|
|
|
220
220
|
valueDown: "bb-value-down",
|
|
221
221
|
valueUp: "bb-value-up"
|
|
222
222
|
};
|
|
223
|
-
|
|
223
|
+
const $CIRCLE = {
|
|
224
224
|
chartCircles: "bb-chart-circles",
|
|
225
225
|
circle: "bb-circle",
|
|
226
226
|
circles: "bb-circles"
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
const $COLOR = {
|
|
229
229
|
colorPattern: "bb-color-pattern",
|
|
230
230
|
colorScale: "bb-colorscale"
|
|
231
231
|
};
|
|
232
|
-
|
|
232
|
+
const $DRAG = {
|
|
233
233
|
dragarea: "bb-dragarea",
|
|
234
234
|
INCLUDED: "_included_"
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
const $GAUGE = {
|
|
237
237
|
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
238
238
|
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
239
239
|
chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
|
240
240
|
chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
|
241
241
|
gaugeValue: "bb-gauge-value"
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
const $LEGEND = {
|
|
244
244
|
legend: "bb-legend",
|
|
245
245
|
legendBackground: "bb-legend-background",
|
|
246
246
|
legendItem: "bb-legend-item",
|
|
@@ -249,26 +249,26 @@ var $LEGEND = {
|
|
|
249
249
|
legendItemPoint: "bb-legend-item-point",
|
|
250
250
|
legendItemTile: "bb-legend-item-tile"
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
const $LINE = {
|
|
253
253
|
chartLine: "bb-chart-line",
|
|
254
254
|
chartLines: "bb-chart-lines",
|
|
255
255
|
line: "bb-line",
|
|
256
256
|
lines: "bb-lines"
|
|
257
257
|
};
|
|
258
|
-
|
|
258
|
+
const $EVENT = {
|
|
259
259
|
eventRect: "bb-event-rect",
|
|
260
260
|
eventRects: "bb-event-rects",
|
|
261
261
|
eventRectsMultiple: "bb-event-rects-multiple",
|
|
262
262
|
eventRectsSingle: "bb-event-rects-single"
|
|
263
263
|
};
|
|
264
|
-
|
|
264
|
+
const $FOCUS = {
|
|
265
265
|
focused: "bb-focused",
|
|
266
266
|
defocused: "bb-defocused",
|
|
267
267
|
legendItemFocused: "bb-legend-item-focused",
|
|
268
268
|
xgridFocus: "bb-xgrid-focus",
|
|
269
269
|
ygridFocus: "bb-ygrid-focus"
|
|
270
270
|
};
|
|
271
|
-
|
|
271
|
+
const $GRID = {
|
|
272
272
|
grid: "bb-grid",
|
|
273
273
|
gridLines: "bb-grid-lines",
|
|
274
274
|
xgrid: "bb-xgrid",
|
|
@@ -280,32 +280,32 @@ var $GRID = {
|
|
|
280
280
|
ygridLines: "bb-ygrid-lines",
|
|
281
281
|
ygrids: "bb-ygrids"
|
|
282
282
|
};
|
|
283
|
-
|
|
283
|
+
const $LEVEL = {
|
|
284
284
|
level: "bb-level",
|
|
285
285
|
levels: "bb-levels"
|
|
286
286
|
};
|
|
287
|
-
|
|
287
|
+
const $RADAR = {
|
|
288
288
|
chartRadar: "bb-chart-radar",
|
|
289
289
|
chartRadars: "bb-chart-radars"
|
|
290
290
|
};
|
|
291
|
-
|
|
291
|
+
const $REGION = {
|
|
292
292
|
region: "bb-region",
|
|
293
293
|
regions: "bb-regions"
|
|
294
294
|
};
|
|
295
|
-
|
|
295
|
+
const $SELECT = {
|
|
296
296
|
selectedCircle: "bb-selected-circle",
|
|
297
297
|
selectedCircles: "bb-selected-circles",
|
|
298
298
|
SELECTED: "_selected_"
|
|
299
299
|
};
|
|
300
|
-
|
|
300
|
+
const $SHAPE = {
|
|
301
301
|
shape: "bb-shape",
|
|
302
302
|
shapes: "bb-shapes"
|
|
303
303
|
};
|
|
304
|
-
|
|
304
|
+
const $SUBCHART = {
|
|
305
305
|
brush: "bb-brush",
|
|
306
306
|
subchart: "bb-subchart"
|
|
307
307
|
};
|
|
308
|
-
|
|
308
|
+
const $TEXT = {
|
|
309
309
|
chartText: "bb-chart-text",
|
|
310
310
|
chartTexts: "bb-chart-texts",
|
|
311
311
|
text: "bb-text",
|
|
@@ -313,17 +313,17 @@ var $TEXT = {
|
|
|
313
313
|
title: "bb-title",
|
|
314
314
|
TextOverlapping: "text-overlapping"
|
|
315
315
|
};
|
|
316
|
-
|
|
316
|
+
const $TOOLTIP = {
|
|
317
317
|
tooltip: "bb-tooltip",
|
|
318
318
|
tooltipContainer: "bb-tooltip-container",
|
|
319
319
|
tooltipName: "bb-tooltip-name"
|
|
320
320
|
};
|
|
321
|
-
|
|
321
|
+
const $TREEMAP = {
|
|
322
322
|
treemap: "bb-treemap",
|
|
323
323
|
chartTreemap: "bb-chart-treemap",
|
|
324
324
|
chartTreemaps: "bb-chart-treemaps"
|
|
325
325
|
};
|
|
326
|
-
|
|
326
|
+
const $ZOOM = {
|
|
327
327
|
buttonZoomReset: "bb-zoom-reset",
|
|
328
328
|
zoomBrush: "bb-zoom-brush"
|
|
329
329
|
};
|
|
@@ -347,7 +347,7 @@ var $ZOOM = {
|
|
|
347
347
|
* @example
|
|
348
348
|
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
349
349
|
*/
|
|
350
|
-
|
|
350
|
+
let Plugin = /*#__PURE__*/function () {
|
|
351
351
|
/**
|
|
352
352
|
* Constructor
|
|
353
353
|
* @param {Any} options config option object
|
|
@@ -401,7 +401,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
401
401
|
};
|
|
402
402
|
return Plugin;
|
|
403
403
|
}();
|
|
404
|
-
Plugin.version = "3.
|
|
404
|
+
Plugin.version = "3.10.0-next.1";
|
|
405
405
|
|
|
406
406
|
;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
|
|
407
407
|
/**
|
|
@@ -416,7 +416,7 @@ Plugin.version = "3.9.3";
|
|
|
416
416
|
* @returns {TableviewOptions}
|
|
417
417
|
* @private
|
|
418
418
|
*/
|
|
419
|
-
|
|
419
|
+
let Options = function () {
|
|
420
420
|
return {
|
|
421
421
|
/**
|
|
422
422
|
* Specify sparkline charts holder selector.
|
|
@@ -438,7 +438,6 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
438
438
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
439
439
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
440
440
|
|
|
441
|
-
var _this = undefined;
|
|
442
441
|
/**
|
|
443
442
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
444
443
|
* billboard.js project is licensed under the MIT license
|
|
@@ -449,32 +448,47 @@ var _this = undefined;
|
|
|
449
448
|
*/
|
|
450
449
|
/* eslint-disable no-new-func, no-undef */
|
|
451
450
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Get global object
|
|
454
|
+
* @returns {object} window object
|
|
455
|
+
* @private
|
|
456
|
+
*/
|
|
457
|
+
function getGlobal() {
|
|
458
|
+
return typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self || Function("return this")();
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Get fallback object
|
|
463
|
+
* @param {object} w global object
|
|
464
|
+
* @returns {Array} fallback object array
|
|
465
|
+
* @private
|
|
466
|
+
*/
|
|
467
|
+
function getFallback(w) {
|
|
468
|
+
var _this = this;
|
|
469
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function",
|
|
470
|
+
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function";
|
|
471
|
+
return [hasRAF ? w.requestAnimationFrame : function (cb) {
|
|
460
472
|
_newArrowCheck(this, _this);
|
|
461
473
|
return setTimeout(cb, 1);
|
|
462
|
-
}.bind(
|
|
463
|
-
cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
|
|
474
|
+
}.bind(this), hasRAF ? w.cancelAnimationFrame : function (id) {
|
|
464
475
|
_newArrowCheck(this, _this);
|
|
465
476
|
return clearTimeout(id);
|
|
466
|
-
}.bind(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
doc = win == null ? void 0 : win.document
|
|
470
|
-
|
|
471
|
-
|
|
477
|
+
}.bind(this), hasRIC ? w.requestIdleCallback : requestAnimationFrame, hasRIC ? w.cancelIdleCallback : cancelAnimationFrame];
|
|
478
|
+
}
|
|
479
|
+
const win = getGlobal(),
|
|
480
|
+
doc = win == null ? void 0 : win.document,
|
|
481
|
+
_getFallback = getFallback(win),
|
|
482
|
+
requestAnimationFrame = _getFallback[0],
|
|
483
|
+
cancelAnimationFrame = _getFallback[1],
|
|
484
|
+
requestIdleCallback = _getFallback[2],
|
|
485
|
+
cancelIdleCallback = _getFallback[3];
|
|
472
486
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
473
487
|
|
|
474
488
|
|
|
475
|
-
var
|
|
476
|
-
function util_ownKeys(
|
|
477
|
-
function util_objectSpread(
|
|
489
|
+
var _this = undefined;
|
|
490
|
+
function util_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
491
|
+
function util_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? util_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : util_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
478
492
|
/**
|
|
479
493
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
480
494
|
* billboard.js project is licensed under the MIT license
|
|
@@ -484,64 +498,64 @@ function util_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
|
|
|
484
498
|
|
|
485
499
|
|
|
486
500
|
|
|
487
|
-
|
|
488
|
-
_newArrowCheck(this,
|
|
501
|
+
const isValue = function (v) {
|
|
502
|
+
_newArrowCheck(this, _this);
|
|
489
503
|
return v || v === 0;
|
|
490
504
|
}.bind(undefined),
|
|
491
505
|
isFunction = function (v) {
|
|
492
|
-
_newArrowCheck(this,
|
|
506
|
+
_newArrowCheck(this, _this);
|
|
493
507
|
return typeof v === "function";
|
|
494
508
|
}.bind(undefined),
|
|
495
509
|
isString = function (v) {
|
|
496
|
-
_newArrowCheck(this,
|
|
510
|
+
_newArrowCheck(this, _this);
|
|
497
511
|
return typeof v === "string";
|
|
498
512
|
}.bind(undefined),
|
|
499
513
|
isNumber = function (v) {
|
|
500
|
-
_newArrowCheck(this,
|
|
514
|
+
_newArrowCheck(this, _this);
|
|
501
515
|
return typeof v === "number";
|
|
502
516
|
}.bind(undefined),
|
|
503
517
|
isUndefined = function (v) {
|
|
504
|
-
_newArrowCheck(this,
|
|
518
|
+
_newArrowCheck(this, _this);
|
|
505
519
|
return typeof v === "undefined";
|
|
506
520
|
}.bind(undefined),
|
|
507
521
|
isDefined = function (v) {
|
|
508
|
-
_newArrowCheck(this,
|
|
522
|
+
_newArrowCheck(this, _this);
|
|
509
523
|
return typeof v !== "undefined";
|
|
510
524
|
}.bind(undefined),
|
|
511
525
|
isboolean = function (v) {
|
|
512
|
-
_newArrowCheck(this,
|
|
526
|
+
_newArrowCheck(this, _this);
|
|
513
527
|
return typeof v === "boolean";
|
|
514
528
|
}.bind(undefined),
|
|
515
529
|
ceil10 = function (v) {
|
|
516
|
-
_newArrowCheck(this,
|
|
530
|
+
_newArrowCheck(this, _this);
|
|
517
531
|
return Math.ceil(v / 10) * 10;
|
|
518
532
|
}.bind(undefined),
|
|
519
533
|
asHalfPixel = function (n) {
|
|
520
|
-
_newArrowCheck(this,
|
|
534
|
+
_newArrowCheck(this, _this);
|
|
521
535
|
return Math.ceil(n) + .5;
|
|
522
536
|
}.bind(undefined),
|
|
523
537
|
diffDomain = function (d) {
|
|
524
|
-
_newArrowCheck(this,
|
|
538
|
+
_newArrowCheck(this, _this);
|
|
525
539
|
return d[1] - d[0];
|
|
526
540
|
}.bind(undefined),
|
|
527
541
|
isObjectType = function (v) {
|
|
528
|
-
_newArrowCheck(this,
|
|
542
|
+
_newArrowCheck(this, _this);
|
|
529
543
|
return typeof v === "object";
|
|
530
544
|
}.bind(undefined),
|
|
531
545
|
isEmpty = function (o) {
|
|
532
|
-
_newArrowCheck(this,
|
|
546
|
+
_newArrowCheck(this, _this);
|
|
533
547
|
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
534
548
|
}.bind(undefined),
|
|
535
549
|
notEmpty = function (o) {
|
|
536
|
-
_newArrowCheck(this,
|
|
550
|
+
_newArrowCheck(this, _this);
|
|
537
551
|
return !isEmpty(o);
|
|
538
552
|
}.bind(undefined),
|
|
539
553
|
isArray = function (arr) {
|
|
540
|
-
_newArrowCheck(this,
|
|
554
|
+
_newArrowCheck(this, _this);
|
|
541
555
|
return Array.isArray(arr);
|
|
542
556
|
}.bind(undefined),
|
|
543
557
|
isObject = function (obj) {
|
|
544
|
-
_newArrowCheck(this,
|
|
558
|
+
_newArrowCheck(this, _this);
|
|
545
559
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
546
560
|
}.bind(undefined);
|
|
547
561
|
/**
|
|
@@ -577,8 +591,8 @@ function getOption(options, key, defaultValue) {
|
|
|
577
591
|
* @private
|
|
578
592
|
*/
|
|
579
593
|
function hasValue(dict, value) {
|
|
580
|
-
var _this2 = this
|
|
581
|
-
|
|
594
|
+
var _this2 = this;
|
|
595
|
+
let found = !1;
|
|
582
596
|
Object.keys(dict).forEach(function (key) {
|
|
583
597
|
_newArrowCheck(this, _this2);
|
|
584
598
|
return dict[key] === value && (found = !0);
|
|
@@ -595,7 +609,7 @@ function hasValue(dict, value) {
|
|
|
595
609
|
* @private
|
|
596
610
|
*/
|
|
597
611
|
function callFn(fn, thisArg) {
|
|
598
|
-
|
|
612
|
+
const isFn = isFunction(fn);
|
|
599
613
|
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
600
614
|
args[_key - 2] = arguments[_key];
|
|
601
615
|
}
|
|
@@ -610,14 +624,15 @@ function callFn(fn, thisArg) {
|
|
|
610
624
|
* @private
|
|
611
625
|
*/
|
|
612
626
|
function endall(transition, cb) {
|
|
613
|
-
var _this3 = this
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
627
|
+
var _this3 = this;
|
|
628
|
+
let n = 0;
|
|
629
|
+
const end = function () {
|
|
630
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
631
|
+
args[_key2] = arguments[_key2];
|
|
632
|
+
}
|
|
633
|
+
--n || cb.apply.apply(cb, [this].concat(args));
|
|
634
|
+
};
|
|
635
|
+
|
|
621
636
|
// if is transition selection
|
|
622
637
|
if ("duration" in transition) {
|
|
623
638
|
transition.each(function () {
|
|
@@ -636,8 +651,8 @@ function endall(transition, cb) {
|
|
|
636
651
|
* @returns {string}
|
|
637
652
|
* @private
|
|
638
653
|
*/
|
|
639
|
-
function
|
|
640
|
-
return isString(str) ? str.replace(
|
|
654
|
+
function sanitize(str) {
|
|
655
|
+
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
641
656
|
}
|
|
642
657
|
|
|
643
658
|
/**
|
|
@@ -662,12 +677,12 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
662
677
|
if (text.indexOf("\n") === -1) {
|
|
663
678
|
node.text(text);
|
|
664
679
|
} else {
|
|
665
|
-
|
|
680
|
+
const diff = [node.text(), text].map(function (v) {
|
|
666
681
|
_newArrowCheck(this, _this4);
|
|
667
682
|
return v.replace(/[\s\n]/g, "");
|
|
668
683
|
}.bind(this));
|
|
669
684
|
if (diff[0] !== diff[1]) {
|
|
670
|
-
|
|
685
|
+
const multiline = text.split("\n"),
|
|
671
686
|
len = toMiddle ? multiline.length - 1 : 1;
|
|
672
687
|
// reset possible text
|
|
673
688
|
node.html("");
|
|
@@ -693,7 +708,7 @@ function getRectSegList(path) {
|
|
|
693
708
|
* | |
|
|
694
709
|
* seg0 ---------- seg3
|
|
695
710
|
* */
|
|
696
|
-
|
|
711
|
+
const _path$getBBox = path.getBBox(),
|
|
697
712
|
x = _path$getBBox.x,
|
|
698
713
|
y = _path$getBBox.y,
|
|
699
714
|
width = _path$getBBox.width,
|
|
@@ -727,7 +742,7 @@ function getRectSegList(path) {
|
|
|
727
742
|
* @private
|
|
728
743
|
*/
|
|
729
744
|
function getPathBox(path) {
|
|
730
|
-
|
|
745
|
+
const _path$getBoundingClie = path.getBoundingClientRect(),
|
|
731
746
|
width = _path$getBoundingClie.width,
|
|
732
747
|
height = _path$getBoundingClie.height,
|
|
733
748
|
items = getRectSegList(path),
|
|
@@ -750,9 +765,12 @@ function getPathBox(path) {
|
|
|
750
765
|
*/
|
|
751
766
|
function getPointer(event, element) {
|
|
752
767
|
var _ref,
|
|
753
|
-
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
754
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
755
768
|
_this5 = this;
|
|
769
|
+
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
770
|
+
let pointer = [0, 0];
|
|
771
|
+
try {
|
|
772
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
773
|
+
} catch (e) {}
|
|
756
774
|
return pointer.map(function (v) {
|
|
757
775
|
_newArrowCheck(this, _this5);
|
|
758
776
|
return isNaN(v) ? 0 : v;
|
|
@@ -766,10 +784,10 @@ function getPointer(event, element) {
|
|
|
766
784
|
* @private
|
|
767
785
|
*/
|
|
768
786
|
function getBrushSelection(ctx) {
|
|
769
|
-
|
|
787
|
+
const event = ctx.event,
|
|
770
788
|
$el = ctx.$el,
|
|
771
789
|
main = $el.subchart.main || $el.main;
|
|
772
|
-
|
|
790
|
+
let selection;
|
|
773
791
|
|
|
774
792
|
// check from event
|
|
775
793
|
if (event && event.type === "brush") {
|
|
@@ -789,7 +807,7 @@ function getBrushSelection(ctx) {
|
|
|
789
807
|
* @private
|
|
790
808
|
*/
|
|
791
809
|
function getBoundingRect(node) {
|
|
792
|
-
|
|
810
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
793
811
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
794
812
|
}
|
|
795
813
|
|
|
@@ -811,7 +829,7 @@ function getRandom(asStr, min, max) {
|
|
|
811
829
|
if (max === void 0) {
|
|
812
830
|
max = 1e4;
|
|
813
831
|
}
|
|
814
|
-
|
|
832
|
+
const crpt = win.crypto || win.msCrypto,
|
|
815
833
|
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
816
834
|
return asStr ? rand + "" : rand;
|
|
817
835
|
}
|
|
@@ -830,8 +848,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
830
848
|
if (start > end) {
|
|
831
849
|
return -1;
|
|
832
850
|
}
|
|
833
|
-
|
|
834
|
-
|
|
851
|
+
const mid = Math.floor((start + end) / 2);
|
|
852
|
+
let _arr$mid = arr[mid],
|
|
835
853
|
x = _arr$mid.x,
|
|
836
854
|
_arr$mid$w = _arr$mid.w,
|
|
837
855
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -852,7 +870,7 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
852
870
|
* @private
|
|
853
871
|
*/
|
|
854
872
|
function brushEmpty(ctx) {
|
|
855
|
-
|
|
873
|
+
const selection = getBrushSelection(ctx);
|
|
856
874
|
if (selection) {
|
|
857
875
|
// brush selected area
|
|
858
876
|
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
@@ -869,17 +887,19 @@ function brushEmpty(ctx) {
|
|
|
869
887
|
* @private
|
|
870
888
|
*/
|
|
871
889
|
function deepClone() {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return r;
|
|
890
|
+
var _this6 = this;
|
|
891
|
+
const _clone = function clone(v) {
|
|
892
|
+
_newArrowCheck(this, _this6);
|
|
893
|
+
if (isObject(v) && v.constructor) {
|
|
894
|
+
const r = new v.constructor();
|
|
895
|
+
for (const k in v) {
|
|
896
|
+
r[k] = _clone(v[k]);
|
|
880
897
|
}
|
|
881
|
-
return
|
|
882
|
-
}
|
|
898
|
+
return r;
|
|
899
|
+
}
|
|
900
|
+
return v;
|
|
901
|
+
}.bind(this);
|
|
902
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
883
903
|
objectN[_key3] = arguments[_key3];
|
|
884
904
|
}
|
|
885
905
|
return objectN.map(function (v) {
|
|
@@ -911,7 +931,7 @@ function extend(target, source) {
|
|
|
911
931
|
}
|
|
912
932
|
|
|
913
933
|
// exclude name with only numbers
|
|
914
|
-
for (
|
|
934
|
+
for (const p in source) {
|
|
915
935
|
if (/^\d+$/.test(p) || p in target) {
|
|
916
936
|
continue;
|
|
917
937
|
}
|
|
@@ -926,8 +946,8 @@ function extend(target, source) {
|
|
|
926
946
|
* @returns {string} capitalized string
|
|
927
947
|
* @private
|
|
928
948
|
*/
|
|
929
|
-
|
|
930
|
-
_newArrowCheck(this,
|
|
949
|
+
const capitalize = function (str) {
|
|
950
|
+
_newArrowCheck(this, _this);
|
|
931
951
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
932
952
|
}.bind(undefined);
|
|
933
953
|
|
|
@@ -955,8 +975,8 @@ function camelize(str, separator) {
|
|
|
955
975
|
* @returns {Array}
|
|
956
976
|
* @private
|
|
957
977
|
*/
|
|
958
|
-
|
|
959
|
-
_newArrowCheck(this,
|
|
978
|
+
const toArray = function (v) {
|
|
979
|
+
_newArrowCheck(this, _this);
|
|
960
980
|
return [].slice.call(v);
|
|
961
981
|
}.bind(undefined);
|
|
962
982
|
|
|
@@ -969,8 +989,8 @@ var toArray = function (v) {
|
|
|
969
989
|
* @private
|
|
970
990
|
*/
|
|
971
991
|
function addCssRules(style, selector, prop) {
|
|
972
|
-
var _this9 = this
|
|
973
|
-
|
|
992
|
+
var _this9 = this;
|
|
993
|
+
const rootSelctor = style.rootSelctor,
|
|
974
994
|
sheet = style.sheet,
|
|
975
995
|
getSelector = function (s) {
|
|
976
996
|
_newArrowCheck(this, _this9);
|
|
@@ -987,8 +1007,8 @@ function addCssRules(style, selector, prop) {
|
|
|
987
1007
|
* @private
|
|
988
1008
|
*/
|
|
989
1009
|
function getCssRules(styleSheets) {
|
|
990
|
-
var _this10 = this
|
|
991
|
-
|
|
1010
|
+
var _this10 = this;
|
|
1011
|
+
let rules = [];
|
|
992
1012
|
styleSheets.forEach(function (sheet) {
|
|
993
1013
|
_newArrowCheck(this, _this10);
|
|
994
1014
|
try {
|
|
@@ -997,7 +1017,7 @@ function getCssRules(styleSheets) {
|
|
|
997
1017
|
}
|
|
998
1018
|
} catch (e) {
|
|
999
1019
|
var _window$console;
|
|
1000
|
-
(_window$console = win.console) == null
|
|
1020
|
+
(_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
1001
1021
|
}
|
|
1002
1022
|
}.bind(this));
|
|
1003
1023
|
return rules;
|
|
@@ -1010,7 +1030,7 @@ function getCssRules(styleSheets) {
|
|
|
1010
1030
|
* @private
|
|
1011
1031
|
*/
|
|
1012
1032
|
function getTranslation(node) {
|
|
1013
|
-
|
|
1033
|
+
const transform = node ? node.transform : null,
|
|
1014
1034
|
baseVal = transform && transform.baseVal;
|
|
1015
1035
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
1016
1036
|
a: 0,
|
|
@@ -1029,8 +1049,8 @@ function getTranslation(node) {
|
|
|
1029
1049
|
* @private
|
|
1030
1050
|
*/
|
|
1031
1051
|
function getUnique(data) {
|
|
1032
|
-
var _this11 = this
|
|
1033
|
-
|
|
1052
|
+
var _this11 = this;
|
|
1053
|
+
const isDate = data[0] instanceof Date,
|
|
1034
1054
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
1035
1055
|
_newArrowCheck(this, _this11);
|
|
1036
1056
|
return self.indexOf(v) === i;
|
|
@@ -1069,11 +1089,11 @@ function mergeObj(target) {
|
|
|
1069
1089
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
1070
1090
|
return target;
|
|
1071
1091
|
}
|
|
1072
|
-
|
|
1092
|
+
const source = objectN.shift();
|
|
1073
1093
|
if (isObject(target) && isObject(source)) {
|
|
1074
1094
|
Object.keys(source).forEach(function (key) {
|
|
1075
1095
|
_newArrowCheck(this, _this13);
|
|
1076
|
-
|
|
1096
|
+
const value = source[key];
|
|
1077
1097
|
if (isObject(value)) {
|
|
1078
1098
|
target[key] || (target[key] = {});
|
|
1079
1099
|
target[key] = mergeObj(target[key], value);
|
|
@@ -1097,7 +1117,7 @@ function sortValue(data, isAsc) {
|
|
|
1097
1117
|
if (isAsc === void 0) {
|
|
1098
1118
|
isAsc = !0;
|
|
1099
1119
|
}
|
|
1100
|
-
|
|
1120
|
+
let fn;
|
|
1101
1121
|
if (data[0] instanceof Date) {
|
|
1102
1122
|
fn = isAsc ? function (a, b) {
|
|
1103
1123
|
_newArrowCheck(this, _this14);
|
|
@@ -1130,11 +1150,11 @@ function sortValue(data, isAsc) {
|
|
|
1130
1150
|
* @private
|
|
1131
1151
|
*/
|
|
1132
1152
|
function getMinMax(type, data) {
|
|
1133
|
-
var _this15 = this
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1153
|
+
var _this15 = this;
|
|
1154
|
+
let res = data.filter(function (v) {
|
|
1155
|
+
_newArrowCheck(this, _this15);
|
|
1156
|
+
return notEmpty(v);
|
|
1157
|
+
}.bind(this));
|
|
1138
1158
|
if (res.length) {
|
|
1139
1159
|
if (isNumber(res[0])) {
|
|
1140
1160
|
res = Math[type].apply(Math, res);
|
|
@@ -1155,14 +1175,14 @@ function getMinMax(type, data) {
|
|
|
1155
1175
|
* @returns {Array}
|
|
1156
1176
|
* @private
|
|
1157
1177
|
*/
|
|
1158
|
-
|
|
1178
|
+
const getRange = function (start, end, step) {
|
|
1159
1179
|
if (step === void 0) {
|
|
1160
1180
|
step = 1;
|
|
1161
1181
|
}
|
|
1162
|
-
_newArrowCheck(this,
|
|
1163
|
-
|
|
1182
|
+
_newArrowCheck(this, _this);
|
|
1183
|
+
const res = [],
|
|
1164
1184
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1165
|
-
for (
|
|
1185
|
+
for (let i = start; i < n; i++) {
|
|
1166
1186
|
res.push(start + i * step);
|
|
1167
1187
|
}
|
|
1168
1188
|
return res;
|
|
@@ -1170,8 +1190,8 @@ var getRange = function (start, end, step) {
|
|
|
1170
1190
|
emulateEvent = {
|
|
1171
1191
|
mouse: function () {
|
|
1172
1192
|
var _this16 = this;
|
|
1173
|
-
_newArrowCheck(this,
|
|
1174
|
-
|
|
1193
|
+
_newArrowCheck(this, _this);
|
|
1194
|
+
const getParams = function () {
|
|
1175
1195
|
_newArrowCheck(this, _this16);
|
|
1176
1196
|
return {
|
|
1177
1197
|
bubbles: !1,
|
|
@@ -1199,7 +1219,7 @@ var getRange = function (start, end, step) {
|
|
|
1199
1219
|
params = getParams();
|
|
1200
1220
|
}
|
|
1201
1221
|
_newArrowCheck(this, _this16);
|
|
1202
|
-
|
|
1222
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
1203
1223
|
|
|
1204
1224
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1205
1225
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
@@ -1210,8 +1230,8 @@ var getRange = function (start, end, step) {
|
|
|
1210
1230
|
}
|
|
1211
1231
|
}.bind(undefined)(),
|
|
1212
1232
|
touch: function touch(el, eventType, params) {
|
|
1213
|
-
_newArrowCheck(this,
|
|
1214
|
-
|
|
1233
|
+
_newArrowCheck(this, _this);
|
|
1234
|
+
const touchObj = new Touch(mergeObj({
|
|
1215
1235
|
identifier: Date.now(),
|
|
1216
1236
|
target: el,
|
|
1217
1237
|
radiusX: 2.5,
|
|
@@ -1237,8 +1257,8 @@ var getRange = function (start, end, step) {
|
|
|
1237
1257
|
* @private
|
|
1238
1258
|
*/
|
|
1239
1259
|
function tplProcess(tpl, data) {
|
|
1240
|
-
|
|
1241
|
-
for (
|
|
1260
|
+
let res = tpl;
|
|
1261
|
+
for (const x in data) {
|
|
1242
1262
|
res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
1243
1263
|
}
|
|
1244
1264
|
return res;
|
|
@@ -1252,13 +1272,14 @@ function tplProcess(tpl, data) {
|
|
|
1252
1272
|
* @private
|
|
1253
1273
|
*/
|
|
1254
1274
|
function parseDate(date) {
|
|
1255
|
-
|
|
1275
|
+
let parsedDate;
|
|
1256
1276
|
if (date instanceof Date) {
|
|
1257
1277
|
parsedDate = date;
|
|
1258
1278
|
} else if (isString(date)) {
|
|
1259
|
-
var _format$dataTime
|
|
1260
|
-
|
|
1279
|
+
var _format$dataTime;
|
|
1280
|
+
const config = this.config,
|
|
1261
1281
|
format = this.format;
|
|
1282
|
+
|
|
1262
1283
|
// if fails to parse, try by new Date()
|
|
1263
1284
|
// https://github.com/naver/billboard.js/issues/1714
|
|
1264
1285
|
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
@@ -1288,11 +1309,11 @@ function isTabVisible() {
|
|
|
1288
1309
|
* @private
|
|
1289
1310
|
*/
|
|
1290
1311
|
function convertInputType(mouse, touch) {
|
|
1291
|
-
var _this17 = this
|
|
1292
|
-
|
|
1312
|
+
var _this17 = this;
|
|
1313
|
+
const DocumentTouch = win.DocumentTouch,
|
|
1293
1314
|
matchMedia = win.matchMedia,
|
|
1294
|
-
navigator = win.navigator
|
|
1295
|
-
|
|
1315
|
+
navigator = win.navigator;
|
|
1316
|
+
let hasTouch = !1;
|
|
1296
1317
|
if (touch) {
|
|
1297
1318
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1298
1319
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
@@ -1308,7 +1329,7 @@ function convertInputType(mouse, touch) {
|
|
|
1308
1329
|
hasTouch = !0;
|
|
1309
1330
|
} else {
|
|
1310
1331
|
// Only as a last resort, fall back to user agent sniffing
|
|
1311
|
-
|
|
1332
|
+
const UA = navigator.userAgent;
|
|
1312
1333
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1313
1334
|
}
|
|
1314
1335
|
}
|
|
@@ -1317,7 +1338,7 @@ function convertInputType(mouse, touch) {
|
|
|
1317
1338
|
// 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
|
|
1318
1339
|
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1319
1340
|
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1320
|
-
|
|
1341
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1321
1342
|
_newArrowCheck(this, _this17);
|
|
1322
1343
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1323
1344
|
}.bind(this));
|
|
@@ -1356,22 +1377,20 @@ function runUntil(fn, conditionFn) {
|
|
|
1356
1377
|
* @private
|
|
1357
1378
|
*/
|
|
1358
1379
|
function loadConfig(config) {
|
|
1359
|
-
var _this = this
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
return undefined;
|
|
1374
|
-
}.bind(this);
|
|
1380
|
+
var _this = this;
|
|
1381
|
+
const thisConfig = this.config;
|
|
1382
|
+
let target, keys, read;
|
|
1383
|
+
const _find = function find() {
|
|
1384
|
+
_newArrowCheck(this, _this);
|
|
1385
|
+
const key = keys.shift();
|
|
1386
|
+
if (key && target && isObjectType(target) && key in target) {
|
|
1387
|
+
target = target[key];
|
|
1388
|
+
return _find();
|
|
1389
|
+
} else if (!key) {
|
|
1390
|
+
return target;
|
|
1391
|
+
}
|
|
1392
|
+
return undefined;
|
|
1393
|
+
}.bind(this);
|
|
1375
1394
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1376
1395
|
_newArrowCheck(this, _this);
|
|
1377
1396
|
target = config;
|
|
@@ -1445,7 +1464,7 @@ function loadConfig(config) {
|
|
|
1445
1464
|
* ]
|
|
1446
1465
|
* })
|
|
1447
1466
|
*/
|
|
1448
|
-
|
|
1467
|
+
let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
1449
1468
|
_inheritsLoose(Sparkline, _Plugin);
|
|
1450
1469
|
function Sparkline(options) {
|
|
1451
1470
|
var _this = _Plugin.call(this, options) || this;
|
|
@@ -1472,9 +1491,9 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1472
1491
|
this.outHandler = this.outHandler.bind(this);
|
|
1473
1492
|
};
|
|
1474
1493
|
_proto.validate = function validate() {
|
|
1475
|
-
|
|
1494
|
+
const $$ = this.$$,
|
|
1476
1495
|
config = this.config;
|
|
1477
|
-
|
|
1496
|
+
let msg = "";
|
|
1478
1497
|
if (!config.selector || !document.querySelector(config.selector)) {
|
|
1479
1498
|
msg = "No holder elements found from given selector option.";
|
|
1480
1499
|
}
|
|
@@ -1486,7 +1505,7 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1486
1505
|
}
|
|
1487
1506
|
};
|
|
1488
1507
|
_proto.overrideInternals = function overrideInternals() {
|
|
1489
|
-
|
|
1508
|
+
const $$ = this.$$,
|
|
1490
1509
|
getBarW = $$.getBarW,
|
|
1491
1510
|
getIndices = $$.getIndices;
|
|
1492
1511
|
// override internal methods to positioning bars
|
|
@@ -1498,15 +1517,15 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1498
1517
|
};
|
|
1499
1518
|
};
|
|
1500
1519
|
_proto.overrideOptions = function overrideOptions() {
|
|
1501
|
-
var _this2 = this
|
|
1502
|
-
|
|
1520
|
+
var _this2 = this;
|
|
1521
|
+
const config = this.$$.config;
|
|
1503
1522
|
config.legend_show = !1;
|
|
1504
1523
|
config.resize_auto = !1;
|
|
1505
1524
|
config.axis_x_show = !1;
|
|
1506
1525
|
|
|
1507
1526
|
// set default axes padding
|
|
1508
1527
|
if (config.padding !== !1) {
|
|
1509
|
-
|
|
1528
|
+
const hasOption = function (o) {
|
|
1510
1529
|
_newArrowCheck(this, _this2);
|
|
1511
1530
|
return Object.keys(o || {}).length > 0;
|
|
1512
1531
|
}.bind(this);
|
|
@@ -1524,8 +1543,8 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1524
1543
|
config.axis_y_show = !1;
|
|
1525
1544
|
if (!config.tooltip_position) {
|
|
1526
1545
|
config.tooltip_position = function (data, width, height) {
|
|
1527
|
-
|
|
1528
|
-
|
|
1546
|
+
const event = this.internal.state.event;
|
|
1547
|
+
let top = event.pageY - height * 1.35,
|
|
1529
1548
|
left = event.pageX - width / 2;
|
|
1530
1549
|
if (top < 0) {
|
|
1531
1550
|
top = 0;
|
|
@@ -1541,14 +1560,15 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1541
1560
|
}
|
|
1542
1561
|
};
|
|
1543
1562
|
_proto.$init = function $init() {
|
|
1544
|
-
var _$el$tooltip
|
|
1545
|
-
|
|
1563
|
+
var _$el$tooltip;
|
|
1564
|
+
const $el = this.$$.$el;
|
|
1565
|
+
|
|
1546
1566
|
// make disable-ish main chart element
|
|
1547
1567
|
$el.chart.style("width", "0").style("height", "0").style("pointer-events", "none");
|
|
1548
1568
|
((_$el$tooltip = $el.tooltip) == null ? void 0 : _$el$tooltip.node()) && document.body.appendChild($el.tooltip.node());
|
|
1549
1569
|
};
|
|
1550
1570
|
_proto.$afterInit = function $afterInit() {
|
|
1551
|
-
|
|
1571
|
+
const $$ = this.$$;
|
|
1552
1572
|
$$.$el.svg.attr("style", null).style("width", "0").style("height", "0");
|
|
1553
1573
|
this.bindEvents(!0);
|
|
1554
1574
|
}
|
|
@@ -1563,12 +1583,12 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1563
1583
|
if (bind === void 0) {
|
|
1564
1584
|
bind = !0;
|
|
1565
1585
|
}
|
|
1566
|
-
|
|
1586
|
+
const config = this.$$.config;
|
|
1567
1587
|
if (config.interaction_enabled && config.tooltip_show) {
|
|
1568
|
-
|
|
1588
|
+
const method = (bind ? "add" : "remove") + "EventListener";
|
|
1569
1589
|
this.element.forEach(function (el) {
|
|
1570
1590
|
_newArrowCheck(this, _this3);
|
|
1571
|
-
|
|
1591
|
+
const svg = el.querySelector("svg");
|
|
1572
1592
|
svg[method]("mouseover", this.overHandler);
|
|
1573
1593
|
svg[method]("mousemove", this.moveHandler);
|
|
1574
1594
|
svg[method]("mouseout", this.outHandler);
|
|
@@ -1576,14 +1596,13 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1576
1596
|
}
|
|
1577
1597
|
};
|
|
1578
1598
|
_proto.overHandler = function overHandler(e) {
|
|
1579
|
-
|
|
1599
|
+
const $$ = this.$$,
|
|
1580
1600
|
eventReceiver = $$.state.eventReceiver;
|
|
1581
1601
|
eventReceiver.rect = e.target.getBoundingClientRect();
|
|
1582
1602
|
};
|
|
1583
1603
|
_proto.moveHandler = function moveHandler(e) {
|
|
1584
|
-
var _$$$api$data,
|
|
1585
|
-
|
|
1586
|
-
$$ = this.$$,
|
|
1604
|
+
var _$$$api$data, _data$values;
|
|
1605
|
+
const $$ = this.$$,
|
|
1587
1606
|
index = $$.getDataIndexFromEvent(e),
|
|
1588
1607
|
data = (_$$$api$data = $$.api.data(e.target.__id)) == null ? void 0 : _$$$api$data[0],
|
|
1589
1608
|
d = data == null || (_data$values = data.values) == null ? void 0 : _data$values[index];
|
|
@@ -1592,29 +1611,29 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1592
1611
|
}
|
|
1593
1612
|
$$.state.event = e;
|
|
1594
1613
|
if ($$.config.point_focus_only && d) {
|
|
1595
|
-
$$.showCircleFocus == null
|
|
1614
|
+
$$.showCircleFocus == null || $$.showCircleFocus([d]);
|
|
1596
1615
|
}
|
|
1597
1616
|
$$.setExpand(index, data.id, !0);
|
|
1598
1617
|
$$.showTooltip([d], e.target);
|
|
1599
1618
|
};
|
|
1600
1619
|
_proto.outHandler = function outHandler(e) {
|
|
1601
|
-
|
|
1620
|
+
const $$ = this.$$;
|
|
1602
1621
|
$$.state.event = e;
|
|
1603
1622
|
$$.config.point_focus_only ? $$.hideCircleFocus() : $$.unexpandCircles();
|
|
1604
1623
|
$$.hideTooltip();
|
|
1605
1624
|
};
|
|
1606
1625
|
_proto.$redraw = function $redraw() {
|
|
1607
1626
|
var _$el$chart$html$match,
|
|
1608
|
-
_this4 = this
|
|
1609
|
-
|
|
1610
|
-
$el = $$.$el
|
|
1611
|
-
|
|
1612
|
-
|
|
1627
|
+
_this4 = this;
|
|
1628
|
+
const $$ = this.$$,
|
|
1629
|
+
$el = $$.$el;
|
|
1630
|
+
let el = this.element;
|
|
1631
|
+
const data = $$.api.data(),
|
|
1613
1632
|
svgWrapper = (_$el$chart$html$match = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _$el$chart$html$match[0];
|
|
1614
1633
|
// append sparkline holder if is less than the data length
|
|
1615
1634
|
if (el.length < data.length) {
|
|
1616
|
-
|
|
1617
|
-
for (
|
|
1635
|
+
const chart = $el.chart.node();
|
|
1636
|
+
for (let i = data.length - el.length; i > 0; i--) {
|
|
1618
1637
|
chart.parentNode.insertBefore(el[0].cloneNode(), chart.nextSibling);
|
|
1619
1638
|
}
|
|
1620
1639
|
this.element = document.querySelectorAll(this.config.selector);
|
|
@@ -1625,9 +1644,9 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1625
1644
|
return v.id;
|
|
1626
1645
|
}.bind(this)).forEach(function (id, i) {
|
|
1627
1646
|
_newArrowCheck(this, _this4);
|
|
1628
|
-
|
|
1647
|
+
const selector = "." + $COMMON.target + "-" + id,
|
|
1629
1648
|
shape = $el.main.selectAll(selector);
|
|
1630
|
-
|
|
1649
|
+
let svg = el[i].querySelector("svg");
|
|
1631
1650
|
if (!svg) {
|
|
1632
1651
|
el[i].innerHTML = svgWrapper + "</svg>";
|
|
1633
1652
|
svg = el[i].querySelector("svg");
|