@esri/solutions-components 0.10.12 → 0.10.13
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/cjs/calcite-alert_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-flow_6.cjs.entry.js +103 -7
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +173 -43
- package/dist/cjs/feature-list.cjs.entry.js +110 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{popupUtils-92e52dbf.js → popupUtils-47bd97e7.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/collection/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/collection/assets/t9n/feature-list/resources.json +3 -1
- package/dist/collection/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/collection/components/create-feature/create-feature.js +145 -2
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +227 -43
- package/dist/collection/components/feature-list/feature-list.css +16 -1
- package/dist/collection/components/feature-list/feature-list.js +165 -15
- package/dist/collection/components/layer-list/layer-list.js +35 -6
- package/dist/collection/demos/crowdsource-reporter.html +2 -0
- package/dist/collection/utils/popupUtils.js +1 -1
- package/dist/collection/utils/popupUtils.ts +1 -1
- package/dist/components/create-feature2.js +91 -3
- package/dist/components/crowdsource-reporter.js +178 -45
- package/dist/components/feature-list2.js +152 -50
- package/dist/components/layer-list2.js +18 -6
- package/dist/components/popupUtils.js +1 -1
- package/dist/esm/calcite-alert_4.entry.js +1 -1
- package/dist/esm/calcite-flow_6.entry.js +104 -8
- package/dist/esm/crowdsource-reporter.entry.js +173 -43
- package/dist/esm/feature-list.entry.js +110 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{popupUtils-00c655fb.js → popupUtils-349a26e6.js} +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources.json +3 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +2 -0
- package/dist/solutions-components/p-40e305b4.entry.js +17 -0
- package/dist/solutions-components/p-4d44410b.entry.js +6 -0
- package/dist/solutions-components/{p-900fee65.js → p-5a473f0d.js} +1 -1
- package/dist/solutions-components/p-9b83e593.entry.js +6 -0
- package/dist/solutions-components/{p-cde8d6e5.entry.js → p-f6bc95b3.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/popupUtils.ts +1 -1
- package/dist/types/components/create-feature/create-feature.d.ts +34 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +80 -21
- package/dist/types/components/feature-list/feature-list.d.ts +49 -7
- package/dist/types/components/layer-list/layer-list.d.ts +4 -0
- package/dist/types/components.d.ts +77 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-064e43e0.entry.js +0 -6
- package/dist/solutions-components/p-2d1afda0.entry.js +0 -17
- package/dist/solutions-components/p-c9260b4c.entry.js +0 -6
@@ -51,11 +51,13 @@ export class CrowdsourceReporter {
|
|
51
51
|
this.searchConfiguration = undefined;
|
52
52
|
this.showComments = undefined;
|
53
53
|
this.showUserImageInCommentsList = false;
|
54
|
+
this.showFeatureSymbol = false;
|
55
|
+
this.showMyReportsOnly = false;
|
54
56
|
this.theme = "light";
|
55
57
|
this.zoomToScale = undefined;
|
58
|
+
this.floorLevel = undefined;
|
56
59
|
this._featureCreationFailedErrorMsg = undefined;
|
57
60
|
this._filterActive = false;
|
58
|
-
this._filterOpen = false;
|
59
61
|
this._flowItems = [];
|
60
62
|
this._hasValidLayers = false;
|
61
63
|
this._loadingFeatureDetails = undefined;
|
@@ -155,6 +157,11 @@ export class CrowdsourceReporter {
|
|
155
157
|
* esri/core/reactiveUtils: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html
|
156
158
|
*/
|
157
159
|
reactiveUtils;
|
160
|
+
/**
|
161
|
+
* "esri/layers/support/FeatureFilter": https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureFilter.html
|
162
|
+
* Esri FeatureFilter
|
163
|
+
*/
|
164
|
+
FeatureFilter;
|
158
165
|
/**
|
159
166
|
* __esri.Graphic: The selected feature
|
160
167
|
*/
|
@@ -191,6 +198,22 @@ export class CrowdsourceReporter {
|
|
191
198
|
* boolean: when true allow panel to show in full height
|
192
199
|
*/
|
193
200
|
_showFullPanel;
|
201
|
+
/**
|
202
|
+
* string: The current floor expression
|
203
|
+
*/
|
204
|
+
_floorExpression;
|
205
|
+
/**
|
206
|
+
* _esri.Element: form elements of the selected layer
|
207
|
+
*/
|
208
|
+
_formElements = [];
|
209
|
+
/**
|
210
|
+
* string[]: URL params set by using filters.
|
211
|
+
*/
|
212
|
+
_filterUrlParams;
|
213
|
+
/**
|
214
|
+
* FilterInitState: filter's init state
|
215
|
+
*/
|
216
|
+
_filterInitState;
|
194
217
|
//--------------------------------------------------------------------------
|
195
218
|
//
|
196
219
|
// Watch handlers
|
@@ -210,6 +233,30 @@ export class CrowdsourceReporter {
|
|
210
233
|
await this.setMapView();
|
211
234
|
});
|
212
235
|
}
|
236
|
+
/**
|
237
|
+
* Called each time the floorLevel prop is changed.
|
238
|
+
*/
|
239
|
+
async floorLevelWatchHandler() {
|
240
|
+
if (this._editableLayerIds) {
|
241
|
+
// updates all layer's defination expression when floorLevel is changed
|
242
|
+
// then refresh the components to update features
|
243
|
+
for (const layerId of this._editableLayerIds) {
|
244
|
+
const layer = await getLayerOrTable(this.mapView, layerId);
|
245
|
+
if (layer.floorInfo?.floorField) {
|
246
|
+
this._updateFloorDefinitionExpression(layer);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
if (this._layerList) {
|
251
|
+
await this._layerList.refresh();
|
252
|
+
}
|
253
|
+
if (this._featureList) {
|
254
|
+
void this._featureList.refresh();
|
255
|
+
}
|
256
|
+
if (this._createFeature) {
|
257
|
+
void this._createFeature.refresh(this.floorLevel);
|
258
|
+
}
|
259
|
+
}
|
213
260
|
//--------------------------------------------------------------------------
|
214
261
|
//
|
215
262
|
// Methods (public)
|
@@ -251,7 +298,7 @@ export class CrowdsourceReporter {
|
|
251
298
|
*/
|
252
299
|
render() {
|
253
300
|
const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
|
254
|
-
return (h(Host, { key: '
|
301
|
+
return (h(Host, { key: '57ea463ae2d3eac3a23e63ed8702f5fde3743e09' }, this._reportSubmitted && h("calcite-alert", { key: '4082ad71fa4d6c3a01ec0ac6477e81b3d3bc40e1', "auto-close": true, class: themeClass + " report-submitted-msg", icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._reportSubmitted = false; }, open: true, placement: "top" }, h("div", { key: '9e042989b10a7d68347b7f34b9f31957ede3ca37', slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && h("calcite-alert", { key: '573dc6a472b00191a1822c95ba0ee2192c486612', "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", onCalciteAlertClose: () => { this._featureCreationFailedErrorMsg = ""; }, open: true, placement: "top" }, h("div", { key: 'f3799e01a09ccbeec651762833783d3200729f1b', slot: "title" }, this._translations.error), h("div", { key: 'cd80f9a2c8df9a4c7b5b517a9e98ce4622e230c2', slot: "message" }, this._featureCreationFailedErrorMsg)), this._commentSubmitted && h("calcite-alert", { key: '1137ce7794f36419d20a5b5d2d1f390e72713155', "auto-close": true, class: 'report-submitted ' + themeClass, icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._commentSubmitted = false; }, open: true, placement: "top" }, h("div", { key: '24a0604c3be1cab965c48ab46435c349a7d67f65', slot: "message" }, this._translations.commentSubmittedMsg)), this._addingCommentFailed && h("calcite-alert", { key: '86112e4c449e1061fa436822670dc93cb3bfe949', "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", onCalciteAlertClose: () => { this._addingCommentFailed = false; }, open: true, placement: "top" }, h("div", { key: '94be8a14c1bf22127f8018dfe3a92304870ce70d', slot: "title" }, this._translations.error), h("div", { key: '6b30463e2ee941834fcad93e4cbe32e5a65d592d', slot: "message" }, this._translations.addingCommentFailedMsg)), h("div", { key: '9b928eab61af6ed84a0059dbc04c633c131f879b' }, h("calcite-shell", { key: 'e07ac5d7d6d8e8c8fd0001586448ab13733e2ed5', "content-behind": true }, this._getReporter()))));
|
255
302
|
}
|
256
303
|
//--------------------------------------------------------------------------
|
257
304
|
//
|
@@ -266,10 +313,12 @@ export class CrowdsourceReporter {
|
|
266
313
|
* @protected
|
267
314
|
*/
|
268
315
|
async _initModules() {
|
269
|
-
const [reactiveUtils] = await loadModules([
|
270
|
-
"esri/core/reactiveUtils"
|
316
|
+
const [reactiveUtils, FeatureFilter] = await loadModules([
|
317
|
+
"esri/core/reactiveUtils",
|
318
|
+
"esri/layers/support/FeatureFilter"
|
271
319
|
]);
|
272
320
|
this.reactiveUtils = reactiveUtils;
|
321
|
+
this.FeatureFilter = FeatureFilter;
|
273
322
|
}
|
274
323
|
/**
|
275
324
|
* Set the selected layer id and layer name
|
@@ -308,6 +357,10 @@ export class CrowdsourceReporter {
|
|
308
357
|
case "feature-list":
|
309
358
|
renderLists.push(this.getFeatureListFlowItem(this._selectedLayerId, this._selectedLayerName));
|
310
359
|
break;
|
360
|
+
case "filter-panel":
|
361
|
+
renderLists.push(this.getFilterPanel());
|
362
|
+
void this._restoreFilters();
|
363
|
+
break;
|
311
364
|
case "feature-details":
|
312
365
|
renderLists.push(this.getFeatureDetailsFlowItem());
|
313
366
|
break;
|
@@ -330,32 +383,6 @@ export class CrowdsourceReporter {
|
|
330
383
|
? h("calcite-flow", null, renderLists?.length > 0 && renderLists)
|
331
384
|
: h("calcite-loader", { label: "", scale: "m" })));
|
332
385
|
}
|
333
|
-
/**
|
334
|
-
* Show filter component in modal
|
335
|
-
* @returns node to interact with any configured filters for the current layer
|
336
|
-
*/
|
337
|
-
filterModal() {
|
338
|
-
//get layer expression for current selected layer
|
339
|
-
const currentLayersExpressions = this.layerExpressions ? this.layerExpressions.filter((exp) => exp.id === this._selectedLayerId) : [];
|
340
|
-
return (currentLayersExpressions.length > 0 &&
|
341
|
-
h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: () => void this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, this._translations?.filterLayerTitle?.replace("{{title}}", this._selectedLayerName)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: () => void this._closeFilter(), comboboxOverlayPositioning: "fixed", layerExpressions: currentLayersExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
|
342
|
-
}
|
343
|
-
/**
|
344
|
-
* Close the filter modal
|
345
|
-
* @protected
|
346
|
-
*/
|
347
|
-
_closeFilter() {
|
348
|
-
if (this._filterOpen) {
|
349
|
-
this._filterOpen = false;
|
350
|
-
}
|
351
|
-
}
|
352
|
-
/**
|
353
|
-
* When true the filter modal will be displayed
|
354
|
-
* @protected
|
355
|
-
*/
|
356
|
-
_toggleFilter() {
|
357
|
-
this._filterOpen = !this._filterOpen;
|
358
|
-
}
|
359
386
|
/**
|
360
387
|
* On sort option click update the sort field and sort order
|
361
388
|
* @param sortField sort field
|
@@ -380,14 +407,27 @@ export class CrowdsourceReporter {
|
|
380
407
|
h(Fragment, null, h("calcite-list-item", { label: this._translations.sortHighestVoted, onCalciteListItemSelect: () => { void this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField, "desc", "sortHighestVoted"); }, selected: this._updatedSortOption === "sortHighestVoted", value: "sortHighestVoted" }), h("calcite-list-item", { label: this._translations.sortLowestVoted, onCalciteListItemSelect: () => { void this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField, "asc", "sortLowestVoted"); }, selected: this._updatedSortOption === "sortLowestVoted", value: "sortLowestVoted" })))));
|
381
408
|
}
|
382
409
|
/**
|
383
|
-
*
|
410
|
+
* Restores the applied filters
|
411
|
+
* @protected
|
412
|
+
*/
|
413
|
+
_restoreFilters() {
|
414
|
+
// call the restore function when instant-apps-filter-list is ready
|
415
|
+
setTimeout(() => {
|
416
|
+
const canRestoreFilter = this._filterList && this._filterUrlParams && this._filterInitState;
|
417
|
+
if (canRestoreFilter) {
|
418
|
+
void this._filterList.restoreFilters(this._filterUrlParams[0], this._filterInitState);
|
419
|
+
}
|
420
|
+
}, 200);
|
421
|
+
}
|
422
|
+
/**
|
423
|
+
* Reset the filter
|
384
424
|
* @protected
|
385
425
|
*/
|
386
|
-
_handleFilterListReset() {
|
387
|
-
//on reset filter list reset the filter
|
426
|
+
async _handleFilterListReset() {
|
427
|
+
//on reset filter list reset the filter states
|
388
428
|
this._filterActive = false;
|
389
|
-
|
390
|
-
|
429
|
+
this._filterUrlParams = null;
|
430
|
+
this._filterInitState = null;
|
391
431
|
}
|
392
432
|
/**
|
393
433
|
* Check if the layers definitionExpression has been modified and update the feature list depending on the applied filters
|
@@ -397,8 +437,7 @@ export class CrowdsourceReporter {
|
|
397
437
|
//if filter are applied the url params will be generated
|
398
438
|
//set the filter active state based on the length of applied filters
|
399
439
|
this._filterActive = this._filterList.urlParams.getAll('filter').length > 0;
|
400
|
-
|
401
|
-
void this._featureList.refresh();
|
440
|
+
this._filterUrlParams = this._filterList.urlParams.getAll('filter');
|
402
441
|
}
|
403
442
|
/**
|
404
443
|
* Get the feature layer list
|
@@ -407,7 +446,7 @@ export class CrowdsourceReporter {
|
|
407
446
|
*/
|
408
447
|
getLayerListFlowItem() {
|
409
448
|
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
|
410
|
-
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: this._editableLayerIds?.length > 0 ? this._editableLayerIds : this._layers, mapView: this.mapView, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
|
449
|
+
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", { applyLayerViewFilter: this.showMyReportsOnly, class: "height-full", layers: this._editableLayerIds?.length > 0 ? this._editableLayerIds : this._layers, mapView: this.mapView, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this), ref: el => this._layerList = el, showFeatureCount: true, showNextIcon: true }))));
|
411
450
|
}
|
412
451
|
/**
|
413
452
|
* Get the layer list for creating a report
|
@@ -426,7 +465,7 @@ export class CrowdsourceReporter {
|
|
426
465
|
* @protected
|
427
466
|
*/
|
428
467
|
getFeatureCreateFlowItem() {
|
429
|
-
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromCreateFeaturePanel.bind(this) }, this._showSubmitCancelButton && h("div", { class: "width-full", slot: "footer" }, h("calcite-button", { appearance: "solid", class: "footer-top-button footer-button", onClick: this.onCreateFeatureSubmitButtonClick.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("div", { class: "progress-bar" }, h("calcite-progress", { type: "determinate", value: this._updatedProgressBarStatus })), h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, h("div", { slot: "message" }, this._translations.featureEditFormInfoMsg)), h("create-feature", { customizeSubmit: true, isMobile: this.isMobile, mapView: this.mapView, onDrawComplete: this.onFormReady.bind(this), onEditingAttachment: this.showSubmitCancelButton.bind(this), onFail: this.createFeatureFailed.bind(this), onModeChanged: this.backFromCreateFeaturePanel.bind(this), onProgressStatus: this.updatedProgressStatus.bind(this), onSuccess: this.onReportSubmitted.bind(this), ref: el => this._createFeature = el, searchConfiguration: this.searchConfiguration, selectedLayerId: this._selectedLayerId }))));
|
468
|
+
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._selectedLayerName, onCalciteFlowItemBack: this.backFromCreateFeaturePanel.bind(this) }, this._showSubmitCancelButton && h("div", { class: "width-full", slot: "footer" }, h("calcite-button", { appearance: "solid", class: "footer-top-button footer-button", onClick: this.onCreateFeatureSubmitButtonClick.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("div", { class: "progress-bar" }, h("calcite-progress", { type: "determinate", value: this._updatedProgressBarStatus })), h("calcite-notice", { class: "notice-msg", icon: "lightbulb", kind: "success", open: true }, h("div", { slot: "message" }, this._translations.featureEditFormInfoMsg)), h("create-feature", { customizeSubmit: true, floorLevel: this.floorLevel, formElements: this._formElements.find(elm => elm.id === this._selectedLayerId), isMobile: this.isMobile, mapView: this.mapView, onDrawComplete: this.onFormReady.bind(this), onEditingAttachment: this.showSubmitCancelButton.bind(this), onFail: this.createFeatureFailed.bind(this), onModeChanged: this.backFromCreateFeaturePanel.bind(this), onProgressStatus: this.updatedProgressStatus.bind(this), onSuccess: this.onReportSubmitted.bind(this), ref: el => this._createFeature = el, searchConfiguration: this.searchConfiguration, selectedLayerId: this._selectedLayerId }))));
|
430
469
|
}
|
431
470
|
/**
|
432
471
|
* Update the progress bar status when editor panel changes
|
@@ -563,8 +602,10 @@ export class CrowdsourceReporter {
|
|
563
602
|
*/
|
564
603
|
async navigateToCreateFeature(evt) {
|
565
604
|
if (evt.detail.layerId && evt.detail.layerName) {
|
566
|
-
|
605
|
+
await this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
|
567
606
|
}
|
607
|
+
// get the form template elements to pass in create-feature to create a LEVELID field in feature-form
|
608
|
+
this._getFormElements();
|
568
609
|
this._showSubmitCancelButton = false;
|
569
610
|
this.updatePanelState(false, true);
|
570
611
|
this._flowItems = [...this._flowItems, "feature-create"];
|
@@ -621,6 +662,15 @@ export class CrowdsourceReporter {
|
|
621
662
|
void this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
|
622
663
|
this._flowItems = [...this._flowItems, "feature-list"];
|
623
664
|
}
|
665
|
+
/**
|
666
|
+
* On back from filter panel get the filter's init state
|
667
|
+
* @protected
|
668
|
+
*/
|
669
|
+
async backFromFilterPanel() {
|
670
|
+
this._filterInitState = await this._filterList.getFilterInitState();
|
671
|
+
void this._featureList.refresh();
|
672
|
+
this.backFromSelectedPanel();
|
673
|
+
}
|
624
674
|
/**
|
625
675
|
* On back from selected panel navigate to the previous panel
|
626
676
|
* @protected
|
@@ -638,6 +688,10 @@ export class CrowdsourceReporter {
|
|
638
688
|
(updatedFlowItems[0] === 'feature-list' || updatedFlowItems[updatedFlowItems.length - 2] === 'feature-list'))) {
|
639
689
|
this.updatePanelState(this._sidePanelCollapsed, false);
|
640
690
|
}
|
691
|
+
// Coming back from feature details refresh the feature list to update the like count
|
692
|
+
if (this.reportingOptions && this.reportingOptions[this._selectedLayerId]?.like && updatedFlowItems[updatedFlowItems.length - 1] === 'feature-details') {
|
693
|
+
void this._featureList.refresh();
|
694
|
+
}
|
641
695
|
updatedFlowItems.pop();
|
642
696
|
//Back to layer list, and return as the flowItems will be reset in navigateToHomePage
|
643
697
|
if (updatedFlowItems.length === 1 && updatedFlowItems[0] === 'layer-list') {
|
@@ -725,8 +779,19 @@ export class CrowdsourceReporter {
|
|
725
779
|
const layerExpressions = this.layerExpressions?.filter((exp) => exp.id === this._selectedLayerId);
|
726
780
|
const canCreateReports = this._getLayersConfig(this._selectedLayerId)?.reporting && this._layerItemsHash[this._selectedLayerId].supportsAdd;
|
727
781
|
const showFilterIcon = layerExpressions?.length > 0;
|
728
|
-
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, loading: this._showLoadingIndicator, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this._toggleSort(), h("calcite-action", { icon: "sort-ascending-arrow", id: "sort-popover", slot: "header-actions-end", text: this._translations.sort, title: this._translations.sort }), showFilterIcon && h("calcite-action", { icon: "filter", indicator: this._filterActive, onClick: this.
|
729
|
-
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, sortingInfo: this._updatedSorting }))));
|
782
|
+
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, loading: this._showLoadingIndicator, onCalciteFlowItemBack: this.backFromSelectedPanel.bind(this) }, this._toggleSort(), h("calcite-action", { icon: "sort-ascending-arrow", id: "sort-popover", slot: "header-actions-end", text: this._translations.sort, title: this._translations.sort }), showFilterIcon && h("calcite-action", { icon: "filter", indicator: this._filterActive, onClick: () => { this._flowItems = [...this._flowItems, "filter-panel"]; }, slot: "header-actions-end", text: this._translations.filter, title: this._translations.filter }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports && canCreateReports &&
|
783
|
+
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", { applyLayerViewFilter: this.showMyReportsOnly, class: "height-full", highlightOnHover: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, ref: el => this._featureList = el, reportingOptions: this.reportingOptions, selectedLayerId: layerId, showFeatureSymbol: this.showFeatureSymbol, sortingInfo: this._updatedSorting }))));
|
784
|
+
}
|
785
|
+
/**
|
786
|
+
* Get Filter page for apllying filter
|
787
|
+
* @param layerId Layer id
|
788
|
+
* @param layerName Layer name
|
789
|
+
* @returns feature list node
|
790
|
+
* @protected
|
791
|
+
*/
|
792
|
+
getFilterPanel() {
|
793
|
+
const currentLayersExpressions = this.layerExpressions ? this.layerExpressions.filter((exp) => exp.id === this._selectedLayerId) : [];
|
794
|
+
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this._translations?.filterLayerTitle?.replace("{{title}}", this._selectedLayerName), loading: this._showLoadingIndicator, onCalciteFlowItemBack: this.backFromFilterPanel.bind(this) }, this.isMobile && this.getActionToExpandCollapsePanel(), h("div", { class: "width-full", slot: "footer" }, h("div", { class: "width-full", slot: "footer" }, h("calcite-button", { appearance: "solid", class: "footer-top-button footer-button", onClick: () => { void this._filterList?.forceReset(); }, width: "full" }, this._translations.resetFilter), h("calcite-button", { appearance: "outline", class: "footer-button", onClick: this.backFromFilterPanel.bind(this), width: "full" }, this._translations.close))), h("calcite-panel", { "full-height": true }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtnOnClick: () => undefined, comboboxOverlayPositioning: "fixed", layerExpressions: currentLayersExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, resetFiltersOnDisconnect: false, view: this.mapView, zoomBtn: false }))));
|
730
795
|
}
|
731
796
|
/**
|
732
797
|
* Returns the calcite-flow item for feature details
|
@@ -830,6 +895,8 @@ export class CrowdsourceReporter {
|
|
830
895
|
*/
|
831
896
|
async setMapView() {
|
832
897
|
await this.getLayersToShowInList();
|
898
|
+
// filter/update the feature(s) if any filter/condition is already applied
|
899
|
+
await this._updateFeatures();
|
833
900
|
// if only one valid layer is present then directly render features list
|
834
901
|
if (this._editableLayerIds?.length === 1) {
|
835
902
|
await this.renderFeaturesList();
|
@@ -931,6 +998,39 @@ export class CrowdsourceReporter {
|
|
931
998
|
const messages = await getLocaleComponentStrings(this.el);
|
932
999
|
this._translations = messages[0];
|
933
1000
|
}
|
1001
|
+
/**
|
1002
|
+
* Applies a definition expression when floor field and level are available
|
1003
|
+
*
|
1004
|
+
* @returns boolean
|
1005
|
+
* @protected
|
1006
|
+
*/
|
1007
|
+
_updateFloorDefinitionExpression(layer) {
|
1008
|
+
const floorField = layer.floorInfo.floorField;
|
1009
|
+
// update the layer defination expression
|
1010
|
+
const floorExp = `${floorField} = '${this.floorLevel}'`;
|
1011
|
+
const defExp = layer.definitionExpression;
|
1012
|
+
layer.definitionExpression = defExp?.indexOf(this._floorExpression) > -1 ?
|
1013
|
+
defExp.replace(this._floorExpression, floorExp) : floorExp;
|
1014
|
+
this._floorExpression = floorExp;
|
1015
|
+
}
|
1016
|
+
/**
|
1017
|
+
* Gets the form template elements
|
1018
|
+
* @protected
|
1019
|
+
*/
|
1020
|
+
_getFormElements() {
|
1021
|
+
const layer = this._selectedLayer;
|
1022
|
+
const floorField = layer?.floorInfo?.floorField;
|
1023
|
+
if (floorField && this.floorLevel && layer?.formTemplate) {
|
1024
|
+
const formElement = this._formElements.find((elm) => elm.id === layer.id);
|
1025
|
+
if (this._formElements.length === 0 || !formElement) {
|
1026
|
+
this._formElements.push({
|
1027
|
+
id: layer.id,
|
1028
|
+
orgElements: layer.formTemplate.elements,
|
1029
|
+
orgExpressionInfos: layer.formTemplate.expressionInfos
|
1030
|
+
});
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
}
|
934
1034
|
/**
|
935
1035
|
* Returns the ids of all OR configured layers that support edits with the update capability
|
936
1036
|
* @param hash each layer item details
|
@@ -948,6 +1048,35 @@ export class CrowdsourceReporter {
|
|
948
1048
|
return prev;
|
949
1049
|
}, []);
|
950
1050
|
}
|
1051
|
+
/**
|
1052
|
+
* updates the features for layer/feature list
|
1053
|
+
* @protected
|
1054
|
+
*/
|
1055
|
+
async _updateFeatures() {
|
1056
|
+
for (const eachLayerId of this._editableLayerIds) {
|
1057
|
+
const featureLayerView = await getFeatureLayerView(this.mapView, eachLayerId);
|
1058
|
+
// In case of show my features add filter for Featurelayerview
|
1059
|
+
await this._showMyFeaturesOnly(featureLayerView);
|
1060
|
+
const floorField = featureLayerView.layer?.floorInfo?.floorField;
|
1061
|
+
if (floorField && this.floorLevel) {
|
1062
|
+
// Update the layer's defination as per selected floor level from map for all editable layers
|
1063
|
+
this._updateFloorDefinitionExpression(featureLayerView.layer);
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
/**
|
1068
|
+
* Show only loggedIn user's features
|
1069
|
+
* @protected
|
1070
|
+
*/
|
1071
|
+
async _showMyFeaturesOnly(featureLayerView) {
|
1072
|
+
const loggedInUserName = this.mapView.map.portalItem.portal?.credential?.userId;
|
1073
|
+
if (loggedInUserName) {
|
1074
|
+
const creatorField = featureLayerView.layer.editFieldsInfo?.creatorField.toLowerCase();
|
1075
|
+
featureLayerView.filter = this.showMyReportsOnly && creatorField ? new this.FeatureFilter({
|
1076
|
+
where: creatorField + "='" + loggedInUserName + "'"
|
1077
|
+
}) : null;
|
1078
|
+
}
|
1079
|
+
}
|
951
1080
|
/**
|
952
1081
|
* Creates the list of layers to be listed in layer list
|
953
1082
|
* @protected
|
@@ -1514,6 +1643,42 @@ export class CrowdsourceReporter {
|
|
1514
1643
|
"reflect": false,
|
1515
1644
|
"defaultValue": "false"
|
1516
1645
|
},
|
1646
|
+
"showFeatureSymbol": {
|
1647
|
+
"type": "boolean",
|
1648
|
+
"mutable": false,
|
1649
|
+
"complexType": {
|
1650
|
+
"original": "boolean",
|
1651
|
+
"resolved": "boolean",
|
1652
|
+
"references": {}
|
1653
|
+
},
|
1654
|
+
"required": false,
|
1655
|
+
"optional": false,
|
1656
|
+
"docs": {
|
1657
|
+
"tags": [],
|
1658
|
+
"text": "boolean: When true the feature symbology of the feature will shown in the features list"
|
1659
|
+
},
|
1660
|
+
"attribute": "show-feature-symbol",
|
1661
|
+
"reflect": false,
|
1662
|
+
"defaultValue": "false"
|
1663
|
+
},
|
1664
|
+
"showMyReportsOnly": {
|
1665
|
+
"type": "boolean",
|
1666
|
+
"mutable": false,
|
1667
|
+
"complexType": {
|
1668
|
+
"original": "boolean",
|
1669
|
+
"resolved": "boolean",
|
1670
|
+
"references": {}
|
1671
|
+
},
|
1672
|
+
"required": false,
|
1673
|
+
"optional": true,
|
1674
|
+
"docs": {
|
1675
|
+
"tags": [],
|
1676
|
+
"text": "boolean: To show only those features which are created by the logged in user"
|
1677
|
+
},
|
1678
|
+
"attribute": "show-my-reports-only",
|
1679
|
+
"reflect": false,
|
1680
|
+
"defaultValue": "false"
|
1681
|
+
},
|
1517
1682
|
"theme": {
|
1518
1683
|
"type": "string",
|
1519
1684
|
"mutable": false,
|
@@ -1554,6 +1719,23 @@ export class CrowdsourceReporter {
|
|
1554
1719
|
},
|
1555
1720
|
"attribute": "zoom-to-scale",
|
1556
1721
|
"reflect": false
|
1722
|
+
},
|
1723
|
+
"floorLevel": {
|
1724
|
+
"type": "string",
|
1725
|
+
"mutable": false,
|
1726
|
+
"complexType": {
|
1727
|
+
"original": "string",
|
1728
|
+
"resolved": "string",
|
1729
|
+
"references": {}
|
1730
|
+
},
|
1731
|
+
"required": false,
|
1732
|
+
"optional": false,
|
1733
|
+
"docs": {
|
1734
|
+
"tags": [],
|
1735
|
+
"text": "string: selected floor level"
|
1736
|
+
},
|
1737
|
+
"attribute": "floor-level",
|
1738
|
+
"reflect": false
|
1557
1739
|
}
|
1558
1740
|
};
|
1559
1741
|
}
|
@@ -1561,7 +1743,6 @@ export class CrowdsourceReporter {
|
|
1561
1743
|
return {
|
1562
1744
|
"_featureCreationFailedErrorMsg": {},
|
1563
1745
|
"_filterActive": {},
|
1564
|
-
"_filterOpen": {},
|
1565
1746
|
"_flowItems": {},
|
1566
1747
|
"_hasValidLayers": {},
|
1567
1748
|
"_loadingFeatureDetails": {},
|
@@ -1605,6 +1786,9 @@ export class CrowdsourceReporter {
|
|
1605
1786
|
}, {
|
1606
1787
|
"propName": "mapView",
|
1607
1788
|
"methodName": "mapViewWatchHandler"
|
1789
|
+
}, {
|
1790
|
+
"propName": "floorLevel",
|
1791
|
+
"methodName": "floorLevelWatchHandler"
|
1608
1792
|
}];
|
1609
1793
|
}
|
1610
1794
|
}
|
@@ -53,4 +53,19 @@
|
|
53
53
|
.profile-img {
|
54
54
|
margin: 0 0.75rem;
|
55
55
|
min-width: 32px;
|
56
|
-
}
|
56
|
+
}
|
57
|
+
|
58
|
+
.like-container {
|
59
|
+
display: flex;
|
60
|
+
align-items: center;
|
61
|
+
gap: 5px;
|
62
|
+
color: gray !important;
|
63
|
+
font-style: italic;
|
64
|
+
}
|
65
|
+
|
66
|
+
.feature-symbol {
|
67
|
+
padding: 3px 10px;
|
68
|
+
min-width: 30px;
|
69
|
+
display: flex;
|
70
|
+
justify-content: center;
|
71
|
+
}
|