aldehyde 0.2.99 → 0.2.100
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/dist/bundle.021f784b1c84781461d2.js +1 -0
- package/dist/bundle.03c542ca824e205fe307.js +2 -0
- package/dist/bundle.03c542ca824e205fe307.js.LICENSE.txt +27 -0
- package/dist/bundle.03c542ca824e205fe307.js.gz +0 -0
- package/dist/bundle.15cb660c34802f6cccf5.js +1 -0
- package/dist/bundle.15cb660c34802f6cccf5.js.gz +0 -0
- package/dist/bundle.2f9c2d692fe0277a37aa.js +2 -0
- package/dist/bundle.2f9c2d692fe0277a37aa.js.LICENSE.txt +1 -0
- package/dist/bundle.2f9c2d692fe0277a37aa.js.gz +0 -0
- package/dist/bundle.320c02187dd135005102.js +2 -0
- package/dist/bundle.320c02187dd135005102.js.LICENSE.txt +6 -0
- package/dist/bundle.320c02187dd135005102.js.gz +0 -0
- package/dist/bundle.35a4af7e2d0da1942d79.js +10 -0
- package/dist/bundle.35a4af7e2d0da1942d79.js.gz +0 -0
- package/dist/bundle.3f9072b1629cdb384b46.js +2 -0
- package/dist/bundle.3f9072b1629cdb384b46.js.LICENSE.txt +5 -0
- package/dist/bundle.3f9072b1629cdb384b46.js.gz +0 -0
- package/dist/bundle.46e2295b5360a725bcd5.js +1 -0
- package/dist/bundle.46e2295b5360a725bcd5.js.gz +0 -0
- package/dist/bundle.4c3c988531c3cf360b87.js +1 -0
- package/dist/bundle.4c3c988531c3cf360b87.js.gz +0 -0
- package/dist/bundle.4df89546fd2e9d665dfb.js +2 -0
- package/dist/bundle.4df89546fd2e9d665dfb.js.LICENSE.txt +5 -0
- package/dist/bundle.4df89546fd2e9d665dfb.js.gz +0 -0
- package/dist/bundle.5a9afb9ee6cceca506fa.js +5 -0
- package/dist/bundle.5a9afb9ee6cceca506fa.js.LICENSE.txt +10 -0
- package/dist/bundle.5a9afb9ee6cceca506fa.js.gz +0 -0
- package/dist/bundle.5e6cccd06b34a0e3a2ff.js +1 -0
- package/dist/bundle.5e6cccd06b34a0e3a2ff.js.gz +0 -0
- package/dist/bundle.62c62e6aaa7f3c20761e.js +2 -0
- package/dist/bundle.62c62e6aaa7f3c20761e.js.LICENSE.txt +17 -0
- package/dist/bundle.62c62e6aaa7f3c20761e.js.gz +0 -0
- package/dist/bundle.6fd2dadd29083268c5a6.js +2 -0
- package/dist/bundle.6fd2dadd29083268c5a6.js.LICENSE.txt +17 -0
- package/dist/bundle.6fd2dadd29083268c5a6.js.gz +0 -0
- package/dist/bundle.8241d8d05e35988dd480.js +1 -0
- package/dist/bundle.8241d8d05e35988dd480.js.gz +0 -0
- package/dist/bundle.829683dfa6a98c78c58e.js +2 -0
- package/dist/bundle.829683dfa6a98c78c58e.js.LICENSE.txt +14 -0
- package/dist/bundle.829683dfa6a98c78c58e.js.gz +0 -0
- package/dist/bundle.840e28984e710e12f467.js +75 -0
- package/dist/bundle.840e28984e710e12f467.js.LICENSE.txt +8 -0
- package/dist/bundle.840e28984e710e12f467.js.gz +0 -0
- package/dist/bundle.85ce5221fe6ab1d91f7d.js +2 -0
- package/dist/bundle.85ce5221fe6ab1d91f7d.js.LICENSE.txt +1 -0
- package/dist/bundle.85ce5221fe6ab1d91f7d.js.gz +0 -0
- package/dist/bundle.9cfd99a04bde7f781c30.js +1 -0
- package/dist/bundle.9cfd99a04bde7f781c30.js.gz +0 -0
- package/dist/bundle.a049dc8814bbbf59160f.js +1 -0
- package/dist/bundle.a049dc8814bbbf59160f.js.gz +0 -0
- package/dist/bundle.a94f7811fac19aa9d6a3.js +2 -0
- package/dist/bundle.a94f7811fac19aa9d6a3.js.LICENSE.txt +1 -0
- package/dist/bundle.a94f7811fac19aa9d6a3.js.gz +0 -0
- package/dist/bundle.abdde6e82ee9f60d1bf3.js +2 -0
- package/dist/bundle.abdde6e82ee9f60d1bf3.js.LICENSE.txt +30 -0
- package/dist/bundle.abdde6e82ee9f60d1bf3.js.gz +0 -0
- package/dist/bundle.b207a66d5902f39d0c5a.js +1 -0
- package/dist/bundle.b207a66d5902f39d0c5a.js.gz +0 -0
- package/dist/bundle.b7b86a025aa95dea0e19.js +2 -0
- package/dist/bundle.b7b86a025aa95dea0e19.js.LICENSE.txt +8 -0
- package/dist/bundle.b7b86a025aa95dea0e19.js.gz +0 -0
- package/dist/bundle.b7e3eb480b649b3de67b.js +2 -0
- package/dist/bundle.b7e3eb480b649b3de67b.js.LICENSE.txt +5 -0
- package/dist/bundle.b7e3eb480b649b3de67b.js.gz +0 -0
- package/dist/bundle.c1c6028fd703ebf78c2e.js +2 -0
- package/dist/bundle.c1c6028fd703ebf78c2e.js.LICENSE.txt +5 -0
- package/dist/bundle.c1c6028fd703ebf78c2e.js.gz +0 -0
- package/dist/bundle.cd10ae07e0e0c36d0dee.js +2 -0
- package/dist/bundle.cd10ae07e0e0c36d0dee.js.LICENSE.txt +22 -0
- package/dist/bundle.cd10ae07e0e0c36d0dee.js.gz +0 -0
- package/dist/bundle.cf6a1933769c2aee4e6e.js +1 -0
- package/dist/bundle.cf6a1933769c2aee4e6e.js.gz +0 -0
- package/dist/bundle.d158d417d1d7a8acb2a1.js +1 -0
- package/dist/bundle.d158d417d1d7a8acb2a1.js.gz +0 -0
- package/dist/bundle.db40aa107272f4303ece.js +1 -0
- package/dist/bundle.db40aa107272f4303ece.js.gz +0 -0
- package/dist/bundle.ddefe6d8f235ef95d470.js +1 -0
- package/dist/bundle.ddefe6d8f235ef95d470.js.gz +0 -0
- package/dist/bundle.e02a7a16b4a6b3bb412f.js +2 -0
- package/dist/bundle.e02a7a16b4a6b3bb412f.js.LICENSE.txt +16 -0
- package/dist/bundle.e02a7a16b4a6b3bb412f.js.gz +0 -0
- package/dist/bundle.e760a70171cf0ae4567b.js +1 -0
- package/dist/bundle.e760a70171cf0ae4567b.js.gz +0 -0
- package/dist/bundle.f3ce062a620fe456c152.js +1 -0
- package/dist/bundle.f6e1c4fda58154810fe2.js +2 -0
- package/dist/bundle.f6e1c4fda58154810fe2.js.LICENSE.txt +41 -0
- package/dist/bundle.f6e1c4fda58154810fe2.js.gz +0 -0
- package/dist/bundle.fe9c09b8ace9c3117b0a.js +1 -0
- package/dist/bundle.fe9c09b8ace9c3117b0a.js.gz +0 -0
- package/dist/bundle.feaa17bec2057a4ee54f.js +1 -0
- package/dist/bundle.feaa17bec2057a4ee54f.js.gz +0 -0
- package/dist/css/chemstruc-graph-6437e59640f8b99b774f.css +12 -0
- package/dist/css/chemstruc-graph-6437e59640f8b99b774f.css.gz +0 -0
- package/dist/css/common-901df6b21f13391f2a53.css +56 -0
- package/dist/css/html-editor-draft-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/html-editor-draft-5e8e152675ab7d201c00.css.gz +0 -0
- package/dist/css/main-f3c8fdebab315e61e7be.css +865 -0
- package/dist/css/main-f3c8fdebab315e61e7be.css.gz +0 -0
- package/dist/images/development-30de07a0.png +0 -0
- package/dist/images/logo-54b328b7.png +0 -0
- package/dist/images/pain-point-8f02421e.png +0 -0
- package/dist/images/target-13a5b4b9.png +0 -0
- package/dist/images/time-cost-cb40d2c2.png +0 -0
- package/dist/images/time-prograss-44b86b36.png +0 -0
- package/dist/index.html +4 -0
- package/lib/controls/collapse-card/index.d.ts +11 -2
- package/lib/controls/collapse-card/index.d.ts.map +1 -1
- package/lib/controls/collapse-card/index.js +18 -16
- package/lib/controls/collapse-card/index.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +2 -1
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.js +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.js.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +1 -1
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/detail/view/field-view-group.d.ts +10 -1
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/field-view-group.js +17 -11
- package/lib/detail/view/field-view-group.js.map +1 -1
- package/lib/form/criteria-form.js +3 -3
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/form/form-Item-group.js +1 -1
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/layout/MainPage.js +1 -1
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/layout/header/index.js +3 -3
- package/lib/layout/header/index.js.map +1 -1
- package/lib/layout/menu/block.d.ts +13 -1
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/block.js +66 -8
- package/lib/layout/menu/block.js.map +1 -1
- package/lib/layout/menu/menu-2layers.d.ts +10 -0
- package/lib/layout/menu/menu-2layers.d.ts.map +1 -1
- package/lib/layout/menu/menu-2layers.js +32 -9
- package/lib/layout/menu/menu-2layers.js.map +1 -1
- package/lib/layout/sidebar/index.d.ts.map +1 -1
- package/lib/layout/sidebar/index.js +3 -1
- package/lib/layout/sidebar/index.js.map +1 -1
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.js +10 -8
- package/lib/locale/LocaleProvider.js.map +1 -1
- package/lib/locale/translate.d.ts.map +1 -1
- package/lib/locale/translate.js +10 -8
- package/lib/locale/translate.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +2 -2
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +22 -21
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +18 -8
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-selector.d.ts.map +1 -1
- package/lib/table/column/column-selector.js +20 -18
- package/lib/table/column/column-selector.js.map +1 -1
- package/lib/table/query-table.d.ts +10 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +47 -41
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.js +4 -4
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +9 -6
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/tree/tree-node.d.ts.map +1 -1
- package/lib/tree/tree-node.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +6 -5
- package/src/aldehyde/controls/collapse-card/index.tsx +96 -54
- package/src/aldehyde/controls/entry-control.tsx +2 -1
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +1 -1
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +1 -1
- package/src/aldehyde/detail/view/field-view-group.tsx +62 -47
- package/src/aldehyde/form/criteria-form.tsx +3 -3
- package/src/aldehyde/form/form-Item-group.tsx +1 -1
- package/src/aldehyde/layout/MainPage.tsx +1 -1
- package/src/aldehyde/layout/header/index.tsx +4 -4
- package/src/aldehyde/layout/menu/block.less +11 -0
- package/src/aldehyde/layout/menu/block.tsx +132 -72
- package/src/aldehyde/layout/menu/menu-2layers.tsx +99 -64
- package/src/aldehyde/layout/sidebar/index.tsx +5 -1
- package/src/aldehyde/locale/LocaleProvider.tsx +10 -9
- package/src/aldehyde/locale/translate.ts +10 -7
- package/src/aldehyde/routable/ltmpl-route.tsx +220 -196
- package/src/aldehyde/table/act-table.tsx +26 -9
- package/src/aldehyde/table/column/column-selector.tsx +111 -72
- package/src/aldehyde/table/query-table.tsx +354 -304
- package/src/aldehyde/table/relation-table.tsx +4 -4
- package/src/aldehyde/tree/tmpl-tree.tsx +19 -3
- package/src/aldehyde/tree/tree-node.tsx +0 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see bundle.6fd2dadd29083268c5a6.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunkaldehyde=self.webpackChunkaldehyde||[]).push([[87],{54700:function(t,e,n){"use strict";n.d(e,{A:function(){return h}});var o=n(58168),i=n(96540),r={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"},a=n(87064),s=function(t,e){return i.createElement(a.A,(0,o.A)({},t,{ref:e,icon:r}))},h=i.forwardRef(s)},84861:function(t,e,n){var o,i,r,a;t.exports=(o=n(5556),i=n(96540),r=n(4764),a=n(6567),function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function i(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 r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),s=o(n(1)),h=n(2),c=o(h),u=o(n(3)),l=o(n(4)),d=function(t){function e(){var t,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];return n=o=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(a))),o._sigPad=null,o._excludeOurProps=function(){var t=o.props;return t.canvasProps,t.clearOnResize,function(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(t,["canvasProps","clearOnResize"])},o.getCanvas=function(){return o._canvas},o.getTrimmedCanvas=function(){var t=document.createElement("canvas");return t.width=o._canvas.width,t.height=o._canvas.height,t.getContext("2d").drawImage(o._canvas,0,0),(0,l.default)(t)},o.getSignaturePad=function(){return o._sigPad},o._checkClearOnResize=function(){o.props.clearOnResize&&o._resizeCanvas()},o._resizeCanvas=function(){var t=o.props.canvasProps||{},e=t.width,n=t.height;if(!e||!n){var i=o._canvas,r=Math.max(window.devicePixelRatio||1,1);e||(i.width=i.offsetWidth*r),n||(i.height=i.offsetHeight*r),i.getContext("2d").scale(r,r),o.clear()}},o.on=function(){return window.addEventListener("resize",o._checkClearOnResize),o._sigPad.on()},o.off=function(){return window.removeEventListener("resize",o._checkClearOnResize),o._sigPad.off()},o.clear=function(){return o._sigPad.clear()},o.isEmpty=function(){return o._sigPad.isEmpty()},o.fromDataURL=function(t,e){return o._sigPad.fromDataURL(t,e)},o.toDataURL=function(t,e){return o._sigPad.toDataURL(t,e)},o.fromData=function(t){return o._sigPad.fromData(t)},o.toData=function(){return o._sigPad.toData()},i(o,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),a(e,[{key:"componentDidMount",value:function(){this._sigPad=new u.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 c.default.createElement("canvas",r({ref:function(e){t._canvas=e}},e))}}]),e}(h.Component);d.propTypes={velocityFilterWeight:s.default.number,minWidth:s.default.number,maxWidth:s.default.number,minDistance:s.default.number,dotSize:s.default.oneOfType([s.default.number,s.default.func]),penColor:s.default.string,throttle:s.default.number,onEnd:s.default.func,onBegin:s.default.func,canvasProps:s.default.object,clearOnResize:s.default.bool},d.defaultProps={clearOnResize:!0},e.default=d},function(t,e){t.exports=o},function(t,e){t.exports=i},function(t,e){t.exports=r},function(t,e){t.exports=a}]))},6567:function(t){t.exports=function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t,e,n,o){return function(t,e,n,o){return{red:o[4*(n*e+t)],green:o[4*(n*e+t)+1],blue:o[4*(n*e+t)+2],alpha:o[4*(n*e+t)+3]}}(t,e,n,o).alpha}function o(t,e,o,i){for(var r=t?1:-1,a=t?0:o-1;t?a<o:a>-1;a+=r)for(var s=0;s<e;s++)if(n(s,a,e,i))return a;return null}function i(t,e,o,i){for(var r=t?1:-1,a=t?0:e-1;t?a<e:a>-1;a+=r)for(var s=0;s<o;s++)if(n(a,s,e,i))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=o(!0,n,r,a),h=o(!1,n,r,a),c=i(!0,n,r,a),u=i(!1,n,r,a)-c+1,l=h-s+1,d=e.getImageData(c,s,u,l);return t.width=u,t.height=l,e.clearRect(0,0,u,l),e.putImageData(d,0,0),t}}])},4764:function(t,e,n){"use strict";function o(t,e,n){this.x=t,this.y=e,this.time=n||(new Date).getTime()}function i(t,e,n,o){this.startPoint=t,this.control1=e,this.control2=n,this.endPoint=o}function r(t,e){var n=this,o=e||{};this.velocityFilterWeight=o.velocityFilterWeight||.7,this.minWidth=o.minWidth||.5,this.maxWidth=o.maxWidth||2.5,this.throttle="throttle"in o?o.throttle:16,this.minDistance="minDistance"in o?o.minDistance:5,this.throttle?this._strokeMoveUpdate=function(t,e,n){var o,i,r,a=null,s=0;n||(n={});var h=function(){s=!1===n.leading?0:Date.now(),a=null,r=t.apply(o,i),a||(o=i=null)};return function(){var c=Date.now();s||!1!==n.leading||(s=c);var u=e-(c-s);return o=this,i=arguments,u<=0||u>e?(a&&(clearTimeout(a),a=null),s=c,r=t.apply(o,i),a||(o=i=null)):a||!1===n.trailing||(a=setTimeout(h,u)),r}}(r.prototype._strokeUpdate,this.throttle):this._strokeMoveUpdate=r.prototype._strokeUpdate,this.dotSize=o.dotSize||function(){return(this.minWidth+this.maxWidth)/2},this.penColor=o.penColor||"black",this.backgroundColor=o.backgroundColor||"rgba(0,0,0,0)",this.onBegin=o.onBegin,this.onEnd=o.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),o.prototype.velocityFrom=function(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):1},o.prototype.distanceTo=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},o.prototype.equals=function(t){return this.x===t.x&&this.y===t.y&&this.time===t.time},i.prototype.length=function(){for(var t=0,e=void 0,n=void 0,o=0;o<=10;o+=1){var i=o/10,r=this._point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this._point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(o>0){var s=r-e,h=a-n;t+=Math.sqrt(s*s+h*h)}e=r,n=a}return t},i.prototype._point=function(t,e,n,o,i){return e*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*o*(1-t)*t*t+i*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]:{},o=new Image,i=n.ratio||window.devicePixelRatio||1,r=n.width||this._canvas.width/i,a=n.height||this._canvas.height/i;this._reset(),o.src=t,o.onload=function(){e._ctx.drawImage(o,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,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return(e=this._canvas).toDataURL.apply(e,[t].concat(o))},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,o=this._createPoint(e,n),i=this._data[this._data.length-1],r=i&&i[i.length-1],a=r&&o.distanceTo(r)<this.minDistance;if(!r||!a){var s=this._addPoint(o),h=s.curve,c=s.widths;h&&c&&this._drawCurve(h,c.start,c.end),this._data[this._data.length-1].push({x:o.x,y:o.y,time:o.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 o=this._data[this._data.length-1],i=o[o.length-1];n.equals(i)||o.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 i=this._canvas.getBoundingClientRect();return new o(t-i.left,e-i.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,o=this._calculateCurveControlPoints(e[1],e[2],e[3]).c1,r=new i(e[1],n,o,e[2]),a=this._calculateCurveWidths(r);return e.shift(),{curve:r,widths:a}}return{}},r.prototype._calculateCurveControlPoints=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,a=e.x-n.x,s=e.y-n.y,h=(t.x+e.x)/2,c=(t.y+e.y)/2,u=(e.x+n.x)/2,l=(e.y+n.y)/2,d=Math.sqrt(i*i+r*r),f=Math.sqrt(a*a+s*s),p=f/(d+f),v=u+(h-u)*p,_=l+(c-l)*p,m=e.x-v,y=e.y-_;return{c1:new o(h+m,c+y),c2:new o(u+m,l+y)}},r.prototype._calculateCurveWidths=function(t){var e=t.startPoint,n=t.endPoint,o={start:null,end:null},i=this.velocityFilterWeight*n.velocityFrom(e)+(1-this.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(i);return o.start=this._lastWidth,o.end=r,this._lastVelocity=i,this._lastWidth=r,o},r.prototype._strokeWidth=function(t){return Math.max(this.maxWidth/(t+1),this.minWidth)},r.prototype._drawPoint=function(t,e,n){var o=this._ctx;o.moveTo(t,e),o.arc(t,e,n,0,2*Math.PI,!1),this._isEmpty=!1},r.prototype._drawCurve=function(t,e,n){var o=this._ctx,i=n-e,r=Math.floor(t.length());o.beginPath();for(var a=0;a<r;a+=1){var s=a/r,h=s*s,c=h*s,u=1-s,l=u*u,d=l*u,f=d*t.startPoint.x;f+=3*l*s*t.control1.x,f+=3*u*h*t.control2.x,f+=c*t.endPoint.x;var p=d*t.startPoint.y;p+=3*l*s*t.control1.y,p+=3*u*h*t.control2.y,p+=c*t.endPoint.y;var v=e+c*i;this._drawPoint(f,p,v)}o.closePath(),o.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 i=0;i<t.length;i+=1){var r=t[i];if(r.length>1)for(var a=0;a<r.length;a+=1){var s=r[a],h=new o(s.x,s.y,s.time),c=s.color;if(0===a)this.penColor=c,this._reset(),this._addPoint(h);else if(a!==r.length-1){var u=this._addPoint(h),l=u.curve,d=u.widths;l&&d&&e(l,d,c)}}else this._reset(),n(r[0])}},r.prototype._toSVG=function(){var t=this,e=this._data,n=this._canvas,o=Math.max(window.devicePixelRatio||1,1),i=n.width/o,r=n.height/o,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 o=document.createElement("path");if(!(isNaN(t.control1.x)||isNaN(t.control1.y)||isNaN(t.control2.x)||isNaN(t.control2.y))){var i="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);o.setAttribute("d",i),o.setAttribute("stroke-width",(2.25*e.end).toFixed(3)),o.setAttribute("stroke",n),o.setAttribute("fill","none"),o.setAttribute("stroke-linecap","round"),a.appendChild(o)}}),(function(e){var n=document.createElement("circle"),o="function"==typeof t.dotSize?t.dotSize():t.dotSize;n.setAttribute("r",o),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 '+i+" "+r+'" width="'+i+'" height="'+r+'">',h=a.innerHTML;if(void 0===h){var c=document.createElement("dummy"),u=a.childNodes;c.innerHTML="";for(var l=0;l<u.length;l+=1)c.appendChild(u[l].cloneNode(!0));h=c.innerHTML}return"data:image/svg+xml;base64,"+btoa(s+h+"</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
|
+
*/
|
|
Binary file
|