@esri/solutions-components 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +5 -6
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +5 -6
  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/public-notification/resources.json +3 -1
  6. package/dist/assets/t9n/public-notification/resources_en.json +3 -1
  7. package/dist/cjs/buffer-tools_3.cjs.entry.js +2 -2
  8. package/dist/cjs/calcite-alert_4.cjs.entry.js +2 -2
  9. package/dist/cjs/calcite-combobox_5.cjs.entry.js +2 -2
  10. package/dist/cjs/calcite-flow_5.cjs.entry.js +163 -16
  11. package/dist/cjs/card-manager_3.cjs.entry.js +41 -2
  12. package/dist/cjs/crowdsource-manager.cjs.entry.js +2 -1
  13. package/dist/cjs/crowdsource-reporter.cjs.entry.js +120 -38
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  16. package/dist/cjs/public-notification.cjs.entry.js +110 -4
  17. package/dist/cjs/{publicNotificationStore-ef379d11.js → publicNotificationStore-e790601d.js} +2 -2
  18. package/dist/cjs/solutions-components.cjs.js +1 -1
  19. package/dist/collection/collection-manifest.json +1 -1
  20. package/dist/collection/components/create-feature/create-feature.css +9 -0
  21. package/dist/collection/components/create-feature/create-feature.js +134 -6
  22. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +19 -1
  23. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +5 -0
  24. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +120 -38
  25. package/dist/collection/components/feature-list/feature-list.js +93 -5
  26. package/dist/collection/components/info-card/info-card.css +1 -1
  27. package/dist/collection/components/info-card/info-card.js +1 -1
  28. package/dist/collection/components/layer-list/layer-list.js +6 -6
  29. package/dist/collection/components/map-card/map-card.js +27 -2
  30. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  31. package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
  32. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  33. package/dist/collection/components/public-notification/public-notification.js +110 -3
  34. package/dist/collection/demos/crowdsource-reporter.html +1 -1
  35. package/dist/collection/utils/interfaces.ts +7 -0
  36. package/dist/collection/utils/publicNotificationStore.js +2 -2
  37. package/dist/collection/utils/publicNotificationStore.ts +3 -2
  38. package/dist/components/create-feature2.js +111 -7
  39. package/dist/components/crowdsource-manager.js +3 -1
  40. package/dist/components/crowdsource-reporter.js +121 -39
  41. package/dist/components/feature-list2.js +54 -6
  42. package/dist/components/info-card2.js +2 -2
  43. package/dist/components/layer-list2.js +6 -6
  44. package/dist/components/map-card2.js +42 -2
  45. package/dist/components/map-draw-tools2.js +1 -1
  46. package/dist/components/map-layer-picker2.js +1 -1
  47. package/dist/components/map-select-tools2.js +1 -1
  48. package/dist/components/public-notification.js +110 -3
  49. package/dist/components/publicNotificationStore.js +2 -2
  50. package/dist/esm/buffer-tools_3.entry.js +2 -2
  51. package/dist/esm/calcite-alert_4.entry.js +3 -3
  52. package/dist/esm/calcite-combobox_5.entry.js +3 -3
  53. package/dist/esm/calcite-flow_5.entry.js +164 -17
  54. package/dist/esm/card-manager_3.entry.js +43 -4
  55. package/dist/esm/crowdsource-manager.entry.js +3 -2
  56. package/dist/esm/crowdsource-reporter.entry.js +121 -39
  57. package/dist/esm/{downloadUtils-0c13073b.js → downloadUtils-0c1e4d7b.js} +2 -2
  58. package/dist/esm/{index.es-ad250bc6.js → index.es-286e3cfa.js} +2 -2
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/map-select-tools_3.entry.js +4 -4
  61. package/dist/esm/{mapViewUtils-20504620.js → mapViewUtils-253178f1.js} +1 -1
  62. package/dist/esm/public-notification.entry.js +112 -6
  63. package/dist/esm/{publicNotificationStore-3bf4de75.js → publicNotificationStore-223faed2.js} +2 -2
  64. package/dist/esm/solutions-components.js +1 -1
  65. package/dist/solutions-components/demos/crowdsource-reporter.html +1 -1
  66. package/dist/solutions-components/p-15f9624a.entry.js +6 -0
  67. package/dist/solutions-components/{p-955647ea.entry.js → p-1ea5e061.entry.js} +2 -2
  68. package/dist/solutions-components/{p-590a2a26.js → p-212b02e7.js} +1 -1
  69. package/dist/solutions-components/p-238d3b5f.entry.js +6 -0
  70. package/dist/solutions-components/p-273d833b.entry.js +6 -0
  71. package/dist/solutions-components/{p-cc280aa1.js → p-322868ec.js} +1 -1
  72. package/dist/solutions-components/{p-1d3a1794.js → p-331b5d1e.js} +2 -2
  73. package/dist/solutions-components/{p-c897e3eb.js → p-3af79063.js} +1 -1
  74. package/dist/solutions-components/p-45ed16d5.entry.js +6 -0
  75. package/dist/solutions-components/p-80b11ec1.entry.js +17 -0
  76. package/dist/solutions-components/{p-5c7e3941.entry.js → p-813fd8a4.entry.js} +2 -2
  77. package/dist/solutions-components/{p-ff302d95.entry.js → p-d136eab0.entry.js} +2 -2
  78. package/dist/solutions-components/p-e0446d5b.entry.js +6 -0
  79. package/dist/solutions-components/solutions-components.esm.js +1 -1
  80. package/dist/solutions-components/utils/interfaces.ts +7 -0
  81. package/dist/solutions-components/utils/publicNotificationStore.ts +3 -2
  82. package/dist/types/components/create-feature/create-feature.d.ts +43 -1
  83. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -0
  84. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +31 -10
  85. package/dist/types/components/feature-list/feature-list.d.ts +31 -0
  86. package/dist/types/components/layer-list/layer-list.d.ts +3 -3
  87. package/dist/types/components/map-card/map-card.d.ts +8 -0
  88. package/dist/types/components/public-notification/public-notification.d.ts +48 -0
  89. package/dist/types/components.d.ts +37 -0
  90. package/dist/types/utils/interfaces.d.ts +6 -0
  91. package/dist/types/utils/publicNotificationStore.d.ts +2 -1
  92. package/package.json +2 -1
  93. package/dist/solutions-components/p-6512dc44.entry.js +0 -6
  94. package/dist/solutions-components/p-65ad1625.entry.js +0 -6
  95. package/dist/solutions-components/p-989bf0bf.entry.js +0 -6
  96. package/dist/solutions-components/p-a0611720.entry.js +0 -6
  97. package/dist/solutions-components/p-efe1694a.entry.js +0 -17
  98. package/dist/solutions-components/p-f3467807.entry.js +0 -6
