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,221 @@
1
+ class C {
2
+ constructor(t, e, s, o, n, h, i) {
3
+ this.isExecuteZoom = n, this.evChartProps = t.props, this.evChartCloneData = e.data, this.brushIdx = h;
4
+ const a = s.zoom;
5
+ this.setEvChartZoomOptions(a), this.setIcon(o);
6
+ const l = e.data[0].labels.length - 1;
7
+ this.cloneLabelsLastIdx = l, this.isAnimationFinish = !0, this.zoomAreaMemory = {
8
+ previous: [],
9
+ current: [[0, l]],
10
+ latest: []
11
+ }, i && (this.emitFunc = i, i.updateZoomStartIdx(0), i.updateZoomEndIdx(l)), a.useWheelMove && (this.wrapWheelMoveZoomArea = this.wheelMoveZoomArea.bind(this)), this.evChartDomContainers = a.useAnimation ? this.drawAnimationCanvas(t.dom) : t.dom;
12
+ }
13
+ setEvChartZoomOptions(t) {
14
+ this.evChartZoomOptions = t;
15
+ }
16
+ setIcon(t) {
17
+ if (!t)
18
+ return;
19
+ const e = t.querySelector(".dragZoom");
20
+ this.resetIcon = t.querySelector(".reset"), this.previousIcon = t.querySelector(".previous"), this.latestIcon = t.querySelector(".latest"), this.dragZoomIcon = e, this.iconStyle(e, "enable");
21
+ }
22
+ drawAnimationCanvas(t) {
23
+ return t.forEach((e) => {
24
+ const s = document.createElement("canvas");
25
+ s.setAttribute("style", "display: block;"), s.setAttribute("class", "animation-canvas"), s.style.position = "absolute", e.appendChild(s);
26
+ }), t;
27
+ }
28
+ setEventListener(t) {
29
+ const e = t ? "addEventListener" : "removeEventListener";
30
+ this.isUseZoomMode = t, this.evChartDomContainers.forEach((s) => {
31
+ s[e]("wheel", this.wrapWheelMoveZoomArea);
32
+ });
33
+ }
34
+ wheelMoveZoomArea(t) {
35
+ t.preventDefault();
36
+ const [e, s] = this.zoomAreaMemory.current[0];
37
+ if (e === s)
38
+ return;
39
+ let o, n;
40
+ if (t.deltaY > 0) {
41
+ if (!e)
42
+ return;
43
+ o = e - 1, n = s - 1;
44
+ } else {
45
+ if (s === this.cloneLabelsLastIdx)
46
+ return;
47
+ o = e + 1, n = s + 1;
48
+ }
49
+ this.isUseToolbar = !0, this.executeZoom(o, n), this.zoomAreaMemory.current[0] = [o, n];
50
+ }
51
+ clickMoveZoomArea(t) {
52
+ if (!this.zoomAreaMemory[t].length)
53
+ return;
54
+ const [e, s] = this.zoomAreaMemory[t].pop();
55
+ this.isUseToolbar = !0, this.executeZoom(e, s), this.setZoomAreaMemory(
56
+ e,
57
+ s,
58
+ t === "previous" ? "latest" : "previous"
59
+ );
60
+ }
61
+ dragZoom({ data: t, range: { dragSelectionInfo: e } }) {
62
+ const { dragXsp: s, dragXep: o, exceptAxesYChartWidth: n, chartTitle: h } = e, { options: i, data: a } = this.evChartProps, l = i.length > 1 ? i.findIndex((r) => {
63
+ var c;
64
+ return (((c = r == null ? void 0 : r.title) == null ? void 0 : c.text) ?? "") === h;
65
+ }) : 0;
66
+ if (i[l].axesX[0].type === "time") {
67
+ const r = t[0].items, c = r[0].x, u = r[r.length - 1].x, m = a[l].labels, I = this.evChartCloneData[l].labels, [x, g] = this.zoomAreaMemory.current[0];
68
+ let d = I.findIndex(
69
+ (y) => +y.$d == +c.$d
70
+ ), p = I.findLastIndex(
71
+ (y) => +y.$d == +u.$d
72
+ );
73
+ const v = (y) => n / (m.length - 1) * (y - x);
74
+ let Z = v(d);
75
+ if (d === p && (Z - s >= o - Z ? d -= 1 : p += 1), d === x && p === g)
76
+ return;
77
+ d - p === -1 && (Z = v(d));
78
+ const f = v(p);
79
+ this.evChartZoomOptions.useAnimation ? this.dragZoomAnimation(
80
+ e,
81
+ d,
82
+ p,
83
+ Z,
84
+ f
85
+ ) : (this.executeZoom(d, p), this.setZoomAreaMemory(d, p));
86
+ }
87
+ }
88
+ dragZoomAnimation(t, e, s, o, n) {
89
+ const { chartRange: h, exceptAxesYChartWidth: i, exceptAxesXChartHeight: a } = t, l = window.devicePixelRatio || 1, r = Array.from(this.evChartDomContainers).map((c) => {
90
+ const u = c.querySelector(".animation-canvas");
91
+ return [c.children[0], u];
92
+ });
93
+ for (let c = 0; c < r.length; c++) {
94
+ const [u, m] = r[c], I = m.getContext("2d");
95
+ m.style.top = `${h.y1}px`, m.style.left = `${h.x1}px`, m.width = i * l, m.style.width = `${i}px`, m.height = a * l, m.style.height = `${a}px`, m.style.display === "none" && (m.style.display = "block"), this.isAnimationFinish = !1, this.isUseToolbar = !0, this.executeDragZoomAnimation(
96
+ u,
97
+ I,
98
+ t,
99
+ o,
100
+ n
101
+ ).then((x) => {
102
+ m.style.display = "none", x && c === r.length - 1 && (this.isAnimationFinish = x, this.executeZoom(e, s), this.setZoomAreaMemory(e, s));
103
+ });
104
+ }
105
+ }
106
+ executeZoom(t, e) {
107
+ this.isExecuteZoom && (this.isExecuteZoom.value = !0);
108
+ for (let s = 0; s < this.evChartCloneData.length; s++) {
109
+ const {
110
+ data: o,
111
+ labels: n,
112
+ series: h
113
+ } = this.evChartCloneData[s], i = this.evChartProps.data[s], a = Object.keys(h);
114
+ for (let l = 0; l < a.length; l++) {
115
+ const r = a[l];
116
+ i.data[r] = o[r].filter(
117
+ (c, u) => t <= u && e >= u
118
+ );
119
+ }
120
+ i.labels = n.filter(
121
+ (l, r) => t <= r && e >= r
122
+ );
123
+ }
124
+ !this.brushIdx.isUseButton && !this.brushIdx.isUseScroll && (this.brushIdx.start = t, this.brushIdx.end = e), this.emitFunc && (this.emitFunc.updateZoomStartIdx(t), this.emitFunc.updateZoomEndIdx(e));
125
+ }
126
+ setBrushIdx(t, e) {
127
+ this.brushIdx.end = -1;
128
+ for (let s = 0; s < e.value.length; s++) {
129
+ const o = t.data[e.value[s]];
130
+ o.labels.length && (this.brushIdx.start = 0, this.brushIdx.end = o.labels.length - 1);
131
+ }
132
+ }
133
+ updateEvChartCloneData(t, e, s, o) {
134
+ const n = t.data[0].labels.length - 1;
135
+ if (this.cloneLabelsLastIdx = n, this.evChartCloneData = t.data, o) {
136
+ const h = this.zoomAreaMemory.current[0];
137
+ let i = h[0], a = h[1];
138
+ i === 0 && a === -1 && (i = 0, a = n, this.zoomAreaMemory = {
139
+ previous: [],
140
+ current: [[i, a]],
141
+ latest: []
142
+ }), this.emitFunc && (this.emitFunc.updateZoomStartIdx(i), this.emitFunc.updateZoomEndIdx(a)), this.executeZoom(i, a);
143
+ } else
144
+ this.dragZoomIcon && this.dragZoomIcon.classList.remove("active"), this.zoomAreaMemory = {
145
+ previous: [],
146
+ current: [[0, n]],
147
+ latest: []
148
+ }, this.emitFunc && (this.emitFunc.updateZoomStartIdx(0), this.emitFunc.updateZoomEndIdx(n)), this.setIconStyle(s), this.setBrushIdx(t, e);
149
+ }
150
+ setZoomAreaMemory(t, e, s) {
151
+ if (t < 0 || e <= 0)
152
+ return;
153
+ const { previous: o, current: n, latest: h } = this.zoomAreaMemory, i = n.pop(), { bufferMemoryCnt: a } = this.evChartZoomOptions;
154
+ s ? (o.length >= a && o.splice(0, o.length - a + 1), this.zoomAreaMemory[s].push(i)) : (t !== i[0] || e !== i[1]) && (i[0] === 0 && i[1] === -1 ? o.push([0, this.cloneLabelsLastIdx]) : o.push(i), h.length = 0), n.push([t, e]), this.setIconStyle(this.isUseZoomMode);
155
+ }
156
+ executeDragZoomAnimation(t, e, s, o, n) {
157
+ const { chartRange: h, exceptAxesYChartWidth: i, exceptAxesXChartHeight: a } = s;
158
+ let l = 0, r = o, c = n - o, u = n, m = 1;
159
+ const I = 15e-4;
160
+ let x = 0.5;
161
+ const g = 0.1, d = 0.05, p = 50, v = Math.ceil(p * (o / i)), Z = Math.ceil(
162
+ p * ((i - n) / i)
163
+ ), f = (y) => (e.clearRect(0, 0, i, a), r <= 0 && c >= i ? (t.style.opacity = "initial", y(!0)) : (x >= g && (t.style.opacity = x, x -= d), e.globalAlpha = m, e.drawImage(
164
+ t,
165
+ h.x1,
166
+ h.y1,
167
+ o,
168
+ a,
169
+ l,
170
+ 0,
171
+ o,
172
+ a
173
+ ), e.drawImage(
174
+ t,
175
+ h.x1 + o,
176
+ h.y1,
177
+ n - o,
178
+ a,
179
+ r,
180
+ 0,
181
+ c,
182
+ a
183
+ ), e.drawImage(
184
+ t,
185
+ h.x1 + n,
186
+ h.y1,
187
+ i,
188
+ a,
189
+ u,
190
+ 0,
191
+ i,
192
+ a
193
+ ), m -= I, l -= v, r -= v, c += v + Z, u += Z, requestAnimationFrame(() => f(y))));
194
+ return new Promise((y) => f(y));
195
+ }
196
+ setIconStyle(t) {
197
+ const e = (s, o) => {
198
+ o ? this.iconStyle(s, "enable") : this.iconStyle(s, "disable");
199
+ };
200
+ if (t && this.dragZoomIcon.classList.contains("active")) {
201
+ const { previous: s, latest: o } = this.zoomAreaMemory;
202
+ e(this.previousIcon, s.length), e(this.latestIcon, o.length), this.iconStyle(this.resetIcon, "enable");
203
+ } else
204
+ e(this.resetIcon), e(this.previousIcon), e(this.latestIcon);
205
+ }
206
+ iconStyle(t, e) {
207
+ if (!t)
208
+ return;
209
+ const [s, o] = e === "enable" ? [1, "initial"] : [0.5, "none"];
210
+ t.style.opacity = s, t.style.pointerEvents = o;
211
+ }
212
+ initZoom() {
213
+ if (!this.isAnimationFinish)
214
+ return;
215
+ const [t, e] = this.zoomAreaMemory.current[0], s = this.cloneLabelsLastIdx;
216
+ (t !== 0 || e !== s) && (this.isUseToolbar = !0, this.executeZoom(0, s), this.setZoomAreaMemory(0, s));
217
+ }
218
+ }
219
+ export {
220
+ C as default
221
+ };
@@ -0,0 +1,358 @@
1
+ import { defaultsDeep as ht } from "lodash-es";
2
+ import { truthyNumber as E, truthy as at } from "../../../common/utils.js";
3
+ import { BAR_OPTION as ct, COLOR as nt } from "../helpers/helpers.constant.js";
4
+ import H from "../helpers/helpers.canvas.js";
5
+ import F from "../helpers/helpers.util.js";
6
+ class yt {
7
+ constructor(t, o, h, c) {
8
+ const r = ht({}, o, ct);
9
+ Object.keys(r).forEach((l) => {
10
+ this[l] = r[l];
11
+ }), this.name === void 0 && (this.name = `series-${h}`), this.color === void 0 && (this.color = nt[h % nt.length]), this.type = "bar", this.sId = t, this.data = [], this.isHorizontal = c, this.size = {
12
+ cat: 0,
13
+ bar: 0,
14
+ cPad: 0,
15
+ bPad: 0,
16
+ w: 0,
17
+ h: 0,
18
+ ix: 0
19
+ };
20
+ }
21
+ /**
22
+ * Draw series data
23
+ * @param {object} param object for drawing series data
24
+ *
25
+ * @returns {undefined}
26
+ */
27
+ draw(t) {
28
+ var K, Q, tt, et, st;
29
+ if (!this.show)
30
+ return;
31
+ const { isHorizontal: o, showValue: h } = this, c = t.ctx, r = t.chartRect, l = t.labelOffset, e = t.axesSteps, i = t.showIndex, a = t.thickness, n = t.showSeriesCount;
32
+ let s, g;
33
+ const d = e.x[this.xAxisIndex], x = e.y[this.yAxisIndex];
34
+ let p = this.data.length;
35
+ const [M, f] = o ? [x.minIndex, x.maxIndex] : [d.minIndex, d.maxIndex];
36
+ E(M) && E(f) && (p = f - M + 1);
37
+ const C = r.chartWidth - (l.left + l.right), z = r.chartHeight - (l.top + l.bottom), w = r.x1 + l.left, I = r.y2 - l.bottom, S = H.calculateX(0, d.graphMin, d.graphMax, C), G = H.calculateY(0, x.graphMin, x.graphMax, z), b = o ? w + S : w, v = o ? I : I + G, Y = o ? z : C, R = Y / (p || 1);
38
+ let m;
39
+ t.cPadRatio >= 1 || t.cPadRatio <= 0 ? m = 2 : m = Math.max(Y * (t.cPadRatio / 2) / p, 2);
40
+ let P, u, T;
41
+ P = R > m * 2 ? R - m * 2 : R, P = this.isExistGrp ? P : P / n;
42
+ const O = this.calculateBarSize(a, P);
43
+ u = o ? null : O, T = o ? O : null;
44
+ const L = o ? (P - T) / 2 : (P - u) / 2, _ = this.isExistGrp ? 1 : i + 1;
45
+ this.size.cat = R, this.size.bar = P, this.size.cPad = m, this.size.bPad = L, this.size.w = u, this.size.h = T, this.size.ix = _, this.chartRect = r, this.labelOffset = l, this.borderRadius = t.borderRadius, this.filteredCount = p;
46
+ const J = E(M) ? M : 0, lt = E(f) ? f : this.data.length - 1;
47
+ for (let B = J; B <= lt; B++) {
48
+ const U = B - J, y = this.data[B];
49
+ if (y) {
50
+ const it = o ? v - R * U - m : b + R * U + m;
51
+ if (o ? (s = b, g = Math.round(it - (P * _ - (T + L)))) : (s = Math.round(it + (P * _ - (u + L))), g = v), o) {
52
+ const V = y.b ? y.o : y.x, N = Math.min(
53
+ Math.max(V, d.graphMin),
54
+ d.graphMax
55
+ );
56
+ if (u = H.calculateX(
57
+ N,
58
+ d.graphMin,
59
+ d.graphMax,
60
+ C,
61
+ -S
62
+ ), y.b) {
63
+ const q = Math.min(
64
+ Math.max(y.b, d.graphMin),
65
+ d.graphMax
66
+ );
67
+ s = H.calculateX(
68
+ q,
69
+ d.graphMin,
70
+ d.graphMax,
71
+ C,
72
+ b - S
73
+ );
74
+ }
75
+ const j = V > 0 ? -1 : 1;
76
+ u = V && Math.abs(u) === 0 ? j : u;
77
+ } else {
78
+ const V = y.b ? y.o : y.y, N = Math.min(
79
+ Math.max(V, x.graphMin),
80
+ x.graphMax
81
+ );
82
+ if (T = H.calculateY(
83
+ N,
84
+ x.graphMin,
85
+ x.graphMax,
86
+ z,
87
+ -G
88
+ ), y.b) {
89
+ const q = Math.min(
90
+ Math.max(y.b, x.graphMin),
91
+ x.graphMax
92
+ );
93
+ g = H.calculateY(
94
+ q,
95
+ x.graphMin,
96
+ x.graphMax,
97
+ z,
98
+ v - G
99
+ );
100
+ }
101
+ const j = V > 0 ? -1 : 1;
102
+ T = V && Math.abs(T) === 0 ? j : T;
103
+ }
104
+ const D = y.dataColor || this.color, k = t == null ? void 0 : t.legendHitInfo, X = (K = t == null ? void 0 : t.selectLabel) == null ? void 0 : K.option, Z = (Q = t == null ? void 0 : t.selectItem) == null ? void 0 : Q.option, ot = ((et = (tt = t == null ? void 0 : t.selectLabel) == null ? void 0 : tt.selected) == null ? void 0 : et.dataIndex) ?? [], { dataIndex: $, seriesID: rt } = ((st = t == null ? void 0 : t.selectItem) == null ? void 0 : st.selected) ?? {};
105
+ let A = !1;
106
+ if (k ? A = (k == null ? void 0 : k.sId) !== this.sId : X != null && X.use && (X != null && X.useSeriesOpacity) ? A = ot.length && !ot.includes(B) : at($) && (Z != null && Z.useSeriesOpacity) && (this.isExistGrp ? A = $ !== B : A = $ !== B || rt !== this.sId), typeof D != "string")
107
+ c.fillStyle = H.createGradient(
108
+ c,
109
+ o,
110
+ { x: s, y: g, w: u, h: T },
111
+ D,
112
+ A,
113
+ t.unSelectedOpacity
114
+ );
115
+ else {
116
+ const V = D.includes("rgba") ? F.getOpacity(D) : 1, N = A ? t.unSelectedOpacity : V;
117
+ c.fillStyle = F.colorStringToRgba(D, N);
118
+ }
119
+ this.drawBar({
120
+ ctx: c,
121
+ positions: { x: s, y: g, w: u, h: T }
122
+ }), h.use && this.drawValueLabels({
123
+ context: c,
124
+ data: y,
125
+ positions: {
126
+ x: s,
127
+ y: g,
128
+ h: T,
129
+ w: u
130
+ },
131
+ isHighlight: !1,
132
+ textColor: y.dataTextColor,
133
+ index: B
134
+ }), y.xp = s, y.yp = g, y.w = u, y.h = o ? -T : T, y.index = B, this.data[U] = y;
135
+ }
136
+ }
137
+ }
138
+ /**
139
+ * Draw item highlight
140
+ * @param {object} item object for drawing series data
141
+ * @param {CanvasRenderingContext2D} context canvas context
142
+ * @param {number} index label index
143
+ * @param {number} unSelectedOpacity - opacity when not selected (0-1)
144
+ *
145
+ * @returns {undefined}
146
+ */
147
+ itemHighlight(t, o, h, c) {
148
+ const r = this.showValue, l = t.data, e = o, i = l.xp, a = l.yp, n = l.w, s = l.h;
149
+ e.save(), e.shadowOffsetX = 0, e.shadowOffsetY = 0, e.shadowBlur = 4;
150
+ const g = t.data.dataColor || this.color;
151
+ if (typeof g != "string") {
152
+ const d = H.createGradient(
153
+ e,
154
+ this.isHorizontal,
155
+ { x: i, y: a, w: n, h: s },
156
+ g,
157
+ !1,
158
+ c
159
+ );
160
+ e.fillStyle = d, e.shadowColor = g[g.length - 1][1];
161
+ } else
162
+ e.fillStyle = g, e.shadowColor = g;
163
+ e.beginPath(), this.drawBar({
164
+ ctx: e,
165
+ positions: { x: i, y: a, w: n, h: this.isHorizontal ? -s : s }
166
+ }), r.use && this.drawValueLabels({
167
+ context: e,
168
+ data: l,
169
+ positions: {
170
+ x: i,
171
+ y: a,
172
+ h: s,
173
+ w: n
174
+ },
175
+ isHighlight: !0,
176
+ textColor: t.data.dataTextColor || t.dataTextColor,
177
+ index: h
178
+ }), e.restore();
179
+ }
180
+ /**
181
+ * Find graph item
182
+ * @param {array} offset mouse position
183
+ * @param {boolean} isHorizontal determines if a horizontal option's value
184
+ * @param {number} dataIndex selected label data index
185
+ * @param {boolean} useIndicatorOnLabel
186
+ *
187
+ * @returns {object} graph item
188
+ */
189
+ findGraphData(t, o, h, c) {
190
+ if (typeof h == "number" && this.show && c) {
191
+ const r = this.data, l = { data: null, hit: !1, color: this.color };
192
+ return r[h] && (l.data = r[h], l.index = h, l.hit = this.isPointInBar(t, r[h])), l;
193
+ }
194
+ return o ? this.findGraphRangeCount(t) : this.findGraphRange(t);
195
+ }
196
+ /**
197
+ * Find graph item
198
+ * @param {array} offset mouse position
199
+ *
200
+ * @returns {object} graph item
201
+ */
202
+ /**
203
+ * Binary search for finding graph item
204
+ * @private
205
+ * @param {array} offset - mouse position
206
+ * @param {boolean} isHorizontal - search orientation
207
+ * @returns {object} graph item
208
+ */
209
+ binarySearchBar(t, o) {
210
+ const [h, c] = t, r = { data: null, hit: !1, color: this.color }, l = this.data, e = this.filteredCount ?? l.length;
211
+ let i = 0, a = e - 1;
212
+ for (; i <= a; ) {
213
+ const n = Math.floor((i + a) / 2), s = l[n], { xp: g, yp: d, w: x, h: p } = s, M = g + x, f = d + p;
214
+ if (o ? f <= c && c <= d : g <= h && h <= M)
215
+ return r.data = s, r.index = s.index, r.hit = this.isPointInBar(t, s), r;
216
+ (o ? !(f < c) : g + 4 < h) ? i = n + 1 : a = n - 1;
217
+ }
218
+ return r;
219
+ }
220
+ findGraphRange(t) {
221
+ return this.binarySearchBar(t, !1);
222
+ }
223
+ /**
224
+ * Find graph item (horizontal)
225
+ * @param {array} offset mouse position
226
+ *
227
+ * @returns {object} graph item
228
+ */
229
+ findGraphRangeCount(t) {
230
+ return this.binarySearchBar(t, !0);
231
+ }
232
+ /**
233
+ * Draw value label if series 'use' of showValue option is true
234
+ *
235
+ * @param context canvas context
236
+ * @param data series value data (model.store.js addData return value)
237
+ * @param positions series value positions
238
+ * @param isHighlight draw label with highlight effect
239
+ * @param textColor data text color
240
+ * @param index label index
241
+ */
242
+ drawValueLabels({ context: t, data: o, positions: h, isHighlight: c, textColor: r, index: l }) {
243
+ const e = this.isHorizontal, { fontSize: i, textColor: a, align: n, formatter: s, decimalPoint: g } = this.showValue, { x: d, y: x, w: p, h: M } = h, f = t;
244
+ f.save(), f.beginPath(), f.font = `normal normal normal ${i}px Roboto`, f.fillStyle = r || a, f.lineWidth = 1, f.textBaseline = "middle", f.textAlign = e && n !== "center" ? "left" : "center";
245
+ let C;
246
+ const z = at(this.stackIndex);
247
+ z ? C = o.o : C = (e ? o.x : o.y) ?? "";
248
+ let w;
249
+ s && (w = s(C, {
250
+ label: e ? o.y : o.x,
251
+ index: l
252
+ })), (!s || typeof w != "string") && (w = F.labelSignFormat(C, g) ?? "");
253
+ const I = C < 0, S = Math.round(f.measureText(w).width), G = i, b = 10, v = I ? d - b : d + b, Y = I ? x + b : x - b, R = d + p / 2, m = c ? x + M / 2 : x - M / 2, W = Math.abs(p) - b, P = Math.abs(M) - b;
254
+ switch (n) {
255
+ case "start": {
256
+ if (e && S < W) {
257
+ const u = I ? v - S : v;
258
+ f.fillText(w, u, m);
259
+ } else if (!e && G < P) {
260
+ const u = I ? x + b : x - b;
261
+ f.fillText(w, R, u);
262
+ }
263
+ break;
264
+ }
265
+ case "center": {
266
+ e && S < W ? f.fillText(w, R, m) : !e && G < P && f.fillText(w, R, x + M / 2);
267
+ break;
268
+ }
269
+ case "out": {
270
+ if (z) {
271
+ console.warn(
272
+ "[EVUI][Bar Chart] In case of Stack Bar Chart, 'out' of 'showValue''s align is not supported."
273
+ );
274
+ return;
275
+ }
276
+ if (e) {
277
+ const u = this.chartRect.x1 + this.labelOffset.left, T = this.chartRect.x2 - this.labelOffset.right;
278
+ if (I) {
279
+ const O = d - b + p - S;
280
+ O > u && f.fillText(w, O, m);
281
+ } else {
282
+ const O = d + b + p;
283
+ O + S < T && f.fillText(w, O, m);
284
+ }
285
+ } else {
286
+ const u = I ? x + M + b : x + M - b;
287
+ f.fillText(w, R, u);
288
+ }
289
+ break;
290
+ }
291
+ default:
292
+ case "end": {
293
+ if (e && S < W) {
294
+ const u = I ? d + p + b : d + p - S - b;
295
+ f.fillText(w, u, m);
296
+ } else if (!e) {
297
+ if (I) {
298
+ const u = x + M - b;
299
+ u > Y && f.fillText(w, R, u);
300
+ } else if (G < P) {
301
+ const u = x + M + b;
302
+ f.fillText(w, R, u);
303
+ }
304
+ }
305
+ break;
306
+ }
307
+ }
308
+ f.restore();
309
+ }
310
+ /**
311
+ * Calculate bar size based on thickness
312
+ * @private
313
+ * @param {string|number} thickness - thickness value
314
+ * @param {number} bArea - available bar area
315
+ * @returns {number} calculated size
316
+ */
317
+ calculateBarSize(t, o) {
318
+ return typeof t == "string" && /[0-9]+px/.test(t) ? Math.min(o, Number(t.replace("px", ""))) : typeof t == "number" && t <= 1 && t >= 0 ? Math.ceil(o * t) : o;
319
+ }
320
+ drawBar({ ctx: t, positions: o }) {
321
+ const { isHorizontal: h, borderRadius: c } = this, r = "stackIndex" in this, l = c && c > 0, { x: e, y: i, w: a } = o, n = h ? -o.h : o.h;
322
+ if (!(a === 0 || n === 0)) {
323
+ if (t.save(), l && !r)
324
+ try {
325
+ this.drawRoundedRect(t, o);
326
+ } catch {
327
+ t.fillRect(e, i, a, n);
328
+ }
329
+ else
330
+ t.fillRect(e, i, a, n);
331
+ t.restore();
332
+ }
333
+ }
334
+ /**
335
+ * Check if point is within bar boundaries
336
+ * @param {array} offset - [x, y] mouse position
337
+ * @param {object} barData - bar data object with xp, yp, w, h properties
338
+ * @returns {boolean} true if point is within bar
339
+ */
340
+ isPointInBar(t, o) {
341
+ const [h, c] = t, { xp: r, yp: l, w: e, h: i } = o, a = r + e, n = l + i;
342
+ return r <= h && h <= a && n <= c && c <= l;
343
+ }
344
+ drawRoundedRect(t, o) {
345
+ const { chartRect: h, labelOffset: c, isHorizontal: r, borderRadius: l } = this, { x: e, y: i } = o;
346
+ let { w: a, h: n } = o, s = l;
347
+ const g = new Path2D();
348
+ g.rect(
349
+ h.x1 + c.left,
350
+ h.y1,
351
+ h.chartWidth - c.right,
352
+ h.chartHeight - c.bottom
353
+ ), t.clip(g), t.beginPath(), t.moveTo(e, i), Math.abs(a) < s * 2 && (s = Math.abs(a) / 2), Math.abs(n) < s * 2 && (s = Math.abs(n) / 2), r ? a < 0 ? (a += s, t.lineTo(e + a, i), t.arcTo(e + a - s, i, e + a - s, i - s, s), t.arcTo(e + a - s, i - n, e + a, i - n, s), t.lineTo(e, i - n), t.lineTo(e, i)) : (a -= s, t.lineTo(e + a, i), t.arcTo(e + a + s, i, e + a + s, i - s, s), t.arcTo(e + a + s, i - n, e + a, i - n, s), t.lineTo(e, i - n), t.lineTo(e, i)) : n > 0 ? (n -= s, t.lineTo(e + a, i), t.lineTo(e + a, i + n), t.arcTo(e + a, i + n + s, e - a + s, i + n + s, s), t.arcTo(e, i + n + s, e, i + n, s), t.lineTo(e, i)) : (n += s, t.lineTo(e + a, i), t.lineTo(e + a, i + n), t.arcTo(e + a, i + n - s, e + a - s, i + n - s, s), t.arcTo(e, i + n - s, e, i + n, s), t.lineTo(e, i)), t.fill(), t.closePath();
354
+ }
355
+ }
356
+ export {
357
+ yt as default
358
+ };
@@ -0,0 +1,55 @@
1
+ import n from "../helpers/helpers.canvas.js";
2
+ import G from "./element.bar.js";
3
+ import P from "../helpers/helpers.util.js";
4
+ class L extends G {
5
+ /**
6
+ * Draw series data
7
+ * It shows partial bar item as time goes by.
8
+ * @param {object} param object for drawing series data
9
+ *
10
+ * @returns {undefined}
11
+ */
12
+ draw(a) {
13
+ if (!this.show)
14
+ return;
15
+ const f = a.ctx, d = a.chartRect, o = a.labelOffset, R = a.axesSteps, Y = a.showIndex, i = a.isHorizontal, p = a.thickness, H = a.showSeriesCount;
16
+ let t, c;
17
+ const r = R.x[this.xAxisIndex], h = R.y[this.yAxisIndex], b = d.chartWidth - (o.left + o.right), y = d.chartHeight - (o.top + o.bottom), u = d.x1 + o.left, w = d.y2 - o.bottom, S = d.x2 - o.right, z = (i ? y : b) / (this.data.length || 1), A = 2;
18
+ let l;
19
+ this.isExistGrp ? l = z - A * 2 : l = (z - A * 2) / H;
20
+ const O = typeof p == "string" && /[0-9]+px/.test(p) ? Math.min(l, Number(p.replace("px", ""))) : typeof p == "number" && p <= 1 && p >= 0 ? Math.ceil(l * p) : l;
21
+ let e = i ? null : O, g = i ? null : O, x = i ? O : null;
22
+ const X = i ? (l - x) / 2 : (l - e) / 2, C = this.isExistGrp ? 1 : Y + 1;
23
+ this.size.cat = z, this.size.bar = l, this.size.cPad = A, this.size.bPad = X, this.size.w = e, this.size.ix = C, this.chartRect = d, this.labelOffset = o, this.borderRadius = a.borderRadius, this.data.forEach((s, I) => {
24
+ if (f.beginPath(), i ? (t = u, c = n.calculateY(s.y, h.graphMin, h.graphMax, y, w)) : (t = n.calculateSubX(s.x, r.graphMin, r.graphMax, b, u), t < u ? (g -= u - t, t = t + e < u ? null : u) : t + e > S && (g -= g - (S - t)), t >= S && (t = null), t !== null && (t += Math.ceil(l * C) - Math.round(e + X)), c = w), i ? s.b ? (e = n.calculateX(s.x - s.b, r.graphMin, r.graphMax, b), t = n.calculateX(s.b, r.graphMin, r.graphMax, b, u)) : e = n.calculateX(s.x, r.graphMin, r.graphMax, b) : s.b ? (x = n.calculateY(s.y - s.b, h.graphMin, h.graphMax, y), c = n.calculateY(s.b, h.graphMin, h.graphMax, y, w)) : x = n.calculateY(s.y, h.graphMin, h.graphMax, y), t !== null && c !== null) {
25
+ const M = s.dataColor || this.color, B = M.includes("rgba") ? P.getOpacity(M) : 1, E = this.state === "downplay" ? a.unSelectedOpacity : B;
26
+ typeof M != "string" ? (e = e !== g ? g : e, f.fillStyle = n.createGradient(
27
+ f,
28
+ i,
29
+ { x: t, y: c, w: e, h: x },
30
+ M,
31
+ this.state === "downplay",
32
+ a.unSelectedOpacity
33
+ )) : f.fillStyle = P.colorStringToRgba(M, E), this.drawBar({
34
+ ctx: f,
35
+ positions: { x: t, y: c, w: e, h: x }
36
+ }), this.showValue.use && this.drawValueLabels({
37
+ context: f,
38
+ data: s,
39
+ positions: {
40
+ x: t,
41
+ y: c,
42
+ h: x,
43
+ w: e
44
+ },
45
+ isHighlight: !1,
46
+ index: I
47
+ });
48
+ }
49
+ g = e, s.xp = t, s.yp = c, s.w = e, s.h = i ? -x : x;
50
+ });
51
+ }
52
+ }
53
+ export {
54
+ L as default
55
+ };