"use strict";

var __extends = this && this.__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 (b.hasOwnProperty(p)) d[p] = b[p];
    };
    return _extendStatics(d, b);
  };
  return function (d, b) {
    _extendStatics(d, b);
    function __() {
      this.constructor = d;
    }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();
exports.__esModule = true;
var react_1 = require("react");
var element_react_1 = require("element-react");
var List_1 = require("./List");
var index_module_scss_1 = require("./index.module.scss");
var DialogBody = element_react_1.Dialog.Body,
  DialogFooter = element_react_1.Dialog.Footer;
var MaterialEdit = /** @class */function (_super) {
  __extends(MaterialEdit, _super);
  function MaterialEdit(props) {
    var _this = _super.call(this, props) || this;
    _this.state = {};
    return _this;
  }
  MaterialEdit.prototype.render = function () {
    var _a = this.props,
      name = _a.name,
      mediaType = _a.mediaType,
      dialogVisible = _a.dialogVisible,
      handleVisible = _a.handleVisible,
      content = _a.content,
      onSubmit = _a.onSubmit,
      onCancel = _a.onCancel;
    // body component
    var Body = function Body() {
      if (!dialogVisible) return null;
      return react_1["default"].createElement(DialogBody, null, react_1["default"].createElement("div", {
        className: index_module_scss_1["default"]['xt-material-list']
      }, react_1["default"].createElement(List_1["default"], {
        mediaType: mediaType
      })), react_1["default"].createElement("div", {
        className: index_module_scss_1["default"]['xt-material-edit']
      }, content));
    };
    // footer component
    var Footer = function Footer() {
      return react_1["default"].createElement(DialogFooter, {
        className: "dialog-footer"
      }, react_1["default"].createElement(element_react_1.Button, {
        type: "primary",
        onClick: onSubmit
      }, react_1["default"].createElement("span", {
        className: index_module_scss_1["default"]['xt-save-icon'] + " xiatu-rich xt-baocun"
      }), "\u4FDD\u5B58", name));
    };
    return react_1["default"].createElement("section", {
      className: index_module_scss_1["default"]['xt-material-container']
    }, react_1["default"].createElement(element_react_1.Button, {
      onClick: function onClick() {
        return handleVisible(true);
      }
    }, "\u7F16\u8F91", name), react_1["default"].createElement(element_react_1.Dialog, {
      title: "\u7F16\u8F91" + name + "\u5185\u5BB9",
      visible: dialogVisible,
      onCancel: onCancel,
      lockScroll: false
    }, react_1["default"].createElement(Body, null), react_1["default"].createElement(Footer, null)));
  };
  return MaterialEdit;
}(react_1.PureComponent);
exports["default"] = MaterialEdit;