@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
@@ -3,11 +3,11 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
6
+ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
7
7
  import { l as loadModules } from './loadModules.js';
8
- import { a as getAllLayers } from './mapViewUtils.js';
8
+ import { a as getAllLayers, g as getLayerOrTable } from './mapViewUtils.js';
9
9
 
10
- const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}";
10
+ const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}.search-widget{width:92% !important;margin:5px 0 20px 14px}.display-none{display:none !important}";
11
11
 
12
12
  const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature extends HTMLElement {
13
13
  constructor() {
@@ -20,6 +20,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
20
20
  this.mapView = undefined;
21
21
  this.selectedLayerId = undefined;
22
22
  this.customizeSubmit = false;
23
+ this.searchConfiguration = undefined;
24
+ this.showSearchWidget = undefined;
23
25
  }
24
26
  //--------------------------------------------------------------------------
25
27
  //
@@ -79,7 +81,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
79
81
  * Renders the component.
80
82
  */
81
83
  render() {
82
- return (h(Host, { id: "feature-form" }));
84
+ const showSearchWidget = this.showSearchWidget ? '' : 'display-none';
85
+ return (h(Fragment, null, h("div", { id: "feature-form" }), h("div", { class: `search-widget ${showSearchWidget}`, id: "search-widget-ref" })));
83
86
  }
84
87
  //--------------------------------------------------------------------------
85
88
  //
@@ -87,11 +90,12 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
87
90
  //
88
91
  //--------------------------------------------------------------------------
89
92
  /**
90
- * Init Editor widget and starts the create workflow
93
+ * Init Editor widget and Search widget
91
94
  */
92
95
  async init() {
93
96
  if (this.mapView && this.selectedLayerId) {
94
97
  await this.createEditorWidget();
98
+ await this.createSearchWidget();
95
99
  }
96
100
  }
97
101
  /**
@@ -100,12 +104,14 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
100
104
  * @protected
101
105
  */
102
106
  async initModules() {
103
- const [Editor, reactiveUtils] = await loadModules([
107
+ const [Editor, reactiveUtils, Search] = await loadModules([
104
108
  "esri/widgets/Editor",
105
- "esri/core/reactiveUtils"
109
+ "esri/core/reactiveUtils",
110
+ "esri/widgets/Search"
106
111
  ]);
107
112
  this.Editor = Editor;
108
113
  this.reactiveUtils = reactiveUtils;
114
+ this.Search = Search;
109
115
  }
110
116
  /**
111
117
  * Display editor widget to create the new feature
@@ -159,6 +165,13 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
159
165
  }
160
166
  });
161
167
  this._editor.viewModel.addHandles(handle);
168
+ //Add handle to watch editor viewmodel state and then show the search widget
169
+ const formHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
170
+ if (state === 'creating-features') {
171
+ this.showSearchWidget = true;
172
+ }
173
+ });
174
+ this._editor.viewModel.addHandles(formHandle);
162
175
  }
163
176
  /**
164
177
  * Start creating the feature
@@ -177,6 +190,7 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
177
190
  //on sketch complete emit the event
178
191
  this._editor.viewModel.sketchViewModel.on("create", (evt) => {
179
192
  if (evt.state === "complete") {
193
+ this.showSearchWidget = false;
180
194
  this.drawComplete.emit();
181
195
  }
182
196
  });
@@ -193,6 +207,94 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
193
207
  this.hideEditorsElements();
194
208
  }
195
209
  }
210
+ /**
211
+ * Display search widget to search location
212
+ * @protected
213
+ */
214
+ async createSearchWidget() {
215
+ let searchOptions = {
216
+ view: this.mapView,
217
+ };
218
+ if (this.searchConfiguration) {
219
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
220
+ searchOptions = Object.assign({}, searchConfiguration);
221
+ }
222
+ this._search = new this.Search(searchOptions);
223
+ this._search.container = 'search-widget-ref';
224
+ this._search.popupEnabled = false;
225
+ this._search.resultGraphicEnabled = false;
226
+ const layer = await getLayerOrTable(this.mapView, this.selectedLayerId);
227
+ let pointGeometry = null;
228
+ // on search get the geometry of the searched location and pass it in sketchViewModel and go to featureForm page
229
+ this._search.on('search-complete', (e) => {
230
+ var _a;
231
+ void this.mapView.goTo(e.results[0].results[0].extent);
232
+ if (layer.geometryType === 'point') {
233
+ pointGeometry = (_a = e.results[0].results[0]) === null || _a === void 0 ? void 0 : _a.feature.geometry;
234
+ }
235
+ });
236
+ //Add handle to watch if search viewModel state is ready
237
+ const createFeatureHandle = this.reactiveUtils.watch(() => this._search.viewModel.state, (state) => {
238
+ if (state === 'ready') {
239
+ setTimeout(() => {
240
+ if (this._editor.viewModel.sketchViewModel.createGraphic && pointGeometry) {
241
+ this._editor.viewModel.sketchViewModel.createGraphic.set('geometry', pointGeometry);
242
+ this._editor.viewModel.sketchViewModel.complete();
243
+ this.hideEditorsElements();
244
+ }
245
+ }, 100);
246
+ }
247
+ });
248
+ this._search.viewModel.addHandles(createFeatureHandle);
249
+ }
250
+ /**
251
+ * Initialize the search widget based on user defined configuration
252
+ *
253
+ * @param searchConfiguration search configuration defined by the user
254
+ * @param view the current map view
255
+ *
256
+ * @protected
257
+ */
258
+ _getSearchConfig(searchConfiguration, view) {
259
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
260
+ const sources = searchConfiguration.sources;
261
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
262
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
263
+ sources.forEach((source) => {
264
+ var _a, _b;
265
+ const isLayerSource = source.hasOwnProperty("layer");
266
+ if (isLayerSource) {
267
+ const layerSource = source;
268
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
269
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
270
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
271
+ if (layerFromMap) {
272
+ layerSource.layer = layerFromMap;
273
+ }
274
+ else if (layerUrl) {
275
+ layerSource.layer = new this.FeatureLayer(layerUrl);
276
+ }
277
+ }
278
+ });
279
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
280
+ const isLocatorSource = source.hasOwnProperty("locator");
281
+ if (isLocatorSource) {
282
+ const locatorSource = source;
283
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
284
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
285
+ locatorSource.outFields = outFields;
286
+ locatorSource.singleLineFieldName = "SingleLine";
287
+ }
288
+ locatorSource.url = locatorSource.url;
289
+ delete locatorSource.url;
290
+ }
291
+ });
292
+ }
293
+ else {
294
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
295
+ }
296
+ return searchConfiguration;
297
+ }
196
298
  /**
197
299
  * Hides the elements of editor widget
198
300
  * @protected
@@ -255,6 +357,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
255
357
  "mapView": [16],
256
358
  "selectedLayerId": [1, "selected-layer-id"],
257
359
  "customizeSubmit": [4, "customize-submit"],
360
+ "searchConfiguration": [16],
361
+ "showSearchWidget": [32],
258
362
  "close": [64],
259
363
  "submit": [64]
260
364
  }, undefined, {
@@ -91,6 +91,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
91
91
  * MapView.when is not fired when mapView is not currently visible
92
92
  */
