/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var isString = require('lodash/isString');
var isNumber = require('lodash/isNumber');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../utils/mixins.js');
var inputAdornment_props = require('./props.js');
require('vue');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../_chunks/dep-7c884501.js');
require('dayjs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);

var classPrefixMixins = configProvider_configReceiver.getClassPrefixMixins("input-adornment");
var _InputAdornment = utils_mixins["default"](classPrefixMixins).extend({
  name: "TInputAdornment",
  props: inputAdornment_props["default"],
  methods: {
    renderAddon: function renderAddon(h, type, addon) {
      var addonNode;
      var isContentNode = isString__default["default"](addon) || isNumber__default["default"](addon);
      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]);
  }
});

exports["default"] = _InputAdornment;
//# sourceMappingURL=input-adornment.js.map
