@esri/solutions-components 0.7.30 → 0.7.32

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 (62) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +7 -5
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +7 -5
  3. package/dist/assets/t9n/feature-list/resources.json +1 -1
  4. package/dist/assets/t9n/feature-list/resources_en.json +1 -1
  5. package/dist/assets/t9n/layer-list/resources.json +1 -1
  6. package/dist/assets/t9n/layer-list/resources_en.json +1 -1
  7. package/dist/cjs/{calcite-flow_4.cjs.entry.js → calcite-flow_5.cjs.entry.js} +286 -19
  8. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +248 -32
  10. package/dist/cjs/{downloadUtils-83c6d3c3.js → downloadUtils-10e0de31.js} +2 -2
  11. package/dist/cjs/{index.es-bd1a93b2.js → index.es-72dc7ab9.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  14. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/create-feature/create-feature.css +50 -0
  18. package/dist/collection/components/create-feature/create-feature.js +444 -0
  19. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
  20. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +287 -33
  21. package/dist/collection/components/feature-list/feature-list.js +1 -0
  22. package/dist/collection/components/layer-list/layer-list.js +60 -16
  23. package/dist/collection/demos/create-feature.html +90 -0
  24. package/dist/collection/demos/crowdsource-reporter.html +26 -11
  25. package/dist/collection/utils/downloadUtils.js +1 -1
  26. package/dist/collection/utils/downloadUtils.ts +1 -1
  27. package/dist/components/create-feature.d.ts +11 -0
  28. package/dist/components/create-feature.js +11 -0
  29. package/dist/components/create-feature2.js +278 -0
  30. package/dist/components/crowdsource-reporter.js +324 -90
  31. package/dist/components/downloadUtils.js +1 -1
  32. package/dist/components/feature-list2.js +1 -0
  33. package/dist/components/layer-list2.js +38 -17
  34. package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +286 -20
  35. package/dist/esm/card-manager_3.entry.js +1 -1
  36. package/dist/esm/crowdsource-reporter.entry.js +249 -33
  37. package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
  38. package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/map-select-tools_3.entry.js +1 -1
  41. package/dist/esm/public-notification.entry.js +1 -1
  42. package/dist/esm/solutions-components.js +1 -1
  43. package/dist/solutions-components/demos/create-feature.html +90 -0
  44. package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
  45. package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
  46. package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
  47. package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
  48. package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
  49. package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
  50. package/dist/solutions-components/p-d5263cb9.entry.js +17 -0
  51. package/dist/solutions-components/p-ea17cefb.entry.js +6 -0
  52. package/dist/solutions-components/solutions-components.esm.js +1 -1
  53. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  54. package/dist/types/components/create-feature/create-feature.d.ts +125 -0
  55. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +146 -12
  56. package/dist/types/components/feature-list/feature-list.d.ts +1 -0
  57. package/dist/types/components/layer-list/layer-list.d.ts +6 -0
  58. package/dist/types/components.d.ts +102 -0
  59. package/dist/types/preact.d.ts +7 -0
  60. package/package.json +1 -1
  61. package/dist/solutions-components/p-2f162664.entry.js +0 -6
  62. package/dist/solutions-components/p-94ee3ef7.entry.js +0 -17
@@ -6,38 +6,41 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { g as getLocaleComponentStrings } from './locale.js';
8
8
  import { l as loadModules } from './loadModules.js';
9
- import { a as getAllLayers } from './mapViewUtils.js';
10
- import { d as defineCustomElement$u } from './action.js';
11
- import { d as defineCustomElement$t } from './action-menu.js';
12
- import { d as defineCustomElement$s } from './alert.js';
13
- import { d as defineCustomElement$r } from './button.js';
14
- import { d as defineCustomElement$q } from './chip.js';
15
- import { d as defineCustomElement$p } from './filter2.js';
16
- import { d as defineCustomElement$o } from './flow.js';
17
- import { d as defineCustomElement$n } from './flow-item.js';
18
- import { d as defineCustomElement$m } from './handle.js';
19
- import { d as defineCustomElement$l } from './icon.js';
20
- import { d as defineCustomElement$k } from './input.js';
21
- import { d as defineCustomElement$j } from './list.js';
22
- import { d as defineCustomElement$i } from './list-item.js';
23
- import { d as defineCustomElement$h } from './loader.js';
24
- import { d as defineCustomElement$g } from './modal.js';
25
- import { d as defineCustomElement$f } from './notice.js';
26
- import { d as defineCustomElement$e } from './pagination.js';
27
- import { d as defineCustomElement$d } from './panel.js';
28
- import { d as defineCustomElement$c } from './popover.js';
29
- import { d as defineCustomElement$b } from './progress.js';
30
- import { d as defineCustomElement$a } from './scrim.js';
31
- import { d as defineCustomElement$9 } from './shell.js';
32
- import { d as defineCustomElement$8 } from './stack.js';
33
- import { d as defineCustomElement$7 } from './tooltip.js';
34
- import { d as defineCustomElement$6 } from './delete-button2.js';
35
- import { d as defineCustomElement$5 } from './edit-card2.js';
36
- import { d as defineCustomElement$4 } from './feature-list2.js';
37
- import { d as defineCustomElement$3 } from './info-card2.js';
9
+ import { a as getAllLayers, g as getLayerOrTable } from './mapViewUtils.js';
10
+ import { q as queryFeaturesByID } from './queryUtils.js';
11
+ import { d as defineCustomElement$w } from './action.js';
12
+ import { d as defineCustomElement$v } from './action-menu.js';
13
+ import { d as defineCustomElement$u } from './alert.js';
14
+ import { d as defineCustomElement$t } from './button.js';
15
+ import { d as defineCustomElement$s } from './chip.js';
16
+ import { d as defineCustomElement$r } from './filter2.js';
17
+ import { d as defineCustomElement$q } from './flow.js';
18
+ import { d as defineCustomElement$p } from './flow-item.js';
19
+ import { d as defineCustomElement$o } from './handle.js';
20
+ import { d as defineCustomElement$n } from './icon.js';
21
+ import { d as defineCustomElement$m } from './input.js';
22
+ import { d as defineCustomElement$l } from './list.js';
23
+ import { d as defineCustomElement$k } from './list-item.js';
24
+ import { d as defineCustomElement$j } from './loader.js';
25
+ import { d as defineCustomElement$i } from './modal.js';
26
+ import { d as defineCustomElement$h } from './notice.js';
27
+ import { d as defineCustomElement$g } from './pagination.js';
28
+ import { d as defineCustomElement$f } from './panel.js';
29
+ import { d as defineCustomElement$e } from './popover.js';
30
+ import { d as defineCustomElement$d } from './progress.js';
31
+ import { d as defineCustomElement$c } from './scrim.js';
32
+ import { d as defineCustomElement$b } from './shell.js';
33
+ import { d as defineCustomElement$a } from './stack.js';
34
+ import { d as defineCustomElement$9 } from './tooltip.js';
35
+ import { d as defineCustomElement$8 } from './create-feature2.js';
36
+ import { d as defineCustomElement$7 } from './delete-button2.js';
37
+ import { d as defineCustomElement$6 } from './edit-card2.js';
38
+ import { d as defineCustomElement$5 } from './feature-list2.js';
39
+ import { d as defineCustomElement$4 } from './info-card2.js';
40
+ import { d as defineCustomElement$3 } from './instant-apps-social-share2.js';
38
41
  import { d as defineCustomElement$2 } from './layer-list2.js';
39
42
 
40
- const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.error-msg{padding:10px}";
43
+ const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}";
41
44
 
