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

'use strict';

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

var components_comment_props = require('./props.js');
var utils_renderNode = require('../../utils/render-node.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../../utils/mixins.js');
require('@babel/runtime/helpers/defineProperty');
require('@babel/runtime/helpers/typeof');
require('vue');
require('lodash/camelCase');
require('lodash/kebabCase');
require('lodash/mergeWith');
require('lodash');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');

var classPrefixMixins = components_configProvider_configReceiver.getClassPrefixMixins("comment");
var _Comment = utils_mixins["default"](classPrefixMixins).extend({
  name: "LComment",
  props: components_comment_props["default"],
  methods: {
    renderReply: function renderReply() {
      var h = this.$createElement;
      var reply = utils_renderNode.renderLNodeJSX(this, "reply");
      return reply ? h("div", {
        "class": "".concat(this.componentName, "__reply")
      }, [reply]) : null;
    },
    renderActions: function renderActions() {
      var h = this.$createElement;
      var actions = utils_renderNode.renderLNodeJSX(this, "actions");
      return actions && actions.length ? h("ul", {
        "class": "".concat(this.componentName, "__actions")
      }, [actions.map(function (action, index) {
        return h("li", {
          "key": "action-".concat(index)
        }, [action]);
      })]) : null;
    },
    renderQuote: function renderQuote() {
      var h = this.$createElement;
      var quote = utils_renderNode.renderLNodeJSX(this, "quote");
      return quote ? h("div", {
        "class": "".concat(this.componentName, "__quote")
      }, [quote]) : null;
    },
    renderAuthorDatetime: function renderAuthorDatetime() {
      var h = this.$createElement;
      var author = utils_renderNode.renderLNodeJSX(this, "author");
      var datetime = utils_renderNode.renderLNodeJSX(this, "datetime");
      return (author || datetime) && h("div", {
        "class": "".concat(this.componentName, "__author")
      }, [author && h("span", {
        "class": "".concat(this.componentName, "__name")
      }, [author]), datetime && h("span", {
        "class": "".concat(this.componentName, "__time")
      }, [datetime])]);
    },
    renderContent: function renderContent() {
      var h = this.$createElement;
      return h("div", {
        "class": "".concat(this.componentName, "__content")
      }, [this.renderAuthorDatetime(), h("div", {
        "class": "".concat(this.componentName, "__detail")
      }, [utils_renderNode.renderLNodeJSX(this, "content")]), this.renderQuote(), this.renderActions()]);
    },
    renderAvatar: function renderAvatar() {
      var h = this.$createElement;
      var avatar = utils_renderNode.renderLNodeJSX(this, "avatar");
      return avatar ? h("div", {
        "class": "".concat(this.componentName, "__avatar")
      }, [typeof avatar === "string" ? h("img", {
        "attrs": {
          "src": avatar,
          "alt": ""
        },
        "class": "".concat(this.componentName, "__avatar-image")
      }) : avatar]) : null;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": this.componentName
    }, [h("div", {
      "class": "".concat(this.componentName, "__inner")
    }, [this.renderAvatar(), this.renderContent()]), this.renderReply()]);
  }
});

exports["default"] = _Comment;
//# sourceMappingURL=comment.js.map
