st-comp 0.0.208 → 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/ChartLayout.cjs +1 -1
- package/es/ChartLayout.js +74 -1
- package/es/CustomFunction.cjs +1 -1
- package/es/CustomFunction.js +56 -53
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +48 -45
- package/es/HeatMap.cjs +1 -1
- package/es/HeatMap.js +118 -1
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +90 -87
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +28 -25
- package/es/KlineConfig.cjs +1 -1
- package/es/KlineConfig.js +164 -161
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +114 -111
- package/es/KlinePlus.cjs +2 -2
- package/es/KlinePlus.js +183 -180
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +143 -140
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +3 -2
- package/es/Table.cjs +1 -1
- package/es/Table.js +58 -55
- package/es/User.cjs +1 -1
- package/es/User.js +88 -85
- package/es/VarSelectDialog.cjs +2 -2
- package/es/VarSelectDialog.js +56 -53
- package/es/VarietyAutoComplete.cjs +1 -1
- package/es/VarietyAutoComplete.js +17 -15
- package/es/VarietySearch.cjs +10 -10
- package/es/VarietySearch.js +56 -53
- package/es/VarietyTextCopy.cjs +3 -3
- package/es/VarietyTextCopy.js +34 -31
- package/es/VirtualTable.cjs +1 -1
- package/es/VirtualTable.js +106 -103
- package/es/_initCloneObject-52b6a510.cjs +1 -0
- package/es/{_initCloneObject-c477c74d.js → _initCloneObject-eaef9418.js} +26 -25
- package/es/base-a5af3db3.js +288 -0
- package/es/base-ef747d02.cjs +5 -0
- package/es/castArray-35947698.cjs +1 -0
- package/es/{castArray-1eb17278.js → castArray-7741a212.js} +1 -1
- package/es/{config-provider-18c0a68a.cjs → config-provider-a584d81e.cjs} +1 -1
- package/es/{config-provider-49c17381.js → config-provider-b16efd62.js} +6 -6
- package/es/debounce-62f5b6e8.cjs +1 -0
- package/es/{debounce-33406a0d.js → debounce-8d53f4dd.js} +9 -9
- package/es/{dropdown-3f1fe325.cjs → dropdown-071c5d7e.cjs} +1 -1
- package/es/{dropdown-6e7b1df0.js → dropdown-a59bba73.js} +15 -15
- package/es/el-autocomplete-a07e9439.cjs +1 -0
- package/es/{el-autocomplete-87b7f461.js → el-autocomplete-ba808eb6.js} +53 -51
- package/es/{el-button-56624e61.js → el-button-c95adb85.js} +46 -45
- package/es/el-button-eec58cff.cjs +1 -0
- package/es/{el-checkbox-f13560e9.js → el-checkbox-7421ccd3.js} +40 -40
- package/es/{el-checkbox-09f3b57f.cjs → el-checkbox-c25236a6.cjs} +1 -1
- package/es/{el-dialog-1d5f5877.js → el-dialog-41ab8417.js} +10 -9
- package/es/el-dialog-ae86edb8.cjs +1 -0
- package/es/{el-divider-8a4c87e3.cjs → el-divider-4713d74c.cjs} +1 -1
- package/es/{el-divider-1cda1783.js → el-divider-4e059794.js} +1 -1
- package/es/el-empty-1697ded8.cjs +1 -0
- package/es/{el-empty-04682b5d.js → el-empty-33cb66f1.js} +3 -3
- package/es/el-form-item-c3fe189b.cjs +12 -0
- package/es/{el-form-item-505c0b70.js → el-form-item-c53c374d.js} +76 -75
- package/es/{el-input-262851e8.js → el-input-2f75c4ba.js} +85 -84
- package/es/el-input-7fd293af.cjs +1 -0
- package/es/el-input-number-22e21d16.cjs +1 -0
- package/es/{el-input-number-fdac2b86.js → el-input-number-5193fe6d.js} +83 -82
- package/es/{el-loading-3cf7b796.cjs → el-loading-cfd86c15.cjs} +1 -1
- package/es/{el-loading-7440dc64.js → el-loading-f6022062.js} +2 -2
- package/es/el-menu-item-17dc717e.cjs +1 -0
- package/es/{el-menu-item-36c3004c.js → el-menu-item-7e881203.js} +54 -53
- package/es/el-message-5e6a6be9.cjs +1 -0
- package/es/{el-message-box-8f5e34ca.js → el-message-box-a93d2f6a.js} +22 -20
- package/es/el-message-box-c10adb52.cjs +1 -0
- package/es/{el-message-416bd265.js → el-message-e544a8f5.js} +29 -28
- package/es/{el-overlay-04426e36.js → el-overlay-09ad71cd.js} +53 -52
- package/es/el-overlay-9e34965f.cjs +1 -0
- package/es/el-popconfirm-70a976bf.cjs +1 -0
- package/es/{el-popconfirm-3790cda2.js → el-popconfirm-81dcd202.js} +39 -38
- package/es/{el-popper-49152708.js → el-popper-b4f97157.js} +192 -191
- package/es/el-popper-b6c99b28.cjs +1 -0
- package/es/{el-segmented-05509f9d.js → el-segmented-b868d074.js} +13 -12
- package/es/el-segmented-f8fce9ac.cjs +1 -0
- package/es/{el-select-700f3686.js → el-select-95627997.js} +295 -292
- package/es/el-select-d8d91db1.cjs +1 -0
- package/es/{el-table-column-44360700.js → el-table-column-376cd907.js} +57 -54
- package/es/el-table-column-c974cb96.cjs +14 -0
- package/es/{el-tag-55a172c9.js → el-tag-66cab138.js} +31 -30
- package/es/el-tag-a33c4b22.cjs +1 -0
- package/es/{el-text-ab6bfc40.js → el-text-ac60d0f2.js} +4 -4
- package/es/{el-text-5bcaffb6.cjs → el-text-c20a9f48.cjs} +1 -1
- package/es/index-098c2447.cjs +1 -0
- package/es/{index-d8294b1a.cjs → index-11547a0c.cjs} +1 -1
- package/es/{index-0afedcbd.js → index-1f7d4f70.js} +12 -11
- package/es/{index-ae6c9d97.cjs → index-298075cf.cjs} +1 -1
- package/es/{index-4e46f96c.js → index-57672682.js} +13 -12
- package/es/{index-66ad0d6a.js → index-844bdd85.js} +34 -34
- package/es/{index-29418a8d.js → index-88546436.js} +18 -18
- package/es/index-960806da.js +314 -0
- package/es/index-9780a537.cjs +1 -0
- package/es/index-9b9ef5dd.cjs +1 -0
- package/es/{base-aa512893.js → index-a871c3eb.js} +171 -454
- package/es/index-bb833443.cjs +1 -0
- package/es/index-c108567d.cjs +1 -0
- package/es/index-d77a7336.js +204 -0
- package/es/{index-cbbd78b4.js → index-d91dc23f.js} +12 -12
- package/es/index-e5566b94.js +368 -0
- package/es/index-f3562b52.cjs +1 -0
- package/es/{index-882d77d3.cjs → index-f967d6c1.cjs} +1 -1
- package/es/raf-80ef0c0a.js +6 -0
- package/es/{raf-336ef01e.cjs → raf-8249652f.cjs} +1 -1
- package/es/{scroll-0a48995c.js → scroll-679bd6bf.js} +5 -5
- package/es/{scroll-19533c53.cjs → scroll-b108dabd.cjs} +1 -1
- package/es/style.css +1 -1
- package/es/use-form-common-props-815d48a6.js +364 -0
- package/es/use-form-common-props-fd9b61a0.cjs +1 -0
- package/es/use-global-config-30d7d8ce.cjs +1 -0
- package/es/use-global-config-b5e9d3d5.js +72 -0
- package/es/{validator-28b22907.cjs → validator-1b8a6128.cjs} +1 -1
- package/es/{validator-e35f7978.js → validator-764a9db0.js} +1 -1
- package/es/{vnode-b62d0045.js → vnode-5ddb7ed1.js} +1 -1
- package/es/{vnode-8cb31692.cjs → vnode-b906ae6d.cjs} +1 -1
- package/es/{zh-cn-7c8640bb.cjs → zh-cn-90317f62.cjs} +1 -1
- package/es/{zh-cn-346f3a73.js → zh-cn-e963c628.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +105 -105
- package/lib/{index-da0f2951.js → index-e158c3d6.js} +1529 -1529
- package/lib/{python-c0a1e4ef.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/KlineNew/components/KlineTips/index.vue +8 -8
- package/packages/KlinePlus/index.vue +4 -4
- package/src/pages/KlineBasic/api.js +1 -1
- package/es/_initCloneObject-e660897e.cjs +0 -1
- package/es/base-7ba08794.cjs +0 -5
- package/es/castArray-efa457a5.cjs +0 -1
- package/es/debounce-4aa22feb.cjs +0 -1
- package/es/el-autocomplete-609ac86d.cjs +0 -1
- package/es/el-button-08310c06.cjs +0 -1
- package/es/el-dialog-ea480083.cjs +0 -1
- package/es/el-empty-b40fa7ea.cjs +0 -1
- package/es/el-form-item-338ea2f7.cjs +0 -12
- package/es/el-input-b04b5bfc.cjs +0 -1
- package/es/el-input-number-7242c8b5.cjs +0 -1
- package/es/el-menu-item-7aca344e.cjs +0 -1
- package/es/el-message-05cd85bf.cjs +0 -1
- package/es/el-message-box-b7e9917e.cjs +0 -1
- package/es/el-overlay-60bc5a02.cjs +0 -1
- package/es/el-popconfirm-24b622c5.cjs +0 -1
- package/es/el-popper-1dd8f5b4.cjs +0 -1
- package/es/el-segmented-a928d89b.cjs +0 -1
- package/es/el-select-5fd77a96.cjs +0 -1
- package/es/el-table-column-bf3ab2a6.cjs +0 -14
- package/es/el-tag-d59f3463.cjs +0 -1
- package/es/index-3d0bc5da.js +0 -566
- package/es/index-a206f6eb.cjs +0 -1
- package/es/index-b4700d83.cjs +0 -1
- package/es/index-c30cf7f9.cjs +0 -1
- package/es/raf-d8c44079.js +0 -6
- package/es/use-form-common-props-41182853.cjs +0 -1
- package/es/use-form-common-props-4cdda474.js +0 -671
- package/es/use-global-config-7bfbe48c.js +0 -71
- package/es/use-global-config-dc5527e8.cjs +0 -1
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-7ba08794.cjs");require("./el-tag-d59f3463.cjs");const R=require("./el-select-5fd77a96.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./el-popper-1dd8f5b4.cjs");const $=require("echarts");require("./index-c30cf7f9.cjs");require("./use-form-common-props-41182853.cjs");require("./index-ae6c9d97.cjs");require("./index-a206f6eb.cjs");require("./castArray-efa457a5.cjs");require("./index-d8294b1a.cjs");require("./scroll-19533c53.cjs");require("./debounce-4aa22feb.cjs");require("./vnode-8cb31692.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:r,endValue:d,maxIndex:f}=u;if(h.code==="ArrowLeft"){if(r===0)return;r=r-1,d=d-1}else if(h.code==="ArrowRight"){if(d===f)return;r=r+1,d=d+1}else if(h.code==="ArrowUp"){if(d-r<5)return;const p=Math.floor((d-r)/2)+1;r=r+p,d-r<5&&(r=d-4)}else if(h.code==="ArrowDown"){const p=Math.min(500,d-r);r=r-p-1}return{startValue:r,endValue:d}},getDataZoomInfoByTime:h=>{const{showStartTime:u,showEndTime:r,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(r)&&(e=n)}),{startValue:p,endValue:e,maxValueSpan:Math.max(...Object.values(i))*f}},formatDataBySlide:h=>{const{originDrawData:u,addData:r,startTime:d,endTime:f}=h,{mainIndicator:p,mainIndicatorList:e,subIndicator:i,subIndicatorList:a,config:n,timeRange:l}=h,{loadAddCount:b,preLoadCount:F}=n;let m=[],v=[],q=[],k=[];d&&f?(m=r.filter(s=>new Date(s[0])>=new Date(d)&&new Date(s[0])<=new Date(f)),k=[...r]):f?(m=[...r.filter((s,o)=>o>=r.length-b&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1])),...u.originData],k=[...r,...u.originData]):d&&(m=[...u.originData,...r.filter((s,o)=>o>=F&&new Date(l[0])<=new Date(s[0])&&new Date(s[0])<=new Date(l[1]))],k=m),m.forEach((s,o)=>{v.push([s[1],s[4],s[3],s[2],o===0?0:m[o-1][4],s[6]]),q.push(s[0])});let c=[],_=[];const I={time:[],open:[],close:[],high:[],low:[],originData:k};let B=null,T=null;return k.forEach((s,o)=>{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=o),s[0]===m[m.length-1][0]&&(T=o+1)}),c=e.find(({value:s})=>s===p).config.map(s=>{const{calculationFn:o}=s,A={time:[],open:[],close:[],high:[],low:[],originData:[]};return{...s,data:o?o(C.talib,I,A).slice(B,T):[]}}),_=a.find(({value:s})=>s===i).config.reduce((s,o)=>{const{source:A,calculationFn:V}=o;return A==="calculation"?[...s,{...o,data:V?V(C.talib,I).slice(B,T):[]}]:s},[]),{originData:m,candlestickData:v,mainIndicatorData:c,subIndicatorData:_,xAxisData:q,startTime:m[0][0],endTime:m[m.length-1][0],length:m.length}},formatDataByCount:h=>{const{originDrawData:u,addData:r,mainIndicator:d,mainIndicatorList:f,subIndicator:p,subIndicatorList:e,config:i}=h;let a={};const{addCount:n,preLoadCount:l}=i,b=[],F=[],m=[],v=[],q=[];let k=[],c=[];const _=r.filter((o,A)=>(b.push(o[0]),F.push(o[1]),m.push(o[4]),v.push(o[2]),q.push(o[3]),k.push(o[0]),c.push([o[1],o[4],o[3],o[2],A===0?0:r[A-1][4],o[6]]),r.length>=n+l-1?A>=l:!0));k=w(k,_.length),c=w(c,_.length);const I={time:b,open:F,close:m,high:v,low:q,originData:r},T=f.find(o=>o.value===d).config.map(o=>({...o,data:w(o.calculationFn?o.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((o,A)=>({...o,data:[...T[A].data,...o.data]})),subIndicatorData:u.subIndicatorData.map((o,A)=>({...o,data:[...s[A].data,...o.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[]}),r=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:r.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,r=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,F;let l="-";return n.source==="origin"?l=e.originData[i][n.dataIndex]||"-":n.source==="calculation"&&(l=(((F=(b=e.subIndicatorData)==null?void 0:b.find(v=>v.key===n.key))==null?void 0:F.data)||[])[i]),{label:n.key,color:n.color,value:l==="-"?l:g(l)}}):[]});t.onMounted(()=>{y=E.init(r.value);let e=!0;w=new ResizeObserver(()=>{if(e){e=null;return}y.resize()}),w.observe(r.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:F,originData:m}=u.drawData,v=u.subIndicatorList.find(c=>c.value===d.value),q=[];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)||[],q.push({name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:c.map((_,I)=>v.color==="kline"?{value:_,itemStyle:p(F,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),q.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:q},!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:r},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,r=t.ref();t.watch(()=>u.data,()=>{p()},{deep:!0}),t.onMounted(()=>{g=E.init(r.value),d(),p();let e=!0;y=new ResizeObserver(()=>{if(e){e=null;return}g.resize()}),y.observe(r.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,F)=>{n===-1&&b[0]===e?n=F:n===-1&&new Date(b[0])>new Date(e)&&(n=F-1),(l===-1&&b[0]===i||l===-1&&new Date(b[0])>new Date(i))&&(l=F)}),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:r},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;
|
package/es/KlineNew.js
CHANGED
|
@@ -2,36 +2,39 @@ import { defineComponent as R, openBlock as T, createElementBlock as L, Fragment
|
|
|
2
2
|
import { i as te, t as z } from "./index.esm-8d9a2abe.js";
|
|
3
3
|
import { _ as q } from "./_plugin-vue_export-helper-dad06003.js";
|
|
4
4
|
import { x as G } from "./index-7ed0999e.js";
|
|
5
|
-
import "./base-
|
|
6
|
-
import "./el-tag-
|
|
7
|
-
import { E as ae, a as ne } from "./el-select-
|
|
5
|
+
import "./base-a5af3db3.js";
|
|
6
|
+
import "./el-tag-66cab138.js";
|
|
7
|
+
import { E as ae, a as ne } from "./el-select-95627997.js";
|
|
8
8
|
import "./el-scrollbar-323542e7.js";
|
|
9
|
-
import "./el-popper-
|
|
9
|
+
import "./el-popper-b4f97157.js";
|
|
10
10
|
import * as B from "echarts";
|
|
11
|
-
import "./index-
|
|
12
|
-
import "./
|
|
13
|
-
import "./
|
|
14
|
-
import "./index-
|
|
15
|
-
import "./
|
|
16
|
-
import "./index-
|
|
17
|
-
import "./
|
|
18
|
-
import "./
|
|
19
|
-
import "./
|
|
11
|
+
import "./index-e5566b94.js";
|
|
12
|
+
import "./index-960806da.js";
|
|
13
|
+
import "./use-form-common-props-815d48a6.js";
|
|
14
|
+
import "./index-a871c3eb.js";
|
|
15
|
+
import "./index-d77a7336.js";
|
|
16
|
+
import "./index-844bdd85.js";
|
|
17
|
+
import "./index-57672682.js";
|
|
18
|
+
import "./castArray-7741a212.js";
|
|
19
|
+
import "./index-d91dc23f.js";
|
|
20
|
+
import "./scroll-679bd6bf.js";
|
|
21
|
+
import "./debounce-8d53f4dd.js";
|
|
22
|
+
import "./vnode-5ddb7ed1.js";
|
|
20
23
|
const oe = /* @__PURE__ */ R({
|
|
21
24
|
__name: "index",
|
|
22
|
-
setup(
|
|
23
|
-
let S = !1, h = !0,
|
|
24
|
-
const
|
|
25
|
-
return
|
|
25
|
+
setup(w, { expose: A }) {
|
|
26
|
+
let S = !1, h = !0, D = [];
|
|
27
|
+
const b = (f, c) => f.length > c ? f.slice(f.length - c) : f;
|
|
28
|
+
return A({
|
|
26
29
|
// 注册计算指标线方法
|
|
27
30
|
initTalib: async () => {
|
|
28
31
|
if (!S)
|
|
29
|
-
S = !0, await te("./talib.wasm"), h = !1,
|
|
32
|
+
S = !0, await te("./talib.wasm"), h = !1, D.forEach((f) => {
|
|
30
33
|
f();
|
|
31
34
|
});
|
|
32
35
|
else if (h)
|
|
33
36
|
return new Promise((f) => {
|
|
34
|
-
|
|
37
|
+
D.push(f);
|
|
35
38
|
});
|
|
36
39
|
},
|
|
37
40
|
// 键盘事件处理
|
|
@@ -86,42 +89,42 @@ const oe = /* @__PURE__ */ R({
|
|
|
86
89
|
* }
|
|
87
90
|
*/
|
|
88
91
|
formatDataBySlide: (f) => {
|
|
89
|
-
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:
|
|
90
|
-
let g = [], _ = [], F = [],
|
|
91
|
-
u && p ? (g = o.filter((l) => new Date(l[0]) >= new Date(u) && new Date(l[0]) <= new Date(p)),
|
|
92
|
+
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: k } = a;
|
|
93
|
+
let g = [], _ = [], F = [], y = [];
|
|
94
|
+
u && p ? (g = o.filter((l) => new Date(l[0]) >= new Date(u) && new Date(l[0]) <= new Date(p)), y = [...o]) : p ? (g = [
|
|
92
95
|
...o.filter((l, n) => n >= o.length - x && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1])),
|
|
93
96
|
...c.originData
|
|
94
|
-
],
|
|
97
|
+
], y = [...o, ...c.originData]) : u && (g = [
|
|
95
98
|
...c.originData,
|
|
96
|
-
...o.filter((l, n) => n >=
|
|
97
|
-
],
|
|
99
|
+
...o.filter((l, n) => n >= k && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1]))
|
|
100
|
+
], y = g), g.forEach((l, n) => {
|
|
98
101
|
_.push([l[1], l[4], l[3], l[2], n === 0 ? 0 : g[n - 1][4], l[6]]), F.push(l[0]);
|
|
99
102
|
});
|
|
100
103
|
let s = [], m = [];
|
|
101
|
-
const
|
|
104
|
+
const v = {
|
|
102
105
|
time: [],
|
|
103
106
|
open: [],
|
|
104
107
|
close: [],
|
|
105
108
|
high: [],
|
|
106
109
|
low: [],
|
|
107
|
-
originData:
|
|
110
|
+
originData: y
|
|
108
111
|
};
|
|
109
112
|
let E = null, C = null;
|
|
110
|
-
return
|
|
111
|
-
|
|
113
|
+
return y.forEach((l, n) => {
|
|
114
|
+
v.time.push(l[0]), v.open.push(l[1]), v.close.push(l[4]), v.high.push(l[2]), v.low.push(l[3]), l[0] === g[0][0] && (E = n), l[0] === g[g.length - 1][0] && (C = n + 1);
|
|
112
115
|
}), s = e.find(({ value: l }) => l === d).config.map((l) => {
|
|
113
116
|
const { calculationFn: n } = l;
|
|
114
117
|
return {
|
|
115
118
|
...l,
|
|
116
|
-
data: n ? n(z,
|
|
119
|
+
data: n ? n(z, v, { time: [], open: [], close: [], high: [], low: [], originData: [] }).slice(E, C) : []
|
|
117
120
|
};
|
|
118
121
|
}), m = t.find(({ value: l }) => l === i).config.reduce((l, n) => {
|
|
119
|
-
const { source:
|
|
120
|
-
return
|
|
122
|
+
const { source: I, calculationFn: V } = n;
|
|
123
|
+
return I === "calculation" ? [
|
|
121
124
|
...l,
|
|
122
125
|
{
|
|
123
126
|
...n,
|
|
124
|
-
data: V ? V(z,
|
|
127
|
+
data: V ? V(z, v).slice(E, C) : []
|
|
125
128
|
}
|
|
126
129
|
] : l;
|
|
127
130
|
}, []), {
|
|
@@ -139,14 +142,14 @@ const oe = /* @__PURE__ */ R({
|
|
|
139
142
|
formatDataByCount: (f) => {
|
|
140
143
|
const { originDrawData: c, addData: o, mainIndicator: u, mainIndicatorList: p, subIndicator: d, subIndicatorList: e, config: i } = f;
|
|
141
144
|
let t = {};
|
|
142
|
-
const { addCount: a, preLoadCount: r } = i, x = [],
|
|
143
|
-
let
|
|
144
|
-
const m = o.filter((n,
|
|
145
|
-
|
|
146
|
-
const
|
|
145
|
+
const { addCount: a, preLoadCount: r } = i, x = [], k = [], g = [], _ = [], F = [];
|
|
146
|
+
let y = [], s = [];
|
|
147
|
+
const m = o.filter((n, I) => (x.push(n[0]), k.push(n[1]), g.push(n[4]), _.push(n[2]), F.push(n[3]), y.push(n[0]), s.push([n[1], n[4], n[3], n[2], I === 0 ? 0 : o[I - 1][4], n[6]]), o.length >= a + r - 1 ? I >= r : !0));
|
|
148
|
+
y = b(y, m.length), s = b(s, m.length);
|
|
149
|
+
const v = { time: x, open: k, close: g, high: _, low: F, originData: o }, C = p.find((n) => n.value === u).config.map((n) => ({
|
|
147
150
|
...n,
|
|
148
|
-
data:
|
|
149
|
-
n.calculationFn ? n.calculationFn(z,
|
|
151
|
+
data: b(
|
|
152
|
+
n.calculationFn ? n.calculationFn(z, v, {
|
|
150
153
|
time: [],
|
|
151
154
|
open: [],
|
|
152
155
|
close: [],
|
|
@@ -154,40 +157,40 @@ const oe = /* @__PURE__ */ R({
|
|
|
154
157
|
low: [],
|
|
155
158
|
originData: []
|
|
156
159
|
}) : [],
|
|
157
|
-
|
|
160
|
+
y.length
|
|
158
161
|
)
|
|
159
162
|
}));
|
|
160
163
|
let l = [];
|
|
161
|
-
return d && e && (l = e.find((
|
|
162
|
-
...
|
|
164
|
+
return d && e && (l = e.find((I) => I.value === d).config.reduce((I, V) => V.source === "calculation" ? [
|
|
165
|
+
...I,
|
|
163
166
|
{
|
|
164
167
|
...V,
|
|
165
|
-
data:
|
|
166
|
-
V.calculationFn ? V.calculationFn(z,
|
|
167
|
-
|
|
168
|
+
data: b(
|
|
169
|
+
V.calculationFn ? V.calculationFn(z, v) : [],
|
|
170
|
+
y.length
|
|
168
171
|
)
|
|
169
172
|
}
|
|
170
|
-
] :
|
|
173
|
+
] : I, [])), c.length ? t = {
|
|
171
174
|
originData: [...m, ...c.originData],
|
|
172
175
|
// 原数据
|
|
173
|
-
xAxisData: [...
|
|
176
|
+
xAxisData: [...y, ...c.xAxisData],
|
|
174
177
|
// 时间数据
|
|
175
178
|
candlestickData: [...s, ...c.candlestickData],
|
|
176
179
|
// k线数据
|
|
177
|
-
mainIndicatorData: c.mainIndicatorData.map((n,
|
|
180
|
+
mainIndicatorData: c.mainIndicatorData.map((n, I) => ({
|
|
178
181
|
...n,
|
|
179
|
-
data: [...C[
|
|
182
|
+
data: [...C[I].data, ...n.data]
|
|
180
183
|
})),
|
|
181
184
|
// 主图指标线数据
|
|
182
|
-
subIndicatorData: c.subIndicatorData.map((n,
|
|
185
|
+
subIndicatorData: c.subIndicatorData.map((n, I) => ({
|
|
183
186
|
...n,
|
|
184
|
-
data: [...l[
|
|
187
|
+
data: [...l[I].data, ...n.data]
|
|
185
188
|
}))
|
|
186
189
|
// 副图数据
|
|
187
190
|
} : t = {
|
|
188
191
|
originData: m,
|
|
189
192
|
// 原数据
|
|
190
|
-
xAxisData:
|
|
193
|
+
xAxisData: y,
|
|
191
194
|
// 时间数据
|
|
192
195
|
candlestickData: s,
|
|
193
196
|
// k线数据
|
|
@@ -210,10 +213,10 @@ const oe = /* @__PURE__ */ R({
|
|
|
210
213
|
require: !0
|
|
211
214
|
}
|
|
212
215
|
},
|
|
213
|
-
setup(
|
|
214
|
-
return (
|
|
215
|
-
(T(!0), L(K, null, Z(
|
|
216
|
-
key:
|
|
216
|
+
setup(w) {
|
|
217
|
+
return (A, S) => (T(), L("div", re, [
|
|
218
|
+
(T(!0), L(K, null, Z(w.data, (h, D) => (T(), L("div", {
|
|
219
|
+
key: D,
|
|
217
220
|
class: "kline-tips-item",
|
|
218
221
|
style: H({ color: h.color })
|
|
219
222
|
}, N(h.label) + " " + N(h.value), 5))), 128))
|
|
@@ -245,28 +248,28 @@ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), le = { clas
|
|
|
245
248
|
require: !0
|
|
246
249
|
}
|
|
247
250
|
},
|
|
248
|
-
setup(
|
|
249
|
-
const { round:
|
|
251
|
+
setup(w) {
|
|
252
|
+
const { round: A, multiply: S, divide: h, subtract: D, formatValue: b } = G, f = w, c = $(() => {
|
|
250
253
|
const { drawData: u, activeIndex: p, candlestickData: d } = f;
|
|
251
254
|
if (d != null && d.length && d[p]) {
|
|
252
255
|
let e;
|
|
253
256
|
return d[p][6] > 0 ? e = "red" : d[p][6] < 0 && (e = "green"), [
|
|
254
|
-
{ label: "开", value:
|
|
255
|
-
{ label: "高", value:
|
|
256
|
-
{ label: "低", value:
|
|
257
|
-
{ label: "收", value:
|
|
258
|
-
{ label: "额", value:
|
|
259
|
-
{ label: "涨跌", value: `${
|
|
257
|
+
{ label: "开", value: d[p][0] },
|
|
258
|
+
{ label: "高", value: d[p][3] },
|
|
259
|
+
{ label: "低", value: d[p][2] },
|
|
260
|
+
{ label: "收", value: d[p][1] },
|
|
261
|
+
{ label: "额", value: b(d[p][4]) },
|
|
262
|
+
{ label: "涨跌", value: `${A(d[p][6])}%`, color: e }
|
|
260
263
|
];
|
|
261
264
|
} else if (u.candlestickData && u.candlestickData[p]) {
|
|
262
265
|
const e = u.candlestickData[p], i = [
|
|
263
|
-
{ label: "开", value:
|
|
264
|
-
{ label: "高", value:
|
|
265
|
-
{ label: "低", value:
|
|
266
|
-
{ label: "收", value:
|
|
266
|
+
{ label: "开", value: e[0] },
|
|
267
|
+
{ label: "高", value: e[3] },
|
|
268
|
+
{ label: "低", value: e[2] },
|
|
269
|
+
{ label: "收", value: e[1] }
|
|
267
270
|
];
|
|
268
|
-
e[5] !== void 0 && i.push({ label: "额", value:
|
|
269
|
-
const t =
|
|
271
|
+
e[5] !== void 0 && i.push({ label: "额", value: b(e[5]) });
|
|
272
|
+
const t = A(S(h(D(e[1], e[4]), Math.abs(e[4])), 100));
|
|
270
273
|
let a;
|
|
271
274
|
return t > 0 ? a = "red" : t < 0 && (a = "green"), i.push({ label: "涨跌", value: `${t}%`, color: a }), i;
|
|
272
275
|
}
|
|
@@ -274,7 +277,7 @@ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), le = { clas
|
|
|
274
277
|
}), o = $(() => {
|
|
275
278
|
var d;
|
|
276
279
|
const { drawData: u, activeIndex: p } = f;
|
|
277
|
-
return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value:
|
|
280
|
+
return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value: A(e.data[p]), color: e.color }))) || [];
|
|
278
281
|
});
|
|
279
282
|
return (u, p) => (T(), L("div", le, [
|
|
280
283
|
O(M, { data: c.value }, null, 8, ["data"]),
|
|
@@ -282,7 +285,7 @@ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), le = { clas
|
|
|
282
285
|
]));
|
|
283
286
|
}
|
|
284
287
|
});
|
|
285
|
-
const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-
|
|
288
|
+
const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-e75a1234"]]), ue = { class: "klineSub" }, de = { class: "klineSub-tips" }, pe = {
|
|
286
289
|
key: 0,
|
|
287
290
|
class: "klineSub-tips-select"
|
|
288
291
|
}, fe = /* @__PURE__ */ R({
|
|
@@ -298,10 +301,10 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
298
301
|
// 配置
|
|
299
302
|
},
|
|
300
303
|
emits: ["update:modelValue"],
|
|
301
|
-
setup(
|
|
304
|
+
setup(w, { expose: A, emit: S }) {
|
|
302
305
|
const { round: h } = G;
|
|
303
|
-
let
|
|
304
|
-
const f = S, c =
|
|
306
|
+
let D, b;
|
|
307
|
+
const f = S, c = w, o = j(), u = $({
|
|
305
308
|
get() {
|
|
306
309
|
return c.modelValue;
|
|
307
310
|
},
|
|
@@ -311,9 +314,9 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
311
314
|
}), p = $(() => {
|
|
312
315
|
const { drawData: e, activeIndex: i } = c, t = c.subIndicatorList.find((a) => a.value === u.value);
|
|
313
316
|
return e.originData && e.originData[i] ? t.config.map((a) => {
|
|
314
|
-
var x,
|
|
317
|
+
var x, k;
|
|
315
318
|
let r = "-";
|
|
316
|
-
return a.source === "origin" ? r = e.originData[i][a.dataIndex] || "-" : a.source === "calculation" && (r = (((
|
|
319
|
+
return a.source === "origin" ? r = e.originData[i][a.dataIndex] || "-" : a.source === "calculation" && (r = (((k = (x = e.subIndicatorData) == null ? void 0 : x.find((_) => _.key === a.key)) == null ? void 0 : k.data) || [])[i]), {
|
|
317
320
|
label: a.key,
|
|
318
321
|
color: a.color,
|
|
319
322
|
value: r === "-" ? r : h(r)
|
|
@@ -321,17 +324,17 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
321
324
|
}) : [];
|
|
322
325
|
});
|
|
323
326
|
U(() => {
|
|
324
|
-
|
|
327
|
+
D = B.init(o.value);
|
|
325
328
|
let e = !0;
|
|
326
|
-
|
|
329
|
+
b = new ResizeObserver(() => {
|
|
327
330
|
if (e) {
|
|
328
331
|
e = null;
|
|
329
332
|
return;
|
|
330
333
|
}
|
|
331
|
-
|
|
332
|
-
}),
|
|
334
|
+
D.resize();
|
|
335
|
+
}), b.observe(o.value);
|
|
333
336
|
}), Y(() => {
|
|
334
|
-
|
|
337
|
+
D.dispose(), b.disconnect(), b = null;
|
|
335
338
|
});
|
|
336
339
|
const d = (e, i) => {
|
|
337
340
|
const t = e[i], a = i === 0 ? e[i] : e[i - 1];
|
|
@@ -347,27 +350,27 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
347
350
|
color: "#00FFFF"
|
|
348
351
|
};
|
|
349
352
|
};
|
|
350
|
-
return
|
|
353
|
+
return A({
|
|
351
354
|
connect: (e) => {
|
|
352
|
-
B.connect([e,
|
|
355
|
+
B.connect([e, D]);
|
|
353
356
|
},
|
|
354
357
|
// 联动
|
|
355
358
|
draw: (e) => {
|
|
356
359
|
J(() => {
|
|
357
|
-
var
|
|
358
|
-
const { startValue: i, endValue: t, maxValueSpan: a } = e, { xAxisData: r, subIndicatorData: x, candlestickData:
|
|
360
|
+
var y;
|
|
361
|
+
const { startValue: i, endValue: t, maxValueSpan: a } = e, { xAxisData: r, subIndicatorData: x, candlestickData: k, originData: g } = c.drawData, _ = c.subIndicatorList.find((s) => s.value === u.value), F = [];
|
|
359
362
|
if (_.series === "bar") {
|
|
360
363
|
let s = [];
|
|
361
|
-
_.source === "origin" ? s = g.map((m) => m[_.dataIndex]) : s = ((
|
|
364
|
+
_.source === "origin" ? s = g.map((m) => m[_.dataIndex]) : s = ((y = x == null ? void 0 : x.find((m) => m.key === _.dataIndex)) == null ? void 0 : y.data) || [], F.push({
|
|
362
365
|
name: "subMain",
|
|
363
366
|
xAxisIndex: 0,
|
|
364
367
|
yAxisIndex: 1,
|
|
365
368
|
type: "bar",
|
|
366
369
|
silent: !0,
|
|
367
370
|
symbol: "none",
|
|
368
|
-
data: s.map((m,
|
|
371
|
+
data: s.map((m, v) => _.color === "kline" ? {
|
|
369
372
|
value: m,
|
|
370
|
-
itemStyle: d(
|
|
373
|
+
itemStyle: d(k, v)
|
|
371
374
|
} : _.color === "value" ? {
|
|
372
375
|
value: m,
|
|
373
376
|
itemStyle: {
|
|
@@ -384,7 +387,7 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
384
387
|
x.forEach((s) => {
|
|
385
388
|
if (s.series === "line") {
|
|
386
389
|
let m = [];
|
|
387
|
-
s.source === "origin" ? m = g.map((
|
|
390
|
+
s.source === "origin" ? m = g.map((v) => v[s.dataIndex]) : s.source === "calculation" && (m = s.data), F.push({
|
|
388
391
|
xAxisIndex: 0,
|
|
389
392
|
yAxisIndex: s.yAxis === "right" ? 2 : 1,
|
|
390
393
|
name: s.key,
|
|
@@ -400,7 +403,7 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
400
403
|
}
|
|
401
404
|
});
|
|
402
405
|
}
|
|
403
|
-
}),
|
|
406
|
+
}), D.setOption(
|
|
404
407
|
{
|
|
405
408
|
animation: !1,
|
|
406
409
|
grid: {
|
|
@@ -426,11 +429,11 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
426
429
|
label: {
|
|
427
430
|
rich: {},
|
|
428
431
|
formatter: (s) => {
|
|
429
|
-
const { axisDimension: m, value:
|
|
432
|
+
const { axisDimension: m, value: v } = s;
|
|
430
433
|
if (m === "x")
|
|
431
|
-
return
|
|
434
|
+
return v;
|
|
432
435
|
if (s.axisIndex === 1)
|
|
433
|
-
return String(h(
|
|
436
|
+
return String(h(v));
|
|
434
437
|
}
|
|
435
438
|
}
|
|
436
439
|
},
|
|
@@ -506,7 +509,7 @@ const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { cla
|
|
|
506
509
|
class: "element-dark subIndicator"
|
|
507
510
|
}, {
|
|
508
511
|
default: Q(() => [
|
|
509
|
-
(T(!0), L(K, null, Z(
|
|
512
|
+
(T(!0), L(K, null, Z(w.subIndicatorList, (r) => (T(), W(t, {
|
|
510
513
|
key: r.value,
|
|
511
514
|
label: r.label,
|
|
512
515
|
value: r.value
|
|
@@ -533,9 +536,9 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
533
536
|
// 时间数据
|
|
534
537
|
},
|
|
535
538
|
emits: ["change"],
|
|
536
|
-
setup(
|
|
537
|
-
let h,
|
|
538
|
-
const f = S, c =
|
|
539
|
+
setup(w, { expose: A, emit: S }) {
|
|
540
|
+
let h, D, b = null;
|
|
541
|
+
const f = S, c = w, o = j();
|
|
539
542
|
ee(
|
|
540
543
|
() => c.data,
|
|
541
544
|
() => {
|
|
@@ -545,21 +548,21 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
545
548
|
), U(() => {
|
|
546
549
|
h = B.init(o.value), u(), d();
|
|
547
550
|
let e = !0;
|
|
548
|
-
|
|
551
|
+
D = new ResizeObserver(() => {
|
|
549
552
|
if (e) {
|
|
550
553
|
e = null;
|
|
551
554
|
return;
|
|
552
555
|
}
|
|
553
556
|
h.resize();
|
|
554
|
-
}),
|
|
557
|
+
}), D.observe(o.value);
|
|
555
558
|
}), Y(() => {
|
|
556
|
-
h.off("datazoom"), h.dispose(),
|
|
559
|
+
h.off("datazoom"), h.dispose(), D.disconnect(), D = null;
|
|
557
560
|
});
|
|
558
561
|
const u = () => {
|
|
559
562
|
h.on("datazoom", (e) => {
|
|
560
|
-
e.dataZoomId && (clearTimeout(
|
|
563
|
+
e.dataZoomId && (clearTimeout(b), b = setTimeout(() => {
|
|
561
564
|
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);
|
|
562
|
-
p(r, x), clearTimeout(
|
|
565
|
+
p(r, x), clearTimeout(b);
|
|
563
566
|
}, 100));
|
|
564
567
|
});
|
|
565
568
|
}, p = (e, i) => {
|
|
@@ -598,11 +601,11 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
598
601
|
]
|
|
599
602
|
}, !0);
|
|
600
603
|
};
|
|
601
|
-
return
|
|
604
|
+
return A({
|
|
602
605
|
resetSlide: (e, i, t) => {
|
|
603
606
|
let a = -1, r = -1;
|
|
604
|
-
c.data.forEach((x,
|
|
605
|
-
a === -1 && x[0] === e ? a =
|
|
607
|
+
c.data.forEach((x, k) => {
|
|
608
|
+
a === -1 && x[0] === e ? a = k : a === -1 && new Date(x[0]) > new Date(e) && (a = k - 1), (r === -1 && x[0] === i || r === -1 && new Date(x[0]) > new Date(i)) && (r = k);
|
|
606
609
|
}), r = r === -1 ? c.data.length - 1 : r, h.setOption({
|
|
607
610
|
dataZoom: [
|
|
608
611
|
{
|
|
@@ -634,11 +637,11 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
634
637
|
}, null, 512));
|
|
635
638
|
}
|
|
636
639
|
});
|
|
637
|
-
const ge = /* @__PURE__ */ q(me, [["__scopeId", "data-v-5008746a"]]),
|
|
638
|
-
install(
|
|
639
|
-
|
|
640
|
+
const ge = /* @__PURE__ */ q(me, [["__scopeId", "data-v-5008746a"]]), qe = {
|
|
641
|
+
install(w) {
|
|
642
|
+
w.component("st-klineUtils", oe), w.component("st-klineSub", he), w.component("st-klineTips", ce), w.component("st-klineSlide", ge);
|
|
640
643
|
}
|
|
641
644
|
};
|
|
642
645
|
export {
|
|
643
|
-
|
|
646
|
+
qe as default
|
|
644
647
|
};
|