@esri/solutions-components 0.7.30 → 0.7.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) 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} +235 -19
  8. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +221 -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 +23 -0
  18. package/dist/collection/components/create-feature/create-feature.js +361 -0
  19. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
  20. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +260 -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/crowdsource-reporter.html +26 -11
  24. package/dist/collection/utils/downloadUtils.js +1 -1
  25. package/dist/collection/utils/downloadUtils.ts +1 -1
  26. package/dist/components/create-feature.d.ts +11 -0
  27. package/dist/components/create-feature.js +11 -0
  28. package/dist/components/create-feature2.js +226 -0
  29. package/dist/components/crowdsource-reporter.js +297 -90
  30. package/dist/components/downloadUtils.js +1 -1
  31. package/dist/components/feature-list2.js +1 -0
  32. package/dist/components/layer-list2.js +38 -17
  33. package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +235 -20
  34. package/dist/esm/card-manager_3.entry.js +1 -1
  35. package/dist/esm/crowdsource-reporter.entry.js +222 -33
  36. package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
  37. package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/map-select-tools_3.entry.js +1 -1
  40. package/dist/esm/public-notification.entry.js +1 -1
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
  43. package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
  44. package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
  45. package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
  46. package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
  47. package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
  48. package/dist/solutions-components/p-b4e2cac4.entry.js +17 -0
  49. package/dist/solutions-components/p-bb6562ab.entry.js +6 -0
  50. package/dist/solutions-components/solutions-components.esm.js +1 -1
  51. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  52. package/dist/types/components/create-feature/create-feature.d.ts +107 -0
  53. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +132 -12
  54. package/dist/types/components/feature-list/feature-list.d.ts +1 -0
  55. package/dist/types/components/layer-list/layer-list.d.ts +6 -0
  56. package/dist/types/components.d.ts +89 -0
  57. package/dist/types/preact.d.ts +6 -0
  58. package/package.json +1 -1
  59. package/dist/solutions-components/p-2f162664.entry.js +0 -6
  60. 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
  //
@@ -109,7 +117,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
109
117
  * Renders the component.
110
118
  */
111
119
  render() {
112
- return (h(Host, null, h("div", null, h("calcite-shell", { "content-behind": true }, this._getReporter()))));
120
+ const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
121
+ 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
122
  }
114
123
  //--------------------------------------------------------------------------
115
124
  //
@@ -129,6 +138,15 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
129
138
  ]);
130
139
  this.reactiveUtils = reactiveUtils;
131
140
  }