42
45
  const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceReporter extends HTMLElement {
43
46
  constructor() {
@@ -54,6 +57,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
54
57
  this.layers = undefined;
55
58
  this.loginTitle = undefined;
56
59
  this.mapView = undefined;
60
+ this.layerId = undefined;
61
+ this.objectId = undefined;
57
62
  this.reportButtonText = undefined;
58
63
  this.reportsHeader = undefined;
59
64
  this.reportSubmittedMessage = undefined;
@@ -71,6 +76,9 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
71
76
  this._translations = undefined;
72
77
  this._hasValidLayers = false;
73
78
  this._selectedLayerName = undefined;
79
+ this._reportSubmitted = false;
80
+ this._showSubmitCancelButton = false;
81
+ this._featureCreationFailedErrorMsg = undefined;
74
82
  }
75
83
  //--------------------------------------------------------------------------
76
84
  //
@@ -102,6 +110,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
102
110
  * @returns Promise when complete
103
111
  */
104
112
  async componentWillLoad() {
113
+ this._urlParamsLoaded = false;
105
114
  await this._initModules();
106
115
  await this._getTranslations();
107
116
  }
@@ -109,7 +118,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
109
118
  * Renders the component.
110
119
  */
111
120
  render() {
112
- return (h(Host, null, h("div", null, h("calcite-shell", { "content-behind": true }, this._getReporter()))));
121
+ const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
122
+ return (h(Host, null, this._reportSubmitted && h("calcite-alert", { "auto-close": true, class: themeClass, closable: true, icon: "check-circle", kind: "success", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, h("div", { slot: "title" }, this._translations.reportSubmit), h("div", { slot: "message" }, this._translations.submitMsg)), this._featureCreationFailedErrorMsg && h("calcite-alert", { "auto-close": true, class: themeClass, closable: true, icon: "x-octagon", kind: "danger", onCalciteAlertClose: () => { this._featureCreationFailedErrorMsg = ""; }, open: true, placement: "top" }, h("div", { slot: "title" }, this._translations.error), h("div", { slot: "message" }, this._featureCreationFailedErrorMsg)), h("div", null, h("calcite-shell", { "content-behind": true }, this._getReporter()))));
113
123
  }
114
124
  //--------------------------------------------------------------------------
115
125
  //
@@ -129,6 +139,20 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
129
139
  ]);
