UNPKG

tongtong-visual

Version:

通通可视化组件库

1 lines 9.93 kB
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){e.exports=require("react")},function(e,t,n){"use strict";var r,a=n(3),o=(r=a)&&r.__esModule?r:{default:r};e.exports=o.default},function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),u=l(o),i=l(n(4)),c=l(n(7));function l(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={currentValue:e.initialValue},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.prepareTween(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.state.currentValue!==e.value&&(this.tweenHandle&&this.endTween(),this.prepareTween(e))}},{key:"componentWillUnmount",value:function(){this.endTween()}},{key:"prepareTween",value:function(){var e=this;this.tweenHandle=(0,c.default)((function(t){e.tweenValue(t,!0)}))}},{key:"endTween",value:function(){c.default.cancel(this.tweenHandle),this.setState(r({},this.state,{currentValue:this.props.value}))}},{key:"ensureSixtyFps",value:function(e){var t=this.state.currentTime;return!t||e-t>16}},{key:"tweenValue",value:function(e,t){if(this.ensureSixtyFps(e)){var n=this.props,r=n.value,a=n.duration,o=this.state.currentValue,u=e,i=t?e:this.state.startTime,l=t?o:this.state.fromValue,s=void 0;(s=u-i>=a?r:l+(u-i)/a*(r-l))!==r?(this.setState({currentValue:s,startTime:i||u,fromValue:l,currentTime:u}),this.tweenHandle=(0,c.default)(this.tweenValue.bind(this))):this.endTween()}else this.tweenHandle=(0,c.default)(this.tweenValue.bind(this))}},{key:"render",value:function(){var e=this.props,t=e.formatValue,n=e.value,a=e.className,o=e.frameStyle,i=e.stepPrecision,c=this.state,l=c.currentValue,s=c.fromValue,p=this.props.style,m=l,d=n-s;l!==n&&(i>0?m=Number(l.toFixed(i)):d<0&&0===i?m=Math.floor(l):d>0&&0===i&&(m=Math.ceil(l)));var h=o(Math.abs((m-s)/(n-s)*100));return p&&h?p=r({},p,h):h&&(p=h),u.default.createElement(this.props.component,r({},f(this.props),{className:a,style:p}),t(m))}}]),t}(o.Component);function f(e){var t={},n=Object.keys(e),r=Object.keys(s.propTypes);return n.filter((function(e){return r.indexOf(e)<0})).forEach((function(n){t[n]=e[n]})),t}s.propTypes={component:i.default.any,formatValue:i.default.func,value:i.default.number,initialValue:i.default.number,duration:i.default.number,frameStyle:i.default.func,stepPrecision:i.default.number,style:i.default.object,className:i.default.string},s.defaultProps={component:"span",formatValue:function(e){return e},initialValue:0,duration:300,frameStyle:function(){return{}},value:0},t.default=s},function(e,t,n){e.exports=n(5)()},function(e,t,n){"use strict";var r=n(6);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,u){if(u!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){(function(t){for(var r=n(9),a="undefined"==typeof window?t:window,o=["moz","webkit"],u="AnimationFrame",i=a["request"+u],c=a["cancel"+u]||a["cancelRequest"+u],l=0;!i&&l<o.length;l++)i=a[o[l]+"Request"+u],c=a[o[l]+"Cancel"+u]||a[o[l]+"CancelRequest"+u];if(!i||!c){var s=0,f=0,p=[];i=function(e){if(0===p.length){var t=r(),n=Math.max(0,1e3/60-(t-s));s=n+t,setTimeout((function(){var e=p.slice(0);p.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(s)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return p.push({handle:++f,callback:e,cancelled:!1}),f},c=function(e){for(var t=0;t<p.length;t++)p[t].handle===e&&(p[t].cancelled=!0)}}e.exports=function(e){return i.call(a,e)},e.exports.cancel=function(){c.apply(a,arguments)},e.exports.polyfill=function(e){e||(e=a),e.requestAnimationFrame=i,e.cancelAnimationFrame=c}}).call(this,n(8))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){(function(){var n,r,a,o,u,i;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:null!=t&&t.hrtime?(e.exports=function(){return(n()-u)/1e6},r=t.hrtime,o=(n=function(){var e;return 1e9*(e=r())[0]+e[1]})(),i=1e9*t.uptime(),u=o-i):Date.now?(e.exports=function(){return Date.now()-a},a=Date.now()):(e.exports=function(){return(new Date).getTime()-a},a=(new Date).getTime())}).call(this)}).call(this,n(10))},function(e,t){var n,r,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function i(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var c,l=[],s=!1,f=-1;function p(){s&&c&&(s=!1,c.length?l=c.concat(l):f=-1,l.length&&m())}function m(){if(!s){var e=i(p);s=!0;for(var t=l.length;t;){for(c=l,l=[];++f<t;)c&&c[f].run();f=-1,t=l.length}c=null,s=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new d(e,t)),1!==l.length||s||i(m)},d.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=h,a.addListener=h,a.once=h,a.off=h,a.removeListener=h,a.removeAllListeners=h,a.emit=h,a.prependListener=h,a.prependOnceListener=h,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,t,n){e.exports=n.p+"c4ff844606f48e29a1ffb0a5bbd9d907.png"},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),o=(n(2),n(1)),u=n.n(o);function i(e){var t=e.data,n=e.touch;return a.a.createElement("article",{className:"park-resource-brief"},a.a.createElement("div",{className:"block"},a.a.createElement("div",{className:"number",onClick:function(){(null==n?void 0:n.clickValue1)&&n.clickValue1()}},a.a.createElement(u.a,{className:"value",value:t.value1,formatValue:function(e){return~~e},duration:1500}),a.a.createElement("span",{className:"unit"},t.unit1)),a.a.createElement("div",{className:"desc"},a.a.createElement("span",{className:"icon icon1"}),a.a.createElement("span",null,t.name1))),a.a.createElement("div",{className:"block"},a.a.createElement("div",{className:"number"},a.a.createElement(u.a,{className:"value",value:t.value2,formatValue:function(e){return~~e},duration:1500}),a.a.createElement("span",{className:"unit"},t.unit2)),a.a.createElement("div",{className:"desc"},a.a.createElement("span",{className:"icon icon2"}),a.a.createElement("span",null,t.name2))))}i.title="双数字组件",i.key="Number1",i.fields={name1:"单位名称1",value1:"值1",unit1:"单位1",name2:"单位名称2",value2:"值2",unit2:"单位2"},i.demo={name1:"车场数量",value1:500,unit1:"个",name2:"车位数量",value2:75e4,unit2:"个"},i.touchs={clickValue1:"点击值1"},i.cover=n(11);var c={Number1:i};n.d(t,"Models",(function(){return c}))}]);