@corva/ui 0.70.0-4 → 0.70.0-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/EChartsWrapper/EChartsWrapper.js +1 -1
- package/components/EChartsWrapper/EChartsWrapper.d.ts.map +1 -1
- package/components/EChartsWrapper/EChartsWrapper.js +1 -1
- package/components/EChartsWrapper/types.d.ts +10 -0
- package/components/EChartsWrapper/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),o=require("react"),n=require("lodash"),
|
|
1
|
+
"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),o=require("react"),n=require("lodash"),a=require("@material-ui/core"),r=require("classnames"),s=require("./components/Toolbox/Toolbox.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=d(r),u=a.makeStyles((function(){return{container:{position:"relative",width:"100%",height:"100%"}}})),l=function(n){var a=n.containerClassName,r=n.customToolboxContainerClass,d=n.onDataZoom,l=n.children,c=u(),x=o.useRef(null),m=x.current,v=o.useState(!0),y=v[0],h=v[1],f=o.useState(!1),M=f[0],p=f[1],b=o.useState(!0),g=b[0],F=b[1],Z=o.useState(!1),A=Z[0],O=Z[1],C=o.useRef(null),E=o.useState(null),I=E[0],S=E[1],T=function(e){var t=100*Math.abs(e.x.start-C.current.x.start),o=100*Math.abs(e.x.end-C.current.x.start),n=100*Math.abs(e.y.start-C.current.y.start),a=100*Math.abs(e.y.end-C.current.y.start),r=n/Math.abs(C.current.y.start-C.current.y.end),s=a/Math.abs(C.current.y.start-C.current.y.end),d=t/Math.abs(C.current.x.start-C.current.x.end),i=o/Math.abs(C.current.x.start-C.current.x.end);A?(m.dispatchAction({type:"dataZoom",dataZoomIndex:0,moveOnMouseMove:M||g,start:+d.toFixed(2),end:+i.toFixed(2)}),m.dispatchAction({type:"dataZoom",dataZoomIndex:1,moveOnMouseMove:M||g,start:+r.toFixed(2),end:+s.toFixed(2)})):(m.setOption({dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:M||g,start:+d.toFixed(2),end:+i.toFixed(2)},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:M||g,start:+r.toFixed(2),end:+s.toFixed(2)}]}),S(e))},q=function(){var e,t,o,n,a,r,s,d,i=null===(n=null===(o=null===(t=null===(e=null==m?void 0:m.getModel())||void 0===e?void 0:e.getComponent("xAxis",0))||void 0===t?void 0:t.axis)||void 0===o?void 0:o.scale)||void 0===n?void 0:n.getExtent(),u=null===(d=null===(s=null===(r=null===(a=null==m?void 0:m.getModel())||void 0===a?void 0:a.getComponent("yAxis",0))||void 0===r?void 0:r.axis)||void 0===s?void 0:s.scale)||void 0===d?void 0:d.getExtent();if(i&&u){var l=i[0],c=i[1],x=u[0],v=u[1];C.current={x:{start:+l.toFixed(2),end:+c.toFixed(2)},y:{start:+x.toFixed(2),end:+v.toFixed(2)}}}},z=function(e){var t=0===e.start&&100===e.end;"datazoom"!==e.type||t||O((function(e){return e||q(),!0})),function(){var e=m.getModel().getComponent("yAxis",0).axis.scale.getExtent(),t=e[0],o=e[1],n=m.getModel().getComponent("xAxis",0).axis.scale.getExtent(),a={x:{start:n[0],end:n[1]},y:{start:t,end:o}};S(a),d(a)}()};o.useEffect((function(){m&&(A||q(),y||(m.setOption({toolbox:{show:!0,width:0,height:0,feature:{dataZoom:{show:!0,icon:null},brush:{show:!1}}},dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1}]},{replaceMerge:"dataZoom"}),m.on("dataZoom",z),h(!0),F(!0)))}),[m,y]),o.useEffect((function(){var e=null==m?void 0:m.getZr();if(e){var t=Array.from(e.dom.getElementsByTagName("canvas")).at(-1);t?t.style.cursor=M?"grab":g?"crosshair":"default":console.error("Canvas not found")}}),[m,M,g]),o.useEffect((function(){m&&m.setOption({dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:M||g},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:M||g}]})}),[M,g,m]),o.useEffect((function(){m&&m.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:g})}),[g]);return t.jsxs("div",e.__assign({className:i.default(c.container,a)},{children:[o.Children.map(l,(function(e){var t,n=e.props.onChartReady;return o.cloneElement(e,{onChartReady:(t=n,function(e){t&&t(e),h(!1),x.current=e})})})),t.jsx(s.Toolbox,{handleTogglePane:function(e){return p(e)},handleToggleBrush:function(e){return F(e)},isPaneEnabled:M,isBrushEnabled:g,isZoomed:A,chart:m,customToolboxContainerClass:r,handleZoomReset:function(){O(!1),p(!1),F(!0),m.dispatchAction({type:"dataZoom",start:0,end:100,rangeMode:["percent","percent"]})},handleZoomOut:function(){var e=.05*Math.abs(C.current.x.start-C.current.x.end),t=.05*Math.abs(C.current.y.start-C.current.y.end),o=+(I.x.start-e).toFixed(2),n=+(I.x.end+e).toFixed(2),a=+(I.y.start-t).toFixed(2),r=+(I.y.end+t).toFixed(2),s=o<=C.current.x.start||n>=C.current.x.end,d=a<=C.current.y.start||r>=C.current.y.end;s&&d&&(O(!1),p(!1),F(!0)),T({x:s?C.current.x:{start:o,end:n},y:d?C.current.y:{start:a,end:r}})},handleZoomIn:function(){A||(q(),O(!0));var e=I||C.current,t=.05*Math.abs(e.x.start-e.x.end),o=.05*Math.abs(e.y.start-e.y.end),n=+(e.x.start+t).toFixed(2),a=+(e.x.end-t).toFixed(2),r=+(e.y.start+o).toFixed(2),s=+(e.y.end-o).toFixed(2),d=n>=a,i=r>=s;T({x:{start:d?e.x.start:n,end:d?e.x.end:a},y:{start:i?e.y.start:r,end:i?e.y.end:s}})}})]}))};l.defaultProps={onDataZoom:n.noop},module.exports=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EChartsWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/EChartsWrapper/EChartsWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,EAAE,EAA+B,MAAM,OAAO,CAAC;AAShF,OAAO,
|
|
1
|
+
{"version":3,"file":"EChartsWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/EChartsWrapper/EChartsWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,EAAE,EAA+B,MAAM,OAAO,CAAC;AAShF,OAAO,EAAa,iBAAiB,EAAiB,MAAM,SAAS,CAAC;AAYtE,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,CAwVzC,CAAC;AAMF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useRef as n,useState as
|
|
1
|
+
import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useRef as n,useState as a,useEffect as r,Children as d,cloneElement as s}from"react";import{noop as i}from"lodash";import{makeStyles as l}from"@material-ui/core";import u from"classnames";import{Toolbox as x}from"./components/Toolbox/Toolbox.js";var c=l((function(){return{container:{position:"relative",width:"100%",height:"100%"}}})),m=function(i){var l=i.containerClassName,m=i.customToolboxContainerClass,v=i.onDataZoom,y=i.children,h=c(),M=n(null),f=M.current,p=a(!0),b=p[0],g=p[1],F=a(!1),Z=F[0],A=F[1],O=a(!0),C=O[0],I=O[1],z=a(!1),E=z[0],T=z[1],W=n(null),w=a(null),j=w[0],B=w[1],N=function(t){var e=100*Math.abs(t.x.start-W.current.x.start),o=100*Math.abs(t.x.end-W.current.x.start),n=100*Math.abs(t.y.start-W.current.y.start),a=100*Math.abs(t.y.end-W.current.y.start),r=n/Math.abs(W.current.y.start-W.current.y.end),d=a/Math.abs(W.current.y.start-W.current.y.end),s=e/Math.abs(W.current.x.start-W.current.x.end),i=o/Math.abs(W.current.x.start-W.current.x.end);E?(f.dispatchAction({type:"dataZoom",dataZoomIndex:0,moveOnMouseMove:Z||C,start:+s.toFixed(2),end:+i.toFixed(2)}),f.dispatchAction({type:"dataZoom",dataZoomIndex:1,moveOnMouseMove:Z||C,start:+r.toFixed(2),end:+d.toFixed(2)})):(f.setOption({dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:Z||C,start:+s.toFixed(2),end:+i.toFixed(2)},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:Z||C,start:+r.toFixed(2),end:+d.toFixed(2)}]}),B(t))},P=function(){var t,e,o,n,a,r,d,s,i=null===(n=null===(o=null===(e=null===(t=null==f?void 0:f.getModel())||void 0===t?void 0:t.getComponent("xAxis",0))||void 0===e?void 0:e.axis)||void 0===o?void 0:o.scale)||void 0===n?void 0:n.getExtent(),l=null===(s=null===(d=null===(r=null===(a=null==f?void 0:f.getModel())||void 0===a?void 0:a.getComponent("yAxis",0))||void 0===r?void 0:r.axis)||void 0===d?void 0:d.scale)||void 0===s?void 0:s.getExtent();if(i&&l){var u=i[0],x=i[1],c=l[0],m=l[1];W.current={x:{start:+u.toFixed(2),end:+x.toFixed(2)},y:{start:+c.toFixed(2),end:+m.toFixed(2)}}}},R=function(t){var e=0===t.start&&100===t.end;"datazoom"!==t.type||e||T((function(t){return t||P(),!0})),function(){var t=f.getModel().getComponent("yAxis",0).axis.scale.getExtent(),e=t[0],o=t[1],n=f.getModel().getComponent("xAxis",0).axis.scale.getExtent(),a={x:{start:n[0],end:n[1]},y:{start:e,end:o}};B(a),v(a)}()};r((function(){f&&(E||P(),b||(f.setOption({toolbox:{show:!0,width:0,height:0,feature:{dataZoom:{show:!0,icon:null},brush:{show:!1}}},dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1}]},{replaceMerge:"dataZoom"}),f.on("dataZoom",R),g(!0),I(!0)))}),[f,b]),r((function(){var t=null==f?void 0:f.getZr();if(t){var e=Array.from(t.dom.getElementsByTagName("canvas")).at(-1);e?e.style.cursor=Z?"grab":C?"crosshair":"default":console.error("Canvas not found")}}),[f,Z,C]),r((function(){f&&f.setOption({dataZoom:[{type:"inside",xAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:Z||C},{type:"inside",yAxisIndex:"all",filterMode:"none",zoomOnMouseWheel:!1,moveOnMouseMove:Z||C}]})}),[Z,C,f]),r((function(){f&&f.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:C})}),[C]);return e("div",t({className:u(h.container,l)},{children:[d.map(y,(function(t){var e,o=t.props.onChartReady;return s(t,{onChartReady:(e=o,function(t){e&&e(t),g(!1),M.current=t})})})),o(x,{handleTogglePane:function(t){return A(t)},handleToggleBrush:function(t){return I(t)},isPaneEnabled:Z,isBrushEnabled:C,isZoomed:E,chart:f,customToolboxContainerClass:m,handleZoomReset:function(){T(!1),A(!1),I(!0),f.dispatchAction({type:"dataZoom",start:0,end:100,rangeMode:["percent","percent"]})},handleZoomOut:function(){var t=.05*Math.abs(W.current.x.start-W.current.x.end),e=.05*Math.abs(W.current.y.start-W.current.y.end),o=+(j.x.start-t).toFixed(2),n=+(j.x.end+t).toFixed(2),a=+(j.y.start-e).toFixed(2),r=+(j.y.end+e).toFixed(2),d=o<=W.current.x.start||n>=W.current.x.end,s=a<=W.current.y.start||r>=W.current.y.end;d&&s&&(T(!1),A(!1),I(!0)),N({x:d?W.current.x:{start:o,end:n},y:s?W.current.y:{start:a,end:r}})},handleZoomIn:function(){E||(P(),T(!0));var t=j||W.current,e=.05*Math.abs(t.x.start-t.x.end),o=.05*Math.abs(t.y.start-t.y.end),n=+(t.x.start+e).toFixed(2),a=+(t.x.end-e).toFixed(2),r=+(t.y.start+o).toFixed(2),d=+(t.y.end-o).toFixed(2),s=n>=a,i=r>=d;N({x:{start:s?t.x.start:n,end:s?t.x.end:a},y:{start:i?t.y.start:r,end:i?t.y.end:d}})}})]}))};m.defaultProps={onDataZoom:i};export{m as default};
|
|
@@ -10,6 +10,16 @@ export declare type BrushEndEvent = {
|
|
|
10
10
|
];
|
|
11
11
|
type: 'brushend';
|
|
12
12
|
};
|
|
13
|
+
export declare type DataZoomEvent = {
|
|
14
|
+
start?: number;
|
|
15
|
+
end?: number;
|
|
16
|
+
type: 'datazoom';
|
|
17
|
+
batch?: {
|
|
18
|
+
startValue: number;
|
|
19
|
+
endValue: number;
|
|
20
|
+
type: 'datazoom';
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
13
23
|
export declare type AxisRange = {
|
|
14
24
|
x: {
|
|
15
25
|
start: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/EChartsWrapper/types.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/EChartsWrapper/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,oBAAY,aAAa,GAAG;IAC1B,KAAK,EAAE;QACL;YACE,SAAS,EAAE,MAAM,CAAC;YAClB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;SAC1E;KACF,CAAC;IACF,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,KAAK,CAAC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