130
140
  this.reactiveUtils = reactiveUtils;
131
141
  }
142
+ /**
143
+ * Set the selected layer id and layer name
144
+ * @param layerId string layerId of the selected layer
145
+ * @param layerName string layerName of the selected layer
146
+ */
147
+ setSelectedLayer(layerId, layerName) {
148
+ this._selectedLayerId = layerId;
149
+ this._selectedLayerName = layerName;
150
+ //show only current layer on map and hide other valid editable layers
151
+ //if layerId is empty then show all the layers on map
152
+ this._validLayers.forEach(layer => {
153
+ layer.set('visible', !layerId || (layer.id === layerId));
154
+ });
155
+ }
132
156
  /**
133
157
  * Get the reporter app functionality
134
158
  * @protected
@@ -146,6 +170,12 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
146
170
  case "feature-details":
147
171
  renderLists.push(this.getFeatureDetailsFlowItem());
148
172
  break;
173
+ case "reporting-layer-list":
174
+ renderLists.push(this.getChooseCategoryFlowItem());
175
+ break;
176
+ case "feature-create":
177
+ renderLists.push(this.getFeatureCreateFlowItem());
178
+ break;
149
179
  }
150
180
  });
151
181
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
@@ -162,34 +192,156 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
162
192
  return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers &&
163
193
  h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), this._hasValidLayers &&
164
194
  h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
165
- h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), h("calcite-panel", { "full-height": true, "full-width": true }, h("layer-list", { class: "height-full", layers: this.layers, mapView: this.mapView, noLayerErrorMsg: this._translations.noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), showFeatureCount: true, showNextIcon: true }))));
195
+ h("calcite-button", { appearance: "secondary", onClick: this.navigateToChooseCategory.bind(this), slot: "footer", width: "full" }, this.reportButtonText), h("calcite-panel", { "full-height": true, "full-width": true }, h("layer-list", { class: "height-full", layers: this.layers, mapView: this.mapView, noLayerErrorMsg: this._translations.noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
196
+ }
197
+ /**
198
+ * Get the layer list for creating a report
199
+ * @returns Choose category flow item
200
+ * @protected
201
+ */
202
+ getChooseCategoryFlowItem() {
203
+ return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._translations.createReportHeader, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), h("div", { class: "width-full", slot: "footer" }, h("calcite-button", { appearance: "secondary", class: "footer-top-button footer-button", disabled: !this._selectedLayerId, onClick: this.navigateToCreateFeature.bind(this), width: "full" }, this._translations.next), h("calcite-button", { appearance: "outline", class: "footer-button", onClick: this.backFromSelectedPanel.bind(this), width: "full" }, this._translations.cancel)), h("calcite-panel", { "full-height": true, "full-width": true }, h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, h("div", { slot: "message" }, this._translations.chooseCategoryMsg)), h("layer-list", { class: "height-full", layers: this.layers, mapView: this.mapView, noLayerErrorMsg: this._translations.noLayerToDisplayErrorMsg, onLayerSelect: this.highlightSelectedLayer.bind(this), showFeatureCount: false, showNextIcon: false }))));
204
+ }
205
+ /**
206
+ * Get Feature create form of the selected feature layer
207
+ * @returns feature create form
208
+ * @protected
209
+ */
210
+ getFeatureCreateFlowItem() {
211
+ return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromCreateFeaturePanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), this._showSubmitCancelButton && h("div", { class: "width-full", slot: "footer" }, h("calcite-button", { appearance: "secondary", class: "footer-top-button footer-button", onClick: this.onSubmitButtonClick.bind(this), width: "full" }, this._translations.submit), h("calcite-button", { appearance: "outline", class: "footer-button", onClick: this.backFromCreateFeaturePanel.bind(this), width: "full" }, this._translations.cancel)), h("calcite-panel", { "full-height": true, "full-width": true }, h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, h("div", { slot: "message" }, this._translations.featureEditFormInfoMsg)), h("create-feature", { customizeSubmit: true, mapView: this.mapView, onDrawComplete: this.onDrawComplete.bind(this), onEditingAttachment: this.showSubmitCancelButton.bind(this), onFail: this.createFeatureFailed.bind(this), onSuccess: this.onReportSubmitted.bind(this), ref: el => this._createFeature = el, selectedLayerId: this._selectedLayerId }))));
212
+ }
213
+ /**
214
+ * When drawing of incident location completed on map show the submit and cancel button
215
+ * @protected
216
+ */
217
+ onDrawComplete() {
218
+ this._showSubmitCancelButton = true;
219
+ }
220
+ /**
221
+ * When Add attachment panel is enabled hide the submit and cancel button
222
+ * @protected
223
+ */
224
+ showSubmitCancelButton(evt) {
225
+ this._showSubmitCancelButton = !evt.detail;
226
+ }
227
+ /**
228
+ * On back from create feature, call submit editor to destroy the Editor widget instance
229
+ * @protected
230
+ */
231
+ onSubmitButtonClick() {
232
+ if (this._createFeature) {
233
+ this._createFeature.submit();
234
+ }
235
+ }
236
+ /**
237
+ * On back from create feature, call close editor to destroy the Editor widget instance
238
+ * @protected
239
+ */
240
+ backFromCreateFeaturePanel() {
241
+ if (this._createFeature) {
242
+ this._createFeature.close();
243
+ }
244
+ this.backFromSelectedPanel();
245
+ }
246
+ /**
247
+ * On creating the feature is failed, show the error message
248
+ * @param evt Event which has feature failed message
249
+ * @protected
250
+ */
251
+ createFeatureFailed(evt) {
252
+ console.error(evt.detail);
253
+ this._featureCreationFailedErrorMsg = evt.detail.message;
254
+ }
255
+ /**
256
+ * On submit report navigate to the layer list home page and refresh the layer list
257
+ * @protected
258
+ */
259
+ onReportSubmitted() {
260
+ this._reportSubmitted = true;
261
+ this.navigateToHomePage();
262
+ }
263
+ /**
264
+ * Navigates to layer-list
265
+ * @protected
266
+ */
267
+ navigateToHomePage() {
268
+ if (this._createFeature) {
269
+ this._createFeature.close();
270
+ }
271
+ if (this._layerList) {
272
+ this._layerList.refresh();
273
+ }
274
+ this.setSelectedFeatures([]);
275
+ this._flowItems = ["layer-list"];
276
+ }
277
+ /**
278
+ * Update the selected layer id and name
279
+ * @param evt Event which has details of selected layerId and layerName
280
+ * @protected
281
+ */
282
+ highlightSelectedLayer(evt) {
283
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
284
+ }
285
+ /**
286
+ * On next button click open the feature create flow item
287
+ * @protected
288
+ */
289
+ async navigateToCreateFeature() {
290
+ this._showSubmitCancelButton = false;
291
+ this._flowItems = [...this._flowItems, "feature-create"];
292
+ }
293
+ /**
294
+ * On report an incident button click open the create a report panel with the layer list
295
+ * @protected
296
+ */
297
+ navigateToChooseCategory() {
298
+ this._flowItems = [...this._flowItems, "reporting-layer-list"];
166
299
  }