141
+ /**
142
+ * Set the selected layer id and layer name
143
+ * @param layerId string layerId of the selected layer
144
+ * @param layerName string layerName of the selected layer
145
+ */
146
+ setSelectedLayer(layerId, layerName) {
147
+ this._selectedLayerId = layerId;
148
+ this._selectedLayerName = layerName;
149
+ }
132
150
  /**
133
151
  * Get the reporter app functionality
134
152
  * @protected
@@ -146,6 +164,12 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
146
164
  case "feature-details":
147
165
  renderLists.push(this.getFeatureDetailsFlowItem());
148
166
  break;
167
+ case "reporting-layer-list":
168
+ renderLists.push(this.getChooseCategoryFlowItem());
169
+ break;
170
+ case "feature-create":
171
+ renderLists.push(this.getFeatureCreateFlowItem());
172
+ break;
149
173
  }
150
174
  });
151
175
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
@@ -162,34 +186,135 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
162
186
  return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers &&
163
187
  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
188
  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 }))));
189
+ 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 }))));
190
+ }
191
+ /**
192
+ * Get the layer list for creating a report
193
+ * @returns Choose category flow item
194
+ * @protected
195
+ */
196
+ getChooseCategoryFlowItem() {
197
+ 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 }))));
198
+ }
199
+ /**
200
+ * Get Feature create form of the selected feature layer
201
+ * @returns feature create form
202
+ * @protected
203
+ */
204
+ getFeatureCreateFlowItem() {
205
+ 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", { mapView: this.mapView, onDrawComplete: this.showSubmitCancelButton.bind(this), onFail: this.createFeatureFailed.bind(this), onSuccess: this.navigateHomePage.bind(this), ref: el => this._createFeature = el, selectedLayerId: this._selectedLayerId }))));
206
+ }
207
+ /**
208
+ * When drawing of incident location completed on map show the submit and cancel button
209
+ * @protected
210
+ */
211
+ showSubmitCancelButton() {
212
+ this._showSubmitCancelButton = true;
213
+ }
214
+ /**
215
+ * On back from create feature, call submit editor to destroy the Editor widget instance
216
+ * @protected
217
+ */
218
+ onSubmitButtonClick() {
219
+ if (this._createFeature) {
220
+ this._createFeature.submit();
221
+ }
222
+ }
223
+ /**
224
+ * On back from create feature, call close editor to destroy the Editor widget instance
225
+ * @protected
226
+ */
227
+ backFromCreateFeaturePanel() {
228
+ if (this._createFeature) {
229
+ this._createFeature.close();
230
+ }
231
+ this.backFromSelectedPanel();
232
+ }
233
+ /**
234
+ * On creating the feature is failed, show the error message
235
+ * @param evt Event which has feature failed message
236
+ * @protected
237
+ */
238
+ createFeatureFailed(evt) {
239
+ console.error(evt.detail);
240
+ this._featureCreationFailedErrorMsg = evt.detail.message;
241
+ }
242
+ /**
243
+ * On submit report navigate to the layer list home page and refresh the layer list
244
+ * @protected
245
+ */
246
+ navigateHomePage() {
247
+ this._reportSubmitted = true;
248
+ if (this._layerList) {
249
+ this._layerList.refresh();
250
+ }
251
+ this._flowItems = ["layer-list"];
252
+ }
253
+ /**
254
+ * Update the selected layer id and name
255
+ * @param evt Event which has details of selected layerId and layerName
256
+ * @protected
257
+ */
258
+ highlightSelectedLayer(evt) {
259
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
260
+ }
261
+ /**
262
+ * On next button click open the feature create flow item
263
+ * @protected
264
+ */
265
+ async navigateToCreateFeature() {
266
+ this._showSubmitCancelButton = false;
267
+ this._flowItems = [...this._flowItems, "feature-create"];
268
+ }
269
+ /**
270
+ * On report an incident button click open the create a report panel with the layer list
271
+ * @protected
272
+ */
273
+ navigateToChooseCategory() {
274
+ this._flowItems = [...this._flowItems, "reporting-layer-list"];
166
275
  }
167
276
  /**
168
277
  * 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
278
  * @param evt Event which has list of layers
170
279
  * @protected
171
280
  */
172
- layerListLoaded(evt) {
281
+ async layerListLoaded(evt) {
173
282
  const layersListed = evt.detail;
174
- this.handleMapClick(layersListed);
283
+ //consider only the layers listed in the layer-list component
284
+ const allMapLayers = await getAllLayers(this.mapView);
285
+ this._validLayers = [];
286
+ allMapLayers.forEach((eachLayer) => {
287
+ if (layersListed.includes(eachLayer.id)) {
288
+ this._validLayers.push(eachLayer);
289
+ }
290
+ });
291
+ //handleMap click on layer list loaded
292
+ this.handleMapClick();
293
+ //update the has valid layer state
175
294
  this._hasValidLayers = layersListed.length > 0;
295
+ //navigate to the feature details if URL params found
296
+ await this.loadFeatureFromURLParams();
176
297
  }
177
298
  /**On click of layer list item show feature list
178
299
  * @param evt Event which has details of selected layerId and layerName
179
300
  * @protected
180
301
  */
181
302
  displayFeaturesList(evt) {
182
- this._selectedLayerId = evt.detail.layerId;
183
- this._selectedLayerName = evt.detail.layerName;
303
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
184
304
  this._flowItems = [...this._flowItems, "feature-list"];
185
305
  }
186
306
  /**
187
- * On back from feature list navigate to the Layer list panel
307
+ * On back from selected panel navigate to the previous panel
188
308
  * @protected
189
309
  */
190
- backFromFeatureList() {
310
+ backFromSelectedPanel() {
191
311
  const updatedFlowItems = [...this._flowItems];
192
312
  updatedFlowItems.pop();
313
+ //clear the selected layer and feature when back to layer list
314
+ if (updatedFlowItems.length === 1) {
315
+ this.setSelectedLayer('', '');
316
+ this.setSelectedFeatures([]);
317
+ }
193
318
  this._flowItems = [...updatedFlowItems];
194
319
  }
195
320
  /**
@@ -205,7 +330,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
205
330
  * @param evt Event which has details of selected feature
206
331
  */
207
332
  async onFeatureSelectFromList(evt) {
208
- this._selectedFeature = [evt.detail];
333
+ this.setSelectedFeatures([evt.detail]);
209
334
  this._flowItems = [...this._flowItems, "feature-details"];
210
335
  }
211
336
  /**
@@ -216,26 +341,50 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
216
341
  * @protected
217
342
  */
218
343
  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 }))));