93
93
  this._shouldSetMapView = false;
94
+ this.appProxies = undefined;
94
95
  this.defaultCenter = "";
95
96
  this.defaultGlobalId = "";
96
97
  this.defaultLayer = "";
@@ -378,7 +379,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
378
379
  _getMapNode(panelOpen) {
379
380
  var _a;
380
381
  const mapContainerClass = this._layoutMode === ELayoutMode.HORIZONTAL && (!this._isMobile || panelOpen) ? "" : "adjusted-height-50";
381
- return (h("div", { class: `${mapContainerClass} overflow-hidden` }, h("map-card", { basemapConfig: this.basemapConfig, class: "width-full", defaultWebmapId: this.defaultWebmap, enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableHome: this.enableHome, enableLegend: this.enableLegend, enableSearch: this.enableSearch, enableSingleExpand: true, hidden: this._expandPopup && !this._isMobile, homeZoomIndex: 3, homeZoomPosition: "top-left", homeZoomToolsSize: "s", mapInfos: (_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.filter(mapInfo => mapInfo.visible !== false), mapWidgetsIndex: 0, mapWidgetsPosition: "top-right", mapWidgetsSize: "m", stackTools: true, theme: this.theme, toolOrder: ["legend", "search", "fullscreen", "basemap", "floorfilter"] })));
382
+ return (h("div", { class: `${mapContainerClass} overflow-hidden` }, h("map-card", { appProxies: this.appProxies, basemapConfig: this.basemapConfig, class: "width-full", defaultWebmapId: this.defaultWebmap, enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableHome: this.enableHome, enableLegend: this.enableLegend, enableSearch: this.enableSearch, enableSingleExpand: true, hidden: this._expandPopup && !this._isMobile, homeZoomIndex: 3, homeZoomPosition: "top-left", homeZoomToolsSize: "s", mapInfos: (_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.filter(mapInfo => mapInfo.visible !== false), mapWidgetsIndex: 0, mapWidgetsPosition: "top-right", mapWidgetsSize: "m", stackTools: true, theme: this.theme, toolOrder: ["legend", "search", "fullscreen", "basemap", "floorfilter"] })));
382
383
  }
383
384
  /**
384
385
  * Get the expand node for the popup information
@@ -544,6 +545,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
544
545
  }; }
545
546
  static get style() { return crowdsourceManagerCss; }
546
547
  }, [0, "crowdsource-manager", {
548
+ "appProxies": [8, "app-proxies"],
547
549
  "defaultCenter": [1, "default-center"],
548
550
  "defaultGlobalId": [1, "default-global-id"],
549
551
  "defaultLayer": [1, "default-layer"],
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { g as getLocaleComponentStrings } from './locale.js';
8
8
  import { l as loadModules } from './loadModules.js';
9
- import { a as getAllLayers, e as getFeatureLayerView, h as highlightFeatures, g as getLayerOrTable } from './mapViewUtils.js';
9
+ import { a as getAllLayers, e as getFeatureLayerView, h as highlightFeatures, c as getMapLayerHash, g as getLayerOrTable } from './mapViewUtils.js';
10
10
  import { q as queryFeaturesByID } from './queryUtils.js';
11
11
  import { d as defineCustomElement$w } from './action.js';
12
12
  import { d as defineCustomElement$v } from './action-menu.js';
@@ -40,7 +40,7 @@ import { d as defineCustomElement$4 } from './info-card2.js';
40
40
  import { d as defineCustomElement$3 } from './instant-apps-social-share2.js';
41
41
  import { d as defineCustomElement$2 } from './layer-list2.js';
42
42
 
43
- const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}";
43
+ const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.report-submitted-msg{position:absolute;z-index:1000}";
44
44
 
45
45
  const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceReporter extends HTMLElement {
46
46
  constructor() {
@@ -75,7 +75,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
75
75
  this.theme = "light";
76
76
  this.enableZoom = true;
77
77
  this._mapInfo = undefined;
78
- this._flowItems = ["layer-list"];
78
+ this._flowItems = [];
79
79
  this._sidePanelCollapsed = false;
80
80
  this._translations = undefined;
81
81
  this._hasValidLayers = false;
@@ -114,16 +114,20 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
114
114
  * @returns Promise when complete
115
115
  */
116
116
  async componentWillLoad() {
117
+ var _a;
117
118
  this._urlParamsLoaded = false;
118
119
  await this._initModules();
119
120
  await this._getTranslations();
121
+ await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.when(async () => {
122
+ await this.setMapView();
123
+ }));
120
124
  }
121
125
  /**
122
126
  * Renders the component.
123
127
  */
124
128
  render() {
125
129
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
126
- return (h(Host, null, this._reportSubmitted && h("calcite-alert", { "auto-close": true, class: themeClass, icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, h("div", { slot: "title" }, this._translations.reportSubmit), h("div", { slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && h("calcite-alert", { "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", 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()))));
130
+ return (h(Host, null, this._reportSubmitted && 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" }, h("div", { slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && h("calcite-alert", { "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", 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()))));
127
131
  }
128
132
  //--------------------------------------------------------------------------
129
133
  //
@@ -193,8 +197,9 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
193
197
  * @protected
194
198
  */
195
199
  getLayerListFlowItem() {
200
+ var _a;
196
201
  return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
197
- h("calcite-button", { appearance: "solid", 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._noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
202
+ h("calcite-button", { appearance: "solid", onClick: this.navigateToChooseCategory.bind(this), slot: "footer", width: "full" }, this.reportButtonText ? this.reportButtonText : this._translations.createReportButtonText), h("calcite-panel", { "full-height": true, "full-width": true }, 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 }))));
198
203
  }
199
204
  /**
200
205
  * Get the layer list for creating a report
@@ -202,7 +207,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
202
207
  * @protected
203
208
  */
204
209
  getChooseCategoryFlowItem() {
205
- 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: "solid", 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._noLayerToDisplayErrorMsg, onLayerSelect: this.highlightSelectedLayer.bind(this), showFeatureCount: false, showNextIcon: false }))));
210
+ return (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(), 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._noLayerToDisplayErrorMsg, onLayerSelect: this.navigateToCreateFeature.bind(this), showFeatureCount: false, showNextIcon: false }))));
206
211
  }
