@arcgis/map-components
Version:
ArcGIS Map Components
77 lines (76 loc) • 2.87 kB
JavaScript
import { c as e } from "../../chunks/runtime.js";
import { ref as o } from "lit-html/directives/ref.js";
import s from "@arcgis/core/widgets/UtilityNetworkValidateTopology.js";
import { d as a, a as r, r as l } from "../../chunks/component-utils.js";
import { o as h } from "../../chunks/disconnected.js";
import { html as d } from "lit";
import { LitElement as n, createEvent as c, noShadowRoot as w } from "@arcgis/lumina";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
v4.32.13 */
class m extends n {
constructor() {
super(...arguments), this._watchHandles = [], this.extentToValidate = "current", this.position = "bottom-left", this.arcgisReady = c();
}
static {
this.properties = { extentToValidate: 1, position: 1, referenceElement: 1, utilityNetwork: 0, view: 0, widget: 0 };
}
static {
this.shadowRootOptions = w;
}
// #endregion
// #region Lifecycle
willUpdate(t) {
t.has("referenceElement") && this.referenceElementWatcher(this.referenceElement), t.has("extentToValidate") && this.extentToValidateWatcher(this.extentToValidate), t.has("utilityNetwork") && this.utilityNetworkWatcher(this.utilityNetwork), t.has("position") && this.positionWatcher(this.position), t.has("view") && this.viewWatcher(this.view);
}
async loaded() {
const t = this._createParams(), i = new s(t);
this.widget = i, this._addContainer(), a(this), r(this);
}
disconnectedCallback() {
super.disconnectedCallback(), h(this);
}
// #endregion
// #region Private Methods
referenceElementWatcher(t) {
l(this, t);
}
extentToValidateWatcher(t) {
this.widget && (this.widget.extentToValidate = t);
}
utilityNetworkWatcher(t) {
this.widget && t && (this.widget.utilityNetwork = t);
}
positionWatcher(t) {
t !== void 0 && this.widget && this.el.childElem && this.view.ui?.move(this.el.childElem, t);
}
viewWatcher(t) {
t !== void 0 && this.widget && (this.widget.view = t, this._loadUtilityNetwork());
}
_addContainer() {
this.widget.container = this.el.childElem;
}
_createParams() {
const t = {};
return this.extentToValidate !== void 0 && (t.extentToValidate = this.extentToValidate), this.utilityNetwork !== void 0 && (t.utilityNetwork = this.utilityNetwork), t;
}
async _loadUtilityNetwork() {
if (this.view?.map && this.view.map.portalItem) {
await this.view.map.load();
const t = this.view.map.utilityNetworks?.getItemAt(0);
await t?.load(), this.utilityNetwork = t;
}
}
_setChildElement(t) {
this.el.childElem = t;
}
// #endregion
// #region Rendering
render() {
return d`<div ${o(this._setChildElement)}></div>`;
}
}
e("arcgis-utility-network-validate-topology", m);
export {
m as ArcgisUtilityNetworkValidateTopology
};