feeles-ide
Version:
The hackable and serializable IDE to make learning material
58 lines (49 loc) • 2.03 kB
JavaScript
import _Object$assign from 'babel-runtime/core-js/object/assign';
import _Promise from 'babel-runtime/core-js/promise';
import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
var FileDialog = function (_Component) {
_inherits(FileDialog, _Component);
function FileDialog() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, FileDialog);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FileDialog.__proto__ || _Object$getPrototypeOf(FileDialog)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
dialogInstance: null
}, _this.open = function (reactClass, props) {
return new _Promise(function (resolve, reject) {
props = _Object$assign({}, _this.props, props, {
resolve: resolve,
reject: reject,
onRequestClose: function onRequestClose() {
resolve();
_this.setState({ dialogInstance: null });
}
});
var dialogInstance = React.createElement(reactClass, props);
_this.setState({ dialogInstance: dialogInstance });
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(FileDialog, [{
key: 'render',
value: function render() {
return this.state.dialogInstance;
}
}]);
return FileDialog;
}(Component);
FileDialog.propTypes = {
localization: PropTypes.object.isRequired,
getConfig: PropTypes.func.isRequired,
setConfig: PropTypes.func.isRequired
};
export default FileDialog;