207
212
  /**
208
213
  * Get Feature create form of the selected feature layer
@@ -210,7 +215,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
210
215
  * @protected
211
216
  */
212
217
  getFeatureCreateFlowItem() {
213
- 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: "solid", 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 }))));
218
+ 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: "solid", 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, searchConfiguration: this.searchConfiguration, selectedLayerId: this._selectedLayerId }))));
214
219
  }
215
220
  /**
216
221
  * When drawing of incident location completed on map show the submit and cancel button
@@ -260,13 +265,13 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
260
265
  */
261
266
  onReportSubmitted() {
262
267
  this._reportSubmitted = true;
263
- this.navigateToHomePage();
268
+ void this.navigateToHomePage();
264
269
  }
265
270
  /**
266
271
  * Navigates to layer-list
267
272
  * @protected
268
273
  */
269
- navigateToHomePage() {
274
+ async navigateToHomePage() {
270
275
  if (this._createFeature) {
271
276
  this._createFeature.close();
272
277
  }
@@ -274,21 +279,23 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
274
279
  this._layerList.refresh();
275
280
  }
276
281
  this.setSelectedFeatures([]);
277
- this._flowItems = ["layer-list"];
282
+ if (this._editableLayerIds.length === 1) {
283
+ await this._featureList.refresh();
284
+ this._flowItems = ["feature-list"];
285
+ }
286
+ else {
287
+ this._flowItems = ["layer-list"];
288
+ }
278
289
  }
