UNPKG

tdesign-vue

Version:
66 lines (62 loc) 2.3 kB
/** * tdesign v1.14.1 * (c) 2025 tdesign * @license MIT */ import { isString, isNumber } from 'lodash-es'; import props from './props.js'; import { getClassPrefixMixins } from '../config-provider/config-receiver.js'; import mixins from '../utils/mixins.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-ba613a02.js'; import '@babel/runtime/helpers/typeof'; import '../_chunks/dep-fdb1b253.js'; import 'dayjs'; import '../_common/js/global-config/t.js'; import '@babel/runtime/helpers/slicedToArray'; var classPrefixMixins = getClassPrefixMixins("input-adornment"); var _InputAdornment = mixins(classPrefixMixins).extend({ name: "TInputAdornment", props: props, methods: { renderAddon: function renderAddon(h, type, addon) { var addonNode; var isContentNode = isString(addon) || isNumber(addon); if (!this.$scopedSlots[type] && isString(addon) && !addon) return null; if (this.$scopedSlots[type]) { if (this.$scopedSlots[type](null).length === 1 && this.$scopedSlots[type](null)[0].text) { addonNode = h("span", { "class": "".concat(this.componentName, "__text") }, [this.$scopedSlots[type](null)]); } else { addonNode = this.$scopedSlots[type](null); } } else if (typeof addon === "function") { addonNode = addon(h); } else { addonNode = isContentNode ? h("span", { "class": "".concat(this.componentName, "__text") }, [addon]) : addon; } return addonNode ? h("span", { "class": "".concat(this.componentName, "__").concat(type) }, [addonNode]) : addonNode; } }, render: function render(h) { var prepend = this.renderAddon(h, "prepend", this.prepend); var append = this.renderAddon(h, "append", this.append); var defaultSlot = this.$scopedSlots["default"] ? this.$scopedSlots["default"](null) : [null]; if (!prepend && !append) { return defaultSlot[0]; } return h("div", { "class": this.componentName }, [prepend, defaultSlot[0], append]); } }); export { _InputAdornment as default }; //# sourceMappingURL=input-adornment.js.map