evui 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/index.js +23148 -0
  2. package/dist/index.umd.cjs +28 -0
  3. package/package.json +5 -11
  4. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  5. package/dist/common/utils.bignumber.js +0 -23
  6. package/dist/common/utils.debounce.js +0 -66
  7. package/dist/common/utils.js +0 -64
  8. package/dist/common/utils.throttle.js +0 -15
  9. package/dist/components/button/Button.vue.js +0 -65
  10. package/dist/components/button/index.js +0 -7
  11. package/dist/components/buttonGroup/ButtonGroup.vue.js +0 -14
  12. package/dist/components/buttonGroup/index.js +0 -7
  13. package/dist/components/calendar/Calendar.vue.js +0 -299
  14. package/dist/components/calendar/index.js +0 -7
  15. package/dist/components/calendar/uses.js +0 -579
  16. package/dist/components/chart/Chart.vue.js +0 -261
  17. package/dist/components/chart/ChartToolbar.vue.js +0 -32
  18. package/dist/components/chart/chart.core.js +0 -738
  19. package/dist/components/chart/chartZoom.core.js +0 -221
  20. package/dist/components/chart/element/element.bar.js +0 -358
  21. package/dist/components/chart/element/element.bar.time.js +0 -55
  22. package/dist/components/chart/element/element.heatmap.js +0 -403
  23. package/dist/components/chart/element/element.line.js +0 -292
  24. package/dist/components/chart/element/element.pie.js +0 -73
  25. package/dist/components/chart/element/element.scatter.js +0 -209
  26. package/dist/components/chart/element/element.tip.js +0 -312
  27. package/dist/components/chart/helpers/helpers.canvas.js +0 -141
  28. package/dist/components/chart/helpers/helpers.constant.js +0 -253
  29. package/dist/components/chart/helpers/helpers.util.js +0 -265
  30. package/dist/components/chart/index.js +0 -7
  31. package/dist/components/chart/model/index.js +0 -6
  32. package/dist/components/chart/model/model.series.js +0 -82
  33. package/dist/components/chart/model/model.store.js +0 -650
  34. package/dist/components/chart/plugins/plugins.interaction.js +0 -823
  35. package/dist/components/chart/plugins/plugins.legend.gradient.js +0 -281
  36. package/dist/components/chart/plugins/plugins.legend.js +0 -665
  37. package/dist/components/chart/plugins/plugins.pie.js +0 -86
  38. package/dist/components/chart/plugins/plugins.scrollbar.js +0 -345
  39. package/dist/components/chart/plugins/plugins.title.js +0 -43
  40. package/dist/components/chart/plugins/plugins.tooltip.js +0 -508
  41. package/dist/components/chart/scale/scale.js +0 -492
  42. package/dist/components/chart/scale/scale.linear.js +0 -248
  43. package/dist/components/chart/scale/scale.logarithmic.js +0 -82
  44. package/dist/components/chart/scale/scale.step.js +0 -227
  45. package/dist/components/chart/scale/scale.time.category.js +0 -148
  46. package/dist/components/chart/scale/scale.time.js +0 -95
  47. package/dist/components/chart/uses.js +0 -479
  48. package/dist/components/chartBrush/ChartBrush.vue.js +0 -198
  49. package/dist/components/chartBrush/chartBrush.core.js +0 -265
  50. package/dist/components/chartBrush/index.js +0 -7
  51. package/dist/components/chartBrush/uses.js +0 -18
  52. package/dist/components/chartGroup/ChartGroup.vue.js +0 -128
  53. package/dist/components/chartGroup/index.js +0 -7
  54. package/dist/components/chartGroup/uses.js +0 -47
  55. package/dist/components/checkbox/Checkbox.vue.js +0 -99
  56. package/dist/components/checkbox/index.js +0 -7
  57. package/dist/components/checkboxGroup/CheckboxGroup.vue.js +0 -40
  58. package/dist/components/checkboxGroup/index.js +0 -7
  59. package/dist/components/contextMenu/ContextMenu.vue.js +0 -70
  60. package/dist/components/contextMenu/MenuList.vue.js +0 -105
  61. package/dist/components/contextMenu/index.js +0 -7
  62. package/dist/components/contextMenu/uses.js +0 -79
  63. package/dist/components/datePicker/DatePicker.vue.js +0 -310
  64. package/dist/components/datePicker/index.js +0 -7
  65. package/dist/components/datePicker/uses.js +0 -190
  66. package/dist/components/grid/Grid.vue.js +0 -1261
  67. package/dist/components/grid/GridColumnSetting.vue.js +0 -212
  68. package/dist/components/grid/GridFilterSetting.vue.js +0 -222
  69. package/dist/components/grid/GridPagination.vue.js +0 -69
  70. package/dist/components/grid/GridSummary.vue.js +0 -186
  71. package/dist/components/grid/GridToolbar.vue.js +0 -15
  72. package/dist/components/grid/icon/icon-option-button.vue.js +0 -39
  73. package/dist/components/grid/icon/icon-sort-button.vue.js +0 -56
  74. package/dist/components/grid/index.js +0 -7
  75. package/dist/components/grid/uses.js +0 -697
  76. package/dist/components/icon/Icon.vue.js +0 -50
  77. package/dist/components/icon/index.js +0 -8
  78. package/dist/components/inputNumber/InputNumber.vue.js +0 -112
  79. package/dist/components/inputNumber/index.js +0 -7
  80. package/dist/components/inputNumber/uses.js +0 -76
  81. package/dist/components/loading/Loading.vue.js +0 -78
  82. package/dist/components/loading/index.js +0 -7
  83. package/dist/components/menu/Menu.vue.js +0 -66
  84. package/dist/components/menu/MenuItem.vue.js +0 -125
  85. package/dist/components/menu/index.js +0 -7
  86. package/dist/components/message/Message.vue.js +0 -122
  87. package/dist/components/message/index.js +0 -16
  88. package/dist/components/messageBox/MessageBox.vue.js +0 -216
  89. package/dist/components/messageBox/index.js +0 -13
  90. package/dist/components/notification/Notification.vue.js +0 -140
  91. package/dist/components/notification/index.js +0 -23
  92. package/dist/components/pagination/Pagination.vue.js +0 -215
  93. package/dist/components/pagination/index.js +0 -7
  94. package/dist/components/pagination/pageButton.vue.js +0 -35
  95. package/dist/components/progress/Progress.vue.js +0 -88
  96. package/dist/components/progress/index.js +0 -7
  97. package/dist/components/radio/Radio.vue.js +0 -75
  98. package/dist/components/radio/index.js +0 -7
  99. package/dist/components/radioGroup/RadioGroup.vue.js +0 -37
  100. package/dist/components/radioGroup/index.js +0 -7
  101. package/dist/components/scheduler/Scheduler.vue.js +0 -128
  102. package/dist/components/scheduler/index.js +0 -7
  103. package/dist/components/scheduler/uses.js +0 -73
  104. package/dist/components/select/Select.vue.js +0 -381
  105. package/dist/components/select/index.js +0 -7
  106. package/dist/components/select/uses.js +0 -147
  107. package/dist/components/slider/Slider.vue.js +0 -243
  108. package/dist/components/slider/index.js +0 -7
  109. package/dist/components/slider/uses.js +0 -188
  110. package/dist/components/tabPanel/TabPanel.vue.js +0 -39
  111. package/dist/components/tabPanel/index.js +0 -7
  112. package/dist/components/tabs/Tabs.vue.js +0 -220
  113. package/dist/components/tabs/index.js +0 -7
  114. package/dist/components/textField/TextField.vue.js +0 -209
  115. package/dist/components/textField/index.js +0 -7
  116. package/dist/components/timePicker/TimePicker.vue.js +0 -227
  117. package/dist/components/timePicker/index.js +0 -7
  118. package/dist/components/toggle/Toggle.vue.js +0 -66
  119. package/dist/components/toggle/index.js +0 -7
  120. package/dist/components/tree/Tree.vue.js +0 -220
  121. package/dist/components/tree/TreeNode.vue.js +0 -146
  122. package/dist/components/tree/index.js +0 -7
  123. package/dist/components/treeGrid/TreeGrid.vue.js +0 -898
  124. package/dist/components/treeGrid/TreeGridNode.vue.js +0 -274
  125. package/dist/components/treeGrid/TreeGridToolbar.vue.js +0 -15
  126. package/dist/components/treeGrid/index.js +0 -7
  127. package/dist/components/treeGrid/uses.js +0 -497
  128. package/dist/components/window/Window.vue.js +0 -211
  129. package/dist/components/window/index.js +0 -7
  130. package/dist/components/window/uses.js +0 -345
  131. package/dist/directives/clickoutside.js +0 -47
  132. package/dist/main.js +0 -142
  133. package/dist/package.json.js +0 -4
  134. package/dist/resolver.js +0 -17
