evui 3.5.0 → 3.5.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.
Files changed (134) hide show
  1. package/dist/index.js +23148 -0
  2. package/dist/index.umd.cjs +28 -0
  3. package/package.json +5 -11
  4. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  5. package/dist/common/utils.bignumber.js +0 -23
  6. package/dist/common/utils.debounce.js +0 -66
  7. package/dist/common/utils.js +0 -64
  8. package/dist/common/utils.throttle.js +0 -15
  9. package/dist/components/button/Button.vue.js +0 -65
  10. package/dist/components/button/index.js +0 -7
  11. package/dist/components/buttonGroup/ButtonGroup.vue.js +0 -14
  12. package/dist/components/buttonGroup/index.js +0 -7
  13. package/dist/components/calendar/Calendar.vue.js +0 -299
  14. package/dist/components/calendar/index.js +0 -7
  15. package/dist/components/calendar/uses.js +0 -579
  16. package/dist/components/chart/Chart.vue.js +0 -261
  17. package/dist/components/chart/ChartToolbar.vue.js +0 -32
  18. package/dist/components/chart/chart.core.js +0 -738
  19. package/dist/components/chart/chartZoom.core.js +0 -221
  20. package/dist/components/chart/element/element.bar.js +0 -358
  21. package/dist/components/chart/element/element.bar.time.js +0 -55
  22. package/dist/components/chart/element/element.heatmap.js +0 -403
  23. package/dist/components/chart/element/element.line.js +0 -292
  24. package/dist/components/chart/element/element.pie.js +0 -73
  25. package/dist/components/chart/element/element.scatter.js +0 -209
  26. package/dist/components/chart/element/element.tip.js +0 -312
  27. package/dist/components/chart/helpers/helpers.canvas.js +0 -141
  28. package/dist/components/chart/helpers/helpers.constant.js +0 -253
  29. package/dist/components/chart/helpers/helpers.util.js +0 -265
  30. package/dist/components/chart/index.js +0 -7
  31. package/dist/components/chart/model/index.js +0 -6
  32. package/dist/components/chart/model/model.series.js +0 -82
  33. package/dist/components/chart/model/model.store.js +0 -650
  34. package/dist/components/chart/plugins/plugins.interaction.js +0 -823
  35. package/dist/components/chart/plugins/plugins.legend.gradient.js +0 -281
  36. package/dist/components/chart/plugins/plugins.legend.js +0 -665
  37. package/dist/components/chart/plugins/plugins.pie.js +0 -86
  38. package/dist/components/chart/plugins/plugins.scrollbar.js +0 -345
  39. package/dist/components/chart/plugins/plugins.title.js +0 -43
  40. package/dist/components/chart/plugins/plugins.tooltip.js +0 -508
  41. package/dist/components/chart/scale/scale.js +0 -492
  42. package/dist/components/chart/scale/scale.linear.js +0 -248
  43. package/dist/components/chart/scale/scale.logarithmic.js +0 -82
  44. package/dist/components/chart/scale/scale.step.js +0 -227
  45. package/dist/components/chart/scale/scale.time.category.js +0 -148
  46. package/dist/components/chart/scale/scale.time.js +0 -95
  47. package/dist/components/chart/uses.js +0 -479
  48. package/dist/components/chartBrush/ChartBrush.vue.js +0 -198
  49. package/dist/components/chartBrush/chartBrush.core.js +0 -265
  50. package/dist/components/chartBrush/index.js +0 -7
  51. package/dist/components/chartBrush/uses.js +0 -18
  52. package/dist/components/chartGroup/ChartGroup.vue.js +0 -128
  53. package/dist/components/chartGroup/index.js +0 -7
  54. package/dist/components/chartGroup/uses.js +0 -47
  55. package/dist/components/checkbox/Checkbox.vue.js +0 -99
  56. package/dist/components/checkbox/index.js +0 -7
  57. package/dist/components/checkboxGroup/CheckboxGroup.vue.js +0 -40
  58. package/dist/components/checkboxGroup/index.js +0 -7
  59. package/dist/components/contextMenu/ContextMenu.vue.js +0 -70
  60. package/dist/components/contextMenu/MenuList.vue.js +0 -105
  61. package/dist/components/contextMenu/index.js +0 -7
  62. package/dist/components/contextMenu/uses.js +0 -79
  63. package/dist/components/datePicker/DatePicker.vue.js +0 -310
  64. package/dist/components/datePicker/index.js +0 -7
  65. package/dist/components/datePicker/uses.js +0 -190
  66. package/dist/components/grid/Grid.vue.js +0 -1261
  67. package/dist/components/grid/GridColumnSetting.vue.js +0 -212
  68. package/dist/components/grid/GridFilterSetting.vue.js +0 -222
  69. package/dist/components/grid/GridPagination.vue.js +0 -69
  70. package/dist/components/grid/GridSummary.vue.js +0 -186
  71. package/dist/components/grid/GridToolbar.vue.js +0 -15
  72. package/dist/components/grid/icon/icon-option-button.vue.js +0 -39
  73. package/dist/components/grid/icon/icon-sort-button.vue.js +0 -56
  74. package/dist/components/grid/index.js +0 -7
  75. package/dist/components/grid/uses.js +0 -697
  76. package/dist/components/icon/Icon.vue.js +0 -50
  77. package/dist/components/icon/index.js +0 -8
  78. package/dist/components/inputNumber/InputNumber.vue.js +0 -112
  79. package/dist/components/inputNumber/index.js +0 -7
  80. package/dist/components/inputNumber/uses.js +0 -76
  81. package/dist/components/loading/Loading.vue.js +0 -78
  82. package/dist/components/loading/index.js +0 -7
  83. package/dist/components/menu/Menu.vue.js +0 -66
  84. package/dist/components/menu/MenuItem.vue.js +0 -125
  85. package/dist/components/menu/index.js +0 -7
  86. package/dist/components/message/Message.vue.js +0 -122
  87. package/dist/components/message/index.js +0 -16
  88. package/dist/components/messageBox/MessageBox.vue.js +0 -216
  89. package/dist/components/messageBox/index.js +0 -13
  90. package/dist/components/notification/Notification.vue.js +0 -140
  91. package/dist/components/notification/index.js +0 -23
  92. package/dist/components/pagination/Pagination.vue.js +0 -215
  93. package/dist/components/pagination/index.js +0 -7
  94. package/dist/components/pagination/pageButton.vue.js +0 -35
  95. package/dist/components/progress/Progress.vue.js +0 -88
  96. package/dist/components/progress/index.js +0 -7
  97. package/dist/components/radio/Radio.vue.js +0 -75
  98. package/dist/components/radio/index.js +0 -7
  99. package/dist/components/radioGroup/RadioGroup.vue.js +0 -37
  100. package/dist/components/radioGroup/index.js +0 -7
  101. package/dist/components/scheduler/Scheduler.vue.js +0 -128
  102. package/dist/components/scheduler/index.js +0 -7
  103. package/dist/components/scheduler/uses.js +0 -73
  104. package/dist/components/select/Select.vue.js +0 -381
  105. package/dist/components/select/index.js +0 -7
  106. package/dist/components/select/uses.js +0 -147
  107. package/dist/components/slider/Slider.vue.js +0 -243
  108. package/dist/components/slider/index.js +0 -7
  109. package/dist/components/slider/uses.js +0 -188
  110. package/dist/components/tabPanel/TabPanel.vue.js +0 -39
  111. package/dist/components/tabPanel/index.js +0 -7
  112. package/dist/components/tabs/Tabs.vue.js +0 -220
  113. package/dist/components/tabs/index.js +0 -7
  114. package/dist/components/textField/TextField.vue.js +0 -209
  115. package/dist/components/textField/index.js +0 -7
  116. package/dist/components/timePicker/TimePicker.vue.js +0 -227
  117. package/dist/components/timePicker/index.js +0 -7
  118. package/dist/components/toggle/Toggle.vue.js +0 -66
  119. package/dist/components/toggle/index.js +0 -7
  120. package/dist/components/tree/Tree.vue.js +0 -220
  121. package/dist/components/tree/TreeNode.vue.js +0 -146
  122. package/dist/components/tree/index.js +0 -7
  123. package/dist/components/treeGrid/TreeGrid.vue.js +0 -898
  124. package/dist/components/treeGrid/TreeGridNode.vue.js +0 -274
  125. package/dist/components/treeGrid/TreeGridToolbar.vue.js +0 -15
  126. package/dist/components/treeGrid/index.js +0 -7
  127. package/dist/components/treeGrid/uses.js +0 -497
  128. package/dist/components/window/Window.vue.js +0 -211
  129. package/dist/components/window/index.js +0 -7
  130. package/dist/components/window/uses.js +0 -345
  131. package/dist/directives/clickoutside.js +0 -47
  132. package/dist/main.js +0 -142
  133. package/dist/package.json.js +0 -4
  134. package/dist/resolver.js +0 -17
