@esri/solutions-components 0.7.30 → 0.7.32

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -5,12 +5,12 @@
5
5
  */
6
6
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-7183ce4a.js';
7
7
  import { l as loadModules, g as getLocaleComponentStrings } from './locale-731e75a8.js';
8
- import { a as getAllLayers } from './mapViewUtils-cf05e880.js';
8
+ import { a as getAllLayers, g as getLayerOrTable, q as queryFeaturesByID } from './mapViewUtils-cf05e880.js';
9
9
  import './esri-loader-eda07632.js';
10
10
  import './_commonjsHelpers-d5f9d613.js';
11
11
  import './interfaces-586e863c.js';
12
12
 
13
- 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}";
13
+ 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}";
14
14
 
15
15
  const CrowdsourceReporter = class {
16
16
  constructor(hostRef) {
@@ -26,6 +26,8 @@ const CrowdsourceReporter = class {
26
26
  this.layers = undefined;
27
27
  this.loginTitle = undefined;
28
28
  this.mapView = undefined;
29
+ this.layerId = undefined;
30
+ this.objectId = undefined;
29
31
  this.reportButtonText = undefined;
30
32
  this.reportsHeader = undefined;
31
33
  this.reportSubmittedMessage = undefined;
@@ -43,6 +45,9 @@ const CrowdsourceReporter = class {
43
45
  this._translations = undefined;
44
46
  this._hasValidLayers = false;
45
47
  this._selectedLayerName = undefined;
48
+ this._reportSubmitted = false;
49
+ this._showSubmitCancelButton = false;
50
+ this._featureCreationFailedErrorMsg = undefined;
46
51
  }
47
52
  //--------------------------------------------------------------------------
48
53
  //
@@ -74,6 +79,7 @@ const CrowdsourceReporter = class {
74
79
  * @returns Promise when complete
75
80
  */
76
81
  async componentWillLoad() {
82
+ this._urlParamsLoaded = false;
77
83
  await this._initModules();
78
84
  await this._getTranslations();
79
85
  }
@@ -81,7 +87,8 @@ const CrowdsourceReporter = class {
81
87
  * Renders the component.
82
88
  */
83
89
  render() {
84
- return (h(Host, null, h("div", null, h("calcite-shell", { "content-behind": true }, this._getReporter()))));
90
+ const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
91
+ 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()))));
85
92
  }
86
93
  //--------------------------------------------------------------------------
87
94
  //
@@ -101,6 +108,20 @@ const CrowdsourceReporter = class {
101
108
  ]);
102
109
  this.reactiveUtils = reactiveUtils;
103
110
  }
