Comparing version 1.4.1 to 1.4.2
'use strict'; | ||
var _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; }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
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'); | ||
@@ -9,25 +15,58 @@ | ||
var _classnames = require('classnames'); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
var Step = _react2['default'].createClass({ | ||
displayName: 'Step', | ||
propTypes: { | ||
className: _react2['default'].PropTypes.string, | ||
prefixCls: _react2['default'].PropTypes.string, | ||
style: _react2['default'].PropTypes.object, | ||
tailWidth: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]), | ||
status: _react2['default'].PropTypes.string, | ||
iconPrefix: _react2['default'].PropTypes.string, | ||
icon: _react2['default'].PropTypes.string, | ||
maxDescriptionWidth: _react2['default'].PropTypes.number, | ||
stepLast: _react2['default'].PropTypes.bool, | ||
stepNumber: _react2['default'].PropTypes.string, | ||
description: _react2['default'].PropTypes.any, | ||
title: _react2['default'].PropTypes.any | ||
}, | ||
render: function render() { | ||
var props = this.props; | ||
var status = props.status || 'wait'; | ||
var prefixCls = props.prefixCls; | ||
var iconPrefix = props.iconPrefix; | ||
var maxWidth = props.maxDescriptionWidth; | ||
var iconName = props.icon ? props.icon : 'check'; | ||
var icon = !props.icon && status !== 'finish' ? _react2['default'].createElement( | ||
var _classNames, _classNames2; | ||
var _props = this.props; | ||
var className = _props.className; | ||
var prefixCls = _props.prefixCls; | ||
var style = _props.style; | ||
var tailWidth = _props.tailWidth; | ||
var _props$status = _props.status; | ||
var status = _props$status === undefined ? 'wait' : _props$status; | ||
var iconPrefix = _props.iconPrefix; | ||
var icon = _props.icon; | ||
var maxDescriptionWidth = _props.maxDescriptionWidth; | ||
var stepLast = _props.stepLast; | ||
var stepNumber = _props.stepNumber; | ||
var description = _props.description; | ||
var title = _props.title; | ||
var restProps = _objectWithoutProperties(_props, ['className', 'prefixCls', 'style', 'tailWidth', 'status', 'iconPrefix', 'icon', 'maxDescriptionWidth', 'stepLast', 'stepNumber', 'description', 'title']); | ||
var iconClassName = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, prefixCls + '-icon', true), _defineProperty(_classNames, iconPrefix + 'icon', true), _defineProperty(_classNames, iconPrefix + 'icon-' + (icon || 'check'), true), _classNames)); | ||
var iconNode = icon || status === 'finish' ? _react2['default'].createElement('span', { className: iconClassName }) : _react2['default'].createElement( | ||
'span', | ||
{ className: prefixCls + '-icon' }, | ||
props.stepNumber | ||
) : _react2['default'].createElement('span', { className: prefixCls + '-icon ' + iconPrefix + 'icon ' + iconPrefix + 'icon-' + iconName }); | ||
stepNumber | ||
); | ||
var classString = (0, _classnames2['default'])((_classNames2 = {}, _defineProperty(_classNames2, className, !!className), _defineProperty(_classNames2, prefixCls + '-item', true), _defineProperty(_classNames2, prefixCls + '-item-last', stepLast), _defineProperty(_classNames2, prefixCls + '-status-' + status, true), _defineProperty(_classNames2, prefixCls + '-custom', icon), _classNames2)); | ||
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 ? _react2['default'].createElement( | ||
_extends({}, restProps, { className: classString, style: { width: tailWidth } }), | ||
stepLast ? '' : _react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-tail' }, | ||
_react2['default'].createElement('i', null) | ||
) : '', | ||
), | ||
_react2['default'].createElement( | ||
@@ -39,3 +78,3 @@ 'div', | ||
{ className: prefixCls + '-head-inner' }, | ||
icon | ||
iconNode | ||
) | ||
@@ -45,12 +84,12 @@ ), | ||
'div', | ||
{ className: prefixCls + '-main', style: { maxWidth: maxWidth } }, | ||
{ className: prefixCls + '-main', style: { maxWidth: maxDescriptionWidth } }, | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-title' }, | ||
props.title | ||
title | ||
), | ||
props.description ? _react2['default'].createElement( | ||
description ? _react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-description' }, | ||
props.description | ||
description | ||
) : '' | ||
@@ -57,0 +96,0 @@ ) |
{ | ||
"name": "rc-steps", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "steps ui component for react", | ||
@@ -56,3 +56,6 @@ "keywords": [ | ||
"lint" | ||
] | ||
], | ||
"dependencies": { | ||
"classnames": "^2.2.3" | ||
} | ||
} |
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
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
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
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
26988
929
1
1
+ Addedclassnames@^2.2.3
+ Addedclassnames@2.5.1(transitive)