@esri/solutions-components 5.1.0-next.152 → 5.1.0-next.153

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.
@@ -1,16 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import { c as w } from "../../chunks/runtime.js";
3
- import { css as b, html as s } from "lit";
4
- import { a as c } from "../../chunks/queryUtils.js";
5
- import { g as _ } from "../../chunks/mapViewUtils.js";
6
- import { u as f } from "../../chunks/useT9n.js";
3
+ import { css as g, html as o } from "lit";
4
+ import { a as h } from "../../chunks/queryUtils.js";
5
+ import { g as f } from "../../chunks/mapViewUtils.js";
6
+ import { u as _ } from "../../chunks/useT9n.js";
7
7
  import { createRef as p, ref as d } from "lit-html/directives/ref.js";
8
- import { LitElement as y, createEvent as o, noShadowRoot as F, safeClassMap as v } from "@arcgis/lumina";
9
- const $ = b`@layer{:host{display:block!important}.display-none{display:none}.padding-1{padding:1rem}.position-relative{position:relative}.overflow-auto{overflow:auto}.height-full{height:100%}.paste-component{--arcgis-paste-height: 100%;--arcgis-paste-width: 100%;height:100%;width:100%}.position-static{position:static!important}.z-index-500{z-index:500!important}.margin-top-10{margin-top:10px}card-manager{display:block}}`;
8
+ import { LitElement as y, createEvent as r, noShadowRoot as F, safeClassMap as v } from "@arcgis/lumina";
9
+ const $ = g`@layer{:host{display:block!important}.display-none{display:none}.padding-1{padding:1rem}.position-relative{position:relative}.overflow-auto{overflow:auto}.height-full{height:100%}.paste-component{--arcgis-paste-height: 100%;--arcgis-paste-width: 100%;height:100%;width:100%}.position-static{position:static!important}.z-index-500{z-index:500!important}.margin-top-10{margin-top:10px}card-manager{display:block}}`;
10
10
  class S extends y {
11
11
  constructor() {
12
- super(), this.customInfoText = "", this.enableEditGeometry = !1, this.enableSnapping = !1, this.isMobile = !1, this.zoomAndScrollToSelected = !1, this.selectedFeaturesIds = [], this.enableCreateFeatures = !0, this.createBtnLabel = "", this.selectingFeatureFromMap = !1, this.showSketchWidgets = !1, this.mapComponentId = "", this.pasteEnabled = !1, this.showCopyPasteActions = !1, this.allowedPasteLayerIds = [], this._cardLoading = !1, this._graphics = [], this._showCreateFeatureComponent = !1, this._showSubmitBtn = !1, this._activeFeatureCreationCount = 1, this._isPasting = !1, this._translations = f({ name: "card-manager", blocking: !0 }), this._isFeatureCreated = !1, this._createFeature = p(), this._pasteComponent = p(), this.createWorkFlowStarted = o(), this.backFromCreateWorkFlow = o(), this.featureOrRecordSubmitted = o(), this.featuresCopied = o(), this.featuresPasted = o(), this._featuresAdded = () => {
13
- this._isPasting && this._pasteComponent.value && this._resetPasteWorkflow();
12
+ super(), this.customInfoText = "", this.enableEditGeometry = !1, this.enableSnapping = !1, this.isMobile = !1, this.zoomAndScrollToSelected = !1, this.selectedFeaturesIds = [], this.enableCreateFeatures = !0, this.createBtnLabel = "", this.selectingFeatureFromMap = !1, this.showSketchWidgets = !1, this.mapComponentId = "", this.pasteEnabled = !1, this.showCopyPasteActions = !1, this.allowedPasteLayerIds = [], this._cardLoading = !1, this._graphics = [], this._showCreateFeatureComponent = !1, this._showSubmitBtn = !1, this._activeFeatureCreationCount = 1, this._translations = _({ name: "card-manager", blocking: !0 }), this._isFeatureCreated = !1, this._createFeature = p(), this._pasteComponent = p(), this.createWorkFlowStarted = r(), this.backFromCreateWorkFlow = r(), this.featureOrRecordSubmitted = r(), this.featuresCopied = r(), this.featuresPasted = r(), this._featuresAdded = () => {
13
+ this._pasteComponent.value && this._resetPasteWorkflow();
14
14
  }, this._initCreateComponent = () => {
15
15
  this._showCreateFeatureComponent = !0;
16
16
  }, this._pasteComponentReady = async () => {
@@ -19,19 +19,26 @@ class S extends y {
19
19
  await e.viewOnReady(), this._pasteComponent.value.referenceElement = e;
20
20
  }
21
21
  }, this._applyPasteCommand = async (e) => {
22
- if (!this._pasteComponent.value) {
23
- console.error("Paste failed: paste component is not available.");
24
- return;
25
- }
26
- try {
27
- e.detail.applySet && (this._isPasting = !0, await this._pasteComponent.value.writeChanges(e.detail.applySet), await this._resetPasteWorkflow());
28
- } catch (t) {
29
- await this._resetPasteWorkflow(), console.error("Paste failed:", t);
30
- }
22
+ const t = new Promise((a, i) => {
23
+ if (!this._pasteComponent.value) {
24
+ console.error("Paste failed: paste component is not available."), a();
25
+ return;
26
+ }
27
+ try {
28
+ e.detail.applySet ? this._pasteComponent.value.writeChanges(e.detail.applySet).then(() => {
29
+ this._resetPasteWorkflow(), a();
30
+ }).catch((s) => {
31
+ console.log(s), i(s);
32
+ }) : a();
33
+ } catch (s) {
34
+ i(s), console.error("Paste failed:", s);
35
+ }
36
+ });
37
+ e.detail.completionCallback = t;
31
38
  }, this.listenOn(window, "featureSelectionChange", this.featureSelectionChange), this.listenOn(window, "layerSelectionChange", this.layerSelectionChange), this.listenOn(window, "mapChanged", this.mapChanged), this.listenOn(window, "relatedRecordToggled", this.relatedRecordToggled), this.listenOn(window, "copyFeatures", this._copyFeatures), this.listenOn(window, "pasteFeatures", this._pasteFeatures), this.listenOn(window, "featuresAdded", this._featuresAdded), this.listenOn(window, "initCreateComponent", this._initCreateComponent);
32
39
  }
33
40
  static {
34
- this.properties = { customInfoText: 1, enableEditGeometry: 5, enableSnapping: 5, isMobile: 5, layerOrTable: 0, mapView: 0, zoomAndScrollToSelected: 5, selectedFeaturesIds: 0, enableCreateFeatures: 5, createBtnLabel: 1, selectingFeatureFromMap: 5, showSketchWidgets: 5, mapComponentId: 1, pasteEnabled: 5, showCopyPasteActions: 5, allowedPasteLayerIds: 0, _cardLoading: 16, _graphics: 16, _showCreateFeatureComponent: 16, _showSubmitBtn: 16, _activeFeatureCreationCount: 16, _isPasting: 16, _translations: 16 };
41
+ this.properties = { customInfoText: 1, enableEditGeometry: 5, enableSnapping: 5, isMobile: 5, layerOrTable: 0, mapView: 0, zoomAndScrollToSelected: 5, selectedFeaturesIds: 0, enableCreateFeatures: 5, createBtnLabel: 1, selectingFeatureFromMap: 5, showSketchWidgets: 5, mapComponentId: 1, pasteEnabled: 5, showCopyPasteActions: 5, allowedPasteLayerIds: 0, _cardLoading: 16, _graphics: 16, _showCreateFeatureComponent: 16, _showSubmitBtn: 16, _activeFeatureCreationCount: 16, _translations: 16 };
35
42
  }
36
43
  static {
37
44
  this.styles = $;
@@ -47,7 +54,7 @@ class S extends y {
47
54
  async layerSelectionChange(e) {
48
55
  this._showCreateFeatureComponent && this._backFromCreateFeature();
49
56
  const t = e.detail[0];
50
- this.layerOrTable = this.mapView ? await _(this.mapView, t) : void 0, await this._resetPasteWorkflow();
57
+ this.layerOrTable = this.mapView ? await f(this.mapView, t) : void 0, await this._resetPasteWorkflow();
51
58
  }
52
59
  async mapChanged(e) {
53
60
  await this._resetPasteWorkflow();
@@ -59,15 +66,15 @@ class S extends y {
59
66
  async _copyFeatures(e) {
60
67
  if (!this._pasteComponent.value)
61
68
  return;
62
- const t = e.detail.featuresIds, a = this.layerOrTable, i = await c(t, a, [], !0, this.mapView?.spatialReference), r = [];
69
+ const t = e.detail.featuresIds, a = this.layerOrTable, i = await h(t, a, [], !0, this.mapView?.spatialReference), s = [];
63
70
  i.forEach((n) => {
64
71
  const l = {
65
72
  layer: n.layer,
66
73
  graphic: n,
67
74
  type: "feature"
68
75
  };
69
- r.push(l);
70
- }), this._pasteComponent.value.clipboard.setData(r), this.featuresCopied.emit(), this.requestUpdate();
76
+ s.push(l);
77
+ }), this._pasteComponent.value.clipboard.setData(s), this.featuresCopied.emit(), this.requestUpdate();
71
78
  }
72
79
  async _pasteFeatures(e) {
73
80
  if (!this._pasteComponent.value) {
@@ -88,30 +95,27 @@ class S extends y {
88
95
  };
89
96
  }
90
97
  async _resetPasteWorkflow() {
91
- if (!this._pasteComponent.value) {
92
- this._isPasting = !1;
93
- return;
94
- }
95
- try {
96
- await this._pasteComponent.value.showClipboardItems(!1), await this._pasteComponent.value.cancelMoveClipboard();
97
- } catch (e) {
98
- console.error("Reset paste workflow failed:", e);
99
- } finally {
100
- this._isPasting = !1, this._pasteComponent.value.closed = !0;
101
- }
98
+ if (this._pasteComponent.value)
99
+ try {
100
+ await this._pasteComponent.value.showClipboardItems(!1), await this._pasteComponent.value.cancelMoveClipboard();
101
+ } catch (e) {
102
+ console.error("Reset paste workflow failed:", e);
103
+ } finally {
104
+ this._pasteComponent.value.closed = !0;
105
+ }
102
106
  }
103
107
  async load() {
104
108
  this.selectedFeaturesIds?.length > 0 && (this._graphics = await this._getFeaturesByIds(this.selectedFeaturesIds));
105
109
  }
106
110
  render() {
107
- const e = (this._pasteComponent.value?.closed || !this.showCopyPasteActions) && this._graphics?.length > 0, t = this._pasteComponent.value?.closed ? "display-none" : "", a = this._graphics?.length === 0 && this._showCreateFeatureComponent ? "" : "display-none", i = this._graphics?.length > 0 || this._showCreateFeatureComponent || !this._pasteComponent.value?.closed && this.showCopyPasteActions ? "display-none" : "", r = this.layerOrTable?.isTable, n = this.customInfoText ? this.customInfoText : this.selectingFeatureFromMap ? this._translations.selectFeaturesFromMapToStart : this._translations.selectFeaturesToStart, l = this.enableCreateFeatures && this.layerOrTable?.editingEnabled && this.layerOrTable?.capabilities?.operations?.supportsAdd, h = this.createBtnLabel ? this.createBtnLabel : r ? this._translations.createRecord : this._translations.createFeature, u = !this.layerOrTable, m = this.enableSnapping && !this.layerOrTable?.isTable, C = this.layerOrTable?.isTable ? ["paste"] : ["paste", "paste-as"], g = !this.layerOrTable?.isTable;
108
- return s`<calcite-panel><div class="overflow-auto height-full">${e && s`<calcite-shell class=${"position-relative"}><div class="position-static z-index-500 height-full"><info-card .allowEditing=${this.layerOrTable?.editingEnabled} .enableEditGeometry=${this.enableEditGeometry} .enableSnapping=${m} .graphics=${this._graphics.reverse()} .isLoading=${this._cardLoading} .isMobile=${this.isMobile} .mapView=${this.mapView} .featuresReferenceId=${this.mapComponentId} position=relative .pasteEnabled=${this.pasteEnabled} show-close-btn .showCopyPasteActions=${this.showCopyPasteActions}></info-card></div></calcite-shell>` || ""}<calcite-shell class=${`position-relative ${i}`}><calcite-panel><div class=padding-1><calcite-notice .icon=${this.selectingFeatureFromMap ? "map" : "table"} icon-flip-rtl open><div slot=message>${n}</div></calcite-notice></div>${!this.isMobile && l && s`<calcite-button .disabled=${u} @click=${() => this._createFeatureBtnClicked()} slot=footer width=full>${h}</calcite-button>` || ""}</calcite-panel></calcite-shell><calcite-shell class=${`position-relative ${a}`}><calcite-flow-item selected><calcite-panel .heading=${h}><calcite-action class="back-button hydrated" icon=chevron-left @click=${this._backFromCreateFeature} scale=s slot=header-actions-start .text=${this._translations.back}></calcite-action>${this.getEditorComponent()}${this._showSubmitBtn && s`<calcite-button appearance=solid class="footer-top-button footer-button" @click=${() => this._createFeature.value && void this._createFeature.value.submit()} slot=footer width=full>${this._activeFeatureCreationCount > 1 ? this._translations.createMultiple.replace("{{n}}", String(this._activeFeatureCreationCount)) : this._translations.create}</calcite-button>` || ""}</calcite-panel></calcite-flow-item></calcite-shell>${this.showCopyPasteActions && s`<calcite-panel class=${v(t)} .loading=${this._isPasting}><arcgis-paste always-show-feature-form class=${`paste-component ${t}`} closed @arcgisReady=${this._pasteComponentReady} @arcgisApplyPasteCommand=${this._applyPasteCommand} @arcgisClose=${() => {
111
+ const e = (this._pasteComponent.value?.closed || !this.showCopyPasteActions) && this._graphics?.length > 0, t = this._pasteComponent.value?.closed ? "display-none" : "", a = this._graphics?.length === 0 && this._showCreateFeatureComponent ? "" : "display-none", i = this._graphics?.length > 0 || this._showCreateFeatureComponent || !this._pasteComponent.value?.closed && this.showCopyPasteActions ? "display-none" : "", s = this.layerOrTable?.isTable, n = this.customInfoText ? this.customInfoText : this.selectingFeatureFromMap ? this._translations.selectFeaturesFromMapToStart : this._translations.selectFeaturesToStart, l = this.enableCreateFeatures && this.layerOrTable?.editingEnabled && this.layerOrTable?.capabilities?.operations?.supportsAdd, c = this.createBtnLabel ? this.createBtnLabel : s ? this._translations.createRecord : this._translations.createFeature, u = !this.layerOrTable, m = this.enableSnapping && !this.layerOrTable?.isTable, C = this.layerOrTable?.isTable ? ["paste"] : ["paste", "paste-as"], b = !this.layerOrTable?.isTable;
112
+ return o`<calcite-panel><div class="overflow-auto height-full">${e && o`<calcite-shell class=${"position-relative"}><div class="position-static z-index-500 height-full"><info-card .allowEditing=${this.layerOrTable?.editingEnabled} .enableEditGeometry=${this.enableEditGeometry} .enableSnapping=${m} .graphics=${this._graphics.reverse()} .isLoading=${this._cardLoading} .isMobile=${this.isMobile} .mapView=${this.mapView} .featuresReferenceId=${this.mapComponentId} position=relative .pasteEnabled=${this.pasteEnabled} show-close-btn .showCopyPasteActions=${this.showCopyPasteActions}></info-card></div></calcite-shell>` || ""}<calcite-shell class=${`position-relative ${i}`}><calcite-panel><div class=padding-1><calcite-notice .icon=${this.selectingFeatureFromMap ? "map" : "table"} icon-flip-rtl open><div slot=message>${n}</div></calcite-notice></div>${!this.isMobile && l && o`<calcite-button .disabled=${u} @click=${() => this._createFeatureBtnClicked()} slot=footer width=full>${c}</calcite-button>` || ""}</calcite-panel></calcite-shell><calcite-shell class=${`position-relative ${a}`}><calcite-flow-item selected><calcite-panel .heading=${c}><calcite-action class="back-button hydrated" icon=chevron-left @click=${this._backFromCreateFeature} scale=s slot=header-actions-start .text=${this._translations.back}></calcite-action>${this.getEditorComponent()}${this._showSubmitBtn && o`<calcite-button appearance=solid class="footer-top-button footer-button" @click=${() => this._createFeature.value && void this._createFeature.value.submit()} slot=footer width=full>${this._activeFeatureCreationCount > 1 ? this._translations.createMultiple.replace("{{n}}", String(this._activeFeatureCreationCount)) : this._translations.create}</calcite-button>` || ""}</calcite-panel></calcite-flow-item></calcite-shell>${this.showCopyPasteActions && o`<calcite-panel class=${v(t)}><arcgis-paste always-show-feature-form class=${`paste-component ${t}`} closed @arcgisReady=${this._pasteComponentReady} @arcgisApplyPasteCommand=${this._applyPasteCommand} @arcgisClose=${() => {
109
113
  this._resetPasteWorkflow();
110
- }} paste-with-multiple-layers-enabled paste-with-multiple-features-enabled .layerPermissionsCheck=${this._getLayerPermissionsCheck()} .supportedCommands=${C} .view=${this.mapView} ${d(this._pasteComponent)}>${g && s`<calcite-notice slot=commands-page-message class="margin-top-10" open icon=move><div slot=message>${this._translations.moveClipboardFeatures}</div></calcite-notice>` || ""}</arcgis-paste></calcite-panel>` || ""}</div></calcite-panel>`;
114
+ }} paste-with-multiple-layers-enabled paste-with-multiple-features-enabled .layerPermissionsCheck=${this._getLayerPermissionsCheck()} .supportedCommands=${C} .view=${this.mapView} ${d(this._pasteComponent)}>${b && o`<calcite-notice slot=commands-page-message class="margin-top-10" open icon=move><div slot=message>${this._translations.moveClipboardFeatures}</div></calcite-notice>` || ""}</arcgis-paste></calcite-panel>` || ""}</div></calcite-panel>`;
111
115
  }
112
116
  getEditorComponent() {
113
117
  const e = this.enableSnapping && !this.layerOrTable?.isTable && this.enableCreateFeatures;
114
- return s`<div>${this._showCreateFeatureComponent && s`<create-feature allow-multiple-creation customize-submit .enableSnapping=${e} .mapView=${this.mapView} .isMobile=${this.isMobile} @activeFeatureCountChange=${(t) => {
118
+ return o`<div>${this._showCreateFeatureComponent && o`<create-feature allow-multiple-creation customize-submit .enableSnapping=${e} .mapView=${this.mapView} .isMobile=${this.isMobile} @activeFeatureCountChange=${(t) => {
115
119
  this._activeFeatureCreationCount = t.detail, this._showSubmitBtn = this._activeFeatureCreationCount > 0;
116
120
  }} @drawComplete=${() => {
117
121
  this._showSubmitBtn = !0;
@@ -124,7 +128,7 @@ class S extends y {
124
128
  }} @success=${this._featureCreated} .showSketchWidgets=${this.showSketchWidgets} .selectedLayerId=${this.layerOrTable?.id} show-guiding-msg .showLayerVisibilityMsg=${this.layerOrTable?.visible === !1} ${d(this._createFeature)}></create-feature>` || ""}</div>`;
125
129
  }
126
130
  async _getFeaturesByIds(e) {
127
- return (e.length > 0 && this.layerOrTable && this.mapView ? await c(e, this.layerOrTable, [], !0, this.mapView?.spatialReference) : []).sort((a, i) => e.indexOf(Number(a.getObjectId())) - e.indexOf(Number(i.getObjectId())));
131
+ return (e.length > 0 && this.layerOrTable && this.mapView ? await h(e, this.layerOrTable, [], !0, this.mapView?.spatialReference) : []).sort((a, i) => e.indexOf(Number(a.getObjectId())) - e.indexOf(Number(i.getObjectId())));
128
132
  }
129
133
  _createFeatureBtnClicked() {
130
134
  this._showCreateFeatureComponent = !0, this.createWorkFlowStarted.emit();
@@ -444,7 +444,7 @@ class R extends A {
444
444
  try {
445
445
  const i = this._layer?.id;
446
446
  if (t === i) {
447
- await this._refresh(), this._clearSelection(), this._searchExpression && await this._searchFullText();
447
+ await this._refresh(!1, !0), this._clearSelection(), this._searchExpression && await this._searchFullText();
448
448
  const s = [];
449
449
  for (const a of e)
450
450
  this._allIds.includes(a) && s.push(a);
@@ -591,13 +591,7 @@ class R extends A {
591
591
  if (this._hasPendingEdits()) {
592
592
  let a = !1;
593
593
  try {
594
- if (this._editor.activeWorkflow) {
595
- const l = new Promise((h, r) => setTimeout(() => r(new Error("cancel-timeout")), 1e3));
596
- await Promise.race([
597
- this._editor.activeWorkflow.cancel({ force: !1 }),
598
- l
599
- ]);
600
- }
594
+ this._editor.activeWorkflow && await this._editor.activeWorkflow.cancel({ force: !1 });
601
595
  } catch (l) {
602
596
  a = l?.name === "workflow:cancel-denied";
603
597
  }
@@ -855,13 +849,13 @@ class R extends A {
855
849
  _updateToolInfoLoading(e, t) {
856
850
  this._toolInfos.some((i) => i?.icon === e ? (i.loading = t, !0) : !1);
857
851
  }
858
- async _refresh(e) {
859
- if (await this._validateActiveEdits([], this.selectedIds)) {
852
+ async _refresh(e, t) {
853
+ if (t ? !0 : await this._validateActiveEdits([], this.selectedIds)) {
860
854
  this._table && await this._table.refresh(), this._relatedFeatureTable && await this._relatedFeatureTable.refresh(), this._allIds = await this.queryAllIds();
861
- const i = this._getSelectedLayer(this.selectedRelatedIds);
862
- if (i && this.relatedRecordToggled.emit(i), !e) {
863
- const s = this._getSelectedIds();
864
- this.featureSelectionChange.emit(s);
855
+ const s = this._getSelectedLayer(this.selectedRelatedIds);
856
+ if (s && this.relatedRecordToggled.emit(s), !e) {
857
+ const a = this._getSelectedIds();
858
+ this.featureSelectionChange.emit(a);
865
859
  }
866
860
  }
867
861
  }