@esri/solutions-components 0.10.12 → 0.10.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) 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/crowdsource-reporter.cjs.entry.js +173 -43
  4. package/dist/cjs/feature-list.cjs.entry.js +110 -17
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{popupUtils-92e52dbf.js → popupUtils-47bd97e7.js} +1 -1
  7. package/dist/cjs/solutions-components.cjs.js +1 -1
  8. package/dist/collection/assets/t9n/crowdsource-reporter/resources.json +3 -1
  9. package/dist/collection/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
  10. package/dist/collection/assets/t9n/feature-list/resources.json +3 -1
  11. package/dist/collection/assets/t9n/feature-list/resources_en.json +3 -1
  12. package/dist/collection/components/create-feature/create-feature.js +145 -2
  13. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +227 -43
  14. package/dist/collection/components/feature-list/feature-list.css +16 -1
  15. package/dist/collection/components/feature-list/feature-list.js +165 -15
  16. package/dist/collection/components/layer-list/layer-list.js +35 -6
  17. package/dist/collection/demos/crowdsource-reporter.html +2 -0
  18. package/dist/collection/utils/popupUtils.js +1 -1
  19. package/dist/collection/utils/popupUtils.ts +1 -1
  20. package/dist/components/create-feature2.js +91 -3
  21. package/dist/components/crowdsource-reporter.js +178 -45
  22. package/dist/components/feature-list2.js +152 -50
  23. package/dist/components/layer-list2.js +18 -6
  24. package/dist/components/popupUtils.js +1 -1
  25. package/dist/esm/calcite-alert_4.entry.js +1 -1
  26. package/dist/esm/calcite-flow_6.entry.js +104 -8
  27. package/dist/esm/crowdsource-reporter.entry.js +173 -43
  28. package/dist/esm/feature-list.entry.js +110 -17
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/{popupUtils-00c655fb.js → popupUtils-349a26e6.js} +1 -1
  31. package/dist/esm/solutions-components.js +1 -1
  32. package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources.json +3 -1
  33. package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
  34. package/dist/solutions-components/assets/t9n/feature-list/resources.json +3 -1
  35. package/dist/solutions-components/assets/t9n/feature-list/resources_en.json +3 -1
  36. package/dist/solutions-components/demos/crowdsource-reporter.html +2 -0
  37. package/dist/solutions-components/p-40e305b4.entry.js +17 -0
  38. package/dist/solutions-components/p-4d44410b.entry.js +6 -0
  39. package/dist/solutions-components/{p-900fee65.js → p-5a473f0d.js} +1 -1
  40. package/dist/solutions-components/p-9b83e593.entry.js +6 -0
  41. package/dist/solutions-components/{p-cde8d6e5.entry.js → p-f6bc95b3.entry.js} +1 -1
  42. package/dist/solutions-components/solutions-components.esm.js +1 -1
  43. package/dist/solutions-components/utils/popupUtils.ts +1 -1
  44. package/dist/types/components/create-feature/create-feature.d.ts +34 -0
  45. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +80 -21
  46. package/dist/types/components/feature-list/feature-list.d.ts +49 -7
  47. package/dist/types/components/layer-list/layer-list.d.ts +4 -0
  48. package/dist/types/components.d.ts +77 -0
  49. package/package.json +1 -1
  50. package/dist/solutions-components/p-064e43e0.entry.js +0 -6
  51. package/dist/solutions-components/p-2d1afda0.entry.js +0 -17
  52. package/dist/solutions-components/p-c9260b4c.entry.js +0 -6
@@ -25,5 +25,7 @@
25
25
  "sortNewest": "Newest",
26
26
  "sortOldest": "Oldest",
27
27
  "sortHighestVoted": "Highest voted",
28
- "sortLowestVoted": "Lowest voted"
28
+ "sortLowestVoted": "Lowest voted",
29
+ "resetFilter": "Reset filter",
30
+ "close": "Close"
29
31
  }
@@ -25,5 +25,7 @@
25
25
  "sortNewest": "Newest",
26
26
  "sortOldest": "Oldest",
27
27
  "sortHighestVoted": "Highest voted",
28
- "sortLowestVoted": "Lowest voted"
28
+ "sortLowestVoted": "Lowest voted",
29
+ "resetFilter": "Reset filter",
30
+ "close": "Close"
29
31
  }
@@ -1,4 +1,6 @@
1
1
  {
2
2
  "error": "Error",
3
- "featureErrorMsg": "No records found."
3
+ "featureErrorMsg": "No records found.",
4
+ "thousandsAbbreviation": "{{abbreviated_value}}k",
5
+ "millionsAbbreviation": "{{abbreviated_value}}M"
4
6
  }
@@ -1,4 +1,6 @@
1
1
  {
2
2
  "error": "Error",
3
- "featureErrorMsg": "No records found."
3
+ "featureErrorMsg": "No records found.",
4
+ "thousandsAbbreviation": "{{abbreviated_value}}k",
5
+ "millionsAbbreviation": "{{abbreviated_value}}M"
4
6
  }
@@ -315,6 +315,8 @@
315
315
  //listen to togglePanel event
316
316
  demo.addEventListener('togglePanel', togglePanel);
317
317
  demo.showUserImageInCommentsList = true;
318
+ demo.showFeatureSymbol = true;
319
+ demo.showMyReportsOnly = false;
318
320
  });
319
321
 
