@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
@@ -14,7 +14,7 @@ require('./esri-loader-a91c0ec1.js');
14
14
  require('./_commonjsHelpers-384729db.js');
15
15
  require('./interfaces-7cd0a48a.js');
16
16
 
17
- 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}";
17
+ 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}";
18
18
 
19
19
  const CrowdsourceReporter = class {
20
20
  constructor(hostRef) {
@@ -30,6 +30,8 @@ const CrowdsourceReporter = class {
30
30
  this.layers = undefined;
31
31
  this.loginTitle = undefined;
32
32
  this.mapView = undefined;
33
+ this.layerId = undefined;
34
+ this.objectId = undefined;
33
35
  this.reportButtonText = undefined;
34
36
  this.reportsHeader = undefined;
35
37
  this.reportSubmittedMessage = undefined;
@@ -47,6 +49,9 @@ const CrowdsourceReporter = class {
47
49
  this._translations = undefined;
48
50
  this._hasValidLayers = false;
49
51
  this._selectedLayerName = undefined;
52
+ this._reportSubmitted = false;
53
+ this._showSubmitCancelButton = false;
54
+ this._featureCreationFailedErrorMsg = undefined;
50
55
  }
51
56
  //--------------------------------------------------------------------------
52
57
  //
@@ -85,7 +90,8 @@ const CrowdsourceReporter = class {
85
90
  * Renders the component.
86
91
  */
87
92
  render() {
88
- return (index.h(index.Host, null, index.h("div", null, index.h("calcite-shell", { "content-behind": true }, this._getReporter()))));
93
+ const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
94
+ return (index.h(index.Host, null, this._reportSubmitted && index.h("calcite-alert", { "auto-close": true, class: themeClass, closable: true, icon: "check-circle", kind: "success", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, index.h("div", { slot: "title" }, this._translations.reportSubmit), index.h("div", { slot: "message" }, this._translations.submitMsg)), this._featureCreationFailedErrorMsg && index.h("calcite-alert", { "auto-close": true, class: themeClass, closable: true, icon: "x-octagon", kind: "danger", onCalciteAlertClose: () => { this._featureCreationFailedErrorMsg = ""; }, open: true, placement: "top" }, index.h("div", { slot: "title" }, this._translations.error), index.h("div", { slot: "message" }, this._featureCreationFailedErrorMsg)), index.h("div", null, index.h("calcite-shell", { "content-behind": true }, this._getReporter()))));
89
95
  }
90
96
  //--------------------------------------------------------------------------
91
97
  //
@@ -105,6 +111,15 @@ const CrowdsourceReporter = class {
105
111
  ]);
106
112
  this.reactiveUtils = reactiveUtils;
107
113
  }
114
+ /**
115
+ * Set the selected layer id and layer name
116
+ * @param layerId string layerId of the selected layer
117
+ * @param layerName string layerName of the selected layer
118
+ */
119
+ setSelectedLayer(layerId, layerName) {
120
+ this._selectedLayerId = layerId;
121
+ this._selectedLayerName = layerName;
122
+ }
108
123
  /**
109
124
  * Get the reporter app functionality
110
125
  * @protected
@@ -122,6 +137,12 @@ const CrowdsourceReporter = class {
122
137
  case "feature-details":
123
138
  renderLists.push(this.getFeatureDetailsFlowItem());
124
139
  break;
140
+ case "reporting-layer-list":
141
+ renderLists.push(this.getChooseCategoryFlowItem());
142
+ break;
143
+ case "feature-create":
144
+ renderLists.push(this.getFeatureCreateFlowItem());
145
+ break;
125
146
  }
126
147
  });
127
148
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
@@ -138,34 +159,135 @@ const CrowdsourceReporter = class {
138
159
  return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers &&
139
160
  index.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 &&
140
161
  index.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 &&
141
- index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.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 }))));
162
+ index.h("calcite-button", { appearance: "secondary", onClick: this.navigateToChooseCategory.bind(this), slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.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 }))));
163
+ }
164
+ /**
165
+ * Get the layer list for creating a report
166
+ * @returns Choose category flow item
167
+ * @protected
168
+ */
169
+ getChooseCategoryFlowItem() {
170
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._translations.createReportHeader, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), index.h("div", { class: "width-full", slot: "footer" }, index.h("calcite-button", { appearance: "secondary", class: "footer-top-button footer-button", disabled: !this._selectedLayerId, onClick: this.navigateToCreateFeature.bind(this), width: "full" }, this._translations.next), index.h("calcite-button", { appearance: "outline", class: "footer-button", onClick: this.backFromSelectedPanel.bind(this), width: "full" }, this._translations.cancel)), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, index.h("div", { slot: "message" }, this._translations.chooseCategoryMsg)), index.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 }))));
171
+ }
172
+ /**
173
+ * Get Feature create form of the selected feature layer
174
+ * @returns feature create form
175
+ * @protected
176
+ */
177
+ getFeatureCreateFlowItem() {
178
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromCreateFeaturePanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), this._showSubmitCancelButton && index.h("div", { class: "width-full", slot: "footer" }, index.h("calcite-button", { appearance: "secondary", class: "footer-top-button footer-button", onClick: this.onSubmitButtonClick.bind(this), width: "full" }, this._translations.submit), index.h("calcite-button", { appearance: "outline", class: "footer-button", onClick: this.backFromCreateFeaturePanel.bind(this), width: "full" }, this._translations.cancel)), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, index.h("div", { slot: "message" }, this._translations.featureEditFormInfoMsg)), index.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 }))));
179
+ }
180
+ /**
181
+ * When drawing of incident location completed on map show the submit and cancel button
182
+ * @protected
183
+ */
184
+ showSubmitCancelButton() {
185
+ this._showSubmitCancelButton = true;
186
+ }
187
+ /**
188
+ * On back from create feature, call submit editor to destroy the Editor widget instance
189
+ * @protected
190
+ */
191
+ onSubmitButtonClick() {
192
+ if (this._createFeature) {
193
+ this._createFeature.submit();
194
+ }
195
+ }
196
+ /**
197
+ * On back from create feature, call close editor to destroy the Editor widget instance
198
+ * @protected
199
+ */
200
+ backFromCreateFeaturePanel() {
201
+ if (this._createFeature) {
202
+ this._createFeature.close();
203
+ }
204
+ this.backFromSelectedPanel();
205
+ }
206
+ /**
207
+ * On creating the feature is failed, show the error message
208
+ * @param evt Event which has feature failed message
209
+ * @protected
210
+ */
211
+ createFeatureFailed(evt) {
212
+ console.error(evt.detail);
213
+ this._featureCreationFailedErrorMsg = evt.detail.message;
214
+ }
215
+ /**
216
+ * On submit report navigate to the layer list home page and refresh the layer list
217
+ * @protected
218
+ */
219
+ navigateHomePage() {
220
+ this._reportSubmitted = true;
221
+ if (this._layerList) {
222
+ this._layerList.refresh();
223
+ }
224
+ this._flowItems = ["layer-list"];
225
+ }
226
+ /**
227
+ * Update the selected layer id and name
228
+ * @param evt Event which has details of selected layerId and layerName
229
+ * @protected
230
+ */
231
+ highlightSelectedLayer(evt) {
232
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
233
+ }
234
+ /**
235
+ * On next button click open the feature create flow item
236
+ * @protected
237
+ */
238
+ async navigateToCreateFeature() {
239
+ this._showSubmitCancelButton = false;
240
+ this._flowItems = [...this._flowItems, "feature-create"];
241
+ }
242
+ /**
243
+ * On report an incident button click open the create a report panel with the layer list
244
+ * @protected
245
+ */
246
+ navigateToChooseCategory() {
247
+ this._flowItems = [...this._flowItems, "reporting-layer-list"];
142
248
  }
