st-comp 0.0.207 → 0.0.209
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/es/Kline.cjs +1 -1
- package/es/Kline.js +71 -71
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +56 -56
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +96 -96
- package/es/KlinePlus.cjs +2 -2
- package/es/KlinePlus.js +163 -163
- package/es/VarietyTextCopy.cjs +3 -3
- package/es/VarietyTextCopy.js +4 -4
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +105 -105
- package/lib/{index-f27d8c7a.js → index-e158c3d6.js} +1531 -1531
- package/lib/{python-c345f0e2.js → python-57033756.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/Kline/componentsNew/KlineTips/index.vue +4 -4
- package/packages/Kline/index.vue +4 -4
- package/packages/KlineBasic/components/KlineTips/index.vue +1 -1
- package/packages/KlineNew/components/KlineTips/index.vue +8 -8
- package/packages/KlinePlus/index.vue +4 -4
- package/src/pages/KlineBasic/api.js +1 -1
package/es/KlineBasic.js
CHANGED
|
@@ -8,7 +8,7 @@ import { E as Ie } from "./el-empty-33cb66f1.js";
|
|
|
8
8
|
import { E as $e, a as Pe } from "./el-menu-item-7e881203.js";
|
|
9
9
|
import "./el-tooltip-4ed993c7.js";
|
|
10
10
|
import "./el-popper-b4f97157.js";
|
|
11
|
-
import { defineComponent as he, openBlock as
|
|
11
|
+
import { defineComponent as he, openBlock as E, createElementBlock as O, Fragment as le, renderList as me, normalizeStyle as ye, toDisplayString as ce, computed as J, createVNode as B, ref as F, onMounted as _e, onUnmounted as we, nextTick as De, createElementVNode as U, withCtx as K, createBlock as ke, createCommentVNode as X, renderSlot as Ye, watch as We, createTextVNode as re, pushScopeId as Ne, popScopeId as qe } from "vue";
|
|
12
12
|
import * as fe from "echarts";
|
|
13
13
|
import { d as u } from "./dayjs.min-8313b006.js";
|
|
14
14
|
import { y as Ce, v as ze, U as Ke, K as Ue, V as Q, x as ge, D as He } from "./index-7ed0999e.js";
|
|
@@ -36,19 +36,19 @@ import "./castArray-7741a212.js";
|
|
|
36
36
|
import "./debounce-8d53f4dd.js";
|
|
37
37
|
let Z = null;
|
|
38
38
|
const Xe = (n) => {
|
|
39
|
-
const
|
|
40
|
-
handleReq: (
|
|
41
|
-
ze() && (
|
|
39
|
+
const R = Ce(n, {
|
|
40
|
+
handleReq: (A) => {
|
|
41
|
+
ze() && (A.headers.token = Ke());
|
|
42
42
|
},
|
|
43
|
-
handleRes: (
|
|
44
|
-
const { data: D } =
|
|
43
|
+
handleRes: (A) => {
|
|
44
|
+
const { data: D } = A;
|
|
45
45
|
if (D.code === 401)
|
|
46
46
|
return location.origin.includes("localhost") ? location.href = `${location.origin}/#/404` : Ue(), !0;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
|
|
50
|
-
}, Ge = (n) => Z("/middleLayer/kline/getKlineBasic", { ...n, userId: Q("id") }), Je = (n) => Z("/middleLayer/kline/getKline", n), Qe = async (n) => Z("/alarm/deliversign/addAlarmPrice", { ...n, userId: Q("id") }), et = async (n) => Z("/alarm/deliversign/findAlarmPriceByUserId", { ...n, userId: Q("id") }), Me = async (n) => Z("/alarm/deliversign/updateAlarmPrice", { ...n, userId: Q("id") }), tt = async (n) => Z("/alarm/deliversign/deleteAlarmPrice", { ...n, userId: Q("id") }), { round: G } = ge, nt = (n,
|
|
51
|
-
const { data: e, time: h } = n, { gridTop: b, gridRight: s, gridLeft: x, maxShowCounts: Y, showSubChart: r } =
|
|
49
|
+
R.get, Z = R.post;
|
|
50
|
+
}, Ge = (n) => Z("/middleLayer/kline/getKlineBasic", { ...n, userId: Q("id") }), Je = (n) => Z("/middleLayer/kline/getKline", n), Qe = async (n) => Z("/alarm/deliversign/addAlarmPrice", { ...n, userId: Q("id") }), et = async (n) => Z("/alarm/deliversign/findAlarmPriceByUserId", { ...n, userId: Q("id") }), Me = async (n) => Z("/alarm/deliversign/updateAlarmPrice", { ...n, userId: Q("id") }), tt = async (n) => Z("/alarm/deliversign/deleteAlarmPrice", { ...n, userId: Q("id") }), { round: G } = ge, nt = (n, R, A, D, g) => {
|
|
51
|
+
const { data: e, time: h } = n, { gridTop: b, gridRight: s, gridLeft: x, maxShowCounts: Y, showSubChart: r } = R;
|
|
52
52
|
return {
|
|
53
53
|
animation: !1,
|
|
54
54
|
grid: {
|
|
@@ -60,7 +60,7 @@ const Xe = (n) => {
|
|
|
60
60
|
dataZoom: [
|
|
61
61
|
{
|
|
62
62
|
type: "inside",
|
|
63
|
-
startValue:
|
|
63
|
+
startValue: A,
|
|
64
64
|
endValue: D,
|
|
65
65
|
maxValueSpan: Y
|
|
66
66
|
}
|
|
@@ -149,9 +149,9 @@ const Xe = (n) => {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
}, ot = (n,
|
|
153
|
-
const { variety: e, featureId: h, featureType: b } =
|
|
154
|
-
return
|
|
152
|
+
}, ot = (n, R, A, D, g) => {
|
|
153
|
+
const { variety: e, featureId: h, featureType: b } = A, { gridTop: s, gridLeft: x, gridRight: Y } = D;
|
|
154
|
+
return R.reduce((r, a) => {
|
|
155
155
|
const { warnPrice: _ } = a, p = n == null ? void 0 : n.convertToPixel({ yAxisIndex: 0 }, _);
|
|
156
156
|
if (p <= s || p >= (n == null ? void 0 : n.getHeight()))
|
|
157
157
|
return r;
|
|
@@ -214,9 +214,9 @@ const Xe = (n) => {
|
|
|
214
214
|
ondragend: async (k) => {
|
|
215
215
|
const M = k.offsetY - T;
|
|
216
216
|
if (M !== 0) {
|
|
217
|
-
const
|
|
217
|
+
const V = n == null ? void 0 : n.convertFromPixel({ yAxisIndex: 0 }, M + p), d = {
|
|
218
218
|
id: a.id,
|
|
219
|
-
warnPrice: G(
|
|
219
|
+
warnPrice: G(V, 3),
|
|
220
220
|
featureId: h,
|
|
221
221
|
//品种id
|
|
222
222
|
featureCode: e,
|
|
@@ -240,8 +240,8 @@ const Xe = (n) => {
|
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
242
|
setup(n) {
|
|
243
|
-
return (
|
|
244
|
-
(
|
|
243
|
+
return (R, A) => (E(), O("div", at, [
|
|
244
|
+
(E(!0), O(le, null, me(n.data, (D, g) => (E(), O("div", {
|
|
245
245
|
key: g,
|
|
246
246
|
class: "kline-tips-item",
|
|
247
247
|
style: ye({ color: D.color })
|
|
@@ -264,7 +264,7 @@ const it = { class: "kline-tips" }, lt = {
|
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
266
|
setup(n) {
|
|
267
|
-
const { round:
|
|
267
|
+
const { round: R, formatValue: A } = ge, D = n, g = J(() => {
|
|
268
268
|
const { data: h, activeIndex: b } = D;
|
|
269
269
|
if (h.data && h.data[b]) {
|
|
270
270
|
const s = h.data[b], x = [
|
|
@@ -273,22 +273,22 @@ const it = { class: "kline-tips" }, lt = {
|
|
|
273
273
|
{ label: "低", value: s[2] },
|
|
274
274
|
{ label: "收", value: s[1] }
|
|
275
275
|
];
|
|
276
|
-
s[4] !== null && x.push({ label: "额", value:
|
|
276
|
+
s[4] !== null && x.push({ label: "额", value: A(s[4]) });
|
|
277
277
|
let Y;
|
|
278
|
-
return s[6] > 0 ? Y = "red" : s[6] < 0 && (Y = "green"), x.push({ label: "涨跌", value: `${s[6]}%`, color: Y }), x;
|
|
278
|
+
return s[6] > 0 ? Y = "red" : s[6] < 0 && (Y = "green"), x.push({ label: "涨跌", value: `${R(s[6])}%`, color: Y }), x;
|
|
279
279
|
}
|
|
280
280
|
return [];
|
|
281
281
|
}), e = J(() => {
|
|
282
282
|
var s;
|
|
283
283
|
const { data: h, activeIndex: b } = D;
|
|
284
|
-
return ((s = h == null ? void 0 : h.mainIndicator) == null ? void 0 : s.map((x) => ({ label: x.key, value:
|
|
284
|
+
return ((s = h == null ? void 0 : h.mainIndicator) == null ? void 0 : s.map((x) => ({ label: x.key, value: R(x.data[b]), color: x.color }))) || [];
|
|
285
285
|
});
|
|
286
|
-
return (h, b) => (
|
|
286
|
+
return (h, b) => (E(), O("div", it, [
|
|
287
287
|
B(pe, { data: g.value }, null, 8, ["data"]),
|
|
288
288
|
B(pe, { data: e.value }, null, 8, ["data"])
|
|
289
289
|
]));
|
|
290
290
|
}
|
|
291
|
-
}, st = /* @__PURE__ */ ee(lt, [["__scopeId", "data-v-
|
|
291
|
+
}, st = /* @__PURE__ */ ee(lt, [["__scopeId", "data-v-ffa125ec"]]);
|
|
292
292
|
const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
293
293
|
key: 0,
|
|
294
294
|
class: "klineSub-tips-select"
|
|
@@ -308,10 +308,10 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
308
308
|
// 副图指标列表
|
|
309
309
|
},
|
|
310
310
|
emits: ["update:modelValue"],
|
|
311
|
-
setup(n, { expose:
|
|
311
|
+
setup(n, { expose: R, emit: A }) {
|
|
312
312
|
const { round: D } = ge;
|
|
313
313
|
let g, e;
|
|
314
|
-
const h =
|
|
314
|
+
const h = A, b = n, s = F(), x = J({
|
|
315
315
|
get() {
|
|
316
316
|
return b.modelValue;
|
|
317
317
|
},
|
|
@@ -350,14 +350,14 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
350
350
|
color: "#00FFFF"
|
|
351
351
|
};
|
|
352
352
|
};
|
|
353
|
-
return
|
|
353
|
+
return R({
|
|
354
354
|
connect: (a) => {
|
|
355
355
|
fe.connect([a, g]);
|
|
356
356
|
},
|
|
357
357
|
// 联动
|
|
358
358
|
draw: (a, _) => {
|
|
359
359
|
De(() => {
|
|
360
|
-
const { startValue: p, endValue: T, maxValueSpan: k } = a, { leftYAxisRange: P, rightYAxisRange: M } = b.data.subIndicator[0],
|
|
360
|
+
const { startValue: p, endValue: T, maxValueSpan: k } = a, { leftYAxisRange: P, rightYAxisRange: M } = b.data.subIndicator[0], V = b.data.subIndicator.map((d) => {
|
|
361
361
|
if (d.series === "bar")
|
|
362
362
|
return {
|
|
363
363
|
name: "subMain",
|
|
@@ -483,7 +483,7 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
],
|
|
486
|
-
series:
|
|
486
|
+
series: V
|
|
487
487
|
},
|
|
488
488
|
!0
|
|
489
489
|
);
|
|
@@ -492,9 +492,9 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
492
492
|
// 重置
|
|
493
493
|
}), (a, _) => {
|
|
494
494
|
const p = je, T = Ze;
|
|
495
|
-
return
|
|
495
|
+
return E(), O("div", ut, [
|
|
496
496
|
U("div", dt, [
|
|
497
|
-
Y.value.length ? (
|
|
497
|
+
Y.value.length ? (E(), O("div", ct, [
|
|
498
498
|
B(T, {
|
|
499
499
|
modelValue: x.value,
|
|
500
500
|
"onUpdate:modelValue": _[0] || (_[0] = (k) => x.value = k),
|
|
@@ -503,7 +503,7 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
503
503
|
class: "element-dark subIndicator"
|
|
504
504
|
}, {
|
|
505
505
|
default: K(() => [
|
|
506
|
-
(
|
|
506
|
+
(E(!0), O(le, null, me(n.subIndicatorList, (k) => (E(), ke(p, {
|
|
507
507
|
key: k.value,
|
|
508
508
|
label: k.label,
|
|
509
509
|
value: k.value
|
|
@@ -525,13 +525,13 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
525
525
|
}, pt = /* @__PURE__ */ ee(ft, [["__scopeId", "data-v-ab519de5"]]), mt = /* @__PURE__ */ he({
|
|
526
526
|
__name: "index",
|
|
527
527
|
emits: ["closeContextMenuCallBack"],
|
|
528
|
-
setup(n, { emit:
|
|
529
|
-
const
|
|
528
|
+
setup(n, { emit: R }) {
|
|
529
|
+
const A = R, D = F(), g = F(), e = F({
|
|
530
530
|
display: "none",
|
|
531
531
|
top: "0px",
|
|
532
532
|
left: "0px"
|
|
533
533
|
}), h = () => {
|
|
534
|
-
e.value.display = "none",
|
|
534
|
+
e.value.display = "none", A("closeContextMenuCallBack"), document.removeEventListener("click", h);
|
|
535
535
|
}, b = (s) => {
|
|
536
536
|
if (s.preventDefault(), e.value.display === "block") {
|
|
537
537
|
const { offsetX: x, offsetY: Y } = s, { offsetWidth: r, offsetHeight: a } = g.value;
|
|
@@ -547,7 +547,7 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
547
547
|
Y.left + Y.width >= x.right && (e.value.left = `${s.offsetX - Y.width}px`), Y.top + Y.height >= x.bottom && (console.log("高度超出"), e.value.top = `${s.offsetY - Y.height}px`);
|
|
548
548
|
}), document.addEventListener("click", h);
|
|
549
549
|
};
|
|
550
|
-
return (s, x) => (
|
|
550
|
+
return (s, x) => (E(), O("div", {
|
|
551
551
|
ref_key: "contextmenuRef",
|
|
552
552
|
ref: D,
|
|
553
553
|
class: "contextmenu",
|
|
@@ -555,7 +555,7 @@ const ut = { class: "klineSub" }, dt = { class: "klineSub-tips" }, ct = {
|
|
|
555
555
|
onMouseleave: h
|
|
556
556
|
}, [
|
|
557
557
|
Ye(s.$slots, "default", {}, void 0, !0),
|
|
558
|
-
e.value.display !== "none" ? (
|
|
558
|
+
e.value.display !== "none" ? (E(), O("div", {
|
|
559
559
|
key: 0,
|
|
560
560
|
ref_key: "contextmenuContentRef",
|
|
561
561
|
ref: g,
|
|
@@ -645,10 +645,10 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
645
645
|
// 时段框选
|
|
646
646
|
},
|
|
647
647
|
emits: ["change", "getFactorData"],
|
|
648
|
-
setup(n, { expose:
|
|
648
|
+
setup(n, { expose: R, emit: A }) {
|
|
649
649
|
const D = [{ label: "画线预警", key: "drawWarningLine" }];
|
|
650
650
|
let g = null, e = null, h, b, s = !1, x = !1;
|
|
651
|
-
const Y =
|
|
651
|
+
const Y = A, r = n, a = F(!1), _ = F(!1), p = F(!1), T = F(null), k = F(null), P = F("VOL"), M = F(0), V = F({}), d = F([]), N = F({}), C = F(!1), te = F(""), se = F([...D]), H = J(() => ({
|
|
652
652
|
defaultShowCounts: 500,
|
|
653
653
|
// 默认展示条数
|
|
654
654
|
addCounts: 2e3,
|
|
@@ -786,12 +786,12 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
786
786
|
_.value = !0, p.value = !1;
|
|
787
787
|
return;
|
|
788
788
|
}
|
|
789
|
-
|
|
789
|
+
V.value = (c = W == null ? void 0 : W.body) == null ? void 0 : c.kline, d.value = ((f = W == null ? void 0 : W.body) == null ? void 0 : f.warningLine) || [], be(), ne(), ae && Y("getFactorData", (o = W == null ? void 0 : W.body) == null ? void 0 : o.factor);
|
|
790
790
|
} catch (l) {
|
|
791
791
|
throw p.value = !0, _.value = !1, new Error(l);
|
|
792
792
|
}
|
|
793
793
|
}, Fe = async (i) => {
|
|
794
|
-
const { variety: t, cycle: m, indicatorStore: c, mainIndicator: f, right: o } = r, { addCounts: l } = H.value, { time: w } =
|
|
794
|
+
const { variety: t, cycle: m, indicatorStore: c, mainIndicator: f, right: o } = r, { addCounts: l } = H.value, { time: w } = V.value;
|
|
795
795
|
if (i === "history") {
|
|
796
796
|
const S = await Je({
|
|
797
797
|
variety: t,
|
|
@@ -802,17 +802,17 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
802
802
|
subIndicator: P.value,
|
|
803
803
|
right: o
|
|
804
804
|
});
|
|
805
|
-
|
|
806
|
-
time: [...S.body.time, ...
|
|
807
|
-
data: [...S.body.data, ...
|
|
808
|
-
mainIndicator:
|
|
805
|
+
V.value = {
|
|
806
|
+
time: [...S.body.time, ...V.value.time.slice(1)],
|
|
807
|
+
data: [...S.body.data, ...V.value.data.slice(1)],
|
|
808
|
+
mainIndicator: V.value.mainIndicator.map((v, q) => {
|
|
809
809
|
var z;
|
|
810
810
|
return {
|
|
811
811
|
...v,
|
|
812
812
|
data: [...((z = S.body.mainIndicator[q]) == null ? void 0 : z.data) ?? [], ...v.data.slice(1)]
|
|
813
813
|
};
|
|
814
814
|
}),
|
|
815
|
-
subIndicator:
|
|
815
|
+
subIndicator: V.value.subIndicator.map((v, q) => {
|
|
816
816
|
var z;
|
|
817
817
|
return {
|
|
818
818
|
...v,
|
|
@@ -824,13 +824,13 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
824
824
|
}, be = (i = !1) => {
|
|
825
825
|
var q, z, j;
|
|
826
826
|
Le();
|
|
827
|
-
const { time: t } =
|
|
827
|
+
const { time: t } = V.value, { gridRight: m, gridLeft: c, defaultShowCounts: f, maxShowCounts: o, showSubChart: l } = H.value;
|
|
828
828
|
let w = t.length - 1 - f, S = t.length - 1;
|
|
829
829
|
if (i) {
|
|
830
830
|
const L = e.getOption(), I = (z = (q = L == null ? void 0 : L.xAxis) == null ? void 0 : q[0]) == null ? void 0 : z.data, y = (j = L == null ? void 0 : L.dataZoom) == null ? void 0 : j[0], de = I[y == null ? void 0 : y.startValue], ae = I[y == null ? void 0 : y.endValue];
|
|
831
831
|
w = t.findIndex(($) => $ === de), S = t.findIndex(($) => $ === ae);
|
|
832
832
|
}
|
|
833
|
-
const v = nt(
|
|
833
|
+
const v = nt(V.value, H.value, w, S, r.cycle);
|
|
834
834
|
if (e.setOption(v, !0), M.value = S, r.brushRange) {
|
|
835
835
|
let L = null, I = null;
|
|
836
836
|
switch (r.cycle) {
|
|
@@ -877,7 +877,7 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
877
877
|
!0
|
|
878
878
|
), xe());
|
|
879
879
|
}, xe = () => {
|
|
880
|
-
const { time: i } =
|
|
880
|
+
const { time: i } = V.value;
|
|
881
881
|
if (r.brushRange && (i != null && i.length)) {
|
|
882
882
|
let t = u(r.brushRange[0]).format("YYYY-MM-DD 00:00:00"), m = u(r.brushRange[1]).format("YYYY-MM-DD 23:59:59"), c = null, f = null;
|
|
883
883
|
switch (r.cycle) {
|
|
@@ -1003,14 +1003,14 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
1003
1003
|
}, Ve = () => {
|
|
1004
1004
|
se.value = [...D];
|
|
1005
1005
|
};
|
|
1006
|
-
return
|
|
1006
|
+
return R({
|
|
1007
1007
|
draw: (i, t) => {
|
|
1008
1008
|
i === "warningLine" && (d.value = t, ne());
|
|
1009
1009
|
}
|
|
1010
1010
|
}), (i, t) => {
|
|
1011
1011
|
var S;
|
|
1012
1012
|
const m = $e, c = Pe, f = Ie, o = Oe, l = Be, w = Ee;
|
|
1013
|
-
return
|
|
1013
|
+
return E(), O(le, null, [
|
|
1014
1014
|
U("div", {
|
|
1015
1015
|
class: "klineBasic",
|
|
1016
1016
|
onMousemove: t[1] || (t[1] = (v) => a.value = !0),
|
|
@@ -1018,7 +1018,7 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
1018
1018
|
}, [
|
|
1019
1019
|
U("div", gt, [
|
|
1020
1020
|
B(st, {
|
|
1021
|
-
data:
|
|
1021
|
+
data: V.value,
|
|
1022
1022
|
activeIndex: M.value
|
|
1023
1023
|
}, null, 8, ["data", "activeIndex"])
|
|
1024
1024
|
]),
|
|
@@ -1035,7 +1035,7 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
1035
1035
|
borderRight: 0
|
|
1036
1036
|
} }, {
|
|
1037
1037
|
default: K(() => [
|
|
1038
|
-
(
|
|
1038
|
+
(E(!0), O(le, null, me(se.value, (v) => (E(), ke(m, {
|
|
1039
1039
|
style: { height: "36px" },
|
|
1040
1040
|
key: v.key,
|
|
1041
1041
|
index: v.key,
|
|
@@ -1060,25 +1060,25 @@ const Se = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), gt = { class: "klin
|
|
|
1060
1060
|
_: 1
|
|
1061
1061
|
})
|
|
1062
1062
|
], 4),
|
|
1063
|
-
H.value.showSubChart ? (
|
|
1063
|
+
H.value.showSubChart ? (E(), O("div", vt, [
|
|
1064
1064
|
B(pt, {
|
|
1065
1065
|
ref_key: "klineSubRef",
|
|
1066
1066
|
ref: k,
|
|
1067
1067
|
modelValue: P.value,
|
|
1068
1068
|
"onUpdate:modelValue": t[0] || (t[0] = (v) => P.value = v),
|
|
1069
|
-
data:
|
|
1069
|
+
data: V.value,
|
|
1070
1070
|
cycle: n.cycle,
|
|
1071
1071
|
activeIndex: M.value,
|
|
1072
1072
|
subIndicatorList: (S = n.indicatorStore) == null ? void 0 : S.subIndicatorList
|
|
1073
1073
|
}, null, 8, ["modelValue", "data", "cycle", "activeIndex", "subIndicatorList"])
|
|
1074
1074
|
])) : X("", !0),
|
|
1075
|
-
_.value ? (
|
|
1075
|
+
_.value ? (E(), O("div", bt, [
|
|
1076
1076
|
B(f, {
|
|
1077
1077
|
class: "klineBasic-empty-content",
|
|
1078
1078
|
description: "暂无数据"
|
|
1079
1079
|
})
|
|
1080
1080
|
])) : X("", !0),
|
|
1081
|
-
p.value ? (
|
|
1081
|
+
p.value ? (E(), O("div", xt, [
|
|
1082
1082
|
Yt,
|
|
1083
1083
|
U("div", ht, [
|
|
1084
1084
|
B(o, { onClick: ue }, {
|
package/es/KlineNew.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),C=require("./index.esm-94a95a2a.cjs"),L=require("./_plugin-vue_export-helper-f246444f.cjs"),z=require("./index-8901a38c.cjs");require("./base-ef747d02.cjs");require("./el-tag-a33c4b22.cjs");const R=require("./el-select-d8d91db1.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./el-popper-b6c99b28.cjs");const $=require("echarts");require("./index-c108567d.cjs");require("./index-9780a537.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-098c2447.cjs");require("./index-bb833443.cjs");require("./index-298075cf.cjs");require("./index-f3562b52.cjs");require("./castArray-35947698.cjs");require("./index-11547a0c.cjs");require("./scroll-b108dabd.cjs");require("./debounce-62f5b6e8.cjs");require("./vnode-b906ae6d.cjs");function N(D){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const S in D)if(S!=="default"){const g=Object.getOwnPropertyDescriptor(D,S);Object.defineProperty(x,S,g.get?g:{enumerable:!0,get:()=>D[S]})}}return x.default=D,Object.freeze(x)}const E=N($),M=t.defineComponent({__name:"index",setup(D,{expose:x}){let S=!1,g=!0,y=[];const w=(h,u)=>h.length>u?h.slice(h.length-u):h;return x({initTalib:async()=>{if(!S)S=!0,await C.init("./talib.wasm"),g=!1,y.forEach(h=>{h()});else if(g)return new Promise(h=>{y.push(h)})},handleKeyDown:(h,u)=>{let{startValue:o,endValue:d,maxIndex:f}=u;if(h.code==="ArrowLeft"){if(o===0)return;o=o-1,d=d-1}else if(h.code==="ArrowRight"){if(d===f)return;o=o+1,d=d+1}else if(h.code==="ArrowUp"){if(d-o<5)return;const p=Math.floor((d-o)/2)+1;o=o+p,d-o<5&&(o=d-4)}else if(h.code==="ArrowDown"){const p=Math.min(500,d-o);o=o-p-1}return{startValue:o,endValue:d}},getDataZoomInfoByTime:h=>{const{showStartTime:u,showEndTime:o,xAxisData:d,maxShowDays:f}=h;let p=-1,e=-1,i={};return d.forEach((a,n)=>{const l=a.split(" ")[0];i[l]=i[l]||0,i[l]+=1,new Date(a)>=new Date(u)&&p===-1&&(p=n),new Date(a)<=new Date(o)&&(e=n)}),{startValue:p,endValue:e,maxValueSpan:Math.max(...Object.values(i))*f}},formatDataBySlide:h=>{const{originDrawData:u,addData:o,startTime:d,endTime:f}=h,{mainIndicator:p,mainIndicatorList:e,subIndicator:i,subIndicatorList:a,config:n,timeRange:l}=h,{loadAddCount:b,preLoadCount:q}=n;let m=[],v=[],F=[],k=[];d&&f?(m=o.filter(s=>new Date(s[0])>=new Date(d)&&new Date(s[0])<=new Date(f)),k=[...o]):f?(m=[...o.filter((s,r)=>r>=o.length-b&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1])),...u.originData],k=[...o,...u.originData]):d&&(m=[...u.originData,...o.filter((s,r)=>r>=q&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1]))],k=m),m.forEach((s,r)=>{v.push([s[1],s[4],s[3],s[2],r===0?0:m[r-1][4],s[6]]),F.push(s[0])});let c=[],_=[];const I={time:[],open:[],close:[],high:[],low:[],originData:k};let B=null,T=null;return k.forEach((s,r)=>{I.time.push(s[0]),I.open.push(s[1]),I.close.push(s[4]),I.high.push(s[2]),I.low.push(s[3]),s[0]===m[0][0]&&(B=r),s[0]===m[m.length-1][0]&&(T=r+1)}),c=e.find(({value:s})=>s===p).config.map(s=>{const{calculationFn:r}=s,A={time:[],open:[],close:[],high:[],low:[],originData:[]};return{...s,data:r?r(C.talib,I,A).slice(B,T):[]}}),_=a.find(({value:s})=>s===i).config.reduce((s,r)=>{const{source:A,calculationFn:V}=r;return A==="calculation"?[...s,{...r,data:V?V(C.talib,I).slice(B,T):[]}]:s},[]),{originData:m,candlestickData:v,mainIndicatorData:c,subIndicatorData:_,xAxisData:F,startTime:m[0][0],endTime:m[m.length-1][0],length:m.length}},formatDataByCount:h=>{const{originDrawData:u,addData:o,mainIndicator:d,mainIndicatorList:f,subIndicator:p,subIndicatorList:e,config:i}=h;let a={};const{addCount:n,preLoadCount:l}=i,b=[],q=[],m=[],v=[],F=[];let k=[],c=[];const _=o.filter((r,A)=>(b.push(r[0]),q.push(r[1]),m.push(r[4]),v.push(r[2]),F.push(r[3]),k.push(r[0]),c.push([r[1],r[4],r[3],r[2],A===0?0:o[A-1][4],r[6]]),o.length>=n+l-1?A>=l:!0));k=w(k,_.length),c=w(c,_.length);const I={time:b,open:q,close:m,high:v,low:F,originData:o},T=f.find(r=>r.value===d).config.map(r=>({...r,data:w(r.calculationFn?r.calculationFn(C.talib,I,{time:[],open:[],close:[],high:[],low:[],originData:[]}):[],k.length)}));let s=[];return p&&e&&(s=e.find(A=>A.value===p).config.reduce((A,V)=>V.source==="calculation"?[...A,{...V,data:w(V.calculationFn?V.calculationFn(C.talib,I):[],k.length)}]:A,[])),u.length?a={originData:[..._,...u.originData],xAxisData:[...k,...u.xAxisData],candlestickData:[...c,...u.candlestickData],mainIndicatorData:u.mainIndicatorData.map((r,A)=>({...r,data:[...T[A].data,...r.data]})),subIndicatorData:u.subIndicatorData.map((r,A)=>({...r,data:[...s[A].data,...r.data]}))}:a={originData:_,xAxisData:k,candlestickData:c,mainIndicatorData:T,subIndicatorData:s},a.length=a.xAxisData.length,a.startTime=a.xAxisData[0],a.endTime=a.xAxisData[a.length-1],a},fn:()=>{}}),(h,u)=>null}}),j={class:"kline-tips"},P=t.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(D){return(x,S)=>(t.openBlock(),t.createElementBlock("div",j,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.data,(g,y)=>(t.openBlock(),t.createElementBlock("div",{key:y,class:"kline-tips-item",style:t.normalizeStyle({color:g.color})},t.toDisplayString(g.label)+" "+t.toDisplayString(g.value),5))),128))]))}});const O=L._export_sfc(P,[["__scopeId","data-v-2a02e841"]]),K={class:"kline-tips"},U=t.defineComponent({__name:"index",props:{drawData:{type:Object,require:!0},candlestickData:{type:Array,default:()=>null},mainIndicatorData:{type:Array,default:()=>null},activeIndex:{type:Number,require:!0}},setup(D){const{round:x,multiply:S,divide:g,subtract:y,formatValue:w}=z.x,h=D,u=t.computed(()=>{const{drawData:d,activeIndex:f,candlestickData:p}=h;if(p!=null&&p.length&&p[f]){let e;return p[f][6]>0?e="red":p[f][6]<0&&(e="green"),[{label:"开",value:x(p[f][0])},{label:"高",value:x(p[f][3])},{label:"低",value:x(p[f][2])},{label:"收",value:x(p[f][1])},{label:"额",value:w(p[f][4])},{label:"涨跌",value:`${x(p[f][6])}%`,color:e}]}else if(d.candlestickData&&d.candlestickData[f]){const e=d.candlestickData[f],i=[{label:"开",value:x(e[0])},{label:"高",value:x(e[3])},{label:"低",value:x(e[2])},{label:"收",value:x(e[1])}];e[5]!==void 0&&i.push({label:"额",value:w(e[5])});const a=x(S(g(y(e[1],e[4]),Math.abs(e[4])),100));let n;return a>0?n="red":a<0&&(n="green"),i.push({label:"涨跌",value:`${a}%`,color:n}),i}return[]}),o=t.computed(()=>{var p;const{drawData:d,activeIndex:f}=h;return((p=d==null?void 0:d.mainIndicatorData)==null?void 0:p.map(e=>({label:e.key,value:x(e.data[f]),color:e.color})))||[]});return(d,f)=>(t.openBlock(),t.createElementBlock("div",K,[t.createVNode(O,{data:u.value},null,8,["data"]),t.createVNode(O,{data:o.value},null,8,["data"])]))}});const Z=L._export_sfc(U,[["__scopeId","data-v-234f3f41"]]),Y={class:"klineSub"},H={class:"klineSub-tips"},G={key:0,class:"klineSub-tips-select"},J=t.defineComponent({__name:"index",props:{drawData:{type:Object,require:!0},activeIndex:{type:Number,require:!0},modelValue:{type:String,required:!0},subIndicatorList:{type:Array,required:!0},config:{type:Object,require:!0}},emits:["update:modelValue"],setup(D,{expose:x,emit:S}){const{round:g}=z.x;let y,w;const h=S,u=D,o=t.ref(),d=t.computed({get(){return u.modelValue},set(e){h("update:modelValue",e)}}),f=t.computed(()=>{const{drawData:e,activeIndex:i}=u,a=u.subIndicatorList.find(n=>n.value===d.value);return e.originData&&e.originData[i]?a.config.map(n=>{var b,q;let l="-";return n.source==="origin"?l=e.originData[i][n.dataIndex]||"-":n.source==="calculation"&&(l=(((q=(b=e.subIndicatorData)==null?void 0:b.find(v=>v.key===n.key))==null?void 0:q.data)||[])[i]),{label:n.key,color:n.color,value:l==="-"?l:g(l)}}):[]});t.onMounted(()=>{y=E.init(o.value);let e=!0;w=new ResizeObserver(()=>{if(e){e=null;return}y.resize()}),w.observe(o.value)}),t.onUnmounted(()=>{y.dispose(),w.disconnect(),w=null});const p=(e,i)=>{const a=e[i],n=i===0?e[i]:e[i-1];return a[0]===a[1]?a[0]>=n[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:a[1]>a[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return x({connect:e=>{E.connect([e,y])},draw:e=>{t.nextTick(()=>{var k;const{startValue:i,endValue:a,maxValueSpan:n}=e,{xAxisData:l,subIndicatorData:b,candlestickData:q,originData:m}=u.drawData,v=u.subIndicatorList.find(c=>c.value===d.value),F=[];if(v.series==="bar"){let c=[];v.source==="origin"?c=m.map(_=>_[v.dataIndex]):c=((k=b==null?void 0:b.find(_=>_.key===v.dataIndex))==null?void 0:k.data)||[],F.push({name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:c.map((_,I)=>v.color==="kline"?{value:_,itemStyle:p(q,I)}:v.color==="value"?{value:_,itemStyle:{color:_>=0?"#FF0000":"#00FFFF"}}:{value:_,itemStyle:{color:v.color}})})}b.forEach(c=>{if(c.series==="line"){let _=[];c.source==="origin"?_=m.map(I=>I[c.dataIndex]):c.source==="calculation"&&(_=c.data),F.push({xAxisIndex:0,yAxisIndex:c.yAxis==="right"?2:1,name:c.key,type:"line",silent:!0,symbol:"none",data:_,lineStyle:{width:1},itemStyle:{color:c.color}})}}),y.setOption({animation:!1,grid:{left:`${u.config.gridLeft}px`,top:"10px",right:`${u.config.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:i,endValue:a,maxValueSpan:n}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:c=>{const{axisDimension:_,value:I}=c;if(_==="x")return I;if(c.axisIndex===1)return String(g(I))}}},formatter:()=>""},xAxis:{type:"category",data:l,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{show:!0,formatter:c=>c}},yAxis:[{position:"right"},{position:"left",min:v.leftYAxisRange==="cover"?c=>c.min:null,max:v.leftYAxisRange==="cover"?c=>c.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:v.rightYAxisRange==="cover"?c=>c.min:null,max:v.rightYAxisRange==="cover"?c=>c.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:F},!0)})}}),(e,i)=>{const a=R.ElOption,n=R.ElSelect;return t.openBlock(),t.createElementBlock("div",Y,[t.createElementVNode("div",H,[f.value.length?(t.openBlock(),t.createElementBlock("div",G,[t.createVNode(n,{modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=l=>d.value=l),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.subIndicatorList,l=>(t.openBlock(),t.createBlock(a,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createVNode(O,{data:f.value},null,8,["data"])]),t.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:o},null,512)])}}});const Q=L._export_sfc(J,[["__scopeId","data-v-0a2f256e"]]),W=t.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]}},emits:["change"],setup(D,{expose:x,emit:S}){let g,y,w=null;const h=S,u=D,o=t.ref();t.watch(()=>u.data,()=>{p()},{deep:!0}),t.onMounted(()=>{g=E.init(o.value),d(),p();let e=!0;y=new ResizeObserver(()=>{if(e){e=null;return}g.resize()}),y.observe(o.value)}),t.onUnmounted(()=>{g.off("datazoom"),g.dispose(),y.disconnect(),y=null});const d=()=>{g.on("datazoom",e=>{e.dataZoomId&&(clearTimeout(w),w=setTimeout(()=>{const{data:i}=u,{start:a,end:n}=e,l=Math.floor(a*i.length/100),b=n===100?i.length-1:Math.floor(n*i.length/100);f(l,b),clearTimeout(w)},100))})},f=(e,i)=>{const a=u.data;if(a.length===0)return;const n=a[e][0].split(" ")[0],l=a[i][0].split(" ")[0];h("change",{startTime:`${n} 00:00:00`,endTime:`${l} 24:00:00`})},p=()=>{const{data:e}=u;if(e.length===0)return;const i=e.map(n=>n[0].split(" ")[0]),a=e.map(n=>n[1]);g.setOption({grid:{height:0,left:"80px",right:"80px"},xAxis:{type:"category",data:i,show:!1},yAxis:{type:"value"},series:[{data:a,type:"line"}]},!0)};return x({resetSlide:(e,i,a)=>{let n=-1,l=-1;u.data.forEach((b,q)=>{n===-1&&b[0]===e?n=q:n===-1&&new Date(b[0])>new Date(e)&&(n=q-1),(l===-1&&b[0]===i||l===-1&&new Date(b[0])>new Date(i))&&(l=q)}),l=l===-1?u.data.length-1:l,g.setOption({dataZoom:[{show:!0,startValue:n,endValue:l,maxValueSpan:a,textStyle:{color:"#ccc"}},{type:"inside",startValue:n,endValue:l,maxValueSpan:a}]})},resize:()=>{g==null||g.resize()}}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:"klineSlide",ref_key:"slideChartRef",ref:o},null,512))}});const X=L._export_sfc(W,[["__scopeId","data-v-5008746a"]]),ee={install(D){D.component("st-klineUtils",M),D.component("st-klineSub",Q),D.component("st-klineTips",Z),D.component("st-klineSlide",X)}};module.exports=ee;
|
|
1
|
+
"use strict";const t=require("vue"),C=require("./index.esm-94a95a2a.cjs"),L=require("./_plugin-vue_export-helper-f246444f.cjs"),z=require("./index-8901a38c.cjs");require("./base-ef747d02.cjs");require("./el-tag-a33c4b22.cjs");const R=require("./el-select-d8d91db1.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./el-popper-b6c99b28.cjs");const $=require("echarts");require("./index-c108567d.cjs");require("./index-9780a537.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-098c2447.cjs");require("./index-bb833443.cjs");require("./index-298075cf.cjs");require("./index-f3562b52.cjs");require("./castArray-35947698.cjs");require("./index-11547a0c.cjs");require("./scroll-b108dabd.cjs");require("./debounce-62f5b6e8.cjs");require("./vnode-b906ae6d.cjs");function N(m){const A=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const S in m)if(S!=="default"){const g=Object.getOwnPropertyDescriptor(m,S);Object.defineProperty(A,S,g.get?g:{enumerable:!0,get:()=>m[S]})}}return A.default=m,Object.freeze(A)}const E=N($),M=t.defineComponent({__name:"index",setup(m,{expose:A}){let S=!1,g=!0,v=[];const I=(h,u)=>h.length>u?h.slice(h.length-u):h;return A({initTalib:async()=>{if(!S)S=!0,await C.init("./talib.wasm"),g=!1,v.forEach(h=>{h()});else if(g)return new Promise(h=>{v.push(h)})},handleKeyDown:(h,u)=>{let{startValue:o,endValue:d,maxIndex:f}=u;if(h.code==="ArrowLeft"){if(o===0)return;o=o-1,d=d-1}else if(h.code==="ArrowRight"){if(d===f)return;o=o+1,d=d+1}else if(h.code==="ArrowUp"){if(d-o<5)return;const p=Math.floor((d-o)/2)+1;o=o+p,d-o<5&&(o=d-4)}else if(h.code==="ArrowDown"){const p=Math.min(500,d-o);o=o-p-1}return{startValue:o,endValue:d}},getDataZoomInfoByTime:h=>{const{showStartTime:u,showEndTime:o,xAxisData:d,maxShowDays:f}=h;let p=-1,e=-1,i={};return d.forEach((a,n)=>{const l=a.split(" ")[0];i[l]=i[l]||0,i[l]+=1,new Date(a)>=new Date(u)&&p===-1&&(p=n),new Date(a)<=new Date(o)&&(e=n)}),{startValue:p,endValue:e,maxValueSpan:Math.max(...Object.values(i))*f}},formatDataBySlide:h=>{const{originDrawData:u,addData:o,startTime:d,endTime:f}=h,{mainIndicator:p,mainIndicatorList:e,subIndicator:i,subIndicatorList:a,config:n,timeRange:l}=h,{loadAddCount:D,preLoadCount:q}=n;let _=[],b=[],F=[],w=[];d&&f?(_=o.filter(s=>new Date(s[0])>=new Date(d)&&new Date(s[0])<=new Date(f)),w=[...o]):f?(_=[...o.filter((s,r)=>r>=o.length-D&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1])),...u.originData],w=[...o,...u.originData]):d&&(_=[...u.originData,...o.filter((s,r)=>r>=q&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1]))],w=_),_.forEach((s,r)=>{b.push([s[1],s[4],s[3],s[2],r===0?0:_[r-1][4],s[6]]),F.push(s[0])});let c=[],x=[];const y={time:[],open:[],close:[],high:[],low:[],originData:w};let B=null,T=null;return w.forEach((s,r)=>{y.time.push(s[0]),y.open.push(s[1]),y.close.push(s[4]),y.high.push(s[2]),y.low.push(s[3]),s[0]===_[0][0]&&(B=r),s[0]===_[_.length-1][0]&&(T=r+1)}),c=e.find(({value:s})=>s===p).config.map(s=>{const{calculationFn:r}=s,k={time:[],open:[],close:[],high:[],low:[],originData:[]};return{...s,data:r?r(C.talib,y,k).slice(B,T):[]}}),x=a.find(({value:s})=>s===i).config.reduce((s,r)=>{const{source:k,calculationFn:V}=r;return k==="calculation"?[...s,{...r,data:V?V(C.talib,y).slice(B,T):[]}]:s},[]),{originData:_,candlestickData:b,mainIndicatorData:c,subIndicatorData:x,xAxisData:F,startTime:_[0][0],endTime:_[_.length-1][0],length:_.length}},formatDataByCount:h=>{const{originDrawData:u,addData:o,mainIndicator:d,mainIndicatorList:f,subIndicator:p,subIndicatorList:e,config:i}=h;let a={};const{addCount:n,preLoadCount:l}=i,D=[],q=[],_=[],b=[],F=[];let w=[],c=[];const x=o.filter((r,k)=>(D.push(r[0]),q.push(r[1]),_.push(r[4]),b.push(r[2]),F.push(r[3]),w.push(r[0]),c.push([r[1],r[4],r[3],r[2],k===0?0:o[k-1][4],r[6]]),o.length>=n+l-1?k>=l:!0));w=I(w,x.length),c=I(c,x.length);const y={time:D,open:q,close:_,high:b,low:F,originData:o},T=f.find(r=>r.value===d).config.map(r=>({...r,data:I(r.calculationFn?r.calculationFn(C.talib,y,{time:[],open:[],close:[],high:[],low:[],originData:[]}):[],w.length)}));let s=[];return p&&e&&(s=e.find(k=>k.value===p).config.reduce((k,V)=>V.source==="calculation"?[...k,{...V,data:I(V.calculationFn?V.calculationFn(C.talib,y):[],w.length)}]:k,[])),u.length?a={originData:[...x,...u.originData],xAxisData:[...w,...u.xAxisData],candlestickData:[...c,...u.candlestickData],mainIndicatorData:u.mainIndicatorData.map((r,k)=>({...r,data:[...T[k].data,...r.data]})),subIndicatorData:u.subIndicatorData.map((r,k)=>({...r,data:[...s[k].data,...r.data]}))}:a={originData:x,xAxisData:w,candlestickData:c,mainIndicatorData:T,subIndicatorData:s},a.length=a.xAxisData.length,a.startTime=a.xAxisData[0],a.endTime=a.xAxisData[a.length-1],a},fn:()=>{}}),(h,u)=>null}}),j={class:"kline-tips"},P=t.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(m){return(A,S)=>(t.openBlock(),t.createElementBlock("div",j,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.data,(g,v)=>(t.openBlock(),t.createElementBlock("div",{key:v,class:"kline-tips-item",style:t.normalizeStyle({color:g.color})},t.toDisplayString(g.label)+" "+t.toDisplayString(g.value),5))),128))]))}});const O=L._export_sfc(P,[["__scopeId","data-v-2a02e841"]]),K={class:"kline-tips"},U=t.defineComponent({__name:"index",props:{drawData:{type:Object,require:!0},candlestickData:{type:Array,default:()=>null},mainIndicatorData:{type:Array,default:()=>null},activeIndex:{type:Number,require:!0}},setup(m){const{round:A,multiply:S,divide:g,subtract:v,formatValue:I}=z.x,h=m,u=t.computed(()=>{const{drawData:d,activeIndex:f,candlestickData:p}=h;if(p!=null&&p.length&&p[f]){let e;return p[f][6]>0?e="red":p[f][6]<0&&(e="green"),[{label:"开",value:p[f][0]},{label:"高",value:p[f][3]},{label:"低",value:p[f][2]},{label:"收",value:p[f][1]},{label:"额",value:I(p[f][4])},{label:"涨跌",value:`${A(p[f][6])}%`,color:e}]}else if(d.candlestickData&&d.candlestickData[f]){const e=d.candlestickData[f],i=[{label:"开",value:e[0]},{label:"高",value:e[3]},{label:"低",value:e[2]},{label:"收",value:e[1]}];e[5]!==void 0&&i.push({label:"额",value:I(e[5])});const a=A(S(g(v(e[1],e[4]),Math.abs(e[4])),100));let n;return a>0?n="red":a<0&&(n="green"),i.push({label:"涨跌",value:`${a}%`,color:n}),i}return[]}),o=t.computed(()=>{var p;const{drawData:d,activeIndex:f}=h;return((p=d==null?void 0:d.mainIndicatorData)==null?void 0:p.map(e=>({label:e.key,value:A(e.data[f]),color:e.color})))||[]});return(d,f)=>(t.openBlock(),t.createElementBlock("div",K,[t.createVNode(O,{data:u.value},null,8,["data"]),t.createVNode(O,{data:o.value},null,8,["data"])]))}});const Z=L._export_sfc(U,[["__scopeId","data-v-e75a1234"]]),Y={class:"klineSub"},H={class:"klineSub-tips"},G={key:0,class:"klineSub-tips-select"},J=t.defineComponent({__name:"index",props:{drawData:{type:Object,require:!0},activeIndex:{type:Number,require:!0},modelValue:{type:String,required:!0},subIndicatorList:{type:Array,required:!0},config:{type:Object,require:!0}},emits:["update:modelValue"],setup(m,{expose:A,emit:S}){const{round:g}=z.x;let v,I;const h=S,u=m,o=t.ref(),d=t.computed({get(){return u.modelValue},set(e){h("update:modelValue",e)}}),f=t.computed(()=>{const{drawData:e,activeIndex:i}=u,a=u.subIndicatorList.find(n=>n.value===d.value);return e.originData&&e.originData[i]?a.config.map(n=>{var D,q;let l="-";return n.source==="origin"?l=e.originData[i][n.dataIndex]||"-":n.source==="calculation"&&(l=(((q=(D=e.subIndicatorData)==null?void 0:D.find(b=>b.key===n.key))==null?void 0:q.data)||[])[i]),{label:n.key,color:n.color,value:l==="-"?l:g(l)}}):[]});t.onMounted(()=>{v=E.init(o.value);let e=!0;I=new ResizeObserver(()=>{if(e){e=null;return}v.resize()}),I.observe(o.value)}),t.onUnmounted(()=>{v.dispose(),I.disconnect(),I=null});const p=(e,i)=>{const a=e[i],n=i===0?e[i]:e[i-1];return a[0]===a[1]?a[0]>=n[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:a[1]>a[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return A({connect:e=>{E.connect([e,v])},draw:e=>{t.nextTick(()=>{var w;const{startValue:i,endValue:a,maxValueSpan:n}=e,{xAxisData:l,subIndicatorData:D,candlestickData:q,originData:_}=u.drawData,b=u.subIndicatorList.find(c=>c.value===d.value),F=[];if(b.series==="bar"){let c=[];b.source==="origin"?c=_.map(x=>x[b.dataIndex]):c=((w=D==null?void 0:D.find(x=>x.key===b.dataIndex))==null?void 0:w.data)||[],F.push({name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:c.map((x,y)=>b.color==="kline"?{value:x,itemStyle:p(q,y)}:b.color==="value"?{value:x,itemStyle:{color:x>=0?"#FF0000":"#00FFFF"}}:{value:x,itemStyle:{color:b.color}})})}D.forEach(c=>{if(c.series==="line"){let x=[];c.source==="origin"?x=_.map(y=>y[c.dataIndex]):c.source==="calculation"&&(x=c.data),F.push({xAxisIndex:0,yAxisIndex:c.yAxis==="right"?2:1,name:c.key,type:"line",silent:!0,symbol:"none",data:x,lineStyle:{width:1},itemStyle:{color:c.color}})}}),v.setOption({animation:!1,grid:{left:`${u.config.gridLeft}px`,top:"10px",right:`${u.config.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:i,endValue:a,maxValueSpan:n}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:c=>{const{axisDimension:x,value:y}=c;if(x==="x")return y;if(c.axisIndex===1)return String(g(y))}}},formatter:()=>""},xAxis:{type:"category",data:l,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{show:!0,formatter:c=>c}},yAxis:[{position:"right"},{position:"left",min:b.leftYAxisRange==="cover"?c=>c.min:null,max:b.leftYAxisRange==="cover"?c=>c.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:b.rightYAxisRange==="cover"?c=>c.min:null,max:b.rightYAxisRange==="cover"?c=>c.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:F},!0)})}}),(e,i)=>{const a=R.ElOption,n=R.ElSelect;return t.openBlock(),t.createElementBlock("div",Y,[t.createElementVNode("div",H,[f.value.length?(t.openBlock(),t.createElementBlock("div",G,[t.createVNode(n,{modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=l=>d.value=l),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.subIndicatorList,l=>(t.openBlock(),t.createBlock(a,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createVNode(O,{data:f.value},null,8,["data"])]),t.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:o},null,512)])}}});const Q=L._export_sfc(J,[["__scopeId","data-v-0a2f256e"]]),W=t.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]}},emits:["change"],setup(m,{expose:A,emit:S}){let g,v,I=null;const h=S,u=m,o=t.ref();t.watch(()=>u.data,()=>{p()},{deep:!0}),t.onMounted(()=>{g=E.init(o.value),d(),p();let e=!0;v=new ResizeObserver(()=>{if(e){e=null;return}g.resize()}),v.observe(o.value)}),t.onUnmounted(()=>{g.off("datazoom"),g.dispose(),v.disconnect(),v=null});const d=()=>{g.on("datazoom",e=>{e.dataZoomId&&(clearTimeout(I),I=setTimeout(()=>{const{data:i}=u,{start:a,end:n}=e,l=Math.floor(a*i.length/100),D=n===100?i.length-1:Math.floor(n*i.length/100);f(l,D),clearTimeout(I)},100))})},f=(e,i)=>{const a=u.data;if(a.length===0)return;const n=a[e][0].split(" ")[0],l=a[i][0].split(" ")[0];h("change",{startTime:`${n} 00:00:00`,endTime:`${l} 24:00:00`})},p=()=>{const{data:e}=u;if(e.length===0)return;const i=e.map(n=>n[0].split(" ")[0]),a=e.map(n=>n[1]);g.setOption({grid:{height:0,left:"80px",right:"80px"},xAxis:{type:"category",data:i,show:!1},yAxis:{type:"value"},series:[{data:a,type:"line"}]},!0)};return A({resetSlide:(e,i,a)=>{let n=-1,l=-1;u.data.forEach((D,q)=>{n===-1&&D[0]===e?n=q:n===-1&&new Date(D[0])>new Date(e)&&(n=q-1),(l===-1&&D[0]===i||l===-1&&new Date(D[0])>new Date(i))&&(l=q)}),l=l===-1?u.data.length-1:l,g.setOption({dataZoom:[{show:!0,startValue:n,endValue:l,maxValueSpan:a,textStyle:{color:"#ccc"}},{type:"inside",startValue:n,endValue:l,maxValueSpan:a}]})},resize:()=>{g==null||g.resize()}}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:"klineSlide",ref_key:"slideChartRef",ref:o},null,512))}});const X=L._export_sfc(W,[["__scopeId","data-v-5008746a"]]),ee={install(m){m.component("st-klineUtils",M),m.component("st-klineSub",Q),m.component("st-klineTips",Z),m.component("st-klineSlide",X)}};module.exports=ee;
|