"use strict"; var common_vendor = require("../../../../common/vendor.js"); var uni_modules_wotDesignUni_components_composables_useCell = require("../composables/useCell.js"); var uni_modules_wotDesignUni_components_composables_useParent = require("../composables/useParent.js"); var uni_modules_wotDesignUni_components_wdForm_types = require("../wd-form/types.js"); var uni_modules_wotDesignUni_components_wdCell_types = require("./types.js"); var uni_modules_wotDesignUni_components_common_util = require("../common/util.js"); require("../wd-cell-group/types.js"); require("../common/props.js"); require("../common/AbortablePromise.js"); if (!Math) { wdIcon(); } const wdIcon = () => "../wd-icon/wd-icon.js"; const __default__ = { name: "wd-cell", options: { addGlobalClass: true, virtualHost: true, styleIsolation: "shared" } }; const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ ...__default__, props: uni_modules_wotDesignUni_components_wdCell_types.cellProps, emits: ["click"], setup(__props, { emit }) { const props = __props; const slots = common_vendor.useSlots(); const cell = uni_modules_wotDesignUni_components_composables_useCell.useCell(); const isBorder = common_vendor.computed$1(() => { return Boolean(uni_modules_wotDesignUni_components_common_util.isDef(props.border) ? props.border : cell.border.value); }); const { parent: form } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdForm_types.FORM_KEY); const errorMessage = common_vendor.computed$1(() => { if (form && props.prop && form.errorMessages && form.errorMessages[props.prop]) { return form.errorMessages[props.prop]; } else { return ""; } }); const isRequired = common_vendor.computed$1(() => { let formRequired = false; if (form && form.props.rules) { const rules = form.props.rules; for (const key in rules) { if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) { formRequired = rules[key].some((rule) => rule.required); } } } return props.required || props.rules.some((rule) => rule.required) || formRequired; }); const showLeft = common_vendor.computed$1(() => { const hasIcon = slots.icon || props.icon; const hasTitle = slots.title && props.useTitleSlot || props.title; const hasLabel = slots.label || props.label; return hasIcon || hasTitle || hasLabel; }); function onClick() { const url = props.to; if (props.clickable || props.isLink) { emit("click"); } if (url && props.isLink) { if (props.replace) { common_vendor.index.redirectTo({ url }); } else { common_vendor.index.navigateTo({ url }); } } } return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.unref(showLeft) }, common_vendor.unref(showLeft) ? common_vendor.e({ b: common_vendor.unref(isRequired) && _ctx.markerSide === "before" }, common_vendor.unref(isRequired) && _ctx.markerSide === "before" ? {} : {}, { c: _ctx.icon }, _ctx.icon ? { d: common_vendor.p({ name: _ctx.icon, size: _ctx.iconSize, ["custom-class"]: `wd-cell__icon ${_ctx.customIconClass}` }) } : {}, { e: _ctx.useTitleSlot && _ctx.$slots.title }, _ctx.useTitleSlot && _ctx.$slots.title ? {} : _ctx.title ? { g: common_vendor.t(_ctx.title), h: common_vendor.n(_ctx.customTitleClass) } : {}, { f: _ctx.title, i: _ctx.label }, _ctx.label ? { j: common_vendor.t(_ctx.label), k: common_vendor.n(`wd-cell__label ${_ctx.customLabelClass}`) } : {}, { l: common_vendor.unref(isRequired) && _ctx.markerSide === "after" }, common_vendor.unref(isRequired) && _ctx.markerSide === "after" ? {} : {}, { m: common_vendor.s(_ctx.titleWidth ? "min-width:" + _ctx.titleWidth + ";max-width:" + _ctx.titleWidth + ";" : "") }) : {}, { n: common_vendor.t(_ctx.value), o: common_vendor.n(`wd-cell__value ${_ctx.customValueClass} wd-cell__value--${_ctx.valueAlign} ${_ctx.ellipsis ? "wd-cell__value--ellipsis" : ""}`), p: _ctx.isLink }, _ctx.isLink ? { q: common_vendor.p({ ["custom-class"]: "wd-cell__arrow-right", name: "arrow-right" }) } : {}, { r: common_vendor.unref(errorMessage) }, common_vendor.unref(errorMessage) ? { s: common_vendor.t(common_vendor.unref(errorMessage)) } : {}, { t: common_vendor.n(_ctx.vertical ? "is-vertical" : ""), v: common_vendor.n(common_vendor.unref(isBorder) ? "is-border" : ""), w: common_vendor.n(_ctx.size ? "is-" + _ctx.size : ""), x: common_vendor.n(_ctx.center ? "is-center" : ""), y: common_vendor.n(_ctx.customClass), z: common_vendor.s(_ctx.customStyle), A: _ctx.isLink || _ctx.clickable ? "is-hover" : "none", B: common_vendor.o(onClick) }); }; } }); var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3c2570ce"], ["__file", "D:/\u7F51\u6291\u4E91Time/\u79C1\u6D3B/2000\u7B97\u5366/src/uni_modules/wot-design-uni/components/wd-cell/wd-cell.vue"]]); wx.createComponent(Component);