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

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var utils_renderTnode = require('../utils/render-tnode.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../utils/mixins.js');
var link_props = require('./props.js');
require('@babel/runtime/helpers/typeof');
require('vue');
require('@vue/composition-api');
require('lodash/camelCase');
require('lodash/kebabCase');
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('../_chunks/dep-7c884501.js');
require('dayjs');

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

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

var classPrefixMixins = configProvider_configReceiver.getClassPrefixMixins("link");
var _Link = utils_mixins["default"](classPrefixMixins).extend({
  name: "TLink",
  props: link_props["default"],
  methods: {
    handleClick: function handleClick(e) {
      var _this$onClick;
      if (this.disabled) return;
      this.$emit("click", e);
      (_this$onClick = this.onClick) === null || _this$onClick === void 0 ? void 0 : _this$onClick.call(this, e);
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    var linkContent = utils_renderTnode.renderContent(this, "default", "content");
    var prefixContent = utils_renderTnode.renderTNodeJSX(this, "prefixIcon");
    var suffixContent = utils_renderTnode.renderTNodeJSX(this, "suffixIcon");
    var linkClass = [this.componentName, "".concat(this.componentName, "--theme-").concat(this.theme), (_ref = {}, _defineProperty__default["default"](_ref, this.commonSizeClassName[this.size], this.size !== "medium"), _defineProperty__default["default"](_ref, this.commonStatusClassName.disabled, this.disabled), _defineProperty__default["default"](_ref, "".concat(this.classPrefix, "-is-underline"), this.underline), _defineProperty__default["default"](_ref, "".concat(this.componentName, "--hover-").concat(this.hover), !this.disabled), _ref)];
    return h("a", {
      "class": linkClass,
      "attrs": {
        "href": this.disabled || !this.href ? void 0 : this.href,
        "target": this.target
      },
      "on": {
        "click": this.handleClick
      }
    }, [prefixContent && h("span", {
      "class": "".concat(this.componentName, "__prefix-icon")
    }, [prefixContent]), linkContent, suffixContent && h("span", {
      "class": "".concat(this.componentName, "__suffix-icon")
    }, [suffixContent])]);
  }
});

exports["default"] = _Link;
//# sourceMappingURL=link.js.map
