Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-steps

Package Overview
Dependencies
Maintainers
8
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-steps - npm Package Compare versions

Comparing version 3.6.0 to 4.0.0

es/index.d.ts

1

es/index.js
import Steps from './Steps';
import Step from './Step';
Steps.Step = Step;
export { Step };
export default Steps;

@@ -1,2 +0,8 @@

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); }
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";

@@ -7,28 +13,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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; }
/* eslint react/prop-types: 0 */

@@ -52,9 +36,5 @@ import React from 'react';

for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _super.apply(this, arguments);
_this = _super.call.apply(_super, [this].concat(_args));
_defineProperty(_assertThisInitialized(_this), "onClick", function () {
_this.onClick = function () {
var _this$props = _this.props,

@@ -70,3 +50,3 @@ onClick = _this$props.onClick,

onStepClick(stepIndex);
});
};

@@ -93,3 +73,3 @@ return _this;

var iconClassName = classNames("".concat(prefixCls, "-icon"), "".concat(iconPrefix, "icon"), (_classNames = {}, _defineProperty(_classNames, "".concat(iconPrefix, "icon-").concat(icon), icon && isString(icon)), _defineProperty(_classNames, "".concat(iconPrefix, "icon-check"), !icon && status === 'finish' && (icons && !icons.finish || !icons)), _defineProperty(_classNames, "".concat(iconPrefix, "icon-cross"), !icon && status === 'error' && (icons && !icons.error || !icons)), _classNames));
var iconDot = /*#__PURE__*/React.createElement("span", {
var iconDot = React.createElement("span", {
className: "".concat(prefixCls, "-icon-dot")

@@ -100,3 +80,3 @@ }); // `progressDot` enjoy the highest priority

if (typeof progressDot === 'function') {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -110,3 +90,3 @@ }, progressDot(iconDot, {

} else {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -116,19 +96,19 @@ }, iconDot);

} else if (icon && !isString(icon)) {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icon);
} else if (icons && icons.finish && status === 'finish') {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icons.finish);
} else if (icons && icons.error && status === 'error') {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icons.error);
} else if (icon || status === 'finish' || status === 'error') {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: iconClassName
});
} else {
iconNode = /*#__PURE__*/React.createElement("span", {
iconNode = React.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -149,3 +129,2 @@ }, stepNumber);

style = _this$props3.style,
itemWidth = _this$props3.itemWidth,
active = _this$props3.active,

@@ -157,3 +136,2 @@ _this$props3$status = _this$props3.status,

wrapperStyle = _this$props3.wrapperStyle,
adjustMarginRight = _this$props3.adjustMarginRight,
stepNumber = _this$props3.stepNumber,

@@ -170,3 +148,3 @@ disabled = _this$props3.disabled,

onClick = _this$props3.onClick,
restProps = _objectWithoutProperties(_this$props3, ["className", "prefixCls", "style", "itemWidth", "active", "status", "iconPrefix", "icon", "wrapperStyle", "adjustMarginRight", "stepNumber", "disabled", "description", "title", "subTitle", "progressDot", "tailContent", "icons", "stepIndex", "onStepClick", "onClick"]);
restProps = _objectWithoutProperties(_this$props3, ["className", "prefixCls", "style", "active", "status", "iconPrefix", "icon", "wrapperStyle", "stepNumber", "disabled", "description", "title", "subTitle", "progressDot", "tailContent", "icons", "stepIndex", "onStepClick", "onClick"]);

@@ -177,10 +155,2 @@ var classString = classNames("".concat(prefixCls, "-item"), "".concat(prefixCls, "-item-").concat(status), className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-item-custom"), icon), _defineProperty(_classNames2, "".concat(prefixCls, "-item-active"), active), _defineProperty(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled === true), _classNames2));

if (itemWidth) {
stepItemStyle.width = itemWidth;
}
if (adjustMarginRight) {
stepItemStyle.marginRight = adjustMarginRight;
}
var accessibilityProps = {};

@@ -194,21 +164,21 @@

return /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
return React.createElement("div", Object.assign({}, restProps, {
className: classString,
style: stepItemStyle
}), /*#__PURE__*/React.createElement("div", _extends({
}), React.createElement("div", Object.assign({
onClick: onClick
}, accessibilityProps, {
className: "".concat(prefixCls, "-item-container")
}), /*#__PURE__*/React.createElement("div", {
}), React.createElement("div", {
className: "".concat(prefixCls, "-item-tail")
}, tailContent), /*#__PURE__*/React.createElement("div", {
}, tailContent), React.createElement("div", {
className: "".concat(prefixCls, "-item-icon")
}, this.renderIconNode()), /*#__PURE__*/React.createElement("div", {
}, this.renderIconNode()), React.createElement("div", {
className: "".concat(prefixCls, "-item-content")
}, /*#__PURE__*/React.createElement("div", {
}, React.createElement("div", {
className: "".concat(prefixCls, "-item-title")
}, title, subTitle && /*#__PURE__*/React.createElement("div", {
}, title, subTitle && React.createElement("div", {
title: typeof subTitle === 'string' ? subTitle : undefined,
className: "".concat(prefixCls, "-item-subtitle")
}, subTitle)), description && /*#__PURE__*/React.createElement("div", {
}, subTitle)), description && React.createElement("div", {
className: "".concat(prefixCls, "-item-description")

@@ -215,0 +185,0 @@ }, description))));

@@ -1,2 +0,8 @@

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); }
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";

@@ -7,224 +13,132 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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; }
/* eslint react/no-did-mount-set-state: 0, react/prop-types: 0 */
import React, { cloneElement, Children, Component } from 'react';
import { findDOMNode } from 'react-dom';
import React, { cloneElement } from 'react';
import toArray from "rc-util/es/Children/toArray";
import classNames from 'classnames';
import debounce from 'lodash/debounce';
import { isFlexSupported } from './utils';
import Step from './Step';
var Steps = /*#__PURE__*/function (_Component) {
_inherits(Steps, _Component);
var Steps =
/** @class */
function () {
var Steps = /*#__PURE__*/function (_React$Component) {
_inherits(Steps, _React$Component);
var _super = _createSuper(Steps);
var _super = _createSuper(Steps);
function Steps(props) {
var _this;
function Steps() {
var _this;
_classCallCheck(this, Steps);
_classCallCheck(this, Steps);
_this = _super.call(this, props);
_this = _super.apply(this, arguments);
_defineProperty(_assertThisInitialized(_this), "onStepClick", function (next) {
var _this$props = _this.props,
onChange = _this$props.onChange,
current = _this$props.current;
_this.onStepClick = function (next) {
var _this$props = _this.props,
onChange = _this$props.onChange,
current = _this$props.current;
if (onChange && current !== next) {
onChange(next);
}
});
_defineProperty(_assertThisInitialized(_this), "calcStepOffsetWidth", function () {
if (isFlexSupported()) {
return;
}
var lastStepOffsetWidth = _this.state.lastStepOffsetWidth; // Just for IE9
var domNode = findDOMNode(_assertThisInitialized(_this));
if (domNode.children.length > 0) {
if (_this.calcTimeout) {
clearTimeout(_this.calcTimeout);
if (onChange && current !== next) {
onChange(next);
}
};
_this.calcTimeout = setTimeout(function () {
// +1 for fit edge bug of digit width, like 35.4px
var offsetWidth = (domNode.lastChild.offsetWidth || 0) + 1; // Reduce shake bug
return _this;
}
if (lastStepOffsetWidth === offsetWidth || Math.abs(lastStepOffsetWidth - offsetWidth) <= 3) {
return;
}
_createClass(Steps, [{
key: "render",
value: function render() {
var _classNames,
_this2 = this;
_this.setState({
lastStepOffsetWidth: offsetWidth
});
});
}
});
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
_this$props2$style = _this$props2.style,
style = _this$props2$style === void 0 ? {} : _this$props2$style,
className = _this$props2.className,
children = _this$props2.children,
direction = _this$props2.direction,
type = _this$props2.type,
labelPlacement = _this$props2.labelPlacement,
iconPrefix = _this$props2.iconPrefix,
status = _this$props2.status,
size = _this$props2.size,
current = _this$props2.current,
progressDot = _this$props2.progressDot,
initial = _this$props2.initial,
icons = _this$props2.icons,
onChange = _this$props2.onChange,
restProps = _objectWithoutProperties(_this$props2, ["prefixCls", "style", "className", "children", "direction", "type", "labelPlacement", "iconPrefix", "status", "size", "current", "progressDot", "initial", "icons", "onChange"]);
_this.state = {
flexSupported: true,
lastStepOffsetWidth: 0
};
_this.calcStepOffsetWidth = debounce(_this.calcStepOffsetWidth, 150);
return _this;
}
_createClass(Steps, [{
key: "componentDidMount",
value: function componentDidMount() {
this.calcStepOffsetWidth();
if (!isFlexSupported()) {
this.setState({
flexSupported: false
var isNav = type === 'navigation';
var filteredChildren = React.Children.toArray(children).filter(function (c) {
return !!c;
});
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.calcStepOffsetWidth();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.calcTimeout) {
clearTimeout(this.calcTimeout);
}
var adjustedLabelPlacement = progressDot ? 'vertical' : labelPlacement;
var classString = classNames(prefixCls, "".concat(prefixCls, "-").concat(direction), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(size), size), _defineProperty(_classNames, "".concat(prefixCls, "-label-").concat(adjustedLabelPlacement), direction === 'horizontal'), _defineProperty(_classNames, "".concat(prefixCls, "-dot"), !!progressDot), _defineProperty(_classNames, "".concat(prefixCls, "-navigation"), isNav), _classNames));
return React.createElement("div", Object.assign({
className: classString,
style: style
}, restProps), toArray(filteredChildren).map(function (child, index) {
if (!child) {
return null;
}
if (this.calcStepOffsetWidth && this.calcStepOffsetWidth.cancel) {
this.calcStepOffsetWidth.cancel();
}
}
}, {
key: "render",
value: function render() {
var _classNames,
_this2 = this;
var stepNumber = initial + index;
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
_this$props2$style = _this$props2.style,
style = _this$props2$style === void 0 ? {} : _this$props2$style,
className = _this$props2.className,
children = _this$props2.children,
direction = _this$props2.direction,
type = _this$props2.type,
labelPlacement = _this$props2.labelPlacement,
iconPrefix = _this$props2.iconPrefix,
status = _this$props2.status,
size = _this$props2.size,
current = _this$props2.current,
progressDot = _this$props2.progressDot,
initial = _this$props2.initial,
icons = _this$props2.icons,
onChange = _this$props2.onChange,
restProps = _objectWithoutProperties(_this$props2, ["prefixCls", "style", "className", "children", "direction", "type", "labelPlacement", "iconPrefix", "status", "size", "current", "progressDot", "initial", "icons", "onChange"]);
var childProps = _objectSpread({
stepNumber: "".concat(stepNumber + 1),
stepIndex: stepNumber,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style,
progressDot: progressDot,
icons: icons,
onStepClick: onChange && _this2.onStepClick
}, child.props); // fix tail color
var isNav = type === 'navigation';
var _this$state = this.state,
lastStepOffsetWidth = _this$state.lastStepOffsetWidth,
flexSupported = _this$state.flexSupported;
var filteredChildren = React.Children.toArray(children).filter(function (c) {
return !!c;
});
var lastIndex = filteredChildren.length - 1;
var adjustedlabelPlacement = progressDot ? 'vertical' : labelPlacement;
var classString = classNames(prefixCls, "".concat(prefixCls, "-").concat(direction), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(size), size), _defineProperty(_classNames, "".concat(prefixCls, "-label-").concat(adjustedlabelPlacement), direction === 'horizontal'), _defineProperty(_classNames, "".concat(prefixCls, "-dot"), !!progressDot), _defineProperty(_classNames, "".concat(prefixCls, "-navigation"), isNav), _defineProperty(_classNames, "".concat(prefixCls, "-flex-not-supported"), !flexSupported), _classNames));
return /*#__PURE__*/React.createElement("div", _extends({
className: classString,
style: style
}, restProps), Children.map(filteredChildren, function (child, index) {
if (!child) {
return null;
}
var stepNumber = initial + index;
if (status === 'error' && index === current - 1) {
childProps.className = "".concat(prefixCls, "-next-error");
}
var childProps = _objectSpread({
stepNumber: "".concat(stepNumber + 1),
stepIndex: stepNumber,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style,
progressDot: progressDot,
icons: icons,
onStepClick: onChange && _this2.onStepClick
}, child.props);
if (!flexSupported && direction !== 'vertical') {
if (isNav) {
childProps.itemWidth = "".concat(100 / (lastIndex + 1), "%");
childProps.adjustMarginRight = 0;
} else if (index !== lastIndex) {
childProps.itemWidth = "".concat(100 / lastIndex, "%");
childProps.adjustMarginRight = -Math.round(lastStepOffsetWidth / lastIndex + 1);
if (!child.props.status) {
if (stepNumber === current) {
childProps.status = status;
} else if (stepNumber < current) {
childProps.status = 'finish';
} else {
childProps.status = 'wait';
}
}
} // fix tail color
childProps.active = stepNumber === current;
return cloneElement(child, childProps);
}));
}
}]);
if (status === 'error' && index === current - 1) {
childProps.className = "".concat(prefixCls, "-next-error");
}
return Steps;
}(React.Component);
if (!child.props.status) {
if (stepNumber === current) {
childProps.status = status;
} else if (stepNumber < current) {
childProps.status = 'finish';
} else {
childProps.status = 'wait';
}
}
childProps.active = stepNumber === current;
return cloneElement(child, childProps);
}));
}
}]);
Steps.Step = Step;
Steps.defaultProps = {
type: 'default',
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
initial: 0,
current: 0,
status: 'process',
size: '',
progressDot: false
};
return Steps;
}(Component);
}();
_defineProperty(Steps, "defaultProps", {
type: 'default',
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
initial: 0,
current: 0,
status: 'process',
size: '',
progressDot: false
});
export { Steps as default };
export default Steps;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,6 +11,6 @@ value: true

get: function get() {
return _Step["default"];
return _Step.default;
}
});
exports["default"] = void 0;
exports.default = void 0;

@@ -19,6 +21,3 @@ var _Steps = _interopRequireDefault(require("./Steps"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
_Steps["default"].Step = _Step["default"];
var _default = _Steps["default"];
exports["default"] = _default;
var _default = _Steps.default;
exports.default = _default;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classnames = _interopRequireDefault(require("classnames"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
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); }
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var _react = _interopRequireDefault(require("react"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _classnames = _interopRequireDefault(require("classnames"));
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); } }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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 isString(str) {

@@ -51,3 +41,3 @@ return typeof str === 'string';

var Step = /*#__PURE__*/function (_React$Component) {
_inherits(Step, _React$Component);
(0, _inherits2.default)(Step, _React$Component);

@@ -59,11 +49,6 @@ var _super = _createSuper(Step);

_classCallCheck(this, Step);
(0, _classCallCheck2.default)(this, Step);
_this = _super.apply(this, arguments);
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(_args));
_defineProperty(_assertThisInitialized(_this), "onClick", function () {
_this.onClick = function () {
var _this$props = _this.props,

@@ -79,3 +64,3 @@ onClick = _this$props.onClick,

onStepClick(stepIndex);
});
};

@@ -85,3 +70,3 @@ return _this;

_createClass(Step, [{
(0, _createClass2.default)(Step, [{
key: "renderIconNode",

@@ -102,5 +87,5 @@ value: function renderIconNode() {

var iconNode;
var iconClassName = (0, _classnames["default"])("".concat(prefixCls, "-icon"), "".concat(iconPrefix, "icon"), (_classNames = {}, _defineProperty(_classNames, "".concat(iconPrefix, "icon-").concat(icon), icon && isString(icon)), _defineProperty(_classNames, "".concat(iconPrefix, "icon-check"), !icon && status === 'finish' && (icons && !icons.finish || !icons)), _defineProperty(_classNames, "".concat(iconPrefix, "icon-cross"), !icon && status === 'error' && (icons && !icons.error || !icons)), _classNames));
var iconClassName = (0, _classnames.default)("".concat(prefixCls, "-icon"), "".concat(iconPrefix, "icon"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(iconPrefix, "icon-").concat(icon), icon && isString(icon)), (0, _defineProperty2.default)(_classNames, "".concat(iconPrefix, "icon-check"), !icon && status === 'finish' && (icons && !icons.finish || !icons)), (0, _defineProperty2.default)(_classNames, "".concat(iconPrefix, "icon-cross"), !icon && status === 'error' && (icons && !icons.error || !icons)), _classNames));
var iconDot = /*#__PURE__*/_react["default"].createElement("span", {
var iconDot = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon-dot")

@@ -112,3 +97,3 @@ }); // `progressDot` enjoy the highest priority

if (typeof progressDot === 'function') {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -122,3 +107,3 @@ }, progressDot(iconDot, {

} else {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -128,19 +113,19 @@ }, iconDot);

} else if (icon && !isString(icon)) {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icon);
} else if (icons && icons.finish && status === 'finish') {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icons.finish);
} else if (icons && icons.error && status === 'error') {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icons.error);
} else if (icon || status === 'finish' || status === 'error') {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: iconClassName
});
} else {
iconNode = /*#__PURE__*/_react["default"].createElement("span", {
iconNode = _react.default.createElement("span", {
className: "".concat(prefixCls, "-icon")

@@ -161,3 +146,2 @@ }, stepNumber);

style = _this$props3.style,
itemWidth = _this$props3.itemWidth,
active = _this$props3.active,

@@ -169,3 +153,2 @@ _this$props3$status = _this$props3.status,

wrapperStyle = _this$props3.wrapperStyle,
adjustMarginRight = _this$props3.adjustMarginRight,
stepNumber = _this$props3.stepNumber,

@@ -182,16 +165,7 @@ disabled = _this$props3.disabled,

onClick = _this$props3.onClick,
restProps = _objectWithoutProperties(_this$props3, ["className", "prefixCls", "style", "itemWidth", "active", "status", "iconPrefix", "icon", "wrapperStyle", "adjustMarginRight", "stepNumber", "disabled", "description", "title", "subTitle", "progressDot", "tailContent", "icons", "stepIndex", "onStepClick", "onClick"]);
restProps = (0, _objectWithoutProperties2.default)(_this$props3, ["className", "prefixCls", "style", "active", "status", "iconPrefix", "icon", "wrapperStyle", "stepNumber", "disabled", "description", "title", "subTitle", "progressDot", "tailContent", "icons", "stepIndex", "onStepClick", "onClick"]);
var classString = (0, _classnames.default)("".concat(prefixCls, "-item"), "".concat(prefixCls, "-item-").concat(status), className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-custom"), icon), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-active"), active), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled === true), _classNames2));
var classString = (0, _classnames["default"])("".concat(prefixCls, "-item"), "".concat(prefixCls, "-item-").concat(status), className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-item-custom"), icon), _defineProperty(_classNames2, "".concat(prefixCls, "-item-active"), active), _defineProperty(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled === true), _classNames2));
var stepItemStyle = _objectSpread({}, style);
if (itemWidth) {
stepItemStyle.width = itemWidth;
}
if (adjustMarginRight) {
stepItemStyle.marginRight = adjustMarginRight;
}
var accessibilityProps = {};

@@ -205,21 +179,21 @@

return /*#__PURE__*/_react["default"].createElement("div", _extends({}, restProps, {
return _react.default.createElement("div", Object.assign({}, restProps, {
className: classString,
style: stepItemStyle
}), /*#__PURE__*/_react["default"].createElement("div", _extends({
}), _react.default.createElement("div", Object.assign({
onClick: onClick
}, accessibilityProps, {
className: "".concat(prefixCls, "-item-container")
}), /*#__PURE__*/_react["default"].createElement("div", {
}), _react.default.createElement("div", {
className: "".concat(prefixCls, "-item-tail")
}, tailContent), /*#__PURE__*/_react["default"].createElement("div", {
}, tailContent), _react.default.createElement("div", {
className: "".concat(prefixCls, "-item-icon")
}, this.renderIconNode()), /*#__PURE__*/_react["default"].createElement("div", {
}, this.renderIconNode()), _react.default.createElement("div", {
className: "".concat(prefixCls, "-item-content")
}, /*#__PURE__*/_react["default"].createElement("div", {
}, _react.default.createElement("div", {
className: "".concat(prefixCls, "-item-title")
}, title, subTitle && /*#__PURE__*/_react["default"].createElement("div", {
}, title, subTitle && _react.default.createElement("div", {
title: typeof subTitle === 'string' ? subTitle : undefined,
className: "".concat(prefixCls, "-item-subtitle")
}, subTitle)), description && /*#__PURE__*/_react["default"].createElement("div", {
}, subTitle)), description && _react.default.createElement("div", {
className: "".concat(prefixCls, "-item-description")

@@ -229,6 +203,5 @@ }, description))));

}]);
return Step;
}(_react["default"].Component);
}(_react.default.Component);
exports["default"] = Step;
exports.default = Step;
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _reactDom = require("react-dom");
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classnames = _interopRequireDefault(require("classnames"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _debounce = _interopRequireDefault(require("lodash/debounce"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _utils = require("./utils");
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _react = _interopRequireWildcard(require("react"));
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); }
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _classnames = _interopRequireDefault(require("classnames"));
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _Step = _interopRequireDefault(require("./Step"));
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var Steps =
/** @class */
function () {
var Steps = /*#__PURE__*/function (_React$Component) {
(0, _inherits2.default)(Steps, _React$Component);
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 _super = _createSuper(Steps);
var Steps = /*#__PURE__*/function (_Component) {
_inherits(Steps, _Component);
function Steps() {
var _this;
var _super = _createSuper(Steps);
(0, _classCallCheck2.default)(this, Steps);
_this = _super.apply(this, arguments);
function Steps(props) {
var _this;
_this.onStepClick = function (next) {
var _this$props = _this.props,
onChange = _this$props.onChange,
current = _this$props.current;
_classCallCheck(this, Steps);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "onStepClick", function (next) {
var _this$props = _this.props,
onChange = _this$props.onChange,
current = _this$props.current;
if (onChange && current !== next) {
onChange(next);
}
});
_defineProperty(_assertThisInitialized(_this), "calcStepOffsetWidth", function () {
if ((0, _utils.isFlexSupported)()) {
return;
}
var lastStepOffsetWidth = _this.state.lastStepOffsetWidth; // Just for IE9
var domNode = (0, _reactDom.findDOMNode)(_assertThisInitialized(_this));
if (domNode.children.length > 0) {
if (_this.calcTimeout) {
clearTimeout(_this.calcTimeout);
if (onChange && current !== next) {
onChange(next);
}
};
_this.calcTimeout = setTimeout(function () {
// +1 for fit edge bug of digit width, like 35.4px
var offsetWidth = (domNode.lastChild.offsetWidth || 0) + 1; // Reduce shake bug
return _this;
}
if (lastStepOffsetWidth === offsetWidth || Math.abs(lastStepOffsetWidth - offsetWidth) <= 3) {
return;
}
(0, _createClass2.default)(Steps, [{
key: "render",
value: function render() {
var _classNames,
_this2 = this;
_this.setState({
lastStepOffsetWidth: offsetWidth
});
});
}
});
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
_this$props2$style = _this$props2.style,
style = _this$props2$style === void 0 ? {} : _this$props2$style,
className = _this$props2.className,
children = _this$props2.children,
direction = _this$props2.direction,
type = _this$props2.type,
labelPlacement = _this$props2.labelPlacement,
iconPrefix = _this$props2.iconPrefix,
status = _this$props2.status,
size = _this$props2.size,
current = _this$props2.current,
progressDot = _this$props2.progressDot,
initial = _this$props2.initial,
icons = _this$props2.icons,
onChange = _this$props2.onChange,
restProps = (0, _objectWithoutProperties2.default)(_this$props2, ["prefixCls", "style", "className", "children", "direction", "type", "labelPlacement", "iconPrefix", "status", "size", "current", "progressDot", "initial", "icons", "onChange"]);
var isNav = type === 'navigation';
_this.state = {
flexSupported: true,
lastStepOffsetWidth: 0
};
_this.calcStepOffsetWidth = (0, _debounce["default"])(_this.calcStepOffsetWidth, 150);
return _this;
}
_createClass(Steps, [{
key: "componentDidMount",
value: function componentDidMount() {
this.calcStepOffsetWidth();
if (!(0, _utils.isFlexSupported)()) {
this.setState({
flexSupported: false
var filteredChildren = _react.default.Children.toArray(children).filter(function (c) {
return !!c;
});
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.calcStepOffsetWidth();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.calcTimeout) {
clearTimeout(this.calcTimeout);
}
if (this.calcStepOffsetWidth && this.calcStepOffsetWidth.cancel) {
this.calcStepOffsetWidth.cancel();
}
}
}, {
key: "render",
value: function render() {
var _classNames,
_this2 = this;
var adjustedLabelPlacement = progressDot ? 'vertical' : labelPlacement;
var classString = (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(direction), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-").concat(size), size), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-label-").concat(adjustedLabelPlacement), direction === 'horizontal'), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-dot"), !!progressDot), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-navigation"), isNav), _classNames));
return _react.default.createElement("div", Object.assign({
className: classString,
style: style
}, restProps), (0, _toArray.default)(filteredChildren).map(function (child, index) {
if (!child) {
return null;
}
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
_this$props2$style = _this$props2.style,
style = _this$props2$style === void 0 ? {} : _this$props2$style,
className = _this$props2.className,
children = _this$props2.children,
direction = _this$props2.direction,
type = _this$props2.type,
labelPlacement = _this$props2.labelPlacement,
iconPrefix = _this$props2.iconPrefix,
status = _this$props2.status,
size = _this$props2.size,
current = _this$props2.current,
progressDot = _this$props2.progressDot,
initial = _this$props2.initial,
icons = _this$props2.icons,
onChange = _this$props2.onChange,
restProps = _objectWithoutProperties(_this$props2, ["prefixCls", "style", "className", "children", "direction", "type", "labelPlacement", "iconPrefix", "status", "size", "current", "progressDot", "initial", "icons", "onChange"]);
var stepNumber = initial + index;
var isNav = type === 'navigation';
var _this$state = this.state,
lastStepOffsetWidth = _this$state.lastStepOffsetWidth,
flexSupported = _this$state.flexSupported;
var childProps = _objectSpread({
stepNumber: "".concat(stepNumber + 1),
stepIndex: stepNumber,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style,
progressDot: progressDot,
icons: icons,
onStepClick: onChange && _this2.onStepClick
}, child.props); // fix tail color
var filteredChildren = _react["default"].Children.toArray(children).filter(function (c) {
return !!c;
});
var lastIndex = filteredChildren.length - 1;
var adjustedlabelPlacement = progressDot ? 'vertical' : labelPlacement;
var classString = (0, _classnames["default"])(prefixCls, "".concat(prefixCls, "-").concat(direction), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(size), size), _defineProperty(_classNames, "".concat(prefixCls, "-label-").concat(adjustedlabelPlacement), direction === 'horizontal'), _defineProperty(_classNames, "".concat(prefixCls, "-dot"), !!progressDot), _defineProperty(_classNames, "".concat(prefixCls, "-navigation"), isNav), _defineProperty(_classNames, "".concat(prefixCls, "-flex-not-supported"), !flexSupported), _classNames));
return /*#__PURE__*/_react["default"].createElement("div", _extends({
className: classString,
style: style
}, restProps), _react.Children.map(filteredChildren, function (child, index) {
if (!child) {
return null;
}
var stepNumber = initial + index;
var childProps = _objectSpread({
stepNumber: "".concat(stepNumber + 1),
stepIndex: stepNumber,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style,
progressDot: progressDot,
icons: icons,
onStepClick: onChange && _this2.onStepClick
}, child.props);
if (!flexSupported && direction !== 'vertical') {
if (isNav) {
childProps.itemWidth = "".concat(100 / (lastIndex + 1), "%");
childProps.adjustMarginRight = 0;
} else if (index !== lastIndex) {
childProps.itemWidth = "".concat(100 / lastIndex, "%");
childProps.adjustMarginRight = -Math.round(lastStepOffsetWidth / lastIndex + 1);
if (status === 'error' && index === current - 1) {
childProps.className = "".concat(prefixCls, "-next-error");
}
} // fix tail color
if (status === 'error' && index === current - 1) {
childProps.className = "".concat(prefixCls, "-next-error");
}
if (!child.props.status) {
if (stepNumber === current) {
childProps.status = status;
} else if (stepNumber < current) {
childProps.status = 'finish';
} else {
childProps.status = 'wait';
if (!child.props.status) {
if (stepNumber === current) {
childProps.status = status;
} else if (stepNumber < current) {
childProps.status = 'finish';
} else {
childProps.status = 'wait';
}
}
}
childProps.active = stepNumber === current;
return (0, _react.cloneElement)(child, childProps);
}));
}
}]);
childProps.active = stepNumber === current;
return (0, _react.cloneElement)(child, childProps);
}));
}
}]);
return Steps;
}(_react.default.Component);
Steps.Step = _Step.default;
Steps.defaultProps = {
type: 'default',
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
initial: 0,
current: 0,
status: 'process',
size: '',
progressDot: false
};
return Steps;
}(_react.Component);
}();
exports["default"] = Steps;
_defineProperty(Steps, "defaultProps", {
type: 'default',
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
initial: 0,
current: 0,
status: 'process',
size: '',
progressDot: false
});
var _default = Steps;
exports.default = _default;
{
"name": "rc-steps",
"version": "3.6.0",
"version": "4.0.0",
"description": "steps ui component for react",
"engines": {
"node": ">=8.x"
},
"keywords": [

@@ -10,10 +13,11 @@ "react",

],
"main": "./lib/index",
"module": "./es/index",
"files": [
"lib",
"assets/*.css",
"dist",
"es",
"assets/iconfont.css",
"assets/index.css"
"lib"
],
"main": "./lib/index",
"module": "./es/index",
"types": "./lib/index.d.ts",
"homepage": "http://github.com/react-component/steps",

@@ -33,3 +37,3 @@ "maintainers": [

},
"licenses": "MIT",
"license": "MIT",
"config": {

@@ -39,39 +43,33 @@ "port": 8002

"scripts": {
"build": "rc-tools run build",
"compile": "rc-tools run compile",
"gh-pages": "rc-tools run gh-pages",
"start": "rc-tools run server",
"pub": "rc-tools run pub",
"lint": "rc-tools run lint",
"lint:fix": "rc-tools run lint --fix",
"test": "jest",
"prepublish": "rc-tools run guard",
"coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls",
"now-build": "npm run build",
"pre-commit": "rc-tools run pre-commit",
"lint-staged": "lint-staged"
"start": "cross-env NODE_ENV=development father doc dev --storybook",
"build": "father doc build --storybook",
"compile": "father build && lessc assets/index.less assets/index.css",
"gh-pages": "npm run build && father doc deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "npm run gh-pages",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"test": "father test",
"coverage": "father test --coverage"
},
"jest": {
"setupFiles": [
"./tests/setup.js"
],
"collectCoverageFrom": [
"src/**/*"
],
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"transform": {
"\\.jsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
}
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"devDependencies": {
"babel-core": "^7.0.0-bridge.0",
"coveralls": "^3.0.4",
"enzyme": "^3.0.0",
"@types/classnames": "^2.2.9",
"@types/enzyme": "^3.10.5",
"@types/jest": "^25.1.0",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"@umijs/fabric": "^2.0.9",
"cross-env": "^7.0.0",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.0.0",
"jest": "^26.0.0",
"lint-staged": "^10.0.1",
"pre-commit": "1.x",
"enzyme-to-json": "^3.1.2",
"eslint": "^7.1.0",
"father": "^2.22.0",
"less": "^3.11.2",
"np": "^6.2.3",
"prettier": "^2.0.5",
"querystring": "^0.2.0",

@@ -82,16 +80,9 @@ "rc-dialog": "7.x",

"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0"
"typescript": "^3.9.3"
},
"pre-commit": [
"lint-staged"
],
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"npm run pre-commit"
]
},
"dependencies": {
"@babel/runtime": "^7.10.2",
"classnames": "^2.2.3",
"lodash": "^4.17.5"
"rc-util": "^5.0.1"
}
}

@@ -9,3 +9,3 @@ # rc-steps

[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Test coverage][codecov-image]][codecov-url]
[![Dependencies][david-image]][david-url]

@@ -20,4 +20,4 @@ [![DevDependencies][david-dev-image]][david-dev-url]

[travis-url]: https://travis-ci.org/react-component/steps
[coveralls-image]: https://img.shields.io/coveralls/react-component/steps.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/steps?branch=master
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/steps/master.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/react-component/steps/branch/master
[david-url]: https://david-dm.org/react-component/steps

@@ -24,0 +24,0 @@ [david-image]: https://david-dm.org/react-component/steps/status.svg?style=flat-square

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc