x-next 1.3.1 → 1.4.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/AI_USAGE.md +2 -2
- package/CHANGELOG.md +36 -0
- package/dist/_utils/constant.d.ts +1 -1
- package/dist/_utils/palette.d.ts +6 -14
- package/dist/components/alert/Alert.vue.d.ts +9 -9
- package/dist/components/alert/index.d.ts +6 -6
- package/dist/components/button/ButtonGroup.vue.d.ts +22 -18
- package/dist/components/date-picker/DatePanel.vue.d.ts +342 -1
- package/dist/components/date-picker/DatePicker.vue.d.ts +343 -2
- package/dist/components/date-picker/index.d.ts +1765 -1083
- package/dist/components/form-input-tag/index.d.ts +26 -25
- package/dist/components/form-input-tag/interface.d.ts +8 -0
- package/dist/components/link/Link.vue.d.ts +4 -4
- package/dist/components/link/index.d.ts +6 -6
- package/dist/components/message/index.d.ts +3 -3
- package/dist/components/message/message.vue.d.ts +1 -1
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/popconfirm/src/types.d.ts +1 -1
- package/dist/components/progress/Progress.vue.d.ts +3 -3
- package/dist/components/progress/index.d.ts +3 -3
- package/dist/components/tag/Tag.vue.d.ts +14 -0
- package/dist/components/tag/index.d.ts +9 -0
- package/dist/components/tag/interface.d.ts +5 -0
- package/dist/components/trend-chart/components/TrendChart.d.ts +127 -17
- package/dist/components/trend-chart/components/trend-chart-curve.d.ts +27 -7
- package/dist/components/trend-chart/components/trend-chart-labels.d.ts +4 -0
- package/dist/components/trend-chart/helpers/getPadding.d.ts +3 -2
- package/dist/components/trend-chart/index.d.ts +223 -28
- package/dist/components/trend-chart/props.d.ts +63 -5
- package/dist/es/_styles/palette-aliases.js +182 -127
- package/dist/es/_utils/palette.js +49 -43
- package/dist/es/components/_components/picker/input-range.vue2.js +10 -10
- package/dist/es/components/_components/picker/input.vue2.js +20 -20
- package/dist/es/components/_components/select-view/select-view.js +2 -2
- package/dist/es/components/alert/Alert.vue.js +2 -2
- package/dist/es/components/alert/Alert.vue2.js +21 -20
- package/dist/es/components/button/Button.js +17 -17
- package/dist/es/components/button/ButtonGroup.vue2.js +11 -9
- package/dist/es/components/date-picker/DatePanel.vue.js +71 -62
- package/dist/es/components/date-picker/DatePanel.vue2.js +50 -40
- package/dist/es/components/date-picker/DatePicker.vue2.js +1 -1
- package/dist/es/components/form/form-item-label.vue.js +25 -22
- package/dist/es/components/form/form-item-label.vue2.js +1 -1
- package/dist/es/components/form-checkbox/icon-check.js +12 -43
- package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
- package/dist/es/components/form-input/InputSearch.js +1 -1
- package/dist/es/components/form-input-number/InputNumber.js +4 -4
- package/dist/es/components/form-input-tag/InputTag.js +168 -147
- package/dist/es/components/form-input-tag/utils.js +21 -19
- package/dist/es/components/form-textarea/Textarea.vue2.js +1 -1
- package/dist/es/components/link/Link.vue2.js +1 -1
- package/dist/es/components/popconfirm/src/popup.vue.js +1 -1
- package/dist/es/components/progress/Progress.vue2.js +1 -1
- package/dist/es/components/table/Table.js +1 -1
- package/dist/es/components/table/table-th.js +2 -2
- package/dist/es/components/tabs/tabs-button.js +2 -2
- package/dist/es/components/tabs/tabs-nav.js +1 -1
- package/dist/es/components/tag/Tag.vue.js +20 -20
- package/dist/es/components/tag/Tag.vue2.js +35 -28
- package/dist/es/components/time-picker/TimePanel.vue.js +30 -29
- package/dist/es/components/time-picker/TimePicker.vue2.js +1 -1
- package/dist/es/components/time-picker/TimeRangePanel.js +26 -23
- package/dist/es/components/trend-chart/components/TrendChart.js +208 -142
- package/dist/es/components/trend-chart/components/trend-chart-curve.js +124 -59
- package/dist/es/components/trend-chart/components/trend-chart-labels.js +43 -41
- package/dist/es/components/trend-chart/helpers/getPadding.js +3 -3
- package/dist/es/components/trend-chart/props.js +101 -33
- package/dist/es/components/trend-chart/themes.js +15 -15
- package/dist/es/components/watermark/controller.js +40 -40
- package/dist/es/icons/default/calendar.js +15 -0
- package/dist/es/icons/default/clock-circle.js +15 -0
- package/dist/es/icons/default/double-left.js +15 -0
- package/dist/es/icons/default/double-right.js +15 -0
- package/dist/es/icons/default/down.js +16 -0
- package/dist/es/icons/default/eye-invisible.js +20 -0
- package/dist/es/icons/default/eye.js +18 -0
- package/dist/es/icons/default/left.js +15 -0
- package/dist/es/icons/default/minus.js +16 -0
- package/dist/es/icons/default/plus.js +16 -0
- package/dist/es/icons/default/question-circle.js +18 -0
- package/dist/es/icons/default/right.js +15 -0
- package/dist/es/icons/default/search.js +16 -0
- package/dist/es/icons/default/up.js +16 -0
- package/dist/es/icons/icon.js +26 -25
- package/dist/es/icons/public/boxicons/basic.js +1893 -0
- package/dist/es/icons/public/boxicons/brands.js +304 -0
- package/dist/es/icons/public/boxicons/filled.js +1893 -0
- package/dist/es/icons/public/boxicons/index.js +24 -0
- package/dist/es/icons/public/boxicons/names.js +4082 -0
- package/dist/es/icons/registry.js +15 -15
- package/dist/es/style.css +1 -1
- package/dist/icons/default/calendar.d.ts +93 -0
- package/dist/icons/default/clock-circle.d.ts +93 -0
- package/dist/icons/{_self/down.d.ts → default/double-left.d.ts} +6 -0
- package/dist/icons/{_self/eye-invisible.d.ts → default/double-right.d.ts} +6 -0
- package/dist/icons/default/down.d.ts +93 -0
- package/dist/icons/default/eye-invisible.d.ts +93 -0
- package/dist/icons/default/eye.d.ts +93 -0
- package/dist/icons/{_self/eye.d.ts → default/left.d.ts} +7 -0
- package/dist/icons/default/minus.d.ts +93 -0
- package/dist/icons/{_self → default}/plus.d.ts +7 -0
- package/dist/icons/default/question-circle.d.ts +93 -0
- package/dist/icons/{_self/minus.d.ts → default/right.d.ts} +7 -0
- package/dist/icons/{_self → default}/search.d.ts +7 -0
- package/dist/icons/{_self → default}/up.d.ts +7 -0
- package/dist/icons/public/boxicons/basic.cjs +1 -0
- package/dist/icons/public/boxicons/basic.d.ts +2 -0
- package/dist/icons/public/boxicons/brands.cjs +1 -0
- package/dist/icons/public/boxicons/brands.d.ts +2 -0
- package/dist/icons/public/boxicons/filled.cjs +1 -0
- package/dist/icons/public/boxicons/filled.d.ts +2 -0
- package/dist/icons/public/boxicons/index.cjs +1 -0
- package/dist/icons/public/boxicons/index.d.ts +10 -0
- package/dist/icons/public/boxicons/names.d.ts +10 -0
- package/dist/icons/registry.d.ts +5 -0
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/style/alert.css +1 -1
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/dialog.css +1 -1
- package/dist/style/drawer.css +1 -1
- package/dist/style/dropdown.css +1 -1
- package/dist/style/form-input-number.css +1 -1
- package/dist/style/form-input-tag.css +1 -1
- package/dist/style/form-input.css +1 -1
- package/dist/style/form-radio.css +1 -1
- package/dist/style/form-select.css +1 -1
- package/dist/style/form-textarea.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/link.css +1 -1
- package/dist/style/menu.css +1 -1
- package/dist/style/message-box.css +1 -1
- package/dist/style/network.css +1 -1
- package/dist/style/popconfirm.css +1 -1
- package/dist/style/popover.css +1 -1
- package/dist/style/popup.css +1 -1
- package/dist/style/progress.css +1 -1
- package/dist/style/rate.css +1 -1
- package/dist/style/spin.css +1 -1
- package/dist/style/steps.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/tag.css +1 -1
- package/dist/style/time-picker.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +30 -4
- package/dist/es/icons/_self/down.js +0 -16
- package/dist/es/icons/_self/eye-invisible.js +0 -13
- package/dist/es/icons/_self/eye.js +0 -13
- package/dist/es/icons/_self/minus.js +0 -13
- package/dist/es/icons/_self/plus.js +0 -12
- package/dist/es/icons/_self/question-message.js +0 -12
- package/dist/es/icons/_self/search.js +0 -13
- package/dist/es/icons/_self/up.js +0 -16
- package/dist/es/icons/_ui/calendar.js +0 -13
- package/dist/es/icons/_ui/time.js +0 -12
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { defineComponent as Z, useId as p, reactive as ee, computed as u, ref as j, onMounted as te, nextTick as f, onUnmounted as le, watch as N, createVNode as m, mergeProps as S, h as ae, Fragment as ne } from "vue";
|
|
2
|
+
import ie from "../helpers/getPadding.js";
|
|
3
|
+
import ue from "../helpers/genPoints.js";
|
|
4
|
+
import { useLocale as oe } from "../../../locale/index.js";
|
|
5
|
+
import F from "./trend-chart-grid.js";
|
|
6
|
+
import E from "./trend-chart-labels.js";
|
|
7
|
+
import $ from "./trend-chart-curve.js";
|
|
8
|
+
import { getComponentPrefix as re } from "../../../_utils/config.js";
|
|
9
|
+
import { trendChartProps as me } from "../props.js";
|
|
10
|
+
import { TrendChartTheme as x } from "../themes.js";
|
|
11
|
+
const we = /* @__PURE__ */ Z({
|
|
12
|
+
name: re("TrendChart"),
|
|
12
13
|
components: {
|
|
13
|
-
TrendChartGrid:
|
|
14
|
-
TrendChartLabels:
|
|
15
|
-
TrendChartCurve:
|
|
14
|
+
TrendChartGrid: F,
|
|
15
|
+
TrendChartLabels: E,
|
|
16
|
+
TrendChartCurve: $
|
|
16
17
|
},
|
|
17
|
-
props:
|
|
18
|
+
props: me,
|
|
18
19
|
emits: {
|
|
19
|
-
"mouse-move": (
|
|
20
|
+
"mouse-move": (t) => !0
|
|
20
21
|
},
|
|
21
|
-
setup(
|
|
22
|
-
emit:
|
|
22
|
+
setup(t, {
|
|
23
|
+
emit: w
|
|
23
24
|
}) {
|
|
24
25
|
const {
|
|
25
|
-
t:
|
|
26
|
-
} =
|
|
26
|
+
t: B
|
|
27
|
+
} = oe(), A = `x-trend-chart-clip-${p()}`, a = ee({
|
|
27
28
|
width: null,
|
|
28
29
|
height: null,
|
|
29
30
|
labelsOverflowObject: {
|
|
@@ -32,155 +33,218 @@ const ie = /* @__PURE__ */ G({
|
|
|
32
33
|
bottom: 0,
|
|
33
34
|
left: 0
|
|
34
35
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}), z = (e, t) => ({
|
|
36
|
+
activeIndex: null
|
|
37
|
+
}), D = (e, l = {}) => ({
|
|
38
38
|
...e,
|
|
39
|
-
...
|
|
39
|
+
...l,
|
|
40
40
|
stroke: {
|
|
41
41
|
...e.stroke,
|
|
42
|
-
...
|
|
42
|
+
...l.color ? {
|
|
43
|
+
color: l.color
|
|
44
|
+
} : {},
|
|
45
|
+
...l.stroke
|
|
43
46
|
},
|
|
44
47
|
fill: {
|
|
45
48
|
...e.fill,
|
|
46
|
-
...
|
|
49
|
+
...l.color ? {
|
|
50
|
+
color: l.color
|
|
51
|
+
} : {},
|
|
52
|
+
...l.fill
|
|
47
53
|
},
|
|
48
54
|
point: {
|
|
49
55
|
...e.point,
|
|
50
|
-
...
|
|
56
|
+
...l.color ? {
|
|
57
|
+
color: l.color
|
|
58
|
+
} : {},
|
|
59
|
+
...l.point
|
|
51
60
|
},
|
|
52
61
|
axisLine: {
|
|
53
62
|
...e.axisLine,
|
|
54
|
-
...
|
|
63
|
+
...l.color ? {
|
|
64
|
+
color: l.color
|
|
65
|
+
} : {},
|
|
66
|
+
...l.axisLine
|
|
55
67
|
}
|
|
56
|
-
}),
|
|
57
|
-
let e =
|
|
58
|
-
return
|
|
59
|
-
}),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const r = m.value.length;
|
|
67
|
-
return a.max !== void 0 && (e = Math.max(e, a.max)), a.min !== void 0 && (t = Math.min(t, a.min)), {
|
|
68
|
-
maxValue: e,
|
|
69
|
-
minValue: t,
|
|
70
|
-
maxAmount: r
|
|
68
|
+
}), g = u(() => {
|
|
69
|
+
let e = x.PRIMARY;
|
|
70
|
+
return t.status === "success" ? e = x.SUCCESS : t.status === "danger" ? e = x.DANGER : t.status === "warning" ? e = x.WARNING : t.status === "strong" ? e = x.STRONG : t.status === "info" && (e = x.INFO), D(e, t.theme);
|
|
71
|
+
}), h = u(() => t.dataset.filter((e) => Number.isFinite(e))), G = u(() => h.value.length > 0), c = u(() => ie(t.padding)), n = u(() => {
|
|
72
|
+
const e = Number(c.value.left) + Number(a.labelsOverflowObject.left), l = Number(c.value.top) + Number(a.labelsOverflowObject.top), i = Math.max(e, (a.width ?? 0) - Number(c.value.right) - Number(a.labelsOverflowObject.right)), o = Math.max(l, (a.height ?? 0) - Number(c.value.bottom) - Number(a.labelsOverflowObject.bottom));
|
|
73
|
+
return {
|
|
74
|
+
minX: e,
|
|
75
|
+
minY: l,
|
|
76
|
+
maxX: i,
|
|
77
|
+
maxY: o
|
|
71
78
|
};
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
}), r = u(() => {
|
|
80
|
+
const e = h.value, l = e.length ? Math.max(...e) : 0, i = e.length ? Math.min(...e) : 0;
|
|
81
|
+
let o = Number.isFinite(t.max) ? t.max : l, s = Number.isFinite(t.min) ? t.min : i;
|
|
82
|
+
return s > o && ([s, o] = [o, s]), {
|
|
83
|
+
maxValue: o,
|
|
84
|
+
minValue: s,
|
|
85
|
+
maxAmount: e.length
|
|
86
|
+
};
|
|
87
|
+
}), W = u(() => ({
|
|
88
|
+
width: typeof t.width == "number" ? `${t.width}px` : t.width,
|
|
89
|
+
height: typeof t.height == "number" ? `${t.height}px` : t.height
|
|
90
|
+
})), b = u(() => n.value.maxX - n.value.minX), L = u(() => n.value.maxY - n.value.minY), U = u(() => ({
|
|
91
|
+
x: n.value.minX,
|
|
92
|
+
y: n.value.minY,
|
|
93
|
+
width: b.value,
|
|
94
|
+
height: L.value,
|
|
77
95
|
opacity: 0
|
|
78
|
-
})),
|
|
79
|
-
x:
|
|
80
|
-
y:
|
|
81
|
-
})),
|
|
82
|
-
if (
|
|
96
|
+
})), R = u(() => ({
|
|
97
|
+
x: n.value.minX + b.value / 2,
|
|
98
|
+
y: n.value.minY + L.value / 2
|
|
99
|
+
})), X = u(() => {
|
|
100
|
+
if (r.value.maxAmount <= 0)
|
|
83
101
|
return [];
|
|
84
|
-
if (
|
|
85
|
-
return [Math.round(
|
|
86
|
-
const e =
|
|
102
|
+
if (r.value.maxAmount === 1)
|
|
103
|
+
return [Math.round(n.value.minX + b.value / 2)];
|
|
104
|
+
const e = b.value / (r.value.maxAmount - 1);
|
|
87
105
|
return Array.from({
|
|
88
|
-
length:
|
|
89
|
-
}, (
|
|
90
|
-
}),
|
|
106
|
+
length: r.value.maxAmount
|
|
107
|
+
}, (l, i) => Math.round(n.value.minX + e * i));
|
|
108
|
+
}), y = u(() => a.activeIndex === null ? null : X.value[a.activeIndex] ?? null), _ = u(() => ue(h.value, n.value, r.value.maxValue, r.value.minValue, r.value.maxAmount)), H = u(() => {
|
|
109
|
+
const e = a.activeIndex === null ? null : _.value[a.activeIndex];
|
|
110
|
+
return e ? Math.min(Math.max(e.y, n.value.minY), n.value.maxY) : n.value.minY;
|
|
111
|
+
}), v = j(null), M = j(null), O = () => {
|
|
91
112
|
if (v.value) {
|
|
92
113
|
const e = v.value.getBoundingClientRect();
|
|
93
|
-
|
|
114
|
+
a.width = e.width, a.height = e.height;
|
|
94
115
|
}
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
}, C = () => {
|
|
117
|
+
a.labelsOverflowObject = {
|
|
118
|
+
top: 0,
|
|
119
|
+
right: 0,
|
|
120
|
+
bottom: 0,
|
|
121
|
+
left: 0
|
|
122
|
+
};
|
|
123
|
+
}, I = () => {
|
|
124
|
+
if (v.value && M.value) {
|
|
125
|
+
const e = v.value.getBoundingClientRect(), l = M.value.$el.getBoundingClientRect();
|
|
126
|
+
a.labelsOverflowObject = {
|
|
127
|
+
top: Math.max(0, Number(e.top) - Number(l.top) + Number(c.value.top)),
|
|
128
|
+
right: Math.max(0, Number(l.right) - Number(e.right) + Number(c.value.right)),
|
|
129
|
+
bottom: Math.max(0, Number(l.bottom) - Number(e.bottom) + Number(c.value.bottom)),
|
|
130
|
+
left: Math.max(0, Number(c.value.left) - Number(l.left) + Number(e.left))
|
|
103
131
|
};
|
|
104
132
|
} else
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
133
|
+
C();
|
|
134
|
+
}, P = () => {
|
|
135
|
+
O(), f(() => {
|
|
136
|
+
C(), f(I);
|
|
137
|
+
});
|
|
138
|
+
}, q = (e) => {
|
|
139
|
+
const l = X.value;
|
|
140
|
+
if (!l.length)
|
|
141
|
+
return null;
|
|
142
|
+
let i = 0;
|
|
143
|
+
return l.forEach((o, s) => {
|
|
144
|
+
Math.abs(o - e) < Math.abs(l[i] - e) && (i = s);
|
|
145
|
+
}), i;
|
|
146
|
+
}, J = (e) => {
|
|
114
147
|
if (v.value) {
|
|
115
|
-
const
|
|
116
|
-
|
|
148
|
+
const l = v.value.getBoundingClientRect();
|
|
149
|
+
a.activeIndex = q(e.clientX - l.left);
|
|
117
150
|
}
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
151
|
+
}, K = () => {
|
|
152
|
+
a.activeIndex = null;
|
|
153
|
+
};
|
|
154
|
+
let d = null;
|
|
155
|
+
const Q = () => {
|
|
156
|
+
typeof ResizeObserver > "u" || !v.value || (d = new ResizeObserver(() => {
|
|
157
|
+
P();
|
|
158
|
+
}), d.observe(v.value));
|
|
159
|
+
}, V = () => {
|
|
160
|
+
P();
|
|
122
161
|
};
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
window.removeEventListener("resize",
|
|
127
|
-
}),
|
|
162
|
+
return te(() => {
|
|
163
|
+
O(), f(I), Q(), window.addEventListener("resize", V);
|
|
164
|
+
}), le(() => {
|
|
165
|
+
d == null || d.disconnect(), d = null, window.removeEventListener("resize", V);
|
|
166
|
+
}), N(() => a.activeIndex, (e) => {
|
|
128
167
|
if (e !== null) {
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
168
|
+
const l = h.value[e];
|
|
169
|
+
if (l === void 0) {
|
|
170
|
+
w("mouse-move", null);
|
|
131
171
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
data: m.value[t]
|
|
172
|
+
}
|
|
173
|
+
w("mouse-move", {
|
|
174
|
+
index: e,
|
|
175
|
+
data: l
|
|
137
176
|
});
|
|
138
177
|
} else
|
|
139
|
-
|
|
140
|
-
}),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
178
|
+
w("mouse-move", null);
|
|
179
|
+
}), N(h, (e) => {
|
|
180
|
+
a.activeIndex !== null && a.activeIndex >= e.length && (a.activeIndex = null);
|
|
181
|
+
}), N(() => [t.labels, t.dataset, t.min, t.max, t.padding], () => {
|
|
182
|
+
C(), f(() => {
|
|
183
|
+
O(), f(I);
|
|
184
|
+
});
|
|
185
|
+
}, {
|
|
186
|
+
deep: !0
|
|
187
|
+
}), N(() => {
|
|
188
|
+
var e, l, i, o;
|
|
189
|
+
return [(e = t.grid) == null ? void 0 : e.verticalLines, (l = t.grid) == null ? void 0 : l.verticalLinesNumber, (o = (i = t.labels) == null ? void 0 : i.xLabels) == null ? void 0 : o.length, h.value.length];
|
|
190
|
+
}, () => {
|
|
147
191
|
}, {
|
|
192
|
+
immediate: !0,
|
|
148
193
|
deep: !0
|
|
149
194
|
}), () => {
|
|
150
|
-
var e,
|
|
151
|
-
return
|
|
195
|
+
var e, l, i, o, s, Y, T, z, k;
|
|
196
|
+
return m("svg", {
|
|
152
197
|
class: "x-trend-chart",
|
|
153
198
|
ref: v,
|
|
154
199
|
xmlns: "http://www.w3.org/2000/svg",
|
|
155
200
|
width: "100%",
|
|
156
|
-
height: "100%"
|
|
157
|
-
|
|
201
|
+
height: "100%",
|
|
202
|
+
style: W.value,
|
|
203
|
+
role: t.ariaLabel ? "img" : void 0,
|
|
204
|
+
"aria-label": t.ariaLabel
|
|
205
|
+
}, [m("defs", null, [m("clipPath", {
|
|
206
|
+
id: A
|
|
207
|
+
}, [m("rect", {
|
|
208
|
+
x: n.value.minX,
|
|
209
|
+
y: n.value.minY,
|
|
210
|
+
width: Math.max(0, b.value),
|
|
211
|
+
height: Math.max(0, L.value)
|
|
212
|
+
}, null)])]), t.grid && m(F, {
|
|
158
213
|
class: "grid",
|
|
159
|
-
verticalLines:
|
|
160
|
-
verticalLinesNumber:
|
|
161
|
-
horizontalLines:
|
|
162
|
-
horizontalLinesNumber:
|
|
163
|
-
boundary:
|
|
164
|
-
}, null),
|
|
165
|
-
ref:
|
|
214
|
+
verticalLines: t.grid.verticalLines,
|
|
215
|
+
verticalLinesNumber: t.grid.verticalLinesNumber || ((l = (e = t.labels) == null ? void 0 : e.xLabels) == null ? void 0 : l.length) || r.value.maxAmount,
|
|
216
|
+
horizontalLines: t.grid.horizontalLines,
|
|
217
|
+
horizontalLinesNumber: t.grid.horizontalLinesNumber || ((i = t.labels) == null ? void 0 : i.yLabels) || 4,
|
|
218
|
+
boundary: n.value
|
|
219
|
+
}, null), t.labels && m(E, S({
|
|
220
|
+
ref: M,
|
|
166
221
|
class: "labels"
|
|
167
|
-
},
|
|
168
|
-
boundary:
|
|
169
|
-
minValue:
|
|
170
|
-
maxValue:
|
|
171
|
-
}), null),
|
|
222
|
+
}, t.labels, {
|
|
223
|
+
boundary: n.value,
|
|
224
|
+
minValue: r.value.minValue,
|
|
225
|
+
maxValue: r.value.maxValue
|
|
226
|
+
}), null), m($, {
|
|
172
227
|
class: "curve",
|
|
173
|
-
data:
|
|
174
|
-
boundary:
|
|
175
|
-
minValue:
|
|
176
|
-
maxValue:
|
|
177
|
-
maxAmount:
|
|
178
|
-
activeLineParams:
|
|
179
|
-
|
|
180
|
-
|
|
228
|
+
data: h.value,
|
|
229
|
+
boundary: n.value,
|
|
230
|
+
minValue: r.value.minValue,
|
|
231
|
+
maxValue: r.value.maxValue,
|
|
232
|
+
maxAmount: r.value.maxAmount,
|
|
233
|
+
activeLineParams: a.activeIndex === null ? null : {
|
|
234
|
+
index: a.activeIndex
|
|
235
|
+
},
|
|
236
|
+
clipPath: `url(#${A})`,
|
|
237
|
+
smooth: t.smooth,
|
|
238
|
+
stroke: t.stroke,
|
|
239
|
+
fill: t.fill,
|
|
240
|
+
showPoints: t.showPoints,
|
|
241
|
+
tooltip: t.tooltip,
|
|
242
|
+
tooltipFormatter: t.tooltipFormatter,
|
|
243
|
+
theme: g.value
|
|
244
|
+
}, null), !G.value && ae("text", {
|
|
181
245
|
class: "x-trend-chart-empty",
|
|
182
|
-
x:
|
|
183
|
-
y:
|
|
246
|
+
x: R.value.x,
|
|
247
|
+
y: R.value.y,
|
|
184
248
|
"text-anchor": "middle",
|
|
185
249
|
"dominant-baseline": "middle",
|
|
186
250
|
style: {
|
|
@@ -188,25 +252,27 @@ const ie = /* @__PURE__ */ G({
|
|
|
188
252
|
fontSize: "12px",
|
|
189
253
|
pointerEvents: "none"
|
|
190
254
|
}
|
|
191
|
-
},
|
|
255
|
+
}, B("common.noData")), t.interactive && m(ne, null, [m("line", {
|
|
192
256
|
class: "x-trend-chart-active-line",
|
|
193
|
-
x1:
|
|
194
|
-
x2:
|
|
195
|
-
y1:
|
|
196
|
-
y2:
|
|
197
|
-
visibility:
|
|
257
|
+
x1: y.value ?? n.value.minX,
|
|
258
|
+
x2: y.value ?? n.value.minX,
|
|
259
|
+
y1: H.value,
|
|
260
|
+
y2: n.value.maxY,
|
|
261
|
+
visibility: y.value !== null ? "visible" : "hidden",
|
|
198
262
|
style: {
|
|
199
|
-
stroke: (
|
|
200
|
-
strokeWidth: (
|
|
201
|
-
strokeOpacity: (
|
|
263
|
+
stroke: (s = (o = g.value) == null ? void 0 : o.axisLine) == null ? void 0 : s.color,
|
|
264
|
+
strokeWidth: (T = (Y = g.value) == null ? void 0 : Y.axisLine) == null ? void 0 : T.width,
|
|
265
|
+
strokeOpacity: (k = (z = g.value) == null ? void 0 : z.axisLine) == null ? void 0 : k.opacity
|
|
202
266
|
}
|
|
203
|
-
}, null),
|
|
204
|
-
|
|
205
|
-
|
|
267
|
+
}, null), m("rect", S({
|
|
268
|
+
class: "x-trend-chart-overlay"
|
|
269
|
+
}, U.value, {
|
|
270
|
+
onMousemove: J,
|
|
271
|
+
onMouseout: K
|
|
206
272
|
}), null)])]);
|
|
207
273
|
};
|
|
208
274
|
}
|
|
209
275
|
});
|
|
210
276
|
export {
|
|
211
|
-
|
|
277
|
+
we as default
|
|
212
278
|
};
|
|
@@ -1,79 +1,144 @@
|
|
|
1
|
-
import { defineComponent as T, computed as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { getComponentPrefix as
|
|
1
|
+
import { defineComponent as T, useId as W, computed as i, createVNode as o } from "vue";
|
|
2
|
+
import G from "../helpers/genPoints.js";
|
|
3
|
+
import H from "../helpers/genPath.js";
|
|
4
|
+
import { getComponentPrefix as O } from "../../../_utils/config.js";
|
|
5
5
|
import { trendChartCurveProps as S } from "../props.js";
|
|
6
|
-
const
|
|
7
|
-
name:
|
|
6
|
+
const _ = /* @__PURE__ */ T({
|
|
7
|
+
name: O("TrendChartCurve"),
|
|
8
8
|
props: S,
|
|
9
9
|
setup(e) {
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
return e.fill && ((
|
|
13
|
-
}),
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const x = `x-trend-chart-fill-${W()}`, h = i(() => G(e.data, e.boundary, e.maxValue, e.minValue, e.maxAmount)), v = i(() => H([...h.value], e.smooth, e.boundary)), k = i(() => {
|
|
11
|
+
var t;
|
|
12
|
+
return e.fill && ((t = v.value) == null ? void 0 : t.fillPath) && h.value.length > 1 && e.maxValue !== e.minValue;
|
|
13
|
+
}), y = i(() => {
|
|
14
|
+
var t, l;
|
|
15
|
+
return ((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.color) || "var(--x-color-text-secondary)";
|
|
16
|
+
}), b = i(() => {
|
|
17
|
+
var t, l;
|
|
18
|
+
return ((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.opacity) ?? 0.1;
|
|
19
|
+
}), g = i(() => {
|
|
20
|
+
var t, l;
|
|
21
|
+
return (((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.type) ?? "gradient") === "gradient";
|
|
22
|
+
}), u = i(() => {
|
|
23
|
+
var t;
|
|
24
|
+
return ((t = e.activeLineParams) == null ? void 0 : t.index) ?? -1;
|
|
25
|
+
}), C = 18, w = i(() => {
|
|
26
|
+
if (e.showPoints === !1) return !1;
|
|
27
|
+
if (e.showPoints === !0) return !0;
|
|
28
|
+
const t = h.value.length;
|
|
29
|
+
return t <= 2 ? !0 : (e.boundary.maxX - e.boundary.minX) / (t - 1) >= C;
|
|
30
|
+
}), V = (t) => {
|
|
31
|
+
var a, n;
|
|
32
|
+
const l = ((n = (a = e.theme) == null ? void 0 : a.point) == null ? void 0 : n.width) ?? 3;
|
|
33
|
+
return t ? l + 1 : l;
|
|
34
|
+
}, I = (t) => {
|
|
35
|
+
var a, n, c, r, m, f;
|
|
36
|
+
const l = ((n = (a = e.theme) == null ? void 0 : a.point) == null ? void 0 : n.color) ?? ((r = (c = e.theme) == null ? void 0 : c.stroke) == null ? void 0 : r.color);
|
|
37
|
+
return t ? {
|
|
38
|
+
fill: l,
|
|
39
|
+
stroke: l,
|
|
40
|
+
strokeWidth: 1
|
|
41
|
+
} : {
|
|
42
|
+
fill: l,
|
|
43
|
+
opacity: (f = (m = e.theme) == null ? void 0 : m.point) == null ? void 0 : f.opacity
|
|
44
|
+
};
|
|
45
|
+
}, N = i(() => {
|
|
46
|
+
var a, n, c, r, m, f, P;
|
|
47
|
+
const t = [];
|
|
48
|
+
k.value && t.push(o("path", {
|
|
17
49
|
class: "x-trend-chart-fill",
|
|
18
|
-
d:
|
|
50
|
+
d: v.value.fillPath,
|
|
19
51
|
fill: "none",
|
|
20
52
|
style: {
|
|
21
|
-
fill:
|
|
22
|
-
opacity:
|
|
53
|
+
fill: g.value ? `url(#${x})` : y.value,
|
|
54
|
+
opacity: g.value ? 1 : b.value
|
|
23
55
|
}
|
|
24
|
-
}, null)), e.stroke && ((
|
|
56
|
+
}, null)), e.stroke && ((a = v.value) != null && a.linePath) && t.push(o("path", {
|
|
25
57
|
class: "x-trend-chart-stroke",
|
|
26
|
-
d:
|
|
58
|
+
d: v.value.linePath,
|
|
27
59
|
fill: "none",
|
|
28
60
|
stroke: "none",
|
|
61
|
+
"stroke-linecap": "round",
|
|
62
|
+
"stroke-linejoin": "round",
|
|
29
63
|
style: {
|
|
30
|
-
stroke: (
|
|
31
|
-
strokeWidth: (
|
|
32
|
-
opacity: (
|
|
64
|
+
stroke: (c = (n = e.theme) == null ? void 0 : n.stroke) == null ? void 0 : c.color,
|
|
65
|
+
strokeWidth: (m = (r = e.theme) == null ? void 0 : r.stroke) == null ? void 0 : m.width,
|
|
66
|
+
opacity: (P = (f = e.theme) == null ? void 0 : f.stroke) == null ? void 0 : P.opacity
|
|
33
67
|
}
|
|
34
68
|
}, null));
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
const l = h.value.map((s, d) => ({
|
|
70
|
+
point: s,
|
|
71
|
+
index: d
|
|
72
|
+
})).filter(({
|
|
73
|
+
index: s
|
|
74
|
+
}) => w.value || s === u.value);
|
|
75
|
+
return l.length && t.push(o("g", {
|
|
76
|
+
class: "x-trend-chart-points"
|
|
77
|
+
}, [l.map(({
|
|
78
|
+
point: s,
|
|
79
|
+
index: d
|
|
80
|
+
}) => o("circle", {
|
|
81
|
+
key: d,
|
|
82
|
+
class: {
|
|
83
|
+
point: !0,
|
|
84
|
+
"x-trend-chart-point-active": u.value === d
|
|
85
|
+
},
|
|
86
|
+
cx: s.x,
|
|
87
|
+
cy: s.y,
|
|
88
|
+
r: V(u.value === d),
|
|
89
|
+
style: I(u.value === d)
|
|
90
|
+
}, null))])), t;
|
|
91
|
+
}), R = i(() => {
|
|
92
|
+
const t = h.value[u.value];
|
|
93
|
+
if (!e.tooltip || u.value < 0 || !t)
|
|
94
|
+
return null;
|
|
95
|
+
const l = e.tooltipFormatter(e.data[u.value]), a = Math.max(24, l.length * 7 + 12), n = 18, r = t.y - n - 6 >= e.boundary.minY ? t.y - n - 6 : t.y + 6;
|
|
96
|
+
return o("g", {
|
|
97
|
+
class: "x-trend-chart-tooltip",
|
|
98
|
+
"pointer-events": "none"
|
|
99
|
+
}, [o("rect", {
|
|
100
|
+
x: t.x - a / 2,
|
|
101
|
+
y: r,
|
|
102
|
+
width: a,
|
|
103
|
+
height: n,
|
|
104
|
+
rx: 4,
|
|
105
|
+
style: {
|
|
106
|
+
fill: "var(--x-color-bg-popup)",
|
|
107
|
+
stroke: "var(--x-color-border-subtle)",
|
|
45
108
|
strokeWidth: 1
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
point: !0,
|
|
58
|
-
"x-trend-chart-point-active": ((l = e.activeLineParams) == null ? void 0 : l.index) === t
|
|
59
|
-
},
|
|
60
|
-
cx: n.x,
|
|
61
|
-
cy: n.y,
|
|
62
|
-
r: N(((o = e.activeLineParams) == null ? void 0 : o.index) === t),
|
|
63
|
-
style: R(((r = e.activeLineParams) == null ? void 0 : r.index) === t)
|
|
64
|
-
}, null);
|
|
65
|
-
});
|
|
66
|
-
a.push(c("g", {
|
|
67
|
-
class: "x-trend-chart-points"
|
|
68
|
-
}, [i]));
|
|
69
|
-
}
|
|
70
|
-
return a;
|
|
109
|
+
}
|
|
110
|
+
}, null), o("text", {
|
|
111
|
+
x: t.x,
|
|
112
|
+
y: r + n / 2,
|
|
113
|
+
"text-anchor": "middle",
|
|
114
|
+
"dominant-baseline": "middle",
|
|
115
|
+
style: {
|
|
116
|
+
fill: "var(--x-color-text-primary)",
|
|
117
|
+
fontSize: "12px"
|
|
118
|
+
}
|
|
119
|
+
}, [l])]);
|
|
71
120
|
});
|
|
72
|
-
return () =>
|
|
121
|
+
return () => o("g", {
|
|
73
122
|
class: e.className
|
|
74
|
-
}, [
|
|
123
|
+
}, [o("defs", null, [o("linearGradient", {
|
|
124
|
+
id: x,
|
|
125
|
+
x1: "0",
|
|
126
|
+
y1: "0",
|
|
127
|
+
x2: "0",
|
|
128
|
+
y2: "1"
|
|
129
|
+
}, [o("stop", {
|
|
130
|
+
offset: "0%",
|
|
131
|
+
"stop-color": y.value,
|
|
132
|
+
"stop-opacity": b.value
|
|
133
|
+
}, null), o("stop", {
|
|
134
|
+
offset: "100%",
|
|
135
|
+
"stop-color": y.value,
|
|
136
|
+
"stop-opacity": "0"
|
|
137
|
+
}, null)])]), o("g", {
|
|
138
|
+
"clip-path": e.clipPath
|
|
139
|
+
}, [N.value]), R.value]);
|
|
75
140
|
}
|
|
76
141
|
});
|
|
77
142
|
export {
|
|
78
|
-
|
|
143
|
+
_ as default
|
|
79
144
|
};
|