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,403 +0,0 @@
1
- import { merge as v } from "lodash-es";
2
- import { convertToPercent as H, truthyNumber as X, checkNullAndUndefined as N, truthy as D } from "../../../common/utils.js";
3
- import P from "../helpers/helpers.util.js";
4
- import { HEAT_MAP_OPTION as U } from "../helpers/helpers.constant.js";
5
- class Z {
6
- constructor(e, o, s, t, i) {
7
- const n = v({}, U, o);
8
- Object.keys(n).forEach((a) => {
9
- this[a] = n[a];
10
- }), this.isHorizontal = t, this.isGradient = i, this.createColorState(s), this.sId = e, this.data = [], this.labels = {
11
- x: [],
12
- y: []
13
- }, this.valueOpt = {}, this.size = {
14
- w: 0,
15
- h: 0
16
- }, this.type = "heatMap", this.currentLabelInfo = {
17
- x: {
18
- steps: 0,
19
- min: 0,
20
- max: 0
21
- },
22
- y: {
23
- steps: 0,
24
- min: 0,
25
- max: 0
26
- }
27
- };
28
- }
29
- /**
30
- * create series color axis
31
- * @param colorOpt
32
- * @returns {*[]}
33
- */
34
- createColorState(e) {
35
- const o = [], s = /[^0-9]&[^,]/g, { min: t, max: i, rangeCount: n, colorsByRange: a, error: l, stroke: d } = e, g = t.includes("#") ? P.hexToRgb(t) : t.replace(s, ""), m = i.includes("#") ? P.hexToRgb(i) : i.replace(s, ""), [f, h, c] = g.split(","), [b, M, r] = m.split(",");
36
- if (this.isGradient)
37
- o.push({
38
- minColor: { minR: f, minG: h, minB: c },
39
- maxColor: { maxR: b, maxG: M, maxB: r },
40
- rangeCount: n,
41
- start: 0,
42
- end: 100,
43
- selectedValue: null
44
- });
45
- else if (a.length)
46
- a.forEach(({ color: x, label: C }, u) => {
47
- o.push({
48
- id: `color#${u}`,
49
- color: x,
50
- label: C,
51
- state: "normal",
52
- show: !0
53
- });
54
- });
55
- else {
56
- const x = Math.floor((f - b) / (n - 1)), C = Math.floor((h - M) / (n - 1)), u = Math.floor((c - r) / (n - 1));
57
- for (let y = 0; y < n; y++) {
58
- const I = +f - x * y, w = +h - C * y, p = +c - u * y;
59
- o.push({
60
- id: `color#${y}`,
61
- color: `rgb(${I},${w},${p})`,
62
- state: "normal",
63
- show: !0
64
- });
65
- }
66
- }
67
- this.colorState = o, this.errorColor = l, this.stroke = d;
68
- }
69
- getColorForGradient(e) {
70
- const { minColor: o, maxColor: s } = this.colorState[0], { minR: t, minG: i, minB: n } = o, { maxR: a, maxG: l, maxB: d } = s, g = +t - Math.floor((t - a) * e / 100), m = +i - Math.floor((i - l) * e / 100), f = +n - Math.floor((n - d) * e / 100);
71
- return `rgb(${g},${m},${f})`;
72
- }
73
- getColorIndexByValue(e) {
74
- const { existError: o, min: s, interval: t, decimalPoint: i } = this.valueOpt, n = this.colorState.length - 1;
75
- if (o && e < 0)
76
- return n;
77
- const a = Math.floor(+(e - s).toFixed(i) / t);
78
- return a >= n ? o ? n - 1 : n : a;
79
- }
80
- getItemInfo(e) {
81
- const { min: o, max: s } = this.valueOpt, t = {
82
- show: !1,
83
- opacity: 1,
84
- dataColor: null,
85
- id: null,
86
- isHighlight: null
87
- };
88
- if (this.isGradient) {
89
- const i = H(e - o, s - o), { start: n, end: a, selectedValue: l } = this.colorState[0];
90
- (e < 0 || n <= i && i <= a) && (t.show = !0, t.isHighlight = l !== null && Math.floor(e) === Math.floor(o + (s - o) * (l / 100)), t.dataColor = e < 0 ? this.errorColor : this.getColorForGradient(i));
91
- } else {
92
- const i = this.getColorIndexByValue(e), { show: n, state: a, color: l, id: d } = this.colorState[i];
93
- t.show = n, t.opacity = a === "downplay" ? 0.1 : 1, t.dataColor = e < 0 ? this.errorColor : l, t.id = d;
94
- }
95
- return t;
96
- }
97
- drawItem(e, o, s, t, i, n) {
98
- if (e.beginPath(), !(t < 0 || i < 0)) {
99
- if (n.show) {
100
- const { radius: a } = n;
101
- if (a > 0) {
102
- const l = Math.min(t, i);
103
- let d = a;
104
- d > l / 2 && (d = Math.floor(l / 2)), e.moveTo(o + d, s), e.arcTo(o + t, s, o + t, s + i, d), e.arcTo(o + t, s + i, o, s + i, d), e.arcTo(o, s + i, o, s, d), e.arcTo(o, s, o + t, s, d), e.stroke(), e.fill();
105
- } else
106
- e.strokeRect(o, s, t, i), e.fillRect(o, s, t, i);
107
- } else {
108
- const a = P.aliasPixel(1);
109
- e.fillRect(o, s - a, t + a, i + a);
110
- }
111
- e.closePath();
112
- }
113
- }
114
- calculateXY(e, o, s, t) {
115
- let i = null;
116
- if (this.labels[e] && this.labels[e].length) {
117
- let n = this.labels[e].findIndex((f) => f === o);
118
- n === -1 && (n = this.labels[e].findIndex((f) => +f == +o));
119
- const { minIndex: a, maxIndex: l, graphMin: d, graphMax: g } = t;
120
- if (X(l) && n > l || X(a) && n < a || N(a) && N(l) && (o < d || o > g))
121
- return null;
122
- const m = a ?? this.labels[e].findIndex((f) => +f == +d);
123
- n > -1 && (n -= m > -1 ? m : 0, i = e === "x" ? s + this.size.w * n : s - this.size.h * (n + 1));
124
- }
125
- return i;
126
- }
127
- draw(e) {
128
- if (!this.show)
129
- return;
130
- const {
131
- ctx: o,
132
- chartRect: s,
133
- labelOffset: t,
134
- overlayCtx: i,
135
- selectLabel: n,
136
- legendHitInfo: a,
137
- selectItem: l,
138
- axesSteps: d
139
- } = e, g = s.chartWidth - (t.left + t.right), m = s.chartHeight - (t.top + t.bottom), f = s.x1 + t.left, h = s.y2 - t.bottom, c = d.x[this.xAxisIndex], b = d.y[this.yAxisIndex];
140
- this.size.w = g / c.oriSteps, this.size.h = m / b.oriSteps, this.currentLabelInfo = {
141
- x: {
142
- steps: c.oriSteps,
143
- min: c.graphMin,
144
- max: c.graphMax
145
- },
146
- y: {
147
- steps: b.oriSteps,
148
- min: b.graphMin,
149
- max: b.graphMax
150
- }
151
- };
152
- const M = (r, x, C) => {
153
- var u, y;
154
- if (!a) {
155
- let I;
156
- const { option: w, selected: p } = l, { option: T, selected: S } = n, O = D(p == null ? void 0 : p.dataIndex) && (p == null ? void 0 : p.dataIndex) > -1, B = ((u = S == null ? void 0 : S.label) == null ? void 0 : u.length) > 0;
157
- return O ? I = w.useSeriesOpacity ? C !== (p == null ? void 0 : p.dataIndex) : !1 : B && (I = T.useSeriesOpacity ? !((y = S == null ? void 0 : S.label) != null && y.includes(this.getItemLabel(n, r))) : !1), I ? 0.1 : x;
158
- }
159
- return x;
160
- };
161
- this.data.forEach((r, x) => {
162
- var T;
163
- let u = this.calculateXY("x", r.x, f, c), y = this.calculateXY("y", r.y, h, b), I = this.size.w, w = this.size.h;
164
- const p = r.o;
165
- if (u !== null && y !== null && p !== null && p !== void 0) {
166
- const { show: S, opacity: O, dataColor: B, id: A, isHighlight: L } = this.getItemInfo(p);
167
- let z = O;
168
- O === 1 && P.getColorStringType(r.dataColor) === "RGBA" && (z = P.getOpacity(r.dataColor));
169
- const Y = M(r, z, x);
170
- if (r.dataColor || (r.dataColor = B), r.cId = A, o.save(), S) {
171
- o.fillStyle = P.colorStringToRgba(r.dataColor, Y);
172
- let k = this.stroke;
173
- const R = l == null ? void 0 : l.option, V = (R == null ? void 0 : R.use) && (R == null ? void 0 : R.showBorder), $ = x === ((T = l == null ? void 0 : l.selected) == null ? void 0 : T.dataIndex);
174
- V && $ && (k = {
175
- show: R == null ? void 0 : R.showBorder,
176
- ...R == null ? void 0 : R.borderStyle
177
- });
178
- let E = !1;
179
- if (k.show && k.lineWidth > 0) {
180
- const { color: F, lineWidth: G, opacity: j } = k, W = G * 2;
181
- E = W < Math.floor(I) && W < Math.floor(w), o.strokeStyle = E ? P.colorStringToRgba(F, Y === 1 ? j : Y) : void 0, E ? (o.lineWidth = G, u += G, y += G, I -= W, w -= W) : o.lineWidth = 0;
182
- }
183
- u += 1, r.xp = u, r.yp = y, r.w = I, r.h = w, this.drawItem(o, u, y, I, w, { ...k, show: E }), o.restore(), this.showValue.use && this.drawValueLabels({
184
- context: o,
185
- data: r
186
- }), L && this.itemHighlight(
187
- {
188
- data: r
189
- },
190
- i
191
- );
192
- }
193
- }
194
- });
195
- }
196
- /**
197
- * Draw value label if series 'use' of showValue option is true
198
- *
199
- * @param context canvas context
200
- * @param data series value data (model.store.js addData return value)
201
- */
202
- drawValueLabels({ context: e, data: o }) {
203
- const { fontSize: s, textColor: t, align: i, formatter: n, decimalPoint: a } = this.showValue, { xp: l, yp: d, w: g, h: m, o: f } = o, h = e;
204
- h.save(), h.beginPath(), h.font = `normal normal normal ${s}px Roboto`, h.fillStyle = t, h.lineWidth = 1, h.textBaseline = "middle", h.textAlign = i !== "center" ? "left" : "center";
205
- let c;
206
- n && (c = n(f)), (!n || typeof c != "string") && (c = P.labelSignFormat(f, a));
207
- const b = Math.round(h.measureText(c).width), M = s, r = l + g / 2, x = d + m / 2;
208
- if (!(b >= g || M >= m || c < 0)) {
209
- switch (i) {
210
- case "top": {
211
- const C = r - b / 2, u = x - M / 2;
212
- h.fillText(c, C, u);
213
- break;
214
- }
215
- case "right": {
216
- const C = l + g - b;
217
- h.fillText(c, C, x);
218
- break;
219
- }
220
- case "bottom": {
221
- const C = r - b / 2, u = x + M / 2;
222
- h.fillText(c, C, u);
223
- break;
224
- }
225
- case "left":
226
- h.fillText(c, l, x);
227
- break;
228
- default: {
229
- const C = r - b / 2;
230
- h.fillText(c, C, x);
231
- break;
232
- }
233
- }
234
- h.restore();
235
- }
236
- }
237
- /**
238
- * 자바스크립트 부동 소수점 오차 때문에 범위를 조정
239
- * @param {object} params - range information
240
- * @param {number} params.xp - start x position
241
- * @param {number} params.yp - start y position
242
- * @param {number} params.width - width
243
- * @param {number} params.height - height
244
- * @returns {object} adjusted range
245
- */
246
- getAdjustedBounds({ xp: e, yp: o, width: s, height: t }) {
247
- const n = Math.max(0, s), a = Math.max(0, t);
248
- return {
249
- xsp: Math.floor(e * 100) / 100,
250
- xep: Math.ceil((e + n) * 100) / 100,
251
- ysp: Math.floor(o * 100) / 100,
252
- yep: Math.ceil((o + a) * 100) / 100
253
- };
254
- }
255
- /**
256
- *Returns items in range
257
- * @param {object} params - range information
258
- * @param {number} params.xsp - start x position
259
- * @param {number} params.width - width
260
- * @param {number} params.ysp - start y position
261
- * @param {number} params.height - height
262
- * @returns {array} items in range
263
- */
264
- findItems(e) {
265
- const o = this.data, { xsp: s, xep: t, ysp: i, yep: n } = this.getAdjustedBounds({
266
- xp: e.xsp,
267
- yp: e.ysp,
268
- width: e.width,
269
- height: e.height
270
- });
271
- return o.filter(({ xp: a, yp: l, w: d, h: g }) => {
272
- const {
273
- xsp: m,
274
- xep: f,
275
- ysp: h,
276
- yep: c
277
- } = this.getAdjustedBounds({
278
- xp: a,
279
- yp: l,
280
- width: d,
281
- height: g
282
- });
283
- return m >= s && f <= t && h >= i && c <= n;
284
- });
285
- }
286
- /**
287
- * Draw item highlight
288
- * @param {object} item object for drawing series data
289
- * @param {object} context canvas context
290
- *
291
- * @returns {undefined}
292
- */
293
- itemHighlight(e, o) {
294
- var b;
295
- const s = e.data, t = o, { stroke: i, shadow: n } = this.highlight, a = s.xp, l = s.yp, d = s.w, g = s.h, m = s.cId;
296
- let f;
297
- if (this.isGradient) {
298
- const { min: M, max: r } = this.valueOpt, x = H(s.o - M, r - M), { start: C, end: u } = this.colorState[0];
299
- f = C <= x && x <= u || s.o === -1;
300
- } else
301
- f = (b = this.colorState.find(({ id: M }) => M === m)) == null ? void 0 : b.show;
302
- if (a === null || l === null || !f)
303
- return;
304
- t.save();
305
- const h = P.getColorStringType(s.dataColor) === "RGBA" ? e.dataColor : P.colorStringToRgba(s.dataColor, 1);
306
- t.fillStyle = h, n.use && (t.shadowOffsetX = n.offsetX, t.shadowOffsetY = n.offsetY, t.shadowBlur = n.blur, t.shadowColor = n.color);
307
- const c = {
308
- color: "",
309
- lineWidth: 1,
310
- opacity: 1,
311
- radius: 0,
312
- show: !0
313
- };
314
- if (i.use) {
315
- const { color: M, width: r, radius: x } = i;
316
- c.show = !0, c.radius = x, t.lineWidth = r, c.lineWidth = r, t.strokeStyle = M || h, c.color = M || h;
317
- } else
318
- c.show = !1, t.strokeStyle = h, c.color = h;
319
- this.drawItem(t, a - 0.5, l - 0.5, d + 1, g + 1, c), t.restore(), this.showValue.use && this.drawValueLabels({
320
- context: t,
321
- data: s
322
- });
323
- }
324
- /**
325
- * Find graph item for tooltip
326
- * @param {array} offset mouse position
327
- *
328
- * @returns {object} graph item
329
- */
330
- findGraphData(e) {
331
- const o = e[0], s = e[1], t = {
332
- data: null,
333
- hit: !1,
334
- color: null,
335
- dataColor: null,
336
- name: null
337
- }, i = this.data, n = i.findIndex((a) => {
338
- const { xp: l, yp: d, w: g, h: m } = a;
339
- return l <= o && o <= l + g && d <= s && s <= d + m;
340
- });
341
- if (n > -1) {
342
- const a = i[n];
343
- t.data = a, t.color = a.dataColor, t.dataColor = a.dataColor, t.index = n, t.hit = !0;
344
- }
345
- return t;
346
- }
347
- findBlockRange({ xcp: e, xep: o, ycp: s, yep: t, range: i }) {
348
- const n = this.labels, a = 1, l = {
349
- xsp: Math.min(e, o),
350
- ysp: Math.min(s, t),
351
- width: Math.ceil(Math.abs(o - e)),
352
- height: Math.ceil(Math.abs(t - s))
353
- };
354
- if (n.x.length && n.y.length) {
355
- const d = this.currentLabelInfo.x.steps || n.x.length, g = this.currentLabelInfo.y.steps || n.y.length, { x1: m, x2: f, y1: h, y2: c } = i, b = (f - m) / d, M = (c - h) / g, r = {
356
- xsp: e,
357
- xep: o,
358
- ysp: s,
359
- yep: t
360
- }, x = (C, u, y) => {
361
- let I, w, p;
362
- C === "x" ? (w = b, p = m + a) : (w = M, p = h), n[C].findIndex((S, O) => (I = p + w * O, I <= u && u <= I + w)) > -1 ? r[y] = ["xsp", "ysp"].includes(y) ? I : I + w : u < p && (r[y] = p);
363
- };
364
- x("x", Math.min(e, o), "xsp"), x("x", Math.max(e, o), "xep"), x("y", Math.min(s, t), "ysp"), x("y", Math.max(s, t), "yep"), l.xsp = Math.min(r.xsp, r.xep), l.ysp = Math.min(r.ysp, r.yep), l.width = Math.abs(r.xep - r.xsp), l.height = Math.abs(r.yep - r.ysp);
365
- }
366
- return l;
367
- }
368
- getFilteredLabel(e, o, s, t) {
369
- return e.length !== o ? e.filter((i) => s <= i && i <= t) : e;
370
- }
371
- findSelectionRange(e) {
372
- const { xsp: o, ysp: s, width: t, height: i, range: n } = e;
373
- let a = null;
374
- const { x1: l, x2: d, y1: g, y2: m } = n, { x: f, y: h } = this.labels;
375
- if (f.length && h.length) {
376
- const {
377
- x: { steps: c, min: b, max: M },
378
- y: { steps: r, min: x, max: C }
379
- } = this.currentLabelInfo, u = c || f.length, y = r || h.length, I = (d - l) / u, w = (m - g) / y, p = o + t, T = s + i, S = {
380
- min: Math.floor((o - l) / I),
381
- max: Math.floor((p - l - I) / I)
382
- }, O = y - 1, B = {
383
- min: O - Math.round((T - g - w) / w),
384
- max: O - Math.round((s - g) / w)
385
- }, A = this.getFilteredLabel(f, u, b, M), L = this.getFilteredLabel(h, y, x, C);
386
- a = {
387
- xMin: A[S.min],
388
- xMax: A[S.max],
389
- yMin: L[B.min],
390
- yMax: L[B.max]
391
- };
392
- }
393
- return a;
394
- }
395
- getItemLabel(e, o) {
396
- const { option: s, selected: t } = e;
397
- let i = this.isHorizontal ? o.y : o.x;
398
- return s != null && s.useBothAxis && (t != null && t.targetAxis) && (i = (t == null ? void 0 : t.targetAxis) === "yAxis" ? o.y : o.x), i;
399
- }
400
- }
401
- export {
402
- Z as default
403
- };
@@ -1,292 +0,0 @@
1
- import { defaultsDeep as st, isNil as A, isUndefined as ot } from "lodash-es";
2
- import { LINE_OPTION as lt, COLOR as K } from "../helpers/helpers.constant.js";
3
- import C from "../helpers/helpers.util.js";
4
- import z from "../helpers/helpers.canvas.js";
5
- class pt {
6
- constructor(M, i, f) {
7
- const e = st({}, i, lt);
8
- Object.keys(e).forEach((t) => {
9
- this[t] = e[t];
10
- }), this.name === void 0 && (this.name = `series-${f}`), ["color", "pointFill", "fillColor"].forEach((t) => {
11
- this[t] === void 0 && (this[t] = t === "pointFill" ? this.color : K[f % K.length]);
12
- }), this.type = "line", this.sId = M, this.extent = {
13
- downplay: { opacity: 0.3, lineWidth: 1 },
14
- normal: { opacity: 1, lineWidth: 1 },
15
- highlight: { opacity: 1, lineWidth: 2 }
16
- }, this.data = [], this.beforeMouseXp = 0, this.beforeMouseYp = 0, this.beforeFindItemIndex = -1, this.size = {
17
- comboOffset: 0
18
- };
19
- }
20
- useLinearInterpolation() {
21
- return this.interpolation === "linear" || this.interpolation === "none" && !!this.passingValue && this.hasPassingValueInData;
22
- }
23
- /**
24
- * @typedef {Object} LineDrawParam
25
- * @property {CanvasRenderingContext2D} ctx - 캔버스 렌더링 컨텍스트
26
- * @property {object} chartRect - 차트 영역 정보
27
- * @property {object} labelOffset - 라벨 오프셋 정보
28
- * @property {object} axesSteps - 축 스텝 정보
29
- * @property {object} [selectLabel] - 선택된 라벨 정보
30
- * @property {object} [selectSeries] - 선택된 시리즈 정보
31
- * @property {object} [legendHitInfo] - 범례 히트 정보
32
- * @property {boolean} [isBrush] - 브러시 사용 여부
33
- * @property {number} [unSelectedOpacity] - 비선택 시 opacity (0~1)
34
- */
35
- /**
36
- * Draw series data
37
- * @param {LineDrawParam} param object for drawing series data
38
- *
39
- * @returns {undefined}
40
- */
41
- draw(M) {
42
- var B, V, _, j, q, J, $;
43
- if (!this.show)
44
- return;
45
- const {
46
- ctx: i,
47
- chartRect: f,
48
- labelOffset: e,
49
- axesSteps: t,
50
- selectLabel: m,
51
- selectSeries: s,
52
- legendHitInfo: h,
53
- isBrush: O,
54
- unSelectedOpacity: F
55
- } = M, c = m == null ? void 0 : m.option, u = (c == null ? void 0 : c.use) && (c == null ? void 0 : c.useSeriesOpacity), d = ((B = m == null ? void 0 : m.selected) == null ? void 0 : B.dataIndex) ?? [];
56
- let n;
57
- if (h)
58
- n = this.extent[(h == null ? void 0 : h.sId) === this.sId ? "highlight" : "downplay"];
59
- else if ((V = s == null ? void 0 : s.option) != null && V.use && ((j = (_ = s == null ? void 0 : s.selected) == null ? void 0 : _.seriesId) != null && j.length)) {
60
- const a = (J = (q = s == null ? void 0 : s.selected) == null ? void 0 : q.seriesId) == null ? void 0 : J.includes(this.sId);
61
- n = this.extent[a ? "highlight" : "downplay"];
62
- } else u && d.length ? n = this.extent.downplay : n = this.extent.normal;
63
- n === this.extent.downplay && (n = { ...n, opacity: F });
64
- const S = (a) => a != null && a.includes("rgba") ? C.getOpacity(a) : n.opacity, b = this.color, o = S(b), l = this.pointFill, p = S(l), y = this.extent.downplay ? this.fillOpacity * n.opacity : this.fillOpacity, P = this.lineWidth * n.lineWidth;
65
- i.beginPath(), i.save(), i.lineJoin = "round", i.lineWidth = P, i.strokeStyle = C.colorStringToRgba(b, o), this.segments && i.setLineDash(this.segments);
66
- const D = this.useLinearInterpolation();
67
- let L = 0;
68
- const H = t.x[this.xAxisIndex], Y = t.y[this.yAxisIndex];
69
- let X = f.chartWidth - (e.left + e.right);
70
- const Q = f.chartHeight - (e.top + e.bottom);
71
- this.combo && (L = X / (this.data.length || 1), X -= L, this.size.comboOffset = L);
72
- const Z = f.x1 + e.left + L / 2, tt = f.y2 - e.bottom, G = (a) => {
73
- const x = Math.min(
74
- Math.max(a, H.graphMin),
75
- H.graphMax
76
- );
77
- return z.calculateX(x, H.graphMin, H.graphMax, X, Z);
78
- }, N = (a) => {
79
- const x = Math.min(
80
- Math.max(a, Y.graphMin),
81
- Y.graphMax
82
- );
83
- return z.calculateY(x, Y.graphMin, Y.graphMax, Q, tt);
84
- }, U = this.data.some((a) => a.o < 0), it = U ? N(0) : f.y2 - e.bottom;
85
- let R;
86
- if (this.data.forEach((a) => {
87
- let x = G(a.x), v = N(a.y);
88
- this.isExistGrp && D && a.o === null && (v = N(a.b ?? 0)), x !== null && (x += C.aliasPixel(x)), a.xp = x, a.yp = v, !(D && a.o === null) && (A(R == null ? void 0 : R.y) && !this.isExistGrp || !D && (A(R == null ? void 0 : R.y) || A(a.o)) ? i.moveTo(x, v) : i.lineTo(x, v), R = a);
89
- }), i.stroke(), this.segments && i.setLineDash([]), this.fill && this.data.length) {
90
- i.beginPath();
91
- const a = C.colorStringToRgba(this.fillColor || b, y);
92
- if (($ = this.fill) != null && $.gradient) {
93
- let r = this.data[0].yp, E = this.data[0].y;
94
- this.data.forEach((w) => {
95
- w.yp && w.yp <= r ? r = w.yp : w.y && w.y >= E && (E = w.y);
96
- });
97
- const g = i.createLinearGradient(0, f.y2, 0, r), I = n.opacity < 1 ? a : b;
98
- g.addColorStop(0, U ? I : a), g.addColorStop(0.5, a), g.addColorStop(1, I), i.fillStyle = g;
99
- } else
100
- i.fillStyle = a;
101
- let x = null, v = null;
102
- const T = this.data.map((r) => r == null ? void 0 : r.o), W = [];
103
- for (let r = 0; r < T.length + 1; r++)
104
- if (D && ot(T[r]) || !D && A(T[r])) {
105
- if (x !== null && v !== null) {
106
- const g = T.slice(x, r).findLastIndex(
107
- (I) => !A(I) && I !== null
108
- );
109
- W.push([x, x + g]), x = null, v = null;
110
- }
111
- } else D && T[r] === null || (x = x === null ? r : x), v = r;
112
- W.forEach(([r, E]) => {
113
- if (r === E) {
114
- const g = this.data[r];
115
- i.moveTo(g.xp - P, g.yp), i.lineTo(g.xp + P, g.yp), i.lineTo(g.xp + P, N(g.b) ?? it), i.closePath();
116
- return;
117
- }
118
- for (let g = r; g <= E; g++) {
119
- const I = this.data[g];
120
- if (g === r ? i.moveTo(I.xp, I.yp) : I.o !== null && i.lineTo(I.xp, I.yp), g === E) {
121
- for (let w = E; w >= r; w--) {
122
- const k = this.data[w], et = G(k.x);
123
- if (k.o !== null) {
124
- const nt = N(k.b) ?? N(0);
125
- i.lineTo(et, nt);
126
- }
127
- }
128
- i.closePath();
129
- }
130
- }
131
- }), i.fill();
132
- }
133
- if (!O) {
134
- i.strokeStyle = C.colorStringToRgba(b, o);
135
- const a = C.colorStringToRgba(l, 1), x = C.colorStringToRgba(l, p), v = this.interpolation === "linear" && this.data.filter((T) => T.o !== null).length === 1;
136
- this.data.forEach((T, W) => {
137
- var w, k;
138
- if (T.xp === null || T.yp === null || T.o === null)
139
- return;
140
- const r = (w = this.data[W - 1]) == null ? void 0 : w.o, E = (k = this.data[W + 1]) == null ? void 0 : k.o, g = !D && A(r) && A(E) || v, I = d.includes(W);
141
- (this.point || g || I) && (i.fillStyle = I && !h ? a : x, z.drawPoint(i, this.pointStyle, this.pointSize, T.xp, T.yp));
142
- });
143
- }
144
- i.restore();
145
- }
146
- /**
147
- * Draw item highlight
148
- * @param {object} item object for drawing series data
149
- * @param {object} context canvas context
150
- * @param {boolean} isMax determines if this series has max value
151
- *
152
- * @returns {undefined}
153
- */
154
- itemHighlight(M, i) {
155
- const f = M.data, e = i, { xp: t, yp: m, o: s } = f;
156
- e.save(), t !== null && m !== null && s !== null && this.pointHighlight && (e.strokeStyle = C.colorStringToRgba(this.color, 0), e.fillStyle = C.colorStringToRgba(this.color, this.highlight.maxShadowOpacity), z.drawPoint(e, this.pointStyle, this.highlight.maxShadowSize, t, m), e.fillStyle = this.color, z.drawPoint(e, this.pointStyle, this.highlight.maxSize, t, m), e.fillStyle = "#fff", z.drawPoint(e, this.pointStyle, this.highlight.defaultSize, t, m)), e.restore();
157
- }
158
- /**
159
- * Find graph item
160
- * @param {array} offset mouse position
161
- * @param {boolean} isHorizontal
162
- * @param {number} dataIndex selected label data index
163
- * @param {boolean} useSelectLabelOrItem used to display select label/item at tooltip location
164
- *
165
- * @returns {object} graph item
166
- */
167
- findGraphData(M, i, f, e) {
168
- var F;
169
- const t = M[0], m = M[1], s = { data: null, hit: !1, color: this.color }, h = this.data.filter((c) => !C.isNullOrUndefined(c.x)), O = this.useLinearInterpolation();
170
- if (h != null && h.length)
171
- if (typeof f == "number" && this.show) {
172
- if (s.data = h[f], s.index = f, s.data) {
173
- const c = h[f];
174
- Math.abs(m - c.yp) <= 15 && (s.hit = !0);
175
- }
176
- } else if (typeof this.beforeFindItemIndex == "number" && this.beforeFindItemIndex !== -1 && this.show && e)
177
- s.data = h[this.beforeFindItemIndex], s.index = this.beforeFindItemIndex;
178
- else {
179
- let c = 1 / 0, u = -1;
180
- const d = [];
181
- h.forEach((o, l) => {
182
- o.xp !== null && o.yp !== null && o.o !== null && d.push({ ...o, originalIndex: l });
183
- }), d.length === 0 && h.forEach((o, l) => {
184
- d.push({ ...o, originalIndex: l });
185
- });
186
- let n = 0, S = d.length - 1;
187
- for (; n <= S; ) {
188
- const o = Math.floor((n + S) / 2), l = d[o], p = Math.abs(t - l.xp);
189
- if (p < c && (c = p, u = l.originalIndex), l.xp < t) {
190
- if (n = o + 1, n < d.length) {
191
- const y = Math.abs(t - d[n].xp);
192
- y < c && (c = y, u = d[n].originalIndex);
193
- }
194
- } else if (l.xp > t) {
195
- if (S = o - 1, S >= 0) {
196
- const y = Math.abs(t - d[S].xp);
197
- y < c && (c = y, u = d[S].originalIndex);
198
- }
199
- } else
200
- break;
201
- }
202
- const b = d.findIndex((o) => o.originalIndex === u);
203
- if (b !== -1)
204
- for (let o = Math.max(0, b - 2); o <= Math.min(d.length - 1, b + 2); o++) {
205
- const l = d[o], p = Math.abs(t - l.xp);
206
- p < c && (c = p, u = l.originalIndex);
207
- }
208
- if (u !== -1) {
209
- let o = 50;
210
- if (h.length > 1) {
211
- const p = [];
212
- for (let y = 1; y < h.length; y++)
213
- h[y].xp !== null && h[y - 1].xp !== null && p.push(Math.abs(h[y].xp - h[y - 1].xp));
214
- p.length > 0 && (o = p.reduce((y, P) => y + P, 0) / p.length);
215
- }
216
- const l = Math.max(o, 1);
217
- if (c <= l)
218
- s.data = h[u], s.index = u;
219
- else {
220
- let p = !1, y = O ? 1 / 0 : l;
221
- const P = O ? d : h;
222
- for (let D = 0; D < P.length; D++) {
223
- const L = Math.abs(t - P[D].xp);
224
- L <= y && (p = !0, y = L, u = O ? P[D].originalIndex : D);
225
- }
226
- p && (s.data = h[u], s.index = u);
227
- }
228
- if (s.data) {
229
- const p = h[u];
230
- Math.abs(m - p.yp) <= 15 && (s.hit = !0);
231
- }
232
- }
233
- }
234
- return e || (this.beforeMouseXp = t, this.beforeMouseYp = m, typeof s.index == "number" && (this.beforeFindItemIndex = s.index)), O && ((F = s == null ? void 0 : s.data) == null ? void 0 : F.o) === null && (s.data = null), s;
235
- }
236
- /**
237
- * Find approximate graph item
238
- * @param {array} offset mouse position
239
- *
240
- * @returns {object} graph item
241
- */
242
- findApproximateData(M) {
243
- var u, d;
244
- const i = M[0], f = M[1], e = { data: null, hit: !1, color: this.color }, t = this.data.filter((n) => !C.isNullOrUndefined(n.x));
245
- if (!t.length)
246
- return e;
247
- const m = t.length > 1 ? Math.abs(((u = t[1]) == null ? void 0 : u.xp) - ((d = t[0]) == null ? void 0 : d.xp)) : 50, s = Math.max(m * 0.4, 10);
248
- let h = 0, O = t.length - 1, F = -1, c = 1 / 0;
249
- for (; h <= O; ) {
250
- const n = Math.floor((h + O) / 2), S = t[n].xp;
251
- if (S - s <= i && i <= S + s) {
252
- const b = Math.max(0, n - 2), o = Math.min(t.length - 1, n + 2);
253
- for (let l = b; l <= o; l++)
254
- if (t[l].xp !== null && t[l].yp !== null) {
255
- const p = Math.sqrt((i - t[l].xp) ** 2 + (f - t[l].yp) ** 2);
256
- p < c && (c = p, F = l);
257
- }
258
- return F !== -1 && (e.data = t[F], e.index = F, c < 5 && (e.hit = !0)), e;
259
- } else if (S + s < i) {
260
- if (n < O && i < t[n + 1].xp) {
261
- const b = Math.abs(t[n].xp - i), o = Math.abs(t[n + 1].xp - i);
262
- e.data = b > o ? t[n + 1] : t[n], e.index = b > o ? n + 1 : n;
263
- const l = e.data;
264
- return Math.abs(f - l.yp) < 10 && (e.hit = !0), e;
265
- }
266
- h = n + 1;
267
- } else {
268
- if (n > 0 && i > t[n - 1].xp) {
269
- const b = Math.abs(t[n - 1].xp - i), o = Math.abs(t[n].xp - i);
270
- e.data = b > o ? t[n] : t[n - 1], e.index = b > o ? n : n - 1;
271
- const l = e.data;
272
- return Math.abs(f - l.yp) < 10 && (e.hit = !0), e;
273
- }
274
- O = n - 1;
275
- }
276
- }
277
- return e;
278
- }
279
- /**
280
- * Returns items in range
281
- * @param {object} params range values
282
- *
283
- * @returns {array}
284
- */
285
- findItems({ xsp: M, width: i }) {
286
- const f = M + i;
287
- return this.data.filter((e) => M - 1 <= e.xp && e.xp <= f + 1);
288
- }
289
- }
290
- export {
291
- pt as default
292
- };