"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.scss");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var positionSetter = /*#__PURE__*/function (_PureComponent) {
  (0, _inheritsLoose2["default"])(positionSetter, _PureComponent);
  function positionSetter() {
    return _PureComponent.apply(this, arguments) || this;
  }
  var _proto = positionSetter.prototype;
  _proto.render = function render() {
    var _this$props = this.props,
      value = _this$props.value,
      onChange = _this$props.onChange;
    // 定位块点击事件
    var evDomCk = function evDomCk(ev) {
      return onChange(ev.target.getAttribute('data-n'));
    };

    // 定位块样式与高亮
    function getClasses(name) {
      var _c = name.split('')[0];
      var isActive = name === value && 'active';
      return "ev-dom " + {
        l: 'left',
        c: 'center',
        r: 'right'
      }[_c] + " " + isActive;
    }
    return /*#__PURE__*/React.createElement("div", {
      className: "position"
    }, /*#__PURE__*/React.createElement("div", {
      className: "pos-main",
      onClick: evDomCk
    }, /*#__PURE__*/React.createElement("div", {
      className: "pos-main-li top"
    }, /*#__PURE__*/React.createElement("div", {
      className: getClasses('lt'),
      "data-n": "lt"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('ct'),
      "data-n": "ct"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('rt'),
      "data-n": "rt"
    })), /*#__PURE__*/React.createElement("div", {
      className: "pos-main-li middel"
    }, /*#__PURE__*/React.createElement("div", {
      className: getClasses('lc'),
      "data-n": "lc"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('cc'),
      "data-n": "cc"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('rc'),
      "data-n": "rc"
    })), /*#__PURE__*/React.createElement("div", {
      className: "pos-main-li bottom"
    }, /*#__PURE__*/React.createElement("div", {
      className: getClasses('lb'),
      "data-n": "lb"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('cb'),
      "data-n": "cb"
    }), /*#__PURE__*/React.createElement("div", {
      className: getClasses('rb'),
      "data-n": "rb"
    }))));
  };
  return positionSetter;
}(React.PureComponent);
exports["default"] = positionSetter;
positionSetter.displayName = 'positionSetter';