@arcgis/map-components 5.2.0-next.51 → 5.2.0-next.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/dist/cdn/4JAQPYHG.js +2 -0
  3. package/dist/cdn/{7L4FPBGQ.js → 6G7UWNCY.js} +1 -1
  4. package/dist/cdn/7RN4FELN.js +2 -0
  5. package/dist/cdn/{TXPI3GGA.js → AIVVE6PW.js} +1 -1
  6. package/dist/cdn/{KBQRHXQ4.js → BCDL4T34.js} +1 -1
  7. package/dist/cdn/H5DDBPGU.js +2 -0
  8. package/dist/cdn/HFJDGHMV.js +2 -0
  9. package/dist/cdn/HGL6PAIG.js +2 -0
  10. package/dist/cdn/NWUV3BTR.js +2 -0
  11. package/dist/cdn/{JUBO5HRV.js → PGKGXEJ7.js} +1 -1
  12. package/dist/cdn/{6RSIIYYJ.js → QA56535U.js} +1 -1
  13. package/dist/cdn/SDBR2UYJ.js +2 -0
  14. package/dist/cdn/U26MQUQF.js +2 -0
  15. package/dist/cdn/UOXJUYC7.js +2 -0
  16. package/dist/cdn/index.js +1 -1
  17. package/dist/chunks/useArcgisViewReadyError.js +14 -7
  18. package/dist/components/arcgis-multi-feature-form/customElement.d.ts +9 -7
  19. package/dist/components/arcgis-multi-feature-form/customElement.js +98 -21
  20. package/dist/components/arcgis-paste/customElement.js +1 -1
  21. package/dist/components/arcgis-utility-network-aggregated-geometry/customElement.js +59 -53
  22. package/dist/components/arcgis-utility-network-subnetwork-info/customElement.d.ts +1 -1
  23. package/dist/components/arcgis-utility-network-subnetwork-info/customElement.js +12 -12
  24. package/dist/components/arcgis-utility-network-trace-analysis/customElement.js +116 -105
  25. package/dist/components/arcgis-utility-network-trace-inputs/customElement.js +199 -182
  26. package/dist/components/arcgis-utility-network-trace-location/customElement.js +68 -67
  27. package/dist/components/arcgis-utility-network-trace-location-list/customElement.js +26 -26
  28. package/dist/components/arcgis-utility-network-trace-results/customElement.js +128 -108
  29. package/dist/docs/api.json +1 -1
  30. package/dist/docs/docs.json +1 -1
  31. package/dist/docs/vscode.html-custom-data.json +1 -1
  32. package/dist/docs/web-types.json +1 -1
  33. package/dist/loader.js +2 -2
  34. package/dist/types/lumina.d.ts +2 -2
  35. package/dist/types/preact.d.ts +2 -2
  36. package/dist/types/react.d.ts +2 -2
  37. package/dist/types/stencil.d.ts +2 -2
  38. package/package.json +4 -4
  39. package/dist/cdn/3BU2B6F7.js +0 -2
  40. package/dist/cdn/3HHUVV6D.js +0 -2
  41. package/dist/cdn/4GZ7DNJF.js +0 -2
  42. package/dist/cdn/CWFOZVE7.js +0 -2
  43. package/dist/cdn/J6ZHNOE2.js +0 -2
  44. package/dist/cdn/MUAJSX4F.js +0 -2
  45. package/dist/cdn/MUFXNQE3.js +0 -2
  46. package/dist/cdn/NKWXCVN3.js +0 -2
  47. package/dist/cdn/WMUI4UFI.js +0 -2
@@ -1,130 +1,131 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as x } from "../../chunks/runtime.js";
3
- import { css as C, html as b } from "lit";
4
- import * as G from "@arcgis/core/geometry/operators/cutOperator.js";
2
+ import { c as k } from "../../chunks/runtime.js";
3
+ import { css as I, html as b } from "lit";
4
+ import * as C from "@arcgis/core/geometry/operators/cutOperator.js";
5
5
  import * as T from "@arcgis/core/geometry/operators/lengthOperator.js";
