@turbox3d/design-engine
Version:
Large-scale design application engine library
63 lines • 3.66 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _typeof from "@babel/runtime/helpers/esm/typeof";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import * as React from 'react';
import { Reactive } from '@turbox3d/reactivity-react';
import EnvSystem from '../env-system/index';
var EnvViewMounter = /*#__PURE__*/function (_React$Component) {
function EnvViewMounter() {
_classCallCheck(this, EnvViewMounter);
return _callSuper(this, EnvViewMounter, arguments);
}
_inherits(EnvViewMounter, _React$Component);
return _createClass(EnvViewMounter, [{
key: "render",
value: function render() {
var _this$props = this.props,
environments = _this$props.environments,
className = _this$props.className,
mountPointId = _this$props.mountPointId,
style = _this$props.style,
unmountDom = _this$props.unmountDom;
var matched = environments.includes(EnvSystem.AppEnvMgr.appEnv);
var styles = style;
if (!matched) {
if (unmountDom) {
return null;
}
styles = _objectSpread(_objectSpread({}, style), {}, {
display: 'none'
});
}
return React.createElement("div", {
id: mountPointId,
className: className,
style: styles
}, this.props.children);
}
}]);
}(React.Component);
EnvViewMounter.defaultProps = {
className: '',
mountPointId: '',
environments: [],
style: {},
unmountDom: true
};
EnvViewMounter = __decorate([Reactive], EnvViewMounter);
export { EnvViewMounter };