evui 3.5.0 → 3.5.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 (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,508 +0,0 @@
1
- import { inRange as $ } from "lodash-es";
2
- import { convertToPercent as ot } from "../../../common/utils.js";
3
- import it from "../../../common/utils.debounce.js";
4
- import z from "../helpers/helpers.canvas.js";
5
- import R from "../helpers/helpers.util.js";
6
- const A = 8, B = 50, X = 17, st = 8, dt = {
7
- /**
8
- * Create tooltip DOM
9
- *
10
- * @returns {undefined}
11
- */
12
- createTooltipDOM() {
13
- var e, o;
14
- this.tooltipDOM = document.createElement("div"), this.tooltipDOM.className = "ev-chart-tooltip", this.tooltipHeaderDOM = document.createElement("div"), this.tooltipHeaderDOM.className = "ev-chart-tooltip-header", this.tooltipBodyDOM = document.createElement("div"), this.tooltipBodyDOM.className = "ev-chart-tooltip-body", this.tooltipCanvas = document.createElement("canvas"), this.tooltipCanvas.className = "ev-chart-tooltip-canvas", this.tooltipCtx = this.tooltipCanvas.getContext("2d"), this.tooltipDOM.style.display = "none", (o = (e = this.options.tooltip) == null ? void 0 : e.formatter) != null && o.html || this.setDefaultTooltipLayout(), document.body.appendChild(this.tooltipDOM), this.options.tooltip.debouncedHide ? this.hideTooltipDOM = it(() => {
15
- this.tooltipDOM.style.display = "none";
16
- }, 200) : this.hideTooltipDOM = () => {
17
- this.tooltipDOM.style.display = "none";
18
- }, this.isInitTooltip = !0;
19
- },
20
- setDefaultTooltipLayout() {
21
- this.tooltipBodyDOM.appendChild(this.tooltipCanvas), this.tooltipDOM.appendChild(this.tooltipHeaderDOM), this.tooltipDOM.appendChild(this.tooltipBodyDOM);
22
- },
23
- /**
24
- * get Tooltip's font style by Type ('title' | 'contents')
25
- * @param {string} type 'title' | 'contents'
26
- * @returns {string}
27
- */
28
- getFontStyle(e) {
29
- var l, a;
30
- const o = (l = this.options) == null ? void 0 : l.tooltip, t = ((a = o == null ? void 0 : o.fontSize) == null ? void 0 : a[e]) ?? 14, s = (o == null ? void 0 : o.fontFamily) ?? "Roboto";
31
- return `normal normal lighter ${Math.max(t, 0)}px ${s}`;
32
- },
33
- getTextHeight() {
34
- var e, o, t;
35
- return (((t = (o = (e = this.options) == null ? void 0 : e.tooltip) == null ? void 0 : o.fontSize) == null ? void 0 : t.contents) ?? 14) + 6;
36
- },
37
- getColorMargin() {
38
- var e, o, t;
39
- return (((t = (o = (e = this.options) == null ? void 0 : e.tooltip) == null ? void 0 : o.fontSize) == null ? void 0 : t.contents) ?? 14) + 2;
40
- },
41
- getBoxPadding() {
42
- var l, a;
43
- const { top: e = 0, right: o = 20, bottom: t = 3, left: s = 16 } = ((a = (l = this.options) == null ? void 0 : l.tooltip) == null ? void 0 : a.rowPadding) ?? {};
44
- return {
45
- t: e,
46
- l: s,
47
- b: t,
48
- r: o
49
- };
50
- },
51
- /**
52
- * Set tooltip DOM's position and style
53
- * @param {object} hitInfo value and mouse position touched
54
- * @param {object} e mousemove callback
55
- *
56
- * @returns {object} tooltip layout information
57
- */
58
- setTooltipLayoutPosition(e, o) {
59
- var j, N, _, I, V, G, K;
60
- const t = this.tooltipCtx, s = o.pageX, l = o.pageY, a = e.items, [n, r] = e.maxTip, m = Object.keys(a).length, h = this.getBoxPadding(), p = this.options.tooltip, y = this.getColorMargin(), f = e.hitId, d = a[f].data, c = a[f].axis, M = (j = p.formatter) == null ? void 0 : j.title;
61
- this.axesX.length && this.axesY.length && p.showHeader && (M ? this.tooltipHeaderDOM.textContent = M({
62
- x: d.x,
63
- y: d.y
64
- }) : this.tooltipHeaderDOM.textContent = this.options.horizontal ? this.axesY[c.y].getLabelFormat(d.y) : this.axesX[c.x].getLabelFormat(d.x)), p.textOverflow && this.tooltipHeaderDOM.classList.add(`ev-chart-tooltip-header--${p.textOverflow}`), this.tooltipHeaderDOM.style.visibility = "hidden", t.save(), t.font = this.getFontStyle("contents");
65
- const u = !!this.options.horizontal ? (_ = (N = a[e.hitId]) == null ? void 0 : N.data) == null ? void 0 : _.y : (V = (I = a[e.hitId]) == null ? void 0 : I.data) == null ? void 0 : V.x, H = (u == null ? void 0 : u.length) > n.length ? u : n, C = Math.round(t.measureText(H).width), v = Math.round(t.measureText(r).width), P = C + v + h.l + h.r + y + B + X, D = P > p.maxWidth ? p.maxWidth : P;
66
- let O = p.textOverflow === "wrap" ? 0 : m;
67
- if (p.textOverflow === "wrap") {
68
- const U = p.maxWidth - (Math.round(t.measureText(r).width) + h.l + h.r + y + B + X);
69
- Object.values(a).map((W) => W.name).forEach((W) => {
70
- if (t.measureText(W).width > U) {
71
- let L = "";
72
- for (let E = 0; E < W.length; E++) {
73
- const q = W[E], J = `${L}${q}`;
74
- t.measureText(J).width > U ? (L = q, O += 1) : L = J;
75
- }
76
- }
77
- O += 1;
78
- }), t.restore();
79
- }
80
- const b = h.t + O * this.getTextHeight() + m * A + h.b;
81
- let T;
82
- p.useScrollbar && b > p.maxHeight ? (this.tooltipBodyDOM.style.overflowY = "auto", T = p.maxHeight) : (this.tooltipBodyDOM.style.overflowY = "hidden", T = b), this.tooltipCanvas.width = D * this.pixelRatio, this.tooltipCanvas.height = b * this.pixelRatio, this.tooltipCanvas.style.width = `${D}px`, this.tooltipCanvas.style.height = `${b}px`, this.tooltipHeaderDOM.style.width = `${D}px`, this.tooltipHeaderDOM.style.height = "auto", this.tooltipDOM.style.height = "auto", this.tooltipBodyDOM.style.height = `${T + 6}px`, this.tooltipDOM.style.display = "block";
83
- const w = document.body.clientWidth, g = document.body.clientHeight, S = 20, Y = ((G = this.tooltipDOM) == null ? void 0 : G.offsetHeight) || ((K = this.tooltipHeaderDOM) == null ? void 0 : K.offsetHeight) + T + st, Q = w - D - S, Z = g - Y - S, F = s + S, k = l + S, tt = s - D - S, et = l - Y - S;
84
- this.tooltipDOM.style.left = F > Q ? `${tt}px` : `${F}px`, this.tooltipDOM.style.top = k > Z ? `${et}px` : `${k}px`;
85
- },
86
- /**
87
- * Draw series color shape
88
- * @param {object} context tooltip canvas context
89
- * @param {string} shape // 'circle' | 'rect' (default)
90
- * @param {object} centerPosition // {x: number, y: number}
91
- */
92
- drawSeriesColorShape(e, o, t) {
93
- var n, r;
94
- const s = (r = (n = this.options.tooltip) == null ? void 0 : n.fontSize) == null ? void 0 : r.contents, { x: l, y: a } = t;
95
- if (o === "circle") {
96
- e.beginPath();
97
- const i = s / 2;
98
- e.arc(l, a - i / 2, i, 0, 2 * Math.PI), e.fill();
99
- } else {
100
- const i = s;
101
- e.fillRect(l - i / 3, a - i / 1.2, i, i);
102
- }
103
- },
104
- /**
105
- * Draw tooltip canvas
106
- * @param {object} hitInfo mousemove callback
107
- * @param {object} context tooltip canvas context
108
- *
109
- * @returns {undefined}
110
- */
111
- drawTooltip(e, o) {
112
- const t = o, s = e.items, [, l] = e.maxTip, a = this.alignSeriesList(Object.keys(s)), n = this.getBoxPadding(), r = this.options.horizontal, i = this.options.tooltip, m = this.getTextHeight(), h = this.getColorMargin();
113
- this.axesX.length && this.axesY.length && i.showHeader ? this.tooltipHeaderDOM.style.visibility = "visible" : this.tooltipHeaderDOM.style.display = "none";
114
- let p = 2, y = 2;
115
- p += R.aliasPixel(p), y += R.aliasPixel(y), t.save(), t.scale(this.pixelRatio, this.pixelRatio), this.tooltipBodyDOM.style.overflowY === "auto" && (n.r += X), p += n.l, y += n.t, t.font = this.getFontStyle("contents");
116
- const f = [];
117
- a.forEach((c) => {
118
- f.push({
119
- id: c,
120
- data: s[c].data,
121
- color: s[c].color,
122
- name: s[c].name,
123
- dataId: s[c].id
124
- });
125
- }), i.sortByValue && f.sort((c, M) => {
126
- let x = c.data.o, u = M.data.o;
127
- return x == null && (x = r ? c.data.x : c.data.y), u == null && (u = r ? M.data.x : M.data.y), u - x;
128
- }), this.setTooltipDOMStyle(i);
129
- let d = 1;
130
- for (let c = 0; c < f.length; c++) {
131
- const M = f[c].data, x = f[c].color, u = f[c].name, H = M.formatted;
132
- let C = p + 4, v = y + d * m;
133
- C += R.aliasPixel(C), v += R.aliasPixel(v), t.beginPath(), typeof x != "string" ? t.fillStyle = z.createGradient(
134
- t,
135
- r,
136
- { x: C - 4, y: v, w: 12, h: -12 },
137
- x
138
- ) : t.fillStyle = x;
139
- const P = {
140
- id: f[c].id,
141
- name: f[c].name,
142
- value: H,
143
- dataId: f[c].dataId
144
- };
145
- this.drawSeriesColorShape(t, i.colorShape, { x: C, y: v }), t.fillStyle = typeof i.fontColor.label == "function" ? i.fontColor.label(P) : i.fontColor.label ?? i.fontColor;
146
- const D = i.maxWidth - Math.round(t.measureText(l).width) - n.l - n.r - h - B, O = C + h, b = v;
147
- if (D > t.measureText(u).width)
148
- t.fillText(u, O, b);
149
- else if (i.textOverflow === "wrap") {
150
- let T = "", w = b;
151
- for (let g = 0; g < u.length; g++) {
152
- const S = u[g], Y = `${T}${S}`;
153
- t.measureText(Y).width > D ? (t.fillText(T, O, w), T = S, d += 1, w += m) : T = Y;
154
- }
155
- t.fillText(T, O, w);
156
- } else {
157
- const T = R.truncateLabelWithEllipsis(u, D, t);
158
- t.fillText(T, O, b);
159
- }
160
- t.save(), t.fillStyle = typeof i.fontColor.value == "function" ? i.fontColor.value(P) : i.fontColor.value ?? i.fontColor, t.textAlign = "right", t.fillText(H, this.tooltipDOM.offsetWidth - n.r, v), t.restore(), t.closePath(), y += A, d += 1;
161
- }
162
- t.restore();
163
- },
164
- /**
165
- * Draw tooltip canvas for heatmap
166
- * @param {object} hitInfo mousemove callback
167
- * @param {object} context tooltip canvas context
168
- *
169
- * @returns {undefined}
170
- */
171
- drawToolTipForHeatMap(e, o) {
172
- const t = o, s = e.items, l = e.hitId, a = s[l].data, n = s[l].axis, r = s[l].color, i = this.getBoxPadding(), m = this.options.horizontal, h = this.options.tooltip, p = Object.values(this.seriesList)[0], y = this.getTextHeight(), f = this.getColorMargin();
173
- let d = !1, c = a.formatted;
174
- const { colorState: M, isGradient: x } = p;
175
- if (x) {
176
- const { min: v, max: P } = p.valueOpt, D = ot(a.o - v, P - v), { start: O, end: b } = M[0];
177
- d = O <= D && D <= b || a.o === -1;
178
- } else {
179
- const v = M.find(({ id: P }) => P === a.cId);
180
- d = v == null ? void 0 : v.show, c = (v == null ? void 0 : v.label) ?? c;
181
- }
182
- if (!d) {
183
- this.tooltipClear();
184
- return;
185
- }
186
- this.axesX.length && this.axesY.length && h.showHeader ? this.tooltipHeaderDOM.style.visibility = "visible" : this.tooltipHeaderDOM.style.display = "none", this.setTooltipDOMStyle(h), t.save(), t.scale(this.pixelRatio, this.pixelRatio), this.tooltipBodyDOM.style.overflowY === "auto" && (i.r += X);
187
- const u = i.l + 2, H = i.t + y + 2;
188
- t.font = this.getFontStyle("contents"), t.beginPath(), typeof r != "string" ? t.fillStyle = z.createGradient(
189
- t,
190
- m,
191
- { x: u, y: H, w: 12, h: -12 },
192
- r
193
- ) : t.fillStyle = r;
194
- const C = {
195
- id: e.hitId,
196
- name: a.y,
197
- value: c,
198
- dataId: s[l].id
199
- };
200
- this.drawSeriesColorShape(t, h.colorShape, { x: u, y: H }), t.fillStyle = typeof h.fontColor.label == "function" ? h.fontColor.label(C) : h.fontColor.label ?? h.fontColor, this.axesY.length && t.fillText(
201
- this.axesY[n.y].getLabelFormat(a.y),
202
- u + f,
203
- H
204
- ), t.textAlign = "right", t.fillStyle = typeof h.fontColor.value == "function" ? h.fontColor.value(C) : h.fontColor.value ?? h.fontColor, t.fillText(c, this.tooltipDOM.offsetWidth - i.r, H), t.closePath();
205
- },
206
- /**
207
- *
208
- * @param hitInfo
209
- * @param context
210
- */
211
- drawTooltipForScatter(e, o) {
212
- const t = o, s = e.items, [, l] = e.maxTip, a = this.alignSeriesList(Object.keys(s)), n = this.getBoxPadding(), r = this.options.tooltip, i = this.getTextHeight(), m = this.getColorMargin();
213
- this.axesX.length && this.axesY.length && r.showHeader ? this.tooltipHeaderDOM.style.visibility = "visible" : this.tooltipHeaderDOM.style.display = "none";
214
- let h = 2, p = 2;
215
- h += R.aliasPixel(h), p += R.aliasPixel(p), t.save(), t.scale(this.pixelRatio, this.pixelRatio), this.tooltipBodyDOM.style.overflowY === "auto" && (n.r += X), h += n.l, p += n.t, t.font = this.getFontStyle("contents");
216
- const y = [];
217
- a.forEach((d) => {
218
- y.push({
219
- data: s[d].data,
220
- color: s[d].color,
221
- name: s[d].name
222
- });
223
- }), r.sortByValue && y.sort((d, c) => {
224
- let M = d.data.o, x = c.data.o;
225
- return M == null && (M = d.data.y), x == null && (x = c.data.y), x - M;
226
- }), this.setTooltipDOMStyle(r);
227
- let f = 1;
228
- for (let d = 0; d < y.length; d++) {
229
- const c = y[d].data, M = y[d].color, x = y[d].name, u = c.formatted;
230
- let H = h + 4, C = p + f * i;
231
- H += R.aliasPixel(H), C += R.aliasPixel(C), t.beginPath(), typeof M != "string" ? t.fillStyle = z.createGradient(
232
- t,
233
- !1,
234
- { x: H - 4, y: C, w: 12, h: -12 },
235
- M
236
- ) : t.fillStyle = M;
237
- const v = {
238
- id: e.hitId,
239
- name: y[d].name,
240
- value: u,
241
- dataId: y[d].dataId
242
- };
243
- this.drawSeriesColorShape(t, r.colorShape, { x: H, y: C }), t.fillStyle = typeof r.fontColor.label == "function" ? r.fontColor.label(v) : r.fontColor.label ?? r.fontColor;
244
- const P = r.maxWidth - Math.round(t.measureText(l).width) - n.l - n.r - m - B, D = H + m, O = C;
245
- if (P > t.measureText(x).width)
246
- t.fillText(x, D, O);
247
- else if (r.textOverflow === "wrap") {
248
- let b = "", T = O;
249
- for (let w = 0; w < x.length; w++) {
250
- const g = x[w], S = `${b}${g}`;
251
- t.measureText(S).width > P ? (t.fillText(b, D, T), b = g, f += 1, T += i) : b = S;
252
- }
253
- t.fillText(b, D, T);
254
- } else {
255
- const b = R.truncateLabelWithEllipsis(x, P, t);
256
- t.fillText(b, D, O);
257
- }
258
- t.save(), t.textAlign = "right", t.fillStyle = typeof r.fontColor.value == "function" ? r.fontColor.value(v) : r.fontColor.value ?? r.fontColor, t.fillText(u, this.tooltipDOM.offsetWidth - n.r, C), t.restore(), t.closePath(), p += A, f += 1;
259
- }
260
- t.restore();
261
- },
262
- setCustomTooltipLayoutPosition(e, o) {
263
- var x, u;
264
- const t = o.pageX, s = o.pageY, l = (x = this.tooltipDOM.getElementsByClassName("ev-chart-tooltip-custom")) == null ? void 0 : x[0];
265
- if (!l && !this.tooltipDOM)
266
- return;
267
- this.tooltipDOM.style.display = "block";
268
- const a = l.offsetWidth, n = l.offsetHeight;
269
- this.tooltipDOM.style.height = "auto", this.tooltipBodyDOM.style.height = `${n + 6}px`;
270
- const r = document.body.clientWidth, i = document.body.clientHeight, m = (u = this.tooltipDOM) == null ? void 0 : u.getBoundingClientRect(), h = 20, p = r - a - h, y = i - (m == null ? void 0 : m.height) - h, f = t + h, d = s + h, c = t - a - h, M = s - (m == null ? void 0 : m.height) - h;
271
- this.tooltipDOM.style.left = f > p ? `${c}px` : `${f}px`, this.tooltipDOM.style.top = d > y ? `${M}px` : `${d}px`;
272
- },
273
- /**
274
- * Draw User Custom Tooltip (tooltip > formatter > html)
275
- * call "formatter > html" and append to tooltip DOM
276
- * @param hitInfoItems
277
- */
278
- drawCustomTooltip(e) {
279
- var t, s, l, a;
280
- const o = (t = this.options) == null ? void 0 : t.tooltip;
281
- if ((s = o.formatter) != null && s.html) {
282
- this.tooltipDOM.innerHTML = "";
283
- const n = [];
284
- Object.keys(e).forEach((i) => {
285
- n.push({
286
- sId: i,
287
- data: e[i].data,
288
- color: e[i].color,
289
- name: e[i].name,
290
- dataId: e[i].id,
291
- index: e[i].index
292
- });
293
- });
294
- const r = R.htmlToElement((l = o == null ? void 0 : o.formatter) == null ? void 0 : l.html(n));
295
- r && this.tooltipDOM.appendChild(r), this.tooltipDOM.style.overflowY = "hidden", this.tooltipDOM.style.backgroundColor = o.backgroundColor, this.tooltipDOM.style.border = `1px solid ${o.borderColor}`, this.tooltipDOM.style.color = ((a = o.fontColor) == null ? void 0 : a.title) ?? o.fontColor;
296
- }
297
- },
298
- /**
299
- * set style properties on tooltip DOM
300
- * @param tooltipOptions
301
- */
302
- setTooltipDOMStyle(e) {
303
- var o;
304
- if (this.tooltipDOM.style.overflowY = "hidden", this.tooltipDOM.style.backgroundColor = e.backgroundColor, this.tooltipDOM.style.border = `1px solid ${e.borderColor}`, this.tooltipDOM.style.color = ((o = e.fontColor) == null ? void 0 : o.title) ?? e.fontColor, this.tooltipHeaderDOM.style.fontSize = `${e.fontSize.title}px`, this.tooltipHeaderDOM.style.fontFamily = this.getFontStyle("title"), e.useShadow) {
305
- const t = `rgba(0, 0, 0, ${e.shadowOpacity})`;
306
- this.tooltipDOM.style.boxShadow = `2px 2px 2px ${t}`;
307
- }
308
- this.tooltipDOM.style.display = "block";
309
- },
310
- /**
311
- * Draw graph item highlight
312
- * @param {object} hitInfo mousemove callback
313
- * @param {object} ctx overlayCanvas context
314
- *
315
- * @returns {undefined}
316
- */
317
- drawItemsHighlight(e, o) {
318
- Object.keys(e.items).forEach((t) => {
319
- var l;
320
- const s = this.seriesList[t];
321
- s.itemHighlight(
322
- e.items[t],
323
- o,
324
- e.items[t].index,
325
- (l = this.options) == null ? void 0 : l.unSelectedOpacity
326
- ), R.isDoughnutHole(s.type) && this.drawDoughnutHole(o);
327
- });
328
- },
329
- /**
330
- * Draw chart indicator with mousemove
331
- * @param {object} offset mousemove callback
332
- * @param {string} color indicator color
333
- *
334
- * @returns {undefined}
335
- */
336
- drawIndicator(e, o) {
337
- var m;
338
- const t = this.overlayCtx, [s, l] = e, a = {
339
- x1: this.chartRect.x1 + this.labelOffset.left,
340
- x2: this.chartRect.x2 - this.labelOffset.right,
341
- y1: this.chartRect.y1 + this.labelOffset.top,
342
- y2: this.chartRect.y2 - this.labelOffset.bottom
343
- }, n = 15, r = 15, i = this.options;
344
- s >= a.x1 - n && s <= a.x2 + n && l >= a.y1 - r && l <= a.y2 + r && (t.beginPath(), t.save(), t.strokeStyle = o, t.lineWidth = 1, (m = i.indicator) != null && m.segments && t.setLineDash(i.indicator.segments), i.horizontal ? (t.moveTo(a.x1, l + 0.5), t.lineTo(a.x2, l + 0.5)) : (t.moveTo(s + 0.5, a.y1), t.lineTo(s + 0.5, a.y2)), t.stroke(), t.restore(), t.closePath());
345
- },
346
- /**
347
- * Get hovered axis label with mousemove
348
- * @param {object} offset mousemove callback
349
- *
350
- * @returns {number | null} hovered axis label
351
- */
352
- getTimeLabel(e) {
353
- var h, p;
354
- const o = this.options;
355
- if (o.syncHover === !1 || !o.horizontal && !o.axesX.every(({ type: y }) => y === "time") || o.horizontal && !o.axesY.every(({ type: y }) => y === "time"))
356
- return null;
357
- const t = +((h = this.data.labels) == null ? void 0 : h[0]), s = +((p = this.data.labels) == null ? void 0 : p[this.data.labels.length - 1]);
358
- if (t == null || s == null)
359
- return null;
360
- const [l, a] = e, n = {
361
- x1: this.chartRect.x1 + this.labelOffset.left,
362
- x2: this.chartRect.x2 - this.labelOffset.right,
363
- y1: this.chartRect.y1 + this.labelOffset.top,
364
- y2: this.chartRect.y2 - this.labelOffset.bottom
365
- };
366
- if (o.horizontal) {
367
- const y = n.y2 - n.y1, d = (a - n.y1) * (s - t) / y + t;
368
- return Math.round(d);
369
- }
370
- const r = n.x2 - n.x1, m = (l - n.x1) * (s - t) / r + t;
371
- return Math.round(m);
372
- },
373
- /**
374
- * Draw chart indicator with other grouped chart's mousemove
375
- * @param {object} hoveredLabel chart direction and hovered axis label
376
- *
377
- * @returns {undefined}
378
- */
379
- drawSyncedIndicator({ horizontal: e, label: o, mousePosition: t, dataLabel: s }) {
380
- var d, c;
381
- if (!this._canDrawSyncedIndicator(e, t))
382
- return;
383
- if (s) {
384
- this.drawSyncedIndicatorForTooltip({ dataLabel: s, mousePosition: t });
385
- return;
386
- }
387
- const l = +((d = this.data.labels) == null ? void 0 : d[0]), a = +((c = this.data.labels) == null ? void 0 : c[this.data.labels.length - 1]), [n, r] = t, { top: i, bottom: m, left: h, right: p } = this.chartDOM.getBoundingClientRect();
388
- if ($(n, h, p) && $(r, m, i))
389
- return;
390
- this.overlayClear();
391
- const f = {
392
- x1: this.chartRect.x1 + this.labelOffset.left,
393
- x2: this.chartRect.x2 - this.labelOffset.right,
394
- y1: this.chartRect.y1 + this.labelOffset.top,
395
- y2: this.chartRect.y2 - this.labelOffset.bottom
396
- };
397
- if (e) {
398
- const x = (f.y2 - f.y1) * (o - l) / (a - l) + f.y1;
399
- this.drawIndicator([f.x2, x], this.options.indicator.color);
400
- } else {
401
- const x = (f.x2 - f.x1) * (o - l) / (a - l) + f.x1;
402
- this.drawIndicator([x, f.y2], this.options.indicator.color);
403
- }
404
- },
405
- _canDrawSyncedIndicator(e, o) {
406
- return !o || !!e != !!this.options.horizontal ? !1 : this._isTimeBasedSyncEnabled(e) && this._hasValidTimeRange();
407
- },
408
- _isTimeBasedSyncEnabled(e) {
409
- var t, s;
410
- return this.options.syncHover === !1 || !((s = (t = this.data) == null ? void 0 : t.labels) != null && s.length) ? !1 : e ? this.options.axesY.every(({ type: l }) => l === "time") : this.options.axesX.every(({ type: l }) => l === "time");
411
- },
412
- _hasValidTimeRange() {
413
- var t, s;
414
- const e = +((t = this.data.labels) == null ? void 0 : t[0]), o = +((s = this.data.labels) == null ? void 0 : s[this.data.labels.length - 1]);
415
- return e != null && o != null;
416
- },
417
- /**
418
- * 제공된 dataLabel과 일치하는 Label이 있다면 indicator를 그림
419
- * @param {object} dataLabel data label
420
- * @param {object} mousePosition mouse position
421
- *
422
- * @returns {undefined}
423
- */
424
- drawSyncedIndicatorForTooltip({ dataLabel: e, mousePosition: o }) {
425
- var p, y, f, d, c, M, x, u, H, C, v, P, D;
426
- if (!((p = this.data) != null && p.labels) || !e)
427
- return;
428
- const t = this.data.labels.findIndex(
429
- (O) => (O == null ? void 0 : O.valueOf()) === (e == null ? void 0 : e.valueOf())
430
- );
431
- if (t === -1) {
432
- this.overlayClear();
433
- return;
434
- }
435
- const { horizontal: s } = this.options, l = this.chartDOM.getBoundingClientRect(), [a, n] = o;
436
- if ($(a, l.left, l.right) && $(n, l.bottom, l.top))
437
- return;
438
- this.overlayClear();
439
- const i = {
440
- x1: this.chartRect.x1 + this.labelOffset.left,
441
- x2: this.chartRect.x2 - this.labelOffset.right,
442
- y1: this.chartRect.y1 + this.labelOffset.top,
443
- y2: this.chartRect.y2 - this.labelOffset.bottom
444
- }, m = this.data.labels.length;
445
- let h;
446
- if (s) {
447
- const O = i.y2 - i.y1, b = (y = this.options.axesY) == null ? void 0 : y.some((g) => g.categoryMode), T = (f = this.options.axesY) == null ? void 0 : f.some((g) => g.type === "time");
448
- let w;
449
- if (b)
450
- w = i.y1 + O * (t + 0.5) / m;
451
- else if (T) {
452
- const g = (c = (d = this.axesSteps) == null ? void 0 : d.y) == null ? void 0 : c[0], S = (g == null ? void 0 : g.graphMin) ?? +((M = this.data.labels) == null ? void 0 : M[0]), Y = (g == null ? void 0 : g.graphMax) ?? +((x = this.data.labels) == null ? void 0 : x[this.data.labels.length - 1]);
453
- w = i.y1 + O * (+e - S) / (Y - S);
454
- } else
455
- w = i.y1 + O * t / (m - 1);
456
- h = [i.x2, w];
457
- } else {
458
- const O = i.x2 - i.x1, b = (u = this.options.axesX) == null ? void 0 : u.some((g) => g.categoryMode), T = (H = this.options.axesX) == null ? void 0 : H.some((g) => g.type === "time");
459
- let w;
460
- if (b)
461
- w = i.x1 + O * (t + 0.5) / m;
462
- else if (T) {
463
- const g = (v = (C = this.axesSteps) == null ? void 0 : C.x) == null ? void 0 : v[0], S = (g == null ? void 0 : g.graphMin) ?? +((P = this.data.labels) == null ? void 0 : P[0]), Y = (g == null ? void 0 : g.graphMax) ?? +((D = this.data.labels) == null ? void 0 : D[this.data.labels.length - 1]);
464
- w = i.x1 + O * (+e - S) / (Y - S);
465
- } else
466
- w = i.x1 + O * t / (m - 1);
467
- h = [w, i.y2];
468
- }
469
- this.drawIndicator(h, this.options.indicator.color);
470
- },
471
- /**
472
- * Clear tooltip canvas
473
- *
474
- * @returns {undefined}
475
- */
476
- tooltipClear() {
477
- this.clearRectRatio = this.pixelRatio < 1 ? this.pixelRatio : 1, this.tooltipCtx.clearRect(
478
- 0,
479
- 0,
480
- this.tooltipCanvas.width / this.clearRectRatio,
481
- this.tooltipCanvas.height / this.clearRectRatio
482
- ), this.tooltipDOM.style.display = "none";
483
- },
484
- /**
485
- * Order series list by groups
486
- * @param {array} sKeys series list that is hit by mouse cursor. (not all of series)
487
- *
488
- * @returns {array} ordered series list by groups
489
- */
490
- alignSeriesList(e) {
491
- const o = this.data.groups, t = this.seriesList, s = [];
492
- return o.forEach((l) => {
493
- l.slice().reverse().forEach((a) => {
494
- const n = t[a];
495
- n && n.showLegend && e.includes(a) && s.push(a);
496
- });
497
- }), Object.keys(t).forEach((l) => {
498
- const a = t[l];
499
- !a.isExistGrp && a.showLegend && e.includes(l) && s.push(l);
500
- }), s;
501
- },
502
- tooltipDestroy() {
503
- this.tooltipDOM && (this.tooltipDOM.remove(), this.tooltipDOM = null), this.isInitTooltip = !1;
504
- }
505
- };
506
- export {
507
- dt as default
508
- };