office-ui-fabric-react
Version:
Reusable React components for building experiences for Microsoft 365.
36 lines • 1.55 kB
JavaScript
import { __assign, __extends } from "tslib";
import * as React from 'react';
import { css, getId, initializeComponentRef } from '../../Utilities';
import { notifyHostChanged, registerLayerHost, unregisterLayerHost } from './Layer.notification';
var LayerHost = /** @class */ (function (_super) {
__extends(LayerHost, _super);
function LayerHost(props) {
var _this = _super.call(this, props) || this;
var layerHostId = getId();
var _a = _this.props.id, hostId = _a === void 0 ? layerHostId : _a;
_this.hostId = hostId;
_this.rootRef = React.createRef();
initializeComponentRef(_this);
return _this;
}
LayerHost.prototype.notifyLayersChanged = function () {
// Nothing, since the default implementation of Layer Host does not need to react to layer changes.
};
LayerHost.prototype.shouldComponentUpdate = function () {
return false;
};
LayerHost.prototype.componentDidMount = function () {
registerLayerHost(this.hostId, this);
notifyHostChanged(this.props.id);
};
LayerHost.prototype.componentWillUnmount = function () {
unregisterLayerHost(this.hostId, this);
notifyHostChanged(this.props.id);
};
LayerHost.prototype.render = function () {
return React.createElement("div", __assign({}, this.props, { className: css('ms-LayerHost', this.props.className), ref: this.rootRef }));
};
return LayerHost;
}(React.Component));
export { LayerHost };
//# sourceMappingURL=LayerHost.js.map