evui 3.4.214 → 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.
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/common/utils.bignumber.js +23 -0
- package/dist/common/utils.debounce.js +66 -0
- package/dist/common/utils.js +64 -0
- package/dist/common/utils.throttle.js +15 -0
- package/dist/components/button/Button.vue.js +65 -0
- package/dist/components/button/index.js +7 -0
- package/dist/components/buttonGroup/ButtonGroup.vue.js +14 -0
- package/dist/components/buttonGroup/index.js +7 -0
- package/dist/components/calendar/Calendar.vue.js +299 -0
- package/dist/components/calendar/index.js +7 -0
- package/dist/components/calendar/uses.js +579 -0
- package/dist/components/chart/Chart.vue.js +261 -0
- package/dist/components/chart/ChartToolbar.vue.js +32 -0
- package/dist/components/chart/chart.core.js +738 -0
- package/dist/components/chart/chartZoom.core.js +221 -0
- package/dist/components/chart/element/element.bar.js +358 -0
- package/dist/components/chart/element/element.bar.time.js +55 -0
- package/dist/components/chart/element/element.heatmap.js +403 -0
- package/dist/components/chart/element/element.line.js +292 -0
- package/dist/components/chart/element/element.pie.js +73 -0
- package/dist/components/chart/element/element.scatter.js +209 -0
- package/dist/components/chart/element/element.tip.js +312 -0
- package/dist/components/chart/helpers/helpers.canvas.js +141 -0
- package/dist/components/chart/helpers/helpers.constant.js +253 -0
- package/dist/components/chart/helpers/helpers.util.js +265 -0
- package/dist/components/chart/index.js +7 -0
- package/dist/components/chart/model/index.js +6 -0
- package/dist/components/chart/model/model.series.js +82 -0
- package/dist/components/chart/model/model.store.js +650 -0
- package/dist/components/chart/plugins/plugins.interaction.js +823 -0
- package/dist/components/chart/plugins/plugins.legend.gradient.js +281 -0
- package/dist/components/chart/plugins/plugins.legend.js +665 -0
- package/dist/components/chart/plugins/plugins.pie.js +86 -0
- package/dist/components/chart/plugins/plugins.scrollbar.js +345 -0
- package/dist/components/chart/plugins/plugins.title.js +43 -0
- package/dist/components/chart/plugins/plugins.tooltip.js +508 -0
- package/dist/components/chart/scale/scale.js +492 -0
- package/dist/components/chart/scale/scale.linear.js +248 -0
- package/dist/components/chart/scale/scale.logarithmic.js +82 -0
- package/dist/components/chart/scale/scale.step.js +227 -0
- package/dist/components/chart/scale/scale.time.category.js +148 -0
- package/dist/components/chart/scale/scale.time.js +95 -0
- package/dist/components/chart/uses.js +479 -0
- package/dist/components/chartBrush/ChartBrush.vue.js +198 -0
- package/dist/components/chartBrush/chartBrush.core.js +265 -0
- package/dist/components/chartBrush/index.js +7 -0
- package/dist/components/chartBrush/uses.js +18 -0
- package/dist/components/chartGroup/ChartGroup.vue.js +128 -0
- package/dist/components/chartGroup/index.js +7 -0
- package/dist/components/chartGroup/uses.js +47 -0
- package/dist/components/checkbox/Checkbox.vue.js +99 -0
- package/dist/components/checkbox/index.js +7 -0
- package/dist/components/checkboxGroup/CheckboxGroup.vue.js +40 -0
- package/dist/components/checkboxGroup/index.js +7 -0
- package/dist/components/contextMenu/ContextMenu.vue.js +70 -0
- package/dist/components/contextMenu/MenuList.vue.js +105 -0
- package/dist/components/contextMenu/index.js +7 -0
- package/dist/components/contextMenu/uses.js +79 -0
- package/dist/components/datePicker/DatePicker.vue.js +310 -0
- package/dist/components/datePicker/index.js +7 -0
- package/dist/components/datePicker/uses.js +190 -0
- package/dist/components/grid/Grid.vue.js +1261 -0
- package/dist/components/grid/GridColumnSetting.vue.js +212 -0
- package/dist/components/grid/GridFilterSetting.vue.js +222 -0
- package/dist/components/grid/GridPagination.vue.js +69 -0
- package/dist/components/grid/GridSummary.vue.js +186 -0
- package/dist/components/grid/GridToolbar.vue.js +15 -0
- package/dist/components/grid/icon/icon-option-button.vue.js +39 -0
- package/dist/components/grid/icon/icon-sort-button.vue.js +56 -0
- package/dist/components/grid/index.js +7 -0
- package/dist/components/grid/uses.js +697 -0
- package/dist/components/icon/Icon.vue.js +50 -0
- package/dist/components/icon/index.js +8 -0
- package/dist/components/inputNumber/InputNumber.vue.js +112 -0
- package/dist/components/inputNumber/index.js +7 -0
- package/dist/components/inputNumber/uses.js +76 -0
- package/dist/components/loading/Loading.vue.js +78 -0
- package/dist/components/loading/index.js +7 -0
- package/dist/components/menu/Menu.vue.js +66 -0
- package/dist/components/menu/MenuItem.vue.js +125 -0
- package/dist/components/menu/index.js +7 -0
- package/dist/components/message/Message.vue.js +122 -0
- package/dist/components/message/index.js +16 -0
- package/dist/components/messageBox/MessageBox.vue.js +216 -0
- package/dist/components/messageBox/index.js +13 -0
- package/dist/components/notification/Notification.vue.js +140 -0
- package/dist/components/notification/index.js +23 -0
- package/dist/components/pagination/Pagination.vue.js +215 -0
- package/dist/components/pagination/index.js +7 -0
- package/dist/components/pagination/pageButton.vue.js +35 -0
- package/dist/components/progress/Progress.vue.js +88 -0
- package/dist/components/progress/index.js +7 -0
- package/dist/components/radio/Radio.vue.js +75 -0
- package/dist/components/radio/index.js +7 -0
- package/dist/components/radioGroup/RadioGroup.vue.js +37 -0
- package/dist/components/radioGroup/index.js +7 -0
- package/dist/components/scheduler/Scheduler.vue.js +128 -0
- package/dist/components/scheduler/index.js +7 -0
- package/dist/components/scheduler/uses.js +73 -0
- package/dist/components/select/Select.vue.js +381 -0
- package/dist/components/select/index.js +7 -0
- package/dist/components/select/uses.js +147 -0
- package/dist/components/slider/Slider.vue.js +243 -0
- package/dist/components/slider/index.js +7 -0
- package/dist/components/slider/uses.js +188 -0
- package/dist/components/tabPanel/TabPanel.vue.js +39 -0
- package/dist/components/tabPanel/index.js +7 -0
- package/dist/components/tabs/Tabs.vue.js +220 -0
- package/dist/components/tabs/index.js +7 -0
- package/dist/components/textField/TextField.vue.js +209 -0
- package/dist/components/textField/index.js +7 -0
- package/dist/components/timePicker/TimePicker.vue.js +227 -0
- package/dist/components/timePicker/index.js +7 -0
- package/dist/components/toggle/Toggle.vue.js +66 -0
- package/dist/components/toggle/index.js +7 -0
- package/dist/components/tree/Tree.vue.js +220 -0
- package/dist/components/tree/TreeNode.vue.js +146 -0
- package/dist/components/tree/index.js +7 -0
- package/dist/components/treeGrid/TreeGrid.vue.js +898 -0
- package/dist/components/treeGrid/TreeGridNode.vue.js +274 -0
- package/dist/components/treeGrid/TreeGridToolbar.vue.js +15 -0
- package/dist/components/treeGrid/index.js +7 -0
- package/dist/components/treeGrid/uses.js +497 -0
- package/dist/components/window/Window.vue.js +211 -0
- package/dist/components/window/index.js +7 -0
- package/dist/components/window/uses.js +345 -0
- package/dist/directives/clickoutside.js +47 -0
- package/dist/main.js +142 -0
- package/dist/package.json.js +4 -0
- package/dist/resolver.js +17 -0
- package/package.json +11 -5
- package/dist/index.js +0 -22966
- package/dist/index.umd.cjs +0 -28
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import g from "./helpers.util.js";
|
|
2
|
+
const k = {
|
|
3
|
+
/**
|
|
4
|
+
* Calculate X position
|
|
5
|
+
* @param {number|null|undefined} value graph value
|
|
6
|
+
* @param {number} min min value
|
|
7
|
+
* @param {number} max max value
|
|
8
|
+
* @param {number} area height for axis
|
|
9
|
+
* @param {number} startPoint startPoint
|
|
10
|
+
*
|
|
11
|
+
* @returns {number|null} position
|
|
12
|
+
*/
|
|
13
|
+
calculateX(e, i, n, o, l = 0) {
|
|
14
|
+
if (e == null || e > n || e < i)
|
|
15
|
+
return null;
|
|
16
|
+
const f = o / (n - i);
|
|
17
|
+
return Math.ceil(l + f * (e - i));
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Calculate X position (for timebar)
|
|
21
|
+
* @param {any} value graph value
|
|
22
|
+
* @param {number} min min value
|
|
23
|
+
* @param {number} max max value
|
|
24
|
+
* @param {number} area height for axis
|
|
25
|
+
* @param {number} startPoint startPoint
|
|
26
|
+
*
|
|
27
|
+
* @returns {any} position
|
|
28
|
+
*/
|
|
29
|
+
calculateSubX(e, i, n, o, l = 0) {
|
|
30
|
+
if (e == null)
|
|
31
|
+
return null;
|
|
32
|
+
const f = o / (n - i);
|
|
33
|
+
return Math.ceil(l + f * (e - i));
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Calculate Y position
|
|
37
|
+
* @param {number|null|undefined} value graph value
|
|
38
|
+
* @param {number} min min value
|
|
39
|
+
* @param {number} max max value
|
|
40
|
+
* @param {number} area height for axis
|
|
41
|
+
* @param {number} startPoint startPoint
|
|
42
|
+
*
|
|
43
|
+
* @returns {number|null} position
|
|
44
|
+
*/
|
|
45
|
+
calculateY(e, i, n, o, l = 0) {
|
|
46
|
+
let f;
|
|
47
|
+
if (e == null || e > n || e < i)
|
|
48
|
+
return null;
|
|
49
|
+
const t = o / (n - i);
|
|
50
|
+
return l ? f = l - t * (e - (i || 0)) : f = -(t * (e - (i || 0))), Math.floor(f);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Draw point for chart
|
|
54
|
+
* @param {object} ctx canvas context
|
|
55
|
+
* @param {string} style point style
|
|
56
|
+
* @param {number} radius radius
|
|
57
|
+
* @param {number} x x position
|
|
58
|
+
* @param {number} y y position
|
|
59
|
+
*
|
|
60
|
+
* @returns {undefined}
|
|
61
|
+
*/
|
|
62
|
+
drawPoint(e, i, n, o, l) {
|
|
63
|
+
let f, t, r, h, a;
|
|
64
|
+
if (isNaN(n) || n <= 0)
|
|
65
|
+
return;
|
|
66
|
+
let s, T, P, b;
|
|
67
|
+
switch (i) {
|
|
68
|
+
case "triangle":
|
|
69
|
+
e.beginPath(), f = 3 * n / Math.sqrt(3), h = f * Math.sqrt(3) / 2, e.moveTo(o - f / 2, l + h / 3), e.lineTo(o + f / 2, l + h / 3), e.lineTo(o, l - 2 * h / 3), e.closePath(), e.fill();
|
|
70
|
+
break;
|
|
71
|
+
case "rect":
|
|
72
|
+
a = 1 / Math.SQRT2 * n, e.beginPath(), e.fillRect(o - a, l - a, 2 * a, 2 * a), e.strokeRect(o - a, l - a, 2 * a, 2 * a);
|
|
73
|
+
break;
|
|
74
|
+
case "rectRounded":
|
|
75
|
+
s = n / Math.SQRT2, T = o - s, P = l - s, b = Math.SQRT2 * n, e.beginPath(), this.roundedRect(e, T, P, b, b, n / 2), e.closePath(), e.fill();
|
|
76
|
+
break;
|
|
77
|
+
case "rectRot":
|
|
78
|
+
a = 1 / Math.SQRT2 * n, e.beginPath(), e.moveTo(o - a, l), e.lineTo(o, l + a), e.lineTo(o + a, l), e.lineTo(o, l - a), e.closePath(), e.fill();
|
|
79
|
+
break;
|
|
80
|
+
case "cross":
|
|
81
|
+
e.beginPath(), e.moveTo(o, l + n), e.lineTo(o, l - n), e.moveTo(o - n, l), e.lineTo(o + n, l), e.closePath();
|
|
82
|
+
break;
|
|
83
|
+
case "crossRot":
|
|
84
|
+
e.beginPath(), t = Math.cos(Math.PI / 4) * n, r = Math.sin(Math.PI / 4) * n, e.moveTo(o - t, l - r), e.lineTo(o + t, l + r), e.moveTo(o - t, l + r), e.lineTo(o + t, l - r), e.closePath();
|
|
85
|
+
break;
|
|
86
|
+
case "star":
|
|
87
|
+
e.beginPath(), e.moveTo(o, l + n), e.lineTo(o, l - n), e.moveTo(o - n, l), e.lineTo(o + n, l), t = Math.cos(Math.PI / 4) * n, r = Math.sin(Math.PI / 4) * n, e.moveTo(o - t, l - r), e.lineTo(o + t, l + r), e.moveTo(o - t, l + r), e.lineTo(o + t, l - r), e.closePath();
|
|
88
|
+
break;
|
|
89
|
+
case "line":
|
|
90
|
+
e.beginPath(), e.moveTo(o - n, l), e.lineTo(o + n, l), e.closePath();
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
e.beginPath(), e.arc(o, l, n, 0, Math.PI * 2), e.closePath(), e.fill();
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
e.stroke();
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Draw roundedRect point for chart
|
|
100
|
+
* @param {object} ctx canvas context
|
|
101
|
+
* @param {number} x x position
|
|
102
|
+
* @param {number} y y position
|
|
103
|
+
* @param {string} width width
|
|
104
|
+
* @param {number} height height
|
|
105
|
+
* @param {number} radius radius
|
|
106
|
+
*
|
|
107
|
+
* @returns {undefined}
|
|
108
|
+
*/
|
|
109
|
+
roundedRect(e, i, n, o, l, f) {
|
|
110
|
+
const t = Math.PI, r = t / 2;
|
|
111
|
+
if (f) {
|
|
112
|
+
const h = Math.min(f, l / 2, o / 2), a = i + h, s = n + h, T = i + o - h, P = n + l - h;
|
|
113
|
+
e.moveTo(i, s), a < T && s < P ? (e.arc(a, s, h, -t, -r), e.arc(T, s, h, -r, 0), e.arc(T, P, h, 0, r), e.arc(a, P, h, r, t)) : a < T ? (e.moveTo(a, n), e.arc(T, s, h, -r, r), e.arc(a, s, h, r, t + r)) : s < P ? (e.arc(a, s, h, -t, 0), e.arc(a, P, h, 0, t)) : e.arc(a, s, h, -t, t), e.closePath(), e.moveTo(i, n);
|
|
114
|
+
} else
|
|
115
|
+
e.rect(i, n, o, l);
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* create Linear Gradient
|
|
119
|
+
* @param ctx
|
|
120
|
+
* @param isHorizontal
|
|
121
|
+
* @param positions
|
|
122
|
+
* @param stops
|
|
123
|
+
* @param isDownplay
|
|
124
|
+
* @param unSelectedOpacity
|
|
125
|
+
*
|
|
126
|
+
* @returns {object} gradient
|
|
127
|
+
*/
|
|
128
|
+
createGradient(e, i, n, o, l, f) {
|
|
129
|
+
const { x: t, y: r, w: h, h: a } = n;
|
|
130
|
+
let s;
|
|
131
|
+
i ? s = e.createLinearGradient(t, 0, t + h, 0) : s = e.createLinearGradient(0, r, 0, r + a);
|
|
132
|
+
for (let T = 0; T < o.length; T++) {
|
|
133
|
+
const P = o[T][0] ?? 0, b = o[T][1] ?? "rgba(255, 255, 255, 0)", M = b.includes("rgba") ? g.getOpacity(b) : 1, c = l ? f : M;
|
|
134
|
+
s.addColorStop(P, g.colorStringToRgba(b, c));
|
|
135
|
+
}
|
|
136
|
+
return s;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
k as default
|
|
141
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
x: {
|
|
3
|
+
rectStart: "x1",
|
|
4
|
+
rectEnd: "x2",
|
|
5
|
+
rectOffsetCounter: (e) => e === "top" ? "y2" : "y1",
|
|
6
|
+
rectOffset: (e) => e === "top" ? "y1" : "y2"
|
|
7
|
+
},
|
|
8
|
+
y: {
|
|
9
|
+
rectStart: "y2",
|
|
10
|
+
rectEnd: "y1",
|
|
11
|
+
rectOffsetCounter: (e) => e === "left" ? "x2" : "x1",
|
|
12
|
+
rectOffset: (e) => e === "left" ? "x1" : "x2"
|
|
13
|
+
}
|
|
14
|
+
}, i = [
|
|
15
|
+
"#2b99f0",
|
|
16
|
+
"#8ac449",
|
|
17
|
+
"#00C4C5",
|
|
18
|
+
"#ffde00",
|
|
19
|
+
"#ff7781",
|
|
20
|
+
"#8470ff",
|
|
21
|
+
"#75cd8e",
|
|
22
|
+
"#48d1cc",
|
|
23
|
+
"#fec64f",
|
|
24
|
+
"#fe984f",
|
|
25
|
+
"#0052ff",
|
|
26
|
+
"#00a48c",
|
|
27
|
+
"#83cfde",
|
|
28
|
+
"#dfe32d",
|
|
29
|
+
"#ff7d40",
|
|
30
|
+
"#99c7ff",
|
|
31
|
+
"#a5fee3",
|
|
32
|
+
"#0379c9",
|
|
33
|
+
"#eef093",
|
|
34
|
+
"#ffa891",
|
|
35
|
+
"#00c5cd",
|
|
36
|
+
"#009bc7",
|
|
37
|
+
"#cacaff",
|
|
38
|
+
"#ffc125",
|
|
39
|
+
"#df6264"
|
|
40
|
+
], l = {
|
|
41
|
+
show: !0,
|
|
42
|
+
highlight: {
|
|
43
|
+
defaultSize: 4,
|
|
44
|
+
maxSize: 6,
|
|
45
|
+
maxShadowSize: 10,
|
|
46
|
+
maxShadowOpacity: 0.4
|
|
47
|
+
},
|
|
48
|
+
xAxisIndex: 0,
|
|
49
|
+
yAxisIndex: 0,
|
|
50
|
+
point: !0,
|
|
51
|
+
pointHighlight: !0,
|
|
52
|
+
pointSize: 3,
|
|
53
|
+
pointStyle: "",
|
|
54
|
+
lineWidth: 2,
|
|
55
|
+
fill: !1,
|
|
56
|
+
fillOpacity: 0.4,
|
|
57
|
+
showLegend: !0,
|
|
58
|
+
passingValue: null,
|
|
59
|
+
interpolation: "none"
|
|
60
|
+
}, n = {
|
|
61
|
+
show: !0,
|
|
62
|
+
highlight: {
|
|
63
|
+
pointSize: 5
|
|
64
|
+
},
|
|
65
|
+
xAxisIndex: 0,
|
|
66
|
+
yAxisIndex: 0,
|
|
67
|
+
category: !0,
|
|
68
|
+
showLegend: !0,
|
|
69
|
+
showValue: {
|
|
70
|
+
use: !1,
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
textColor: "#000000",
|
|
73
|
+
formatter: null,
|
|
74
|
+
decimalPoint: null
|
|
75
|
+
}
|
|
76
|
+
}, s = {
|
|
77
|
+
show: !0,
|
|
78
|
+
showLegend: !0,
|
|
79
|
+
stroke: {
|
|
80
|
+
show: !0,
|
|
81
|
+
color: "#FFFFFF",
|
|
82
|
+
lineWidth: 2
|
|
83
|
+
},
|
|
84
|
+
showValue: {
|
|
85
|
+
use: !1,
|
|
86
|
+
fontSize: 12,
|
|
87
|
+
textColor: "#000000",
|
|
88
|
+
formatter: null
|
|
89
|
+
}
|
|
90
|
+
}, r = {
|
|
91
|
+
min: null,
|
|
92
|
+
max: null,
|
|
93
|
+
autoScaleRatio: null,
|
|
94
|
+
startToZero: !1,
|
|
95
|
+
showAxis: !0,
|
|
96
|
+
axisLineColor: "#C9CFDC",
|
|
97
|
+
axisLineWidth: 1,
|
|
98
|
+
showGrid: !0,
|
|
99
|
+
gridLineColor: "#C9CFDC",
|
|
100
|
+
showAxisTick: !0,
|
|
101
|
+
showIndicator: !1,
|
|
102
|
+
timeFormat: "mm:ss",
|
|
103
|
+
range: null,
|
|
104
|
+
interval: null,
|
|
105
|
+
decimalPoint: "auto",
|
|
106
|
+
fixedSteps: !1,
|
|
107
|
+
scaleChange: !1,
|
|
108
|
+
labelStyle: {
|
|
109
|
+
show: !0,
|
|
110
|
+
fontSize: 12,
|
|
111
|
+
color: "#25262E",
|
|
112
|
+
fontFamily: "Roboto",
|
|
113
|
+
fontWeight: 400,
|
|
114
|
+
fitWidth: !1,
|
|
115
|
+
fitDir: "right",
|
|
116
|
+
alignToGridLine: !1,
|
|
117
|
+
padding: 0,
|
|
118
|
+
fixWidth: void 0
|
|
119
|
+
},
|
|
120
|
+
lastLabelFontStyle: {
|
|
121
|
+
fontSize: 12,
|
|
122
|
+
color: "#808080",
|
|
123
|
+
fontFamily: "Roboto",
|
|
124
|
+
fontWeight: 400
|
|
125
|
+
},
|
|
126
|
+
title: {
|
|
127
|
+
use: !1,
|
|
128
|
+
text: null,
|
|
129
|
+
fontWeight: 400,
|
|
130
|
+
fontSize: 12,
|
|
131
|
+
fontFamily: "Roboto",
|
|
132
|
+
textAlign: "right",
|
|
133
|
+
fontStyle: "normal",
|
|
134
|
+
color: "#808080"
|
|
135
|
+
},
|
|
136
|
+
scrollbar: {
|
|
137
|
+
use: !1,
|
|
138
|
+
width: 14,
|
|
139
|
+
height: 14,
|
|
140
|
+
background: "#F2F2F2",
|
|
141
|
+
showButton: !0,
|
|
142
|
+
thumbStyle: {
|
|
143
|
+
background: "#929292",
|
|
144
|
+
radius: 0
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, t = {
|
|
148
|
+
show: !1,
|
|
149
|
+
fontSize: 12,
|
|
150
|
+
fontColor: "#FF0000",
|
|
151
|
+
fillColor: "#FFFFFF",
|
|
152
|
+
lineColor: "#FF0000",
|
|
153
|
+
lineWidth: 0,
|
|
154
|
+
fontWeight: 400,
|
|
155
|
+
fontFamily: "Roboto",
|
|
156
|
+
verticalAlign: "middle",
|
|
157
|
+
textAlign: "center",
|
|
158
|
+
textOverflow: "none",
|
|
159
|
+
// 'none', 'ellipsis'
|
|
160
|
+
maxWidth: null
|
|
161
|
+
}, f = {
|
|
162
|
+
color: "#FF0000",
|
|
163
|
+
lineWidth: 1,
|
|
164
|
+
label: t
|
|
165
|
+
}, a = {
|
|
166
|
+
color: "#FAE59D"
|
|
167
|
+
}, c = {
|
|
168
|
+
show: !0,
|
|
169
|
+
xAxisIndex: 0,
|
|
170
|
+
yAxisIndex: 0,
|
|
171
|
+
showLegend: !0,
|
|
172
|
+
showValue: {
|
|
173
|
+
use: !1,
|
|
174
|
+
fontSize: 12,
|
|
175
|
+
textColor: "#000000",
|
|
176
|
+
formatter: null,
|
|
177
|
+
decimalPoint: 0
|
|
178
|
+
},
|
|
179
|
+
highlight: {
|
|
180
|
+
stroke: {
|
|
181
|
+
use: !1,
|
|
182
|
+
color: null,
|
|
183
|
+
width: 1,
|
|
184
|
+
radius: 0
|
|
185
|
+
},
|
|
186
|
+
shadow: {
|
|
187
|
+
use: !0,
|
|
188
|
+
offsetX: 0,
|
|
189
|
+
offsetY: 0,
|
|
190
|
+
blur: 4,
|
|
191
|
+
color: "#959494"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}, u = {
|
|
195
|
+
millisecond: {
|
|
196
|
+
common: !0,
|
|
197
|
+
size: 1,
|
|
198
|
+
steps: [1, 2, 5, 10, 20, 50, 100, 250, 500]
|
|
199
|
+
},
|
|
200
|
+
second: {
|
|
201
|
+
common: !0,
|
|
202
|
+
size: 1e3,
|
|
203
|
+
steps: [1, 2, 5, 10, 30]
|
|
204
|
+
},
|
|
205
|
+
minute: {
|
|
206
|
+
common: !0,
|
|
207
|
+
size: 6e4,
|
|
208
|
+
steps: [1, 2, 5, 10, 30]
|
|
209
|
+
},
|
|
210
|
+
hour: {
|
|
211
|
+
common: !0,
|
|
212
|
+
size: 36e5,
|
|
213
|
+
steps: [1, 2, 3, 6, 12]
|
|
214
|
+
},
|
|
215
|
+
day: {
|
|
216
|
+
common: !0,
|
|
217
|
+
size: 864e5,
|
|
218
|
+
steps: [1, 2, 5]
|
|
219
|
+
},
|
|
220
|
+
week: {
|
|
221
|
+
common: !1,
|
|
222
|
+
size: 6048e5,
|
|
223
|
+
steps: [1, 2, 3, 4]
|
|
224
|
+
},
|
|
225
|
+
month: {
|
|
226
|
+
common: !0,
|
|
227
|
+
size: 26784e5,
|
|
228
|
+
steps: [1, 2, 3]
|
|
229
|
+
},
|
|
230
|
+
quarter: {
|
|
231
|
+
common: !1,
|
|
232
|
+
size: 7884e6,
|
|
233
|
+
steps: [1, 2, 3, 4]
|
|
234
|
+
},
|
|
235
|
+
year: {
|
|
236
|
+
common: !0,
|
|
237
|
+
size: 3154e7
|
|
238
|
+
}
|
|
239
|
+
}, d = Object.freeze([1, 2, 2.5, 5, 10]);
|
|
240
|
+
export {
|
|
241
|
+
r as AXIS_OPTION,
|
|
242
|
+
o as AXIS_UNITS,
|
|
243
|
+
n as BAR_OPTION,
|
|
244
|
+
i as COLOR,
|
|
245
|
+
c as HEAT_MAP_OPTION,
|
|
246
|
+
l as LINE_OPTION,
|
|
247
|
+
d as NICE_FRACTIONS,
|
|
248
|
+
s as PIE_OPTION,
|
|
249
|
+
a as PLOT_BAND_OPTION,
|
|
250
|
+
t as PLOT_LINE_LABEL_OPTION,
|
|
251
|
+
f as PLOT_LINE_OPTION,
|
|
252
|
+
u as TIME_INTERVALS
|
|
253
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { isNil as p } from "lodash-es";
|
|
2
|
+
import { quadrillion as $, trillion as x, billions as T, millions as m, truthy as E } from "../../../common/utils.js";
|
|
3
|
+
const S = document.createElement("canvas"), b = S.getContext("2d"), y = {
|
|
4
|
+
/**
|
|
5
|
+
* Transforming hex to rgb code
|
|
6
|
+
* @param {string} hex hex color code
|
|
7
|
+
*
|
|
8
|
+
* @returns {string} rgb code
|
|
9
|
+
*/
|
|
10
|
+
hexToRgb(t) {
|
|
11
|
+
if (!t)
|
|
12
|
+
return !1;
|
|
13
|
+
const e = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t), n = parseInt(e[1], 16), s = parseInt(e[2], 16), r = parseInt(e[3], 16);
|
|
14
|
+
return `${n},${s},${r}`;
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Check color string and return what type it is. ('HEX', 'RGB', 'RGBA' or 'NONE')
|
|
18
|
+
* @param colorStr
|
|
19
|
+
* @returns {string} color type
|
|
20
|
+
*/
|
|
21
|
+
getColorStringType(t) {
|
|
22
|
+
if (!t)
|
|
23
|
+
return "";
|
|
24
|
+
const e = t.replace(/ /g, ""), n = /^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(e), s = /^rgb[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*(?:,(?![)])|(?=[)]))){3}[)]$/.exec(
|
|
25
|
+
e
|
|
26
|
+
), r = /^rgba[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*,){3}\s*0*(?:\.\d+|1?)\s*[)]$/.exec(
|
|
27
|
+
e
|
|
28
|
+
);
|
|
29
|
+
let o = "";
|
|
30
|
+
return n ? o = "HEX" : s ? o = "RGB" : r ? o = "RGBA" : o = "NONE", o;
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Transforming color string to rgba code
|
|
34
|
+
* Return BLACK ('rgba(0, 0, 0, ${opacity})') if fail transforming
|
|
35
|
+
* @param colorStr hex color code, rgb, rgba .. etc
|
|
36
|
+
* @param opacity color opacity. (default 1)translate
|
|
37
|
+
* @returns {string} transformed rgba
|
|
38
|
+
*/
|
|
39
|
+
colorStringToRgba(t, e = 1) {
|
|
40
|
+
const n = t.replace(/ /g, ""), s = this.getColorStringType(n);
|
|
41
|
+
let r = "";
|
|
42
|
+
switch (s) {
|
|
43
|
+
case "HEX":
|
|
44
|
+
r = `rgba(${this.hexToRgb(n)},${e})`;
|
|
45
|
+
break;
|
|
46
|
+
case "RGB":
|
|
47
|
+
r = n.replace(")", `, ${e})`).replace("rgb", "rgba");
|
|
48
|
+
break;
|
|
49
|
+
case "RGBA":
|
|
50
|
+
r = n.replace(`${this.getOpacity(t)})`, `${e})`);
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
r = `rgba(0, 0, 0, ${e})`;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return r;
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* get opacity value on rgba color string
|
|
60
|
+
* ex) input : rgba(255, 255, 255, 0.1)
|
|
61
|
+
* return : 0.1
|
|
62
|
+
* @param rgbaColorString
|
|
63
|
+
* @returns {string} opacity
|
|
64
|
+
*/
|
|
65
|
+
getOpacity(t) {
|
|
66
|
+
const e = t == null ? void 0 : t.replace(/ /g, "");
|
|
67
|
+
return this.getColorStringType(e) === "RGBA" ? e.replace(/^.*,(.+)\)/, "$1") : "1";
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* To logarithmic scale, compute log value
|
|
71
|
+
* @param {number} value graph value
|
|
72
|
+
*
|
|
73
|
+
* @returns {number} computed value
|
|
74
|
+
*/
|
|
75
|
+
calculateMagnitude(t) {
|
|
76
|
+
return Math.floor(Math.log(t) / Math.LN10);
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Set alias pixel to deal with anti-aliasing
|
|
80
|
+
* @param {number} width line width
|
|
81
|
+
*
|
|
82
|
+
* @returns {number} computed value
|
|
83
|
+
*/
|
|
84
|
+
aliasPixel(t) {
|
|
85
|
+
return t % 2 === 0 ? 0 : 0.5;
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Create string for canvas font style
|
|
89
|
+
* @param {object} style style object by user
|
|
90
|
+
*
|
|
91
|
+
* @returns {string} computed value
|
|
92
|
+
*/
|
|
93
|
+
getLabelStyle(t) {
|
|
94
|
+
const {
|
|
95
|
+
fontStyle: e = "normal",
|
|
96
|
+
fontWeight: n = "normal",
|
|
97
|
+
fontSize: s = "12",
|
|
98
|
+
fontFamily: r = "Roboto"
|
|
99
|
+
} = t;
|
|
100
|
+
return `${e} normal ${n} ${s}px ${r}`;
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Create sign format with number
|
|
104
|
+
* @param {number} value graph value
|
|
105
|
+
* @param {number} decimalPoint decimal point
|
|
106
|
+
*
|
|
107
|
+
* @returns {string} signed value
|
|
108
|
+
*/
|
|
109
|
+
labelSignFormat(t, e = null) {
|
|
110
|
+
const n = $(1), s = x(1), r = T(1), o = m(1), l = 1e3;
|
|
111
|
+
let i;
|
|
112
|
+
if (!E(t))
|
|
113
|
+
return t;
|
|
114
|
+
const g = t < 0, a = Math.abs(t), f = (c, d, u) => {
|
|
115
|
+
let h;
|
|
116
|
+
return c % d === 0 ? h = p(e) ? `${c / d}${u}` : `${(c / d).toFixed(e)}${u}` : h = `${(c / d).toFixed(1)}${u}`, g ? `-${h}` : h;
|
|
117
|
+
};
|
|
118
|
+
if (a >= n)
|
|
119
|
+
i = f(a, n, "P");
|
|
120
|
+
else if (a >= s)
|
|
121
|
+
i = f(a, s, "T");
|
|
122
|
+
else if (a >= r)
|
|
123
|
+
i = f(a, r, "G");
|
|
124
|
+
else if (a >= o)
|
|
125
|
+
i = f(a, o, "M");
|
|
126
|
+
else if (a >= l)
|
|
127
|
+
i = f(a, 1e3, "K");
|
|
128
|
+
else {
|
|
129
|
+
const c = p(e) ? a : a.toFixed(e);
|
|
130
|
+
i = g ? `-${c}` : `${c}`;
|
|
131
|
+
}
|
|
132
|
+
return i;
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Calculate text size with html
|
|
136
|
+
* @param {string} text text is needed to check size
|
|
137
|
+
* @param {string} fontStyle text font style
|
|
138
|
+
* @param {number} padding user define text padding
|
|
139
|
+
*
|
|
140
|
+
* @returns {object} text size information
|
|
141
|
+
*/
|
|
142
|
+
calcTextSize(t, e, n = 0) {
|
|
143
|
+
const s = document.createElement("span"), r = `visibility:hidden; position:absolute; top:-10000px; font: ${e}; padding: 0 ${n}px`;
|
|
144
|
+
s.setAttribute("style", r), s.style.font = e, s.textContent = t, document.body.appendChild(s);
|
|
145
|
+
const o = s.getBoundingClientRect(), l = o.width || 2, i = o.height || 2;
|
|
146
|
+
return s.remove(), { width: l, height: i };
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Calculate text size with Canvas
|
|
150
|
+
* @param {string} text text is needed to check size
|
|
151
|
+
* @param {string} fontStyle text font style
|
|
152
|
+
* @returns {{width: number; height: number;}} text size information
|
|
153
|
+
*/
|
|
154
|
+
calcTextSizeCanvas(t, e) {
|
|
155
|
+
if (!t)
|
|
156
|
+
return { width: 2, height: 2 };
|
|
157
|
+
b.save(), b.font = e;
|
|
158
|
+
const n = b.measureText(t), s = e.match(/(\d+(?:\.\d+)?)px/), o = (s ? Number(s[1]) : 14) * 1.2;
|
|
159
|
+
return b.restore(), {
|
|
160
|
+
width: Math.max(Math.ceil(n.width), 2),
|
|
161
|
+
height: Math.max(Math.ceil(o), 2)
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Comparing strings
|
|
166
|
+
* @param {array} array compared array
|
|
167
|
+
*
|
|
168
|
+
* @returns {object} min/max information
|
|
169
|
+
*/
|
|
170
|
+
getStringMinMax(t) {
|
|
171
|
+
const e = {
|
|
172
|
+
min: t[0],
|
|
173
|
+
max: t[0]
|
|
174
|
+
};
|
|
175
|
+
return t.forEach((n) => {
|
|
176
|
+
var s, r;
|
|
177
|
+
((s = e == null ? void 0 : e.max) == null ? void 0 : s.length) < (n == null ? void 0 : n.length) && (e.max = n), ((r = e == null ? void 0 : e.min) == null ? void 0 : r.length) > (n == null ? void 0 : n.length) && (e.min = n);
|
|
178
|
+
}), e;
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* Truncate the long string to short string with ellipsis until fitting maxWidth
|
|
182
|
+
* @param {string} str target string
|
|
183
|
+
* @param {number} maxWidth maximum string width on canvas
|
|
184
|
+
* @param {Object} ctx canvas context
|
|
185
|
+
* @param {string} direction left or right (default: right)
|
|
186
|
+
*/
|
|
187
|
+
truncateLabelWithEllipsis(t, e, n, s = "right") {
|
|
188
|
+
if (!t)
|
|
189
|
+
return "";
|
|
190
|
+
if (!e)
|
|
191
|
+
return t;
|
|
192
|
+
const r = "…", o = n.measureText(r).width;
|
|
193
|
+
let l = t, i = n.measureText(l).width;
|
|
194
|
+
if (i <= e || i <= o)
|
|
195
|
+
return t;
|
|
196
|
+
let g = l.length;
|
|
197
|
+
for (; i >= e - o && g-- > 0; )
|
|
198
|
+
l = s === "right" ? l.substring(0, g) : l.substring(1, l.length), i = n.measureText(l).width;
|
|
199
|
+
return s === "right" ? l + r : r + l;
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* Draw text tip
|
|
203
|
+
* @param {object} param object for drawing text tip
|
|
204
|
+
*
|
|
205
|
+
* @returns {undefined}
|
|
206
|
+
*/
|
|
207
|
+
showLabelTip(t) {
|
|
208
|
+
const { ctx: e, width: n, height: s, x: r, y: o, arrowSize: l, borderRadius: i, text: g, backgroundColor: a, textColor: f } = t, c = r - n / 2, d = r + n / 2, u = o - s, h = o;
|
|
209
|
+
e.beginPath(), e.save(), e.fillStyle = a || "#E96E2C", e.strokeStyle = a || "#E96E2C", e.shadowBlur = 0, e.moveTo(c + i, u), e.quadraticCurveTo(c, u, c, u + i), e.lineTo(c, h - i), e.quadraticCurveTo(c, h, c + i, h), e.lineTo(d - i, h), e.quadraticCurveTo(d, h, d, h - i), e.lineTo(d, u + i), e.quadraticCurveTo(d, u, d - i, u), e.lineTo(r - l, u), e.lineTo(r, u - l), e.lineTo(r + l, u), e.lineTo(c + i, u), e.closePath(), e.fill(), e.restore(), e.save(), e.font = "normal normal bold 12px Roboto", e.fillStyle = f || "#FFF", e.textBaseline = "middle", e.textAlign = "center", e.fillText(`${g}`, r, u + s / 2), e.restore(), e.beginPath();
|
|
210
|
+
},
|
|
211
|
+
isPieType(t) {
|
|
212
|
+
return t === "pie" || t === "doughnut" || t === "sunburst";
|
|
213
|
+
},
|
|
214
|
+
isDoughnutHole(t) {
|
|
215
|
+
return t === "doughnut" || t === "sunburst";
|
|
216
|
+
},
|
|
217
|
+
setDOMStyle(t, e) {
|
|
218
|
+
var n;
|
|
219
|
+
!t || !e || (n = Object.keys(e)) == null || n.forEach((s) => {
|
|
220
|
+
t.style[s] = e[s];
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
/**
|
|
224
|
+
* Check the value exceeds 9007199254740991 or less than -9007199254740991
|
|
225
|
+
* null => safe Integer
|
|
226
|
+
* string and undefined => Not Safe Integer
|
|
227
|
+
* @param {any} value
|
|
228
|
+
* @returns {boolean}
|
|
229
|
+
*/
|
|
230
|
+
checkSafeInteger(t) {
|
|
231
|
+
return t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* Convert html(string) To Element
|
|
235
|
+
* @param htmlString
|
|
236
|
+
* @returns {ChildNode}
|
|
237
|
+
*/
|
|
238
|
+
htmlToElement(t) {
|
|
239
|
+
const e = document.createElement("template");
|
|
240
|
+
return e.innerHTML = t.trim(), e.content.firstChild;
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* Check The value is null or undefined
|
|
244
|
+
* @param { number | undefined | null } value
|
|
245
|
+
* @returns {boolean}
|
|
246
|
+
*/
|
|
247
|
+
isNullOrUndefined(t) {
|
|
248
|
+
return t == null;
|
|
249
|
+
},
|
|
250
|
+
rgbaAdjustHalfOpacity(t) {
|
|
251
|
+
const e = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/, n = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
|
|
252
|
+
if (e.test(t)) {
|
|
253
|
+
const [, s, r, o] = t.match(e);
|
|
254
|
+
return `rgba(${s}, ${r}, ${o}, 0.5)`;
|
|
255
|
+
}
|
|
256
|
+
if (n.test(t)) {
|
|
257
|
+
const [, s, r, o, l] = t.match(n), i = (parseFloat(l) / 2).toFixed(2);
|
|
258
|
+
return `rgba(${s}, ${r}, ${o}, ${i})`;
|
|
259
|
+
}
|
|
260
|
+
return t.startsWith("#") && t.length > 7 ? t : `${t}80`;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
export {
|
|
264
|
+
y as default
|
|
265
|
+
};
|