UNPKG

react-web-native-sketch

Version:

[TODO: We need an overview of how this can be used via npm vs as a local package]

59 lines 2.79 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var Dialog_1 = require("@material-ui/core/Dialog"); var react_redux_1 = require("react-redux"); var navigation_1 = require("../../redux/reducers/navigation"); var CDialog = /** @class */ (function (_super) { __extends(CDialog, _super); function CDialog(props) { var _this = _super.call(this, props) || this; _this.hideDialog = _this.props.hideDialog.bind(_this, props.id); _this.onExited = _this.props.removeDialog.bind(_this, props.id); return _this; } CDialog.prototype.render = function () { var _a = this.props, body = _a.body, fullScreen = _a.fullScreen, id = _a.id, props = _a.props, dialogs = _a.dialogs, disableBackdropClick = _a.disableBackdropClick, disableEscapeKeyDown = _a.disableEscapeKeyDown; var dialog = null; for (var _i = 0, dialogs_1 = dialogs; _i < dialogs_1.length; _i++) { var ldialog = dialogs_1[_i]; if (ldialog.id === id) { dialog = ldialog; break; } } if (!dialog) { return null; } // noinspection JSUnusedLocalSymbols var BodyComponent = body; return (React.createElement(Dialog_1.default, { open: dialog.visible || false, onExited: this.onExited, fullScreen: fullScreen, onClose: this.hideDialog, disableBackdropClick: disableBackdropClick || false, disableEscapeKeyDown: disableEscapeKeyDown || false }, React.createElement(BodyComponent, { displayTopbar: true, navigation: { state: { params: __assign({}, (props || {}), (dialog.props || {})) } } }))); }; return CDialog; }(React.PureComponent)); exports.Dialog = react_redux_1.connect(function (state, ownProps) { return ({ dialogs: state.navigation.dialogs, }); }, { hideDialog: navigation_1.hideDialog, removeDialog: navigation_1.removeDialog, })(CDialog); //# sourceMappingURL=Dialog.js.map