UNPKG

@mree/mre-react-message

Version:
117 lines (97 loc) 6.42 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _mreReactModel = require('@mree/mre-react-model'); var _Dialog = require('material-ui/Dialog'); var _Dialog2 = _interopRequireDefault(_Dialog); var _FlatButton = require('material-ui/FlatButton'); var _FlatButton2 = _interopRequireDefault(_FlatButton); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var InformationalDialog = function (_BaseComponent) { _inherits(InformationalDialog, _BaseComponent); function InformationalDialog(props, states) { _classCallCheck(this, InformationalDialog); var _this = _possibleConstructorReturn(this, (InformationalDialog.__proto__ || Object.getPrototypeOf(InformationalDialog)).call(this, props, states)); _this._bind('handleClose'); return _this; } _createClass(InformationalDialog, [{ key: 'componentWillMount', value: function componentWillMount() { this.setState({ open: true }); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (nextProps.props != null && nextProps.props != {} && nextProps.props != this.props.props) { this.setState({ open: true }); } } }, { key: 'handleClose', value: function handleClose() { var message = { function: "cleanMessengerData" }; this.props.execute(message); this.setState({ open: false }); } }, { key: 'render', value: function render() { var actionButton = [_react2.default.createElement(_FlatButton2.default //backgroundColor = {this.props.button.backgroundColor} //buttonStyle = {this.props.button.buttonStyle} //children = {this.props.button.children} //className = {this.props.button.className} //disabled = {this.props.button.disabled} //disabledBackgroundColor = {this.props.button.disabledBackgroundColor} //disabledLabelColor = {this.props.button.disabledLabelColor} //fullWidth = {this.props.button.fullWidth} //href = {this.props.button.href} //icon = {this.props.button.icon} , { label: this.props.button.label //labelColor = {this.props.button.labelColor} //labelPosition = {this.props.button.labelPosition} //labelStyle = {this.props.button.labelStyle} //overlayStyle = {this.props.button.overlayStyle} , primary: this.props.button.primary //rippleStyle = {this.props.button.rippleStyle} //secondary = {this.props.button.secondary} //style = {this.props.button.style} , keyboardFocused: this.props.button.keyboardFocused, onTouchTap: this.handleClose })]; return _react2.default.createElement(_Dialog2.default // Docs: http://www.material-ui.com/#/components/dialog , { actions: actionButton //actionsContainerClassName = {this.props.actionsContainerClassName} //actionsContainerStyle = {this.props.actionsContainerStyle} //autoDetectWindowHeight = {this.props.autoDetectWindowHeight} , autoScrollBodyContent: this.props.autoScrollBodyContent //bodyClassName = {this.props.bodyClassName} //bodyStyle = {this.props.bodyStyle} , children: this.props.feedback.message //className = {this.props.className} //contentClassName = {this.props.contentClassName} //contentStyle = {this.props.contentStyle} , modal: this.props.modal, onRequestClose: this.handleClose, open: this.state.open //overlayClassName = {this.props.overlayClassName} //overlayStyle = {this.props.overlayStyle} //repositionOnUpdate = {this.props.repositionOnUpdate} //style = {this.props.style} , title: this.props.feedback.title //titleClassName = {this.props.titleClassName} //titleStyle = {this.props.titleStyle} }); } }]); return InformationalDialog; }(_mreReactModel.BaseComponent); exports.default = InformationalDialog;