billboard.js 3.11.3 → 3.12.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.
Files changed (177) hide show
  1. package/README.md +1 -5
  2. package/dist/billboard.css +13 -1
  3. package/dist/billboard.js +19672 -24210
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +26 -3
  6. package/dist/billboard.pkgd.js +24515 -30430
  7. package/dist/billboard.pkgd.min.js +33 -3
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +429 -1134
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +666 -1524
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1387 -1854
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2760 -3959
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3504 -5057
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2906 -4072
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3076 -4506
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
  28. package/dist/theme/dark.css +12 -1
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +12 -1
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +12 -1
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +12 -1
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +12 -1
  37. package/dist/theme/modern.min.css +3 -4
  38. package/dist-esm/billboard.js +9297 -8527
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +20 -27
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +155 -149
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +302 -289
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +236 -236
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +41 -43
  44. package/package.json +29 -49
  45. package/src/Chart/api/axis.ts +6 -13
  46. package/src/Chart/api/chart.ts +12 -11
  47. package/src/Chart/api/data.ts +8 -7
  48. package/src/Chart/api/export.ts +28 -21
  49. package/src/Chart/api/flow.ts +4 -2
  50. package/src/Chart/api/grid.ts +1 -5
  51. package/src/Chart/api/load.ts +2 -2
  52. package/src/Chart/api/regions.ts +29 -5
  53. package/src/Chart/api/selection.ts +2 -2
  54. package/src/Chart/api/show.ts +2 -3
  55. package/src/Chart/api/subchart.ts +2 -2
  56. package/src/Chart/api/tooltip.ts +8 -9
  57. package/src/Chart/api/x.ts +2 -2
  58. package/src/Chart/api/zoom.ts +2 -2
  59. package/src/ChartInternal/Axis/Axis.ts +119 -44
  60. package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
  61. package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
  62. package/src/ChartInternal/ChartInternal.ts +87 -55
  63. package/src/ChartInternal/data/IData.ts +31 -31
  64. package/src/ChartInternal/data/convert.helper.ts +66 -68
  65. package/src/ChartInternal/data/convert.ts +11 -11
  66. package/src/ChartInternal/data/data.ts +51 -27
  67. package/src/ChartInternal/data/load.ts +7 -6
  68. package/src/ChartInternal/interactions/drag.ts +2 -1
  69. package/src/ChartInternal/interactions/eventrect.ts +84 -32
  70. package/src/ChartInternal/interactions/flow.ts +14 -4
  71. package/src/ChartInternal/interactions/interaction.ts +51 -22
  72. package/src/ChartInternal/interactions/subchart.ts +27 -25
  73. package/src/ChartInternal/interactions/zoom.ts +29 -18
  74. package/src/ChartInternal/internals/category.ts +1 -1
  75. package/src/ChartInternal/internals/class.ts +6 -6
  76. package/src/ChartInternal/internals/clip.ts +8 -4
  77. package/src/ChartInternal/internals/color.ts +70 -42
  78. package/src/ChartInternal/internals/domain.ts +59 -28
  79. package/src/ChartInternal/internals/format.ts +5 -5
  80. package/src/ChartInternal/internals/grid.ts +131 -47
  81. package/src/ChartInternal/internals/legend.ts +93 -61
  82. package/src/ChartInternal/internals/redraw.ts +6 -2
  83. package/src/ChartInternal/internals/region.ts +5 -3
  84. package/src/ChartInternal/internals/scale.ts +28 -15
  85. package/src/ChartInternal/internals/selection.ts +14 -13
  86. package/src/ChartInternal/internals/size.axis.ts +18 -10
  87. package/src/ChartInternal/internals/size.ts +98 -67
  88. package/src/ChartInternal/internals/style.ts +21 -19
  89. package/src/ChartInternal/internals/text.ts +79 -43
  90. package/src/ChartInternal/internals/title.ts +2 -2
  91. package/src/ChartInternal/internals/tooltip.ts +78 -32
  92. package/src/ChartInternal/internals/transform.ts +4 -4
  93. package/src/ChartInternal/internals/type.ts +17 -12
  94. package/src/ChartInternal/shape/arc.ts +78 -44
  95. package/src/ChartInternal/shape/area.ts +19 -22
  96. package/src/ChartInternal/shape/bar.ts +41 -31
  97. package/src/ChartInternal/shape/bubble.ts +5 -5
  98. package/src/ChartInternal/shape/candlestick.ts +15 -13
  99. package/src/ChartInternal/shape/funnel.ts +317 -0
  100. package/src/ChartInternal/shape/gauge.ts +16 -9
  101. package/src/ChartInternal/shape/line.ts +62 -46
  102. package/src/ChartInternal/shape/point.common.ts +1 -4
  103. package/src/ChartInternal/shape/point.ts +54 -34
  104. package/src/ChartInternal/shape/polar.ts +4 -2
  105. package/src/ChartInternal/shape/radar.ts +40 -22
  106. package/src/ChartInternal/shape/shape.ts +84 -58
  107. package/src/ChartInternal/shape/treemap.ts +31 -20
  108. package/src/Plugin/bubblecompare/index.ts +1 -3
  109. package/src/Plugin/sparkline/index.ts +3 -4
  110. package/src/Plugin/stanford/ColorScale.ts +3 -2
  111. package/src/Plugin/stanford/Elements.ts +15 -6
  112. package/src/Plugin/stanford/Options.ts +5 -5
  113. package/src/Plugin/stanford/index.ts +13 -9
  114. package/src/Plugin/tableview/Options.ts +1 -1
  115. package/src/Plugin/tableview/const.ts +1 -4
  116. package/src/Plugin/tableview/index.ts +11 -9
  117. package/src/Plugin/textoverlap/index.ts +4 -6
  118. package/src/config/Options/Options.ts +3 -3
  119. package/src/config/Options/axis/axis.ts +36 -0
  120. package/src/config/Options/axis/x.ts +34 -14
  121. package/src/config/Options/axis/y.ts +13 -13
  122. package/src/config/Options/axis/y2.ts +23 -10
  123. package/src/config/Options/common/color.ts +4 -4
  124. package/src/config/Options/common/grid.ts +4 -4
  125. package/src/config/Options/common/legend.ts +12 -13
  126. package/src/config/Options/common/main.ts +23 -23
  127. package/src/config/Options/common/point.ts +17 -18
  128. package/src/config/Options/common/title.ts +2 -2
  129. package/src/config/Options/common/tooltip.ts +13 -11
  130. package/src/config/Options/data/axis.ts +2 -2
  131. package/src/config/Options/data/data.ts +48 -45
  132. package/src/config/Options/interaction/interaction.ts +1 -1
  133. package/src/config/Options/interaction/subchart.ts +2 -2
  134. package/src/config/Options/interaction/zoom.ts +9 -9
  135. package/src/config/Options/shape/arc.ts +10 -13
  136. package/src/config/Options/shape/area.ts +5 -7
  137. package/src/config/Options/shape/bar.ts +8 -10
  138. package/src/config/Options/shape/bubble.ts +1 -1
  139. package/src/config/Options/shape/candlestick.ts +2 -2
  140. package/src/config/Options/shape/donut.ts +4 -4
  141. package/src/config/Options/shape/funnel.ts +38 -0
  142. package/src/config/Options/shape/gauge.ts +6 -6
  143. package/src/config/Options/shape/line.ts +3 -3
  144. package/src/config/Options/shape/pie.ts +5 -5
  145. package/src/config/Options/shape/polar.ts +3 -3
  146. package/src/config/Options/shape/radar.ts +2 -2
  147. package/src/config/Options/shape/scatter.ts +1 -1
  148. package/src/config/Options/shape/treemap.ts +1 -1
  149. package/src/config/Store/Element.ts +8 -5
  150. package/src/config/Store/State.ts +20 -13
  151. package/src/config/classes.ts +14 -4
  152. package/src/config/config.ts +1 -1
  153. package/src/config/const.ts +2 -0
  154. package/src/config/resolver/axis.ts +4 -4
  155. package/src/config/resolver/interaction.ts +3 -7
  156. package/src/config/resolver/shape.ts +17 -12
  157. package/src/core.ts +2 -3
  158. package/src/index.esm.ts +3 -6
  159. package/src/index.ts +2 -2
  160. package/src/module/Cache.ts +2 -3
  161. package/src/module/browser.ts +15 -10
  162. package/src/module/error.ts +9 -8
  163. package/src/module/generator.ts +3 -5
  164. package/src/module/util.ts +62 -39
  165. package/src/module/worker.ts +14 -11
  166. package/src/scss/billboard.scss +18 -0
  167. package/src/scss/theme/dark.scss +17 -0
  168. package/src/scss/theme/datalab.scss +17 -0
  169. package/src/scss/theme/graph.scss +17 -0
  170. package/src/scss/theme/insight.scss +17 -0
  171. package/src/scss/theme/modern.scss +17 -0
  172. package/types/axis.d.ts +17 -0
  173. package/types/bb.d.ts +1 -0
  174. package/types/index.d.ts +1 -0
  175. package/types/options.d.ts +9 -0
  176. package/types/options.shape.d.ts +26 -1
  177. package/types/types.d.ts +1 -0
