st-comp 0.0.69 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/lib/ChartLayout.cjs.js +1 -0
  2. package/lib/ChartLayout.es.js +71 -0
  3. package/lib/Dialog.cjs.js +1 -0
  4. package/lib/Dialog.es.js +89 -0
  5. package/lib/HeatMap.cjs.js +1 -0
  6. package/lib/HeatMap.es.js +117 -0
  7. package/lib/Kline.cjs.js +1 -0
  8. package/lib/Kline.es.js +2631 -0
  9. package/lib/KlineNew.cjs.js +1 -0
  10. package/lib/KlineNew.es.js +614 -0
  11. package/lib/LinearLegend.cjs.js +1 -0
  12. package/lib/LinearLegend.es.js +62 -0
  13. package/lib/Map.cjs.js +1 -0
  14. package/lib/{bundle.js → Map.es.js} +43 -41504
  15. package/lib/Pagination.cjs.js +1 -0
  16. package/lib/Pagination.es.js +624 -0
  17. package/lib/Pie.cjs.js +2 -0
  18. package/lib/Pie.es.js +159 -0
  19. package/lib/Table.cjs.js +20 -0
  20. package/lib/Table.es.js +4006 -0
  21. package/lib/TreeMap.cjs.js +2 -0
  22. package/lib/TreeMap.es.js +162 -0
  23. package/lib/VarietySearch.cjs.js +12 -0
  24. package/lib/VarietySearch.es.js +3335 -0
  25. package/lib/VirtualTable.cjs.js +13 -0
  26. package/lib/VirtualTable.es.js +2679 -0
  27. package/lib/_commonjsHelpers-10dfc225.js +8 -0
  28. package/lib/_commonjsHelpers-87b0abe8.cjs +1 -0
  29. package/lib/_plugin-vue_export-helper-dad06003.js +9 -0
  30. package/lib/_plugin-vue_export-helper-f246444f.cjs +1 -0
  31. package/lib/base-4865d432.cjs +9 -0
  32. package/lib/base-a240bf62.js +762 -0
  33. package/lib/bundle.cjs.js +1 -0
  34. package/lib/bundle.es.js +46 -0
  35. package/lib/bundle.umd-4967d574.js +16091 -0
  36. package/lib/bundle.umd-c5698c50.cjs +71 -0
  37. package/lib/castArray-3341cbb4.cjs +1 -0
  38. package/lib/castArray-a723a736.js +10 -0
  39. package/lib/config-provider-3db4dac6.js +148 -0
  40. package/lib/config-provider-cf4edc1e.cjs +1 -0
  41. package/lib/el-button-c24606d0.cjs +1 -0
  42. package/lib/el-button-fa6a5742.js +231 -0
  43. package/lib/el-empty-282e5e93.js +204 -0
  44. package/lib/el-empty-608948d9.cjs +1 -0
  45. package/lib/el-icon-7718f55e.cjs +1 -0
  46. package/lib/el-icon-d9ef9ccc.js +592 -0
  47. package/lib/el-overlay-7fceb816.cjs +5 -0
  48. package/lib/el-overlay-9b7bdd18.js +678 -0
  49. package/lib/el-scrollbar-7dc53299.js +248 -0
  50. package/lib/el-scrollbar-bc381e35.cjs +1 -0
  51. package/lib/el-select-85ed2643.js +1894 -0
  52. package/lib/el-select-a50741c1.cjs +9 -0
  53. package/lib/el-tag-308f715a.js +2416 -0
  54. package/lib/el-tag-87fd3960.cjs +1 -0
  55. package/lib/el-tooltip-0ea8fbf8.cjs +1 -0
  56. package/lib/el-tooltip-4ed993c7.js +1 -0
  57. package/lib/focus-trap-2a734f35.cjs +3 -0
  58. package/lib/focus-trap-6922b96b.js +376 -0
  59. package/lib/index-1508a06b.js +556 -0
  60. package/lib/index-48a9f60d.cjs +1 -0
  61. package/lib/index-657047bb.js +513 -0
  62. package/lib/index-eea0bcb3.cjs +1 -0
  63. package/lib/index.esm-8d9a2abe.js +2432 -0
  64. package/lib/index.esm-94a95a2a.cjs +3 -0
  65. package/lib/raf-5e5c53db.cjs +1 -0
  66. package/lib/raf-fc8a56cf.js +6 -0
  67. package/lib/scroll-bb8039ba.cjs +1 -0
  68. package/lib/scroll-cfdae01b.js +35 -0
  69. package/lib/style.css +1 -1
  70. package/lib/typescript-7ae59c4c.js +4 -0
  71. package/lib/typescript-b63f8e83.cjs +1 -0
  72. package/lib/vnode-a9714179.js +14 -0
  73. package/lib/vnode-abafec9e.cjs +1 -0
  74. package/lib/zh-cn-92978806.js +134 -0
  75. package/lib/zh-cn-d4df7172.cjs +1 -0
  76. package/package.json +3 -3
  77. package/packages/ChartLayout/index.ts +5 -5
  78. package/packages/Dialog/index.ts +5 -5
  79. package/packages/HeatMap/index.ts +5 -5
  80. package/packages/Kline/componentsNew/KlineUtils/index.vue +2 -3
  81. package/packages/LinearLegend/index.ts +5 -5
  82. package/packages/Map/index.ts +5 -5
  83. package/packages/Pagination/index.ts +5 -5
  84. package/packages/Pie/index.ts +5 -5
  85. package/packages/Table/index.ts +5 -5
  86. package/packages/TreeMap/index.ts +5 -5
  87. package/packages/VarietySearch/index.ts +5 -5
  88. package/packages/VirtualTable/index.ts +5 -5
  89. package/vitePlugins/createExportFile.ts +5 -5
  90. package/lib/bundle.umd.cjs +0 -139
