@esri/solutions-components 0.10.14 → 0.10.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,7 +73,7 @@
73
73
  top: calc(100% - 100px);
74
74
  height: 100px;
75
75
  }
76
-
76
+
77
77
  .map-collapsed {
78
78
  height: 100%;
79
79
  top: 0;
@@ -83,12 +83,12 @@
83
83
  }
84
84
  </style>
85
85
 
86
- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css"/>
86
+ <link rel="stylesheet" href="https://jsdev.arcgis.com/4.31/esri/themes/light/main.css"/>
87
87
  <link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
88
88
  <link rel="stylesheet" href="../solutions-components.css" type="text/css">
89
89
  <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.8.2/calcite.css" />
90
90
 
91
- <script src="https://jsdev.arcgis.com/4.29/"></script>
91
+ <script src="https://jsdev.arcgis.com/4.31/"></script>
92
92
  <script type="module" src="../solutions-components.esm.js"></script>
93
93
 
94
94
  <script>
@@ -136,7 +136,7 @@
136
136
  // Set the locale before the JSAPI loads
137
137
  esriConfig.locale = locale;
138
138
  demo.lang = locale;
139
-
139
+
140
140
  //update the portalUrl if found in urlParams
141
141
  //esriConfig.portalUrl = "https://solutions.mapsdevext.arcgis.com";
142
142
  if (portal) {
@@ -151,8 +151,8 @@
151
151
  //id: "dda88d905a6748a5ab46bea5be795f33" // screening layers
152
152
  //id: "b5bdcb1e5d684dd3b21a2d44b8e4f928" //Popup content + like dislike
153
153
  //id: "d399ec39959a4aac8617ae4f05dd6785" //Arcade
154
- //id: "024e8a5e73a34c5aade9632d651c5750" //Attachments
155
- id: "ae6d5d1936e84ce7adde44c7a7908846" //like dislike
154
+ id: "4bb6641b18e94cfb9d895ed37b13418a" //Attachments
155
+ //id: "ae6d5d1936e84ce7adde44c7a7908846" //like dislike
156
156
  // id: "ce3dec81bf714d3bb71da9691ab686d1" //Filter
157
157
  }
158
158
  const webMap = new WebMap({
@@ -182,125 +182,75 @@
182
182
  demo.enableNewReports = true;
183
183
  demo.theme = "light";
184
184
  demo.reportSubmittedMessage = "Thank you! Your request was successfully submitted";
185
-
185
+
186
186
  //Set the zoomScale to be used when zooming to single point feature
187
187
  //demo.zoomToScale = 139596221; //World
188
188
  //demo.zoomToScale = 33800278;//Country
189
189
  //demo.zoomToScale = 4291772;//States
190
190
  demo.zoomToScale = 96610;//City
191
191
  //demo.zoomToScale = 3495; //Building
192
-
192
+
193
193
  //Set filter config
194
- demo.layerExpressions = [
195
- {
196
- id: "Requests_681",
197
- title: "Requests",
198
- operator: " AND ",
199
- expressions: [
200
- {
201
- definitionExpression: "OBJECTID > 690",
202
- id: 1701793260225,
203
- index: 0,
204
- name: "greater than 690",
205
- active: false
206
- },
207
- {
208
- id: 1654881457794,
209
- name: 'status',
210
- type: 'string',
211
- field: 'status'
212
- }
213
- ]
214
- },{
215
- id: "18f056682a4-layer-12",
216
- title: "PopUp with date in title",
217
- operator: " AND ",
218
- expressions: [
219
- {
220
- definitionExpression: "shrt > 0",
221
- id: 1901793260225,
222
- index: 0,
223
- name: "Like greater than 0",
224
- active: false
225
- }
226
- ]
227
- }
228
- ];
194
+ // demo.layerExpressions = [
195
+ // {
196
+ // id: "Requests_681",
197
+ // title: "Requests",
198
+ // operator: " AND ",
199
+ // expressions: [
200
+ // {
201
+ // definitionExpression: "OBJECTID > 690",
202
+ // id: 1701793260225,
203
+ // index: 0,
204
+ // name: "greater than 690",
205
+ // active: false
206
+ // },
207
+ // {
208
+ // id: 1654881457794,
209
+ // name: 'status',
210
+ // type: 'string',
211
+ // field: 'status'
212
+ // }
213
+ // ]
214
+ // },{
215
+ // id: "18f056682a4-layer-12",
216
+ // title: "PopUp with date in title",
217
+ // operator: " AND ",
218
+ // expressions: [
219
+ // {
220
+ // definitionExpression: "shrt > 0",
221
+ // id: 1901793260225,
222
+ // index: 0,
223
+ // name: "Like greater than 0",
224
+ // active: false
225
+ // }
226
+ // ]
227
+ // }
228
+ // ];
229
229
  //Set the reporting layer options, layers from this object with reporting set to true will only be shown in layer list
230
- //if all the layers from map should be considered for reporting then pass true for each layer
230
+ //if all the layers from map should be considered for reporting then pass true for each layer
231
231
  demo.reportingOptions = {
232
- "Requests_681":{
233
- reporting: true,
234
- comment: false,
235
- like: false,
236
- likeField: "Like_field",
237
- dislike: false,
238
- dislikeField: "Dislike_field",
239
- visible: false
240
- },
241
- "18cdb191817-layer-5": {
242
- reporting: true,
243
- comment: false,
244
- like: true,
245
- likeField: "Like_field",
246
- dislike: true,
247
- dislikeField: "Dislike_field",
248
- visible: false
232
+ "19055a4633a-layer-11": {
233
+ "visible": true,
234
+ "reporting": true,
235
+ "comment": true,
236
+ "like": false,
237
+ "dislike": false
249
238
  },
250
- "18f056682a4-layer-12":{
251
- reporting: true,
252
- comment: false,
253
- like: true,
254
- likeField: "shrt",
255
- dislike: false,
256
- dislikeField: "dislike_field",
257
- visible: true
239
+ "19055a2a831-layer-7": {
240
+ "visible": true,
241
+ "reporting": true,
242
+ "comment": false,
243
+ "like": false,
244
+ "dislike": false
258
245
  },
259
- "18f2a1562a5-layer-3": {
260
- reporting: true,
261
- comment: true,
262
- like: true,
263
- likeField: "like_field",
264
- dislike: true,
265
- dislikeField: "dislike_field",
266
- visible: true
267
- },
268
- "18f2a1562a7-layer-4": {
269
- reporting: true,
270
- comment: true,
271
- like: true,
272
- likeField: "like_field",
273
- dislike: true,
274
- dislikeField: "dislike_field",
275
- visible: true
276
- },
277
- "18f2a1562a7-layer-5": {
278
- reporting: false,
279
- comment: true,
280
- like: true,
281
- likeField: "like_field",
282
- dislike: true,
283
- dislikeField: "dislike_field",
284
- visible: true
285
- },
286
- "18f2a1562a8-layer-6": {
287
- reporting: true,
288
- comment: true,
289
- like: true,
290
- likeField: "like_field",
291
- dislike: true,
292
- dislikeField: "dislike_field",
293
- visible: true
294
- },
295
- "18f2a1562a8-layer-7": {
296
- reporting: true,
297
- comment: true,
298
- like: true,
299
- likeField: "like_field",
300
- dislike: true,
301
- dislikeField: "dislike_field"
246
+ "19055a2a735-layer-3": {
247
+ "visible": true,
248
+ "reporting": true,
249
+ "comment": false,
250
+ "like": false,
251
+ "dislike": false
302
252
  }
303
- }
253
+ };
304
254
  //Select reporting layers -
305
255
  //demo.layers = ['SE_field_mapping_9688', 'SE_field_mapping_5784', 'SE_field_mapping_1853']; //Se mapping
306
256
  //demo.layers = ['Three_Layers_nested_4042', 'SE_sort_2889', 'SE_sort_756']; //screening layers
@@ -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 v}from"./p-1a9a47a0.js";import{S as k}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",M="frame--retreating",D=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,[M]:"retreating"===t}},i("slot",{key:"5b97e4147abb053391f170f5e36bac4670934072"}))}get el(){return s(this)}};D.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 z=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(){v(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:k.actionBar}),i("slot",{key:"566fb396078d3eac17fbff69e0cd43fb5b8ca13e",name:"alerts",slot:k.alerts}),i("slot",{key:"88ced257238e369cd99250c9d5a93fa03746fbd5",name:"header-actions-start",slot:k.headerActionsStart}),i("slot",{key:"beab9f93af9deed383adc8250ec943b883e058b8",name:"header-actions-end",slot:k.headerActionsEnd}),i("slot",{key:"1f1c7579d1ac1085004b08d2f57ec8b9e0641e35",name:"header-content",slot:k.headerContent}),i("slot",{key:"3696e4a7e80db48581f438336007a1b63a201040",name:"header-menu-actions",slot:k.headerMenuActions}),i("slot",{key:"370e0817cbc13d7cf4c8adaccff8fe9d7c91c859",name:"fab",slot:k.fab}),i("slot",{key:"d55cc859cb1c9c6cc80a63521aad955f6e23d31c",name:"content-top",slot:k.contentTop}),i("slot",{key:"7cea1750cd59d1fdda66516c9b4c78884127dde5",name:"content-bottom",slot:k.contentBottom}),i("slot",{key:"d07ed2f97623023312cdb0a5a01b909286f34373",name:"footer-start",slot:k.footerStart}),i("slot",{key:"fdc209c1e77fd62cadaaad0ee576e71a1f0419d8",name:"footer",slot:k.footer}),i("slot",{key:"5348d32cc42b7fa3b07e4b5ef711863f6ce812bc",name:"footer-end",slot:k.footerEnd}),i("slot",{key:"bad7644787a3ad19ef40931fb38cfe9c18962b27",name:"footer-actions",slot:k.footerActions}),i("slot",{key:"97675398537cc86f41a219126e17bcf24cf4682b"}))))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};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([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 T=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:"aac8fd8fe4ba5d7fb67a2b74a86147e053c1b0b8"},i("calcite-loader",{key:"e440bd2e0f4cf5acf4fd6941ada508c8ac5a0380",class:this._editorLoading?"":"display-none",label:"",scale:"s"}),i("div",{key:"055a4e4b30b1fe24e0735257fa54fa9845cbaf2f",class:s,id:"feature-form"}),i("div",{key:"342847f06ba99ad3c9693026bc83a8ac18b6c05f",class:`search-widget ${t} ${s}`,id:"search-widget-ref"}),i("div",{key:"0acb837b4604d8d590bbfbcd738a3e09a099c362",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=>{console.log(`this._editor.viewModel.state: ${t}`),console.log(`this._editor.viewModel?.activeWorkflow?.type: ${this._editor.viewModel?.activeWorkflow?.type}`),"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=>{console.log(`this._editor.viewModel.featureTemplatesViewModel.state: ${t}`),console.log(`this._editor.viewModel?.activeWorkflow?.type: ${this._editor.viewModel?.activeWorkflow?.type}`),"ready"===t&&"create-features"!==this._editor.viewModel?.activeWorkflow?.type&&(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=>{console.log(`==============================this._editor.viewModel.state: ${t}`),"creating-features"===t&&(this._mapViewContainer?.classList?.replace("hide-map","show-map"),this._showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){return console.log("========================startCreate=============================="),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"]}}};T.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 H=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"]}}};H.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{D as calcite_flow,z as calcite_flow_item,T as create_feature,H as create_related_feature,V as feature_details,A as layer_list}