@@ -5,20 +5,20 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.11.3
8
+ * @version 3.12.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
12
12
  (function webpackUniversalModuleDefinition(root, factory) {
13
13
  if(typeof exports === 'object' && typeof module === 'object')
14
- module.exports = factory(require("d3-selection"), require("d3-brush"));
14
+ module.exports = factory(require("d3-brush"), require("d3-selection"));
15
15
  else if(typeof define === 'function' && define.amd)
16
- define("bb", ["d3-selection", "d3-brush"], factory);
16
+ define("bb", ["d3-brush", "d3-selection"], factory);
17
17
  else if(typeof exports === 'object')
18
- exports["bb"] = factory(require("d3-selection"), require("d3-brush"));
18
+ exports["bb"] = factory(require("d3-brush"), require("d3-selection"));
19
19
  else
20
20
  root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["tableview"] = factory(root["d3"], root["d3"]);
21
- })(this, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__3__) {
21
+ })(this, function(__WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__1__) {
22
22
  return /******/ (function() { // webpackBootstrap
23
23
  /******/ "use strict";
24
24
  /******/ var __webpack_modules__ = ([
@@ -90,707 +90,179 @@ __webpack_require__.d(__webpack_exports__, {
90
90
  "default": function() { return /* binding */ TableView; }
91
91
  });
92
92
 
93
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
94
- function _typeof(o) {
95
- "@babel/helpers - typeof";
96
-
97
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
98
- return typeof o;
99
- } : function (o) {
100
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
101
- }, _typeof(o);
102
- }
103
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
104
-
105
- function toPrimitive(t, r) {
106
- if ("object" != _typeof(t) || !t) return t;
107
- var e = t[Symbol.toPrimitive];
108
- if (void 0 !== e) {
109
- var i = e.call(t, r || "default");
110
- if ("object" != _typeof(i)) return i;
111
- throw new TypeError("@@toPrimitive must return a primitive value.");
112
- }
113
- return ("string" === r ? String : Number)(t);
114
- }
115
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
116
-
117
-
118
- function toPropertyKey(t) {
119
- var i = toPrimitive(t, "string");
120
- return "symbol" == _typeof(i) ? i : String(i);
121
- }
122
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
123
-
124
- function _defineProperty(obj, key, value) {
125
- key = toPropertyKey(key);
126
- if (key in obj) {
127
- Object.defineProperty(obj, key, {
128
- value: value,
129
- enumerable: true,
130
- configurable: true,
131
- writable: true
132
- });
133
- } else {
134
- obj[key] = value;
135
- }
136
- return obj;
137
- }
138
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
139
- function _newArrowCheck(innerThis, boundThis) {
140
- if (innerThis !== boundThis) {
141
- throw new TypeError("Cannot instantiate an arrow function");
142
- }
143
- }
144
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
145
- function _assertThisInitialized(self) {
146
- if (self === void 0) {
147
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
148
- }
149
- return self;
150
- }
151
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
152
- function _setPrototypeOf(o, p) {
153
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
154
- o.__proto__ = p;
155
- return o;
156
- };
157
- return _setPrototypeOf(o, p);
158
- }
159
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
160
-
161
- function _inheritsLoose(subClass, superClass) {
162
- subClass.prototype = Object.create(superClass.prototype);
163
- subClass.prototype.constructor = subClass;
164
- _setPrototypeOf(subClass, superClass);
165
- }
166
- ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
167
-
168
- /**
169
- * Copyright (c) 2017 ~ present NAVER Corp.
170
- * billboard.js project is licensed under the MIT license
171
- */
172
- /**
173
- * Base class to generate billboard.js plugin
174
- * @class Plugin
175
- */
176
- /**
177
- * Version info string for plugin
178
- * @name version
179
- * @static
180
- * @memberof Plugin
181
- * @type {string}
182
- * @example
183
- * bb.plugin.stanford.version; // ex) 1.9.0
184
- */
185
- let Plugin = /*#__PURE__*/function () {
186
- /**
187
- * Constructor
188
- * @param {Any} options config option object
189
- * @private
190
- */
191
- function Plugin(options) {
192
- if (options === void 0) {
193
- options = {};
194
- }
195
- this.$$ = void 0;
196
- this.options = void 0;
197
- this.options = options;
198
- }
199
-
200
- /**
201
- * Lifecycle hook for 'beforeInit' phase.
202
- * @private
203
- */
204
- var _proto = Plugin.prototype;
205
- _proto.$beforeInit = function $beforeInit() {}
206
-
207
- /**
208
- * Lifecycle hook for 'init' phase.
209
- * @private
210
- */;
211
- _proto.$init = function $init() {}
212
-
213
- /**
214
- * Lifecycle hook for 'afterInit' phase.
215
- * @private
216
- */;
217
- _proto.$afterInit = function $afterInit() {}
218
-
219
- /**
220
- * Lifecycle hook for 'redraw' phase.
221
- * @private
222
- */;
223
- _proto.$redraw = function $redraw() {}
224
-
225
- /**
226
- * Lifecycle hook for 'willDestroy' phase.
227
- * @private
228
- */;
229
- _proto.$willDestroy = function $willDestroy() {
230
- var _this = this;
231
- Object.keys(this).forEach(function (key) {
232
- _newArrowCheck(this, _this);
233
- this[key] = null;
234
- delete this[key];
235
- }.bind(this));
236
- };
237
- return Plugin;
238
- }();
239
- Plugin.version = "3.11.3";
240
-
241
- ;// CONCATENATED MODULE: ./src/Plugin/tableview/Options.ts
242
- /**
243
- * Copyright (c) 2021 ~ present NAVER Corp.
244
- * billboard.js project is licensed under the MIT license
245
- */
246
- /**
247
- * TableView plugin option class
248
- * @class TableviewOptions
249
- * @param {Options} options TableView plugin options
250
- * @augments Plugin
251
- * @returns {TableviewOptions}
252
- * @private
253
- */
254
- let Options = function () {
255
- return {
256
- /**
257
- * Set tableview holder selector.
258
- * - **NOTE:** If not set, will append new holder element dynamically right after chart element.
259
- * @name selector
260
- * @memberof plugin-tableview
261
- * @type {string}
262
- * @default undefined
263
- * @example
264
- * selector: "#table-holder"
265
- */
266
- selector: undefined,
267
- /**
268
- * Set category title text
269
- * @name categoryTitle
270
- * @memberof plugin-tableview
271
- * @type {string}
272
- * @default "Category"
273
- * @example
274
- * categoryTitle: "#table-holder"
275
- */
276
- categoryTitle: "Category",
277
- /**
278
- * Set category text format function.
279
- * @name categoryFormat
280
- * @memberof plugin-tableview
281
- * @type {Function}
282
- * @returns {string}
283
- * @default function(v) { // will return formatted value according x Axis type }}
284
- * @example
285
- * categoryFormat: "#table-holder"
286
- */
287
- categoryFormat: function categoryFormat(v) {
288
- let category = v;
289
- if (this.$$.axis.isCategorized()) {
290
- category = this.$$.categoryName(v);
291
- } else if (this.$$.axis.isTimeSeries()) {
292
- category = v.toLocaleDateString();
293
- }
294
- return category;
295
- },
296
- /**
297
- * Set tableview holder class name.
298
- * @name class
299
- * @memberof plugin-tableview
300
- * @type {string}
301
- * @default undefined
302
- * @example
303
- * class: "table-class-name"
304
- */
305
- class: undefined,
306
- /**
307
- * Set to apply default style(`.bb-tableview`) to tableview element.
308
- * @name style
309
- * @memberof plugin-tableview
310
- * @type {boolean}
311
- * @default true
312
- * @example
313
- * style: false
314
- */
315
- style: !0,
316
- /**
317
- * Set tableview title text.
318
- * - **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.
319
- * @name title
320
- * @memberof plugin-tableview
321
- * @type {string}
322
- * @default undefined
323
- * @example
324
- * title: "Table Title Text"
325
- */
326
- title: undefined,
327
- /**
328
- * Update tableview from data visibility update(ex. legend toggle).
329
- * @name updateOnToggle
330
- * @memberof plugin-tableview
331
- * @type {boolean}
332
- * @default true
333
- * @example
334
- * legendToggleUpdate: false
335
- */
336
- updateOnToggle: !0,
337
- /**
338
- * Set how null value to be shown.
339
- * @name nullString
340
- * @memberof plugin-tableview
341
- * @type {string}
342
- * @default "-"
343
- * @example
344
- * nullString: "N/A"
345
- */
346
- nullString: "-"
347
- };
348
- };
349
-
350
- ;// CONCATENATED MODULE: ./src/Plugin/tableview/const.ts
351
- /**
352
- * Copyright (c) 2021 ~ present NAVER Corp.
353
- * billboard.js project is licensed under the MIT license
354
- */
355
- /**
356
- * Constants values for plugin option
357
- * @ignore
358
- */
359
-
360
- const defaultStyle = {
361
- id: "__tableview-style__",
362
- class: "bb-tableview",
363
- rule: ".bb-tableview {\n\t\tborder-collapse:collapse;\n\t\tborder-spacing:0;\n\t\tbackground:#fff;\n\t\tmin-width:100%;\n\t\tmargin-top:10px;\n\t\tfont-family:sans-serif;\n\t\tfont-size:.9em;\n\t}\n\t.bb-tableview tr:hover {\n\t\tbackground:#eef7ff;\n\t}\n\t.bb-tableview thead tr {\n\t\tbackground:#f8f8f8;\n\t}\n\t.bb-tableview caption,.bb-tableview td,.bb-tableview th {\n\t\ttext-align: center;\n\t\tborder:1px solid silver;\n\t\tpadding:.5em;\n\t}\n\t.bb-tableview caption {\n\t\tfont-size:1.1em;\n\t\tfont-weight:700;\n\t\tmargin-bottom: -1px;\n\t}"
364
- },
365
- tpl = {
366
- body: "<caption>{=title}</caption>\n\t\t<thead><tr>{=thead}</tr></thead>\n\t\t<tbody>{=tbody}</tbody>",
367
- thead: "<th scope=\"col\">{=title}</th>",
368
- tbodyHeader: "<th scope=\"row\">{=value}</th>",
369
- tbody: "<td>{=value}</td>"
370
- }; // template
371
- // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
372
- var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
373
93
  // EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
374
94
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
95
+ // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
96
+ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
375
97
  ;// CONCATENATED MODULE: ./src/module/browser.ts
376
-
377
- /**
378
- * Copyright (c) 2017 ~ present NAVER Corp.
379
- * billboard.js project is licensed under the MIT license
380
- */
381
- /**
382
- * Window object
383
- * @private
384
- */
385
- /* eslint-disable no-new-func, no-undef */
386
-
387
-
388
- /**
389
- * Get global object
390
- * @returns {object} window object
391
- * @private
392
- */
393
98
  function getGlobal() {
394
99
  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")();
395
100
  }
396
-
397
- /**
398
- * Get fallback object
399
- * @param {object} w global object
400
- * @returns {Array} fallback object array
401
- * @private
402
- */
403
101
  function getFallback(w) {
404
- var _this = this;
405
- const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function",
406
- hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function",
407
- request = function (cb) {
408
- _newArrowCheck(this, _this);
409
- return setTimeout(cb, 1);
410
- }.bind(this),
411
- cancel = function (id) {
412
- _newArrowCheck(this, _this);
413
- return clearTimeout(id);
414
- }.bind(this);
415
- return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel];
102
+ const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function";
103
+ const hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function";
104
+ const request = (cb) => setTimeout(cb, 1);
105
+ const cancel = (id) => clearTimeout(id);
106
+ return [
107
+ hasRAF ? w.requestAnimationFrame : request,
108
+ hasRAF ? w.cancelAnimationFrame : cancel,
109
+ hasRIC ? w.requestIdleCallback : request,
110
+ hasRIC ? w.cancelIdleCallback : cancel
111
+ ];
416
112
  }
417
- const win = getGlobal(),
418
- doc = win == null ? void 0 : win.document,
419
- _getFallback = getFallback(win),
420
- requestAnimationFrame = _getFallback[0],
421
- cancelAnimationFrame = _getFallback[1],
422
- requestIdleCallback = _getFallback[2],
423
- cancelIdleCallback = _getFallback[3];
424
- ;// CONCATENATED MODULE: ./src/module/util.ts
113
+ const win = getGlobal();
114
+ const doc = win == null ? void 0 : win.document;
115
+ const [
116
+ requestAnimationFrame,
117
+ cancelAnimationFrame,
118
+ requestIdleCallback,
119
+ cancelIdleCallback
120
+ ] = getFallback(win);
425
121
 
426
122
 
427
- var _this = undefined;
428
- 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; }
429
- 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; }
430
- /**
431
- * Copyright (c) 2017 ~ present NAVER Corp.
432
- * billboard.js project is licensed under the MIT license
433
- * @ignore
434
- */
123
+ ;// CONCATENATED MODULE: ./src/module/util.ts
124
+ var __defProp = Object.defineProperty;
125
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
126
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
127
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
128
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
129
+ var __spreadValues = (a, b) => {
130
+ for (var prop in b || (b = {}))
131
+ if (__hasOwnProp.call(b, prop))
132
+ __defNormalProp(a, prop, b[prop]);
133
+ if (__getOwnPropSymbols)
134
+ for (var prop of __getOwnPropSymbols(b)) {
135
+ if (__propIsEnum.call(b, prop))
136
+ __defNormalProp(a, prop, b[prop]);
137
+ }
138
+ return a;
139
+ };
435
140
 
436
141
 
437
142
 
438
143
 
439
- const isValue = function (v) {
440
- _newArrowCheck(this, _this);
441
- return v || v === 0;
442
- }.bind(undefined),
443
- isFunction = function (v) {
444
- _newArrowCheck(this, _this);
445
- return typeof v === "function";
446
- }.bind(undefined),
447
- isString = function (v) {
448
- _newArrowCheck(this, _this);
449
- return typeof v === "string";
450
- }.bind(undefined),
451
- isNumber = function (v) {
452
- _newArrowCheck(this, _this);
453
- return typeof v === "number";
454
- }.bind(undefined),
455
- isUndefined = function (v) {
456
- _newArrowCheck(this, _this);
457
- return typeof v === "undefined";
458
- }.bind(undefined),
459
- isDefined = function (v) {
460
- _newArrowCheck(this, _this);
461
- return typeof v !== "undefined";
462
- }.bind(undefined),
463
- isboolean = function (v) {
464
- _newArrowCheck(this, _this);
465
- return typeof v === "boolean";
466
- }.bind(undefined),
467
- ceil10 = function (v) {
468
- _newArrowCheck(this, _this);
469
- return Math.ceil(v / 10) * 10;
470
- }.bind(undefined),
471
- asHalfPixel = function (n) {
472
- _newArrowCheck(this, _this);
473
- return Math.ceil(n) + .5;
474
- }.bind(undefined),
475
- diffDomain = function (d) {
476
- _newArrowCheck(this, _this);
477
- return d[1] - d[0];
478
- }.bind(undefined),
479
- isObjectType = function (v) {
480
- _newArrowCheck(this, _this);
481
- return typeof v === "object";
482
- }.bind(undefined),
483
- isEmpty = function (o) {
484
- _newArrowCheck(this, _this);
485
- return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
486
- }.bind(undefined),
487
- notEmpty = function (o) {
488
- _newArrowCheck(this, _this);
489
- return !isEmpty(o);
490
- }.bind(undefined),
491
- isArray = function (arr) {
492
- _newArrowCheck(this, _this);
493
- return Array.isArray(arr);
494
- }.bind(undefined),
495
- isObject = function (obj) {
496
- _newArrowCheck(this, _this);
497
- return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
498
- }.bind(undefined);
499
- /**
500
- * Check if is array
501
- * @param {Array} arr Data to be checked
502
- * @returns {boolean}
503
- * @private
504
- */
505
- /**
506
- * Check if is object
507
- * @param {object} obj Data to be checked
508
- * @returns {boolean}
509
- * @private
510
- */
511
- /**
512
- * Get specified key value from object
513
- * If default value is given, will return if given key value not found
514
- * @param {object} options Source object
515
- * @param {string} key Key value
516
- * @param {*} defaultValue Default value
517
- * @returns {*}
518
- * @private
519
- */
144
+ const isValue = (v) => v || v === 0;
145
+ const isFunction = (v) => typeof v === "function";
146
+ const isString = (v) => typeof v === "string";
147
+ const isNumber = (v) => typeof v === "number";
148
+ const isUndefined = (v) => typeof v === "undefined";
149
+ const isDefined = (v) => typeof v !== "undefined";
150
+ const isBoolean = (v) => typeof v === "boolean";
151
+ const ceil10 = (v) => Math.ceil(v / 10) * 10;
152
+ const asHalfPixel = (n) => Math.ceil(n) + 0.5;
153
+ const diffDomain = (d) => d[1] - d[0];
154
+ const isObjectType = (v) => typeof v === "object";
155
+ const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
156
+ const notEmpty = (o) => !isEmpty(o);
157
+ const isArray = (arr) => Array.isArray(arr);
158
+ const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
520
159
  function getOption(options, key, defaultValue) {
521
160
  return isDefined(options[key]) ? options[key] : defaultValue;
522
161
  }
523
-
524
- /**
525
- * Check if value exist in the given object
526
- * @param {object} dict Target object to be checked
527
- * @param {*} value Value to be checked
528
- * @returns {boolean}
529
- * @private
530
- */
531
162
  function hasValue(dict, value) {
532
- var _this2 = this;
533
- let found = !1;
534
- Object.keys(dict).forEach(function (key) {
535
- _newArrowCheck(this, _this2);
536
- return dict[key] === value && (found = !0);
537
- }.bind(this));
163
+ let found = false;
164
+ Object.keys(dict).forEach((key) => dict[key] === value && (found = true));
538
165
  return found;
539
166
  }
540
-
541
- /**
542
- * Call function with arguments
543
- * @param {Function} fn Function to be called
544
- * @param {*} thisArg "this" value for fn
545
- * @param {*} args Arguments for fn
546
- * @returns {boolean} true: fn is function, false: fn is not function
547
- * @private
548
- */
549
- function callFn(fn, thisArg) {
167
+ function callFn(fn, thisArg, ...args) {
550
168
  const isFn = isFunction(fn);
551
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
552
- args[_key - 2] = arguments[_key];
553
- }
554
- isFn && fn.call.apply(fn, [thisArg].concat(args));
169
+ isFn && fn.call(thisArg, ...args);
555
170
  return isFn;
556
171
  }
557
-
558
- /**
559
- * Call function after all transitions ends
560
- * @param {d3.transition} transition Transition
561
- * @param {Fucntion} cb Callback function
562
- * @private
563
- */
564
172
  function endall(transition, cb) {
565
- var _this3 = this;
566
173
  let n = 0;
567
- const end = function () {
568
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
569
- args[_key2] = arguments[_key2];
570
- }
571
- --n || cb.apply.apply(cb, [this].concat(args));
174
+ const end = function(...args) {
175
+ !--n && cb.apply(this, ...args);
572
176
  };
573
-
574
- // if is transition selection
575
177
  if ("duration" in transition) {
576
- transition.each(function () {
577
- _newArrowCheck(this, _this3);
578
- return ++n;
579
- }.bind(this)).on("end", end);
178
+ transition.each(() => ++n).on("end", end);
580
179
  } else {
581
180
  ++n;
582
181
  transition.call(end);
583
182
  }
584
183
  }
585
-
586
- /**
587
- * Replace tag sign to html entity
588
- * @param {string} str Target string value
589
- * @returns {string}
590
- * @private
591
- */
592
184
  function sanitize(str) {
593
185
  return isString(str) ? str.replace(/<(script|img)?/ig, "&lt;").replace(/(script)?>/ig, "&gt;") : str;
594
186
  }
595
-
596
- /**
597
- * Set text value. If there's multiline add nodes.
598
- * @param {d3Selection} node Text node
599
- * @param {string} text Text value string
600
- * @param {Array} dy dy value for multilined text
601
- * @param {boolean} toMiddle To be alingned vertically middle
602
- * @private
603
- */
604
- function setTextValue(node, text, dy, toMiddle) {
605
- var _this4 = this;
606
- if (dy === void 0) {
607
- dy = [-1, 1];
608
- }
609
- if (toMiddle === void 0) {
610
- toMiddle = !1;
611
- }
187
+ function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
612
188
  if (!node || !isString(text)) {
613
189
  return;
614
190
  }
615
191
  if (text.indexOf("\n") === -1) {
616
192
  node.text(text);
617
193
  } else {
618
- const diff = [node.text(), text].map(function (v) {
619
- _newArrowCheck(this, _this4);
620
- return v.replace(/[\s\n]/g, "");
621
- }.bind(this));
194
+ const diff = [node.text(), text].map((v) => v.replace(/[\s\n]/g, ""));
622
195
  if (diff[0] !== diff[1]) {
623
- const multiline = text.split("\n"),
624
- len = toMiddle ? multiline.length - 1 : 1;
625
- // reset possible text
196
+ const multiline = text.split("\n");
197
+ const len = toMiddle ? multiline.length - 1 : 1;
626
198
  node.html("");
627
- multiline.forEach(function (v, i) {
628
- _newArrowCheck(this, _this4);
629
- node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
630
- }.bind(this));
199
+ multiline.forEach((v, i) => {
200
+ node.append("tspan").attr("x", 0).attr("dy", `${i === 0 ? dy[0] * len : dy[1]}em`).text(v);
201
+ });
631
202
  }
632
203
  }
633
204
  }
634
-
635
- /**
636
- * Substitution of SVGPathSeg API polyfill
637
- * @param {SVGGraphicsElement} path Target svg element
638
- * @returns {Array}
639
- * @private
640
- */
641
205
  function getRectSegList(path) {
642
- /*
643
- * seg1 ---------- seg2
644
- * | |
645
- * | |
646
- * | |
647
- * seg0 ---------- seg3
648
- * */
649
- const _path$getBBox = path.getBBox(),
650
- x = _path$getBBox.x,
651
- y = _path$getBBox.y,
652
- width = _path$getBBox.width,
653
- height = _path$getBBox.height;
654
- return [{
655
- x: x,
656
- y: y + height
657
- },
658
- // seg0
659
- {
660
- x: x,
661
- y: y
662
- },
663
- // seg1
664
- {
665
- x: x + width,
666
- y: y
667
- },
668
- // seg2
669
- {
670
- x: x + width,
671
- y: y + height
672
- } // seg3
206
+ const { x, y, width, height } = path.getBBox();
207
+ return [
208
+ { x, y: y + height },
209
+ // seg0
210
+ { x, y },
211
+ // seg1
212
+ { x: x + width, y },
213
+ // seg2
214
+ { x: x + width, y: y + height }
215
+ // seg3
673
216
  ];
674
217
  }
675
-
676
- /**
677
- * Get svg bounding path box dimension
678
- * @param {SVGGraphicsElement} path Target svg element
679
- * @returns {object}
680
- * @private
681
- */
682
218
  function getPathBox(path) {
683
- const _path$getBoundingClie = path.getBoundingClientRect(),
684
- width = _path$getBoundingClie.width,
685
- height = _path$getBoundingClie.height,
686
- items = getRectSegList(path),
687
- x = items[0].x,
688
- y = Math.min(items[0].y, items[1].y);
219
+ const { width, height } = path.getBoundingClientRect();
220
+ const items = getRectSegList(path);
221
+ const x = items[0].x;
222
+ const y = Math.min(items[0].y, items[1].y);
689
223
  return {
690
- x: x,
691
- y: y,
692
- width: width,
693
- height: height
224
+ x,
225
+ y,
226
+ width,
227
+ height
694
228
  };
695
229
  }
696
-
697
- /**
698
- * Get event's current position coordinates
699
- * @param {object} event Event object
700
- * @param {SVGElement|HTMLElement} element Target element
701
- * @returns {Array} [x, y] Coordinates x, y array
702
- * @private
703
- */
704
230
  function getPointer(event, element) {
705
- var _ref,
706
- _this5 = this;
707
- const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
231
+ var _a;
232
+ const touches = event && ((_a = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _a[0]);
708
233
  let pointer = [0, 0];
709
234
  try {
710
235
  pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
711
- } catch (e) {}
712
- return pointer.map(function (v) {
713
- _newArrowCheck(this, _this5);
714
- return isNaN(v) ? 0 : v;
715
- }.bind(this));
236
+ } catch (e) {
237
+ }
238
+ return pointer.map((v) => isNaN(v) ? 0 : v);
716
239
  }
717
-
718
- /**
719
- * Return brush selection array
720
- * @param {object} ctx Current instance
721
- * @returns {d3.brushSelection}
722
- * @private
723
- */
724
240
  function getBrushSelection(ctx) {
725
- const event = ctx.event,
726
- $el = ctx.$el,
727
- main = $el.subchart.main || $el.main;
241
+ const { event, $el } = ctx;
242
+ const main = $el.subchart.main || $el.main;
728
243
  let selection;
729
-
730
- // check from event
731
244
  if (event && event.type === "brush") {
732
245
  selection = event.selection;
733
- // check from brush area selection
734
246
  } else if (main && (selection = main.select(".bb-brush").node())) {
735
247
  selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
736
248
  }
737
249
  return selection;
738
250
  }
739
-
740
- /**
741
- * Get boundingClientRect.
742
- * Cache the evaluated value once it was called.
743
- * @param {HTMLElement} node Target element
744
- * @returns {object}
745
- * @private
746
- */
747
251
  function getBoundingRect(node) {
748
252
  const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
749
253
  return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
750
254
  }
751
-
752
- /**
753
- * Retrun random number
754
- * @param {boolean} asStr Convert returned value as string
755
- * @param {number} min Minimum value
756
- * @param {number} max Maximum value
757
- * @returns {number|string}
758
- * @private
759
- */
760
- function getRandom(asStr, min, max) {
761
- if (asStr === void 0) {
762
- asStr = !0;
763
- }
764
- if (min === void 0) {
765
- min = 0;
766
- }
767
- if (max === void 0) {
768
- max = 1e4;
769
- }
770
- const crpt = win.crypto || win.msCrypto,
771
- rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
772
- return asStr ? rand + "" : rand;
255
+ function getRandom(asStr = true, min = 0, max = 1e4) {
256
+ const crpt = win.crypto || win.msCrypto;
257
+ const rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
258
+ return asStr ? String(rand) : rand;
773
259
  }
774
-
775
- /**
776
- * Find index based on binary search
777
- * @param {Array} arr Data array
778
- * @param {number} v Target number to find
779
- * @param {number} start Start index of data array
780
- * @param {number} end End index of data arr
781
- * @param {boolean} isRotated Weather is roted axis
782
- * @returns {number} Index number
783
- * @private
784
- */
785
260
  function findIndex(arr, v, start, end, isRotated) {
786
261
  if (start > end) {
787
262
  return -1;
788
263
  }
789
264
  const mid = Math.floor((start + end) / 2);
790
- let _arr$mid = arr[mid],
791
- x = _arr$mid.x,
792
- _arr$mid$w = _arr$mid.w,
793
- w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
265
+ let { x, w = 0 } = arr[mid];
794
266
  if (isRotated) {
795
267
  x = arr[mid].y;
796
268
  w = arr[mid].h;
@@ -800,75 +272,30 @@ function findIndex(arr, v, start, end, isRotated) {
800
272
  }
801
273
  return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
802
274
  }
803
-
804
- /**
805
- * Check if brush is empty
806
- * @param {object} ctx Bursh context
807
- * @returns {boolean}
808
- * @private
809
- */
810
275
  function brushEmpty(ctx) {
811
276
  const selection = getBrushSelection(ctx);
812
277
  if (selection) {
813
- // brush selected area
814
- // two-dimensional: [[x0, y0], [x1, y1]]
815
- // one-dimensional: [x0, x1] or [y0, y1]
816
278
  return selection[0] === selection[1];
817
279
  }
818
- return !0;
280
+ return true;
819
281
  }
820
-
821
- /**
822
- * Deep copy object
823
- * @param {object} objectN Source object
824
- * @returns {object} Cloned object
825
- * @private
826
- */
827
- function deepClone() {
828
- var _this6 = this;
829
- const _clone = function clone(v) {
830
- _newArrowCheck(this, _this6);
282
+ function deepClone(...objectN) {
283
+ const clone = (v) => {
831
284
  if (isObject(v) && v.constructor) {
832
285
  const r = new v.constructor();
833
286
  for (const k in v) {
834
- r[k] = _clone(v[k]);
287
+ r[k] = clone(v[k]);
835
288
  }
836
289
  return r;
837
290
  }
838
291
  return v;
839
- }.bind(this);
840
- for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
841
- objectN[_key3] = arguments[_key3];
842
- }
843
- return objectN.map(function (v) {
844
- _newArrowCheck(this, _this6);
845
- return _clone(v);
846
- }.bind(this)).reduce(function (a, c) {
847
- _newArrowCheck(this, _this6);
848
- return _objectSpread(_objectSpread({}, a), c);
849
- }.bind(this));
292
+ };
293
+ return objectN.map((v) => clone(v)).reduce((a, c) => __spreadValues(__spreadValues({}, a), c));
850
294
  }
851
-
852
- /**
853
- * Extend target from source object
854
- * @param {object} target Target object
855
- * @param {object|Array} source Source object
856
- * @returns {object}
857
- * @private
858
- */
859
- function extend(target, source) {
860
- var _this7 = this;
861
- if (target === void 0) {
862
- target = {};
863
- }
295
+ function extend(target = {}, source) {
864
296
  if (isArray(source)) {
865
- source.forEach(function (v) {
866
- _newArrowCheck(this, _this7);
867
- return extend(target, v);
868
- }.bind(this));
297
+ source.forEach((v) => extend(target, v));
869
298
  }
870
-
871
- // exclude name with only numbers
872
299
  for (const p in source) {
873
300
  if (/^\d+$/.test(p) || p in target) {
874
301
  continue;
@@ -877,569 +304,489 @@ function extend(target, source) {
877
304
  }
878
305
  return target;
879
306
  }
880
-
881
- /**
882
- * Return first letter capitalized
883
- * @param {string} str Target string
884
- * @returns {string} capitalized string
885
- * @private
886
- */
887
- const capitalize = function (str) {
888
- _newArrowCheck(this, _this);
889
- return str.charAt(0).toUpperCase() + str.slice(1);
890
- }.bind(undefined);
891
-
892
- /**
893
- * Camelize from kebob style string
894
- * @param {string} str Target string
895
- * @param {string} separator Separator string
896
- * @returns {string} camelized string
897
- * @private
898
- */
899
- function camelize(str, separator) {
900
- var _this8 = this;
901
- if (separator === void 0) {
902
- separator = "-";
903
- }
904
- return str.split(separator).map(function (v, i) {
905
- _newArrowCheck(this, _this8);
906
- return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
907
- }.bind(this)).join("");
307
+ const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
308
+ function camelize(str, separator = "-") {
309
+ return str.split(separator).map((v, i) => i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase()).join("");
908
310
  }
909
-
910
- /**
911
- * Convert to array
912
- * @param {object} v Target to be converted
913
- * @returns {Array}
914
- * @private
915
- */
916
- const toArray = function (v) {
917
- _newArrowCheck(this, _this);
918
- return [].slice.call(v);
919
- }.bind(undefined);
920
-
921
- /**
922
- * Add CSS rules
923
- * @param {object} style Style object
924
- * @param {string} selector Selector string
925
- * @param {Array} prop Prps arrary
926
- * @returns {number} Newely added rule index
927
- * @private
928
- */
311
+ const toArray = (v) => [].slice.call(v);
929
312
  function addCssRules(style, selector, prop) {
930
- var _this9 = this;
931
- const _style$rootSelector = style.rootSelector,
932
- rootSelector = _style$rootSelector === void 0 ? "" : _style$rootSelector,
933
- sheet = style.sheet,
934
- getSelector = function (s) {
935
- _newArrowCheck(this, _this9);
936
- return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
937
- }.bind(this),
938
- rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
939
- return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
313
+ const { rootSelector = "", sheet } = style;
314
+ const getSelector = (s) => s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
315
+ const rule = `${rootSelector} ${getSelector(selector)} {${prop.join(";")}}`;
316
+ return sheet[sheet.insertRule ? "insertRule" : "addRule"](
317
+ rule,
318
+ sheet.cssRules.length
319
+ );
940
320
  }
941
-
942
- /**
943
- * Get css rules for specified stylesheets
944
- * @param {Array} styleSheets The stylesheets to get the rules from
945
- * @returns {Array}
946
- * @private
947
- */
948
321
  function getCssRules(styleSheets) {
949
- var _this10 = this;
950
322
  let rules = [];
951
- styleSheets.forEach(function (sheet) {
952
- _newArrowCheck(this, _this10);
323
+ styleSheets.forEach((sheet) => {
324
+ var _a;
953
325
  try {
954
326
  if (sheet.cssRules && sheet.cssRules.length) {
955
327
  rules = rules.concat(toArray(sheet.cssRules));
956
328
  }
957
329
  } catch (e) {
958
- var _window$console;
959
- (_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
330
+ (_a = win.console) == null ? void 0 : _a.warn(`Error while reading rules from ${sheet.href}: ${e.toString()}`);
960
331
  }
961
- }.bind(this));
332
+ });
962
333
  return rules;
963
334
  }
964
-
965
- /**
966
- * Get current window and container scroll position
967
- * @param {HTMLElement} node Target element
968
- * @returns {object} window scroll position
969
- * @private
970
- */
971
335
  function getScrollPosition(node) {
972
- var _ref2, _ref3, _window$pageXOffset, _ref4, _ref5, _window$pageYOffset;
336
+ var _a, _b, _c, _d;
973
337
  return {
974
- x: (_ref2 = ((_ref3 = (_window$pageXOffset = win.pageXOffset) != null ? _window$pageXOffset : win.scrollX) != null ? _ref3 : 0) + node.scrollLeft) != null ? _ref2 : 0,
975
- y: (_ref4 = ((_ref5 = (_window$pageYOffset = win.pageYOffset) != null ? _window$pageYOffset : win.scrollY) != null ? _ref5 : 0) + node.scrollTop) != null ? _ref4 : 0
338
+ x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + node.scrollLeft,
339
+ y: ((_d = (_c = win.pageYOffset) != null ? _c : win.scrollY) != null ? _d : 0) + node.scrollTop
976
340
  };
977
341
  }
978
-
979
- /**
980
- * Gets the SVGMatrix of an SVGGElement
981
- * @param {SVGElement} node Node element
982
- * @returns {SVGMatrix} matrix
983
- * @private
984
- */
985
342
  function getTranslation(node) {
986
- const transform = node ? node.transform : null,
987
- baseVal = transform && transform.baseVal;
988
- return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
989
- a: 0,
990
- b: 0,
991
- c: 0,
992
- d: 0,
993
- e: 0,
994
- f: 0
995
- };
343
+ const transform = node ? node.transform : null;
344
+ const baseVal = transform && transform.baseVal;
345
+ return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 };
996
346
  }
997
-
998
- /**
999
- * Get unique value from array
1000
- * @param {Array} data Source data
1001
- * @returns {Array} Unique array value
1002
- * @private
1003
- */
1004
347
  function getUnique(data) {
1005
- var _this11 = this;
1006
- const isDate = data[0] instanceof Date,
1007
- d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
1008
- _newArrowCheck(this, _this11);
1009
- return self.indexOf(v) === i;
1010
- }.bind(this));
1011
- return isDate ? d.map(function (v) {
1012
- _newArrowCheck(this, _this11);
1013
- return new Date(v);
1014
- }.bind(this)) : d;
348
+ const isDate = data[0] instanceof Date;
349
+ const d = (isDate ? data.map(Number) : data).filter((v, i, self) => self.indexOf(v) === i);
350
+ return isDate ? d.map((v) => new Date(v)) : d;
1015
351
  }
1016
-
1017
- /**
1018
- * Merge array
1019
- * @param {Array} arr Source array
1020
- * @returns {Array}
1021
- * @private
1022
- */
1023
352
  function mergeArray(arr) {
1024
- var _this12 = this;
1025
- return arr && arr.length ? arr.reduce(function (p, c) {
1026
- _newArrowCheck(this, _this12);
1027
- return p.concat(c);
1028
- }.bind(this)) : [];
353
+ return arr && arr.length ? arr.reduce((p, c) => p.concat(c)) : [];
1029
354
  }
1030
-
1031
- /**
1032
- * Merge object returning new object
1033
- * @param {object} target Target object
1034
- * @param {object} objectN Source object
1035
- * @returns {object} merged target object
1036
- * @private
1037
- */
1038
- function mergeObj(target) {
1039
- for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1040
- objectN[_key4 - 1] = arguments[_key4];
1041
- }
355
+ function mergeObj(target, ...objectN) {
1042
356
  if (!objectN.length || objectN.length === 1 && !objectN[0]) {
1043
357
  return target;
1044
358
  }
1045
359
  const source = objectN.shift();
1046
360
  if (isObject(target) && isObject(source)) {
1047
- Object.keys(source).forEach(function (key) {
1048
- _newArrowCheck(this, _this13);
361
+ Object.keys(source).forEach((key) => {
1049
362
  const value = source[key];
1050
363
  if (isObject(value)) {
1051
- target[key] || (target[key] = {});
364
+ !target[key] && (target[key] = {});
1052
365
  target[key] = mergeObj(target[key], value);
1053
366
  } else {
1054
367
  target[key] = isArray(value) ? value.concat() : value;
1055
368
  }
1056
- }.bind(this));
369
+ });
1057
370
  }
1058
- return mergeObj.apply(void 0, [target].concat(objectN));
371
+ return mergeObj(target, ...objectN);
1059
372
  }
1060
-
1061
- /**
1062
- * Sort value
1063
- * @param {Array} data value to be sorted
1064
- * @param {boolean} isAsc true: asc, false: desc
1065
- * @returns {number|string|Date} sorted date
1066
- * @private
1067
- */
1068
- function sortValue(data, isAsc) {
1069
- var _this14 = this;
1070
- if (isAsc === void 0) {
1071
- isAsc = !0;
1072
- }
373
+ function sortValue(data, isAsc = true) {
1073
374
  let fn;
1074
375
  if (data[0] instanceof Date) {
1075
- fn = isAsc ? function (a, b) {
1076
- _newArrowCheck(this, _this14);
1077
- return a - b;
1078
- }.bind(this) : function (a, b) {
1079
- _newArrowCheck(this, _this14);
1080
- return b - a;
1081
- }.bind(this);
376
+ fn = isAsc ? (a, b) => a - b : (a, b) => b - a;
1082
377
  } else {
1083
378
  if (isAsc && !data.every(isNaN)) {
1084
- fn = function (a, b) {
1085
- _newArrowCheck(this, _this14);
1086
- return a - b;
1087
- }.bind(this);
379
+ fn = (a, b) => a - b;
1088
380
  } else if (!isAsc) {
1089
- fn = function (a, b) {
1090
- _newArrowCheck(this, _this14);
1091
- return a > b && -1 || a < b && 1 || a === b && 0;
1092
- }.bind(this);
381
+ fn = (a, b) => a > b && -1 || a < b && 1 || a === b && 0;
1093
382
  }
1094
383
  }
1095
384
  return data.concat().sort(fn);
1096
385
  }
1097
-
1098
- /**
1099
- * Get min/max value
1100
- * @param {string} type 'min' or 'max'
1101
- * @param {Array} data Array data value
1102
- * @returns {number|Date|undefined}
1103
- * @private
1104
- */
1105
386
  function getMinMax(type, data) {
1106
- var _this15 = this;
1107
- let res = data.filter(function (v) {
1108
- _newArrowCheck(this, _this15);
1109
- return notEmpty(v);
1110
- }.bind(this));
387
+ let res = data.filter((v) => notEmpty(v));
1111
388
  if (res.length) {
1112
389
  if (isNumber(res[0])) {
1113
- res = Math[type].apply(Math, res);
390
+ res = Math[type](...res);
1114
391
  } else if (res[0] instanceof Date) {
1115
392
  res = sortValue(res, type === "min")[0];
1116
393
  }
1117
394
  } else {
1118
- res = undefined;
395
+ res = void 0;
1119
396
  }
1120
397
  return res;
1121
398
  }
1122
-
1123
- /**
1124
- * Get range
1125
- * @param {number} start Start number
1126
- * @param {number} end End number
1127
- * @param {number} step Step number
1128
- * @returns {Array}
1129
- * @private
1130
- */
1131
- const getRange = function (start, end, step) {
1132
- if (step === void 0) {
1133
- step = 1;
1134
- }
1135
- _newArrowCheck(this, _this);
1136
- const res = [],
1137
- n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1138
- for (let i = start; i < n; i++) {
1139
- res.push(start + i * step);
1140
- }
1141
- return res;
1142
- }.bind(undefined),
1143
- emulateEvent = {
1144
- mouse: function () {
1145
- var _this16 = this;
1146
- _newArrowCheck(this, _this);
1147
- const getParams = function () {
1148
- _newArrowCheck(this, _this16);
1149
- return {
1150
- bubbles: !1,
1151
- cancelable: !1,
1152
- screenX: 0,
1153
- screenY: 0,
1154
- clientX: 0,
1155
- clientY: 0
1156
- };
1157
- }.bind(this);
1158
- try {
1159
- // eslint-disable-next-line no-new
1160
- new MouseEvent("t");
1161
- return function (el, eventType, params) {
1162
- if (params === void 0) {
1163
- params = getParams();
1164
- }
1165
- _newArrowCheck(this, _this16);
1166
- el.dispatchEvent(new MouseEvent(eventType, params));
1167
- }.bind(this);
1168
- } catch (e) {
1169
- // Polyfills DOM4 MouseEvent
1170
- return function (el, eventType, params) {
1171
- if (params === void 0) {
1172
- params = getParams();
1173
- }
1174
- _newArrowCheck(this, _this16);
1175
- const mouseEvent = doc.createEvent("MouseEvent");
1176
-
1177
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1178
- mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
399
+ const getRange = (start, end, step = 1) => {
400
+ const res = [];
401
+ const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
402
+ for (let i = start; i < n; i++) {
403
+ res.push(start + i * step);
404
+ }
405
+ return res;
406
+ };
407
+ const emulateEvent = {
408
+ mouse: (() => {
409
+ const getParams = () => ({
410
+ bubbles: false,
411
+ cancelable: false,
412
+ screenX: 0,
413
+ screenY: 0,
414
+ clientX: 0,
415
+ clientY: 0
416
+ });
417
+ try {
418
+ new MouseEvent("t");
419
+ return (el, eventType, params = getParams()) => {
420
+ el.dispatchEvent(new MouseEvent(eventType, params));
421
+ };
422
+ } catch (e) {
423
+ return (el, eventType, params = getParams()) => {
424
+ const mouseEvent = doc.createEvent("MouseEvent");
425
+ mouseEvent.initMouseEvent(
426
+ eventType,
427
+ params.bubbles,
428
+ params.cancelable,
429
+ win,
430
+ 0,
1179
431
  // the event's mouse click count
1180
- params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1181
- el.dispatchEvent(mouseEvent);
1182
- }.bind(this);
1183
- }
1184
- }.bind(undefined)(),
1185
- touch: function touch(el, eventType, params) {
1186
- _newArrowCheck(this, _this);
1187
- const touchObj = new Touch(mergeObj({
1188
- identifier: Date.now(),
1189
- target: el,
1190
- radiusX: 2.5,
1191
- radiusY: 2.5,
1192
- rotationAngle: 10,
1193
- force: .5
1194
- }, params));
1195
- el.dispatchEvent(new TouchEvent(eventType, {
1196
- cancelable: !0,
1197
- bubbles: !0,
1198
- shiftKey: !0,
1199
- touches: [touchObj],
1200
- targetTouches: [],
1201
- changedTouches: [touchObj]
1202
- }));
1203
- }.bind(undefined)
1204
- }; // emulate event
1205
- /**
1206
- * Process the template & return bound string
1207
- * @param {string} tpl Template string
1208
- * @param {object} data Data value to be replaced
1209
- * @returns {string}
1210
- * @private
1211
- */
432
+ params.screenX,
433
+ params.screenY,
434
+ params.clientX,
435
+ params.clientY,
436
+ false,
437
+ false,
438
+ false,
439
+ false,
440
+ 0,
441
+ null
442
+ );
443
+ el.dispatchEvent(mouseEvent);
444
+ };
445
+ }
446
+ })(),
447
+ touch: (el, eventType, params) => {
448
+ const touchObj = new Touch(mergeObj({
449
+ identifier: Date.now(),
450
+ target: el,
451
+ radiusX: 2.5,
452
+ radiusY: 2.5,
453
+ rotationAngle: 10,
454
+ force: 0.5
455
+ }, params));
456
+ el.dispatchEvent(new TouchEvent(eventType, {
457
+ cancelable: true,
458
+ bubbles: true,
459
+ shiftKey: true,
460
+ touches: [touchObj],
461
+ targetTouches: [],
462
+ changedTouches: [touchObj]
463
+ }));
464
+ }
465
+ };
1212
466
  function tplProcess(tpl, data) {
1213
467
  let res = tpl;
1214
468
  for (const x in data) {
1215
- res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
469
+ res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
1216
470
  }
1217
471
  return res;
1218
472
  }
1219
-
1220
- /**
1221
- * Get parsed date value
1222
- * (It must be called in 'ChartInternal' context)
1223
- * @param {Date|string|number} date Value of date to be parsed
1224
- * @returns {Date}
1225
- * @private
1226
- */
1227
473
  function parseDate(date) {
474
+ var _a;
1228
475
  let parsedDate;
1229
476
  if (date instanceof Date) {
1230
477
  parsedDate = date;
1231
478
  } else if (isString(date)) {
1232
- var _format$dataTime;
1233
- const config = this.config,
1234
- format = this.format;
1235
-
1236
- // if fails to parse, try by new Date()
1237
- // https://github.com/naver/billboard.js/issues/1714
1238
- parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
479
+ const { config, format } = this;
480
+ parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) != null ? _a : new Date(date);
1239
481
  } else if (isNumber(date) && !isNaN(date)) {
1240
- parsedDate = new Date(+date);
482
+ parsedDate = /* @__PURE__ */ new Date(+date);
1241
483
  }
1242
484
  if (!parsedDate || isNaN(+parsedDate)) {
1243
- console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
485
+ console && console.error && console.error(`Failed to parse x '${date}' to Date object`);
1244
486
  }
1245
487
  return parsedDate;
1246
488
  }
1247
-
1248
- /**
1249
- * Return if the current doc is visible or not
1250
- * @returns {boolean}
1251
- * @private
1252
- */
1253
489
  function isTabVisible() {
1254
- return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
490
+ var _a, _b;
491
+ return ((_a = doc) == null ? void 0 : _a.hidden) === false || ((_b = doc) == null ? void 0 : _b.visibilityState) === "visible";
1255
492
  }
1256
-
1257
- /**
1258
- * Get the current input type
1259
- * @param {boolean} mouse Config value: interaction.inputType.mouse
1260
- * @param {boolean} touch Config value: interaction.inputType.touch
1261
- * @returns {string} "mouse" | "touch" | null
1262
- * @private
1263
- */
1264
493
  function convertInputType(mouse, touch) {
1265
- var _this17 = this;
1266
- const DocumentTouch = win.DocumentTouch,
1267
- matchMedia = win.matchMedia,
1268
- navigator = win.navigator;
1269
- let hasTouch = !1;
494
+ const { DocumentTouch, matchMedia, navigator } = win;
495
+ let hasTouch = false;
1270
496
  if (touch) {
1271
- // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1272
497
  if (navigator && "maxTouchPoints" in navigator) {
1273
498
  hasTouch = navigator.maxTouchPoints > 0;
1274
-
1275
- // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1276
- // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1277
499
  } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
1278
- hasTouch = !0;
500
+ hasTouch = true;
1279
501
  } else {
1280
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
1281
- if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
1282
- hasTouch = !0;
502
+ if (matchMedia == null ? void 0 : matchMedia("(pointer:coarse)").matches) {
503
+ hasTouch = true;
1283
504
  } else {
1284
- // Only as a last resort, fall back to user agent sniffing
1285
505
  const UA = navigator.userAgent;
1286
506
  hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1287
507
  }
1288
508
  }
1289
509
  }
1290
-
1291
- // 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
1292
- // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1293
- // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1294
- const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1295
- _newArrowCheck(this, _this17);
1296
- return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1297
- }.bind(this));
1298
-
1299
- // fallback to 'mouse' if no input type is detected.
510
+ const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some((v) => matchMedia == null ? void 0 : matchMedia(`(${v})`).matches);
1300
511
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1301
512
  }
1302
-
1303
- /**
1304
- * Run function until given condition function return true
1305
- * @param {Function} fn Function to be executed when condition is true
1306
- * @param {Function} conditionFn Condition function to check if condition is true
1307
- * @private
1308
- */
1309
513
  function runUntil(fn, conditionFn) {
1310
- var _this18 = this;
1311
- if (conditionFn() === !1) {
1312
- requestAnimationFrame(function () {
1313
- _newArrowCheck(this, _this18);
1314
- return runUntil(fn, conditionFn);
1315
- }.bind(this));
514
+ if (conditionFn() === false) {
515
+ requestAnimationFrame(() => runUntil(fn, conditionFn));
1316
516
  } else {
1317
517
  fn();
1318
518
  }
1319
519
  }
1320
- ;// CONCATENATED MODULE: ./src/config/config.ts
1321
520
 
1322
- /**
1323
- * Copyright (c) 2017 ~ present NAVER Corp.
1324
- * billboard.js project is licensed under the MIT license
1325
- */
521
+ ;// CONCATENATED MODULE: ./src/config/config.ts
1326
522
 
1327
- /**
1328
- * Load configuration option
1329
- * @param {object} config User's generation config value
1330
- * @private
1331
- */
1332
523
  function loadConfig(config) {
1333
- var _this = this;
1334
524
  const thisConfig = this.config;
1335
- let target, keys, read;
1336
- const _find = function find() {
1337
- _newArrowCheck(this, _this);
525
+ let target;
526
+ let keys;
527
+ let read;
528
+ const find = () => {
1338
529
  const key = keys.shift();
1339
530
  if (key && target && isObjectType(target) && key in target) {
1340
531
  target = target[key];
1341
- return _find();
532
+ return find();
1342
533
  } else if (!key) {
1343
534
  return target;
1344
535
  }
1345
- return undefined;
1346
- }.bind(this);
1347
- Object.keys(thisConfig).forEach(function (key) {
1348
- _newArrowCheck(this, _this);
536
+ return void 0;
537
+ };
538
+ Object.keys(thisConfig).forEach((key) => {
1349
539
  target = config;
1350
540
  keys = key.split("_");
1351
- read = _find();
541
+ read = find();
1352
542
  if (isDefined(read)) {
1353
543
  thisConfig[key] = read;
1354
544
  }
1355
- }.bind(this));
1356
-
1357
- // only should run in the ChartInternal context
545
+ });
1358
546
  if (this.api) {
1359
547
  this.state.orgConfig = config;
1360
548
  }
1361
549
  }
1362
- ;// CONCATENATED MODULE: ./src/Plugin/tableview/index.ts
1363
550
 
551
+ ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
552
+ var Plugin_defProp = Object.defineProperty;
553
+ var Plugin_defNormalProp = (obj, key, value) => key in obj ? Plugin_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
554
+ var __publicField = (obj, key, value) => {
555
+ Plugin_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
556
+ return value;
557
+ };
558
+ class Plugin {
559
+ /**
560
+ * Constructor
561
+ * @param {Any} options config option object
562
+ * @private
563
+ */
564
+ constructor(options = {}) {
565
+ __publicField(this, "$$");
566
+ __publicField(this, "options");
567
+ this.options = options;
568
+ }
569
+ /**
570
+ * Lifecycle hook for 'beforeInit' phase.
571
+ * @private
572
+ */
573
+ $beforeInit() {
574
+ }
575
+ /**
576
+ * Lifecycle hook for 'init' phase.
577
+ * @private
578
+ */
579
+ $init() {
580
+ }
581
+ /**
582
+ * Lifecycle hook for 'afterInit' phase.
583
+ * @private
584
+ */
585
+ $afterInit() {
586
+ }
587
+ /**
588
+ * Lifecycle hook for 'redraw' phase.
589
+ * @private
590
+ */
591
+ $redraw() {
592
+ }
593
+ /**
594
+ * Lifecycle hook for 'willDestroy' phase.
595
+ * @private
596
+ */
597
+ $willDestroy() {
598
+ Object.keys(this).forEach((key) => {
599
+ this[key] = null;
600
+ delete this[key];
601
+ });
602
+ }
603
+ }
604
+ __publicField(Plugin, "version", "3.12.0-next.2");
1364
605
 
606
+ ;// CONCATENATED MODULE: ./src/Plugin/tableview/const.ts
1365
607
 
608
+ const defaultStyle = {
609
+ id: "__tableview-style__",
610
+ class: "bb-tableview",
611
+ rule: `.bb-tableview {
612
+ border-collapse:collapse;
613
+ border-spacing:0;
614
+ background:#fff;
615
+ min-width:100%;
616
+ margin-top:10px;
617
+ font-family:sans-serif;
618
+ font-size:.9em;
619
+ }
620
+ .bb-tableview tr:hover {
621
+ background:#eef7ff;
622
+ }
623
+ .bb-tableview thead tr {
624
+ background:#f8f8f8;
625
+ }
626
+ .bb-tableview caption,.bb-tableview td,.bb-tableview th {
627
+ text-align: center;
628
+ border:1px solid silver;
629
+ padding:.5em;
630
+ }
631
+ .bb-tableview caption {
632
+ font-size:1.1em;
633
+ font-weight:700;
634
+ margin-bottom: -1px;
635
+ }`
636
+ };
637
+ const tpl = {
638
+ body: `<caption>{=title}</caption>
639
+ <thead><tr>{=thead}</tr></thead>
640
+ <tbody>{=tbody}</tbody>`,
641
+ thead: `<th scope="col">{=title}</th>`,
642
+ tbodyHeader: `<th scope="row">{=value}</th>`,
643
+ tbody: `<td>{=value}</td>`
644
+ };
1366
645
 
1367
- function tableview_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; }
1368
- function tableview_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? tableview_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : tableview_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1369
- /**
1370
- * Copyright (c) 2021 ~ present NAVER Corp.
1371
- * billboard.js project is licensed under the MIT license
1372
- */
646
+ ;// CONCATENATED MODULE: ./src/Plugin/tableview/Options.ts
647
+ class Options {
648
+ constructor() {
649
+ return {
650
+ /**
651
+ * Set tableview holder selector.
652
+ * - **NOTE:** If not set, will append new holder element dynamically right after chart element.
653
+ * @name selector
654
+ * @memberof plugin-tableview
655
+ * @type {string}
656
+ * @default undefined
657
+ * @example
658
+ * selector: "#table-holder"
659
+ */
660
+ selector: void 0,
661
+ /**
662
+ * Set category title text
663
+ * @name categoryTitle
664
+ * @memberof plugin-tableview
665
+ * @type {string}
666
+ * @default "Category"
667
+ * @example
668
+ * categoryTitle: "#table-holder"
669
+ */
670
+ categoryTitle: "Category",
671
+ /**
672
+ * Set category text format function.
673
+ * @name categoryFormat
674
+ * @memberof plugin-tableview
675
+ * @type {Function}
676
+ * @returns {string}
677
+ * @default function(v) { // will return formatted value according x Axis type }}
678
+ * @example
679
+ * categoryFormat: "#table-holder"
680
+ */
681
+ categoryFormat: function(v) {
682
+ let category = v;
683
+ if (this.$$.axis.isCategorized()) {
684
+ category = this.$$.categoryName(v);
685
+ } else if (this.$$.axis.isTimeSeries()) {
686
+ category = v.toLocaleDateString();
687
+ }
688
+ return category;
689
+ },
690
+ /**
691
+ * Set tableview holder class name.
692
+ * @name class
693
+ * @memberof plugin-tableview
694
+ * @type {string}
695
+ * @default undefined
696
+ * @example
697
+ * class: "table-class-name"
698
+ */
699
+ class: void 0,
700
+ /**
701
+ * Set to apply default style(`.bb-tableview`) to tableview element.
702
+ * @name style
703
+ * @memberof plugin-tableview
704
+ * @type {boolean}
705
+ * @default true
706
+ * @example
707
+ * style: false
708
+ */
709
+ style: true,
710
+ /**
711
+ * Set tableview title text.
712
+ * - **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.
713
+ * @name title
714
+ * @memberof plugin-tableview
715
+ * @type {string}
716
+ * @default undefined
717
+ * @example
718
+ * title: "Table Title Text"
719
+ */
720
+ title: void 0,
721
+ /**
722
+ * Update tableview from data visibility update(ex. legend toggle).
723
+ * @name updateOnToggle
724
+ * @memberof plugin-tableview
725
+ * @type {boolean}
726
+ * @default true
727
+ * @example
728
+ * legendToggleUpdate: false
729
+ */
730
+ updateOnToggle: true,
731
+ /**
732
+ * Set how null value to be shown.
733
+ * @name nullString
734
+ * @memberof plugin-tableview
735
+ * @type {string}
736
+ * @default "-"
737
+ * @example
738
+ * nullString: "N/A"
739
+ */
740
+ nullString: "-"
741
+ };
742
+ }
743
+ }
1373
744
 
745
+ ;// CONCATENATED MODULE: ./src/Plugin/tableview/index.ts
746
+ var tableview_defProp = Object.defineProperty;
747
+ var __defProps = Object.defineProperties;
748
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
749
+ var tableview_getOwnPropSymbols = Object.getOwnPropertySymbols;
750
+ var tableview_hasOwnProp = Object.prototype.hasOwnProperty;
751
+ var tableview_propIsEnum = Object.prototype.propertyIsEnumerable;
752
+ var tableview_defNormalProp = (obj, key, value) => key in obj ? tableview_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
753
+ var tableview_spreadValues = (a, b) => {
754
+ for (var prop in b || (b = {}))
755
+ if (tableview_hasOwnProp.call(b, prop))
756
+ tableview_defNormalProp(a, prop, b[prop]);
757
+ if (tableview_getOwnPropSymbols)
758
+ for (var prop of tableview_getOwnPropSymbols(b)) {
759
+ if (tableview_propIsEnum.call(b, prop))
760
+ tableview_defNormalProp(a, prop, b[prop]);
761
+ }
762
+ return a;
763
+ };
764
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
765
+ var tableview_publicField = (obj, key, value) => {
766
+ tableview_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
767
+ return value;
768
+ };
1374
769
 
1375
770
 
1376
771
 
1377
772
 
1378
773
 
1379
- /**
1380
- * Table view plugin.<br>
1381
- * Generates table view for bound dataset.
1382
- * - **NOTE:**
1383
- * - Plugins aren't built-in. Need to be loaded or imported to be used.
1384
- * - Non required modules from billboard.js core, need to be installed separately.
1385
- * @class plugin-tableview
1386
- * @param {object} options table view plugin options
1387
- * @augments Plugin
1388
- * @returns {TableView}
1389
- * @example
1390
- * // Plugin must be loaded before the use.
1391
- * <script src="$YOUR_PATH/plugin/billboardjs-plugin-tableview.js"></script>
1392
- *
1393
- * var chart = bb.generate({
1394
- * ...
1395
- * plugins: [
1396
- * new bb.plugin.tableview({
1397
- * selector: "#my-table-view",
1398
- * categoryTitle: "Category",
1399
- * categoryFormat: function(v) {
1400
- * // do some transformation
1401
- * ...
1402
- * return v;
1403
- * },
1404
- * class: "my-class-name",
1405
- * style: true,
1406
- * title: "My Data List",
1407
- * updateOnToggle: false,
1408
- * nullString: "N/A"
1409
- * }),
1410
- * ]
1411
- * });
1412
- * @example
1413
- * import {bb} from "billboard.js";
1414
- * import TableView from "billboard.js/dist/billboardjs-plugin-tableview";
1415
- *
1416
- * bb.generate({
1417
- * ...
1418
- * plugins: [
1419
- * new TableView({ ... })
1420
- * ]
1421
- * })
1422
- */
1423
- let TableView = /*#__PURE__*/function (_Plugin) {
1424
- _inheritsLoose(TableView, _Plugin);
1425
- function TableView(options) {
1426
- var _this = _Plugin.call(this, options) || this;
1427
- _this.config = void 0;
1428
- _this.element = void 0;
1429
- _this.config = new Options();
1430
- return _assertThisInitialized(_this) || _assertThisInitialized(_this);
774
+ class TableView extends Plugin {
775
+ constructor(options) {
776
+ super(options);
777
+ tableview_publicField(this, "config");
778
+ tableview_publicField(this, "element");
779
+ this.config = new Options();
780
+ return this;
1431
781
  }
1432
- var _proto = TableView.prototype;
1433
- _proto.$beforeInit = function $beforeInit() {
782
+ $beforeInit() {
1434
783
  loadConfig.call(this, this.options);
1435
- };
1436
- _proto.$init = function $init() {
1437
- var _element$classList;
1438
- const _this$config = this.config,
1439
- className = _this$config.class,
1440
- selector = _this$config.selector,
1441
- style = _this$config.style;
1442
- let element = document.querySelector(selector || "." + (className || defaultStyle.class));
784
+ }
785
+ $init() {
786
+ const { class: className, selector, style } = this.config;
787
+ let element = document.querySelector(
788
+ selector || `.${className || defaultStyle.class}`
789
+ );
1443
790
  if (!element) {
1444
791
  const chart = this.$$.$el.chart.node();
1445
792
  element = document.createElement("table");
@@ -1450,84 +797,65 @@ let TableView = /*#__PURE__*/function (_Plugin) {
1450
797
  element.appendChild(table);
1451
798
  element = table;
1452
799
  }
1453
-
1454
- // append default css style
1455
800
  if (style && !document.getElementById(defaultStyle.id)) {
1456
801
  const s = document.createElement("style");
1457
802
  s.id = defaultStyle.id;
1458
803
  s.innerHTML = defaultStyle.rule;
1459
804
  (document.head || document.getElementsByTagName("head")[0]).appendChild(s);
1460
805
  }
1461
- (_element$classList = element.classList).add.apply(_element$classList, [style && defaultStyle.class, className].filter(Boolean));
806
+ element.classList.add(...[style && defaultStyle.class, className].filter(Boolean));
1462
807
  this.element = element;
1463
808
  }
1464
-
1465
809
  /**
1466
810
  * Generate table
1467
811
  * @private
1468
- */;
1469
- _proto.generateTable = function generateTable() {
1470
- var _this2 = this;
1471
- const $$ = this.$$,
1472
- config = this.config,
1473
- element = this.element,
1474
- dataToShow = $$.filterTargetsToShow($$.data.targets);
812
+ */
813
+ generateTable() {
814
+ const { $$, config, element } = this;
815
+ const dataToShow = $$.filterTargetsToShow($$.data.targets);
1475
816
  let thead = tplProcess(tpl.thead, {
1476
- title: dataToShow.length ? this.config.categoryTitle : ""
1477
- }),
1478
- tbody = "";
817
+ title: dataToShow.length ? this.config.categoryTitle : ""
818
+ });
819
+ let tbody = "";
1479
820
  const rows = [];
1480
- dataToShow.forEach(function (v) {
1481
- var _this3 = this;
1482
- _newArrowCheck(this, _this2);
1483
- thead += tplProcess(tpl.thead, {
1484
- title: v.id
1485
- });
1486
-
1487
- // make up value rows
1488
- v.values.forEach(function (d, i) {
1489
- _newArrowCheck(this, _this3);
821
+ dataToShow.forEach((v) => {
822
+ thead += tplProcess(tpl.thead, { title: v.id });
823
+ v.values.forEach((d, i) => {
1490
824
  if (!rows[i]) {
1491
825
  rows[i] = [d.x];
1492
826
  }
1493
827
  rows[i].push(d.value);
1494
- }.bind(this));
1495
- }.bind(this));
1496
- rows.forEach(function (v) {
1497
- var _this4 = this;
1498
- _newArrowCheck(this, _this2);
1499
- tbody += "<tr>" + v.map(function (d, i) {
1500
- _newArrowCheck(this, _this4);
1501
- return tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
828
+ });
829
+ });
830
+ rows.forEach((v) => {
831
+ tbody += `<tr>${v.map(
832
+ (d, i) => tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
1502
833
  value: i === 0 ? config.categoryFormat.bind(this)(d) : isNumber(d) ? d.toLocaleString() : config.nullString
1503
- });
1504
- }.bind(this)).join("") + "</tr>";
1505
- }.bind(this));
1506
- const r = tplProcess(tpl.body, tableview_objectSpread(tableview_objectSpread({}, config), {}, {
834
+ })
835
+ ).join("")}</tr>`;
836
+ });
837
+ const rx = /(<\/?(script|img)[^>]*>|<[^>]+><\/[^>]+>)/ig;
838
+ const r = tplProcess(tpl.body, __spreadProps(tableview_spreadValues({}, config), {
1507
839
  title: config.title || $$.config.title_text || "",
1508
- thead: thead,
1509
- tbody: tbody
1510
- })).replace(/(<\/?(script|img)[^>]*>|<[^>]+><\/[^>]+>)/ig, "");
840
+ thead,
841
+ tbody
842
+ })).replace(rx, "");
1511
843
  element.innerHTML = r;
1512
- };
1513
- _proto.$redraw = function $redraw() {
1514
- const state = this.$$.state,
1515
- doNotUpdate = state.resizing || !this.config.updateOnToggle && state.toggling;
1516
- doNotUpdate || this.generateTable();
1517
- };
1518
- _proto.$willDestroy = function $willDestroy() {
1519
- var _this$element$parentN;
1520
- (_this$element$parentN = this.element.parentNode) == null || _this$element$parentN.removeChild(this.element);
1521
-
1522
- // remove default css style when left one chart instance
844
+ }
845
+ $redraw() {
846
+ const { state } = this.$$;
847
+ const doNotUpdate = state.resizing || !this.config.updateOnToggle && state.toggling;
848
+ !doNotUpdate && this.generateTable();
849
+ }
850
+ $willDestroy() {
851
+ var _a, _b;
852
+ (_a = this.element.parentNode) == null ? void 0 : _a.removeChild(this.element);
1523
853
  if (this.$$.charts.length === 1) {
1524
- var _s$parentNode;
1525
854
  const s = document.getElementById(defaultStyle.id);
1526
- s == null || (_s$parentNode = s.parentNode) == null || _s$parentNode.removeChild(s);
855
+ (_b = s == null ? void 0 : s.parentNode) == null ? void 0 : _b.removeChild(s);
1527
856
  }
1528
- };
1529
- return TableView;
1530
- }(Plugin);
857
+ }
858
+ }
1531
859
 
1532
860
  }();
1533
861
  __webpack_exports__ = __webpack_exports__["default"];