@arcgis/map-components 5.1.0-next.47 → 5.1.0-next.49

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 (63) hide show
  1. package/dist/cdn/{JFNCIZRD.js → 2CHYBLOC.js} +1 -1
  2. package/dist/cdn/{UMPYIYP6.js → 2G3HODZY.js} +1 -1
  3. package/dist/cdn/{ERCTSHRH.js → 3KOWS73L.js} +1 -1
  4. package/dist/cdn/3KZ42JDF.js +2 -0
  5. package/dist/cdn/4BF7JJHX.js +2 -0
  6. package/dist/cdn/{T5MRUYOH.js → 53A4TVFJ.js} +1 -1
  7. package/dist/cdn/{5FJIKNID.js → 63VDVNOO.js} +1 -1
  8. package/dist/cdn/{CYSDIJ4L.js → 73W64JNK.js} +1 -1
  9. package/dist/cdn/DE5AA22M.js +2 -0
  10. package/dist/cdn/{YET5HTLQ.js → DEUTYZQD.js} +1 -1
  11. package/dist/cdn/{BDA4BCEB.js → DQJMLG55.js} +1 -1
  12. package/dist/cdn/DYI5GSBP.js +2 -0
  13. package/dist/cdn/{KWZTLNUH.js → FL3CDOKT.js} +1 -1
  14. package/dist/cdn/{CC77IOI3.js → G2QS2EES.js} +1 -1
  15. package/dist/cdn/{FF5VMKLK.js → GV445FXS.js} +1 -1
  16. package/dist/cdn/{I6PZUSTS.js → HBJXWV7A.js} +1 -1
  17. package/dist/cdn/I7NY2VAH.js +2 -0
  18. package/dist/cdn/IUL5Z7VB.js +2 -0
  19. package/dist/cdn/{XOARVKET.js → MN6VPZBF.js} +1 -1
  20. package/dist/cdn/{ET2U2ZGP.js → P4KEOVAP.js} +1 -1
  21. package/dist/cdn/{LY77GAJT.js → RBTA7SDX.js} +1 -1
  22. package/dist/cdn/{6E7H5LPA.js → SUCLDKGU.js} +1 -1
  23. package/dist/cdn/{F2SNWNAZ.js → TPLNBIOY.js} +1 -1
  24. package/dist/cdn/{PNGKWZJQ.js → TVLLHHUA.js} +1 -1
  25. package/dist/cdn/{R42WEZRB.js → UDSVK25W.js} +1 -1
  26. package/dist/cdn/WDAYQZKY.js +2 -0
  27. package/dist/cdn/WH7FEIAX.js +2 -0
  28. package/dist/cdn/{REQFNQZY.js → WR3AVKYZ.js} +1 -1
  29. package/dist/cdn/{W27U4A3P.js → WUWAJE6E.js} +1 -1
  30. package/dist/cdn/index.js +1 -1
  31. package/dist/chunks/layer-utils.js +15 -14
  32. package/dist/components/arcgis-bookmarks/customElement.js +1 -1
  33. package/dist/components/arcgis-building-explorer/customElement.js +14 -9
  34. package/dist/components/arcgis-coordinate-conversion/customElement.js +23 -22
  35. package/dist/components/arcgis-daylight/customElement.js +148 -144
  36. package/dist/components/arcgis-editor/customElement.js +1 -1
  37. package/dist/components/arcgis-sketch/customElement.js +13 -13
  38. package/dist/components/arcgis-snapping-controls/customElement.js +3 -3
  39. package/dist/components/arcgis-swipe/customElement.d.ts +5 -6
  40. package/dist/components/arcgis-swipe/customElement.js +55 -43
  41. package/dist/components/arcgis-utility-network-trace-inputs/customElement.js +68 -62
  42. package/dist/components/arcgis-utility-network-trace-location/customElement.d.ts +7 -2
  43. package/dist/components/arcgis-utility-network-trace-location/customElement.js +210 -216
  44. package/dist/components/arcgis-utility-network-trace-location-list/customElement.d.ts +3 -0
  45. package/dist/components/arcgis-utility-network-trace-location-list/customElement.js +12 -12
  46. package/dist/components/arcgis-volume-measurement/customElement.js +4 -4
  47. package/dist/docs/api.json +1 -1
  48. package/dist/docs/docs.json +1 -1
  49. package/dist/docs/web-types.json +1 -1
  50. package/dist/loader.js +2 -2
  51. package/dist/types/lumina.d.ts +2 -2
  52. package/dist/types/preact.d.ts +2 -2
  53. package/dist/types/react.d.ts +2 -2
  54. package/dist/types/stencil.d.ts +2 -2
  55. package/package.json +4 -4
  56. package/dist/cdn/23JXEUKK.js +0 -2
  57. package/dist/cdn/76RS6RKB.js +0 -2
  58. package/dist/cdn/EHPHVZAX.js +0 -2
  59. package/dist/cdn/MYWUNBD6.js +0 -2
  60. package/dist/cdn/ORFDJKWO.js +0 -2
  61. package/dist/cdn/QRZPQOL3.js +0 -2
  62. package/dist/cdn/RUESKUUR.js +0 -2
  63. package/dist/cdn/WFCOTNQQ.js +0 -2
