zent
Version:
一套前端设计语言和基于React的实现
45 lines (44 loc) • 2.97 kB
JavaScript
import { __assign, __extends } from "tslib";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Component } from 'react';
import classNames from 'classnames';
import Icon from '../../icon';
var Step = (function (_super) {
__extends(Step, _super);
function Step() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.renderIconNode = function () {
var _a = _this.props, stepNumber = _a.stepNumber, sequence = _a.sequence, _b = _a.status, status = _b === void 0 ? 'wait' : _b, icon = _a.icon;
var iconNode;
if (icon) {
var iconNode_1 = typeof icon === 'string' ? _jsx(Icon, { type: icon }, void 0) : icon;
return _jsx(_Fragment, { children: iconNode_1 }, void 0);
}
if (status === 'finish') {
iconNode = _jsx(Icon, { type: "check-circle-o" }, void 0);
}
else if (status === 'error') {
iconNode = _jsx(Icon, { type: "error-circle" }, void 0);
}
else {
iconNode = (_jsx("span", __assign({ className: "zent-icon zent-steps-sequence", "data-zv": '10.0.17' }, { children: sequence ? stepNumber : '' }), void 0));
}
return iconNode;
};
return _this;
}
Step.prototype.render = function () {
var props = this.props;
var isCurrentStep = props.isCurrentStep, _a = props.status, status = _a === void 0 ? 'wait' : _a, isLastFinishStep = props.isLastFinishStep, stepLast = props.stepLast, title = props.title, description = props.description;
var classString = classNames('zent-steps-item', "zent-steps-status-" + status, {
'zent-steps-item--current': isCurrentStep,
'zent-steps-item--last-finished': isLastFinishStep,
});
return (_jsxs("div", __assign({ className: classString, "data-zv": '10.0.17' }, { children: [!stepLast && (_jsx("div", __assign({ className: "zent-steps-tail", "data-zv": '10.0.17' }, { children: _jsx("i", { "data-zv": '10.0.17' }, void 0) }), void 0)), _jsxs("div", __assign({ className: "zent-steps-step", "data-zv": '10.0.17' }, { children: [_jsx("div", __assign({ className: "zent-step-head", "data-zv": '10.0.17' }, { children: _jsx("div", __assign({ className: "zent-step-head-inner", "data-zv": '10.0.17' }, { children: this.renderIconNode() }), void 0) }), void 0), _jsxs("div", __assign({ className: "zent-step-main", "data-zv": '10.0.17' }, { children: [_jsx("div", __assign({ className: "zent-step-title", "data-zv": '10.0.17' }, { children: title }), void 0), description && (_jsx("div", __assign({ className: "zent-step-description", "data-zv": '10.0.17' }, { children: description }), void 0))] }), void 0)] }), void 0)] }), void 0));
};
Step.defaultProps = {
description: '',
};
return Step;
}(Component));
export default Step;