344
+ 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 &&
345
+ 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
346
  }
222
347
  /**
223
348
  * Returns the calcite-flow item for feature details
224
349
  * @returns Node
225
350
  */
226
351
  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 }))));
352
+ 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 }))));
353
+ }
354
+ /**
355
+ * Sets the selected features and updates the first feature as the current selected feature
356
+ * @param features Graphics array of the features selected
357
+ */
358
+ setSelectedFeatures(features) {
359
+ this._selectedFeature = features;
360
+ this.setCurrentFeature(this._selectedFeature.length ? this._selectedFeature[0] : null);
361
+ }
362
+ /**
363
+ * Set the object id of the current selected feature, and also updates the current selected layer details
364
+ * @param selectedFeature Graphic currently shown in feature details
365
+ */
366
+ setCurrentFeature(selectedFeature) {
367
+ if (selectedFeature && selectedFeature.layer) {
368
+ const layer = selectedFeature.layer;
369
+ this.setSelectedLayer(layer.id, layer.title);
370
+ this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
371
+ }
372
+ else {
373
+ this.setSelectedLayer('', '');
374
+ this._currentFeatureId = '';
375
+ }
376
+ this._updateShareURL();
228
377
  }
229
378
  /**
230
379
  * On Feature details change update the Layer title and the current selected layer id
231
380
  * @param evt Event hold the details of current feature graphic in the info-card
232
381
  */
233
382
  featureDetailsChanged(evt) {
234
- this._selectedLayerId = evt.detail[0].layer.id;
235
- this._selectedLayerName = evt.detail[0].layer.title;
383
+ this.setCurrentFeature(evt.detail[0]);
236
384
  }
237
385
  /**
238
386
  * Returns the action button to Expand/Collapse side panel in mobile mode
387
+ * @protected
239
388
  */
240
389
  getActionToExpandCollapsePanel() {
241
390
  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 +408,26 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
259
408
  * Handle map click event
260
409
  * @param layers Array of layerIds
261
410
  *
262
- * @protected
411
+ * @protected
263
412
  */
264
- handleMapClick(layers) {
413
+ handleMapClick() {
265
414
  if (this._mapClickHandle) {
266
415
  this._mapClickHandle.remove();
267
416
  }
268
- this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
269
- void this.onMapClick(event, layers);
270
- });
417
+ this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
271
418
  }
272
419
  /**
273
420
  * On map click do hitTest and get the clicked graphics of valid layers and show feature details
274
- * @param event
275
- * @param layers
421
+ * @param event IMapClick map click event details
276
422
  *
277
423
  * @protected
278
424
  */
279
- async onMapClick(event, layers) {
425
+ async onMapClick(event) {
280
426
  //disable map popup
281
427
  this.mapView.popupEnabled = false;
282
428
  // 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
429
  const opts = {
291
- include: validLayers
430
+ include: this._validLayers
292
431
  };
293
432
  // Perform a hitTest on the View
294
433
  const hitTest = await this.mapView.hitTest(event, opts);
@@ -301,7 +440,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
301
440
  }
302
441
  });
303
442
  //update the selectedFeature
304
- this._selectedFeature = clickedGraphics;
443
+ this.setSelectedFeatures(clickedGraphics);
305
444
  //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
306
445
  // eslint-disable-next-line unicorn/prefer-ternary
307
446
  if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
@@ -321,6 +460,59 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
321
460
  const messages = await getLocaleComponentStrings(this.el);
322
461
  this._translations = messages[0];
323
462
  }