@@ -0,0 +1 @@
1
+ "use strict";const t=require("vue"),B=require("./index.esm-94a95a2a.cjs"),E=require("./_plugin-vue_export-helper-f246444f.cjs"),z=require("./bundle.umd-c5698c50.cjs");require("./base-4865d432.cjs");const R=require("./el-select-a50741c1.cjs");require("./el-tag-87fd3960.cjs");require("./el-scrollbar-bc381e35.cjs");const N=require("echarts");require("./_commonjsHelpers-87b0abe8.cjs");require("./index-48a9f60d.cjs");require("./focus-trap-2a734f35.cjs");require("./typescript-b63f8e83.cjs");require("./scroll-bb8039ba.cjs");function M(m){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const A in m)if(A!=="default"){const h=Object.getOwnPropertyDescriptor(m,A);Object.defineProperty(v,A,h.get?h:{enumerable:!0,get:()=>m[A]})}}return v.default=m,Object.freeze(v)}const L=M(N),$=t.defineComponent({__name:"index",setup(m,{expose:v}){let A=!1,h=!0,y=[];const S=(f,u)=>f.length>u?f.slice(f.length-u):f;return v({initTalib:async()=>{if(!A)A=!0,await B.init("./talib.wasm"),h=!1,y.forEach(f=>{f()});else if(h)return new Promise(f=>{y.push(f)})},handleKeyDown:(f,u)=>{let{startValue:o,endValue:d,maxIndex:x}=u;if(f.code==="ArrowLeft"){if(o===0)return;o=o-1,d=d-1}else if(f.code==="ArrowRight"){if(d===x)return;o=o+1,d=d+1}else if(f.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(f.code==="ArrowDown"){const p=Math.min(500,d-o);o=o-p-1}return{startValue:o,endValue:d}},getDataZoomInfoByTime:f=>{const{showStartTime:u,showEndTime:o,xAxisData:d,maxShowDays:x}=f;let p=-1,e=-1,i={};return d.forEach((a,l)=>{const r=a.split(" ")[0];i[r]=i[r]||0,i[r]+=1,new Date(a)>=new Date(u)&&p===-1&&(p=l),new Date(a)<=new Date(o)&&(e=l)}),{startValue:p,endValue:e,maxValueSpan:Math.max(...Object.values(i))*x}},formatDataBySlide:f=>{const{originDrawData:u,addData:o,startTime:d,endTime:x}=f,{mainIndicator:p,mainIndicatorList:e,subIndicator:i,subIndicatorList:a,config:l,timeRange:r}=f,{loadAddCount:D,preLoadCount:F}=l;let _=[],b=[],V=[],w=[];d&&x?(_=o.filter(s=>new Date(s[0])>=new Date(d)&&new Date(s[0])<=new Date(x)),w=[...o]):x?(_=[...o.filter((s,n)=>n>=o.length-D&&new Date(r[0])<=new Date(s[0])&&new Date(s[0])<=new Date(r[1])),...u.originData],w=[...o,...u.originData]):d&&(_=[...u.originData,...o.filter((s,n)=>n>=F&&new Date(r[0])<=new Date(s[0])&&new Date(s[0])<=new Date(r[1]))],w=_),_.forEach((s,n)=>{b.push([s[1],s[4],s[3],s[2],n===0?0:_[n-1][4],s[6]]),V.push(s[0])});let c=[],g=[];const I={time:[],open:[],close:[],high:[],low:[],originData:w};let C=null,q=null;return w.forEach((s,n)=>{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]===_[0][0]&&(C=n),s[0]===_[_.length-1][0]&&(q=n+1)}),c=e.find(({value:s})=>s===p).config.map(s=>{const{calculationFn:n}=s,k={time:[],open:[],close:[],high:[],low:[],originData:[]};return{...s,data:n?n(B.talib,I,k).slice(C,q):[]}}),g=a.find(({value:s})=>s===i).config.reduce((s,n)=>{const{source:k,calculationFn:T}=n;return k==="calculation"?[...s,{...n,data:T?T(B.talib,I).slice(C,q):[]}]:s},[]),{originData:_,candlestickData:b,mainIndicatorData:c,subIndicatorData:g,xAxisData:V,startTime:_[0][0],endTime:_[_.length-1][0],length:_.length}},formatDataByCount:f=>{const{originDrawData:u,addData:o,mainIndicator:d,mainIndicatorList:x,subIndicator:p,subIndicatorList:e,config:i}=f;let a={};const{addCount:l,preLoadCount:r}=i,D=[],F=[],_=[],b=[],V=[];let w=[],c=[];const g=o.filter((n,k)=>(D.push(n[0]),F.push(n[1]),_.push(n[4]),b.push(n[2]),V.push(n[3]),w.push(n[0]),c.push([n[1],n[4],n[3],n[2],k===0?0:o[k-1][4],n[6]]),o.length>=l+r-1?k>=r:!0));w=S(w,g.length),c=S(c,g.length);const I={time:D,open:F,close:_,high:b,low:V,originData:o},q=x.find(n=>n.value===d).config.map(n=>({...n,data:S(n.calculationFn?n.calculationFn(B.talib,I,{time:[],open:[],close:[],high:[],low:[],originData:[]}):[],w.length)}));let s=[];return p&&e&&(s=e.find(k=>k.value===p).config.reduce((k,T)=>T.source==="calculation"?[...k,{...T,data:S(T.calculationFn?T.calculationFn(B.talib,I):[],w.length)}]:k,[])),u.length?a={originData:[...g,...u.originData],xAxisData:[...w,...u.xAxisData],candlestickData:[...c,...u.candlestickData],mainIndicatorData:u.mainIndicatorData.map((n,k)=>({...n,data:[...q[k].data,...n.data]})),subIndicatorData:u.subIndicatorData.map((n,k)=>({...n,data:[...s[k].data,...n.data]}))}:a={originData:g,xAxisData:w,candlestickData:c,mainIndicatorData:q,subIndicatorData:s},a.length=a.xAxisData.length,a.startTime=a.xAxisData[0],a.endTime=a.xAxisData[a.length-1],a},fn:()=>{}}),(f,u)=>null}}),j={class:"kline-tips"},P=t.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(m){return(v,A)=>(t.openBlock(),t.createElementBlock("div",j,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.data,(h,y)=>(t.openBlock(),t.createElementBlock("div",{key:y,class:"kline-tips-item",style:t.normalizeStyle({color:h.color})},t.toDisplayString(h.label)+" "+t.toDisplayString(h.value),5))),128))]))}});const O=E._export_sfc(P,[["__scopeId","data-v-2a02e841"]]),K={class:"kline-tips"},U=t.defineComponent({__name:"index",props:{drawData:{type:Object,require:!0},activeIndex:{type:Number,require:!0}},setup(m){const{round:v,multiply:A,divide:h,subtract:y,formatValue:S}=z.bundle_umdExports.stMath,f=m,u=t.computed(()=>{const{drawData:d,activeIndex:x}=f;if(d.candlestickData&&d.candlestickData[x]){const p=d.candlestickData[x],e=[{label:"开",value:v(p[0])},{label:"高",value:v(p[3])},{label:"低",value:v(p[2])},{label:"收",value:v(p[1])}];p[5]!==void 0&&e.push({label:"额",value:S(p[5])});const i=v(A(h(y(p[1],p[4]),Math.abs(p[4])),100));let a;return i>0?a="red":i<0&&(a="green"),e.push({label:"涨跌",value:`${i}%`,color:a}),e}return[]}),o=t.computed(()=>{var p;const{drawData:d,activeIndex:x}=f;return((p=d==null?void 0:d.mainIndicatorData)==null?void 0:p.map(e=>({label:e.key,value:v(e.data[x]),color:e.color})))||[]});return(d,x)=>(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=E._export_sfc(U,[["__scopeId","data-v-a1302914"]]),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:v,emit:A}){const{round:h}=z.bundle_umdExports.stMath;let y,S;const f=A,u=m,o=t.ref(),d=t.computed({get(){return u.modelValue},set(e){f("update:modelValue",e)}}),x=t.computed(()=>{const{drawData:e,activeIndex:i}=u,a=u.subIndicatorList.find(l=>l.value===d.value);return e.originData&&e.originData[i]?a.config.map(l=>{var D,F;let r="-";return l.source==="origin"?r=e.originData[i][l.dataIndex]||"-":l.source==="calculation"&&(r=(((F=(D=e.subIndicatorData)==null?void 0:D.find(b=>b.key===l.key))==null?void 0:F.data)||[])[i]),{label:l.key,color:l.color,value:r==="-"?r:h(r)}}):[]});t.onMounted(()=>{y=L.init(o.value);let e=!0;S=new ResizeObserver(()=>{if(e){e=null;return}y.resize()}),S.observe(o.value)}),t.onUnmounted(()=>{y.dispose(),S.disconnect(),S=null});const p=(e,i)=>{const a=e[i],l=i===0?e[i]:e[i-1];return a[0]===a[1]?a[0]>=l[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:a[1]>a[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return v({connect:e=>{L.connect([e,y])},draw:e=>{t.nextTick(()=>{var w;const{startValue:i,endValue:a,maxValueSpan:l}=e,{xAxisData:r,subIndicatorData:D,candlestickData:F,originData:_}=u.drawData,b=u.subIndicatorList.find(c=>c.value===d.value),V=[];if(b.series==="bar"){let c=[];b.source==="origin"?c=_.map(g=>g[b.dataIndex]):c=((w=D==null?void 0:D.find(g=>g.key===b.dataIndex))==null?void 0:w.data)||[],V.push({name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:c.map((g,I)=>b.color==="kline"?{value:g,itemStyle:p(F,I)}:b.color==="value"?{value:g,itemStyle:{color:g>=0?"#FF0000":"#00FFFF"}}:{value:g,itemStyle:{color:b.color}})})}D.forEach(c=>{if(c.series==="line"){let g=[];c.source==="origin"?g=_.map(I=>I[c.dataIndex]):c.source==="calculation"&&(g=c.data),V.push({xAxisIndex:0,yAxisIndex:c.yAxis==="right"?2:1,name:c.key,type:"line",silent:!0,symbol:"none",data:g,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:l}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:c=>{const{axisDimension:g,value:I}=c;if(g==="x")return I;if(c.axisIndex===1)return String(h(I))}}},formatter:()=>""},xAxis:{type:"category",data:r,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:V},!0)})}}),(e,i)=>{const a=R.ElOption,l=R.ElSelect;return t.openBlock(),t.createElementBlock("div",Y,[t.createElementVNode("div",H,[x.value.length?(t.openBlock(),t.createElementBlock("div",G,[t.createVNode(l,{modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=r=>d.value=r),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,r=>(t.openBlock(),t.createBlock(a,{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createVNode(O,{data:x.value},null,8,["data"])]),t.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:o},null,512)])}}});const Q=E._export_sfc(J,[["__scopeId","data-v-2ece79b3"]]),W=t.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]}},emits:["change"],setup(m,{expose:v,emit:A}){let h,y,S=null;const f=A,u=m,o=t.ref();t.watch(()=>u.data,()=>{p()},{deep:!0}),t.onMounted(()=>{h=L.init(o.value),d(),p();let e=!0;y=new ResizeObserver(()=>{if(e){e=null;return}h.resize()}),y.observe(o.value)}),t.onUnmounted(()=>{h.off("datazoom"),h.dispose(),y.disconnect(),y=null});const d=()=>{h.on("datazoom",e=>{e.dataZoomId&&(clearTimeout(S),S=setTimeout(()=>{const{data:i}=u,{start:a,end:l}=e,r=Math.floor(a*i.length/100),D=l===100?i.length-1:Math.floor(l*i.length/100);x(r,D),clearTimeout(S)},100))})},x=(e,i)=>{const a=u.data;if(a.length===0)return;const l=a[e][0].split(" ")[0],r=a[i][0].split(" ")[0];f("change",{startTime:`${l} 00:00:00`,endTime:`${r} 24:00:00`})},p=()=>{const{data:e}=u;if(e.length===0)return;const i=e.map(l=>l[0].split(" ")[0]),a=e.map(l=>l[1]);h.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 v({resetSlide:(e,i,a)=>{let l=-1,r=-1;u.data.forEach((D,F)=>{l===-1&&D[0]===e?l=F:l===-1&&new Date(D[0])>new Date(e)&&(l=F-1),(r===-1&&D[0]===i||r===-1&&new Date(D[0])>new Date(i))&&(r=F)}),r=r===-1?u.data.length-1:r,h.setOption({dataZoom:[{show:!0,startValue:l,endValue:r,maxValueSpan:a,textStyle:{color:"#ccc"}},{type:"inside",startValue:l,endValue:r,maxValueSpan:a}]})},resize:()=>{h==null||h.resize()}}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:"klineSlide",ref_key:"slideChartRef",ref:o},null,512))}});const X=E._export_sfc(W,[["__scopeId","data-v-5008746a"]]),ee={install(m){m.component("st-klineUtils",$),m.component("st-klineSub",Q),m.component("st-klineTips",Z),m.component("st-klineSlide",X)}};module.exports=ee;
@@ -0,0 +1,614 @@
1
+ import { defineComponent as E, openBlock as T, createElementBlock as L, Fragment as K, renderList as Z, normalizeStyle as H, toDisplayString as N, computed as $, createVNode as M, ref as j, onMounted as U, onUnmounted as Y, nextTick as J, createElementVNode as P, withCtx as Q, createBlock as W, createCommentVNode as X, watch as ee } from "vue";
2
+ import { i as te, t as z } from "./index.esm-8d9a2abe.js";
3
+ import { _ as O } from "./_plugin-vue_export-helper-dad06003.js";
4
+ import { b as G } from "./bundle.umd-4967d574.js";
5
+ import "./base-a240bf62.js";
6
+ import { E as ae, a as ne } from "./el-select-85ed2643.js";
7
+ import "./el-tag-308f715a.js";
8
+ import "./el-scrollbar-7dc53299.js";
9
+ import * as q from "echarts";
10
+ import "./_commonjsHelpers-10dfc225.js";
11
+ import "./index-1508a06b.js";
12
+ import "./focus-trap-6922b96b.js";
13
+ import "./typescript-7ae59c4c.js";
14
+ import "./scroll-cfdae01b.js";
15
+ const oe = /* @__PURE__ */ E({
16
+ __name: "index",
17
+ setup(w, { expose: A }) {
18
+ let S = !1, f = !0, D = [];
19
+ const y = (p, c) => p.length > c ? p.slice(p.length - c) : p;
20
+ return A({
21
+ // 注册计算指标线方法
22
+ initTalib: async () => {
23
+ if (!S)
24
+ S = !0, await te("./talib.wasm"), f = !1, D.forEach((p) => {
25
+ p();
26
+ });
27
+ else if (f)
28
+ return new Promise((p) => {
29
+ D.push(p);
30
+ });
31
+ },
32
+ // 键盘事件处理
33
+ handleKeyDown: (p, c) => {
34
+ let { startValue: n, endValue: u, maxIndex: g } = c;
35
+ if (p.code === "ArrowLeft") {
36
+ if (n === 0)
37
+ return;
38
+ n = n - 1, u = u - 1;
39
+ } else if (p.code === "ArrowRight") {
40
+ if (u === g)
41
+ return;
42
+ n = n + 1, u = u + 1;
43
+ } else if (p.code === "ArrowUp") {
44
+ if (u - n < 5)
45
+ return;
46
+ const d = Math.floor((u - n) / 2) + 1;
47
+ n = n + d, u - n < 5 && (n = u - 4);
48
+ } else if (p.code === "ArrowDown") {
49
+ const d = Math.min(500, u - n);
50
+ n = n - d - 1;
51
+ }
52
+ return {
53
+ startValue: n,
54
+ endValue: u
55
+ };
56
+ },
57
+ // 根据时间解析dataZoom
58
+ getDataZoomInfoByTime: (p) => {
59
+ const { showStartTime: c, showEndTime: n, xAxisData: u, maxShowDays: g } = p;
60
+ let d = -1, e = -1, r = {};
61
+ return u.forEach((t, i) => {
62
+ const o = t.split(" ")[0];
63
+ 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);
64
+ }), {
65
+ startValue: d,
66
+ endValue: e,
67
+ maxValueSpan: Math.max(...Object.values(r)) * g
68
+ };
69
+ },
70
+ /**
71
+ * @description: 计算绘图数据(拖动轴使用)
72
+ * @returns: {
73
+ * originData, // 原始格式的K线数据 [时间, 开, 高, 低, 收, 交易量, 交易总额]
74
+ * candlestickData, // 整理格式后的K线数据 [开, 收, 低, 高, 昨收, 交易总额]
75
+ * mainIndicatorData, // 主图指标线数据
76
+ * subIndicatorData, // 副图指标线数据
77
+ * xAxisData, // 便捷数据 - K线时间轴
78
+ * startTime, // 便捷数据 - K线首根时间
79
+ * endTime // 便捷数据 - K线末根时间
80
+ * length, // 便捷数据 - K线长度
81
+ * }
82
+ */
83
+ formatDataBySlide: (p) => {
84
+ 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;
85
+ let m = [], _ = [], F = [], v = [];
86
+ u && g ? (m = n.filter((s) => new Date(s[0]) >= new Date(u) && new Date(s[0]) <= new Date(g)), v = [...n]) : g ? (m = [
87
+ ...n.filter((s, a) => a >= n.length - x && new Date(o[0]) <= new Date(s[0]) && new Date(s[0]) <= new Date(o[1])),
88
+ ...c.originData
89
+ ], v = [...n, ...c.originData]) : u && (m = [
90
+ ...c.originData,
91
+ ...n.filter((s, a) => a >= k && new Date(o[0]) <= new Date(s[0]) && new Date(s[0]) <= new Date(o[1]))
92
+ ], v = m), m.forEach((s, a) => {
93
+ _.push([s[1], s[4], s[3], s[2], a === 0 ? 0 : m[a - 1][4], s[6]]), F.push(s[0]);
94
+ });
95
+ let l = [], h = [];
96
+ const b = {
97
+ time: [],
98
+ open: [],
99
+ close: [],
100
+ high: [],
101
+ low: [],
102
+ originData: v
103
+ };
104
+ let R = null, C = null;
105
+ return v.forEach((s, a) => {
106
+ b.time.push(s[0]), b.open.push(s[1]), b.close.push(s[4]), b.high.push(s[2]), b.low.push(s[3]), s[0] === m[0][0] && (R = a), s[0] === m[m.length - 1][0] && (C = a + 1);
107
+ }), l = e.find(({ value: s }) => s === d).config.map((s) => {
108
+ const { calculationFn: a } = s;
109
+ return {
110
+ ...s,
111
+ data: a ? a(z, b, { time: [], open: [], close: [], high: [], low: [], originData: [] }).slice(R, C) : []
112
+ };
113
+ }), h = t.find(({ value: s }) => s === r).config.reduce((s, a) => {
114
+ const { source: I, calculationFn: V } = a;
115
+ return I === "calculation" ? [
116
+ ...s,
117
+ {
118
+ ...a,
119
+ data: V ? V(z, b).slice(R, C) : []
120
+ }
121
+ ] : s;
122
+ }, []), {
123
+ originData: m,
124
+ candlestickData: _,
125
+ mainIndicatorData: l,
126
+ subIndicatorData: h,
127
+ xAxisData: F,
128
+ startTime: m[0][0],
129
+ endTime: m[m.length - 1][0],
130
+ length: m.length
131
+ };
132
+ },
133
+ // 计算绘图数据(根据长度使用)
134
+ formatDataByCount: (p) => {
135
+ const { originDrawData: c, addData: n, mainIndicator: u, mainIndicatorList: g, subIndicator: d, subIndicatorList: e, config: r } = p;
136
+ let t = {};
137
+ const { addCount: i, preLoadCount: o } = r, x = [], k = [], m = [], _ = [], F = [];
138
+ let v = [], l = [];
139
+ 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]), v.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));
140
+ v = y(v, h.length), l = y(l, h.length);
141
+ const b = { time: x, open: k, close: m, high: _, low: F, originData: n }, C = g.find((a) => a.value === u).config.map((a) => ({
142
+ ...a,
143
+ data: y(
144
+ a.calculationFn ? a.calculationFn(z, b, {
145
+ time: [],
146
+ open: [],
147
+ close: [],
148
+ high: [],
149
+ low: [],
150
+ originData: []
151
+ }) : [],
152
+ v.length
153
+ )
154
+ }));
155
+ let s = [];
156
+ return d && e && (s = e.find((I) => I.value === d).config.reduce((I, V) => V.source === "calculation" ? [
157
+ ...I,
158
+ {
159
+ ...V,
160
+ data: y(
161
+ V.calculationFn ? V.calculationFn(z, b) : [],
162
+ v.length
163
+ )
164
+ }
165
+ ] : I, [])), c.length ? t = {
166
+ originData: [...h, ...c.originData],
167
+ // 原数据
168
+ xAxisData: [...v, ...c.xAxisData],
169
+ // 时间数据
170
+ candlestickData: [...l, ...c.candlestickData],
171
+ // k线数据
172
+ mainIndicatorData: c.mainIndicatorData.map((a, I) => ({
173
+ ...a,
174
+ data: [...C[I].data, ...a.data]
175
+ })),
176
+ // 主图指标线数据
177
+ subIndicatorData: c.subIndicatorData.map((a, I) => ({
178
+ ...a,
179
+ data: [...s[I].data, ...a.data]
180
+ }))
181
+ // 副图数据
182
+ } : t = {
183
+ originData: h,
184
+ // 原数据
185
+ xAxisData: v,
186
+ // 时间数据
187
+ candlestickData: l,
188
+ // k线数据
189
+ mainIndicatorData: C,
190
+ // 主图指标线数据
191
+ subIndicatorData: s
192
+ // 副图数据
193
+ }, t.length = t.xAxisData.length, t.startTime = t.xAxisData[0], t.endTime = t.xAxisData[t.length - 1], t;
194
+ },
195
+ fn: () => {
196
+ }
197
+ }), (p, c) => null;
198
+ }
199
+ }), re = { class: "kline-tips" }, ie = /* @__PURE__ */ E({
200
+ __name: "index",
201
+ props: {
202
+ // 提示数据
203
+ data: {
204
+ type: Array,
205
+ require: !0
206
+ }
207
+ },
208
+ setup(w) {
209
+ return (A, S) => (T(), L("div", re, [
210
+ (T(!0), L(K, null, Z(w.data, (f, D) => (T(), L("div", {
211
+ key: D,
212
+ class: "kline-tips-item",
213
+ style: H({ color: f.color })
214
+ }, N(f.label) + " " + N(f.value), 5))), 128))
215
+ ]));
216
+ }
217
+ });
218
+ const B = /* @__PURE__ */ O(ie, [["__scopeId", "data-v-2a02e841"]]), se = { class: "kline-tips" }, le = /* @__PURE__ */ E({
219
+ __name: "index",
220
+ props: {
221
+ // 提示数据
222
+ drawData: {
223
+ type: Object,
224
+ require: !0
225
+ },
226
+ activeIndex: {
227
+ type: Number,
228
+ require: !0
229
+ }
230
+ },
231
+ setup(w) {
232
+ const { round: A, multiply: S, divide: f, subtract: D, formatValue: y } = G.stMath, p = w, c = $(() => {
233
+ const { drawData: u, activeIndex: g } = p;
234
+ if (u.candlestickData && u.candlestickData[g]) {
235
+ const d = u.candlestickData[g], e = [
236
+ { label: "开", value: A(d[0]) },
237
+ { label: "高", value: A(d[3]) },
238
+ { label: "低", value: A(d[2]) },
239
+ { label: "收", value: A(d[1]) }
240
+ ];
241
+ d[5] !== void 0 && e.push({ label: "额", value: y(d[5]) });
242
+ const r = A(S(f(D(d[1], d[4]), Math.abs(d[4])), 100));
243
+ let t;
244
+ return r > 0 ? t = "red" : r < 0 && (t = "green"), e.push({ label: "涨跌", value: `${r}%`, color: t }), e;
245
+ }
246
+ return [];
247
+ }), n = $(() => {
248
+ var d;
249
+ const { drawData: u, activeIndex: g } = p;
250
+ 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 }))) || [];
251
+ });
252
+ return (u, g) => (T(), L("div", se, [
253
+ M(B, { data: c.value }, null, 8, ["data"]),
254
+ M(B, { data: n.value }, null, 8, ["data"])
255
+ ]));
256
+ }
257
+ });
258
+ const ce = /* @__PURE__ */ O(le, [["__scopeId", "data-v-a1302914"]]), ue = { class: "klineSub" }, de = { class: "klineSub-tips" }, pe = {
259
+ key: 0,
260
+ class: "klineSub-tips-select"
261
+ }, fe = /* @__PURE__ */ E({
262
+ __name: "index",
263
+ props: {
264
+ drawData: { type: Object, require: !0 },
265
+ activeIndex: { type: Number, require: !0 },
266
+ modelValue: { type: String, required: !0 },
267
+ // 副图指标
268
+ subIndicatorList: { type: Array, required: !0 },
269
+ // 副图指标列表
270
+ config: { type: Object, require: !0 }
271
+ // 配置
272
+ },
273
+ emits: ["update:modelValue"],
274
+ setup(w, { expose: A, emit: S }) {
275
+ const { round: f } = G.stMath;
276
+ let D, y;
277
+ const p = S, c = w, n = j(), u = $({
278
+ get() {
279
+ return c.modelValue;
280
+ },
281
+ set(e) {
282
+ p("update:modelValue", e);
283
+ }
284
+ }), g = $(() => {
285
+ const { drawData: e, activeIndex: r } = c, t = c.subIndicatorList.find((i) => i.value === u.value);
286
+ return e.originData && e.originData[r] ? t.config.map((i) => {
287
+ var x, k;
288
+ let o = "-";
289
+ 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]), {
290
+ label: i.key,
291
+ color: i.color,
292
+ value: o === "-" ? o : f(o)
293
+ };
294
+ }) : [];
295
+ });
296
+ U(() => {
297
+ D = q.init(n.value);
298
+ let e = !0;
299
+ y = new ResizeObserver(() => {
300
+ if (e) {
301
+ e = null;
302
+ return;
303
+ }
304
+ D.resize();
305
+ }), y.observe(n.value);
306
+ }), Y(() => {
307
+ D.dispose(), y.disconnect(), y = null;
308
+ });
309
+ const d = (e, r) => {
310
+ const t = e[r], i = r === 0 ? e[r] : e[r - 1];
311
+ return t[0] === t[1] ? t[0] >= i[1] ? {
312
+ color: "transparent",
313
+ borderColor: "#FF0000"
314
+ } : {
315
+ color: "#00FFFF"
316
+ } : t[1] > t[0] ? {
317
+ color: "transparent",
318
+ borderColor: "#FF0000"
319
+ } : {
320
+ color: "#00FFFF"
321
+ };
322
+ };
323
+ return A({
324
+ connect: (e) => {
325
+ q.connect([e, D]);
326
+ },
327
+ // 联动
328
+ draw: (e) => {
329
+ J(() => {
330
+ var v;
331
+ 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 = [];
332
+ if (_.series === "bar") {
333
+ let l = [];
334
+ _.source === "origin" ? l = m.map((h) => h[_.dataIndex]) : l = ((v = x == null ? void 0 : x.find((h) => h.key === _.dataIndex)) == null ? void 0 : v.data) || [], F.push({
335
+ name: "subMain",
336
+ xAxisIndex: 0,
337
+ yAxisIndex: 1,
338
+ type: "bar",
339
+ silent: !0,
340
+ symbol: "none",
341
+ data: l.map((h, b) => _.color === "kline" ? {
342
+ value: h,
343
+ itemStyle: d(k, b)
344
+ } : _.color === "value" ? {
345
+ value: h,
346
+ itemStyle: {
347
+ color: h >= 0 ? "#FF0000" : "#00FFFF"
348
+ }
349
+ } : {
350
+ value: h,
351
+ itemStyle: {
352
+ color: _.color
353
+ }
354
+ })
355
+ });
356
+ }
357
+ x.forEach((l) => {
358
+ if (l.series === "line") {
359
+ let h = [];
360
+ l.source === "origin" ? h = m.map((b) => b[l.dataIndex]) : l.source === "calculation" && (h = l.data), F.push({
361
+ xAxisIndex: 0,
362
+ yAxisIndex: l.yAxis === "right" ? 2 : 1,
363
+ name: l.key,
364
+ type: "line",
365
+ silent: !0,
366
+ symbol: "none",
367
+ data: h,
368
+ lineStyle: {
369
+ width: 1
370
+ },
371
+ itemStyle: {
372
+ color: l.color
373
+ }
374
+ });
375
+ }
376
+ }), D.setOption({
377
+ animation: !1,
378
+ grid: {
379
+ left: `${c.config.gridLeft}px`,
380
+ top: "10px",
381
+ right: `${c.config.gridRight}px`,
382
+ bottom: "20px"
383
+ },
384
+ dataZoom: [
385
+ {
386
+ type: "inside",
387
+ startValue: r,
388
+ endValue: t,
389
+ maxValueSpan: i
390
+ }
391
+ ],
392
+ tooltip: {
393
+ trigger: "axis",
394
+ appendToBody: !0,
395
+ confine: !0,
396
+ axisPointer: {
397
+ type: "cross",
398
+ label: {
399
+ rich: {},
400
+ formatter: (l) => {
401
+ const { axisDimension: h, value: b } = l;
402
+ if (h === "x")
403
+ return b;
404
+ if (l.axisIndex === 1)
405
+ return String(f(b));
406
+ }
407
+ }
408
+ },
409
+ formatter: () => ""
410
+ },
411
+ xAxis: {
412
+ type: "category",
413
+ data: o,
414
+ axisLine: {
415
+ show: !0
416
+ },
417
+ splitLine: {
418
+ show: !1
419
+ },
420
+ axisLabel: {
421
+ show: !0,
422
+ formatter: (l) => l
423
+ }
424
+ },
425
+ yAxis: [
426
+ {
427
+ position: "right"
428
+ },
429
+ {
430
+ position: "left",
431
+ min: _.leftYAxisRange === "cover" ? (l) => l.min : null,
432
+ max: _.leftYAxisRange === "cover" ? (l) => l.max : null,
433
+ splitNumber: 1,
434
+ axisLine: {
435
+ show: !0
436
+ },
437
+ splitLine: {
438
+ show: !0,
439
+ lineStyle: {
440
+ type: "dotted",
441
+ color: "#333"
442
+ }
443
+ }
444
+ },
445
+ {
446
+ position: "right",
447
+ min: _.rightYAxisRange === "cover" ? (l) => l.min : null,
448
+ max: _.rightYAxisRange === "cover" ? (l) => l.max : null,
449
+ splitNumber: 1,
450
+ axisLine: {
451
+ show: !1
452
+ },
453
+ splitLine: {
454
+ show: !1
455
+ },
456
+ axisLabel: {
457
+ show: !1
458
+ }
459
+ }
460
+ ],
461
+ series: F
462
+ }, !0);
463
+ });
464
+ }
465
+ // 重置
466
+ }), (e, r) => {
467
+ const t = ae, i = ne;
468
+ return T(), L("div", ue, [
469
+ P("div", de, [
470
+ g.value.length ? (T(), L("div", pe, [
471
+ M(i, {
472
+ modelValue: u.value,
473
+ "onUpdate:modelValue": r[0] || (r[0] = (o) => u.value = o),
474
+ size: "small",
475
+ "popper-class": "element-dark",
476
+ class: "element-dark subIndicator"
477
+ }, {
478
+ default: Q(() => [
479
+ (T(!0), L(K, null, Z(w.subIndicatorList, (o) => (T(), W(t, {
480
+ key: o.value,
481
+ label: o.label,
482
+ value: o.value
483
+ }, null, 8, ["label", "value"]))), 128))
484
+ ]),
485
+ _: 1
486
+ }, 8, ["modelValue"])
487
+ ])) : X("", !0),
488
+ M(B, { data: g.value }, null, 8, ["data"])
489
+ ]),
490
+ P("div", {
491
+ class: "klineSub-chart",
492
+ ref_key: "subChartRef",
493
+ ref: n
494
+ }, null, 512)
495
+ ]);
496
+ };
497
+ }
498
+ });
499
+ const he = /* @__PURE__ */ O(fe, [["__scopeId", "data-v-2ece79b3"]]), me = /* @__PURE__ */ E({
500
+ __name: "index",
501
+ props: {
502
+ data: { type: Array, default: () => [] }
503
+ // 时间数据
504
+ },
505
+ emits: ["change"],
506
+ setup(w, { expose: A, emit: S }) {
507
+ let f, D, y = null;
508
+ const p = S, c = w, n = j();
509
+ ee(
510
+ () => c.data,
511
+ () => {
512
+ d();
513
+ },
514
+ { deep: !0 }
515
+ ), U(() => {
516
+ f = q.init(n.value), u(), d();
517
+ let e = !0;
518
+ D = new ResizeObserver(() => {
519
+ if (e) {
520
+ e = null;
521
+ return;
522
+ }
523
+ f.resize();
524
+ }), D.observe(n.value);
525
+ }), Y(() => {
526
+ f.off("datazoom"), f.dispose(), D.disconnect(), D = null;
527
+ });
528
+ const u = () => {
529
+ f.on("datazoom", (e) => {
530
+ e.dataZoomId && (clearTimeout(y), y = setTimeout(() => {
531
+ 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);
532
+ g(o, x), clearTimeout(y);
533
+ }, 100));
534
+ });
535
+ }, g = (e, r) => {
536
+ const t = c.data;
537
+ if (t.length === 0)
538
+ return;
539
+ const i = t[e][0].split(" ")[0], o = t[r][0].split(" ")[0];
540
+ p("change", {
541
+ startTime: `${i} 00:00:00`,
542
+ endTime: `${o} 24:00:00`
543
+ });
544
+ }, d = () => {
545
+ const { data: e } = c;
546
+ if (e.length === 0)
547
+ return;
548
+ const r = e.map((i) => i[0].split(" ")[0]), t = e.map((i) => i[1]);
549
+ f.setOption({
550
+ grid: {
551
+ height: 0,
552
+ left: "80px",
553
+ right: "80px"
554
+ },
555
+ xAxis: {
556
+ type: "category",
557
+ data: r,
558
+ show: !1
559
+ },
560
+ yAxis: {
561
+ type: "value"
562
+ },
563
+ series: [
564
+ {
565
+ data: t,
566
+ type: "line"
567
+ }
568
+ ]
569
+ }, !0);
570
+ };
571
+ return A({
572
+ resetSlide: (e, r, t) => {
573
+ let i = -1, o = -1;
574
+ c.data.forEach((x, k) => {
575
+ 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);
576
+ }), o = o === -1 ? c.data.length - 1 : o, f.setOption({
577
+ dataZoom: [
578
+ {
579
+ show: !0,
580
+ startValue: i,
581
+ endValue: o,
582
+ maxValueSpan: t,
583
+ textStyle: {
584
+ color: "#ccc"
585
+ }
586
+ },
587
+ {
588
+ type: "inside",
589
+ startValue: i,
590
+ endValue: o,
591
+ maxValueSpan: t
592
+ }
593
+ ]
594
+ });
595
+ },
596
+ // 重置
597
+ resize: () => {
598
+ f == null || f.resize();
599
+ }
600
+ }), (e, r) => (T(), L("div", {
601
+ class: "klineSlide",
602
+ ref_key: "slideChartRef",
603
+ ref: n
604
+ }, null, 512));
605
+ }
606
+ });
607
+ const ge = /* @__PURE__ */ O(me, [["__scopeId", "data-v-5008746a"]]), Le = {
608
+ install(w) {
609
+ w.component("st-klineUtils", oe), w.component("st-klineSub", he), w.component("st-klineTips", ce), w.component("st-klineSlide", ge);
610
+ }
611
+ };
612
+ export {
613
+ Le as default
614
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),g=require("./_plugin-vue_export-helper-f246444f.cjs"),p={class:"linearLegend"},_={key:0,class:"linearLegend-unit"},h={class:"linearLegend-content"},v={class:"linearLegend-content-box"},f={class:"linearLegend-content-number"},k=e.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]},unit:{type:String,default:()=>null}},setup(c,{expose:d}){const r=c,s=e.computed(()=>r.data.reduce((t,n,o)=>o===r.data.length-1?t:n.type==="="?(t[t.length-1].width=2,t):n.range.length===1?[...t,{value:n.range[0],width:1}]:[...t,{value:n.range[1],width:1}],[]));return d({numberToColor:t=>{let n=1;r.unit==="亿"?n=1e8:r.unit==="万"&&(n=1e4);for(let o=0;o<r.data.length;o++){const{type:a,color:u,range:l}=r.data[o];if(a==="="&&t===l[0]*n||a===">"&&t>l[0]*n||a===">="&&t>=l[0]*n||a==="<"&&t<l[0]*n||a==="<="&&t<=l[0]*n||a==="()"&&t>l[0]*n&&t<l[1]*n||a==="(]"&&t>l[0]*n&&t<=l[1]*n||a==="[]"&&t>=l[0]*n&&t<=l[1]*n||a==="[)"&&t>=l[0]*n&&t<l[1]*n)return u}}}),(t,n)=>(e.openBlock(),e.createElementBlock("div",p,[c.unit?(e.openBlock(),e.createElementBlock("div",_,"(单位:"+e.toDisplayString(c.unit)+")",1)):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.createElementVNode("div",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.data,o=>(e.openBlock(),e.createElementBlock("div",{class:"linearLegend-content-box-item",style:e.normalizeStyle({background:o.color})},null,4))),256))]),e.createElementVNode("div",f,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,o=>(e.openBlock(),e.createElementBlock("div",{class:"linearLegend-content-number-item",style:e.normalizeStyle({width:`${o.width*36}px`})},e.toDisplayString(o.value),5))),256))])])]))}});const i=g._export_sfc(k,[["__scopeId","data-v-88fd5500"]]);i.install=c=>{c.component("st-linearLegend",i)};module.exports=i;