evui 3.5.0-rc.1 → 3.5.0

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 (135) hide show
  1. package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  2. package/dist/common/utils.bignumber.js +23 -0
  3. package/dist/common/utils.debounce.js +66 -0
  4. package/dist/common/utils.js +64 -0
  5. package/dist/common/utils.throttle.js +15 -0
  6. package/dist/components/button/Button.vue.js +65 -0
  7. package/dist/components/button/index.js +7 -0
  8. package/dist/components/buttonGroup/ButtonGroup.vue.js +14 -0
  9. package/dist/components/buttonGroup/index.js +7 -0
  10. package/dist/components/calendar/Calendar.vue.js +299 -0
  11. package/dist/components/calendar/index.js +7 -0
  12. package/dist/components/calendar/uses.js +579 -0
  13. package/dist/components/chart/Chart.vue.js +261 -0
  14. package/dist/components/chart/ChartToolbar.vue.js +32 -0
  15. package/dist/components/chart/chart.core.js +738 -0
  16. package/dist/components/chart/chartZoom.core.js +221 -0
  17. package/dist/components/chart/element/element.bar.js +358 -0
  18. package/dist/components/chart/element/element.bar.time.js +55 -0
  19. package/dist/components/chart/element/element.heatmap.js +403 -0
  20. package/dist/components/chart/element/element.line.js +292 -0
  21. package/dist/components/chart/element/element.pie.js +73 -0
  22. package/dist/components/chart/element/element.scatter.js +209 -0
  23. package/dist/components/chart/element/element.tip.js +312 -0
  24. package/dist/components/chart/helpers/helpers.canvas.js +141 -0
  25. package/dist/components/chart/helpers/helpers.constant.js +253 -0
  26. package/dist/components/chart/helpers/helpers.util.js +265 -0
  27. package/dist/components/chart/index.js +7 -0
  28. package/dist/components/chart/model/index.js +6 -0
  29. package/dist/components/chart/model/model.series.js +82 -0
  30. package/dist/components/chart/model/model.store.js +650 -0
  31. package/dist/components/chart/plugins/plugins.interaction.js +823 -0
  32. package/dist/components/chart/plugins/plugins.legend.gradient.js +281 -0
  33. package/dist/components/chart/plugins/plugins.legend.js +665 -0
  34. package/dist/components/chart/plugins/plugins.pie.js +86 -0
  35. package/dist/components/chart/plugins/plugins.scrollbar.js +345 -0
  36. package/dist/components/chart/plugins/plugins.title.js +43 -0
  37. package/dist/components/chart/plugins/plugins.tooltip.js +508 -0
  38. package/dist/components/chart/scale/scale.js +492 -0
  39. package/dist/components/chart/scale/scale.linear.js +248 -0
  40. package/dist/components/chart/scale/scale.logarithmic.js +82 -0
  41. package/dist/components/chart/scale/scale.step.js +227 -0
  42. package/dist/components/chart/scale/scale.time.category.js +148 -0
  43. package/dist/components/chart/scale/scale.time.js +95 -0
  44. package/dist/components/chart/uses.js +479 -0
  45. package/dist/components/chartBrush/ChartBrush.vue.js +198 -0
  46. package/dist/components/chartBrush/chartBrush.core.js +265 -0
  47. package/dist/components/chartBrush/index.js +7 -0
  48. package/dist/components/chartBrush/uses.js +18 -0
  49. package/dist/components/chartGroup/ChartGroup.vue.js +128 -0
  50. package/dist/components/chartGroup/index.js +7 -0
  51. package/dist/components/chartGroup/uses.js +47 -0
  52. package/dist/components/checkbox/Checkbox.vue.js +99 -0
  53. package/dist/components/checkbox/index.js +7 -0
  54. package/dist/components/checkboxGroup/CheckboxGroup.vue.js +40 -0
  55. package/dist/components/checkboxGroup/index.js +7 -0
  56. package/dist/components/contextMenu/ContextMenu.vue.js +70 -0
  57. package/dist/components/contextMenu/MenuList.vue.js +105 -0
  58. package/dist/components/contextMenu/index.js +7 -0
  59. package/dist/components/contextMenu/uses.js +79 -0
  60. package/dist/components/datePicker/DatePicker.vue.js +310 -0
  61. package/dist/components/datePicker/index.js +7 -0
  62. package/dist/components/datePicker/uses.js +190 -0
  63. package/dist/components/grid/Grid.vue.js +1261 -0
  64. package/dist/components/grid/GridColumnSetting.vue.js +212 -0
  65. package/dist/components/grid/GridFilterSetting.vue.js +222 -0
  66. package/dist/components/grid/GridPagination.vue.js +69 -0
  67. package/dist/components/grid/GridSummary.vue.js +186 -0
  68. package/dist/components/grid/GridToolbar.vue.js +15 -0
  69. package/dist/components/grid/icon/icon-option-button.vue.js +39 -0
  70. package/dist/components/grid/icon/icon-sort-button.vue.js +56 -0
  71. package/dist/components/grid/index.js +7 -0
  72. package/dist/components/grid/uses.js +697 -0
  73. package/dist/components/icon/Icon.vue.js +50 -0
  74. package/dist/components/icon/index.js +8 -0
  75. package/dist/components/inputNumber/InputNumber.vue.js +112 -0
  76. package/dist/components/inputNumber/index.js +7 -0
  77. package/dist/components/inputNumber/uses.js +76 -0
  78. package/dist/components/loading/Loading.vue.js +78 -0
  79. package/dist/components/loading/index.js +7 -0
  80. package/dist/components/menu/Menu.vue.js +66 -0
  81. package/dist/components/menu/MenuItem.vue.js +125 -0
  82. package/dist/components/menu/index.js +7 -0
  83. package/dist/components/message/Message.vue.js +122 -0
  84. package/dist/components/message/index.js +16 -0
  85. package/dist/components/messageBox/MessageBox.vue.js +216 -0
  86. package/dist/components/messageBox/index.js +13 -0
  87. package/dist/components/notification/Notification.vue.js +140 -0
  88. package/dist/components/notification/index.js +23 -0
  89. package/dist/components/pagination/Pagination.vue.js +215 -0
  90. package/dist/components/pagination/index.js +7 -0
  91. package/dist/components/pagination/pageButton.vue.js +35 -0
  92. package/dist/components/progress/Progress.vue.js +88 -0
  93. package/dist/components/progress/index.js +7 -0
  94. package/dist/components/radio/Radio.vue.js +75 -0
  95. package/dist/components/radio/index.js +7 -0
  96. package/dist/components/radioGroup/RadioGroup.vue.js +37 -0
  97. package/dist/components/radioGroup/index.js +7 -0
  98. package/dist/components/scheduler/Scheduler.vue.js +128 -0
  99. package/dist/components/scheduler/index.js +7 -0
  100. package/dist/components/scheduler/uses.js +73 -0
  101. package/dist/components/select/Select.vue.js +381 -0
  102. package/dist/components/select/index.js +7 -0
  103. package/dist/components/select/uses.js +147 -0
  104. package/dist/components/slider/Slider.vue.js +243 -0
  105. package/dist/components/slider/index.js +7 -0
  106. package/dist/components/slider/uses.js +188 -0
  107. package/dist/components/tabPanel/TabPanel.vue.js +39 -0
  108. package/dist/components/tabPanel/index.js +7 -0
  109. package/dist/components/tabs/Tabs.vue.js +220 -0
  110. package/dist/components/tabs/index.js +7 -0
  111. package/dist/components/textField/TextField.vue.js +209 -0
  112. package/dist/components/textField/index.js +7 -0
  113. package/dist/components/timePicker/TimePicker.vue.js +227 -0
  114. package/dist/components/timePicker/index.js +7 -0
  115. package/dist/components/toggle/Toggle.vue.js +66 -0
  116. package/dist/components/toggle/index.js +7 -0
  117. package/dist/components/tree/Tree.vue.js +220 -0
  118. package/dist/components/tree/TreeNode.vue.js +146 -0
  119. package/dist/components/tree/index.js +7 -0
  120. package/dist/components/treeGrid/TreeGrid.vue.js +898 -0
  121. package/dist/components/treeGrid/TreeGridNode.vue.js +274 -0
  122. package/dist/components/treeGrid/TreeGridToolbar.vue.js +15 -0
  123. package/dist/components/treeGrid/index.js +7 -0
  124. package/dist/components/treeGrid/uses.js +497 -0
  125. package/dist/components/window/Window.vue.js +211 -0
  126. package/dist/components/window/index.js +7 -0
  127. package/dist/components/window/uses.js +345 -0
  128. package/dist/directives/clickoutside.js +47 -0
  129. package/dist/main.js +142 -0
  130. package/dist/package.json.js +4 -0
  131. package/dist/resolver.js +17 -0
  132. package/dist/style.css +1 -1
  133. package/package.json +56 -23
  134. package/dist/index.js +0 -21754
  135. package/dist/index.umd.cjs +0 -28