167
300
  /**
168
301
  * When layer list is loaded, we will receive the list of layers, if its means we don't have any valid layer to be listed
169
302
  * @param evt Event which has list of layers
170
303
  * @protected
171
304
  */
172
- layerListLoaded(evt) {
305
+ async layerListLoaded(evt) {
173
306
  const layersListed = evt.detail;
174
- this.handleMapClick(layersListed);
307
+ //consider only the layers listed in the layer-list component
308
+ const allMapLayers = await getAllLayers(this.mapView);
309
+ this._validLayers = [];
310
+ allMapLayers.forEach((eachLayer) => {
311
+ if (layersListed.includes(eachLayer.id)) {
312
+ this._validLayers.push(eachLayer);
313
+ }
314
+ });
315
+ //handleMap click on layer list loaded
316
+ this.handleMapClick();
317
+ //update the has valid layer state
175
318
  this._hasValidLayers = layersListed.length > 0;
319
+ //navigate to the feature details if URL params found
320
+ if (!this._urlParamsLoaded) {
321
+ this._urlParamsLoaded = true;
322
+ await this.loadFeatureFromURLParams();
323
+ }
176
324
  }
177
325
  /**On click of layer list item show feature list
178
326
  * @param evt Event which has details of selected layerId and layerName
179
327
  * @protected
180
328
  */
181
329
  displayFeaturesList(evt) {
182
- this._selectedLayerId = evt.detail.layerId;
183
- this._selectedLayerName = evt.detail.layerName;
330
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
184
331
  this._flowItems = [...this._flowItems, "feature-list"];
185
332
  }
186
333
  /**
187
- * On back from feature list navigate to the Layer list panel
334
+ * On back from selected panel navigate to the previous panel
188
335
  * @protected
189
336
  */
190
- backFromFeatureList() {
337
+ backFromSelectedPanel() {
191
338
  const updatedFlowItems = [...this._flowItems];
192
339
  updatedFlowItems.pop();
340
+ //Back to layer list, and return as the flowItems will be reset in navigateToHomePage
341
+ if (updatedFlowItems.length === 1) {
342
+ this.navigateToHomePage();
343
+ return;
344
+ }
193
345
  this._flowItems = [...updatedFlowItems];
194
346
  }
195
347
  /**
@@ -205,7 +357,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
205
357
  * @param evt Event which has details of selected feature
206
358
  */
207
359
  async onFeatureSelectFromList(evt) {
208
- this._selectedFeature = [evt.detail];
360
+ this.setSelectedFeatures([evt.detail]);
209
361
  this._flowItems = [...this._flowItems, "feature-details"];
210
362
  }
211
363
  /**
@@ -216,26 +368,50 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
216
368
  * @protected
217
369
  */
218
370
  getFeatureListFlowItem(layerId, layerName) {
219
- return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports &&
220
- h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), h("calcite-panel", { "full-height": true }, h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
371
+ return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports &&
372
+ h("calcite-button", { appearance: "secondary", onClick: this.navigateToCreateFeature.bind(this), slot: "footer", width: "full" }, this.reportButtonText), h("calcite-panel", { "full-height": true }, h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
221
373
  }
222
374
  /**
223
375
  * Returns the calcite-flow item for feature details
224
376
  * @returns Node
225
377
  */
226
378
  getFeatureDetailsFlowItem() {
227
- return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), h("calcite-action", { icon: "share", slot: "header-actions-end", text: this._translations.share }), h("calcite-panel", { "full-height": true }, h("info-card", { allowEditing: false, graphics: this._selectedFeature, isLoading: false, isMobile: false, mapView: this.mapView, onSelectionChanged: this.featureDetailsChanged.bind(this), zoomAndScrollToSelected: true }))));
379
+ return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), h("instant-apps-social-share", { autoUpdateShareUrl: false, embed: false, popoverButtonIconScale: "s", ref: el => this._shareNode = el, scale: "m", shareButtonColor: "neutral", shareButtonType: "action", slot: "header-actions-end", socialMedia: true, view: this.mapView }), h("calcite-panel", { "full-height": true }, h("info-card", { allowEditing: false, graphics: this._selectedFeature, isLoading: false, isMobile: false, mapView: this.mapView, onSelectionChanged: this.featureDetailsChanged.bind(this), zoomAndScrollToSelected: true }))));
380
+ }
381
+ /**
382
+ * Sets the selected features and updates the first feature as the current selected feature
383
+ * @param features Graphics array of the features selected
384
+ */
385
+ setSelectedFeatures(features) {
386
+ this._selectedFeature = features;
387
+ this.setCurrentFeature(this._selectedFeature.length ? this._selectedFeature[0] : null);
388
+ }
389
+ /**
390
+ * Set the object id of the current selected feature, and also updates the current selected layer details
391
+ * @param selectedFeature Graphic currently shown in feature details
392
+ */
393
+ setCurrentFeature(selectedFeature) {
394
+ if (selectedFeature && selectedFeature.layer) {
395
+ const layer = selectedFeature.layer;
396
+ this.setSelectedLayer(layer.id, layer.title);
397
+ this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
398
+ }
399
+ else {
400
+ this.setSelectedLayer('', '');
401
+ this._currentFeatureId = '';
402
+ }
403
+ this._updateShareURL();
228
404
  }
