aldehyde 0.0.1
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/163.js +2 -0
- package/dist/163.js.LICENSE.txt +43 -0
- package/dist/41.js +1 -0
- package/dist/aldehyde.js +2 -0
- package/dist/aldehyde.js.LICENSE.txt +122 -0
- package/dist/chemstruc-graph.js +1 -0
- package/dist/css/163-24392163d3c7b54ea806.css +11 -0
- package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
- package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
- package/dist/html-editor-draft.js +2 -0
- package/dist/html-editor-draft.js.LICENSE.txt +5 -0
- package/dist/images/logo-06f6a5d8.png +0 -0
- package/dist/index.html +4 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.LICENSE.txt +17 -0
- package/package.json +180 -0
- package/src/components/chart/antd/Chart.js +32 -0
- package/src/components/chart/antd/Chart10000.js +90 -0
- package/src/components/chart/antd/Max2DimLineChart.js +128 -0
- package/src/components/chart/antd/PieChart1.js +54 -0
- package/src/components/chart/antd/PieChart2.js +56 -0
- package/src/components/chart/antd/chart-utils.tsx +50 -0
- package/src/components/chart/antd/column-chart-sub.tsx +67 -0
- package/src/components/chart/antd/line-chart-sub.tsx +65 -0
- package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
- package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
- package/src/components/chart/statview-l2-chart.tsx +69 -0
- package/src/components/controls/action/index.css +9 -0
- package/src/components/controls/action/index.tsx +228 -0
- package/src/components/controls/action/utils.tsx +122 -0
- package/src/components/controls/auto-complete/index.tsx +80 -0
- package/src/components/controls/cascader/index.js +97 -0
- package/src/components/controls/chemstruc/graph.tsx +150 -0
- package/src/components/controls/chemstruc/index.css +28 -0
- package/src/components/controls/collapse-card/index.css +9 -0
- package/src/components/controls/collapse-card/index.tsx +59 -0
- package/src/components/controls/color-picker/index.css +27 -0
- package/src/components/controls/color-picker/index.tsx +88 -0
- package/src/components/controls/cquery/cquick-button.tsx +117 -0
- package/src/components/controls/date-picker/index.tsx +141 -0
- package/src/components/controls/entity-select/entity-select.tsx +277 -0
- package/src/components/controls/entity-select/index.css +6 -0
- package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
- package/src/components/controls/entry-control.tsx +240 -0
- package/src/components/controls/enum-badge/index.tsx +28 -0
- package/src/components/controls/enum-tag/index.tsx +30 -0
- package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
- package/src/components/controls/file-view/index.tsx +145 -0
- package/src/components/controls/html-editor/draft.tsx +161 -0
- package/src/components/controls/html-editor/tinymce.js +55 -0
- package/src/components/controls/input-number/index.tsx +101 -0
- package/src/components/controls/input-range/index.tsx +48 -0
- package/src/components/controls/password-setter/index.css +3 -0
- package/src/components/controls/password-setter/index.js +70 -0
- package/src/components/controls/progress/index.tsx +61 -0
- package/src/components/controls/relation-existion/index.css +4 -0
- package/src/components/controls/relation-existion/index.tsx +108 -0
- package/src/components/controls/rfield/index.css +4 -0
- package/src/components/controls/rfield/index.tsx +161 -0
- package/src/components/controls/signature/index.tsx +162 -0
- package/src/components/controls/steps/index.tsx +58 -0
- package/src/components/controls/text/ellipsis-text.tsx +70 -0
- package/src/components/controls/upload/index.tsx +122 -0
- package/src/components/controls/view-control.tsx +177 -0
- package/src/components/detail/button/cquery-button-bar.tsx +112 -0
- package/src/components/detail/button/index.css +43 -0
- package/src/components/detail/button/submit-button-bar.tsx +151 -0
- package/src/components/detail/dtmpl.css +53 -0
- package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
- package/src/components/detail/edit/fields-edit-card.tsx +103 -0
- package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
- package/src/components/detail/edit/modal-row-edit.tsx +72 -0
- package/src/components/detail/edit/post-result/index.tsx +52 -0
- package/src/components/detail/edit/row-edit-card.tsx +125 -0
- package/src/components/detail/edit/row-editor.tsx +71 -0
- package/src/components/detail/rightbar/index.css +35 -0
- package/src/components/detail/rightbar/index.tsx +76 -0
- package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
- package/src/components/detail/view/dtmpl-view.tsx +143 -0
- package/src/components/detail/view/field-view-group.tsx +73 -0
- package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
- package/src/components/detail/view/snapshot-timeline.tsx +130 -0
- package/src/components/exportor/export-frame.css +3 -0
- package/src/components/exportor/export-frame.tsx +194 -0
- package/src/components/exportor/index.tsx +60 -0
- package/src/components/form/criteria-form.tsx +241 -0
- package/src/components/form/dtmpl-form.css +4 -0
- package/src/components/form/dtmpl-form.tsx +272 -0
- package/src/components/form/field-group-form.tsx +75 -0
- package/src/components/form/fields-form.tsx +51 -0
- package/src/components/form/form-Item-group.tsx +99 -0
- package/src/components/form/index.css +13 -0
- package/src/components/import/excel-import.tsx +316 -0
- package/src/components/import/index.css +54 -0
- package/src/components/import/template-builder.js +474 -0
- package/src/components/import/template.css +51 -0
- package/src/components/layout/MainPage.tsx +230 -0
- package/src/components/layout/footer/index.css +6 -0
- package/src/components/layout/footer/index.js +17 -0
- package/src/components/layout/header/index.css +86 -0
- package/src/components/layout/header/index.tsx +58 -0
- package/src/components/layout/menu/block.tsx +88 -0
- package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
- package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
- package/src/components/layout/menu/menu-2layers.tsx +92 -0
- package/src/components/layout/menu/menu-render.tsx +49 -0
- package/src/components/layout/menu/reset-password.tsx +185 -0
- package/src/components/layout/menu/user-bar.tsx +97 -0
- package/src/components/layout/menu/userinfo-bar.tsx +70 -0
- package/src/components/layout/sidebar/index.css +26 -0
- package/src/components/layout/sidebar/index.tsx +38 -0
- package/src/components/login.js +137 -0
- package/src/components/module/criteria-page.tsx +175 -0
- package/src/components/module/dtmpl-page.tsx +70 -0
- package/src/components/module/ltmpl-page.tsx +181 -0
- package/src/components/routable/dtmpl-route.tsx +96 -0
- package/src/components/routable/import-route.tsx +28 -0
- package/src/components/routable/ltmpl-route.tsx +158 -0
- package/src/components/table/act-table.tsx +635 -0
- package/src/components/table/column/column-selector.tsx +79 -0
- package/src/components/table/column/index.css +14 -0
- package/src/components/table/index.css +45 -0
- package/src/components/table/l2-act-table.tsx +85 -0
- package/src/components/table/modal-select-table.tsx +248 -0
- package/src/components/table/pagination.css +15 -0
- package/src/components/table/pagination.tsx +72 -0
- package/src/components/table/query-table.tsx +331 -0
- package/src/components/table/relation-table.tsx +600 -0
- package/src/components/table/select-table.tsx +247 -0
- package/src/components/table/selected-rows-card.tsx +62 -0
- package/src/components/table/stat/restat.tsx +79 -0
- package/src/components/table/table-util.tsx +33 -0
- package/src/components/tmpl/control-type-supportor.tsx +97 -0
- package/src/components/tmpl/hc-data-source.tsx +230 -0
- package/src/components/tmpl/hcservice-v3.tsx +624 -0
- package/src/components/tmpl/interface.tsx +308 -0
- package/src/components/tmpl/superagent.js +93 -0
- package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
- package/src/components/units/EncryptUtils.js +38 -0
- package/src/components/units/image.d.ts +8 -0
- package/src/components/units/index.tsx +536 -0
- package/src/components/units/logo.png +0 -0
- package/src/components/units/storage.js +3 -0
- package/src/components/welcome/HCWelcome.js +232 -0
- package/src/components/welcome/index.css +13 -0
- package/src/components/welcome/logo.png +0 -0
- package/src/components/welcome/quick-entrance.tsx +77 -0
- package/src/components/welcome/workbench.tsx +76 -0
- package/src/index.js +4 -0
- package/src/style/common.css +79 -0
- package/src/style/coverstyle.css +49 -0
- package/src/style/transstyle.css +24 -0
- package/tsconfig.json +106 -0
|
Binary file
|
package/dist/index.html
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><title></title><link rel="icon" href="favicon.ico" type="image/x-icon"/><script defer="defer" src="aldehyde.js"></script><link href="css/main-2e6725ec1b56da516cee.css" rel="stylesheet"></head><body><script>document.title=window.localStorage['programName']?window.localStorage['programName']:'HYDROCARBON';
|
|
2
|
+
window.addEventListener('beforeunload',e=>{
|
|
3
|
+
window.scrollTo(0);
|
|
4
|
+
})</script><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div class="ajax-loading" id="ajaxLoading" style="display: none;"><div class="overlay"></div></div></body></html>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see signature.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunkaldehyde=self.webpackChunkaldehyde||[]).push([[958],{10404:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return M}});var i=n(84322),o=n.n(i),r=n(59755),a=n(90237),s=n(65337),c=n(95225),h=n(39576),l=n(61378),u=n(69905),d=n(15274),f=n(67294),p=n(62462),v=n(71577),m=n(50146),_=n(75443),y=n(71230),g=n(15746),x=n(58877),w=n.n(x),b=n(1413),P={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M957.6 507.4L603.2 158.2a7.9 7.9 0 00-11.2 0L353.3 393.4a8.03 8.03 0 00-.1 11.3l.1.1 40 39.4-117.2 115.3a8.03 8.03 0 00-.1 11.3l.1.1 39.5 38.9-189.1 187H72.1c-4.4 0-8.1 3.6-8.1 8V860c0 4.4 3.6 8 8 8h344.9c2.1 0 4.1-.8 5.6-2.3l76.1-75.6 40.4 39.8a7.9 7.9 0 0011.2 0l117.1-115.6 40.1 39.5a7.9 7.9 0 0011.2 0l238.7-235.2c3.4-3 3.4-8 .3-11.2zM389.8 796.2H229.6l134.4-133 80.1 78.9-54.3 54.1zm154.8-62.1L373.2 565.2l68.6-67.6 171.4 168.9-68.6 67.6zM713.1 658L450.3 399.1 597.6 254l262.8 259-147.3 145z"}}]},name:"highlight",theme:"outlined"},C=n(41390),E=function(t,e){return f.createElement(C.Z,(0,b.Z)((0,b.Z)({},t),{},{ref:e,icon:P}))};E.displayName="HighlightOutlined";var k=f.forwardRef(E),D=n(39935);var M=function(t){(0,h.Z)(x,t);var e,n,i=(e=x,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,i=(0,u.Z)(e);if(n){var o=(0,u.Z)(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return(0,l.Z)(this,t)});function x(){var t;(0,a.Z)(this,x);for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return t=i.call.apply(i,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{modalVisible:!1,molFileLoaded:!1,molFile:void 0,trimmedDataURL:void 0}),(0,d.Z)((0,c.Z)(t),"signCanvas",void 0),(0,d.Z)((0,c.Z)(t),"loadData",(0,r.Z)(o().mark((function e(){var n,i,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.props.value)){e.next=13;break}if(1!=(i=JSON.parse(n)).valid){e.next=10;break}if(!/^image\/png;base64/.test(i.base.type)){e.next=8;break}return e.next=7,D.Z.loadFileTxt(i.base.path);case 7:r=e.sent;case 8:e.next=11;break;case 10:r="new"==i.valid?i.body:void 0;case 11:console.log("file:",r),t.setState({trimmedDataURL:r});case 13:case"end":return e.stop()}}),e)})))),(0,d.Z)((0,c.Z)(t),"saveMolfile",(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.signCanvas.getTrimmedCanvas().toDataURL("image/png"),console.log("DataURL value:",n),t.triggerChange(n),t.setState({modalVisible:!1,trimmedDataURL:n});case 4:case"end":return e.stop()}}),e)})))),(0,d.Z)((0,c.Z)(t),"triggerChange",(function(e){var n=t.props.onChange;n&&n(JSON.stringify({valid:"new",body:e,suffix:"image/png;base64",fileName:"signature.png"}))})),(0,d.Z)((0,c.Z)(t),"showView",(0,r.Z)(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.signCanvas.clear(),t.signCanvas.fromDataURL(t.state.trimmedDataURL),t.setState({modalVisible:!0});case 3:case"end":return e.stop()}}),e)})))),(0,d.Z)((0,c.Z)(t),"onCancel",(function(){t.setState({modalVisible:!1})})),(0,d.Z)((0,c.Z)(t),"onClear",(function(){t.signCanvas.clear()})),t}return(0,s.Z)(x,[{key:"componentDidMount",value:function(){this.loadData()}},{key:"render",value:function(){var t=this,e=this.props,n=e.id,i=e.disabled,o=e.viewOrEdit,r=(e.value,this.state),a=(r.molFile,r.trimmedDataURL);return f.createElement("span",{id:n},a?f.createElement(p.Z,{width:90,src:a,preview:{src:a}}):"","edit"==o?f.createElement(v.Z,{onClick:this.showView},f.createElement(k,null),"编 辑"):"",f.createElement(m.Z,{closable:!1,visible:this.state.modalVisible,forceRender:!0,centered:!0,style:{maxWidth:"calc(100vw - 62px)",maxHeight:"calc(100vw - 50px)"},width:900,onCancel:function(){t.onCancel()},footer:i?[f.createElement(v.Z,{key:1,onClick:function(){t.onCancel()}},"取消")]:[f.createElement(v.Z,{key:1,onClick:function(){t.onClear()}},"清除"),f.createElement(_.Z,{key:2,placement:"top",title:"确定要取消本次编辑的数据吗?",onConfirm:this.onCancel,okText:"确定",cancelText:"取消"},f.createElement(v.Z,null,"取消")),f.createElement(v.Z,{key:3,onClick:function(){t.saveMolfile()},type:"primary"},"确定")],bodyStyle:{width:"900px"}},f.createElement(y.Z,{style:{height:"430px",border:"1px solid #00f",maxWidth:"860px",maxHeight:"calc(100vw - 80px)"}},f.createElement(g.Z,{key:1,span:24,style:{height:"400px"}},f.createElement(w(),{ref:function(e){t.signCanvas=e},penColor:"#000",canvasProps:{width:860,height:400,className:"sigCanvas"}})))))}}]),x}(f.PureComponent);(0,d.Z)(M,"defaultProps",{viewOrEdit:"view"})},58877:function(t,e,n){var i,o,r,a;t.exports=(i=n(45697),o=n(67294),r=n(21518),a=n(41400),function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),h=i(n(1)),l=n(2),u=i(l),d=i(n(3)),f=i(n(4)),p=function(t){function e(){var t,n,i;r(this,e);for(var s=arguments.length,c=Array(s),h=0;h<s;h++)c[h]=arguments[h];return n=i=a(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(c))),i._sigPad=null,i._excludeOurProps=function(){var t=i.props;return t.canvasProps,t.clearOnResize,o(t,["canvasProps","clearOnResize"])},i.getCanvas=function(){return i._canvas},i.getTrimmedCanvas=function(){var t=document.createElement("canvas");return t.width=i._canvas.width,t.height=i._canvas.height,t.getContext("2d").drawImage(i._canvas,0,0),(0,f.default)(t)},i.getSignaturePad=function(){return i._sigPad},i._checkClearOnResize=function(){i.props.clearOnResize&&i._resizeCanvas()},i._resizeCanvas=function(){var t=i.props.canvasProps||{},e=t.width,n=t.height;if(!e||!n){var o=i._canvas,r=Math.max(window.devicePixelRatio||1,1);e||(o.width=o.offsetWidth*r),n||(o.height=o.offsetHeight*r),o.getContext("2d").scale(r,r),i.clear()}},i.on=function(){return window.addEventListener("resize",i._checkClearOnResize),i._sigPad.on()},i.off=function(){return window.removeEventListener("resize",i._checkClearOnResize),i._sigPad.off()},i.clear=function(){return i._sigPad.clear()},i.isEmpty=function(){return i._sigPad.isEmpty()},i.fromDataURL=function(t,e){return i._sigPad.fromDataURL(t,e)},i.toDataURL=function(t,e){return i._sigPad.toDataURL(t,e)},i.fromData=function(t){return i._sigPad.fromData(t)},i.toData=function(){return i._sigPad.toData()},a(i,n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),c(e,[{key:"componentDidMount",value:function(){this._sigPad=new d.default(this._canvas,this._excludeOurProps()),this._resizeCanvas(),this.on()}},{key:"componentWillUnmount",value:function(){this.off()}},{key:"componentDidUpdate",value:function(){Object.assign(this._sigPad,this._excludeOurProps())}},{key:"render",value:function(){var t=this,e=this.props.canvasProps;return u.default.createElement("canvas",s({ref:function(e){t._canvas=e}},e))}}]),e}(l.Component);p.propTypes={velocityFilterWeight:h.default.number,minWidth:h.default.number,maxWidth:h.default.number,minDistance:h.default.number,dotSize:h.default.oneOfType([h.default.number,h.default.func]),penColor:h.default.string,throttle:h.default.number,onEnd:h.default.func,onBegin:h.default.func,canvasProps:h.default.object,clearOnResize:h.default.bool},p.defaultProps={clearOnResize:!0},e.default=p},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e){t.exports=r},function(t,e){t.exports=a}]))},41400:function(t){t.exports=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t,e,n,i){return function(t,e,n,i){return{red:i[4*(n*e+t)],green:i[4*(n*e+t)+1],blue:i[4*(n*e+t)+2],alpha:i[4*(n*e+t)+3]}}(t,e,n,i).alpha}function i(t,e,i,o){for(var r=t?1:-1,a=t?0:i-1;t?a<i:a>-1;a+=r)for(var s=0;s<e;s++)if(n(s,a,e,o))return a;return null}function o(t,e,i,o){for(var r=t?1:-1,a=t?0:e-1;t?a<e:a>-1;a+=r)for(var s=0;s<i;s++)if(n(a,s,e,o))return a;return null}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.getContext("2d"),n=t.width,r=t.height,a=e.getImageData(0,0,n,r).data,s=i(!0,n,r,a),c=i(!1,n,r,a),h=o(!0,n,r,a),l=o(!1,n,r,a)-h+1,u=c-s+1,d=e.getImageData(h,s,l,u);return t.width=l,t.height=u,e.clearRect(0,0,l,u),e.putImageData(d,0,0),t}}])},21518:function(t,e,n){"use strict";function i(t,e,n){this.x=t,this.y=e,this.time=n||(new Date).getTime()}function o(t,e,n,i){this.startPoint=t,this.control1=e,this.control2=n,this.endPoint=i}function r(t,e){var n=this,i=e||{};this.velocityFilterWeight=i.velocityFilterWeight||.7,this.minWidth=i.minWidth||.5,this.maxWidth=i.maxWidth||2.5,this.throttle="throttle"in i?i.throttle:16,this.minDistance="minDistance"in i?i.minDistance:5,this.throttle?this._strokeMoveUpdate=function(t,e,n){var i,o,r,a=null,s=0;n||(n={});var c=function(){s=!1===n.leading?0:Date.now(),a=null,r=t.apply(i,o),a||(i=o=null)};return function(){var h=Date.now();s||!1!==n.leading||(s=h);var l=e-(h-s);return i=this,o=arguments,l<=0||l>e?(a&&(clearTimeout(a),a=null),s=h,r=t.apply(i,o),a||(i=o=null)):a||!1===n.trailing||(a=setTimeout(c,l)),r}}(r.prototype._strokeUpdate,this.throttle):this._strokeMoveUpdate=r.prototype._strokeUpdate,this.dotSize=i.dotSize||function(){return(this.minWidth+this.maxWidth)/2},this.penColor=i.penColor||"black",this.backgroundColor=i.backgroundColor||"rgba(0,0,0,0)",this.onBegin=i.onBegin,this.onEnd=i.onEnd,this._canvas=t,this._ctx=t.getContext("2d"),this.clear(),this._handleMouseDown=function(t){1===t.which&&(n._mouseButtonDown=!0,n._strokeBegin(t))},this._handleMouseMove=function(t){n._mouseButtonDown&&n._strokeMoveUpdate(t)},this._handleMouseUp=function(t){1===t.which&&n._mouseButtonDown&&(n._mouseButtonDown=!1,n._strokeEnd(t))},this._handleTouchStart=function(t){if(1===t.targetTouches.length){var e=t.changedTouches[0];n._strokeBegin(e)}},this._handleTouchMove=function(t){t.preventDefault();var e=t.targetTouches[0];n._strokeMoveUpdate(e)},this._handleTouchEnd=function(t){t.target===n._canvas&&(t.preventDefault(),n._strokeEnd(t))},this.on()}n.r(e),i.prototype.velocityFrom=function(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):1},i.prototype.distanceTo=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},i.prototype.equals=function(t){return this.x===t.x&&this.y===t.y&&this.time===t.time},o.prototype.length=function(){for(var t=0,e=void 0,n=void 0,i=0;i<=10;i+=1){var o=i/10,r=this._point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this._point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(i>0){var s=r-e,c=a-n;t+=Math.sqrt(s*s+c*c)}e=r,n=a}return t},o.prototype._point=function(t,e,n,i,o){return e*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*i*(1-t)*t*t+o*t*t*t},r.prototype.clear=function(){var t=this._ctx,e=this._canvas;t.fillStyle=this.backgroundColor,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),this._data=[],this._reset(),this._isEmpty=!0},r.prototype.fromDataURL=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new Image,o=n.ratio||window.devicePixelRatio||1,r=n.width||this._canvas.width/o,a=n.height||this._canvas.height/o;this._reset(),i.src=t,i.onload=function(){e._ctx.drawImage(i,0,0,r,a)},this._isEmpty=!1},r.prototype.toDataURL=function(t){var e;if("image/svg+xml"===t)return this._toSVG();for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return(e=this._canvas).toDataURL.apply(e,[t].concat(i))},r.prototype.on=function(){this._handleMouseEvents(),this._handleTouchEvents()},r.prototype.off=function(){this._canvas.removeEventListener("mousedown",this._handleMouseDown),this._canvas.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._canvas.removeEventListener("touchstart",this._handleTouchStart),this._canvas.removeEventListener("touchmove",this._handleTouchMove),this._canvas.removeEventListener("touchend",this._handleTouchEnd)},r.prototype.isEmpty=function(){return this._isEmpty},r.prototype._strokeBegin=function(t){this._data.push([]),this._reset(),this._strokeUpdate(t),"function"==typeof this.onBegin&&this.onBegin(t)},r.prototype._strokeUpdate=function(t){var e=t.clientX,n=t.clientY,i=this._createPoint(e,n),o=this._data[this._data.length-1],r=o&&o[o.length-1],a=r&&i.distanceTo(r)<this.minDistance;if(!r||!a){var s=this._addPoint(i),c=s.curve,h=s.widths;c&&h&&this._drawCurve(c,h.start,h.end),this._data[this._data.length-1].push({x:i.x,y:i.y,time:i.time,color:this.penColor})}},r.prototype._strokeEnd=function(t){var e=this.points.length>2,n=this.points[0];if(!e&&n&&this._drawDot(n),n){var i=this._data[this._data.length-1],o=i[i.length-1];n.equals(o)||i.push({x:n.x,y:n.y,time:n.time,color:this.penColor})}"function"==typeof this.onEnd&&this.onEnd(t)},r.prototype._handleMouseEvents=function(){this._mouseButtonDown=!1,this._canvas.addEventListener("mousedown",this._handleMouseDown),this._canvas.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)},r.prototype._handleTouchEvents=function(){this._canvas.style.msTouchAction="none",this._canvas.style.touchAction="none",this._canvas.addEventListener("touchstart",this._handleTouchStart),this._canvas.addEventListener("touchmove",this._handleTouchMove),this._canvas.addEventListener("touchend",this._handleTouchEnd)},r.prototype._reset=function(){this.points=[],this._lastVelocity=0,this._lastWidth=(this.minWidth+this.maxWidth)/2,this._ctx.fillStyle=this.penColor},r.prototype._createPoint=function(t,e,n){var o=this._canvas.getBoundingClientRect();return new i(t-o.left,e-o.top,n||(new Date).getTime())},r.prototype._addPoint=function(t){var e=this.points;if(e.push(t),e.length>2){3===e.length&&e.unshift(e[0]);var n=this._calculateCurveControlPoints(e[0],e[1],e[2]).c2,i=this._calculateCurveControlPoints(e[1],e[2],e[3]).c1,r=new o(e[1],n,i,e[2]),a=this._calculateCurveWidths(r);return e.shift(),{curve:r,widths:a}}return{}},r.prototype._calculateCurveControlPoints=function(t,e,n){var o=t.x-e.x,r=t.y-e.y,a=e.x-n.x,s=e.y-n.y,c=(t.x+e.x)/2,h=(t.y+e.y)/2,l=(e.x+n.x)/2,u=(e.y+n.y)/2,d=Math.sqrt(o*o+r*r),f=Math.sqrt(a*a+s*s),p=f/(d+f),v=l+(c-l)*p,m=u+(h-u)*p,_=e.x-v,y=e.y-m;return{c1:new i(c+_,h+y),c2:new i(l+_,u+y)}},r.prototype._calculateCurveWidths=function(t){var e=t.startPoint,n=t.endPoint,i={start:null,end:null},o=this.velocityFilterWeight*n.velocityFrom(e)+(1-this.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(o);return i.start=this._lastWidth,i.end=r,this._lastVelocity=o,this._lastWidth=r,i},r.prototype._strokeWidth=function(t){return Math.max(this.maxWidth/(t+1),this.minWidth)},r.prototype._drawPoint=function(t,e,n){var i=this._ctx;i.moveTo(t,e),i.arc(t,e,n,0,2*Math.PI,!1),this._isEmpty=!1},r.prototype._drawCurve=function(t,e,n){var i=this._ctx,o=n-e,r=Math.floor(t.length());i.beginPath();for(var a=0;a<r;a+=1){var s=a/r,c=s*s,h=c*s,l=1-s,u=l*l,d=u*l,f=d*t.startPoint.x;f+=3*u*s*t.control1.x,f+=3*l*c*t.control2.x,f+=h*t.endPoint.x;var p=d*t.startPoint.y;p+=3*u*s*t.control1.y,p+=3*l*c*t.control2.y,p+=h*t.endPoint.y;var v=e+h*o;this._drawPoint(f,p,v)}i.closePath(),i.fill()},r.prototype._drawDot=function(t){var e=this._ctx,n="function"==typeof this.dotSize?this.dotSize():this.dotSize;e.beginPath(),this._drawPoint(t.x,t.y,n),e.closePath(),e.fill()},r.prototype._fromData=function(t,e,n){for(var o=0;o<t.length;o+=1){var r=t[o];if(r.length>1)for(var a=0;a<r.length;a+=1){var s=r[a],c=new i(s.x,s.y,s.time),h=s.color;if(0===a)this.penColor=h,this._reset(),this._addPoint(c);else if(a!==r.length-1){var l=this._addPoint(c),u=l.curve,d=l.widths;u&&d&&e(u,d,h)}}else this._reset(),n(r[0])}},r.prototype._toSVG=function(){var t=this,e=this._data,n=this._canvas,i=Math.max(window.devicePixelRatio||1,1),o=n.width/i,r=n.height/i,a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttributeNS(null,"width",n.width),a.setAttributeNS(null,"height",n.height),this._fromData(e,(function(t,e,n){var i=document.createElement("path");if(!(isNaN(t.control1.x)||isNaN(t.control1.y)||isNaN(t.control2.x)||isNaN(t.control2.y))){var o="M "+t.startPoint.x.toFixed(3)+","+t.startPoint.y.toFixed(3)+" C "+t.control1.x.toFixed(3)+","+t.control1.y.toFixed(3)+" "+t.control2.x.toFixed(3)+","+t.control2.y.toFixed(3)+" "+t.endPoint.x.toFixed(3)+","+t.endPoint.y.toFixed(3);i.setAttribute("d",o),i.setAttribute("stroke-width",(2.25*e.end).toFixed(3)),i.setAttribute("stroke",n),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","round"),a.appendChild(i)}}),(function(e){var n=document.createElement("circle"),i="function"==typeof t.dotSize?t.dotSize():t.dotSize;n.setAttribute("r",i),n.setAttribute("cx",e.x),n.setAttribute("cy",e.y),n.setAttribute("fill",e.color),a.appendChild(n)}));var s='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 '+o+" "+r+'" width="'+o+'" height="'+r+'">',c=a.innerHTML;if(void 0===c){var h=document.createElement("dummy"),l=a.childNodes;h.innerHTML="";for(var u=0;u<l.length;u+=1)h.appendChild(l[u].cloneNode(!0));c=h.innerHTML}return"data:image/svg+xml;base64,"+btoa(s+c+"</svg>")},r.prototype.fromData=function(t){var e=this;this.clear(),this._fromData(t,(function(t,n){return e._drawCurve(t,n.start,n.end)}),(function(t){return e._drawDot(t)})),this._data=t},r.prototype.toData=function(){return this._data},e.default=r}}]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Signature Pad v2.3.2
|
|
3
|
+
* https://github.com/szimek/signature_pad
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2017 Szymon Nowak
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
*
|
|
8
|
+
* The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:
|
|
9
|
+
* http://corner.squareup.com/2012/07/smoother-signatures.html
|
|
10
|
+
*
|
|
11
|
+
* Implementation of interpolation using cubic Bézier curves is taken from:
|
|
12
|
+
* http://benknowscode.wordpress.com/2012/09/14/path-interpolation-using-cubic-bezier-and-control-point-estimation-in-javascript
|
|
13
|
+
*
|
|
14
|
+
* Algorithm for approximated length of a Bézier curve is taken from:
|
|
15
|
+
* http://www.lemoda.net/maths/bezier-length/index.html
|
|
16
|
+
*
|
|
17
|
+
*/
|
package/package.json
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aldehyde",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": "cosmicparticle",
|
|
5
|
+
"main": "dist/aldehyde.js",
|
|
6
|
+
"files": ["dist/*","src/*","*.json", "*.js"],
|
|
7
|
+
"homepage": "./",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@ant-design/charts": "^1.3.5",
|
|
10
|
+
"@ant-design/icons": "^4.6.2",
|
|
11
|
+
"@antv/g6": "^3.0.5",
|
|
12
|
+
"@tinymce/tinymce-react": "^3.12.2",
|
|
13
|
+
"add": "^2.0.6",
|
|
14
|
+
"antd": "^4.19.5",
|
|
15
|
+
"array-move": "^4.0.0",
|
|
16
|
+
"axios": "^0.18.0",
|
|
17
|
+
"bfj": "^6.1.1",
|
|
18
|
+
"browserslist": "^4.6.2",
|
|
19
|
+
"caniuse-lite": "^1.0.30001299",
|
|
20
|
+
"chalk": "^4.0.0",
|
|
21
|
+
"clsx": "^1.1.1",
|
|
22
|
+
"compute-scroll-into-view": "^1.0.17",
|
|
23
|
+
"core-js": "^3.21.1",
|
|
24
|
+
"crypto-js": "^4.1.1",
|
|
25
|
+
"dayjs": "^1.8.30",
|
|
26
|
+
"dotenv": "^6.0.0",
|
|
27
|
+
"dotenv-expand": "^4.2.0",
|
|
28
|
+
"draft-js": "^0.11.7",
|
|
29
|
+
"draftjs-to-html": "^0.9.1",
|
|
30
|
+
"echarts": "^5.2.2",
|
|
31
|
+
"echarts-for-react": "^2.0.15-beta.0",
|
|
32
|
+
"echarts-liquidfill": "^2.0.5",
|
|
33
|
+
"express": "^4.17.1",
|
|
34
|
+
"fs-extra": "^7.0.0",
|
|
35
|
+
"griffith": "^1.10.0",
|
|
36
|
+
"http-proxy-middleware": "^2.0.1",
|
|
37
|
+
"identity-obj-proxy": "^3.0.0",
|
|
38
|
+
"immutability-helper": "^3.0.0",
|
|
39
|
+
"jquery": "^3.1.1",
|
|
40
|
+
"jsencrypt": "^3.2.1",
|
|
41
|
+
"jsonp": "^0.2.1",
|
|
42
|
+
"jsonschema": "^1.4.0",
|
|
43
|
+
"ketcher-core": "1.3.0",
|
|
44
|
+
"ketcher-react": "2.4.2",
|
|
45
|
+
"leaflet": "^1.6.0",
|
|
46
|
+
"less": "^2.7.3",
|
|
47
|
+
"loadable-components": "^2.2.3",
|
|
48
|
+
"lodash": "^4.17.21",
|
|
49
|
+
"miew": "^0.9.0",
|
|
50
|
+
"moment": "^2.22.2",
|
|
51
|
+
"picomatch": "^2.3.1",
|
|
52
|
+
"process": "^0.11.10",
|
|
53
|
+
"prop-types": "^15.8.1",
|
|
54
|
+
"react": "^17.0.2",
|
|
55
|
+
"react-app-polyfill": "^0.1.3",
|
|
56
|
+
"react-color": "^2.19.3",
|
|
57
|
+
"react-copy-to-clipboard": "^5.0.1",
|
|
58
|
+
"react-custom-scrollbars": "^4.2.1",
|
|
59
|
+
"react-dev-utils": "^6.1.1",
|
|
60
|
+
"react-dnd": "^7.4.5",
|
|
61
|
+
"react-dnd-html5-backend": "^7.4.4",
|
|
62
|
+
"react-document-title": "^2.0.3",
|
|
63
|
+
"react-dom": "17.0.0",
|
|
64
|
+
"react-draft-wysiwyg": "^1.14.7",
|
|
65
|
+
"react-error-overlay": "^6.0.10",
|
|
66
|
+
"react-file-viewer": "^1.2.1",
|
|
67
|
+
"react-highlight-words": "^0.16.0",
|
|
68
|
+
"react-load-script": "^0.0.6",
|
|
69
|
+
"react-loadable": "^5.5.0",
|
|
70
|
+
"react-router-dom": "^4.3.1",
|
|
71
|
+
"react-signature-canvas": "^1.0.5",
|
|
72
|
+
"react-sortable-hoc": "^2.0.0",
|
|
73
|
+
"react-virtualized": "^9.22.3",
|
|
74
|
+
"reconnecting-websocket": "^4.4.0",
|
|
75
|
+
"redux": "^4.0.1",
|
|
76
|
+
"redux-devtools-extension": "^2.13.5",
|
|
77
|
+
"reqwest": "^2.0.5",
|
|
78
|
+
"resolve": "^1.8.1",
|
|
79
|
+
"sass-loader": "^7.1.0",
|
|
80
|
+
"scroll-into-view-if-needed": "^2.2.28",
|
|
81
|
+
"superagent": "^4.0.0",
|
|
82
|
+
"superagent-jsonp": "^0.2.1",
|
|
83
|
+
"three": "^0.134.0",
|
|
84
|
+
"typescript": "^4.5.4",
|
|
85
|
+
"url": "^0.11.0",
|
|
86
|
+
"url-loader": "^4.1.1",
|
|
87
|
+
"use-resize-observer": "^7.0.0",
|
|
88
|
+
"validate": "^5.2.0",
|
|
89
|
+
"webpack-node-externals": "^3.0.0",
|
|
90
|
+
"yargs": "^13.2.4",
|
|
91
|
+
"yarn": "^1.22.17"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "cross-env NODE_ENV=production webpack --config config/webpack.prod.js",
|
|
95
|
+
"dev": "cross-env NODE_ENV=development webpack server --config config/webpack.dev.js",
|
|
96
|
+
"package": "cross-env NODE_ENV=development webpack --config config/webpack.package.js"
|
|
97
|
+
},
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=14"
|
|
100
|
+
},
|
|
101
|
+
"eslintConfig": {
|
|
102
|
+
"extends": "react-app"
|
|
103
|
+
},
|
|
104
|
+
"browserslist": [
|
|
105
|
+
">0.2%",
|
|
106
|
+
"not dead",
|
|
107
|
+
"not op_mini all",
|
|
108
|
+
"ie >= 10"
|
|
109
|
+
],
|
|
110
|
+
"resolutions": {
|
|
111
|
+
"browserslist": "^4.6.2",
|
|
112
|
+
"caniuse-lite": "^1.0.30000974"
|
|
113
|
+
},
|
|
114
|
+
"babel": {
|
|
115
|
+
"presets": [
|
|
116
|
+
"react-app",
|
|
117
|
+
"@babel/preset-react",
|
|
118
|
+
"@babel/preset-env"
|
|
119
|
+
],
|
|
120
|
+
"plugins": [
|
|
121
|
+
"@babel/plugin-syntax-dynamic-import",
|
|
122
|
+
"@loadable/babel-plugin"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"@babel/core": "^7.16.7",
|
|
127
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
128
|
+
"@babel/preset-env": "^7.16.8",
|
|
129
|
+
"@babel/preset-react": "^7.13.13",
|
|
130
|
+
"@loadable/babel-plugin": "^5.13.2",
|
|
131
|
+
"@loadable/component": "^5.15.0",
|
|
132
|
+
"@loadable/server": "^5.15.0",
|
|
133
|
+
"@loadable/webpack-plugin": "^5.15.0",
|
|
134
|
+
"@svgr/webpack": "2.4.1",
|
|
135
|
+
"@types/webpack": "^5.28.0",
|
|
136
|
+
"autoprefixer": "^10.4.2",
|
|
137
|
+
"babel-core": "^7.0.0-bridge.0",
|
|
138
|
+
"babel-eslint": "^9.0.0",
|
|
139
|
+
"babel-jest": "^23.6.0",
|
|
140
|
+
"babel-loader": "^8.2.3",
|
|
141
|
+
"babel-plugin-import": "^1.11.0",
|
|
142
|
+
"babel-plugin-named-asset-import": "^0.2.3",
|
|
143
|
+
"babel-preset-react-app": "^6.1.0",
|
|
144
|
+
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
145
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
146
|
+
"compression-webpack-plugin": "^9.2.0",
|
|
147
|
+
"cross-env": "^7.0.3",
|
|
148
|
+
"css-loader": "^6.5.1",
|
|
149
|
+
"eslint": "^5.6.0",
|
|
150
|
+
"eslint-config-react-app": "^3.0.5",
|
|
151
|
+
"eslint-loader": "^2.1.1",
|
|
152
|
+
"eslint-plugin-flowtype": "^2.50.1",
|
|
153
|
+
"eslint-plugin-import": "^2.14.0",
|
|
154
|
+
"eslint-plugin-jsx-a11y": "^6.1.2",
|
|
155
|
+
"eslint-plugin-react": "^7.11.1",
|
|
156
|
+
"file-loader": "^6.2.0",
|
|
157
|
+
"fork-ts-checker-webpack-plugin": "^6.5.0",
|
|
158
|
+
"fork-ts-checker-webpack-plugin-alt": "^0.4.14",
|
|
159
|
+
"generate-asset-webpack-plugin": "^0.3.0",
|
|
160
|
+
"html-webpack-plugin": "^5.5.0",
|
|
161
|
+
"jest": "^23.6.0",
|
|
162
|
+
"jest-pnp-resolver": "^1.0.1",
|
|
163
|
+
"jest-resolve": "^23.6.0",
|
|
164
|
+
"less-loader": "^10.2.0",
|
|
165
|
+
"mini-css-extract-plugin": "^2.4.7",
|
|
166
|
+
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
|
167
|
+
"pnp-webpack-plugin": "^1.7.0",
|
|
168
|
+
"postcss-loader": "^6.2.1",
|
|
169
|
+
"postcss-scss": "^3.0.5",
|
|
170
|
+
"style-loader": "^3.3.1",
|
|
171
|
+
"ts-loader": "^9.2.6",
|
|
172
|
+
"webpack": "^5.65.0",
|
|
173
|
+
"webpack-cli": "^4.9.1",
|
|
174
|
+
"webpack-dev-middleware": "^5.3.0",
|
|
175
|
+
"webpack-dev-server": "^4.7.3",
|
|
176
|
+
"webpack-manifest-plugin": "^4.0.2",
|
|
177
|
+
"webpack-merge": "^5.8.0",
|
|
178
|
+
"workbox-webpack-plugin": "^6.4.2"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Chart10000 from './Chart10000'
|
|
3
|
+
import LineChart from './Max2DimLineChart'
|
|
4
|
+
export default class Chart extends React.Component {
|
|
5
|
+
|
|
6
|
+
state = {}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async componentWillReceiveProps(nextProps) {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getChart = () => {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
let {data, statView, ltmpl} = this.props;
|
|
20
|
+
return (<div>
|
|
21
|
+
|
|
22
|
+
{ statView.refL2ChartType == '10000' ||statView.refL2ChartType=='折线图' ?
|
|
23
|
+
<LineChart data={data} statView={statView} ltmpl={ltmpl}> </LineChart>
|
|
24
|
+
:
|
|
25
|
+
<div>没有找到匹配的图表</div>
|
|
26
|
+
}
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import LineChart from './LineChart-sub'
|
|
4
|
+
import {Col, Row} from "antd";
|
|
5
|
+
import chartUtils from "./ChartUtils";
|
|
6
|
+
|
|
7
|
+
export default class Chart extends React.Component {
|
|
8
|
+
|
|
9
|
+
state = {
|
|
10
|
+
dataArray: [],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// data = [
|
|
14
|
+
// {xField: '1800', 收率: 3},
|
|
15
|
+
// {xField: '1992', 收率: 4},
|
|
16
|
+
// {xField: '1993', 收率: 3.5},
|
|
17
|
+
// {xField: 'X1994', 收率: 50},
|
|
18
|
+
// {xField: '1995', 收率: 4.9},
|
|
19
|
+
// {xField: '1999', 收率: 60},
|
|
20
|
+
// {xField: '1997', 收率: 7},
|
|
21
|
+
// {xField: '1996', 收率: 7},
|
|
22
|
+
// {xField: '1998', 收率: 190},
|
|
23
|
+
// {xField: '1011', 收率: 1300},
|
|
24
|
+
// {xField: '1997', 收率: 1200},
|
|
25
|
+
// ];
|
|
26
|
+
|
|
27
|
+
async componentWillReceiveProps(nextProps) {
|
|
28
|
+
let dataArray=[];
|
|
29
|
+
let {data,statView,ltmpl}=nextProps;
|
|
30
|
+
console.log("data:",data);
|
|
31
|
+
console.log("statView:",statView);
|
|
32
|
+
console.log("ltmpl:",ltmpl);
|
|
33
|
+
|
|
34
|
+
let data_=chartUtils.transValueFloat(ltmpl,data);
|
|
35
|
+
|
|
36
|
+
let obj1 = {};
|
|
37
|
+
obj1.data = data_;
|
|
38
|
+
obj1.config = {xAxisTitle: '主变量', yAxisTitle: '收率(%)',xField:'特征值',yField:'收率'};
|
|
39
|
+
dataArray.push(obj1);
|
|
40
|
+
let obj2 = {};
|
|
41
|
+
obj2.data = data_;
|
|
42
|
+
obj2.config = {xAxisTitle: '主变量', yAxisTitle: '转换率(%)',xField:'特征值',yField:'转换率'};
|
|
43
|
+
dataArray.push(obj2);
|
|
44
|
+
|
|
45
|
+
let obj3 = {};
|
|
46
|
+
obj3.data = data_;
|
|
47
|
+
obj3.config = {xAxisTitle: '主变量', yAxisTitle: '纯度(%)',xField:'特征值',yField:'纯度'};
|
|
48
|
+
dataArray.push(obj3);
|
|
49
|
+
|
|
50
|
+
let obj4 = {};
|
|
51
|
+
obj4.data = data_;
|
|
52
|
+
obj4.config = {xAxisTitle: '主变量', yAxisTitle: '含量(%)',xField:'特征值',yField:'含量'};
|
|
53
|
+
dataArray.push(obj4);
|
|
54
|
+
|
|
55
|
+
this.setState({
|
|
56
|
+
dataArray
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render() {
|
|
61
|
+
let {dataArray} = this.state;
|
|
62
|
+
|
|
63
|
+
return <div>
|
|
64
|
+
<Row style={{padding: '8px 0'}} gutter={[32, {xs: 8, sm: 16, md: 24, lg: 32}]}>
|
|
65
|
+
|
|
66
|
+
{dataArray.map(function (val) {
|
|
67
|
+
return <Col span={12} key={val.config.yAxisTitle}>
|
|
68
|
+
<LineChart data={val.data} config={val.config}/>
|
|
69
|
+
</Col>
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
{/*<Col span={12}>*/}
|
|
74
|
+
{/* <LineChart data={data} config={}/>*/}
|
|
75
|
+
{/*</Col>*/}
|
|
76
|
+
{/*<Col span={12}>*/}
|
|
77
|
+
{/* <LineChart data={data} config={{xAxisTitle: '主变量', yAxisTitle: '收率(%)'}}/>*/}
|
|
78
|
+
{/*</Col>*/}
|
|
79
|
+
{/*<Col span={12}>*/}
|
|
80
|
+
{/* <LineChart data={data} config={{xAxisTitle: '主变量', yAxisTitle: '收率(%)'}}/>*/}
|
|
81
|
+
{/*</Col>*/}
|
|
82
|
+
{/*<Col span={12}>*/}
|
|
83
|
+
{/* <LineChart data={data} config={{xAxisTitle: '主变量', yAxisTitle: '收率(%)'}}/>*/}
|
|
84
|
+
{/*</Col>*/}
|
|
85
|
+
</Row>
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LineChart from './LineChart-sub';
|
|
3
|
+
import ColumnChart from './ColumnChart-sub';
|
|
4
|
+
import PieChart from './PieChart-sub';
|
|
5
|
+
import {Col, Divider, Row} from "antd";
|
|
6
|
+
import chartUtils from "./ChartUtils";
|
|
7
|
+
|
|
8
|
+
export default class Max2DimLineChart extends React.Component {
|
|
9
|
+
|
|
10
|
+
state = {
|
|
11
|
+
dataArray: [],
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async componentWillMount() {
|
|
15
|
+
|
|
16
|
+
let {data, statView, ltmpl} = this.props;
|
|
17
|
+
console.log("data:", data);
|
|
18
|
+
console.log("statView:", statView);
|
|
19
|
+
console.log("ltmpl:", ltmpl);
|
|
20
|
+
|
|
21
|
+
this.init(data, statView, ltmpl);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
componentWillReceiveProps(nextprops) {
|
|
25
|
+
let {data, statView, ltmpl} = nextprops;
|
|
26
|
+
this.init(data, statView, ltmpl);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
init = (data, statView, ltmpl) => {
|
|
30
|
+
let data_;
|
|
31
|
+
|
|
32
|
+
let firstDim = undefined, secondDim = undefined, dimensions = [], facts = [];
|
|
33
|
+
ltmpl.columns.forEach((col) => {
|
|
34
|
+
if ("fact" == col.colClass) {
|
|
35
|
+
facts.push(col);
|
|
36
|
+
} else if ("dimension" == col.colClass) {
|
|
37
|
+
dimensions.push(col);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
let lineData;
|
|
41
|
+
if (dimensions.length > 1) {
|
|
42
|
+
firstDim = dimensions[0];
|
|
43
|
+
secondDim = dimensions[1];
|
|
44
|
+
data_ = chartUtils.transValueFloatGroupByDim(ltmpl, data, firstDim);
|
|
45
|
+
lineData = new Map();
|
|
46
|
+
for (let [key, data1] of data_) {
|
|
47
|
+
lineData.set(key, []);
|
|
48
|
+
facts.forEach((fact) => {
|
|
49
|
+
let obj1 = {};
|
|
50
|
+
obj1.data = data1;
|
|
51
|
+
obj1.config = {
|
|
52
|
+
xAxisTitle: key,
|
|
53
|
+
yAxisTitle: fact.title,
|
|
54
|
+
xField: secondDim.title,
|
|
55
|
+
yField: fact.title
|
|
56
|
+
};
|
|
57
|
+
lineData.get(key).push(obj1);
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
} else if (dimensions.length == 1) {
|
|
61
|
+
lineData = [];
|
|
62
|
+
secondDim = dimensions[0];
|
|
63
|
+
data_ = chartUtils.transValueFloat(ltmpl, data.list);
|
|
64
|
+
facts.forEach((fact) => {
|
|
65
|
+
let obj1 = {};
|
|
66
|
+
obj1.data = data_;
|
|
67
|
+
obj1.config = {
|
|
68
|
+
xAxisTitle: secondDim.title,
|
|
69
|
+
yAxisTitle: fact.title,
|
|
70
|
+
xField: secondDim.title,
|
|
71
|
+
yField: fact.title
|
|
72
|
+
};
|
|
73
|
+
lineData.push(obj1);
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.setState({
|
|
78
|
+
lineData
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get2DimChart = (lineData) => {
|
|
83
|
+
let refL2ChartType = this.props.statView.refL2ChartType;
|
|
84
|
+
let list = [];
|
|
85
|
+
let that=this;
|
|
86
|
+
for (let [key, obj] of lineData) {
|
|
87
|
+
obj.map(function (val) {
|
|
88
|
+
list.push(<Col span={12} key={val.config.yAxisTitle}>
|
|
89
|
+
{ that.getChart1(refL2ChartType,val)}
|
|
90
|
+
{/*<PieChart groupName={key} data={val.data} config={val.config}/>*/}
|
|
91
|
+
<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>
|
|
92
|
+
</Col>)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
return list;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getChart1 = (refL2ChartType, val) => {
|
|
99
|
+
return refL2ChartType == '折线图' ?
|
|
100
|
+
<LineChart data={val.data} config={val.config}/>
|
|
101
|
+
: refL2ChartType == '柱图' ?
|
|
102
|
+
<ColumnChart data={val.data} config={val.config}/>
|
|
103
|
+
:
|
|
104
|
+
refL2ChartType == '饼图' ?
|
|
105
|
+
<PieChart data={val.data} config={val.config}/> :
|
|
106
|
+
<div>暂不支持的图形</div>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
let {lineData} = this.state;
|
|
111
|
+
let refL2ChartType = this.props.refL2ChartType;;
|
|
112
|
+
let that=this;
|
|
113
|
+
return <div>
|
|
114
|
+
<Row style={{padding: '8px 0'}} gutter={[32, {xs: 8, sm: 16, md: 24, lg: 32}]}>
|
|
115
|
+
{lineData instanceof Map ?
|
|
116
|
+
that.get2DimChart(lineData)
|
|
117
|
+
: lineData ? lineData.map(function (val) {
|
|
118
|
+
return <Col span={12} key={val.config.yAxisTitle}>
|
|
119
|
+
{that.getChart1(refL2ChartType,val)}
|
|
120
|
+
<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>
|
|
121
|
+
</Col>
|
|
122
|
+
}) : ""
|
|
123
|
+
}
|
|
124
|
+
</Row>
|
|
125
|
+
</div>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Pie } from '@ant-design/charts';
|
|
3
|
+
|
|
4
|
+
const DemoPie: React.FunctionComponent = () => {
|
|
5
|
+
var data = [
|
|
6
|
+
{
|
|
7
|
+
type: '分类一',
|
|
8
|
+
value: 27,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
type: '分类二',
|
|
12
|
+
value: 25,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: '分类三',
|
|
16
|
+
value: 18,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: '分类四',
|
|
20
|
+
value: 15,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: '分类五',
|
|
24
|
+
value: 10,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: '其他',
|
|
28
|
+
value: 5,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
var config = {
|
|
32
|
+
appendPadding: 10,
|
|
33
|
+
data: data,
|
|
34
|
+
angleField: 'value',
|
|
35
|
+
colorField: 'type',
|
|
36
|
+
radius: 0.5,
|
|
37
|
+
label: {
|
|
38
|
+
type: 'inner',
|
|
39
|
+
offset: '-30%',
|
|
40
|
+
content: function content(_ref) {
|
|
41
|
+
var percent = _ref.percent;
|
|
42
|
+
return ''.concat(percent * 100, '%');
|
|
43
|
+
},
|
|
44
|
+
style: {
|
|
45
|
+
fontSize: 14,
|
|
46
|
+
textAlign: 'center',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
interactions: [{ type: 'element-active' }],
|
|
50
|
+
};
|
|
51
|
+
return <Pie {...config} />;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default DemoPie;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Pie} from '@ant-design/charts';
|
|
3
|
+
|
|
4
|
+
export default class PieChart extends React.Component {
|
|
5
|
+
render() {
|
|
6
|
+
let { data,key} = this.props;
|
|
7
|
+
// let data = [
|
|
8
|
+
// {
|
|
9
|
+
// type: '分类一',
|
|
10
|
+
// value: 27,
|
|
11
|
+
// },
|
|
12
|
+
// {
|
|
13
|
+
// type: '分类二',
|
|
14
|
+
// value: 25,
|
|
15
|
+
// },
|
|
16
|
+
// {
|
|
17
|
+
// type: '分类三',
|
|
18
|
+
// value: 18,
|
|
19
|
+
// },
|
|
20
|
+
// {
|
|
21
|
+
// type: '分类四',
|
|
22
|
+
// value: 15,
|
|
23
|
+
// },
|
|
24
|
+
// {
|
|
25
|
+
// type: '分类五',
|
|
26
|
+
// value: 10,
|
|
27
|
+
// },
|
|
28
|
+
// {
|
|
29
|
+
// type: '其他',
|
|
30
|
+
// value: 5,
|
|
31
|
+
// },
|
|
32
|
+
// ];
|
|
33
|
+
|
|
34
|
+
var config = {
|
|
35
|
+
appendPadding: 10,
|
|
36
|
+
data: data,
|
|
37
|
+
angleField: 'value',
|
|
38
|
+
colorField: 'type',
|
|
39
|
+
radius: 0.6,
|
|
40
|
+
label: {
|
|
41
|
+
type: 'inner',
|
|
42
|
+
offset: '-30%',
|
|
43
|
+
content: function content(_ref) {
|
|
44
|
+
var percent = _ref.percent;
|
|
45
|
+
return ''.concat((percent * 100).toFixed(2), '%');
|
|
46
|
+
},
|
|
47
|
+
style: {
|
|
48
|
+
fontSize: 14,
|
|
49
|
+
textAlign: 'center',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
interactions: [{type: 'element-active'}],
|
|
53
|
+
};
|
|
54
|
+
return <Pie key={key} {...config} />;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {DtmplData, LtmplConfig} from "../../tmpl/interface";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
transValueFloat(ltmpl:LtmplConfig,data:DtmplData[]){
|
|
7
|
+
let data_=[];
|
|
8
|
+
let cols= ltmpl.columns;
|
|
9
|
+
if(data){
|
|
10
|
+
data.map(function (val) {
|
|
11
|
+
let value={};
|
|
12
|
+
Object.keys(val.fieldMap).forEach((key)=>{
|
|
13
|
+
cols.forEach((col)=>{
|
|
14
|
+
if(col.id==key){
|
|
15
|
+
let v1=parseFloat(val.fieldMap[key]);
|
|
16
|
+
value[col.title]=isNaN(v1)?val.fieldMap[key]:v1;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
data_.push(value);
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
console.log("chartData:",data_);
|
|
25
|
+
return data_;
|
|
26
|
+
},
|
|
27
|
+
transValueFloatGroupByDim(ltmpl:LtmplConfig,data:DtmplData[],dimension){
|
|
28
|
+
|
|
29
|
+
let dimKey=dimension.id;
|
|
30
|
+
//先分类
|
|
31
|
+
let map1=new Map();
|
|
32
|
+
if(data){
|
|
33
|
+
data.map(function (val) {
|
|
34
|
+
let v1=val.fieldMap[dimKey];
|
|
35
|
+
if(v1){
|
|
36
|
+
if(!map1.has(v1)){
|
|
37
|
+
map1.set(v1,[]);
|
|
38
|
+
}
|
|
39
|
+
map1.get(v1).push(val);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
let map2=new Map();
|
|
44
|
+
//再转换
|
|
45
|
+
for(let [key,value] of map1){
|
|
46
|
+
map2.set(key,this.transValueFloat(ltmpl,value));
|
|
47
|
+
}
|
|
48
|
+
return map2;
|
|
49
|
+
},
|
|
50
|
+
}
|