rc-checkbox
Advanced tools
Comparing version 1.3.2 to 1.3.3
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -9,23 +9,23 @@ }); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _react = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _react2 = _interopRequireDefault(_react); | ||
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 _classnames2 = require('classnames'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _classnames3 = _interopRequireDefault(_classnames2); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _react = require('react'); | ||
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 _react2 = _interopRequireDefault(_react); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _classnames2 = require('classnames'); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var _classnames3 = _interopRequireDefault(_classnames2); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Checkbox = (function (_React$Component) { | ||
var Checkbox = function (_React$Component) { | ||
_inherits(Checkbox, _React$Component); | ||
@@ -36,4 +36,5 @@ | ||
_get(Object.getPrototypeOf(Checkbox.prototype), 'constructor', this).call(this, props); | ||
this.handleChange = this.handleChange.bind(this); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Checkbox).call(this, props)); | ||
_this.handleChange = _this.handleChange.bind(_this); | ||
var checked = false; | ||
@@ -45,3 +46,6 @@ if ('checked' in props) { | ||
} | ||
this.state = { checked: checked }; | ||
_this.state = { | ||
checked: checked | ||
}; | ||
return _this; | ||
} | ||
@@ -84,3 +88,8 @@ | ||
var props = this.props; | ||
var props = _extends({}, this.props); | ||
// Remove React warning. | ||
// Warning: Input elements must be either controlled or uncontrolled | ||
// (specify either the value prop, or the defaultValue prop, but not both). | ||
delete props.defaultChecked; | ||
var prefixCls = props.prefixCls; | ||
@@ -91,10 +100,11 @@ var checked = this.state.checked; | ||
} | ||
var className = (0, _classnames3['default'])((_classnames = {}, _defineProperty(_classnames, props.className, !!props.className), _defineProperty(_classnames, prefixCls, 1), _defineProperty(_classnames, prefixCls + '-checked', checked), _defineProperty(_classnames, prefixCls + '-checked-' + checked, !!checked), _defineProperty(_classnames, prefixCls + '-disabled', props.disabled), _classnames)); | ||
return _react2['default'].createElement( | ||
var className = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, props.className, !!props.className), _defineProperty(_classnames, prefixCls, 1), _defineProperty(_classnames, prefixCls + '-checked', checked), _defineProperty(_classnames, prefixCls + '-checked-' + checked, !!checked), _defineProperty(_classnames, prefixCls + '-disabled', props.disabled), _classnames)); | ||
return _react2["default"].createElement( | ||
'span', | ||
{ className: className, | ||
style: props.style }, | ||
_react2['default'].createElement('span', { className: prefixCls + '-inner' }), | ||
_react2['default'].createElement('input', _extends({}, props, { | ||
defaultChecked: !!props.defaultChecked, | ||
{ | ||
className: className, | ||
style: props.style | ||
}, | ||
_react2["default"].createElement('span', { className: prefixCls + '-inner' }), | ||
_react2["default"].createElement('input', _extends({}, props, { | ||
className: prefixCls + '-input', | ||
@@ -109,14 +119,15 @@ checked: !!checked, | ||
return Checkbox; | ||
})(_react2['default'].Component); | ||
}(_react2["default"].Component); | ||
exports['default'] = Checkbox; | ||
exports["default"] = Checkbox; | ||
Checkbox.propTypes = { | ||
prefixCls: _react2['default'].PropTypes.string, | ||
style: _react2['default'].PropTypes.object, | ||
type: _react2['default'].PropTypes.string, | ||
className: _react2['default'].PropTypes.string, | ||
defaultChecked: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.bool]), | ||
checked: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.bool]), | ||
onChange: _react2['default'].PropTypes.func | ||
prefixCls: _react2["default"].PropTypes.string, | ||
style: _react2["default"].PropTypes.object, | ||
type: _react2["default"].PropTypes.string, | ||
className: _react2["default"].PropTypes.string, | ||
defaultChecked: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.bool]), | ||
checked: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.bool]), | ||
onChange: _react2["default"].PropTypes.func | ||
}; | ||
@@ -123,0 +134,0 @@ |
{ | ||
"name": "rc-checkbox", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "checkbox ui component for react", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"gh-pages": "rc-tools run gh-pages", | ||
"start": "rc-server", | ||
"start": "rc-tools run server", | ||
"pub": "rc-tools run pub", | ||
@@ -37,4 +37,5 @@ "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" | ||
"test": "rc-tools run test", | ||
"chrome-test": "rc-tools run chrome-test", | ||
"coverage": "rc-tools run coverage" | ||
}, | ||
@@ -44,4 +45,3 @@ "devDependencies": { | ||
"pre-commit": "1.x", | ||
"rc-server": "3.x", | ||
"rc-tools": "4.x", | ||
"rc-tools": "5.x", | ||
"react": "~0.14.0", | ||
@@ -48,0 +48,0 @@ "react-addons-test-utils": "^0.14.0", |
@@ -10,3 +10,2 @@ # rc-checkbox | ||
[![gemnasium deps][gemnasium-image]][gemnasium-url] | ||
[![node version][node-image]][node-url] | ||
[![npm download][download-image]][download-url] | ||
@@ -27,10 +26,2 @@ | ||
## Screenshots | ||
## Feature | ||
* support ie8,ie8+,chrome,firefox,safari | ||
## install | ||
@@ -116,10 +107,18 @@ | ||
http://localhost:8001/tests/runner.html?coverage | ||
``` | ||
npm test | ||
npm run chrome-test | ||
``` | ||
## Coverage | ||
http://localhost:8001/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8001/tests/runner.html?coverage | ||
``` | ||
npm run coverage | ||
``` | ||
open coverage/ dir | ||
## License | ||
rc-checkbox is released under the MIT license. |
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
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
6
277
0
14189
122