rax-countdown
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -629,8 +629,8 @@ module.exports = function(require, exports, module) { | ||
function transformChild(child, instance) { | ||
var Com = child.type, | ||
var ChildComponent = child.type, | ||
props = child.props; | ||
var children = props.children; | ||
if (typeof type === 'function') { | ||
var childInstance = new Com(); | ||
if (typeof ChildComponent === 'function') { | ||
var childInstance = new ChildComponent(); | ||
childInstance.props = props; | ||
@@ -637,0 +637,0 @@ if (children) { |
@@ -651,8 +651,8 @@ | ||
function transformChild(child, instance) { | ||
var Com = child.type, | ||
var ChildComponent = child.type, | ||
props = child.props; | ||
var children = props.children; | ||
if (typeof type === 'function') { | ||
var childInstance = new Com(); | ||
if (typeof ChildComponent === 'function') { | ||
var childInstance = new ChildComponent(); | ||
childInstance.props = props; | ||
@@ -659,0 +659,0 @@ if (children) { |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("rax-countdown",function(t,n,o){o.exports=e()});else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,t.RaxCountdown=e()}}(function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t){e.exports=function(){var e;if(!e)try{e=require("rax")}catch(e){}return e}()},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)};t.isWeb="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),t.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),t.isWeex="function"==typeof callNative,t.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(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)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=this.props;if(p.isWeex)return(0,f.createElement)("div",e);var t=c({},d.initial,e.style);return(0,f.createElement)("div",c({},e,{style:t}))}}]),t}(f.Component),u.propTypes={},a),d={initial:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"flex",flexDirection:"column",alignContent:"flex-start",flexShrink:0}};t.default=y,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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}function l(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)}function u(e){return e&&"[object Function]"==={}.toString.call(e)}function a(e,t,n,o,r,i){var l=e<0?0:e,u=l<10?0:l.toString().slice(0,1),a=l<10?l:l.toString().slice(1);return(0,p.createElement)(b.default,{style:[t,x.item]},n?(0,p.createElement)(v.default,{source:n,style:o}):null,(0,p.createElement)(d.default,{style:r},""+u),(0,p.createElement)(d.default,{style:i},""+a))}Object.defineProperty(t,"__esModule",{value:!0});var c,s,f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=n(0),y=n(4),d=o(y),m=n(2),b=o(m),h=n(5),v=o(h),g=(s=c=function(e){function t(){var e,n,o,l;r(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.state={timeRemaining:0},o.timeoutId=0,o.tick=function(){var e=o.props,t=e.onComplete,n=e.onTick,r=e.interval,i=o.state.timeRemaining,l=1e3>i;o.timeoutId&&clearTimeout(o.timeoutId),l&&u(t)?t():o.timeoutId=!l&&setTimeout(function(){return o.setState({timeRemaining:i-r},function(){return u(n)&&n(i)})},r)},l=n,i(o,l)}return l(t,e),f(t,[{key:"componentWillMount",value:function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})}},{key:"componentDidMount",value:function(){this.tick()}},{key:"componentDidUpdate",value:function(){this.tick()}},{key:"componentWillReceiveProps",value:function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}},{key:"componentWillUnmount",value:function(){this.timeoutId&&clearTimeout(this.timeoutId)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}},{key:"render",value:function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,o=t.timeStyle,r=t.timeBackgroundStyle,i=t.timeWrapStyle,l=t.timeBackground,u=t.secondStyle,c=t.textStyle,s=t.tpl;if(n)return n(e);var f=Math.floor(e/1e3),y=parseInt(f/3600/24),m=parseInt(f/3600)%24,h=parseInt(f/60)%60,v=parseInt(f%60),g=[x.background,r],w=new RegExp("{d}").test(s),S=new RegExp("{h}").test(s),O=new RegExp("{m}").test(s),P=new RegExp("{s}").test(s),j=s.indexOf("d"),_=s.indexOf("h"),T=s.indexOf("m"),k=s.indexOf("s");return(0,p.createElement)(b.default,{style:x.main},w?a(y,i,l,g,o,o):null,w?(0,p.createElement)(d.default,{style:c},s.slice(j+2,j+3)):null,S?a(m,i,l,g,o,o):null,S?(0,p.createElement)(d.default,{style:c},s.slice(_+2,_+3)):null,O?a(h,i,l,g,o,o):null,O?(0,p.createElement)(d.default,{style:c},s.slice(T+2,T+3)):null,P?a(v,i,l,g,o,u):null,P?(0,p.createElement)(d.default,{style:c},s.slice(k+2,k+3)):null)}}]),t}(p.Component),c.propTypes={formatFunc:p.PropTypes.func,onTick:p.PropTypes.func,onComplete:p.PropTypes.func,tpl:p.PropTypes.string,timeRemaining:p.PropTypes.number,secondStyle:p.PropTypes.object,timeStyle:p.PropTypes.object,textStyle:p.PropTypes.object,timeWrapStyle:p.PropTypes.object,timeBackground:p.PropTypes.string,timeBackgroundStyle:p.PropTypes.object,interval:p.PropTypes.number},c.defaultProps={tpl:"{d}天{h}时{m}分{s}秒",timeRemaining:0,interval:1e3},s),x={main:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},item:{flexDirection:"row"},background:{position:"absolute"}};t.default=g,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(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)}function l(e,t){var n=e.type,o=e.props,r=o.children;if("function"==typeof type){var i=new n;return i.props=o,r&&(i.props.children=u(r,t)),i.context=t.getChildContext(),i.render()}return e}function u(e,t){var n=[];Array.isArray(e)||(e=[e]);for(var o=0;o<e.length;o++){var r=e[o];"string"==typeof r?n.push(r):"object"===(void 0===r?"undefined":f(r))&&n.push(l(r,t))}return n}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var c,s,f="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),d=n(0),m=n(1),b=(s=c=function(e){function t(){var e,n,i,l;o(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=i=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.renderText=function(){var e=i.props,t=p({},e,{style:e.style||{}}),n="";if(null!=e.children&&(n=Array.isArray(e.children)?e.children.join(""):e.children.toString()),i.context.isInAParentText)return(0,d.createElement)("span",t,n);if(e.onPress&&(t.onClick=e.onPress),m.isWeex)return e.numberOfLines&&(t.style.lines=e.numberOfLines),t.value=n,(0,d.createElement)("text",t);var o=p({},h.text,t.style),r=e.numberOfLines;return r&&(1===parseInt(r)?o.whiteSpace="nowrap":(o.display="-webkit-box",o.webkitBoxOrient="vertical",o.webkitLineClamp=String(r)),o.overflow="hidden"),(0,d.createElement)("span",p({},t,{style:o}),n)},i.renderRichText=function(){var e=i.props,t=e.children,n=p({},e,{style:e.style||{}}),o=p({},h.richtext,n.style);return m.isWeex&&(t=u(t,i)),(0,d.createElement)("p",p({},n,{style:o}),t)},l=n,r(i,l)}return i(t,e),y(t,[{key:"getChildContext",value:function(){return{isInAParentText:!0}}},{key:"render",value:function(){var e=this.props,t=e.children;Array.isArray(t)||(t=[t]);for(var n=!1,o=0;o<t.length;o++){var r=t[o];if(r&&"object"===(void 0===r?"undefined":f(r))){n=!0;break}}return n?this.renderRichText():this.renderText()}}]),t}(d.Component),c.propTypes={},c.contextTypes={isInAParentText:d.PropTypes.bool},c.childContextTypes={isInAParentText:d.PropTypes.bool},s),h={text:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"block",flexDirection:"column",alignContent:"flex-start",flexShrink:0,fontSize:32},richtext:{marginTop:0,marginBottom:0}};t.default=b,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(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)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=n(2),d=function(e){return e&&e.__esModule?e:{default:e}}(y),m=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=c({},this.props),t=e.source;if(t&&t.uri){var n=e.style,o=t.width,r=t.height,i=t.uri;null==o&&null==r&&null==n.height&&null==n.width&&(o=0,r=0),e.style=c(c({},!this.context.isInAParentText&&{display:"flex"},{width:o,height:r}),n),e.src=i,delete e.source;var l=void 0;l=p.isWeex?"image":"img";var u=e.resizeMode||e.style.resizeMode;return u&&(p.isWeex?(e.resize=u,e.style.resizeMode=u):e.style.objectFit=u),this.props.children?(e.children=null,(0,f.createElement)(d.default,{style:e.style},(0,f.createElement)(l,e),(0,f.createElement)(d.default,{style:b.absoluteImage},this.props.children))):(0,f.createElement)(l,e)}return null}}]),t}(f.Component),u.propTypes={},u.resizeMode={contain:"contain",cover:"cover",stretch:"stretch",center:"center",repeat:"repeat"},u.contextTypes={isInAParentText:f.PropTypes.bool},a),b={absoluteImage:{left:0,top:0,position:"absolute"}};t.default=m,e.exports=t.default}])}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("rax-countdown",function(t,n,o){o.exports=e()});else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,t.RaxCountdown=e()}}(function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t){e.exports=function(){var e;if(!e)try{e=require("rax")}catch(e){}return e}()},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)};t.isWeb="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),t.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),t.isWeex="function"==typeof callNative,t.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(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)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=this.props;if(p.isWeex)return(0,f.createElement)("div",e);var t=c({},d.initial,e.style);return(0,f.createElement)("div",c({},e,{style:t}))}}]),t}(f.Component),u.propTypes={},a),d={initial:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"flex",flexDirection:"column",alignContent:"flex-start",flexShrink:0}};t.default=y,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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}function l(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)}function u(e){return e&&"[object Function]"==={}.toString.call(e)}function a(e,t,n,o,r,i){var l=e<0?0:e,u=l<10?0:l.toString().slice(0,1),a=l<10?l:l.toString().slice(1);return(0,p.createElement)(b.default,{style:[t,x.item]},n?(0,p.createElement)(v.default,{source:n,style:o}):null,(0,p.createElement)(d.default,{style:r},""+u),(0,p.createElement)(d.default,{style:i},""+a))}Object.defineProperty(t,"__esModule",{value:!0});var c,s,f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=n(0),y=n(4),d=o(y),m=n(2),b=o(m),h=n(5),v=o(h),g=(s=c=function(e){function t(){var e,n,o,l;r(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.state={timeRemaining:0},o.timeoutId=0,o.tick=function(){var e=o.props,t=e.onComplete,n=e.onTick,r=e.interval,i=o.state.timeRemaining,l=1e3>i;o.timeoutId&&clearTimeout(o.timeoutId),l&&u(t)?t():o.timeoutId=!l&&setTimeout(function(){return o.setState({timeRemaining:i-r},function(){return u(n)&&n(i)})},r)},l=n,i(o,l)}return l(t,e),f(t,[{key:"componentWillMount",value:function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})}},{key:"componentDidMount",value:function(){this.tick()}},{key:"componentDidUpdate",value:function(){this.tick()}},{key:"componentWillReceiveProps",value:function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}},{key:"componentWillUnmount",value:function(){this.timeoutId&&clearTimeout(this.timeoutId)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}},{key:"render",value:function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,o=t.timeStyle,r=t.timeBackgroundStyle,i=t.timeWrapStyle,l=t.timeBackground,u=t.secondStyle,c=t.textStyle,s=t.tpl;if(n)return n(e);var f=Math.floor(e/1e3),y=parseInt(f/3600/24),m=parseInt(f/3600)%24,h=parseInt(f/60)%60,v=parseInt(f%60),g=[x.background,r],w=new RegExp("{d}").test(s),S=new RegExp("{h}").test(s),O=new RegExp("{m}").test(s),P=new RegExp("{s}").test(s),j=s.indexOf("d"),_=s.indexOf("h"),T=s.indexOf("m"),k=s.indexOf("s");return(0,p.createElement)(b.default,{style:x.main},w?a(y,i,l,g,o,o):null,w?(0,p.createElement)(d.default,{style:c},s.slice(j+2,j+3)):null,S?a(m,i,l,g,o,o):null,S?(0,p.createElement)(d.default,{style:c},s.slice(_+2,_+3)):null,O?a(h,i,l,g,o,o):null,O?(0,p.createElement)(d.default,{style:c},s.slice(T+2,T+3)):null,P?a(v,i,l,g,o,u):null,P?(0,p.createElement)(d.default,{style:c},s.slice(k+2,k+3)):null)}}]),t}(p.Component),c.propTypes={formatFunc:p.PropTypes.func,onTick:p.PropTypes.func,onComplete:p.PropTypes.func,tpl:p.PropTypes.string,timeRemaining:p.PropTypes.number,secondStyle:p.PropTypes.object,timeStyle:p.PropTypes.object,textStyle:p.PropTypes.object,timeWrapStyle:p.PropTypes.object,timeBackground:p.PropTypes.string,timeBackgroundStyle:p.PropTypes.object,interval:p.PropTypes.number},c.defaultProps={tpl:"{d}天{h}时{m}分{s}秒",timeRemaining:0,interval:1e3},s),x={main:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},item:{flexDirection:"row"},background:{position:"absolute"}};t.default=g,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(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)}function l(e,t){var n=e.type,o=e.props,r=o.children;if("function"==typeof n){var i=new n;return i.props=o,r&&(i.props.children=u(r,t)),i.context=t.getChildContext(),i.render()}return e}function u(e,t){var n=[];Array.isArray(e)||(e=[e]);for(var o=0;o<e.length;o++){var r=e[o];"string"==typeof r?n.push(r):"object"===(void 0===r?"undefined":f(r))&&n.push(l(r,t))}return n}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var c,s,f="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),d=n(0),m=n(1),b=(s=c=function(e){function t(){var e,n,i,l;o(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=i=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.renderText=function(){var e=i.props,t=p({},e,{style:e.style||{}}),n="";if(null!=e.children&&(n=Array.isArray(e.children)?e.children.join(""):e.children.toString()),i.context.isInAParentText)return(0,d.createElement)("span",t,n);if(e.onPress&&(t.onClick=e.onPress),m.isWeex)return e.numberOfLines&&(t.style.lines=e.numberOfLines),t.value=n,(0,d.createElement)("text",t);var o=p({},h.text,t.style),r=e.numberOfLines;return r&&(1===parseInt(r)?o.whiteSpace="nowrap":(o.display="-webkit-box",o.webkitBoxOrient="vertical",o.webkitLineClamp=String(r)),o.overflow="hidden"),(0,d.createElement)("span",p({},t,{style:o}),n)},i.renderRichText=function(){var e=i.props,t=e.children,n=p({},e,{style:e.style||{}}),o=p({},h.richtext,n.style);return m.isWeex&&(t=u(t,i)),(0,d.createElement)("p",p({},n,{style:o}),t)},l=n,r(i,l)}return i(t,e),y(t,[{key:"getChildContext",value:function(){return{isInAParentText:!0}}},{key:"render",value:function(){var e=this.props,t=e.children;Array.isArray(t)||(t=[t]);for(var n=!1,o=0;o<t.length;o++){var r=t[o];if(r&&"object"===(void 0===r?"undefined":f(r))){n=!0;break}}return n?this.renderRichText():this.renderText()}}]),t}(d.Component),c.propTypes={},c.contextTypes={isInAParentText:d.PropTypes.bool},c.childContextTypes={isInAParentText:d.PropTypes.bool},s),h={text:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"block",flexDirection:"column",alignContent:"flex-start",flexShrink:0,fontSize:32},richtext:{marginTop:0,marginBottom:0}};t.default=b,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(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)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=n(2),d=function(e){return e&&e.__esModule?e:{default:e}}(y),m=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=c({},this.props),t=e.source;if(t&&t.uri){var n=e.style,o=t.width,r=t.height,i=t.uri;null==o&&null==r&&null==n.height&&null==n.width&&(o=0,r=0),e.style=c(c({},!this.context.isInAParentText&&{display:"flex"},{width:o,height:r}),n),e.src=i,delete e.source;var l=void 0;l=p.isWeex?"image":"img";var u=e.resizeMode||e.style.resizeMode;return u&&(p.isWeex?(e.resize=u,e.style.resizeMode=u):e.style.objectFit=u),this.props.children?(e.children=null,(0,f.createElement)(d.default,{style:e.style},(0,f.createElement)(l,e),(0,f.createElement)(d.default,{style:b.absoluteImage},this.props.children))):(0,f.createElement)(l,e)}return null}}]),t}(f.Component),u.propTypes={},u.resizeMode={contain:"contain",cover:"cover",stretch:"stretch",center:"center",repeat:"repeat"},u.contextTypes={isInAParentText:f.PropTypes.bool},a),b={absoluteImage:{left:0,top:0,position:"absolute"}};t.default=m,e.exports=t.default}])}); |
{ | ||
"name": "rax-countdown", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Countdown component for Rax.", | ||
@@ -24,5 +24,5 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"rax-image": "^0.4.0", | ||
"rax-text": "^0.4.0", | ||
"rax-view": "^0.4.0" | ||
"rax-image": "^0.4.1", | ||
"rax-text": "^0.4.1", | ||
"rax-view": "^0.4.1" | ||
}, | ||
@@ -33,4 +33,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"rax-test-renderer": "^0.4.0" | ||
"rax-test-renderer": "^0.4.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
186456
Updatedrax-image@^0.4.1
Updatedrax-text@^0.4.1
Updatedrax-view@^0.4.1