@esri/solutions-components 0.8.30 → 0.8.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-alert_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-flow_6.cjs.entry.js +58 -34
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +2 -2
- package/dist/cjs/feature-list.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{popupUtils-e3fa775b.js → popupUtils-9ca69f8c.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/create-feature/create-feature.js +13 -8
- package/dist/collection/components/create-related-feature/create-related-feature.css +4 -0
- package/dist/collection/components/create-related-feature/create-related-feature.js +52 -26
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +4 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +1 -1
- package/dist/collection/utils/popupUtils.js +1 -1
- package/dist/collection/utils/popupUtils.ts +1 -1
- package/dist/components/create-feature2.js +13 -8
- package/dist/components/create-related-feature2.js +57 -30
- package/dist/components/crowdsource-reporter.js +2 -2
- package/dist/components/popupUtils.js +1 -1
- package/dist/esm/calcite-alert_4.entry.js +1 -1
- package/dist/esm/calcite-flow_6.entry.js +58 -34
- package/dist/esm/crowdsource-reporter.entry.js +2 -2
- package/dist/esm/feature-list.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{popupUtils-17193415.js → popupUtils-8efd3cde.js} +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/p-2455bcb0.js +21 -0
- package/dist/solutions-components/{p-bb90a138.entry.js → p-3365a6de.entry.js} +2 -2
- package/dist/solutions-components/p-4ae34862.entry.js +17 -0
- package/dist/solutions-components/{p-16fb8296.entry.js → p-628874a6.entry.js} +1 -1
- package/dist/solutions-components/{p-2f7bfd8d.entry.js → p-90c3bc54.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/popupUtils.ts +1 -1
- package/dist/types/components/create-feature/create-feature.d.ts +1 -1
- package/dist/types/components/create-related-feature/create-related-feature.d.ts +19 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-2e23ac2c.js +0 -21
- package/dist/solutions-components/p-c21a6940.entry.js +0 -17
@@ -0,0 +1,21 @@
|
|
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{_ as t}from"./p-52dba022.js";import{l as i}from"./p-896c9644.js";
|
7
|
+
/** @license
|
8
|
+
* Copyright 2022 Esri
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/class l{async getPopupTitle(i,l){var o,s,n;this.arcade||await this._initModules();let e={};for(const[t,l]of Object.entries(i.attributes))e=Object.assign(Object.assign({},e),{[`{${t.toUpperCase()}}`]:l});const a=i.layer,r=this._removeTags(null===(o=null==a?void 0:a.popupTemplate)||void 0===o?void 0:o.title);if(r.includes("{expression/expr")&&null!=(null===(s=null==a?void 0:a.popupTemplate)||void 0===s?void 0:s.expressionInfos))for(let t=0;t<(null===(n=a.popupTemplate)||void 0===n?void 0:n.expressionInfos.length);t++){const o=a.popupTemplate.expressionInfos[t],s=this.arcade.createArcadeProfile("popup");try{const t=await this.arcade.createArcadeExecutor(o.expression,s),n=await t.executeAsync({$feature:i,$layer:a,$map:l});null==n&&""===n||(e[`{expression/${o.name}}`.toUpperCase()]=n)}catch(t){console.error(t);continue}}return a.popupTemplate.fieldInfos&&a.fields.forEach((l=>{const o=i.attributes[l.name],s=a.popupTemplate.fieldInfos.find((t=>t.fieldName.toLowerCase()===l.name.toLowerCase())),n=t(o,l.type,l.domain,null==s?void 0:s.format,this.intl);e[`{${l.name.toUpperCase()}}`]=null!=n?n:o})),null==r?void 0:r.replace(/{.*?}/g,(t=>null!=e[t.toUpperCase()]?e[t.toUpperCase()]:""))}_removeTags(t){return null==t||""===t?"":t.toString().replace(/(<([^>]+)>)/gi,"")}async _initModules(){const[t,l]=await i(["esri/arcade","esri/intl"]);this.arcade=t,this.intl=l}}export{l as P}
|
@@ -3,9 +3,9 @@
|
|
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 i,h as e,H as s,g as a}from"./p-6d753a3d.js";import{s as o,t as n,g as l,y as c}from"./p-67b26725.js";import{g as r}from"./p-e6e50975.js";import{s as d,a as h,c as p}from"./p-a25bbcc1.js";import{N as u,c as
|
6
|
+
import{r as t,c as i,h as e,H as s,g as a}from"./p-6d753a3d.js";import{s as o,t as n,g as l,y as c}from"./p-67b26725.js";import{g as r}from"./p-e6e50975.js";import{s as d,a as h,c as p}from"./p-a25bbcc1.js";import{N as u,c as b,d as f}from"./p-b5bfe190.js";import{o as m}from"./p-12c80030.js";import{c as v,s as g,d as y,u as w}from"./p-2e625f11.js";import{K as k}from"./p-37e40c37.js";import{g as x,l as z}from"./p-896c9644.js";import{a as C}from"./p-5aaa05ef.js";import{P as _}from"./p-2455bcb0.js";import"./p-b85be429.js";import"./p-db50226e.js";import"./p-f50a294b.js";import"./p-bfd3d428.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";import"./p-52dba022.js";import"./p-334e6394.js";import"./p-a230b270.js";import"./p-530b73ce.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/main/LICENSE.md for details.
|
10
10
|
* v2.8.2
|
11
|
-
*/const j={slow:14e3,medium:1e4,fast:6e3},W="container",q="container--queued",H="container--slotted-in-shell",D="queue-count",E="queue-count--active",S=class{constructor(e){t(this,e),this.calciteAlertBeforeClose=i(this,"calciteAlertBeforeClose",6),this.calciteAlertClose=i(this,"calciteAlertClose",6),this.calciteAlertBeforeOpen=i(this,"calciteAlertBeforeOpen",6),this.calciteAlertOpen=i(this,"calciteAlertOpen",6),this.calciteInternalAlertSync=i(this,"calciteInternalAlertSync",6),this.calciteInternalAlertRegister=i(this,"calciteInternalAlertRegister",6),this.autoCloseTimeoutId=null,this.totalOpenTime=0,this.totalHoverTime=0,this.openTransitionProp="opacity",this.setTransitionEl=t=>{this.transitionEl=t},this.closeAlert=()=>{this.autoCloseTimeoutId=null,this.queued=!1,this.open=!1,this.queue=this.queue.filter((t=>t!==this.el)),this.determineActiveAlert(),this.calciteInternalAlertSync.emit({queue:this.queue})},this.actionsEndSlotChangeHandler=t=>{this.hasEndActions=o(t)},this.handleMouseOver=()=>{window.clearTimeout(this.autoCloseTimeoutId),this.totalOpenTime=Date.now()-this.initialOpenTime,this.lastMouseOverBegin=Date.now()},this.handleMouseLeave=()=>{const t=Date.now()-this.lastMouseOverBegin,i=j[this.autoCloseDuration]-this.totalOpenTime+this.totalHoverTime;this.totalHoverTime=this.totalHoverTime?t+this.totalHoverTime:t,this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),i)},this.open=!1,this.autoClose=!1,this.autoCloseDuration="medium",this.kind="brand",this.icon=void 0,this.iconFlipRtl=!1,this.label=void 0,this.numberingSystem=void 0,this.placement="bottom",this.scale="m",this.messages=void 0,this.messageOverrides=void 0,this.slottedInShell=void 0,this.defaultMessages=void 0,this.effectiveLocale="",this.numberStringFormatter=new u,this.hasEndActions=!1,this.queue=[],this.queueLength=0,this.queued=!1}openHandler(){m(this),this.open&&!this.queued&&this.calciteInternalAlertRegister.emit(),this.open||(this.queue=this.queue.filter((t=>t!==this.el)),this.calciteInternalAlertSync.emit({queue:this.queue}))}onMessagesChange(){}updateDuration(){this.autoClose&&this.autoCloseTimeoutId&&(window.clearTimeout(this.autoCloseTimeoutId),this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),j[this.autoCloseDuration]))}connectedCallback(){f(this),v(this),this.open&&!this.queued&&this.calciteInternalAlertRegister.emit(),this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}async componentWillLoad(){d(this),await g(this),this.open&&m(this)}componentDidLoad(){h(this)}disconnectedCallback(){window.dispatchEvent(new CustomEvent("calciteInternalAlertUnregister",{detail:{alert:this.el}})),window.clearTimeout(this.autoCloseTimeoutId),window.clearTimeout(this.queueTimeout),b(this),y(this),this.slottedInShell=!1}render(){const{open:t,autoClose:i,label:a,placement:o,queued:l}=this,r=i?"alert":"alertdialog",d=!t,h=c(k,this.icon,this.kind),p=this.queueLength>1;return e(s,{key:"ea81bb8c414a682356d9c2a839df57b73fd4de1e","aria-hidden":n(d),"aria-label":a,"calcite-hydrated-hidden":d,role:r},e("div",{key:"1be63a6bf505158a2df208e6815944713cf61283",class:{[W]:!0,[q]:l,[`${W}--${o}`]:!0,[H]:this.slottedInShell},onPointerEnter:this.autoClose&&this.autoCloseTimeoutId?this.handleMouseOver:null,onPointerLeave:this.autoClose&&this.autoCloseTimeoutId?this.handleMouseLeave:null,ref:this.setTransitionEl},h&&this.renderIcon(h),e("div",{key:"7ba8590dc6b9f30a321b777a9eb13d12fe24257c",class:"text-container"},e("slot",{key:"d58da2c0c6348ccdfded0c374bd8d20fe9f137db",name:"title"}),e("slot",{key:"91638c47e6917271aa7c1171496bb409a6a944dd",name:"message"}),e("slot",{key:"15cc676155a80cc02534e47108478a8f5090a41c",name:"link"})),this.renderActionsEnd(),p?this.renderQueueCount():null,this.renderCloseButton(),t&&!l&&i?e("div",{class:"dismiss-progress"}):null))}renderCloseButton(){return e("button",{"aria-label":this.messages.close,class:"close",key:"close",onClick:this.closeAlert,type:"button",ref:t=>this.closeButton=t},e("calcite-icon",{icon:"x",scale:r(this.scale)}))}renderQueueCount(){const t=this.numberStringFormatter.numberFormatter.format(this.queueLength>2?this.queueLength-1:1);return e("div",{class:{[D]:!0,[E]:this.queueLength>1},key:"queue-count"},e("calcite-chip",{scale:this.scale,value:t},t))}renderActionsEnd(){return e("div",{class:"actions-end"},e("slot",{name:"actions-end",onSlotchange:this.actionsEndSlotChangeHandler}))}renderIcon(t){return e("div",{class:"icon"},e("calcite-icon",{flipRtl:this.iconFlipRtl,icon:t,scale:r(this.scale)}))}alertSync(t){this.queue!==t.detail.queue&&(this.queue=t.detail.queue),this.queueLength=this.queue.length,this.determineActiveAlert(),t.stopPropagation()}alertRegister(){this.open&&!this.queue.includes(this.el)&&(this.queued=!0,this.queue.push(this.el)),this.calciteInternalAlertSync.emit({queue:this.queue}),this.determineActiveAlert()}alertUnregister(t){const i=this.queue.filter((i=>i!==t.detail.alert));this.queue=i,window.dispatchEvent(new CustomEvent("calciteInternalAlertSync",{detail:{queue:i}}))}async setFocus(){await p(this);const t=l(this.el,{selector:"calcite-link"});if(this.closeButton||t)return t?t.setFocus():void(this.closeButton&&this.closeButton.focus())}effectiveLocaleChange(){w(this,this.effectiveLocale),this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}numberingSystemChange(){this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}determineActiveAlert(){var t;(null===(t=this.queue)||void 0===t?void 0:t[0])===this.el&&(this.openAlert(),this.autoClose&&!this.autoCloseTimeoutId&&(this.initialOpenTime=Date.now(),this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),j[this.autoCloseDuration])))}onBeforeOpen(){this.calciteAlertBeforeOpen.emit()}onOpen(){this.calciteAlertOpen.emit()}onBeforeClose(){this.calciteAlertBeforeClose.emit()}onClose(){this.calciteAlertClose.emit()}openAlert(){window.clearTimeout(this.queueTimeout),this.queueTimeout=window.setTimeout((()=>this.queued=!1),300)}static get assetsDirs(){return["assets"]}get el(){return a(this)}static get watchers(){return{open:["openHandler"],messageOverrides:["onMessagesChange"],autoCloseDuration:["updateDuration"],effectiveLocale:["effectiveLocaleChange"],numberingSystem:["numberingSystemChange"]}}};S.style=':host{--calcite-alert-edge-distance:2rem;--calcite-alert-dismiss-progress-background:var(--calcite-color-transparent-tint);display:block}.container{pointer-events:none;position:fixed;z-index:var(--calcite-z-index-toast);margin-inline:auto;margin-block:0px;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:-moz-min-content;min-inline-size:min-content;align-items:center;justify-content:center;background-color:var(--calcite-color-foreground-1);text-align:start;opacity:0;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius);border-block-start:0 solid transparent;border-inline:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3);inline-size:var(--calcite-alert-width);max-inline-size:calc(100% - var(--calcite-alert-edge-distance) * 2);transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out}.container--bottom,.container--top{inset-inline-end:0;inset-inline-start:0}.container[class*=bottom]{transform:translate3d(0, var(--calcite-alert-edge-distance), 0);inset-block-end:var(--calcite-alert-edge-distance)}.container[class*=top]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);inset-block-start:var(--calcite-alert-edge-distance)}.container[class*=start]{inset-inline-start:var(--calcite-alert-edge-distance);inset-inline-end:auto}.container[class*=end]{inset-inline-end:var(--calcite-alert-edge-distance);inset-inline-start:auto}.icon{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0px;margin-block:auto;margin-inline-end:auto;padding-inline-start:var(--calcite-alert-spacing-token-large)}.close{display:flex;cursor:pointer;align-items:center;justify-content:flex-end;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-color-text-3);outline:2px solid transparent;outline-offset:2px;-webkit-appearance:none;padding:var(--calcite-alert-spacing-token-large);outline-color:transparent}.close:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-color-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}.close:hover,.close:focus{background-color:var(--calcite-color-foreground-2);color:var(--calcite-color-text-1)}.close:active{background-color:var(--calcite-color-foreground-3)}.queue-count{visibility:hidden;display:flex;min-inline-size:-moz-min-content;min-inline-size:min-content;cursor:default;align-items:center;justify-content:space-around;align-self:stretch;overflow:hidden;background-color:var(--calcite-color-foreground-1);text-align:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-2);opacity:0;transition:background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start inset-size, opacity, outline-color, transform var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline:0 solid transparent;border-start-end-radius:0}.queue-count--active{visibility:visible;opacity:1}.dismiss-progress{position:absolute;display:block;inline-size:100%;overflow:hidden;inset-inline:0;inset-block-start:-2px;block-size:2px;border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}.dismiss-progress:after{position:absolute;inset-block-start:0px;display:block;block-size:2px;content:"";background-color:var(--calcite-alert-dismiss-progress-background);inset-inline-end:0}.actions-end{display:flex;align-self:stretch}.text-container{box-sizing:border-box;display:flex;min-inline-size:0px;flex:1 1 auto;flex-direction:column;overflow-wrap:break-word;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large) var(--calcite-alert-spacing-token-small)}.footer{position:relative;display:flex;inline-size:auto;justify-content:flex-end;align-self:stretch;padding-block-start:1px;block-size:inherit}:host([scale=s]){--calcite-alert-width:40em;--calcite-alert-spacing-token-small:0.5rem;--calcite-alert-spacing-token-large:0.75rem;--calcite-alert-footer-height:2rem;--calcite-alert-footer-divider-gap:0.125rem}:host([scale=s]) slot[name=title]::slotted(*),:host([scale=s]) *::slotted([slot=title]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) slot[name=message]::slotted(*),:host([scale=s]) *::slotted([slot=message]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) slot[name=link]::slotted(*),:host([scale=s]) *::slotted([slot=link]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .queue-count{margin-inline:0.5rem}:host([scale=s]) .container{--calcite-alert-min-height:3.5rem}:host([scale=m]){--calcite-alert-width:50em;--calcite-alert-spacing-token-small:0.75rem;--calcite-alert-spacing-token-large:1rem;--calcite-alert-footer-height:3rem;--calcite-alert-footer-divider-gap:0.25rem}:host([scale=m]) slot[name=title]::slotted(*),:host([scale=m]) *::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) slot[name=message]::slotted(*),:host([scale=m]) *::slotted([slot=message]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) slot[name=link]::slotted(*),:host([scale=m]) *::slotted([slot=link]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .queue-count{margin-inline:0.75rem}:host([scale=m]) .container{--calcite-alert-min-height:4.1875rem}:host([scale=l]){--calcite-alert-width:60em;--calcite-alert-spacing-token-small:1rem;--calcite-alert-spacing-token-large:1.25rem;--calcite-alert-footer-height:4rem;--calcite-alert-footer-divider-gap:0.5rem}:host([scale=l]) slot[name=title]::slotted(*),:host([scale=l]) *::slotted([slot=title]){margin-block-end:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) slot[name=message]::slotted(*),:host([scale=l]) *::slotted([slot=message]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) slot[name=link]::slotted(*),:host([scale=l]) *::slotted([slot=link]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .queue-count{margin-inline:1rem}:host([scale=l]) .container{--calcite-alert-min-height:5.625rem}:host([open]) .container:not(.container--queued){border-block-start-width:2px;opacity:1;pointer-events:initial}:host([open]) .container:not(.container--queued)[class*=bottom]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}:host([open]) .container:not(.container--queued)[class*=top]{transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}:host([auto-close])>.queue-count{border-inline-end:0 solid transparent}slot[name=title]::slotted(*),*::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}slot[name=message]::slotted(*),*::slotted([slot=message]){margin:0px;display:inline;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2);margin-inline-end:0.5rem}slot[name=link]::slotted(*),*::slotted([slot=link]){display:inline-flex;color:var(--calcite-color-text-link)}:host([kind=brand]) .container{border-block-start-color:var(--calcite-color-brand)}:host([kind=brand]) .container .icon{color:var(--calcite-color-brand)}:host([kind=info]) .container{border-block-start-color:var(--calcite-color-status-info)}:host([kind=info]) .container .icon{color:var(--calcite-color-status-info)}:host([kind=danger]) .container{border-block-start-color:var(--calcite-color-status-danger)}:host([kind=danger]) .container .icon{color:var(--calcite-color-status-danger)}:host([kind=success]) .container{border-block-start-color:var(--calcite-color-status-success)}:host([kind=success]) .container .icon{color:var(--calcite-color-status-success)}:host([kind=warning]) .container{border-block-start-color:var(--calcite-color-status-warning)}:host([kind=warning]) .container .icon{color:var(--calcite-color-status-warning)}:host([auto-close-duration=fast]) .dismiss-progress:after{animation:dismissProgress 6000ms ease-out}:host(:hover[auto-close-duration=fast]) .dismiss-progress:after{animation-play-state:paused}:host([auto-close-duration=medium]) .dismiss-progress:after{animation:dismissProgress 10000ms ease-out}:host(:hover[auto-close-duration=medium]) .dismiss-progress:after{animation-play-state:paused}:host([auto-close-duration=slow]) .dismiss-progress:after{animation:dismissProgress 14000ms ease-out}:host(:hover[auto-close-duration=slow]) .dismiss-progress:after{animation-play-state:paused}@keyframes dismissProgress{0%{inline-size:0px;opacity:0.75}100%{inline-size:100%;opacity:1}}.container--slotted-in-shell{position:absolute}:host([hidden]){display:none}[hidden]{display:none}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}';const A=class{constructor(e){t(this,e),this.editsComplete=i(this,"editsComplete",7),this.buttonType="button",this.disabled=!1,this.icon=void 0,this.ids=[],this.layer=void 0,this._confirmDelete=!1,this._deleteEndabled=!1,this._isDeleting=!1,this._supportsDelete=void 0,this._translations=void 0}async idsWatchHandler(){this._setDeleteEnabled()}async layerWatchHandler(){this._setDeleteEnabled()}async componentWillLoad(){await this._getTranslations()}render(){return e(s,{key:"87e080ea4203ab7fcb1313d8fa57a3d5c5d37885"},"button"===this.buttonType?e("calcite-button",{appearance:"outline",disabled:!this._deleteEndabled,id:"solutions-delete",kind:"danger",onClick:()=>this._delete(),width:"full"},this._translations.deleteCount.replace("{{n}}",this.ids.length.toString())):e("calcite-action",{appearance:"solid",compact:!0,disabled:!this._deleteEndabled,id:this.icon,onClick:()=>this._delete(),scale:"s",text:this._translations.delete},e("calcite-button",{appearance:"transparent",iconStart:this.icon,kind:"danger"},this._translations.delete)),this._deleteMessage())}async componentDidLoad(){this._setDeleteEnabled()}_setDeleteEnabled(){var t,i,e,s;this._supportsDelete=(null===(t=this.layer)||void 0===t?void 0:t.editingEnabled)&&(null===(s=null===(e=null===(i=this.layer)||void 0===i?void 0:i.capabilities)||void 0===e?void 0:e.operations)||void 0===s?void 0:s.supportsDelete),this._deleteEndabled=!this.disabled||this._supportsDelete&&this.ids.length>0}_delete(){this._confirmDelete=!0}_deleteMessage(){const t=1===this.ids.length?this._translations.confirmSingle:this._translations.confirmMultiple;return e("calcite-modal",{"aria-labelledby":"modal-title",class:"delete-modal",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},e("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),e("div",{slot:"content"},t),e("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),e("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this.ids.map((t=>({objectId:t})));await this.layer.applyEdits({deleteFeatures:t}),this._isDeleting=!1,this._deleteClosed(),this.editsComplete.emit("delete")}_deleteClosed(){this._confirmDelete=!1}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{ids:["idsWatchHandler"],layer:["layerWatchHandler"]}}};A.style=":host{display:block}.delete-modal{position:fixed}";const L=class{constructor(e){t(this,e),this.closeEdit=i(this,"closeEdit",7),this.editsComplete=i(this,"editsComplete",7),this.refreshGraphics=i(this,"refreshGraphics",7),this._shouldClose=!1,this.graphics=void 0,this.mapView=void 0,this.open=!1,this.graphicIndex=0,this._editorLoading=!1,this._translations=void 0}async graphicsWatchHandler(){0===this.graphics.length&&this.open&&await this._closeEdit(!0)}async openWatchHandler(t){var i;t&&(null===(i=this.graphics)||void 0===i?void 0:i.length)>0&&this.graphicIndex>-1&&(this._editorLoading=!0,await this._initEditorWidget(),this.graphicIndex>-1&&this.graphics.length>0&&this.open&&!this._shouldClose&&await this._startUpdate(),this._editorLoading=!1),t||await this._closeEdit(!0)}async featureSelectionChange(){this.open&&await this._closeEdit(!1)}async componentWillLoad(){await this._initModules(),await this._getTranslations()}async componentWillRender(){var t,i;(null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&(null===(i=this.graphics[0])||void 0===i?void 0:i.layer)&&(this._layer=this.graphics[0].layer,this._layerEditHandle&&this._layerEditHandle.remove(),this._layerEditHandle=this._layer.on("edits",(()=>{this.editsComplete.emit()})))}render(){var t;const i=!((null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&this.graphics[0]&&this.graphics[0].layer.editingEnabled),a=this._editorLoading?"display-none":"position-absolute",o=this._editorLoading?"":"display-none";return e(s,{key:"80acdd7d9b9441be28664ab60b7ad5d19c633bdd"},e("div",{key:"c8e41f2f7f3d5fcc4f49dd42b1f530c9e422cc8a",class:"position-absolute"},i?e("calcite-notice",{kind:"warning",open:!0,slot:"content-top",width:"full"},e("div",{slot:"message"},this._translations.enableEditing)):void 0,e("div",{key:"4b93fef902254d2a55e997bccdb4e16ee67c3c75",class:"position-absolute"},e("div",{key:"1794c5c246ab90b2915a15a15077ae7d82ec567c",class:a,id:"feature-form",ref:t=>this._editContainer=t}),e("calcite-loader",{key:"001162f8ae947cae915de33c16a116efd7795f75",class:o,label:"",scale:"s"}))))}async _initModules(){const[t,i]=await z(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}async _initEditorWidget(){if(this.mapView&&this.graphics&&this.graphics.length>0&&this.graphics[0]){this._editor&&this._editor.destroy();const t=document.createElement("div"),i=(await C(this.mapView)).map((t=>({layer:t,geometryUpdatesEnabled:!1})));this._editor=new this.Editor({allowedWorkflows:"update",view:this.mapView,layerInfos:i,visibleElements:{snappingControls:!1},container:t}),this._attachmentHandle&&this._activeWorkflowHandle&&(this._attachmentHandle.remove(),this._activeWorkflowHandle.remove()),this._attachmentHandle=this.reactiveUtils.when((()=>"adding-attachment"===this._editor.viewModel.state||"editing-attachment"===this._editor.viewModel.state||"creating-features"===this._editor.viewModel.state),(()=>{this._shouldClose=!1})),this._activeWorkflowHandle=this.reactiveUtils.watch((()=>{var t;return null===(t=this._editor.viewModel.activeWorkflow)||void 0===t?void 0:t.activeWorkflow}),(t=>{var i,e;"update-table-record"!==(null==t?void 0:t.type)&&"create-features"!==(null==t?void 0:t.type)||(this._shouldClose=!1),((null==t?void 0:t.type)||(null==t?void 0:t.hasPendingEdits)||this._editor.activeWorkflow)&&(null===(e=null===(i=this._editor)||void 0===i?void 0:i.activeWorkflow)||void 0===e?void 0:e.started)||(this.open=!1)})),this._editContainer.appendChild(t)}}async _closeEdit(t){var i,e,s,a;this._shouldClose=!0,t&&(null===(i=this._editor)||void 0===i?void 0:i.activeWorkflow)?((null===(s=null===(e=this._editor.activeWorkflow)||void 0===e?void 0:e.activeWorkflow)||void 0===s?void 0:s.hasPendingEdits)&&(await this._editor.activeWorkflow.reset(),await this._editor.cancelWorkflow()),this._editor.destroy()):this.graphicIndex>-1&&(null===(a=this.graphics)||void 0===a?void 0:a.length)>0&&this.refreshGraphics.emit(this.graphics),this._shouldClose=!1,this.closeEdit.emit()}async _startUpdate(){await this._editor.startUpdateWorkflowAtFeatureEdit(this.graphics[this.graphicIndex]),this._shouldClose=!0}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphics:["graphicsWatchHandler"],open:["openWatchHandler"]}}};L.style=":host{display:block}.padding-bottom-1{padding-bottom:1rem}.font-bold{font-weight:var(--calcite-font-weight-bold)}.font-500{font-weight:var(--calcite-font-weight-medium)}.font-italic{font-style:italic}#feature-form{--calcite-color-background:none;padding-top:0px}.padding-sides-bottom-1{padding:0 1rem 1rem 1rem}.position-relative{position:relative}.esri-editor__prompt--danger{position:relative !important;width:100% !important;background-color:var(--calcite-color-foreground-1) !important}.esri-feature__content-node{background-color:var(--calcite-color-foreground-1) !important}.esri-editor__panel-toolbar{display:none !important}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}";const M=class{constructor(e){t(this,e),this.popupClosed=i(this,"popupClosed",7),this.selectionChanged=i(this,"selectionChanged",7),this._featuresNodeId="features-node"+(new Date).getMilliseconds().toString(),this.graphics=void 0,this.isLoading=!1,this.isMobile=void 0,this.mapView=void 0,this.allowEditing=!0,this.highlightEnabled=!0,this.paginationEnabled=!0,this.position="absolute",this._alertOpen=!1,this._count="",this._editRecordOpen=!1,this._mobileTitle="",this._showListView=!1,this._translations=void 0}async graphicsWatchHandler(){await this.setGraphics()}async isMobileWatchHandler(){await this._initFeaturesWidget()}async mapViewWatchHandler(){return await this._initFeaturesWidget()}async getSelectedFeature(){return this._features.selectedFeature}async refresh(){await this.setGraphics()}async back(){this._features.previous(),this._count=this._getCount()}async next(){this._features.next(),this._count=this._getCount()}async toggleListView(){this._showListView=!this._showListView;const t=this._features.selectedFeatureIndex;this._features.open({features:this.graphics,featureMenuOpen:this._showListView}),this._features.selectedFeatureIndex=t}async updateCurrentGraphic(t){this._features.selectedFeatureWidget.graphic=t}async closeEdit(){this._editRecordOpen=!1}async layerSelectionChange(){var t;this._showListView=!1,(null===(t=this._features)||void 0===t?void 0:t.viewModel)&&(this._features.viewModel.featureMenuOpen=!1,this._features.close())}async refreshGraphics(t){this.graphics=[...t.detail]}async componentWillLoad(){await this._initModules(),await this._getTranslations(),this._popupUtils=new _}async componentDidLoad(){var t;(null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&await this.setGraphics()}render(){var t,i,a,o,n,l,c,r,d;const h=this.isLoading?"":"display-none",p=this.isLoading||this._editRecordOpen?"visibility-hidden":"position-absolute",u=!this.isLoading&&this._editRecordOpen?"position-absolute":"display-none",f=!this.isLoading&&this._editRecordOpen||this._showListView?"display-none":"",b=(null===(i=null===(t=this._features)||void 0===t?void 0:t.features)||void 0===i?void 0:i.length)<2,m=this.isMobile?"display-none":"",v=null===(o=null===(a=this._features)||void 0===a?void 0:a.selectedFeature)||void 0===o?void 0:o.getObjectId(),g=parseInt(null==v?void 0:v.toString(),10)>-1?[v]:[],y=(null===(n=this._layer)||void 0===n?void 0:n.editingEnabled)&&(null===(r=null===(c=null===(l=this._layer)||void 0===l?void 0:l.capabilities)||void 0===c?void 0:c.operations)||void 0===r?void 0:r.supportsDelete);return e(s,{key:"ac9c78b064154a666a50e7e8540f13bd541c4d37"},e("calcite-shell",{key:"e12b6fd8ac5f92282899edceb5818764fb543301",style:{position:this.position}},this._getHeader(),e("calcite-loader",{key:"e73db3c6f71cddf497cb20e1f59e9f1d8b1ecdd6",class:h,label:this._translations.fetchingData}),e("div",{key:"ab1913d90206219978d425a45f312da3e73bcca8",class:"esri-widget feature-node "+p,id:this._featuresNodeId}),e("div",{key:"67242dfb2b219e71a135c88d9d5e2fd40b083226",class:`${f} width-100`,slot:"footer"},this.allowEditing&&e("div",{key:"25ee3d9374a5ce97c4fcd672b1f78315d1294719",class:"display-flex top-border padding-1-2"},e("calcite-button",{key:"840e3b4ae075fbfd7836f2757128e2cfe9f267e3",appearance:"solid",id:"solutions-edit",onClick:()=>this._openEditRecord(),width:"full"},this._translations.edit),this.isMobile&&y?e("delete-button",{class:"padding-inline-start-1 width-100",id:"solutions-delete",ids:g,layer:this._layer,onEditsComplete:()=>this._closePopup()}):void 0,e("calcite-tooltip",{key:"747436c3815e94976c2838777a26185c9cb7ab28",placement:"bottom","reference-element":"solutions-edit"},e("span",{key:"d40dbe85eddaf99acc522f305960ce59c16a8b1f"},this._translations.edit)),this.isMobile?e("calcite-tooltip",{placement:"bottom","reference-element":"solutions-delete"},e("span",null,this._translations.delete)):void 0),this.paginationEnabled&&!b&&e("div",{key:"9a1b1e5d7e4432f6b2cd80f77a49f50b1910117f",class:`display-flex padding-1-2 button-container top-border ${m}`},e("div",{key:"9b6fd66023b514ff996107ade3af93415f1353f1"},e("calcite-button",{key:"823bcbe1a3b592344972e6ef39fd5088ab6197fa",appearance:"transparent",disabled:b,iconStart:"chevron-left",id:"solutions-back",onClick:()=>this._back(),width:"full"}),e("calcite-tooltip",{key:"f547487c9eae179e0c65015a24432c936de2ceca",placement:"top","reference-element":"solutions-back"},e("span",{key:"f6f352416103008acc20238efe7e7714fca8d05e"},this._translations.back))),e("calcite-action",{key:"799e06b8af5df338b920ddc578fa349de469e786",class:"pagination-action",onClick:()=>this._toggleListView(),scale:"s",text:"",textEnabled:!0},e("span",{key:"adee5b6b5149dbb4c1d6136c1314db89a04e8913",class:"pagination-count"},this._count)),e("div",{key:"87f181c53ad1806a9831d01b54fdd51434a5a4c2"},e("calcite-button",{key:"a4612a6f0d9b6a9412e60022599cba536cd4f623",appearance:"transparent",disabled:b,iconStart:"chevron-right",id:"solutions-next",onClick:()=>this._next(),width:"full"}),e("calcite-tooltip",{key:"613849a34a568fe8df2abe8b1813070cb7a54633",placement:"top","reference-element":"solutions-next"},e("span",{key:"35a2e621ce4b3bccb2b859e961db1065d619b2d9"},this._translations.next))))),e("edit-card",{key:"a2054fc21fc09dbffc47e1a7617a4b91b29d26fd",class:u,graphicIndex:null===(d=this._features)||void 0===d?void 0:d.selectedFeatureIndex,graphics:this.graphics,mapView:this.mapView,open:this._editRecordOpen}),e("calcite-alert",{key:"ec0fd6540b21987c80fe2035efa96d197c1e6cec",icon:"layer-broken",kind:"warning",label:"",onCalciteAlertClose:()=>this._alertClosed(),open:this._alertOpen,placement:"top"},e("div",{key:"721a363423ec61a9645b003a7d53849137fe1b82",slot:"title"},this._translations.editDisabled),e("div",{key:"143e9ff06f5363682e8b9e1976fdbfdd1b56f2a9",slot:"message"},this._translations.enableEditing))))}async _initModules(){const[t,i]=await z(["esri/widgets/Features","esri/core/reactiveUtils"]);this.Features=t,this.reactiveUtils=i}async setGraphics(){var t;this._features||await this._initFeaturesWidget(),this.graphics.length>0?(this._layer=null===(t=this.graphics[0])||void 0===t?void 0:t.layer,this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._mobileTitle=await this._popupUtils.getPopupTitle(this.graphics[0],this.mapView.map),this._features.open({features:this.graphics})):(this._features.clear(),this._features.close()),this._count=this._getCount()}async _initFeaturesWidget(){var t;return void 0!==this.isMobile?await(null===(t=this.mapView)||void 0===t?void 0:t.when((()=>{this._features?(this._features.view=this.mapView,this._features.visibleElements.actionBar=!1,this._features.visibleElements.closeButton=!1,this._features.visibleElements.heading=!this.isMobile):(this._features=new this.Features({view:this.mapView,container:this._featuresNodeId,visibleElements:{actionBar:!1,closeButton:!1,heading:!this.isMobile}}),this._features.viewModel.highlightEnabled=this.highlightEnabled,this.reactiveUtils.watch((()=>this._features.viewModel.featureMenuOpen),(t=>{this._count=this._getCount(),t||(this._showListView=t)})),this.reactiveUtils.watch((()=>this._features.selectedFeatureIndex),(t=>{t>-1&&this.selectionChanged.emit({selectedFeature:[this._features.selectedFeature],selectedFeatureIndex:this._features.selectedFeatureIndex})})))}))):Promise.resolve()}_getHeader(){return this.isMobile&&!this._editRecordOpen?e("calcite-panel",{class:"border-width-0",slot:"header"},e("calcite-action",{class:"end-border",icon:"chevron-left",iconFlipRtl:!0,onClick:()=>this._closePopup(),scale:"s",slot:"header-actions-start",text:""}),e("span",{class:"font-bold",slot:"header-content"},this._mobileTitle)):void 0}_closePopup(){this.popupClosed.emit()}_alertClosed(){this._alertOpen=!1}_openEditRecord(){this._editEnabled?this._editRecordOpen=!0:this._alertOpen=!0}_back(){this._features.previous(),this._count=this._getCount()}_next(){this._features.next(),this._count=this._getCount()}_getCount(){var t,i,e;const s=((null===(t=this._features)||void 0===t?void 0:t.viewModel.selectedFeatureIndex)+1).toString(),a=null===(e=null===(i=this._features)||void 0===i?void 0:i.features)||void 0===e?void 0:e.length.toString();return this._translations.indexOfTotal.replace("{{index}}",s).replace("{{total}}",a)}_toggleListView(){this._showListView=!this._showListView;const t=this._features.selectedFeatureIndex;this._features.open({features:this.graphics,featureMenuOpen:this._showListView}),this._features.selectedFeatureIndex=t}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphics:["graphicsWatchHandler"],isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};M.style=":host{display:block;--calcite-label-margin-bottom:0}.padding-1-2{padding:0.5rem}.display-none{display:none !important}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.feature-node{position:relative !important}.feature-node .esri-features__footer{display:none !important}.button-container{justify-content:center;align-items:center}.top-border{border-top:1px solid var(--calcite-color-border-1)}.width-100{width:100%}.esri-features__container{padding:0.5rem !important;background-color:var(--calcite-color-foreground-1) !important;height:100% !important}.overflow-hidden{overflow:hidden}.height-40{height:40px}.end-border{border-inline-end:1px solid var(--calcite-color-border-1)}.font-bold{font-weight:bold}.visibility-hidden{visibility:hidden;height:0px}.padding-inline-start-1{padding-inline-start:1rem}.border-width-0{border-width:0px}.pagination-action{position:relative;left:3px}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}";export{S as calcite_alert,A as delete_button,L as edit_card,M as info_card}
|
11
|
+
*/const j={slow:14e3,medium:1e4,fast:6e3},W="container",q="container--queued",H="container--slotted-in-shell",D="queue-count",E="queue-count--active",S=class{constructor(e){t(this,e),this.calciteAlertBeforeClose=i(this,"calciteAlertBeforeClose",6),this.calciteAlertClose=i(this,"calciteAlertClose",6),this.calciteAlertBeforeOpen=i(this,"calciteAlertBeforeOpen",6),this.calciteAlertOpen=i(this,"calciteAlertOpen",6),this.calciteInternalAlertSync=i(this,"calciteInternalAlertSync",6),this.calciteInternalAlertRegister=i(this,"calciteInternalAlertRegister",6),this.autoCloseTimeoutId=null,this.totalOpenTime=0,this.totalHoverTime=0,this.openTransitionProp="opacity",this.setTransitionEl=t=>{this.transitionEl=t},this.closeAlert=()=>{this.autoCloseTimeoutId=null,this.queued=!1,this.open=!1,this.queue=this.queue.filter((t=>t!==this.el)),this.determineActiveAlert(),this.calciteInternalAlertSync.emit({queue:this.queue})},this.actionsEndSlotChangeHandler=t=>{this.hasEndActions=o(t)},this.handleMouseOver=()=>{window.clearTimeout(this.autoCloseTimeoutId),this.totalOpenTime=Date.now()-this.initialOpenTime,this.lastMouseOverBegin=Date.now()},this.handleMouseLeave=()=>{const t=Date.now()-this.lastMouseOverBegin,i=j[this.autoCloseDuration]-this.totalOpenTime+this.totalHoverTime;this.totalHoverTime=this.totalHoverTime?t+this.totalHoverTime:t,this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),i)},this.open=!1,this.autoClose=!1,this.autoCloseDuration="medium",this.kind="brand",this.icon=void 0,this.iconFlipRtl=!1,this.label=void 0,this.numberingSystem=void 0,this.placement="bottom",this.scale="m",this.messages=void 0,this.messageOverrides=void 0,this.slottedInShell=void 0,this.defaultMessages=void 0,this.effectiveLocale="",this.numberStringFormatter=new u,this.hasEndActions=!1,this.queue=[],this.queueLength=0,this.queued=!1}openHandler(){m(this),this.open&&!this.queued&&this.calciteInternalAlertRegister.emit(),this.open||(this.queue=this.queue.filter((t=>t!==this.el)),this.calciteInternalAlertSync.emit({queue:this.queue}))}onMessagesChange(){}updateDuration(){this.autoClose&&this.autoCloseTimeoutId&&(window.clearTimeout(this.autoCloseTimeoutId),this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),j[this.autoCloseDuration]))}connectedCallback(){b(this),v(this),this.open&&!this.queued&&this.calciteInternalAlertRegister.emit(),this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}async componentWillLoad(){d(this),await g(this),this.open&&m(this)}componentDidLoad(){h(this)}disconnectedCallback(){window.dispatchEvent(new CustomEvent("calciteInternalAlertUnregister",{detail:{alert:this.el}})),window.clearTimeout(this.autoCloseTimeoutId),window.clearTimeout(this.queueTimeout),f(this),y(this),this.slottedInShell=!1}render(){const{open:t,autoClose:i,label:a,placement:o,queued:l}=this,r=i?"alert":"alertdialog",d=!t,h=c(k,this.icon,this.kind),p=this.queueLength>1;return e(s,{key:"ea81bb8c414a682356d9c2a839df57b73fd4de1e","aria-hidden":n(d),"aria-label":a,"calcite-hydrated-hidden":d,role:r},e("div",{key:"1be63a6bf505158a2df208e6815944713cf61283",class:{[W]:!0,[q]:l,[`${W}--${o}`]:!0,[H]:this.slottedInShell},onPointerEnter:this.autoClose&&this.autoCloseTimeoutId?this.handleMouseOver:null,onPointerLeave:this.autoClose&&this.autoCloseTimeoutId?this.handleMouseLeave:null,ref:this.setTransitionEl},h&&this.renderIcon(h),e("div",{key:"7ba8590dc6b9f30a321b777a9eb13d12fe24257c",class:"text-container"},e("slot",{key:"d58da2c0c6348ccdfded0c374bd8d20fe9f137db",name:"title"}),e("slot",{key:"91638c47e6917271aa7c1171496bb409a6a944dd",name:"message"}),e("slot",{key:"15cc676155a80cc02534e47108478a8f5090a41c",name:"link"})),this.renderActionsEnd(),p?this.renderQueueCount():null,this.renderCloseButton(),t&&!l&&i?e("div",{class:"dismiss-progress"}):null))}renderCloseButton(){return e("button",{"aria-label":this.messages.close,class:"close",key:"close",onClick:this.closeAlert,type:"button",ref:t=>this.closeButton=t},e("calcite-icon",{icon:"x",scale:r(this.scale)}))}renderQueueCount(){const t=this.numberStringFormatter.numberFormatter.format(this.queueLength>2?this.queueLength-1:1);return e("div",{class:{[D]:!0,[E]:this.queueLength>1},key:"queue-count"},e("calcite-chip",{scale:this.scale,value:t},t))}renderActionsEnd(){return e("div",{class:"actions-end"},e("slot",{name:"actions-end",onSlotchange:this.actionsEndSlotChangeHandler}))}renderIcon(t){return e("div",{class:"icon"},e("calcite-icon",{flipRtl:this.iconFlipRtl,icon:t,scale:r(this.scale)}))}alertSync(t){this.queue!==t.detail.queue&&(this.queue=t.detail.queue),this.queueLength=this.queue.length,this.determineActiveAlert(),t.stopPropagation()}alertRegister(){this.open&&!this.queue.includes(this.el)&&(this.queued=!0,this.queue.push(this.el)),this.calciteInternalAlertSync.emit({queue:this.queue}),this.determineActiveAlert()}alertUnregister(t){const i=this.queue.filter((i=>i!==t.detail.alert));this.queue=i,window.dispatchEvent(new CustomEvent("calciteInternalAlertSync",{detail:{queue:i}}))}async setFocus(){await p(this);const t=l(this.el,{selector:"calcite-link"});if(this.closeButton||t)return t?t.setFocus():void(this.closeButton&&this.closeButton.focus())}effectiveLocaleChange(){w(this,this.effectiveLocale),this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}numberingSystemChange(){this.numberStringFormatter.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,signDisplay:"always"}}determineActiveAlert(){var t;(null===(t=this.queue)||void 0===t?void 0:t[0])===this.el&&(this.openAlert(),this.autoClose&&!this.autoCloseTimeoutId&&(this.initialOpenTime=Date.now(),this.autoCloseTimeoutId=window.setTimeout((()=>this.closeAlert()),j[this.autoCloseDuration])))}onBeforeOpen(){this.calciteAlertBeforeOpen.emit()}onOpen(){this.calciteAlertOpen.emit()}onBeforeClose(){this.calciteAlertBeforeClose.emit()}onClose(){this.calciteAlertClose.emit()}openAlert(){window.clearTimeout(this.queueTimeout),this.queueTimeout=window.setTimeout((()=>this.queued=!1),300)}static get assetsDirs(){return["assets"]}get el(){return a(this)}static get watchers(){return{open:["openHandler"],messageOverrides:["onMessagesChange"],autoCloseDuration:["updateDuration"],effectiveLocale:["effectiveLocaleChange"],numberingSystem:["numberingSystemChange"]}}};S.style=':host{--calcite-alert-edge-distance:2rem;--calcite-alert-dismiss-progress-background:var(--calcite-color-transparent-tint);display:block}.container{pointer-events:none;position:fixed;z-index:var(--calcite-z-index-toast);margin-inline:auto;margin-block:0px;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:-moz-min-content;min-inline-size:min-content;align-items:center;justify-content:center;background-color:var(--calcite-color-foreground-1);text-align:start;opacity:0;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius);border-block-start:0 solid transparent;border-inline:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3);inline-size:var(--calcite-alert-width);max-inline-size:calc(100% - var(--calcite-alert-edge-distance) * 2);transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out}.container--bottom,.container--top{inset-inline-end:0;inset-inline-start:0}.container[class*=bottom]{transform:translate3d(0, var(--calcite-alert-edge-distance), 0);inset-block-end:var(--calcite-alert-edge-distance)}.container[class*=top]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);inset-block-start:var(--calcite-alert-edge-distance)}.container[class*=start]{inset-inline-start:var(--calcite-alert-edge-distance);inset-inline-end:auto}.container[class*=end]{inset-inline-end:var(--calcite-alert-edge-distance);inset-inline-start:auto}.icon{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0px;margin-block:auto;margin-inline-end:auto;padding-inline-start:var(--calcite-alert-spacing-token-large)}.close{display:flex;cursor:pointer;align-items:center;justify-content:flex-end;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-color-text-3);outline:2px solid transparent;outline-offset:2px;-webkit-appearance:none;padding:var(--calcite-alert-spacing-token-large);outline-color:transparent}.close:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-color-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}.close:hover,.close:focus{background-color:var(--calcite-color-foreground-2);color:var(--calcite-color-text-1)}.close:active{background-color:var(--calcite-color-foreground-3)}.queue-count{visibility:hidden;display:flex;min-inline-size:-moz-min-content;min-inline-size:min-content;cursor:default;align-items:center;justify-content:space-around;align-self:stretch;overflow:hidden;background-color:var(--calcite-color-foreground-1);text-align:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-2);opacity:0;transition:background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start inset-size, opacity, outline-color, transform var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline:0 solid transparent;border-start-end-radius:0}.queue-count--active{visibility:visible;opacity:1}.dismiss-progress{position:absolute;display:block;inline-size:100%;overflow:hidden;inset-inline:0;inset-block-start:-2px;block-size:2px;border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}.dismiss-progress:after{position:absolute;inset-block-start:0px;display:block;block-size:2px;content:"";background-color:var(--calcite-alert-dismiss-progress-background);inset-inline-end:0}.actions-end{display:flex;align-self:stretch}.text-container{box-sizing:border-box;display:flex;min-inline-size:0px;flex:1 1 auto;flex-direction:column;overflow-wrap:break-word;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large) var(--calcite-alert-spacing-token-small)}.footer{position:relative;display:flex;inline-size:auto;justify-content:flex-end;align-self:stretch;padding-block-start:1px;block-size:inherit}:host([scale=s]){--calcite-alert-width:40em;--calcite-alert-spacing-token-small:0.5rem;--calcite-alert-spacing-token-large:0.75rem;--calcite-alert-footer-height:2rem;--calcite-alert-footer-divider-gap:0.125rem}:host([scale=s]) slot[name=title]::slotted(*),:host([scale=s]) *::slotted([slot=title]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) slot[name=message]::slotted(*),:host([scale=s]) *::slotted([slot=message]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) slot[name=link]::slotted(*),:host([scale=s]) *::slotted([slot=link]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .queue-count{margin-inline:0.5rem}:host([scale=s]) .container{--calcite-alert-min-height:3.5rem}:host([scale=m]){--calcite-alert-width:50em;--calcite-alert-spacing-token-small:0.75rem;--calcite-alert-spacing-token-large:1rem;--calcite-alert-footer-height:3rem;--calcite-alert-footer-divider-gap:0.25rem}:host([scale=m]) slot[name=title]::slotted(*),:host([scale=m]) *::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) slot[name=message]::slotted(*),:host([scale=m]) *::slotted([slot=message]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) slot[name=link]::slotted(*),:host([scale=m]) *::slotted([slot=link]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .queue-count{margin-inline:0.75rem}:host([scale=m]) .container{--calcite-alert-min-height:4.1875rem}:host([scale=l]){--calcite-alert-width:60em;--calcite-alert-spacing-token-small:1rem;--calcite-alert-spacing-token-large:1.25rem;--calcite-alert-footer-height:4rem;--calcite-alert-footer-divider-gap:0.5rem}:host([scale=l]) slot[name=title]::slotted(*),:host([scale=l]) *::slotted([slot=title]){margin-block-end:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) slot[name=message]::slotted(*),:host([scale=l]) *::slotted([slot=message]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) slot[name=link]::slotted(*),:host([scale=l]) *::slotted([slot=link]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .queue-count{margin-inline:1rem}:host([scale=l]) .container{--calcite-alert-min-height:5.625rem}:host([open]) .container:not(.container--queued){border-block-start-width:2px;opacity:1;pointer-events:initial}:host([open]) .container:not(.container--queued)[class*=bottom]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}:host([open]) .container:not(.container--queued)[class*=top]{transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}:host([auto-close])>.queue-count{border-inline-end:0 solid transparent}slot[name=title]::slotted(*),*::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}slot[name=message]::slotted(*),*::slotted([slot=message]){margin:0px;display:inline;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2);margin-inline-end:0.5rem}slot[name=link]::slotted(*),*::slotted([slot=link]){display:inline-flex;color:var(--calcite-color-text-link)}:host([kind=brand]) .container{border-block-start-color:var(--calcite-color-brand)}:host([kind=brand]) .container .icon{color:var(--calcite-color-brand)}:host([kind=info]) .container{border-block-start-color:var(--calcite-color-status-info)}:host([kind=info]) .container .icon{color:var(--calcite-color-status-info)}:host([kind=danger]) .container{border-block-start-color:var(--calcite-color-status-danger)}:host([kind=danger]) .container .icon{color:var(--calcite-color-status-danger)}:host([kind=success]) .container{border-block-start-color:var(--calcite-color-status-success)}:host([kind=success]) .container .icon{color:var(--calcite-color-status-success)}:host([kind=warning]) .container{border-block-start-color:var(--calcite-color-status-warning)}:host([kind=warning]) .container .icon{color:var(--calcite-color-status-warning)}:host([auto-close-duration=fast]) .dismiss-progress:after{animation:dismissProgress 6000ms ease-out}:host(:hover[auto-close-duration=fast]) .dismiss-progress:after{animation-play-state:paused}:host([auto-close-duration=medium]) .dismiss-progress:after{animation:dismissProgress 10000ms ease-out}:host(:hover[auto-close-duration=medium]) .dismiss-progress:after{animation-play-state:paused}:host([auto-close-duration=slow]) .dismiss-progress:after{animation:dismissProgress 14000ms ease-out}:host(:hover[auto-close-duration=slow]) .dismiss-progress:after{animation-play-state:paused}@keyframes dismissProgress{0%{inline-size:0px;opacity:0.75}100%{inline-size:100%;opacity:1}}.container--slotted-in-shell{position:absolute}:host([hidden]){display:none}[hidden]{display:none}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}';const A=class{constructor(e){t(this,e),this.editsComplete=i(this,"editsComplete",7),this.buttonType="button",this.disabled=!1,this.icon=void 0,this.ids=[],this.layer=void 0,this._confirmDelete=!1,this._deleteEndabled=!1,this._isDeleting=!1,this._supportsDelete=void 0,this._translations=void 0}async idsWatchHandler(){this._setDeleteEnabled()}async layerWatchHandler(){this._setDeleteEnabled()}async componentWillLoad(){await this._getTranslations()}render(){return e(s,{key:"87e080ea4203ab7fcb1313d8fa57a3d5c5d37885"},"button"===this.buttonType?e("calcite-button",{appearance:"outline",disabled:!this._deleteEndabled,id:"solutions-delete",kind:"danger",onClick:()=>this._delete(),width:"full"},this._translations.deleteCount.replace("{{n}}",this.ids.length.toString())):e("calcite-action",{appearance:"solid",compact:!0,disabled:!this._deleteEndabled,id:this.icon,onClick:()=>this._delete(),scale:"s",text:this._translations.delete},e("calcite-button",{appearance:"transparent",iconStart:this.icon,kind:"danger"},this._translations.delete)),this._deleteMessage())}async componentDidLoad(){this._setDeleteEnabled()}_setDeleteEnabled(){var t,i,e,s;this._supportsDelete=(null===(t=this.layer)||void 0===t?void 0:t.editingEnabled)&&(null===(s=null===(e=null===(i=this.layer)||void 0===i?void 0:i.capabilities)||void 0===e?void 0:e.operations)||void 0===s?void 0:s.supportsDelete),this._deleteEndabled=!this.disabled||this._supportsDelete&&this.ids.length>0}_delete(){this._confirmDelete=!0}_deleteMessage(){const t=1===this.ids.length?this._translations.confirmSingle:this._translations.confirmMultiple;return e("calcite-modal",{"aria-labelledby":"modal-title",class:"delete-modal",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},e("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),e("div",{slot:"content"},t),e("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),e("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this.ids.map((t=>({objectId:t})));await this.layer.applyEdits({deleteFeatures:t}),this._isDeleting=!1,this._deleteClosed(),this.editsComplete.emit("delete")}_deleteClosed(){this._confirmDelete=!1}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{ids:["idsWatchHandler"],layer:["layerWatchHandler"]}}};A.style=":host{display:block}.delete-modal{position:fixed}";const L=class{constructor(e){t(this,e),this.closeEdit=i(this,"closeEdit",7),this.editsComplete=i(this,"editsComplete",7),this.refreshGraphics=i(this,"refreshGraphics",7),this._shouldClose=!1,this.graphics=void 0,this.mapView=void 0,this.open=!1,this.graphicIndex=0,this._editorLoading=!1,this._translations=void 0}async graphicsWatchHandler(){0===this.graphics.length&&this.open&&await this._closeEdit(!0)}async openWatchHandler(t){var i;t&&(null===(i=this.graphics)||void 0===i?void 0:i.length)>0&&this.graphicIndex>-1&&(this._editorLoading=!0,await this._initEditorWidget(),this.graphicIndex>-1&&this.graphics.length>0&&this.open&&!this._shouldClose&&await this._startUpdate(),this._editorLoading=!1),t||await this._closeEdit(!0)}async featureSelectionChange(){this.open&&await this._closeEdit(!1)}async componentWillLoad(){await this._initModules(),await this._getTranslations()}async componentWillRender(){var t,i;(null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&(null===(i=this.graphics[0])||void 0===i?void 0:i.layer)&&(this._layer=this.graphics[0].layer,this._layerEditHandle&&this._layerEditHandle.remove(),this._layerEditHandle=this._layer.on("edits",(()=>{this.editsComplete.emit()})))}render(){var t;const i=!((null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&this.graphics[0]&&this.graphics[0].layer.editingEnabled),a=this._editorLoading?"display-none":"position-absolute",o=this._editorLoading?"":"display-none";return e(s,{key:"80acdd7d9b9441be28664ab60b7ad5d19c633bdd"},e("div",{key:"c8e41f2f7f3d5fcc4f49dd42b1f530c9e422cc8a",class:"position-absolute"},i?e("calcite-notice",{kind:"warning",open:!0,slot:"content-top",width:"full"},e("div",{slot:"message"},this._translations.enableEditing)):void 0,e("div",{key:"4b93fef902254d2a55e997bccdb4e16ee67c3c75",class:"position-absolute"},e("div",{key:"1794c5c246ab90b2915a15a15077ae7d82ec567c",class:a,id:"feature-form",ref:t=>this._editContainer=t}),e("calcite-loader",{key:"001162f8ae947cae915de33c16a116efd7795f75",class:o,label:"",scale:"s"}))))}async _initModules(){const[t,i]=await z(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}async _initEditorWidget(){if(this.mapView&&this.graphics&&this.graphics.length>0&&this.graphics[0]){this._editor&&this._editor.destroy();const t=document.createElement("div"),i=(await C(this.mapView)).map((t=>({layer:t,geometryUpdatesEnabled:!1})));this._editor=new this.Editor({allowedWorkflows:"update",view:this.mapView,layerInfos:i,visibleElements:{snappingControls:!1},container:t}),this._attachmentHandle&&this._activeWorkflowHandle&&(this._attachmentHandle.remove(),this._activeWorkflowHandle.remove()),this._attachmentHandle=this.reactiveUtils.when((()=>"adding-attachment"===this._editor.viewModel.state||"editing-attachment"===this._editor.viewModel.state||"creating-features"===this._editor.viewModel.state),(()=>{this._shouldClose=!1})),this._activeWorkflowHandle=this.reactiveUtils.watch((()=>{var t;return null===(t=this._editor.viewModel.activeWorkflow)||void 0===t?void 0:t.activeWorkflow}),(t=>{var i,e;"update-table-record"!==(null==t?void 0:t.type)&&"create-features"!==(null==t?void 0:t.type)||(this._shouldClose=!1),((null==t?void 0:t.type)||(null==t?void 0:t.hasPendingEdits)||this._editor.activeWorkflow)&&(null===(e=null===(i=this._editor)||void 0===i?void 0:i.activeWorkflow)||void 0===e?void 0:e.started)||(this.open=!1)})),this._editContainer.appendChild(t)}}async _closeEdit(t){var i,e,s,a;this._shouldClose=!0,t&&(null===(i=this._editor)||void 0===i?void 0:i.activeWorkflow)?((null===(s=null===(e=this._editor.activeWorkflow)||void 0===e?void 0:e.activeWorkflow)||void 0===s?void 0:s.hasPendingEdits)&&(await this._editor.activeWorkflow.reset(),await this._editor.cancelWorkflow()),this._editor.destroy()):this.graphicIndex>-1&&(null===(a=this.graphics)||void 0===a?void 0:a.length)>0&&this.refreshGraphics.emit(this.graphics),this._shouldClose=!1,this.closeEdit.emit()}async _startUpdate(){await this._editor.startUpdateWorkflowAtFeatureEdit(this.graphics[this.graphicIndex]),this._shouldClose=!0}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphics:["graphicsWatchHandler"],open:["openWatchHandler"]}}};L.style=":host{display:block}.padding-bottom-1{padding-bottom:1rem}.font-bold{font-weight:var(--calcite-font-weight-bold)}.font-500{font-weight:var(--calcite-font-weight-medium)}.font-italic{font-style:italic}#feature-form{--calcite-color-background:none;padding-top:0px}.padding-sides-bottom-1{padding:0 1rem 1rem 1rem}.position-relative{position:relative}.esri-editor__prompt--danger{position:relative !important;width:100% !important;background-color:var(--calcite-color-foreground-1) !important}.esri-feature__content-node{background-color:var(--calcite-color-foreground-1) !important}.esri-editor__panel-toolbar{display:none !important}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}";const M=class{constructor(e){t(this,e),this.popupClosed=i(this,"popupClosed",7),this.selectionChanged=i(this,"selectionChanged",7),this._featuresNodeId="features-node"+(new Date).getMilliseconds().toString(),this.graphics=void 0,this.isLoading=!1,this.isMobile=void 0,this.mapView=void 0,this.allowEditing=!0,this.highlightEnabled=!0,this.paginationEnabled=!0,this.position="absolute",this._alertOpen=!1,this._count="",this._editRecordOpen=!1,this._mobileTitle="",this._showListView=!1,this._translations=void 0}async graphicsWatchHandler(){await this.setGraphics()}async isMobileWatchHandler(){await this._initFeaturesWidget()}async mapViewWatchHandler(){return await this._initFeaturesWidget()}async getSelectedFeature(){return this._features.selectedFeature}async refresh(){await this.setGraphics()}async back(){this._features.previous(),this._count=this._getCount()}async next(){this._features.next(),this._count=this._getCount()}async toggleListView(){this._showListView=!this._showListView;const t=this._features.selectedFeatureIndex;this._features.open({features:this.graphics,featureMenuOpen:this._showListView}),this._features.selectedFeatureIndex=t}async updateCurrentGraphic(t){this._features.selectedFeatureWidget.graphic=t}async closeEdit(){this._editRecordOpen=!1}async layerSelectionChange(){var t;this._showListView=!1,(null===(t=this._features)||void 0===t?void 0:t.viewModel)&&(this._features.viewModel.featureMenuOpen=!1,this._features.close())}async refreshGraphics(t){this.graphics=[...t.detail]}async componentWillLoad(){await this._initModules(),await this._getTranslations(),this._popupUtils=new _}async componentDidLoad(){var t;(null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&await this.setGraphics()}render(){var t,i,a,o,n,l,c,r,d;const h=this.isLoading?"":"display-none",p=this.isLoading||this._editRecordOpen?"visibility-hidden":"position-absolute",u=!this.isLoading&&this._editRecordOpen?"position-absolute":"display-none",b=!this.isLoading&&this._editRecordOpen||this._showListView?"display-none":"",f=(null===(i=null===(t=this._features)||void 0===t?void 0:t.features)||void 0===i?void 0:i.length)<2,m=this.isMobile?"display-none":"",v=null===(o=null===(a=this._features)||void 0===a?void 0:a.selectedFeature)||void 0===o?void 0:o.getObjectId(),g=parseInt(null==v?void 0:v.toString(),10)>-1?[v]:[],y=(null===(n=this._layer)||void 0===n?void 0:n.editingEnabled)&&(null===(r=null===(c=null===(l=this._layer)||void 0===l?void 0:l.capabilities)||void 0===c?void 0:c.operations)||void 0===r?void 0:r.supportsDelete);return e(s,{key:"ac9c78b064154a666a50e7e8540f13bd541c4d37"},e("calcite-shell",{key:"e12b6fd8ac5f92282899edceb5818764fb543301",style:{position:this.position}},this._getHeader(),e("calcite-loader",{key:"e73db3c6f71cddf497cb20e1f59e9f1d8b1ecdd6",class:h,label:this._translations.fetchingData}),e("div",{key:"ab1913d90206219978d425a45f312da3e73bcca8",class:"esri-widget feature-node "+p,id:this._featuresNodeId}),e("div",{key:"67242dfb2b219e71a135c88d9d5e2fd40b083226",class:`${b} width-100`,slot:"footer"},this.allowEditing&&e("div",{key:"25ee3d9374a5ce97c4fcd672b1f78315d1294719",class:"display-flex top-border padding-1-2"},e("calcite-button",{key:"840e3b4ae075fbfd7836f2757128e2cfe9f267e3",appearance:"solid",id:"solutions-edit",onClick:()=>this._openEditRecord(),width:"full"},this._translations.edit),this.isMobile&&y?e("delete-button",{class:"padding-inline-start-1 width-100",id:"solutions-delete",ids:g,layer:this._layer,onEditsComplete:()=>this._closePopup()}):void 0,e("calcite-tooltip",{key:"747436c3815e94976c2838777a26185c9cb7ab28",placement:"bottom","reference-element":"solutions-edit"},e("span",{key:"d40dbe85eddaf99acc522f305960ce59c16a8b1f"},this._translations.edit)),this.isMobile?e("calcite-tooltip",{placement:"bottom","reference-element":"solutions-delete"},e("span",null,this._translations.delete)):void 0),this.paginationEnabled&&!f&&e("div",{key:"9a1b1e5d7e4432f6b2cd80f77a49f50b1910117f",class:`display-flex padding-1-2 button-container top-border ${m}`},e("div",{key:"9b6fd66023b514ff996107ade3af93415f1353f1"},e("calcite-button",{key:"823bcbe1a3b592344972e6ef39fd5088ab6197fa",appearance:"transparent",disabled:f,iconStart:"chevron-left",id:"solutions-back",onClick:()=>this._back(),width:"full"}),e("calcite-tooltip",{key:"f547487c9eae179e0c65015a24432c936de2ceca",placement:"top","reference-element":"solutions-back"},e("span",{key:"f6f352416103008acc20238efe7e7714fca8d05e"},this._translations.back))),e("calcite-action",{key:"799e06b8af5df338b920ddc578fa349de469e786",class:"pagination-action",onClick:()=>this._toggleListView(),scale:"s",text:"",textEnabled:!0},e("span",{key:"adee5b6b5149dbb4c1d6136c1314db89a04e8913",class:"pagination-count"},this._count)),e("div",{key:"87f181c53ad1806a9831d01b54fdd51434a5a4c2"},e("calcite-button",{key:"a4612a6f0d9b6a9412e60022599cba536cd4f623",appearance:"transparent",disabled:f,iconStart:"chevron-right",id:"solutions-next",onClick:()=>this._next(),width:"full"}),e("calcite-tooltip",{key:"613849a34a568fe8df2abe8b1813070cb7a54633",placement:"top","reference-element":"solutions-next"},e("span",{key:"35a2e621ce4b3bccb2b859e961db1065d619b2d9"},this._translations.next))))),e("edit-card",{key:"a2054fc21fc09dbffc47e1a7617a4b91b29d26fd",class:u,graphicIndex:null===(d=this._features)||void 0===d?void 0:d.selectedFeatureIndex,graphics:this.graphics,mapView:this.mapView,open:this._editRecordOpen}),e("calcite-alert",{key:"ec0fd6540b21987c80fe2035efa96d197c1e6cec",icon:"layer-broken",kind:"warning",label:"",onCalciteAlertClose:()=>this._alertClosed(),open:this._alertOpen,placement:"top"},e("div",{key:"721a363423ec61a9645b003a7d53849137fe1b82",slot:"title"},this._translations.editDisabled),e("div",{key:"143e9ff06f5363682e8b9e1976fdbfdd1b56f2a9",slot:"message"},this._translations.enableEditing))))}async _initModules(){const[t,i]=await z(["esri/widgets/Features","esri/core/reactiveUtils"]);this.Features=t,this.reactiveUtils=i}async setGraphics(){var t;this._features||await this._initFeaturesWidget(),this.graphics.length>0?(this._layer=null===(t=this.graphics[0])||void 0===t?void 0:t.layer,this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._mobileTitle=await this._popupUtils.getPopupTitle(this.graphics[0],this.mapView.map),this._features.open({features:this.graphics})):(this._features.clear(),this._features.close()),this._count=this._getCount()}async _initFeaturesWidget(){var t;return void 0!==this.isMobile?await(null===(t=this.mapView)||void 0===t?void 0:t.when((()=>{this._features?(this._features.view=this.mapView,this._features.visibleElements.actionBar=!1,this._features.visibleElements.closeButton=!1,this._features.visibleElements.heading=!this.isMobile):(this._features=new this.Features({view:this.mapView,container:this._featuresNodeId,visibleElements:{actionBar:!1,closeButton:!1,heading:!this.isMobile}}),this._features.viewModel.highlightEnabled=this.highlightEnabled,this.reactiveUtils.watch((()=>this._features.viewModel.featureMenuOpen),(t=>{this._count=this._getCount(),t||(this._showListView=t)})),this.reactiveUtils.watch((()=>this._features.selectedFeatureIndex),(t=>{t>-1&&this.selectionChanged.emit({selectedFeature:[this._features.selectedFeature],selectedFeatureIndex:this._features.selectedFeatureIndex})})))}))):Promise.resolve()}_getHeader(){return this.isMobile&&!this._editRecordOpen?e("calcite-panel",{class:"border-width-0",slot:"header"},e("calcite-action",{class:"end-border",icon:"chevron-left",iconFlipRtl:!0,onClick:()=>this._closePopup(),scale:"s",slot:"header-actions-start",text:""}),e("span",{class:"font-bold",slot:"header-content"},this._mobileTitle)):void 0}_closePopup(){this.popupClosed.emit()}_alertClosed(){this._alertOpen=!1}_openEditRecord(){this._editEnabled?this._editRecordOpen=!0:this._alertOpen=!0}_back(){this._features.previous(),this._count=this._getCount()}_next(){this._features.next(),this._count=this._getCount()}_getCount(){var t,i,e;const s=((null===(t=this._features)||void 0===t?void 0:t.viewModel.selectedFeatureIndex)+1).toString(),a=null===(e=null===(i=this._features)||void 0===i?void 0:i.features)||void 0===e?void 0:e.length.toString();return this._translations.indexOfTotal.replace("{{index}}",s).replace("{{total}}",a)}_toggleListView(){this._showListView=!this._showListView;const t=this._features.selectedFeatureIndex;this._features.open({features:this.graphics,featureMenuOpen:this._showListView}),this._features.selectedFeatureIndex=t}async _getTranslations(){const t=await x(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphics:["graphicsWatchHandler"],isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};M.style=":host{display:block;--calcite-label-margin-bottom:0}.padding-1-2{padding:0.5rem}.display-none{display:none !important}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.feature-node{position:relative !important}.feature-node .esri-features__footer{display:none !important}.button-container{justify-content:center;align-items:center}.top-border{border-top:1px solid var(--calcite-color-border-1)}.width-100{width:100%}.esri-features__container{padding:0.5rem !important;background-color:var(--calcite-color-foreground-1) !important;height:100% !important}.overflow-hidden{overflow:hidden}.height-40{height:40px}.end-border{border-inline-end:1px solid var(--calcite-color-border-1)}.font-bold{font-weight:bold}.visibility-hidden{visibility:hidden;height:0px}.padding-inline-start-1{padding-inline-start:1rem}.border-width-0{border-width:0px}.pagination-action{position:relative;left:3px}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}";export{S as calcite_alert,A as delete_button,L as edit_card,M as info_card}
|
@@ -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-6d753a3d.js";import{c as n}from"./p-bfd3d428.js";import{c as h,s as c,a as l}from"./p-a25bbcc1.js";import{a as r}from"./p-67b26725.js";import{c as d,u as b,d as f,I as p}from"./p-9db9645e.js";import{c as u,d as m}from"./p-b5bfe190.js";import{c as y,s as v,d as g,u as w}from"./p-2e625f11.js";import{S as k}from"./p-d2b66bd2.js";import{l as x,f as L,g as _}from"./p-896c9644.js";import{a as C,g as S,b as j,d as W}from"./p-5aaa05ef.js";import"./p-b85be429.js";import"./p-db50226e.js";import"./p-820d8935.js";import"./p-f50a294b.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";
|
7
|
+
/*!
|
8
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
+
* v2.8.2
|
11
|
+
*/const E="frame",I="frame--advancing",F="frame--retreating",z=class{constructor(i){t(this,i),this.itemMutationObserver=n("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,n=e[o-1],h=e[o-2];if(o&&n&&e.forEach((t=>{t.showBackButton=t===n&&o>1,t.hidden=t!==n})),h&&(h.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 h(this);const{items:t}=this,i=t[t.length-1];return null==i?void 0:i.setFocus()}connectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.observe(this.el,{childList:!0,subtree:!0}),this.updateFlowProps()}async componentWillLoad(){c(this)}componentDidLoad(){l(this)}disconnectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.disconnect()}async handleItemBackClick(t){if(!t.defaultPrevented)return await this.back(),this.setFocus()}render(){const{flowDirection:t}=this;return i("div",{key:"9d405841d7a1ee2d7a5da28c02ef8d5bf08dd9f5",class:{[E]:!0,[I]:"advancing"===t,[F]:"retreating"===t}},i("slot",{key:"a02231a5002f8b19542e03529aad12771787b26f"}))}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/main/LICENSE.md for details.
|
15
|
+
* v2.8.2
|
16
|
+
*/
|
17
|
+
const D=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.handlePanelScroll=t=>{t.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=t=>{t.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=t=>{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.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.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){d(this),u(this),y(this)}async componentWillLoad(){await v(this),c(this)}componentDidRender(){b(this)}disconnectedCallback(){f(this),m(this),g(this)}componentDidLoad(){l(this)}effectiveLocaleChange(){w(this,this.effectiveLocale)}async setFocus(){await h(this);const{backButtonEl:t,containerEl:i}=this;return t?t.setFocus():i?i.setFocus():void 0}async scrollContentTo(t){var i;await(null===(i=this.containerEl)||void 0===i?void 0:i.scrollContentTo(t))}renderBackButton(){const{el:t}=this,s="rtl"===r(t),{showBackButton:e,backButtonClick:a,messages:o}=this,n=o.back;return e?i("calcite-action",{"aria-label":n,class:"back-button",icon:s?"chevron-right":"chevron-left",key:"flow-back-button",onClick:a,scale:"s",slot:"header-actions-start",text:n,title:n,ref:this.setBackRef}):null}render(){const{collapsed:t,collapseDirection:s,collapsible:e,closable:o,closed:n,description:h,disabled:c,heading:l,headingLevel:r,loading:d,menuOpen:b,messages:f,overlayPositioning:u}=this;return i(a,{key:"ab926d381ff2493f3fd49a5c8724260211d69ca9"},i(p,{key:"6799b56c2116de5e08739ddc2ec1557bd291f3f8",disabled:c},i("calcite-panel",{key:"2e438b8abf573eabaaa2e966dcca5c4843a53cba",closable:o,closed:n,collapseDirection:s,collapsed:t,collapsible:e,description:h,disabled:c,heading:l,headingLevel:r,loading:d,menuOpen:b,messageOverrides:f,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,overlayPositioning:u,ref:this.setContainerRef},this.renderBackButton(),i("slot",{key:"39b650abdf64df16f535d45f64dc1b367acfcc9e",name:"action-bar",slot:k.actionBar}),i("slot",{key:"5b36c56874ad762f842c81f9ffbdcdbd3168cf75",name:"header-actions-start",slot:k.headerActionsStart}),i("slot",{key:"2dbf552425d238a4479a12bbec79571d11124577",name:"header-actions-end",slot:k.headerActionsEnd}),i("slot",{key:"2dd0a30236844c91c2cf10a9fbacbe9935ea234c",name:"header-content",slot:k.headerContent}),i("slot",{key:"1b025f746e2e7d58fb057aab36b24e46872e607e",name:"header-menu-actions",slot:k.headerMenuActions}),i("slot",{key:"5dd5986e93dcc11e0b0fade6822814b160053c70",name:"fab",slot:k.fab}),i("slot",{key:"e7cf2702cd2e423d07a8a8ac57c142bc4738b3ef",name:"footer-actions",slot:k.footerActions}),i("slot",{key:"e2561d89aaebe4fbb82b1f546551d05ebb23b0bf",name:"footer",slot:k.footer}),i("slot",{key:"fb6bf40456038f84486b2858765bb9d147800e84"}))))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};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([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 H=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._isSubmitBtnClicked=!1,this.mapView=void 0,this.selectedLayerId=void 0,this.customizeSubmit=!1,this.searchConfiguration=void 0,this._editorLoading=!1,this._showSearchWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async _editorLoadingWatchHandler(t){var i,s;t&&(null===(i=this._container)||void 0===i||i.classList.add("display-none"),await this.startCreate(),null===(s=this._container)||void 0===s||s.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 componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){const t=this._showSearchWidget?"":"display-none",s=this._editorLoading?"display-none":"";return i(o,{key:"a4ccd565a52a4cde4e76439629425f19bd4c222e"},i("calcite-loader",{key:"30e8a3753985a734dd7cba461f26691b51f49ab9",class:this._editorLoading?"":"display-none",label:"",scale:"s"}),i("div",{key:"0845f1fa85a21b578fd18200b43d4a77c34e6808",class:s,id:"feature-form"}),i("div",{key:"af74b6337f5a0dcfdbd552145c88eae5282a3307",class:`search-widget ${t} ${s}`,id:"search-widget-ref"}))}async init(){this.mapView&&this.selectedLayerId&&(await this.createEditorWidget(),await this.createSearchWidget())}async initModules(){const[t,i,s]=await x(["esri/widgets/Editor","esri/core/reactiveUtils","esri/widgets/Search"]);this.Editor=t,this.reactiveUtils=i,this.Search=s}async createEditorWidget(){var t;this._editor&&this._editor.destroy();const i=[];this._container=document.createElement("div"),null===(t=this._container)||void 0===t||t.classList.add("display-none"),(await C(this.mapView)).forEach((async t=>{i.push({layer:t,enabled:"feature"===(null==t?void 0:t.type)&&(null==t?void 0:t.id)===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({allowedWorkflows:"create-features",view:this.mapView,layerInfos:i,visibleElements:{snappingControls:!1},container:this._container}),this.el.appendChild(this._container);const s=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(s);const e=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this.progressStatus.emit(.5),this._editorLoading=!0)}));this._editor.viewModel.addHandles(e);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&(this._editorLoading=!0,this._showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){return new Promise(((t,i)=>{var s;if(null===(s=this._editor.viewModel.featureTemplatesViewModel.items)||void 0===s?void 0:s.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._editor.viewModel.sketchViewModel.on("create",(t=>{"complete"===t.state&&(this._showSearchWidget=!1,this.progressStatus.emit(1),this.drawComplete.emit())})),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.mapView};if(this.searchConfiguration){const i=this._getSearchConfig(this.searchConfiguration,this.mapView);t=Object.assign({},i)}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.mapView,this.selectedLayerId);let s=null;this._search.on("search-complete",(t=>{var e;this.mapView.goTo(t.results[0].results[0].extent),"point"===i.geometryType&&(s=null===(e=t.results[0].results[0])||void 0===e?void 0:e.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(null==s?void 0:s.length)>0?(t.includeDefaultSources=!1,s.forEach((t=>{var s,e;if(t.hasOwnProperty("layer")){const a=t,o=null===(s=a.layer)||void 0===s?void 0:s.id,n=o?i.map.findLayerById(o):null,h=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;n?a.layer=n:h&&(a.layer=new this.FeatureLayer(h))}})),null==s||s.forEach((t=>{if(t.hasOwnProperty("locator")){const i=t;"ArcGIS World Geocoding Service"===(null==i?void 0:i.name)&&(i.outFields=i.outFields||["Addr_type","Match_addr","StAddr","City"],i.singleLineFieldName="SingleLine"),i.url=i.url,delete i.url}}))):t=Object.assign(Object.assign({},t),{includeDefaultSources:!0}),t}async hideEditorsElements(){var t;this.customizeSubmit&&(await this.timeout(700),null===(t=this.el.querySelector(".esri-editor").querySelectorAll("calcite-flow-item"))||void 0===t||t.forEach((t=>{var i,s,e,a,o;const n=null===(e=null===(s=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("calcite-panel"))||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("article");null===(a=null==n?void 0:n.querySelector("header"))||void 0===a||a.setAttribute("style","display: none"),null===(o=null==n?void 0:n.querySelector("footer"))||void 0===o||o.setAttribute("style","display: none")})))}async submitted(t){var i;if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),(null===(i=this._editor.viewModel.failures)||void 0===i?void 0:i.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)))}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};H.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}";const O=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._isSubmitBtnClicked=!1,this.mapView=void 0,this.table=void 0,this.selectedFeature=void 0,this.customizeSubmit=!1,this._editorLoading=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async _editorLoadingWatchHandler(t){var i,s;t&&(null===(i=this._container)||void 0===i||i.classList.add("display-none"),await this.startCreate(),null===(s=this._container)||void 0===s||s.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 componentWillLoad(){await this.initModules()}async init(){this.mapView&&await this.createEditorWidget()}async initModules(){const[t,i]=await x(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}render(){return i("calcite-loader",{key:"a8fd1e83a4a9614779be19a11e6028b3a402cbd2",class:this._editorLoading?"":"display-none",label:"",scale:"s"})}async componentDidLoad(){await this.init()}async createEditorWidget(){var t;this._editor&&this._editor.destroy(),this._container=document.createElement("div"),null===(t=this._container)||void 0===t||t.classList.add("display-none"),this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:this._container}),this.el.appendChild(this._container);const i=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this._editorLoading=!0)}));this._editor.viewModel.addHandles(i);const s=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(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],n={attributeOverrides:this.makeAttributesForRelatedFeature(a.features[0],s,e),layer:i,template:o};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(n),await this.hideEditorsElements(),this.isActionPending.emit(!1),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}async hideEditorsElements(){var t,i;this.customizeSubmit&&(await this.timeout(700),null===(i=null===(t=this.el.querySelector(".esri-editor"))||void 0===t?void 0:t.querySelectorAll("calcite-flow-item"))||void 0===i||i.forEach((t=>{var i,s,e,a,o;const n=null===(e=null===(s=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("calcite-panel"))||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("article");null===(a=null==n?void 0:n.querySelector("header"))||void 0===a||a.setAttribute("style","display: none"),null===(o=null==n?void 0:n.querySelector("footer"))||void 0===o||o.setAttribute("style","display: none")})))}makeAttributesForRelatedFeature(t,i,s){const e=t.getAttribute(i.keyField);let a=s.keyField;const o=this.table.fields.find((t=>t.name.toLocaleLowerCase()===a.toLocaleLowerCase()));return a=o.name,{[a]:e}}async submitted(t){var i;if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),(null===(i=this._editor.viewModel.failures)||void 0===i?void 0:i.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)))}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};O.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.display-none{display:none !important}";const B=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._validFieldTypes=["small-integer","integer","big-integer","single","long"],this.mapView=void 0,this.graphics=void 0,this.reportingOptions=void 0,this.layerItemsHash=void 0,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}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()}async componentWillLoad(){await this._initModules(),await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}render(){var t,s,e,a,o;const n=(null===(t=this._relatedFeaturesOIDs)||void 0===t?void 0:t.length)>0?`objectId in(${this._relatedFeaturesOIDs})`:"1=0";return i("calcite-panel",{key:"e42bbf7e4070b03c43aec1bf47c442b65cd35731","full-height":!0},i("info-card",{key:"f44099e2f8f87edbc656700e65daeb1bf934d41c",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:"aa65adf8d8b6a059d5e9d0e74a1896eb20c84eaf",class:"buttons-container"},this._commentsAvailable&&i("div",{key:"09dd5da4932a9a0526b413592d25469087eaf4c9",class:"comment-btn"},i("span",{key:"48f7080ace69de3589aa4f3b199eb25e53f61110"},this._relatedFeaturesOIDs.length),i("calcite-icon",{key:"f524b4d66a0a6427dda6a7a93e9dc362fe7337fc",icon:"speech-bubble",scale:"s"})),this._likeFieldAvailable&&i("calcite-button",{key:"278a685b13f7ae2a37cb649a0933006104fa7b9f",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onLikeButtonClick.bind(this),scale:"m"},null!==(e=null!==(s=this._likeCount)&&void 0!==s?s:this._selectedGraphic.attributes[this._likeField])&&void 0!==e?e:0),this._dislikeFieldAvailable&&i("calcite-button",{key:"7010b6ef352be7c587d7ca49fe3b8411aeb163c6",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onDislikeButtonClick.bind(this),scale:"m"},null!==(o=null!==(a=this._disLikeCount)&&void 0!==a?a:this._selectedGraphic.attributes[this._dislikeField])&&void 0!==o?o:0)),this.relatedTableId&&this._commentsAvailable&&i("feature-list",{key:"526614c384fa627057a18528c1bd4aaf2b9c70d8",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,textSize:"small",whereClause:n}))}async _initModules(){const[t,i]=await x(["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(){var t;const i=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[i.id]&&this.reportingOptions[i.id].comment&&(null===(t=i.relationships)||void 0===t?void 0:t.length)>0){const t=i.relationships[0].relatedTableId,s=(await j(this.mapView)).filter((i=>t===i.layerId));if(this.relatedTableId=(null==s?void 0:s.length)>0?s[0].id:"",this.relatedTableId){const t=this._selectedGraphic.attributes[i.objectIdField],s=new this.RelationshipQuery({objectIds:[t],outFields:["*"],relationshipId:i.relationships[0].id}),e=await i.queryRelatedFeatures(s).catch((t=>{console.error(t)})),a=[];e[t]&&e[t].features.forEach((t=>{a.push(t.attributes.OBJECTID)})),this._relatedFeaturesOIDs=a,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]=i?Number(a.attributes[t])+1:Number(a.attributes[t])-1,s[e.objectIdField]=a.attributes[e.objectIdField],s[t]=a.attributes[t];const o=new this.Graphic;o.attributes=s;const n={updateFeatures:[o]};await e.applyEdits(n).then((()=>{this._selectedGraphic=a,this._infoCard&&this._infoCard.updateCurrentGraphic(this._selectedGraphic),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))}get el(){return s(this)}static get watchers(){return{graphics:["graphicsWatchHandler"]}}};B.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 P=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._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=void 0}async refresh(){await this.setLayers()}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0}async componentDidLoad(){await this.setLayers(),this._isLoading=!1}render(){return i(o,{key:"9366302a704c1dbdd7a65aef5c43d0ad84a44b23"},this._isLoading&&i("calcite-loader",{key:"69974a23fd42bc37ef13816efbe6d06e28cb2749",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{key:"a93abb55b4db09727b3634cb1935e482c377d662",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{key:"b9046685353b8894e6c6094cff47fab7a8e07ffa",slot:"title"},this._translations.error),i("div",{key:"90a052e1d80779a09a32fdd35563a1ce21d582e0",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{key:"709c1b8edd5710a2476ecef638199c2f929b4165","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await W(this.mapView,!0),(await C(this.mapView)).forEach((async i=>{if("feature"===(null==i?void 0:i.type)&&this.showFeatureCount){const s=i.createQuery(),e=i.queryFeatureCount(s);t.push(e),e.then((async t=>{const s=isNaN(t)?"":await L(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[i.id].formattedFeatureCount=s}))}})),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){var i;const s=(null===(i=this.layers)||void 0===i?void 0:i.length)>0?this.layers:[];return Object.keys(t).reduce(((t,i)=>(s.indexOf(i)>-1&&t.push(i),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 _(this.el);this._translations=t[0]}get el(){return s(this)}};P.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,D as calcite_flow_item,H as create_feature,O as create_related_feature,B as feature_details,P as layer_list}
|
@@ -3,4 +3,4 @@
|
|
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 i,h as s,g as e}from"./p-6d753a3d.js";import{l as a,g as h}from"./p-896c9644.js";import{P as c}from"./p-
|
6
|
+
import{r as t,c as i,h as s,g as e}from"./p-6d753a3d.js";import{l as a,g as h}from"./p-896c9644.js";import{P as c}from"./p-2455bcb0.js";import{g as n,c as o,h as l}from"./p-5aaa05ef.js";import"./p-82e085d0.js";import"./p-52dba022.js";import"./p-334e6394.js";import"./p-a230b270.js";import"./p-530b73ce.js";import"./p-c1cf3ebc.js";const r=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._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}async selectedLayerWatchHandler(){this._selectedLayer=await n(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(){await this.initializeFeatureItems()}async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new c,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await n(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return s("calcite-panel",{key:"3d7b707a73bb6c4d566515e50cf2baa155e60816","full-height":!0,"full-width":!0},this._isLoading&&s("calcite-loader",{key:"50294111fb6c1e52e727b03e54ca83fc498ca3b9",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&s("calcite-notice",{key:"8dd48fc33e2a9825a95b0d0d50424baf431fed55",class:"error-msg",icon:"feature-details",kind:"info",open:!0},s("div",{key:"6ff0dc700cdf40fe6929a9777bca8ebc6325f1ed",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),s("calcite-list",{key:"2412a7b41ab87bfee803460bdea0395ca609d55a","selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&s("div",{key:"4216b02c264cf88472082f1c6f3cd466bd77d166",class:"width-full",slot:"footer"},s("calcite-pagination",{key:"2bb39768d0fbd0d863b075b0e2e6b750c5f7c2a1",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]=await a(["esri/Color"]);this.Color=t}getWhereCondition(){var t;let i="1=1";return this.whereClause&&(i=this.whereClause),(null===(t=this._selectedLayer)||void 0===t?void 0:t.definitionExpression)&&(i=i+" AND "+this._selectedLayer.definitionExpression),i}async initializeFeatureItems(){var t;if(this._selectedLayer){null===(t=this._pagination)||void 0===t||t.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const i={where:this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(i),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 l([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){var i,s;const e=this._selectedLayer,a=(null===(i=this.sortingInfo)||void 0===i?void 0:i.field)?this.sortingInfo.field:e.objectIdField,h=(null===(s=this.sortingInfo)||void 0===s?void 0:s.order)?this.sortingInfo.order:"desc",c={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:this.getWhereCondition(),outSpatialReference:this.mapView.spatialReference.toJSON()};a&&h&&(c.orderByFields=[a.toString()+" "+h]);const n=await e.queryFeatures(c);return await this.createFeatureItem(n)}async createFeatureItem(t){const i=(null==t?void 0:t.features).map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);return this.getFeatureItem(t,i)}));return Promise.all(i)}getFeatureItem(t,i){const e=t.attributes[this._selectedLayer.objectIdField].toString();return s("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:e},s("div",{class:"small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title",slot:"content-start"},i=null!=i?i:e),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};r.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;padding:10px 12px;white-space:pre-line}.feature-list-popup-title-small{font-size:small;padding:10px 12px;white-space:pre-line}";export{r as feature_list}
|
@@ -3,4 +3,4 @@
|
|
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 i,h as s,H as e,F as a,g as h}from"./p-6d753a3d.js";import{l as o,g as l}from"./p-896c9644.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-5aaa05ef.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";const m=class{constructor(s){t(this,s),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.theme="light",this.zoomToScale=void 0,this._featureCreationFailedErrorMsg=void 0,this._filterActive=!1,this._filterOpen=!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}async isMobileWatchHandler(){this._sidePanelCollapsed=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async componentWillLoad(){var t;this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(null===(t=this.mapView)||void 0===t?void 0:t.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(e,{key:"119bb8b1c9115dca4e15c45ddd8e7fbed500b4d7"},this._reportSubmitted&&s("calcite-alert",{key:"ef85c61fb5c9eaac9391c1e37494ef5e4244dadb","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:"616a75103a227cf1b50d9e43fea129afc3fee4f9",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"2faf9a9729bf90b87e044bfe8958571735f2cbf5","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"66cdf81166042ff4efddd4cc5801d790463d75fc",slot:"title"},this._translations.error),s("div",{key:"ad289b06742d2159d6fcfbdc42ecc9fb6d81f362",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"27aee542bfd2cae8972035d17167407b35b5eb76","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"70a8a21de05b00d409adb226d6393817f7514930",slot:"message"},this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"107ab01eca03500faeb4db5a2ac0e9dc7261e6fc","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"31e6fba8c28489f87897a13ebb4e7b8956452191",slot:"title"},this._translations.error),s("div",{key:"6f0868946ef6e04490ba1e0806a03e26c756760b",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"e169b7b466023010d45151ca9b7dfb900d8d7f9f"},s("calcite-shell",{key:"72899b8eff6622233224df91223ee5d59539905b","content-behind":!0},this._getReporter())),this.filterModal())}async _initModules(){const[t]=await o(["esri/core/reactiveUtils"]);this.reactiveUtils=t}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"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,(null==t?void 0:t.length)>0&&t):s("calcite-loader",{label:"",scale:"m"}))}filterModal(){var t,i;const e=this.layerExpressions?this.layerExpressions.filter((t=>t.id===this._selectedLayerId)):[];return e.length>0&&s("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},s("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},null===(i=null===(t=this._translations)||void 0===t?void 0:t.filterLayerTitle)||void 0===i?void 0:i.replace("{{title}}",this._selectedLayerName)),s("div",{slot:"content"},s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:()=>{this._closeFilter()},comboboxOverlayPositioning:"fixed",layerExpressions:e,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:t=>this._filterList=t,view:this.mapView,zoomBtn:!1})))}_closeFilter(){this._filterOpen&&(this._filterOpen=!1)}_toggleFilter(){this._filterOpen=!this._filterOpen}async sortOptionClick(t,i,s){this._updatedSorting={field:t,order:i},this._updatedSortOption=s}_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(a,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"}))))}_handleFilterListReset(){this._filterActive=!1,this._featureList.refresh()}_handleFilterUpdate(){this._filterActive=this._filterList.urlParams.getAll("filter").length>0,this._featureList.refresh()}getLayerListFlowItem(){var t;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",{class:"height-full",layers:(null===(t=this._editableLayerIds)||void 0===t?void 0:t.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)},this.isMobile&&this.getActionToExpandCollapsePanel(),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.isMobile&&this.getActionToExpandCollapsePanel(),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,mapView:this.mapView,onDrawComplete:this.onDrawComplete.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.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}onDrawComplete(){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._reportSubmitted=!0,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&&this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._showSubmitCancelButton=!1,this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this._flowItems=[...this._flowItems,"reporting-layer-list"]}async layerListLoaded(t){const i=t.detail,s=await n(this.mapView),e=[];this._validLayers=[],s.forEach((t=>{var s;i.includes(t.id)&&(this._validLayers.push(t),(null===(s=this._getLayersConfig(t.id))||void 0===s?void 0:s.reporting)&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&e.push(t.id))})),this.handleMapClick(),this._hasValidLayers=e.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"]}backFromSelectedPanel(){this._updatedProgressBarStatus=.25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit(this._sidePanelCollapsed)}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer.relationships[0].relatedTableId,i=(await r(this.mapView)).filter((i=>t===i.layerId));this._relatedTable=i[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){var e,a;const h=null===(e=this.layerExpressions)||void 0===e?void 0:e.filter((t=>t.id===this._selectedLayerId)),o=(null===(a=this._getLayersConfig(this._selectedLayerId))||void 0===a?void 0:a.reporting)&&this._layerItemsHash[this._selectedLayerId].supportsAdd,l=(null==h?void 0:h.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}),l&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:this._toggleFilter.bind(this),slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&o&&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",{class:"height-full",highlightOnHover:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,selectedLayerId:t,sortingInfo:this._updatedSorting})))}getFeatureDetailsFlowItem(){var t;const i=(null===(t=this._getLayersConfig(this._selectedLayerId))||void 0===t?void 0:t.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,embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,removePopoverOffset:!0,scale:"s",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}),i&&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),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){var i;if(this._currentFeature=t,t&&t.layer){const s=t.layer;this.setSelectedLayer(s.id,s.title),this._currentFeatureId=t.attributes[s.objectIdField],(null===(i=this._getLayersConfig(s.id))||void 0===i?void 0:i.comment)&&s.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(){var t;await this.getLayersToShowInList(),1===(null===(t=this._editableLayerIds)||void 0===t?void 0:t.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 s=t.filter((t=>this._validLayers.includes(t.layer))),e=t.filter((t=>{var i;return!this._validLayers.includes(t.layer)&&(null===(i=null==t?void 0:t.layer)||void 0===i?void 0:i.id)}));if(s.length>0&&(await this.setSelectedFeatures(s),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"]),e.length>0){this.mapView.popupEnabled=!0;const t={features:e,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 l(this.el);this._translations=t[0]}reduceToConfiguredLayers(t){return Object.keys(t).reduce(((i,s)=>{var e;return(this.reportingOptions?null===(e=this._getLayersConfig(s))||void 0===e?void 0:e.visible:t[s].supportsAdd)&&i.push(s),i}),[])}async getLayersToShowInList(){const t=await p(this.mapView,!0);(await n(this.mapView)).forEach((i=>{var s,e;"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.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(){var t,i;const s=null===(t=this._shareNode)||void 0===t?void 0:t.shareUrl;if(!s)return;const e=new URL(s);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),(null===(i=this._selectedFeature)||void 0===i?void 0:i.length)?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.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])}}}get el(){return h(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};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}";export{m as crowdsource_reporter}
|
6
|
+
import{r as t,c as i,h as s,H as e,F as a,g as h}from"./p-6d753a3d.js";import{l as o,g as l}from"./p-896c9644.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-5aaa05ef.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";const m=class{constructor(s){t(this,s),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.theme="light",this.zoomToScale=void 0,this._featureCreationFailedErrorMsg=void 0,this._filterActive=!1,this._filterOpen=!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}async isMobileWatchHandler(){this._sidePanelCollapsed=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async componentWillLoad(){var t;this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(null===(t=this.mapView)||void 0===t?void 0:t.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(e,{key:"119bb8b1c9115dca4e15c45ddd8e7fbed500b4d7"},this._reportSubmitted&&s("calcite-alert",{key:"ef85c61fb5c9eaac9391c1e37494ef5e4244dadb","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:"616a75103a227cf1b50d9e43fea129afc3fee4f9",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"2faf9a9729bf90b87e044bfe8958571735f2cbf5","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"66cdf81166042ff4efddd4cc5801d790463d75fc",slot:"title"},this._translations.error),s("div",{key:"ad289b06742d2159d6fcfbdc42ecc9fb6d81f362",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"27aee542bfd2cae8972035d17167407b35b5eb76","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"70a8a21de05b00d409adb226d6393817f7514930",slot:"message"},this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"107ab01eca03500faeb4db5a2ac0e9dc7261e6fc","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"31e6fba8c28489f87897a13ebb4e7b8956452191",slot:"title"},this._translations.error),s("div",{key:"6f0868946ef6e04490ba1e0806a03e26c756760b",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"e169b7b466023010d45151ca9b7dfb900d8d7f9f"},s("calcite-shell",{key:"72899b8eff6622233224df91223ee5d59539905b","content-behind":!0},this._getReporter())),this.filterModal())}async _initModules(){const[t]=await o(["esri/core/reactiveUtils"]);this.reactiveUtils=t}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"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,(null==t?void 0:t.length)>0&&t):s("calcite-loader",{label:"",scale:"m"}))}filterModal(){var t,i;const e=this.layerExpressions?this.layerExpressions.filter((t=>t.id===this._selectedLayerId)):[];return e.length>0&&s("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},s("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},null===(i=null===(t=this._translations)||void 0===t?void 0:t.filterLayerTitle)||void 0===i?void 0:i.replace("{{title}}",this._selectedLayerName)),s("div",{slot:"content"},s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:()=>{this._closeFilter()},comboboxOverlayPositioning:"fixed",layerExpressions:e,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:t=>this._filterList=t,view:this.mapView,zoomBtn:!1})))}_closeFilter(){this._filterOpen&&(this._filterOpen=!1)}_toggleFilter(){this._filterOpen=!this._filterOpen}async sortOptionClick(t,i,s){this._updatedSorting={field:t,order:i},this._updatedSortOption=s}_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(a,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"}))))}_handleFilterListReset(){this._filterActive=!1,this._featureList.refresh()}_handleFilterUpdate(){this._filterActive=this._filterList.urlParams.getAll("filter").length>0,this._featureList.refresh()}getLayerListFlowItem(){var t;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",{class:"height-full",layers:(null===(t=this._editableLayerIds)||void 0===t?void 0:t.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)},this.isMobile&&this.getActionToExpandCollapsePanel(),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.isMobile&&this.getActionToExpandCollapsePanel(),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,mapView:this.mapView,onDrawComplete:this.onDrawComplete.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.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}onDrawComplete(){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._reportSubmitted=!0,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&&this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._showSubmitCancelButton=!1,this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this._flowItems=[...this._flowItems,"reporting-layer-list"]}async layerListLoaded(t){const i=t.detail,s=await n(this.mapView),e=[];this._validLayers=[],s.forEach((t=>{var s;i.includes(t.id)&&(this._validLayers.push(t),(null===(s=this._getLayersConfig(t.id))||void 0===s?void 0:s.reporting)&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&e.push(t.id))})),this.handleMapClick(),this._hasValidLayers=e.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"]}backFromSelectedPanel(){this._updatedProgressBarStatus=.25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit(this._sidePanelCollapsed)}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer.relationships[0].relatedTableId,i=(await r(this.mapView)).filter((i=>t===i.layerId));this._relatedTable=i[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){var e,a;const h=null===(e=this.layerExpressions)||void 0===e?void 0:e.filter((t=>t.id===this._selectedLayerId)),o=(null===(a=this._getLayersConfig(this._selectedLayerId))||void 0===a?void 0:a.reporting)&&this._layerItemsHash[this._selectedLayerId].supportsAdd,l=(null==h?void 0:h.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}),l&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:this._toggleFilter.bind(this),slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&o&&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",{class:"height-full",highlightOnHover:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,selectedLayerId:t,sortingInfo:this._updatedSorting})))}getFeatureDetailsFlowItem(){var t;const i=(null===(t=this._getLayersConfig(this._selectedLayerId))||void 0===t?void 0:t.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}),i&&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),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){var i;if(this._currentFeature=t,t&&t.layer){const s=t.layer;this.setSelectedLayer(s.id,s.title),this._currentFeatureId=t.attributes[s.objectIdField],(null===(i=this._getLayersConfig(s.id))||void 0===i?void 0:i.comment)&&s.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(){var t;await this.getLayersToShowInList(),1===(null===(t=this._editableLayerIds)||void 0===t?void 0:t.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 s=t.filter((t=>this._validLayers.includes(t.layer))),e=t.filter((t=>{var i;return!this._validLayers.includes(t.layer)&&(null===(i=null==t?void 0:t.layer)||void 0===i?void 0:i.id)}));if(s.length>0&&(await this.setSelectedFeatures(s),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"]),e.length>0){this.mapView.popupEnabled=!0;const t={features:e,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 l(this.el);this._translations=t[0]}reduceToConfiguredLayers(t){return Object.keys(t).reduce(((i,s)=>{var e;return(this.reportingOptions?null===(e=this._getLayersConfig(s))||void 0===e?void 0:e.visible:t[s].supportsAdd)&&i.push(s),i}),[])}async getLayersToShowInList(){const t=await p(this.mapView,!0);(await n(this.mapView)).forEach((i=>{var s,e;"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.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(){var t,i;const s=null===(t=this._shareNode)||void 0===t?void 0:t.shareUrl;if(!s)return;const e=new URL(s);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),(null===(i=this._selectedFeature)||void 0===i?void 0:i.length)?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.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])}}}get el(){return h(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};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}
|