111
+ /**
112
+ * Set the selected layer id and layer name
113
+ * @param layerId string layerId of the selected layer
114
+ * @param layerName string layerName of the selected layer
115
+ */
116
+ setSelectedLayer(layerId, layerName) {
117
+ this._selectedLayerId = layerId;
118
+ this._selectedLayerName = layerName;
119
+ //show only current layer on map and hide other valid editable layers
120
+ //if layerId is empty then show all the layers on map
121
+ this._validLayers.forEach(layer => {
122
+ layer.set('visible', !layerId || (layer.id === layerId));
123
+ });
124
+ }
104
125
  /**
105
126
  * Get the reporter app functionality
106
127
  * @protected
@@ -118,6 +139,12 @@ const CrowdsourceReporter = class {
118
139
  case "feature-details":
119
140
  renderLists.push(this.getFeatureDetailsFlowItem());
120
141
  break;
142
+ case "reporting-layer-list":
143
+ renderLists.push(this.getChooseCategoryFlowItem());
144
+ break;
145
+ case "feature-create":
146
+ renderLists.push(this.getFeatureCreateFlowItem());
147
+ break;
121
148
  }
122
149
  });
123
150
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
@@ -134,34 +161,156 @@ const CrowdsourceReporter = class {
134
161
  return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers &&
135
162
  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 &&
136
163
  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 &&
137
- 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 }))));
164
+ 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 }))));
165
+ }
166
+ /**
167
+ * Get the layer list for creating a report
168
+ * @returns Choose category flow item
169
+ * @protected
170
+ */
171
+ getChooseCategoryFlowItem() {
172
+ 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 }))));
173
+ }
174
+ /**
175
+ * Get Feature create form of the selected feature layer
176
+ * @returns feature create form
177
+ * @protected
178
+ */
179
+ getFeatureCreateFlowItem() {
180
+ 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 }))));
181
+ }
182
+ /**
183
+ * When drawing of incident location completed on map show the submit and cancel button
184
+ * @protected
185
+ */
186
+ onDrawComplete() {
187
+ this._showSubmitCancelButton = true;
188
+ }
189
+ /**
190
+ * When Add attachment panel is enabled hide the submit and cancel button
191
+ * @protected
192
+ */
193
+ showSubmitCancelButton(evt) {
194
+ this._showSubmitCancelButton = !evt.detail;
195
+ }
196
+ /**
197
+ * On back from create feature, call submit editor to destroy the Editor widget instance
198
+ * @protected
199
+ */
200
+ onSubmitButtonClick() {
201
+ if (this._createFeature) {
202
+ this._createFeature.submit();
203
+ }
204
+ }
205
+ /**
206
+ * On back from create feature, call close editor to destroy the Editor widget instance
207
+ * @protected
208
+ */
209
+ backFromCreateFeaturePanel() {
210
+ if (this._createFeature) {
211
+ this._createFeature.close();
212
+ }
213
+ this.backFromSelectedPanel();
214
+ }
215
+ /**
216
+ * On creating the feature is failed, show the error message
217
+ * @param evt Event which has feature failed message
218
+ * @protected
219
+ */
220
+ createFeatureFailed(evt) {
221
+ console.error(evt.detail);
222
+ this._featureCreationFailedErrorMsg = evt.detail.message;
223
+ }
224
+ /**
225
+ * On submit report navigate to the layer list home page and refresh the layer list
226
+ * @protected
227
+ */
228
+ onReportSubmitted() {
229
+ this._reportSubmitted = true;
230
+ this.navigateToHomePage();
231
+ }
232
+ /**
233
+ * Navigates to layer-list
234
+ * @protected
235
+ */
236
+ navigateToHomePage() {
237
+ if (this._createFeature) {
238
+ this._createFeature.close();
239
+ }
240
+ if (this._layerList) {
241
+ this._layerList.refresh();
242
+ }
243
+ this.setSelectedFeatures([]);
244
+ this._flowItems = ["layer-list"];
245
+ }
246
+ /**
247
+ * Update the selected layer id and name
248
+ * @param evt Event which has details of selected layerId and layerName
249
+ * @protected
250
+ */
251
+ highlightSelectedLayer(evt) {
252
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
253
+ }
254
+ /**
255
+ * On next button click open the feature create flow item
256
+ * @protected
257
+ */
258
+ async navigateToCreateFeature() {
259
+ this._showSubmitCancelButton = false;
260
+ this._flowItems = [...this._flowItems, "feature-create"];
261
+ }
262
+ /**
263
+ * On report an incident button click open the create a report panel with the layer list
264
+ * @protected
265
+ */
266
+ navigateToChooseCategory() {
267
+ this._flowItems = [...this._flowItems, "reporting-layer-list"];
138
268
  }
139
269
  /**
140
270
  * 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
141
271
  * @param evt Event which has list of layers
142
272
  * @protected
143
273
  */