@@ -2,7 +2,6 @@
2
2
  import type Collection from "@arcgis/core/core/Collection.js";
3
3
  import type Point from "@arcgis/core/geometry/Point.js";
4
4
  import type Graphic from "@arcgis/core/Graphic.js";
5
- import type GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
6
5
  import type Layer from "@arcgis/core/layers/Layer.js";
7
6
  import type TerminalConfiguration from "@arcgis/core/networks/support/TerminalConfiguration.js";
8
7
  import type UtilityNetwork from "@arcgis/core/networks/UtilityNetwork.js";
@@ -22,6 +21,13 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
22
21
  * @internal
23
22
  */
24
23
  export abstract class ArcgisUtilityNetworkTraceLocation extends LitElement {
24
+ /**
25
+ * A function to run after a hit test is performed to select a trace location. If left empty, the first graphic from the hit test results will be used as the trace location.
26
+ * This function allows for modification of the selected graphic before it is added as a trace location, such as changing its attributes or geometry.
27
+ * If the promise is rejected, the selection process will be cancelled.
28
+ *
29
+ * @internal
30
+ */
25
31
  accessor afterHitTest: ((graphics: Graphic[]) => Promise<Graphic>) | undefined;
26
32
  /** @default false */
27
33
  accessor autoDestroyDisabled: boolean;
@@ -32,7 +38,6 @@ export abstract class ArcgisUtilityNetworkTraceLocation extends LitElement {
32
38
  */
33
39
  accessor beforeTraceLocationSelectStart: (() => Promise<void>) | undefined;
34
40
  accessor filterLayers: Collection<Layer> | undefined;
35
- accessor flagLayer: GraphicsLayer | undefined;
36
41
  /** @internal */
37
42
  protected messages: {
38
43
  buttons: { clear: string; };
@@ -1,296 +1,290 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as T } from "../../chunks/runtime.js";
3
- import { css as L, html as p } from "lit";
4
- import * as _ from "@arcgis/core/geometry/operators/cutOperator.js";
5
- import * as g from "@arcgis/core/geometry/operators/lengthOperator.js";
6
- import * as y from "@arcgis/core/geometry/operators/projectOperator.js";
7
- import S from "@arcgis/core/geometry/Polyline.js";
8
- import v from "@arcgis/core/geometry/SpatialReference.js";
9
- import A from "@arcgis/core/Graphic.js";
10
- import m from "@arcgis/core/rest/networks/support/TraceLocation.js";
11
- import b from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
12
- import { LitElement as x, createEvent as w } from "@arcgis/lumina";
13
- import { log as l } from "@arcgis/toolkit/log";
14
- import { u as I } from "../../chunks/useT9n.js";
15
- import { i as C } from "../../chunks/layer-utils.js";
16
- const F = L`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{justify-content:center;display:grid}.clear-button{--calcite-button-border-color: transparent}`;
17
- class G extends x {
2
+ import { c as k } from "../../chunks/runtime.js";
3
+ import { css as _, html as f } from "lit";
4
+ import * as x from "@arcgis/core/geometry/operators/cutOperator.js";
5
+ import * as y from "@arcgis/core/geometry/operators/lengthOperator.js";
6
+ import * as m from "@arcgis/core/geometry/operators/projectOperator.js";
7
+ import C from "@arcgis/core/geometry/Polyline.js";
8
+ import I from "@arcgis/core/geometry/SpatialReference.js";
9
+ import F from "@arcgis/core/Graphic.js";
10
+ import b from "@arcgis/core/rest/networks/support/TraceLocation.js";
11
+ import w from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
12
+ import { LitElement as A, createEvent as T } from "@arcgis/lumina";
13
+ import { log as u, composeMissingPropertyMessage as g } from "@arcgis/toolkit/log";
14
+ import { u as G } from "../../chunks/useT9n.js";
15
+ import { d as S, i as v } from "../../chunks/layer-utils.js";
16
+ const P = _`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{justify-content:center;display:grid}.clear-button{--calcite-button-border-color: transparent}`;
17
+ class N extends A {
18
18
  constructor() {
19
- super(...arguments), this.messages = I({ blocking: !0 }), this.isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = w(), this.arcgisTraceLocationSelectEnd = w(), this.arcgisTraceLocationSelectStart = w();
19
+ super(...arguments), this.messages = G({ blocking: !0 }), this.isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = T(), this.arcgisTraceLocationSelectEnd = T(), this.arcgisTraceLocationSelectStart = T();
20
20
  }
21
21
  static {
22
- this.properties = { isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0, flagLayer: 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
- this.styles = F;
25
+ this.styles = P;
26
26
  }
27
27
  async destroy() {
28
- this._resetAfterSketch(!1), await this.manager.destroy();
28
+ this._resetCursor(), await this.manager.destroy();
29
29
  }
30
30
  async load() {
31
- y.isLoaded() || await y.load();
31
+ m.isLoaded() || await m.load();
32
32
  }
33
- _createPolyline(e, t) {
34
- return new S({
33
+ _createPolyline(t, e) {
34
+ return new C({
35
35
  hasZ: !1,
36
36
  hasM: !0,
37
- paths: e,
38
- spatialReference: new v({ wkid: t })
37
+ paths: t,
38
+ spatialReference: new I({ wkid: e })
39
39
  });
40
40
  }
41
- _calculatePercentAlong(e, t) {
42
- const r = e.spatialReference, a = this._createPolyline(e.paths, r.wkid), s = t.x - 0.5, n = t.x + 0.5, o = t.y - 0.5, i = t.y + 0.5, c = [
41
+ _calculatePercentAlong(t, e) {
42
+ const r = t.spatialReference, s = this._createPolyline(t.paths, r.wkid), o = e.x - 0.5, i = e.x + 0.5, c = e.y - 0.5, a = e.y + 0.5, n = [
43
43
  [
44
- [s, o],
45
- [n, i]
44
+ [o, c],
45
+ [i, a]
46
46
  ]
47
- ], u = this._createPolyline(c, t.spatialReference.wkid), h = y.execute(u, r);
48
- if (!h)
49
- return l("error", this, "Unable to project flag geometry to source geometry spatial reference."), 0.5;
50
- const d = _.execute(a, h);
47
+ ], l = this._createPolyline(n, e.spatialReference.wkid), p = m.execute(l, r);
48
+ if (!p)
49
+ return u("error", this, "Unable to project flag geometry to source geometry spatial reference."), 0.5;
50
+ const d = x.execute(s, p);
51
51
  if (d.length > 0) {
52
- const k = g.execute(a, { unit: "feet" });
53
- let f;
54
- return d[0].paths[0][0][0] === a.paths[0][0][0] ? f = g.execute(d[0], { unit: "feet" }) : d.length > 1 ? f = g.execute(d[1], { unit: "feet" }) : f = 0, f / k;
52
+ const L = y.execute(s, { unit: "feet" });
53
+ let h;
54
+ return d[0].paths[0][0][0] === s.paths[0][0][0] ? h = y.execute(d[0], { unit: "feet" }) : d.length > 1 ? h = y.execute(d[1], { unit: "feet" }) : h = 0, h / L;
55
55
  }
56
- return l("warn", this, "Unable to cut the source geometry with the flag geometry."), 0.5;
56
+ return u("warn", this, "Unable to cut the source geometry with the flag geometry."), 0.5;
57
57
  }
58
58
  get _edgeSourceLayerIds() {
59
- const e = this.utilityNetwork?.dataElement?.domainNetworks;
60
- return e ? e.flatMap((t) => t.edgeSources).map((t) => t.layerId).filter(Boolean) : [];
59
+ const t = this.utilityNetwork?.dataElement?.domainNetworks;
60
+ return t ? t.flatMap((e) => e.edgeSources).map((e) => e.layerId).filter(Boolean) : [];
61
61
  }
62
- async _ensureNecessaryAttributes(e) {
63
- const t = (e.layer?.type === "feature", e.layer), r = t.fieldsIndex?.get("assetgroup") ?? !1, a = t.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", s = t.fieldsIndex?.get("assettype") ?? !1, n = t.fieldsIndex?.get("assettype")?.name ?? "assettype", o = e.getGlobalId(), i = e.getObjectId(), c = r ? !!e.getAttribute(a) : !0, u = s ? !!e.getAttribute(n) : !0;
64
- if (o && i && c && u)
65
- return e;
66
- const h = t.createQuery();
67
- return h.objectIds = [i], (await t.queryFeatures(h))?.features[0] || null;
62
+ async _handleAddButtonClick() {
63
+ const { view: t, sketchViewModel: e } = this;
64
+ if (!(t && e)) {
65
+ u("error", this, "Cannot add trace location."), e || u("error", this, g("sketchViewModel")), t || u("error", this, g("view"));
66
+ return;
67
+ }
68
+ if (this.beforeTraceLocationSelectStart) {
69
+ this.isSelectWaiting = !0;
70
+ try {
71
+ await this.beforeTraceLocationSelectStart();
72
+ } finally {
73
+ this.isSelectWaiting = !1;
74
+ }
75
+ }
76
+ this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => e.cancel() }).defaultPrevented || await this._startSketch(t, e);
77
+ }
78
+ async _startSketch(t, e) {
79
+ this._clickHandler?.remove(), this._clickHandler = e.on("create", (r) => this._handleSketchComplete(r, t, e)), "acquireCursor" in t && t.acquireCursor("crosshair"), this.sketchViewModel?.create("point");
68
80
  }
69
- async _ensureNecessaryAttributesAndGenerateTraceLocation(e, t) {
70
- const { view: r } = this;
71
- if (!r || e.length === 0) {
72
- l("error", this, "`view` is unavailable or there are no results to process.");
81
+ _handleSketchComplete(t, e, r) {
82
+ if (t.state === "complete" && t.graphic) {
83
+ r.layer.remove(t.graphic), this._performHitTest(t, e, r);
73
84
  return;
74
85
  }
75
- const a = e[0], s = e.map((i) => {
76
- const c = i, u = c.graphic;
77
- return u.origin = c.layer, u;
78
- }), n = this.afterHitTest ? await this.afterHitTest(s).catch(() => (this._resetAfterSketch(!0), null)) : a.graphic;
79
- if (!n) {
80
- l("error", this, "No graphic available from hit test results.");
86
+ t.state === "cancel" && (this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit());
87
+ }
88
+ async _performHitTest(t, e, r) {
89
+ const { utilityNetwork: s } = this;
90
+ if (!s) {
91
+ u("error", this, g("utilityNetwork")), this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit();
81
92
  return;
82
93
  }
83
- const o = await this._ensureNecessaryAttributes(n);
84
- if (!o) {
85
- l("error", this, "Unable to ensure necessary attributes on the selected graphic.");
94
+ const o = t.graphic?.geometry, i = e.toScreen(o);
95
+ if (!i) {
96
+ u("warn", this, "No screen point available for hit test."), this._startSketch(e, r);
86
97
  return;
87
98
  }
88
- await this._generateTraceLocation(o, t);
99
+ const a = (await e.hitTest(i, {
100
+ include: this.filterLayers
101
+ })).results.filter((n) => n.type === "graphic" && n?.layer && n.graphic);
102
+ if (a.length === 0) {
103
+ u("info", this, "No usable hit test results found."), this._startSketch(e, r);
104
+ return;
105
+ }
106
+ this._resetCursor(), await this._processHitTestResults(a, o, e), this.arcgisTraceLocationSelectEnd.emit();
89
107
  }
90
- _createFlagSymbol() {
91
- const { traceLocationType: e } = this, t = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
92
- return e === "stopping-point" ? new b({
93
- color: t,
94
- style: "x",
95
- size: 12,
96
- outline: {
97
- color: t,
98
- width: 2
99
- }
100
- }) : e === "barrier" ? new b({
101
- color: t,
102
- style: "square",
103
- size: 12,
104
- outline: {
105
- color: t,
106
- width: 0
107
- }
108
- }) : new b({
109
- color: r,
110
- style: "circle",
111
- size: 12,
112
- outline: {
113
- color: r,
114
- width: 0
115
- }
116
- });
108
+ _resetCursor() {
109
+ const { view: t } = this;
110
+ if (!t) {
111
+ u("error", this, g("view"));
112
+ return;
113
+ }
114
+ this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in t && t.acquireCursor("default");
117
115
  }
118
- _addFlagGraphic(e, t, r) {
119
- const { flagLayer: a, view: s } = this;
120
- if (!a || !s)
121
- return l("error", this, "The properties `flagLayer` and `view` are required but either one or both are missing."), null;
122
- const n = t.geometry?.type;
123
- if (this.traceLocations?.some((c) => c.traceLocation.globalId === e) && n !== "polyline")
124
- return l("warn", this, "A flag with the same globalId already exists."), null;
125
- const o = this._createFlagSymbol(), i = new A({
126
- geometry: r,
127
- symbol: o,
128
- attributes: t.attributes
129
- });
130
- return a.add(i), i;
116
+ async _processHitTestResults(t, e, r) {
117
+ if (t.length === 0) {
118
+ u("error", this, "There are no hit test results to process.");
119
+ return;
120
+ }
121
+ const s = t[0], o = t.map((a) => {
122
+ const n = a, l = n.graphic;
123
+ return l.origin = n.layer, l.sourceLayer = n.layer, l;
124
+ }), i = this.afterHitTest ? await this.afterHitTest(o).catch(() => (
125
+ // if the callback is rejected treat it as a cancellation of the selection process, and do not add a trace location
126
+ null
127
+ )) : s.graphic;
128
+ if (!i) {
129
+ u("error", this, "No graphic available from hit test results."), this.arcgisTraceLocationSelectEnd.emit();
130
+ return;
131
+ }
132
+ const c = await this._ensureNecessaryAttributes(i);
133
+ if (!c) {
134
+ u("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit();
135
+ return;
136
+ }
137
+ await this._generateTraceLocation(c, e, r);
131
138
  }
132
- async _generateItemTitle(e) {
133
- const { messages: t } = this, r = (e.layer?.type === "feature", e.layer);
134
- return ("getFeatureTitle" in r ? await r.getFeatureTitle(e) : null) || e?.getObjectId()?.toString() || t.labels.unknown;
139
+ async _ensureNecessaryAttributes(t) {
140
+ const e = (S(t.layer), t.layer), r = e.fieldsIndex?.get("assetgroup") ?? !1, s = e.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", o = e.fieldsIndex?.get("assettype") ?? !1, i = e.fieldsIndex?.get("assettype")?.name ?? "assettype", c = t.getGlobalId(), a = t.getObjectId(), n = r ? !!t.getAttribute(s) : !0, l = o ? !!t.getAttribute(i) : !0;
141
+ if (c && a && n && l)
142
+ return t;
143
+ const p = e.createQuery();
144
+ return p.objectIds = [a], (await e.queryFeatures(p))?.features[0] || null;
135
145
  }
136
- async _generateFlagInfo(e, t) {
137
- const { traceLocationType: r, utilityNetwork: a } = this, s = e.getGlobalId() ?? "", n = e.geometry?.type, o = await this._generateItemTitle(e);
138
- if (n === "point" || n === "polygon") {
139
- const i = a?.getTerminalConfiguration(e), c = i ? i.terminals[0].id : 1;
146
+ async _generateTraceLocation(t, e, r) {
147
+ const { traceLocations: s } = this, o = t.getGlobalId() ?? "", i = t.geometry?.type, c = await this._generateFlagInfo(t, e);
148
+ if (!c) {
149
+ u("error", this, "Unable to generate flag info for trace location.");
150
+ return;
151
+ }
152
+ const a = s?.filter((l) => l.spatialProperties.mapGraphic?.getGlobalId() === o) ?? [];
153
+ if (a.length > 0) {
154
+ if (i !== "polyline") {
155
+ u("warn", this, "A flag with the same globalId already exists.");
156
+ return;
157
+ } else if (a.some((l) => Math.abs(l.traceLocation.percentAlong - c.traceLocation.percentAlong) <= this.spatialTolerance)) {
158
+ u("warn", this, "A flag with the same globalId already exists within tolerance.");
159
+ return;
160
+ }
161
+ }
162
+ const n = this._addFlagGraphic(t, e, r);
163
+ if (!n) {
164
+ u("warn", this, "Unable to add flag graphic.");
165
+ return;
166
+ }
167
+ c.spatialProperties.flagGraphic = n, s?.add(c);
168
+ }
169
+ async _generateFlagInfo(t, e) {
170
+ const { traceLocationType: r, utilityNetwork: s } = this, o = t.getGlobalId() ?? "", i = t.geometry?.type, c = await this._generateItemTitle(t);
171
+ if (i === "point" || i === "polygon") {
172
+ const a = s?.getTerminalConfiguration(t), n = a ? a.terminals[0].id : 1;
140
173
  return {
141
- traceLocation: new m({
174
+ traceLocation: new b({
142
175
  type: r,
143
176
  isFilterBarrier: !1,
144
- globalId: s,
145
- terminalId: c
177
+ globalId: o,
178
+ terminalId: n
146
179
  }),
147
180
  flagProperties: {
148
- title: o,
181
+ title: c,
149
182
  expanded: !1,
150
- terminalConfiguration: i ?? void 0,
151
- selectedTerminals: i ? /* @__PURE__ */ new Set([c]) : void 0
183
+ terminalConfiguration: a ?? void 0,
184
+ selectedTerminals: a ? /* @__PURE__ */ new Set([n]) : void 0
152
185
  },
153
186
  spatialProperties: {
154
- mapPoint: t,
155
- mapGraphic: e
187
+ mapPoint: e,
188
+ mapGraphic: t
156
189
  }
157
190
  };
158
- } else if (n === "polyline") {
159
- const i = this._calculatePercentAlong(e.geometry, t);
191
+ } else if (i === "polyline") {
192
+ const a = this._calculatePercentAlong(t.geometry, e);
160
193
  return {
161
- traceLocation: new m({
194
+ traceLocation: new b({
162
195
  type: r,
163
196
  isFilterBarrier: !1,
164
- globalId: s,
165
- percentAlong: i
197
+ globalId: o,
198
+ percentAlong: a
166
199
  }),
167
200
  flagProperties: {
168
- title: o,
201
+ title: c,
169
202
  expanded: !1
170
203
  },
171
204
  spatialProperties: {
172
- mapPoint: t,
173
- mapGraphic: e
205
+ mapPoint: e,
206
+ mapGraphic: t
174
207
  }
175
208
  };
176
- } else if (!n) {
177
- const i = C(e.layer) ? e.layer.parent : e.layer, c = i && this._edgeSourceLayerIds.includes(i.layerId), u = a?.getTerminalConfiguration(e), h = u ? u.terminals[0].id : c ? -1 : 1, d = c ? 0.5 : -1;
209
+ } else if (!i) {
210
+ const a = v(t.layer) ? t.layer.parent : t.layer, n = a && this._edgeSourceLayerIds.includes(a.layerId), l = s?.getTerminalConfiguration(t), p = l ? l.terminals[0].id : n ? -1 : 1, d = n ? 0.5 : -1;
178
211
  return {
179
- traceLocation: new m({
212
+ traceLocation: new b({
180
213
  type: r,
181
214
  isFilterBarrier: !1,
182
- globalId: s,
183
- terminalId: h,
215
+ globalId: o,
216
+ terminalId: p,
184
217
  percentAlong: d
185
218
  }),
186
219
  flagProperties: {
187
- title: o,
220
+ title: c,
188
221
  expanded: !1,
189
- terminalConfiguration: u ?? void 0,
190
- selectedTerminals: u ? /* @__PURE__ */ new Set([h]) : void 0
222
+ terminalConfiguration: l ?? void 0,
223
+ selectedTerminals: l ? /* @__PURE__ */ new Set([p]) : void 0
191
224
  },
192
225
  spatialProperties: {
193
- mapPoint: t
226
+ mapPoint: e,
227
+ mapGraphic: t
194
228
  }
195
229
  };
196
230
  }
197
231
  return null;
198
232
  }
199
- async _generateTraceLocation(e, t) {
200
- const { traceLocations: r } = this, a = e.getGlobalId() ?? "", s = e.geometry?.type, n = await this._generateFlagInfo(e, t);
201
- if (!n) {
202
- l("error", this, "Unable to generate flag info for trace location.");
203
- return;
204
- }
205
- const o = r?.filter((i) => i.spatialProperties.mapGraphic?.getGlobalId() === a) ?? [];
206
- if (o.length === 0 || s === "polyline") {
207
- if (s === "polyline" && o.length > 0 && o.some((c) => Math.abs(c.traceLocation.percentAlong - n.traceLocation.percentAlong) <= this.spatialTolerance)) {
208
- l("warn", this, "A flag with the same globalId already exists within tolerance.");
209
- return;
210
- }
211
- const i = this._addFlagGraphic(a, e, t);
212
- if (!i) {
213
- l("warn", this, "Unable to add flag graphic.");
214
- return;
215
- }
216
- n.spatialProperties.flagGraphic = i, r?.add(n);
217
- return;
218
- }
219
- l("warn", this, "A flag with the same globalId already exists.");
220
- }
221
- async _hitTest(e) {
222
- const { view: t, utilityNetwork: r } = this;
223
- if (!t || !r)
224
- return l("error", this, "Either `utilityNetwork` or `view` is unavailable for hit test."), !0;
225
- const a = e.graphic?.geometry, s = this.view?.toScreen(a);
226
- if (!s)
227
- return l("warn", this, "No screen point available for hit test."), !1;
228
- const o = (await t.hitTest(s, {
229
- include: this.filterLayers
230
- })).results.filter((i) => i.type === "graphic" && i?.layer && i.graphic);
231
- return o.length === 0 ? (l("info", this, "No usable hit test results found."), !1) : (this._resetAfterSketch(!1), await this._ensureNecessaryAttributesAndGenerateTraceLocation(o, a), this._resetAfterSketch(!0), !0);
232
- }
233
- _resetAfterSketch(e = !1) {
234
- const { view: t } = this;
235
- if (!t) {
236
- l("error", this, "View is not available to reset after sketch.");
237
- return;
238
- }
239
- this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in t && t.acquireCursor("default"), e && this.arcgisTraceLocationSelectEnd.emit();
240
- }
241
- _handleSketchComplete(e) {
242
- const { sketchViewModel: t, view: r } = this;
243
- if (!t || !r) {
244
- l("error", this, "Either `sketchViewModel` or `view` is not available in sketch complete handler.");
245
- return;
246
- }
247
- if (e.state === "complete" && e.graphic) {
248
- t.layer.remove(e.graphic), this._hitTest(e).then((s) => {
249
- s ? this._resetAfterSketch() : this._initiateHitTest();
250
- });
251
- return;
252
- }
253
- e.state === "cancel" && this._resetAfterSketch(!0);
233
+ async _generateItemTitle(t) {
234
+ const { messages: e } = this, r = (S(t.layer), t.layer);
235
+ return ("getFeatureTitle" in r ? await r.getFeatureTitle(t) : null) || t?.getObjectId()?.toString() || e.labels.unknown;
254
236
  }
255
- async _initiateHitTest() {
256
- const { view: e, sketchViewModel: t } = this;
257
- if (!e || !t) {
258
- l("error", this, "Cannot initiate hit test; either `view` or `sketchViewModel` not found.");
259
- return;
260
- }
261
- this._clickHandler?.remove(), this._clickHandler = t.on("create", this._handleSketchComplete.bind(this)), "acquireCursor" in e && e.acquireCursor("crosshair"), this.sketchViewModel?.create("point");
237
+ _addFlagGraphic(t, e, r) {
238
+ const s = t.geometry?.type === "point" ? t.geometry : e, o = this._createFlagSymbol(), i = new F({
239
+ geometry: s,
240
+ symbol: o,
241
+ attributes: t.attributes
242
+ });
243
+ return r.graphics.add(i), i;
262
244
  }
263
- async _handleAddButtonClick() {
264
- const { view: e, sketchViewModel: t } = this;
265
- if (!(e && t)) {
266
- l("error", this, "Cannot add trace location; `view` not found.");
267
- return;
268
- }
269
- if (this.beforeTraceLocationSelectStart) {
270
- this.isSelectWaiting = !0;
271
- try {
272
- await this.beforeTraceLocationSelectStart();
273
- } finally {
274
- this.isSelectWaiting = !1;
245
+ _createFlagSymbol() {
246
+ const { traceLocationType: t } = this, e = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
247
+ return t === "stopping-point" ? new w({
248
+ color: e,
249
+ style: "x",
250
+ size: 12,
251
+ outline: {
252
+ color: e,
253
+ width: 2
275
254
  }
276
- }
277
- this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => t.cancel() }).defaultPrevented || await this._initiateHitTest();
255
+ }) : t === "barrier" ? new w({
256
+ color: e,
257
+ style: "square",
258
+ size: 12,
259
+ outline: {
260
+ color: e,
261
+ width: 0
262
+ }
263
+ }) : new w({
264
+ color: r,
265
+ style: "circle",
266
+ size: 12,
267
+ outline: {
268
+ color: r,
269
+ width: 0
270
+ }
271
+ });
278
272
  }
279
273
  _handleClearButtonClick() {
280
- const { flagLayer: e, traceLocations: t } = this;
281
- t?.forEach((r) => {
282
- r.spatialProperties.flagGraphic && e && e.remove(r.spatialProperties.flagGraphic);
283
- }), t?.removeAll();
274
+ const { view: t, traceLocations: e } = this;
275
+ e?.forEach((r) => {
276
+ r.spatialProperties.flagGraphic && t && t.graphics.remove(r.spatialProperties.flagGraphic);
277
+ }), e?.removeAll();
284
278
  }
285
279
  renderAddLocationBlock() {
286
- const { traceLocationType: e, messages: t, traceLocations: r } = this, a = e === "starting-point" ? t.types.startingPoint : e === "barrier" ? t.types.barrier : t.types.stoppingPoint, s = a.heading, n = a.description, o = a.buttonText;
287
- return p`<calcite-block .heading=${s} .label=${s} expanded .description=${n}>${r?.length ? p`<calcite-button class="clear-button" slot=actions-end appearance=transparent .label=${t.buttons.clear} @click=${() => this._handleClearButtonClick()}>${t.buttons.clear}</calcite-button>` : null}<arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${e}></arcgis-utility-network-trace-location-list><div class="button-container"><calcite-button .loading=${this.isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${o} @click=${() => this._handleAddButtonClick()}>${o}</calcite-button></div></calcite-block>`;
280
+ const { traceLocationType: t, messages: e, traceLocations: r, view: s } = this, o = t === "starting-point" ? e.types.startingPoint : t === "barrier" ? e.types.barrier : e.types.stoppingPoint, i = o.heading, c = o.description, a = o.buttonText;
281
+ return f`<calcite-block .heading=${i} .label=${i} expanded .description=${c}>${r?.length ? f`<calcite-button class="clear-button" slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${() => this._handleClearButtonClick()}>${e.buttons.clear}</calcite-button>` : null}<arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${t} .view=${s}></arcgis-utility-network-trace-location-list><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>`;
288
282
  }
289
283
  render() {
290
- return p`<div class="root">${this.renderAddLocationBlock()}</div>`;
284
+ return f`<div class="root">${this.renderAddLocationBlock()}</div>`;
291
285
  }
292
286
  }
293
- T("arcgis-utility-network-trace-location", G);
287
+ k("arcgis-utility-network-trace-location", N);
294
288
  export {
295
- G as ArcgisUtilityNetworkTraceLocation
289
+ N as ArcgisUtilityNetworkTraceLocation
296
290
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../../index.d.ts" />
2
2
  import type Collection from "@arcgis/core/core/Collection.js";
3
+ import type MapView from "@arcgis/core/views/MapView.js";
3
4
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
4
5
  import type { FlagInfo, TraceLocationType } from "../arcgis-utility-network-trace-location/customElement.js";
5
6
  import type { T9nMeta } from "@arcgis/lumina/controllers";
@@ -35,4 +36,6 @@ export abstract class ArcgisUtilityNetworkTraceLocationList extends LitElement {
35
36
  accessor traceLocations: Collection<FlagInfo>;
36
37
  /** @default "starting-point" */
37
38
  accessor traceLocationType: TraceLocationType;
39
+ /** @required */
40
+ accessor view: MapView | undefined;
38
41
  }
@@ -4,22 +4,22 @@ import { css as h, html as n } from "lit";
4
4
  import u from "@arcgis/core/core/Collection.js";
5
5
  import { substitute as g } from "@arcgis/core/intl.js";
6
6
  import { LitElement as b } from "@arcgis/lumina";
7
- import { u as f } from "../../chunks/useT9n.js";
8
- import { log as s, composeEmptyPropertyMessage as v } from "@arcgis/toolkit/log";
9
- const y = h`:host{margin-block-start:0;padding:0 var(--calcite-spacing-sm) 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 [slot=content-bottom]{background-color:transparent;display:none}calcite-list-item[expanded] [slot=content-bottom]{display:unset}.warning{color:var(--calcite-color-status-danger)}.terminals{padding-block:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-xl);padding-inline-end:var(--calcite-spacing-sm);display:flex;flex-direction:column}.filter-barrier-container{display:flex;width:100%;calcite-label{width:100%}}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
10
- class $ extends b {
7
+ import { u as v } from "../../chunks/useT9n.js";
8
+ import { log as s, composeEmptyPropertyMessage as f } from "@arcgis/toolkit/log";
9
+ const w = h`:host{margin-block-start:0;padding:0 var(--calcite-spacing-sm) 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 [slot=content-bottom]{background-color:transparent;display:none}calcite-list-item[expanded] [slot=content-bottom]{display:unset}.warning{color:var(--calcite-color-status-danger)}.terminals{padding-block:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-xl);padding-inline-end:var(--calcite-spacing-sm);display:flex;flex-direction:column}.filter-barrier-container{display:flex;width:100%;calcite-label{width:100%}}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
10
+ class y extends b {
11
11
  constructor() {
12
- super(...arguments), this._messages = f({ blocking: !0 }), this.traceLocations = new u(), this.traceLocationType = "starting-point";
12
+ super(...arguments), this._messages = v({ blocking: !0 }), this.traceLocations = new u(), this.traceLocationType = "starting-point";
13
13
  }
14
14
  static {
15
- this.properties = { traceLocations: 0, traceLocationType: 1 };
15
+ this.properties = { traceLocations: 0, traceLocationType: 1, view: 0 };
16
16
  }
17
17
  static {
18
- this.styles = y;
18
+ this.styles = w;
19
19
  }
20
20
  _handleTraceLocationItemRemoved(e) {
21
- const i = e.spatialProperties.flagGraphic?.layer, { traceLocations: t } = this;
22
- e.spatialProperties.flagGraphic && i && i.remove(e.spatialProperties.flagGraphic), t?.remove(e);
21
+ const { traceLocations: i, view: t } = this;
22
+ e.spatialProperties.flagGraphic && t && t.graphics.remove(e.spatialProperties.flagGraphic), i?.remove(e);
23
23
  }
24
24
  _renderTerminal(e, i) {
25
25
  const { flagProperties: t } = e, { selectedTerminals: r } = t;
@@ -59,10 +59,10 @@ class $ extends b {
59
59
  }
60
60
  render() {
61
61
  const { _messages: e, traceLocationType: i } = this, t = g(e.labels.list, { traceLocationType: i }), r = this.traceLocations?.map((c) => this._renderListItem(c)).toArray() ?? [];
62
- return r.length === 0 ? (s("warn", this, v("traceLocations")), null) : n`<div><calcite-list interaction-mode=static selection-mode=none .label=${t}>${r}</calcite-list></div>`;
62
+ return r.length === 0 ? (s("warn", this, f("traceLocations")), null) : n`<div><calcite-list interaction-mode=static selection-mode=none .label=${t}>${r}</calcite-list></div>`;
63
63
  }
64
64
  }
65
- p("arcgis-utility-network-trace-location-list", $);
65
+ p("arcgis-utility-network-trace-location-list", y);
66
66
  export {
67
- $ as ArcgisUtilityNetworkTraceLocationList
67
+ y as ArcgisUtilityNetworkTraceLocationList
68
68
  };