st-comp 0.0.121 → 0.0.122

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/KlineNew.js CHANGED
@@ -17,57 +17,57 @@ import "./scroll-3b521d81.js";
17
17
  import "./debounce-2336e546.js";
18
18
  const oe = /* @__PURE__ */ R({
19
19
  __name: "index",
20
- setup(w, { expose: A }) {
21
- let S = !1, f = !0, D = [];
22
- const b = (p, c) => p.length > c ? p.slice(p.length - c) : p;
23
- return A({
20
+ setup(k, { expose: D }) {
21
+ let S = !1, h = !0, v = [];
22
+ const y = (f, c) => f.length > c ? f.slice(f.length - c) : f;
23
+ return D({
24
24
  // 注册计算指标线方法
25
25
  initTalib: async () => {
26
26
  if (!S)
27
- S = !0, await te("./talib.wasm"), f = !1, D.forEach((p) => {
28
- p();
27
+ S = !0, await te("./talib.wasm"), h = !1, v.forEach((f) => {
28
+ f();
29
29
  });
30
- else if (f)
31
- return new Promise((p) => {
32
- D.push(p);
30
+ else if (h)
31
+ return new Promise((f) => {
32
+ v.push(f);
33
33
  });
34
34
  },
35
35
  // 键盘事件处理
36
- handleKeyDown: (p, c) => {
37
- let { startValue: n, endValue: u, maxIndex: g } = c;
38
- if (p.code === "ArrowLeft") {
39
- if (n === 0)
36
+ handleKeyDown: (f, c) => {
37
+ let { startValue: o, endValue: u, maxIndex: p } = c;
38
+ if (f.code === "ArrowLeft") {
39
+ if (o === 0)
40
40
  return;
41
- n = n - 1, u = u - 1;
42
- } else if (p.code === "ArrowRight") {
43
- if (u === g)
41
+ o = o - 1, u = u - 1;
42
+ } else if (f.code === "ArrowRight") {
43
+ if (u === p)
44
44
  return;
45
- n = n + 1, u = u + 1;
46
- } else if (p.code === "ArrowUp") {
47
- if (u - n < 5)
45
+ o = o + 1, u = u + 1;
46
+ } else if (f.code === "ArrowUp") {
47
+ if (u - o < 5)
48
48
  return;
49
- const d = Math.floor((u - n) / 2) + 1;
50
- n = n + d, u - n < 5 && (n = u - 4);
51
- } else if (p.code === "ArrowDown") {
52
- const d = Math.min(500, u - n);
53
- n = n - d - 1;
49
+ const d = Math.floor((u - o) / 2) + 1;
50
+ o = o + d, u - o < 5 && (o = u - 4);
51
+ } else if (f.code === "ArrowDown") {
52
+ const d = Math.min(500, u - o);
53
+ o = o - d - 1;
54
54
  }
55
55
  return {
56
- startValue: n,
56
+ startValue: o,
57
57
  endValue: u
58
58
  };
59
59
  },
60
60
  // 根据时间解析dataZoom
61
- getDataZoomInfoByTime: (p) => {
62
- const { showStartTime: c, showEndTime: n, xAxisData: u, maxShowDays: g } = p;
63
- let d = -1, e = -1, r = {};
64
- return u.forEach((t, i) => {
65
- const o = t.split(" ")[0];
66
- r[o] = r[o] || 0, r[o] += 1, new Date(t) >= new Date(c) && d === -1 && (d = i), new Date(t) <= new Date(n) && (e = i);
61
+ getDataZoomInfoByTime: (f) => {
62
+ const { showStartTime: c, showEndTime: o, xAxisData: u, maxShowDays: p } = f;
63
+ let d = -1, e = -1, i = {};
64
+ return u.forEach((t, a) => {
65
+ const r = t.split(" ")[0];
66
+ i[r] = i[r] || 0, i[r] += 1, new Date(t) >= new Date(c) && d === -1 && (d = a), new Date(t) <= new Date(o) && (e = a);
67
67
  }), {
68
68
  startValue: d,
69
69
  endValue: e,
70
- maxValueSpan: Math.max(...Object.values(r)) * g
70
+ maxValueSpan: Math.max(...Object.values(i)) * p
71
71
  };
72
72
  },
73
73
  /**
@@ -83,68 +83,68 @@ const oe = /* @__PURE__ */ R({
83
83
  * length, // 便捷数据 - K线长度
84
84
  * }
85
85
  */
86
- formatDataBySlide: (p) => {
87
- const { originDrawData: c, addData: n, startTime: u, endTime: g } = p, { mainIndicator: d, mainIndicatorList: e, subIndicator: r, subIndicatorList: t, config: i, timeRange: o } = p, { loadAddCount: x, preLoadCount: k } = i;
88
- let m = [], _ = [], F = [], y = [];
89
- u && g ? (m = n.filter((s) => new Date(s[0]) >= new Date(u) && new Date(s[0]) <= new Date(g)), y = [...n]) : g ? (m = [
90
- ...n.filter((s, a) => a >= n.length - x && new Date(o[0]) <= new Date(s[0]) && new Date(s[0]) <= new Date(o[1])),
86
+ formatDataBySlide: (f) => {
87
+ const { originDrawData: c, addData: o, startTime: u, endTime: p } = f, { mainIndicator: d, mainIndicatorList: e, subIndicator: i, subIndicatorList: t, config: a, timeRange: r } = f, { loadAddCount: x, preLoadCount: A } = a;
88
+ let g = [], _ = [], F = [], I = [];
89
+ u && p ? (g = o.filter((l) => new Date(l[0]) >= new Date(u) && new Date(l[0]) <= new Date(p)), I = [...o]) : p ? (g = [
90
+ ...o.filter((l, n) => n >= o.length - x && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1])),
91
91
  ...c.originData
92
- ], y = [...n, ...c.originData]) : u && (m = [
92
+ ], I = [...o, ...c.originData]) : u && (g = [
93
93
  ...c.originData,
94
- ...n.filter((s, a) => a >= k && new Date(o[0]) <= new Date(s[0]) && new Date(s[0]) <= new Date(o[1]))
95
- ], y = m), m.forEach((s, a) => {
96
- _.push([s[1], s[4], s[3], s[2], a === 0 ? 0 : m[a - 1][4], s[6]]), F.push(s[0]);
94
+ ...o.filter((l, n) => n >= A && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1]))
95
+ ], I = g), g.forEach((l, n) => {
96
+ _.push([l[1], l[4], l[3], l[2], n === 0 ? 0 : g[n - 1][4], l[6]]), F.push(l[0]);
97
97
  });
98
- let l = [], h = [];
99
- const v = {
98
+ let s = [], m = [];
99
+ const b = {
100
100
  time: [],
101
101
  open: [],
102
102
  close: [],
103
103
  high: [],
104
104
  low: [],
105
- originData: y
105
+ originData: I
106
106
  };
107
107
  let E = null, C = null;
108
- return y.forEach((s, a) => {
109
- v.time.push(s[0]), v.open.push(s[1]), v.close.push(s[4]), v.high.push(s[2]), v.low.push(s[3]), s[0] === m[0][0] && (E = a), s[0] === m[m.length - 1][0] && (C = a + 1);
110
- }), l = e.find(({ value: s }) => s === d).config.map((s) => {
111
- const { calculationFn: a } = s;
108
+ return I.forEach((l, n) => {
109
+ b.time.push(l[0]), b.open.push(l[1]), b.close.push(l[4]), b.high.push(l[2]), b.low.push(l[3]), l[0] === g[0][0] && (E = n), l[0] === g[g.length - 1][0] && (C = n + 1);
110
+ }), s = e.find(({ value: l }) => l === d).config.map((l) => {
111
+ const { calculationFn: n } = l;
112
112
  return {
113
- ...s,
114
- data: a ? a(z, v, { time: [], open: [], close: [], high: [], low: [], originData: [] }).slice(E, C) : []
113
+ ...l,
114
+ data: n ? n(z, b, { time: [], open: [], close: [], high: [], low: [], originData: [] }).slice(E, C) : []
115
115
  };
116
- }), h = t.find(({ value: s }) => s === r).config.reduce((s, a) => {
117
- const { source: I, calculationFn: V } = a;
118
- return I === "calculation" ? [
119
- ...s,
116
+ }), m = t.find(({ value: l }) => l === i).config.reduce((l, n) => {
117
+ const { source: w, calculationFn: V } = n;
118
+ return w === "calculation" ? [
119
+ ...l,
120
120
  {
121
- ...a,
122
- data: V ? V(z, v).slice(E, C) : []
121
+ ...n,
122
+ data: V ? V(z, b).slice(E, C) : []
123
123
  }
124
- ] : s;
124
+ ] : l;
125
125
  }, []), {
126
- originData: m,
126
+ originData: g,
127
127
  candlestickData: _,
128
- mainIndicatorData: l,
129
- subIndicatorData: h,
128
+ mainIndicatorData: s,
129
+ subIndicatorData: m,
130
130
  xAxisData: F,
131
- startTime: m[0][0],
132
- endTime: m[m.length - 1][0],
133
- length: m.length
131
+ startTime: g[0][0],
132
+ endTime: g[g.length - 1][0],
133
+ length: g.length
134
134
  };
135
135
  },
136
136
  // 计算绘图数据(根据长度使用)
137
- formatDataByCount: (p) => {
138
- const { originDrawData: c, addData: n, mainIndicator: u, mainIndicatorList: g, subIndicator: d, subIndicatorList: e, config: r } = p;
137
+ formatDataByCount: (f) => {
138
+ const { originDrawData: c, addData: o, mainIndicator: u, mainIndicatorList: p, subIndicator: d, subIndicatorList: e, config: i } = f;
139
139
  let t = {};
140
- const { addCount: i, preLoadCount: o } = r, x = [], k = [], m = [], _ = [], F = [];
141
- let y = [], l = [];
142
- const h = n.filter((a, I) => (x.push(a[0]), k.push(a[1]), m.push(a[4]), _.push(a[2]), F.push(a[3]), y.push(a[0]), l.push([a[1], a[4], a[3], a[2], I === 0 ? 0 : n[I - 1][4], a[6]]), n.length >= i + o - 1 ? I >= o : !0));
143
- y = b(y, h.length), l = b(l, h.length);
144
- const v = { time: x, open: k, close: m, high: _, low: F, originData: n }, C = g.find((a) => a.value === u).config.map((a) => ({
145
- ...a,
146
- data: b(
147
- a.calculationFn ? a.calculationFn(z, v, {
140
+ const { addCount: a, preLoadCount: r } = i, x = [], A = [], g = [], _ = [], F = [];
141
+ let I = [], s = [];
142
+ const m = o.filter((n, w) => (x.push(n[0]), A.push(n[1]), g.push(n[4]), _.push(n[2]), F.push(n[3]), I.push(n[0]), s.push([n[1], n[4], n[3], n[2], w === 0 ? 0 : o[w - 1][4], n[6]]), o.length >= a + r - 1 ? w >= r : !0));
143
+ I = y(I, m.length), s = y(s, m.length);
144
+ const b = { time: x, open: A, close: g, high: _, low: F, originData: o }, C = p.find((n) => n.value === u).config.map((n) => ({
145
+ ...n,
146
+ data: y(
147
+ n.calculationFn ? n.calculationFn(z, b, {
148
148
  time: [],
149
149
  open: [],
150
150
  close: [],
@@ -152,52 +152,52 @@ const oe = /* @__PURE__ */ R({
152
152
  low: [],
153
153
  originData: []
154
154
  }) : [],
155
- y.length
155
+ I.length
156
156
  )
157
157
  }));
158
- let s = [];
159
- return d && e && (s = e.find((I) => I.value === d).config.reduce((I, V) => V.source === "calculation" ? [
160
- ...I,
158
+ let l = [];
159
+ return d && e && (l = e.find((w) => w.value === d).config.reduce((w, V) => V.source === "calculation" ? [
160
+ ...w,
161
161
  {
162
162
  ...V,
163
- data: b(
164
- V.calculationFn ? V.calculationFn(z, v) : [],
165
- y.length
163
+ data: y(
164
+ V.calculationFn ? V.calculationFn(z, b) : [],
165
+ I.length
166
166
  )
167
167
  }
168
- ] : I, [])), c.length ? t = {
169
- originData: [...h, ...c.originData],
168
+ ] : w, [])), c.length ? t = {
169
+ originData: [...m, ...c.originData],
170
170
  // 原数据
171
- xAxisData: [...y, ...c.xAxisData],
171
+ xAxisData: [...I, ...c.xAxisData],
172
172
  // 时间数据
173
- candlestickData: [...l, ...c.candlestickData],
173
+ candlestickData: [...s, ...c.candlestickData],
174
174
  // k线数据
175
- mainIndicatorData: c.mainIndicatorData.map((a, I) => ({
176
- ...a,
177
- data: [...C[I].data, ...a.data]
175
+ mainIndicatorData: c.mainIndicatorData.map((n, w) => ({
176
+ ...n,
177
+ data: [...C[w].data, ...n.data]
178
178
  })),
179
179
  // 主图指标线数据
180
- subIndicatorData: c.subIndicatorData.map((a, I) => ({
181
- ...a,
182
- data: [...s[I].data, ...a.data]
180
+ subIndicatorData: c.subIndicatorData.map((n, w) => ({
181
+ ...n,
182
+ data: [...l[w].data, ...n.data]
183
183
  }))
184
184
  // 副图数据
185
185
  } : t = {
186
- originData: h,
186
+ originData: m,
187
187
  // 原数据
188
- xAxisData: y,
188
+ xAxisData: I,
189
189
  // 时间数据
190
- candlestickData: l,
190
+ candlestickData: s,
191
191
  // k线数据
192
192
  mainIndicatorData: C,
193
193
  // 主图指标线数据
194
- subIndicatorData: s
194
+ subIndicatorData: l
195
195
  // 副图数据
196
196
  }, t.length = t.xAxisData.length, t.startTime = t.xAxisData[0], t.endTime = t.xAxisData[t.length - 1], t;
197
197
  },
198
198
  fn: () => {
199
199
  }
200
- }), (p, c) => null;
200
+ }), (f, c) => null;
201
201
  }
202
202
  }), re = { class: "kline-tips" }, ie = /* @__PURE__ */ R({
203
203
  __name: "index",
@@ -208,17 +208,17 @@ const oe = /* @__PURE__ */ R({
208
208
  require: !0
209
209
  }
210
210
  },
211
- setup(w) {
212
- return (A, S) => (T(), L("div", re, [
213
- (T(!0), L(K, null, Z(w.data, (f, D) => (T(), L("div", {
214
- key: D,
211
+ setup(k) {
212
+ return (D, S) => (T(), L("div", re, [
213
+ (T(!0), L(K, null, Z(k.data, (h, v) => (T(), L("div", {
214
+ key: v,
215
215
  class: "kline-tips-item",
216
- style: H({ color: f.color })
217
- }, N(f.label) + " " + N(f.value), 5))), 128))
216
+ style: H({ color: h.color })
217
+ }, N(h.label) + " " + N(h.value), 5))), 128))
218
218
  ]));
219
219
  }
220
220
  });
221
- const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), se = { class: "kline-tips" }, le = /* @__PURE__ */ R({
221
+ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), le = { class: "kline-tips" }, se = /* @__PURE__ */ R({
222
222
  __name: "index",
223
223
  props: {
224
224
  // 提示数据
@@ -226,39 +226,61 @@ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), se = { clas
226
226
  type: Object,
227
227
  require: !0
228
228
  },
229
+ // K线数据
230
+ // candlestickData: [开, 收, 低, 高, 成交额, 涨跌值, 涨跌百分比]
231
+ candlestickData: {
232
+ type: Array,
233
+ default: () => null
234
+ },
235
+ // 主图指标数据
236
+ // mainIndicatorData: [key, data, color]
237
+ mainIndicatorData: {
238
+ type: Array,
239
+ default: () => null
240
+ },
229
241
  activeIndex: {
230
242
  type: Number,
231
243
  require: !0
232
244
  }
233
245
  },
234
- setup(w) {
235
- const { round: A, multiply: S, divide: f, subtract: D, formatValue: b } = G, p = w, c = $(() => {
236
- const { drawData: u, activeIndex: g } = p;
237
- if (u.candlestickData && u.candlestickData[g]) {
238
- const d = u.candlestickData[g], e = [
239
- { label: "", value: A(d[0]) },
240
- { label: "", value: A(d[3]) },
241
- { label: "", value: A(d[2]) },
242
- { label: "", value: A(d[1]) }
246
+ setup(k) {
247
+ const { round: D, multiply: S, divide: h, subtract: v, formatValue: y } = G, f = k, c = $(() => {
248
+ const { drawData: u, activeIndex: p, candlestickData: d } = f;
249
+ if (d != null && d.length && d[p]) {
250
+ let e;
251
+ return d[p][6] > 0 ? e = "red" : d[p][6] < 0 && (e = "green"), [
252
+ { label: "", value: D(d[p][0]) },
253
+ { label: "", value: D(d[p][3]) },
254
+ { label: "", value: D(d[p][2]) },
255
+ { label: "收", value: D(d[p][1]) },
256
+ { label: "额", value: y(d[p][4]) },
257
+ { label: "涨跌", value: `${D(d[p][6])}%`, color: e }
258
+ ];
259
+ } else if (u.candlestickData && u.candlestickData[p]) {
260
+ const e = u.candlestickData[p], i = [
261
+ { label: "开", value: D(e[0]) },
262
+ { label: "高", value: D(e[3]) },
263
+ { label: "低", value: D(e[2]) },
264
+ { label: "收", value: D(e[1]) }
243
265
  ];
244
- d[5] !== void 0 && e.push({ label: "额", value: b(d[5]) });
245
- const r = A(S(f(D(d[1], d[4]), Math.abs(d[4])), 100));
246
- let t;
247
- return r > 0 ? t = "red" : r < 0 && (t = "green"), e.push({ label: "涨跌", value: `${r}%`, color: t }), e;
266
+ e[5] !== void 0 && i.push({ label: "额", value: y(e[5]) });
267
+ const t = D(S(h(v(e[1], e[4]), Math.abs(e[4])), 100));
268
+ let a;
269
+ return t > 0 ? a = "red" : t < 0 && (a = "green"), i.push({ label: "涨跌", value: `${t}%`, color: a }), i;
248
270
  }
249
271
  return [];
250
- }), n = $(() => {
272
+ }), o = $(() => {
251
273
  var d;
252
- const { drawData: u, activeIndex: g } = p;
253
- return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value: A(e.data[g]), color: e.color }))) || [];
274
+ const { drawData: u, activeIndex: p } = f;
275
+ return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value: D(e.data[p]), color: e.color }))) || [];
254
276
  });
255
- return (u, g) => (T(), L("div", se, [
277
+ return (u, p) => (T(), L("div", le, [
256
278
  O(M, { data: c.value }, null, 8, ["data"]),
257
- O(M, { data: n.value }, null, 8, ["data"])
279
+ O(M, { data: o.value }, null, 8, ["data"])
258
280
  ]));
259
281
  }
260
282
  });
261
- const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { class: "klineSub" }, de = { class: "klineSub-tips" }, pe = {
283
+ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { class: "klineSub" }, de = { class: "klineSub-tips" }, pe = {
262
284
  key: 0,
263
285
  class: "klineSub-tips-select"
264
286
  }, fe = /* @__PURE__ */ R({
@@ -274,44 +296,44 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
274
296
  // 配置
275
297
  },
276
298
  emits: ["update:modelValue"],
277
- setup(w, { expose: A, emit: S }) {
278
- const { round: f } = G;
279
- let D, b;
280
- const p = S, c = w, n = j(), u = $({
299
+ setup(k, { expose: D, emit: S }) {
300
+ const { round: h } = G;
301
+ let v, y;
302
+ const f = S, c = k, o = j(), u = $({
281
303
  get() {
282
304
  return c.modelValue;
283
305
  },
284
306
  set(e) {
285
- p("update:modelValue", e);
307
+ f("update:modelValue", e);
286
308
  }
287
- }), g = $(() => {
288
- const { drawData: e, activeIndex: r } = c, t = c.subIndicatorList.find((i) => i.value === u.value);
289
- return e.originData && e.originData[r] ? t.config.map((i) => {
290
- var x, k;
291
- let o = "-";
292
- return i.source === "origin" ? o = e.originData[r][i.dataIndex] || "-" : i.source === "calculation" && (o = (((k = (x = e.subIndicatorData) == null ? void 0 : x.find((_) => _.key === i.key)) == null ? void 0 : k.data) || [])[r]), {
293
- label: i.key,
294
- color: i.color,
295
- value: o === "-" ? o : f(o)
309
+ }), p = $(() => {
310
+ const { drawData: e, activeIndex: i } = c, t = c.subIndicatorList.find((a) => a.value === u.value);
311
+ return e.originData && e.originData[i] ? t.config.map((a) => {
312
+ var x, A;
313
+ let r = "-";
314
+ return a.source === "origin" ? r = e.originData[i][a.dataIndex] || "-" : a.source === "calculation" && (r = (((A = (x = e.subIndicatorData) == null ? void 0 : x.find((_) => _.key === a.key)) == null ? void 0 : A.data) || [])[i]), {
315
+ label: a.key,
316
+ color: a.color,
317
+ value: r === "-" ? r : h(r)
296
318
  };
297
319
  }) : [];
298
320
  });
299
321
  U(() => {
300
- D = B.init(n.value);
322
+ v = B.init(o.value);
301
323
  let e = !0;
302
- b = new ResizeObserver(() => {
324
+ y = new ResizeObserver(() => {
303
325
  if (e) {
304
326
  e = null;
305
327
  return;
306
328
  }
307
- D.resize();
308
- }), b.observe(n.value);
329
+ v.resize();
330
+ }), y.observe(o.value);
309
331
  }), Y(() => {
310
- D.dispose(), b.disconnect(), b = null;
332
+ v.dispose(), y.disconnect(), y = null;
311
333
  });
312
- const d = (e, r) => {
313
- const t = e[r], i = r === 0 ? e[r] : e[r - 1];
314
- return t[0] === t[1] ? t[0] >= i[1] ? {
334
+ const d = (e, i) => {
335
+ const t = e[i], a = i === 0 ? e[i] : e[i - 1];
336
+ return t[0] === t[1] ? t[0] >= a[1] ? {
315
337
  color: "transparent",
316
338
  borderColor: "#FF0000"
317
339
  } : {
@@ -323,60 +345,60 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
323
345
  color: "#00FFFF"
324
346
  };
325
347
  };
326
- return A({
348
+ return D({
327
349
  connect: (e) => {
328
- B.connect([e, D]);
350
+ B.connect([e, v]);
329
351
  },
330
352
  // 联动
331
353
  draw: (e) => {
332
354
  J(() => {
333
- var y;
334
- const { startValue: r, endValue: t, maxValueSpan: i } = e, { xAxisData: o, subIndicatorData: x, candlestickData: k, originData: m } = c.drawData, _ = c.subIndicatorList.find((l) => l.value === u.value), F = [];
355
+ var I;
356
+ const { startValue: i, endValue: t, maxValueSpan: a } = e, { xAxisData: r, subIndicatorData: x, candlestickData: A, originData: g } = c.drawData, _ = c.subIndicatorList.find((s) => s.value === u.value), F = [];
335
357
  if (_.series === "bar") {
336
- let l = [];
337
- _.source === "origin" ? l = m.map((h) => h[_.dataIndex]) : l = ((y = x == null ? void 0 : x.find((h) => h.key === _.dataIndex)) == null ? void 0 : y.data) || [], F.push({
358
+ let s = [];
359
+ _.source === "origin" ? s = g.map((m) => m[_.dataIndex]) : s = ((I = x == null ? void 0 : x.find((m) => m.key === _.dataIndex)) == null ? void 0 : I.data) || [], F.push({
338
360
  name: "subMain",
339
361
  xAxisIndex: 0,
340
362
  yAxisIndex: 1,
341
363
  type: "bar",
342
364
  silent: !0,
343
365
  symbol: "none",
344
- data: l.map((h, v) => _.color === "kline" ? {
345
- value: h,
346
- itemStyle: d(k, v)
366
+ data: s.map((m, b) => _.color === "kline" ? {
367
+ value: m,
368
+ itemStyle: d(A, b)
347
369
  } : _.color === "value" ? {
348
- value: h,
370
+ value: m,
349
371
  itemStyle: {
350
- color: h >= 0 ? "#FF0000" : "#00FFFF"
372
+ color: m >= 0 ? "#FF0000" : "#00FFFF"
351
373
  }
352
374
  } : {
353
- value: h,
375
+ value: m,
354
376
  itemStyle: {
355
377
  color: _.color
356
378
  }
357
379
  })
358
380
  });
359
381
  }
360
- x.forEach((l) => {
361
- if (l.series === "line") {
362
- let h = [];
363
- l.source === "origin" ? h = m.map((v) => v[l.dataIndex]) : l.source === "calculation" && (h = l.data), F.push({
382
+ x.forEach((s) => {
383
+ if (s.series === "line") {
384
+ let m = [];
385
+ s.source === "origin" ? m = g.map((b) => b[s.dataIndex]) : s.source === "calculation" && (m = s.data), F.push({
364
386
  xAxisIndex: 0,
365
- yAxisIndex: l.yAxis === "right" ? 2 : 1,
366
- name: l.key,
387
+ yAxisIndex: s.yAxis === "right" ? 2 : 1,
388
+ name: s.key,
367
389
  type: "line",
368
390
  silent: !0,
369
391
  symbol: "none",
370
- data: h,
392
+ data: m,
371
393
  lineStyle: {
372
394
  width: 1
373
395
  },
374
396
  itemStyle: {
375
- color: l.color
397
+ color: s.color
376
398
  }
377
399
  });
378
400
  }
379
- }), D.setOption(
401
+ }), v.setOption(
380
402
  {
381
403
  animation: !1,
382
404
  grid: {
@@ -388,9 +410,9 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
388
410
  dataZoom: [
389
411
  {
390
412
  type: "inside",
391
- startValue: r,
413
+ startValue: i,
392
414
  endValue: t,
393
- maxValueSpan: i
415
+ maxValueSpan: a
394
416
  }
395
417
  ],
396
418
  tooltip: {
@@ -401,12 +423,12 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
401
423
  type: "cross",
402
424
  label: {
403
425
  rich: {},
404
- formatter: (l) => {
405
- const { axisDimension: h, value: v } = l;
406
- if (h === "x")
407
- return v;
408
- if (l.axisIndex === 1)
409
- return String(f(v));
426
+ formatter: (s) => {
427
+ const { axisDimension: m, value: b } = s;
428
+ if (m === "x")
429
+ return b;
430
+ if (s.axisIndex === 1)
431
+ return String(h(b));
410
432
  }
411
433
  }
412
434
  },
@@ -414,7 +436,7 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
414
436
  },
415
437
  xAxis: {
416
438
  type: "category",
417
- data: o,
439
+ data: r,
418
440
  axisLine: {
419
441
  show: !0
420
442
  },
@@ -423,7 +445,7 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
423
445
  },
424
446
  axisLabel: {
425
447
  show: !0,
426
- formatter: (l) => l
448
+ formatter: (s) => s
427
449
  }
428
450
  },
429
451
  yAxis: [
@@ -432,8 +454,8 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
432
454
  },
433
455
  {
434
456
  position: "left",
435
- min: _.leftYAxisRange === "cover" ? (l) => l.min : null,
436
- max: _.leftYAxisRange === "cover" ? (l) => l.max : null,
457
+ min: _.leftYAxisRange === "cover" ? (s) => s.min : null,
458
+ max: _.leftYAxisRange === "cover" ? (s) => s.max : null,
437
459
  splitNumber: 1,
438
460
  axisLine: {
439
461
  show: !0
@@ -448,8 +470,8 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
448
470
  },
449
471
  {
450
472
  position: "right",
451
- min: _.rightYAxisRange === "cover" ? (l) => l.min : null,
452
- max: _.rightYAxisRange === "cover" ? (l) => l.max : null,
473
+ min: _.rightYAxisRange === "cover" ? (s) => s.min : null,
474
+ max: _.rightYAxisRange === "cover" ? (s) => s.max : null,
453
475
  splitNumber: 1,
454
476
  axisLine: {
455
477
  show: !1
@@ -469,34 +491,34 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
469
491
  });
470
492
  }
471
493
  // 重置
472
- }), (e, r) => {
473
- const t = ae, i = ne;
494
+ }), (e, i) => {
495
+ const t = ae, a = ne;
474
496
  return T(), L("div", ue, [
475
497
  P("div", de, [
476
- g.value.length ? (T(), L("div", pe, [
477
- O(i, {
498
+ p.value.length ? (T(), L("div", pe, [
499
+ O(a, {
478
500
  modelValue: u.value,
479
- "onUpdate:modelValue": r[0] || (r[0] = (o) => u.value = o),
501
+ "onUpdate:modelValue": i[0] || (i[0] = (r) => u.value = r),
480
502
  size: "small",
481
503
  "popper-class": "element-dark",
482
504
  class: "element-dark subIndicator"
483
505
  }, {
484
506
  default: Q(() => [
485
- (T(!0), L(K, null, Z(w.subIndicatorList, (o) => (T(), W(t, {
486
- key: o.value,
487
- label: o.label,
488
- value: o.value
507
+ (T(!0), L(K, null, Z(k.subIndicatorList, (r) => (T(), W(t, {
508
+ key: r.value,
509
+ label: r.label,
510
+ value: r.value
489
511
  }, null, 8, ["label", "value"]))), 128))
490
512
  ]),
491
513
  _: 1
492
514
  }, 8, ["modelValue"])
493
515
  ])) : X("", !0),
494
- O(M, { data: g.value }, null, 8, ["data"])
516
+ O(M, { data: p.value }, null, 8, ["data"])
495
517
  ]),
496
518
  P("div", {
497
519
  class: "klineSub-chart",
498
520
  ref_key: "subChartRef",
499
- ref: n
521
+ ref: o
500
522
  }, null, 512)
501
523
  ]);
502
524
  };
@@ -509,9 +531,9 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
509
531
  // 时间数据
510
532
  },
511
533
  emits: ["change"],
512
- setup(w, { expose: A, emit: S }) {
513
- let f, D, b = null;
514
- const p = S, c = w, n = j();
534
+ setup(k, { expose: D, emit: S }) {
535
+ let h, v, y = null;
536
+ const f = S, c = k, o = j();
515
537
  ee(
516
538
  () => c.data,
517
539
  () => {
@@ -519,40 +541,40 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
519
541
  },
520
542
  { deep: !0 }
521
543
  ), U(() => {
522
- f = B.init(n.value), u(), d();
544
+ h = B.init(o.value), u(), d();
523
545
  let e = !0;
524
- D = new ResizeObserver(() => {
546
+ v = new ResizeObserver(() => {
525
547
  if (e) {
526
548
  e = null;
527
549
  return;
528
550
  }
529
- f.resize();
530
- }), D.observe(n.value);
551
+ h.resize();
552
+ }), v.observe(o.value);
531
553
  }), Y(() => {
532
- f.off("datazoom"), f.dispose(), D.disconnect(), D = null;
554
+ h.off("datazoom"), h.dispose(), v.disconnect(), v = null;
533
555
  });
534
556
  const u = () => {
535
- f.on("datazoom", (e) => {
536
- e.dataZoomId && (clearTimeout(b), b = setTimeout(() => {
537
- const { data: r } = c, { start: t, end: i } = e, o = Math.floor(t * r.length / 100), x = i === 100 ? r.length - 1 : Math.floor(i * r.length / 100);
538
- g(o, x), clearTimeout(b);
557
+ h.on("datazoom", (e) => {
558
+ e.dataZoomId && (clearTimeout(y), y = setTimeout(() => {
559
+ const { data: i } = c, { start: t, end: a } = e, r = Math.floor(t * i.length / 100), x = a === 100 ? i.length - 1 : Math.floor(a * i.length / 100);
560
+ p(r, x), clearTimeout(y);
539
561
  }, 100));
540
562
  });
541
- }, g = (e, r) => {
563
+ }, p = (e, i) => {
542
564
  const t = c.data;
543
565
  if (t.length === 0)
544
566
  return;
545
- const i = t[e][0].split(" ")[0], o = t[r][0].split(" ")[0];
546
- p("change", {
547
- startTime: `${i} 00:00:00`,
548
- endTime: `${o} 24:00:00`
567
+ const a = t[e][0].split(" ")[0], r = t[i][0].split(" ")[0];
568
+ f("change", {
569
+ startTime: `${a} 00:00:00`,
570
+ endTime: `${r} 24:00:00`
549
571
  });
550
572
  }, d = () => {
551
573
  const { data: e } = c;
552
574
  if (e.length === 0)
553
575
  return;
554
- const r = e.map((i) => i[0].split(" ")[0]), t = e.map((i) => i[1]);
555
- f.setOption({
576
+ const i = e.map((a) => a[0].split(" ")[0]), t = e.map((a) => a[1]);
577
+ h.setOption({
556
578
  grid: {
557
579
  height: 0,
558
580
  left: "80px",
@@ -560,7 +582,7 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
560
582
  },
561
583
  xAxis: {
562
584
  type: "category",
563
- data: r,
585
+ data: i,
564
586
  show: !1
565
587
  },
566
588
  yAxis: {
@@ -574,17 +596,17 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
574
596
  ]
575
597
  }, !0);
576
598
  };
577
- return A({
578
- resetSlide: (e, r, t) => {
579
- let i = -1, o = -1;
580
- c.data.forEach((x, k) => {
581
- i === -1 && x[0] === e ? i = k : i === -1 && new Date(x[0]) > new Date(e) && (i = k - 1), (o === -1 && x[0] === r || o === -1 && new Date(x[0]) > new Date(r)) && (o = k);
582
- }), o = o === -1 ? c.data.length - 1 : o, f.setOption({
599
+ return D({
600
+ resetSlide: (e, i, t) => {
601
+ let a = -1, r = -1;
602
+ c.data.forEach((x, A) => {
603
+ a === -1 && x[0] === e ? a = A : a === -1 && new Date(x[0]) > new Date(e) && (a = A - 1), (r === -1 && x[0] === i || r === -1 && new Date(x[0]) > new Date(i)) && (r = A);
604
+ }), r = r === -1 ? c.data.length - 1 : r, h.setOption({
583
605
  dataZoom: [
584
606
  {
585
607
  show: !0,
586
- startValue: i,
587
- endValue: o,
608
+ startValue: a,
609
+ endValue: r,
588
610
  maxValueSpan: t,
589
611
  textStyle: {
590
612
  color: "#ccc"
@@ -592,8 +614,8 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
592
614
  },
593
615
  {
594
616
  type: "inside",
595
- startValue: i,
596
- endValue: o,
617
+ startValue: a,
618
+ endValue: r,
597
619
  maxValueSpan: t
598
620
  }
599
621
  ]
@@ -601,18 +623,18 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
601
623
  },
602
624
  // 重置
603
625
  resize: () => {
604
- f == null || f.resize();
626
+ h == null || h.resize();
605
627
  }
606
- }), (e, r) => (T(), L("div", {
628
+ }), (e, i) => (T(), L("div", {
607
629
  class: "klineSlide",
608
630
  ref_key: "slideChartRef",
609
- ref: n
631
+ ref: o
610
632
  }, null, 512));
611
633
  }
612
634
  });
613
635
  const ge = /* @__PURE__ */ q(me, [["__scopeId", "data-v-5008746a"]]), Re = {
614
- install(w) {
615
- w.component("st-klineUtils", oe), w.component("st-klineSub", he), w.component("st-klineTips", ce), w.component("st-klineSlide", ge);
636
+ install(k) {
637
+ k.component("st-klineUtils", oe), k.component("st-klineSub", he), k.component("st-klineTips", ce), k.component("st-klineSlide", ge);
616
638
  }
617
639
  };
618
640
  export {