144
- layerListLoaded(evt) {
274
+ async layerListLoaded(evt) {
145
275
  const layersListed = evt.detail;
146
- this.handleMapClick(layersListed);
276
+ //consider only the layers listed in the layer-list component
277
+ const allMapLayers = await getAllLayers(this.mapView);
278
+ this._validLayers = [];
279
+ allMapLayers.forEach((eachLayer) => {
280
+ if (layersListed.includes(eachLayer.id)) {
281
+ this._validLayers.push(eachLayer);
282
+ }
283
+ });
284
+ //handleMap click on layer list loaded
285
+ this.handleMapClick();
286
+ //update the has valid layer state
147
287
  this._hasValidLayers = layersListed.length > 0;
288
+ //navigate to the feature details if URL params found
289
+ if (!this._urlParamsLoaded) {
290
+ this._urlParamsLoaded = true;
291
+ await this.loadFeatureFromURLParams();
292
+ }
148
293
  }
149
294
  /**On click of layer list item show feature list
150
295
  * @param evt Event which has details of selected layerId and layerName
151
296
  * @protected
152
297
  */
153
298
  displayFeaturesList(evt) {
154
- this._selectedLayerId = evt.detail.layerId;
155
- this._selectedLayerName = evt.detail.layerName;
299
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
156
300
  this._flowItems = [...this._flowItems, "feature-list"];
157
301
  }
158
302
  /**
159
- * On back from feature list navigate to the Layer list panel
303
+ * On back from selected panel navigate to the previous panel
160
304
  * @protected
161
305
  */
162
- backFromFeatureList() {
306
+ backFromSelectedPanel() {
163
307
  const updatedFlowItems = [...this._flowItems];
164
308
  updatedFlowItems.pop();
309
+ //Back to layer list, and return as the flowItems will be reset in navigateToHomePage
310
+ if (updatedFlowItems.length === 1) {
311
+ this.navigateToHomePage();
312
+ return;
313
+ }
165
314
  this._flowItems = [...updatedFlowItems];
166
315
  }
167
316
  /**
@@ -177,7 +326,7 @@ const CrowdsourceReporter = class {
177
326
  * @param evt Event which has details of selected feature
178
327
  */
179
328
  async onFeatureSelectFromList(evt) {
180
- this._selectedFeature = [evt.detail];
329
+ this.setSelectedFeatures([evt.detail]);
181
330
  this._flowItems = [...this._flowItems, "feature-details"];
182
331
  }
183
332
  /**
@@ -188,26 +337,50 @@ const CrowdsourceReporter = class {
188
337
  * @protected
189
338
  */
190
339
  getFeatureListFlowItem(layerId, layerName) {
191
- 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 &&
192
- 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 }))));
340
+ 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 &&
341
+ 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 }))));
193
342
  }
194
343
  /**
195
344
  * Returns the calcite-flow item for feature details
196
345
  * @returns Node
197
346
  */
198
347
  getFeatureDetailsFlowItem() {
199
- 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 }))));
348
+ 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 }))));
349
+ }
350
+ /**
351
+ * Sets the selected features and updates the first feature as the current selected feature
352
+ * @param features Graphics array of the features selected
353
+ */
354
+ setSelectedFeatures(features) {
355
+ this._selectedFeature = features;
356
+ this.setCurrentFeature(this._selectedFeature.length ? this._selectedFeature[0] : null);
357
+ }
358
+ /**
359
+ * Set the object id of the current selected feature, and also updates the current selected layer details
360
+ * @param selectedFeature Graphic currently shown in feature details
361
+ */
362
+ setCurrentFeature(selectedFeature) {
363
+ if (selectedFeature && selectedFeature.layer) {
364
+ const layer = selectedFeature.layer;
365
+ this.setSelectedLayer(layer.id, layer.title);
366
+ this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
367
+ }
368
+ else {
369
+ this.setSelectedLayer('', '');
370
+ this._currentFeatureId = '';
371
+ }
372
+ this._updateShareURL();
200
373
  }
201
374
  /**
202
375
  * On Feature details change update the Layer title and the current selected layer id
203
376
  * @param evt Event hold the details of current feature graphic in the info-card
204
377
  */
205
378
  featureDetailsChanged(evt) {
206
- this._selectedLayerId = evt.detail[0].layer.id;
207
- this._selectedLayerName = evt.detail[0].layer.title;
379
+ this.setCurrentFeature(evt.detail[0]);
208
380
  }
209
381
  /**
210
382
  * Returns the action button to Expand/Collapse side panel in mobile mode
383
+ * @protected
211
384
  */
212
385
  getActionToExpandCollapsePanel() {
213
386
  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 }));
@@ -231,36 +404,26 @@ const CrowdsourceReporter = class {
231
404
  * Handle map click event
232
405
  * @param layers Array of layerIds
233
406
  *
234
- * @protected
407
+ * @protected
235
408
  */
236
- handleMapClick(layers) {
409
+ handleMapClick() {
237
410
  if (this._mapClickHandle) {
238
411
  this._mapClickHandle.remove();
239
412
  }
240
- this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
241
- void this.onMapClick(event, layers);
242
- });
413
+ this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
243
414
  }
244
415
  /**
245
416
  * On map click do hitTest and get the clicked graphics of valid layers and show feature details
246
- * @param event
247
- * @param layers
417
+ * @param event IMapClick map click event details
248
418
  *
249
419
  * @protected
250
420
  */