6
6
  import * as L from "@arcgis/core/geometry/operators/projectOperator.js";
7
- import * as I from "@arcgis/core/geometry/operators/proximityOperator.js";
8
- import v from "@arcgis/core/geometry/Polyline.js";
9
- import A from "@arcgis/core/Graphic.js";
7
+ import * as v from "@arcgis/core/geometry/operators/proximityOperator.js";
8
+ import A from "@arcgis/core/geometry/Polyline.js";
9
+ import N from "@arcgis/core/Graphic.js";
10
10
  import w from "@arcgis/core/rest/networks/support/TraceLocation.js";
11
11
  import S from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
12
- import { LitElement as F, createEvent as _ } from "@arcgis/lumina";
12
+ import { LitElement as E, createEvent as x } from "@arcgis/lumina";
13
13
  import { log as l, composeMissingPropertyMessage as m } from "@arcgis/toolkit/log";
14
- import { u as N } from "../../chunks/useT9n.js";
15
- import { d as k, b as P } from "../../chunks/layer-utils.js";
16
- const R = C`calcite-block{--calcite-block-content-space: 0;--calcite-block-border-color: transparent;margin:0}.add-location-button{--calcite-button-border-color: var(--calcite-color-border-1);--calcite-button-icon-color: var(--calcite-color-text-1);--calcite-button-text-color: var(--calcite-color-text-1)}.button-container{display:flex;justify-content:center}`;
17
- class E extends F {
14
+ import { u as F } from "../../chunks/useT9n.js";
15
+ import { d as G, b as P } from "../../chunks/layer-utils.js";
16
+ const R = I`calcite-block{--calcite-block-content-space: 0;--calcite-block-border-color: transparent;margin:0}.add-location-button{--calcite-button-border-color: var(--calcite-color-border-1);--calcite-button-icon-color: var(--calcite-color-text-1);--calcite-button-text-color: var(--calcite-color-text-1)}.button-container{display:flex;justify-content:center}`;
17
+ class $ extends E {
18
18
  constructor() {
19
- super(...arguments), this._messages = N({ blocking: !0 }), this.isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = _(), this.arcgisTraceLocationSelectEnd = _(), this.arcgisTraceLocationSelectStart = _();
19
+ super(...arguments), this._messages = F({ blocking: !0 }), this._isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = x(), this.arcgisTraceLocationSelectEnd = x(), this.arcgisTraceLocationSelectStart = x();
20
20
  }
21
21
  static {
22
- this.properties = { isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0, spatialTolerance: 9, autoDestroyDisabled: 5, utilityNetwork: 0 };
22
+ this.properties = { _isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0, spatialTolerance: 9, autoDestroyDisabled: 5, utilityNetwork: 0 };
23
23
  }
24
24
  static {
25
25
  this.styles = R;
26
26
  }
27
+ #e;
27
28
  async destroy() {
28
- this._resetCursor(), await this.manager.destroy();
29
+ this.#r(), await this.manager.destroy();
29
30
  }
30
31
  async load() {
31
32
  L.isLoaded() || await L.load();
32
33
  }
33
- _calculatePercentAlong(t, e) {
34
+ #a(t, e) {
34
35
  const r = t.clone(), o = r.spatialReference, i = e.spatialReference;
35
36
  if (!o || !i)
36
37
  return l("warn", this, "Unable to calculate percent along because geometry is missing a spatial reference."), -1;
37
38
  let s = e;
38
39
  if (!o.equals(i)) {
39
- const h = L.execute(e, o);
40
- if (!h)
40
+ const d = L.execute(e, o);
41
+ if (!d)
41
42
  return l("warn", this, "Unable to project flag point to source geometry spatial reference."), -1;
42
- s = h;
43
+ s = d;
43
44
  }
44
- const n = I.getNearestCoordinate(r, s);
45
+ const n = v.getNearestCoordinate(r, s);
45
46
  if (n.isEmpty)
46
47
  return l("warn", this, "Unable to compute nearest coordinate for polyline flag."), -1;
47
- const a = n.coordinate, c = a.x - 0.5, u = a.y - 0.5, p = a.x + 0.5, d = a.y + 0.5, g = new v({
48
+ const a = n.coordinate, c = a.x - 0.5, u = a.y - 0.5, p = a.x + 0.5, h = a.y + 0.5, g = new A({
48
49
  hasZ: !1,
49
50
  hasM: !0,
50
51
  paths: [
51
52
  [
52
53
  [c, u],
53
- [p, d]
54
+ [p, h]
54
55
  ]
55
56
  ],
56
57
  spatialReference: r.spatialReference
57
- }), f = G.execute(r, g);
58
+ }), f = C.execute(r, g);
58
59
  if (f.length > 0) {
59
- const h = T.execute(r, { unit: "feet" });
60
+ const d = T.execute(r, { unit: "feet" });
60
61
  let y;
61
- return f[0].paths[0][0][0] === r.paths[0][0][0] ? y = T.execute(f[0], { unit: "feet" }) : f.length > 1 ? y = T.execute(f[1], { unit: "feet" }) : y = 0, y / h;
62
+ return f[0].paths[0][0][0] === r.paths[0][0][0] ? y = T.execute(f[0], { unit: "feet" }) : f.length > 1 ? y = T.execute(f[1], { unit: "feet" }) : y = 0, y / d;
62
63
  }
63
64
  return l("warn", this, "Unable to cut the source geometry with the flag geometry."), -1;
64
65
  }
65
- get _edgeSourceLayerIds() {
66
+ get #i() {
66
67
  const t = this.utilityNetwork?.dataElement?.domainNetworks;
67
68
  return t ? t.flatMap((e) => e.edgeSources).map((e) => e.layerId).filter(Boolean) : [];
68
69
  }
69
- async _handleAddButtonClick() {
70
+ async #s() {
70
71
  const { view: t, sketchViewModel: e } = this;
71
72
  if (!(t && e)) {
72
73
  l("error", this, "Cannot add trace location."), e || l("error", this, m("sketchViewModel")), t || l("error", this, m("view"));
73
74
  return;
74
75
  }
75
76
  if (this.beforeTraceLocationSelectStart) {
76
- this.isSelectWaiting = !0;
77
+ this._isSelectWaiting = !0;
77
78
  try {
78
79
  await this.beforeTraceLocationSelectStart();
79
80
  } finally {
80
- this.isSelectWaiting = !1;
81
+ this._isSelectWaiting = !1;
81
82
  }
82
83
  }
83
- await this._startSketch(t, e);
84
+ await this.#t(t, e);
84
85
  }
85
- async _startSketch(t, e) {
86
- this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => e.cancel() }).defaultPrevented || (this._clickHandler?.remove(), this._clickHandler = e.on("create", (o) => this._handleSketchComplete(o, t, e)), "acquireCursor" in t && t.acquireCursor("crosshair"), e.snappingOptions.enabled = !0, e.create("point"));
86
+ async #t(t, e) {
87
+ this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => e.cancel() }).defaultPrevented || (this.#e?.remove(), this.#e = e.on("create", (o) => this.#o(o, t, e)), "acquireCursor" in t && t.acquireCursor("crosshair"), e.snappingOptions.enabled = !0, e.create("point"));
87
88
  }
