UNPKG

tdesign-vue

Version:
125 lines (121 loc) 5.04 kB
/** * tdesign v1.12.1 * (c) 2025 tdesign * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { isFunction } from 'lodash-es'; import { CheckIcon, CloseIcon } from 'tdesign-icons-vue'; import mixins from '../utils/mixins.js'; import getConfigReceiverMixins, { getGlobalIconMixins } from '../config-provider/config-receiver.js'; import props from './step-item-props.js'; import { renderTNodeJSX, renderContent } from '../utils/render-tnode.js'; import 'vue'; import '../config-provider/context.js'; import '../_common/js/global-config/default-config.js'; import '../_common/js/global-config/locale/zh_CN.js'; import '../_chunks/dep-c44a474d.js'; import '@babel/runtime/helpers/typeof'; import '../_chunks/dep-d639fbd7.js'; import 'dayjs'; import '../_chunks/dep-3c66615e.js'; import '../config-provider/type.js'; import '../_common/js/global-config/t.js'; import '@babel/runtime/helpers/slicedToArray'; import '@babel/runtime/helpers/readOnlyError'; import '@vue/composition-api'; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var _StepItem = mixins(getConfigReceiverMixins("steps"), getGlobalIconMixins()).extend({ name: "TStepItem", props: _objectSpread(_objectSpread({}, props), {}, { index: Number }), inject: { steps: { "default": void 0 } }, computed: { current: function current() { return this.steps && this.steps.current; }, baseClass: function baseClass() { return ["".concat(this.componentName, "-item"), _defineProperty({}, "".concat(this.componentName, "-item--").concat(this.status), this.status)]; }, iconClass: function iconClass() { return ["".concat(this.componentName, "-item__icon"), _defineProperty({}, "".concat(this.componentName, "-item--").concat(this.status), this.status)]; }, canClick: function canClick() { var _this$steps; return this.status !== "process" && !((_this$steps = this.steps) !== null && _this$steps !== void 0 && _this$steps.readonly); } }, methods: { renderIcon: function renderIcon() { var h = this.$createElement; var defaultIcon; if (this.steps.theme === "default") { var icon = ""; var _this$useGlobalIcon = this.useGlobalIcon({ CheckIcon: CheckIcon, CloseIcon: CloseIcon }), CheckIcon$1 = _this$useGlobalIcon.CheckIcon, CloseIcon$1 = _this$useGlobalIcon.CloseIcon; switch (this.status) { case "finish": if (isFunction(this.global.checkIcon)) { icon = this.global.checkIcon(this.$createElement); } else { icon = h(CheckIcon$1); } break; case "error": if (isFunction(this.global.errorIcon)) { icon = this.global.errorIcon(this.$createElement); } else { icon = h(CloseIcon$1); } break; default: icon = String(this.index + 1); break; } defaultIcon = h("span", { "class": "".concat(this.componentName, "-item__icon--number") }, [icon]); } return renderTNodeJSX(this, "icon", defaultIcon); }, onStepClick: function onStepClick(e) { if (!this.canClick) return; var val = this.value === void 0 ? this.index : this.value; this.steps.handleChange(val, this.current, e); } }, render: function render() { var h = arguments[0]; var content = renderContent(this, "default", "content"); return h("div", { "class": this.baseClass }, [h("div", { "class": "".concat(this.componentName, "-item__inner ").concat(this.canClick ? "".concat(this.componentName, "-item--clickable") : ""), "on": { "click": this.onStepClick } }, [h("div", { "class": this.iconClass }, [this.renderIcon()]), h("div", { "class": "".concat(this.componentName, "-item__content") }, [h("div", { "class": "".concat(this.componentName, "-item__title") }, [renderTNodeJSX(this, "title")]), h("div", { "class": "".concat(this.componentName, "-item__description") }, [content]), h("div", { "class": "".concat(this.componentName, "-item__extra") }, [renderTNodeJSX(this, "extra")])])])]); } }); export { _StepItem as default }; //# sourceMappingURL=step-item.js.map