rax-countdown
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},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=6)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("rax")},function(e,t){e.exports=require("rax-text")},function(e,t){e.exports=require("rax-view")},function(e,t){e.exports=require("rax-image")},function(e,t,n){},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t);var i=n(1),r=n(0),o=n.n(r),a=n(2),c=n.n(a),s=n(3),u=n.n(s),m=n(4),l=n.n(m),p=n(5),d=n.n(p).a;function f(e){return e&&"[object Function]"==={}.toString.call(e)}function g(e){const{num:t,timeWrapStyle:n,timeBackground:r,timeBackgroundStyle:o,timeStyle:a,secondStyle:s}=e;let m=t.toString();t<0?m="00":t<10&&(m="0"+t);const p=m.split(""),f=p.length-1;return Object(i.createElement)(u.a,{className:"rax-countdown-item",style:Object.assign({},d["rax-countdown-item"],n)},r?Object(i.createElement)(l.a,{className:"rax-countdown-background",source:r,style:Object.assign({},d["rax-countdown-background"],o)}):null,p.map((e,t)=>Object(i.createElement)(c.a,{key:"time_"+t,style:t===f?s:a},e)))}class y extends i.Component{constructor(...e){super(...e),this.state={timeRemaining:0},this.timeoutId=0,this.tick=()=>{const{onComplete:e,onTick:t,interval:n}=this.props,{timeRemaining:i}=this.state,r=1e3>i;this.timeoutId&&clearTimeout(this.timeoutId),r&&f(e)?e():this.timeoutId=!r&&setTimeout(()=>this.setState({timeRemaining:i-n},()=>f(t)&&t(i)),n)}}componentWillMount(){const{timeRemaining:e}=this.props;this.setState({timeRemaining:e})}componentDidMount(){this.tick()}componentDidUpdate(){this.tick()}componentWillReceiveProps(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}componentWillUnmount(){this.timeoutId&&clearTimeout(this.timeoutId)}shouldComponentUpdate(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}render(){const{timeRemaining:e}=this.state,{formatFunc:t,timeStyle:n,timeBackgroundStyle:r,timeWrapStyle:o,timeBackground:a,secondStyle:s,textStyle:m,tpl:l}=this.props;if(t)return t(e);const p=Math.floor(e/1e3);const f={d:parseInt(p/3600/24),h:parseInt(p/3600)%24,m:parseInt(p/60)%60,s:parseInt(p%60)};let y=new RegExp("{[d,h,m,s]}","g");const h=[];let b=null;for(;null!==(b=y.exec(l));)h.push(b.index,b.index);0!==h.length&&h.push(-1);let x=0;return Object(i.createElement)(u.a,{className:"rax-countdown-main",style:d["rax-countdown-main"]},h.map((e,t)=>{if(-1===e){const e=l.slice(x);return e?Object(i.createElement)(c.a,{style:m,key:"text_"+t},e):null}const u=l[e+1];switch(u){case"d":case"h":case"m":case"s":if(t%2==0){const n=l.slice(x,e);return n?Object(i.createElement)(c.a,{style:m,key:"text_"+t},n):null}return x=e+3,Object(i.createElement)(g,{num:f[u],timeWrapStyle:o,timeBackground:a,timeBackgroundStyle:r,timeStyle:n,secondStyle:s,key:"time_"+t});default:return null}}))}}y.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},y.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},t.default=y}]); | ||
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},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=5)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("rax")},function(e,t){e.exports=require("rax-text")},function(e,t){e.exports=require("rax-view")},function(e,t){e.exports=require("rax-image")},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";n.r(t);var i=n(1),r=n(0),o=n.n(r),a=n(2),c=n.n(a),s=n(3),u=n.n(s),l=n(4),m=n.n(l);n(7);function p(e){return e&&"[object Function]"==={}.toString.call(e)}function d(e){const{num:t,timeWrapStyle:n,timeBackground:r,timeBackgroundStyle:o,timeStyle:a,secondStyle:s}=e;let l=t.toString();t<0?l="00":t<10&&(l="0"+t);const p=l.split(""),d=p.length-1;return Object(i.createElement)(u.a,{className:"rax-countdown-item",style:n},r?Object(i.createElement)(m.a,{className:"rax-countdown-background",source:r,style:o}):null,p.map(((e,t)=>Object(i.createElement)(c.a,{key:`time_${t}`,style:t===d?s:a},e))))}class f extends i.Component{constructor(...e){super(...e),this.state={timeRemaining:0},this.timeoutId=0,this.tick=()=>{const{onComplete:e,onTick:t,interval:n}=this.props,{timeRemaining:i}=this.state,r=1e3>i;this.timeoutId&&clearTimeout(this.timeoutId),r&&p(e)?e():this.timeoutId=!r&&setTimeout((()=>this.setState({timeRemaining:i-n},(()=>p(t)&&t(i)))),n)}}componentWillMount(){const{timeRemaining:e}=this.props;this.setState({timeRemaining:e})}componentDidMount(){this.tick()}componentDidUpdate(){this.tick()}componentWillReceiveProps(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}componentWillUnmount(){this.timeoutId&&clearTimeout(this.timeoutId)}shouldComponentUpdate(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}render(){const{timeRemaining:e}=this.state,{formatFunc:t,timeStyle:n,timeBackgroundStyle:r,timeWrapStyle:o,timeBackground:a,secondStyle:s,textStyle:l,tpl:m}=this.props;if(t)return t(e);const p=Math.floor(e/1e3);const f={d:parseInt(p/3600/24),h:parseInt(p/3600)%24,m:parseInt(p/60)%60,s:parseInt(p%60)};let y=new RegExp("{[d,h,m,s]}","g");const g=[];let h=null;for(;null!==(h=y.exec(m));)g.push(h.index,h.index);0!==g.length&&g.push(-1);let b=0;return Object(i.createElement)(u.a,{className:"rax-countdown-main"},g.map(((e,t)=>{if(-1===e){const e=m.slice(b);return e?Object(i.createElement)(c.a,{style:l,key:`text_${t}`},e):null}const u=m[e+1];switch(u){case"d":case"h":case"m":case"s":if(t%2==0){const n=m.slice(b,e);return n?Object(i.createElement)(c.a,{style:l,key:`text_${t}`},n):null}return b=e+3,Object(i.createElement)(d,{num:f[u],timeWrapStyle:o,timeBackground:a,timeBackgroundStyle:r,timeStyle:n,secondStyle:s,key:`time_${t}`});default:return null}})))}}f.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},f.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},t.default=f},function(e,t,n){}]); |
@@ -1,1 +0,1 @@ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="./",n(n.s=6)}([function(t,e){t.exports=require("prop-types")},function(t,e){t.exports=require("rax")},function(t,e){t.exports=require("rax-text")},function(t,e){t.exports=require("rax-view")},function(t,e){t.exports=require("rax-image")},function(t,e,n){},function(t,e,n){t.exports=n(7)},function(t,e,n){"use strict";n.r(e);var r=n(1),i=n(0),o=n.n(i),a=n(2),u=n.n(a),c=n(3),m=n.n(c),l=n(4),s=n.n(l),p=n(5);var f=n.n(p).a;function d(t){return t&&"[object Function]"==={}.toString.call(t)}function y(t){var e=t.num,n=t.timeWrapStyle,i=t.timeBackground,o=t.timeBackgroundStyle,a=t.timeStyle,c=t.secondStyle,l=e.toString();e<0?l="00":e<10&&(l="0"+e);var p=l.split(""),d=p.length-1;return Object(r.createElement)(m.a,{className:"rax-countdown-item",style:Object.assign({},f["rax-countdown-item"],n)},i?Object(r.createElement)(s.a,{className:"rax-countdown-background",source:i,style:Object.assign({},f["rax-countdown-background"],o)}):null,p.map((function(t,e){return Object(r.createElement)(u.a,{key:"time_"+e,style:e===d?c:a},t)})))}var g=function(t){var e,n;function i(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).state={timeRemaining:0},e.timeoutId=0,e.tick=function(){var t=e.props,n=t.onComplete,r=t.onTick,i=t.interval,o=e.state.timeRemaining,a=1e3>o;e.timeoutId&&clearTimeout(e.timeoutId),a&&d(n)?n():e.timeoutId=!a&&setTimeout((function(){return e.setState({timeRemaining:o-i},(function(){return d(r)&&r(o)}))}),i)},e}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var o=i.prototype;return o.componentWillMount=function(){var t=this.props.timeRemaining;this.setState({timeRemaining:t})},o.componentDidMount=function(){this.tick()},o.componentDidUpdate=function(){this.tick()},o.componentWillReceiveProps=function(t){t.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:t.timeRemaining}))},o.componentWillUnmount=function(){this.timeoutId&&clearTimeout(this.timeoutId)},o.shouldComponentUpdate=function(t,e){return this.props.timeRemaining!==t.timeRemaining||this.state.timeRemaining!==e.timeRemaining},o.render=function(){var t=this.state.timeRemaining,e=this.props,n=e.formatFunc,i=e.timeStyle,o=e.timeBackgroundStyle,a=e.timeWrapStyle,c=e.timeBackground,l=e.secondStyle,s=e.textStyle,p=e.tpl;if(n)return n(t);for(var d=Math.floor(t/1e3),g={d:parseInt(d/3600/24),h:parseInt(d/3600)%24,m:parseInt(d/60)%60,s:parseInt(d%60)},b=new RegExp("{[d,h,m,s]}","g"),h=[],x=null;null!==(x=b.exec(p));)h.push(x.index,x.index);0!==h.length&&h.push(-1);var v=0;return Object(r.createElement)(m.a,{className:"rax-countdown-main",style:f["rax-countdown-main"]},h.map((function(t,e){if(-1===t){var n=p.slice(v);return n?Object(r.createElement)(u.a,{style:s,key:"text_"+e},n):null}var m=p[t+1];switch(m){case"d":case"h":case"m":case"s":if(e%2==0){var f=p.slice(v,t);return f?Object(r.createElement)(u.a,{style:s,key:"text_"+e},f):null}return v=t+3,Object(r.createElement)(y,{num:g[m],timeWrapStyle:a,timeBackground:c,timeBackgroundStyle:o,timeStyle:i,secondStyle:l,key:"time_"+e});default:return null}})))},i}(r.Component);g.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},g.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},e.default=g}]); | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=5)}([function(t,e){t.exports=require("prop-types")},function(t,e){t.exports=require("rax")},function(t,e){t.exports=require("rax-text")},function(t,e){t.exports=require("rax-view")},function(t,e){t.exports=require("rax-image")},function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";n.r(e);var r=n(1),i=n(0),o=n.n(i),a=n(2),u=n.n(a),c=n(3),m=n.n(c),l=n(4),s=n.n(l);n(7);function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return t&&"[object Function]"==={}.toString.call(t)}function d(t){var e=t.num,n=t.timeWrapStyle,i=t.timeBackground,o=t.timeBackgroundStyle,a=t.timeStyle,c=t.secondStyle,l=e.toString();e<0?l="00":e<10&&(l="0"+e);var p=l.split(""),f=p.length-1;return Object(r.createElement)(m.a,{className:"rax-countdown-item",style:n},i?Object(r.createElement)(s.a,{className:"rax-countdown-background",source:i,style:o}):null,p.map((function(t,e){return Object(r.createElement)(u.a,{key:"time_"+e,style:e===f?c:a},t)})))}var y=function(t){var e,n;function i(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).state={timeRemaining:0},e.timeoutId=0,e.tick=function(){var t=e.props,n=t.onComplete,r=t.onTick,i=t.interval,o=e.state.timeRemaining,a=1e3>o;e.timeoutId&&clearTimeout(e.timeoutId),a&&f(n)?n():e.timeoutId=!a&&setTimeout((function(){return e.setState({timeRemaining:o-i},(function(){return f(r)&&r(o)}))}),i)},e}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,p(e,n);var o=i.prototype;return o.componentWillMount=function(){var t=this.props.timeRemaining;this.setState({timeRemaining:t})},o.componentDidMount=function(){this.tick()},o.componentDidUpdate=function(){this.tick()},o.componentWillReceiveProps=function(t){t.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:t.timeRemaining}))},o.componentWillUnmount=function(){this.timeoutId&&clearTimeout(this.timeoutId)},o.shouldComponentUpdate=function(t,e){return this.props.timeRemaining!==t.timeRemaining||this.state.timeRemaining!==e.timeRemaining},o.render=function(){var t=this.state.timeRemaining,e=this.props,n=e.formatFunc,i=e.timeStyle,o=e.timeBackgroundStyle,a=e.timeWrapStyle,c=e.timeBackground,l=e.secondStyle,s=e.textStyle,p=e.tpl;if(n)return n(t);for(var f=Math.floor(t/1e3),y={d:parseInt(f/3600/24),h:parseInt(f/3600)%24,m:parseInt(f/60)%60,s:parseInt(f%60)},g=new RegExp("{[d,h,m,s]}","g"),b=[],h=null;null!==(h=g.exec(p));)b.push(h.index,h.index);0!==b.length&&b.push(-1);var v=0;return Object(r.createElement)(m.a,{className:"rax-countdown-main"},b.map((function(t,e){if(-1===t){var n=p.slice(v);return n?Object(r.createElement)(u.a,{style:s,key:"text_"+e},n):null}var m=p[t+1];switch(m){case"d":case"h":case"m":case"s":if(e%2==0){var f=p.slice(v,t);return f?Object(r.createElement)(u.a,{style:s,key:"text_"+e},f):null}return v=t+3,Object(r.createElement)(d,{num:y[m],timeWrapStyle:a,timeBackground:c,timeBackgroundStyle:o,timeStyle:i,secondStyle:l,key:"time_"+e});default:return null}})))},i}(r.Component);y.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},y.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},e.default=y},function(t,e,n){}]); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.raxCountdown=t():e.raxCountdown=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));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=6)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("rax")},function(e,t){e.exports=require("rax-text")},function(e,t){e.exports=require("rax-view")},function(e,t){e.exports=require("rax-image")},function(e,t,n){},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n(0),o=n.n(i),a=n(2),u=n.n(a),c=n(3),m=n.n(c),l=n(4),s=n.n(l),p=n(5);var f=n.n(p).a;function d(e){return e&&"[object Function]"==={}.toString.call(e)}function y(e){var t=e.num,n=e.timeWrapStyle,i=e.timeBackground,o=e.timeBackgroundStyle,a=e.timeStyle,c=e.secondStyle,l=t.toString();t<0?l="00":t<10&&(l="0"+t);var p=l.split(""),d=p.length-1;return Object(r.createElement)(m.a,{className:"rax-countdown-item",style:Object.assign({},f["rax-countdown-item"],n)},i?Object(r.createElement)(s.a,{className:"rax-countdown-background",source:i,style:Object.assign({},f["rax-countdown-background"],o)}):null,p.map((function(e,t){return Object(r.createElement)(u.a,{key:"time_"+t,style:t===d?c:a},e)})))}var g=function(e){var t,n;function i(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={timeRemaining:0},t.timeoutId=0,t.tick=function(){var e=t.props,n=e.onComplete,r=e.onTick,i=e.interval,o=t.state.timeRemaining,a=1e3>o;t.timeoutId&&clearTimeout(t.timeoutId),a&&d(n)?n():t.timeoutId=!a&&setTimeout((function(){return t.setState({timeRemaining:o-i},(function(){return d(r)&&r(o)}))}),i)},t}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=i.prototype;return o.componentWillMount=function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})},o.componentDidMount=function(){this.tick()},o.componentDidUpdate=function(){this.tick()},o.componentWillReceiveProps=function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))},o.componentWillUnmount=function(){this.timeoutId&&clearTimeout(this.timeoutId)},o.shouldComponentUpdate=function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining},o.render=function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,i=t.timeStyle,o=t.timeBackgroundStyle,a=t.timeWrapStyle,c=t.timeBackground,l=t.secondStyle,s=t.textStyle,p=t.tpl;if(n)return n(e);for(var d=Math.floor(e/1e3),g={d:parseInt(d/3600/24),h:parseInt(d/3600)%24,m:parseInt(d/60)%60,s:parseInt(d%60)},b=new RegExp("{[d,h,m,s]}","g"),x=[],h=null;null!==(h=b.exec(p));)x.push(h.index,h.index);0!==x.length&&x.push(-1);var v=0;return Object(r.createElement)(m.a,{className:"rax-countdown-main",style:f["rax-countdown-main"]},x.map((function(e,t){if(-1===e){var n=p.slice(v);return n?Object(r.createElement)(u.a,{style:s,key:"text_"+t},n):null}var m=p[e+1];switch(m){case"d":case"h":case"m":case"s":if(t%2==0){var f=p.slice(v,e);return f?Object(r.createElement)(u.a,{style:s,key:"text_"+t},f):null}return v=e+3,Object(r.createElement)(y,{num:g[m],timeWrapStyle:a,timeBackground:c,timeBackgroundStyle:o,timeStyle:i,secondStyle:l,key:"time_"+t});default:return null}})))},i}(r.Component);g.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},g.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},t.default=g}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.raxCountdown=t():e.raxCountdown=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));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=5)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("rax")},function(e,t){e.exports=require("rax-text")},function(e,t){e.exports=require("rax-view")},function(e,t){e.exports=require("rax-image")},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n(0),o=n.n(i),a=n(2),u=n.n(a),c=n(3),m=n.n(c),l=n(4),s=n.n(l);n(7);function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){return e&&"[object Function]"==={}.toString.call(e)}function d(e){var t=e.num,n=e.timeWrapStyle,i=e.timeBackground,o=e.timeBackgroundStyle,a=e.timeStyle,c=e.secondStyle,l=t.toString();t<0?l="00":t<10&&(l="0"+t);var p=l.split(""),f=p.length-1;return Object(r.createElement)(m.a,{className:"rax-countdown-item",style:n},i?Object(r.createElement)(s.a,{className:"rax-countdown-background",source:i,style:o}):null,p.map((function(e,t){return Object(r.createElement)(u.a,{key:"time_"+t,style:t===f?c:a},e)})))}var y=function(e){var t,n;function i(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={timeRemaining:0},t.timeoutId=0,t.tick=function(){var e=t.props,n=e.onComplete,r=e.onTick,i=e.interval,o=t.state.timeRemaining,a=1e3>o;t.timeoutId&&clearTimeout(t.timeoutId),a&&f(n)?n():t.timeoutId=!a&&setTimeout((function(){return t.setState({timeRemaining:o-i},(function(){return f(r)&&r(o)}))}),i)},t}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,p(t,n);var o=i.prototype;return o.componentWillMount=function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})},o.componentDidMount=function(){this.tick()},o.componentDidUpdate=function(){this.tick()},o.componentWillReceiveProps=function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))},o.componentWillUnmount=function(){this.timeoutId&&clearTimeout(this.timeoutId)},o.shouldComponentUpdate=function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining},o.render=function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,i=t.timeStyle,o=t.timeBackgroundStyle,a=t.timeWrapStyle,c=t.timeBackground,l=t.secondStyle,s=t.textStyle,p=t.tpl;if(n)return n(e);for(var f=Math.floor(e/1e3),y={d:parseInt(f/3600/24),h:parseInt(f/3600)%24,m:parseInt(f/60)%60,s:parseInt(f%60)},g=new RegExp("{[d,h,m,s]}","g"),b=[],x=null;null!==(x=g.exec(p));)b.push(x.index,x.index);0!==b.length&&b.push(-1);var h=0;return Object(r.createElement)(m.a,{className:"rax-countdown-main"},b.map((function(e,t){if(-1===e){var n=p.slice(h);return n?Object(r.createElement)(u.a,{style:s,key:"text_"+t},n):null}var m=p[e+1];switch(m){case"d":case"h":case"m":case"s":if(t%2==0){var f=p.slice(h,e);return f?Object(r.createElement)(u.a,{style:s,key:"text_"+t},f):null}return h=e+3,Object(r.createElement)(d,{num:y[m],timeWrapStyle:a,timeBackground:c,timeBackgroundStyle:o,timeStyle:i,secondStyle:l,key:"time_"+t});default:return null}})))},i}(r.Component);y.propTypes={formatFunc:o.a.func,onTick:o.a.func,onComplete:o.a.func,tpl:o.a.string,timeRemaining:o.a.number,secondStyle:o.a.object,timeStyle:o.a.object,textStyle:o.a.object,timeWrapStyle:o.a.object,timeBackground:o.a.shape({uri:o.a.string}),timeBackgroundStyle:o.a.object,interval:o.a.number},y.defaultProps={tpl:"{d}\u5929{h}\u65f6{m}\u5206{s}\u79d2",timeRemaining:0,interval:1e3},t.default=y},function(e,t,n){}])})); |
@@ -20,4 +20,6 @@ "use strict"; | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var _styleSheet = _index.default; | ||
@@ -24,0 +26,0 @@ |
{ | ||
"name": "rax-countdown", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Countdown component for Rax.", | ||
"license": "BSD-3-Clause", | ||
"main": "lib/index.js", | ||
"module": "es/index.js", | ||
"files": [ | ||
"es", | ||
"lib", | ||
"dist" | ||
], | ||
"miniprogram": ".", | ||
"miniappConfig": { | ||
"main": "lib/miniapp-native/ali-miniapp/index", | ||
"main:bytedance": "lib/miniapp-native/bytedance-microapp/index" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf ./lib && rm -rf ./package-lock.json", | ||
"build": "npm run clean && ../../node_modules/.bin/build-scripts build --config ../../build.json", | ||
"build": "../../node_modules/.bin/build-scripts build --config ../../build.json --skip-demo", | ||
"start": "../../node_modules/.bin/build-scripts start --config ../../build.json", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"files": [ | ||
"dist", | ||
"lib" | ||
], | ||
"repository": { | ||
@@ -21,2 +27,6 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/raxjs/rax-components/issues" | ||
}, | ||
"homepage": "https://github.com/raxjs/rax-components#readme", | ||
"keywords": [ | ||
@@ -27,9 +37,2 @@ "Rax", | ||
], | ||
"bugs": { | ||
"url": "https://github.com/alibaba/rax/issues" | ||
}, | ||
"homepage": "https://github.com/alibaba/rax#readme", | ||
"engines": { | ||
"npm": ">=3.0.0" | ||
}, | ||
"dependencies": { | ||
@@ -59,7 +62,3 @@ "rax-image": "^1.0.0", | ||
"typescript": "^3.9.2" | ||
}, | ||
"miniappConfig": { | ||
"main": "lib/miniapp/index", | ||
"main:bytedance": "lib/bytedance-microapp/index" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69811
36
1049
4
1