@@ -1,738 +0,0 @@
1
- import { mobileCheck as M, truthyNumber as C } from "../../common/utils.js";
2
- import I from "./model/index.js";
3
- import D from "./scale/scale.time.js";
4
- import O from "./scale/scale.linear.js";
5
- import k from "./scale/scale.logarithmic.js";
6
- import z from "./scale/scale.step.js";
7
- import T from "./scale/scale.time.category.js";
8
- import E from "./plugins/plugins.title.js";
9
- import A from "./plugins/plugins.legend.js";
10
- import B from "./plugins/plugins.legend.gradient.js";
11
- import H from "./plugins/plugins.scrollbar.js";
12
- import P from "./plugins/plugins.interaction.js";
13
- import j from "./plugins/plugins.tooltip.js";
14
- import X from "./plugins/plugins.pie.js";
15
- import Y from "./element/element.tip.js";
16
- class ie {
17
- constructor(e, t, i, s, a, r, h) {
18
- Object.keys(I).forEach((o) => Object.assign(this, I[o])), i.brush || (Object.assign(this, j), Object.assign(this, P), Object.assign(this, Y), Object.assign(this, A), Object.assign(this, X), Object.assign(this, E), Object.assign(this, H)), i.type === "heatMap" && i.legend.type === "gradient" && Object.assign(this, B), this.isMobile = M(), this.brushSeries = h, this.target = e, this.data = t, this.options = i, this.listeners = s, this.wrapperDOM = document.createElement("div"), this.wrapperDOM.className = i.brush ? "ev-chart-brush-wrapper" : "ev-chart-wrapper", this.chartDOM = document.createElement("div"), this.chartDOM.className = i.brush ? "ev-chart-brush-container" : "ev-chart-container", this.wrapperDOM.appendChild(this.chartDOM), this.target.appendChild(this.wrapperDOM), this.displayCanvas = document.createElement("canvas"), this.displayCanvas.setAttribute("style", "display: block;"), this.displayCtx = this.displayCanvas.getContext("2d"), this.bufferCanvas = document.createElement("canvas"), this.bufferCanvas.setAttribute("style", "display: block;"), this.bufferCtx = this.bufferCanvas.getContext("2d"), this.pixelRatio = window.devicePixelRatio || 1, this.oldPixelRatio = this.pixelRatio, this.chartDOM.appendChild(this.displayCanvas), i.brush || (this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.setAttribute("style", "display: block; z-index: 2;"), this.overlayCanvas.setAttribute("class", "overlay-canvas"), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.chartDOM.appendChild(this.overlayCanvas), this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0px", this.overlayCanvas.style.left = "0px"), this.isInitLegend = !1, this.isInitTitle = !1, this.isInit = !1, this.scrollbar = {
19
- x: { isInit: !1 },
20
- y: { isInit: !1 }
21
- }, this.seriesList = {}, this.lastTip = { pos: null, value: null }, this.seriesInfo = {
22
- charts: { pie: [], bar: [], line: [], scatter: [], heatMap: [] },
23
- count: 0
24
- }, this.defaultSelectItemInfo = a, this.defaultSelectInfo = r, this.legendHover = null;
25
- }
26
- /**
27
- * Initialize chart object
28
- *
29
- * @returns {undefined}
30
- */
31
- init() {
32
- var c;
33
- const { series: e, data: t, labels: i, groups: s } = this.data, { type: a, axesX: r, axesY: h, tooltip: o, horizontal: n, realTimeScatter: l } = this.options;
34
- this.createSeriesSet(e, a, n, s), s.length && this.addGroupInfo(s), l != null && l.use ? (this.dataSet = {}, this.createRealTimeScatterDataSet(t)) : this.createDataSet(t, i), this.minMax = this.getStoreMinMax(), this.initRect(), this.axesX = this.createAxes("x", r), this.axesY = this.createAxes("y", h), this.initDefaultSelectInfo(), this.drawChart(), o.use && !this.isInitTooltip && this.createTooltipDOM(), (c = this.createEventFunctions) == null || c.call(this), this.isInit = !0;
35
- }
36
- _updateSeriesCount() {
37
- this.seriesInfo.count = Object.values(this.seriesList).filter((e) => e.show).length;
38
- }
39
- /**
40
- * Initialize chart rectangle
41
- *
42
- * @returns {undefined}
43
- */
44
- initRect() {
45
- var t, i, s, a, r, h;
46
- const e = this.options;
47
- e.title.show && (this.isInitTitle || this.initTitle(), this.showTitle()), e.legend.show && !e.legend.external ? (this.isInitLegend || this.initLegend(), this.setLegendPosition()) : e.legend.show && e.legend.external && this._updateSeriesCount(), ((s = (i = (t = e.axesX) == null ? void 0 : t[0]) == null ? void 0 : i.scrollbar) != null && s.use || (h = (r = (a = e.axesY) == null ? void 0 : a[0]) == null ? void 0 : r.scrollbar) != null && h.use) && this.initScrollbar(), this.chartRect = this.getChartRect();
48
- }
49
- drawSyncedIndicator({ horizontal: e, label: t, mousePosition: i }) {
50
- this.drawSyncedIndicator({ horizontal: e, label: t, mousePosition: i });
51
- }
52
- adjustXAndYAxisWidth() {
53
- var i, s, a, r;
54
- const e = (h, o, n) => {
55
- const {
56
- interval: l,
57
- graphMin: c,
58
- graphMax: d,
59
- steps: g = 0,
60
- minIndex: u,
61
- maxIndex: x,
62
- indexInterval: m
63
- } = h ?? {};
64
- let v = [];
65
- if ((n == null ? void 0 : n.type) === "step" && u !== void 0 && x !== void 0 && m !== void 0) {
66
- const { labels: f } = this.data, y = o === "x" ? (f == null ? void 0 : f.x) ?? f ?? [] : (f == null ? void 0 : f.y) ?? f ?? [];
67
- v = [];
68
- for (let p = u; p <= x; p += m)
69
- y[p] !== void 0 && v.push(y[p]);
70
- } else if (l)
71
- v = Array.from({ length: g }, (f, y) => c + y * l), v.push(d);
72
- else {
73
- const { labels: f } = this.data;
74
- v = o === "x" ? (f == null ? void 0 : f.x) ?? f ?? [] : (f == null ? void 0 : f.y) ?? f ?? [];
75
- }
76
- return v;
77
- }, t = {
78
- x: (s = (i = this.axesRange) == null ? void 0 : i.x) == null ? void 0 : s.map((h, o) => {
79
- var u, x, m;
80
- const n = this.axesX[o], l = (u = this.axesSteps) == null ? void 0 : u.x[o], c = e(l, "x", n), d = C((x = n == null ? void 0 : n.labelStyle) == null ? void 0 : x.fixWidth) ? n.labelStyle.fixWidth : 0, g = ((m = n == null ? void 0 : n.getLabelWidthHasMaxLength) == null ? void 0 : m.call(n, c, this.chartRect)) ?? 0;
81
- return {
82
- ...h,
83
- size: {
84
- width: d || Math.max(g, h.size.width),
85
- height: h.size.height
86
- }
87
- };
88
- }),
89
- y: (r = (a = this.axesRange) == null ? void 0 : a.y) == null ? void 0 : r.map((h, o) => {
90
- var u, x, m;
91
- const n = this.axesY[o], l = (u = this.axesSteps) == null ? void 0 : u.y[o], c = e(l, "y", n), d = C((x = n == null ? void 0 : n.labelStyle) == null ? void 0 : x.fixWidth) ? n.labelStyle.fixWidth : 0, g = ((m = n == null ? void 0 : n.getLabelWidthHasMaxLength) == null ? void 0 : m.call(n, c, this.chartRect)) ?? 0;
92
- return {
93
- ...h,
94
- size: {
95
- width: d || Math.max(g, h.size.width),
96
- height: h.size.height
97
- }
98
- };
99
- })
100
- };
101
- this.axesRange = t, this.labelOffset = this.getLabelOffset(t), this.labelRange = this.getAxesLabelRange(), this.axesSteps = this.calculateSteps();
102
- }
103
- emitAxesScaleChange() {
104
- var o;
105
- if (typeof ((o = this.listeners) == null ? void 0 : o["axes-scale-change"]) != "function")
106
- return;
107
- const e = this._lastEmittedAxesRange, t = this.labelRange, i = (n, l) => (n == null ? void 0 : n.min) === (l == null ? void 0 : l.min) && (n == null ? void 0 : n.max) === (l == null ? void 0 : l.max), s = ({ min: n, max: l }) => ({ minSteps: n, maxSteps: l }), a = t.x.every((n, l) => {
108
- var d;
109
- return !!!((d = this.options.axesX[l]) != null && d.scaleChange) || !!e && i(n, e.x[l]);
110
- }), r = t.y.every((n, l) => {
111
- var d;
112
- return !!!((d = this.options.axesY[l]) != null && d.scaleChange) || !!e && i(n, e.y[l]);
113
- });
114
- if (a && r)
115
- return;
116
- this._lastEmittedAxesRange = t;
117
- const h = {
118
- x: t.x.map(s),
119
- y: t.y.map(s)
120
- };
121
- this.listeners["axes-scale-change"](h);
122
- }
123
- /**
124
- * To draw canvas chart, it processes several sequential jobs
125
- * @param {any} [hitInfo=undefined] from mousemove callback (object or object[] of undefined)
126
- *
127
- * @returns {undefined}
128
- */
129
- drawChart(e) {
130
- var t, i, s, a, r, h;
131
- this.initScale(), this.axesRange = this.getAxesRange(), this.labelOffset = this.getLabelOffset(), this.labelRange = this.getAxesLabelRange(), this.axesSteps = this.calculateSteps(), this.adjustXAndYAxisWidth(), this.emitAxesScaleChange(), this.drawAxis(e), this.drawSeries(e), ((i = (t = this.scrollbar) == null ? void 0 : t.x) != null && i.use || (a = (s = this.scrollbar) == null ? void 0 : s.y) != null && a.use) && (this.initScrollbar(), this.updateScrollbarPosition()), this.drawTip(), this.bufferCanvas && ((r = this.bufferCanvas) == null ? void 0 : r.width) > 1 && ((h = this.bufferCanvas) == null ? void 0 : h.height) > 1 && this.displayCtx.drawImage(this.bufferCanvas, 0, 0);
132
- }
133
- /**
134
- * Collect duplicate point keys for scatter overlap detection
135
- * @param {Map<string, string>} duple
136
- * @param {string[]} chartTypeSet
137
- *
138
- * @returns {undefined}
139
- */
140
- collectDuplicatePoints(e, t) {
141
- var s, a, r;
142
- const i = !!this.options.seriesReverse;
143
- for (let h = i ? t.length - 1 : 0; i ? h >= 0 : h < t.length; i ? h-- : h++) {
144
- const o = this.seriesList[t[h]];
145
- if (!!(o != null && o.show))
146
- if ((s = this.options.realTimeScatter) != null && s.use) {
147
- const l = (a = o.data[o.sId]) == null ? void 0 : a.dataGroup;
148
- for (let c = 0; c < l.length; c++) {
149
- const d = ((r = l[c]) == null ? void 0 : r.data) || [];
150
- for (let g = 0; g < d.length; g++) {
151
- const u = d[g];
152
- e.set(`${u.x}${u.y}`, o.sId);
153
- }
154
- }
155
- } else {
156
- const l = this.data.data[t[h]] ?? [];
157
- for (let c = 0; c < l.length; c++) {
158
- const d = l[c];
159
- e.set(`${d.x}${d.y}`, o.sId);
160
- }
161
- }
162
- }
163
- }
164
- /**
165
- * Draw each series
166
- * @param {any} [hitInfo=undefined] legend mouseover callback (object or undefined)
167
- *
168
- * @returns {undefined}
169
- */
170
- drawSeries(e) {
171
- var u;
172
- const {
173
- maxTip: t,
174
- selectLabel: i,
175
- selectItem: s,
176
- selectSeries: a,
177
- brush: r,
178
- displayOverflow: h,
179
- unSelectedOpacity: o
180
- } = this.options, n = {
181
- ctx: this.bufferCtx,
182
- chartRect: this.chartRect,
183
- labelOffset: this.labelOffset,
184
- axesSteps: this.axesSteps,
185
- maxTipOpt: { background: t.background, color: t.color },
186
- selectLabel: { option: i, selected: this.defaultSelectInfo },
187
- selectSeries: { option: a, selected: this.defaultSelectInfo },
188
- selectItem: { option: s, selected: this.defaultSelectItemInfo },
189
- overlayCtx: this.overlayCtx,
190
- isBrush: !!r,
191
- displayOverflow: h,
192
- unSelectedOpacity: o
193
- };
194
- let l = 0, c = 0;
195
- this.seriesInfo.charts.bar.forEach((x) => {
196
- this.seriesList[x].show && c++;
197
- });
198
- const d = /* @__PURE__ */ new Map(), g = Object.keys(this.seriesInfo.charts);
199
- for (let x = 0; x < g.length; x++) {
200
- const m = g[x], v = this.seriesInfo.charts[m];
201
- m === "scatter" && this.options.coordinateDedupe && this.collectDuplicatePoints(d, v);
202
- for (let f = 0; f < v.length; f++) {
203
- let y = this.seriesList[v[f]];
204
- switch (m) {
205
- case "line": {
206
- const p = e == null ? void 0 : e.legend;
207
- y.draw({
208
- legendHitInfo: p,
209
- ...n
210
- });
211
- break;
212
- }
213
- case "heatMap": {
214
- const p = e == null ? void 0 : e.legend;
215
- y.draw({
216
- legendHitInfo: p,
217
- ...n
218
- });
219
- break;
220
- }
221
- case "bar": {
222
- const p = e == null ? void 0 : e.legend, { thickness: S, cPadRatio: b, borderRadius: R } = this.options;
223
- y.draw({
224
- thickness: S,
225
- cPadRatio: b,
226
- borderRadius: R,
227
- showSeriesCount: c,
228
- showIndex: l,
229
- legendHitInfo: p,
230
- ...n
231
- }), y.show && l++;
232
- break;
233
- }
234
- case "pie": {
235
- const p = this.lastHitInfo ?? { sId: (u = this.defaultSelectItemInfo) == null ? void 0 : u.seriesID }, S = e == null ? void 0 : e.legend;
236
- this.options.sunburst ? this.drawSunburst({
237
- selectInfo: p,
238
- legendHitInfo: S,
239
- unSelectedOpacity: n.unSelectedOpacity
240
- }) : this.drawPie({
241
- selectInfo: p,
242
- legendHitInfo: S,
243
- unSelectedOpacity: n.unSelectedOpacity
244
- }), this.options.doughnutHoleSize > 0 && this.drawDoughnutHole();
245
- break;
246
- }
247
- case "scatter": {
248
- const p = e == null ? void 0 : e.legend;
249
- let S;
250
- if (s.use && s.useSeriesOpacity) {
251
- const b = this.lastHitInfo, R = this.defaultSelectItemInfo;
252
- b != null && b.maxIndex || (b == null ? void 0 : b.maxIndex) === 0 ? S = {
253
- seriesID: b.sId,
254
- dataIndex: b.maxIndex
255
- } : R != null && R.dataIndex || (R == null ? void 0 : R.dataIndex) === 0 ? S = { ...R } : S = null;
256
- }
257
- this.options.seriesReverse && (y = this.seriesList[v.at(-1 - f)]), y.draw({
258
- legendHitInfo: p,
259
- selectInfo: S,
260
- duple: d,
261
- coordinateDedupe: this.options.coordinateDedupe,
262
- ...n
263
- });
264
- break;
265
- }
266
- }
267
- }
268
- }
269
- }
270
- /**
271
- * Draw Tip with hitInfo and defaultSelectItemInfo
272
- */
273
- drawTip() {
274
- var t;
275
- let e;
276
- this.lastHitInfo ? e = this.lastHitInfo : this.defaultSelectItemInfo ? e = this.getItem(this.defaultSelectItemInfo, !1) : this.defaultSelectInfo && this.options.selectLabel.use ? e = this.getItem(this.defaultSelectInfo, !1) : e = null, (t = this.drawTips) == null || t.call(this, e);
277
- }
278
- /**
279
- * Create axes
280
- * @param {string} dir axis direction
281
- * @param {array} axes axes array
282
- *
283
- * @returns {array} axes objects in array
284
- */
285
- createAxes(e, t = []) {
286
- const i = this.bufferCtx, a = this.options.type === "heatMap" ? this.data.labels[e] : this.data.labels, r = this.options;
287
- return t.map((h) => {
288
- switch (h.type) {
289
- case "linear":
290
- return new O(e, h, i, r);
291
- case "time":
292
- return h.categoryMode ? new T(e, h, i, a, r) : new D(e, h, i, r);
293
- case "log":
294
- return new k(e, h, i);
295
- case "step":
296
- return new z(e, h, i, a, r);
297
- default:
298
- return !1;
299
- }
300
- });
301
- }
302
- /**
303
- * Calculate min/max value, label and size information for each axis
304
- *
305
- * @returns {object} axes min/max information
306
- */
307
- getAxesRange() {
308
- const e = this.axesX.map(
309
- (i, s) => i.calculateScaleRange(this.minMax.x[s], this.scrollbar.x, this.chartRect)
310
- ), t = this.axesY.map(
311
- (i, s) => i.calculateScaleRange(this.minMax.y[s], this.scrollbar.y, this.chartRect)
312
- );
313
- return { x: e, y: t };
314
- }
315
- /**
316
- * Draw each axis
317
- *
318
- * @returns {undefined}
319
- */
320
- drawAxis(e) {
321
- this.axesX.forEach((t, i) => {
322
- t.draw(
323
- this.chartRect,
324
- this.labelOffset,
325
- this.axesSteps.x[i],
326
- e,
327
- this.defaultSelectInfo,
328
- this.data.labels
329
- );
330
- }), this.axesY.forEach((t, i) => {
331
- t.draw(
332
- this.chartRect,
333
- this.labelOffset,
334
- this.axesSteps.y[i],
335
- e,
336
- this.defaultSelectInfo
337
- );
338
- });
339
- }
340
- /**
341
- * With each axis's min/max value and label information, calculate how many labels in each axis
342
- *
343
- * @returns {object} each axis's label steps in axes array
344
- */
345
- calculateSteps() {
346
- const e = this.axesX.map((i, s) => {
347
- const a = {
348
- minValue: this.axesRange.x[s].min,
349
- maxValue: this.axesRange.x[s].max,
350
- minIndex: this.axesRange.x[s].minIndex,
351
- maxIndex: this.axesRange.x[s].maxIndex,
352
- minSteps: this.labelRange.x[s].min,
353
- maxSteps: this.labelRange.x[s].max
354
- };
355
- return i.calculateSteps(a);
356
- }), t = this.axesY.map((i, s) => {
357
- const a = {
358
- minValue: this.axesRange.y[s].min,
359
- maxValue: this.axesRange.y[s].max,
360
- minIndex: this.axesRange.y[s].minIndex,
361
- maxIndex: this.axesRange.y[s].maxIndex,
362
- minSteps: this.labelRange.y[s].min,
363
- maxSteps: this.labelRange.y[s].max
364
- };
365
- return i.calculateSteps(a);
366
- });
367
- return { x: e, y: t };
368
- }
369
- /**
370
- * Calculate axis's min/max label steps
371
- *
372
- * @returns {object} axes's label range
373
- */
374
- getAxesLabelRange() {
375
- const e = this.axesX.map((i, s) => {
376
- const a = this.axesRange.x[s].size;
377
- return i.calculateLabelRange("x", this.chartRect, this.labelOffset, a.width);
378
- }), t = this.axesY.map((i, s) => {
379
- const a = this.axesRange.y[s].size;
380
- return i.calculateLabelRange("y", this.chartRect, this.labelOffset, a.height);
381
- });
382
- return { x: e, y: t };
383
- }
384
- /**
385
- * Reset devicePixelRatio for high DPI
386
- *
387
- * @returns {undefined}
388
- */
389
- initScale() {
390
- const e = window.devicePixelRatio || 1, t = this.displayCtx.webkitBackingStorePixelRatio || this.displayCtx.mozBackingStorePixelRatio || this.displayCtx.msBackingStorePixelRatio || this.displayCtx.oBackingStorePixelRatio || this.displayCtx.backingStorePixelRatio || 1;
391
- this.pixelRatio = e / t, this.oldPixelRatio !== this.pixelRatio && (this.oldPixelRatio = this.pixelRatio), this.bufferCtx.scale(this.pixelRatio, this.pixelRatio), this.overlayCtx && this.overlayCtx.scale(this.pixelRatio, this.pixelRatio);
392
- }
393
- /**
394
- * Get chart DOM size and set canvas size
395
- * @typedef {import('./model/index').ChartDOMSize} ChartDOMSize
396
- *
397
- * @returns {ChartDOMSize} chart size information
398
- */
399
- getChartDOMRect() {
400
- var s;
401
- const e = (s = this.chartDOM) == null ? void 0 : s.getBoundingClientRect(), t = (e == null ? void 0 : e.width) || 10, i = (e == null ? void 0 : e.height) || 10;
402
- return this.setWidth(t), this.setHeight(i), { width: t, height: i };
403
- }
404
- /**
405
- * Calculate chart size
406
- * @typedef {import('./model/index').ChartRect} ChartRect
407
- *
408
- * @returns {ChartRect} chart size information
409
- */
410
- getChartRect() {
411
- var S, b, R, w;
412
- const { width: e, height: t } = this.getChartDOMRect(), i = this.options.padding, s = (b = (S = this.options.axesX) == null ? void 0 : S[0]) == null ? void 0 : b.title, a = (w = (R = this.options.axesY) == null ? void 0 : R[0]) == null ? void 0 : w.title, r = 10;
413
- let h = 0;
414
- s != null && s.use && (s != null && s.text) && (h = (isNaN(s == null ? void 0 : s.fontSize) ? 12 : s == null ? void 0 : s.fontSize) + r);
415
- let o = 0;
416
- a != null && a.use && (a != null && a.text) && (o = (isNaN(a == null ? void 0 : a.fontSize) ? 12 : a == null ? void 0 : a.fontSize) + r);
417
- const n = this.scrollbar.x, l = this.scrollbar.y;
418
- let c = 0;
419
- n != null && n.use && (c = n == null ? void 0 : n.height);
420
- let d = 0;
421
- l != null && l.use && (d = l == null ? void 0 : l.width);
422
- const g = i.left + i.right + d, u = i.top + i.bottom + h + o + c, x = e > g ? e - g : e, m = t > u ? t - u : t, v = i.left, f = Math.max(e - i.right - d, v + 2), y = i.top + o, p = Math.max(t - i.bottom - h - c, y + 2);
423
- return {
424
- x1: v,
425
- x2: f,
426
- y1: y,
427
- y2: p,
428
- chartWidth: x,
429
- chartHeight: m,
430
- width: e,
431
- height: t
432
- };
433
- }
434
- /**
435
- * Set canvas width
436
- * @param {number} width canvas width from chartDOM.width
437
- *
438
- * @returns {undefined}
439
- */
440
- setWidth(e) {
441
- this.displayCanvas && (this.displayCanvas.width = e * this.pixelRatio, this.displayCanvas.style.width = `${e}px`, this.bufferCanvas.width = e * this.pixelRatio, this.bufferCanvas.style.width = `${e}px`, this.overlayCanvas && (this.overlayCanvas.width = e * this.pixelRatio, this.overlayCanvas.style.width = `${e}px`));
442
- }
443
- /**
444
- * Set canvas height
445
- * @param {number} height canvas width from chartDOM.height
446
- *
447
- * @returns {undefined}
448
- */
449
- setHeight(e) {
450
- this.displayCanvas && (this.displayCanvas.height = e * this.pixelRatio, this.displayCanvas.style.height = `${e}px`, this.bufferCanvas.height = e * this.pixelRatio, this.bufferCanvas.style.height = `${e}px`, this.overlayCanvas && (this.overlayCanvas.height = e * this.pixelRatio, this.overlayCanvas.style.height = `${e}px`));
451
- }
452
- /**
453
- * Calculate labels offset from chart rect (Axis 영역을 벗어나는 label 크기 계산)
454
- *
455
- * ex)
456
- * Y축 label의 넓이와 (X축 최소값 label 넓이 / 2) 중 넓은 값이 left label offset으로 처리됨
457
- *
458
- * 0 |
459
- * |
460
- * |
461
- * 0 ----------------------
462
- * hh:mm hh:mm
463
- *
464
- * @param {object} adjustedRange
465
- * {
466
- * min: number, max: number, minLabel: string, maxLabel: string,
467
- * size: {width: number, height: number}
468
- * }
469
- * minLabel and maxLabel is formatted label
470
- * @returns {object} label offset for edge
471
- */
472
- getLabelOffset(e = null) {
473
- const t = this.axesX, i = this.axesY, s = e ?? this.axesRange, a = { top: 2, left: 2, right: 2, bottom: 2 }, r = { width: 14, height: 4 };
474
- let h = 0, o = 0;
475
- return t.forEach((n, l) => {
476
- var c;
477
- (c = n.labelStyle) != null && c.show && (h = s.x[l].size.width + r.width, o = s.x[l].size.height + r.height, n.position === "bottom" ? o > a.bottom && (a.bottom = o) : n.position === "top" && o > a.top && (a.top = o), a.left = h / 2 > a.left ? h / 2 : a.left, a.right = h / 2 > a.right ? h / 2 : a.right);
478
- }), i.forEach((n, l) => {
479
- var c;
480
- (c = n.labelStyle) != null && c.show && (h = s.y[l].size.width + r.width, n.position === "left" ? h > a.left && (a.left = h) : n.position === "right" && h > a.right && (a.right = h), a.top = o / 2 > a.top ? o / 2 : a.top, a.bottom = o / 2 > a.bottom ? o / 2 : a.bottom);
481
- }), a;
482
- }
483
- /**
484
- * To re-render chart, reset properties, canvas and then render chart.
485
- * @param {object} updateInfo information for each components are needed to update
486
- *
487
- * @returns {undefined}
488
- */
489
- update(e) {
490
- var m, v, f, y, p, S, b;
491
- const t = this.options, i = this.data.data, s = this.data.labels, a = this.data.groups, r = this.data.series, {
492
- updateSeries: h,
493
- updateSelTip: o,
494
- updateLegend: n,
495
- updateData: l,
496
- updateTooltip: c,
497
- updateByScrollbar: d,
498
- lightUpdate: g
499
- } = e;
500
- if (!this.isInit)
501
- return;
502
- if (d && ((m = this.updateScrollbar) == null || m.call(this, l)), this.resetProps(), this.updateSeries = h, h && (this.seriesInfo = null, this.seriesList = null, this.lastTip = null, this.seriesInfo = {
503
- charts: {
504
- pie: [],
505
- bar: [],
506
- line: [],
507
- scatter: [],
508
- heatMap: []
509
- },
510
- count: 0
511
- }, this.seriesList = {}, this.lastTip = { pos: null, value: null }, this.createSeriesSet(r, t.type, t.horizontal, a), this.legendDOM && !t.legend.external && this.updateLegend()), o.update && (this.lastTip.value = null, o.keepDomain || (this.lastTip.pos = null, this.lastHitInfo = null)), !g)
512
- if (a.length && this.addGroupInfo(a), (v = this.options.realTimeScatter) != null && v.use ? (this.dataSet || (this.dataSet = {}), this.createRealTimeScatterDataSet(i)) : this.createDataSet(i, s), t.title.show ? (this.isInitTitle ? this.updateTitle() : this.initTitle(), this.showTitle()) : this.isInitTitle && this.hideTitle(), t.legend.show && !t.legend.external) {
513
- const R = !!((y = (f = t.legend) == null ? void 0 : f.table) != null && y.use) && t.type !== "heatMap" && t.type !== "scatter";
514
- this.isInitLegend ? h ? this.updateLegend() : n ? this.forceUpdateLegend() : R && l && this.updateLegendTableValues() : this.initLegend(), this.setLegendPosition(), this.updateLegendContainerSize(), this.showLegend();
515
- } else t.legend.show && t.legend.external ? (h || l) && (this._updateSeriesCount(), this.emitLegendData()) : this.isInitLegend && this.hideLegend();
516
- c && (this.isInitTooltip || this.createTooltipDOM(), this.tooltipDOM.innerHTML = "", (S = (p = t.tooltip) == null ? void 0 : p.formatter) != null && S.html || this.setDefaultTooltipLayout()), this.minMax = this.getStoreMinMax(), this.axesX = this.createAxes("x", t.axesX), this.axesY = this.createAxes("y", t.axesY), this.initDefaultSelectInfo();
517
- let u = e == null ? void 0 : e.hitInfo;
518
- !(u != null && u.legend) && ((b = this.legendHover) != null && b.sId) && (u = { ...u || {}, legend: this.legendHover }), this.render(u), this.dragInfo && this.drawSelectionArea ? this.drawSelectionArea(this.dragInfo) : this.dragInfoBackup && (this.dragInfoBackup = null);
519
- }
520
- /**
521
- * To re-render chart, reset properties
522
- *
523
- * @returns {undefined}
524
- */
525
- resetProps() {
526
- this.axesX[0] = null, this.axesY[0] = null, this.axesX = null, this.axesY = null, this.minMax = null, this.axesRange = null, this.labelOffset = null, this.chartRect = null;
527
- }
528
- /**
529
- * Clear overlay canvas
530
- *
531
- * @returns {undefined}
532
- */
533
- overlayClear() {
534
- this.clearRectRatio = this.pixelRatio < 1 ? this.pixelRatio : 1, this.overlayCtx.clearRect(
535
- 0,
536
- 0,
537
- this.overlayCanvas.width / this.clearRectRatio,
538
- this.overlayCanvas.height / this.clearRectRatio
539
- );
540
- }
541
- /**
542
- * Clear display and buffer canvas
543
- *
544
- * @returns {undefined}
545
- */
546
- clear() {
547
- this.clearRectRatio = this.pixelRatio < 1 ? this.pixelRatio : 1, this.displayCanvas && this.displayCtx.clearRect(
548
- 0,
549
- 0,
550
- this.displayCanvas.width / this.clearRectRatio,
551
- this.displayCanvas.height / this.clearRectRatio
552
- ), this.bufferCanvas && this.bufferCtx.clearRect(
553
- 0,
554
- 0,
555
- this.bufferCanvas.width / this.clearRectRatio,
556
- this.bufferCanvas.height / this.clearRectRatio
557
- ), this.overlayCanvas && this.overlayCtx.clearRect(
558
- 0,
559
- 0,
560
- this.overlayCanvas.width / this.clearRectRatio,
561
- this.overlayCanvas.height / this.clearRectRatio
562
- );
563
- }
564
- /**
565
- * Resize chart
566
- * @param {Function} promiseRes After evChart resize completes,
567
- * callback completion status with promiseRes to draw a Brush over it.
568
- *
569
- * @returns {undefined}
570
- */
571
- resize(e) {
572
- var t, i, s;
573
- (t = this.scrollbar) != null && t.x && delete this.scrollbar.x.savedPosition, (i = this.scrollbar) != null && i.y && delete this.scrollbar.y.savedPosition, this.clear(), this.bufferCtx.restore(), this.bufferCtx.save(), this.initRect(), this.initScale(), this.chartRect = this.getChartRect(), this.drawChart(), this.dragInfoBackup && ((s = this.drawSelectionArea) == null || s.call(this, this.dragInfoBackup)), e && e(!0);
574
- }
575
- /**
576
- * Render chart
577
- * @param {any} [hitInfo=undefined] hit item from mouse click/dblclick
578
- *
579
- * @returns {undefined}
580
- */
581
- render(e) {
582
- this.isInit && (this.clear(), this.chartRect = this.getChartRect(), this.drawChart(e));
583
- }
584
- /**
585
- * Get legend series list respecting group order
586
- *
587
- * @returns {Array} array of [sId, series] pairs
588
- */
589
- _getLegendSeries() {
590
- var t;
591
- const e = (t = this.data.groups) == null ? void 0 : t.at(0);
592
- return e ? e.filter((i) => {
593
- var s;
594
- return (s = this.seriesList[i]) == null ? void 0 : s.showLegend;
595
- }).map((i) => [i, this.seriesList[i]]) : Object.entries(this.seriesList).filter(([, i]) => i.showLegend);
596
- }
597
- /**
598
- * Convert series object to plain legend item
599
- *
600
- * @param {object} series series object
601
- * @returns {object} legend item
602
- */
603
- _seriesToLegendItem(e) {
604
- const t = typeof e.color != "string" ? e.color[e.color.length - 1][1] : e.color;
605
- return {
606
- sId: e.sId,
607
- name: e.name,
608
- color: t,
609
- type: e.type,
610
- show: e.show,
611
- fill: e.fill,
612
- fillColor: e.fillColor
613
- };
614
- }
615
- /**
616
- * Build legend data array from current seriesList
617
- *
618
- * @returns {Array} legend items
619
- */
620
- buildLegendData() {
621
- return this._getLegendSeries().map(([, e]) => this._seriesToLegendItem(e));
622
- }
623
- /**
624
- * Emit legend data through listeners
625
- *
626
- * @returns {undefined}
627
- */
628
- emitLegendData() {
629
- typeof this.listeners["update:legendData"] == "function" && this.listeners["update:legendData"](this.buildLegendData());
630
- }
631
- /**
632
- * Toggle series visibility (for external legend)
633
- *
634
- * @param {string} sId series ID to toggle
635
- * @returns {undefined}
636
- */
637
- toggleSeries(e) {
638
- var n;
639
- const t = this.seriesList[e];
640
- if (!t)
641
- return;
642
- const i = this.options.legend, s = this._getLegendSeries();
643
- if (i.clickMode === "active")
644
- s.every(([, d]) => d.show) ? (s.forEach(([, d]) => {
645
- d.show = !1;
646
- }), t.show = !0, this.seriesInfo.count = 1) : t.show ? (t.show = !1, this.seriesInfo.count--) : (t.show = !0, this.seriesInfo.count++), s.every(([, d]) => !d.show) && (s.forEach(([, d]) => {
647
- d.show = !0;
648
- }), this.seriesInfo.count = s.length);
649
- else {
650
- if (t.show && this.seriesInfo.count === 1)
651
- return;
652
- t.show ? (t.show = !1, this.seriesInfo.count--) : (t.show = !0, this.seriesInfo.count++);
653
- }
654
- if (this.brushSeries) {
655
- const { chartIdx: l } = this.data, c = [...this.brushSeries.list];
656
- c[l] = this.seriesList, this.brushSeries.list = c, this.brushSeries.chartIdx = l;
657
- }
658
- ((n = this.options.eventBehavior) == null ? void 0 : n.legendClick) !== "emitOnly" && this.update({
659
- updateSeries: !1,
660
- updateSelTip: { update: !0, keepDomain: !0 }
661
- });
662
- const r = Object.values(this.seriesList).filter((l) => l.show).map((l) => l.sId), h = r.length === Object.values(this.seriesList).length, o = {
663
- data: {
664
- seriesIds: h ? [] : r,
665
- isActiveAll: h
666
- }
667
- };
668
- typeof this.listeners["click-legend"] == "function" && this.listeners["click-legend"](o), this.options.legend.show && this.options.legend.external && this.emitLegendData();
669
- }
670
- /**
671
- * Highlight a series (for external legend hover)
672
- *
673
- * @param {string} sId series ID to highlight
674
- * @returns {undefined}
675
- */
676
- highlightSeries(e) {
677
- const t = { sId: e, type: this.options.type };
678
- this.legendHover = t, this.update({
679
- updateSeries: !1,
680
- updateSelTip: { update: !1, keepDomain: !1 },
681
- hitInfo: {
682
- legend: t
683
- },
684
- lightUpdate: !0
685
- });
686
- }
687
- /**
688
- * Remove series highlight (for external legend mouse leave)
689
- *
690
- * @returns {undefined}
691
- */
692
- unhighlightSeries() {
693
- this.legendHover = null, this.update({
694
- updateSeries: !1,
695
- updateSelTip: { update: !1, keepDomain: !1 },
696
- hitInfo: {
697
- legend: null
698
- },
699
- lightUpdate: !0
700
- });
701
- }
702
- /**
703
- * destroy chart component
704
- *
705
- * @returns {undefined}
706
- */
707
- destroy() {
708
- if (!this.isInit)
709
- return;
710
- const e = this.target;
711
- for (this.options.legend.show && !this.options.legend.external && (this.legendBoxDOM && (this.legendBoxDOM.removeEventListener("click", this.onLegendBoxClick), this.legendBoxDOM.removeEventListener("mouseover", this.onLegendBoxOver), this.legendBoxDOM.removeEventListener("mouseleave", this.onLegendBoxLeave), this.options.legend.type === "gradient" && this.legendBoxDOM.removeEventListener("mousedown", this.onLegendMouseDown), this.options.legend.virtualScroll && !this.useTable && (this.legendBoxDOM.removeEventListener("resize", this.updateVisibleRowCount), this.legendBoxDOM.removeEventListener("scroll", this.renderVisibleLegends))), this.resizeDOM && this.resizeDOM.removeEventListener("mousedown", this.onResizeMouseDown)), this.overlayCanvas && (this.overlayCanvas.removeEventListener("mousemove", this.onMouseMove), this.overlayCanvas.removeEventListener("mouseleave", this.onMouseLeave), this.overlayCanvas.removeEventListener("dblclick", this.onDblClick), this.overlayCanvas.removeEventListener("click", this.onClick), this.overlayCanvas.removeEventListener("mousedown", this.onMouseDown), this.overlayCanvas.removeEventListener("wheel", this.onWheel), window.removeEventListener("click", this.dragTouchSelectionEvent)), this.isInitTooltip && this.tooltipDestroy(), this.renderVisibleLegendsFrameId != null && (cancelAnimationFrame(this.renderVisibleLegendsFrameId), this.renderVisibleLegendsFrameId = null), this.updateVisibleRowCountFrameId != null && (cancelAnimationFrame(this.updateVisibleRowCountFrameId), this.updateVisibleRowCountFrameId = null), this.wrapperDOM = null, this.chartDOM = null, this.legendDOM = null, this.legendBoxDOM = null, this.resizeDOM = null, this.ghostDOM = null, this.titleDOM = null, this.displayCanvas = null, this.bufferCanvas = null, this.overlayCanvas = null; e.hasChildNodes(); )
712
- e.removeChild(e.firstChild);
713
- }
714
- /**
715
- * hide chart tooltip
716
- *
717
- * @returns {undefined}
718
- */
719
- hideTooltip() {
720
- var e;
721
- this.options.tooltip.use && ((e = this.tooltipDOM) != null && e.style) && (this.tooltipDOM.style.display = "none");
722
- }
723
- /**
724
- * init defaultSelectInfo (for selectLabel, selectSeries options)
725
- */
726
- initDefaultSelectInfo() {
727
- var s, a;
728
- const { type: e, selectLabel: t, selectSeries: i } = this.options;
729
- if (t.use) {
730
- let r = null;
731
- e === "heatMap" && (t != null && t.useBothAxis) && (r = (s = this.defaultSelectInfo) == null ? void 0 : s.targetAxis), this.defaultSelectInfo = (a = this.defaultSelectInfo) != null && a.dataIndex ? this.getSelectedLabelInfoWithLabelData(this.defaultSelectInfo.dataIndex, r) : { dataIndex: [], label: [], data: [] };
732
- }
733
- i.use && !this.defaultSelectInfo && (this.defaultSelectInfo = { seriesId: [] });
734
- }
735
- }
736
- export {
737
- ie as default
738
- };