@@ -0,0 +1,650 @@
1
+ import { reverse as k } from "lodash-es";
2
+ import X from "dayjs";
3
+ import L from "../helpers/helpers.util.js";
4
+ const z = {
5
+ /**
6
+ * Take chart data and labels to create normalized data and min/max info
7
+ * @param {object} data chart series info
8
+ * @param {object} label chart label
9
+ *
10
+ * @returns {undefined}
11
+ */
12
+ createDataSet(c, o) {
13
+ Object.keys(this.seriesInfo.charts).forEach((l) => {
14
+ const h = this.seriesInfo.charts[l];
15
+ h.length && (l === "pie" ? this.options.sunburst ? this.createSunburstDataSet(c) : this.createPieDataSet(c, h) : l === "scatter" ? h.forEach((s) => {
16
+ const t = this.seriesList[s], r = c[s], e = t == null ? void 0 : t.passingValue;
17
+ t && r && (t.data = this.addSeriesDSforScatter(r), t.minMax = this.getSeriesMinMax(t.data, e));
18
+ }) : l === "heatMap" ? h.forEach((s) => {
19
+ const t = this.seriesList[s], r = t == null ? void 0 : t.passingValue, e = c[s];
20
+ t && e && (t.labels = o, t.data = this.addSeriesDSForHeatMap(e), t.minMax = this.getSeriesMinMax(t.data, r), t.valueOpt = this.getSeriesValueOptForHeatMap(t));
21
+ }) : h.forEach((s) => {
22
+ var n, i;
23
+ const t = this.seriesList[s], r = (n = c == null ? void 0 : c[s]) == null ? void 0 : n.some(
24
+ (a) => a === t.passingValue
25
+ );
26
+ t.hasPassingValueInData = r;
27
+ const e = (i = c == null ? void 0 : c[s]) == null ? void 0 : i.map((a) => t.interpolation === "zero" && !a ? 0 : a === t.passingValue ? null : a);
28
+ t && e && (t.isExistGrp && t.stackIndex && !t.isOverlapping ? t.data = this.addSeriesStackDS(e, o, t.bsIds, t.stackIndex) : t.data = this.addSeriesDS(e, o, t.isExistGrp), t.minMax = this.getSeriesMinMax(t.data, t.passingValue));
29
+ }));
30
+ });
31
+ },
32
+ /**
33
+ * Take chart data and create a two-dimensional array, specify max/min and delete/add over time.
34
+ * @param {object} datas chart series info
35
+ *
36
+ * @returns {undefined}
37
+ */
38
+ createRealTimeScatterDataSet(c) {
39
+ var h, s, t;
40
+ const o = Object.keys(c), l = {
41
+ maxY: 0,
42
+ minY: 1 / 0,
43
+ fromTime: 0,
44
+ toTime: 0
45
+ };
46
+ for (let r = 0; r < o.length; r++) {
47
+ const e = o[r], n = c[e], i = n == null ? void 0 : n.length;
48
+ if (!this.isInit || this.updateSeries || !this.dataSet[e]) {
49
+ const x = {
50
+ dataGroup: [],
51
+ startIndex: 0,
52
+ endIndex: null,
53
+ length: 0,
54
+ fromTime: 0,
55
+ toTime: 0
56
+ };
57
+ this.dataSet[e] = {
58
+ ...x,
59
+ ...this.dataSet[e]
60
+ };
61
+ }
62
+ const a = this.dataSet[e], m = a.dataGroup, u = this.options.realTimeScatter.range || 300, d = a.length !== u;
63
+ a.length = u;
64
+ const f = a.length;
65
+ let y = 0;
66
+ for (let x = 0; x < i; x++) {
67
+ const b = n[x];
68
+ b && y < b.x && (y = b.x);
69
+ }
70
+ y = y ? Math.floor(y / 1e3) * 1e3 : 0;
71
+ const g = ((t = (s = (h = m.at(-1)) == null ? void 0 : h.data) == null ? void 0 : s.at(-1)) == null ? void 0 : t.x) || Date.now(), I = Math.floor(g / 1e3) * 1e3, S = a.toTime || I, p = y || S;
72
+ if (a.endIndex == null || d) {
73
+ a.startIndex = 0, a.endIndex = f - 1, m.length = f;
74
+ for (let x = 0; x < f; x++)
75
+ m[x] = m[x] || { data: [], max: 0, min: 1 / 0 }, m[x].data.length = 0, m[x].max = 0, m[x].min = 1 / 0;
76
+ a.toTime = p, a.fromTime = a.toTime - f * 1e3;
77
+ }
78
+ const v = (p - S) / 1e3, D = Number.isFinite(v) ? Math.max(0, Math.floor(v)) : 0;
79
+ if (a.toTime = p, a.fromTime = a.toTime - f * 1e3, y && (a.toTime - y) / 1e3 > f && e === "")
80
+ return;
81
+ const Y = (x) => {
82
+ x.data.length = 0, x.max = 0, x.min = 1 / 0;
83
+ };
84
+ for (let x = 0; x < f; x++)
85
+ m[x] ? m[x].data || (m[x].data = [], m[x].max = 0, m[x].min = 1 / 0) : m[x] = { data: [], max: 0, min: 1 / 0 };
86
+ if (D > 0)
87
+ if (D >= f) {
88
+ for (let x = 0; x < f; x++) Y(m[x]);
89
+ a.startIndex = 0, a.endIndex = f - 1;
90
+ } else {
91
+ let x = a.startIndex, b = a.endIndex;
92
+ for (let T = 0; T < D; T++)
93
+ Y(m[x]), x = (x + 1) % f, b = (b + 1) % f;
94
+ a.startIndex = x, a.endIndex = b;
95
+ }
96
+ for (let x = 0; x < i; x++) {
97
+ const b = n[x];
98
+ if (b) {
99
+ const T = Math.floor(b.x / 1e3) * 1e3;
100
+ if (a.fromTime <= T) {
101
+ let P = a.endIndex - (a.toTime - T) / 1e3;
102
+ P < 0 && (P = f + P);
103
+ const V = m[P];
104
+ V.data.push({
105
+ x: b.x,
106
+ y: b.y,
107
+ o: b.value ?? b.y,
108
+ color: b.color
109
+ }), V.max = Math.max(V.max, b.y), V.min = Math.min(V.min, b.y);
110
+ }
111
+ }
112
+ }
113
+ const M = { maxY: 0, minY: 1 / 0 };
114
+ for (let x = 0; x < f; x++) {
115
+ const b = m[x];
116
+ b.max > M.maxY && (M.maxY = b.max), b.min < M.minY && (M.minY = b.min);
117
+ }
118
+ l.maxY = Math.max(l.maxY, M.maxY), l.minY = Math.min(l.minY, M.minY), l.fromTime = a.fromTime, l.toTime = a.toTime;
119
+ }
120
+ this.seriesInfo.charts.scatter.forEach((r) => {
121
+ const e = this.seriesList[r];
122
+ e.data = this.dataSet, e.minMax = {
123
+ minX: X(l.fromTime),
124
+ minY: l.minY,
125
+ maxX: X(l.toTime),
126
+ maxY: l.maxY
127
+ };
128
+ });
129
+ },
130
+ /**
131
+ * Take chart data and to create normalized pie data
132
+ * @param {object} data chart series info
133
+ *
134
+ * @returns {undefined}
135
+ */
136
+ createSunburstDataSet(c) {
137
+ this.pieDataSet = [];
138
+ const o = this.pieDataSet, l = [];
139
+ for (let h = 0; h < c.length; h++) {
140
+ const s = c[h], t = this.seriesList[s.id];
141
+ let r = !1;
142
+ if (o[0] || (o[0] = { ir: 0, or: 0, total: 0, data: [] }), t.show) {
143
+ if (o[0].total += s.value || 0, o[0].data.push({ parent: "$ev-root", id: s.id, value: s.value, sa: 0, ea: 0 }), s.children)
144
+ for (let e = 0; e < s.children.length; e++)
145
+ this.seriesList[s.children[e].id].show && (r = !0), l.push({ parent: s.id, data: s.children[e], depth: 1 });
146
+ else {
147
+ const e = {
148
+ id: "dummy",
149
+ value: s.value
150
+ };
151
+ l.push({ parent: s.id, data: e, depth: 1 });
152
+ }
153
+ if (!r) {
154
+ const e = {
155
+ id: "dummy",
156
+ value: s.value
157
+ };
158
+ l.push({ parent: s.id, data: e, depth: 1 });
159
+ }
160
+ }
161
+ }
162
+ for (o[0].data.sort((h, s) => s.value - h.value); l.length; ) {
163
+ const h = l.shift(), s = h.parent, t = h.data, r = h.depth;
164
+ let e = !1;
165
+ o[r] || (o[r] = { ir: 0, or: 0, total: {}, data: [] }), o[r].total[s] || (o[r].total[s] = 0);
166
+ const n = this.seriesList[t.id];
167
+ if (t.id === "dummy")
168
+ o[r].data.push({ parent: s, id: "dummy", value: t.value, sa: 0, ea: 0 }), o[r].total[s] += t.value;
169
+ else if (n && n.show) {
170
+ if (o[r].data.push({ parent: s, id: t.id, value: t.value, sa: 0, ea: 0 }), o[r].total[s] += t.value, t.children)
171
+ for (let i = 0; i < t.children.length; i++)
172
+ this.seriesList[t.children[i].id].show && (e = !0), l.push({ parent: t.id, data: t.children[i], depth: r + 1 });
173
+ else {
174
+ const i = {
175
+ id: "dummy",
176
+ value: t.value
177
+ };
178
+ l.push({ parent: t.id, data: i, depth: r + 1 });
179
+ }
180
+ if (!e) {
181
+ const i = {
182
+ id: "dummy",
183
+ value: t.value
184
+ };
185
+ l.push({ parent: t.id, data: i, depth: r + 1 });
186
+ }
187
+ }
188
+ o[r].data.sort((i, a) => a.value - i.value);
189
+ }
190
+ },
191
+ /**
192
+ * Take chart data and to create normalized pie data
193
+ * @param {object} data chart data
194
+ * @param {String[]} seriesIDs chart series info
195
+ *
196
+ * @returns {undefined}
197
+ */
198
+ createPieDataSet(c, o) {
199
+ this.pieDataSet = [];
200
+ const l = this.pieDataSet;
201
+ l[0] = { data: [], ir: 0, or: 0, total: 0 }, o.forEach((h) => {
202
+ if (this.seriesList[h].show) {
203
+ const s = c[h][0] ?? 0;
204
+ l[0].total += s, l[0].data.push({ id: h, value: s, sa: 0, ea: 0 });
205
+ }
206
+ }), l.forEach((h) => {
207
+ h.data.sort((s, t) => t.value - s.value);
208
+ });
209
+ },
210
+ /**
211
+ * Take data and label to create stack data for each series
212
+ * @param {object} data chart series info
213
+ * @param {object} label chart label
214
+ * @param {array} bsIds stacked base data ID List
215
+ * @param {number} sIdx series ordered index
216
+ *
217
+ * @typedef {import('./index').ChartSeriesDataPoint} ChartSeriesDataPoint
218
+ *
219
+ * @returns {ChartSeriesDataPoint[]} data for each series
220
+ */
221
+ addSeriesStackDS(c, o, l, h = 0) {
222
+ const s = this.seriesList, t = this.options.horizontal, r = [], e = /* @__PURE__ */ new Map(), n = (a, m, u) => {
223
+ const d = `${a}-${m}-${u >= 0 ? "pos" : "neg"}`;
224
+ if (e.has(d))
225
+ return e.get(d);
226
+ let f = 0, y = a;
227
+ for (; y >= 0; ) {
228
+ const g = s[l[y]];
229
+ if (g != null && g.show) {
230
+ const I = g.data[m], S = t ? I == null ? void 0 : I.x : I == null ? void 0 : I.y, p = I == null ? void 0 : I.o, v = !L.isNullOrUndefined(g.passingValue) && g.passingValue === p, D = u >= 0 && p >= 0 || u < 0 && p < 0;
231
+ if (S != null && !v && D) {
232
+ f = S;
233
+ break;
234
+ }
235
+ }
236
+ y--;
237
+ }
238
+ return e.set(d, f), f;
239
+ }, i = l.length - 1;
240
+ return c.forEach((a, m) => {
241
+ const u = Math.max(0, i);
242
+ let d = n(u, m, a), f = a, y = o[m], g = a;
243
+ if (d != null && y != null) {
244
+ g && typeof g == "object" && ("x" in g || "y" in g) && (f = t ? a.x : a.y, y = t ? a.y : a.x);
245
+ const I = (f == null ? void 0 : f.value) ?? f;
246
+ h > 0 ? I != null ? g = d + I : g = f : (d = 0, g = I), r.push(this.addData(g, y, f, d));
247
+ }
248
+ }), r;
249
+ },
250
+ /**
251
+ * Take data and label to create data for each series
252
+ * @param {object} data chart series info
253
+ * @param {object} label chart label
254
+ * @param {boolean} isBase is Base(bottommost) series at stack chart
255
+ *
256
+ * @typedef {import('./index').ChartSeriesDataPoint} ChartSeriesDataPoint
257
+ *
258
+ * @returns {ChartSeriesDataPoint[]} data for each series
259
+ */
260
+ addSeriesDS(c, o, l) {
261
+ var r;
262
+ const h = this.options.horizontal, s = [], t = (r = this.seriesList[Object.keys(this.seriesList)[0]]) == null ? void 0 : r.passingValue;
263
+ return c.forEach((e, n) => {
264
+ let i = e, a = o[n];
265
+ if (i && typeof i == "object" && (e.x || e.y) && (i = h ? e.x : e.y, a = h ? e.y : e.x), a !== null) {
266
+ const m = l && !L.isNullOrUndefined(t) && i === t;
267
+ s.push(this.addData(m ? 0 : i, a, i));
268
+ }
269
+ }), s;
270
+ },
271
+ /**
272
+ * Take data to create data for each series
273
+ * @param {array} data data array for each series
274
+ * @returns {array} data info added position and etc
275
+ */
276
+ addSeriesDSforScatter(c) {
277
+ return c.map((o) => {
278
+ const l = o.x, h = {
279
+ value: o.y,
280
+ color: (o == null ? void 0 : o.color) || null
281
+ };
282
+ return this.addData(h, l, h);
283
+ });
284
+ },
285
+ /**
286
+ * Take data to create data for each series
287
+ * @param {array} data data array for each series
288
+ *
289
+ * @returns {array} data info added position and etc
290
+ */
291
+ addSeriesDSForHeatMap(c) {
292
+ return c.map(({ x: o, y: l, value: h, color: s = null }) => ({
293
+ x: o,
294
+ y: l,
295
+ o: h,
296
+ xp: null,
297
+ yp: null,
298
+ w: null,
299
+ h: null,
300
+ dataColor: s,
301
+ cId: null
302
+ }));
303
+ },
304
+ /**
305
+ * Take data to create data object for graph
306
+ * @param {object} gdata graph data (y-axis value for vertical chart)
307
+ * @param {object} ldata label data (x-axis value for vertical chart)
308
+ * @param {object} odata original data (without stacked value)
309
+ * @param {object} bdata base data (stacked value)
310
+ *
311
+ * @typedef {import('./index').ChartSeriesDataPoint} ChartSeriesDataPoint
312
+ *
313
+ * @returns {ChartSeriesDataPoint} data for each graph point
314
+ */
315
+ addData(c, o, l = null, h = null) {
316
+ let s, t = null, r = null, e = null, n = null, i = null;
317
+ return c !== null && typeof c == "object" ? (t = c.value, e = c.color, i = c.textColor) : t = c ?? null, l !== null && typeof l == "object" ? (r = l.value, n = l.color) : r = l ?? null, this.options.horizontal ? s = { x: t, y: o, o: r, b: h } : s = { x: o, y: t, o: r, b: h }, s.xp = null, s.yp = null, s.w = null, s.h = null, s.dataColor = e ?? n, s.dataTextColor = i, s;
318
+ },
319
+ /**
320
+ * Take series data to create min/max info for each series
321
+ * @param {object} data series data
322
+ *
323
+ * @returns {object} min/max info for series
324
+ */
325
+ getSeriesMinMax(c, o) {
326
+ const l = { minX: null, minY: null, maxX: null, maxY: null, maxDomain: null }, h = this.options.horizontal;
327
+ if (c.length) {
328
+ const s = !L.isNullOrUndefined(o);
329
+ return c.reduce(
330
+ (t, r, e) => {
331
+ var u, d, f;
332
+ const n = t, i = ((u = r.x) == null ? void 0 : u.value) || r.x, a = ((d = r.y) == null ? void 0 : d.value) || r.y, m = ((f = r.o) == null ? void 0 : f.value) || r.o;
333
+ return (s ? m !== o && i <= n.minX : i <= n.minX) && (n.minX = i === null ? 0 : i), (s ? m !== o && a <= n.minY : a <= n.minY) && (n.minY = a === null ? 0 : a), (s ? m !== o && i >= n.maxX : i >= n.maxX) && (n.maxX = i === null ? 0 : i, h && i !== null && (n.maxDomain = a, n.maxDomainIndex = e)), (s ? m !== o && a >= n.maxY : a >= n.maxY) && (n.maxY = a === null ? 0 : a, !h && a !== null && (n.maxDomain = i, n.maxDomainIndex = e)), n;
334
+ },
335
+ {
336
+ minX: c[0].x,
337
+ minY: c[0].y,
338
+ maxX: c[0].x,
339
+ maxY: c[0].y,
340
+ maxDomain: h ? c[0].y : c[0].x,
341
+ maxDomainIndex: 0
342
+ }
343
+ );
344
+ }
345
+ return l;
346
+ },
347
+ getSeriesValueOptForHeatMap(c) {
348
+ const { data: o, colorState: l, isGradient: h } = c, s = this.options.heatMapColor, t = s.colorsByRange.length || s.rangeCount, r = s.decimalPoint;
349
+ let e, n = 0, i = !1;
350
+ o.forEach(({ o: m }) => {
351
+ n < m && (n = Math.max(n, m)), m < 0 ? i = !0 : e === void 0 ? e = m : e = Math.min(e, m);
352
+ }), i && !h && l.length === t && l.push({
353
+ id: `color#${t}`,
354
+ color: s.error,
355
+ state: "normal",
356
+ label: "Error",
357
+ show: !0
358
+ });
359
+ let a = n > e ? Math.floor((n - e) / t) : 1;
360
+ return n - e <= t && (r > 0 ? a = +((n - e) / t).toFixed(r) : a = 1), {
361
+ min: e,
362
+ max: n,
363
+ interval: a,
364
+ existError: i,
365
+ decimalPoint: r
366
+ };
367
+ },
368
+ /**
369
+ * Get graph items for each series by label index
370
+ * @param {number} labelIndex label index
371
+ *
372
+ * @returns {object} graph item
373
+ */
374
+ getItemByLabelIndex(c) {
375
+ if (c < 0)
376
+ return !1;
377
+ const o = Object.keys(this.seriesList), l = !!this.options.horizontal;
378
+ let h = null, s = null, t = null, r = "", e = 0, n = !1, i = !1;
379
+ if (c > -1) {
380
+ for (let a = 0; a < o.length; a++) {
381
+ const m = o[a], u = this.seriesList[m], d = u.data[c];
382
+ if (d && u.show && u.showLegend) {
383
+ const f = l ? d.y : d.x, y = l ? d.yp : d.xp;
384
+ if (f != null) {
385
+ const g = l ? d.o || d.x : d.o || d.y;
386
+ u.stackIndex ? (e += isNaN(d.o) ? 0 : d.o, n = !0) : e += d.y, (t === null || t <= g) && (t = g, r = m, h = f, s = y);
387
+ }
388
+ }
389
+ }
390
+ i = {
391
+ label: h,
392
+ pos: s,
393
+ value: t === null ? 0 : t,
394
+ sId: r,
395
+ acc: e,
396
+ useStack: n,
397
+ maxIndex: c
398
+ };
399
+ }
400
+ return i;
401
+ },
402
+ getItem(c, o = !1) {
403
+ const { seriesID: l, dataIndex: h } = c;
404
+ let s;
405
+ if ("seriesID" in c) {
406
+ const t = this.getDataByValues(l, h);
407
+ if (!t || !(t != null && t.xp) || !(t != null && t.yp))
408
+ return null;
409
+ s = [
410
+ this.getItemByPosition([t.xp, t.yp], o, h, !0)
411
+ ];
412
+ } else {
413
+ const t = Object.entries(this.seriesList);
414
+ let r;
415
+ for (let e = 0; e < t.length; e++) {
416
+ const [n, i] = t[e];
417
+ if (i.show) {
418
+ r = n;
419
+ break;
420
+ }
421
+ }
422
+ s = h == null ? void 0 : h.map((e) => {
423
+ const n = this.getDataByValues(r, e);
424
+ return n ? this.getItemByPosition(
425
+ [(n == null ? void 0 : n.xp) ?? 0, (n == null ? void 0 : n.yp) ?? 0],
426
+ o,
427
+ e,
428
+ !0
429
+ ) : null;
430
+ });
431
+ }
432
+ return s;
433
+ },
434
+ /**
435
+ *
436
+ * @param seriesID
437
+ * @param dataIndex
438
+ * @returns {*}
439
+ */
440
+ getDataByValues(c, o) {
441
+ const l = this.seriesList[c];
442
+ return !l || isNaN(o) || o < 0 || (l == null ? void 0 : l.data.length) <= o ? !1 : l.data[o];
443
+ },
444
+ /**
445
+ * Find graph item by position x and y
446
+ * @param {array} offset position x and y
447
+ * @param {boolean} useApproximate if it's true. it'll look for closed item on mouse position
448
+ * @param {number} dataIndex selected data index
449
+ * @param {boolean} useSelectLabelOrItem used to display select label/item at tooltip location
450
+ *
451
+ * @returns {object} clicked item information
452
+ */
453
+ getItemByPosition(c, o = !1, l, h = !1) {
454
+ const s = Object.keys(this.seriesList), t = !!this.options.horizontal;
455
+ let r = null, e = null, n = null, i = null, a = "", m = 0, u = !1, d = null;
456
+ for (let f = 0; f < s.length; f++) {
457
+ const y = s[f], g = this.seriesList[y], I = o ? g.findApproximateData : g.findGraphData;
458
+ if (I) {
459
+ const S = I.call(g, c, t, l, h), p = S.data, v = S.index;
460
+ if (p)
461
+ if (L.isPieType(S.type))
462
+ e = y, a = y, n = (p.ea - p.sa) / 2, i = p.o, d = p.index, r = S.type;
463
+ else {
464
+ const D = t ? p.y : p.x, Y = t ? p.yp : p.xp;
465
+ if (D != null) {
466
+ const M = t ? p.o || p.x : p.o || p.y;
467
+ g.stackIndex != null ? (m += isNaN(p.o) ? 0 : p.o, u = !0) : m += p.y, r === "bar" && u ? S.hit && (i = M, a = y, d = v, e = D, n = Y, r = g.type) : (i === null || i <= M) && (i = M, a = y, e = D, n = Y, d = v, r = g.type);
468
+ }
469
+ }
470
+ }
471
+ }
472
+ return {
473
+ type: r,
474
+ label: e,
475
+ pos: n,
476
+ value: i ?? 0,
477
+ sId: a,
478
+ acc: m,
479
+ useStack: u,
480
+ maxIndex: d
481
+ };
482
+ },
483
+ /**
484
+ * @typedef {Object} LabelInfoResult
485
+ * @property {number} labelIndex - 선택된 라벨의 인덱스
486
+ * @property {object} hitInfo - 해당 위치에서의 히트 정보 (getItemByPosition 반환값)
487
+ */
488
+ /**
489
+ * Find label info by position x and y
490
+ * @param {array} offset position x and y
491
+ * @param {string | null} targetAxis target Axis Location ('xAxis', 'yAxis' , null)
492
+ *
493
+ * @returns {LabelInfoResult} clicked label information
494
+ */
495
+ getLabelInfoByPosition(c, o) {
496
+ var y, g, I;
497
+ const [l, h] = c, s = {
498
+ x1: this.chartRect.x1 + this.labelOffset.left,
499
+ x2: this.chartRect.x2 - this.labelOffset.right,
500
+ y1: this.chartRect.y1 + this.labelOffset.top,
501
+ y2: this.chartRect.y2 - this.labelOffset.bottom
502
+ }, t = this.data.series, r = ((y = Object.values(t).sort((S, p) => p.pointSize ?? 0 - S.pointSize ?? 0)[0]) == null ? void 0 : y.pointSize) ?? 3, { horizontal: e, selectLabel: n } = this.options;
503
+ let i, a;
504
+ o === "xAxis" ? (i = this.axesX[0], a = this.scrollbar.x) : o === "yAxis" ? (i = this.axesY[0], a = this.scrollbar.y) : (i = e ? this.axesY[0] : this.axesX[0], a = e ? this.scrollbar.y : this.scrollbar.x);
505
+ const m = s[i.units.rectStart], u = s[i.units.rectEnd];
506
+ let d, f;
507
+ if (a != null && a.use && ((g = i == null ? void 0 : i.labels) != null && g.length)) {
508
+ const { type: S, range: p, interval: v = 1 } = a, [D, Y] = p ?? [0, i.labels.length], M = Math.floor((+Y - +D) / v) + 1, x = (u - m) / M, T = Math.floor(((o === "yAxis" || e ? h : l) - m) / x);
509
+ S === "step" ? d = D + T : d = (i == null ? void 0 : i.labels.findIndex((V) => V === +D)) + T;
510
+ } else if ((I = i == null ? void 0 : i.labels) != null && I.length) {
511
+ const S = (u - m) / i.labels.length, v = Math.floor(((o === "yAxis" ? h : l) - m) / S);
512
+ d = i.labels.length > v ? v : -1;
513
+ } else {
514
+ let S, p;
515
+ l < m - r ? (S = m, p = 0) : l > u + r ? (S = u, p = this.data.labels.length - 1) : S = l, f = this.getItemByPosition(
516
+ [S, h],
517
+ n == null ? void 0 : n.useApproximateValue,
518
+ p,
519
+ !0
520
+ ), d = f.maxIndex ?? -1;
521
+ }
522
+ return {
523
+ labelIndex: d,
524
+ hitInfo: f
525
+ };
526
+ },
527
+ /**
528
+ * Get current mouse target label value in label array or calculated using mouse position
529
+ *
530
+ * @typedef {import('./index').MouseLabelValue} MouseLabelValue
531
+ *
532
+ * @param {string} targetAxis target Axis Location ('xAxis', 'yAxis')
533
+ * @param {array} offset return value from getMousePosition()
534
+ * @param {number} labelIndex
535
+ *
536
+ * @returns {MouseLabelValue} current mouse target label value
537
+ */
538
+ getCurMouseLabelVal(c, o, l) {
539
+ const { type: h, horizontal: s } = this.options, t = c === "xAxis", r = t ? "x" : "y";
540
+ let e = "", n = -1;
541
+ const i = () => {
542
+ let m = "";
543
+ switch (h) {
544
+ case "bar":
545
+ case "line": {
546
+ m = s && !t || !s && t ? this.data.labels[l] : "";
547
+ break;
548
+ }
549
+ case "heatMap": {
550
+ m = this.data.labels[r][l];
551
+ break;
552
+ }
553
+ }
554
+ return m;
555
+ }, a = () => {
556
+ let m = "";
557
+ const u = {
558
+ x1: this.chartRect.x1 + this.labelOffset.left,
559
+ x2: this.chartRect.x2 - this.labelOffset.right,
560
+ y1: this.chartRect.y1 + this.labelOffset.top,
561
+ y2: this.chartRect.y2 - this.labelOffset.bottom
562
+ }, {
563
+ steps: d,
564
+ interval: f,
565
+ graphMin: y
566
+ } = this.axesSteps[r][0], { width: g, height: I } = this.axesRange[r][0].size, S = t ? this.axesX : this.axesY, p = u[S[0].units.rectStart], v = u[S[0].units.rectEnd], D = Math.abs(o[t ? 0 : 1] - p), Y = (t ? g : I) / 2, M = Math.abs(p - v) / d, x = Math.floor((D + Y) / M);
567
+ return M * x + Y > D && M * x - Y < D && (m = x * f + y), m;
568
+ };
569
+ return typeof l == "number" && (e = i(), n = l), e || (e = a(), n = -1), { labelVal: e, labelIdx: n };
570
+ },
571
+ /**
572
+ * Create min/max information for all of data
573
+ * @property seriesList
574
+ *
575
+ * @returns {object} min/max info for all of data
576
+ */
577
+ getStoreMinMax() {
578
+ const c = Object.keys(this.seriesList), o = this.options.horizontal, l = {
579
+ x: [{ min: null, max: null }],
580
+ y: [{ min: null, max: null }]
581
+ };
582
+ return c.length ? c.reduce(
583
+ (h, s) => {
584
+ const t = h, r = this.seriesList[s], e = r.minMax, n = r.xAxisIndex, i = r.yAxisIndex;
585
+ if (t.x[n] || (t.x[n] = { min: null, max: null, maxSID: null }), t.y[i] || (t.y[i] = { min: null, max: null, maxSID: null }), e && r.show) {
586
+ o ? ((t.x[n].min === null || e.minX < t.x[n].min) && (t.x[n].min = e.minX), e.minY !== null && (t.y[i].min === null || e.minY < t.y[i].min) && (t.y[i].min = e.minY)) : (e.minX !== null && (t.x[n].min === null || e.minX < t.x[n].min) && (t.x[n].min = e.minX), (t.y[i].min === null || e.minY < t.y[i].min) && (t.y[i].min = e.minY));
587
+ const a = this.seriesList[s].isExistGrp, m = t.x[n].max < 0;
588
+ (a && m || !t.x[n].max || e.maxX >= t.x[n].max) && (t.x[n].max = e.maxX, t.x[n].maxSID = s);
589
+ const u = t.y[i].max < 0;
590
+ (a && u || !t.y[i].max || e.maxY >= t.y[i].max) && (t.y[i].max = e.maxY, t.y[i].maxSID = s);
591
+ }
592
+ return t;
593
+ },
594
+ {
595
+ x: [{ min: null, max: null, maxSID: null }],
596
+ y: [{ min: null, max: null, maxSID: null }]
597
+ }
598
+ ) : l;
599
+ },
600
+ calculateAngle() {
601
+ const c = this.pieDataSet;
602
+ let o, l, h, s, t, r, e, n, i;
603
+ const a = [], m = {
604
+ "$ev-root": 1.5 * Math.PI
605
+ };
606
+ for (let u = 0; u < c.length; u++) {
607
+ const d = c[u];
608
+ i = !0;
609
+ for (let f = 0; f < d.data.length; f++)
610
+ if (o = d.data[f], l = o.value, i && (i = o.id === "dummy"), !u)
611
+ r = m["$ev-root"], t = 2 * Math.PI * (l / d.total), e = r + t, o.sa = r, o.ea = e, m["$ev-root"] += t;
612
+ else {
613
+ if (h = this.getParentInfo(u - 1, o.parent), !h)
614
+ break;
615
+ m[o.parent] || (m[o.parent] = h.sa), r = m[o.parent], n = h.ea - h.sa, s = d.total[o.parent] || 0, t = n * (l / s), e = r + t, o.sa = r, o.ea = e, m[o.parent] += t;
616
+ }
617
+ i && a.push(u);
618
+ }
619
+ for (let u = 0; u < a.length; u++)
620
+ this.pieDataSet.splice(a, 1);
621
+ this.options.reverse && (this.pieDataSet = k(this.pieDataSet));
622
+ },
623
+ getParentInfo(c, o) {
624
+ for (let l = c; l >= 0; l--) {
625
+ const h = this.pieDataSet[l];
626
+ for (let s = 0; s < h.data.length; s++)
627
+ if (h.data[s].id === o)
628
+ return h.data[s];
629
+ }
630
+ return null;
631
+ },
632
+ /**
633
+ * Get Aggregations (
634
+ * @returns {{}}
635
+ */
636
+ getAggregations() {
637
+ const c = this.data.data, o = this.data.series, l = {}, h = Object.keys(o);
638
+ return h == null || h.forEach((s) => {
639
+ const t = c[s].map((u) => u != null && u.value ? u.value : u), r = t[t.length - 1], e = t.filter(
640
+ (u) => u != null
641
+ ), n = Math.min(...e), i = Math.max(...e), a = e.reduce((u, d) => u + d, 0), m = a / e.length || 0;
642
+ (!L.checkSafeInteger(n) || !L.checkSafeInteger(i) || !L.checkSafeInteger(m) || !L.checkSafeInteger(a) || !L.checkSafeInteger(r)) && console.warn(
643
+ "[EVUI][Chart] The aggregated value exceeds 9007199254740991 or less than -9007199254740991."
644
+ ), l[s] = { min: n, max: i, avg: m, total: a, last: r };
645
+ }), l;
646
+ }
647
+ };
648
+ export {
649
+ z as default
650
+ };