463
+ /**
464
+ * Updates the share url for current selected feature
465
+ * @returns
466
+ * @protected
467
+ */
468
+ _updateShareURL() {
469
+ var _a, _b;
470
+ const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;
471
+ if (!url) {
472
+ return;
473
+ }
474
+ const urlObj = new URL(url);
475
+ //set the selected layers id
476
+ if (this._selectedLayerId) {
477
+ urlObj.searchParams.set("layerid", this._selectedLayerId);
478
+ }
479
+ else {
480
+ urlObj.searchParams.delete("layerid");
481
+ }
482
+ //Set the selected features objectid
483
+ if ((_b = this._selectedFeature) === null || _b === void 0 ? void 0 : _b.length) {
484
+ urlObj.searchParams.set("oid", this._currentFeatureId);
485
+ }
486
+ else {
487
+ urlObj.searchParams.delete("oid");
488
+ }
489
+ //update the url in share component
490
+ this._shareNode.shareUrl = urlObj.href;
491
+ }
492
+ /**
493
+ * Navigates to selected features detail based on the URL params
494
+ */
495
+ async loadFeatureFromURLParams() {
496
+ if (this.layerId && this.objectId) {
497
+ const layer = await getLayerOrTable(this.mapView, this.layerId);
498
+ if (layer) {
499
+ // only query if we have some ids...query with no ids will result in all features being returned
500
+ const featureSet = await queryFeaturesByID([Number(this.objectId)], layer, [], false, this.mapView.spatialReference);
501
+ if (featureSet.length) {
502
+ //update the selectedFeature
503
+ this._selectedFeature = featureSet;
504
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
505
+ // eslint-disable-next-line unicorn/prefer-ternary
506
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
507
+ this._flowItems = [...this._flowItems, "feature-details"];
508
+ }
509
+ else {
510
+ this._flowItems = [...this._flowItems];
511
+ }
512
+ }
513
+ }
514
+ }
515
+ }
324
516
  get el() { return this; }