@@ -14,7 +14,7 @@ require('./esri-loader-ce6c3d3d.js');
14
14
  require('./_commonjsHelpers-480c2e77.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)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}";
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}.report-submitted-msg{position:absolute;z-index:1000}";
18
18
 
19
19
  const CrowdsourceReporter = class {
20
20
  constructor(hostRef) {
@@ -48,7 +48,7 @@ const CrowdsourceReporter = class {
48
48
  this.theme = "light";
49
49
  this.enableZoom = true;
50
50
  this._mapInfo = undefined;
51
- this._flowItems = ["layer-list"];
51
+ this._flowItems = [];
52
52
  this._sidePanelCollapsed = false;
53
53
  this._translations = undefined;
54
54
  this._hasValidLayers = false;
@@ -87,16 +87,20 @@ const CrowdsourceReporter = class {
87
87
  * @returns Promise when complete
88
88
  */
89
89
  async componentWillLoad() {
90
+ var _a;
90
91
  this._urlParamsLoaded = false;
91
92
  await this._initModules();
92
93
  await this._getTranslations();
94
+ await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.when(async () => {
95
+ await this.setMapView();
96
+ }));
93
97
  }
94
98
  /**
95
99
  * Renders the component.
96
100
  */
97
101
  render() {
98
102
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
99
- return (index.h(index.Host, null, this._reportSubmitted && index.h("calcite-alert", { "auto-close": true, class: themeClass, icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, index.h("div", { slot: "title" }, this._translations.reportSubmit), index.h("div", { slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && index.h("calcite-alert", { "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", 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()))));
103
+ return (index.h(index.Host, null, this._reportSubmitted && index.h("calcite-alert", { "auto-close": true, class: themeClass + " report-submitted-msg", icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, index.h("div", { slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && index.h("calcite-alert", { "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", 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()))));
100
104
  }
101
105
  //--------------------------------------------------------------------------
102
106
  //
@@ -166,8 +170,9 @@ const CrowdsourceReporter = class {
166
170
  * @protected
167
171
  */
168
172
  getLayerListFlowItem() {
173
+ var _a;
169
174
  return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
170
- index.h("calcite-button", { appearance: "solid", 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._noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
175
+ index.h("calcite-button", { appearance: "solid", onClick: this.navigateToChooseCategory.bind(this), slot: "footer", width: "full" }, this.reportButtonText ? this.reportButtonText : this._translations.createReportButtonText), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.h("layer-list", { class: "height-full", layers: ((_a = this._editableLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this._editableLayerIds : this.layers, mapView: this.mapView, noLayerErrorMsg: this._noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
171
176
  }
172
177
  /**
173
178
  * Get the layer list for creating a report
@@ -175,7 +180,7 @@ const CrowdsourceReporter = class {
175
180
  * @protected
176
181
  */
177
182
  getChooseCategoryFlowItem() {
178
- 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: "solid", 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._noLayerToDisplayErrorMsg, onLayerSelect: this.highlightSelectedLayer.bind(this), showFeatureCount: false, showNextIcon: false }))));
183
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportButtonText ? this.reportButtonText : this._translations.createReportButtonText, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), 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._noLayerToDisplayErrorMsg, onLayerSelect: this.navigateToCreateFeature.bind(this), showFeatureCount: false, showNextIcon: false }))));
179
184
  }
180
185
  /**
181
186
  * Get Feature create form of the selected feature layer
@@ -183,7 +188,7 @@ const CrowdsourceReporter = class {
183
188
  * @protected
184
189
  */
185
190
  getFeatureCreateFlowItem() {
186
- 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: "solid", 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", { 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 }))));
191
+ 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: "solid", 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", { 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, searchConfiguration: this.searchConfiguration, selectedLayerId: this._selectedLayerId }))));
187
192
  }
188
193
  /**
189
194
  * When drawing of incident location completed on map show the submit and cancel button
@@ -233,13 +238,13 @@ const CrowdsourceReporter = class {
233
238
  */
234
239
  onReportSubmitted() {
235
240
  this._reportSubmitted = true;
236
- this.navigateToHomePage();
241
+ void this.navigateToHomePage();
237
242
  }
238
243
  /**
239
244
  * Navigates to layer-list
240
245
  * @protected
241
246
  */
242
- navigateToHomePage() {
247
+ async navigateToHomePage() {
243
248
  if (this._createFeature) {
244
249
  this._createFeature.close();
245
250
  }
@@ -247,21 +252,23 @@ const CrowdsourceReporter = class {
247
252
  this._layerList.refresh();
248
253
  }
249
254
  this.setSelectedFeatures([]);
250
- this._flowItems = ["layer-list"];
255
+ if (this._editableLayerIds.length === 1) {
256
+ await this._featureList.refresh();
257
+ this._flowItems = ["feature-list"];
258
+ }
259
+ else {
260
+ this._flowItems = ["layer-list"];
261
+ }
251
262
  }
252
263
  /**
253
- * Update the selected layer id and name
264
+ * On layer select open the feature create flow item
254
265
  * @param evt Event which has details of selected layerId and layerName
255
266
  * @protected
256
267
  */
257
- highlightSelectedLayer(evt) {
258
- this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
259
- }
260
- /**
261
- * On next button click open the feature create flow item
262
- * @protected
263
- */
264
- async navigateToCreateFeature() {
268
+ async navigateToCreateFeature(evt) {
269
+ if (evt.detail.layerId && evt.detail.layerName) {
270
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
271
+ }
265
272
  this._showSubmitCancelButton = false;
266
273
  this._flowItems = [...this._flowItems, "feature-create"];
267
274
  }
@@ -314,8 +321,8 @@ const CrowdsourceReporter = class {
314
321
  updatedFlowItems.pop();
315
322
  this.clearHighlights();
316
323
  //Back to layer list, and return as the flowItems will be reset in navigateToHomePage
317
- if (updatedFlowItems.length === 1) {
318
- this.navigateToHomePage();
324
+ if (updatedFlowItems.length === 1 && updatedFlowItems[0] === 'layer-list') {
325
+ void this.navigateToHomePage();
319
326
  return;
320
327
  }
321
328
  this._flowItems = [...updatedFlowItems];
@@ -345,7 +352,7 @@ const CrowdsourceReporter = class {
345
352
  */
346
353
  getFeatureListFlowItem(layerId, layerName) {
347
354
  return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports &&
348
- index.h("calcite-button", { appearance: "solid", 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", mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
355
+ index.h("calcite-button", { appearance: "solid", onClick: this.navigateToCreateFeature.bind(this), slot: "footer", width: "full" }, this.reportButtonText ? this.reportButtonText : this._translations.createReportButtonText), index.h("calcite-panel", { "full-height": true }, index.h("feature-list", { class: "height-full", highlightOnHover: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, ref: el => this._featureList = el, selectedLayerId: layerId }))));
349
356
  }
350
357
  /**
351
358
  * Returns the calcite-flow item for feature details
@@ -373,7 +380,9 @@ const CrowdsourceReporter = class {
373
380
  this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
374
381
  }
375
382
  else {
376
- this.setSelectedLayer('', '');
383
+ if (this._editableLayerIds.length > 1) {
384
+ this.setSelectedLayer('', '');
385
+ }
377
386
  this._currentFeatureId = '';
378
387
  }
379
388
  this._updateShareURL();
@@ -396,6 +405,8 @@ const CrowdsourceReporter = class {
396
405
  // highlight the newly selected feature only when it has valid geometry
397
406
  if (selectedFeature && selectedFeature.geometry && selectedFeature.layer) {
398
407
  const selectedLayerView = await mapViewUtils.getFeatureLayerView(this.mapView, selectedFeature.layer.id);
408
+ // remove previous highlight options (if any) to highlight the feature by default color
409
+ selectedLayerView.highlightOptions = null;
399
410
  this._highlightHandle = await mapViewUtils.highlightFeatures([selectedFeature.getObjectId()], selectedLayerView, this.mapView, true);
400
411
  }
401
412
  }
@@ -421,6 +432,15 @@ const CrowdsourceReporter = class {
421
432
  * @protected
422
433
  */
423
434
  async setMapView() {
435
+ var _a;
436
+ await this.getLayersToShowInList();
437
+ // if only one valid layer is present then directly render features list
438
+ if (((_a = this._editableLayerIds) === null || _a === void 0 ? void 0 : _a.length) === 1) {
439
+ await this.renderFeaturesList();
440
+ }
441
+ else {
442
+ this._flowItems = ['layer-list'];
443
+ }
424
444
  this.mapView.popupEnabled = false;
425
445
  if (this._defaultCenter && this._defaultLevel) {
426
446
  await this.mapView.goTo({
@@ -444,7 +464,7 @@ const CrowdsourceReporter = class {
444
464
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
445
465
  }
446
466
  /**
447
- * On map click do hitTest and get the clicked graphics of valid layers and show feature details
467
+ * On map click do hitTest and get the clicked graphics from both reporting and non-reporting layers, and show feature details
448
468
  * @param event IMapClick map click event details
449
469
  *
450
470
  * @protected
@@ -452,12 +472,8 @@ const CrowdsourceReporter = class {
452
472
  async onMapClick(event) {
453
473
  //disable map popup
454
474
  this.mapView.popupEnabled = false;
455
- // only include graphics from valid layers listed in the layer list widget
456
- const opts = {
457
- include: this._validLayers
458
- };
459
475
  // Perform a hitTest on the View
460
- const hitTest = await this.mapView.hitTest(event, opts);
476
+ const hitTest = await this.mapView.hitTest(event);
461
477
  if (hitTest.results.length > 0) {
462
478
  const clickedGraphics = [];
463
479
  hitTest.results.forEach(function (result) {
@@ -466,16 +482,35 @@ const CrowdsourceReporter = class {
466
482
  clickedGraphics.push(result.graphic);
467
483
  }
468
484
  });
469
- //update the selectedFeature
470
- this.setSelectedFeatures(clickedGraphics);
471
- //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
472
- // eslint-disable-next-line unicorn/prefer-ternary
473
- if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
474
- this._flowItems = [...this._flowItems, "feature-details"];
485
+ const reportingLayerGraphics = clickedGraphics.filter((graphic) => {
486
+ return this._validLayers.includes(graphic.layer);
487
+ });
488
+ const nonReportingLayerGraphics = clickedGraphics.filter((graphic) => {
489
+ var _a;
490
+ return !this._validLayers.includes(graphic.layer) && ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.layer) === null || _a === void 0 ? void 0 : _a.id);
491
+ });
492
+ // if clicked graphic's layer is one of the reporting layers then show details in layer panel
493
+ if (reportingLayerGraphics.length > 0) {
494
+ //update the selectedFeature
495
+ this.setSelectedFeatures(reportingLayerGraphics);
496
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
497
+ // eslint-disable-next-line unicorn/prefer-ternary
498
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
499
+ this._flowItems = [...this._flowItems, "feature-details"];
500
+ }
501
+ else {
502
+ this._flowItems = [...this._flowItems];
503
+ void this.highlightOnMap(clickedGraphics[0]);
504
+ }
475
505
  }
476
- else {
477
- this._flowItems = [...this._flowItems];
478
- void this.highlightOnMap(clickedGraphics[0]);
506
+ // if clicked graphic's layer is from non reporting layers then show popup on map
507
+ if (nonReportingLayerGraphics.length > 0) {
508
+ this.mapView.popupEnabled = true;
509
+ const options = {
510
+ features: nonReportingLayerGraphics,
511
+ updateLocationEnabled: true
512
+ };
513
+ await this.mapView.openPopup(options);
479
514
  }
480
515
  }
481
516
  }
@@ -488,10 +523,57 @@ const CrowdsourceReporter = class {
488
523
  const messages = await locale.getLocaleComponentStrings(this.el);
489
524
  this._translations = messages[0];
490
525
  }
526
+ /**
527
+ * Returns the ids of all OR configured layers that support edits with the update capability
528
+ * @param hash each layer item details
529
+ * @param layers list of layers id
530
+ * @returns array of editable layer ids
531
+ */
532
+ reduceToConfiguredLayers(hash) {
533
+ var _a;
534
+ const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
535
+ return Object.keys(hash).reduce((prev, cur) => {
536
+ let showLayer = hash[cur].supportsAdd;
537
+ if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
538
+ showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
539
+ }
540
+ if (showLayer) {
541
+ prev.push(cur);
542
+ }
543
+ return prev;
544
+ }, []);
545
+ }
546
+ /**
547
+ * Creates the list of layers to be listed in layer list
548
+ * @protected
549
+ */
550
+ async getLayersToShowInList() {
551
+ const layerItemsHash = await mapViewUtils.getMapLayerHash(this.mapView, true);
552
+ const allMapLayers = await mapViewUtils.getAllLayers(this.mapView);
553
+ allMapLayers.forEach((eachLayer) => {
554
+ var _a, _b;
555
+ if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.supportsAdd)) {
556
+ layerItemsHash[eachLayer.id].supportsAdd = true;
557
+ }
558
+ });
559
+ this._editableLayerIds = this.reduceToConfiguredLayers(layerItemsHash);
560
+ }
561
+ /**
562
+ * renders feature list
563
+ * @protected
564
+ */
565
+ async renderFeaturesList() {
566
+ const evt = {
567
+ detail: this._editableLayerIds
568
+ };
569
+ await this.layerListLoaded(evt);
570
+ this.setSelectedLayer(this._validLayers[0].id, this._validLayers[0].title);
571
+ this._flowItems = ['feature-list'];
572
+ }
491
573
  /**
492
574
  * Updates the share url for current selected feature
493
575
  * @protected
494
- */
576
+ */
495
577
  _updateShareURL() {
496
578
  var _a, _b;
497
579
  const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;