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,73 +0,0 @@
1
- import { merge as p } from "lodash-es";
2
- import { PIE_OPTION as P, COLOR as y } from "../helpers/helpers.constant.js";
3
- import r from "../helpers/helpers.util.js";
4
- class Y {
5
- constructor(a, e, t) {
6
- const i = p({}, P, e);
7
- Object.keys(i).forEach((s) => {
8
- this[s] = i[s];
9
- }), this.name === void 0 && (this.name = `series-${t}`), this.color === void 0 && (this.color = y[t % y.length]), this.sId = a, this.show = !0, this.data = [], this.type = "pie", this.centerX = 0, this.centerY = 0, this.radius = 0, this.doughnutHoleSize = 0, this.startAngle = 0, this.endAngle = 0, this.ctx = null, this.isSelect = !1;
10
- }
11
- /**
12
- * Draw series data
13
- * @param context
14
- * @param strokeOptions
15
- * @param unSelectedOpacity
16
- *
17
- * @returns {undefined}
18
- */
19
- draw(a, e, t) {
20
- var o;
21
- const i = a ?? this.ctx, s = new Path2D(), h = this.isSelect ? this.radius + 5 : this.radius, n = this.color, l = n.includes("rgba") ? r.getOpacity(n) : 1, c = this.isDownplay ? t : l;
22
- i.beginPath(), s.moveTo(this.centerX, this.centerY), s.arc(this.centerX, this.centerY, h, this.startAngle, this.endAngle), s.lineTo(this.centerX, this.centerY), i.fillStyle = r.colorStringToRgba(n, c), i.fill(s), e.use && (i.lineCap = "round", i.lineWidth = e == null ? void 0 : e.lineWidth, i.strokeStyle = e == null ? void 0 : e.color, i.stroke(s)), (o = this.showValue) != null && o.use && this.drawValueLabels(i), i.closePath(), this.ctx = i;
23
- }
24
- /**
25
- * Find graph item
26
- * @param {array} offset mouse position
27
- *
28
- * @returns {object} graph item
29
- */
30
- findGraphData([a, e]) {
31
- const t = { data: null, hit: !1, color: null, index: -1 }, { radius: i, startAngle: s, endAngle: h, centerX: n, centerY: l } = this, c = Math.sqrt((a - n) ** 2 + (e - l) ** 2), o = 2.5 * Math.PI - Math.atan2(a - n, e - l), d = i > c && o >= s && o <= h;
32
- return this.show && d && (t.type = this.type, t.data = this.data, t.hit = !0, t.color = this.color, t.index = 0), t;
33
- }
34
- /**
35
- * Draw item highlight
36
- *
37
- * @param item {object} object for drawing series data
38
- * @param context {CanvasRenderingContext2D} canvas context
39
- *
40
- * @returns {undefined}
41
- */
42
- itemHighlight(a, e) {
43
- var h, n;
44
- const t = e, i = this.isSelect ? this.radius + 5 : this.radius;
45
- t.save(), t.shadowOffsetX = 0, t.shadowOffsetY = 0, t.shadowBlur = 4;
46
- const s = ((h = a == null ? void 0 : a.data) == null ? void 0 : h.dataColor) || this.color;
47
- t.fillStyle = s, t.shadowColor = s, t.beginPath(), t.moveTo(this.centerX, this.centerY), t.arc(this.centerX, this.centerY, i, this.startAngle, this.endAngle), t.lineTo(this.centerX, this.centerY), t.fill(), (n = this.showValue) != null && n.use && this.drawValueLabels(t), t.closePath(), t.restore();
48
- }
49
- /**
50
- * Draw value label if series 'use' of showValue option is true
51
- *
52
- * @param context canvas context
53
- */
54
- drawValueLabels(a) {
55
- const e = a, t = this.data.o, { fontSize: i, textColor: s, formatter: h } = this.showValue;
56
- let n;
57
- h && (n = h({
58
- value: t,
59
- percentage: this.data.percentage
60
- })), (!h || typeof n != "string") && (n = r.labelSignFormat(t));
61
- const l = 1.8, c = this.radius - this.doughnutHoleSize, o = (this.endAngle - this.startAngle) * 180 / Math.PI, d = i + 4, u = Math.round(e.measureText(n).width);
62
- if (o >= u * l && o >= d * l && c >= u * l && c >= d * l) {
63
- e.save(), e.beginPath();
64
- const w = s.includes("rgba") ? r.getOpacity(s) : 1, m = this.state === "downplay" ? this.unSelectedOpacity : w;
65
- e.font = `normal normal normal ${i}px Roboto`, e.fillStyle = r.colorStringToRgba(s, m), e.lineWidth = 1, e.textAlign = "center", e.textBaseline = "middle";
66
- const g = c / 2 + this.doughnutHoleSize, f = (this.endAngle - this.startAngle) / 2 + this.startAngle, x = g * Math.cos(f) + this.centerX, A = g * Math.sin(f) + this.centerY;
67
- e.fillText(n, x, A), e.restore();
68
- }
69
- }
70
- }
71
- export {
72
- Y as default
73
- };
@@ -1,209 +0,0 @@
1
- import { merge as F } from "lodash-es";
2
- import { LINE_OPTION as b, COLOR as v } from "../helpers/helpers.constant.js";
3
- import I from "../helpers/helpers.util.js";
4
- import S from "../helpers/helpers.canvas.js";
5
- class $ {
6
- constructor(e, l, s, t = !1) {
7
- const i = F({}, b, l);
8
- Object.keys(i).forEach((o) => {
9
- this[o] = i[o];
10
- }), this.name === void 0 && (this.name = `series-${s}`), ["color", "pointFill", "fillColor", "overflowColor"].forEach((o) => {
11
- this[o] === void 0 && (this[o] = v[s % v.length]);
12
- }), this.sId = e, this.data = [], this.type = "scatter", this.realTimeScatter = t, this._rtTotalCount = 0, this._colorCache = /* @__PURE__ */ new Map();
13
- }
14
- /**
15
- * Get cached color with opacity
16
- * colorStringToRgba cache the result of colorStringToRgba to avoid repeated calculations.
17
- * @param {string} colorStr - Color string
18
- * @param {number} opacity - Opacity value
19
- * @returns {string} rgba string
20
- */
21
- getCachedColor(e, l) {
22
- const s = `${e}_${l}`;
23
- if (this._colorCache.has(s))
24
- return this._colorCache.get(s);
25
- const t = I.colorStringToRgba(e, l);
26
- if (this._colorCache.size > 100) {
27
- const i = this._colorCache.keys().next().value;
28
- this._colorCache.delete(i);
29
- }
30
- return this._colorCache.set(s, t), t;
31
- }
32
- /**
33
- * Draw series data
34
- * @param {object} param object for drawing series data
35
- *
36
- * @returns {undefined}
37
- */
38
- draw(e) {
39
- this.show && (this.realTimeScatter ? this.realTimeScatterDraw(e) : this.defaultScatterDraw(e));
40
- }
41
- /**
42
- * Calculate opacity for a data item in the series.
43
- * @param {object} param - The parameter object passed to the draw function.
44
- * @param {string} colorStr - The color string of the item.
45
- * @param {number} dataIndex - The index of the item in the data array.
46
- *
47
- * @returns {number} - The calculated opacity level for the item.
48
- */
49
- getOpacity(e, l, s) {
50
- const t = l.includes("rgba") ? I.getOpacity(l) : 1;
51
- let i = !1;
52
- const { selectInfo: o, legendHitInfo: n, unSelectedOpacity: r } = e;
53
- return n ? i = n.sId !== this.sId : o && (i = (o == null ? void 0 : o.seriesID) !== this.sId || (o == null ? void 0 : o.dataIndex) !== s), i ? r : t;
54
- }
55
- /**
56
- * Calculate x and y coordinates for a data item in the series.
57
- * @param {object} item - The data item for which coordinates are to be calculated.
58
- * @param {object} param - The parameter object passed to the draw function.
59
- *
60
- * @returns {undefined}
61
- */
62
- calcItem(e, l) {
63
- const { chartRect: s, labelOffset: t, axesSteps: i, displayOverflow: o } = l;
64
- let n;
65
- const r = i.x[this.xAxisIndex], a = i.y[this.yAxisIndex], f = s.chartWidth - (t.left + t.right), d = s.chartHeight - (t.top + t.bottom), c = s.x1 + t.left, u = s.y2 - t.bottom;
66
- let h = S.calculateX(e.x, r.graphMin, r.graphMax, f, c);
67
- const p = S.calculateY(
68
- o && e.y > a.graphMax ? a.graphMax : e.y,
69
- a.graphMin,
70
- a.graphMax,
71
- d,
72
- u
73
- );
74
- h !== null && (n = I.aliasPixel(h), h += n), e.xp = h, e.yp = p;
75
- }
76
- /**
77
- * Draw default scatter chart
78
- * @param {object} param - The parameter object passed to the draw function.
79
- *
80
- * @returns {undefined}
81
- */
82
- defaultScatterDraw(e) {
83
- const { ctx: l, axesSteps: s, duple: t, legendHitInfo: i, coordinateDedupe: o } = e, n = s.y[this.yAxisIndex];
84
- for (let r = 0; r < this.data.length; r++) {
85
- const a = this.data[r], f = r, d = o !== !1;
86
- let c;
87
- if (i ? c = i.sId === this.sId : d ? c = t.get(`${a.x}${a.y}`) === this.sId : c = !0, c && (this.calcItem(a, e), a.xp !== null && a.yp !== null)) {
88
- const h = a.y > n.graphMax && this.overflowColor || a.dataColor || this.color, p = this.getOpacity(e, h, f);
89
- l.strokeStyle = this.getCachedColor(h, p);
90
- const g = a.dataColor || this.pointFill, x = this.getOpacity(e, g, f);
91
- l.fillStyle = this.getCachedColor(g, x), S.drawPoint(l, this.pointStyle, this.pointSize, a.xp, a.yp);
92
- }
93
- }
94
- }
95
- /**
96
- * Draw real time scatter chart
97
- * @param {object} param - The parameter object passed to the draw function.
98
- *
99
- * @returns {undefined}
100
- */
101
- realTimeScatterDraw(e) {
102
- var d, c, u, h, p, g;
103
- const { ctx: l, axesSteps: s, duple: t, legendHitInfo: i, coordinateDedupe: o } = e, n = s.y[this.yAxisIndex], r = typeof this.pointStyle == "string" ? this.pointStyle : this.pointStyle.value, a = typeof this.pointSize == "number" ? this.pointSize : this.pointSize.value;
104
- let f = 0;
105
- for (let x = 0; x < ((c = (d = this.data[this.sId]) == null ? void 0 : d.dataGroup) == null ? void 0 : c.length); x++)
106
- for (let C = 0; C < ((h = (u = this.data[this.sId]) == null ? void 0 : u.dataGroup[x]) == null ? void 0 : h.data.length); C++) {
107
- const y = (g = (p = this.data[this.sId]) == null ? void 0 : p.dataGroup[x]) == null ? void 0 : g.data[C];
108
- f++;
109
- const _ = o !== !1;
110
- let m;
111
- if (i ? m = i.sId === this.sId : _ ? m = t.get(`${y.x}${y.y}`) === this.sId : m = !0, m && (this.calcItem(y, e), y.xp !== null && y.yp !== null)) {
112
- const w = y.y > n.graphMax && this.overflowColor, O = w || y.color || this.color, T = w || y.color || this.pointFill || this.color, z = this.getOpacity(e, O, C), D = this.getOpacity(e, T, C);
113
- l.strokeStyle = this.getCachedColor(O, z), l.fillStyle = this.getCachedColor(T, D), S.drawPoint(l, r, a, y.xp, y.yp);
114
- }
115
- }
116
- this._rtTotalCount = f;
117
- }
118
- /**
119
- * Filters and returns data items based on input coordinates
120
- *
121
- * @param {Array} data - The data to filter
122
- * @param {number} xsp - Start X coordinate
123
- * @param {number} ysp - Start Y coordinate
124
- * @param {number} xep - End X coordinate
125
- * @param {number} yep - End Y coordinate
126
- * @returns {Array} Filtered data items
127
- */
128
- findItemsInRange(e, l, s, t, i) {
129
- return e.filter(
130
- (o) => l - 1 <= o.xp && o.xp <= t + 1 && s - 1 <= o.yp && o.yp <= i + 1
131
- );
132
- }
133
- defaultScatterFindItems(e, l, s, t, i) {
134
- return this.findItemsInRange(e, l, s, t, i);
135
- }
136
- realTimeScatterFindItems(e, l, s, t, i) {
137
- const o = [];
138
- for (let n = 0; n < e[this.sId].dataGroup.length; n++) {
139
- const r = e[this.sId].dataGroup[n];
140
- o.push(...this.findItemsInRange(r.data, l, s, t, i));
141
- }
142
- return o;
143
- }
144
- /**
145
- *Returns items in range
146
- * @param {object} params range values
147
- *
148
- * @returns {array}
149
- */
150
- findItems({ xsp: e, ysp: l, width: s, height: t }) {
151
- const i = this.data, o = e + s, n = l + t;
152
- let r = [];
153
- return this.realTimeScatter ? r = this.realTimeScatterFindItems(i, e, l, o, n) : r = this.defaultScatterFindItems(i, e, l, o, n), r;
154
- }
155
- /**
156
- * Draw item highlight
157
- * @param {object} item object for drawing series data
158
- * @param {object} context canvas context
159
- * @param {boolean} isMax determines if this series has max value
160
- *
161
- * @returns {undefined}
162
- */
163
- itemHighlight(e, l) {
164
- const s = e.data, t = l, i = s.xp, o = s.yp;
165
- if (t.save(), i !== null && o !== null) {
166
- const n = s.dataColor || this.color, r = s.dataColor || this.pointFill;
167
- t.strokeStyle = this.getCachedColor(n, 0), t.fillStyle = this.getCachedColor(r, this.highlight.maxShadowOpacity), S.drawPoint(t, this.pointStyle, this.highlight.maxShadowSize, i, o), t.fillStyle = n, S.drawPoint(t, this.pointStyle, this.highlight.maxSize, i, o), t.fillStyle = "#fff", S.drawPoint(t, this.pointStyle, this.highlight.defaultSize, i, o);
168
- }
169
- t.restore();
170
- }
171
- /**
172
- * Find graph item for tooltip
173
- * @param {array} offset mouse position
174
- *
175
- * @returns {object} graph item
176
- */
177
- findGraphData(e) {
178
- var r;
179
- const l = e[0], s = e[1], t = { data: null, hit: !1, color: this.color, index: null }, i = this.pointSize;
180
- if (this.realTimeScatter) {
181
- const a = (r = this.data[this.sId]) == null ? void 0 : r.dataGroup;
182
- if (!a)
183
- return t;
184
- let d = this._rtTotalCount - 1;
185
- for (let c = a.length - 1; c >= 0; c--) {
186
- const u = a[c];
187
- if (u != null && u.data)
188
- for (let h = u.data.length - 1; h >= 0; h--) {
189
- const p = u.data[h];
190
- if (p.xp !== null && p.yp !== null) {
191
- const g = p.xp, x = p.yp;
192
- if (g - i <= l && l <= g + i && x - i <= s && s <= x + i)
193
- return t.data = p, t.index = d, t.hit = !0, t;
194
- }
195
- d--;
196
- }
197
- }
198
- return t;
199
- }
200
- const o = this.data, n = o.findIndex((a) => {
201
- const f = a.xp, d = a.yp;
202
- return f - i <= l && l <= f + i && d - i <= s && s <= d + i;
203
- });
204
- return n > -1 && (t.data = o[n], t.index = n, t.hit = !0), t;
205
- }
206
- }
207
- export {
208
- $ as default
209
- };
@@ -1,312 +0,0 @@
1
- import U from "dayjs";
2
- import { truthyNumber as K, numberWithComma as Q } from "../../../common/utils.js";
3
- import P from "../helpers/helpers.canvas.js";
4
- const et = {
5
- /**
6
- * Draw TextTip with tip's locationInfo
7
- * @param {object} [tipLocationInfo=undefined] tip location information
8
- *
9
- * @returns {undefined}
10
- */
11
- drawTips(d) {
12
- var f, T, u, t, x, h;
13
- const l = this.options;
14
- let s = null;
15
- const r = !!l.horizontal, i = l.maxTip, p = l.selectItem, c = l.selectLabel;
16
- let a, n;
17
- typeof ((f = l.tooltip) == null ? void 0 : f.formatter) == "function" ? s = (T = l.tooltip) == null ? void 0 : T.formatter : typeof ((t = (u = l.tooltip) == null ? void 0 : u.formatter) == null ? void 0 : t.value) == "function" && (s = (h = (x = l.tooltip) == null ? void 0 : x.formatter) == null ? void 0 : h.value), c.use && c.showTip && (n = l.type === "heatMap" ? this.drawLabelTipForHeatMap() : this.drawTipForSelectedLabel());
18
- const b = (o) => {
19
- d.forEach((e) => {
20
- if (e) {
21
- const w = this.seriesList[e == null ? void 0 : e.sId];
22
- if (!(w != null && w.show))
23
- return;
24
- const m = this.calculateTipInfo(w, "sel", e);
25
- if (m) {
26
- let z = !1;
27
- if (i.use && (a == null ? void 0 : a.dp) === m.dp && (z = !0), o.showTextTip || o.showTip) {
28
- if (o.tipText === "label") {
29
- const C = r ? l.axesY[0] : l.axesX[0], O = m.label;
30
- m.text = C.type === "time" ? U(O).format(C.timeFormat) : O;
31
- } else
32
- m.text = Q(m.value);
33
- this.drawTextTip({
34
- opt: o,
35
- tipType: "sel",
36
- seriesOpt: w,
37
- isSamePos: z,
38
- ...m
39
- });
40
- }
41
- o.showIndicator && this.drawFixedIndicator({ opt: o, seriesOpt: w, ...m });
42
- }
43
- e && (e != null && e.label) && (e == null ? void 0 : e.label) === 0 && (this.lastHitInfo = e);
44
- }
45
- });
46
- };
47
- if (d && !n && (p.use ? b(p) : c.use && l.type === "line" && b(c)), i.use && !n) {
48
- const o = this.minMax[r ? "x" : "y"][0].maxSID, e = this.seriesList[o];
49
- a = this.calculateTipInfo(e, "max", null), i.use && a && (s ? a.text = s({
50
- seriesId: e.sId,
51
- x: r ? a.value : void 0,
52
- y: r ? void 0 : a.value
53
- }) : a.text = Q(a.value), this.drawTextTip({ opt: i, tipType: "max", seriesOpt: e, ...a }), i.showIndicator && this.drawFixedIndicator({ opt: i, seriesOpt: e, ...a }));
54
- }
55
- },
56
- /**
57
- * Calculate tip size and contents
58
- * @param {object} series series information (max series or selected series)
59
- * @param {string} tipType tip type
60
- * [sel = user select series, label = user select label, max = max value]
61
- * @param {object} hitInfo mouse hit information
62
- *
63
- * @returns {object} size and tip contents
64
- */
65
- calculateTipInfo(d, l, s) {
66
- if (!d)
67
- return !1;
68
- const r = !!this.options.horizontal, i = this.lastTip, p = this.chartRect, c = this.labelOffset, a = {
69
- x1: p.x1 + c.left,
70
- x2: p.x2 - c.right,
71
- y1: p.y1 + c.top,
72
- y2: p.y2 - c.bottom
73
- }, n = p.chartHeight - (c.top + c.bottom), b = p.chartWidth - (c.left + c.right), f = this.axesSteps.x[d.xAxisIndex], T = this.axesSteps.y[d.yAxisIndex], u = a.x1, t = a.x2, x = a.y2, { type: h, size: o } = d, { maxDomain: e, maxDomainIndex: w } = d.minMax;
74
- if (e === null || w < 0)
75
- return !1;
76
- let m = h === "bar" ? w : e;
77
- l === "sel" && (s && s.label !== null ? (i.pos = h === "bar" ? s.maxIndex : s.label, m = i.pos) : i.pos !== null && (m = i.pos));
78
- let z = r ? d.minMax.maxX : d.minMax.maxY, C;
79
- if (l === "sel") {
80
- if (s && s.value !== null)
81
- z = s.useStack ? s.acc : s.value, C = s.label, i.value = z, i.label = C;
82
- else if (i.value !== null)
83
- z = i.value, C = i.label;
84
- else if (i.pos !== null) {
85
- const g = h === "bar" ? this.getItemByLabelIndex(i.pos) : this.getItemByLabel(i.pos);
86
- z = g.useStack ? g.acc : g.value, C = g.label, i.value = z, i.label = C;
87
- }
88
- }
89
- let O, A, S;
90
- if (h === "bar") {
91
- const g = r ? this.scrollbar.y : this.scrollbar.x;
92
- if (g != null && g.use) {
93
- const [E, L] = (g == null ? void 0 : g.range) ?? [];
94
- if (m >= E && m <= L)
95
- m -= E ?? 0;
96
- else
97
- return !1;
98
- }
99
- r ? (A = Math.round(o.h / 2), O = x - o.cat * m - o.cPad, S = O - (o.bar * o.ix - (o.h + o.bPad)) - A) : (A = Math.round(o.w / 2), O = u + o.cat * m + o.cPad, S = O + (o.bar * o.ix - (o.w + o.bPad)) + A);
100
- } else h === "line" ? S = P.calculateX(
101
- m,
102
- f.graphMin,
103
- f.graphMax,
104
- b - o.comboOffset,
105
- u + o.comboOffset / 2
106
- ) : h === "scatter" && (S = P.calculateX(m, f.graphMin, f.graphMax, b, u));
107
- return { ...{ xArea: b, yArea: n, graphX: f, graphY: T, xsp: u, xep: t, ysp: x }, ...{ dp: S, value: z, label: C, type: h } };
108
- },
109
- drawFixedIndicator(d) {
110
- const l = !!this.options.horizontal, s = this.bufferCtx, { graphX: r, graphY: i, xArea: p, yArea: c, xsp: a, ysp: n, dp: b, type: f, value: T, opt: u, seriesOpt: t } = d;
111
- let x = 0;
112
- f === "line" ? x += 3 : f === "scatter" && (x += (t == null ? void 0 : t.pointSize) ?? 0);
113
- let h;
114
- if (u.fixedPosTop)
115
- l ? h = P.calculateX(r.graphMax, r.graphMin, r.graphMax, p, a) : (h = P.calculateY(i.graphMax, i.graphMin, i.graphMax, c, n), h -= x);
116
- else if (l) {
117
- const o = Math.min(Math.max(T, r.graphMin), r.graphMax);
118
- h = P.calculateX(o, r.graphMin, r.graphMax, p, a);
119
- } else {
120
- const o = Math.min(Math.max(T, i.graphMin), i.graphMax);
121
- h = P.calculateY(o, i.graphMin, i.graphMax, c, n), h -= x;
122
- }
123
- b !== null && (s.beginPath(), s.save(), s.strokeStyle = u.indicatorColor, s.lineWidth = 2, l ? (s.moveTo(a, b), s.lineTo(h, b)) : (s.moveTo(b, n), s.lineTo(b, h)), s.stroke(), s.restore(), s.closePath());
124
- },
125
- /**
126
- * Draw Selected Label Tip
127
- * none Text
128
- * @returns {boolean} Whether drew at least one tip
129
- */
130
- drawTipForSelectedLabel() {
131
- var a, n;
132
- const d = this.options, l = !!d.horizontal, s = d.selectLabel, { dataIndex: r, data: i, label: p } = this.defaultSelectInfo;
133
- let c = !1;
134
- if (r.length) {
135
- c = !0;
136
- const b = this.chartRect, f = this.labelOffset, T = {
137
- x1: b.x1 + f.left,
138
- x2: b.x2 - f.right,
139
- y1: b.y1 + f.top,
140
- y2: b.y2 - f.bottom
141
- }, u = l ? this.axesY[0] : this.axesX[0], t = l ? this.axesX[0] : this.axesY[0], x = l ? this.axesSteps.x[0] : this.axesSteps.y[0], h = l ? P.calculateX : P.calculateY, o = l ? P.calculateY : P.calculateX, e = l ? this.scrollbar.y : this.scrollbar.x, w = b.chartWidth - (f.left + f.right), m = b.chartHeight - (f.top + f.bottom), z = l ? w : m, C = T[t.units.rectStart];
142
- let O = this.options.type === "bar" ? 4 : 6;
143
- O *= l ? 1 : -1;
144
- const A = Object.keys(this.seriesList ?? {}), S = A.filter((M) => this.seriesList[M].show), H = A.some(
145
- (M) => this.seriesList[M].isExistGrp && !this.seriesList[M].isOverlapping
146
- ), y = ((a = this.data.groups) == null ? void 0 : a[0]) ?? [];
147
- let g, E, L, R, B, q, G, _, N, V = 0, $ = (n = u.labels) == null ? void 0 : n.length;
148
- if (u.labels) {
149
- let M = u.labels.length;
150
- if (e != null && e.use) {
151
- const { range: j, interval: W, type: F } = e, [X, Y] = j;
152
- K(X) && K(Y) && (M = Math.floor((+Y - +X) / W) + 1, V = F === "step" ? X : u.labels.findIndex((v) => v === +X), $ = F === "step" ? Y : u.labels.findIndex((v) => v === +Y));
153
- }
154
- R = T[u.units.rectStart], B = T[u.units.rectEnd], q = (B - R) / M;
155
- } else
156
- G = this.axesSteps.x[0], _ = A.find((M) => {
157
- var j;
158
- return ((j = this.seriesList[M]) == null ? void 0 : j.type) === "line";
159
- }), N = this.seriesList[_].size;
160
- i.forEach((M, j) => {
161
- var W;
162
- if (L = x.graphMax, !s.fixedPosTop) {
163
- if (H) {
164
- const F = S == null ? void 0 : S.reduce(
165
- (v, k) => {
166
- var I, J;
167
- return y.includes(k) && (((I = M[k]) == null ? void 0 : I.value) ?? M[k]) > 0 ? v + (((J = M[k]) == null ? void 0 : J.value) ?? M[k]) : v;
168
- },
169
- 0
170
- ), X = ((W = S == null ? void 0 : S.filter((v) => !y.includes(v))) == null ? void 0 : W.map((v) => {
171
- var k;
172
- return ((k = M[v]) == null ? void 0 : k.value) ?? M[v];
173
- })) ?? [], Y = (X == null ? void 0 : X.length) > 0 ? X.reduce((v, k) => Math.max(v, k ?? -1 / 0), -1 / 0) : -1 / 0;
174
- L = F > 0 ? Math.max(Y, F) : Math.max(Y, 0);
175
- } else if (S.length) {
176
- const F = S.map(
177
- (Y) => {
178
- var v;
179
- return ((v = M[Y]) == null ? void 0 : v.value) ?? M[Y];
180
- }
181
- ), X = F.length > 0 ? F.reduce((Y, v) => Math.max(Y, v ?? -1 / 0), -1 / 0) : -1 / 0;
182
- L = X > 0 || this.options.type !== "bar" ? X : 0;
183
- }
184
- }
185
- if (u.labels) {
186
- if (r[j] < V || r[j] > $)
187
- return;
188
- const F = r[j] - V;
189
- g = Math.round(R + q * F) + q / 2;
190
- } else
191
- g = o(
192
- p[j],
193
- G.graphMin,
194
- G.graphMax,
195
- w - N.comboOffset,
196
- T.x1 + N.comboOffset / 2
197
- );
198
- E = h(
199
- L,
200
- x.graphMin,
201
- x.graphMax,
202
- z,
203
- C
204
- ) + O, this.showTip({
205
- context: this.bufferCtx,
206
- x: l ? E : g,
207
- y: l ? g : E,
208
- opt: s,
209
- isSamePos: !1
210
- });
211
- });
212
- }
213
- return c;
214
- },
215
- /**
216
- * Draw Selected Label Tip
217
- * @returns {boolean} Whether drew at least one tip
218
- */
219
- drawLabelTipForHeatMap() {
220
- const d = this.options, l = !!d.horizontal, s = d.selectLabel, { dataIndex: r } = this.defaultSelectInfo;
221
- let i = !1;
222
- if (r) {
223
- i = !0;
224
- const p = this.chartRect, c = this.labelOffset, a = {
225
- x1: p.x1 + c.left,
226
- x2: p.x2 - c.right,
227
- y1: p.y1 + c.top,
228
- y2: p.y2 - c.bottom
229
- }, n = l ? this.axesY[0] : this.axesX[0], b = a[n.units.rectStart], T = (a[n.units.rectEnd] - b) / n.labels.length, u = l ? this.axesX[0] : this.axesY[0], t = 6 * (l ? 1 : -1), x = a[u.units.rectEnd] + t;
230
- r == null || r.forEach((h) => {
231
- const e = Math.round(b + T * h) + T / 2;
232
- this.showTip({
233
- context: this.bufferCtx,
234
- x: l ? x : e,
235
- y: l ? e : x,
236
- opt: s,
237
- isSamePos: !1
238
- });
239
- });
240
- }
241
- return i;
242
- },
243
- /**
244
- * Calculate x, y position to draw text tip
245
- * @param {object} param object for drawing text tip
246
- *
247
- * @returns {undefined}
248
- */
249
- drawTextTip(d) {
250
- const l = !!this.options.horizontal, s = this.bufferCtx, { graphX: r, graphY: i, xArea: p, yArea: c, xsp: a, xep: n, ysp: b } = d, { dp: f, value: T, text: u, opt: t, type: x, tipType: h, isSamePos: o, seriesOpt: e } = d, w = 4, m = 4, { fontSize: z, fontFamily: C, fontWeight: O, height: A } = t.tipStyle, S = `normal normal ${O} ${z}px ${C}`;
251
- let H = 1;
252
- x === "line" ? H += 6 : x === "scatter" ? H += e == null ? void 0 : e.pointSize : x === "bar" && (H += 4);
253
- let y, g = f;
254
- if (t.fixedPosTop)
255
- l ? (y = P.calculateX(r.graphMax, r.graphMin, r.graphMax, p, a), y += H) : (y = P.calculateY(i.graphMax, i.graphMin, i.graphMax, c, b), y -= H);
256
- else if (l) {
257
- const R = Math.min(Math.max(T, r.graphMin), r.graphMax);
258
- y = P.calculateX(R, r.graphMin, r.graphMax, p, a), y = T < 0 ? y - H : y + H;
259
- } else {
260
- const R = x === "bar" && T < 0 ? 0 : T, B = Math.min(Math.max(R, i.graphMin), i.graphMax);
261
- y = P.calculateY(B, i.graphMin, i.graphMax, c, b), y = R < 0 ? y + H : y - H;
262
- }
263
- let E = "center";
264
- s.save(), s.font = S;
265
- const L = Math.round(Math.max(s.measureText(u).width + 12, 40));
266
- l || (f + L / 2 > n - 10 ? (E = "right", g -= L / 2 - w * 2) : f - L / 2 < a + 10 && (E = "left", g += L / 2 - w * 2)), s.restore(), (t.showTextTip || h === "max") && this.showTextTip({
267
- context: s,
268
- type: E,
269
- width: L,
270
- height: A,
271
- x: l ? y + L / 2 : g,
272
- y: l ? g + A / 2 : y,
273
- opt: t,
274
- arrowSize: w,
275
- borderRadius: m,
276
- text: u,
277
- textStyle: S,
278
- isNegative: T < 0
279
- }), t.showTip && h === "sel" && this.showTip({
280
- context: s,
281
- x: l ? y : f,
282
- y: l ? f : y,
283
- opt: t,
284
- isSamePos: o
285
- });
286
- },
287
- /**
288
- * Draw text tip
289
- * @param {object} param object for drawing text tip
290
- *
291
- * @returns {undefined}
292
- */
293
- showTextTip(d) {
294
- const l = !!this.options.horizontal, { type: s, width: r, height: i, x: p, y: c, arrowSize: a, borderRadius: n, text: b, opt: f, textStyle: T, isNegative: u } = d, t = d.context;
295
- let x = p - r / 2, h = p + r / 2;
296
- const o = c - i, e = c;
297
- u && l && (x = p - r / 2 - r, h = p - r / 2), t.save(), t.font = T, t.fillStyle = f.tipBackground ?? f.tipStyle.background, t.shadowBlur = 0, t.beginPath(), t.moveTo(x + n, o), t.quadraticCurveTo(x, o, x, o + n), t.lineTo(x, e - n), t.quadraticCurveTo(x, e, x + n, e), t.lineTo(h - n, e), t.quadraticCurveTo(h, e, h, e - n), t.lineTo(h, o + n), t.quadraticCurveTo(h, o, h - n, o), t.lineTo(x + n, o), t.closePath(), t.fill(), t.beginPath(), l ? (u ? (t.moveTo(h, e), t.lineTo(h, o + n + a / 2), t.lineTo(h + a, e - i / 2), t.lineTo(h, e - n - a / 2)) : (t.moveTo(x, o), t.lineTo(x, o + n + a / 2), t.lineTo(x - a, e - i / 2), t.lineTo(x, e - n - a / 2)), t.closePath(), t.fill()) : (u ? s === "left" ? (t.lineTo(x + n + a, e + a), t.lineTo(x + n + a * 2, e)) : s === "right" ? (t.lineTo(h - a * 2 - n, e), t.lineTo(h - a - n, e + a)) : (t.lineTo(p - a, e), t.lineTo(p, e + a), t.lineTo(p + a, e)) : u || (s === "left" ? (t.moveTo(x, o), t.lineTo(x + n + a, e + a), t.lineTo(x + n + a * 2, e)) : s === "right" ? (t.moveTo(h, o), t.lineTo(h - a * 2 - n, e), t.lineTo(h - a - n, e + a)) : (t.lineTo(p - a, e), t.lineTo(p, e + a), t.lineTo(p + a, e))), t.closePath(), t.fill()), t.restore(), t.save(), t.font = T, t.fillStyle = f.tipTextColor ?? f.tipStyle.textColor, t.textBaseline = "middle", t.textAlign = "center", t.fillText(`${b}`, x + r / 2, o + i / 2), t.restore();
298
- },
299
- /**
300
- * Draw arrow tip
301
- * @param {object} param object for drawing arrow tip
302
- *
303
- * @returns {undefined}
304
- */
305
- showTip(d) {
306
- const l = !!this.options.horizontal, { x: s, y: r, opt: i, isSamePos: p } = d, c = d.context, n = r - (p ? 24 : 0);
307
- c.save(), c.fillStyle = i.tipBackground ?? i.tipStyle.background, c.beginPath(), c.moveTo(s, n), l ? (c.lineTo(s + 6, n - 6), c.lineTo(s + 6, n + 6)) : (c.lineTo(s + 6, n - 6), c.lineTo(s - 6, n - 6)), c.lineTo(s, n), c.closePath(), c.fill(), c.restore();
308
- }
309
- };
310
- export {
311
- et as default
312
- };