325
517
  static get watchers() { return {
326
518
  "isMobile": ["isMobileWatchHandler"],
@@ -338,6 +530,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
338
530
  "layers": [16],
339
531
  "loginTitle": [1, "login-title"],
340
532
  "mapView": [16],
533
+ "layerId": [1, "layer-id"],
534
+ "objectId": [1, "object-id"],
341
535
  "reportButtonText": [1, "report-button-text"],
342
536
  "reportsHeader": [1, "reports-header"],
343
537
  "reportSubmittedMessage": [1, "report-submitted-message"],
@@ -354,7 +548,10 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
354
548
  "_sidePanelCollapsed": [32],
355
549
  "_translations": [32],
356
550
  "_hasValidLayers": [32],
357
- "_selectedLayerName": [32]
551
+ "_selectedLayerName": [32],
552
+ "_reportSubmitted": [32],
553
+ "_showSubmitCancelButton": [32],
554
+ "_featureCreationFailedErrorMsg": [32]
358
555
  }, undefined, {
359
556
  "isMobile": ["isMobileWatchHandler"],
360
557
  "mapView": ["mapViewWatchHandler"]
@@ -363,7 +560,7 @@ function defineCustomElement$1() {
363
560
  if (typeof customElements === "undefined") {
364
561
  return;
365
562
  }
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"];
563
+ 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
564
  components.forEach(tagName => { switch (tagName) {
368
565
  case "crowdsource-reporter":
369
566
  if (!customElements.get(tagName)) {
@@ -372,140 +569,150 @@ function defineCustomElement$1() {
372
569
  break;
373
570
  case "calcite-action":
374
571
  if (!customElements.get(tagName)) {
375
- defineCustomElement$u();
572
+ defineCustomElement$w();
376
573
  }
377
574
  break;
378
575
  case "calcite-action-menu":
379
576
  if (!customElements.get(tagName)) {
380
- defineCustomElement$t();
577
+ defineCustomElement$v();
381
578
  }
382
579
  break;
383
580
  case "calcite-alert":
384
581
  if (!customElements.get(tagName)) {
385
- defineCustomElement$s();
582
+ defineCustomElement$u();
386
583
  }
387
584
  break;
388
585
  case "calcite-button":
389
586
  if (!customElements.get(tagName)) {
390
- defineCustomElement$r();
587
+ defineCustomElement$t();
391
588
  }
392
589
  break;
393
590
  case "calcite-chip":
394
591
  if (!customElements.get(tagName)) {
395
- defineCustomElement$q();
592
+ defineCustomElement$s();
396
593
  }
397
594
  break;
398
595
  case "calcite-filter":
399
596
  if (!customElements.get(tagName)) {
400
- defineCustomElement$p();
597
+ defineCustomElement$r();
401
598
  }
402
599
  break;
403
600
  case "calcite-flow":
404
601
  if (!customElements.get(tagName)) {
405
- defineCustomElement$o();
602
+ defineCustomElement$q();
406
603
  }
407
604
  break;
408
605
  case "calcite-flow-item":
409
606
  if (!customElements.get(tagName)) {
410
- defineCustomElement$n();
607
+ defineCustomElement$p();
411
608
  }
412
609
  break;
413
610
  case "calcite-handle":
414
611
  if (!customElements.get(tagName)) {
415
- defineCustomElement$m();
612
+ defineCustomElement$o();
416
613
  }
417
614
  break;
418
615
  case "calcite-icon":
419
616
  if (!customElements.get(tagName)) {
420
- defineCustomElement$l();
617
+ defineCustomElement$n();
421
618
  }
422
619
  break;
423
620
  case "calcite-input":
424
621
  if (!customElements.get(tagName)) {
425
- defineCustomElement$k();
622
+ defineCustomElement$m();
426
623
  }
427
624
  break;
428
625
  case "calcite-list":
429
626
  if (!customElements.get(tagName)) {
430
- defineCustomElement$j();
627
+ defineCustomElement$l();
431
628
  }
432
629
  break;
433
630
  case "calcite-list-item":
434
631
  if (!customElements.get(tagName)) {
435
- defineCustomElement$i();
632
+ defineCustomElement$k();
436
633
  }
437
634
  break;
438
635
  case "calcite-loader":
439
636
  if (!customElements.get(tagName)) {
440
- defineCustomElement$h();
637
+ defineCustomElement$j();
441
638
  }
442
639
  break;
443
640
  case "calcite-modal":
444
641
  if (!customElements.get(tagName)) {
445
- defineCustomElement$g();
642
+ defineCustomElement$i();
446
643
  }
447
644
  break;
448
645
  case "calcite-notice":
449
646
  if (!customElements.get(tagName)) {
450
- defineCustomElement$f();
647
+ defineCustomElement$h();
451
648
  }
452
649
  break;
453
650
  case "calcite-pagination":
454
651
  if (!customElements.get(tagName)) {
455
- defineCustomElement$e();
652
+ defineCustomElement$g();
456
653
  }
457
654
  break;
458
655
  case "calcite-panel":
459
656
  if (!customElements.get(tagName)) {
460
- defineCustomElement$d();
657
+ defineCustomElement$f();
461
658
  }
462
659
  break;
463
660
  case "calcite-popover":
464
661
  if (!customElements.get(tagName)) {
465
- defineCustomElement$c();
662
+ defineCustomElement$e();
466
663
  }
467
664
  break;
468
665
  case "calcite-progress":
469
666
  if (!customElements.get(tagName)) {
470
- defineCustomElement$b();
667
+ defineCustomElement$d();
471
668
  }
472
669
  break;
473
670
  case "calcite-scrim":
474
671
  if (!customElements.get(tagName)) {
475
- defineCustomElement$a();
672
+ defineCustomElement$c();
476
673
  }
477
674
  break;
478
675
  case "calcite-shell":
479
676
  if (!customElements.get(tagName)) {
480
- defineCustomElement$9();
677
+ defineCustomElement$b();
481
678
  }
482
679
  break;
483
680
  case "calcite-stack":
484
681
  if (!customElements.get(tagName)) {
485
- defineCustomElement$8();
682
+ defineCustomElement$a();
486
683
  }
487
684
  break;
488
685
  case "calcite-tooltip":
489
686
  if (!customElements.get(tagName)) {
490
- defineCustomElement$7();
687
+ defineCustomElement$9();
688
+ }
689
+ break;
690
+ case "create-feature":
691
+ if (!customElements.get(tagName)) {
692
+ defineCustomElement$8();
491
693
  }
492
694
  break;
493
695
  case "delete-button":
494
696
  if (!customElements.get(tagName)) {
495
- defineCustomElement$6();
697
+ defineCustomElement$7();
496
698
  }
497
699
  break;
498
700
  case "edit-card":
499
701
  if (!customElements.get(tagName)) {
500
- defineCustomElement$5();
702
+ defineCustomElement$6();
501
703
  }
502
704
  break;
503
705
  case "feature-list":
504
706
  if (!customElements.get(tagName)) {
505
- defineCustomElement$4();
707
+ defineCustomElement$5();
506
708
  }
507
709
  break;
508
710
  case "info-card":
711
+ if (!customElements.get(tagName)) {
712
+ defineCustomElement$4();
713
+ }
714
+ break;
715
+ case "instant-apps-social-share":
509
716
  if (!customElements.get(tagName)) {
510
717
  defineCustomElement$3();
511
718
  }