229
405
  /**
230
406
  * On Feature details change update the Layer title and the current selected layer id
231
407
  * @param evt Event hold the details of current feature graphic in the info-card
232
408
  */
233
409
  featureDetailsChanged(evt) {
234
- this._selectedLayerId = evt.detail[0].layer.id;
235
- this._selectedLayerName = evt.detail[0].layer.title;
410
+ this.setCurrentFeature(evt.detail[0]);
236
411
  }
237
412
  /**
238
413
  * Returns the action button to Expand/Collapse side panel in mobile mode
414
+ * @protected
239
415
  */
240
416
  getActionToExpandCollapsePanel() {
241
417
  return (h("calcite-action", { icon: this._sidePanelCollapsed ? "chevrons-up" : "chevrons-down", onClick: this.toggleSidePanel.bind(this), slot: "header-actions-end", text: this._sidePanelCollapsed ? this._translations.expand : this._translations.collapse }));
@@ -259,36 +435,26 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
259
435
  * Handle map click event
260
436
  * @param layers Array of layerIds
261
437
  *
262
- * @protected
438
+ * @protected
263
439
  */
264
- handleMapClick(layers) {
440
+ handleMapClick() {
265
441
  if (this._mapClickHandle) {
266
442
  this._mapClickHandle.remove();
267
443
  }
268
- this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
269
- void this.onMapClick(event, layers);
270
- });
444
+ this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
271
445
  }
