rax-countdown
Advanced tools
Comparing version 1.0.1 to 1.0.2-0
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -18,6 +18,10 @@ var _rax = require("rax"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -33,12 +37,12 @@ | ||
var displaySecondNum = displayNum < 10 ? displayNum : displayNum.toString().slice(1); | ||
return (0, _rax.createElement)(_raxView.default, { | ||
return (0, _rax.createElement)(_raxView["default"], { | ||
className: "item", | ||
style: _extends({}, _index.default.item, {}, timeWrapStyle) | ||
}, timeBackground ? (0, _rax.createElement)(_raxImage.default, { | ||
style: _extends({}, _index["default"].item, {}, timeWrapStyle) | ||
}, timeBackground ? (0, _rax.createElement)(_raxImage["default"], { | ||
className: "background", | ||
source: timeBackground, | ||
style: _extends({}, _index.default.background, {}, timeBackgroundStyle) | ||
}) : null, (0, _rax.createElement)(_raxText.default, { | ||
style: _extends({}, _index["default"].background, {}, timeBackgroundStyle) | ||
}) : null, (0, _rax.createElement)(_raxText["default"], { | ||
style: timeStyle | ||
}, '' + displayFirstNum), (0, _rax.createElement)(_raxText.default, { | ||
}, '' + displayFirstNum), (0, _rax.createElement)(_raxText["default"], { | ||
style: secondStyle | ||
@@ -61,8 +65,10 @@ }, '' + displaySecondNum)); | ||
_this = _Component.call.apply(_Component, [this].concat(args)) || this; | ||
_this.state = { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
timeRemaining: 0 | ||
}; | ||
_this.timeoutId = 0; | ||
}); | ||
_this.tick = function () { | ||
_defineProperty(_assertThisInitialized(_this), "timeoutId", 0); | ||
_defineProperty(_assertThisInitialized(_this), "tick", function () { | ||
var _this$props = _this.props, | ||
@@ -90,3 +96,3 @@ onComplete = _this$props.onComplete, | ||
} | ||
}; | ||
}); | ||
@@ -177,5 +183,5 @@ return _this; | ||
var lastPlaintextIndex = 0; | ||
return (0, _rax.createElement)(_raxView.default, { | ||
return (0, _rax.createElement)(_raxView["default"], { | ||
className: "main", | ||
style: _index.default.main | ||
style: _index["default"].main | ||
}, matchlist.map(function (val, index) { | ||
@@ -185,3 +191,3 @@ if (val === -1) { | ||
var lastPlaintext = tpl.slice(lastPlaintextIndex); | ||
return lastPlaintext ? (0, _rax.createElement)(_raxText.default, { | ||
return lastPlaintext ? (0, _rax.createElement)(_raxText["default"], { | ||
style: textStyle | ||
@@ -200,3 +206,3 @@ }, lastPlaintext) : null; | ||
// insert plain text before current matched item | ||
return (0, _rax.createElement)(_raxText.default, { | ||
return (0, _rax.createElement)(_raxText["default"], { | ||
style: textStyle | ||
@@ -219,27 +225,29 @@ }, tpl.slice(lastPlaintextIndex, val)); | ||
Index.propTypes = { | ||
formatFunc: _propTypes.default.func, | ||
onTick: _propTypes.default.func, | ||
onComplete: _propTypes.default.func, | ||
tpl: _propTypes.default.string, | ||
_defineProperty(Index, "propTypes", { | ||
formatFunc: _propTypes["default"].func, | ||
onTick: _propTypes["default"].func, | ||
onComplete: _propTypes["default"].func, | ||
tpl: _propTypes["default"].string, | ||
// template (example {h}:{m}:{s}) | ||
timeRemaining: _propTypes.default.number, | ||
secondStyle: _propTypes.default.object, | ||
timeStyle: _propTypes.default.object, | ||
timeRemaining: _propTypes["default"].number, | ||
secondStyle: _propTypes["default"].object, | ||
timeStyle: _propTypes["default"].object, | ||
// style for num | ||
textStyle: _propTypes.default.object, | ||
textStyle: _propTypes["default"].object, | ||
// style for text | ||
timeWrapStyle: _propTypes.default.object, | ||
timeBackground: _propTypes.default.shape({ | ||
uri: _propTypes.default.string | ||
timeWrapStyle: _propTypes["default"].object, | ||
timeBackground: _propTypes["default"].shape({ | ||
uri: _propTypes["default"].string | ||
}), | ||
timeBackgroundStyle: _propTypes.default.object, | ||
interval: _propTypes.default.number | ||
}; | ||
Index.defaultProps = { | ||
timeBackgroundStyle: _propTypes["default"].object, | ||
interval: _propTypes["default"].number | ||
}); | ||
_defineProperty(Index, "defaultProps", { | ||
tpl: '{d}天{h}时{m}分{s}秒', | ||
timeRemaining: 0, | ||
interval: 1000 | ||
}; | ||
}); | ||
var _default = Index; | ||
exports.default = _default; | ||
exports["default"] = _default; |
{ | ||
"name": "rax-countdown", | ||
"version": "1.0.1", | ||
"version": "1.0.2-0", | ||
"description": "Countdown component for Rax.", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
23891
325
1
1