@esri/solutions-components 0.10.12 → 0.10.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/dist/cjs/calcite-alert_4.cjs.entry.js +1 -1
  2. package/dist/cjs/calcite-flow_6.cjs.entry.js +103 -7
  3. package/dist/cjs/card-manager_3.cjs.entry.js +2 -1
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +3 -2
  5. package/dist/cjs/crowdsource-reporter.cjs.entry.js +173 -43
  6. package/dist/cjs/feature-list.cjs.entry.js +110 -17
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{popupUtils-92e52dbf.js → popupUtils-47bd97e7.js} +1 -1
  9. package/dist/cjs/solutions-components.cjs.js +1 -1
  10. package/dist/collection/assets/t9n/crowdsource-reporter/resources.json +3 -1
  11. package/dist/collection/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
  12. package/dist/collection/assets/t9n/feature-list/resources.json +3 -1
  13. package/dist/collection/assets/t9n/feature-list/resources_en.json +3 -1
  14. package/dist/collection/components/card-manager/card-manager.js +19 -1
  15. package/dist/collection/components/create-feature/create-feature.js +145 -2
  16. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +20 -2
  17. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +227 -43
  18. package/dist/collection/components/feature-list/feature-list.css +16 -1
  19. package/dist/collection/components/feature-list/feature-list.js +165 -15
  20. package/dist/collection/components/layer-list/layer-list.js +35 -6
  21. package/dist/collection/demos/crowdsource-reporter.html +2 -0
  22. package/dist/collection/utils/popupUtils.js +1 -1
  23. package/dist/collection/utils/popupUtils.ts +1 -1
  24. package/dist/components/card-manager2.js +3 -1
  25. package/dist/components/create-feature2.js +91 -3
  26. package/dist/components/crowdsource-manager.js +4 -2
  27. package/dist/components/crowdsource-reporter.js +178 -45
  28. package/dist/components/feature-list2.js +152 -50
  29. package/dist/components/layer-list2.js +18 -6
  30. package/dist/components/popupUtils.js +1 -1
  31. package/dist/esm/calcite-alert_4.entry.js +1 -1
  32. package/dist/esm/calcite-flow_6.entry.js +104 -8
  33. package/dist/esm/card-manager_3.entry.js +2 -1
  34. package/dist/esm/crowdsource-manager.entry.js +3 -2
  35. package/dist/esm/crowdsource-reporter.entry.js +173 -43
  36. package/dist/esm/feature-list.entry.js +110 -17
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/{popupUtils-00c655fb.js → popupUtils-349a26e6.js} +1 -1
  39. package/dist/esm/solutions-components.js +1 -1
  40. package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources.json +3 -1
  41. package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
  42. package/dist/solutions-components/assets/t9n/feature-list/resources.json +3 -1
  43. package/dist/solutions-components/assets/t9n/feature-list/resources_en.json +3 -1
  44. package/dist/solutions-components/demos/crowdsource-reporter.html +2 -0
  45. package/dist/solutions-components/p-40e305b4.entry.js +17 -0
  46. package/dist/solutions-components/p-4d44410b.entry.js +6 -0
  47. package/dist/solutions-components/{p-900fee65.js → p-5a473f0d.js} +1 -1
  48. package/dist/solutions-components/p-8efa9edf.entry.js +6 -0
  49. package/dist/solutions-components/p-977f2314.entry.js +6 -0
  50. package/dist/solutions-components/p-9b83e593.entry.js +6 -0
  51. package/dist/solutions-components/{p-cde8d6e5.entry.js → p-f6bc95b3.entry.js} +1 -1
  52. package/dist/solutions-components/solutions-components.esm.js +1 -1
  53. package/dist/solutions-components/utils/popupUtils.ts +1 -1
  54. package/dist/types/components/card-manager/card-manager.d.ts +4 -0
  55. package/dist/types/components/create-feature/create-feature.d.ts +34 -0
  56. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -0
  57. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +80 -21
  58. package/dist/types/components/feature-list/feature-list.d.ts +49 -7
  59. package/dist/types/components/layer-list/layer-list.d.ts +4 -0
  60. package/dist/types/components.d.ts +93 -0
  61. package/package.json +1 -1
  62. package/dist/solutions-components/p-064e43e0.entry.js +0 -6
  63. package/dist/solutions-components/p-2d1afda0.entry.js +0 -17
  64. package/dist/solutions-components/p-4a0d9efe.entry.js +0 -6
  65. package/dist/solutions-components/p-c9260b4c.entry.js +0 -6
  66. package/dist/solutions-components/p-f7d3ef3e.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: '8adaa70257dfef9632f82be75dbdff572e2c39b3' }, h("calcite-loader", { key: 'e1a1aba8613d9cea1033513748dd21b7f27f9806', class: loaderClass, label: "", scale: "s" }), h("div", { key: 'e1089ffe60d079f345d358aac7ae1a6bd59a55df', class: featureFormClass, id: "feature-form" }), h("div", { key: '52274b6cd4c9f6886293f858caac9e572697da25', class: `search-widget ${showSearchWidget} ${featureFormClass}`, id: "search-widget-ref" }), h("div", { key: '64108cfa3bb57f9739bfb4951352c5523c194761', class: `${mobileMapClass}`, ref: (el) => { this._mapViewContainer = el; } })));
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: '9366302a704c1dbdd7a65aef5c43d0ad84a44b23' }, this._isLoading && h("calcite-loader", { key: '69974a23fd42bc37ef13816efbe6d06e28cb2749', label: "", scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
1706
- h("calcite-notice", { key: 'a93abb55b4db09727b3634cb1935e482c377d662', class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, h("div", { key: 'b9046685353b8894e6c6094cff47fab7a8e07ffa', slot: "title" }, this._translations.error), h("div", { key: '90a052e1d80779a09a32fdd35563a1ce21d582e0', slot: "message" }, this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
1707
- h("calcite-list", { key: '709c1b8edd5710a2476ecef638199c2f929b4165', "selection-appearance": "border", "selection-mode": "none" }, this.renderLayerList())));
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
- allMapLayers.forEach(async (eachLayer) => {
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();
@@ -19,6 +19,7 @@ const CardManagerStyle0 = cardManagerCss;
19
19
  const CardManager = class {
20
20
  constructor(hostRef) {
21
21
  registerInstance(this, hostRef);
22
+ this.customInfoText = undefined;
22
23
  this.enableEditGeometry = false;
23
24
  this.isMobile = undefined;
24
25
  this.layer = undefined;
@@ -81,7 +82,7 @@ const CardManager = class {
81
82
  render() {
82
83
  const featuresClass = this._graphics?.length > 0 ? "" : "display-none";
83
84
  const messageClass = this._graphics?.length > 0 ? "display-none" : "";
84
- return (h(Host, { key: '0309205d485d9c7a5c558b3619a6c5ac03fcb528' }, h("div", { key: 'a5d291f6073b0e0a918573549c6eb29fe1d892dd', class: "overflow-auto height-full" }, h("calcite-shell", { key: '572b9cdf002e0c8c46e6c4bc5e2f1f8494228e93', class: "position-relative " + featuresClass }, h("div", { key: 'f8ba07deb9786d64f3d25011ff66ead43d809bf1' }, h("info-card", { key: '6eda3ab2cfa2e5fb948f5a7ddaeb6b9022aa5543', enableEditGeometry: this.enableEditGeometry, graphics: this._graphics, isLoading: this._cardLoading, isMobile: this.isMobile, mapView: this.mapView }))), h("calcite-shell", { key: 'f32d9cfe3a41bbd7d58cdc732c8abe99b232beb7', class: "position-relative " + messageClass }, h("div", { key: 'b97eb023c5d57a4a8dda09467d8599166da40f3c', class: "padding-1" }, h("calcite-notice", { key: '23a204782bd254909e3ab803a944d10004e4954a', icon: "table", open: true }, h("div", { key: 'ea25078647612b8fa40e26b4474a91c853dae126', slot: "message" }, this._translations.selectFeaturesToStart)))))));
85
+ return (h(Host, { key: 'dafff11793b5ae60164964c346cbb152caceaeb9' }, h("div", { key: '02507fe9e1f4205fe8a9342b466f1ada849c8ed8', class: "overflow-auto height-full" }, h("calcite-shell", { key: '712c42c4044c1386e8bc4ff42e44f250ac4023a2', class: "position-relative " + featuresClass }, h("div", { key: 'f2bc47f58463506f7ea8011495b22cafb63e4f27' }, h("info-card", { key: '1ad1fb78dcc99a43d92ad08d4c7bbeda7c2f276d', enableEditGeometry: this.enableEditGeometry, graphics: this._graphics, isLoading: this._cardLoading, isMobile: this.isMobile, mapView: this.mapView }))), h("calcite-shell", { key: 'fa9fcada67198c182f918b939826f1f7f19f8e5b', class: "position-relative " + messageClass }, h("div", { key: '0da349d1442b6375cde177780c5f868d2e32072a', class: "padding-1" }, h("calcite-notice", { key: 'c0e04ca03c546f90c942c2eef622fbe9c8e61227', icon: "table", open: true }, h("div", { key: '85e3925e725798189b16270df31c266c55391ec7', slot: "message" }, this.customInfoText || this._translations.selectFeaturesToStart)))))));
85
86
  }
86
87
  //--------------------------------------------------------------------------
87
88
  //
@@ -22,6 +22,7 @@ const CrowdsourceManager = class {
22
22
  this.appProxies = undefined;
23
23
  this.basemapConfig = undefined;
24
24
  this.coverPageEnabled = undefined;
25
+ this.customInfoText = undefined;
25
26
  this.defaultCenter = "";
26
27
  this.defaultGlobalId = "";
27
28
  this.defaultLayer = "";
@@ -217,7 +218,7 @@ const CrowdsourceManager = class {
217
218
  render() {
218
219
  // only avoid border when we have a header color that is not white
219
220
  const borderClass = this.popupHeaderColor && this.popupHeaderColor !== "#FFFFFF" ? "border-width-0" : "";
220
- return (h(Host, { key: '805eb5daf8d5d7879e3404cd3c5145abf36469de' }, h("calcite-shell", { key: 'cb8a9037084e0ce4d32986a19a9aac9e6f407e1a', class: "position-relative" }, h("calcite-panel", { key: '176b6ef3c05414ec4a0582aac2d56deb21bd329f', class: `width-full height-full ${borderClass}` }, this._getBody(this._layoutMode, this._panelOpen, this._hideTable)), this._getFooter()), this._filterModal()));
221
+ return (h(Host, { key: 'fa5d4e79b6f5a3eb176af497a4444bb9aca59f15' }, h("calcite-shell", { key: '3e7466a6db42b61db1f9b6efb5cd84b97d3f9d3b', class: "position-relative" }, h("calcite-panel", { key: '15b850a0e9c3b62ebe3bd94b39b61eff1734ad4b', class: `width-full height-full ${borderClass}` }, this._getBody(this._layoutMode, this._panelOpen, this._hideTable)), this._getFooter()), this._filterModal()));
221
222
  }
222
223
  /**
223
224
  * Called after each render
@@ -440,7 +441,7 @@ const CrowdsourceManager = class {
440
441
  const isTableLayout = this.appLayout === 'tableView';
441
442
  const cardManagerHeight = (isMapLayout || isTableLayout) ? "height-full" : !this._isMobile ? "height-50" : "height-full";
442
443
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
443
- return (h("div", { class: `width-50 height-full ${themeClass}` }, h("card-manager", { class: `${cardManagerHeight} width-full`, enableEditGeometry: this?._mapInfo?.enableEditGeometry, isMobile: this._isMobile, layer: this._layer, mapView: this?._mapView, selectedFeaturesIds: this._layerTable?.selectedIds, zoomAndScrollToSelected: this.zoomAndScrollToSelected })));
444
+ return (h("div", { class: `width-50 height-full ${themeClass}` }, h("card-manager", { class: `${cardManagerHeight} width-full`, customInfoText: this.customInfoText, enableEditGeometry: this?._mapInfo?.enableEditGeometry, isMobile: this._isMobile, layer: this._layer, mapView: this?._mapView, selectedFeaturesIds: this._layerTable?.selectedIds, zoomAndScrollToSelected: this.zoomAndScrollToSelected })));
444
445
  }
445
446
  /**
446
447
  * Get the table node based for the current layout
@@ -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: 'e4d2d075e2667ba3e396178e4b820658655813d3' }, this._reportSubmitted && h("calcite-alert", { key: '0cc4678edca8993e529aed1f328816f7ff00e565', "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: 'cb1bc1c8bed7db3d4535542e7cd6c42119fe1ac3', slot: "message" }, this.reportSubmittedMessage ? this.reportSubmittedMessage : this._translations.submitMsg)), this._featureCreationFailedErrorMsg && h("calcite-alert", { key: '83693e1946d2825cf57f6d8ae5ca5a21a0cc7bfc', "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", onCalciteAlertClose: () => { this._featureCreationFailedErrorMsg = ""; }, open: true, placement: "top" }, h("div", { key: 'c8477c3bcbee4a71ba5169cf80895702bd2adf16', slot: "title" }, this._translations.error), h("div", { key: '30722d6036a5634269cd3e485c94e55a06d008a2', slot: "message" }, this._featureCreationFailedErrorMsg)), this._commentSubmitted && h("calcite-alert", { key: '373b8130788f65dd55106ea3be7fe17aecf80ebb', "auto-close": true, class: 'report-submitted ' + themeClass, icon: "check-circle", kind: "success", label: "", onCalciteAlertClose: () => { this._commentSubmitted = false; }, open: true, placement: "top" }, h("div", { key: '999471c510f95a9699fcb84307bd7daca608725a', slot: "message" }, this._translations.commentSubmittedMsg)), this._addingCommentFailed && h("calcite-alert", { key: '72accc95ed73545157141ae82b1be1ff0b407a26', "auto-close": true, class: themeClass, icon: "x-octagon", kind: "danger", label: "", onCalciteAlertClose: () => { this._addingCommentFailed = false; }, open: true, placement: "top" }, h("div", { key: 'b8beab27be23c9c7f3a9a4a0e839090e63ed9916', slot: "title" }, this._translations.error), h("div", { key: '60d4db0311c00b9bf4ccf56bed1c4d40e003d30d', slot: "message" }, this._translations.addingCommentFailedMsg)), h("div", { key: '4bcca25c6f33c79eeb013cb469dd4e650bc649fb' }, h("calcite-shell", { key: '5d68b182b17c9a09671f73ec477efd0bf5badcfb', "content-behind": true }, this._getReporter())), this.filterModal()));
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
- * Reset the filter active prop
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 active state
413
+ async _handleFilterListReset() {
414
+ //on reset filter list reset the filter states
375
415
  this._filterActive = false;
376
- //reset the features list to reflect the applied filters
377
- void this._featureList.refresh();
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
- //reset the features list to reflect the applied filters
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
- void this.setSelectedLayer(evt.detail.layerId, evt.detail.layerName);
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._toggleFilter.bind(this), slot: "header-actions-end", text: this._translations.filter, title: this._translations.filter }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports && canCreateReports &&
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;