"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

var _tslib = require("tslib");

var React = _interopRequireWildcard(require("react"));

var _warning = _interopRequireDefault(require("../../../lib/_util/warning"));

var _mobxReact = require("mobx-react");

var _omit = _interopRequireDefault(require("lodash/omit"));

var _Base = _interopRequireDefault(require("./Base"));

var _FormField2 = require("../field/FormField");

var _excluded = ["ellipsis", "children"];

var Text = /*#__PURE__*/function (_FormField) {
  (0, _inherits2["default"])(Text, _FormField);

  var _super = (0, _createSuper2["default"])(Text);

  function Text() {
    (0, _classCallCheck2["default"])(this, Text);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(Text, [{
    key: "mergedEllipsis",
    get: function get() {
      var ellipsis = this.props.ellipsis;

      if (ellipsis && (0, _typeof2["default"])(ellipsis) === 'object') {
        return (0, _omit["default"])(ellipsis, ['expandable', 'rows']);
      }

      return ellipsis;
    }
  }, {
    key: "renderWrapper",
    value: function renderWrapper() {
      var _this$props = this.props,
          ellipsis = _this$props.ellipsis,
          children = _this$props.children,
          restProps = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
      (0, _warning["default"])((0, _typeof2["default"])(ellipsis) !== 'object' || !ellipsis || !('expandable' in ellipsis) && !('rows' in ellipsis), 'Typography.Text `ellipsis` do not support `expandable` or `rows` props.');
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Base["default"], (0, _extends2["default"])({}, restProps, {
        ellipsis: this.mergedEllipsis,
        component: "span"
      }), this.processRenderer(this.getValue()) || children), this.renderFloatLabel());
    }
  }]);
  return Text;
}(_FormField2.FormField);

Text.displayName = 'Text';
Text.__PRO_TEXT = true;
Text.defaultProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _FormField2.FormField.defaultProps), {}, {
  suffixCls: 'text'
});
Text = (0, _tslib.__decorate)([_mobxReact.observer], Text);
var _default = Text;
exports["default"] = _default;
//# sourceMappingURL=Text.js.map
