Comparing version 1.3.3 to 1.4.0
# History | ||
---- | ||
## 1.4 | ||
* update react to 0.14 | ||
## 1.3 | ||
@@ -5,0 +9,0 @@ |
'use strict'; | ||
var React = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var Step = React.createClass({ | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var Step = _react2['default'].createClass({ | ||
displayName: 'Step', | ||
@@ -15,19 +19,19 @@ | ||
var iconName = props.icon ? props.icon : 'check'; | ||
var icon = !props.icon && status !== 'finish' ? React.createElement( | ||
var icon = !props.icon && status !== 'finish' ? _react2['default'].createElement( | ||
'span', | ||
{ className: prefixCls + '-icon' }, | ||
props.stepNumber | ||
) : React.createElement('span', { className: prefixCls + '-icon ' + iconPrefix + 'icon ' + iconPrefix + 'icon-' + iconName }); | ||
return React.createElement( | ||
) : _react2['default'].createElement('span', { className: prefixCls + '-icon ' + iconPrefix + 'icon ' + iconPrefix + 'icon-' + iconName }); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-item ' + (props.stepLast ? prefixCls + '-item-last ' : '') + prefixCls + '-status-' + status + (props.icon ? ' ' + prefixCls + '-custom' : ''), style: { width: props.tailWidth } }, | ||
!props.stepLast ? React.createElement( | ||
!props.stepLast ? _react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-tail' }, | ||
React.createElement('i', null) | ||
_react2['default'].createElement('i', null) | ||
) : '', | ||
React.createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-head' }, | ||
React.createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
@@ -38,6 +42,6 @@ { className: prefixCls + '-head-inner' }, | ||
), | ||
React.createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-main', style: { maxWidth: maxWidth } }, | ||
React.createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
@@ -47,3 +51,3 @@ { className: prefixCls + '-title' }, | ||
), | ||
props.description ? React.createElement( | ||
props.description ? _react2['default'].createElement( | ||
'div', | ||
@@ -50,0 +54,0 @@ { className: prefixCls + '-description' }, |
'use strict'; | ||
var React = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var Steps = React.createClass({ | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _reactDom = require('react-dom'); | ||
var _reactDom2 = _interopRequireDefault(_reactDom); | ||
var Steps = _react2['default'].createClass({ | ||
displayName: 'Steps', | ||
_previousStepsWidth: 0, | ||
_itemsWidth: [], | ||
getInitialState: function getInitialState() { | ||
return { | ||
init: false, | ||
tailWidth: 0 | ||
}; | ||
propTypes: { | ||
direction: _react2['default'].PropTypes.string, | ||
children: _react2['default'].PropTypes.any | ||
}, | ||
@@ -25,2 +29,8 @@ getDefaultProps: function getDefaultProps() { | ||
}, | ||
getInitialState: function getInitialState() { | ||
return { | ||
init: false, | ||
tailWidth: 0 | ||
}; | ||
}, | ||
componentDidMount: function componentDidMount() { | ||
@@ -30,7 +40,7 @@ if (this.props.direction === 'vertical') { | ||
} | ||
var $dom = React.findDOMNode(this); | ||
var $dom = _reactDom2['default'].findDOMNode(this); | ||
var len = $dom.children.length - 1; | ||
var i; | ||
this._itemsWidth = new Array(len + 1); | ||
var i = undefined; | ||
for (i = 0; i <= len - 1; i++) { | ||
@@ -41,3 +51,3 @@ var $item = $dom.children[i].children; | ||
this._itemsWidth[i] = Math.ceil($dom.children[len].offsetWidth); | ||
this._previousStepsWidth = Math.floor(React.findDOMNode(this).offsetWidth); | ||
this._previousStepsWidth = Math.floor(_reactDom2['default'].findDOMNode(this).offsetWidth); | ||
this._update(); | ||
@@ -67,2 +77,5 @@ | ||
}, | ||
componentDidUpdate: function componentDidUpdate() { | ||
this._resize(); | ||
}, | ||
componentWillUnmount: function componentWillUnmount() { | ||
@@ -78,7 +91,6 @@ if (this.props.direction === 'vertical') { | ||
}, | ||
componentDidUpdate: function componentDidUpdate() { | ||
this._resize(); | ||
}, | ||
_previousStepsWidth: 0, | ||
_itemsWidth: [], | ||
_resize: function _resize() { | ||
var w = Math.floor(React.findDOMNode(this).offsetWidth); | ||
var w = Math.floor(_reactDom2['default'].findDOMNode(this).offsetWidth); | ||
if (this._previousStepsWidth === w) { | ||
@@ -117,6 +129,6 @@ return; | ||
return React.createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: clsName }, | ||
React.Children.map(children, function (ele, idx) { | ||
_react2['default'].Children.map(children, function (ele, idx) { | ||
var np = { | ||
@@ -131,5 +143,11 @@ stepNumber: (idx + 1).toString(), | ||
if (!ele.props.status) { | ||
np.status = idx === props.current ? 'process' : idx < props.current ? 'finish' : 'wait'; | ||
if (idx === props.current) { | ||
np.status = 'process'; | ||
} else if (idx < props.current) { | ||
np.status = 'finish'; | ||
} else { | ||
np.status = 'wait'; | ||
} | ||
} | ||
return React.cloneElement(ele, np); | ||
return _react2['default'].cloneElement(ele, np); | ||
}, this) | ||
@@ -136,0 +154,0 @@ ); |
{ | ||
"name": "rc-steps", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "steps ui component for react", | ||
@@ -31,3 +31,2 @@ "keywords": [ | ||
"build": "rc-tools run build", | ||
"precommit": "rc-tools run precommit", | ||
"less": "rc-tools run less", | ||
@@ -48,8 +47,9 @@ "gh-pages": "rc-tools run gh-pages", | ||
"rc-server": "3.x", | ||
"rc-tools": "3.x", | ||
"react": "0.13.x" | ||
"rc-tools": "~4.2.6", | ||
"react": "~0.14.0", | ||
"react-dom": "~0.14.0" | ||
}, | ||
"precommit": [ | ||
"precommit" | ||
"lint" | ||
] | ||
} |
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
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
9253
6
6
192
1