279
290
  /**
280
- * Update the selected layer id and name
291
+ * On layer select open the feature create flow item
281
292
  * @param evt Event which has details of selected layerId and layerName
282
293
  * @protected
283
294
  */
284
- highlightSelectedLayer(evt) {
285
- this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
286
- }
287
- /**
288
- * On next button click open the feature create flow item
289
- * @protected
290
- */
291
- async navigateToCreateFeature() {
295
+ async navigateToCreateFeature(evt) {
296
+ if (evt.detail.layerId && evt.detail.layerName) {
297
+ this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
298
+ }
292
299
  this._showSubmitCancelButton = false;
293
300
  this._flowItems = [...this._flowItems, "feature-create"];
294
301
  }
@@ -341,8 +348,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
341
348
  updatedFlowItems.pop();
342
349
  this.clearHighlights();
343
350
  //Back to layer list, and return as the flowItems will be reset in navigateToHomePage
344
- if (updatedFlowItems.length === 1) {
345
- this.navigateToHomePage();
351
+ if (updatedFlowItems.length === 1 && updatedFlowItems[0] === 'layer-list') {
352
+ void this.navigateToHomePage();
346
353
  return;
347
354
  }
348
355
  this._flowItems = [...updatedFlowItems];
@@ -372,7 +379,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
372
379
  */
373
380
  getFeatureListFlowItem(layerId, layerName) {
374
381
  return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports &&
375
- h("calcite-button", { appearance: "solid", onClick: this.navigateToCreateFeature.bind(this), slot: "footer", width: "full" }, this.reportButtonText), h("calcite-panel", { "full-height": true }, h("feature-list", { class: "height-full", mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
382
+ h("calcite-button", { appearance: "solid", onClick: this.navigateToCreateFeature.bind(this), slot: "footer", width: "full" }, this.reportButtonText ? this.reportButtonText : this._translations.createReportButtonText), h("calcite-panel", { "full-height": true }, 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 }))));
376
383
  }
377
384
  /**
378
385
  * Returns the calcite-flow item for feature details
@@ -400,7 +407,9 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
400
407
  this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
401
408
  }
402
409
  else {
403
- this.setSelectedLayer('', '');
410
+ if (this._editableLayerIds.length > 1) {
411
+ this.setSelectedLayer('', '');
412
+ }
404
413
  this._currentFeatureId = '';
405
414
  }
406
415
  this._updateShareURL();
@@ -423,6 +432,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
423
432
  // highlight the newly selected feature only when it has valid geometry
424
433
  if (selectedFeature && selectedFeature.geometry && selectedFeature.layer) {
425
434
  const selectedLayerView = await getFeatureLayerView(this.mapView, selectedFeature.layer.id);
435
+ // remove previous highlight options (if any) to highlight the feature by default color
436
+ selectedLayerView.highlightOptions = null;
426
437
  this._highlightHandle = await highlightFeatures([selectedFeature.getObjectId()], selectedLayerView, this.mapView, true);
427
438
  }
428
439
  }
@@ -448,6 +459,15 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
448
459
  * @protected
449
460
  */
450
461
  async setMapView() {
462
+ var _a;
463
+ await this.getLayersToShowInList();
464
+ // if only one valid layer is present then directly render features list
465
+ if (((_a = this._editableLayerIds) === null || _a === void 0 ? void 0 : _a.length) === 1) {
466
+ await this.renderFeaturesList();
467
+ }
468
+ else {
469
+ this._flowItems = ['layer-list'];
470
+ }
451
471
  this.mapView.popupEnabled = false;
452
472
  if (this._defaultCenter && this._defaultLevel) {
453
473
  await this.mapView.goTo({
@@ -471,7 +491,7 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
471
491
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
472
492
  }
473
493
  /**
474
- * On map click do hitTest and get the clicked graphics of valid layers and show feature details
494
+ * On map click do hitTest and get the clicked graphics from both reporting and non-reporting layers, and show feature details
475
495
  * @param event IMapClick map click event details
476
496
  *
477
497
  * @protected
@@ -479,12 +499,8 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
479
499
  async onMapClick(event) {
480
500
  //disable map popup
481
501
  this.mapView.popupEnabled = false;
482
- // only include graphics from valid layers listed in the layer list widget
483
- const opts = {
484
- include: this._validLayers
485
- };
486
502
  // Perform a hitTest on the View
487
- const hitTest = await this.mapView.hitTest(event, opts);
503
+ const hitTest = await this.mapView.hitTest(event);
488
504
  if (hitTest.results.length > 0) {
489
505
  const clickedGraphics = [];
490
506
  hitTest.results.forEach(function (result) {
@@ -493,16 +509,35 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
493
509
  clickedGraphics.push(result.graphic);
494
510
  }
495
511
  });
496
- //update the selectedFeature
497
- this.setSelectedFeatures(clickedGraphics);
498
- //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
499
- // eslint-disable-next-line unicorn/prefer-ternary
500
- if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
501
- this._flowItems = [...this._flowItems, "feature-details"];
512
+ const reportingLayerGraphics = clickedGraphics.filter((graphic) => {
513
+ return this._validLayers.includes(graphic.layer);
514
+ });
515
+ const nonReportingLayerGraphics = clickedGraphics.filter((graphic) => {
516
+ var _a;
517
+ return !this._validLayers.includes(graphic.layer) && ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.layer) === null || _a === void 0 ? void 0 : _a.id);
518
+ });
519
+ // if clicked graphic's layer is one of the reporting layers then show details in layer panel
520
+ if (reportingLayerGraphics.length > 0) {
521
+ //update the selectedFeature
522
+ this.setSelectedFeatures(reportingLayerGraphics);
523
+ //if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
524
+ // eslint-disable-next-line unicorn/prefer-ternary
525
+ if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
526
+ this._flowItems = [...this._flowItems, "feature-details"];
527
+ }
528
+ else {
529
+ this._flowItems = [...this._flowItems];
530
+ void this.highlightOnMap(clickedGraphics[0]);
531
+ }
502
532
  }
503
- else {
504
- this._flowItems = [...this._flowItems];
505
- void this.highlightOnMap(clickedGraphics[0]);
533
+ // if clicked graphic's layer is from non reporting layers then show popup on map
534
+ if (nonReportingLayerGraphics.length > 0) {
535
+ this.mapView.popupEnabled = true;
536
+ const options = {
537
+ features: nonReportingLayerGraphics,
538
+ updateLocationEnabled: true
539
+ };
540
+ await this.mapView.openPopup(options);
506
541
  }
507
542
  }
508
543
  }
@@ -515,10 +550,57 @@ const CrowdsourceReporter$1 = /*@__PURE__*/ proxyCustomElement(class Crowdsource
515
550
  const messages = await getLocaleComponentStrings(this.el);
516
551
  this._translations = messages[0];
517
552
  }
553
+ /**
554
+ * Returns the ids of all OR configured layers that support edits with the update capability
555
+ * @param hash each layer item details
556
+ * @param layers list of layers id
557
+ * @returns array of editable layer ids
558
+ */
559
+ reduceToConfiguredLayers(hash) {
560
+ var _a;
561
+ const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
562
+ return Object.keys(hash).reduce((prev, cur) => {
563
+ let showLayer = hash[cur].supportsAdd;
564
+ if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
565
+ showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
566
+ }
567
+ if (showLayer) {
568
+ prev.push(cur);
569
+ }
570
+ return prev;
571
+ }, []);
572
+ }
573
+ /**
574
+ * Creates the list of layers to be listed in layer list
575
+ * @protected
576
+ */
577
+ async getLayersToShowInList() {
578
+ const layerItemsHash = await getMapLayerHash(this.mapView, true);
579
+ const allMapLayers = await getAllLayers(this.mapView);
580
+ allMapLayers.forEach((eachLayer) => {
581
+ var _a, _b;
582
+ 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)) {
583
+ layerItemsHash[eachLayer.id].supportsAdd = true;
584
+ }
585
+ });
586
+ this._editableLayerIds = this.reduceToConfiguredLayers(layerItemsHash);
587
+ }
588
+ /**
589
+ * renders feature list
590
+ * @protected
591
+ */
592
+ async renderFeaturesList() {
593
+ const evt = {
594
+ detail: this._editableLayerIds
595
+ };
596
+ await this.layerListLoaded(evt);
597
+ this.setSelectedLayer(this._validLayers[0].id, this._validLayers[0].title);
598
+ this._flowItems = ['feature-list'];
599
+ }
518
600
  /**
519
601
  * Updates the share url for current selected feature
520
602
  * @protected
521
- */
603
+ */
522
604
  _updateShareURL() {
523
605
  var _a, _b;
524
606
  const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;