antd-management-fast-charts 2.6.119 → 2.6.121

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 +13 -13
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 _,Divider as E}from"antd";import x 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 N(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 O(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)||N(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 T(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 P(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,T(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function j(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 F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(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",chartLoading:"index_chartLoading__jDM-I"};function L(e,t,n){return t=F(t),j(e,I()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(I=function(){return!!e})()}var z=function(){function n(){var e;S(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return(e=L(this,n,[].concat(r))).state={autoHideXLabels:!1},e}return R(n,t),P(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 D(){return D=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},D.apply(null,arguments)}function B(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(t.includes(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],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function H(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q={chartCard:"index_chartCard__9EAQx",chartTop:"index_chartTop__SQ2cg",chartTopMargin:"index_chartTopMargin__6-Xl2",chartTopHasMargin:"index_chartTopHasMargin__xcCoM",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"},U=["loading"];function V(e,t,n){return t=F(t),j(e,G()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function G(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(G=function(){return!!e})()}var Y=function(){function t(){var n;S(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return(n=V(this,t,[].concat(a))).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:q.chartCard},e.createElement("div",{className:x(q.chartTop,H({},q.chartTopMargin,!s&&!c))},e.createElement("div",{className:q.avatar},i),e.createElement("div",{className:q.metaWrap},e.createElement("div",{className:q.meta},e.createElement("span",{className:q.title},a),e.createElement("span",{className:q.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:q.total},t());break;default:n=e.createElement("div",{className:q.total},t)}return n}(l))),s&&e.createElement("div",{className:q.content,style:{height:r||"auto"}},e.createElement("div",{className:q.contentFixed},s)),c&&e.createElement("div",{className:x(q.footer,H({},q.footerMargin,!s))},c))},n}return R(t,e.Component),P(t,[{key:"render",value:function(){var t=this.props,n=t.loading,r=void 0!==n&&n,a=B(t,U);return e.createElement(v,D({loading:r,styles:{body:{padding:"20px 24px 8px 24px"}}},a),this.renderContent())}}])}(),X="index_field__pEkBk",Q="index_label__8cj8I",Z="index_number__D3ouB",J=["label","value"];function K(e,t,n){return t=F(t),j(e,$()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function $(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return($=function(){return!!e})()}function ee(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 te(e){if(!e)return 0;var t=e,n=ee(t),r=t.parentNode;return r&&(n=ee(r)),n}var ne=function(){function t(){var e;S(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=K(this,t,[].concat(r))).state={computedHeight:0},e.root=void 0,e.handleRoot=function(t){e.root=t},e}return R(t,e.Component),P(t,[{key:"componentDidMount",value:function(){if(!this.props.height){var e=te(this.root);this.setState({computedHeight:e}),e<1&&(e=te(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)}}])}(),re=c.Arc,ae=c.Html,ie=c.Line,oe=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 le(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 ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?le(Object(n),!0).forEach((function(t){H(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var se="index_miniProgress__f07Y-",ue="index_progressWrap__II1Y1",de="index_progress__Zps2h",me="index_target__77Xoq",fe="index_pie__i-WEw",pe="index_chart__Npfns",he="index_legend__kJ-GY",ve="index_dot__Y1znw",ye="index_legendTitle__pU8R8",ge="index_percent__fIW53",_e="index_value__HFjZ-",Ee="index_total__frj0M",xe="index_legendBlock__K0V8C";function be(e,t,n){return t=F(t),j(e,we()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function we(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(we=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 ke=function(){function n(){var e;S(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return(e=be(this,n,[].concat(r))).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),P(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=x(fe,d,xe),h=this.props.data,v=this.calculateTotal(h);return e.createElement("div",{className:p},e.createElement(g,{gutter:24},e.createElement(_,{lg:12,md:12,sm:24,xs:24},e.createElement("div",{className:pe,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:Ee},c&&e.createElement("h4",{className:"pie-sub-title"},c),u&&e.createElement("div",{className:"pie-stat"},"function"==typeof u?u():u))),e.createElement(_,{lg:12,md:12,sm:24,xs:24},e.createElement("ul",{className:he,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:ve,style:{backgroundColor:n.checked?n.color:"#aaa"}}),e.createElement("span",{className:ye},n.x),e.createElement(E,{type:"vertical"}),e.createElement("span",{className:ge},"".concat(((v||0)>0?100*(Number.isNaN(n.y/v)?0:n.y/v):0).toFixed(2),"%")),e.createElement("span",{className:_e},r?r(n.y):n.y))}))))))}}])}();function Ce(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)||N(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 Ne="index_tagCloud__Xpi-N";function Oe(e,t,n){return t=F(t),j(e,Se()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function Se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Se=function(){return!!e})()}var Me=r.registerShape;var Te=function(){function n(){var e;S(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return(e=Oe(this,n,[].concat(r))).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(){Me("point","cloud",{draw:function(e,t){var n=function(e){return ce(ce({},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:ce(ce({},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=Ce(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),P(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(ne,null,e.createElement("div",{className:x(Ne,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}}]}))))}}])}(),Pe="index_timelineChart__YekIc",je="index_waterWave__M5niT",Fe="index_text__SRpKH",Ae="index_waterWaveCanvasWrapper__hMwnr";function Re(e,t,n){return t=F(t),j(e,We()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function We(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(We=function(){return!!e})()}var Le={Bar:z,Pie:ke,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?oe: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(ne,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(ie,{start:[3,.905],end:[3,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:2}}),e.createElement(ie,{start:[5,.905],end:[5,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(ie,{start:[7,.905],end:[7,.85],lineStyle:{stroke:p,lineDash:void 0,lineWidth:3}}),e.createElement(re,{start:[0,.965],end:[10,.965],style:{stroke:v,lineWidth:10}}),e.createElement(re,{start:[0,.965],end:[y[0].value,.965],style:{stroke:p,lineWidth:10}}),e.createElement(ae,{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,_=t.yAxis,E=t.animate,x=void 0===E||E,b=t.pure,w=void 0===b||b,k={x:ce({type:"cat",range:[0,1]},v.x),y:ce({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:x,scale:k,autoFit:c,data:r,pure:w},e.createElement(i,D({key:"axis-x",name:"x",label:null,line:null,tickLine:null,grid:null},g)),e.createElement(i,D({key:"axis-y",name:"y",label:null,line:null,tickLine:null,grid:null},_)),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:se},e.createElement(y,{title:n},e.createElement("div",{className:me,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:ue},e.createElement("div",{className:de,style:{backgroundColor:i||void 0,width:l?"".concat(l,"%"):void 0,height:o||void 0}})))},ChartCard:Y,Field:function(t){var n=t.label,r=t.value,a=B(t,J);return e.createElement("div",D({className:X},a),e.createElement("span",{className:Q},n),e.createElement("span",{className:Z},r))},WaterWave:function(){function n(){var e;S(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return(e=Re(this,n,[].concat(r))).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),P(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=2,g=0,_=0,E=[],x=d-2,b=-Math.PI/2,w=!0,k=b;k<b+2*Math.PI;k+=1/(8*Math.PI))E.push([d+x*Math.cos(k),d+x*Math.sin(k)]);var C=E.shift();c.strokeStyle=a,c.moveTo(C[0],C[1]),function t(){if(c){if(c.clearRect(0,0,s,u),w&&"update"!==e)if(E.length>0){var n=E.shift();c.lineTo(n[0],n[1]),c.stroke()}else w=!1,c.lineTo(C[0],C[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-_>0&&(_+=.005),i-_<0&&(_-=.005),g+=.07,function(){if(c){c.beginPath(),c.save();for(var e=[],t=y;t<=y+f;t+=20/f){var n=g+(y+t)/p,r=Math.sin(n)*v,i=t,o=2*m*(1-_)+(d-m)-p*r;c.lineTo(i,o),e.push([i,o])}var l=e.shift();c.lineTo(y+f,u),c.lineTo(y,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(ne,null,e.createElement("div",{className:je,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:Ae,ref:function(e){return t.node=e},width:2*l,height:2*l})),e.createElement("div",{className:Fe,style:{width:l}},i&&e.createElement("span",null,i),e.createElement("h4",null,a,"%"))))}}])}(),TagCloud:Te,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,_=Array.isArray(g)?g:[{x:0,y1:0,y2:0}];_.sort((function(e,t){return e.x-t.x})),_[0]&&_[0].y1&&_[0].y2&&(n=Math.max(O(_).sort((function(e,t){return t.y1-e.y1}))[0].y1,O(_).sort((function(e,t){return t.y2-e.y2}))[0].y2));var E=new w({state:{start:_[0].x,end:_[_.length-1].x}}),x=E.createView();x.source(_).transform({type:"filter",callback:function(e){var t=e.x;return t<=E.state.end&&t>=E.state.start}}).transform({type:"map",callback:function(e){var t=ce({},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:_,start:E.state.start,end:E.state.end,backgroundChart:{type:"line"},onChange:function(e){var t=e.startValue,n=e.endValue;E.setState("start",t),E.setState("end",n)}})};return e.createElement(ne,null,e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Pe,style:{height:c+30}},e.createElement("div",null,r&&e.createElement("h4",null,r),e.createElement(a,{height:c,padding:d,data:x,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))))))}},Ie="index_activeChart__HCbH3",ze="index_activeChartGrid__fUR9L",De="index_activeChartLegend__PnJGF",Be="index_dashedLine__OjP--",He="index_line__h0Is-";function qe(e,t,n){return t=F(t),j(e,Ue()?Reflect.construct(t,n||[],F(e).constructor):t.apply(e,n))}function Ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ue=function(){return!!e})()}var Ve=Le.MiniArea;function Ge(){for(var e,t=[],n=0;n<24;n+=1)t.push({x:"".concat((e=n,1*e<10?"0".concat(e):e),":00"),y:Math.floor(200*Math.random())+50*n});return t}var Ye=function(){function r(){var e;S(this,r);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return(e=qe(this,r,[].concat(n))).state={activeData:Ge()},e.loopData=function(){e.requestRef=requestAnimationFrame((function(){e.timer=setTimeout((function(){e.setState({activeData:Ge()},(function(){e.loopData()}))}),1e3)}))},e}return R(r,t),P(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:Ie},e.createElement(n,{subTitle:"目标评估",total:"有望达到预期"}),e.createElement("div",{style:{marginTop:32}},e.createElement(Ve,{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:ze},e.createElement("p",null,O(r).sort()[r.length-1].y+200," 亿元"),e.createElement("p",null,O(r).sort()[Math.floor(r.length/2)].y," ","亿元")),e.createElement("div",{className:Be},e.createElement("div",{className:He})),e.createElement("div",{className:Be},e.createElement("div",{className:He}))),r&&e.createElement("div",{className:De},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{Ye as ActiveChart,Le 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 _,Divider as E}from"antd";import x 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 N(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 O(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)||N(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 T(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 P(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,T(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function j(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 F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(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",chartLoading:"index_chartLoading__jDM-I"};function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(L=function(){return!!e})()}var I=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=F(r),(e=j(t,L()?Reflect.construct(r,a||[],F(t).constructor):r.apply(t,a))).state={autoHideXLabels:!1},e}return R(n,t),P(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(t.includes(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],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function B(e,t,n){return(t=T(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",chartTopHasMargin:"index_chartTopHasMargin__xcCoM",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=F(a),(n=j(r,U()?Reflect.construct(a,i||[],F(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:x(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:x(H.footer,B({},H.footerMargin,!s))},c))},n}return R(t,e.Component),P(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=F(r),(e=j(n,Z()?Reflect.construct(r,a||[],F(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),P(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 _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_e=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 Ee=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=F(r),(e=j(t,_e()?Reflect.construct(r,a||[],F(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),P(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=x(ue,d,ge),h=this.props.data,v=this.calculateTotal(h);return e.createElement("div",{className:p},e.createElement(g,{gutter:24},e.createElement(_,{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(_,{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(E,{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 xe(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)||N(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=F(r),(e=j(t,we()?Reflect.construct(r,a||[],F(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=xe(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),P(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:x(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}}]}))))}}])}(),Ne="index_timelineChart__YekIc",Oe="index_waterWave__M5niT",Se="index_text__SRpKH",Me="index_waterWaveCanvasWrapper__hMwnr";function Te(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Te=function(){return!!e})()}var Pe={Bar:I,Pie:Ee,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,_=t.yAxis,E=t.animate,x=void 0===E||E,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:x,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.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=F(r),(e=j(t,Te()?Reflect.construct(r,a||[],F(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),P(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=d-2,x=-Math.PI/2,b=!0,w=x;w<x+2*Math.PI;w+=1/(8*Math.PI))_.push([d+E*Math.cos(w),d+E*Math.sin(w)]);var k=_.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(_.length>0){var n=_.shift();c.lineTo(n[0],n[1]),c.stroke()}else b=!1,c.lineTo(k[0],k[1]),c.stroke(),_=[],c.globalCompositeOperation="destination-over",c.beginPath(),c.lineWidth=2,c.arc(d,d,E,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:Oe,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,_=Array.isArray(g)?g:[{x:0,y1:0,y2:0}];_.sort((function(e,t){return e.x-t.x})),_[0]&&_[0].y1&&_[0].y2&&(n=Math.max(O(_).sort((function(e,t){return t.y1-e.y1}))[0].y1,O(_).sort((function(e,t){return t.y2-e.y2}))[0].y2));var E=new w({state:{start:_[0].x,end:_[_.length-1].x}}),x=E.createView();x.source(_).transform({type:"filter",callback:function(e){var t=e.x;return t<=E.state.end&&t>=E.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:_,start:E.state.start,end:E.state.end,backgroundChart:{type:"line"},onChange:function(e){var t=e.startValue,n=e.endValue;E.setState("start",t),E.setState("end",n)}})};return e.createElement($,null,e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Ne,style:{height:c+30}},e.createElement("div",null,r&&e.createElement("h4",null,r),e.createElement(a,{height:c,padding:d,data:x,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))))))}},je="index_activeChart__HCbH3",Fe="index_activeChartGrid__fUR9L",Ae="index_activeChartLegend__PnJGF",Re="index_dashedLine__OjP--",We="index_line__h0Is-";function Le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Le=function(){return!!e})()}var Ie=Pe.MiniArea;function ze(){for(var e,t=[],n=0;n<24;n+=1)t.push({x:"".concat((e=n,1*e<10?"0".concat(e):e),":00"),y:Math.floor(200*Math.random())+50*n});return t}var De=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=F(n),(e=j(t,Le()?Reflect.construct(n,a||[],F(t).constructor):n.apply(t,a))).state={activeData:ze()},e.loopData=function(){e.requestRef=requestAnimationFrame((function(){e.timer=setTimeout((function(){e.setState({activeData:ze()},(function(){e.loopData()}))}),1e3)}))},e}return R(r,t),P(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:je},e.createElement(n,{subTitle:"目标评估",total:"有望达到预期"}),e.createElement("div",{style:{marginTop:32}},e.createElement(Ie,{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:Fe},e.createElement("p",null,O(r).sort()[r.length-1].y+200," 亿元"),e.createElement("p",null,O(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{De as ActiveChart,Pe as Charts};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-management-fast-charts",
3
- "version": "2.6.119",
3
+ "version": "2.6.121",
4
4
  "description": "antd-management-fast-charts",
5
5
  "keywords": [
6
6
  "antd-management-fast-charts"
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@ant-design/icons": "^5.4.0",
62
- "@ant-design/pro-components": "^2.7.16",
62
+ "@ant-design/pro-components": "^2.7.18",
63
63
  "@tanem/react-nprogress": "^5.0.51",
64
64
  "@tinymce/tinymce-react": "^5.1.1",
65
65
  "@umijs/max": "^4.3.20",
@@ -72,9 +72,9 @@
72
72
  "classnames": "^2.5.1",
73
73
  "copy-to-clipboard": "^3.3.3",
74
74
  "dayjs": "^1.11.13",
75
- "easy-soft-dva": "^3.10.65",
76
- "easy-soft-utility": "^2.8.68",
77
- "html-react-parser": "^5.1.15",
75
+ "easy-soft-dva": "^3.10.67",
76
+ "easy-soft-utility": "^2.8.70",
77
+ "html-react-parser": "^5.1.16",
78
78
  "lodash.debounce": "^4.0.8",
79
79
  "numeral": "^2.0.6",
80
80
  "path-to-regexp": "^8.1.0",
@@ -121,15 +121,15 @@
121
121
  "@rollup/plugin-url": "^8.0.2",
122
122
  "@svgr/rollup": "^8.1.0",
123
123
  "@types/fs-extra": "^11.0.4",
124
- "@types/jest": "^29.5.12",
124
+ "@types/jest": "^29.5.13",
125
125
  "@types/lodash": "^4.17.7",
126
126
  "@types/lodash.debounce": "^4.0.9",
127
127
  "@types/lodash.isequal": "^4.5.8",
128
- "@types/node": "^22.5.4",
129
- "@types/react": "^18.3.5",
128
+ "@types/node": "^22.5.5",
129
+ "@types/react": "^18.3.7",
130
130
  "@types/react-dom": "^18.3.0",
131
131
  "@types/shelljs": "^0.8.15",
132
- "@typescript-eslint/parser": "^8.5.0",
132
+ "@typescript-eslint/parser": "^8.6.0",
133
133
  "autoprefixer": "^10.4.20",
134
134
  "babel-jest": "^29.7.0",
135
135
  "commitizen": "^4.3.0",
@@ -138,7 +138,7 @@
138
138
  "cssnano": "^7.0.6",
139
139
  "cz-git": "^1.9.4",
140
140
  "docdash": "^2.0.2",
141
- "easy-soft-develop": "^2.1.239",
141
+ "easy-soft-develop": "^2.1.241",
142
142
  "eslint": "^8.57.0",
143
143
  "eslint-config-airbnb": "^19.0.4",
144
144
  "eslint-config-airbnb-typescript": "^18.0.0",
@@ -151,11 +151,11 @@
151
151
  "eslint-plugin-jsx-a11y": "^6.10.0",
152
152
  "eslint-plugin-prettier": "^5.2.1",
153
153
  "eslint-plugin-promise": "^7.1.0",
154
- "eslint-plugin-react": "^7.35.2",
154
+ "eslint-plugin-react": "^7.36.1",
155
155
  "eslint-plugin-react-hooks": "^4.6.2",
156
156
  "eslint-plugin-simple-import-sort": "^12.1.1",
157
157
  "eslint-plugin-unicorn": "^52.0.0",
158
- "husky": "^9.1.5",
158
+ "husky": "^9.1.6",
159
159
  "jest": "^29.7.0",
160
160
  "jsdoc": "^4.0.3",
161
161
  "lint-staged": "^15.2.10",
@@ -166,7 +166,7 @@
166
166
  "prop-types": "^15.8.1",
167
167
  "react-refresh": "0.14.2",
168
168
  "rimraf": "^6.0.1",
169
- "rollup": "^4.21.2",
169
+ "rollup": "^4.21.3",
170
170
  "rollup-plugin-copy": "^3.5.0",
171
171
  "rollup-plugin-dts": "^6.1.1",
172
172
  "rollup-plugin-livereload": "^2.0.5",