@10yun/cv-mobile-ui 0.5.9 → 0.5.11
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/extend/permission.js +1 -2
- package/package.json +1 -1
- package/plugins/uni-richText.js +1 -1
- package/plugins/uni-socket.js +6 -8
- package/ui-cv/cv-base-audio/cv-base-audio.vue +278 -0
- package/ui-cv/cv-editor-parse/components/wxParseAudio.vue +2 -4
- package/ui-cv/cv-geo-local/cv-geo-local.vue +0 -1
- package/ui-cv/cv-layout-topbar/cv-layout-topbar.vue +238 -0
- package/ui-cv/cv-markdown-show/lib/highlight/uni-highlight.min.js +9001 -5133
- package/ui-sdks/sdk-app-update/img/logo.png +0 -0
- package/ui-sdks/sdk-app-update/img/update_bg.png +0 -0
- package/ui-sdks/sdk-app-update/img/update_bg_top.png +0 -0
- package/{ui-cv/cv-update-app/cv-update-app.vue → ui-sdks/sdk-app-update/sdk-app-update.vue} +2 -2
- package/ui-sdks/sdk-app-update/xxxx +62 -0
- package/ui-sdks/sdk-privacy-policy/sdk-privacy-policy.vue +113 -0
- package/ui-sdks/sdk-u-charts/app-echarts.min.js +23 -0
- package/ui-sdks/sdk-u-charts/config-echarts.js +420 -0
- package/ui-sdks/sdk-u-charts/config-ucharts.js +630 -0
- package/ui-sdks/sdk-u-charts/h5-echarts.min.js +23 -0
- package/ui-sdks/sdk-u-charts/u-charts.js +7398 -0
- package/ui-sdks/sdk-u-charts/u-charts.min.js +1 -0
- package/ui-sdks/sdk-webview-main/WebViewMain.vue +1 -0
- package/ui-sdks/sdk-webview-main/main.js +0 -0
- package/ui-sdks/sdk-webview-main/mixin.js +0 -0
- package/ui-uni/uParse/src/components/wxParseAudio.vue +26 -0
- package/ui-uni/uParse/src/components/wxParseImg.vue +94 -0
- package/ui-uni/uParse/src/components/wxParseTable.vue +55 -0
- package/ui-uni/uParse/src/components/wxParseTemplate0.vue +103 -0
- package/ui-uni/uParse/src/components/wxParseTemplate1.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate10.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate11.vue +86 -0
- package/ui-uni/uParse/src/components/wxParseTemplate2.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate3.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate4.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate5.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate6.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate7.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate8.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate9.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseVideo.vue +15 -0
- package/ui-uni/uParse/src/editor.css +495 -0
- package/ui-uni/uParse/src/libs/html2json.js +261 -0
- package/ui-uni/uParse/src/libs/htmlparser.js +156 -0
- package/ui-uni/uParse/src/libs/wxDiscode.js +195 -0
- package/ui-uni/uParse/src/wxParse.css +270 -0
- package/ui-uni/uParse/src/wxParse.vue +206 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var config={yAxisWidth:15,yAxisSplit:5,xAxisHeight:15,xAxisLineHeight:15,legendHeight:15,yAxisTitleWidth:15,padding:12,pixelRatio:1,rotate:!1,columePadding:3,fontSize:13,dataPointShape:["circle","circle","circle","circle"],colors:["#1890ff","#2fc25b","#facc14","#f04864","#8543e0","#90ed7d"],pieChartLinePadding:15,pieChartTextPadding:5,xAxisTextPadding:3,titleColor:"#333333",titleFontSize:20,subtitleColor:"#999999",subtitleFontSize:15,toolTipPadding:3,toolTipBackground:"#000000",toolTipOpacity:.7,toolTipLineHeight:20,radarGridCount:3,radarLabelTextMargin:15,gaugeLabelTextMargin:15};function assign(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t,i=Object(e),o=1;o<arguments.length;o++)if(t=arguments[o],null!=t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=t[a]);return i}var util={toFixed:function(e,t){return t=t||2,this.isFloat(e)&&(e=e.toFixed(t)),e},isFloat:function(e){return 0!=e%1},approximatelyEqual:function(e,t){return 1e-10>Math.abs(e-t)},isSameSign:function(e,t){var i=Math.abs;return i(e)===e&&i(t)===t||i(e)!==e&&i(t)!==t},isSameXCoordinateArea:function(e,t){return this.isSameSign(e.x,t.x)},isCollision:function(e,t){e.end={},e.end.x=e.start.x+e.width,e.end.y=e.start.y-e.height,t.end={},t.end.x=t.start.x+t.width,t.end.y=t.start.y-t.height;var i=t.start.x>e.end.x||t.end.x<e.start.x||t.end.y>e.start.y||t.start.y<e.end.y;return!i}};function hexToRgb(e,t){var i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,o=e.replace(i,function(e,t,i,o){return t+t+i+i+o+o}),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o),n=parseInt(a[1],16),l=parseInt(a[2],16),s=parseInt(a[3],16);return"rgba("+n+","+l+","+s+","+t+")"}function findRange(e,t,i){if(isNaN(e))throw new Error("[wxCharts] unvalid series data!");i=i||10,t=t?t:"upper";for(var o=1;1>i;)i*=10,o*=10;for(e="upper"===t?Math.ceil(e*o):Math.floor(e*o);0!=e%i;)"upper"===t?e++:e--;return e/o}function calValidDistance(e,t,i,o){var a=o.width-i.padding-t.xAxisPoints[0],n=t.eachSpacing*o.categories.length,l=e;return 0<=e?l=0:Math.abs(e)>=n-a&&(l=a-n),l}function isInAngleRange(e,t,i){function o(e){for(;0>e;)e+=2*a;for(;e>2*a;)e-=2*a;return e}var a=Math.PI;return e=o(e),t=o(t),i=o(i),t>i&&(i+=2*a,e<t&&(e+=2*a)),e>=t&&e<=i}function calRotateTranslate(e,t,i){var o=e,a=i-t,n=o+(i-a-o)/1.4142135623730951;n*=-1;return{transX:n,transY:(i-a)*(1.4142135623730951-1)-(i-a-o)/1.4142135623730951}}function createCurveControlPoints(e,t){function i(e,t){return!!(e[t-1]&&e[t+1])&&(e[t].y>=Math.max(e[t-1].y,e[t+1].y)||e[t].y<=Math.min(e[t-1].y,e[t+1].y))}var o=.2,a=.2,n=null,l=null,s=null,r=null;if(1>t?(n=e[0].x+(e[1].x-e[0].x)*o,l=e[0].y+(e[1].y-e[0].y)*o):(n=e[t].x+(e[t+1].x-e[t-1].x)*o,l=e[t].y+(e[t+1].y-e[t-1].y)*o),t>e.length-3){var d=e.length-1;s=e[d].x-(e[d].x-e[d-1].x)*a,r=e[d].y-(e[d].y-e[d-1].y)*a}else s=e[t+1].x-(e[t+2].x-e[t].x)*a,r=e[t+1].y-(e[t+2].y-e[t].y)*a;return i(e,t+1)&&(r=e[t+1].y),i(e,t)&&(l=e[t].y),{ctrA:{x:n,y:l},ctrB:{x:s,y:r}}}function convertCoordinateOrigin(e,t,i){return{x:i.x+e,y:i.y-t}}function avoidCollision(e,t){if(t)for(;util.isCollision(e,t);)0<e.start.x?e.start.y--:0>e.start.x?e.start.y++:0<e.start.y?e.start.y++:e.start.y--;return e}function fillSeriesColor(e,t){var i=0;return e.map(function(e){return e.color||(e.color=t.colors[i],i=(i+1)%t.colors.length),e})}function fillSeriesType(e,t){return e.map(function(e){return e.type||(e.type=t.type),e})}function getDataRange(e,t){var i=0,o=t-e;return i=1e4<=o?1e3:1e3<=o?100:100<=o?10:10<=o?5:1<=o?1:.1<=o?.1:.01,{minRange:findRange(e,"lower",i),maxRange:findRange(t,"upper",i)}}function measureText(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:config.fontSize;e+="";var e=e.split(""),i=0;return e.forEach(function(e){i+=/[a-zA-Z]/.test(e)?7:/[0-9]/.test(e)?5.5:/\./.test(e)?2.7:/-/.test(e)?3.25:/[\u4e00-\u9fa5]/.test(e)?10:/\(|\)/.test(e)?3.73:/\s/.test(e)?2.5:/%/.test(e)?8:10}),i*t/10}function dataCombine(e){return e.reduce(function(e,t){return(e.data?e.data:e).concat(t.data)},[])}function dataCombineStack(e){for(var t=Array(e[0].data.length),o=0;o<t.length;o++)t[o]=0;for(var a=0;a<e.length;a++)for(var o=0;o<t.length;o++)t[o]+=e[a].data[o];return e.reduce(function(e,i){return(e.data?e.data:e).concat(i.data).concat(t)},[])}function getTouches(t,i,o){let e,a;return t.clientX?i.rotate?(a=i.height-t.clientX*i.pixelRatio,e=(t.pageY-o.mp.currentTarget.offsetTop-i.height/i.pixelRatio/2*(i.pixelRatio-1))*i.pixelRatio):(e=t.clientX*i.pixelRatio,a=(t.pageY-o.mp.currentTarget.offsetTop-i.height/i.pixelRatio/2*(i.pixelRatio-1))*i.pixelRatio):i.rotate?(a=i.height-t.x*i.pixelRatio,e=t.y*i.pixelRatio):(e=t.x*i.pixelRatio,a=t.y*i.pixelRatio),{x:e,y:a}}function getSeriesDataItem(e,t){var i=[];return e.forEach(function(e){if(null!==e.data[t]&&"undefined"!=typeof e.data[t]){var o={};o.color=e.color,o.type=e.type,o.style=e.style,o.shape=e.shape,o.disableLegend=e.disableLegend,o.name=e.name,o.data=e.format?e.format(e.data[t]):e.data[t],i.push(o)}}),i}function getMaxTextListLength(e){var t=e.map(function(e){return measureText(e)});return Math.max.apply(null,t)}function getRadarCoordinateSeries(e){for(var t=Math.PI,o=[],a=0;a<e;a++)o.push(2*t/e*a);return o.map(function(e){return-1*e+t/2})}function getToolTipData(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},n=e.map(function(e){return{text:a.format?a.format(e,o[i]):e.name+": "+e.data,color:e.color}}),l=[],s={x:0,y:0};return t.forEach(function(e){"undefined"!=typeof e[i]&&null!==e[i]&&l.push(e[i])}),l.forEach(function(e){s.x=Math.round(e.x),s.y+=e.y}),s.y/=l.length,{textList:n,offset:s}}function getMixToolTipData(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},n=e.map(function(e){return{text:a.format?a.format(e,o[i]):e.name+": "+e.data,color:e.color,disableLegend:!!e.disableLegend}});n=n.filter(function(e){if(!0!==e.disableLegend)return e});var l=[],s={x:0,y:0};return t.forEach(function(e){"undefined"!=typeof e[i]&&null!==e[i]&&l.push(e[i])}),l.forEach(function(e){s.x=Math.round(e.x),s.y+=e.y}),s.y/=l.length,{textList:n,offset:s}}function getCandleToolTipData(e,t,i,o,a,n){6<arguments.length&&void 0!==arguments[6]?arguments[6]:{};let l=n.color.upFill,s=n.color.downFill,r=[l,l,s,l];var d=[];let h={text:a[o],color:null};d.push(h),t.map(function(t){0==o&&0>t.data[1]-t.data[0]?r[1]=s:(t.data[0]<e[o-1][1]&&(r[0]=s),t.data[1]<t.data[0]&&(r[1]=s),t.data[2]>e[o-1][1]&&(r[2]=l),t.data[3]<e[o-1][1]&&(r[3]=s));let i={text:"\u5F00\u76D8\uFF1A"+t.data[0],color:r[0]},a={text:"\u6536\u76D8\uFF1A"+t.data[1],color:r[1]},n={text:"\u6700\u4F4E\uFF1A"+t.data[2],color:r[2]},h={text:"\u6700\u9AD8\uFF1A"+t.data[3],color:r[3]};d.push(i,a,n,h)});var x=[],c={x:0,y:0};return i.forEach(function(e){"undefined"!=typeof e[o]&&null!==e[o]&&x.push(e[o])}),c.x=Math.round(x[0][0].x),{textList:d,offset:c}}function findCurrentIndex(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,n=-1;return isInExactChartArea(e,i,o)&&t.forEach(function(t,i){e.x+a>t&&(n=i)}),n}function isInExactChartArea(e,t,i){return e.x<t.width-i.padding&&e.x>i.padding+i.yAxisWidth+i.yAxisTitleWidth&&e.y>i.padding&&e.y<t.height-i.legendHeight-i.xAxisHeight-i.padding}function findRadarChartCurrentIndex(e,t,i){var o=Math.PI,a=2*o/i,n=-1;if(isInExactPieChartArea(e,t.center,t.radius)){var l=function(e){return 0>e&&(e+=2*o),e>2*o&&(e-=2*o),e},s=Math.atan2(t.center.y-e.y,e.x-t.center.x);s=-1*s,0>s&&(s+=2*o);var r=t.angleList.map(function(e){return e=l(-1*e),e});r.forEach(function(e,t){var i=l(e-a/2),r=l(e+a/2);r<i&&(r+=2*o),(s>=i&&s<=r||s+2*o>=i&&s+2*o<=r)&&(n=t)})}return n}function findPieChartCurrentIndex(e,t){var o=-1;if(isInExactPieChartArea(e,t.center,t.radius)){var a=Math.atan2(t.center.y-e.y,e.x-t.center.x);a=-a;for(var n,l=0,s=t.series.length;l<s;l++)if(n=t.series[l],isInAngleRange(a,n._start_,n._start_+2*n._proportion_*Math.PI)){o=l;break}}return o}function isInExactPieChartArea(e,t,i){var o=Math.pow;return o(e.x-t.x,2)+o(e.y-t.y,2)<=o(i,2)}function splitPoints(e){var t=[],i=[];return e.forEach(function(e){null===e?(i.length&&t.push(i),i=[]):i.push(e)}),i.length&&t.push(i),t}function calLegendData(e,t,i){if(!1===t.legend)return{legendList:[],legendHeight:0};var o=5*t.pixelRatio,a=8*t.pixelRatio,n=15*t.pixelRatio,l=[],s=0,r=[];return e.forEach(function(e){var i=3*o+n+measureText(e.name||"undefined");s+i>t.width?(l.push(r),s=i,r=[e]):(s+=i,r.push(e))}),r.length&&l.push(r),{legendList:l,legendHeight:l.length*(i.fontSize+a)+o}}function calCategoriesData(e,t,i){var o={angle:0,xAxisHeight:i.xAxisHeight},a=getXAxisPoints(e,t,i),n=a.eachSpacing,l=e.map(function(e){return measureText(e)}),s=Math.max.apply(this,l);return!0==t.xAxis.rotateLabel&&s+2*i.xAxisTextPadding>n&&(o.angle=45*Math.PI/180,o.xAxisHeight=2*i.xAxisTextPadding+s*Math.sin(o.angle)),o}function getRadarDataPoints(e,t,i,o,a){var n=Math.max,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1,s=a.extra.radar||{};s.max=s.max||0;var r=n(s.max,n.apply(null,dataCombine(o))),d=[];return o.forEach(function(o){var a={};a.color=o.color,a.data=[],o.data.forEach(function(o,n){var s={};s.angle=e[n],s.proportion=o/r,s.position=convertCoordinateOrigin(i*s.proportion*l*Math.cos(s.angle),i*s.proportion*l*Math.sin(s.angle),t),a.data.push(s)}),d.push(a)}),d}function getPieDataPoints(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=0,o=0;return e.forEach(function(e){e.data=null===e.data?0:e.data,i+=e.data}),e.forEach(function(o){o.data=null===o.data?0:o.data,o._proportion_=0===i?1/e.length:o.data/i*t}),e.forEach(function(e){e._start_=o,o+=2*e._proportion_*Math.PI}),e}function getArcbarDataPoints(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return 1==i&&(i=.999999),e.forEach(function(e){e.data=null===e.data?0:e.data;let o;o="default"==t.type?t.startAngle-t.endAngle+1:2,e._proportion_=o*e.data*i+t.startAngle,2<=e._proportion_&&(e._proportion_%=2)}),e}function getGaugeAxisPoints(e,t,o){let a=t;for(let n=0;n<e.length;n++)e[n].value=null===e[n].value?0:e[n].value,e[n]._startAngle_=a,e[n]._endAngle_=(t-o+1)*e[n].value+t,2<=e[n]._endAngle_&&(e[n]._endAngle_%=2),a=e[n]._endAngle_;return e}function getGaugeDataPoints(e,t,i){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;return e.forEach(function(e){if(e.data=null===e.data?0:e.data,"auto"==i.pointer.color){for(let o=0;o<t.length;o++)if(e.data<=t[o].value){e.color=t[o].color;break}}else e.color=i.pointer.color;let a=i.startAngle-i.endAngle+1;e._endAngle_=a*e.data+i.startAngle,e._oldAngle_=i.oldAngle,i.oldAngle<i.endAngle&&(e._oldAngle_+=2),e._proportion_=e.data>=i.oldData?(e._endAngle_-e._oldAngle_)*o+i.oldAngle:e._oldAngle_-(e._oldAngle_-e._endAngle_)*o,2<=e._proportion_&&(e._proportion_%=2)}),e}function getPieTextMaxLength(e){e=getPieDataPoints(e);var t=0;return e.forEach(function(e){var i=e.format?e.format(+e._proportion_.toFixed(2)):util.toFixed(100*e._proportion_)+"%";t=Math.max(t,measureText(i))}),t}function fixColumeData(e,t,i,o,a,n){var l=Math.min;return e.map(function(e){return null===e?null:(e.width=(t-2*a.columePadding)/i,e.width=n.extra.column&&n.extra.column.width&&0<+n.extra.column.width?l(e.width,+n.extra.column.width):l(e.width,25),e.x+=(o+.5-i/2)*e.width,e)})}function fixColumeMeterData(e,t,i,o,a,n,l){var s=Math.min;return e.map(function(e){return null===e?null:(e.width=t-2*a.columePadding,e.width=n.extra.column&&n.extra.column.width&&0<+n.extra.column.width?s(e.width,+n.extra.column.width):s(e.width,25),0<o&&(e.width-=2*l),e)})}function fixColumeStackData(e,t,i,o,a,n){var l=Math.min;return e.map(function(e){return null===e?null:(e.width=t-2*a.columePadding,e.width=n.extra.column&&n.extra.column.width&&0<+n.extra.column.width?l(e.width,+n.extra.column.width):l(e.width,25),e)})}function getXAxisPoints(e,t,i){var o=i.yAxisWidth+i.yAxisTitleWidth,a=t.width-2*i.padding-o,n=t.enableScroll?Math.min(t.xAxis.itemCount,e.length):e.length,l=a/n,s=[],r=i.padding+o,d=t.width-i.padding;return e.forEach(function(e,t){s.push(r+t*l)}),!0===t.enableScroll?s.push(r+e.length*l):s.push(d),{xAxisPoints:s,startX:r,endX:d,eachSpacing:l}}function getCandleDataPoints(e,t,i,o,a,n,l){var s=Math.round,r=7<arguments.length&&void 0!==arguments[7]?arguments[7]:1,d=[],h=n.height-2*l.padding-l.xAxisHeight-l.legendHeight;return e.forEach(function(e,x){if(null===e)d.push(null);else{var c=[];e.forEach(function(e){var d={x:o[x]+s(a/2)},p=e.value||e,g=h*(p-t)/(i-t);g*=r,d.y=n.height-l.xAxisHeight-l.legendHeight-s(g)-l.padding,c.push(d)}),d.push(c)}}),d}function getDataPoints(e,t,i,o,a,n,l){var s=Math.round,r=7<arguments.length&&void 0!==arguments[7]?arguments[7]:1,d=[],h=n.height-2*l.padding-l.xAxisHeight-l.legendHeight;return e.forEach(function(e,x){if(null===e)d.push(null);else{var c={color:e.color,x:o[x]+s(a/2)},p=e;"object"==typeof e&&null!=e&&(p=e.value);var g=h*(p-t)/(i-t);g*=r,c.y=n.height-l.xAxisHeight-l.legendHeight-s(g)-l.padding,d.push(c)}}),d}function getStackDataPoints(e,t,i,o,a,n,l,s,r){var d=Math.round,h=9<arguments.length&&void 0!==arguments[9]?arguments[9]:1,x=[],c=n.height-2*l.padding-l.xAxisHeight-l.legendHeight;return e.forEach(function(e,p){if(null===e)x.push(null);else{var g={color:e.color,x:o[p]+d(a/2)};if(0<s){var y=0;for(let e=0;e<=s;e++)y+=r[e].data[p];var f=y-e,u=c*(y-t)/(i-t),m=c*(f-t)/(i-t)}else var y=e,u=c*(y-t)/(i-t),m=0;var A=m;u*=h,A*=h,g.y=n.height-l.xAxisHeight-l.legendHeight-d(u)-l.padding,g.y0=n.height-l.xAxisHeight-l.legendHeight-d(A)-l.padding,x.push(g)}}),x}function getYAxisTextList(e,t,o,a){var n,l=Math.min,s=Math.max;n="stack"==a?dataCombineStack(e):dataCombine(e);var r=[];n=n.filter(function(e){return"object"==typeof e&&null!==e?e.constructor==Array?null!==e:null!==e.value:null!==e}),n.map(e=>{"object"==typeof e?e.constructor==Array?e.map(e=>{r.push(e)}):r.push(e.value):r.push(e)});var d=0,h=0;if(0<r.length&&(d=l.apply(this,r),h=s.apply(this,r)),"number"==typeof t.yAxis.min&&(d=l(t.yAxis.min,d)),"number"==typeof t.yAxis.max&&(h=s(t.yAxis.max,h)),d===h){var x=h||10;h+=x}for(var c=getDataRange(d,h),p=c.minRange,g=c.maxRange,y=[],f=(g-p)/o.yAxisSplit,u=0;u<=o.yAxisSplit;u++)y.push(p+f*u);return y.reverse()}function calYAxisData(e,t,i){var o=assign({},t.extra.column||{type:""}),a=getYAxisTextList(e,t,i,o.type),n=i.yAxisWidth,l=a.map(function(e){return e=util.toFixed(e,2),e=t.yAxis.format?t.yAxis.format(+e):e,n=Math.max(n,measureText(e)+5),e});return!0===t.yAxis.disabled&&(n=0),{rangesFormat:l,ranges:a,yAxisWidth:n}}function calTooltipYAxisData(e,t,i,o){var a=getYAxisTextList(t,i,o),n=i.height-2*o.padding-o.xAxisHeight-o.legendHeight;let l=a[0],s=a[a.length-1],r=o.padding,d=o.padding+n,h=l-(l-s)*(e-r)/(d-r);return h=i.yAxis.format?i.yAxis.format(+h):h,h}function contextRotate(e,t){var i=Math.PI;!0===t.rotateLock?!0!==t._rotate_&&(e.translate(t.height,0),e.rotate(90*i/180),t._rotate_=!0):(e.translate(t.height,0),e.rotate(90*i/180))}function drawPointShape(e,t,i,o,a){o.beginPath(),o.setStrokeStyle("#ffffff"),o.setLineWidth(1*a.pixelRatio),o.setFillStyle(t),"diamond"===i?e.forEach(function(e){null!==e&&(o.moveTo(e.x,e.y-4.5),o.lineTo(e.x-4.5,e.y),o.lineTo(e.x,e.y+4.5),o.lineTo(e.x+4.5,e.y),o.lineTo(e.x,e.y-4.5))}):"circle"===i?e.forEach(function(e){null!==e&&(o.moveTo(e.x+3.5*a.pixelRatio,e.y),o.arc(e.x,e.y,4*a.pixelRatio,0,2*Math.PI,!1))}):"rect"===i?e.forEach(function(e){null!==e&&(o.moveTo(e.x-3.5,e.y-3.5),o.rect(e.x-3.5,e.y-3.5,7,7))}):"triangle"==i&&e.forEach(function(e){null!==e&&(o.moveTo(e.x,e.y-4.5),o.lineTo(e.x-4.5,e.y+4.5),o.lineTo(e.x+4.5,e.y+4.5),o.lineTo(e.x,e.y-4.5))}),o.closePath(),o.fill(),o.stroke()}function drawRingTitle(e,t,i){var o=e.title.fontSize||t.titleFontSize,a=e.subtitle.fontSize||t.subtitleFontSize,n=e.title.name||"",l=e.subtitle.name||"",s=e.title.color||t.titleColor,r=e.subtitle.color||t.subtitleColor,d=n?o:0,h=l?a:0,x=5;if(l){var c=measureText(l,a),p=(e.width-c)/2+(e.subtitle.offsetX||0),g=(e.height-t.legendHeight+a)/2+(e.subtitle.offsetY||0);n&&(g-=(d+x)/2),i.beginPath(),i.setFontSize(a),i.setFillStyle(r),i.fillText(l,p,g),i.closePath(),i.stroke()}if(n){var y=measureText(n,o),f=(e.width-y)/2+(e.title.offsetX||0),u=(e.height-t.legendHeight+o)/2+(e.title.offsetY||0);l&&(u+=(h+x)/2),i.beginPath(),i.setFontSize(o),i.setFillStyle(s),i.fillText(n,f,u),i.closePath(),i.stroke()}}function drawPointText(e,t,i,o){var a=t.data;e.forEach(function(e,n){if(null!==e){o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle("#666666");var l=a[n];"object"==typeof a[n]&&null!==a[n]&&(l=a[n].value);var s=t.format?t.format(l):l;o.fillText(s,e.x-measureText(s)/2,e.y-2),o.closePath(),o.stroke()}})}function drawGaugeLabel(e,t,i,o,a,n){var l=Math.PI;t-=e.width/2+a.gaugeLabelTextMargin;let s=e.startAngle-e.endAngle+1,r=s/e.splitLine.splitNumber,d=e.endNumber-e.startNumber,h=d/e.splitLine.splitNumber,x=e.startAngle,c=e.startNumber;for(let s=0;s<e.splitLine.splitNumber+1;s++){var p={x:t*Math.cos(x*l),y:t*Math.sin(x*l),x:i.x-measureText(c)/2,y:i.y},g=p.x,y=p.y;n.beginPath(),n.setFontSize(a.fontSize),n.setFillStyle(e.labelColor||"#666666"),n.fillText(c,g,y+a.fontSize/2),n.closePath(),n.stroke(),x+=r,2<=x&&(x%=2),c+=h}}function drawRadarLabel(e,t,i,o,a,n){var l=o.extra.radar||{};t+=a.radarLabelTextMargin,e.forEach(function(e,s){var r={x:t*Math.cos(e),y:t*Math.sin(e)},d=convertCoordinateOrigin(r.x,r.y,i),h=d.x,x=d.y;util.approximatelyEqual(r.x,0)?h-=measureText(o.categories[s]||"")/2:0>r.x&&(h-=measureText(o.categories[s]||"")),n.beginPath(),n.setFontSize(a.fontSize),n.setFillStyle(l.labelColor||"#666666"),n.fillText(o.categories[s]||"",h,x+a.fontSize/2),n.closePath(),n.stroke()})}function drawPieText(e,t,i,o,a,n){var l=Math.cos,s=Math.sin,r=Math.min,d=Math.max,h=Math.PI,x=a+i.pieChartLinePadding,c=[],p=null,g=e.map(function(e){var t=2*h-(e._start_+2*h*e._proportion_/2),i=e.format?e.format(+e._proportion_.toFixed(2)):util.toFixed(100*e._proportion_)+"%",o=e.color;return{arc:t,text:i,color:o}});g.forEach(function(e){var t=l(e.arc)*x,o=s(e.arc)*x,n=l(e.arc)*a,h=s(e.arc)*a,g=0<=t?t+i.pieChartTextPadding:t-i.pieChartTextPadding,y=o,f=measureText(e.text),u=y;p&&util.isSameXCoordinateArea(p.start,{x:g})&&(0<g?u=r(y,p.start.y):0>t?u=d(y,p.start.y):0<y?u=d(y,p.start.y):u=r(y,p.start.y)),0>g&&(g-=f);var m={lineStart:{x:n,y:h},lineEnd:{x:t,y:o},start:{x:g,y:u},width:f,height:i.fontSize,text:e.text,color:e.color};p=avoidCollision(m,p),c.push(p)}),c.forEach(function(e){var a=convertCoordinateOrigin(e.lineStart.x,e.lineStart.y,n),l=convertCoordinateOrigin(e.lineEnd.x,e.lineEnd.y,n),s=convertCoordinateOrigin(e.start.x,e.start.y,n);o.setLineWidth(1*t.pixelRatio),o.setFontSize(i.fontSize),o.beginPath(),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.moveTo(a.x,a.y);var r=0>e.start.x?s.x+e.width:s.x,d=0>e.start.x?s.x-5:s.x+5;o.quadraticCurveTo(l.x,l.y,r,s.y),o.moveTo(a.x,a.y),o.stroke(),o.closePath(),o.beginPath(),o.moveTo(s.x+e.width,s.y),o.arc(r,s.y,2,0,2*h),o.closePath(),o.fill(),o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle("#666666"),o.fillText(e.text,d,s.y+3),o.closePath(),o.stroke(),o.closePath()})}function drawToolTipSplitLine(e,t,i,o){var a=t.extra.tooltip||{};a.gridType=null==a.gridType?"solid":a.gridType,a.dashLength=null==a.dashLength?4:a.dashLength;var n=i.padding,l=t.height-i.padding-i.xAxisHeight-i.legendHeight;if("dash"==a.gridType&&o.setLineDash([a.dashLength,a.dashLength]),o.beginPath(),o.setStrokeStyle(a.gridColor||"#cccccc"),o.setLineWidth(1*t.pixelRatio),o.moveTo(e,n),o.lineTo(e,l),o.closePath(),o.stroke(),o.setLineDash([]),a.xAxisLabel){let n=t.categories[t.tooltip.index];o.setFontSize(i.fontSize);let s=o.measureText(n).width,r=e-i.toolTipPadding-.5*s,d=l;o.beginPath(),o.setFillStyle(hexToRgb(a.labelBgColor||i.toolTipBackground,a.labelBgOpacity||i.toolTipOpacity)),o.setStrokeStyle(a.labelBgColor||i.toolTipBackground),o.setLineWidth(1*t.pixelRatio),o.rect(r,d,s+2*i.toolTipPadding,i.fontSize+2*i.toolTipPadding),o.closePath(),o.stroke(),o.fill(),o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle(a.labelFontColor||i.fontColor),o.fillText(n,r+2*i.toolTipPadding,d+i.toolTipPadding+i.fontSize),o.closePath(),o.stroke()}}function drawToolTipHorizentalLine(e,t,i,o){var a=e.extra.tooltip||{};a.gridType=null==a.gridType?"solid":a.gridType,a.dashLength=null==a.dashLength?4:a.dashLength;var n=t.padding+t.yAxisWidth+t.yAxisTitleWidth,l=e.width-t.padding;if("dash"==a.gridType&&i.setLineDash([a.dashLength,a.dashLength]),i.beginPath(),i.setStrokeStyle(a.gridColor||"#cccccc"),i.setLineWidth(1*e.pixelRatio),i.moveTo(n,e.tooltip.offset.y),i.lineTo(l,e.tooltip.offset.y),i.closePath(),i.stroke(),i.setLineDash([]),a.yAxisLabel){let l=calTooltipYAxisData(e.tooltip.offset.y,e.series,e,t,o);i.setFontSize(t.fontSize);let s=i.measureText(l).width,r=n-2*t.toolTipPadding-s,d=e.tooltip.offset.y;i.beginPath(),i.setFillStyle(hexToRgb(a.labelBgColor||t.toolTipBackground,a.labelBgOpacity||t.toolTipOpacity)),i.setStrokeStyle(a.labelBgColor||t.toolTipBackground),i.setLineWidth(1*e.pixelRatio),i.rect(r,d-.5*t.fontSize-t.toolTipPadding,s+2*t.toolTipPadding,t.fontSize+2*t.toolTipPadding),i.closePath(),i.stroke(),i.fill(),i.beginPath(),i.setFontSize(t.fontSize),i.setFillStyle(a.labelFontColor||t.fontColor),i.fillText(l,r+t.toolTipPadding,d+.5*t.fontSize),i.closePath(),i.stroke()}}function drawToolTipSplitArea(e,t,i,o,a){var n=t.extra.tooltip||{activeBgColor:"#000000",activeBgOpacity:.08};n.activeBgColor=n.activeBgColor?n.activeBgColor:"#000000",n.activeBgOpacity=n.activeBgOpacity?n.activeBgOpacity:.08;var l=i.padding,s=t.height-i.padding-i.xAxisHeight-i.legendHeight;o.beginPath(),o.setFillStyle(hexToRgb(n.activeBgColor,n.activeBgOpacity)),o.rect(e-a/2,l,a,s-l),o.closePath(),o.fill()}function drawToolTip(e,t,i,o,a){var n=Math.round,l=i.extra.tooltip||{bgColor:"#000000",bgOpacity:.7,fontColor:"#FFFFFF"};l.bgColor=l.bgColor?l.bgColor:"#000000",l.bgOpacity=l.bgOpacity?l.bgOpacity:.7,l.fontColor=l.fontColor?l.fontColor:"#FFFFFF";var s=4*i.pixelRatio,r=5*i.pixelRatio,d=8*i.pixelRatio,h=!1;("line"==i.type||"area"==i.type||"candle"==i.type||"mix"==i.type)&&drawToolTipSplitLine(i.tooltip.offset.x,i,o,a),t=assign({x:0,y:0},t),t.y-=8*i.pixelRatio;var x=e.map(function(e){return measureText(e.text)}),c=s+r+4*o.toolTipPadding+Math.max.apply(null,x),p=2*o.toolTipPadding+e.length*o.toolTipLineHeight;t.x-Math.abs(i._scrollDistance_)+d+c>i.width&&(h=!0),a.beginPath(),a.setFillStyle(hexToRgb(l.bgColor||o.toolTipBackground,l.bgOpacity||o.toolTipOpacity)),h?(a.moveTo(t.x,t.y+10*i.pixelRatio),a.lineTo(t.x-d,t.y+10*i.pixelRatio-5*i.pixelRatio),a.lineTo(t.x-d,t.y),a.lineTo(t.x-d-n(c),t.y),a.lineTo(t.x-d-n(c),t.y+p),a.lineTo(t.x-d,t.y+p),a.lineTo(t.x-d,t.y+10*i.pixelRatio+5*i.pixelRatio),a.lineTo(t.x,t.y+10*i.pixelRatio)):(a.moveTo(t.x,t.y+10*i.pixelRatio),a.lineTo(t.x+d,t.y+10*i.pixelRatio-5*i.pixelRatio),a.lineTo(t.x+d,t.y),a.lineTo(t.x+d+n(c),t.y),a.lineTo(t.x+d+n(c),t.y+p),a.lineTo(t.x+d,t.y+p),a.lineTo(t.x+d,t.y+10*i.pixelRatio+5*i.pixelRatio),a.lineTo(t.x,t.y+10*i.pixelRatio)),a.closePath(),a.fill(),e.forEach(function(e,i){if(null!==e.color){a.beginPath(),a.setFillStyle(e.color);var n=t.x+d+2*o.toolTipPadding,l=t.y+(o.toolTipLineHeight-o.fontSize)/2+o.toolTipLineHeight*i+o.toolTipPadding+1;h&&(n=t.x-c-d+2*o.toolTipPadding),a.fillRect(n,l,s,o.fontSize),a.closePath()}}),e.forEach(function(e,i){var n=t.x+d+2*o.toolTipPadding+s+r;h&&(n=t.x-c-d+2*o.toolTipPadding+ +s+r);var x=t.y+(o.toolTipLineHeight-o.fontSize)/2+o.toolTipLineHeight*i+o.toolTipPadding;a.beginPath(),a.setFontSize(o.fontSize),a.setFillStyle(l.fontColor),a.fillText(e.text,n,x+o.fontSize),a.closePath(),a.stroke()})}function drawYAxisTitle(e,t,i,o){var a=i.xAxisHeight+(t.height-i.xAxisHeight-measureText(e))/2;o.save(),o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle(t.yAxis.titleFontColor||"#333333"),o.translate(0,t.height),o.rotate(-90*Math.PI/180),o.fillText(e,a,i.padding+.5*i.fontSize),o.closePath(),o.stroke(),o.restore()}function drawColumnDataPoints(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,n=t.extra.column||{type:{},meter:{}};n.type=null==n.type?"group":n.type,n.meter=n.meter||{},n.meter.border=null==n.meter.border?4:n.meter.border,n.meter.fillColor=null==n.meter.fillColor?"#FFFFFF":n.meter.fillColor;var l=calYAxisData(e,t,i),s=l.ranges,r=getXAxisPoints(t.categories,t,i),d=r.xAxisPoints,h=r.eachSpacing,x=s.pop(),c=s.shift(),p=[];return o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&o.translate(t._scrollDistance_,0),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===a&&drawToolTipSplitArea(t.tooltip.offset.x,t,i,o,h),e.forEach(function(l,s){var r=l.data;switch(n.type){case"group":var g=getDataPoints(r,x,c,d,h,t,i,a),y=getStackDataPoints(r,x,c,d,h,t,i,s,e,a);p.push(y),g=fixColumeData(g,h,e.length,s,i,t),g.forEach(function(e){if(null!==e){o.beginPath(),o.setFillStyle(e.color||l.color);var a=e.x-e.width/2+1,n=t.height-e.y-i.padding-i.xAxisHeight-i.legendHeight;o.moveTo(a,e.y),o.fillRect(a,e.y,e.width-2,n),o.closePath(),o.fill()}});break;case"stack":var g=getStackDataPoints(r,x,c,d,h,t,i,s,e,a);p.push(g),g=fixColumeStackData(g,h,e.length,s,i,t,e),g.forEach(function(e){if(null!==e){o.beginPath(),o.setFillStyle(e.color||l.color);var a=e.x-e.width/2+1,n=t.height-e.y-i.padding-i.xAxisHeight-i.legendHeight,r=t.height-e.y0-i.padding-i.xAxisHeight-i.legendHeight;0<s&&(n-=r),o.moveTo(a,e.y),o.fillRect(a,e.y,e.width-2,n),o.closePath(),o.fill()}});break;case"meter":var g=getDataPoints(r,x,c,d,h,t,i,a);p.push(g),g=fixColumeMeterData(g,h,e.length,s,i,t,n.meter.border),0==s?g.forEach(function(e){if(null!==e){o.beginPath(),o.setFillStyle(n.meter.fillColor);var a=e.x-e.width/2+1,s=t.height-e.y-i.padding-i.xAxisHeight-i.legendHeight;o.moveTo(a,e.y),o.fillRect(a,e.y,e.width-2,s),o.closePath(),o.fill(),o.beginPath(),o.setStrokeStyle(l.color),o.setLineWidth(n.meter.border*t.pixelRatio),o.moveTo(a+.5*n.meter.border,e.y+s),o.lineTo(a+.5*n.meter.border,e.y+.5*n.meter.border),o.lineTo(a+e.width-n.meter.border,e.y+.5*n.meter.border),o.lineTo(a+e.width-n.meter.border,e.y+s),o.stroke()}}):g.forEach(function(e){if(null!==e){o.beginPath(),o.setFillStyle(e.color||l.color);var a=e.x-e.width/2+1,n=t.height-e.y-i.padding-i.xAxisHeight-i.legendHeight;o.moveTo(a,e.y),o.rect(a,e.y,e.width-2,n),o.closePath(),o.fill()}});}}),!1!==t.dataLabel&&1===a&&e.forEach(function(l,s){var r=l.data;switch(n.type){case"group":var p=getDataPoints(r,x,c,d,h,t,i,a);p=fixColumeData(p,h,e.length,s,i,t),drawPointText(p,l,i,o);break;case"stack":var p=getStackDataPoints(r,x,c,d,h,t,i,s,e,a);drawPointText(p,l,i,o);break;case"meter":var p=getDataPoints(r,x,c,d,h,t,i,a);drawPointText(p,l,i,o);}}),o.restore(),{xAxisPoints:d,calPoints:p,eachSpacing:h}}function drawCandleDataPoints(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,n=t.extra.candle||{color:{},average:{}};n.color.upLine=n.color.upLine?n.color.upLine:"#f04864",n.color.upFill=n.color.upFill?n.color.upFill:"#f04864",n.color.downLine=n.color.downLine?n.color.downLine:"#2fc25b",n.color.downFill=n.color.downFill?n.color.downFill:"#2fc25b",n.average.show=!0===n.average.show,n.average.name=n.average.name?n.average.name:[],n.average.day=n.average.day?n.average.day:[],n.average.color=n.average.color?n.average.color:["#1890ff","#2fc25b","#facc14","#f04864","#8543e0","#90ed7d"],t.extra.candle=n;var l=calYAxisData(e,t,i),s=l.ranges,r=getXAxisPoints(t.categories,t,i),d=r.xAxisPoints,h=r.eachSpacing,x=s.pop(),c=s.shift(),p=[];return o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&o.translate(t._scrollDistance_,0),e.forEach(function(e){var l=e.data,s=getCandleDataPoints(l,x,c,d,h,t,i,a);p.push(s);var r=splitPoints(s);r=r[0],r.forEach(function(e,i){o.beginPath(),0<l[i][1]-l[i][0]?(o.setStrokeStyle(n.color.upLine),o.setFillStyle(n.color.upFill),o.setLineWidth(1*t.pixelRatio),o.moveTo(e[3].x,e[3].y),o.lineTo(e[1].x,e[1].y),o.lineTo(e[1].x-h/4,e[1].y),o.lineTo(e[0].x-h/4,e[0].y),o.lineTo(e[0].x,e[0].y),o.lineTo(e[2].x,e[2].y),o.lineTo(e[0].x,e[0].y),o.lineTo(e[0].x+h/4,e[0].y),o.lineTo(e[1].x+h/4,e[1].y),o.lineTo(e[1].x,e[1].y),o.moveTo(e[3].x,e[3].y)):(o.setStrokeStyle(n.color.downLine),o.setFillStyle(n.color.downFill),o.setLineWidth(1*t.pixelRatio),o.moveTo(e[3].x,e[3].y),o.lineTo(e[0].x,e[0].y),o.lineTo(e[0].x-h/4,e[0].y),o.lineTo(e[1].x-h/4,e[1].y),o.lineTo(e[1].x,e[1].y),o.lineTo(e[2].x,e[2].y),o.lineTo(e[1].x,e[1].y),o.lineTo(e[1].x+h/4,e[1].y),o.lineTo(e[0].x+h/4,e[0].y),o.lineTo(e[0].x,e[0].y),o.moveTo(e[3].x,e[3].y)),o.closePath(),o.fill(),o.stroke()})}),o.restore(),n.average.show,{xAxisPoints:d,calPoints:p,eachSpacing:h}}function drawAreaDataPoints(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,n=t.extra.area||{type:"straight",opacity:.5,addLine:!1,width:2};n.type=n.type?n.type:"straight",n.opacity=n.opacity?n.opacity:.2,n.addLine=!0==n.addLine,n.width=n.width?n.width:2;var l=calYAxisData(e,t,i),s=l.ranges,r=getXAxisPoints(t.categories,t,i),d=r.xAxisPoints,h=r.eachSpacing,x=s.pop(),c=s.shift(),p=t.height-i.padding-i.xAxisHeight-i.legendHeight,g=[];return o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&o.translate(t._scrollDistance_,0),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===a&&drawToolTipSplitLine(t.tooltip.offset.x,t,i,o),e.forEach(function(e,l){var s=e.data,r=getDataPoints(s,x,c,d,h,t,i,a);g.push(r);var y=splitPoints(r);if(y.forEach(function(i){if(o.beginPath(),o.setStrokeStyle(hexToRgb(e.color,n.opacity)),o.setFillStyle(hexToRgb(e.color,n.opacity)),o.setLineWidth(n.width*t.pixelRatio),1<i.length){var a=i[0],l=i[i.length-1];o.moveTo(a.x,a.y),"curve"===n.type?i.forEach(function(e,t){if(0<t){var a=createCurveControlPoints(i,t-1);o.bezierCurveTo(a.ctrA.x,a.ctrA.y,a.ctrB.x,a.ctrB.y,e.x,e.y)}}):i.forEach(function(e,t){0<t&&o.lineTo(e.x,e.y)}),o.lineTo(l.x,p),o.lineTo(a.x,p),o.lineTo(a.x,a.y)}else{var s=i[0];o.moveTo(s.x-h/2,s.y),o.lineTo(s.x+h/2,s.y),o.lineTo(s.x+h/2,p),o.lineTo(s.x-h/2,p),o.moveTo(s.x-h/2,s.y)}o.closePath(),o.fill(),n.addLine&&(o.beginPath(),o.setStrokeStyle(e.color),o.setLineWidth(n.width*t.pixelRatio),1===i.length?(o.moveTo(i[0].x,i[0].y),o.arc(i[0].x,i[0].y,1,0,2*Math.PI)):(o.moveTo(i[0].x,i[0].y),"curve"===n.type?i.forEach(function(e,t){if(0<t){var a=createCurveControlPoints(i,t-1);o.bezierCurveTo(a.ctrA.x,a.ctrA.y,a.ctrB.x,a.ctrB.y,e.x,e.y)}}):i.forEach(function(e,t){0<t&&o.lineTo(e.x,e.y)}),o.moveTo(i[0].x,i[0].y)),o.closePath(),o.stroke())}),!1!==t.dataPointShape){var f=i.dataPointShape[l%i.dataPointShape.length];drawPointShape(r,e.color,f,o,t)}}),!1!==t.dataLabel&&1===a&&e.forEach(function(e){var n=e.data,l=getDataPoints(n,x,c,d,h,t,i,a);drawPointText(l,e,i,o)}),o.restore(),{xAxisPoints:d,calPoints:g,eachSpacing:h}}function drawLineDataPoints(e,t,i,o){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,n=t.extra.line||{type:"straight",width:2};n.type=n.type?n.type:"straight",n.width=n.width?n.width:2;var l=calYAxisData(e,t,i),s=l.ranges,r=getXAxisPoints(t.categories,t,i),d=r.xAxisPoints,h=r.eachSpacing,x=s.pop(),c=s.shift(),p=[];return o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&o.translate(t._scrollDistance_,0),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===a&&drawToolTipSplitLine(t.tooltip.offset.x,t,i,o),e.forEach(function(e,l){var s=e.data,r=getDataPoints(s,x,c,d,h,t,i,a);p.push(r);var g=splitPoints(r);if(g.forEach(function(i){o.beginPath(),o.setStrokeStyle(e.color),o.setLineWidth(n.width*t.pixelRatio),1===i.length?(o.moveTo(i[0].x,i[0].y),o.arc(i[0].x,i[0].y,1,0,2*Math.PI)):(o.moveTo(i[0].x,i[0].y),"curve"===n.type?i.forEach(function(e,t){if(0<t){var a=createCurveControlPoints(i,t-1);o.bezierCurveTo(a.ctrA.x,a.ctrA.y,a.ctrB.x,a.ctrB.y,e.x,e.y)}}):i.forEach(function(e,t){0<t&&o.lineTo(e.x,e.y)}),o.moveTo(i[0].x,i[0].y)),o.closePath(),o.stroke()}),!1!==t.dataPointShape){var y=i.dataPointShape[l%i.dataPointShape.length];drawPointShape(r,e.color,y,o,t)}}),!1!==t.dataLabel&&1===a&&e.forEach(function(e){var n=e.data,l=getDataPoints(n,x,c,d,h,t,i,a);drawPointText(l,e,i,o)}),o.restore(),{xAxisPoints:d,calPoints:p,eachSpacing:h}}function drawMixDataPoints(e,t,i,o){var a=Math.PI,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,l=calYAxisData(e,t,i),s=l.ranges,r=getXAxisPoints(t.categories,t,i),d=r.xAxisPoints,h=r.eachSpacing,x=s.pop(),c=s.shift(),p=t.height-i.padding-i.xAxisHeight-i.legendHeight,g=[],y=0,f=0;if(e.forEach(function(e){"column"==e.type&&(f+=1)}),o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&o.translate(t._scrollDistance_,0),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===n&&drawToolTipSplitLine(t.tooltip.offset.x,t,i,o),e.forEach(function(e,l){var s=e.data,r=getDataPoints(s,x,c,d,h,t,i,n);if(g.push(r),"column"==e.type&&(r=fixColumeData(r,h,f,y,i,t),r.forEach(function(a){if(null!==a){o.beginPath(),o.setFillStyle(a.color||e.color);var n=a.x-a.width/2+1,l=t.height-a.y-i.padding-i.xAxisHeight-i.legendHeight;o.moveTo(n,a.y),o.rect(n,a.y,a.width-2,l),o.closePath(),o.fill()}}),y+=1),"area"==e.type){var u=splitPoints(r);u.forEach(function(i){if(o.beginPath(),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.setGlobalAlpha(.2),o.setLineWidth(2*t.pixelRatio),1<i.length){var a=i[0],n=i[i.length-1];o.moveTo(a.x,a.y),"curve"===e.style?i.forEach(function(e,t){if(0<t){var a=createCurveControlPoints(i,t-1);o.bezierCurveTo(a.ctrA.x,a.ctrA.y,a.ctrB.x,a.ctrB.y,e.x,e.y)}}):i.forEach(function(e,t){0<t&&o.lineTo(e.x,e.y)}),o.lineTo(n.x,p),o.lineTo(a.x,p),o.lineTo(a.x,a.y)}else{var l=i[0];o.moveTo(l.x-h/2,l.y),o.lineTo(l.x+h/2,l.y),o.lineTo(l.x+h/2,p),o.lineTo(l.x-h/2,p),o.moveTo(l.x-h/2,l.y)}o.closePath(),o.fill(),o.setGlobalAlpha(1)})}if("line"==e.type){var u=splitPoints(r);u.forEach(function(i){o.beginPath(),o.setStrokeStyle(e.color),o.setLineWidth(2*t.pixelRatio),1===i.length?(o.moveTo(i[0].x,i[0].y),o.arc(i[0].x,i[0].y,1,0,2*a)):(o.moveTo(i[0].x,i[0].y),"curve"==e.style?i.forEach(function(e,t){if(0<t){var a=createCurveControlPoints(i,t-1);o.bezierCurveTo(a.ctrA.x,a.ctrA.y,a.ctrB.x,a.ctrB.y,e.x,e.y)}}):i.forEach(function(e,t){0<t&&o.lineTo(e.x,e.y)}),o.moveTo(i[0].x,i[0].y)),o.closePath(),o.stroke()})}if("point"==e.type){var u=splitPoints(r);u.forEach(function(i){o.beginPath(),o.setStrokeStyle(e.color),o.setLineWidth(2*t.pixelRatio),o.moveTo(i[0].x,i[0].y),o.arc(i[0].x,i[0].y,1,0,2*a),o.closePath(),o.stroke()})}if(!1!==t.dataPointShape&&"column"!==e.type){var m=i.dataPointShape[l%i.dataPointShape.length];drawPointShape(r,e.color,m,o,t)}}),!1!==t.dataLabel&&1===n){var y=0;e.forEach(function(e){var a=e.data,l=getDataPoints(a,x,c,d,h,t,i,n);"column"===e.type?(l=fixColumeData(l,h,f,y,i,t),drawPointText(l,e,i,o),y+=1):drawPointText(l,e,i,o)})}return o.restore(),{xAxisPoints:d,calPoints:g,eachSpacing:h}}function drawToolTipBridge(e,t,i,o,a,n){var l=e.extra.tooltip||{};l.horizentalLine&&e.tooltip&&1===o&&("line"==e.type||"area"==e.type||"column"==e.type||"candle"==e.type||"mix"==e.type)&&drawToolTipHorizentalLine(e,t,i,a,n),i.save(),e._scrollDistance_&&0!==e._scrollDistance_&&!0===e.enableScroll&&i.translate(e._scrollDistance_,0),e.tooltip&&e.tooltip.textList&&e.tooltip.textList.length&&1===o&&drawToolTip(e.tooltip.textList,e.tooltip.offset,e,t,i,a,n),i.restore()}function drawXAxis(e,t,i,o){var a=Math.ceil,n=getXAxisPoints(e,t,i),l=n.xAxisPoints,s=n.startX,r=n.endX,d=n.eachSpacing,h=t.height-i.padding-i.xAxisHeight-i.legendHeight,x=i.padding;if(t.enableScroll&&t.xAxis.scrollShow){var c=t.height-i.padding-i.legendHeight+6*t.pixelRatio,p=r-s,g=d*(l.length-1),y=0;t._scrollDistance_&&(y=-t._scrollDistance_*p/g),o.beginPath(),o.setLineCap("round"),o.setLineWidth(6*t.pixelRatio),o.setStrokeStyle(t.xAxis.scrollBackgroundColor||"#EFEBEF"),o.moveTo(s,c),o.lineTo(r,c),o.stroke(),o.closePath(),o.beginPath(),o.setLineCap("round"),o.setLineWidth(6*t.pixelRatio),o.setStrokeStyle(t.xAxis.scrollColor||"#A6A6A6"),o.moveTo(s+y,c),o.lineTo(s+y+p*p/g,c),o.stroke(),o.setLineCap("butt"),o.closePath()}if(o.save(),t._scrollDistance_&&0!==t._scrollDistance_&&o.translate(t._scrollDistance_,0),o.beginPath(),o.setStrokeStyle(t.xAxis.gridColor||"#cccccc"),o.setLineCap("butt"),o.setLineWidth(1*t.pixelRatio),"dash"==t.xAxis.gridType&&o.setLineDash([t.xAxis.dashLength,t.xAxis.dashLength]),!0!==t.xAxis.disableGrid&&("calibration"===t.xAxis.type?l.forEach(function(e,i){0<i&&(o.moveTo(e-d/2,h),o.lineTo(e-d/2,h+4*t.pixelRatio))}):l.forEach(function(e){o.moveTo(e,h),o.lineTo(e,x)})),o.closePath(),o.stroke(),o.setLineDash([]),!0!==t.xAxis.disabled){var f=t.width-2*i.padding-i.yAxisWidth-i.yAxisTitleWidth,u=Math.min(e.length,a(f/i.fontSize/1.5)),m=a(e.length/u);e=e.map(function(e,t){return 0==t%m?e:""}),0===i._xAxisTextAngle_?e.forEach(function(e,a){var n=d/2-measureText(e)/2;o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle(t.xAxis.fontColor||"#666666"),o.fillText(e,l[a]+n,h+i.fontSize+5),o.closePath(),o.stroke()}):e.forEach(function(e,a){o.save(),o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle(t.xAxis.fontColor||"#666666");var n=measureText(e),s=calRotateTranslate(l[a]+d/2,h+i.fontSize/2+5,t.height),r=s.transX,x=s.transY;o.rotate(-1*i._xAxisTextAngle_),o.translate(r,x),o.fillText(e,l[a]+(d/2-n),h+i.fontSize+5),o.closePath(),o.stroke(),o.restore()})}o.restore()}function drawYAxisGrid(e,t,o,a){if(!0!==t.yAxis.disableGrid){for(var n=t.height-2*o.padding-o.xAxisHeight-o.legendHeight,l=Math.floor(n/o.yAxisSplit),s=o.yAxisWidth+o.yAxisTitleWidth,r=o.padding+s,d=getXAxisPoints(e,t,o),h=d.xAxisPoints,x=d.eachSpacing,c=x*(h.length-1),p=r+c,g=[],y=0;y<o.yAxisSplit;y++)g.push(o.padding+l*y);g.push(o.padding+l*o.yAxisSplit+2),a.save(),t._scrollDistance_&&0!==t._scrollDistance_&&a.translate(t._scrollDistance_,0),"dash"==t.yAxis.gridType&&a.setLineDash([t.yAxis.dashLength,t.yAxis.dashLength]),a.beginPath(),a.setStrokeStyle(t.yAxis.gridColor||"#cccccc"),a.setLineWidth(1*t.pixelRatio),g.forEach(function(e){a.moveTo(r,e),a.lineTo(p,e)}),a.closePath(),a.stroke(),a.setLineDash([]),a.restore()}}function drawYAxis(e,t,o,a){if(!0!==t.yAxis.disabled){var n=calYAxisData(e,t,o),l=n.rangesFormat,s=o.yAxisWidth+o.yAxisTitleWidth,r=t.height-2*o.padding-o.xAxisHeight-o.legendHeight,d=Math.floor(r/o.yAxisSplit),h=o.padding+s,x=t.width-o.padding,c=t.height-o.padding-o.xAxisHeight-o.legendHeight+o.xAxisTextPadding;a.beginPath(),a.setFillStyle(t.background||"#ffffff"),0>t._scrollDistance_&&a.fillRect(0,0,h,c+o.xAxisHeight),a.fillRect(x,0,t.width,c+o.xAxisHeight),a.closePath(),a.stroke();for(var p=[],g=0;g<=o.yAxisSplit;g++)p.push(o.padding+d*g);l.forEach(function(e,i){var n=p[i]?p[i]:c;a.beginPath(),a.setFontSize(o.fontSize),a.setFillStyle(t.yAxis.fontColor||"#666666"),a.fillText(e,o.padding+o.yAxisTitleWidth,n+o.fontSize/2),a.closePath(),a.stroke()}),t.yAxis.title&&drawYAxisTitle(t.yAxis.title,t,o,a)}}function drawLegend(e,t,i,o){var a=Math.PI;if(!1!==t.legend){var n=calLegendData(e,t,i),l=n.legendList,s=5*t.pixelRatio,r=10*t.pixelRatio,d=15*t.pixelRatio;l.forEach(function(e,n){var l=0;e.forEach(function(e){e.name=e.name||"undefined",l+=3*s+measureText(e.name)+d});var h=(t.width-l)/2+s,x=t.height-i.padding-i.legendHeight+n*(i.fontSize+r)+s+r;o.setFontSize(i.fontSize),e.forEach(function(e){switch(t.type){case"line":o.beginPath(),o.setLineWidth(1*t.pixelRatio),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.moveTo(h+7.5*t.pixelRatio,x+5*t.pixelRatio),o.arc(h+7.5*t.pixelRatio,x+5*t.pixelRatio,6*t.pixelRatio,0,2*a),o.closePath(),o.fill(),o.stroke();break;case"pie":o.beginPath(),o.setLineWidth(1*t.pixelRatio),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.moveTo(h+7.5*t.pixelRatio,x+5*t.pixelRatio),o.arc(h+7.5*t.pixelRatio,x+5*t.pixelRatio,6*t.pixelRatio,0,2*a),o.closePath(),o.fill(),o.stroke();break;case"ring":o.beginPath(),o.setLineWidth(1*t.pixelRatio),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.moveTo(h+7.5*t.pixelRatio,x+5*t.pixelRatio),o.arc(h+7.5*t.pixelRatio,x+5*t.pixelRatio,6*t.pixelRatio,0,2*a),o.closePath(),o.fill(),o.stroke();break;case"gauge":break;case"arcbar":break;default:o.beginPath(),o.setLineWidth(1*t.pixelRatio),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.moveTo(h,x),o.fillRect(h,x,15*t.pixelRatio,10*t.pixelRatio),o.closePath(),o.fill(),o.stroke();}h+=s+d,o.beginPath(),o.setFontSize(i.fontSize),o.setFillStyle(t.extra.legendTextColor||"#333333"),o.fillText(e.name,h,x+6*t.pixelRatio+3*t.pixelRatio),o.closePath(),o.stroke(),h+=measureText(e.name)+2*s})})}}function drawPieDataPoints(e,t,o,a){var n=Math.PI,l=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,s=t.extra.pie||{};e=getPieDataPoints(e,l);var r={x:t.width/2,y:(t.height-o.legendHeight)/2},d=Math.min(r.x-o.pieChartLinePadding-o.pieChartTextPadding-o._pieTextMaxLength_,r.y-o.pieChartLinePadding-o.pieChartTextPadding);d-=t.dataLabel?10:2*o.padding;var h=d+o.pieChartLinePadding/2;if(e=e.map(function(e){return e._start_+=(s.offsetAngle||0)*n/180,e}),e.forEach(function(e,i){t.tooltip&&t.tooltip.index==i&&(a.beginPath(),a.setFillStyle(hexToRgb(e.color,t.extra.pie.activeOpacity||.5)),a.moveTo(r.x,r.y),a.arc(r.x,r.y,h,e._start_,e._start_+2*e._proportion_*n),a.closePath(),a.fill()),a.beginPath(),a.setLineWidth(2*t.pixelRatio),a.lineJoin="round",a.setStrokeStyle("#ffffff"),a.setFillStyle(e.color),a.moveTo(r.x,r.y),a.arc(r.x,r.y,d,e._start_,e._start_+2*e._proportion_*n),a.closePath(),a.fill(),!0!==t.disablePieStroke&&a.stroke()}),"ring"===t.type){var x=.6*d;"number"==typeof t.extra.pie.ringWidth&&0<t.extra.pie.ringWidth&&(x=Math.max(0,d-t.extra.pie.ringWidth)),a.beginPath(),a.setFillStyle(t.background||"#ffffff"),a.moveTo(r.x,r.y),a.arc(r.x,r.y,x,0,2*n),a.closePath(),a.fill()}if(!1!==t.dataLabel&&1===l){for(var c=!1,p=0,g=e.length;p<g;p++)if(0<e[p].data){c=!0;break}c&&drawPieText(e,t,o,a,d,r)}return 1===l&&"ring"===t.type&&drawRingTitle(t,o,a),{center:r,radius:d,series:e}}function drawArcbarDataPoints(e,t,i,o){var a=Math.PI,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,l=t.extra.arcbar||{};l.startAngle=l.startAngle?l.startAngle:.75,l.endAngle=l.endAngle?l.endAngle:.25,l.type=l.type?l.type:"default",e=getArcbarDataPoints(e,l,n);var s={x:t.width/2,y:t.height/2},r=Math.min(s.x,s.y);return l.width="number"==typeof l.width&&0<l.width?l.width:12*t.pixelRatio,r-=i.padding+l.width/2,o.setLineWidth(l.width),o.setStrokeStyle(l.backgroundColor||"#E9E9E9"),o.setLineCap("round"),o.beginPath(),"default"==l.type?o.arc(s.x,s.y,r,l.startAngle*a,l.endAngle*a,!1):o.arc(s.x,s.y,r,0,2*a,!1),o.stroke(),e.forEach(function(e){o.setLineWidth(l.width),o.setStrokeStyle(e.color),o.setLineCap("round"),o.beginPath(),o.arc(s.x,s.y,r,l.startAngle*a,e._proportion_*a,!1),o.stroke()}),drawRingTitle(t,i,o),{center:s,radius:r,series:e}}function drawGaugeDataPoints(e,t,o,i,a){var n=Math.PI,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1,s=o.extra.gauge||{};s.startAngle=s.startAngle?s.startAngle:.75,null==s.oldAngle&&(s.oldAngle=s.startAngle),null==s.oldData&&(s.oldData=0),s.endAngle=s.endAngle?s.endAngle:.25,e=getGaugeAxisPoints(e,s.startAngle,s.endAngle);var r={x:o.width/2,y:o.height/2},d=Math.min(r.x,r.y);s.width="number"==typeof s.width&&0<s.width?s.width:15*o.pixelRatio,d-=i.padding+s.width/2;var h=d-s.width;a.setLineWidth(s.width),a.setLineCap("butt"),e.forEach(function(e){a.beginPath(),a.setStrokeStyle(e.color),a.arc(r.x,r.y,d,e._startAngle_*n,e._endAngle_*n,!1),a.stroke()}),a.save();let x=s.startAngle-s.endAngle+1;s.splitLine.fixRadius=s.splitLine.fixRadius?s.splitLine.fixRadius:0,s.splitLine.splitNumber=s.splitLine.splitNumber?s.splitLine.splitNumber:10,s.splitLine.width=s.splitLine.width?s.splitLine.width:15*o.pixelRatio,s.splitLine.color=s.splitLine.color?s.splitLine.color:"#FFFFFF",s.splitLine.childNumber=s.splitLine.childNumber?s.splitLine.childNumber:5,s.splitLine.childWidth=s.splitLine.childWidth?s.splitLine.childWidth:5*o.pixelRatio;let c=x/s.splitLine.splitNumber,p=x/s.splitLine.splitNumber/s.splitLine.childNumber,g=-d-.5*s.width-s.splitLine.fixRadius,y=-d-.5*s.width-s.splitLine.fixRadius+s.splitLine.width,f=-d-.5*s.width-s.splitLine.fixRadius+s.splitLine.childWidth;a.translate(r.x,r.y),a.rotate((s.startAngle-1)*n);for(let l=0;l<s.splitLine.splitNumber+1;l++)a.beginPath(),a.setStrokeStyle(s.splitLine.color),a.setLineWidth(2*o.pixelRatio),a.moveTo(g,0),a.lineTo(y,0),a.stroke(),a.rotate(c*n);a.restore(),a.save(),a.translate(r.x,r.y),a.rotate((s.startAngle-1)*n);for(let l=0;l<s.splitLine.splitNumber*s.splitLine.childNumber+1;l++)a.beginPath(),a.setStrokeStyle(s.splitLine.color),a.setLineWidth(1*o.pixelRatio),a.moveTo(g,0),a.lineTo(f,0),a.stroke(),a.rotate(p*n);return a.restore(),s.pointer.width=s.pointer.width?s.pointer.width:15*o.pixelRatio,null==s.pointer.color||"auto"==s.pointer.color?"auto"==s.pointer.color:s.pointer.color==s.pointer.color,t=getGaugeDataPoints(t,e,s,l),t.forEach(function(e){a.save(),a.translate(r.x,r.y),a.rotate((e._proportion_-1)*n),a.beginPath(),a.setFillStyle(e.color),a.moveTo(s.pointer.width,0),a.lineTo(0,-s.pointer.width/2),a.lineTo(-h,0),a.lineTo(0,s.pointer.width/2),a.lineTo(s.pointer.width,0),a.closePath(),a.fill(),a.beginPath(),a.setFillStyle("#FFFFFF"),a.arc(0,0,s.pointer.width/6,0,2*n,!1),a.fill(),a.restore()}),!1!==o.dataLabel&&drawGaugeLabel(s,d,r,o,i,a),drawRingTitle(o,i,a),1===l&&"gauge"===o.type&&(s.oldAngle=t[0]._proportion_,s.oldData=t[0].data),{center:r,radius:d,innerRadius:h,categories:e,totalAngle:x}}function drawRadarDataPoints(e,t,o,a){var n=Math.cos,l=Math.sin,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,r=t.extra.radar||{},d=getRadarCoordinateSeries(t.categories.length),h={x:t.width/2,y:(t.height-o.legendHeight)/2},x=Math.min(h.x-(getMaxTextListLength(t.categories)+o.radarLabelTextMargin),h.y-o.radarLabelTextMargin);x-=o.padding,a.beginPath(),a.setLineWidth(1*t.pixelRatio),a.setStrokeStyle(r.gridColor||"#cccccc"),d.forEach(function(e){var t=convertCoordinateOrigin(x*n(e),x*l(e),h);a.moveTo(h.x,h.y),a.lineTo(t.x,t.y)}),a.stroke(),a.closePath();for(var c=function(e){var i={};a.beginPath(),a.setLineWidth(1*t.pixelRatio),a.setStrokeStyle(r.gridColor||"#cccccc"),d.forEach(function(t,s){var r=convertCoordinateOrigin(x/o.radarGridCount*e*n(t),x/o.radarGridCount*e*l(t),h);0===s?(i=r,a.moveTo(r.x,r.y)):a.lineTo(r.x,r.y)}),a.lineTo(i.x,i.y),a.stroke(),a.closePath()},p=1;p<=o.radarGridCount;p++)c(p);var g=getRadarDataPoints(d,h,x,e,t,s);return g.forEach(function(e,i){if(a.beginPath(),a.setFillStyle(e.color),a.setGlobalAlpha(.3),e.data.forEach(function(e,t){0===t?a.moveTo(e.position.x,e.position.y):a.lineTo(e.position.x,e.position.y)}),a.closePath(),a.fill(),a.setGlobalAlpha(1),!1!==t.dataPointShape){var n=o.dataPointShape[i%o.dataPointShape.length],l=e.data.map(function(e){return e.position});drawPointShape(l,e.color,n,a,t)}}),drawRadarLabel(d,x,h,t,o,a),{center:h,radius:x,angleList:d}}function drawCanvas(e,t){t.draw()}var Timing={easeIn:function(e){return Math.pow(e,3)},easeOut:function(e){return Math.pow(e-1,3)+1},easeInOut:function(e){var t=Math.pow;return 1>(e/=.5)?.5*t(e,3):.5*(t(e-2,3)+2)},linear:function(e){return e}};function Animation(e){this.isStop=!1,e.duration="undefined"==typeof e.duration?1e3:e.duration,e.timing=e.timing||"linear";var t=function(){return"undefined"==typeof requestAnimationFrame?"undefined"==typeof setTimeout?function(e){e(null)}:function(e,t){setTimeout(function(){var t=+new Date;e(t)},t)}:requestAnimationFrame}(),i=null,o=function(a){if(null===a||!0===this.isStop)return e.onProcess&&e.onProcess(1),void(e.onAnimationFinish&&e.onAnimationFinish());if(null===i&&(i=a),a-i<e.duration){var n=(a-i)/e.duration,l=Timing[e.timing];n=l(n),e.onProcess&&e.onProcess(n),t(o,17)}else e.onProcess&&e.onProcess(1),e.onAnimationFinish&&e.onAnimationFinish()};o=o.bind(this),t(o,17)}Animation.prototype.stop=function(){this.isStop=!0};function drawCharts(e,t,i,o){var a=this,n=t.series,l=t.categories;n=fillSeriesColor(n,i),n=fillSeriesType(n,t);var s=calLegendData(n,t,i),r=s.legendHeight;i.legendHeight=r;var d=calYAxisData(n,t,i),h=d.yAxisWidth;if(i.yAxisWidth=h,l&&l.length){var x=calCategoriesData(l,t,i),c=x.xAxisHeight,p=x.angle;i.xAxisHeight=c,i._xAxisTextAngle_=p}("pie"===e||"ring"===e)&&(i._pieTextMaxLength_=!1===t.dataLabel?0:getPieTextMaxLength(n));var g=t.animation?1e3:0;this.animationInstance&&this.animationInstance.stop(),o.clearRect(0,0,t.width,t.height),"line"===e?this.animationInstance=new Animation({timing:"easeIn",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),drawYAxisGrid(l,t,i,o),drawXAxis(l,t,i,o);var s=drawLineDataPoints(n,t,i,o,e),r=s.xAxisPoints,d=s.calPoints,h=s.eachSpacing;a.chartData.xAxisPoints=r,a.chartData.calPoints=d,a.chartData.eachSpacing=h,drawLegend(t.series,t,i,o),drawYAxis(n,t,i,o),drawToolTipBridge(t,i,o,e,h,r),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"mix"===e?this.animationInstance=new Animation({timing:"easeIn",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),drawYAxisGrid(l,t,i,o),drawXAxis(l,t,i,o);var s=drawMixDataPoints(n,t,i,o,e),r=s.xAxisPoints,d=s.calPoints,h=s.eachSpacing;a.chartData.xAxisPoints=r,a.chartData.calPoints=d,a.chartData.eachSpacing=h,drawLegend(t.series,t,i,o),drawYAxis(n,t,i,o),drawToolTipBridge(t,i,o,e,h,r),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"column"===e?this.animationInstance=new Animation({timing:"easeIn",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),drawYAxisGrid(l,t,i,o),drawXAxis(l,t,i,o);var s=drawColumnDataPoints(n,t,i,o,e),r=s.xAxisPoints,d=s.calPoints,h=s.eachSpacing;a.chartData.xAxisPoints=r,a.chartData.calPoints=d,a.chartData.eachSpacing=h,drawLegend(t.series,t,i,o),drawYAxis(n,t,i,o),drawToolTipBridge(t,i,o,e,h,r),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"area"===e?this.animationInstance=new Animation({timing:"easeIn",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),drawYAxisGrid(l,t,i,o),drawXAxis(l,t,i,o);var s=drawAreaDataPoints(n,t,i,o,e),r=s.xAxisPoints,d=s.calPoints,h=s.eachSpacing;a.chartData.xAxisPoints=r,a.chartData.calPoints=d,a.chartData.eachSpacing=h,drawLegend(t.series,t,i,o),drawYAxis(n,t,i,o),drawToolTipBridge(t,i,o,e,h,r),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"ring"===e||"pie"===e?this.animationInstance=new Animation({timing:"easeInOut",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),a.chartData.pieData=drawPieDataPoints(n,t,i,o,e),drawLegend(t.series,t,i,o),drawToolTipBridge(t,i,o,e),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"radar"===e?this.animationInstance=new Animation({timing:"easeInOut",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),a.chartData.radarData=drawRadarDataPoints(n,t,i,o,e),drawLegend(t.series,t,i,o),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"arcbar"===e?this.animationInstance=new Animation({timing:"easeInOut",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),a.chartData.arcbarData=drawArcbarDataPoints(n,t,i,o,e),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"gauge"===e?this.animationInstance=new Animation({timing:"easeInOut",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),a.chartData.gaugeData=drawGaugeDataPoints(l,n,t,i,o,e),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):"candle"===e?this.animationInstance=new Animation({timing:"easeIn",duration:g,onProcess:function(e){t.rotate&&contextRotate(o,t),drawYAxisGrid(l,t,i,o),drawXAxis(l,t,i,o);var s=drawCandleDataPoints(n,t,i,o,e),r=s.xAxisPoints,d=s.calPoints,h=s.eachSpacing;a.chartData.xAxisPoints=r,a.chartData.calPoints=d,a.chartData.eachSpacing=h,drawLegend(t.series,t,i,o),drawYAxis(n,t,i,o),drawToolTipBridge(t,i,o,e,h,r),drawCanvas(t,o)},onAnimationFinish:function(){a.event.trigger("renderComplete")}}):void 0}function Event(){this.events={}}Event.prototype.addEventListener=function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)},Event.prototype.trigger=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];var o=t[0],a=t.slice(1);!this.events[o]||this.events[o].forEach(function(e){try{e.apply(null,a)}catch(t){console.error(t)}})};var Charts=function(e){e.fontSize=e.fontSize?e.fontSize*e.pixelRatio:13*e.pixelRatio,e.title=e.title||{},e.subtitle=e.subtitle||{},e.yAxis=e.yAxis||{},e.yAxis.gridType=e.yAxis.gridType?e.yAxis.gridType:"solid",e.yAxis.dashLength=e.yAxis.dashLength?e.yAxis.dashLength:4*e.pixelRatio,e.xAxis=e.xAxis||{},e.xAxis.rotateLabel=!!e.xAxis.rotateLabel,e.xAxis.type=e.xAxis.type?e.xAxis.type:"calibration",e.xAxis.gridType=e.xAxis.gridType?e.xAxis.gridType:"solid",e.xAxis.dashLength=e.xAxis.dashLength?e.xAxis.dashLength:4*e.pixelRatio,e.xAxis.itemCount=e.xAxis.itemCount?e.xAxis.itemCount:5,e.xAxis.scrollAlign=e.xAxis.scrollAlign?e.xAxis.scrollAlign:"left",e.extra=e.extra||{},e.legend=!1!==e.legend,e.rotate=!!e.rotate,e.animation=!1!==e.animation;var t=assign({},config);if(t.yAxisTitleWidth=!0!==e.yAxis.disabled&&e.yAxis.title?t.yAxisTitleWidth:0,("pie"==e.type||"ring"==e.type)&&(t.pieChartLinePadding=!1===e.dataLabel?0:e.extra.pie.lableWidth||t.pieChartLinePadding*e.pixelRatio),t.pieChartTextPadding=!1===e.dataLabel?0:t.pieChartTextPadding*e.pixelRatio,t.yAxisSplit=e.yAxis.splitNumber?e.yAxis.splitNumber:config.yAxisSplit,t.rotate=e.rotate,e.rotate){let t=e.width,i=e.height;e.width=i,e.height=t}if(t.yAxisWidth=config.yAxisWidth*e.pixelRatio,t.xAxisHeight=config.xAxisHeight*e.pixelRatio,e.enableScroll&&e.xAxis.scrollShow&&(t.xAxisHeight+=6*e.pixelRatio),t.xAxisLineHeight=config.xAxisLineHeight*e.pixelRatio,t.legendHeight=config.legendHeight*e.pixelRatio,t.padding=config.padding*e.pixelRatio,t.fontSize=e.fontSize,t.titleFontSize=config.titleFontSize*e.pixelRatio,t.subtitleFontSize=config.subtitleFontSize*e.pixelRatio,t.toolTipPadding=config.toolTipPadding*e.pixelRatio,t.toolTipLineHeight=config.toolTipLineHeight*e.pixelRatio,t.columePadding=config.columePadding*e.pixelRatio,config.pixelRatio=e.pixelRatio,config.fontSize=e.fontSize,config.rotate=e.rotate,this.opts=e,this.config=t,e.$this=e.$this?e.$this:this,this.context=uni.createCanvasContext(e.canvasId,e.$this),this.chartData={},this.event=new Event,this.scrollOption={currentOffset:0,startTouchX:0,distance:0},e.enableScroll&&"right"==e.xAxis.scrollAlign){let i=calYAxisData(e.series,e,t),o=i.yAxisWidth;t.yAxisWidth=o;let a=0,n=getXAxisPoints(e.categories,e,t),l=n.xAxisPoints,s=n.startX,r=n.endX,d=n.eachSpacing,h=d*(l.length-1);a=r-s-h,this.scrollOption={currentOffset:a,startTouchX:a,distance:0},e._scrollDistance_=a}drawCharts.call(this,e.type,e,t,this.context)};Charts.prototype.updateData=function(){let e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};this.opts.series=e.series||this.opts.series,this.opts.categories=e.categories||this.opts.categories;let t=e.scrollPosition||"current";switch(t){case"current":this.opts._scrollDistance_=this.scrollOption.currentOffset;break;case"left":this.opts._scrollDistance_=0,this.scrollOption={currentOffset:0,startTouchX:0,distance:0};break;case"right":let e=calYAxisData(this.opts.series,this.opts,this.config),i=e.yAxisWidth;this.config.yAxisWidth=i;let o=0,a=getXAxisPoints(this.opts.categories,this.opts,this.config),n=a.xAxisPoints,l=a.startX,s=a.endX,r=a.eachSpacing,d=r*(n.length-1);o=s-l-d,this.scrollOption={currentOffset:o,startTouchX:o,distance:0},this.opts._scrollDistance_=o;}let i=e.animation==null?this.opts.animation:e.animation;this.opts.animation=i,this.opts.title=assign({},this.opts.title,e.title||{}),this.opts.subtitle=assign({},this.opts.subtitle,e.subtitle||{}),drawCharts.call(this,this.opts.type,this.opts,this.config,this.context)},Charts.prototype.zoom=function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:this.opts.xAxis.itemCount;return!0===this.opts.enableScroll?void(this.opts.animation=!1,this.opts.xAxis.itemCount=e.itemCount,drawCharts.call(this,this.opts.type,this.opts,this.config,this.context)):void console.log("\u8BF7\u542F\u7528\u6EDA\u52A8\u6761\u540E\u4F7F\u7528\uFF01")},Charts.prototype.stopAnimation=function(){this.animationInstance&&this.animationInstance.stop()},Charts.prototype.addEventListener=function(e,t){this.event.addEventListener(e,t)},Charts.prototype.getCurrentDataIndex=function(t){var e=t.mp.changedTouches[0];if(e){var i=getTouches(e,this.opts,t);return"pie"===this.opts.type||"ring"===this.opts.type?findPieChartCurrentIndex({x:i.x,y:i.y},this.chartData.pieData):"radar"===this.opts.type?findRadarChartCurrentIndex({x:i.x,y:i.y},this.chartData.radarData,this.opts.categories.length):findCurrentIndex({x:i.x,y:i.y},this.chartData.xAxisPoints,this.opts,this.config,Math.abs(this.scrollOption.currentOffset))}return-1},Charts.prototype.showToolTip=function(t){var e=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},i=t.mp.changedTouches[0],o=getTouches(i,this.opts,t);if("line"===this.opts.type||"area"===this.opts.type||"column"===this.opts.type){var a=this.getCurrentDataIndex(t),n=this.scrollOption.currentOffset,l=assign({},this.opts,{_scrollDistance_:n,animation:!1});if(-1<a){var s=getSeriesDataItem(this.opts.series,a);if(0!==s.length){var r=getToolTipData(s,this.chartData.calPoints,a,this.opts.categories,e),d=r.textList,h=r.offset;h.y=o.y,l.tooltip={textList:d,offset:h,option:e,index:a}}}drawCharts.call(this,l.type,l,this.config,this.context)}if("mix"===this.opts.type){var a=this.getCurrentDataIndex(t),n=this.scrollOption.currentOffset,l=assign({},this.opts,{_scrollDistance_:n,animation:!1});if(-1<a){var s=getSeriesDataItem(this.opts.series,a);if(0!==s.length){var x=getMixToolTipData(s,this.chartData.calPoints,a,this.opts.categories,e),d=x.textList,h=x.offset;h.y=o.y,l.tooltip={textList:d,offset:h,option:e,index:a}}}drawCharts.call(this,l.type,l,this.config,this.context)}if("candle"===this.opts.type){var a=this.getCurrentDataIndex(t),n=this.scrollOption.currentOffset,l=assign({},this.opts,{_scrollDistance_:n,animation:!1});if(-1<a){var s=getSeriesDataItem(this.opts.series,a);if(0!==s.length){var r=getCandleToolTipData(this.opts.series[0].data,s,this.chartData.calPoints,a,this.opts.categories,this.opts.extra.candle,e),d=r.textList,h=r.offset;h.y=o.y,l.tooltip={textList:d,offset:h,option:e,index:a}}}drawCharts.call(this,l.type,l,this.config,this.context)}if("pie"===this.opts.type||"ring"===this.opts.type){var a=this.getCurrentDataIndex(t),n=this.scrollOption.currentOffset,l=assign({},this.opts,{_scrollDistance_:n,animation:!1});if(-1<a){var s=this.opts.series[a],d=[{text:e.format?e.format(s):s.name+": "+s.data,color:s.color}],h={x:o.x,y:o.y};l.tooltip={textList:d,offset:h,option:e,index:a}}drawCharts.call(this,l.type,l,this.config,this.context)}},Charts.prototype.scrollStart=function(t){var e=t.mp.changedTouches[0],i=getTouches(e,this.opts,t);e&&!0===this.opts.enableScroll&&(e.x?this.scrollOption.startTouchX=i.x:this.scrollOption.startTouchX=i.clientX)},Charts.prototype.scroll=function(t){var{disableTouch:e,throttleTouch:i,lastMoveTime:o}=this;if(!e&&t.mp.changedTouches[0]){if(i){var a=Date.now();if(240>a-o)return;this.lastMoveTime=a}var n=t.mp.changedTouches[0],l=getTouches(n,this.opts,t);if(n&&!0===this.opts.enableScroll){var s=n.x?l.x-this.scrollOption.startTouchX:l.clientX-this.scrollOption.startTouchX;var r=this.scrollOption.currentOffset,d=calValidDistance(r+s,this.chartData,this.config,this.opts);this.scrollOption.distance=s=d-r;var h=assign({},this.opts,{_scrollDistance_:r+s,animation:!1});drawCharts.call(this,h.type,h,this.config,this.context)}}},Charts.prototype.scrollEnd=function(){if(!0===this.opts.enableScroll){var e=this.scrollOption,t=e.currentOffset,i=e.distance;this.scrollOption.currentOffset=t+i,this.scrollOption.distance=0}},export default Charts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template></template>
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<audio
|
|
3
|
+
:id="node.attr.id"
|
|
4
|
+
:class="node.classStr"
|
|
5
|
+
:style="node.styleStr"
|
|
6
|
+
:src="node.attr.src"
|
|
7
|
+
:loop="node.attr.loop"
|
|
8
|
+
:poster="node.attr.poster"
|
|
9
|
+
:name="node.attr.name"
|
|
10
|
+
:author="node.attr.author"
|
|
11
|
+
controls></audio>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'wxParseAudio',
|
|
17
|
+
props: {
|
|
18
|
+
node: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default() {
|
|
21
|
+
return {};
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<image
|
|
3
|
+
:mode="node.attr.mode"
|
|
4
|
+
:lazy-load="node.attr.lazyLoad"
|
|
5
|
+
:class="node.classStr"
|
|
6
|
+
:style="newStyleStr || node.styleStr"
|
|
7
|
+
:data-src="node.attr.src"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
@tap="wxParseImgTap"
|
|
10
|
+
@load="wxParseImgLoad"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'wxParseImg',
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
newStyleStr: '',
|
|
20
|
+
preview: true
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
inject: ['parseWidth'],
|
|
24
|
+
mounted() {},
|
|
25
|
+
props: {
|
|
26
|
+
node: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default() {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
wxParseImgTap(e) {
|
|
36
|
+
if (!this.preview) return;
|
|
37
|
+
const { src } = e.currentTarget.dataset;
|
|
38
|
+
if (!src) return;
|
|
39
|
+
let parent = this.$parent;
|
|
40
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
41
|
+
// TODO 遍历获取父节点执行方法
|
|
42
|
+
parent = parent.$parent;
|
|
43
|
+
}
|
|
44
|
+
parent.preview(src, e);
|
|
45
|
+
},
|
|
46
|
+
// 图片视觉宽高计算函数区
|
|
47
|
+
wxParseImgLoad(e) {
|
|
48
|
+
const { src } = e.currentTarget.dataset;
|
|
49
|
+
if (!src) return;
|
|
50
|
+
let { width, height } = e.mp.detail;
|
|
51
|
+
|
|
52
|
+
const recal = this.wxAutoImageCal(width, height);
|
|
53
|
+
|
|
54
|
+
const { imageheight, imageWidth } = recal;
|
|
55
|
+
const { padding, mode } = this.node.attr;//删除padding
|
|
56
|
+
// const { mode } = this.node.attr;
|
|
57
|
+
|
|
58
|
+
const { styleStr } = this.node;
|
|
59
|
+
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
|
60
|
+
|
|
61
|
+
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;//删除padding
|
|
62
|
+
// this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px;`;
|
|
63
|
+
},
|
|
64
|
+
// 计算视觉优先的图片宽高
|
|
65
|
+
wxAutoImageCal(originalWidth, originalHeight) {
|
|
66
|
+
// 获取图片的原始长宽
|
|
67
|
+
const windowWidth = this.parseWidth.value;
|
|
68
|
+
const results = {};
|
|
69
|
+
|
|
70
|
+
if (originalWidth < 60 || originalHeight < 60) {
|
|
71
|
+
const { src } = this.node.attr;
|
|
72
|
+
let parent = this.$parent;
|
|
73
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
74
|
+
parent = parent.$parent;
|
|
75
|
+
}
|
|
76
|
+
parent.removeImageUrl(src);
|
|
77
|
+
this.preview = false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 判断按照那种方式进行缩放
|
|
81
|
+
if (originalWidth > windowWidth) {
|
|
82
|
+
// 在图片width大于手机屏幕width时候
|
|
83
|
+
results.imageWidth = windowWidth;
|
|
84
|
+
results.imageheight = windowWidth * (originalHeight / originalWidth);
|
|
85
|
+
} else {
|
|
86
|
+
// 否则展示原来的数据
|
|
87
|
+
results.imageWidth = originalWidth;
|
|
88
|
+
results.imageheight = originalHeight;
|
|
89
|
+
}
|
|
90
|
+
return results;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class='tablebox'>
|
|
3
|
+
<rich-text :nodes="nodes" :class="node.classStr" :style="'user-select:' + parseSelect"></rich-text>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'wxParseTable',
|
|
9
|
+
props: {
|
|
10
|
+
node: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default() {
|
|
13
|
+
return {};
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
inject: ['parseSelect'],
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
nodes:[]
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
mounted() {
|
|
24
|
+
this.nodes=this.loadNode([this.node]);
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
loadNode(node) {
|
|
28
|
+
let obj = [];
|
|
29
|
+
for (let children of node) {
|
|
30
|
+
if (children.node=='element') {
|
|
31
|
+
let t = {
|
|
32
|
+
name:children.tag,
|
|
33
|
+
attrs: {
|
|
34
|
+
class: children.classStr,
|
|
35
|
+
// style: children.styleStr,
|
|
36
|
+
},
|
|
37
|
+
children: children.nodes?this.loadNode(children.nodes):[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
obj.push(t)
|
|
41
|
+
} else if(children.node=='text'){
|
|
42
|
+
obj.push({
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: children.text
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return obj
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
<style>
|
|
54
|
+
@import url("../wxParse.css");
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--判断是否是标签节点-->
|
|
3
|
+
<block v-if="node.node == 'element'">
|
|
4
|
+
<!--button类型-->
|
|
5
|
+
<button v-if="node.tag == 'button'" type="default" size="mini" :class="node.classStr" :style="node.styleStr">
|
|
6
|
+
<wx-parse-template :node="node" />
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<!--a类型-->
|
|
10
|
+
<view v-else-if="node.tag == 'a'" @click="wxParseATap(node.attr,$event)" :class="node.classStr" :data-href="node.attr.href"
|
|
11
|
+
:style="node.styleStr">
|
|
12
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
13
|
+
<wx-parse-template :node="node" />
|
|
14
|
+
</block>
|
|
15
|
+
</view>
|
|
16
|
+
|
|
17
|
+
<!--li类型-->
|
|
18
|
+
<view v-else-if="node.tag == 'li'" :class="node.classStr" :style="node.styleStr">
|
|
19
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
20
|
+
<wx-parse-template :node="node" />
|
|
21
|
+
</block>
|
|
22
|
+
</view>
|
|
23
|
+
|
|
24
|
+
<!--table类型-->
|
|
25
|
+
<wx-parse-table v-else-if="node.tag == 'table'" :class="node.classStr" :style="node.styleStr" :node="node" />
|
|
26
|
+
|
|
27
|
+
<!--br类型-->
|
|
28
|
+
<!-- #ifndef H5 -->
|
|
29
|
+
<text v-else-if="node.tag == 'br'">\n</text>
|
|
30
|
+
<!-- #endif -->
|
|
31
|
+
<!-- #ifdef H5 -->
|
|
32
|
+
<br v-else-if="node.tag == 'br'">
|
|
33
|
+
<!-- #endif -->
|
|
34
|
+
|
|
35
|
+
<!--video类型-->
|
|
36
|
+
<wx-parse-video :node="node" v-else-if="node.tag == 'video'" />
|
|
37
|
+
|
|
38
|
+
<!--audio类型-->
|
|
39
|
+
<wx-parse-audio :node="node" v-else-if="node.tag == 'audio'" />
|
|
40
|
+
|
|
41
|
+
<!--img类型-->
|
|
42
|
+
<wx-parse-img :node="node" v-else-if="node.tag == 'img'" :style="node.styleStr" />
|
|
43
|
+
|
|
44
|
+
<!--其他标签-->
|
|
45
|
+
<view v-else :class="node.classStr" :style="node.styleStr">
|
|
46
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
47
|
+
<wx-parse-template :node="node" />
|
|
48
|
+
</block>
|
|
49
|
+
</view>
|
|
50
|
+
</block>
|
|
51
|
+
|
|
52
|
+
<!--判断是否是文本节点-->
|
|
53
|
+
<block v-else-if="node.node == 'text'"><text decode="true">{{textHandle(node.text)}}</text></block>
|
|
54
|
+
<!-- <block v-else-if="node.node == 'text'">{{node.text}}</block> -->
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
// #ifdef APP-PLUS | H5
|
|
59
|
+
import wxParseTemplate from './wxParseTemplate0';
|
|
60
|
+
// #endif
|
|
61
|
+
// #ifdef MP
|
|
62
|
+
import wxParseTemplate from './wxParseTemplate1';
|
|
63
|
+
// #endif
|
|
64
|
+
import wxParseImg from './wxParseImg';
|
|
65
|
+
import wxParseVideo from './wxParseVideo';
|
|
66
|
+
import wxParseAudio from './wxParseAudio';
|
|
67
|
+
import wxParseTable from './wxParseTable';
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
// #ifdef APP-PLUS | H5
|
|
71
|
+
name: 'wxParseTemplate',
|
|
72
|
+
// #endif
|
|
73
|
+
// #ifdef MP
|
|
74
|
+
name: 'wxParseTemplate0',
|
|
75
|
+
// #endif
|
|
76
|
+
props: {
|
|
77
|
+
node: {},
|
|
78
|
+
},
|
|
79
|
+
components: {
|
|
80
|
+
wxParseTemplate,
|
|
81
|
+
wxParseImg,
|
|
82
|
+
wxParseVideo,
|
|
83
|
+
wxParseAudio,
|
|
84
|
+
wxParseTable
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
wxParseATap(attr, e) {
|
|
88
|
+
const {
|
|
89
|
+
href
|
|
90
|
+
} = e.currentTarget.dataset; // TODO currentTarget才有dataset
|
|
91
|
+
if (!href) return;
|
|
92
|
+
let parent = this.$parent;
|
|
93
|
+
while (!parent.preview || typeof parent.preview !== 'function') { // TODO 遍历获取父节点执行方法
|
|
94
|
+
parent = parent.$parent;
|
|
95
|
+
}
|
|
96
|
+
parent.navigate(href, e, attr);
|
|
97
|
+
},
|
|
98
|
+
textHandle: function(text) {
|
|
99
|
+
return text ? text.replace(/\n/g, '\n') : ""
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--判断是否是标签节点-->
|
|
3
|
+
<block v-if="node.node == 'element'">
|
|
4
|
+
<!--button类型-->
|
|
5
|
+
<button v-if="node.tag == 'button'" type="default" size="mini" :class="node.classStr" :style="node.styleStr">
|
|
6
|
+
<wx-parse-template :node="node" />
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<!--a类型-->
|
|
10
|
+
<view v-else-if="node.tag == 'a'" @click="wxParseATap(node.attr,$event)" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
11
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
12
|
+
<wx-parse-template :node="node" />
|
|
13
|
+
</block>
|
|
14
|
+
</view>
|
|
15
|
+
|
|
16
|
+
<!--li类型-->
|
|
17
|
+
<view v-else-if="node.tag == 'li'" :class="node.classStr" :style="node.styleStr">
|
|
18
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
19
|
+
<wx-parse-template :node="node" />
|
|
20
|
+
</block>
|
|
21
|
+
</view>
|
|
22
|
+
|
|
23
|
+
<!--table类型-->
|
|
24
|
+
<wx-parse-table v-else-if="node.tag == 'table'" :class="node.classStr" :style="node.styleStr" :node="node" />
|
|
25
|
+
|
|
26
|
+
<!--br类型-->
|
|
27
|
+
<!-- #ifndef H5 -->
|
|
28
|
+
<text v-else-if="node.tag == 'br'">\n</text>
|
|
29
|
+
<!-- #endif -->
|
|
30
|
+
<!-- #ifdef H5 -->
|
|
31
|
+
<br v-else-if="node.tag == 'br'">
|
|
32
|
+
<!-- #endif -->
|
|
33
|
+
|
|
34
|
+
<!--video类型-->
|
|
35
|
+
<wx-parse-video :node="node" v-else-if="node.tag == 'video'"/>
|
|
36
|
+
|
|
37
|
+
<!--audio类型-->
|
|
38
|
+
<wx-parse-audio :node="node" v-else-if="node.tag == 'audio'"/>
|
|
39
|
+
|
|
40
|
+
<!--img类型-->
|
|
41
|
+
<wx-parse-img :node="node" v-else-if="node.tag == 'img'" :style="node.styleStr"/>
|
|
42
|
+
|
|
43
|
+
<!--其他标签-->
|
|
44
|
+
<view v-else :class="node.classStr" :style="node.styleStr">
|
|
45
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
46
|
+
<wx-parse-template :node="node" />
|
|
47
|
+
</block>
|
|
48
|
+
</view>
|
|
49
|
+
</block>
|
|
50
|
+
|
|
51
|
+
<!--判断是否是文本节点-->
|
|
52
|
+
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import wxParseTemplate from './wxParseTemplate2';
|
|
57
|
+
import wxParseImg from './wxParseImg';
|
|
58
|
+
import wxParseVideo from './wxParseVideo';
|
|
59
|
+
import wxParseAudio from './wxParseAudio';
|
|
60
|
+
import wxParseTable from './wxParseTable';
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
name: 'wxParseTemplate1',
|
|
64
|
+
props: {
|
|
65
|
+
node: {},
|
|
66
|
+
},
|
|
67
|
+
components: {
|
|
68
|
+
wxParseTemplate,
|
|
69
|
+
wxParseImg,
|
|
70
|
+
wxParseVideo,
|
|
71
|
+
wxParseAudio,
|
|
72
|
+
wxParseTable
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
wxParseATap(attr,e) {
|
|
76
|
+
const {
|
|
77
|
+
href
|
|
78
|
+
} = e.currentTarget.dataset;
|
|
79
|
+
if (!href) return;
|
|
80
|
+
let parent = this.$parent;
|
|
81
|
+
while(!parent.preview || typeof parent.preview !== 'function') {
|
|
82
|
+
parent = parent.$parent;
|
|
83
|
+
}
|
|
84
|
+
parent.navigate(href, e, attr);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--判断是否是标签节点-->
|
|
3
|
+
<block v-if="node.node == 'element'">
|
|
4
|
+
<!--button类型-->
|
|
5
|
+
<button v-if="node.tag == 'button'" type="default" size="mini" :class="node.classStr" :style="node.styleStr">
|
|
6
|
+
<wx-parse-template :node="node" />
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<!--a类型-->
|
|
10
|
+
<view v-else-if="node.tag == 'a'" @click="wxParseATap(node.attr,$event)" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
11
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
12
|
+
<wx-parse-template :node="node" />
|
|
13
|
+
</block>
|
|
14
|
+
</view>
|
|
15
|
+
|
|
16
|
+
<!--li类型-->
|
|
17
|
+
<view v-else-if="node.tag == 'li'" :class="node.classStr" :style="node.styleStr">
|
|
18
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
19
|
+
<wx-parse-template :node="node" />
|
|
20
|
+
</block>
|
|
21
|
+
</view>
|
|
22
|
+
|
|
23
|
+
<!--table类型-->
|
|
24
|
+
<wx-parse-table v-else-if="node.tag == 'table'" :class="node.classStr" :style="node.styleStr" :node="node" />
|
|
25
|
+
|
|
26
|
+
<!--br类型-->
|
|
27
|
+
<!-- #ifndef H5 -->
|
|
28
|
+
<text v-else-if="node.tag == 'br'">\n</text>
|
|
29
|
+
<!-- #endif -->
|
|
30
|
+
<!-- #ifdef H5 -->
|
|
31
|
+
<br v-else-if="node.tag == 'br'">
|
|
32
|
+
<!-- #endif -->
|
|
33
|
+
|
|
34
|
+
<!--video类型-->
|
|
35
|
+
<wx-parse-video :node="node" v-else-if="node.tag == 'video'"/>
|
|
36
|
+
|
|
37
|
+
<!--audio类型-->
|
|
38
|
+
<wx-parse-audio :node="node" v-else-if="node.tag == 'audio'"/>
|
|
39
|
+
|
|
40
|
+
<!--img类型-->
|
|
41
|
+
<wx-parse-img :node="node" v-else-if="node.tag == 'img'" :style="node.styleStr"/>
|
|
42
|
+
|
|
43
|
+
<!--其他标签-->
|
|
44
|
+
<view v-else :class="node.classStr" :style="node.styleStr">
|
|
45
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
46
|
+
<wx-parse-template :node="node" />
|
|
47
|
+
</block>
|
|
48
|
+
</view>
|
|
49
|
+
</block>
|
|
50
|
+
|
|
51
|
+
<!--判断是否是文本节点-->
|
|
52
|
+
<block v-else-if="node.node == 'text' ">{{node.text}}</block>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import wxParseTemplate from './wxParseTemplate11';
|
|
57
|
+
import wxParseImg from './wxParseImg';
|
|
58
|
+
import wxParseVideo from './wxParseVideo';
|
|
59
|
+
import wxParseAudio from './wxParseAudio';
|
|
60
|
+
import wxParseTable from './wxParseTable';
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
name: 'wxParseTemplate10',
|
|
64
|
+
props: {
|
|
65
|
+
node: {},
|
|
66
|
+
},
|
|
67
|
+
components: {
|
|
68
|
+
wxParseTemplate,
|
|
69
|
+
wxParseImg,
|
|
70
|
+
wxParseVideo,
|
|
71
|
+
wxParseAudio,
|
|
72
|
+
wxParseTable
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
wxParseATap(attr,e) {
|
|
76
|
+
const {
|
|
77
|
+
href
|
|
78
|
+
} = e.currentTarget.dataset;
|
|
79
|
+
if (!href) return;
|
|
80
|
+
let parent = this.$parent;
|
|
81
|
+
while(!parent.preview || typeof parent.preview !== 'function') {
|
|
82
|
+
parent = parent.$parent;
|
|
83
|
+
}
|
|
84
|
+
parent.navigate(href, e, attr);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
</script>
|