antd-management-fast-charts 2.6.180 → 2.6.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/es/index.js +1 -1
  2. package/package.json +2 -1
package/es/index.js CHANGED
@@ -1 +1 @@
1
- import e,{Component as t}from"react";import{NumberInfo as n}from"antd-management-fast-component";import r,{Chart as a,Axis as i,Tooltip as o,Interval as l,Guide as c,Coordinate as s,Geom as u,Line as d,Area as m,Interaction as f,Legend as p,Slider as h}from"bizcharts";import{Card as v,Tooltip as y,Row as g,Col as E,Divider as x}from"antd";import _ from"classnames";import b from"lodash.debounce";import w from"@antv/data-set";import{stringifyJson as k}from"easy-soft-utility";function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function N(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function P(e){var t=function(e,t){if("object"!=M(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==M(t)?t:t+""}function T(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function F(e,t){if(t&&("object"==M(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function R(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}var W={miniChart:"index_miniChart__VVpjQ",chartContent:"index_chartContent__07CVR"};function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}var L=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,I()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={autoHideXLabels:!1},e}return R(n,t),T(n,[{key:"render",value:function(){var t=this.props,n=t.title,r=t.autoFit,c=void 0===r||r,s=t.data,u=t.color,d=void 0===u?"rgba(24, 144, 255, 0.85)":u,m=t.animate,f=void 0===m||m,p=this.state.autoHideXLabels,h={x:{type:"cat"},y:{min:0,alias:n}};return e.createElement("div",{className:W.chart,style:{height:"100%"}},e.createElement("div",{style:{height:"100%"}},e.createElement(a,{animate:f,scale:h,autoFit:c,data:s},e.createElement(i,{name:"x",title:!1,label:p?void 0:{},tickLine:p?void 0:{}}),e.createElement(i,{title:!0,name:"y",min:0}),e.createElement(o,{showTitle:!1,showCrosshairs:!1}),e.createElement(l,{position:"x*y",color:d,tooltip:["x*y",function(e,t){return{name:e,value:t}}]}))))}}])}();function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function D(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function B(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H={chartCard:"index_chartCard__9EAQx",chartTop:"index_chartTop__SQ2cg",chartTopMargin:"index_chartTopMargin__6-Xl2",metaWrap:"index_metaWrap__FRdqD",avatar:"index_avatar__iqOXO",meta:"index_meta__4k-PY",action:"index_action__7kwfj",total:"index_total__Tli4O",content:"index_content__sYn14",contentFixed:"index_contentFixed__U4Wqa",footer:"index_footer__m-TMs",footerMargin:"index_footerMargin__UG6kg"},q=["loading"];function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}var V=function(){function t(){var n,r,a,i;S(this,t);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return r=this,a=t,i=[].concat(l),a=j(a),(n=F(r,U()?Reflect.construct(a,i||[],j(r).constructor):a.apply(r,i))).renderContent=function(){var t=n.props,r=t.contentHeight,a=t.title,i=t.avatar,o=t.action,l=t.total,c=t.footer,s=t.children;return!t.loading&&e.createElement("div",{className:H.chartCard},e.createElement("div",{className:_(H.chartTop,B({},H.chartTopMargin,!s&&!c))},e.createElement("div",{className:H.avatar},i),e.createElement("div",{className:H.metaWrap},e.createElement("div",{className:H.meta},e.createElement("span",{className:H.title},a),e.createElement("span",{className:H.action},o)),function(t){if(!t&&0!==t)return null;var n;switch(M(t)){case"undefined":n=null;break;case"function":n=e.createElement("div",{className:H.total},t());break;default:n=e.createElement("div",{className:H.total},t)}return n}(l))),s&&e.createElement("div",{className:H.content,style:{height:r||"auto"}},e.createElement("div",{className:H.contentFixed},s)),c&&e.createElement("div",{className:_(H.footer,B({},H.footerMargin,!s))},c))},n}return R(t,e.Component),T(t,[{key:"render",value:function(){var t=this.props,n=t.loading,r=void 0!==n&&n,a=D(t,q);return e.createElement(v,z({loading:r,styles:{body:{padding:"20px 24px 8px 24px"}}},a),this.renderContent())}}])}(),G="index_field__pEkBk",Y="index_label__8cj8I",X="index_number__D3ouB",Q=["label","value"];function Z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Z=function(){return!!e})()}function J(e){return e.style.height="100%",Number.parseInt("".concat(getComputedStyle(e).height),10)-(Number.parseInt("".concat(getComputedStyle(e).paddingTop),10)+Number.parseInt("".concat(getComputedStyle(e).paddingBottom),10))}function K(e){if(!e)return 0;var t=e,n=J(t),r=t.parentNode;return r&&(n=J(r)),n}var $=function(){function t(){var e,n,r,a;S(this,t);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return n=this,r=t,a=[].concat(o),r=j(r),(e=F(n,Z()?Reflect.construct(r,a||[],j(n).constructor):r.apply(n,a))).state={computedHeight:0},e.root=void 0,e.handleRoot=function(t){e.root=t},e}return R(t,e.Component),T(t,[{key:"componentDidMount",value:function(){if(!this.props.height){var e=K(this.root);this.setState({computedHeight:e}),e<1&&(e=K(this.root),this.setState({computedHeight:e}))}}},{key:"render",value:function(){var t=this.props,n=t.height,r=t.children,a=this.state.computedHeight,i=n||a;return e.createElement("div",{ref:this.handleRoot,style:{height:"".concat(i,"px")}},i>0?r:null)}}])}(),ee=c.Arc,te=c.Html,ne=c.Line,re=function(e){switch(e){case"2":return"差";case"4":return"中";case"6":return"良";case"8":return"优";default:return""}};r.registerShape&&r.registerShape("point","pointer",{draw:function(e,t){var n=e.points[0];n=this.parsePoint(n);var r=this.parsePoint({x:0,y:0});return t.addShape("line",{attrs:{x1:r.x,y1:r.y,x2:n.x,y2:n.y,stroke:e.color,lineWidth:2,lineCap:"round"}}),t.addShape("circle",{attrs:{x:r.x,y:r.y,r:6,stroke:e.color,lineWidth:3,fill:"#fff"}})}});function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(t){B(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var oe="index_miniProgress__f07Y-",le="index_progressWrap__II1Y1",ce="index_progress__Zps2h",se="index_target__77Xoq",ue="index_pie__i-WEw",de="index_chart__Npfns",me="index_legend__kJ-GY",fe="index_dot__Y1znw",pe="index_legendTitle__pU8R8",he="index_percent__fIW53",ve="index_value__HFjZ-",ye="index_total__frj0M",ge="index_legendBlock__K0V8C";function Ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ee=function(){return!!e})()}r.registerShape("interval","sliceShape",{draw:function(e,t){var n=e.points,r=e.color,a=[];return a.push(["M",n[0].x,n[0].y],["L",n[1].x,n[1].y-.01],["L",n[2].x,n[2].y-.01],["L",n[3].x,n[3].y],"Z"),a=this.parsePath(a),t.addShape("path",{attrs:{fill:r,path:a}})}});var xe=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,Ee()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={},e.calculateTotal=function(e){var t=0;return(e||[]).map(function(e){return t+=e.y,e}),t},e.handleLegendClick=function(e,t){},e}return R(n,t),T(n,[{key:"render",value:function(){var t=this,n=this.props,r=n.valueFormat,c=n.subTitle,u=n.total,d=n.className,m=n.style,p=_(ue,d,ge),h=this.props.data,v=this.calculateTotal(h);return e.createElement("div",{className:p},e.createElement(g,{gutter:24},e.createElement(E,{lg:12,md:12,sm:24,xs:24},e.createElement("div",{className:de,style:m},e.createElement(a,{data:h||[],autoFit:!0},e.createElement(s,{type:"theta",radius:.8,innerRadius:.75}),e.createElement(i,{visible:!1}),e.createElement(o,{showTitle:!1}),e.createElement(l,{adjust:"stack",position:"y",color:"x",shape:"sliceShape"}),e.createElement(f,{type:"element-single-selected"}))),(c||u)&&e.createElement("div",{className:ye},c&&e.createElement("h4",{className:"pie-sub-title"},c),u&&e.createElement("div",{className:"pie-stat"},"function"==typeof u?u():u))),e.createElement(E,{lg:12,md:12,sm:24,xs:24},e.createElement("ul",{className:me,style:m},(h||[]).map(function(n,a){var i="".concat(n.x,"_").concat(a);return e.createElement("li",{key:i,onClick:function(){return t.handleLegendClick(n,a)}},e.createElement("span",{className:fe,style:{backgroundColor:n.checked?n.color:"#aaa"}}),e.createElement("span",{className:pe},n.x),e.createElement(x,{type:"vertical"}),e.createElement("span",{className:he},"".concat(((v||0)>0?100*(Number.isNaN(n.y/v)?0:n.y/v):0).toFixed(2),"%")),e.createElement("span",{className:ve},r?r(n.y):n.y))})))))}}])}();function _e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw a}}return l}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var be="index_tagCloud__Xpi-N";function we(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(we=function(){return!!e})()}var ke=r.registerShape;var Ce=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,we()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={dv:null,height:0,width:0},e.isUnmount=!1,e.requestRef=0,e.root=void 0,e.imageMask=void 0,e.resize=function(){e.requestRef=requestAnimationFrame(function(){e.renderChart(e.props)})},e.saveRootRef=function(t){e.root=t},e.initTagCloud=function(){ke("point","cloud",{draw:function(e,t){var n=function(e){return ie(ie({},e.style),{},{fillOpacity:e.opacity,fontSize:e.origin._origin.size,rotate:e.origin._origin.rotate,text:e.origin._origin.text,textAlign:"center",fontFamily:e.origin._origin.font,fill:e.color,textBaseline:"Alphabetic"})}(e);return t.addShape("text",{attrs:ie(ie({},n),{},{x:e.x,y:e.y})})}})},e.renderChart=b(function(t){var n=t||e.props,r=n.data,a=n.height;if(0!==r.length&&e.root){var i=a,o=e.root.offsetWidth,l=function(){var t=(new w.View).source(r),n=_e(t.range("value"),2),a=n[0],l=n[1];t.transform({type:"tag-cloud",fields:["name","value"],imageMask:e.imageMask,font:"Verdana",size:[o,i],padding:0,timeInterval:5e3,rotate:function(){return 0},fontSize:function(e){return 12.5*Math.pow((e.value-a)/(l-a),2)+5}}),e.isUnmount||e.setState({dv:t,width:o,height:i})};e.imageMask?l():(e.imageMask=new Image,e.imageMask.crossOrigin="",e.imageMask.src="https://gw.alipayobjects.com/zos/rmsportal/gWyeGLCdFFRavBGIDzWk.png",e.imageMask.addEventListener("load",l))}},500),e}return R(n,t),T(n,[{key:"componentDidMount",value:function(){var e=this;requestAnimationFrame(function(){e.initTagCloud(),e.renderChart(e.props)}),window.addEventListener("resize",this.resize,{passive:!0})}},{key:"componentDidUpdate",value:function(e){var t=this.props.data;e&&k(e.data)!==k(t)&&this.renderChart(this.props)}},{key:"componentWillUnmount",value:function(){this.isUnmount=!0,window.cancelAnimationFrame(this.requestRef),window.removeEventListener("resize",this.resize)}},{key:"render",value:function(){var t=this.props.className,n=this.state,r=n.dv,i=n.width,l=n.height;return e.createElement($,null,e.createElement("div",{className:_(be,t),style:{width:"100%",height:"100%"},ref:this.saveRootRef},r&&e.createElement(a,{width:i,height:l,data:r,padding:0,scale:{x:{nice:!1},y:{nice:!1}}},e.createElement(o,{showTitle:!1}),e.createElement(s,{reflect:"y"}),e.createElement(u,{type:"point",position:"x*y",color:"text",shape:"cloud",tooltip:["text*value",function(e,t){return{name:e,value:t}}]}))))}}])}(),Oe="index_timelineChart__YekIc",Ne="index_waterWave__M5niT",Se="index_text__SRpKH",Me="index_waterWaveCanvasWrapper__hMwnr";function Pe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Pe=function(){return!!e})()}var Te={Bar:L,Pie:xe,Gauge:function(t){var n=t.title,r=t.percent,o=t.forceFit,l=void 0===o||o,d=t.formatter,m=void 0===d?re:d,f=t.color,p=void 0===f?"#2F9CFF":f,h=t.bgColor,v=void 0===h?"#F0F2F5":h,y=[{value:r/10}];return e.createElement($,null,e.createElement(a,{style:{height:"100%"},data:y,scale:{value:{type:"linear",min:0,max:10,tickCount:6,nice:!0}},padding:[-16,0,16,0],forceFit:l},e.createElement(s,{type:"polar",startAngle:-1.25*Math.PI,endAngle:.25*Math.PI,radius:.8}),e.createElement(i,{name:"1",line:void 0}),e.createElement(i,{line:void 0,tickLine:void 0,subTickLine:void 0,name:"value",zIndex:2,label:{offset:-12,formatter:m,textStyle:{fontSize:12,fill:"rgba(0, 0, 0, 0.65)",textAlign:"center"}}}),e.createElement(c,null,e.createElement(ne,{start:[3,.905],end:[3,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:2}}),e.createElement(ne,{start:[5,.905],end:[5,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(ne,{start:[7,.905],end:[7,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(ee,{start:[0,.965],end:[10,.965],style:{stroke:v,lineWidth:10}}),e.createElement(ee,{start:[0,.965],end:[y[0].value,.965],style:{stroke:p,lineWidth:10}}),e.createElement(te,{position:["50%","95%"],html:'\n <div style="width: 300px;text-align: center;font-size: 12px!important;">\n <div style="font-size: 14px; color: rgba(0,0,0,0.43);margin: 0;">'.concat(n,'</div>\n <div style="font-size: 24px;color: rgba(0,0,0,0.85);margin: 0;">\n ').concat((10*y[0].value).toFixed(2),"%\n </div>\n </div>")})),e.createElement(u,{line:!1,type:"point",position:"value*1",shape:"pointer",color:p,active:!1})))},MiniBar:function(t){var n=t.autoFit,r=void 0===n||n,i=t.color,c=void 0===i?"#1890FF":i,s=t.data,u=void 0===s?[]:s,d=t.animate,m=void 0===d||d,f=t.pure,p=void 0===f||f;return e.createElement("div",{className:W.miniChart},e.createElement("div",{className:W.chartContent},e.createElement(a,{animate:m,scale:{x:{type:"cat"},y:{min:0}},autoFit:r,data:u,pure:p},e.createElement(o,{showTitle:!1,showCrosshairs:!1}),e.createElement(l,{position:"x*y",color:c,tooltip:["x*y",function(e,t){return{name:e,value:t}}]}))))},MiniArea:function(t){var n=t.data,r=void 0===n?[]:n,l=t.autoFit,c=void 0===l||l,s=t.color,u=void 0===s?"rgba(24, 144, 255, 0.2)":s,f=t.borderColor,p=void 0===f?"#1089ff":f,h=t.scale,v=void 0===h?{x:{},y:{}}:h,y=t.line,g=t.xAxis,E=t.yAxis,x=t.animate,_=void 0===x||x,b=t.pure,w=void 0===b||b,k={x:ie({type:"cat",range:[0,1]},v.x),y:ie({min:0},v.y)},C=["x*y",function(e,t){return{name:e,value:t}}];return e.createElement("div",{className:W.miniChart},e.createElement("div",{className:W.chartContent},e.createElement(a,{animate:_,scale:k,autoFit:c,data:r,pure:w},e.createElement(i,z({key:"axis-x",name:"x",label:null,line:null,tickLine:null,grid:null},g)),e.createElement(i,z({key:"axis-y",name:"y",label:null,line:null,tickLine:null,grid:null},E)),e.createElement(o,{showTitle:!1,showCrosshairs:!1}),y?e.createElement(d,{position:"x*y",tooltip:C,color:p,shape:"smooth",style:{fillOpacity:1}}):e.createElement(m,{position:"x*y",color:u,tooltip:C,shape:"smooth",style:{fillOpacity:1}}))))},MiniProgress:function(t){var n=t.targetLabel,r=t.target,a=t.color,i=void 0===a?"rgb(19, 194, 194)":a,o=t.strokeWidth,l=t.percent;return e.createElement("div",{className:oe},e.createElement(y,{title:n},e.createElement("div",{className:se,style:{left:r?"".concat(r,"%"):void 0}},e.createElement("span",{style:{backgroundColor:i||void 0}}),e.createElement("span",{style:{backgroundColor:i||void 0}}))),e.createElement("div",{className:le},e.createElement("div",{className:ce,style:{backgroundColor:i||void 0,width:l?"".concat(l,"%"):void 0,height:o||void 0}})))},ChartCard:V,Field:function(t){var n=t.label,r=t.value,a=D(t,Q);return e.createElement("div",z({className:G},a),e.createElement("span",{className:Y},n),e.createElement("span",{className:X},r))},WaterWave:function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,Pe()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={radio:1},e.timer=0,e.root=null,e.node=null,e.resize=function(){if(e.root){var t=e.props.height,n=void 0===t?1:t,r=e.root.parentNode.offsetWidth;e.setState({radio:r<n?r/n:1})}},e}return R(n,t),T(n,[{key:"componentDidMount",value:function(){var e=this;this.renderChart(),this.resize(),window.addEventListener("resize",function(){requestAnimationFrame(function(){return e.resize()})},{passive:!0})}},{key:"componentDidUpdate",value:function(e){var t=this.props.percent;e.percent!==t&&this.renderChart("update")}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.timer),this.node&&(this.node.innerHTML=""),window.removeEventListener("resize",this.resize)}},{key:"renderChart",value:function(e){var t=this.props,n=t.percent,r=t.color,a=void 0===r?"#1890FF":r,i=n/100,o=this;if(cancelAnimationFrame(this.timer),this.node&&(0===i||i)){var l=this.node,c=l.getContext("2d");if(c){var s=l.width,u=l.height,d=s/2,m=d-2;c.beginPath(),c.lineWidth=4;for(var f=s-2,p=f/8,h=.2,v=h,y=0,g=0,E=[],x=d-2,_=-Math.PI/2,b=!0,w=_;w<_+2*Math.PI;w+=1/(8*Math.PI))E.push([d+x*Math.cos(w),d+x*Math.sin(w)]);var k=E.shift();c.strokeStyle=a,c.moveTo(k[0],k[1]),function t(){if(c){if(c.clearRect(0,0,s,u),b&&"update"!==e)if(E.length>0){var n=E.shift();c.lineTo(n[0],n[1]),c.stroke()}else b=!1,c.lineTo(k[0],k[1]),c.stroke(),E=[],c.globalCompositeOperation="destination-over",c.beginPath(),c.lineWidth=2,c.arc(d,d,x,0,2*Math.PI,!0),c.beginPath(),c.save(),c.arc(d,d,d-6,0,2*Math.PI,!0),c.restore(),c.clip(),c.fillStyle=a;else{if(i>=.85){if(v>.05){v-=.002}}else if(i<=.1){if(v<1.5*h){v+=.002}}else{if(v<=h){v+=.002}if(v>=h){v-=.002}}i-g>0&&(g+=.005),i-g<0&&(g-=.005),y+=.07,function(){if(c){c.beginPath(),c.save();for(var e=[],t=2;t<=2+f;t+=20/f){var n=y+(2+t)/p,r=Math.sin(n)*v,i=t,o=2*m*(1-g)+(d-m)-p*r;c.lineTo(i,o),e.push([i,o])}var l=e.shift();c.lineTo(2+f,u),c.lineTo(2,u),c.lineTo(l[0],l[1]);var s=c.createLinearGradient(0,0,0,u);s.addColorStop(0,"#ffffff"),s.addColorStop(1,a),c.fillStyle=s,c.fill(),c.restore()}}()}o.timer=requestAnimationFrame(t)}}()}}}},{key:"render",value:function(){var t=this,n=this.state.radio,r=this.props,a=r.percent,i=r.title,o=r.height,l=void 0===o?1:o;return e.createElement($,null,e.createElement("div",{className:Ne,ref:function(e){return t.root=e},style:{transform:"scale(".concat(n,")"),height:"100%"}},e.createElement("div",{style:{width:l,height:l,overflow:"hidden"}},e.createElement("canvas",{className:Me,ref:function(e){return t.node=e},width:2*l,height:2*l})),e.createElement("div",{className:Se,style:{width:l}},i&&e.createElement("span",null,i),e.createElement("h4",null,a,"%"))))}}])}(),TagCloud:Ce,TimelineChart:function(t){var n,r=t.title,l=t.height,c=void 0===l?400:l,s=t.padding,d=void 0===s?[60,20,40,40]:s,m=t.titleMap,f=void 0===m?{y1:"y1",y2:"y2"}:m,v=t.borderWidth,y=void 0===v?2:v,g=t.data,E=Array.isArray(g)?g:[{x:0,y1:0,y2:0}];E.sort(function(e,t){return e.x-t.x}),E[0]&&E[0].y1&&E[0].y2&&(n=Math.max(N(E).sort(function(e,t){return t.y1-e.y1})[0].y1,N(E).sort(function(e,t){return t.y2-e.y2})[0].y2));var x=new w({state:{start:E[0].x,end:E[E.length-1].x}}),_=x.createView();_.source(E).transform({type:"filter",callback:function(e){var t=e.x;return t<=x.state.end&&t>=x.state.start}}).transform({type:"map",callback:function(e){var t=ie({},e);return t[f.y1]=e.y1,t[f.y2]=e.y2,t}}).transform({type:"fold",fields:[f.y1,f.y2],key:"key",value:"value"});var b={type:"time",tickInterval:36e5,mask:"HH:mm",range:[0,1]},k={x:b,value:{max:n,min:0}},C=function(){return e.createElement(h,{padding:[0,d[1]+20,0,d[3]],width:"auto",height:26,xAxis:"x",yAxis:"y1",scales:{x:b},data:E,start:x.state.start,end:x.state.end,backgroundChart:{type:"line"},onChange:function(e){var t=e.startValue,n=e.endValue;x.setState("start",t),x.setState("end",n)}})};return e.createElement($,null,e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Oe,style:{height:c+30}},e.createElement("div",null,r&&e.createElement("h4",null,r),e.createElement(a,{height:c,padding:d,data:_,scale:k,forceFit:!0},e.createElement(i,{name:"x"}),e.createElement(o,null),e.createElement(p,{name:"key",position:"top"}),e.createElement(u,{type:"line",position:"x*value",size:y,color:"key"})),e.createElement("div",{style:{marginRight:-20}},e.createElement(C,null))))))}},Fe="index_activeChart__HCbH3",je="index_activeChartGrid__fUR9L",Ae="index_activeChartLegend__PnJGF",Re="index_dashedLine__OjP--",We="index_line__h0Is-";function Ie(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ie=function(){return!!e})()}var Le=Te.MiniArea;function ze(e){return 1*e<10?"0".concat(e):e}function De(){for(var e=[],t=0;t<24;t+=1)e.push({x:"".concat(ze(t),":00"),y:Math.floor(200*Math.random())+50*t});return e}var Be=function(){function r(){var e,t,n,a;S(this,r);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,n=r,a=[].concat(o),n=j(n),(e=F(t,Ie()?Reflect.construct(n,a||[],j(t).constructor):n.apply(t,a))).state={activeData:De()},e.loopData=function(){e.requestRef=requestAnimationFrame(function(){e.timer=setTimeout(function(){e.setState({activeData:De()},function(){e.loopData()})},1e3)})},e}return R(r,t),T(r,[{key:"componentDidMount",value:function(){this.loopData()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timer),cancelAnimationFrame(this.requestRef)}},{key:"render",value:function(){var t=this.state.activeData,r=void 0===t?[]:t;return e.createElement("div",{className:Fe},e.createElement(n,{subTitle:"目标评估",total:"有望达到预期"}),e.createElement("div",{style:{marginTop:32}},e.createElement(Le,{animate:!1,line:!0,borderWidth:2,height:84,scale:{y:{tickCount:3}},yAxis:{tickLine:!1,label:!1,title:!1,line:!1},data:r})),r&&e.createElement("div",null,e.createElement("div",{className:je},e.createElement("p",null,N(r).sort()[r.length-1].y+200," 亿元"),e.createElement("p",null,N(r).sort()[Math.floor(r.length/2)].y," ","亿元")),e.createElement("div",{className:Re},e.createElement("div",{className:We})),e.createElement("div",{className:Re},e.createElement("div",{className:We}))),r&&e.createElement("div",{className:Ae},e.createElement("span",null,"00:00"),e.createElement("span",null,r[Math.floor(r.length/2)].x),e.createElement("span",null,r.at(-1).x)))}}])}();export{Be as ActiveChart,Te as Charts};
1
+ import e,{Component as t}from"react";import{NumberInfo as n}from"antd-management-fast-component";import r,{Chart as a,Axis as i,Tooltip as o,Interval as l,Guide as c,Coordinate as s,Geom as u,Line as d,Area as m,Interaction as f,Legend as p,Slider as h}from"bizcharts";import{Card as v,Tooltip as y,Row as g,Col as E,Divider as x}from"antd";import _ from"classnames";import b from"lodash.debounce";import w from"@antv/data-set";import{stringifyJson as k}from"easy-soft-utility";function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function N(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function P(e){var t=function(e,t){if("object"!=M(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==M(t)?t:t+""}function T(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function F(e,t){if(t&&("object"==M(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function R(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}var W={miniChart:"index_miniChart__VVpjQ",chartContent:"index_chartContent__07CVR"};function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}var L=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,I()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={autoHideXLabels:!1},e}return R(n,t),T(n,[{key:"render",value:function(){var t=this.props,n=t.title,r=t.autoFit,c=void 0===r||r,s=t.data,u=t.color,d=void 0===u?"rgba(24, 144, 255, 0.85)":u,m=t.animate,f=void 0===m||m,p=this.state.autoHideXLabels,h={x:{type:"cat"},y:{min:0,alias:n}};return e.createElement("div",{className:W.chart,style:{height:"100%"}},e.createElement("div",{style:{height:"100%"}},e.createElement(a,{animate:f,scale:h,autoFit:c,data:s},e.createElement(i,{name:"x",title:!1,label:p?void 0:{},tickLine:p?void 0:{}}),e.createElement(i,{title:!0,name:"y",min:0}),e.createElement(o,{showTitle:!1,showCrosshairs:!1}),e.createElement(l,{position:"x*y",color:d,tooltip:["x*y",function(e,t){return{name:e,value:t}}]}))))}}])}();function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function D(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function B(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H={chartCard:"index_chartCard__9EAQx",chartTop:"index_chartTop__SQ2cg",chartTopMargin:"index_chartTopMargin__6-Xl2",metaWrap:"index_metaWrap__FRdqD",avatar:"index_avatar__iqOXO",meta:"index_meta__4k-PY",action:"index_action__7kwfj",total:"index_total__Tli4O",content:"index_content__sYn14",contentFixed:"index_contentFixed__U4Wqa",footer:"index_footer__m-TMs",footerMargin:"index_footerMargin__UG6kg"},q=["loading"];function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}var V=function(){function t(){var n,r,a,i;S(this,t);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return r=this,a=t,i=[].concat(l),a=j(a),(n=F(r,U()?Reflect.construct(a,i||[],j(r).constructor):a.apply(r,i))).renderContent=function(){var t=n.props,r=t.contentHeight,a=t.title,i=t.avatar,o=t.action,l=t.total,c=t.footer,s=t.children;return!t.loading&&e.createElement("div",{className:H.chartCard},e.createElement("div",{className:_(H.chartTop,B({},H.chartTopMargin,!s&&!c))},e.createElement("div",{className:H.avatar},i),e.createElement("div",{className:H.metaWrap},e.createElement("div",{className:H.meta},e.createElement("span",{className:H.title},a),e.createElement("span",{className:H.action},o)),function(t){if(!t&&0!==t)return null;var n;switch(M(t)){case"undefined":n=null;break;case"function":n=e.createElement("div",{className:H.total},t());break;default:n=e.createElement("div",{className:H.total},t)}return n}(l))),s&&e.createElement("div",{className:H.content,style:{height:r||"auto"}},e.createElement("div",{className:H.contentFixed},s)),c&&e.createElement("div",{className:_(H.footer,B({},H.footerMargin,!s))},c))},n}return R(t,e.Component),T(t,[{key:"render",value:function(){var t=this.props,n=t.loading,r=void 0!==n&&n,a=D(t,q);return e.createElement(v,z({loading:r,styles:{body:{padding:"20px 24px 8px 24px"}}},a),this.renderContent())}}])}(),G="index_field__pEkBk",Y="index_label__8cj8I",X="index_number__D3ouB",Q=["label","value"];function Z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Z=function(){return!!e})()}function J(e){return e.style.height="100%",Number.parseInt("".concat(getComputedStyle(e).height),10)-(Number.parseInt("".concat(getComputedStyle(e).paddingTop),10)+Number.parseInt("".concat(getComputedStyle(e).paddingBottom),10))}function K(e){if(!e)return 0;var t=e,n=J(t),r=t.parentNode;return r&&(n=J(r)),n}var $=function(){function t(){var e,n,r,a;S(this,t);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return n=this,r=t,a=[].concat(o),r=j(r),(e=F(n,Z()?Reflect.construct(r,a||[],j(n).constructor):r.apply(n,a))).state={computedHeight:0},e.root=void 0,e.handleRoot=function(t){e.root=t},e}return R(t,e.Component),T(t,[{key:"componentDidMount",value:function(){if(!this.props.height){var e=K(this.root);this.setState({computedHeight:e}),e<1&&(e=K(this.root),this.setState({computedHeight:e}))}}},{key:"render",value:function(){var t=this.props,n=t.height,r=t.children,a=this.state.computedHeight,i=n||a;return e.createElement("div",{ref:this.handleRoot,style:{height:"".concat(i,"px")}},i>0?r:null)}}])}(),ee=c.Arc,te=c.Html,ne=c.Line,re=function(e){switch(e){case"2":return"差";case"4":return"中";case"6":return"良";case"8":return"优";default:return""}};r.registerShape&&r.registerShape("point","pointer",{draw:function(e,t){var n=e.points[0];n=this.parsePoint(n);var r=this.parsePoint({x:0,y:0});return t.addShape("line",{attrs:{x1:r.x,y1:r.y,x2:n.x,y2:n.y,stroke:e.color,lineWidth:2,lineCap:"round"}}),t.addShape("circle",{attrs:{x:r.x,y:r.y,r:6,stroke:e.color,lineWidth:3,fill:"#fff"}})}});function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(t){B(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var oe="index_miniProgress__f07Y-",le="index_progressWrap__II1Y1",ce="index_progress__Zps2h",se="index_target__77Xoq",ue="index_pie__i-WEw",de="index_chart__Npfns",me="index_legend__kJ-GY",fe="index_dot__Y1znw",pe="index_legendTitle__pU8R8",he="index_percent__fIW53",ve="index_value__HFjZ-",ye="index_total__frj0M",ge="index_legendBlock__K0V8C";function Ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ee=function(){return!!e})()}r.registerShape("interval","sliceShape",{draw:function(e,t){var n=e.points,r=e.color,a=[];return a.push(["M",n[0].x,n[0].y],["L",n[1].x,n[1].y-.01],["L",n[2].x,n[2].y-.01],["L",n[3].x,n[3].y],"Z"),a=this.parsePath(a),t.addShape("path",{attrs:{fill:r,path:a}})}});var xe=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,Ee()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={},e.calculateTotal=function(e){var t=0;return(e||[]).map(function(e){return t+=e.y,e}),t},e.handleLegendClick=function(e,t){},e}return R(n,t),T(n,[{key:"render",value:function(){var t=this,n=this.props,r=n.valueFormat,c=n.subTitle,u=n.total,d=n.className,m=n.style,p=_(ue,d,ge),h=this.props.data,v=this.calculateTotal(h);return e.createElement("div",{className:p},e.createElement(g,{gutter:24},e.createElement(E,{lg:12,md:12,sm:24,xs:24},e.createElement("div",{className:de,style:m},e.createElement(a,{data:h||[],autoFit:!0},e.createElement(s,{type:"theta",radius:.8,innerRadius:.75}),e.createElement(i,{visible:!1}),e.createElement(o,{showTitle:!1}),e.createElement(l,{adjust:"stack",position:"y",color:"x",shape:"sliceShape"}),e.createElement(f,{type:"element-single-selected"}))),(c||u)&&e.createElement("div",{className:ye},c&&e.createElement("h4",{className:"pie-sub-title"},c),u&&e.createElement("div",{className:"pie-stat"},"function"==typeof u?u():u))),e.createElement(E,{lg:12,md:12,sm:24,xs:24},e.createElement("ul",{className:me,style:m},(h||[]).map(function(n,a){var i="".concat(n.x,"_").concat(a);return e.createElement("li",{key:i,onClick:function(){return t.handleLegendClick(n,a)}},e.createElement("span",{className:fe,style:{backgroundColor:n.checked?n.color:"#aaa"}}),e.createElement("span",{className:pe},n.x),e.createElement(x,{orientation:"vertical"}),e.createElement("span",{className:he},"".concat(((v||0)>0?100*(Number.isNaN(n.y/v)?0:n.y/v):0).toFixed(2),"%")),e.createElement("span",{className:ve},r?r(n.y):n.y))})))))}}])}();function _e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw a}}return l}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var be="index_tagCloud__Xpi-N";function we(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(we=function(){return!!e})()}var ke=r.registerShape;var Ce=function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,we()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={dv:null,height:0,width:0},e.isUnmount=!1,e.requestRef=0,e.root=void 0,e.imageMask=void 0,e.resize=function(){e.requestRef=requestAnimationFrame(function(){e.renderChart(e.props)})},e.saveRootRef=function(t){e.root=t},e.initTagCloud=function(){ke("point","cloud",{draw:function(e,t){var n=function(e){return ie(ie({},e.style),{},{fillOpacity:e.opacity,fontSize:e.origin._origin.size,rotate:e.origin._origin.rotate,text:e.origin._origin.text,textAlign:"center",fontFamily:e.origin._origin.font,fill:e.color,textBaseline:"Alphabetic"})}(e);return t.addShape("text",{attrs:ie(ie({},n),{},{x:e.x,y:e.y})})}})},e.renderChart=b(function(t){var n=t||e.props,r=n.data,a=n.height;if(0!==r.length&&e.root){var i=a,o=e.root.offsetWidth,l=function(){var t=(new w.View).source(r),n=_e(t.range("value"),2),a=n[0],l=n[1];t.transform({type:"tag-cloud",fields:["name","value"],imageMask:e.imageMask,font:"Verdana",size:[o,i],padding:0,timeInterval:5e3,rotate:function(){return 0},fontSize:function(e){return 12.5*Math.pow((e.value-a)/(l-a),2)+5}}),e.isUnmount||e.setState({dv:t,width:o,height:i})};e.imageMask?l():(e.imageMask=new Image,e.imageMask.crossOrigin="",e.imageMask.src="https://gw.alipayobjects.com/zos/rmsportal/gWyeGLCdFFRavBGIDzWk.png",e.imageMask.addEventListener("load",l))}},500),e}return R(n,t),T(n,[{key:"componentDidMount",value:function(){var e=this;requestAnimationFrame(function(){e.initTagCloud(),e.renderChart(e.props)}),window.addEventListener("resize",this.resize,{passive:!0})}},{key:"componentDidUpdate",value:function(e){var t=this.props.data;e&&k(e.data)!==k(t)&&this.renderChart(this.props)}},{key:"componentWillUnmount",value:function(){this.isUnmount=!0,window.cancelAnimationFrame(this.requestRef),window.removeEventListener("resize",this.resize)}},{key:"render",value:function(){var t=this.props.className,n=this.state,r=n.dv,i=n.width,l=n.height;return e.createElement($,null,e.createElement("div",{className:_(be,t),style:{width:"100%",height:"100%"},ref:this.saveRootRef},r&&e.createElement(a,{width:i,height:l,data:r,padding:0,scale:{x:{nice:!1},y:{nice:!1}}},e.createElement(o,{showTitle:!1}),e.createElement(s,{reflect:"y"}),e.createElement(u,{type:"point",position:"x*y",color:"text",shape:"cloud",tooltip:["text*value",function(e,t){return{name:e,value:t}}]}))))}}])}(),Oe="index_timelineChart__YekIc",Ne="index_waterWave__M5niT",Se="index_text__SRpKH",Me="index_waterWaveCanvasWrapper__hMwnr";function Pe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Pe=function(){return!!e})()}var Te={Bar:L,Pie:xe,Gauge:function(t){var n=t.title,r=t.percent,o=t.forceFit,l=void 0===o||o,d=t.formatter,m=void 0===d?re:d,f=t.color,p=void 0===f?"#2F9CFF":f,h=t.bgColor,v=void 0===h?"#F0F2F5":h,y=[{value:r/10}];return e.createElement($,null,e.createElement(a,{style:{height:"100%"},data:y,scale:{value:{type:"linear",min:0,max:10,tickCount:6,nice:!0}},padding:[-16,0,16,0],forceFit:l},e.createElement(s,{type:"polar",startAngle:-1.25*Math.PI,endAngle:.25*Math.PI,radius:.8}),e.createElement(i,{name:"1",line:void 0}),e.createElement(i,{line:void 0,tickLine:void 0,subTickLine:void 0,name:"value",zIndex:2,label:{offset:-12,formatter:m,textStyle:{fontSize:12,fill:"rgba(0, 0, 0, 0.65)",textAlign:"center"}}}),e.createElement(c,null,e.createElement(ne,{start:[3,.905],end:[3,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:2}}),e.createElement(ne,{start:[5,.905],end:[5,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(ne,{start:[7,.905],end:[7,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(ee,{start:[0,.965],end:[10,.965],style:{stroke:v,lineWidth:10}}),e.createElement(ee,{start:[0,.965],end:[y[0].value,.965],style:{stroke:p,lineWidth:10}}),e.createElement(te,{position:["50%","95%"],html:'\n <div style="width: 300px;text-align: center;font-size: 12px!important;">\n <div style="font-size: 14px; color: rgba(0,0,0,0.43);margin: 0;">'.concat(n,'</div>\n <div style="font-size: 24px;color: rgba(0,0,0,0.85);margin: 0;">\n ').concat((10*y[0].value).toFixed(2),"%\n </div>\n </div>")})),e.createElement(u,{line:!1,type:"point",position:"value*1",shape:"pointer",color:p,active:!1})))},MiniBar:function(t){var n=t.autoFit,r=void 0===n||n,i=t.color,c=void 0===i?"#1890FF":i,s=t.data,u=void 0===s?[]:s,d=t.animate,m=void 0===d||d,f=t.pure,p=void 0===f||f;return e.createElement("div",{className:W.miniChart},e.createElement("div",{className:W.chartContent},e.createElement(a,{animate:m,scale:{x:{type:"cat"},y:{min:0}},autoFit:r,data:u,pure:p},e.createElement(o,{showTitle:!1,showCrosshairs:!1}),e.createElement(l,{position:"x*y",color:c,tooltip:["x*y",function(e,t){return{name:e,value:t}}]}))))},MiniArea:function(t){var n=t.data,r=void 0===n?[]:n,l=t.autoFit,c=void 0===l||l,s=t.color,u=void 0===s?"rgba(24, 144, 255, 0.2)":s,f=t.borderColor,p=void 0===f?"#1089ff":f,h=t.scale,v=void 0===h?{x:{},y:{}}:h,y=t.line,g=t.xAxis,E=t.yAxis,x=t.animate,_=void 0===x||x,b=t.pure,w=void 0===b||b,k={x:ie({type:"cat",range:[0,1]},v.x),y:ie({min:0},v.y)},C=["x*y",function(e,t){return{name:e,value:t}}];return e.createElement("div",{className:W.miniChart},e.createElement("div",{className:W.chartContent},e.createElement(a,{animate:_,scale:k,autoFit:c,data:r,pure:w},e.createElement(i,z({key:"axis-x",name:"x",label:null,line:null,tickLine:null,grid:null},g)),e.createElement(i,z({key:"axis-y",name:"y",label:null,line:null,tickLine:null,grid:null},E)),e.createElement(o,{showTitle:!1,showCrosshairs:!1}),y?e.createElement(d,{position:"x*y",tooltip:C,color:p,shape:"smooth",style:{fillOpacity:1}}):e.createElement(m,{position:"x*y",color:u,tooltip:C,shape:"smooth",style:{fillOpacity:1}}))))},MiniProgress:function(t){var n=t.targetLabel,r=t.target,a=t.color,i=void 0===a?"rgb(19, 194, 194)":a,o=t.strokeWidth,l=t.percent;return e.createElement("div",{className:oe},e.createElement(y,{title:n},e.createElement("div",{className:se,style:{left:r?"".concat(r,"%"):void 0}},e.createElement("span",{style:{backgroundColor:i||void 0}}),e.createElement("span",{style:{backgroundColor:i||void 0}}))),e.createElement("div",{className:le},e.createElement("div",{className:ce,style:{backgroundColor:i||void 0,width:l?"".concat(l,"%"):void 0,height:o||void 0}})))},ChartCard:V,Field:function(t){var n=t.label,r=t.value,a=D(t,Q);return e.createElement("div",z({className:G},a),e.createElement("span",{className:Y},n),e.createElement("span",{className:X},r))},WaterWave:function(){function n(){var e,t,r,a;S(this,n);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,r=n,a=[].concat(o),r=j(r),(e=F(t,Pe()?Reflect.construct(r,a||[],j(t).constructor):r.apply(t,a))).state={radio:1},e.timer=0,e.root=null,e.node=null,e.resize=function(){if(e.root){var t=e.props.height,n=void 0===t?1:t,r=e.root.parentNode.offsetWidth;e.setState({radio:r<n?r/n:1})}},e}return R(n,t),T(n,[{key:"componentDidMount",value:function(){var e=this;this.renderChart(),this.resize(),window.addEventListener("resize",function(){requestAnimationFrame(function(){return e.resize()})},{passive:!0})}},{key:"componentDidUpdate",value:function(e){var t=this.props.percent;e.percent!==t&&this.renderChart("update")}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.timer),this.node&&(this.node.innerHTML=""),window.removeEventListener("resize",this.resize)}},{key:"renderChart",value:function(e){var t=this.props,n=t.percent,r=t.color,a=void 0===r?"#1890FF":r,i=n/100,o=this;if(cancelAnimationFrame(this.timer),this.node&&(0===i||i)){var l=this.node,c=l.getContext("2d");if(c){var s=l.width,u=l.height,d=s/2,m=d-2;c.beginPath(),c.lineWidth=4;for(var f=s-2,p=f/8,h=.2,v=h,y=0,g=0,E=[],x=d-2,_=-Math.PI/2,b=!0,w=_;w<_+2*Math.PI;w+=1/(8*Math.PI))E.push([d+x*Math.cos(w),d+x*Math.sin(w)]);var k=E.shift();c.strokeStyle=a,c.moveTo(k[0],k[1]),function t(){if(c){if(c.clearRect(0,0,s,u),b&&"update"!==e)if(E.length>0){var n=E.shift();c.lineTo(n[0],n[1]),c.stroke()}else b=!1,c.lineTo(k[0],k[1]),c.stroke(),E=[],c.globalCompositeOperation="destination-over",c.beginPath(),c.lineWidth=2,c.arc(d,d,x,0,2*Math.PI,!0),c.beginPath(),c.save(),c.arc(d,d,d-6,0,2*Math.PI,!0),c.restore(),c.clip(),c.fillStyle=a;else{if(i>=.85){if(v>.05){v-=.002}}else if(i<=.1){if(v<1.5*h){v+=.002}}else{if(v<=h){v+=.002}if(v>=h){v-=.002}}i-g>0&&(g+=.005),i-g<0&&(g-=.005),y+=.07,function(){if(c){c.beginPath(),c.save();for(var e=[],t=2;t<=2+f;t+=20/f){var n=y+(2+t)/p,r=Math.sin(n)*v,i=t,o=2*m*(1-g)+(d-m)-p*r;c.lineTo(i,o),e.push([i,o])}var l=e.shift();c.lineTo(2+f,u),c.lineTo(2,u),c.lineTo(l[0],l[1]);var s=c.createLinearGradient(0,0,0,u);s.addColorStop(0,"#ffffff"),s.addColorStop(1,a),c.fillStyle=s,c.fill(),c.restore()}}()}o.timer=requestAnimationFrame(t)}}()}}}},{key:"render",value:function(){var t=this,n=this.state.radio,r=this.props,a=r.percent,i=r.title,o=r.height,l=void 0===o?1:o;return e.createElement($,null,e.createElement("div",{className:Ne,ref:function(e){return t.root=e},style:{transform:"scale(".concat(n,")"),height:"100%"}},e.createElement("div",{style:{width:l,height:l,overflow:"hidden"}},e.createElement("canvas",{className:Me,ref:function(e){return t.node=e},width:2*l,height:2*l})),e.createElement("div",{className:Se,style:{width:l}},i&&e.createElement("span",null,i),e.createElement("h4",null,a,"%"))))}}])}(),TagCloud:Ce,TimelineChart:function(t){var n,r=t.title,l=t.height,c=void 0===l?400:l,s=t.padding,d=void 0===s?[60,20,40,40]:s,m=t.titleMap,f=void 0===m?{y1:"y1",y2:"y2"}:m,v=t.borderWidth,y=void 0===v?2:v,g=t.data,E=Array.isArray(g)?g:[{x:0,y1:0,y2:0}];E.sort(function(e,t){return e.x-t.x}),E[0]&&E[0].y1&&E[0].y2&&(n=Math.max(N(E).sort(function(e,t){return t.y1-e.y1})[0].y1,N(E).sort(function(e,t){return t.y2-e.y2})[0].y2));var x=new w({state:{start:E[0].x,end:E.at(-1).x}}),_=x.createView();_.source(E).transform({type:"filter",callback:function(e){var t=e.x;return t<=x.state.end&&t>=x.state.start}}).transform({type:"map",callback:function(e){var t=ie({},e);return t[f.y1]=e.y1,t[f.y2]=e.y2,t}}).transform({type:"fold",fields:[f.y1,f.y2],key:"key",value:"value"});var b={type:"time",tickInterval:36e5,mask:"HH:mm",range:[0,1]},k={x:b,value:{max:n,min:0}},C=function(){return e.createElement(h,{padding:[0,d[1]+20,0,d[3]],width:"auto",height:26,xAxis:"x",yAxis:"y1",scales:{x:b},data:E,start:x.state.start,end:x.state.end,backgroundChart:{type:"line"},onChange:function(e){var t=e.startValue,n=e.endValue;x.setState("start",t),x.setState("end",n)}})};return e.createElement($,null,e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Oe,style:{height:c+30}},e.createElement("div",null,r&&e.createElement("h4",null,r),e.createElement(a,{height:c,padding:d,data:_,scale:k,forceFit:!0},e.createElement(i,{name:"x"}),e.createElement(o,null),e.createElement(p,{name:"key",position:"top"}),e.createElement(u,{type:"line",position:"x*value",size:y,color:"key"})),e.createElement("div",{style:{marginRight:-20}},e.createElement(C,null))))))}},Fe="index_activeChart__HCbH3",je="index_activeChartGrid__fUR9L",Ae="index_activeChartLegend__PnJGF",Re="index_dashedLine__OjP--",We="index_line__h0Is-";function Ie(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ie=function(){return!!e})()}var Le=Te.MiniArea;function ze(e){return 1*e<10?"0".concat(e):e}function De(){for(var e=[],t=0;t<24;t+=1)e.push({x:"".concat(ze(t),":00"),y:Math.floor(200*Math.random())+50*t});return e}var Be=function(){function r(){var e,t,n,a;S(this,r);for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];return t=this,n=r,a=[].concat(o),n=j(n),(e=F(t,Ie()?Reflect.construct(n,a||[],j(t).constructor):n.apply(t,a))).state={activeData:De()},e.loopData=function(){e.requestRef=requestAnimationFrame(function(){e.timer=setTimeout(function(){e.setState({activeData:De()},function(){e.loopData()})},1e3)})},e}return R(r,t),T(r,[{key:"componentDidMount",value:function(){this.loopData()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timer),cancelAnimationFrame(this.requestRef)}},{key:"render",value:function(){var t=this.state.activeData,r=void 0===t?[]:t;return e.createElement("div",{className:Fe},e.createElement(n,{subTitle:"目标评估",total:"有望达到预期"}),e.createElement("div",{style:{marginTop:32}},e.createElement(Le,{animate:!1,line:!0,borderWidth:2,height:84,scale:{y:{tickCount:3}},yAxis:{tickLine:!1,label:!1,title:!1,line:!1},data:r})),r&&e.createElement("div",null,e.createElement("div",{className:je},e.createElement("p",null,N(r).sort()[r.length-1].y+200," 亿元"),e.createElement("p",null,N(r).sort()[Math.floor(r.length/2)].y," ","亿元")),e.createElement("div",{className:Re},e.createElement("div",{className:We})),e.createElement("div",{className:Re},e.createElement("div",{className:We}))),r&&e.createElement("div",{className:Ae},e.createElement("span",null,"00:00"),e.createElement("span",null,r[Math.floor(r.length/2)].x),e.createElement("span",null,r.at(-1).x)))}}])}();export{Be as ActiveChart,Te as Charts};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-management-fast-charts",
3
- "version": "2.6.180",
3
+ "version": "2.6.183",
4
4
  "description": "antd-management-fast-charts",
5
5
  "keywords": [
6
6
  "antd-management-fast-charts"
@@ -60,6 +60,7 @@
60
60
  "dependencies": {
61
61
  "@ant-design/icons": "^6.1.0",
62
62
  "@ant-design/pro-components": "^2.8.10",
63
+ "@antv/data-set": "^0.11.8",
63
64
  "@tanem/react-nprogress": "^5.0.56",
64
65
  "@tinymce/miniature": "^6.0.0",
65
66
  "@tinymce/tinymce-react": "^6.3.0",