143
249
  /**
144
250
  * 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
145
251
  * @param evt Event which has list of layers
146
252
  * @protected
147
253
  */
148
- layerListLoaded(evt) {
254
+ async layerListLoaded(evt) {
149
255
  const layersListed = evt.detail;
150
- this.handleMapClick(layersListed);
256
+ //consider only the layers listed in the layer-list component
257
+ const allMapLayers = await mapViewUtils.getAllLayers(this.mapView);
258
+ this._validLayers = [];
259
+ allMapLayers.forEach((eachLayer) => {
260
+ if (layersListed.includes(eachLayer.id)) {
261
+ this._validLayers.push(eachLayer);
262
+ }
263
+ });
264
+ //handleMap click on layer list loaded
265
+ this.handleMapClick();
266
+ //update the has valid layer state
151
267
  this._hasValidLayers = layersListed.length > 0;
268
+ //navigate to the feature details if URL params found
269
+ await this.loadFeatureFromURLParams();
152
270
  }
153
271
  /**On click of layer list item show feature list
154
272
  * @param evt Event which has details of selected layerId and layerName
155
273
  * @protected
156
274
  */
157
275
  displayFeaturesList(evt) {
158
- this._selectedLayerId = evt.detail.layerId;
159
- this._selectedLayerName = evt.detail.layerName;
276
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
160
277
  this._flowItems = [...this._flowItems, "feature-list"];
161
278
  }
162
279
  /**
163
- * On back from feature list navigate to the Layer list panel
280
+ * On back from selected panel navigate to the previous panel
164
281
  * @protected
165
282
  */
166
- backFromFeatureList() {
283
+ backFromSelectedPanel() {
167
284
  const updatedFlowItems = [...this._flowItems];
168
285
  updatedFlowItems.pop();
286
+ //clear the selected layer and feature when back to layer list
287
+ if (updatedFlowItems.length === 1) {
288
+ this.setSelectedLayer('', '');
289
+ this.setSelectedFeatures([]);
290
+ }
169
291
  this._flowItems = [...updatedFlowItems];
170
292
  }
171
293
  /**
@@ -181,7 +303,7 @@ const CrowdsourceReporter = class {
181
303
  * @param evt Event which has details of selected feature
182
304
  */
183
305
  async onFeatureSelectFromList(evt) {
184
- this._selectedFeature = [evt.detail];
306
+ this.setSelectedFeatures([evt.detail]);
185
307
  this._flowItems = [...this._flowItems, "feature-details"];
186
308
  }
187
309
  /**
@@ -192,26 +314,50 @@ const CrowdsourceReporter = class {
192
314
  * @protected
193
315
  */
194
316
  getFeatureListFlowItem(layerId, layerName) {
195
- return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), index.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 &&
196
- index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true }, index.h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
317
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), index.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 &&
318
+ index.h("calcite-button", { appearance: "secondary", onClick: this.navigateToCreateFeature.bind(this), slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true }, index.h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
197
319
  }
198
320
  /**
199
321
  * Returns the calcite-flow item for feature details
200
322
  * @returns Node
201
323
  */
202
324
  getFeatureDetailsFlowItem() {
203
- return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), index.h("calcite-action", { icon: "share", slot: "header-actions-end", text: this._translations.share }), index.h("calcite-panel", { "full-height": true }, index.h("info-card", { allowEditing: false, graphics: this._selectedFeature, isLoading: false, isMobile: false, mapView: this.mapView, onSelectionChanged: this.featureDetailsChanged.bind(this), zoomAndScrollToSelected: true }))));
325
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), index.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 }), index.h("calcite-panel", { "full-height": true }, index.h("info-card", { allowEditing: false, graphics: this._selectedFeature, isLoading: false, isMobile: false, mapView: this.mapView, onSelectionChanged: this.featureDetailsChanged.bind(this), zoomAndScrollToSelected: true }))));
326
+ }
327
+ /**
328
+ * Sets the selected features and updates the first feature as the current selected feature
329
+ * @param features Graphics array of the features selected
330
+ */
331
+ setSelectedFeatures(features) {
332
+ this._selectedFeature = features;
333
+ this.setCurrentFeature(this._selectedFeature.length ? this._selectedFeature[0] : null);
334
+ }
335
+ /**
336
+ * Set the object id of the current selected feature, and also updates the current selected layer details
337
+ * @param selectedFeature Graphic currently shown in feature details
338
+ */
339
+ setCurrentFeature(selectedFeature) {
340
+ if (selectedFeature && selectedFeature.layer) {
341
+ const layer = selectedFeature.layer;
342
+ this.setSelectedLayer(layer.id, layer.title);
343
+ this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
344
+ }
345
+ else {
346
+ this.setSelectedLayer('', '');
347
+ this._currentFeatureId = '';
348
+ }
349
+ this._updateShareURL();
204
350
  }
205
351
  /**
206
352
  * On Feature details change update the Layer title and the current selected layer id
207
353
  * @param evt Event hold the details of current feature graphic in the info-card
208
354
  */
209
355
  featureDetailsChanged(evt) {
210
- this._selectedLayerId = evt.detail[0].layer.id;
211
- this._selectedLayerName = evt.detail[0].layer.title;
356
+ this.setCurrentFeature(evt.detail[0]);
212
357
  }
213
358
  /**
214
359
  * Returns the action button to Expand/Collapse side panel in mobile mode
360
+ * @protected
215
361
  */
216
362
  getActionToExpandCollapsePanel() {
217
363
  return (index.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 }));
@@ -235,36 +381,26 @@ const CrowdsourceReporter = class {
235
381
  * Handle map click event
236
382
  * @param layers Array of layerIds
237
383
  *
238
- * @protected
384
+ * @protected
239
385
  */
240
- handleMapClick(layers) {
386
+ handleMapClick() {
241
387
  if (this._mapClickHandle) {
242
388
  this._mapClickHandle.remove();
243
389
  }
244
- this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
245
- void this.onMapClick(event, layers);
246
- });
390
+ this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
247
391
  }
248
392
  /**
249
393
  * On map click do hitTest and get the clicked graphics of valid layers and show feature details
250
- * @param event
251
- * @param layers
394
+ * @param event IMapClick map click event details
252
395
  *
253
396
  * @protected
254
397
  */