320
322
  function togglePanel(evt) {
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as t,h as i,g as s,c as e,H as a,F as o}from"./p-6eb37ed2.js";import{c as h}from"./p-c638d28e.js";import{c as n,s as c,a as r}from"./p-18f18ab3.js";import{a as l}from"./p-68ec5c15.js";import{c as d,u as f,d as p,I as m}from"./p-415cf05e.js";import{c as b,d as y}from"./p-939bc1b4.js";import{c as g,s as u,d as w,u as k}from"./p-1a9a47a0.js";import{S as v}from"./p-56601650.js";import{l as _,f as x,g as L}from"./p-2058b5d9.js";import{a as C,g as S,b as E,d as I,c as F}from"./p-eb483242.js";import"./p-acaae81d.js";import"./p-ff8343ec.js";import"./p-b39c5275.js";import"./p-fe6f7734.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";
7
+ /*!
8
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
9
+ * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
10
+ * v2.12.0
11
+ */const W="frame",j="frame--advancing",D="frame--retreating",z=class{constructor(i){t(this,i),this.itemMutationObserver=h("mutation",(()=>this.updateFlowProps())),this.getFlowDirection=(t,i)=>t&&i>1||t>1?i<t?"retreating":"advancing":null,this.updateFlowProps=()=>{const{customItemSelectors:t,el:i,items:s}=this,e=Array.from(i.querySelectorAll("calcite-flow-item"+(t?`,${t}`:""))).filter((t=>t.closest("calcite-flow")===i)),a=s.length,o=e.length,h=e[o-1],n=e[o-2];if(o&&h&&e.forEach((t=>{t.showBackButton=t===h&&o>1,t.hidden=t!==h})),n&&(n.menuOpen=!1),this.items=e,a!==o){const t=this.getFlowDirection(a,o);this.itemCount=o,this.flowDirection=t}},this.customItemSelectors=void 0,this.flowDirection=null,this.itemCount=0,this.items=[]}async back(){const{items:t}=this,i=t[t.length-1];if(!i)return;const s=i.beforeBack?i.beforeBack:()=>Promise.resolve();try{await s.call(i)}catch(t){return}return i.remove(),i}async setFocus(){await n(this);const{items:t}=this,i=t[t.length-1];return i?.setFocus()}connectedCallback(){this.itemMutationObserver?.observe(this.el,{childList:!0,subtree:!0}),this.updateFlowProps()}async componentWillLoad(){c(this)}componentDidLoad(){r(this)}disconnectedCallback(){this.itemMutationObserver?.disconnect()}async handleItemBackClick(t){if(!t.defaultPrevented)return await this.back(),this.setFocus()}render(){const{flowDirection:t}=this;return i("div",{key:"93590e2eec869cef65a59c01aa2c6001b431da9a",class:{[W]:!0,[j]:"advancing"===t,[D]:"retreating"===t}},i("slot",{key:"5b97e4147abb053391f170f5e36bac4670934072"}))}get el(){return s(this)}};z.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}:host([hidden]){display:none}[hidden]{display:none}";
12
+ /*!
13
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
14
+ * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
15
+ * v2.12.0
16
+ */
17
+ const H=class{constructor(i){t(this,i),this.calciteFlowItemBack=e(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=e(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=e(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=e(this,"calciteFlowItemToggle",6),this.handleInternalPanelScroll=t=>{t.target===this.containerEl&&(t.stopPropagation(),this.calciteFlowItemScroll.emit())},this.handleInternalPanelClose=t=>{t.target===this.containerEl&&(t.stopPropagation(),this.closed=!0,this.calciteFlowItemClose.emit())},this.handleInternalPanelToggle=t=>{t.target===this.containerEl&&(t.stopPropagation(),this.collapsed=t.target.collapsed,this.calciteFlowItemToggle.emit())},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=t=>{this.backButtonEl=t},this.setContainerRef=t=>{this.containerEl=t},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.beforeClose=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.overlayPositioning="absolute",this.scale="m",this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){d(this),b(this),g(this)}async componentWillLoad(){await u(this),c(this)}componentDidRender(){f(this)}disconnectedCallback(){p(this),y(this),w(this)}componentDidLoad(){r(this)}effectiveLocaleChange(){k(this,this.effectiveLocale)}async setFocus(){await n(this);const{backButtonEl:t,containerEl:i}=this;return t?t.setFocus():i?i.setFocus():void 0}async scrollContentTo(t){await(this.containerEl?.scrollContentTo(t))}renderBackButton(){const{el:t}=this,s="rtl"===l(t),{showBackButton:e,backButtonClick:a,messages:o}=this,h=o.back;return e?i("calcite-action",{"aria-label":h,class:"back-button",icon:s?"chevron-right":"chevron-left",key:"flow-back-button",onClick:a,ref:this.setBackRef,scale:"s",slot:"header-actions-start",text:h,title:h}):null}render(){const{collapsed:t,collapseDirection:s,collapsible:e,closable:o,closed:h,description:n,disabled:c,heading:r,headingLevel:l,loading:d,menuOpen:f,messages:p,overlayPositioning:b,beforeClose:y}=this;return i(a,{key:"166a2f53829cecc09019a7fa3fe670b5e4e42146"},i(m,{key:"53f00fb0e5ec53b8a19efde1592e1bff176302d1",disabled:c},i("calcite-panel",{key:"a24ff76af240b1403ebfa5810bc8fe0443901040",beforeClose:y,closable:o,closed:h,collapseDirection:s,collapsed:t,collapsible:e,description:n,disabled:c,heading:r,headingLevel:l,loading:d,menuOpen:f,messageOverrides:p,onCalcitePanelClose:this.handleInternalPanelClose,onCalcitePanelScroll:this.handleInternalPanelScroll,onCalcitePanelToggle:this.handleInternalPanelToggle,overlayPositioning:b,ref:this.setContainerRef,scale:this.scale},this.renderBackButton(),i("slot",{key:"9051287e5b89eaca28b440816cbcddc03cefed73",name:"action-bar",slot:v.actionBar}),i("slot",{key:"566fb396078d3eac17fbff69e0cd43fb5b8ca13e",name:"alerts",slot:v.alerts}),i("slot",{key:"88ced257238e369cd99250c9d5a93fa03746fbd5",name:"header-actions-start",slot:v.headerActionsStart}),i("slot",{key:"beab9f93af9deed383adc8250ec943b883e058b8",name:"header-actions-end",slot:v.headerActionsEnd}),i("slot",{key:"1f1c7579d1ac1085004b08d2f57ec8b9e0641e35",name:"header-content",slot:v.headerContent}),i("slot",{key:"3696e4a7e80db48581f438336007a1b63a201040",name:"header-menu-actions",slot:v.headerMenuActions}),i("slot",{key:"370e0817cbc13d7cf4c8adaccff8fe9d7c91c859",name:"fab",slot:v.fab}),i("slot",{key:"d55cc859cb1c9c6cc80a63521aad955f6e23d31c",name:"content-top",slot:v.contentTop}),i("slot",{key:"7cea1750cd59d1fdda66516c9b4c78884127dde5",name:"content-bottom",slot:v.contentBottom}),i("slot",{key:"d07ed2f97623023312cdb0a5a01b909286f34373",name:"footer-start",slot:v.footerStart}),i("slot",{key:"fdc209c1e77fd62cadaaad0ee576e71a1f0419d8",name:"footer",slot:v.footer}),i("slot",{key:"5348d32cc42b7fa3b07e4b5ef711863f6ce812bc",name:"footer-end",slot:v.footerEnd}),i("slot",{key:"bad7644787a3ad19ef40931fb38cfe9c18962b27",name:"footer-actions",slot:v.footerActions}),i("slot",{key:"97675398537cc86f41a219126e17bcf24cf4682b"}))))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};H.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;overflow:hidden}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-color-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}";const M=class{constructor(i){t(this,i),this.success=e(this,"success",7),this.fail=e(this,"fail",7),this.drawComplete=e(this,"drawComplete",7),this.editingAttachment=e(this,"editingAttachment",7),this.progressStatus=e(this,"progressStatus",7),this.modeChanged=e(this,"modeChanged",7),this.mapView=void 0,this.selectedLayerId=void 0,this.customizeSubmit=!1,this.searchConfiguration=void 0,this.isMobile=void 0,this.floorLevel=void 0,this.formElements=void 0,this._editorLoading=!1,this._showSearchWidget=void 0}get el(){return s(this)}Editor;ExpressionInfo;FieldElement;FormTemplate;_editor;FeatureLayer;MapView;_updatedMapView;Search;_search;reactiveUtils;_addingAttachment;_container;_mapViewContainer;_isSubmitBtnClicked=!1;async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async isMobileHandler(){this.modeChanged.emit()}async _editorLoadingWatchHandler(t){t&&(this._container?.classList.add("display-none"),await this.startCreate(),this._container?.classList.remove("display-none"),this._editorLoading=!1)}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}async refresh(t){this._editor&&this._setFloorLevel(t)}success;fail;drawComplete;editingAttachment;progressStatus;modeChanged;async componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){const t=this._showSearchWidget?"":"display-none",s=this._editorLoading?"display-none":"",e=this.isMobile?"show-map":"display-none";return i(o,{key:"47d29e529402482acf3811c37c0cd5a426ed40ed"},i("calcite-loader",{key:"283b2c6a0f1722c9a8d955e11390e65e6041b247",class:this._editorLoading?"":"display-none",label:"",scale:"s"}),i("div",{key:"bb596467d5da22882932259db6a9e8029717850b",class:s,id:"feature-form"}),i("div",{key:"c3887f5c5aa92efdcf588da4918933dadb87937f",class:`search-widget ${t} ${s}`,id:"search-widget-ref"}),i("div",{key:"566069a6202053468a3cf7a221feb071491eabb4",class:`${e}`,ref:t=>{this._mapViewContainer=t}}))}async init(){this.mapView&&this.selectedLayerId&&(this._updatedMapView=this.mapView,await(this.isMobile?this.createMobileMapView():this._loadWidgets()))}async initModules(){const[t,i,s,e,a,o,h]=await _(["esri/widgets/Editor","esri/core/reactiveUtils","esri/widgets/Search","esri/form/ExpressionInfo","esri/form/elements/FieldElement","esri/form/FormTemplate","esri/views/MapView"]);this.Editor=t,this.reactiveUtils=i,this.Search=s,this.ExpressionInfo=e,this.FieldElement=a,this.FormTemplate=o,this.MapView=h}async createMobileMapView(){this._mapViewContainer.classList.add("hide-map"),await new this.MapView({map:this.mapView.map,container:this._mapViewContainer}).when((t=>{this._updatedMapView=t,this._loadWidgets()}),(t=>{console.log(t)}))}async _loadWidgets(){await this.createEditorWidget(),await this.createSearchWidget()}async createEditorWidget(){this._editor&&this._editor.destroy();const t=[];this._container=document.createElement("div"),this._container?.classList.add("display-none"),(await C(this._updatedMapView)).forEach((async i=>{t.push({layer:i,enabled:"feature"===i?.type&&i?.id===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({allowedWorkflows:"create-features",view:this._updatedMapView,layerInfos:t,visibleElements:{snappingControls:!1},container:this._container}),this._mapViewContainer?this.el.insertBefore(this._container,this._mapViewContainer):this.el.appendChild(this._container);const i=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"adding-attachment"===t||"editing-attachment"===t?(this._addingAttachment=!0,this.editingAttachment.emit(!0)):this._addingAttachment&&(this.editingAttachment.emit(!1),this._addingAttachment=!1)}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this.progressStatus.emit(.5),this._editorLoading=!0)}));this._editor.viewModel.addHandles(s);const e=this.reactiveUtils.watch((()=>this._editor.viewModel.featureFormViewModel?.state),(t=>{"ready"===t&&(this._mapViewContainer?.classList?.replace("show-map","hide-map"),this._setFloorLevel(this.floorLevel),this._showSearchWidget=!1,this.progressStatus.emit(1),this.drawComplete.emit())}));this._editor.viewModel.addHandles(e);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&(this._mapViewContainer?.classList?.replace("hide-map","show-map"),this._editorLoading=!0,this._showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){return await this.hideEditorsElements(),new Promise(((t,i)=>{if(this._editor.viewModel.featureTemplatesViewModel.items?.length){const s=this._editor.viewModel.featureTemplatesViewModel.items[0].get("items");this._editor.viewModel.featureTemplatesViewModel.on("select",(()=>{this.progressStatus.emit(.75),setTimeout((()=>{this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this)),this.hideEditorsElements().then((()=>{t({})}),(t=>i(t)))}),700)})),1===s.length&&this._editor.viewModel.featureTemplatesViewModel.select(s[0]);const e=s.length>1;this.hideEditorsElements().then((()=>{e&&t({})}),(t=>e&&i(t)))}}))}async createSearchWidget(){let t={view:this._updatedMapView};this.searchConfiguration&&(t={...this._getSearchConfig(this.searchConfiguration,this._updatedMapView)}),this._search=new this.Search(t),this._search.container="search-widget-ref",this._search.popupEnabled=!1,this._search.resultGraphicEnabled=!1;const i=await S(this._updatedMapView,this.selectedLayerId);let s=null;this._search.on("search-complete",(t=>{this._updatedMapView.goTo(t.results[0].results[0].extent),"point"===i.geometryType&&(s=t.results[0].results[0]?.feature.geometry)}));const e=this.reactiveUtils.watch((()=>this._search.viewModel.state),(t=>{"ready"===t&&setTimeout((()=>{this._editor.viewModel.sketchViewModel.createGraphic&&s&&(this._editor.viewModel.sketchViewModel.createGraphic.set("geometry",s),this._editor.viewModel.sketchViewModel.complete(),this.hideEditorsElements())}),100)}));this._search.viewModel.addHandles(e)}_getSearchConfig(t,i){const s=t.sources;return s?.length>0?(t.includeDefaultSources=!1,s.forEach((t=>{if(t.hasOwnProperty("layer")){const s=t,e=s.layer?.id,a=e?i.map.findLayerById(e):null,o=s?.layer?.url;a?s.layer=a:o&&(s.layer=new this.FeatureLayer(o))}})),s?.forEach((t=>{if(t.hasOwnProperty("locator")){const i=t;"ArcGIS World Geocoding Service"===i?.name&&(i.outFields=i.outFields||["Addr_type","Match_addr","StAddr","City"],i.singleLineFieldName="SingleLine"),i.url=i.url,delete i.url}}))):t={...t,includeDefaultSources:!0},t}async _setFloorLevel(t){if(!t)return;const i=await S(this._updatedMapView,this.selectedLayerId);if(i?.floorInfo?.floorField){const s=i.fields.find((t=>t.name===i.floorInfo.floorField));if(s&&!i?.formTemplate)this._editor.viewModel.featureFormViewModel.setValue(s.name,t),s.editable=!1;else if(i.formTemplate&&this.formElements){const s=new this.ExpressionInfo({expression:`"${t}"`,name:"floor-info-test",title:"Floor Info",returnType:"string"}),e=new this.FieldElement({label:i.floorInfo.floorField,editableExpression:"false",fieldName:i.floorInfo.floorField,input:{type:"text-box",maxLength:50,minLength:0},valueExpression:s.name});this._updatedMapView.map.editableLayers.forEach((t=>{const i=this.formElements.orgExpressionInfos,a=[...this.formElements.orgElements];a.push(e);const o=new this.FormTemplate({title:t.formTemplate.title,description:t.formTemplate.description,elements:a,expressionInfos:[s].concat(i)});t.formTemplate=o}))}}}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach((t=>{const i=t.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");i?.querySelector("header")?.setAttribute("style","display: none"),i?.querySelector("footer")?.setAttribute("style","display: none")})))}async submitted(t){if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}timeout(t){return new Promise((i=>setTimeout(i,t)))}static get watchers(){return{mapView:["mapViewWatchHandler"],isMobile:["isMobileHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};M.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}.search-widget{width:92% !important;margin:5px 0 20px 14px}.display-none{display:none !important}.hide-map{height:1%;visibility:hidden}.show-map{padding:10px !important;position:absolute;bottom:0;width:calc(100% - 22px);height:50%}";const T=class{constructor(i){t(this,i),this.success=e(this,"success",7),this.fail=e(this,"fail",7),this.isActionPending=e(this,"isActionPending",7),this.formReady=e(this,"formReady",7),this.mapView=void 0,this.table=void 0,this.selectedFeature=void 0,this.customizeSubmit=!1,this._editorLoading=!1}get el(){return s(this)}Editor;_editor;reactiveUtils;_container;_addingAttachment;_isSubmitBtnClicked=!1;async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async _editorLoadingWatchHandler(t){t&&(this._container?.classList.add("display-none"),await this.startCreate(),this._container?.classList.remove("display-none"),this._editorLoading=!1)}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}success;fail;isActionPending;formReady;async componentWillLoad(){await this.initModules()}async init(){this.mapView&&await this.createEditorWidget()}async initModules(){const[t,i]=await _(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}render(){return i("calcite-loader",{key:"f78b296f74ee01aadc0443abd0bb78b68a7d9f3e",class:this._editorLoading?"":"display-none",label:"",scale:"s"})}async componentDidLoad(){await this.init()}async createEditorWidget(){this._editor&&this._editor.destroy(),this._container=document.createElement("div"),this._container?.classList.add("display-none"),this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:this._container}),this.el.appendChild(this._container);const t=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this._editorLoading=!0)}));this._editor.viewModel.addHandles(t);const i=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"adding-attachment"===t||"editing-attachment"===t?(this._addingAttachment=!0,this.isActionPending.emit(!0)):this._addingAttachment&&(this.isActionPending.emit(!1),this._addingAttachment=!1)}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureFormViewModel?.state),(t=>{"ready"===t&&this.formReady.emit()}));this._editor.viewModel.addHandles(s)}async startCreate(){const t=this.selectedFeature.layer,i=this.table,s=t.relationships[0],e=i.relationships.find((i=>t.layerId===i.relatedTableId)),a=await t.queryFeatures({objectIds:[this.selectedFeature.getObjectId()],outFields:[t.objectIdField,s.keyField]}),o=i.templates[0],h={attributeOverrides:this.makeAttributesForRelatedFeature(a.features[0],s,e),layer:i,template:o};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(h),await this.hideEditorsElements(),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach((t=>{const i=t.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");i?.querySelector("header")?.setAttribute("style","display: none"),i?.querySelector("footer")?.setAttribute("style","display: none")})))}makeAttributesForRelatedFeature(t,i,s){const e=i.keyField;let a;t.attributes.hasOwnProperty(e)?a=t.getAttribute(e):t.attributes.hasOwnProperty(e.toLowerCase())?a=t.getAttribute(e.toLowerCase()):t.attributes.hasOwnProperty(e.toUpperCase())&&(a=t.getAttribute(e.toUpperCase()));let o=s.keyField;const h=this.table.fields.find((t=>t.name.toLocaleLowerCase()===o.toLocaleLowerCase()));return o=h.name,{[o]:a}}async submitted(t){if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}timeout(t){return new Promise((i=>setTimeout(i,t)))}static get watchers(){return{mapView:["mapViewWatchHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};T.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.display-none{display:none !important}";const V=class{constructor(i){t(this,i),this.loadingStatus=e(this,"loadingStatus",7),this.commentSelect=e(this,"commentSelect",7),this.featureSelectionChange=e(this,"featureSelectionChange",7),this.mapView=void 0,this.graphics=void 0,this.reportingOptions=void 0,this.layerItemsHash=void 0,this.showUserImageInCommentsList=!1,this._likeFieldAvailable=!1,this._likeCount=0,this._disLikeCount=0,this._dislikeFieldAvailable=!1,this._commentsAvailable=!1,this._isLikeBtnClicked=!1,this._isDislikeBtnClicked=!1,this._relatedFeaturesOIDs=void 0,this._updating=!1}get el(){return s(this)}_infoCard;_commentsList;_selectedGraphic;_likeField;_dislikeField;Graphic;RelationshipQuery;_validFieldTypes=["small-integer","integer","big-integer","single","long"];relatedTableId;async graphicsWatchHandler(){await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}async refresh(t){await this.getCompleteGraphic(t),await this.processComments(),this.isLikeDislikeConfigured(t.layer)?t&&this.graphics.length>1&&this.checkLikeDislikeFields():(this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1)}async back(){this._infoCard.back()}async next(){this._infoCard.next()}async toggleListView(){this._infoCard.toggleListView()}loadingStatus;commentSelect;featureSelectionChange;async componentWillLoad(){await this._initModules(),await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}render(){const t=this._relatedFeaturesOIDs?.length>0?`objectId in(${this._relatedFeaturesOIDs})`:"1=0";return i("calcite-panel",{key:"a2d31f643b1a361343eb502ede98a35ea954f244","full-height":!0},i("info-card",{key:"4ba44decfa3f155034d3edfdf8ab3e7df5f1ea8a",allowEditing:!1,graphics:this.graphics,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,onSelectionChanged:t=>{this.featureSelectionChange.emit(t.detail)},paginationEnabled:!1,position:"relative",ref:t=>this._infoCard=t}),(this._likeFieldAvailable||this._dislikeFieldAvailable||this._commentsAvailable)&&i("div",{key:"0f7af99fd964da408f3131385cfd617138f40151",class:"buttons-container"},this._commentsAvailable&&i("div",{key:"6ce7b090a07db23c542fc7aaacf9cc8a39987483",class:"comment-btn"},i("span",{key:"fcce9266efa253c679dcb69f308c07950f5e2693"},this._relatedFeaturesOIDs.length),i("calcite-icon",{key:"25355a5c195824e473a390f196d28c909c1348eb",icon:"speech-bubble",scale:"s"})),this._likeFieldAvailable&&i("calcite-button",{key:"6dca1c0f2ca14f662de98362cbe7ef0993fad6b8",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onLikeButtonClick.bind(this),scale:"m"},this._likeCount??this._selectedGraphic.attributes[this._likeField]??0),this._dislikeFieldAvailable&&i("calcite-button",{key:"9d1c0a5938806645a24a757f06e31b13587912dc",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onDislikeButtonClick.bind(this),scale:"m"},this._disLikeCount??this._selectedGraphic.attributes[this._dislikeField]??0)),this.relatedTableId&&this._commentsAvailable&&i("feature-list",{key:"73f81c666a054b2c9f02246fcc7ea4811494c106",class:"height-full",mapView:this.mapView,onFeatureSelect:t=>{this.commentSelect.emit(t.detail)},pageSize:5,ref:t=>this._commentsList=t,selectedLayerId:this.relatedTableId,showErrorWhenNoFeatures:!1,showInitialLoading:!1,showUserImageInList:this.showUserImageInCommentsList,textSize:"small",whereClause:t}))}async _initModules(){const[t,i]=await _(["esri/rest/support/RelationshipQuery","esri/Graphic"]);this.RelationshipQuery=t,this.Graphic=i}async getCompleteGraphic(t){const i=t.layer,s=i.createQuery();s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this._selectedGraphic=e.features[0]}async processComments(){const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]&&this.reportingOptions[t.id].comment&&t.relationships?.length>0){const i=t.relationships[0].relatedTableId,s=(await E(this.mapView)).filter((s=>t.url===s.url&&i===s.layerId)),e=s?.length>0?s[0]:null;if(this.relatedTableId=e?.id??"",this.relatedTableId){const i=this._selectedGraphic.attributes[t.objectIdField],s=new this.RelationshipQuery({objectIds:[i],outFields:["*"],relationshipId:t.relationships[0].id}),a=await t.queryRelatedFeatures(s).catch((t=>{console.error(t)})),o=[];a[i]&&a[i].features.forEach((t=>{o.push(t.attributes[e.objectIdField])})),this._relatedFeaturesOIDs=o,this._commentsAvailable=!0}else this._relatedFeaturesOIDs=[],this._commentsAvailable=!1}else this._relatedFeaturesOIDs=[],this._commentsAvailable=!1,this.relatedTableId=""}isLikeDislikeConfigured(t){let i=!1,s=!1;if(this.reportingOptions&&this.reportingOptions[t.id]){if(!this.reportingOptions[t.id].like&&!this.reportingOptions[t.id].dislike)return!1;const e=this.reportingOptions[t.id].likeField,a=this.reportingOptions[t.id].dislikeField;if(!e&&!a)return!1;t.fields.forEach((o=>{this._validFieldTypes.indexOf(o.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(o.name===e&&this.reportingOptions[t.id].like?i=!0:o.name===a&&this.reportingOptions[t.id].dislike&&(s=!0))}))}return i||s}checkLikeDislikeFields(){this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1,this._isLikeBtnClicked=!1,this._isDislikeBtnClicked=!1,this._likeCount=0,this._disLikeCount=0;const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]){if(this._likeField=this.reportingOptions[t.id].likeField,this._dislikeField=this.reportingOptions[t.id].dislikeField,!this._likeField&&!this._dislikeField)return;t.fields.forEach((i=>{this._validFieldTypes.indexOf(i.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(i.name===this._likeField&&this.reportingOptions[t.id].like?(this._likeFieldAvailable=!0,this._likeCount=this._selectedGraphic.attributes[i.name]):i.name===this._dislikeField&&this.reportingOptions[t.id].dislike&&(this._dislikeFieldAvailable=!0,this._disLikeCount=this._selectedGraphic.attributes[i.name]))})),this.getFromLocalStorage()}}onLikeButtonClick(){this._isDislikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].dislike&&this.onDislikeButtonClick(),this._isLikeBtnClicked=!this._isLikeBtnClicked,this._isLikeBtnClicked?this._likeCount++:this._likeCount--,this.updateFeaturesLikeDislikeField(this._likeField,this._isLikeBtnClicked)}onDislikeButtonClick(){this._isLikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].like&&this.onLikeButtonClick(),this._isDislikeBtnClicked=!this._isDislikeBtnClicked,this._isDislikeBtnClicked?this._disLikeCount++:this._disLikeCount--,this.updateFeaturesLikeDislikeField(this._dislikeField,this._isDislikeBtnClicked)}async updateFeaturesLikeDislikeField(t,i){const s={},e=this._selectedGraphic.layer;this._updating=!0;const a=this._selectedGraphic;a.attributes[t]=Number(a.attributes[t])+(i?1:-1),s[e.objectIdField]=a.attributes[e.objectIdField],s[t]=a.attributes[t];const o=new this.Graphic;o.attributes=s;const h={updateFeatures:[o]};await e.applyEdits(h).then((()=>{this._selectedGraphic=a,this.setInLocalStorage(),this._updating=!1}),(t=>{this._updating=!1,console.log(t)}))}getFromLocalStorage(){const t=localStorage[this._selectedGraphic.layer.id];if(t){const i=JSON.parse(t).filter((t=>t.id===this._selectedGraphic.getObjectId()));i.length>0&&(this._isLikeBtnClicked=i[0].like,this._isDislikeBtnClicked=i[0].dislike)}}setInLocalStorage(){const t=this._selectedGraphic.layer.id,i=localStorage[t];let s=[];if(i){s=JSON.parse(i);const t=s.findIndex((t=>t.id===this._selectedGraphic.getObjectId()));t>=0&&s.splice(t,1)}s.push({id:this._selectedGraphic.getObjectId(),like:this._isLikeBtnClicked&&0!==this._likeCount,dislike:this._isDislikeBtnClicked&&0!==this._disLikeCount}),localStorage.setItem(t,JSON.stringify(s))}static get watchers(){return{graphics:["graphicsWatchHandler"]}}};V.style=":host{display:block}.buttons-container{align-items:center;display:flex;padding:4px;color:var(--calcite-color-text-1) !important;background-color:var(--calcite-color-foreground-1) !important;border-block-start:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3)}.comment-btn{display:flex;gap:10px;font-size:var(--calcite-font-size--1);align-items:center;padding:7px 0.75rem}";const A=class{constructor(i){t(this,i),this.layerSelect=e(this,"layerSelect",7),this.layersListLoaded=e(this,"layersListLoaded",7),this.mapView=void 0,this.layers=void 0,this.showFeatureCount=!0,this.showNextIcon=!1,this.applyLayerViewFilter=!1,this._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=void 0}get el(){return s(this)}_layerItemsHash;async refresh(){await this.setLayers()}layerSelect;layersListLoaded;async componentWillLoad(){await this._getTranslations(),this._isLoading=!0}async componentDidLoad(){await this.setLayers(),this._isLoading=!1}render(){return i(o,{key:"19f68b9a5d0b6c85832544e4281e1c4a1707ba86"},this._isLoading&&i("calcite-loader",{key:"c908f311165f8f520f267a0dcde0bd954863ba6b",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{key:"56dfb252f998333ed6a671cccddd5683f08ad63d",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{key:"a27ad45ac2b1984152af5a80da36583f7c375be6",slot:"title"},this._translations.error),i("div",{key:"a9466cb560b6ee2c72ebd18130ce21371f9e7cdf",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{key:"40e54ba92d2f48a97dd0987808f4b7fdefd266bb","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await I(this.mapView,!0);const i=await C(this.mapView);for(const s of i)if("feature"===s?.type&&this.showFeatureCount){const i=s.createQuery();if(s?.definitionExpression&&(i.where=i.where+" AND "+s.definitionExpression),this.applyLayerViewFilter){const t=await F(this.mapView,s.id);t?.filter?.where&&(i.where=i.where?i.where+" AND "+t.filter.where:t.filter.where)}const e=s.queryFeatureCount(i);t.push(e),e.then((async t=>{const i=isNaN(t)?"":await x(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[s.id].formattedFeatureCount=i}))}await Promise.all(t).then((()=>{const t=this.getLayersToBeShownInList(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getLayersToBeShownInList(t){const i=this.layers?.length>0?this.layers:[];return Object.keys(t).reduce(((t,s)=>(i.indexOf(s)>-1&&t.push(s),t)),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const s=this._layerItemsHash[t].formattedFeatureCount;return i("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},i("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==s&&""!==s&&i("div",{class:this.showNextIcon?"":"feature-count",slot:"content-end"},"("+s+")"),this.showNextIcon&&i("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await L(this.el);this._translations=t[0]}};A.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{z as calcite_flow,H as calcite_flow_item,M as create_feature,T as create_related_feature,V as feature_details,A as layer_list}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as t,c as i,g as e,h as s,H as a,F as h}from"./p-6eb37ed2.js";import{l,g as o}from"./p-2058b5d9.js";import{g as c,a as n,b as r,c as d,h as u,d as p,q as f}from"./p-eb483242.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const m=class{constructor(e){t(this,e),this.togglePanel=i(this,"togglePanel",7),this.center=void 0,this.defaultWebmap="",this.description=void 0,this.enableAnonymousAccess=void 0,this.enableAnonymousComments=void 0,this.enableComments=void 0,this.enableHome=!0,this.enableLogin=void 0,this.enableNewReports=void 0,this.enableSearch=!0,this.enableZoom=!0,this.isMobile=void 0,this.layerExpressions=[],this.layerId=void 0,this.level=void 0,this.loginTitle=void 0,this.mapInfos=[],this.mapView=void 0,this.objectId=void 0,this.reportButtonText=void 0,this.reportingOptions=void 0,this.reportsHeader=void 0,this.reportSubmittedMessage=void 0,this.searchConfiguration=void 0,this.showComments=void 0,this.showUserImageInCommentsList=!1,this.showFeatureSymbol=!1,this.showMyReportsOnly=!1,this.theme="light",this.zoomToScale=void 0,this.floorLevel=void 0,this._featureCreationFailedErrorMsg=void 0,this._filterActive=!1,this._flowItems=[],this._hasValidLayers=!1,this._loadingFeatureDetails=void 0,this._mapInfo=void 0,this._reportSubmitted=!1,this._selectedLayerName=void 0,this._showSubmitCancelButton=!1,this._showLoadingIndicator=!1,this._sidePanelCollapsed=!1,this._translations=void 0,this._updatedProgressBarStatus=.25,this._updatedSorting=void 0,this._updatedSortOption="sortNewest",this._commentSubmitted=!1,this._addingCommentFailed=!1}get el(){return e(this)}_createFeature;_currentFeatureId;_defaultCenter;_defaultLevel;_editableLayerIds;_featureDetails;_featureList;_currentFeature;_selectedRelatedFeature;_relatedTable;_filterList;_highlightHandle;_layerList;_createRelatedFeature;_layers;_mapChange;_mapClickHandle;reactiveUtils;FeatureFilter;_selectedFeature;_selectedFeatureIndex;_selectedLayerId;_shareNode;_urlParamsLoaded;_validLayers;_selectedLayer;_layerItemsHash;_showFullPanel;_floorExpression;_formElements=[];_filterUrlParams;_filterInitState;async isMobileWatchHandler(){this.updatePanelState(!1,this._showFullPanel)}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async floorLevelWatchHandler(){if(this._editableLayerIds)for(const t of this._editableLayerIds){const i=await c(this.mapView,t);i.floorInfo?.floorField&&this._updateFloorDefinitionExpression(i)}this._layerList&&await this._layerList.refresh(),this._featureList&&this._featureList.refresh(),this._createFeature&&this._createFeature.refresh(this.floorLevel)}togglePanel;async componentWillLoad(){this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(this.mapView?.when((async()=>{this._layers=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible)):[],await this.setMapView()})))}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(a,{key:"57ea463ae2d3eac3a23e63ed8702f5fde3743e09"},this._reportSubmitted&&s("calcite-alert",{key:"4082ad71fa4d6c3a01ec0ac6477e81b3d3bc40e1","auto-close":!0,class:t+" report-submitted-msg",icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},s("div",{key:"9e042989b10a7d68347b7f34b9f31957ede3ca37",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"573dc6a472b00191a1822c95ba0ee2192c486612","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"f3799e01a09ccbeec651762833783d3200729f1b",slot:"title"},this._translations.error),s("div",{key:"cd80f9a2c8df9a4c7b5b517a9e98ce4622e230c2",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"1137ce7794f36419d20a5b5d2d1f390e72713155","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"24a0604c3be1cab965c48ab46435c349a7d67f65",slot:"message"},this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"86112e4c449e1061fa436822670dc93cb3bfe949","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"94be8a14c1bf22127f8018dfe3a92304870ce70d",slot:"title"},this._translations.error),s("div",{key:"6b30463e2ee941834fcad93e4cbe32e5a65d592d",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"9b928eab61af6ed84a0059dbc04c633c131f879b"},s("calcite-shell",{key:"e07ac5d7d6d8e8c8fd0001586448ab13733e2ed5","content-behind":!0},this._getReporter())))}async _initModules(){const[t,i]=await l(["esri/core/reactiveUtils","esri/layers/support/FeatureFilter"]);this.reactiveUtils=t,this.FeatureFilter=i}async setSelectedLayer(t,i){this._selectedLayerId=t,this._selectedLayer=await c(this.mapView,t),this._selectedLayerName=i,this._validLayers.forEach((i=>{i.set("visible",!t||i.id===t)}))}_getLayersConfig(t){return this.reportingOptions&&this.reportingOptions[t]?this.reportingOptions[t]:null}_getReporter(){const t=[];return this._flowItems.forEach((i=>{switch(i){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"filter-panel":t.push(this.getFilterPanel()),this._restoreFilters();break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem());break;case"comment-details":t.push(this.getCommentDetailsFlowItem());break;case"add-comment":t.push(this.getAddCommentFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,t?.length>0&&t):s("calcite-loader",{label:"",scale:"m"}))}async sortOptionClick(t,i,e){this._updatedSorting={field:t,order:i},this._updatedSortOption=e}_toggleSort(){const t=this.reportingOptions&&this.reportingOptions[this._selectedLayerId]&&this.reportingOptions[this._selectedLayerId].like&&this.reportingOptions[this._selectedLayerId].likeField;return s("calcite-popover",{autoClose:!0,label:"",offsetDistance:0,placement:this.isMobile?"leading-start":"auto",pointerDisabled:!0,referenceElement:"sort-popover"},s("calcite-list",{"selection-mode":"single"},s("calcite-list-item",{label:this._translations.sortNewest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"desc","sortNewest")},selected:"sortNewest"===this._updatedSortOption,value:"sortNewest"}),s("calcite-list-item",{label:this._translations.sortOldest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"asc","sortOldest")},selected:"sortOldest"===this._updatedSortOption,value:"sortOldest"}),t&&s(h,null,s("calcite-list-item",{label:this._translations.sortHighestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"desc","sortHighestVoted")},selected:"sortHighestVoted"===this._updatedSortOption,value:"sortHighestVoted"}),s("calcite-list-item",{label:this._translations.sortLowestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"asc","sortLowestVoted")},selected:"sortLowestVoted"===this._updatedSortOption,value:"sortLowestVoted"}))))}_restoreFilters(){setTimeout((()=>{this._filterList&&this._filterUrlParams&&this._filterInitState&&this._filterList.restoreFilters(this._filterUrlParams[0],this._filterInitState)}),200)}async _handleFilterListReset(){this._filterActive=!1,this._filterUrlParams=null,this._filterInitState=null}_handleFilterUpdate(){this._filterActive=this._filterList.urlParams.getAll("filter").length>0,this._filterUrlParams=this._filterList.urlParams.getAll("filter")}getLayerListFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader},this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"solid",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("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:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){const t=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible&&this.reportingOptions[t].reporting&&this._layerItemsHash[t]&&this._layerItemsHash[t].supportsAdd)):[];return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.chooseCategoryMsg)),s("layer-list",{class:"height-full",layers:t,mapView:this.mapView,onLayerSelect:this.navigateToCreateFeature.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this)},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.featureEditFormInfoMsg)),s("create-feature",{customizeSubmit:!0,floorLevel:this.floorLevel,formElements:this._formElements.find((t=>t.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:t=>this._createFeature=t,searchConfiguration:this.searchConfiguration,selectedLayerId:this._selectedLayerId})))}updatedProgressStatus(t){this._updatedProgressBarStatus=t.detail}onFormReady(){this._showSubmitCancelButton=!0}showSubmitCancelButton(t){this._showSubmitCancelButton=!t.detail}onCreateFeatureSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this._createFeature.close(),this.backFromSelectedPanel()}onCreateRelatedFeatureSubmitButtonClick(){this._createRelatedFeature&&this._createRelatedFeature.submit()}backFromCreateRelatedFeaturePanel(){this._createRelatedFeature&&(this._createRelatedFeature.close(),this._showSubmitCancelButton=!1),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}onReportSubmitted(){this._showFullPanel&&this.updatePanelState(this._sidePanelCollapsed,!1),this._reportSubmitted=!0,this._updatedProgressBarStatus=.25,this.navigateToHomePage()}addCommentFailed(t){console.error(t.detail),this._addingCommentFailed=!0}async onCommentSubmitted(){this._commentSubmitted=!0,this.backFromSelectedPanel(),this._showLoadingIndicator=!0,await this._featureDetails.refresh(this._currentFeature),setTimeout((()=>{this._showLoadingIndicator=!1}),300)}async navigateToHomePage(){this._createFeature&&this._createFeature.close(),this._layerList&&this._layerList.refresh(),await this.setSelectedFeatures([]),1===this._editableLayerIds.length?(await this._featureList.refresh(),this._flowItems=["feature-list"]):this._flowItems=["layer-list"]}async navigateToCreateFeature(t){t.detail.layerId&&t.detail.layerName&&await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._getFormElements(),this._showSubmitCancelButton=!1,this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"reporting-layer-list"]}async layerListLoaded(t){const i=t.detail,e=await n(this.mapView),s=[];this._validLayers=[],e.forEach((t=>{i.includes(t.id)&&(this._validLayers.push(t),this._getLayersConfig(t.id)?.reporting&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&s.push(t.id))})),this.handleMapClick(),this._hasValidLayers=s.length>0,this._urlParamsLoaded||(this._urlParamsLoaded=!0,await this.loadFeatureFromURLParams())}displayFeaturesList(t){this._updatedSorting={field:"",order:"desc"},this._filterActive=!1,this._updatedSortOption="sortNewest",this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._flowItems=[...this._flowItems,"feature-list"]}async backFromFilterPanel(){this._filterInitState=await this._filterList.getFilterInitState(),this._featureList.refresh(),this.backFromSelectedPanel()}backFromSelectedPanel(){this._updatedProgressBarStatus=.25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),"reporting-layer-list"!==t[t.length-1]&&("feature-create"!==t[t.length-1]||"feature-list"!==t[0]&&"feature-list"!==t[t.length-2])||this.updatePanelState(this._sidePanelCollapsed,!1),this.reportingOptions&&this.reportingOptions[this._selectedLayerId]?.like&&"feature-details"===t[t.length-1]&&this._featureList.refresh(),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}updatePanelState(t,i){this._sidePanelCollapsed=t,this._showFullPanel=i,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer,i=t.relationships[0].relatedTableId,e=(await r(this.mapView)).filter((e=>t.url===e.url&&i===e.layerId));this._relatedTable=e[0]}async updatingFeatureDetails(t){this._showLoadingIndicator=t}async selectionChanged(t){this.updatingFeatureDetails(!0),await this.setCurrentFeature(t.detail.selectedFeature[0]),this.highlightOnMap(t.detail.selectedFeature[0]),this._selectedFeatureIndex=t.detail.selectedFeatureIndex,await this._featureDetails.refresh(t.detail.selectedFeature[0])}async onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,i){const e=this.layerExpressions?.filter((t=>t.id===this._selectedLayerId)),a=this._getLayersConfig(this._selectedLayerId)?.reporting&&this._layerItemsHash[this._selectedLayerId].supportsAdd,h=e?.length>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this._toggleSort(),s("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),h&&s("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&&a&&s("calcite-button",{appearance:"solid",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",highlightOnHover:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,reportingOptions:this.reportingOptions,selectedLayerId:t,showFeatureSymbol:this.showFeatureSymbol,sortingInfo:this._updatedSorting})))}getFilterPanel(){const t=this.layerExpressions?this.layerExpressions.filter((t=>t.id===this._selectedLayerId)):[];return s("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(),s("div",{class:"width-full",slot:"footer"},s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:()=>{this._filterList?.forceReset()},width:"full"},this._translations.resetFilter),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromFilterPanel.bind(this),width:"full"},this._translations.close))),s("calcite-panel",{"full-height":!0},s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtnOnClick:()=>{},comboboxOverlayPositioning:"fixed",layerExpressions:t,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:t=>this._filterList=t,resetFiltersOnDisconnect:!1,view:this.mapView,zoomBtn:!1})))}getFeatureDetailsFlowItem(){const t=this._getLayersConfig(this._selectedLayerId)?.comment&&this._selectedLayer.relationships.length>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"share-node",embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,removePopoverOffset:!0,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),this._selectedFeature.length>1&&this.getFeaturesPagination(),s("calcite-panel",null,s("feature-details",{class:"full-height",graphics:this._selectedFeature,layerItemsHash:this._layerItemsHash,mapView:this.mapView,onCommentSelect:this.onCommentSelectFromList.bind(this),onFeatureSelectionChange:this.selectionChanged.bind(this),onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions,showUserImageInCommentsList:this.showUserImageInCommentsList}),t&&s("calcite-button",{appearance:"solid",onClick:()=>this._flowItems=[...this._flowItems,"add-comment"],slot:"footer",width:"full"},this._translations.comment)))}getFeaturesPagination(){return s("div",{class:"feature-pagination"},s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-left",id:"solutions-back",onClick:()=>{this._featureDetails.back()},scale:"s",width:"full"}),s("calcite-tooltip",{label:"",placement:"top","reference-element":"solutions-back"},s("span",null,this._translations.back))),s("calcite-button",{appearance:"transparent",onClick:()=>{this._featureDetails.toggleListView()},scale:"s"},s("span",{class:"pagination-count"},this._getCount())),s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-right",id:"solutions-next",onClick:()=>{this._featureDetails.next()},scale:"s",width:"full"}),s("calcite-tooltip",{placement:"top","reference-element":"solutions-next"},s("span",null,this._translations.next))))}getCommentDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedRelatedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,paginationEnabled:!1})))}getAddCommentFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromCreateRelatedFeaturePanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateRelatedFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateRelatedFeaturePanel.bind(this),width:"full"},this._translations.cancel))),s("calcite-panel",null,s("create-related-feature",{customizeSubmit:!0,mapView:this.mapView,onFail:this.addCommentFailed.bind(this),onFormReady:this.onFormReady.bind(this),onIsActionPending:this.showSubmitCancelButton.bind(this),onSuccess:this.onCommentSubmitted.bind(this),ref:t=>this._createRelatedFeature=t,selectedFeature:this._currentFeature,table:this._relatedTable})))}async setSelectedFeatures(t){this._selectedFeature=t,await this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}async setCurrentFeature(t){if(this._currentFeature=t,t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField],this._getLayersConfig(i.id)?.comment&&i.relationships.length>0&&await this.getRelatedTable()}else this._editableLayerIds.length>1&&this.setSelectedLayer("",""),this._currentFeatureId="";this._updateShareURL()}async highlightOnMap(t){if(this.clearHighlights(),t&&t.geometry&&t.layer){const i=await d(this.mapView,t.layer.id);i.highlightOptions=null,this._highlightHandle=await u([t.getObjectId()],i,this.mapView,!0,this.zoomToScale)}this.updatingFeatureDetails(!1)}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){await this.getLayersToShowInList(),await this._updateFeatures(),1===this._editableLayerIds?.length?await this.renderFeaturesList():this._flowItems=["layer-list"],this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const i=await this.mapView.hitTest(t);if(i.results.length>0){const t=[];i.results.forEach((function(i){"graphic"===i.type&&t.push(i.graphic)}));const e=t.filter((t=>this._validLayers.includes(t.layer))),s=t.filter((t=>!this._validLayers.includes(t.layer)&&t?.layer?.id));if(e.length>0&&(await this.setSelectedFeatures(e),this._flowItems.length&&this._flowItems.includes("feature-details")?(this._flowItems=[...this._flowItems.slice(0,this._flowItems.indexOf("feature-details")+1)],await this.highlightOnMap(t[0])):this._flowItems=[...this._flowItems,"feature-details"]),s.length>0){this.mapView.popupEnabled=!0;const t={features:s,updateLocationEnabled:!0};await this.mapView.openPopup(t)}}}_getCount(){const t=(this._selectedFeatureIndex+1).toString(),i=this._selectedFeature.length.toString();return this._translations.indexOfTotal.replace("{{index}}",t).replace("{{total}}",i)}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}_updateFloorDefinitionExpression(t){const i=`${t.floorInfo.floorField} = '${this.floorLevel}'`,e=t.definitionExpression;t.definitionExpression=e?.indexOf(this._floorExpression)>-1?e.replace(this._floorExpression,i):i,this._floorExpression=i}_getFormElements(){const t=this._selectedLayer,i=t?.floorInfo?.floorField;if(i&&this.floorLevel&&t?.formTemplate){const i=this._formElements.find((i=>i.id===t.id));0!==this._formElements.length&&i||this._formElements.push({id:t.id,orgElements:t.formTemplate.elements,orgExpressionInfos:t.formTemplate.expressionInfos})}}reduceToConfiguredLayers(t){return Object.keys(t).reduce(((i,e)=>((this.reportingOptions?this._getLayersConfig(e)?.visible:t[e].supportsAdd)&&i.push(e),i)),[])}async _updateFeatures(){for(const t of this._editableLayerIds){const i=await d(this.mapView,t);await this._showMyFeaturesOnly(i);const e=i.layer?.floorInfo?.floorField;e&&this.floorLevel&&this._updateFloorDefinitionExpression(i.layer)}}async _showMyFeaturesOnly(t){const i=this.mapView.map.portalItem.portal?.credential?.userId;if(i){const e=t.layer.editFieldsInfo?.creatorField.toLowerCase();t.filter=this.showMyReportsOnly&&e?new this.FeatureFilter({where:e+"='"+i+"'"}):null}}async getLayersToShowInList(){const t=await p(this.mapView,!0);(await n(this.mapView)).forEach((i=>{"feature"===i?.type&&i?.editingEnabled&&i?.capabilities?.operations?.supportsAdd&&(t[i.id].supportsAdd=!0)})),this._editableLayerIds=this.reduceToConfiguredLayers(t),this._layerItemsHash=t}async renderFeaturesList(){this._flowItems=["feature-list"];const t={detail:this._editableLayerIds};await this.layerListLoaded(t),this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title)}_updateShareURL(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this._selectedLayerId?i.searchParams.set("layerid",this._selectedLayerId):i.searchParams.delete("layerid"),this._selectedFeature?.length?i.searchParams.set("oid",this._currentFeatureId):i.searchParams.delete("oid"),this._shareNode.shareUrl=i.href}async loadFeatureFromURLParams(){if(this.center&&this.level&&await this.mapView.goTo({center:this.center.split(";").map(Number),zoom:this.level}),this.layerId&&this.objectId){const t=await c(this.mapView,this.layerId);if(t){const i=await f([Number(this.objectId)],t,[],!0,this.mapView.spatialReference);i.length&&(await this.setSelectedFeatures(i),this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems])}}}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"],floorLevel:["floorLevelWatchHandler"]}}};m.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.progress-bar{padding:12px}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.feature-pagination{background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3);display:flex;justify-content:center;padding:5px 0}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}.report-submitted-msg{position:absolute;z-index:1000}.share-node{display:flex}";export{m as crowdsource_reporter}
@@ -18,4 +18,4 @@ import{_ as t}from"./p-022c49af.js";import{l as s}from"./p-2058b5d9.js";
18
18
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
- */class i{arcade;intl;async getPopupTitle(s,i){this.arcade||await this._initModules();let e={};for(const[t,i]of Object.entries(s.attributes))e={...e,[`{${t.toUpperCase()}}`]:i};const a=s.layer,o=this._removeTags(a?.popupTemplate?.title);if(o.includes("{expression/expr")&&null!=a?.popupTemplate?.expressionInfos)for(let t=0;t<a.popupTemplate?.expressionInfos.length;t++){const o=a.popupTemplate.expressionInfos[t],n=this.arcade.createArcadeProfile("popup");try{const t=await this.arcade.createArcadeExecutor(o.expression,n),r=await t.executeAsync({$feature:s,$layer:a,$map:i});null==r&&""===r||(e[`{expression/${o.name}}`.toUpperCase()]=r)}catch(t){console.error(t);continue}}return a.popupTemplate.fieldInfos&&a.fields.forEach((i=>{const o=s.attributes[i.name],n=a.popupTemplate.fieldInfos.find((t=>t.fieldName.toLowerCase()===i.name.toLowerCase())),r=t(o,i.type,i.domain,n?.format,this.intl);e[`{${i.name.toUpperCase()}}`]=r??o})),o?.replace(/{.*?}/g,(t=>null!=e[t.toUpperCase()]?e[t.toUpperCase()]:""))}_removeTags(t){return null==t||""===t?"":t.toString().replace(/(<([^>]+)>)/gi,"")}async _initModules(){const[t,i]=await s(["esri/arcade","esri/intl"]);this.arcade=t,this.intl=i}}export{i as P}
21
+ */class i{arcade;intl;async getPopupTitle(s,i){this.arcade||await this._initModules();let e={};for(const[t,i]of Object.entries(s.attributes))e={...e,[`{${t.toUpperCase()}}`]:i};const a=s.layer,o=this._removeTags(a?.popupTemplate?.title);if(o.includes("{expression/expr")&&null!=a?.popupTemplate?.expressionInfos)for(let t=0;t<a.popupTemplate?.expressionInfos.length;t++){const o=a.popupTemplate.expressionInfos[t],n=this.arcade.createArcadeProfile("popup");try{const t=await this.arcade.createArcadeExecutor(o.expression,n),r=await t.executeAsync({$feature:s,$layer:a,$map:i});null==r&&""===r||(e[`{expression/${o.name}}`.toUpperCase()]=r)}catch(t){console.error(t);continue}}return a.popupTemplate?.fieldInfos&&a.fields.forEach((i=>{const o=s.attributes[i.name],n=a.popupTemplate.fieldInfos.find((t=>t.fieldName.toLowerCase()===i.name.toLowerCase())),r=t(o,i.type,i.domain,n?.format,this.intl);e[`{${i.name.toUpperCase()}}`]=r??o})),o?.replace(/{.*?}/g,(t=>null!=e[t.toUpperCase()]?e[t.toUpperCase()]:""))}_removeTags(t){return null==t||""===t?"":t.toString().replace(/(<([^>]+)>)/gi,"")}async _initModules(){const[t,i]=await s(["esri/arcade","esri/intl"]);this.arcade=t,this.intl=i}}export{i as P}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as t,c as i,g as s,h as e}from"./p-6eb37ed2.js";import{l as a,g as h}from"./p-2058b5d9.js";import{P as n}from"./p-5a473f0d.js";import{g as l,c as o,h as r}from"./p-eb483242.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-022c49af.js";import"./p-659678f1.js";import"./p-7c583516.js";import"./p-80cb7c73.js";const c=class{constructor(s){t(this,s),this.featureSelect=i(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this.highlightOnHover=!1,this.sortingInfo=void 0,this.whereClause=void 0,this.textSize="large",this.showInitialLoading=!0,this.showErrorWhenNoFeatures=!0,this.showUserImageInList=!1,this.showFeatureSymbol=!1,this.applyLayerViewFilter=!1,this.reportingOptions=void 0,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}get el(){return s(this)}Color;esriConfig;symbolUtils;_popupUtils;_selectedLayer;_highlightHandle;_pagination;_validFieldTypes=["small-integer","integer","big-integer","single","long"];_abbreviatedLikeCount;_likeFieldAvailable=!1;async selectedLayerWatchHandler(){this._selectedLayer=await l(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(){await this.initializeFeatureItems()}featureSelect;async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new n,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await l(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return e("calcite-panel",{key:"b84cbd9d8c0f4d9d84fe7a49d149b67e88e46c53","full-height":!0,"full-width":!0},this._isLoading&&e("calcite-loader",{key:"91ee86a3223b55141206be0d3f20bca1b777e4db",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&e("calcite-notice",{key:"3c3b4a35c45715a86bd17630e8f3f9b566592c27",class:"error-msg",icon:"feature-details",kind:"info",open:!0},e("div",{key:"63a35389ac64f66c706fa05e92fb8f1af8dd0b69",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),e("calcite-list",{key:"a237f97a0d286af17cce837bfbdd3c0d868ea023","selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&e("div",{key:"9cb166b5095167a2004e93217240bea6789e9039",class:"width-full",slot:"footer"},e("calcite-pagination",{key:"a413b26dd30fdc89be1d65ef06995604f1430a18",class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,ref:t=>this._pagination=t,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t,i,s]=await a(["esri/Color","esri/config","esri/symbols/support/symbolUtils"]);this.Color=t,this.esriConfig=i,this.symbolUtils=s}async getWhereCondition(){let t="1=1";if(this.whereClause&&(t=this.whereClause),this._selectedLayer?.definitionExpression&&(t=t+" AND "+this._selectedLayer.definitionExpression),this.applyLayerViewFilter){const i=await o(this.mapView,this.selectedLayerId);i?.filter?.where&&(t=t+" AND "+i.filter.where)}return t}async initializeFeatureItems(){if(this._selectedLayer){this._pagination?.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const t={where:await this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(t),this._isLoading=!1}}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),s=await o(this.mapView,this.selectedLayerId);this._highlightHandle=await r([i],s,this.mapView,!0)}await this.emitSelectedFeature(i)}async emitSelectedFeature(t){const i=t.layer,s=i.createQuery();s.returnGeometry=!0,s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this.featureSelect.emit(e.features[0])}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),s=await o(this.mapView,this.selectedLayerId);s.highlightOptions={color:new this.Color("#FFFF00")},this._highlightHandle=s.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,s=this.sortingInfo?.field?this.sortingInfo.field:i.objectIdField,e=this.sortingInfo?.order?this.sortingInfo.order:"desc",a=await this.getWhereCondition(),h={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:a,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&e&&(h.orderByFields=[s.toString()+" "+e]);const n=await i.queryFeatures(h);return await this.createFeatureItem(n)}async createFeatureItem(t){const i=t?.features,s=this.reportingOptions&&this.reportingOptions[this.selectedLayerId].like,e=i.map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);let e,a;if(this.showUserImageInList){const i=this._selectedLayer.editFieldsInfo?.creatorField.toLowerCase();i&&(e=await this.getUserInformation(t,i))}return this.showFeatureSymbol&&(a=await this.getFeatureSymbol(t)),s&&this.getAbbreviatedLikeCount(t),this.getFeatureItem(t,i,a,e)}));return Promise.all(e)}getAbbreviatedLikeCount(t){const i=this._selectedLayer,s=this.reportingOptions[i.id].likeField;i.fields.forEach((e=>{if(this._validFieldTypes.indexOf(e.type)>-1&&e.name===s&&this.reportingOptions[i.id].like){this._likeFieldAvailable=!0;let i=t.attributes[s]||0;i>999&&(i=i>999999?this._translations.millionsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e6).toString()):this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e3).toString())),this._abbreviatedLikeCount=i}}))}getFeatureItem(t,i,s,a){const h=t.attributes[this._selectedLayer.objectIdField].toString();i=i??h;const n=Number(t.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString(),l="small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title",o=this.showUserImageInList||this.showFeatureSymbol?"feature-list-popup-title-padding-reduced":"feature-list-popup-title-padding";return e("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:h},this.showUserImageInList&&e("calcite-avatar",{class:"profile-img","full-name":a?.fullName,id:a?.id,scale:"m",slot:"content-start",thumbnail:a?.userProfileUrl,username:a?.username}),this.showFeatureSymbol&&e("div",{class:"feature-symbol",ref:t=>t&&t.appendChild(s),slot:"content-start"}),e("div",{class:`${l} ${o}`,slot:"content-start"},i),this._likeFieldAvailable&&e("div",{class:"like-container",id:h.concat("like"),slot:"content-end"},e("span",null,this._abbreviatedLikeCount),e("calcite-icon",{icon:"thumbs-up",scale:"s"}),e("calcite-tooltip",{"reference-element":h.concat("like")},n)),e("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async getUserInformation(t,i){const s=this.mapView.map.portalItem.portal?.credential?.token;let e=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${t.attributes[i]}?f=json&returnUserLicensedItems=true`;s&&(e+=`&token=${s}`);const a=await fetch(e),h=await a.json();let n=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${h?.username??t.attributes[i]}/info/blob.png`;return h?.access&&s&&(n+=`?token=${s}`),h.userProfileUrl=n,h}async getFeatureSymbol(t){const i=document.createElement("div");return await this.symbolUtils.getDisplayedSymbol(t).then((async t=>{if(t&&await(this.symbolUtils?.renderPreviewHTML(t,{node:i})),i.children?.length){const t=i.children[0];if(t){const i=Number(t.getAttribute("height")),s=Number(t.getAttribute("width"));s>30?t.setAttribute("width","30"):s<19&&t.setAttribute("width","20"),t.setAttribute("viewBox",`0 0 ${s} ${i}`)}}})),i}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};c.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-padding{padding:10px 12px}.feature-list-popup-title-padding-reduced{padding:10px 0}.profile-img{margin:0 0.75rem;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:3px 10px;min-width:30px;display:flex;justify-content:center}";export{c as feature_list}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as e,h as i,H as s,g as a}from"./p-6eb37ed2.js";import{s as o,t as n,g as l,z as c}from"./p-68ec5c15.js";import{g as r}from"./p-d559f79c.js";import{s as h,a as d,c as p}from"./p-18f18ab3.js";import{N as u,c as f,d as b}from"./p-939bc1b4.js";import{o as m}from"./p-580a4537.js";import{c as g,s as v,d as y,u as k}from"./p-1a9a47a0.js";import{K as w}from"./p-9ab3df4f.js";import{g as x,l as C}from"./p-2058b5d9.js";import{a as _}from"./p-eb483242.js";import{P as z}from"./p-900fee65.js";import"./p-ff8343ec.js";import"./p-b39c5275.js";import"./p-acaae81d.js";import"./p-fe6f7734.js";import"./p-c638d28e.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-022c49af.js";import"./p-659678f1.js";import"./p-7c583516.js";
6
+ import{r as t,c as e,h as i,H as s,g as a}from"./p-6eb37ed2.js";import{s as o,t as n,g as l,z as c}from"./p-68ec5c15.js";import{g as r}from"./p-d559f79c.js";import{s as h,a as d,c as p}from"./p-18f18ab3.js";import{N as u,c as f,d as b}from"./p-939bc1b4.js";import{o as m}from"./p-580a4537.js";import{c as g,s as v,d as y,u as k}from"./p-1a9a47a0.js";import{K as w}from"./p-9ab3df4f.js";import{g as x,l as C}from"./p-2058b5d9.js";import{a as _}from"./p-eb483242.js";import{P as z}from"./p-5a473f0d.js";import"./p-ff8343ec.js";import"./p-b39c5275.js";import"./p-acaae81d.js";import"./p-fe6f7734.js";import"./p-c638d28e.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-022c49af.js";import"./p-659678f1.js";import"./p-7c583516.js";
7
7
  /*!
8
8
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
9
9
  * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.