272
446
  /**
273
447
  * On map click do hitTest and get the clicked graphics of valid layers and show feature details
274
- * @param event
275
- * @param layers
448
+ * @param event IMapClick map click event details
276
449
  *
277
450
  * @protected
278
451
  */
279
- async onMapClick(event, layers) {
452
+ async onMapClick(event) {
280
453
  //disable map popup
281
454
  this.mapView.popupEnabled = false;
282
455
  // only include graphics from valid layers listed in the layer list widget
283
- const allMapLayers = await getAllLayers(this.mapView);
284
- const validLayers = [];
285
- allMapLayers.forEach((eachLayer) => {
286
- if (layers.includes(eachLayer.id)) {
287
- validLayers.push(eachLayer);
288
- }
289
- });
290
456
  const opts = {
291
- include: validLayers
457
+ include: this._validLayers
292
458
  };
293
459
  // Perform a hitTest on the View
294
460
  const hitTest = await this.mapView.hitTest(event, opts);
@@ -301,7 +467,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
301
467
  }
302
468
  });
303
469
  //update the selectedFeature
304
- this._selectedFeature = clickedGraphics;
470
+ this.setSelectedFeatures(clickedGraphics);
305
471
  //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
306
472
  // eslint-disable-next-line unicorn/prefer-ternary
307
473
  if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
@@ -321,6 +487,59 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
321
487
  const messages = await getLocaleComponentStrings(this.el);
322
488
  this._translations = messages[0];
323
489
  }
490
+ /**
491
+ * Updates the share url for current selected feature
492
+ * @protected
493
+ */
494
+ _updateShareURL() {
495
+ var _a, _b;
496
+ const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;
497
+ if (!url) {
498
+ return;
499
+ }
500
+ const urlObj = new URL(url);
501
+ //set the selected layers id
502
+ if (this._selectedLayerId) {
503
+ urlObj.searchParams.set("layerid", this._selectedLayerId);
504
+ }
505
+ else {
506
+ urlObj.searchParams.delete("layerid");
507
+ }
508
+ //Set the selected features objectid
509
+ if ((_b = this._selectedFeature) === null || _b === void 0 ? void 0 : _b.length) {
510
+ urlObj.searchParams.set("oid", this._currentFeatureId);
511
+ }
512
+ else {
513
+ urlObj.searchParams.delete("oid");
514
+ }
515
+ //update the url in share component
516
+ this._shareNode.shareUrl = urlObj.href;
517
+ }
518
+ /**
519
+ * Navigates to selected features detail based on the URL params
520
+ * @protected
521
+ */
522
+ async loadFeatureFromURLParams() {
523
+ if (this.layerId && this.objectId) {
524
+ const layer = await getLayerOrTable(this.mapView, this.layerId);
525
+ if (layer) {
526
+ // only query if we have some ids...query with no ids will result in all features being returned
527
+ const featureSet = await queryFeaturesByID([Number(this.objectId)], layer, [], false, this.mapView.spatialReference);
528
+ if (featureSet.length) {
529
+ //update the selectedFeature
530
+ this._selectedFeature = featureSet;
531
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
532
+ // eslint-disable-next-line unicorn/prefer-ternary
533
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
534
+ this._flowItems = [...this._flowItems, "feature-details"];
535
+ }
536
+ else {
537
+ this._flowItems = [...this._flowItems];
538
+ }
539
+ }
540
+ }
541
+ }
542
+ }
324
543
  get el() { return this; }