251
- async onMapClick(event, layers) {
421
+ async onMapClick(event) {
252
422
  //disable map popup
253
423
  this.mapView.popupEnabled = false;
254
424
  // only include graphics from valid layers listed in the layer list widget
255
- const allMapLayers = await getAllLayers(this.mapView);
256
- const validLayers = [];
257
- allMapLayers.forEach((eachLayer) => {
258
- if (layers.includes(eachLayer.id)) {
259
- validLayers.push(eachLayer);
260
- }
261
- });
262
425
  const opts = {
263
- include: validLayers
426
+ include: this._validLayers
264
427
  };
265
428
  // Perform a hitTest on the View
266
429
  const hitTest = await this.mapView.hitTest(event, opts);
@@ -273,7 +436,7 @@ const CrowdsourceReporter = class {
273
436
  }
274
437
  });
275
438
  //update the selectedFeature
276
- this._selectedFeature = clickedGraphics;
439
+ this.setSelectedFeatures(clickedGraphics);
277
440
  //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
278
441
  // eslint-disable-next-line unicorn/prefer-ternary
279
442
  if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
@@ -293,6 +456,59 @@ const CrowdsourceReporter = class {
293
456
  const messages = await getLocaleComponentStrings(this.el);
294
457
  this._translations = messages[0];
295
458
  }
459
+ /**
460
+ * Updates the share url for current selected feature
461
+ * @protected
462
+ */
463
+ _updateShareURL() {
464
+ var _a, _b;
465
+ const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;
466
+ if (!url) {
467
+ return;
468
+ }
469
+ const urlObj = new URL(url);
470
+ //set the selected layers id
471
+ if (this._selectedLayerId) {
472
+ urlObj.searchParams.set("layerid", this._selectedLayerId);
473
+ }
474
+ else {
475
+ urlObj.searchParams.delete("layerid");
476
+ }
477
+ //Set the selected features objectid
478
+ if ((_b = this._selectedFeature) === null || _b === void 0 ? void 0 : _b.length) {
479
+ urlObj.searchParams.set("oid", this._currentFeatureId);
480
+ }
481
+ else {
482
+ urlObj.searchParams.delete("oid");
483
+ }
484
+ //update the url in share component
485
+ this._shareNode.shareUrl = urlObj.href;
486
+ }
487
+ /**
488
+ * Navigates to selected features detail based on the URL params
489
+ * @protected
490
+ */
491
+ async loadFeatureFromURLParams() {
492
+ if (this.layerId && this.objectId) {
493
+ const layer = await getLayerOrTable(this.mapView, this.layerId);
494
+ if (layer) {
495
+ // only query if we have some ids...query with no ids will result in all features being returned
496
+ const featureSet = await queryFeaturesByID([Number(this.objectId)], layer, [], false, this.mapView.spatialReference);
497
+ if (featureSet.length) {
498
+ //update the selectedFeature
499
+ this._selectedFeature = featureSet;
500
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
501
+ // eslint-disable-next-line unicorn/prefer-ternary
502
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
503
+ this._flowItems = [...this._flowItems, "feature-details"];
504
+ }
505
+ else {
506
+ this._flowItems = [...this._flowItems];
507
+ }
508
+ }
509
+ }
510
+ }
511
+ }
296
512
  get el() { return getElement(this); }
297
513
  static get watchers() { return {
298
514
  "isMobile": ["isMobileWatchHandler"],
@@ -1508,7 +1508,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1508
1508
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1509
1509
  * ====================================================================
1510
1510
  */
1511
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-d48535a2.js')).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
1511
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-3b4fa9d0.js')).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
1512
1512
  /** ====================================================================
1513
1513
  * @license
1514
1514
  * jsPDF XMP metadata plugin
@@ -2859,7 +2859,7 @@ function _prepareAttributeValue(attributeValue, attributeType, attributeDomain,
2859
2859
  if (attributeDomain && attributeDomain.type === "coded-value") {
2860
2860
  // "coded-value" domain field
2861
2861
  const value = attributeDomain.getName(attributeValue);
2862
- return value.toString();
2862
+ return value === null || value === void 0 ? void 0 : value.toString();
2863
2863
  }
2864
2864
  else {
2865
2865
  // Non-domain field or unsupported domain type
@@ -4,7 +4,7 @@
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
6
  import { a as commonjsGlobal, c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-d5f9d613.js';
7
- import { _ as _typeof_1 } from './downloadUtils-d070a467.js';
7
+ import { _ as _typeof_1 } from './downloadUtils-d297078f.js';
8
8
  import './index-7183ce4a.js';
9
9
  import './locale-731e75a8.js';
10
10
  import './esri-loader-eda07632.js';