MCPcopy Create free account
hub / github.com/microsoft/SandDance / LayerBase1

Function LayerBase1

docs/app/js/sanddance-app.js:32573–32605  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

32571var LayerBase = /** @class */ function(_super) {
32572 (0, _tslib.__extends)(LayerBase1, _super);
32573 function LayerBase1(props) {
32574 var _this = _super.call(this, props) || this;
32575 _this._rootRef = _react.createRef();
32576 _this._createLayerElement = function() {
32577 var _a1, _b;
32578 var hostId = _this.props.hostId;
32579 var doc = (0, _utilities.getDocument)(_this._rootRef.current);
32580 var host = _this._getHost();
32581 if (!host) return;
32582 // If one was already existing, remove.
32583 _this._removeLayerElement();
32584 // eslint-disable-next-line deprecation/deprecation
32585 var layerElement = (_b = (_a1 = host.ownerDocument, _a1 !== null && _a1 !== void 0 ? _a1 : doc)) === null || _b === void 0 ? void 0 : _b.createElement("div");
32586 if (layerElement) {
32587 var classNames = _this._getClassNames();
32588 layerElement.className = classNames.root;
32589 (0, _utilities.setPortalAttribute)(layerElement);
32590 (0, _utilities.setVirtualParent)(layerElement, _this._rootRef.current);
32591 _this.props.insertFirst ? host.insertBefore(layerElement, host.firstChild) : host.appendChild(layerElement);
32592 _this.setState({
32593 hostId: hostId,
32594 layerElement: layerElement
32595 }, function() {
32596 // eslint-disable-next-line deprecation/deprecation
32597 var _a = _this.props, onLayerDidMount = _a.onLayerDidMount, onLayerMounted = _a.onLayerMounted;
32598 if (onLayerMounted) onLayerMounted();
32599 if (onLayerDidMount) onLayerDidMount();
32600 });
32601 }
32602 };
32603 _this.state = {};
32604 return _this;
32605 }
32606 LayerBase1.prototype.componentDidMount = function() {
32607 var hostId = this.props.hostId;
32608 this._createLayerElement();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected