@esri/solutions-components 0.8.5 → 0.8.7
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.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +5 -6
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +5 -6
- package/dist/assets/t9n/feature-list/resources.json +1 -1
- package/dist/assets/t9n/feature-list/resources_en.json +1 -1
- package/dist/assets/t9n/public-notification/resources.json +3 -1
- package/dist/assets/t9n/public-notification/resources_en.json +3 -1
- package/dist/cjs/buffer-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-alert_4.cjs.entry.js +2 -2
- package/dist/cjs/calcite-combobox_5.cjs.entry.js +2 -2
- package/dist/cjs/calcite-flow_5.cjs.entry.js +163 -16
- package/dist/cjs/crowdsource-manager.cjs.entry.js +6 -4
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +124 -38
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/public-notification.cjs.entry.js +110 -4
- package/dist/cjs/{publicNotificationStore-ef379d11.js → publicNotificationStore-e790601d.js} +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/create-feature/create-feature.css +9 -0
- package/dist/collection/components/create-feature/create-feature.js +134 -6
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +102 -66
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +5 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +196 -38
- package/dist/collection/components/feature-list/feature-list.js +93 -5
- package/dist/collection/components/info-card/info-card.css +1 -1
- package/dist/collection/components/info-card/info-card.js +1 -1
- package/dist/collection/components/layer-list/layer-list.js +6 -6
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +110 -3
- package/dist/collection/demos/crowdsource-reporter.html +1 -1
- package/dist/collection/utils/interfaces.ts +23 -0
- package/dist/collection/utils/publicNotificationStore.js +2 -2
- package/dist/collection/utils/publicNotificationStore.ts +3 -2
- package/dist/components/create-feature2.js +111 -7
- package/dist/components/crowdsource-manager.js +12 -8
- package/dist/components/crowdsource-reporter.js +129 -39
- package/dist/components/feature-list2.js +54 -6
- package/dist/components/info-card2.js +2 -2
- package/dist/components/layer-list2.js +6 -6
- package/dist/components/map-draw-tools2.js +1 -1
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/public-notification.js +110 -3
- package/dist/components/publicNotificationStore.js +2 -2
- package/dist/esm/buffer-tools_3.entry.js +2 -2
- package/dist/esm/calcite-alert_4.entry.js +3 -3
- package/dist/esm/calcite-combobox_5.entry.js +3 -3
- package/dist/esm/calcite-flow_5.entry.js +164 -17
- package/dist/esm/card-manager_3.entry.js +2 -2
- package/dist/esm/crowdsource-manager.entry.js +7 -5
- package/dist/esm/crowdsource-reporter.entry.js +125 -39
- package/dist/esm/{downloadUtils-0c13073b.js → downloadUtils-0c1e4d7b.js} +2 -2
- package/dist/esm/{index.es-ad250bc6.js → index.es-286e3cfa.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +4 -4
- package/dist/esm/{mapViewUtils-20504620.js → mapViewUtils-253178f1.js} +1 -1
- package/dist/esm/public-notification.entry.js +112 -6
- package/dist/esm/{publicNotificationStore-3bf4de75.js → publicNotificationStore-223faed2.js} +2 -2
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +1 -1
- package/dist/solutions-components/p-15f9624a.entry.js +6 -0
- package/dist/solutions-components/{p-955647ea.entry.js → p-1ea5e061.entry.js} +2 -2
- package/dist/solutions-components/{p-590a2a26.js → p-212b02e7.js} +1 -1
- package/dist/solutions-components/p-238d3b5f.entry.js +6 -0
- package/dist/solutions-components/{p-cc280aa1.js → p-322868ec.js} +1 -1
- package/dist/solutions-components/{p-1d3a1794.js → p-331b5d1e.js} +2 -2
- package/dist/solutions-components/{p-c897e3eb.js → p-3af79063.js} +1 -1
- package/dist/solutions-components/p-6db185bf.entry.js +6 -0
- package/dist/solutions-components/p-80b11ec1.entry.js +17 -0
- package/dist/solutions-components/{p-5c7e3941.entry.js → p-813fd8a4.entry.js} +2 -2
- package/dist/solutions-components/{p-ff302d95.entry.js → p-d136eab0.entry.js} +2 -2
- package/dist/solutions-components/p-e0446d5b.entry.js +6 -0
- package/dist/solutions-components/p-e8f13354.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +23 -0
- package/dist/solutions-components/utils/publicNotificationStore.ts +3 -2
- package/dist/types/components/create-feature/create-feature.d.ts +43 -1
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +22 -14
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +48 -11
- package/dist/types/components/feature-list/feature-list.d.ts +31 -0
- package/dist/types/components/layer-list/layer-list.d.ts +3 -3
- package/dist/types/components/public-notification/public-notification.d.ts +48 -0
- package/dist/types/components.d.ts +71 -2
- package/dist/types/utils/interfaces.d.ts +20 -0
- package/dist/types/utils/publicNotificationStore.d.ts +2 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-6512dc44.entry.js +0 -6
- package/dist/solutions-components/p-6f65682c.entry.js +0 -6
- package/dist/solutions-components/p-989bf0bf.entry.js +0 -6
- package/dist/solutions-components/p-a0611720.entry.js +0 -6
- package/dist/solutions-components/p-b8c12736.entry.js +0 -6
- package/dist/solutions-components/p-efe1694a.entry.js +0 -17
|
@@ -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) {
|
|
@@ -36,8 +36,11 @@ const CrowdsourceReporter = class {
|
|
|
36
36
|
this.objectId = undefined;
|
|
37
37
|
this.center = undefined;
|
|
38
38
|
this.level = undefined;
|
|
39
|
+
this.popupHeaderHoverColor = undefined;
|
|
40
|
+
this.popupHeaderColor = undefined;
|
|
39
41
|
this.reportButtonText = undefined;
|
|
40
42
|
this.reportsHeader = undefined;
|
|
43
|
+
this.reportingOptions = undefined;
|
|
41
44
|
this.reportSubmittedMessage = undefined;
|
|
42
45
|
this.searchConfiguration = undefined;
|
|
43
46
|
this.showComments = undefined;
|
|
@@ -47,8 +50,9 @@ const CrowdsourceReporter = class {
|
|
|
47
50
|
this.mapInfos = [];
|
|
48
51
|
this.theme = "light";
|
|
49
52
|
this.enableZoom = true;
|
|
53
|
+
this.zoomToScale = undefined;
|
|
50
54
|
this._mapInfo = undefined;
|
|
51
|
-
this._flowItems = [
|
|
55
|
+
this._flowItems = [];
|
|
52
56
|
this._sidePanelCollapsed = false;
|
|
53
57
|
this._translations = undefined;
|
|
54
58
|
this._hasValidLayers = false;
|
|
@@ -87,16 +91,20 @@ const CrowdsourceReporter = class {
|
|
|
87
91
|
* @returns Promise when complete
|
|
88
92
|
*/
|
|
89
93
|
async componentWillLoad() {
|
|
94
|
+
var _a;
|
|
90
95
|
this._urlParamsLoaded = false;
|
|
91
96
|
await this._initModules();
|
|
92
97
|
await this._getTranslations();
|
|
98
|
+
await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.when(async () => {
|
|
99
|
+
await this.setMapView();
|
|
100
|
+
}));
|
|
93
101
|
}
|
|
94
102
|
/**
|
|
95
103
|
* Renders the component.
|
|
96
104
|
*/
|
|
97
105
|
render() {
|
|
98
106
|
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: "
|
|
107
|
+
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
108
|
}
|
|
101
109
|
//--------------------------------------------------------------------------
|
|
102
110
|
//
|
|
@@ -166,8 +174,9 @@ const CrowdsourceReporter = class {
|
|
|
166
174
|
* @protected
|
|
167
175
|
*/
|
|
168
176
|
getLayerListFlowItem() {
|
|
177
|
+
var _a;
|
|
169
178
|
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 }))));
|
|
179
|
+
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
180
|
}
|
|
172
181
|
/**
|
|
173
182
|
* Get the layer list for creating a report
|
|
@@ -175,7 +184,7 @@ const CrowdsourceReporter = class {
|
|
|
175
184
|
* @protected
|
|
176
185
|
*/
|
|
177
186
|
getChooseCategoryFlowItem() {
|
|
178
|
-
return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.
|
|
187
|
+
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
188
|
}
|
|
180
189
|
/**
|
|
181
190
|
* Get Feature create form of the selected feature layer
|
|
@@ -183,7 +192,7 @@ const CrowdsourceReporter = class {
|
|
|
183
192
|
* @protected
|
|
184
193
|
*/
|
|
185
194
|
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 }))));
|
|
195
|
+
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
196
|
}
|
|
188
197
|
/**
|
|
189
198
|
* When drawing of incident location completed on map show the submit and cancel button
|
|
@@ -233,13 +242,13 @@ const CrowdsourceReporter = class {
|
|
|
233
242
|
*/
|
|
234
243
|
onReportSubmitted() {
|
|
235
244
|
this._reportSubmitted = true;
|
|
236
|
-
this.navigateToHomePage();
|
|
245
|
+
void this.navigateToHomePage();
|
|
237
246
|
}
|
|
238
247
|
/**
|
|
239
248
|
* Navigates to layer-list
|
|
240
249
|
* @protected
|
|
241
250
|
*/
|
|
242
|
-
navigateToHomePage() {
|
|
251
|
+
async navigateToHomePage() {
|
|
243
252
|
if (this._createFeature) {
|
|
244
253
|
this._createFeature.close();
|
|
245
254
|
}
|
|
@@ -247,21 +256,23 @@ const CrowdsourceReporter = class {
|
|
|
247
256
|
this._layerList.refresh();
|
|
248
257
|
}
|
|
249
258
|
this.setSelectedFeatures([]);
|
|
250
|
-
this.
|
|
259
|
+
if (this._editableLayerIds.length === 1) {
|
|
260
|
+
await this._featureList.refresh();
|
|
261
|
+
this._flowItems = ["feature-list"];
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this._flowItems = ["layer-list"];
|
|
265
|
+
}
|
|
251
266
|
}
|
|
252
267
|
/**
|
|
253
|
-
*
|
|
268
|
+
* On layer select open the feature create flow item
|
|
254
269
|
* @param evt Event which has details of selected layerId and layerName
|
|
255
270
|
* @protected
|
|
256
271
|
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
* On next button click open the feature create flow item
|
|
262
|
-
* @protected
|
|
263
|
-
*/
|
|
264
|
-
async navigateToCreateFeature() {
|
|
272
|
+
async navigateToCreateFeature(evt) {
|
|
273
|
+
if (evt.detail.layerId && evt.detail.layerName) {
|
|
274
|
+
this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
|
|
275
|
+
}
|
|
265
276
|
this._showSubmitCancelButton = false;
|
|
266
277
|
this._flowItems = [...this._flowItems, "feature-create"];
|
|
267
278
|
}
|
|
@@ -314,8 +325,8 @@ const CrowdsourceReporter = class {
|
|
|
314
325
|
updatedFlowItems.pop();
|
|
315
326
|
this.clearHighlights();
|
|
316
327
|
//Back to layer list, and return as the flowItems will be reset in navigateToHomePage
|
|
317
|
-
if (updatedFlowItems.length === 1) {
|
|
318
|
-
this.navigateToHomePage();
|
|
328
|
+
if (updatedFlowItems.length === 1 && updatedFlowItems[0] === 'layer-list') {
|
|
329
|
+
void this.navigateToHomePage();
|
|
319
330
|
return;
|
|
320
331
|
}
|
|
321
332
|
this._flowItems = [...updatedFlowItems];
|
|
@@ -345,7 +356,7 @@ const CrowdsourceReporter = class {
|
|
|
345
356
|
*/
|
|
346
357
|
getFeatureListFlowItem(layerId, layerName) {
|
|
347
358
|
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 }))));
|
|
359
|
+
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
360
|
}
|
|
350
361
|
/**
|
|
351
362
|
* Returns the calcite-flow item for feature details
|
|
@@ -373,7 +384,9 @@ const CrowdsourceReporter = class {
|
|
|
373
384
|
this._currentFeatureId = selectedFeature.attributes[layer.objectIdField];
|
|
374
385
|
}
|
|
375
386
|
else {
|
|
376
|
-
this.
|
|
387
|
+
if (this._editableLayerIds.length > 1) {
|
|
388
|
+
this.setSelectedLayer('', '');
|
|
389
|
+
}
|
|
377
390
|
this._currentFeatureId = '';
|
|
378
391
|
}
|
|
379
392
|
this._updateShareURL();
|
|
@@ -396,6 +409,8 @@ const CrowdsourceReporter = class {
|
|
|
396
409
|
// highlight the newly selected feature only when it has valid geometry
|
|
397
410
|
if (selectedFeature && selectedFeature.geometry && selectedFeature.layer) {
|
|
398
411
|
const selectedLayerView = await mapViewUtils.getFeatureLayerView(this.mapView, selectedFeature.layer.id);
|
|
412
|
+
// remove previous highlight options (if any) to highlight the feature by default color
|
|
413
|
+
selectedLayerView.highlightOptions = null;
|
|
399
414
|
this._highlightHandle = await mapViewUtils.highlightFeatures([selectedFeature.getObjectId()], selectedLayerView, this.mapView, true);
|
|
400
415
|
}
|
|
401
416
|
}
|
|
@@ -421,6 +436,15 @@ const CrowdsourceReporter = class {
|
|
|
421
436
|
* @protected
|
|
422
437
|
*/
|
|
423
438
|
async setMapView() {
|
|
439
|
+
var _a;
|
|
440
|
+
await this.getLayersToShowInList();
|
|
441
|
+
// if only one valid layer is present then directly render features list
|
|
442
|
+
if (((_a = this._editableLayerIds) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
443
|
+
await this.renderFeaturesList();
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
this._flowItems = ['layer-list'];
|
|
447
|
+
}
|
|
424
448
|
this.mapView.popupEnabled = false;
|
|
425
449
|
if (this._defaultCenter && this._defaultLevel) {
|
|
426
450
|
await this.mapView.goTo({
|
|
@@ -444,7 +468,7 @@ const CrowdsourceReporter = class {
|
|
|
444
468
|
this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", this.onMapClick.bind(this));
|
|
445
469
|
}
|
|
446
470
|
/**
|
|
447
|
-
* On map click do hitTest and get the clicked graphics
|
|
471
|
+
* On map click do hitTest and get the clicked graphics from both reporting and non-reporting layers, and show feature details
|
|
448
472
|
* @param event IMapClick map click event details
|
|
449
473
|
*
|
|
450
474
|
* @protected
|
|
@@ -452,12 +476,8 @@ const CrowdsourceReporter = class {
|
|
|
452
476
|
async onMapClick(event) {
|
|
453
477
|
//disable map popup
|
|
454
478
|
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
479
|
// Perform a hitTest on the View
|
|
460
|
-
const hitTest = await this.mapView.hitTest(event
|
|
480
|
+
const hitTest = await this.mapView.hitTest(event);
|
|
461
481
|
if (hitTest.results.length > 0) {
|
|
462
482
|
const clickedGraphics = [];
|
|
463
483
|
hitTest.results.forEach(function (result) {
|
|
@@ -466,16 +486,35 @@ const CrowdsourceReporter = class {
|
|
|
466
486
|
clickedGraphics.push(result.graphic);
|
|
467
487
|
}
|
|
468
488
|
});
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.
|
|
489
|
+
const reportingLayerGraphics = clickedGraphics.filter((graphic) => {
|
|
490
|
+
return this._validLayers.includes(graphic.layer);
|
|
491
|
+
});
|
|
492
|
+
const nonReportingLayerGraphics = clickedGraphics.filter((graphic) => {
|
|
493
|
+
var _a;
|
|
494
|
+
return !this._validLayers.includes(graphic.layer) && ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.layer) === null || _a === void 0 ? void 0 : _a.id);
|
|
495
|
+
});
|
|
496
|
+
// if clicked graphic's layer is one of the reporting layers then show details in layer panel
|
|
497
|
+
if (reportingLayerGraphics.length > 0) {
|
|
498
|
+
//update the selectedFeature
|
|
499
|
+
this.setSelectedFeatures(reportingLayerGraphics);
|
|
500
|
+
//if featureDetails not open then add it to the list else just reInit flowItems which will update details with newly selected features
|
|
501
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
502
|
+
if (this._flowItems.length && this._flowItems[this._flowItems.length - 1] !== "feature-details") {
|
|
503
|
+
this._flowItems = [...this._flowItems, "feature-details"];
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
this._flowItems = [...this._flowItems];
|
|
507
|
+
void this.highlightOnMap(clickedGraphics[0]);
|
|
508
|
+
}
|
|
475
509
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
510
|
+
// if clicked graphic's layer is from non reporting layers then show popup on map
|
|
511
|
+
if (nonReportingLayerGraphics.length > 0) {
|
|
512
|
+
this.mapView.popupEnabled = true;
|
|
513
|
+
const options = {
|
|
514
|
+
features: nonReportingLayerGraphics,
|
|
515
|
+
updateLocationEnabled: true
|
|
516
|
+
};
|
|
517
|
+
await this.mapView.openPopup(options);
|
|
479
518
|
}
|
|
480
519
|
}
|
|
481
520
|
}
|
|
@@ -488,10 +527,57 @@ const CrowdsourceReporter = class {
|
|
|
488
527
|
const messages = await locale.getLocaleComponentStrings(this.el);
|
|
489
528
|
this._translations = messages[0];
|
|
490
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Returns the ids of all OR configured layers that support edits with the update capability
|
|
532
|
+
* @param hash each layer item details
|
|
533
|
+
* @param layers list of layers id
|
|
534
|
+
* @returns array of editable layer ids
|
|
535
|
+
*/
|
|
536
|
+
reduceToConfiguredLayers(hash) {
|
|
537
|
+
var _a;
|
|
538
|
+
const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
|
|
539
|
+
return Object.keys(hash).reduce((prev, cur) => {
|
|
540
|
+
let showLayer = hash[cur].supportsAdd;
|
|
541
|
+
if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
|
|
542
|
+
showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
|
|
543
|
+
}
|
|
544
|
+
if (showLayer) {
|
|
545
|
+
prev.push(cur);
|
|
546
|
+
}
|
|
547
|
+
return prev;
|
|
548
|
+
}, []);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Creates the list of layers to be listed in layer list
|
|
552
|
+
* @protected
|
|
553
|
+
*/
|
|
554
|
+
async getLayersToShowInList() {
|
|
555
|
+
const layerItemsHash = await mapViewUtils.getMapLayerHash(this.mapView, true);
|
|
556
|
+
const allMapLayers = await mapViewUtils.getAllLayers(this.mapView);
|
|
557
|
+
allMapLayers.forEach((eachLayer) => {
|
|
558
|
+
var _a, _b;
|
|
559
|
+
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)) {
|
|
560
|
+
layerItemsHash[eachLayer.id].supportsAdd = true;
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
this._editableLayerIds = this.reduceToConfiguredLayers(layerItemsHash);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* renders feature list
|
|
567
|
+
* @protected
|
|
568
|
+
*/
|
|
569
|
+
async renderFeaturesList() {
|
|
570
|
+
const evt = {
|
|
571
|
+
detail: this._editableLayerIds
|
|
572
|
+
};
|
|
573
|
+
await this.layerListLoaded(evt);
|
|
574
|
+
this.setSelectedLayer(this._validLayers[0].id, this._validLayers[0].title);
|
|
575
|
+
this._flowItems = ['feature-list'];
|
|
576
|
+
}
|
|
491
577
|
/**
|
|
492
578
|
* Updates the share url for current selected feature
|
|
493
579
|
* @protected
|
|
494
|
-
|
|
580
|
+
*/
|
|
495
581
|
_updateShareURL() {
|
|
496
582
|
var _a, _b;
|
|
497
583
|
const url = (_a = this._shareNode) === null || _a === void 0 ? void 0 : _a.shareUrl;
|