/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import props from './props.js';
import { getClassPrefixMixins } from '../config-provider/config-receiver.js';
import mixins from '../utils/mixins.js';
import 'vue';
import 'lodash/mergeWith';
import '../config-provider/context.js';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../config-provider/type.js';

var classPrefixMixins = getClassPrefixMixins("input-adornment");
var _InputAdornment = mixins(classPrefixMixins).extend({
  name: "TInputAdornment",
  props: props,
  methods: {
    renderAddon: function renderAddon(h, type, addon) {
      var addonNode;

      if (this.$scopedSlots[type]) {
        addonNode = this.$scopedSlots[type](null);
      } else if (typeof addon === "string") {
        addonNode = addon;
      } else if (typeof addon === "function") {
        addonNode = addon(h);
      } else {
        addonNode = null;
      }

      return addonNode ? h("span", {
        "class": "".concat(this.componentName, "__").concat(type)
      }, [addonNode]) : addonNode;
    }
  },
  render: function render(h) {
    var _ref;

    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];
    var className = [this.componentName, (_ref = {}, _defineProperty(_ref, "".concat(this.componentName, "--prepend"), prepend), _defineProperty(_ref, "".concat(this.componentName, "--append"), append), _ref)];

    if (!prepend && !append) {
      return defaultSlot[0];
    }

    return h("div", {
      "class": className
    }, [prepend, defaultSlot[0], append]);
  }
});

export { _InputAdornment as default };
//# sourceMappingURL=input-adornment.js.map
