UNPKG

@arcgis/map-components

Version:
52 lines (51 loc) 1.99 kB
import { c as s } from "../../chunks/runtime.js"; import { g as i, r, d as n, a as o } from "../../chunks/component-utils.js"; import { LitElement as l, createEvent as a, noShadowRoot as c } from "@arcgis/lumina"; import { css as h } from "@lit/reactive-element/css-tag.js"; /*! All material copyright Esri, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. v4.33.13 */ const d = h`@layer{arcgis-placement{display:flex;pointer-events:auto;box-shadow:none}.arcgis-placement__container{display:block}}`; class m extends l { constructor() { super(), this._observer = void 0, this._moveChildren = () => { if (i(this).parentElement !== this.el) for (let t = this.el.firstElementChild; t !== null; t = this.el.firstElementChild) i(this).append(t); }, this.position = "bottom-left", this.arcgisReady = a(); const e = this; e.el.childElem = document.createElement("div"), e.el.childElem.classList.add("arcgis-placement__container"), this.listen("arcgisReady", this._startObserving, { once: !0 }); } static { this.properties = { position: 1, referenceElement: 1 }; } static { this.shadowRootOptions = c; } static { this.styles = d; } connectedCallback() { super.connectedCallback(), this.el.view && this._startObserving(); } willUpdate(e) { e.has("referenceElement") && r(this, this.referenceElement); const t = i(this); e.has("position") && t && this.position !== void 0 && this.el.view?.ui?.move(t, this.position); } loaded() { n(this), o(this); } disconnectedCallback() { super.disconnectedCallback(); const e = i(this); e && this.el.view?.ui?.remove(e), this._observer?.disconnect(); } _startObserving() { this._moveChildren(), this._observer = new MutationObserver(this._moveChildren), this._observer.observe(this.el, { childList: !0 }); } } s("arcgis-placement", m); export { m as ArcgisPlacement };