1 line
20 KiB
JSON
1 line
20 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"className\", \"prefixCls\", \"style\", \"active\", \"status\", \"iconPrefix\", \"icon\", \"wrapperStyle\", \"stepNumber\", \"disabled\", \"description\", \"title\", \"subTitle\", \"progressDot\", \"stepIcon\", \"tailContent\", \"icons\", \"stepIndex\", \"onStepClick\", \"onClick\", \"render\"];\n/* eslint react/prop-types: 0 */\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nfunction isString(str) {\n return typeof str === 'string';\n}\nfunction Step(props) {\n var _classNames2;\n var className = props.className,\n prefixCls = props.prefixCls,\n style = props.style,\n active = props.active,\n status = props.status,\n iconPrefix = props.iconPrefix,\n icon = props.icon,\n wrapperStyle = props.wrapperStyle,\n stepNumber = props.stepNumber,\n disabled = props.disabled,\n description = props.description,\n title = props.title,\n subTitle = props.subTitle,\n progressDot = props.progressDot,\n stepIcon = props.stepIcon,\n tailContent = props.tailContent,\n icons = props.icons,\n stepIndex = props.stepIndex,\n onStepClick = props.onStepClick,\n onClick = props.onClick,\n render = props.render,\n restProps = _objectWithoutProperties(props, _excluded);\n\n // ========================= Click ==========================\n var clickable = !!onStepClick && !disabled;\n var accessibilityProps = {};\n if (clickable) {\n accessibilityProps.role = 'button';\n accessibilityProps.tabIndex = 0;\n accessibilityProps.onClick = function (e) {\n onClick === null || onClick === void 0 ? void 0 : onClick(e);\n onStepClick(stepIndex);\n };\n accessibilityProps.onKeyDown = function (e) {\n var which = e.which;\n if (which === KeyCode.ENTER || which === KeyCode.SPACE) {\n onStepClick(stepIndex);\n }\n };\n }\n\n // ========================= Render =========================\n var renderIconNode = function renderIconNode() {\n var _classNames;\n var iconNode;\n 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));\n var iconDot = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon-dot\")\n });\n // `progressDot` enjoy the highest priority\n if (progressDot) {\n if (typeof progressDot === 'function') {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, progressDot(iconDot, {\n index: stepNumber - 1,\n status: status,\n title: title,\n description: description\n }));\n } else {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, iconDot);\n }\n } else if (icon && !isString(icon)) {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, icon);\n } else if (icons && icons.finish && status === 'finish') {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, icons.finish);\n } else if (icons && icons.error && status === 'error') {\n iconNode = /*
|