"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 _radio = _interopRequireDefault(require("@alifd/next/lib/radio"));
var React = _interopRequireWildcard(require("react"));
require("./index.scss");
require("../../components/border-box/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 RadioGroup = _radio["default"].Group;
var BoxStyleSetter = /*#__PURE__*/function (_Component) {
  (0, _inheritsLoose2["default"])(BoxStyleSetter, _Component);
  function BoxStyleSetter() {
    var _this;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _Component.call.apply(_Component, [this].concat(args)) || this;
    _this.state = {
      styleType: 2
      // skinType: 'def'
    };
    return _this;
  }
  var _proto = BoxStyleSetter.prototype;
  _proto.render = function render() {
    var _this2 = this,
      _options$;
    var _this$props = this.props,
      options = _this$props.options,
      onChange = _this$props.onChange;
    var onStyleType = function onStyleType(styleType) {
      _this2.setState({
        styleType: styleType
      });
      onChange([styleType, ['none', 'color'][styleType] || "skin1"]);
    };
    var onSkinType = function onSkinType(skinType) {
      // this.setState({
      //     skinType: skinType
      // });
      onChange([2, "skin" + skinType]);
    };
    return /*#__PURE__*/React.createElement("div", {
      className: "box-style-setter"
    }, /*#__PURE__*/React.createElement(RadioGroup, {
      dataSource: options,
      shape: "button",
      value: this.state.styleType,
      onChange: onStyleType
    }), /*#__PURE__*/React.createElement("div", {
      className: "img-select"
    }, this.state.styleType === 2 && ((_options$ = options[2]) === null || _options$ === void 0 ? void 0 : _options$.list.map(function (res, idx) {
      return /*#__PURE__*/React.createElement("div", {
        className: "img-select-li " + (idx === 1000 ? 'active' : '') + " "
      }, /*#__PURE__*/React.createElement("div", {
        className: "border-box " + res.value,
        onClick: function onClick() {
          return onSkinType(idx + 1);
        }
      }, /*#__PURE__*/React.createElement("div", {
        className: "box-title"
      }, /*#__PURE__*/React.createElement("div", {
        className: "box-title-content"
      }, "\u6807\u9898")), /*#__PURE__*/React.createElement("div", {
        className: "box-slot-container"
      })));
    }))));
  };
  return BoxStyleSetter;
}(React.Component);
exports["default"] = BoxStyleSetter;
BoxStyleSetter.displayName = 'BoxStyleSetter';