Modal.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  10. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  11. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  12. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  13. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  14. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  15. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  16. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  17. var Modal =
  18. /*#__PURE__*/
  19. function (_React$Component) {
  20. _inherits(Modal, _React$Component);
  21. function Modal(props) {
  22. _classCallCheck(this, Modal);
  23. return _possibleConstructorReturn(this, _getPrototypeOf(Modal).call(this, props));
  24. }
  25. _createClass(Modal, [{
  26. key: "componentWillUnmount",
  27. value: function componentWillUnmount() {
  28. try {
  29. document.querySelector('.modal-backdrop').remove();
  30. } catch (e) {}
  31. }
  32. }, {
  33. key: "render",
  34. value: function render() {
  35. var _this = this;
  36. return _react.default.createElement("div", {
  37. className: "modal fade",
  38. id: this.props.id,
  39. tabIndex: "-1",
  40. role: "dialog",
  41. "aria-labelledby": "ModalLabel",
  42. "aria-hidden": "true"
  43. }, _react.default.createElement("div", {
  44. className: "modal-dialog",
  45. role: "document"
  46. }, _react.default.createElement("div", {
  47. className: "modal-content"
  48. }, _react.default.createElement("div", {
  49. className: "modal-header"
  50. }, _react.default.createElement("h5", {
  51. className: "modal-title",
  52. id: "ModalLabel"
  53. }, this.props.title), _react.default.createElement("button", {
  54. type: "button",
  55. className: "close",
  56. "data-dismiss": "modal",
  57. "aria-label": "Close"
  58. }, _react.default.createElement("span", {
  59. "aria-hidden": "true"
  60. }, "\xD7"))), _react.default.createElement("div", {
  61. className: "modal-body"
  62. }, this.props.children), this.props.footer ? _react.default.createElement("div", {
  63. className: "modal-footer"
  64. }, _react.default.createElement("button", {
  65. type: "button",
  66. className: "btn btn-secondary",
  67. "data-dismiss": "modal"
  68. }, "Close"), this.props.confirmButton ? _react.default.createElement("button", {
  69. type: "button",
  70. className: "btn btn-primary",
  71. onClick: function onClick() {
  72. return _this.onConfirm();
  73. }
  74. }, this.props.confirmButton) : '') : '')));
  75. }
  76. }]);
  77. return Modal;
  78. }(_react.default.Component);
  79. var _default = Modal;
  80. exports.default = _default;