UNPKG

@arcgis/map-components

Version:
117 lines (116 loc) 6.5 kB
import { c as s } from "../../chunks/runtime.js"; import { ref as r } from "lit-html/directives/ref.js"; import { watch as a } from "@arcgis/core/core/reactiveUtils.js"; import h from "@arcgis/core/widgets/UtilityNetworkTrace.js"; import { d as l, a as o, r as d, b as c } from "../../chunks/component-utils.js"; import { o as n } from "../../chunks/disconnected.js"; import { html as p } from "lit"; import { LitElement as f, createEvent as t, 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 g extends f { constructor() { super(...arguments), this._watchHandles = [], this.defaultGraphicColor = { color: [255, 255, 0, 0.6], haloOpacity: 0.9, fillOpacity: 0.2, hex: "#FFFF00" }, this.disabled = !1, this.enableResultArea = !1, this.flags = [], this.gdbVersion = "sde.DEFAULT", this.inputSettings = [], this.position = "bottom-left", this.selectOnCompleteDisabled = !1, this.selectedTraces = [], this.showGraphicsOnCompleteDisabled = !1, this.showSelectionAttributesDisabled = !1, this.arcgisAddFlag = t(), this.arcgisAddFlagComplete = t(), this.arcgisAddFlagError = t(), this.arcgisAddResultArea = t(), this.arcgisReady = t(), this.arcgisRemoveResultArea = t(); } static { this.properties = { defaultGraphicColor: 0, disabled: 7, enableResultArea: 5, flags: 0, gdbVersion: 1, inputSettings: 0, position: 1, referenceElement: 1, resultAreaProperties: 0, selectOnCompleteDisabled: 5, selectedTraces: 0, showGraphicsOnCompleteDisabled: 5, showSelectionAttributesDisabled: 5, view: 0, widget: 0 }; } static { this.shadowRootOptions = w; } // #endregion // #region Public Methods async checkCanTrace() { await this.widget?.checkCanTrace(); } async confirmReset() { this.widget?.confirmReset(); } // #endregion // #region Lifecycle willUpdate(e) { e.has("referenceElement") && this.referenceElementWatcher(this.referenceElement), e.has("enableResultArea") && this.enableResultAreaWatcher(this.enableResultArea), e.has("defaultGraphicColor") && this.defaultGraphicColorWatcher(this.defaultGraphicColor), e.has("disabled") && this.disabledWatcher(this.disabled, e.get("disabled")), e.has("flags") && this.flagsWatcher(this.flags), e.has("gdbVersion") && this.gdbVersionWatcher(this.gdbVersion), e.has("inputSettings") && this.inputSettingsWatcher(this.inputSettings), e.has("resultAreaProperties") && this.resultAreaProperties && this.resultAreaPropertiesWatcher(this.resultAreaProperties), e.has("selectedTraces") && this.selectedTracesWatcher(this.selectedTraces), e.has("selectOnCompleteDisabled") && this.selectOnCompleteDisabledWatcher(this.selectOnCompleteDisabled), e.has("showGraphicsOnCompleteDisabled") && this.showGraphicsOnCompleteDisabledWatcher(this.showGraphicsOnCompleteDisabled), e.has("showSelectionAttributesDisabled") && this.showSelectionAttributesDisabledWatcher(this.showSelectionAttributesDisabled), e.has("position") && this.positionWatcher(this.position), e.has("view") && this.viewWatcher(this.view); } async loaded() { const e = this._createParams(), i = new h(e); this.widget = i, await this._addWatchers(), this._proxyEvents(), this._addContainer(), l(this), o(this); } disconnectedCallback() { super.disconnectedCallback(), n(this); } // #endregion // #region Private Methods referenceElementWatcher(e) { d(this, e); } enableResultAreaWatcher(e) { this.widget && (this.widget.enableResultArea = e); } defaultGraphicColorWatcher(e) { this.widget && (this.widget.defaultGraphicColor = e); } disabledWatcher(e, i) { this.widget && e !== i && (this.widget.disabled = e); } flagsWatcher(e) { this.widget && (this.widget.flags = e); } gdbVersionWatcher(e) { this.widget && (this.widget.gdbVersion = e); } inputSettingsWatcher(e) { this.widget && (this.widget.inputSettings = e); } resultAreaPropertiesWatcher(e) { this.widget && (this.widget.resultAreaProperties = e); } selectedTracesWatcher(e) { this.widget && (this.widget.selectedTraces = e); } selectOnCompleteDisabledWatcher(e) { e !== void 0 && this.widget && (this.widget.selectOnComplete = !e); } showGraphicsOnCompleteDisabledWatcher(e) { e !== void 0 && this.widget && (this.widget.showGraphicsOnComplete = !e); } showSelectionAttributesDisabledWatcher(e) { e !== void 0 && this.widget && (this.widget.showSelectionAttributes = !e); } positionWatcher(e) { e !== void 0 && this.widget && this.el.childElem && this.view.ui?.move(this.el.childElem, e); } viewWatcher(e) { e !== void 0 && this.widget && (this.widget.view = e); } _addContainer() { this.widget.container = this.el.childElem; } async _addWatchers() { c(this, a(() => this.widget.disabled, (e) => this.disabled = e)); } _createParams() { const e = {}; return this.defaultGraphicColor && (e.defaultGraphicColor = this.defaultGraphicColor), this.enableResultArea !== void 0 && (e.enableResultArea = this.enableResultArea), this.flags && (e.flags = this.flags), this.gdbVersion && (e.gdbVersion = this.gdbVersion), this.inputSettings && (e.inputSettings = this.inputSettings), this.resultAreaProperties && (e.resultAreaProperties = this.resultAreaProperties), this.selectedTraces && (e.selectedTraces = this.selectedTraces), this.selectOnCompleteDisabled !== void 0 && (e.selectOnComplete = !this.selectOnCompleteDisabled), this.showGraphicsOnCompleteDisabled !== void 0 && (e.showGraphicsOnComplete = !this.showGraphicsOnCompleteDisabled), this.showSelectionAttributesDisabled !== void 0 && (e.showSelectionAttributes = !this.showSelectionAttributesDisabled), this.view && (e.view = this.view), e; } _proxyEvents() { this.widget.on("add-flag", (e) => this.arcgisAddFlag.emit(e)), this.widget.on("add-flag-complete", (e) => this.arcgisAddFlagComplete.emit(e)), this.widget.on("add-flag-error", (e) => this.arcgisAddFlagError.emit(e)), this.widget.on("add-result-area", (e) => this.arcgisAddResultArea.emit(e)), this.widget.on("remove-result-area", (e) => this.arcgisRemoveResultArea.emit(e)); } _setChildElement(e) { this.el.childElem = e; } // #endregion // #region Rendering render() { return p`<div ${r(this._setChildElement)}></div>`; } } s("arcgis-utility-network-trace", g); export { g as ArcgisUtilityNetworkTrace };