@@ -1,492 +0,0 @@
1
- import { defaultsDeep as E } from "lodash-es";
2
- import F from "../helpers/helpers.canvas.js";
3
- import { truthyNumber as nt } from "../../../common/utils.js";
4
- import { AXIS_OPTION as at, AXIS_UNITS as ht, PLOT_BAND_OPTION as rt, PLOT_LINE_OPTION as ct, PLOT_LINE_LABEL_OPTION as xt } from "../helpers/helpers.constant.js";
5
- import f from "../helpers/helpers.util.js";
6
- class mt {
7
- constructor(e, l, i, n) {
8
- const a = E({}, l, at);
9
- Object.keys(a).forEach((s) => {
10
- this[s] = a[s];
11
- }), this.type = e, this.ctx = i, this.units = ht[this.type], this.options = n, this.position || (this.position = e === "x" ? "bottom" : "left");
12
- }
13
- /**
14
- * Calculate axis's min/max label steps
15
- * @param {string} type axis direction ('x', 'y')
16
- * @param {object} chartRect chart size information
17
- * @param {object} labelOffset chart label offset information
18
- * @param {number} tickSize label's size
19
- *
20
- * @returns {object} label range
21
- */
22
- calculateLabelRange(e, l, i, n) {
23
- let a, s, t;
24
- e === "x" ? (a = l.chartWidth, t = Math.floor(n * 1.1), s = [i.left, i.right]) : (a = l.chartHeight, s = [i.top, i.bottom], t = n + Math.floor(a * 0.1));
25
- const o = a - (s[0] + s[1]), h = 1, r = Math.max(Math.floor(o / t) - 1, 1);
26
- return {
27
- min: h,
28
- max: r
29
- };
30
- }
31
- /**
32
- * Calculate min/max value, label and size information for axis
33
- * @param {object} minMax min/max information
34
- * @param {object} scrollbarOpt scrollbar option
35
- *
36
- * @returns {object} min/max value and label
37
- */
38
- calculateScaleRange(e, l) {
39
- var h;
40
- let i, n, a = !1;
41
- const s = l != null && l.use ? l == null ? void 0 : l.range : this.range;
42
- Array.isArray(s) && (s == null ? void 0 : s.length) === 2 ? this.options.type === "heatMap" ? (i = s[1] > +e.max ? +e.max : s[1], n = s[0] < +e.min ? +e.min : s[0]) : (i = s[1], n = s[0]) : typeof s == "function" ? [n, i] = s(e.min, e.max) : (i = e.max, n = e.min), this.autoScaleRatio && (i = Math.ceil(i * (this.autoScaleRatio + 1))), this.startToZero && (n = 0), i === n && (i += 1, a = !0);
43
- const t = this.getLabelFormat(n), o = this.getLabelFormat(i, {
44
- isMaxValueSameAsMin: a
45
- });
46
- return {
47
- min: n,
48
- max: i,
49
- minLabel: t,
50
- maxLabel: o,
51
- size: f.calcTextSizeCanvas(
52
- o,
53
- f.getLabelStyle(this.labelStyle),
54
- (h = this.labelStyle) == null ? void 0 : h.padding
55
- )
56
- };
57
- }
58
- /**
59
- * return width what has max length
60
- * @param {string[]} notFormattedLabels
61
- * @param {object} chartRect - unused in base class, used in StepScale override
62
- * @reutrn number maxWidth
63
- */
64
- // eslint-disable-next-line no-unused-vars
65
- getLabelWidthHasMaxLength(e, l) {
66
- return (e ?? []).reduce((i, n) => {
67
- var t;
68
- const a = this.getLabelFormat(n), s = ((t = f.calcTextSizeCanvas(a, f.getLabelStyle(this.labelStyle))) == null ? void 0 : t.width) ?? 0;
69
- return Math.max(i, s);
70
- }, 0);
71
- }
72
- /**
73
- * With range information, calculate how many labels in axis
74
- * linear type은 scale.linear.js에서 처리
75
- * @param {object} range min/max information
76
- *
77
- * @returns {object} steps, interval, min/max graph value
78
- */
79
- calculateSteps(e) {
80
- const { maxValue: l, minValue: i } = e;
81
- let { maxSteps: n } = e, a = this.getInterval(e), s = i, t;
82
- for (; s < l; )
83
- s += a;
84
- const o = s, h = i, r = o - h;
85
- if (t = Math.round(r / a), l === 1 && (this.decimalPoint ? n > 2 ? (a = 0.2, t = 5, n = 5) : (a = 0.5, t = 2, n = 2) : (a = 1, t = 1, n = 1)), this.fixedSteps)
86
- return {
87
- steps: t,
88
- interval: a,
89
- graphMin: h,
90
- graphMax: o
91
- };
92
- for (; t > n; )
93
- a *= 2, t = Math.round(r / a), a = Math.ceil(r / t);
94
- return o - h > t * a && (a = Math.ceil((o - h) / t)), {
95
- steps: t,
96
- interval: a,
97
- graphMin: h,
98
- graphMax: o
99
- };
100
- }
101
- /**
102
- * Draw Axis Title
103
- *
104
- * @param {object} chartRect min/max information
105
- * @param {object} labelOffset label offset information
106
- *
107
- * @returns {undefined}
108
- */
109
- drawAxisTitle(e, l) {
110
- const i = this.title;
111
- if (!(i != null && i.use) || isNaN(i.fontSize))
112
- return;
113
- const n = this.ctx;
114
- n.save(), n.font = f.getLabelStyle(i), n.fillStyle = i.color, n.textAlign = i.textAlign;
115
- const a = {
116
- xLeft: e.x1 + l.left,
117
- xRight: e.x2 - l.right,
118
- yTop: e.y1
119
- };
120
- let s, t;
121
- const o = 10;
122
- this.type === "x" ? (s = a.xRight, t = e.y2 + i.fontSize + o) : (t = a.yTop - i.fontSize - o, s = a.xLeft), s > 0 && t > 0 && n.fillText(i.text, s, t), n.restore();
123
- }
124
- /**
125
- * Draw axis
126
- * @param {object} chartRect min/max information
127
- * @param {object} labelOffset label offset information
128
- * @param {object} stepInfo label steps information
129
- * @param {object} hitInfo hit information
130
- * @param {object} selectLabelInfo selected label information
131
- * @param {object} dataLabels data label information, x axis only
132
- *
133
- * @returns {undefined}
134
- */
135
- draw(e, l, i, n, a, s) {
136
- var O, V, Y, G, U, Z, j, K, q, J, Q, $, I, R, D, tt, et, it, lt, st;
137
- const t = this.ctx, o = this.options, h = {
138
- x1: e.x1 + l.left,
139
- x2: e.x2 - l.right,
140
- y1: e.y1 + l.top,
141
- y2: e.y2 - l.bottom
142
- }, r = i.steps, c = i.graphMin, g = i.graphMax, w = i.interval, y = h[this.units.rectStart], d = h[this.units.rectEnd], u = h[this.units.rectOffset(this.position)], M = h[this.units.rectOffsetCounter(this.position)], A = 5;
143
- let m;
144
- if (this.drawAxisTitle(e, l), t.font = f.getLabelStyle(this.labelStyle), t.fillStyle = this.labelStyle.color, this.type === "x" ? (t.textAlign = "center", t.textBaseline = this.position === "top" ? "bottom" : "top") : (t.textAlign = this.position === "left" ? "right" : "left", t.textBaseline = "middle"), this.showAxis && (t.lineWidth = this.axisLineWidth, m = f.aliasPixel(t.lineWidth), t.beginPath(), t.strokeStyle = this.axisLineColor, this.type === "x" ? (t.moveTo(y, u + m), t.lineTo(d, u + m)) : (t.moveTo(u + m, y), t.lineTo(u + m, d)), t.stroke(), t.closePath()), !(r === 0 || c === null)) {
145
- if ((O = this.labelStyle) != null && O.show) {
146
- const N = d - y, X = N / r, C = [], k = i.interval;
147
- let S = null, b = null, v = y, z = c;
148
- if (this.type === "x" && (o != null && o.axesX[0].flow) && s.length !== r + 1) {
149
- const x = Math.floor(c / k) * k;
150
- x !== +c && (z = x + k, v += N / (g - c) * (z - c));
151
- }
152
- t.strokeStyle = this.gridLineColor, t.lineWidth = 1, m = f.aliasPixel(t.lineWidth);
153
- let P;
154
- for (let x = 0; x <= r; x++)
155
- if (S = Math.round(v + X * x), S <= d || this.type !== "x" || !(o != null && o.axesX[0].flow) || s.length === r + 1) {
156
- t.beginPath(), C[x] = z + x * w, C[x] === 0 && this.zeroLineColor ? t.strokeStyle = this.zeroLineColor : t.strokeStyle = this.gridLineColor, b = S + m, P = this.getLabelFormat(Math.min(g, C[x]), {
157
- prev: C[x - 1] ?? ""
158
- });
159
- const L = ((Y = (V = this.options) == null ? void 0 : V.selectLabel) == null ? void 0 : Y.use) && ((U = (G = this.options) == null ? void 0 : G.selectLabel) == null ? void 0 : U.useLabelOpacity) && this.options.horizontal === (this.type === "y") && ((Z = a == null ? void 0 : a.dataIndex) == null ? void 0 : Z.length) && !(a != null && a.label.map(
160
- (p) => this.getLabelFormat(Math.min(g, p), {
161
- prev: C[x - 1] ?? ""
162
- })
163
- ).includes(P));
164
- let W;
165
- x === r && this.lastLabelFontStyle ? (t.font = f.getLabelStyle(this.lastLabelFontStyle), W = this.lastLabelFontStyle.color) : (t.font = f.getLabelStyle(this.labelStyle), W = this.labelStyle.color);
166
- let B = 1;
167
- f.getColorStringType(W) === "RGBA" && (B = f.getOpacity(W)), t.fillStyle = f.colorStringToRgba(
168
- W,
169
- L ? (j = this.options) == null ? void 0 : j.unSelectedOpacity : B
170
- );
171
- let T;
172
- if (this.type === "x") {
173
- if (T = this.position === "top" ? u - 10 : u + 10, ((K = o == null ? void 0 : o.brush) != null && K.showLabel || !(o != null && o.brush)) && t.fillText(this.checkFixWidth(P), S, T), !L && ((q = o == null ? void 0 : o.selectItem) != null && q.showLabelTip) && (n != null && n.label) && !((J = this.options) != null && J.horizontal)) {
174
- const p = this.getLabelFormat(
175
- Math.min(g, n.label + 0 * w)
176
- );
177
- if (p === P) {
178
- const _ = Math.round(t.measureText((Q = this.labelStyle) == null ? void 0 : Q.fontSize).width);
179
- f.showLabelTip({
180
- ctx: this.ctx,
181
- width: Math.round(t.measureText(p).width) + 10,
182
- height: _,
183
- x: S,
184
- y: T + (_ - 2),
185
- borderRadius: 2,
186
- arrowSize: 3,
187
- text: P,
188
- backgroundColor: (I = ($ = o == null ? void 0 : o.selectItem) == null ? void 0 : $.labelTipStyle) == null ? void 0 : I.backgroundColor,
189
- textColor: (D = (R = o == null ? void 0 : o.selectItem) == null ? void 0 : R.labelTipStyle) == null ? void 0 : D.textColor
190
- });
191
- }
192
- }
193
- this.showAxisTick && (t.beginPath(), t.strokeStyle = this.axisLineColor, t.moveTo(b, u), t.lineTo(b, u + A), t.stroke(), t.closePath()), (x !== 0 || o != null && o.axesX[0].flow) && this.showGrid && (t.beginPath(), t.strokeStyle = this.gridLineColor, t.moveTo(b, u), t.lineTo(b, M), t.stroke(), t.closePath());
194
- } else
195
- T = this.position === "left" ? u - 10 : u + 10, ((tt = o == null ? void 0 : o.brush) != null && tt.showLabel || !(o != null && o.brush)) && t.fillText(this.checkFixWidth(P), T, S), x === r && (b -= 1), this.showAxisTick && (t.beginPath(), t.strokeStyle = this.axisLineColor, t.moveTo(u + (this.axisLineWidth ?? 1), b), t.lineTo(u - A, b), t.stroke(), t.closePath()), x !== 0 && this.showGrid && (t.beginPath(), t.strokeStyle = this.gridLineColor, t.moveTo(u, b), t.lineTo(M, b), t.stroke(), t.closePath());
196
- }
197
- }
198
- if ((et = this.plotBands) != null && et.length || (it = this.plotLines) != null && it.length) {
199
- const N = e.chartWidth - (l.left + l.right), X = e.chartHeight - (l.top + l.bottom), C = m + 1, k = h.x1, S = h.x2 + C, b = h.y1 - C, v = h.y2;
200
- (lt = this.plotBands) == null || lt.forEach((z) => {
201
- const P = E({}, z, rt), { from: x, to: H, label: L } = P, W = f.isNullOrUndefined(x) ? c : Math.max(x, c), B = f.isNullOrUndefined(H) ? g : Math.min(H, g);
202
- this.setPlotBandStyle(P);
203
- let T, p;
204
- if (this.type === "x") {
205
- if (T = F.calculateX(W, c, g, N, k), p = F.calculateX(B, c, g, N, k), T === null || p === null)
206
- return;
207
- this.drawXPlotBand(T, p, k, S, b, v);
208
- } else {
209
- if (T = F.calculateY(W, c, g, X, v), p = F.calculateY(B, c, g, X, v), T === null || p === null)
210
- return;
211
- this.drawYPlotBand(T, p, k, S, b, v);
212
- }
213
- if (L.show) {
214
- const _ = this.getNormalizedLabelOptions(e, L), ot = this.getPlotBandLabelPosition(T, p, _, S, b);
215
- this.drawPlotLabel(_, ot);
216
- }
217
- t.restore();
218
- }), (st = this.plotLines) == null || st.forEach((z) => {
219
- if (typeof +z.value != "number")
220
- return;
221
- const P = E({}, z, ct), { value: x, label: H } = P;
222
- let L;
223
- if (this.type === "x") {
224
- if (L = F.calculateX(x, c, g, N, k), L === null)
225
- return;
226
- this.setPlotLineStyle(P), this.drawXPlotLine(L, k, S, b, v);
227
- } else {
228
- if (L = F.calculateY(x, c, g, X, v), L === null)
229
- return;
230
- this.setPlotLineStyle(P), this.drawYPlotLine(L, k, S, b, v);
231
- }
232
- if (H.show) {
233
- const W = this.getNormalizedLabelOptions(e, H), B = this.getPlotLineLabelPosition(L, W, S, b);
234
- this.drawPlotLabel(W, B);
235
- }
236
- t.restore();
237
- });
238
- }
239
- }
240
- }
241
- /**
242
- * Set plot line style
243
- * @param {object} plotLine plotLine Options
244
- *
245
- * @returns {undefined}
246
- */
247
- setPlotLineStyle(e) {
248
- const l = this.ctx, { color: i, lineWidth: n } = e;
249
- l.beginPath(), l.save(), l.lineWidth = n, l.strokeStyle = i, e.segments && l.setLineDash(e.segments);
250
- }
251
- /**
252
- * Set plot band style
253
- * @param {object} plotBand plotBand Options
254
- *
255
- * @returns {undefined}
256
- */
257
- setPlotBandStyle(e) {
258
- const l = this.ctx, { color: i } = e;
259
- l.beginPath(), l.save(), l.fillStyle = i;
260
- }
261
- /**
262
- * Draw X Plot band
263
- * @param {number} fromDataX From data's X Position
264
- * @param {number} toDataX To data's X Position
265
- * @param {number} minX Min X Position
266
- * @param {number} maxX Max X Position
267
- * @param {number} minY Min Y Position
268
- * @param {number} maxY Max Y Position
269
- *
270
- * @returns {undefined}
271
- */
272
- drawXPlotBand(e, l, i, n, a, s) {
273
- const t = this.ctx, o = (h) => h || h > i || h < n;
274
- if (!o(e) || !o(l)) {
275
- t.closePath(), t.restore();
276
- return;
277
- }
278
- t.moveTo(e, a), t.lineTo(e, s), t.lineTo(l, s), t.lineTo(l, a), t.lineTo(e, a), t.stroke(), t.fill(), t.restore(), t.closePath();
279
- }
280
- /**
281
- * Draw X Plot line
282
- * @param {number} dataX Data's X Position
283
- * @param {number} minX Min X Position
284
- * @param {number} maxX Max X Position
285
- * @param {number} minY Min Y Position
286
- * @param {number} maxY Max Y Position
287
- *
288
- * @returns {undefined}
289
- */
290
- drawXPlotLine(e, l, i, n, a) {
291
- const s = this.ctx;
292
- if (!e || e < l || e > i) {
293
- s.closePath(), s.restore();
294
- return;
295
- }
296
- let t = e;
297
- t += f.aliasPixel(s.lineWidth), s.moveTo(t, a), s.lineTo(t, n), s.stroke(), s.restore(), s.closePath();
298
- }
299
- /**
300
- * Draw Y Plot line
301
- * @param {number} dataY Data's Y Position
302
- * @param {number} minX Min X Position
303
- * @param {number} maxX Max X Position
304
- * @param {number} minY Min Y Position
305
- * @param {number} maxY Max Y Position
306
- *
307
- * @returns {undefined}
308
- */
309
- drawYPlotLine(e, l, i, n, a) {
310
- const s = this.ctx;
311
- if (!e || e > a || e < n) {
312
- s.closePath(), s.restore();
313
- return;
314
- }
315
- let t = e;
316
- t += f.aliasPixel(s.lineWidth), s.moveTo(l, t), s.lineTo(i, t), s.stroke(), s.restore(), s.closePath();
317
- }
318
- /**
319
- * Draw Y Plot band
320
- * @param {number} fromDataY From data's Y Position (bottom)
321
- * @param {number} toDataY To data's Y Position (top)
322
- * @param {number} minX Min X Position
323
- * @param {number} maxX Max X Position
324
- * @param {number} minY Min Y Position
325
- * @param {number} maxY Max Y Position
326
- *
327
- * @returns {undefined}
328
- */
329
- drawYPlotBand(e, l, i, n, a, s) {
330
- const t = this.ctx, o = (h) => h || h > a || h < s;
331
- if (!o(e) || !o(l)) {
332
- t.closePath(), t.restore();
333
- return;
334
- }
335
- t.moveTo(i, e), t.lineTo(i, l), t.lineTo(n, l), t.lineTo(n, e), t.lineTo(i, e), t.fill(), t.restore(), t.closePath();
336
- }
337
- /**
338
- * get normalized options for plot label
339
- * @param {object} chartRect chartRect
340
- * @param {object} labelOpt plotLine Options
341
- *
342
- * @returns {object}
343
- */
344
- getNormalizedLabelOptions(e, l) {
345
- const i = E({}, l, xt), n = this.ctx, { maxWidth: a } = i, s = i.fontSize > 20 ? 20 : i.fontSize;
346
- let t = i.text, o = a ?? n.measureText(t).width;
347
- const h = this.type === "y" ? e.width - e.chartWidth : a ?? e.width;
348
- return h < n.measureText(t).width && i.textOverflow === "ellipsis" && (t = f.truncateLabelWithEllipsis(i.text, h, n), o = n.measureText(t).width), {
349
- label: t,
350
- fontSize: s,
351
- labelWidth: o,
352
- labelBoxPadding: s / 4,
353
- labelHalfWidth: o / 2,
354
- labelHalfHeight: s / 2,
355
- ...i
356
- };
357
- }
358
- /**
359
- * Calculate position of plot band's label
360
- * @param {object} fromPos from data position
361
- * @param {object} toPos to data position
362
- * @param {object} labelOpt label options
363
- * @param {object} maxX max x position
364
- * @param {object} minY min y position
365
- *
366
- * @returns {object}
367
- */
368
- getPlotBandLabelPosition(e, l, i, n, a) {
369
- const {
370
- fontSize: s,
371
- labelWidth: t,
372
- labelHalfWidth: o,
373
- labelHalfHeight: h,
374
- labelBoxPadding: r,
375
- textAlign: c,
376
- verticalAlign: g
377
- } = i;
378
- if (s <= 0)
379
- return { textX: 0, textY: 0 };
380
- let w, y;
381
- if (this.type === "x")
382
- switch (y = a - r - s, c) {
383
- case "left":
384
- w = e + o + r;
385
- break;
386
- case "right":
387
- w = l - o - r;
388
- break;
389
- case "center":
390
- default:
391
- w = (l - e) / 2 + e;
392
- break;
393
- }
394
- else
395
- switch (w = n + t + r, g) {
396
- case "top":
397
- y = l + h + r;
398
- break;
399
- case "bottom":
400
- y = e - h - r;
401
- break;
402
- case "middle":
403
- default:
404
- y = (e - l) / 2 + l;
405
- break;
406
- }
407
- return { textX: w, textY: y };
408
- }
409
- /**
410
- * Calculate position of plot line's label
411
- * @param {object} dataPos data position
412
- * @param {object} labelOpt label options
413
- * @param {object} maxX max x position
414
- * @param {object} minY min y position
415
- *
416
- * @returns {undefined}
417
- */
418
- getPlotLineLabelPosition(e, l, i, n) {
419
- const { fontSize: a, labelWidth: s, labelHalfWidth: t, labelHalfHeight: o, labelBoxPadding: h } = l;
420
- if (a <= 0)
421
- return { textX: 0, textY: 0 };
422
- let r, c;
423
- if (this.type === "x")
424
- switch (c = n - h - a, l.textAlign) {
425
- case "left":
426
- r = e - t - h;
427
- break;
428
- case "right":
429
- r = e + t + h;
430
- break;
431
- case "center":
432
- default:
433
- r = e;
434
- break;
435
- }
436
- else
437
- switch (r = i + s + h, l.verticalAlign) {
438
- case "top":
439
- c = e - o - h;
440
- break;
441
- case "bottom":
442
- c = e + o + h;
443
- break;
444
- case "middle":
445
- default:
446
- c = e;
447
- break;
448
- }
449
- return { textX: r, textY: c };
450
- }
451
- /**
452
- * Calculate Values for drawing label
453
- * @param {object} labelOptions plot line Label Options
454
- * @param {object} positions x, y Position
455
- *
456
- * @returns {undefined}
457
- */
458
- drawPlotLabel(e, l) {
459
- if (!l)
460
- return;
461
- const { textX: i, textY: n } = l, {
462
- label: a,
463
- fontSize: s,
464
- fontColor: t,
465
- fillColor: o,
466
- lineColor: h,
467
- lineWidth: r,
468
- labelBoxPadding: c,
469
- labelWidth: g,
470
- labelHalfWidth: w,
471
- labelHalfHeight: y
472
- } = e;
473
- if (s <= 0)
474
- return;
475
- const d = this.ctx;
476
- d.save(), d.beginPath(), d.font = f.getLabelStyle(e);
477
- let u = 0, M = 0, A = 0, m = 0;
478
- this.type === "x" ? (u = n - c, M = n + s, A = i - w - c, m = i + w + c) : (u = n - y - c, M = n + y + c, A = i - g, m = i + c), d.fillStyle = o, d.strokeStyle = h, d.lineWidth = r, d.moveTo(A, M), d.lineTo(A, u), d.lineTo(m, u), d.lineTo(m, M), d.lineTo(A, M), d.fill(), r > 0 && d.stroke(), d.fillStyle = t, d.fillText(a, i, n), d.closePath();
479
- }
480
- /**
481
- * Check if the label width is greater than the fix width
482
- * @param {string} value label value
483
- * @returns
484
- */
485
- checkFixWidth(e) {
486
- const { fixWidth: l, fitDir: i } = this.labelStyle;
487
- return nt(l) && l > 0 ? f.truncateLabelWithEllipsis(e, l, this.ctx, i) : e;
488
- }
489
- }
490
- export {
491
- mt as default
492
- };