/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var components_inputAdornment_props = require('./props.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../../utils/mixins.js');
require('vue');
require('lodash/mergeWith');
require('lodash');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');

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

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

var classPrefixMixins = components_configProvider_configReceiver.getClassPrefixMixins("input-adornment");
var _InputAdornment = utils_mixins["default"](classPrefixMixins).extend({
  name: "LInputAdornment",
  props: components_inputAdornment_props["default"],
  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__default["default"](_ref, "".concat(this.componentName, "--prepend"), prepend), _defineProperty__default["default"](_ref, "".concat(this.componentName, "--append"), append), _ref)];

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

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

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