st-comp 0.0.13 → 0.0.15
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/lib/bundle.js +1025 -1017
- package/lib/bundle.umd.cjs +1 -1
- package/package.json +1 -1
- package/packages/Table/components/Button/index.vue +7 -0
- package/packages/Table/index.vue +37 -24
- package/src/pages/ChartLayout/index.vue +22 -22
package/lib/bundle.umd.cjs
CHANGED
|
@@ -35,4 +35,4 @@ usage: app.provide(ID_INJECTION_KEY, {
|
|
|
35
35
|
`).forEach(function(s){l=s.indexOf(":"),o=s.substring(0,l).trim().toLowerCase(),r=s.substring(l+1).trim(),!(!o||t[o]&&yv[o])&&(o==="set-cookie"?t[o]?t[o].push(r):t[o]=[r]:t[o]=t[o]?t[o]+", "+r:r)}),t},ou=Symbol("internals");function so(e){return e&&String(e).trim().toLowerCase()}function cr(e){return e===!1||e==null?e:M.isArray(e)?e.map(cr):String(e)}function wv(e){const t=Object.create(null),o=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=o.exec(e);)t[r[1]]=r[2];return t}const Cv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Gl(e,t,o,r,l){if(M.isFunction(r))return r.call(this,t,o);if(l&&(t=o),!!M.isString(t)){if(M.isString(r))return t.indexOf(r)!==-1;if(M.isRegExp(r))return r.test(t)}}function Sv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,o,r)=>o.toUpperCase()+r)}function Ev(e,t){const o=M.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+o,{value:function(l,a,s){return this[r].call(this,t,l,a,s)},configurable:!0})})}class ur{constructor(t){t&&this.set(t)}set(t,o,r){const l=this;function a(i,c,u){const d=so(c);if(!d)throw new Error("header name must be a non-empty string");const f=M.findKey(l,d);(!f||l[f]===void 0||u===!0||u===void 0&&l[f]!==!1)&&(l[f||c]=cr(i))}const s=(i,c)=>M.forEach(i,(u,d)=>a(u,d,c));return M.isPlainObject(t)||t instanceof this.constructor?s(t,o):M.isString(t)&&(t=t.trim())&&!Cv(t)?s(bv(t),o):t!=null&&a(o,t,r),this}get(t,o){if(t=so(t),t){const r=M.findKey(this,t);if(r){const l=this[r];if(!o)return l;if(o===!0)return wv(l);if(M.isFunction(o))return o.call(this,l,r);if(M.isRegExp(o))return o.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,o){if(t=so(t),t){const r=M.findKey(this,t);return!!(r&&this[r]!==void 0&&(!o||Gl(this,this[r],r,o)))}return!1}delete(t,o){const r=this;let l=!1;function a(s){if(s=so(s),s){const i=M.findKey(r,s);i&&(!o||Gl(r,r[i],i,o))&&(delete r[i],l=!0)}}return M.isArray(t)?t.forEach(a):a(t),l}clear(t){const o=Object.keys(this);let r=o.length,l=!1;for(;r--;){const a=o[r];(!t||Gl(this,this[a],a,t,!0))&&(delete this[a],l=!0)}return l}normalize(t){const o=this,r={};return M.forEach(this,(l,a)=>{const s=M.findKey(r,a);if(s){o[s]=cr(l),delete o[a];return}const i=t?Sv(a):String(a).trim();i!==a&&delete o[a],o[i]=cr(l),r[i]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const o=Object.create(null);return M.forEach(this,(r,l)=>{r!=null&&r!==!1&&(o[l]=t&&M.isArray(r)?r.join(", "):r)}),o}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,o])=>t+": "+o).join(`
|
|
36
36
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...o){const r=new this(t);return o.forEach(l=>r.set(l)),r}static accessor(t){const r=(this[ou]=this[ou]={accessors:{}}).accessors,l=this.prototype;function a(s){const i=so(s);r[i]||(Ev(l,s),r[i]=!0)}return M.isArray(t)?t.forEach(a):a(t),this}}ur.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),M.reduceDescriptors(ur.prototype,({value:e},t)=>{let o=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[o]=r}}}),M.freezeMethods(ur);const Nt=ur;function Jl(e,t){const o=this||Yl,r=t||o,l=Nt.from(r.headers);let a=r.data;return M.forEach(e,function(i){a=i.call(o,a,l.normalize(),t?t.status:void 0)}),l.normalize(),a}function ru(e){return!!(e&&e.__CANCEL__)}function io(e,t,o){ae.call(this,e??"canceled",ae.ERR_CANCELED,t,o),this.name="CanceledError"}M.inherits(io,ae,{__CANCEL__:!0});function vv(e,t,o){const r=o.config.validateStatus;!o.status||!r||r(o.status)?e(o):t(new ae("Request failed with status code "+o.status,[ae.ERR_BAD_REQUEST,ae.ERR_BAD_RESPONSE][Math.floor(o.status/100)-4],o.config,o.request,o))}const kv=wt.isStandardBrowserEnv?function(){return{write:function(o,r,l,a,s,i){const c=[];c.push(o+"="+encodeURIComponent(r)),M.isNumber(l)&&c.push("expires="+new Date(l).toGMTString()),M.isString(a)&&c.push("path="+a),M.isString(s)&&c.push("domain="+s),i===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(o){const r=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(o){this.write(o,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function xv(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Tv(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function lu(e,t){return e&&!xv(t)?Tv(e,t):t}const _v=wt.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");let r;function l(a){let s=a;return t&&(o.setAttribute("href",s),s=o.href),o.setAttribute("href",s),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:o.pathname.charAt(0)==="/"?o.pathname:"/"+o.pathname}}return r=l(window.location.href),function(s){const i=M.isString(s)?l(s):s;return i.protocol===r.protocol&&i.host===r.host}}():function(){return function(){return!0}}();function Bv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ov(e,t){e=e||10;const o=new Array(e),r=new Array(e);let l=0,a=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[a];s||(s=u),o[l]=c,r[l]=u;let f=a,h=0;for(;f!==l;)h+=o[f++],f=f%e;if(l=(l+1)%e,l===a&&(a=(a+1)%e),u-s<t)return;const g=d&&u-d;return g?Math.round(h*1e3/g):void 0}}function au(e,t){let o=0;const r=Ov(50,250);return l=>{const a=l.loaded,s=l.lengthComputable?l.total:void 0,i=a-o,c=r(i),u=a<=s;o=a;const d={loaded:a,total:s,progress:s?a/s:void 0,bytes:i,rate:c||void 0,estimated:c&&s&&u?(s-a)/c:void 0,event:l};d[t?"download":"upload"]=!0,e(d)}}const Xl={http:ov,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(o,r){let l=e.data;const a=Nt.from(e.headers).normalize(),s=e.responseType;let i;function c(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}let u;M.isFormData(l)&&(wt.isStandardBrowserEnv||wt.isStandardBrowserWebWorkerEnv?a.setContentType(!1):a.getContentType(/^\s*multipart\/form-data/)?M.isString(u=a.getContentType())&&a.setContentType(u.replace(/^\s*(multipart\/form-data);+/,"$1")):a.setContentType("multipart/form-data"));let d=new XMLHttpRequest;if(e.auth){const m=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.set("Authorization","Basic "+btoa(m+":"+p))}const f=lu(e.baseURL,e.url);d.open(e.method.toUpperCase(),Qc(f,e.params,e.paramsSerializer),!0),d.timeout=e.timeout;function h(){if(!d)return;const m=Nt.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),y={data:!s||s==="text"||s==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:m,config:e,request:d};vv(function(C){o(C),c()},function(C){r(C),c()},y),d=null}if("onloadend"in d?d.onloadend=h:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(h)},d.onabort=function(){d&&(r(new ae("Request aborted",ae.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new ae("Network Error",ae.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let p=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const y=e.transitional||tu;e.timeoutErrorMessage&&(p=e.timeoutErrorMessage),r(new ae(p,y.clarifyTimeoutError?ae.ETIMEDOUT:ae.ECONNABORTED,e,d)),d=null},wt.isStandardBrowserEnv){const m=(e.withCredentials||_v(f))&&e.xsrfCookieName&&kv.read(e.xsrfCookieName);m&&a.set(e.xsrfHeaderName,m)}l===void 0&&a.setContentType(null),"setRequestHeader"in d&&M.forEach(a.toJSON(),function(p,y){d.setRequestHeader(y,p)}),M.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),s&&s!=="json"&&(d.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&d.addEventListener("progress",au(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",au(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=m=>{d&&(r(!m||m.type?new io(null,e,d):m),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const g=Bv(f);if(g&&wt.protocols.indexOf(g)===-1){r(new ae("Unsupported protocol "+g+":",ae.ERR_BAD_REQUEST,e));return}d.send(l||null)})}};M.forEach(Xl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const su=e=>`- ${e}`,$v=e=>M.isFunction(e)||e===null||e===!1,iu={getAdapter:e=>{e=M.isArray(e)?e:[e];const{length:t}=e;let o,r;const l={};for(let a=0;a<t;a++){o=e[a];let s;if(r=o,!$v(o)&&(r=Xl[(s=String(o)).toLowerCase()],r===void 0))throw new ae(`Unknown adapter '${s}'`);if(r)break;l[s||"#"+a]=r}if(!r){const a=Object.entries(l).map(([i,c])=>`adapter ${i} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=t?a.length>1?`since :
|
|
37
37
|
`+a.map(su).join(`
|
|
38
|
-
`):" "+su(a[0]):"as no adapter specified";throw new ae("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Xl};function Zl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new io(null,e)}function cu(e){return Zl(e),e.headers=Nt.from(e.headers),e.data=Jl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),iu.getAdapter(e.adapter||Yl.adapter)(e).then(function(r){return Zl(e),r.data=Jl.call(e,e.transformResponse,r),r.headers=Nt.from(r.headers),r},function(r){return ru(r)||(Zl(e),r&&r.response&&(r.response.data=Jl.call(e,e.transformResponse,r.response),r.response.headers=Nt.from(r.response.headers))),Promise.reject(r)})}const uu=e=>e instanceof Nt?e.toJSON():e;function Rn(e,t){t=t||{};const o={};function r(u,d,f){return M.isPlainObject(u)&&M.isPlainObject(d)?M.merge.call({caseless:f},u,d):M.isPlainObject(d)?M.merge({},d):M.isArray(d)?d.slice():d}function l(u,d,f){if(M.isUndefined(d)){if(!M.isUndefined(u))return r(void 0,u,f)}else return r(u,d,f)}function a(u,d){if(!M.isUndefined(d))return r(void 0,d)}function s(u,d){if(M.isUndefined(d)){if(!M.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function i(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:i,headers:(u,d)=>l(uu(u),uu(d),!0)};return M.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||l,h=f(e[d],t[d],d);M.isUndefined(h)&&f!==i||(o[d]=h)}),o}const du="1.5.1",Ql={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ql[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const fu={};Ql.transitional=function(t,o,r){function l(a,s){return"[Axios v"+du+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return(a,s,i)=>{if(t===!1)throw new ae(l(s," has been removed"+(o?" in "+o:"")),ae.ERR_DEPRECATED);return o&&!fu[s]&&(fu[s]=!0,console.warn(l(s," has been deprecated since v"+o+" and will be removed in the near future"))),t?t(a,s,i):!0}};function Nv(e,t,o){if(typeof e!="object")throw new ae("options must be an object",ae.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let l=r.length;for(;l-- >0;){const a=r[l],s=t[a];if(s){const i=e[a],c=i===void 0||s(i,a,e);if(c!==!0)throw new ae("option "+a+" must be "+c,ae.ERR_BAD_OPTION_VALUE);continue}if(o!==!0)throw new ae("Unknown option "+a,ae.ERR_BAD_OPTION)}}const ea={assertOptions:Nv,validators:Ql},qt=ea.validators;class dr{constructor(t){this.defaults=t,this.interceptors={request:new eu,response:new eu}}request(t,o){typeof t=="string"?(o=o||{},o.url=t):o=t||{},o=Rn(this.defaults,o);const{transitional:r,paramsSerializer:l,headers:a}=o;r!==void 0&&ea.assertOptions(r,{silentJSONParsing:qt.transitional(qt.boolean),forcedJSONParsing:qt.transitional(qt.boolean),clarifyTimeoutError:qt.transitional(qt.boolean)},!1),l!=null&&(M.isFunction(l)?o.paramsSerializer={serialize:l}:ea.assertOptions(l,{encode:qt.function,serialize:qt.function},!0)),o.method=(o.method||this.defaults.method||"get").toLowerCase();let s=a&&M.merge(a.common,a[o.method]);a&&M.forEach(["delete","get","head","post","put","patch","common"],m=>{delete a[m]}),o.headers=Nt.concat(s,a);const i=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(o)===!1||(c=c&&p.synchronous,i.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[cu.bind(this),void 0];for(m.unshift.apply(m,i),m.push.apply(m,u),h=m.length,d=Promise.resolve(o);f<h;)d=d.then(m[f++],m[f++]);return d}h=i.length;let g=o;for(f=0;f<h;){const m=i[f++],p=i[f++];try{g=m(g)}catch(y){p.call(this,y);break}}try{d=cu.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Rn(this.defaults,t);const o=lu(t.baseURL,t.url);return Qc(o,t.params,t.paramsSerializer)}}M.forEach(["delete","get","head","options"],function(t){dr.prototype[t]=function(o,r){return this.request(Rn(r||{},{method:t,url:o,data:(r||{}).data}))}}),M.forEach(["post","put","patch"],function(t){function o(r){return function(a,s,i){return this.request(Rn(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:s}))}}dr.prototype[t]=o(),dr.prototype[t+"Form"]=o(!0)});const fr=dr;class ta{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let o;this.promise=new Promise(function(a){o=a});const r=this;this.promise.then(l=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](l);r._listeners=null}),this.promise.then=l=>{let a;const s=new Promise(i=>{r.subscribe(i),a=i}).then(l);return s.cancel=function(){r.unsubscribe(a)},s},t(function(a,s,i){r.reason||(r.reason=new io(a,s,i),o(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const o=this._listeners.indexOf(t);o!==-1&&this._listeners.splice(o,1)}static source(){let t;return{token:new ta(function(l){t=l}),cancel:t}}}const Av=ta;function Pv(e){return function(o){return e.apply(null,o)}}function Rv(e){return M.isObject(e)&&e.isAxiosError===!0}const na={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(na).forEach(([e,t])=>{na[t]=e});const Mv=na;function pu(e){const t=new fr(e),o=Ic(fr.prototype.request,t);return M.extend(o,fr.prototype,t,{allOwnKeys:!0}),M.extend(o,t,null,{allOwnKeys:!0}),o.create=function(l){return pu(Rn(e,l))},o}const ye=pu(Yl);ye.Axios=fr,ye.CanceledError=io,ye.CancelToken=Av,ye.isCancel=ru,ye.VERSION=du,ye.toFormData=ir,ye.AxiosError=ae,ye.Cancel=ye.CanceledError,ye.all=function(t){return Promise.all(t)},ye.spread=Pv,ye.isAxiosError=Rv,ye.mergeConfig=Rn,ye.AxiosHeaders=Nt,ye.formToJSON=e=>nu(M.isHTMLForm(e)?new FormData(e):e),ye.getAdapter=iu.getAdapter,ye.HttpStatusCode=Mv,ye.default=ye;const oa=ye,Lv=async(e,t,o,r)=>{let l=On(o).format("YYYY-MM-DD HH:mm:ss");return oa(`http://116.62.161.92:8005/history_kline?code=${e}&bar_count=${t}&dt=${l}&frequency=${r}`)},Iv=()=>oa("http://116.62.161.92:8005/get_indicator"),Dv=(e,t,o,r,l)=>oa(`http://116.62.161.92:8005/realtime_indicator?code=${e}&start_date=${t}&end_date=${o}&indicator=${l}&frequency=${r}`),tt=e=>e||e===0?Math.round(e*1e3)/1e3:null,zv=e=>e>=1e12?`${(e/1e12).toFixed(2)}万亿`:e>=1e8?`${(e/1e8).toFixed(2)}亿`:e>=1e4?`${(e/1e4).toFixed(2)}万`:e.toFixed(2),Fv=async e=>{const{kLineData:t,indicatorData:o,indicator:r,indicatorConfigList:l,defaultShowBarCount:a}=e,s=[],i=[],c=t.length;t.forEach(f=>{s.push([tt(f[1]),tt(f[4]),tt(f[3]),tt(f[2])]),i.push(f[0])});const u=l[r],d=o?Object.keys(o[0]).filter(f=>f!=="datetime").map(f=>{let h="rgba(238, 238, 238, 0.5)";return u&&u[f]&&(h=`#${u[f].split("#")[1]}`),{name:f,type:"line",symbol:"none",data:o.map(g=>g[f]),lineStyle:{width:1},itemStyle:{color:h}}}):[];return{dataset:{id:"data",source:{kLineData:t}},grid:{left:"50px",top:"50px",right:"30px",bottom:"30px"},tooltip:{trigger:"axis",showContent:!1,axisPointer:{type:"cross",label:{formatter:f=>{const{axisDimension:h,value:g}=f;return h==="x"?On(new Date(g*1e3)).format("YYYY-MM-DD HH:mm"):String(tt(g))}}}},xAxis:{type:"category",data:i,axisLine:{lineStyle:{color:"red"}},splitLine:{show:!0,lineStyle:{type:"dotted"}},axisLabel:{show:!0,formatter:f=>On(new Date(f*1e3)).format("YYYY-MM-DD HH:mm")}},yAxis:[{index:0,min:"dataMin",axisLine:{show:!0,lineStyle:{color:"red"}},splitLine:{show:!0,lineStyle:{type:"dotted"}},axisLabel:{formatter:f=>tt(f)}}],dataZoom:[{type:"inside",xAxisIndex:[0,0],startValue:c>=a?c-a:0,endValue:c-1}],series:[{name:"k线",type:"candlestick",data:s},...d],toolbox:{show:!1},brush:{xAxisIndex:"all",brushLink:"all",transformable:!1,outOfBrush:{colorAlpha:1},brushStyle:{color:"rgba(120,140,180,0)",borderColor:"rgba(255,255,255,0.4)"}}}},Vv={class:"st-kline-tips"},Hv={class:"st-kline-tips-row"},jv={class:"st-kline-tips-row"},Wv=n.defineComponent({__name:"index",props:{activeIndex:{type:Number,required:!0},klineData:{type:Array,default:()=>[]},indicatorData:{type:Array,default:()=>[]},indicatorConfig:{type:Object,default:()=>{}}},setup(e){const t=e,o=n.computed(()=>{const{activeIndex:l,klineData:a}=t;if(a&&a[l]){const s=a[l],i=tt((s[4]-s[5])/s[5]*100);let c="#fff";return i>0?c="#f00":i<0&&(c="#090"),[{label:"",value:On(s[0]*1e3).format("YYYY-MM-DD hh:mm"),color:"#fff"},{label:"开",value:tt(s[1])||"--",color:"#fff"},{label:"高",value:tt(s[2])||"--",color:"#fff"},{label:"低",value:tt(s[3])||"--",color:"#fff"},{label:"收",value:tt(s[4])||"--",color:"#fff"},{label:"额",value:zv(s[7])||"--",color:"#fff"},{label:"涨跌",value:typeof i=="number"?`${i}%`:"--",color:c}]}return[]}),r=n.computed(()=>{const{activeIndex:l,indicatorData:a,indicatorConfig:s}=t;if(a&&a[l]){const i=a[l];return Object.keys(i).filter(c=>c!=="datetime").map(c=>{let u="rgba(238, 238, 238, 0.5)";return s&&s[c]&&(u=`#${s[c].split("#")[1]}`),{label:c,value:tt(i[c])||"--",color:u}})}return[]});return(l,a)=>(n.openBlock(),n.createElementBlock("div",Vv,[n.createElementVNode("div",Hv,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,s=>(n.openBlock(),n.createElementBlock("div",{class:"st-kline-tips-row-item",style:n.normalizeStyle({color:s.color})},n.toDisplayString(s.label)+" "+n.toDisplayString(s.value),5))),256))]),n.createElementVNode("div",jv,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,s=>(n.openBlock(),n.createElementBlock("div",{class:"st-kline-tips-row-item",style:n.normalizeStyle({color:s.color})},n.toDisplayString(s.label)+" "+n.toDisplayString(s.value),5))),256))])]))}}),kk="",Kv=ro(Wv,[["__scopeId","data-v-60b609bd"]]),Uv={candlestick:{itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},categoryAxis:{splitLine:{lineStyle:{color:["#333"]}}},valueAxis:{splitLine:{lineStyle:{color:["#333"]}}}},qv={candlestick:{itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},categoryAxis:{splitLine:{lineStyle:{color:["#333"]}}},valueAxis:{splitLine:{lineStyle:{color:["#333"]}}}},Yv={class:"st-kline"},Gv={class:"st-kline-header"},Jv=n.defineComponent({__name:"index",props:{code:{type:String,required:!0},defaultCount:{type:Number,default:()=>500},tradeDate:{type:String,required:!0},frequency:{type:String,required:!0},indicator:{type:String,required:!0}},setup(e){const t=e,o=n.ref(null),r=n.ref([]),l=n.ref([]),a=n.ref({}),s=n.ref(0),i=async()=>{const{code:h,defaultCount:g,tradeDate:m,frequency:p}=t;return(await Lv(h,g,m,p)).data},c=async h=>{if(h.length===0)return;const{code:g,frequency:m,indicator:p}=t,y=On(new Date(h[0][0]*1e3)).format("YYYY-MM-DD"),w=On(new Date(h[h.length-1][0]*1e3)).format("YYYY-MM-DD"),C=await Dv(g,y,w,m,p);return C.data.datetime?C.data.datetime.reduce((k,b,v)=>b>=h[0][0]&&b<=h[h.length-1][0]?[...k,{...Object.keys(C.data).reduce((E,S)=>({...E,[S]:C.data[S][v]}),{})}]:k,[]):null},u=async()=>{r.value=await i(),s.value=r.value.length-1,l.value=await c(r.value),a.value=(await Iv()).data;const h={kLineData:r.value,indicatorData:l.value,indicator:t.indicator,indicatorConfigList:a.value,defaultShowBarCount:200};o.value=await Fv(h)},d=(h,g)=>{var m,p;if(h)s.value=typeof((m=h==null?void 0:h.batch[0])==null?void 0:m.dataIndex)=="number"?(p=h==null?void 0:h.batch[0])==null?void 0:p.dataIndex:-1;else{const y=g.getOption();y.dataZoom instanceof Array&&(s.value=y.dataZoom[0].endValue)}},f=h=>{};return n.onMounted(()=>{u()}),(h,g)=>{const m=n.resolveComponent("st-echarts");return n.openBlock(),n.createElementBlock("div",Yv,[n.createElementVNode("div",Gv,[n.createVNode(Kv,{activeIndex:s.value,klineData:r.value,indicatorData:l.value,indicatorConfig:a.value[e.indicator]},null,8,["activeIndex","klineData","indicatorData","indicatorConfig"])]),o.value?(n.openBlock(),n.createBlock(m,{key:0,option:o.value,themeConfig:{name:"kline",light:n.unref(qv),dark:n.unref(Uv)},onHighlight:d,onAfterInit:f},null,8,["option","themeConfig"])):n.createCommentVNode("",!0)])}}}),Nk="",Xv=ro(Jv,[["__scopeId","data-v-fc95a00c"]]),Zv={install(e){e.component("st-kline",Xv)}},Ak="",Pk="",Rk="",Mk="",Lk="",Ik="",Dk="",zk="",Qv=n.defineComponent({__name:"index",props:{pageData:{type:Object,default:()=>({pageNum:1,pageSize:10})},total:{type:Number,default:0},pageSizes:{type:Array,default:()=>[10,20,30,50]},background:{type:Boolean,default:!0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:pageData","change"],setup(e,{emit:t}){const o=e,r=n.computed({get(){return o.pageData.pageNum},set(s){t("update:pageData",{...o.pageData,pageNum:s})}}),l=n.computed({get(){return o.pageData.pageSize},set(s){t("update:pageData",{...o.pageData,pageSize:s})}}),a=()=>{t("change",o.pageData)};return(s,i)=>{const c=DS,u=rl;return n.openBlock(),n.createBlock(u,{locale:n.unref(Vl)},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(c,n.mergeProps({class:"st-pagination",currentPage:r.value,"onUpdate:currentPage":i[0]||(i[0]=d=>r.value=d),"page-size":l.value,"onUpdate:pageSize":i[1]||(i[1]=d=>l.value=d),total:e.total,background:e.background,"page-sizes":e.pageSizes,layout:e.layout},s.$attrs,{onSizeChange:a,onCurrentChange:a}),null,16,["currentPage","page-size","total","background","page-sizes","layout"]),[[n.vShow,e.total]])]),_:1},8,["locale"])}}}),Fk="",ek=ro(Qv,[["__scopeId","data-v-61b7745b"]]),tk={install(e){e.component("st-pagination",ek)}},Vk="",Hk="",jk="",Wk="",Kk="",Uk="",qk="",Yk="",mu=n.defineComponent({__name:"index",props:{option:{type:Object,required:!0},scope:{type:Object,required:!0}},setup(e){const t=e,o=n.computed(()=>{const{option:r,scope:l}=t;return typeof r.show=="function"?r.show(l.row,l.$index):r.show!==!1});return(r,l)=>{const a=Jo,s=WS;return o.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[e.option.needCheck?(n.openBlock(),n.createBlock(s,{key:0,title:e.option.needCheck.title,onConfirm:l[0]||(l[0]=i=>e.option.onClick(e.scope.row,e.scope.$index))},{reference:n.withCtx(()=>[n.createVNode(a,{type:e.option.type,disabled:typeof e.option.disabled=="function"?e.option.disabled(e.scope.row,e.scope.$index):e.option.disabled},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(typeof e.option.text=="function"?e.option.text(e.scope.row,e.scope.$index):e.option.text),1)]),_:1},8,["type","disabled"])]),_:1},8,["title"])):(n.openBlock(),n.createBlock(a,{key:1,type:e.option.type,disabled:typeof e.option.disabled=="function"?e.option.disabled(e.scope.row,e.scope.$index):e.option.disabled,onClick:l[1]||(l[1]=i=>e.option.onClick(e.scope.row,e.scope.$index))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(typeof e.option.text=="function"?e.option.text(e.scope.row,e.scope.$index):e.option.text),1)]),_:1},8,["type","disabled"]))],64)):n.createCommentVNode("",!0)}}}),nk=n.defineComponent({__name:"index",props:{option:{type:Object,required:!0},scope:{type:Object,required:!0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{style:n.normalizeStyle(typeof e.option.style=="function"?e.option.style(e.scope.row[e.option.prop],e.scope.row):e.option.style)},n.toDisplayString(typeof e.option.formatter=="function"?e.option.formatter(e.scope.row[e.option.prop],e.scope.row):e.scope.row[e.option.prop]),5))}}),ok=n.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]},column:{type:Array,default:()=>[]},loading:{type:Boolean,default:()=>!1},emptyText:{type:String,default:()=>""}},emits:["sortChange"],setup(e,{emit:t}){const o=e,r=n.computed(()=>o.column.filter(a=>a.show!==!1)),l=a=>{t("sortChange",a)};return(a,s)=>{const i=be,c=QS,u=iE,d=sE,f=rl,h=mE;return n.openBlock(),n.createBlock(f,{locale:n.unref(Vl)},{default:n.withCtx(()=>[n.withDirectives((n.openBlock(),n.createBlock(d,{data:e.data,"empty-text":e.emptyText,stripe:"",style:{width:"100%"},onSortChange:l},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,g=>(n.openBlock(),n.createBlock(u,{key:g.prop,prop:g.prop,label:g.label,sortable:g.sortable,width:g.width,"min-width":g.minWidth},n.createSlots({_:2},[g.type==="formatter"?{name:"default",fn:n.withCtx(m=>[n.createVNode(nk,{option:g,scope:m},null,8,["option","scope"])]),key:"0"}:g.type==="slot"?{name:"default",fn:n.withCtx(m=>[n.renderSlot(a.$slots,g.slot,{row:m.row})]),key:"1"}:g.type==="btns"?{name:"default",fn:n.withCtx(m=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.btns,(p,y)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:`${p.text}-${y}`},[p.children?(n.openBlock(),n.createBlock(c,{key:0,placement:"bottom",trigger:"hover","popper-style":{minWidth:"0px",width:null}},{reference:n.withCtx(()=>[n.createVNode(i,{style:{marginLeft:"10px",verticalAlign:"-5px",cursor:"pointer"},size:"20"},{default:n.withCtx(()=>[n.createVNode(n.unref(Wr))]),_:1})]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.children,(w,C)=>(n.openBlock(),n.createElementBlock("div",{key:`${w.text}-${C}`,style:n.normalizeStyle({marginTop:C===0?0:"10px"})},[n.createVNode(mu,{option:w,scope:m},null,8,["option","scope"])],4))),128))]),_:2},1024)):(n.openBlock(),n.createBlock(mu,{key:1,option:p,scope:m},null,8,["option","scope"]))],64))),128))]),key:"2"}:void 0]),1032,["prop","label","sortable","width","min-width"]))),128))]),_:1},8,["data","empty-text"])),[[h,e.loading]])]),_:1},8,["locale"])}}}),rk={install(e){e.component("st-table",ok)}};return{install(e){gE.install(e),CE.install(e),vE.install(e),Zv.install(e),tk.install(e),rk.install(e)}}});
|
|
38
|
+
`):" "+su(a[0]):"as no adapter specified";throw new ae("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Xl};function Zl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new io(null,e)}function cu(e){return Zl(e),e.headers=Nt.from(e.headers),e.data=Jl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),iu.getAdapter(e.adapter||Yl.adapter)(e).then(function(r){return Zl(e),r.data=Jl.call(e,e.transformResponse,r),r.headers=Nt.from(r.headers),r},function(r){return ru(r)||(Zl(e),r&&r.response&&(r.response.data=Jl.call(e,e.transformResponse,r.response),r.response.headers=Nt.from(r.response.headers))),Promise.reject(r)})}const uu=e=>e instanceof Nt?e.toJSON():e;function Rn(e,t){t=t||{};const o={};function r(u,d,f){return M.isPlainObject(u)&&M.isPlainObject(d)?M.merge.call({caseless:f},u,d):M.isPlainObject(d)?M.merge({},d):M.isArray(d)?d.slice():d}function l(u,d,f){if(M.isUndefined(d)){if(!M.isUndefined(u))return r(void 0,u,f)}else return r(u,d,f)}function a(u,d){if(!M.isUndefined(d))return r(void 0,d)}function s(u,d){if(M.isUndefined(d)){if(!M.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function i(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:i,headers:(u,d)=>l(uu(u),uu(d),!0)};return M.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||l,h=f(e[d],t[d],d);M.isUndefined(h)&&f!==i||(o[d]=h)}),o}const du="1.5.1",Ql={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ql[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const fu={};Ql.transitional=function(t,o,r){function l(a,s){return"[Axios v"+du+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return(a,s,i)=>{if(t===!1)throw new ae(l(s," has been removed"+(o?" in "+o:"")),ae.ERR_DEPRECATED);return o&&!fu[s]&&(fu[s]=!0,console.warn(l(s," has been deprecated since v"+o+" and will be removed in the near future"))),t?t(a,s,i):!0}};function Nv(e,t,o){if(typeof e!="object")throw new ae("options must be an object",ae.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let l=r.length;for(;l-- >0;){const a=r[l],s=t[a];if(s){const i=e[a],c=i===void 0||s(i,a,e);if(c!==!0)throw new ae("option "+a+" must be "+c,ae.ERR_BAD_OPTION_VALUE);continue}if(o!==!0)throw new ae("Unknown option "+a,ae.ERR_BAD_OPTION)}}const ea={assertOptions:Nv,validators:Ql},qt=ea.validators;class dr{constructor(t){this.defaults=t,this.interceptors={request:new eu,response:new eu}}request(t,o){typeof t=="string"?(o=o||{},o.url=t):o=t||{},o=Rn(this.defaults,o);const{transitional:r,paramsSerializer:l,headers:a}=o;r!==void 0&&ea.assertOptions(r,{silentJSONParsing:qt.transitional(qt.boolean),forcedJSONParsing:qt.transitional(qt.boolean),clarifyTimeoutError:qt.transitional(qt.boolean)},!1),l!=null&&(M.isFunction(l)?o.paramsSerializer={serialize:l}:ea.assertOptions(l,{encode:qt.function,serialize:qt.function},!0)),o.method=(o.method||this.defaults.method||"get").toLowerCase();let s=a&&M.merge(a.common,a[o.method]);a&&M.forEach(["delete","get","head","post","put","patch","common"],m=>{delete a[m]}),o.headers=Nt.concat(s,a);const i=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(o)===!1||(c=c&&p.synchronous,i.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[cu.bind(this),void 0];for(m.unshift.apply(m,i),m.push.apply(m,u),h=m.length,d=Promise.resolve(o);f<h;)d=d.then(m[f++],m[f++]);return d}h=i.length;let g=o;for(f=0;f<h;){const m=i[f++],p=i[f++];try{g=m(g)}catch(y){p.call(this,y);break}}try{d=cu.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Rn(this.defaults,t);const o=lu(t.baseURL,t.url);return Qc(o,t.params,t.paramsSerializer)}}M.forEach(["delete","get","head","options"],function(t){dr.prototype[t]=function(o,r){return this.request(Rn(r||{},{method:t,url:o,data:(r||{}).data}))}}),M.forEach(["post","put","patch"],function(t){function o(r){return function(a,s,i){return this.request(Rn(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:s}))}}dr.prototype[t]=o(),dr.prototype[t+"Form"]=o(!0)});const fr=dr;class ta{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let o;this.promise=new Promise(function(a){o=a});const r=this;this.promise.then(l=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](l);r._listeners=null}),this.promise.then=l=>{let a;const s=new Promise(i=>{r.subscribe(i),a=i}).then(l);return s.cancel=function(){r.unsubscribe(a)},s},t(function(a,s,i){r.reason||(r.reason=new io(a,s,i),o(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const o=this._listeners.indexOf(t);o!==-1&&this._listeners.splice(o,1)}static source(){let t;return{token:new ta(function(l){t=l}),cancel:t}}}const Av=ta;function Pv(e){return function(o){return e.apply(null,o)}}function Rv(e){return M.isObject(e)&&e.isAxiosError===!0}const na={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(na).forEach(([e,t])=>{na[t]=e});const Mv=na;function pu(e){const t=new fr(e),o=Ic(fr.prototype.request,t);return M.extend(o,fr.prototype,t,{allOwnKeys:!0}),M.extend(o,t,null,{allOwnKeys:!0}),o.create=function(l){return pu(Rn(e,l))},o}const ye=pu(Yl);ye.Axios=fr,ye.CanceledError=io,ye.CancelToken=Av,ye.isCancel=ru,ye.VERSION=du,ye.toFormData=ir,ye.AxiosError=ae,ye.Cancel=ye.CanceledError,ye.all=function(t){return Promise.all(t)},ye.spread=Pv,ye.isAxiosError=Rv,ye.mergeConfig=Rn,ye.AxiosHeaders=Nt,ye.formToJSON=e=>nu(M.isHTMLForm(e)?new FormData(e):e),ye.getAdapter=iu.getAdapter,ye.HttpStatusCode=Mv,ye.default=ye;const oa=ye,Lv=async(e,t,o,r)=>{let l=On(o).format("YYYY-MM-DD HH:mm:ss");return oa(`http://116.62.161.92:8005/history_kline?code=${e}&bar_count=${t}&dt=${l}&frequency=${r}`)},Iv=()=>oa("http://116.62.161.92:8005/get_indicator"),Dv=(e,t,o,r,l)=>oa(`http://116.62.161.92:8005/realtime_indicator?code=${e}&start_date=${t}&end_date=${o}&indicator=${l}&frequency=${r}`),tt=e=>e||e===0?Math.round(e*1e3)/1e3:null,zv=e=>e>=1e12?`${(e/1e12).toFixed(2)}万亿`:e>=1e8?`${(e/1e8).toFixed(2)}亿`:e>=1e4?`${(e/1e4).toFixed(2)}万`:e.toFixed(2),Fv=async e=>{const{kLineData:t,indicatorData:o,indicator:r,indicatorConfigList:l,defaultShowBarCount:a}=e,s=[],i=[],c=t.length;t.forEach(f=>{s.push([tt(f[1]),tt(f[4]),tt(f[3]),tt(f[2])]),i.push(f[0])});const u=l[r],d=o?Object.keys(o[0]).filter(f=>f!=="datetime").map(f=>{let h="rgba(238, 238, 238, 0.5)";return u&&u[f]&&(h=`#${u[f].split("#")[1]}`),{name:f,type:"line",symbol:"none",data:o.map(g=>g[f]),lineStyle:{width:1},itemStyle:{color:h}}}):[];return{dataset:{id:"data",source:{kLineData:t}},grid:{left:"50px",top:"50px",right:"30px",bottom:"30px"},tooltip:{trigger:"axis",showContent:!1,axisPointer:{type:"cross",label:{formatter:f=>{const{axisDimension:h,value:g}=f;return h==="x"?On(new Date(g*1e3)).format("YYYY-MM-DD HH:mm"):String(tt(g))}}}},xAxis:{type:"category",data:i,axisLine:{lineStyle:{color:"red"}},splitLine:{show:!0,lineStyle:{type:"dotted"}},axisLabel:{show:!0,formatter:f=>On(new Date(f*1e3)).format("YYYY-MM-DD HH:mm")}},yAxis:[{index:0,min:"dataMin",axisLine:{show:!0,lineStyle:{color:"red"}},splitLine:{show:!0,lineStyle:{type:"dotted"}},axisLabel:{formatter:f=>tt(f)}}],dataZoom:[{type:"inside",xAxisIndex:[0,0],startValue:c>=a?c-a:0,endValue:c-1}],series:[{name:"k线",type:"candlestick",data:s},...d],toolbox:{show:!1},brush:{xAxisIndex:"all",brushLink:"all",transformable:!1,outOfBrush:{colorAlpha:1},brushStyle:{color:"rgba(120,140,180,0)",borderColor:"rgba(255,255,255,0.4)"}}}},Vv={class:"st-kline-tips"},Hv={class:"st-kline-tips-row"},jv={class:"st-kline-tips-row"},Wv=n.defineComponent({__name:"index",props:{activeIndex:{type:Number,required:!0},klineData:{type:Array,default:()=>[]},indicatorData:{type:Array,default:()=>[]},indicatorConfig:{type:Object,default:()=>{}}},setup(e){const t=e,o=n.computed(()=>{const{activeIndex:l,klineData:a}=t;if(a&&a[l]){const s=a[l],i=tt((s[4]-s[5])/s[5]*100);let c="#fff";return i>0?c="#f00":i<0&&(c="#090"),[{label:"",value:On(s[0]*1e3).format("YYYY-MM-DD hh:mm"),color:"#fff"},{label:"开",value:tt(s[1])||"--",color:"#fff"},{label:"高",value:tt(s[2])||"--",color:"#fff"},{label:"低",value:tt(s[3])||"--",color:"#fff"},{label:"收",value:tt(s[4])||"--",color:"#fff"},{label:"额",value:zv(s[7])||"--",color:"#fff"},{label:"涨跌",value:typeof i=="number"?`${i}%`:"--",color:c}]}return[]}),r=n.computed(()=>{const{activeIndex:l,indicatorData:a,indicatorConfig:s}=t;if(a&&a[l]){const i=a[l];return Object.keys(i).filter(c=>c!=="datetime").map(c=>{let u="rgba(238, 238, 238, 0.5)";return s&&s[c]&&(u=`#${s[c].split("#")[1]}`),{label:c,value:tt(i[c])||"--",color:u}})}return[]});return(l,a)=>(n.openBlock(),n.createElementBlock("div",Vv,[n.createElementVNode("div",Hv,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,s=>(n.openBlock(),n.createElementBlock("div",{class:"st-kline-tips-row-item",style:n.normalizeStyle({color:s.color})},n.toDisplayString(s.label)+" "+n.toDisplayString(s.value),5))),256))]),n.createElementVNode("div",jv,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,s=>(n.openBlock(),n.createElementBlock("div",{class:"st-kline-tips-row-item",style:n.normalizeStyle({color:s.color})},n.toDisplayString(s.label)+" "+n.toDisplayString(s.value),5))),256))])]))}}),kk="",Kv=ro(Wv,[["__scopeId","data-v-60b609bd"]]),Uv={candlestick:{itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},categoryAxis:{splitLine:{lineStyle:{color:["#333"]}}},valueAxis:{splitLine:{lineStyle:{color:["#333"]}}}},qv={candlestick:{itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},categoryAxis:{splitLine:{lineStyle:{color:["#333"]}}},valueAxis:{splitLine:{lineStyle:{color:["#333"]}}}},Yv={class:"st-kline"},Gv={class:"st-kline-header"},Jv=n.defineComponent({__name:"index",props:{code:{type:String,required:!0},defaultCount:{type:Number,default:()=>500},tradeDate:{type:String,required:!0},frequency:{type:String,required:!0},indicator:{type:String,required:!0}},setup(e){const t=e,o=n.ref(null),r=n.ref([]),l=n.ref([]),a=n.ref({}),s=n.ref(0),i=async()=>{const{code:h,defaultCount:g,tradeDate:m,frequency:p}=t;return(await Lv(h,g,m,p)).data},c=async h=>{if(h.length===0)return;const{code:g,frequency:m,indicator:p}=t,y=On(new Date(h[0][0]*1e3)).format("YYYY-MM-DD"),w=On(new Date(h[h.length-1][0]*1e3)).format("YYYY-MM-DD"),C=await Dv(g,y,w,m,p);return C.data.datetime?C.data.datetime.reduce((k,b,v)=>b>=h[0][0]&&b<=h[h.length-1][0]?[...k,{...Object.keys(C.data).reduce((E,S)=>({...E,[S]:C.data[S][v]}),{})}]:k,[]):null},u=async()=>{r.value=await i(),s.value=r.value.length-1,l.value=await c(r.value),a.value=(await Iv()).data;const h={kLineData:r.value,indicatorData:l.value,indicator:t.indicator,indicatorConfigList:a.value,defaultShowBarCount:200};o.value=await Fv(h)},d=(h,g)=>{var m,p;if(h)s.value=typeof((m=h==null?void 0:h.batch[0])==null?void 0:m.dataIndex)=="number"?(p=h==null?void 0:h.batch[0])==null?void 0:p.dataIndex:-1;else{const y=g.getOption();y.dataZoom instanceof Array&&(s.value=y.dataZoom[0].endValue)}},f=h=>{};return n.onMounted(()=>{u()}),(h,g)=>{const m=n.resolveComponent("st-echarts");return n.openBlock(),n.createElementBlock("div",Yv,[n.createElementVNode("div",Gv,[n.createVNode(Kv,{activeIndex:s.value,klineData:r.value,indicatorData:l.value,indicatorConfig:a.value[e.indicator]},null,8,["activeIndex","klineData","indicatorData","indicatorConfig"])]),o.value?(n.openBlock(),n.createBlock(m,{key:0,option:o.value,themeConfig:{name:"kline",light:n.unref(qv),dark:n.unref(Uv)},onHighlight:d,onAfterInit:f},null,8,["option","themeConfig"])):n.createCommentVNode("",!0)])}}}),Nk="",Xv=ro(Jv,[["__scopeId","data-v-fc95a00c"]]),Zv={install(e){e.component("st-kline",Xv)}},Ak="",Pk="",Rk="",Mk="",Lk="",Ik="",Dk="",zk="",Qv=n.defineComponent({__name:"index",props:{pageData:{type:Object,default:()=>({pageNum:1,pageSize:10})},total:{type:Number,default:0},pageSizes:{type:Array,default:()=>[10,20,30,50]},background:{type:Boolean,default:!0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:pageData","change"],setup(e,{emit:t}){const o=e,r=n.computed({get(){return o.pageData.pageNum},set(s){t("update:pageData",{...o.pageData,pageNum:s})}}),l=n.computed({get(){return o.pageData.pageSize},set(s){t("update:pageData",{...o.pageData,pageSize:s})}}),a=()=>{t("change",o.pageData)};return(s,i)=>{const c=DS,u=rl;return n.openBlock(),n.createBlock(u,{locale:n.unref(Vl)},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(c,n.mergeProps({class:"st-pagination",currentPage:r.value,"onUpdate:currentPage":i[0]||(i[0]=d=>r.value=d),"page-size":l.value,"onUpdate:pageSize":i[1]||(i[1]=d=>l.value=d),total:e.total,background:e.background,"page-sizes":e.pageSizes,layout:e.layout},s.$attrs,{onSizeChange:a,onCurrentChange:a}),null,16,["currentPage","page-size","total","background","page-sizes","layout"]),[[n.vShow,e.total]])]),_:1},8,["locale"])}}}),Fk="",ek=ro(Qv,[["__scopeId","data-v-61b7745b"]]),tk={install(e){e.component("st-pagination",ek)}},Vk="",Hk="",jk="",Wk="",Kk="",Uk="",qk="",Yk="",mu=n.defineComponent({__name:"index",props:{option:{type:Object,required:!0},scope:{type:Object,required:!0},showMargin:{type:Boolean,default:()=>!1}},setup(e){const t=e,o=n.computed(()=>{const{option:r,scope:l}=t;return typeof r.show=="function"?r.show(l.row,l.$index):r.show!==!1});return(r,l)=>{const a=Jo,s=WS;return o.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[e.option.needCheck?(n.openBlock(),n.createBlock(s,{key:0,title:e.option.needCheck.title,onConfirm:l[0]||(l[0]=i=>e.option.onClick(e.scope.row,e.scope.$index))},{reference:n.withCtx(()=>[n.createVNode(a,{type:e.option.type,disabled:typeof e.option.disabled=="function"?e.option.disabled(e.scope.row,e.scope.$index):e.option.disabled,style:n.normalizeStyle({marginTop:e.showMargin?"10px":0})},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(typeof e.option.text=="function"?e.option.text(e.scope.row,e.scope.$index):e.option.text),1)]),_:1},8,["type","disabled","style"])]),_:1},8,["title"])):(n.openBlock(),n.createBlock(a,{key:1,type:e.option.type,disabled:typeof e.option.disabled=="function"?e.option.disabled(e.scope.row,e.scope.$index):e.option.disabled,style:n.normalizeStyle({marginTop:e.showMargin?"10px":0}),onClick:l[1]||(l[1]=i=>e.option.onClick(e.scope.row,e.scope.$index))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(typeof e.option.text=="function"?e.option.text(e.scope.row,e.scope.$index):e.option.text),1)]),_:1},8,["type","disabled","style"]))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[],64))}}}),nk=n.defineComponent({__name:"index",props:{option:{type:Object,required:!0},scope:{type:Object,required:!0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{style:n.normalizeStyle(typeof e.option.style=="function"?e.option.style(e.scope.row[e.option.prop],e.scope.row):e.option.style)},n.toDisplayString(typeof e.option.formatter=="function"?e.option.formatter(e.scope.row[e.option.prop],e.scope.row):e.scope.row[e.option.prop]),5))}}),ok=n.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]},column:{type:Array,default:()=>[]},loading:{type:Boolean,default:()=>!1},emptyText:{type:String,default:()=>""}},emits:["sortChange"],setup(e,{emit:t}){const o=e,r=n.computed(()=>o.column.filter(s=>s.show!==!1)),l=s=>{t("sortChange",s)},a=(s,i)=>s.filter(c=>typeof c.show=="function"&&c.show(i.row,i.$index)===!1?!1:c.show!==!1);return(s,i)=>{const c=be,u=QS,d=iE,f=sE,h=rl,g=mE;return n.openBlock(),n.createBlock(h,{locale:n.unref(Vl)},{default:n.withCtx(()=>[n.withDirectives((n.openBlock(),n.createBlock(f,{data:e.data,"empty-text":e.emptyText,stripe:"",style:{width:"100%"},onSortChange:l},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,m=>(n.openBlock(),n.createBlock(d,{key:m.prop,prop:m.prop,label:m.label,sortable:m.sortable,width:m.width,"min-width":m.minWidth},n.createSlots({_:2},[m.type==="formatter"?{name:"default",fn:n.withCtx(p=>[n.createVNode(nk,{option:m,scope:p},null,8,["option","scope"])]),key:"0"}:m.type==="slot"?{name:"default",fn:n.withCtx(p=>[n.renderSlot(s.$slots,m.slot,{row:p.row})]),key:"1"}:m.type==="btns"?{name:"default",fn:n.withCtx(p=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.btns,(y,w)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:`${y.text}-${w}`},[y.children?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[a(y.children,p).length?(n.openBlock(),n.createBlock(u,{key:0,placement:"bottom",trigger:"hover","popper-style":{minWidth:"0px",width:null}},{reference:n.withCtx(()=>[n.createVNode(c,{style:{marginLeft:"10px",verticalAlign:"-5px",cursor:"pointer"},size:"20"},{default:n.withCtx(()=>[n.createVNode(n.unref(Wr))]),_:1})]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a(y.children,p),(C,k)=>(n.openBlock(),n.createElementBlock("div",{key:`${C.text}-${k}`},[n.createVNode(mu,{option:C,scope:p,showMargin:k!==0},null,8,["option","scope","showMargin"])]))),128))]),_:2},1024)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createBlock(mu,{key:1,option:y,scope:p},null,8,["option","scope"]))],64))),128))]),key:"2"}:void 0]),1032,["prop","label","sortable","width","min-width"]))),128))]),_:1},8,["data","empty-text"])),[[g,e.loading]])]),_:1},8,["locale"])}}}),rk={install(e){e.component("st-table",ok)}};return{install(e){gE.install(e),CE.install(e),vE.install(e),Zv.install(e),tk.install(e),rk.install(e)}}});
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<el-button
|
|
10
10
|
:type="option.type"
|
|
11
11
|
:disabled="typeof option.disabled === 'function' ? option.disabled(scope.row, scope.$index) : option.disabled"
|
|
12
|
+
:style="{ marginTop: showMargin ? '10px' : 0 }"
|
|
12
13
|
>
|
|
13
14
|
{{ typeof option.text === 'function' ? option.text(scope.row, scope.$index) : option.text }}
|
|
14
15
|
</el-button>
|
|
@@ -18,11 +19,13 @@
|
|
|
18
19
|
v-else
|
|
19
20
|
:type="option.type"
|
|
20
21
|
:disabled="typeof option.disabled === 'function' ? option.disabled(scope.row, scope.$index) : option.disabled"
|
|
22
|
+
:style="{ marginTop: showMargin ? '10px' : 0 }"
|
|
21
23
|
@click="option.onClick(scope.row, scope.$index)"
|
|
22
24
|
>
|
|
23
25
|
{{ typeof option.text === 'function' ? option.text(scope.row, scope.$index) : option.text }}
|
|
24
26
|
</el-button>
|
|
25
27
|
</template>
|
|
28
|
+
<template v-else></template>
|
|
26
29
|
</template>
|
|
27
30
|
|
|
28
31
|
<script setup lang="ts">
|
|
@@ -36,6 +39,10 @@
|
|
|
36
39
|
scope: {
|
|
37
40
|
type: Object,
|
|
38
41
|
required: true
|
|
42
|
+
},
|
|
43
|
+
showMargin: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: () => false
|
|
39
46
|
}
|
|
40
47
|
})
|
|
41
48
|
|
package/packages/Table/index.vue
CHANGED
|
@@ -43,31 +43,33 @@
|
|
|
43
43
|
v-for="(btn, btnIndex) in item.btns"
|
|
44
44
|
:key="`${btn.text}-${btnIndex}`"
|
|
45
45
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<template #reference>
|
|
53
|
-
<el-icon
|
|
54
|
-
:style="{ marginLeft: '10px', verticalAlign: '-5px', cursor: 'pointer' }"
|
|
55
|
-
size="20"
|
|
56
|
-
>
|
|
57
|
-
<MoreFilled />
|
|
58
|
-
</el-icon>
|
|
59
|
-
</template>
|
|
60
|
-
<div
|
|
61
|
-
v-for="(subBtn, subBtnIndex) in btn.children"
|
|
62
|
-
:key="`${subBtn.text}-${subBtnIndex}`"
|
|
63
|
-
:style="{ marginTop: subBtnIndex === 0 ? 0 : '10px'}"
|
|
46
|
+
<template v-if="btn.children">
|
|
47
|
+
<el-popover
|
|
48
|
+
v-if="getShowChildren(btn.children, scope).length"
|
|
49
|
+
placement="bottom"
|
|
50
|
+
trigger="hover"
|
|
51
|
+
:popper-style="{ minWidth: '0px', width: null }"
|
|
64
52
|
>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
<template #reference>
|
|
54
|
+
<el-icon
|
|
55
|
+
:style="{ marginLeft: '10px', verticalAlign: '-5px', cursor: 'pointer' }"
|
|
56
|
+
size="20"
|
|
57
|
+
>
|
|
58
|
+
<MoreFilled />
|
|
59
|
+
</el-icon>
|
|
60
|
+
</template>
|
|
61
|
+
<div
|
|
62
|
+
v-for="(subBtn, subBtnIndex) in getShowChildren(btn.children, scope)"
|
|
63
|
+
:key="`${subBtn.text}-${subBtnIndex}`"
|
|
64
|
+
>
|
|
65
|
+
<Button
|
|
66
|
+
:option="subBtn"
|
|
67
|
+
:scope="scope"
|
|
68
|
+
:showMargin="subBtnIndex !== 0"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</el-popover>
|
|
72
|
+
</template>
|
|
71
73
|
<Button
|
|
72
74
|
v-else
|
|
73
75
|
:option="btn"
|
|
@@ -114,6 +116,17 @@
|
|
|
114
116
|
const sortChange = (params: any) => {
|
|
115
117
|
emit('sortChange', params)
|
|
116
118
|
}
|
|
119
|
+
|
|
120
|
+
const getShowChildren = (children: any[], scope: any) => {
|
|
121
|
+
return children.filter(item => {
|
|
122
|
+
if(typeof item.show === 'function' && item.show(scope.row, scope.$index) === false) {
|
|
123
|
+
return false
|
|
124
|
+
} else if (item.show === false) {
|
|
125
|
+
return false
|
|
126
|
+
}
|
|
127
|
+
return true
|
|
128
|
+
})
|
|
129
|
+
}
|
|
117
130
|
</script>
|
|
118
131
|
|
|
119
132
|
<style lang="scss" scoped>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="width: 100%;height: 100%;">
|
|
3
|
-
<st-chartLayout
|
|
4
|
-
:data="data"
|
|
5
|
-
:row="2"
|
|
6
|
-
:col="3"
|
|
7
|
-
>
|
|
8
|
-
<template #default="{ data }">
|
|
9
|
-
<div style="width: 100%;height: 100%;;background: #ccc">{{ data }}</div>
|
|
10
|
-
</template>
|
|
11
|
-
</st-chartLayout>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
const data = [
|
|
17
|
-
1,2,3,4,5,6
|
|
18
|
-
]
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<style lang="scss" scoped>
|
|
22
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 100%;height: 100%;">
|
|
3
|
+
<st-chartLayout
|
|
4
|
+
:data="data"
|
|
5
|
+
:row="2"
|
|
6
|
+
:col="3"
|
|
7
|
+
>
|
|
8
|
+
<template #default="{ data }">
|
|
9
|
+
<div style="width: 100%;height: 100%;;background: #ccc">{{ data }}</div>
|
|
10
|
+
</template>
|
|
11
|
+
</st-chartLayout>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
const data = [
|
|
17
|
+
1,2,3,4,5,6
|
|
18
|
+
]
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style lang="scss" scoped>
|
|
22
|
+
</style>
|