viser-react
Version:
viser-react is react of viser.
85 lines (64 loc) • 2.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var PropTypes = _interopRequireWildcard(require("prop-types"));
var React = _interopRequireWildcard(require("react"));
var ReactDOM = _interopRequireWildcard(require("react-dom"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var __extends = void 0 && (void 0).__extends || function () {
var _extendStatics = function extendStatics(d, b) {
_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 _extendStatics(d, b);
};
return function (d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var isReact16 = ReactDOM.createPortal !== undefined;
var Facet = function (_super) {
__extends(Facet, _super);
function Facet(props) {
var _this = _super.call(this, props) || this;
_this.displayName = 'Facet';
return _this;
}
Facet.prototype.componentDidUpdate = function () {
this.context.centralizedUpdates(this);
};
Facet.prototype.componentDidMount = function () {
this.context.centralizedUpdates(this);
};
Facet.prototype.render = function () {
if (!this.props.children) {
return null;
}
if (isReact16) {
return this.props.children;
} else {
return React.Children.only(this.props.children);
}
};
Facet.contextTypes = {
centralizedUpdates: PropTypes.func,
hasInViews: PropTypes.bool,
viewId: PropTypes.string
};
return Facet;
}(React.Component);
var _default = Facet;
exports.default = _default;