88
- _handleSketchComplete(t, e, r) {
89
+ #o(t, e, r) {
89
90
  if (t.state === "complete" && t.graphic) {
90
- r.layer.remove(t.graphic), this._performHitTest(t, e, r);
91
+ r.layer.remove(t.graphic), this.#n(t, e, r);
91
92
  return;
92
93
  }
93
- t.state === "cancel" && (this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit());
94
+ t.state === "cancel" && (this.#r(), this.arcgisTraceLocationSelectEnd.emit());
94
95
  }
95
- async _performHitTest(t, e, r) {
96
+ async #n(t, e, r) {
96
97
  const { utilityNetwork: o } = this, { graphic: i } = t;
97
98
  if (!o) {
98
- l("error", this, m("utilityNetwork")), this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit();
99
+ l("error", this, m("utilityNetwork")), this.#r(), this.arcgisTraceLocationSelectEnd.emit();
99
100
  return;
100
101
  }
101
102
  if (i?.geometry?.type !== "point") {
102
- l("warn", this, "No screen point available for hit test."), this._startSketch(e, r);
103
+ l("warn", this, "No screen point available for hit test."), this.#t(e, r);
103
104
  return;
104
105
  }
105
106
  const s = i.geometry, n = e.toScreen(s);
106
107
  if (!n) {
107
- l("warn", this, "No screen point available for hit test."), this._startSketch(e, r);
108
+ l("warn", this, "No screen point available for hit test."), this.#t(e, r);
108
109
  return;
109
110
  }
110
111
  const c = (await e.hitTest(n, {
111
112
  include: this.filterLayers
112
113
  })).results.filter((p) => p.type === "graphic" && p?.layer && p.graphic);
113
114
  if (!c.length) {
114
- l("info", this, "No usable hit test results found."), this._startSketch(e, r);
115
+ l("info", this, "No usable hit test results found."), this.#t(e, r);
115
116
  return;
116
117
  }
117
- this._resetCursor(), await this._processHitTestResults(c, s, e) ? this.arcgisTraceLocationSelectEnd.emit() : this._startSketch(e, r);
118
+ this.#r(), await this.#c(c, s, e) ? this.arcgisTraceLocationSelectEnd.emit() : this.#t(e, r);
118
119
  }
119
- _resetCursor() {
120
+ #r() {
120
121
  const { view: t, sketchViewModel: e } = this;
121
122
  if (!t) {
122
123
  l("error", this, m("view"));
123
124
  return;
124
125
  }
125
- e && (e.snappingOptions.enabled = !1), this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in t && t.acquireCursor("default");
126
+ e && (e.snappingOptions.enabled = !1), this.#e?.remove(), this.#e = void 0, "acquireCursor" in t && t.acquireCursor("default");
126
127
  }
127
- async _processHitTestResults(t, e, r) {
128
+ async #c(t, e, r) {
128
129
  if (!t.length)
129
130
  return l("error", this, "There are no hit test results to process."), !1;
130
131
  let i = t[0].graphic;
@@ -141,18 +142,18 @@ class E extends F {
141
142
  }
142
143
  if (!i)
143
144
  return l("error", this, "No graphic available from hit test results."), this.arcgisTraceLocationSelectEnd.emit(), !0;
144
- const s = await this._getGraphicWithAttributes(i);
145
- return s ? await this._addTraceLocation(s, e, r) : (l("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit(), !0);
145
+ const s = await this.#l(i);
146
+ return s ? await this.#u(s, e, r) : (l("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit(), !0);
146
147
  }
147
- async _getGraphicWithAttributes(t) {
148
- const e = (k(t.layer), t.layer), r = e.geometryType === null, o = e.fieldsIndex?.get("assetgroup") ?? !1, i = e.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", s = e.fieldsIndex?.get("assettype") ?? !1, n = e.fieldsIndex?.get("assettype")?.name ?? "assettype", a = t.getGlobalId(), c = t.getObjectId(), u = o ? !!t.getAttribute(i) : !0, p = s ? !!t.getAttribute(n) : !0, d = !!t.geometry;
149
- if (a && c && u && p && (d || r))
148
+ async #l(t) {
149
+ const e = (G(t.layer), t.layer), r = e.geometryType === null, o = e.fieldsIndex?.get("assetgroup") ?? !1, i = e.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", s = e.fieldsIndex?.get("assettype") ?? !1, n = e.fieldsIndex?.get("assettype")?.name ?? "assettype", a = t.getGlobalId(), c = t.getObjectId(), u = o ? !!t.getAttribute(i) : !0, p = s ? !!t.getAttribute(n) : !0, h = !!t.geometry;
150
+ if (a && c && u && p && (h || r))
150
151
  return t;
151
152
  const g = e.createQuery();
152
153
  return g.objectIds = [c], (await e.queryFeatures(g)).features[0] || null;
153
154
  }
154
- async _addTraceLocation(t, e, r) {
155
- const { traceLocations: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this._generateFlagInfo(t, e);
155
+ async #u(t, e, r) {
156
+ const { traceLocations: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this.#p(t, e);
156
157
  if (!n)
157
158
  return l("error", this, "Unable to generate flag info for trace location."), !1;
158
159
  const a = o?.filter((u) => u.spatialProperties.mapGraphic?.getGlobalId() === i) ?? [];
@@ -162,11 +163,11 @@ class E extends F {
162
163
  if (a.some((u) => Math.abs(u.traceLocation.percentAlong - n.traceLocation.percentAlong) <= this.spatialTolerance))
163
164
  return l("warn", this, "A flag with the same globalId already exists within tolerance."), !1;
164
165
  }
165
- const c = this._addFlagGraphicToMap(t, e, r);
166
+ const c = this.#h(t, e, r);
166
167
  return c ? (n.spatialProperties.flagGraphic = c, o?.add(n), !0) : (l("warn", this, "Unable to add flag graphic."), !1);
167
168
  }
168
- async _generateFlagInfo(t, e) {
169
- const { traceLocationType: r, utilityNetwork: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this._generateItemTitle(t);
169
+ async #p(t, e) {
170
+ const { traceLocationType: r, utilityNetwork: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this.#f(t);
170
171
  if (s === "point" || s === "polygon") {
171
172
  const a = o?.getTerminalConfiguration(t), c = a ? a.terminals[0].id : 1;
172
173
  return {
@@ -188,7 +189,7 @@ class E extends F {
188
189
  }
189
190
  };
190
191
  } else if (s === "polyline") {
191
- const a = this._calculatePercentAlong(t.geometry, e);
192
+ const a = this.#a(t.geometry, e);
192
193
  return a < 0 ? (l("warn", this, "Unable to calculate percent along for polyline flag."), null) : {
193
194
  traceLocation: new w({
194
195
  type: r,
@@ -208,14 +209,14 @@ class E extends F {
208
209
  }
209
210
  };
210
211
  } else if (!s) {
211
- const a = P(t.layer) ? t.layer.parent : t.layer, c = a && this._edgeSourceLayerIds.includes(a.layerId), u = o?.getTerminalConfiguration(t), p = u ? u.terminals[0].id : c ? -1 : 1, d = c ? 0.5 : -1;
212
+ const a = P(t.layer) ? t.layer.parent : t.layer, c = a && this.#i.includes(a.layerId), u = o?.getTerminalConfiguration(t), p = u ? u.terminals[0].id : c ? -1 : 1, h = c ? 0.5 : -1;
212
213
  return {
213
214
  traceLocation: new w({
214
215
  type: r,
215
216
  isFilterBarrier: !1,
216
217
  globalId: i,
217
218
  terminalId: p,
218
- percentAlong: d
219
+ percentAlong: h
219
220
  }),
220
221
  flagProperties: {
221
222
  title: n,
@@ -231,19 +232,19 @@ class E extends F {
231
232
  }
232
233
  return null;
233
234
  }
234
- async _generateItemTitle(t) {
235
- const e = (k(t.layer), t.layer);
235
+ async #f(t) {
236
+ const e = (G(t.layer), t.layer);
236
237
  return ("getFeatureTitle" in e ? await e.getFeatureTitle(t) : null) || t.getObjectId()?.toString() || this._messages.unknown;
237
238
  }
238
- _addFlagGraphicToMap(t, e, r) {
239
- const o = t.geometry ? t.geometry.type === "point" ? t.geometry : e : null, i = this._getFlagSymbol(), s = new A({
239
+ #h(t, e, r) {
240
+ const o = t.geometry ? t.geometry.type === "point" ? t.geometry : e : null, i = this.#d(), s = new N({
240
241
  geometry: o,
241
242
  symbol: i,
242
243
  attributes: t.attributes
243
244
  });
244
245
  return r.graphics.add(s), s;
245
246
  }
246
- _getFlagSymbol() {
247
+ #d() {
247
248
  const { traceLocationType: t } = this, e = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
248
249
  return t === "stopping-point" ? new S({
249
250
  color: e,
@@ -271,21 +272,21 @@ class E extends F {
271
272
  }
272
273
  });
273
274
  }
274
- _handleClearButtonClick() {
275
+ #g() {
275
276
  const { view: t, traceLocations: e } = this;
276
277
  e?.forEach((r) => {
277
278
  r.spatialProperties.flagGraphic && t && t.graphics.remove(r.spatialProperties.flagGraphic);
278
279
  }), e?.removeAll();
279
280
  }
280
- renderAddLocationBlock() {
281
+ #y() {
281
282
  const { traceLocationType: t, _messages: e, traceLocations: r, view: o } = this, i = t === "starting-point" ? e.types.startingPoint : t === "barrier" ? e.types.barrier : e.types.stoppingPoint, s = i.heading, n = i.description, a = i.buttonText;
282
- return b`<calcite-block .heading=${s} .label=${s} expanded .description=${n}>${r?.length ? b`<calcite-button slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${() => this._handleClearButtonClick()}>${e.buttons.clear}</calcite-button><arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${t} .view=${o}></arcgis-utility-network-trace-location-list>` : null}<div class="button-container"><calcite-button .loading=${this.isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${a} @click=${() => this._handleAddButtonClick()}>${a}</calcite-button></div></calcite-block>`;
283
+ return b`<calcite-block .heading=${s} .label=${s} expanded .description=${n}>${r?.length ? b`<calcite-button slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${() => this.#g()}>${e.buttons.clear}</calcite-button><arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${t} .view=${o}></arcgis-utility-network-trace-location-list>` : null}<div class="button-container"><calcite-button .loading=${this._isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${a} @click=${() => this.#s()}>${a}</calcite-button></div></calcite-block>`;
283
284
  }
284
285
  render() {
285
- return b`<div class="root">${this.renderAddLocationBlock()}</div>`;
286
+ return b`<div class="root">${this.#y()}</div>`;
286
287
  }
287
288
  }
288
- x("arcgis-utility-network-trace-location", E);
289
+ k("arcgis-utility-network-trace-location", $);
289
290
  export {
290
- E as ArcgisUtilityNetworkTraceLocation
291
+ $ as ArcgisUtilityNetworkTraceLocation
291
292
  };
@@ -1,67 +1,67 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as m } from "../../chunks/runtime.js";
3
- import { css as h, html as c } from "lit";
4
- import p from "@arcgis/core/core/Collection.js";
3
+ import { css as p, html as a } from "lit";
4
+ import h from "@arcgis/core/core/Collection.js";
5
5
  import { substitute as u } from "@arcgis/core/intl.js";
6
6
  import { LitElement as g } from "@arcgis/lumina";
7
7
  import { log as l, composeEmptyPropertyMessage as b } from "@arcgis/toolkit/log";
8
- import { u as v } from "../../chunks/useT9n.js";
9
- const f = h`:host{padding:0 var(--calcite-spacing-sm) var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}calcite-list{border:solid 1px var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sm);overflow:hidden}calcite-list-item[selected] [slot=content-bottom]{display:block}.warning{color:var(--calcite-color-status-danger)}.terminals{padding:var(--calcite-spacing-sm) var(--calcite-spacing-md);display:flex;flex-direction:column}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
8
+ import { u as f } from "../../chunks/useT9n.js";
9
+ const v = p`:host{padding:0 var(--calcite-spacing-sm) var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}calcite-list{border:solid 1px var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sm);overflow:hidden}calcite-list-item[selected] [slot=content-bottom]{display:block}.warning{color:var(--calcite-color-status-danger)}.terminals{padding:var(--calcite-spacing-sm) var(--calcite-spacing-md);display:flex;flex-direction:column}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
10
10
  class $ extends g {
11
11
  constructor() {
12
- super(...arguments), this._messages = v({ blocking: !0 }), this.traceLocations = new p(), this.traceLocationType = "starting-point";
12
+ super(...arguments), this._messages = f({ blocking: !0 }), this.traceLocations = new h(), this.traceLocationType = "starting-point";
13
13
  }
14
14
  static {
15
15
  this.properties = { traceLocations: 0, traceLocationType: 1, view: 0 };
16
16
  }
17
17
  static {
18
- this.styles = f;
18
+ this.styles = v;
19
19
  }
20
20
  loaded() {
21
21
  this.traceLocations.length || l("warn", this, b("traceLocations"));
22
22
  }
23
- _handleTraceLocationItemRemoved(e) {
23
+ #e(e) {
24
24
  const { traceLocations: i, view: t } = this;
25
25
  e.spatialProperties.flagGraphic && t && t.graphics.remove(e.spatialProperties.flagGraphic), i?.remove(e);
26
26
  }
27
- _renderTerminal(e, i) {
28
- const { flagProperties: t } = e, { selectedTerminals: r } = t, { name: s, id: a } = i, n = r?.has(a) ?? !1;
29
- return c`<calcite-label layout=inline><calcite-checkbox .value=${a} .checked=${n} @calciteCheckboxChange=${(o) => {
30
- o.target.checked ? r?.add(a) : r?.delete(a), this.requestUpdate();
27
+ #t(e, i) {
28
+ const { flagProperties: t } = e, { selectedTerminals: r } = t, { name: s, id: c } = i, n = r?.has(c) ?? !1;
29
+ return a`<calcite-label layout=inline><calcite-checkbox .value=${c} .checked=${n} @calciteCheckboxChange=${(o) => {
30
+ o.target.checked ? r?.add(c) : r?.delete(c), this.requestUpdate();
31
31
  }}></calcite-checkbox>${s}</calcite-label>`;
32
32
  }
33
- _renderTerminalError() {
34
- return c`<calcite-notice kind=danger open scale=s width=auto><div slot=message>${this._messages.errors.noTerminalSelected}</div></calcite-notice>`;
33
+ #i() {
34
+ return a`<calcite-notice kind=danger open scale=s width=auto><div slot=message>${this._messages.errors.noTerminalSelected}</div></calcite-notice>`;
35
35
  }
36
- _renderFilterBarrier(e) {
36
+ #r(e) {
37
37
  const { traceLocation: i } = e;
38
- return c`<calcite-label layout=inline><div class="filter-barrier">${this._messages.labels.filterBarrier}<calcite-switch .checked=${i.isFilterBarrier} @calciteSwitchChange=${(t) => {
38
+ return a`<calcite-label layout=inline><div class="filter-barrier">${this._messages.labels.filterBarrier}<calcite-switch .checked=${i.isFilterBarrier} @calciteSwitchChange=${(t) => {
39
39
  i.isFilterBarrier = t.target.checked;
40
40
  }}></calcite-switch></div></calcite-label>`;
41
41
  }
42
- _renderContents(e) {
43
- const { flagProperties: i } = e, { terminalConfiguration: t, selectedTerminals: r } = i, s = e.traceLocation.type === "barrier", a = t && t.terminals.length > 0 && r?.size === 0;
44
- return c`<calcite-action .icon=${i.expanded ? "chevron-up" : "chevron-down"} slot=actions-end scale=s text @click=${() => {
42
+ #c(e) {
43
+ const { flagProperties: i } = e, { terminalConfiguration: t, selectedTerminals: r } = i, s = e.traceLocation.type === "barrier", c = t && t.terminals.length > 0 && r?.size === 0;
44
+ return a`<calcite-action .icon=${i.expanded ? "chevron-up" : "chevron-down"} slot=actions-end scale=s text @click=${() => {
45
45
  i.expanded = !i.expanded, this.requestUpdate();
46
- }}></calcite-action>${a && c`<calcite-icon class="warning" icon=exclamation-mark-triangle scale=s slot=content-start></calcite-icon>` || ""}${i.expanded && c`<div class="terminals" slot=content-bottom>${s && this._renderFilterBarrier(e) || ""}${t && this._renderTerminals(e) || ""}${a && this._renderTerminalError() || ""}</div>` || ""}`;
46
+ }}></calcite-action>${c && a`<calcite-icon class="warning" icon=exclamation-mark-triangle scale=s slot=content-start></calcite-icon>` || ""}${i.expanded && a`<div class="terminals" slot=content-bottom>${s && this.#r(e) || ""}${t && this.#a(e) || ""}${c && this.#i() || ""}</div>` || ""}`;
47
47
  }
48
- _renderTerminals(e) {
48
+ #a(e) {
49
49
  const { flagProperties: i } = e, { terminalConfiguration: t } = i;
50
50
  if (!t)
51
51
  return l("warn", this, "One or more locations are missing the required flag property `terminalConfiguration`."), [];
52
52
  const r = t.terminals;
53
- return r.length ? r.length === 1 ? [] : r.map((a) => this._renderTerminal(e, a)) : (l("warn", this, "`terminalConfiguration.terminals` is required but either missing or empty.`"), []);
53
+ return r.length ? r.length === 1 ? [] : r.map((c) => this.#t(e, c)) : (l("warn", this, "`terminalConfiguration.terminals` is required but either missing or empty.`"), []);
54
54
  }
55
- _renderListItem(e) {
56
- const { flagProperties: i } = e, { terminalConfiguration: t, expanded: r, title: s } = i, a = t && t.id !== 0, n = e.traceLocation.type === "barrier", o = a || n, d = t?.name ?? void 0;
57
- return c`<calcite-list-item .label=${s} .description=${d} .value=${s} .expanded=${r}>${o ? this._renderContents(e) : c`<div slot=content-bottom></div>`}<calcite-action icon=x slot=actions-end scale=s text @click=${() => this._handleTraceLocationItemRemoved(e)}></calcite-action></calcite-list-item>`;
55
+ #s(e) {
56
+ const { flagProperties: i } = e, { terminalConfiguration: t, expanded: r, title: s } = i, c = t && t.id !== 0, n = e.traceLocation.type === "barrier", o = c || n, d = t?.name ?? void 0;
57
+ return a`<calcite-list-item .label=${s} .description=${d} .value=${s} .expanded=${r}>${o ? this.#c(e) : a`<div slot=content-bottom></div>`}<calcite-action icon=x slot=actions-end scale=s text @click=${() => this.#e(e)}></calcite-action></calcite-list-item>`;
58
58
  }
59
59
  render() {
60
- const e = this.traceLocations.map((t) => this._renderListItem(t)).toArray();
60
+ const e = this.traceLocations.map((t) => this.#s(t)).toArray();
61
61
  if (!e.length)
62
62
  return null;
63
63
  const i = u(this._messages.labels.list, { traceLocationType: this.traceLocationType });
64
- return c`<div><calcite-list interaction-mode=static selection-mode=none .label=${i}>${e}</calcite-list></div>`;
64
+ return a`<div><calcite-list interaction-mode=static selection-mode=none .label=${i}>${e}</calcite-list></div>`;
65
65
  }
66
66
  }
67
67
  m("arcgis-utility-network-trace-location-list", $);