rc-notification
Advanced tools
Comparing version 1.3.2 to 1.3.3
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Notification = require('./Notification'); | ||
@@ -13,3 +11,5 @@ | ||
exports['default'] = _Notification2['default']; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
exports["default"] = _Notification2["default"]; | ||
module.exports = exports['default']; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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; } | ||
var _react = require('react'); | ||
@@ -19,9 +15,13 @@ | ||
var Notice = _react2['default'].createClass({ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
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; } | ||
var Notice = _react2["default"].createClass({ | ||
displayName: 'Notice', | ||
propTypes: { | ||
duration: _react2['default'].PropTypes.number, | ||
onClose: _react2['default'].PropTypes.func, | ||
children: _react2['default'].PropTypes.any | ||
duration: _react2["default"].PropTypes.number, | ||
onClose: _react2["default"].PropTypes.func, | ||
children: _react2["default"].PropTypes.any | ||
}, | ||
@@ -32,2 +32,3 @@ | ||
onEnd: function onEnd() {}, | ||
duration: 1.5, | ||
@@ -39,3 +40,2 @@ style: { | ||
}, | ||
componentDidMount: function componentDidMount() { | ||
@@ -51,11 +51,8 @@ var _this = this; | ||
}, | ||
componentDidUpdate: function componentDidUpdate() { | ||
this.componentDidMount(); | ||
}, | ||
componentWillUnmount: function componentWillUnmount() { | ||
this.clearCloseTimer(); | ||
}, | ||
clearCloseTimer: function clearCloseTimer() { | ||
@@ -67,3 +64,2 @@ if (this.closeTimer) { | ||
}, | ||
close: function close() { | ||
@@ -73,3 +69,2 @@ this.clearCloseTimer(); | ||
}, | ||
render: function render() { | ||
@@ -81,6 +76,6 @@ var _className; | ||
var className = (_className = {}, _defineProperty(_className, '' + componentClass, 1), _defineProperty(_className, componentClass + '-closable', props.closable), _defineProperty(_className, props.className, !!props.className), _className); | ||
return _react2['default'].createElement( | ||
return _react2["default"].createElement( | ||
'div', | ||
{ className: (0, _classnames2['default'])(className), style: props.style }, | ||
_react2['default'].createElement( | ||
{ className: (0, _classnames2["default"])(className), style: props.style }, | ||
_react2["default"].createElement( | ||
'div', | ||
@@ -90,6 +85,6 @@ { className: componentClass + '-content' }, | ||
), | ||
props.closable ? _react2['default'].createElement( | ||
props.closable ? _react2["default"].createElement( | ||
'a', | ||
{ tabIndex: '0', onClick: this.close, className: componentClass + '-close' }, | ||
_react2['default'].createElement('span', { className: componentClass + '-close-x' }) | ||
_react2["default"].createElement('span', { className: componentClass + '-close-x' }) | ||
) : null | ||
@@ -100,3 +95,3 @@ ); | ||
exports['default'] = Notice; | ||
exports["default"] = Notice; | ||
module.exports = exports['default']; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -9,6 +9,2 @@ }); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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; } | ||
var _react = require('react'); | ||
@@ -36,2 +32,6 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
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; } | ||
var seed = 0; | ||
@@ -44,5 +44,4 @@ var now = Date.now(); | ||
var Notification = _react2['default'].createClass({ | ||
var Notification = _react2["default"].createClass({ | ||
displayName: 'Notification', | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -53,3 +52,3 @@ return { | ||
style: { | ||
'top': 65, | ||
top: 65, | ||
left: '50%' | ||
@@ -59,3 +58,2 @@ } | ||
}, | ||
getInitialState: function getInitialState() { | ||
@@ -66,3 +64,2 @@ return { | ||
}, | ||
getTransitionName: function getTransitionName() { | ||
@@ -76,27 +73,27 @@ var props = this.props; | ||
}, | ||
add: function add(notice) { | ||
var key = notice.key = notice.key || getUuid(); | ||
var notices = this.state.notices; | ||
if (!notices.filter(function (v) { | ||
return v.key === key; | ||
}).length) { | ||
this.setState({ | ||
notices: notices.concat(notice) | ||
}); | ||
} | ||
this.setState(function (previousState) { | ||
var notices = previousState.notices; | ||
if (!notices.filter(function (v) { | ||
return v.key === key; | ||
}).length) { | ||
return { | ||
notices: notices.concat(notice) | ||
}; | ||
} | ||
}); | ||
}, | ||
remove: function remove(key) { | ||
var notices = this.state.notices.filter(function (notice) { | ||
return notice.key !== key; | ||
this.setState(function (previousState) { | ||
return { | ||
notices: previousState.notices.filter(function (notice) { | ||
return notice.key !== key; | ||
}) | ||
}; | ||
}); | ||
this.setState({ | ||
notices: notices | ||
}); | ||
}, | ||
render: function render() { | ||
var _className, | ||
_this = this; | ||
var _this = this, | ||
_className; | ||
@@ -106,5 +103,9 @@ var props = this.props; | ||
var onClose = (0, _rcUtil.createChainedFunction)(_this.remove.bind(_this, notice.key), notice.onClose); | ||
return _react2['default'].createElement( | ||
_Notice2['default'], | ||
_extends({ prefixCls: props.prefixCls }, notice, { onClose: onClose }), | ||
return _react2["default"].createElement( | ||
_Notice2["default"], | ||
_extends({ | ||
prefixCls: props.prefixCls | ||
}, notice, { | ||
onClose: onClose | ||
}), | ||
notice.content | ||
@@ -114,7 +115,7 @@ ); | ||
var className = (_className = {}, _defineProperty(_className, props.prefixCls, 1), _defineProperty(_className, props.className, !!props.className), _className); | ||
return _react2['default'].createElement( | ||
return _react2["default"].createElement( | ||
'div', | ||
{ className: (0, _classnames2['default'])(className), style: props.style }, | ||
_react2['default'].createElement( | ||
_rcAnimate2['default'], | ||
{ className: (0, _classnames2["default"])(className), style: props.style }, | ||
_react2["default"].createElement( | ||
_rcAnimate2["default"], | ||
{ transitionName: this.getTransitionName() }, | ||
@@ -131,3 +132,3 @@ noticeNodes | ||
document.body.appendChild(div); | ||
var notification = _reactDom2['default'].render(_react2['default'].createElement(Notification, props), div); | ||
var notification = _reactDom2["default"].render(_react2["default"].createElement(Notification, props), div); | ||
return { | ||
@@ -140,5 +141,6 @@ notice: function notice(noticeProps) { | ||
}, | ||
component: notification, | ||
destroy: function destroy() { | ||
_reactDom2['default'].unmountComponentAtNode(div); | ||
_reactDom2["default"].unmountComponentAtNode(div); | ||
document.body.removeChild(div); | ||
@@ -149,3 +151,3 @@ } | ||
exports['default'] = Notification; | ||
exports["default"] = Notification; | ||
module.exports = exports['default']; |
{ | ||
"name": "rc-notification", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "notification ui component for react", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"gh-pages": "rc-tools run gh-pages", | ||
"start": "rc-server", | ||
"start": "rc-tools run server", | ||
"pub": "rc-tools run pub", | ||
@@ -41,14 +41,13 @@ "lint": "rc-tools run lint", | ||
"saucelabs": "rc-tools run saucelabs", | ||
"browser-test": "rc-tools run browser-test", | ||
"browser-test-cover": "rc-tools run browser-test-cover", | ||
"validate": "npm ls" | ||
"test": "rc-tools run test", | ||
"chrome-test": "rc-tools run chrome-test", | ||
"coverage": "rc-tools run coverage" | ||
}, | ||
"devDependencies": { | ||
"expect.js": "~0.3.1", | ||
"precommit-hook": "~3.0.0", | ||
"rc-server": "~3.3.4", | ||
"rc-tools": "~4.4.1", | ||
"react": "~0.14.3", | ||
"react-addons-test-utils": "^0.14.3", | ||
"react-dom": "~0.14.3" | ||
"pre-commit": "1.x", | ||
"rc-tools": "5.x", | ||
"react": "15.x", | ||
"react-addons-test-utils": "15.x", | ||
"react-dom": "15.x" | ||
}, | ||
@@ -64,6 +63,4 @@ "precommit": [ | ||
"pre-commit": [ | ||
"lint", | ||
"validate", | ||
"test" | ||
"lint" | ||
] | ||
} |
@@ -154,10 +154,17 @@ # rc-notification | ||
http://localhost:8000/tests/runner.html?coverage | ||
``` | ||
npm test | ||
npm run chrome-test | ||
``` | ||
## Coverage | ||
http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage | ||
``` | ||
npm run coverage | ||
``` | ||
open coverage/ dir | ||
## License | ||
rc-notification is released under the MIT license. |
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
6
308
170
15233