"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _antd = require("antd");

var _ButtonConfig = _interopRequireDefault(require("../../../../../meta-comp/config-panels/ButtonConfig"));

var _TextConfig = _interopRequireDefault(require("../../../../../meta-comp/config-panels/TextConfig"));

var _coreUtil = require("../../../../../utils/coreUtil");

var _common = require("../../../../../common");

require("./index.less");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");

    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var AComponent =
/** @class */
function (_super) {
  __extends(AComponent, _super);

  function AComponent() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this.state = {};

    _this.reRender = function () {
      (0, _coreUtil.renderPreview)();

      _this.setState({});
    };

    return _this;
  }

  AComponent.prototype.render = function () {
    var _this = this;

    var panelProps = this.props.panelProps;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "flash_sale_content"
    }, /*#__PURE__*/_react["default"].createElement(_common.Field, {
      title: "product sort by"
    }, /*#__PURE__*/_react["default"].createElement(_antd.Select, {
      onChange: function onChange(v) {
        panelProps.sortType = v;

        _this.reRender();
      },
      value: panelProps.sortType
    }, /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
      value: "1"
    }, "Sales"), /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
      value: "3"
    }, "Price"))), /*#__PURE__*/_react["default"].createElement(_common.Collapse, {
      headerSize: "middle",
      onRefresh: this.reRender,
      source: [{
        key: '1',
        name: 'Label',
        value: /*#__PURE__*/_react["default"].createElement(_ButtonConfig["default"], {
          data: panelProps.label
        }),
        metaOption: panelProps.label
      }, {
        key: '2',
        name: 'Product Name',
        value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
          data: panelProps.productName
        }),
        metaOption: panelProps.productName
      }, {
        key: '3',
        name: 'Activity Price',
        value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
          data: panelProps.activityPrice
        }),
        metaOption: panelProps.activityPrice
      }, {
        key: '4',
        name: 'Sales Price',
        value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
          data: panelProps.salesPrice
        }),
        metaOption: panelProps.salesPrice
      }, {
        key: '5',
        name: 'Sales Progress',
        value: null,
        metaOption: panelProps.salesProgressVisible
      }],
      type: "switch"
    }));
  };

  AComponent.defaultProps = {
    panelProps: {
      sortType: '1',
      label: {},
      productName: {},
      activityPrice: {},
      salesPrice: {},
      salesProgressVisible: {
        open: false
      }
    }
  };
  return AComponent;
}(_react["default"].Component);

var _default = AComponent;
exports["default"] = _default;