255
- async onMapClick(event, layers) {
398
+ async onMapClick(event) {
256
399
  //disable map popup
257
400
  this.mapView.popupEnabled = false;
258
401
  // only include graphics from valid layers listed in the layer list widget
259
- const allMapLayers = await mapViewUtils.getAllLayers(this.mapView);
260
- const validLayers = [];
261
- allMapLayers.forEach((eachLayer) => {
262
- if (layers.includes(eachLayer.id)) {
263
- validLayers.push(eachLayer);
264
- }
265
- });
266
402
  const opts = {
267
- include: validLayers
403
+ include: this._validLayers
268
404
  };
269
405
  // Perform a hitTest on the View
270
406
  const hitTest = await this.mapView.hitTest(event, opts);
@@ -277,7 +413,7 @@ const CrowdsourceReporter = class {
277
413
  }
278
414
  });
279
415
  //update the selectedFeature
280
- this._selectedFeature = clickedGraphics;
416
+ this.setSelectedFeatures(clickedGraphics);
281
417
  //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
282
418
  // eslint-disable-next-line unicorn/prefer-ternary
283
419
  if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
@@ -297,6 +433,59 @@ const CrowdsourceReporter = class {
297
433
  const messages = await locale.getLocaleComponentStrings(this.el);
298
434
  this._translations = messages[0];
299
435
  }
436
+ /**
437
+ * Updates the share url for current selected feature
438
+ * @returns
439
+ * @protected
440
+ */
441
+ _updateShareURL() {
442
+ var _a, _b;
443
+ const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;
444
+ if (!url) {
445
+ return;
446
+ }
447
+ const urlObj = new URL(url);
448
+ //set the selected layers id
449
+ if (this._selectedLayerId) {
450
+ urlObj.searchParams.set("layerid", this._selectedLayerId);
451
+ }
452
+ else {
453
+ urlObj.searchParams.delete("layerid");
454
+ }
455
+ //Set the selected features objectid
456
+ if ((_b = this._selectedFeature) === null || _b === void 0 ? void 0 : _b.length) {
457
+ urlObj.searchParams.set("oid", this._currentFeatureId);
458
+ }
459
+ else {
460
+ urlObj.searchParams.delete("oid");
461
+ }
462
+ //update the url in share component
463
+ this._shareNode.shareUrl = urlObj.href;
464
+ }
465
+ /**
466
+ * Navigates to selected features detail based on the URL params
467
+ */
468
+ async loadFeatureFromURLParams() {
469
+ if (this.layerId && this.objectId) {
470
+ const layer = await mapViewUtils.getLayerOrTable(this.mapView, this.layerId);
471
+ if (layer) {
472
+ // only query if we have some ids...query with no ids will result in all features being returned
473
+ const featureSet = await mapViewUtils.queryFeaturesByID([Number(this.objectId)], layer, [], false, this.mapView.spatialReference);
474
+ if (featureSet.length) {
475
+ //update the selectedFeature
476
+ this._selectedFeature = featureSet;
477
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
478
+ // eslint-disable-next-line unicorn/prefer-ternary
479
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
480
+ this._flowItems = [...this._flowItems, "feature-details"];
481
+ }
482
+ else {
483
+ this._flowItems = [...this._flowItems];
484
+ }
485
+ }
486
+ }
487
+ }
488
+ }
300
489
  get el() { return index.getElement(this); }
301
490
  static get watchers() { return {
302
491
  "isMobile": ["isMobileWatchHandler"],
@@ -1510,7 +1510,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1510
1510
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1511
1511
  * ====================================================================
1512
1512
  */
1513
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-bd1a93b2.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},
1513
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-72dc7ab9.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},
1514
1514
  /** ====================================================================
1515
1515
  * @license
1516
1516
  * jsPDF XMP metadata plugin
@@ -2861,7 +2861,7 @@ function _prepareAttributeValue(attributeValue, attributeType, attributeDomain,
2861
2861
  if (attributeDomain && attributeDomain.type === "coded-value") {
2862
2862
  // "coded-value" domain field
2863
2863
  const value = attributeDomain.getName(attributeValue);
2864
- return value.toString();
2864
+ return value === null || value === void 0 ? void 0 : value.toString();
2865
2865
  }
2866
2866
  else {
2867
2867
  // Non-domain field or unsupported domain type
@@ -6,7 +6,7 @@
6
6
  'use strict';
7
7
 
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
9
- const downloadUtils = require('./downloadUtils-83c6d3c3.js');
9
+ const downloadUtils = require('./downloadUtils-10e0de31.js');
10
10
  require('./index-b8a649fc.js');
11
11
  require('./locale-a476e15d.js');
12
12
  require('./esri-loader-a91c0ec1.js');