@esri/solutions-components 0.10.11 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-alert_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +5 -3
- 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/map-select-tools_3.cjs.entry.js +2 -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/components/map-layer-picker/map-layer-picker.js +6 -4
- package/dist/collection/components/map-select-tools/map-select-tools.js +2 -1
- 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/map-layer-picker2.js +6 -4
- package/dist/components/map-select-tools2.js +2 -1
- package/dist/components/popupUtils.js +1 -1
- package/dist/esm/calcite-alert_4.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +6 -4
- 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/map-select-tools_3.entry.js +2 -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-1f40908b.entry.js → p-15622ace.entry.js} +2 -2
- 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-abd3e579.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-058b77d7.entry.js +0 -6
- 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
@@ -12,7 +12,7 @@ import { c as connectLocalized, d as disconnectLocalized } from './locale-21e40b
|
|
12
12
|
import { c as connectMessages, s as setUpMessages, d as disconnectMessages, u as updateMessages } from './t9n-2fb3af62.js';
|
13
13
|
import { S as SLOTS$1 } from './resources-64237427.js';
|
14
14
|
import { l as loadModules, f as formatNumber, g as getLocaleComponentStrings } from './locale-b1d53fb1.js';
|
15
|
-
import { a as getAllLayers, g as getLayerOrTable, b as getAllTables, d as getMapLayerHash } from './mapViewUtils-3e3d33ea.js';
|
15
|
+
import { a as getAllLayers, g as getLayerOrTable, b as getAllTables, d as getMapLayerHash, c as getFeatureLayerView } from './mapViewUtils-3e3d33ea.js';
|
16
16
|
import './browser-552eb2d0.js';
|
17
17
|
import './guid-4c746a7f.js';
|
18
18
|
import './resources-defbb49f.js';
|
@@ -364,6 +364,8 @@ const CreateFeature = class {
|
|
364
364
|
this.customizeSubmit = false;
|
365
365
|
this.searchConfiguration = undefined;
|
366
366
|
this.isMobile = undefined;
|
367
|
+
this.floorLevel = undefined;
|
368
|
+
this.formElements = undefined;
|
367
369
|
this._editorLoading = false;
|
368
370
|
this._showSearchWidget = undefined;
|
369
371
|
}
|
@@ -378,6 +380,20 @@ const CreateFeature = class {
|
|
378
380
|
* The Editor constructor
|
379
381
|
*/
|
380
382
|
Editor;
|
383
|
+
/**
|
384
|
+
* esri/form/ExpressionInfo: https://developers.arcgis.com/javascript/latest/api-reference/esri-form-ExpressionInfo.html
|
385
|
+
* The ExpressionInfo constructor
|
386
|
+
*/
|
387
|
+
ExpressionInfo;
|
388
|
+
/**
|
389
|
+
* esri/form/elements/FieldElement: https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-FieldElement.html
|
390
|
+
* The FieldElement constructor
|
391
|
+
*/
|
392
|
+
FieldElement;
|
393
|
+
/**
|
394
|
+
* esri/form/FormTemplate: https://developers.arcgis.com/javascript/latest/api-reference/esri-form-FormTemplate.html
|
395
|
+
*/
|
396
|
+
FormTemplate;
|
381
397
|
/**
|
382
398
|
* esri/widgets/Editor: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html
|
383
399
|
* The Editor instance
|
@@ -483,6 +499,15 @@ const CreateFeature = class {
|
|
483
499
|
this._editor.viewModel.featureFormViewModel.submit();
|
484
500
|
}
|
485
501
|
}
|
502
|
+
/**
|
503
|
+
* refresh the feature form
|
504
|
+
* @returns Promise that resolves when the operation is complete
|
505
|
+
*/
|
506
|
+
async refresh(floorLevel) {
|
507
|
+
if (this._editor) {
|
508
|
+
void this._setFloorLevel(floorLevel);
|
509
|
+
}
|
510
|
+
}
|
486
511
|
//--------------------------------------------------------------------------
|
487
512
|
//
|
488
513
|
// Events (public)
|
@@ -538,7 +563,7 @@ const CreateFeature = class {
|
|
538
563
|
const loaderClass = this._editorLoading ? "" : "display-none";
|
539
564
|
const featureFormClass = this._editorLoading ? "display-none" : "";
|
540
565
|
const mobileMapClass = this.isMobile ? "show-map" : "display-none";
|
541
|
-
return (h(Fragment, { key: '
|
566
|
+
return (h(Fragment, { key: '47d29e529402482acf3811c37c0cd5a426ed40ed' }, h("calcite-loader", { key: '283b2c6a0f1722c9a8d955e11390e65e6041b247', class: loaderClass, label: "", scale: "s" }), h("div", { key: 'bb596467d5da22882932259db6a9e8029717850b', class: featureFormClass, id: "feature-form" }), h("div", { key: 'c3887f5c5aa92efdcf588da4918933dadb87937f', class: `search-widget ${showSearchWidget} ${featureFormClass}`, id: "search-widget-ref" }), h("div", { key: '566069a6202053468a3cf7a221feb071491eabb4', class: `${mobileMapClass}`, ref: (el) => { this._mapViewContainer = el; } })));
|
542
567
|
}
|
543
568
|
//--------------------------------------------------------------------------
|
544
569
|
//
|
@@ -561,15 +586,21 @@ const CreateFeature = class {
|
|
561
586
|
* @protected
|
562
587
|
*/
|
563
588
|
async initModules() {
|
564
|
-
const [Editor, reactiveUtils, Search, MapView] = await loadModules([
|
589
|
+
const [Editor, reactiveUtils, Search, ExpressionInfo, FieldElement, FormTemplate, MapView] = await loadModules([
|
565
590
|
"esri/widgets/Editor",
|
566
591
|
"esri/core/reactiveUtils",
|
567
592
|
"esri/widgets/Search",
|
593
|
+
"esri/form/ExpressionInfo",
|
594
|
+
"esri/form/elements/FieldElement",
|
595
|
+
"esri/form/FormTemplate",
|
568
596
|
"esri/views/MapView"
|
569
597
|
]);
|
570
598
|
this.Editor = Editor;
|
571
599
|
this.reactiveUtils = reactiveUtils;
|
572
600
|
this.Search = Search;
|
601
|
+
this.ExpressionInfo = ExpressionInfo;
|
602
|
+
this.FieldElement = FieldElement;
|
603
|
+
this.FormTemplate = FormTemplate;
|
573
604
|
this.MapView = MapView;
|
574
605
|
}
|
575
606
|
/**
|
@@ -660,6 +691,7 @@ const CreateFeature = class {
|
|
660
691
|
const formHandle = this.reactiveUtils.watch(() => this._editor.viewModel.featureFormViewModel?.state, (state) => {
|
661
692
|
if (state === 'ready') {
|
662
693
|
this._mapViewContainer?.classList?.replace("show-map", "hide-map");
|
694
|
+
void this._setFloorLevel(this.floorLevel);
|
663
695
|
this._showSearchWidget = false;
|
664
696
|
this.progressStatus.emit(1);
|
665
697
|
this.drawComplete.emit();
|
@@ -804,6 +836,59 @@ const CreateFeature = class {
|
|
804
836
|
}
|
805
837
|
return searchConfiguration;
|
806
838
|
}
|
839
|
+
/**
|
840
|
+
* Add the floor level value to form
|
841
|
+
* @param level selected floor level
|
842
|
+
*
|
843
|
+
* @protected
|
844
|
+
*/
|
845
|
+
async _setFloorLevel(level) {
|
846
|
+
if (!level) {
|
847
|
+
return;
|
848
|
+
}
|
849
|
+
const layer = await getLayerOrTable(this._updatedMapView, this.selectedLayerId);
|
850
|
+
if (layer?.floorInfo?.floorField) {
|
851
|
+
const layerField = layer.fields.find((field) => field.name === layer.floorInfo.floorField);
|
852
|
+
// if layer field is present and form template is not present only then we can set value of floorfield into feature form otherwise create a mannual formtemplate to add the floorfeild element
|
853
|
+
if (layerField && !layer?.formTemplate) {
|
854
|
+
this._editor.viewModel.featureFormViewModel.setValue(layerField.name, level);
|
855
|
+
layerField.editable = false;
|
856
|
+
}
|
857
|
+
else if (layer.formTemplate && this.formElements) {
|
858
|
+
const floorInfoExpression = new this.ExpressionInfo({
|
859
|
+
expression: `"${level}"`,
|
860
|
+
name: "floor-info-test",
|
861
|
+
title: "Floor Info",
|
862
|
+
returnType: "string"
|
863
|
+
});
|
864
|
+
const levelIdFieldElement = new this.FieldElement({
|
865
|
+
label: layer.floorInfo.floorField,
|
866
|
+
editableExpression: 'false',
|
867
|
+
fieldName: layer.floorInfo.floorField,
|
868
|
+
input: {
|
869
|
+
type: "text-box",
|
870
|
+
maxLength: 50,
|
871
|
+
minLength: 0
|
872
|
+
},
|
873
|
+
valueExpression: floorInfoExpression.name
|
874
|
+
});
|
875
|
+
this._updatedMapView.map.editableLayers.forEach((layer) => {
|
876
|
+
const orgElements = this.formElements.orgElements;
|
877
|
+
const orgExpressionInfos = this.formElements.orgExpressionInfos;
|
878
|
+
const elements = [...orgElements];
|
879
|
+
elements.push(levelIdFieldElement);
|
880
|
+
// Creating formtemplate
|
881
|
+
const floorInfoTemplate = new this.FormTemplate({
|
882
|
+
title: layer.formTemplate.title,
|
883
|
+
description: layer.formTemplate.description,
|
884
|
+
elements,
|
885
|
+
expressionInfos: [floorInfoExpression].concat(orgExpressionInfos)
|
886
|
+
});
|
887
|
+
layer.formTemplate = floorInfoTemplate;
|
888
|
+
});
|
889
|
+
}
|
890
|
+
}
|
891
|
+
}
|
807
892
|
/**
|
808
893
|
* Hides the elements of editor widget
|
809
894
|
* @protected
|
@@ -1632,6 +1717,7 @@ const LayerList = class {
|
|
1632
1717
|
this.layers = undefined;
|
1633
1718
|
this.showFeatureCount = true;
|
1634
1719
|
this.showNextIcon = false;
|
1720
|
+
this.applyLayerViewFilter = false;
|
1635
1721
|
this._noLayersToDisplay = false;
|
1636
1722
|
this._mapLayerIds = [];
|
1637
1723
|
this._isLoading = false;
|
@@ -1702,9 +1788,9 @@ const LayerList = class {
|
|
1702
1788
|
* Renders the component.
|
1703
1789
|
*/
|
1704
1790
|
render() {
|
1705
|
-
return (h(Fragment, { key: '
|
1706
|
-
h("calcite-notice", { key: '
|
1707
|
-
h("calcite-list", { key: '
|
1791
|
+
return (h(Fragment, { key: '19f68b9a5d0b6c85832544e4281e1c4a1707ba86' }, this._isLoading && h("calcite-loader", { key: 'c908f311165f8f520f267a0dcde0bd954863ba6b', label: "", scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
|
1792
|
+
h("calcite-notice", { key: '56dfb252f998333ed6a671cccddd5683f08ad63d', class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, h("div", { key: 'a27ad45ac2b1984152af5a80da36583f7c375be6', slot: "title" }, this._translations.error), h("div", { key: 'a9466cb560b6ee2c72ebd18130ce21371f9e7cdf', slot: "message" }, this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
|
1793
|
+
h("calcite-list", { key: '40e54ba92d2f48a97dd0987808f4b7fdefd266bb', "selection-appearance": "border", "selection-mode": "none" }, this.renderLayerList())));
|
1708
1794
|
}
|
1709
1795
|
//--------------------------------------------------------------------------
|
1710
1796
|
//
|
@@ -1731,10 +1817,20 @@ const LayerList = class {
|
|
1731
1817
|
this._layerItemsHash = await getMapLayerHash(this.mapView, true);
|
1732
1818
|
const allMapLayers = await getAllLayers(this.mapView);
|
1733
1819
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
1734
|
-
|
1820
|
+
for (const eachLayer of allMapLayers) {
|
1735
1821
|
if (eachLayer?.type === "feature") {
|
1736
1822
|
if (this.showFeatureCount) {
|
1737
1823
|
const q = eachLayer.createQuery();
|
1824
|
+
//if layer has definitionExpression append it to the where clause
|
1825
|
+
if (eachLayer?.definitionExpression) {
|
1826
|
+
q.where = q.where + ' AND ' + eachLayer.definitionExpression;
|
1827
|
+
}
|
1828
|
+
if (this.applyLayerViewFilter) {
|
1829
|
+
const featureLayerView = await getFeatureLayerView(this.mapView, eachLayer.id);
|
1830
|
+
if (featureLayerView?.filter?.where) {
|
1831
|
+
q.where = q.where ? q.where + ' AND ' + featureLayerView.filter.where : featureLayerView.filter.where;
|
1832
|
+
}
|
1833
|
+
}
|
1738
1834
|
const result = eachLayer.queryFeatureCount(q);
|
1739
1835
|
def.push(result);
|
1740
1836
|
void result.then(async (resCount) => {
|
@@ -1747,7 +1843,7 @@ const LayerList = class {
|
|
1747
1843
|
});
|
1748
1844
|
}
|
1749
1845
|
}
|
1750
|
-
}
|
1846
|
+
}
|
1751
1847
|
await Promise.all(def).then(() => {
|
1752
1848
|
const editableLayerIds = this.getLayersToBeShownInList(this._layerItemsHash);
|
1753
1849
|
this._mapLayerIds = editableLayerIds.reverse();
|
@@ -43,11 +43,13 @@ const CrowdsourceReporter = class {
|
|
43
43
|
this.searchConfiguration = undefined;
|
44
44
|
this.showComments = undefined;
|
45
45
|
this.showUserImageInCommentsList = false;
|
46
|
+
this.showFeatureSymbol = false;
|
47
|
+
this.showMyReportsOnly = false;
|
46
48
|
this.theme = "light";
|
47
49
|
this.zoomToScale = undefined;
|
50
|
+
this.floorLevel = undefined;
|
48
51
|
this._featureCreationFailedErrorMsg = undefined;
|
49
52
|
this._filterActive = false;
|
50
|
-
this._filterOpen = false;
|
51
53
|
this._flowItems = [];
|
52
54
|
this._hasValidLayers = false;
|
53
55
|
this._loadingFeatureDetails = undefined;
|
@@ -142,6 +144,11 @@ const CrowdsourceReporter = class {
|
|
142
144
|
* esri/core/reactiveUtils: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html
|
143
145
|
*/
|
144
146
|
reactiveUtils;
|
147
|
+
/**
|
148
|
+
* "esri/layers/support/FeatureFilter": https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureFilter.html
|
149
|
+
* Esri FeatureFilter
|
150
|
+
*/
|
151
|
+
FeatureFilter;
|
145
152
|
/**
|
146
153
|
* __esri.Graphic: The selected feature
|
147
154
|
*/
|
@@ -178,6 +185,22 @@ const CrowdsourceReporter = class {
|
|
178
185
|
* boolean: when true allow panel to show in full height
|
179
186
|
*/
|
180
187
|
_showFullPanel;
|
188
|
+
/**
|
189
|
+
* string: The current floor expression
|
190
|
+
*/
|
191
|
+
_floorExpression;
|
192
|
+
/**
|
193
|
+
* _esri.Element: form elements of the selected layer
|
194
|
+
*/
|
195
|
+
_formElements = [];
|
196
|
+
/**
|
197
|
+
* string[]: URL params set by using filters.
|
198
|
+
*/
|
199
|
+
_filterUrlParams;
|
200
|
+
/**
|
201
|
+
* FilterInitState: filter's init state
|
202
|
+
*/
|
203
|
+
_filterInitState;
|
181
204
|
//--------------------------------------------------------------------------
|
182
205
|
//
|
183
206
|
// Watch handlers
|
@@ -197,6 +220,30 @@ const CrowdsourceReporter = class {
|
|
197
220
|
await this.setMapView();
|
198
221
|
});
|
199
222
|
}
|
223
|
+
/**
|
224
|
+
* Called each time the floorLevel prop is changed.
|
225
|
+
*/
|
226
|
+
async floorLevelWatchHandler() {
|
227
|
+
if (this._editableLayerIds) {
|
228
|
+
// updates all layer's defination expression when floorLevel is changed
|
229
|
+
// then refresh the components to update features
|
230
|
+
for (const layerId of this._editableLayerIds) {
|
231
|
+
const layer = await getLayerOrTable(this.mapView, layerId);
|
232
|
+
if (layer.floorInfo?.floorField) {
|
233
|
+
this._updateFloorDefinitionExpression(layer);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
if (this._layerList) {
|
238
|
+
await this._layerList.refresh();
|
239
|
+
}
|
240
|
+
if (this._featureList) {
|
241
|
+
void this._featureList.refresh();
|
242
|
+
}
|
243
|
+
if (this._createFeature) {
|
244
|
+
void this._createFeature.refresh(this.floorLevel);
|
245
|
+
}
|
246
|
+
}
|
200
247
|
//--------------------------------------------------------------------------
|
201
248
|
//
|
202
249
|
// Methods (public)
|
@@ -238,7 +285,7 @@ const CrowdsourceReporter = class {
|
|
238
285
|
*/
|
239
286
|
render() {
|
240
287
|
const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
|
241
|
-
return (h(Host, { key: '
|
288
|
+
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()))));
|
242
289
|
}
|
243
290
|
//--------------------------------------------------------------------------
|
244
291
|
//
|
@@ -253,10 +300,12 @@ const CrowdsourceReporter = class {
|
|
253
300
|
* @protected
|
254
301
|
*/
|
255
302
|
async _initModules() {
|
256
|
-
const [reactiveUtils] = await loadModules([
|
257
|
-
"esri/core/reactiveUtils"
|
303
|
+
const [reactiveUtils, FeatureFilter] = await loadModules([
|
304
|
+
"esri/core/reactiveUtils",
|
305
|
+
"esri/layers/support/FeatureFilter"
|
258
306
|
]);
|
259
307
|
this.reactiveUtils = reactiveUtils;
|
308
|
+
this.FeatureFilter = FeatureFilter;
|
260
309
|
}
|
261
310
|
/**
|
262
311
|
* Set the selected layer id and layer name
|
@@ -295,6 +344,10 @@ const CrowdsourceReporter = class {
|
|
295
344
|
case "feature-list":
|
296
345
|
renderLists.push(this.getFeatureListFlowItem(this._selectedLayerId, this._selectedLayerName));
|
297
346
|
break;
|
347
|
+
case "filter-panel":
|
348
|
+
renderLists.push(this.getFilterPanel());
|
349
|
+
void this._restoreFilters();
|
350
|
+
break;
|
298
351
|
case "feature-details":
|
299
352
|
renderLists.push(this.getFeatureDetailsFlowItem());
|
300
353
|
break;
|
@@ -317,32 +370,6 @@ const CrowdsourceReporter = class {
|
|
317
370
|
? h("calcite-flow", null, renderLists?.length > 0 && renderLists)
|
318
371
|
: h("calcite-loader", { label: "", scale: "m" })));
|
319
372
|
}
|
320
|
-
/**
|
321
|
-
* Show filter component in modal
|
322
|
-
* @returns node to interact with any configured filters for the current layer
|
323
|
-
*/
|
324
|
-
filterModal() {
|
325
|
-
//get layer expression for current selected layer
|
326
|
-
const currentLayersExpressions = this.layerExpressions ? this.layerExpressions.filter((exp) => exp.id === this._selectedLayerId) : [];
|
327
|
-
return (currentLayersExpressions.length > 0 &&
|
328
|
-
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 }))));
|
329
|
-
}
|
330
|
-
/**
|
331
|
-
* Close the filter modal
|
332
|
-
* @protected
|
333
|
-
*/
|
334
|
-
_closeFilter() {
|
335
|
-
if (this._filterOpen) {
|
336
|
-
this._filterOpen = false;
|
337
|
-
}
|
338
|
-
}
|
339
|
-
/**
|
340
|
-
* When true the filter modal will be displayed
|
341
|
-
* @protected
|
342
|
-
*/
|
343
|
-
_toggleFilter() {
|
344
|
-
this._filterOpen = !this._filterOpen;
|
345
|
-
}
|
346
373
|
/**
|
347
374
|
* On sort option click update the sort field and sort order
|
348
375
|
* @param sortField sort field
|
@@ -367,14 +394,27 @@ const CrowdsourceReporter = class {
|
|
367
394
|
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" })))));
|
368
395
|
}
|
369
396
|
/**
|
370
|
-
*
|
397
|
+
* Restores the applied filters
|
398
|
+
* @protected
|
399
|
+
*/
|
400
|
+
_restoreFilters() {
|
401
|
+
// call the restore function when instant-apps-filter-list is ready
|
402
|
+
setTimeout(() => {
|
403
|
+
const canRestoreFilter = this._filterList && this._filterUrlParams && this._filterInitState;
|
404
|
+
if (canRestoreFilter) {
|
405
|
+
void this._filterList.restoreFilters(this._filterUrlParams[0], this._filterInitState);
|
406
|
+
}
|
407
|
+
}, 200);
|
408
|
+
}
|
409
|
+
/**
|
410
|
+
* Reset the filter
|
371
411
|
* @protected
|
372
412
|
*/
|
373
|
-
_handleFilterListReset() {
|
374
|
-
//on reset filter list reset the filter
|
413
|
+
async _handleFilterListReset() {
|
414
|
+
//on reset filter list reset the filter states
|
375
415
|
this._filterActive = false;
|
376
|
-
|
377
|
-
|
416
|
+
this._filterUrlParams = null;
|
417
|
+
this._filterInitState = null;
|
378
418
|
}
|
379
419
|
/**
|
380
420
|
* Check if the layers definitionExpression has been modified and update the feature list depending on the applied filters
|
@@ -384,8 +424,7 @@ const CrowdsourceReporter = class {
|
|
384
424
|
//if filter are applied the url params will be generated
|
385
425
|
//set the filter active state based on the length of applied filters
|
386
426
|
this._filterActive = this._filterList.urlParams.getAll('filter').length > 0;
|
387
|
-
|
388
|
-
void this._featureList.refresh();
|
427
|
+
this._filterUrlParams = this._filterList.urlParams.getAll('filter');
|
389
428
|
}
|
390
429
|
/**
|
391
430
|
* Get the feature layer list
|
@@ -394,7 +433,7 @@ const CrowdsourceReporter = class {
|
|
394
433
|
*/
|
395
434
|
getLayerListFlowItem() {
|
396
435
|
return (h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
|
397
|
-
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 }))));
|
436
|
+
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 }))));
|
398
437
|
}
|
399
438
|
/**
|
400
439
|
* Get the layer list for creating a report
|
@@ -413,7 +452,7 @@ const CrowdsourceReporter = class {
|
|
413
452
|
* @protected
|
414
453
|
*/
|
415
454
|
getFeatureCreateFlowItem() {
|
416
|
-
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 }))));
|
455
|
+
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 }))));
|
417
456
|
}
|
418
457
|
/**
|
419
458
|
* Update the progress bar status when editor panel changes
|
@@ -550,8 +589,10 @@ const CrowdsourceReporter = class {
|
|
550
589
|
*/
|
551
590
|
async navigateToCreateFeature(evt) {
|
552
591
|
if (evt.detail.layerId && evt.detail.layerName) {
|
553
|
-
|
592
|
+
await this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
|
554
593
|
}
|
594
|
+
// get the form template elements to pass in create-feature to create a LEVELID field in feature-form
|
595
|
+
this._getFormElements();
|
555
596
|
this._showSubmitCancelButton = false;
|
556
597
|
this.updatePanelState(false, true);
|
557
598
|
this._flowItems = [...this._flowItems, "feature-create"];
|
@@ -608,6 +649,15 @@ const CrowdsourceReporter = class {
|
|
608
649
|
void this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
|
609
650
|
this._flowItems = [...this._flowItems, "feature-list"];
|
610
651
|
}
|
652
|
+
/**
|
653
|
+
* On back from filter panel get the filter's init state
|
654
|
+
* @protected
|
655
|
+
*/
|
656
|
+
async backFromFilterPanel() {
|
657
|
+
this._filterInitState = await this._filterList.getFilterInitState();
|
658
|
+
void this._featureList.refresh();
|
659
|
+
this.backFromSelectedPanel();
|
660
|
+
}
|
611
661
|
/**
|
612
662
|
* On back from selected panel navigate to the previous panel
|
613
663
|
* @protected
|
@@ -625,6 +675,10 @@ const CrowdsourceReporter = class {
|
|
625
675
|
(updatedFlowItems[0] === 'feature-list' || updatedFlowItems[updatedFlowItems.length - 2] === 'feature-list'))) {
|
626
676
|
this.updatePanelState(this._sidePanelCollapsed, false);
|
627
677
|
}
|
678
|
+
// Coming back from feature details refresh the feature list to update the like count
|
679
|
+
if (this.reportingOptions && this.reportingOptions[this._selectedLayerId]?.like && updatedFlowItems[updatedFlowItems.length - 1] === 'feature-details') {
|
680
|
+
void this._featureList.refresh();
|
681
|
+
}
|
628
682
|
updatedFlowItems.pop();
|
629
683
|
//Back to layer list, and return as the flowItems will be reset in navigateToHomePage
|
630
684
|
if (updatedFlowItems.length === 1 && updatedFlowItems[0] === 'layer-list') {
|
@@ -712,8 +766,19 @@ const CrowdsourceReporter = class {
|
|
712
766
|
const layerExpressions = this.layerExpressions?.filter((exp) => exp.id === this._selectedLayerId);
|
713
767
|
const canCreateReports = this._getLayersConfig(this._selectedLayerId)?.reporting && this._layerItemsHash[this._selectedLayerId].supportsAdd;
|
714
768
|
const showFilterIcon = layerExpressions?.length > 0;
|
715
|
-
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.
|
716
|
-
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 }))));
|
769
|
+
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 &&
|
770
|
+
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 }))));
|
771
|
+
}
|
772
|
+
/**
|
773
|
+
* Get Filter page for apllying filter
|
774
|
+
* @param layerId Layer id
|
775
|
+
* @param layerName Layer name
|
776
|
+
* @returns feature list node
|
777
|
+
* @protected
|
778
|
+
*/
|
779
|
+
getFilterPanel() {
|
780
|
+
const currentLayersExpressions = this.layerExpressions ? this.layerExpressions.filter((exp) => exp.id === this._selectedLayerId) : [];
|
781
|
+
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 }))));
|
717
782
|
}
|
718
783
|
/**
|
719
784
|
* Returns the calcite-flow item for feature details
|
@@ -817,6 +882,8 @@ const CrowdsourceReporter = class {
|
|
817
882
|
*/
|
818
883
|
async setMapView() {
|
819
884
|
await this.getLayersToShowInList();
|
885
|
+
// filter/update the feature(s) if any filter/condition is already applied
|
886
|
+
await this._updateFeatures();
|
820
887
|
// if only one valid layer is present then directly render features list
|
821
888
|
if (this._editableLayerIds?.length === 1) {
|
822
889
|
await this.renderFeaturesList();
|
@@ -918,6 +985,39 @@ const CrowdsourceReporter = class {
|
|
918
985
|
const messages = await getLocaleComponentStrings(this.el);
|
919
986
|
this._translations = messages[0];
|
920
987
|
}
|
988
|
+
/**
|
989
|
+
* Applies a definition expression when floor field and level are available
|
990
|
+
*
|
991
|
+
* @returns boolean
|
992
|
+
* @protected
|
993
|
+
*/
|
994
|
+
_updateFloorDefinitionExpression(layer) {
|
995
|
+
const floorField = layer.floorInfo.floorField;
|
996
|
+
// update the layer defination expression
|
997
|
+
const floorExp = `${floorField} = '${this.floorLevel}'`;
|
998
|
+
const defExp = layer.definitionExpression;
|
999
|
+
layer.definitionExpression = defExp?.indexOf(this._floorExpression) > -1 ?
|
1000
|
+
defExp.replace(this._floorExpression, floorExp) : floorExp;
|
1001
|
+
this._floorExpression = floorExp;
|
1002
|
+
}
|
1003
|
+
/**
|
1004
|
+
* Gets the form template elements
|
1005
|
+
* @protected
|
1006
|
+
*/
|
1007
|
+
_getFormElements() {
|
1008
|
+
const layer = this._selectedLayer;
|
1009
|
+
const floorField = layer?.floorInfo?.floorField;
|
1010
|
+
if (floorField && this.floorLevel && layer?.formTemplate) {
|
1011
|
+
const formElement = this._formElements.find((elm) => elm.id === layer.id);
|
1012
|
+
if (this._formElements.length === 0 || !formElement) {
|
1013
|
+
this._formElements.push({
|
1014
|
+
id: layer.id,
|
1015
|
+
orgElements: layer.formTemplate.elements,
|
1016
|
+
orgExpressionInfos: layer.formTemplate.expressionInfos
|
1017
|
+
});
|
1018
|
+
}
|
1019
|
+
}
|
1020
|
+
}
|
921
1021
|
/**
|
922
1022
|
* Returns the ids of all OR configured layers that support edits with the update capability
|
923
1023
|
* @param hash each layer item details
|
@@ -935,6 +1035,35 @@ const CrowdsourceReporter = class {
|
|
935
1035
|
return prev;
|
936
1036
|
}, []);
|
937
1037
|
}
|
1038
|
+
/**
|
1039
|
+
* updates the features for layer/feature list
|
1040
|
+
* @protected
|
1041
|
+
*/
|
1042
|
+
async _updateFeatures() {
|
1043
|
+
for (const eachLayerId of this._editableLayerIds) {
|
1044
|
+
const featureLayerView = await getFeatureLayerView(this.mapView, eachLayerId);
|
1045
|
+
// In case of show my features add filter for Featurelayerview
|
1046
|
+
await this._showMyFeaturesOnly(featureLayerView);
|
1047
|
+
const floorField = featureLayerView.layer?.floorInfo?.floorField;
|
1048
|
+
if (floorField && this.floorLevel) {
|
1049
|
+
// Update the layer's defination as per selected floor level from map for all editable layers
|
1050
|
+
this._updateFloorDefinitionExpression(featureLayerView.layer);
|
1051
|
+
}
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
/**
|
1055
|
+
* Show only loggedIn user's features
|
1056
|
+
* @protected
|
1057
|
+
*/
|
1058
|
+
async _showMyFeaturesOnly(featureLayerView) {
|
1059
|
+
const loggedInUserName = this.mapView.map.portalItem.portal?.credential?.userId;
|
1060
|
+
if (loggedInUserName) {
|
1061
|
+
const creatorField = featureLayerView.layer.editFieldsInfo?.creatorField.toLowerCase();
|
1062
|
+
featureLayerView.filter = this.showMyReportsOnly && creatorField ? new this.FeatureFilter({
|
1063
|
+
where: creatorField + "='" + loggedInUserName + "'"
|
1064
|
+
}) : null;
|
1065
|
+
}
|
1066
|
+
}
|
938
1067
|
/**
|
939
1068
|
* Creates the list of layers to be listed in layer list
|
940
1069
|
* @protected
|
@@ -1022,7 +1151,8 @@ const CrowdsourceReporter = class {
|
|
1022
1151
|
}
|
1023
1152
|
static get watchers() { return {
|
1024
1153
|
"isMobile": ["isMobileWatchHandler"],
|
1025
|
-
"mapView": ["mapViewWatchHandler"]
|
1154
|
+
"mapView": ["mapViewWatchHandler"],
|
1155
|
+
"floorLevel": ["floorLevelWatchHandler"]
|
1026
1156
|
}; }
|
1027
1157
|
};
|
1028
1158
|
CrowdsourceReporter.style = CrowdsourceReporterStyle0;
|