325
544
  static get watchers() { return {
326
545
  "isMobile": ["isMobileWatchHandler"],
@@ -338,6 +557,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
338
557
  "layers": [16],
339
558
  "loginTitle": [1, "login-title"],
340
559
  "mapView": [16],
560
+ "layerId": [1, "layer-id"],
561
+ "objectId": [1, "object-id"],
341
562
  "reportButtonText": [1, "report-button-text"],
342
563
  "reportsHeader": [1, "reports-header"],
343
564
  "reportSubmittedMessage": [1, "report-submitted-message"],
@@ -354,7 +575,10 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
354
575
  "_sidePanelCollapsed": [32],
355
576
  "_translations": [32],
356
577
  "_hasValidLayers": [32],
357
- "_selectedLayerName": [32]
578
+ "_selectedLayerName": [32],
579
+ "_reportSubmitted": [32],
580
+ "_showSubmitCancelButton": [32],
581
+ "_featureCreationFailedErrorMsg": [32]
358
582
  }, undefined, {
359
583
  "isMobile": ["isMobileWatchHandler"],
360
584
  "mapView": ["mapViewWatchHandler"]
@@ -363,7 +587,7 @@ function defineCustomElement$1() {
363
587
  if (typeof customElements === "undefined") {
364
588
  return;
365
589
  }
366
- const components = ["crowdsource-reporter", "calcite-action", "calcite-action-menu", "calcite-alert", "calcite-button", "calcite-chip", "calcite-filter", "calcite-flow", "calcite-flow-item", "calcite-handle", "calcite-icon", "calcite-input", "calcite-list", "calcite-list-item", "calcite-loader", "calcite-modal", "calcite-notice", "calcite-pagination", "calcite-panel", "calcite-popover", "calcite-progress", "calcite-scrim", "calcite-shell", "calcite-stack", "calcite-tooltip", "delete-button", "edit-card", "feature-list", "info-card", "layer-list"];
590
+ const components = ["crowdsource-reporter", "calcite-action", "calcite-action-menu", "calcite-alert", "calcite-button", "calcite-chip", "calcite-filter", "calcite-flow", "calcite-flow-item", "calcite-handle", "calcite-icon", "calcite-input", "calcite-list", "calcite-list-item", "calcite-loader", "calcite-modal", "calcite-notice", "calcite-pagination", "calcite-panel", "calcite-popover", "calcite-progress", "calcite-scrim", "calcite-shell", "calcite-stack", "calcite-tooltip", "create-feature", "delete-button", "edit-card", "feature-list", "info-card", "instant-apps-social-share", "layer-list"];
367
591
  components.forEach(tagName => { switch (tagName) {
368
592
  case "crowdsource-reporter":
369
593
  if (!customElements.get(tagName)) {
@@ -372,140 +596,150 @@ function defineCustomElement$1() {
372
596
  break;
373
597
  case "calcite-action":
374
598
  if (!customElements.get(tagName)) {
375
- defineCustomElement$u();
599
+ defineCustomElement$w();
376
600
  }
377
601
  break;
378
602
  case "calcite-action-menu":
379
603
  if (!customElements.get(tagName)) {
380
- defineCustomElement$t();
604
+ defineCustomElement$v();
381
605
  }
382
606
  break;
383
607
  case "calcite-alert":
384
608
  if (!customElements.get(tagName)) {
385
- defineCustomElement$s();
609
+ defineCustomElement$u();
386
610
  }
387
611
  break;
388
612
  case "calcite-button":
389
613
  if (!customElements.get(tagName)) {
390
- defineCustomElement$r();
614
+ defineCustomElement$t();
391
615
  }
392
616
  break;
393
617
  case "calcite-chip":
394
618
  if (!customElements.get(tagName)) {
395
- defineCustomElement$q();
619
+ defineCustomElement$s();
396
620
  }
397
621
  break;
398
622
  case "calcite-filter":
399
623
  if (!customElements.get(tagName)) {
400
- defineCustomElement$p();
624
+ defineCustomElement$r();
401
625
  }
402
626
  break;
403
627
  case "calcite-flow":
404
628
  if (!customElements.get(tagName)) {
405
- defineCustomElement$o();
629
+ defineCustomElement$q();
406
630
  }
407
631
  break;
408
632
  case "calcite-flow-item":
409
633
  if (!customElements.get(tagName)) {
410
- defineCustomElement$n();
634
+ defineCustomElement$p();
411
635
  }
412
636
  break;
413
637
  case "calcite-handle":
414
638
  if (!customElements.get(tagName)) {
415
- defineCustomElement$m();
639
+ defineCustomElement$o();
416
640
  }
417
641
  break;
418
642
  case "calcite-icon":
419
643
  if (!customElements.get(tagName)) {
420
- defineCustomElement$l();
644
+ defineCustomElement$n();
421
645
  }
422
646
  break;
423
647
  case "calcite-input":
424
648
  if (!customElements.get(tagName)) {
425
- defineCustomElement$k();
649
+ defineCustomElement$m();
426
650
  }
427
651
  break;
428
652
  case "calcite-list":
429
653
  if (!customElements.get(tagName)) {
430
- defineCustomElement$j();
654
+ defineCustomElement$l();
431
655
  }
432
656
  break;
433
657
  case "calcite-list-item":
434
658
  if (!customElements.get(tagName)) {
435
- defineCustomElement$i();
659
+ defineCustomElement$k();
436
660
  }
437
661
  break;
438
662
  case "calcite-loader":
439
663
  if (!customElements.get(tagName)) {
440
- defineCustomElement$h();
664
+ defineCustomElement$j();
441
665
  }
442
666
  break;
443
667
  case "calcite-modal":
444
668
  if (!customElements.get(tagName)) {
445
- defineCustomElement$g();
669
+ defineCustomElement$i();
446
670
  }
447
671
  break;
448
672
  case "calcite-notice":
449
673
  if (!customElements.get(tagName)) {
450
- defineCustomElement$f();
674
+ defineCustomElement$h();
451
675
  }
452
676
  break;
453
677
  case "calcite-pagination":
454
678
  if (!customElements.get(tagName)) {
455
- defineCustomElement$e();
679
+ defineCustomElement$g();
456
680
  }
457
681
  break;
458
682
  case "calcite-panel":
459
683
  if (!customElements.get(tagName)) {
460
- defineCustomElement$d();
684
+ defineCustomElement$f();
461
685
  }
462
686
  break;
463
687
  case "calcite-popover":
464
688
  if (!customElements.get(tagName)) {
465
- defineCustomElement$c();
689
+ defineCustomElement$e();
466
690
  }
467
691
  break;
468
692
  case "calcite-progress":
469
693
  if (!customElements.get(tagName)) {
470
- defineCustomElement$b();
694
+ defineCustomElement$d();
471
695
  }
472
696
  break;
473
697
  case "calcite-scrim":
474
698
  if (!customElements.get(tagName)) {
475
- defineCustomElement$a();
699
+ defineCustomElement$c();
476
700
  }
477
701
  break;
478
702
  case "calcite-shell":
479
703
  if (!customElements.get(tagName)) {
480
- defineCustomElement$9();
704
+ defineCustomElement$b();
481
705
  }
482
706
  break;
483
707
  case "calcite-stack":
484
708
  if (!customElements.get(tagName)) {
485
- defineCustomElement$8();
709
+ defineCustomElement$a();
486
710
  }
487
711
  break;
488
712
  case "calcite-tooltip":
489
713
  if (!customElements.get(tagName)) {
490
- defineCustomElement$7();
714
+ defineCustomElement$9();
715
+ }
716
+ break;
717
+ case "create-feature":
718
+ if (!customElements.get(tagName)) {
719
+ defineCustomElement$8();
491
720
  }
492
721
  break;
493
722
  case "delete-button":
494
723
  if (!customElements.get(tagName)) {
495
- defineCustomElement$6();
724
+ defineCustomElement$7();
496
725
  }
497
726
  break;
498
727
  case "edit-card":
499
728
  if (!customElements.get(tagName)) {
500
- defineCustomElement$5();
729
+ defineCustomElement$6();
501
730
  }
502
731
  break;
503
732
  case "feature-list":
504
733
  if (!customElements.get(tagName)) {
505
- defineCustomElement$4();
734
+ defineCustomElement$5();
506
735
  }
507
736
  break;
508
737
  case "info-card":
738
+ if (!customElements.get(tagName)) {
739
+ defineCustomElement$4();
740
+ }
741
+ break;
742
+ case "instant-apps-social-share":
509
743
  if (!customElements.get(tagName)) {
510
744
  defineCustomElement$3();
511
745
  }