@esri/solutions-components 0.11.22 → 0.11.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/card-manager_3.cjs.entry.js +8 -4
- package/dist/cjs/create-feature_4.cjs.entry.js +21 -10
- package/dist/cjs/create-related-feature_3.cjs.entry.js +25 -19
- package/dist/cjs/crowdsource-manager.cjs.entry.js +3 -2
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +7 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/card-manager/card-manager.js +23 -2
- package/dist/collection/components/create-feature/create-feature.css +1 -1
- package/dist/collection/components/create-feature/create-feature.js +28 -3
- package/dist/collection/components/create-related-feature/create-related-feature.css +1 -1
- package/dist/collection/components/create-related-feature/create-related-feature.js +74 -49
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +23 -2
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +27 -6
- package/dist/collection/components/edit-card/edit-card.css +1 -1
- package/dist/collection/components/edit-card/edit-card.js +48 -23
- package/dist/collection/components/feature-details/feature-details.js +27 -6
- package/dist/collection/components/info-card/info-card.js +23 -2
- package/dist/collection/components/layer-table/layer-table.js +5 -2
- package/dist/components/card-manager2.js +4 -2
- package/dist/components/create-feature2.js +10 -4
- package/dist/components/create-related-feature2.js +21 -15
- package/dist/components/crowdsource-manager.js +4 -2
- package/dist/components/crowdsource-reporter.js +8 -6
- package/dist/components/edit-card2.js +11 -5
- package/dist/components/feature-details2.js +8 -6
- package/dist/components/info-card2.js +4 -2
- package/dist/components/layer-table2.js +5 -2
- package/dist/esm/card-manager_3.entry.js +8 -4
- package/dist/esm/create-feature_4.entry.js +21 -10
- package/dist/esm/create-related-feature_3.entry.js +25 -19
- package/dist/esm/crowdsource-manager.entry.js +3 -2
- package/dist/esm/crowdsource-reporter.entry.js +7 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/p-2507c685.entry.js +6 -0
- package/dist/solutions-components/p-386b0163.entry.js +6 -0
- package/dist/solutions-components/p-99e00361.entry.js +6 -0
- package/dist/solutions-components/p-a415a60d.entry.js +6 -0
- package/dist/solutions-components/p-b5a102db.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components_commit.txt +6 -6
- package/dist/types/components/card-manager/card-manager.d.ts +4 -0
- package/dist/types/components/create-feature/create-feature.d.ts +4 -0
- package/dist/types/components/create-related-feature/create-related-feature.d.ts +23 -19
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +4 -0
- package/dist/types/components/edit-card/edit-card.d.ts +8 -4
- package/dist/types/components/feature-details/feature-details.d.ts +4 -0
- package/dist/types/components/info-card/info-card.d.ts +4 -0
- package/dist/types/components.d.ts +64 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-1ac20964.entry.js +0 -6
- package/dist/solutions-components/p-892b42be.entry.js +0 -6
- package/dist/solutions-components/p-9161beb0.entry.js +0 -6
- package/dist/solutions-components/p-decfd5fc.entry.js +0 -6
- package/dist/solutions-components/p-eba271dd.entry.js +0 -6
@@ -1,6 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,c as i,g as e,h as s,F as a,H as h}from"./p-e996c38f.js";import{l as o,g as n}from"./p-404cbf48.js";import{a as d,g as c}from"./p-dcd2f00b.js";import{P as r}from"./p-bf04c6f4.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-db3391b9.js";import"./p-4fe489cf.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";const l=class{constructor(e){t(this,e),this.success=i(this,"success",7),this.fail=i(this,"fail",7),this.drawComplete=i(this,"drawComplete",7),this.editingAttachment=i(this,"editingAttachment",7),this.progressStatus=i(this,"progressStatus",7),this.modeChanged=i(this,"modeChanged",7),this.customizeSubmit=!1,this.enableSearch=!1,this.floorLevel=void 0,this.formElements=void 0,this.isMobile=void 0,this.locale=void 0,this.mapView=void 0,this.searchConfiguration=void 0,this.selectedLayerId=void 0,this.showGuidingMsg=!0,this.showGuidingMsgWhileDrawing=!0,this.submitNewReportsMessage=void 0,this._currentPage="templatePicker",this._editorLoading=!1,this._translations=void 0}get el(){return e(this)}Editor;ExpressionInfo;FeatureLayer;FieldElement;FormTemplate;MapView;Search;_addingAttachment;_calciteNotice;_container;_editor;_isSubmitBtnClicked=!1;_mapViewContainer;reactiveUtils;_search;_searchDiv;_selectedLayer;_updatedMapView;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async isMobileHandler(){this.modeChanged.emit()}async _editorLoadingWatchHandler(t){if(t){if(this._container?.classList.add("display-none"),this._selectedLayer?.isTable){const t={layer:this._selectedLayer,template:this._selectedLayer.templates[0]};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(t),await this.hideEditorsElements()}else await this.startCreate();this._container?.classList.remove("display-none"),this._editorLoading=!1}}async submit(){this._editor&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}async refresh(t){this._editor&&this._setFloorLevel(t)}success;fail;drawComplete;editingAttachment;progressStatus;modeChanged;async componentWillLoad(){await this._getTranslations(),await this.initModules()}async componentDidLoad(){await this.init()}componentDidRender(){this.isMobile&&(this._mapViewContainer.style.top=`${this._calciteNotice.offsetHeight+this._searchDiv.offsetHeight+80}px`)}disconnectedCallback(){this._editor&&this._editor.destroy()}render(){const t="drawing"===this._currentPage?"":"display-none",i=this._editorLoading?"":"display-none",e=this._editorLoading?"display-none":"",h=this.isMobile?"show-map":"display-none";let o=this._translations.chooseCategoryMsg;return"drawing"===this._currentPage?o=this._translations.provideLocationMsg:"featureForm"===this._currentPage&&(o=this._translations.provideDetailsMsg),s(a,{key:"cb3462a70e0097e9b4ac9dac3f910fce6d30f8b5"},this.showGuidingMsg&&(this.showGuidingMsgWhileDrawing||"drawing"!==this._currentPage)&&s("calcite-notice",{key:"ddd908ac4b31f60d07de064ec1decae06b3d93bd",class:"notice-msg",icon:"lightbulb",kind:"success",open:!0,ref:t=>this._calciteNotice=t},s("div",{key:"3cee10085fa29190d88d3d03d35f726d1b51651b",slot:"message"},o)),s("calcite-loader",{key:"cf714d63a011712fa03c148c17a8811356e14859",class:i,label:"",scale:"s"}),s("div",{key:"e20cb740a1d22795b397af191a26339d709aba0d",class:e,id:"feature-form"}),this.enableSearch&&s("div",{key:"d2b439d3845b69527fdea2414c7b22078b0af4ea",class:`search-widget ${t} ${e}`,id:"search-widget-ref",ref:t=>this._searchDiv=t}),s("div",{key:"1f4e39aaaa93f4e2102767c04c5ad256e4f129e2",class:`${h}`,ref:t=>{this._mapViewContainer=t}}))}async init(){this.mapView&&this.selectedLayerId&&(this._updatedMapView=this.mapView,await(this.isMobile?this.createMobileMapView():this._loadWidgets()))}async initModules(){const[t,i,e,s,a,h,n]=await o(["esri/widgets/Editor","esri/core/reactiveUtils","esri/widgets/Search","esri/form/ExpressionInfo","esri/form/elements/FieldElement","esri/form/FormTemplate","esri/views/MapView"]);this.Editor=t,this.reactiveUtils=i,this.Search=e,this.ExpressionInfo=s,this.FieldElement=a,this.FormTemplate=h,this.MapView=n}async createMobileMapView(){this._mapViewContainer.classList.add("hide-map"),await new this.MapView({map:this.mapView.map,container:this._mapViewContainer,zoom:this.mapView.zoom}).when((t=>{this._updatedMapView=t,this._loadWidgets()}),(t=>{console.log(t)}))}async _loadWidgets(){await this.createEditorWidget(),this.enableSearch&&await this.createSearchWidget()}async createEditorWidget(){this._editor&&this._editor.destroy();const t=[];this._container=document.createElement("div"),this._container?.classList.add("display-none");const i=await d(this._updatedMapView);this._selectedLayer=await c(this.mapView,this.selectedLayerId),this._selectedLayer?.isTable||i.forEach((async i=>{t.push({layer:i,enabled:"feature"===i?.type&&i?.id===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({view:this._updatedMapView,layerInfos:t,visibleElements:{snappingControls:!1,createFeaturesSection:!0,editFeaturesSection:!1,flow:!1},container:this._container}),this._mapViewContainer?this.el.insertBefore(this._container,this._mapViewContainer):this.el.appendChild(this._container);const e=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(e);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&"create-features"!==this._editor.viewModel?.activeWorkflow?.type&&(this.progressStatus.emit(50),this._editorLoading=!0)}));this._editor.viewModel.addHandles(s);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.featureFormViewModel?.state),(t=>{"ready"===t&&(this._mapViewContainer?.classList?.replace("show-map","hide-map"),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this)),setTimeout((()=>{this._setFloorLevel(this.floorLevel)}),50),this._currentPage="featureForm",this.progressStatus.emit(100),this.drawComplete.emit())}));this._editor.viewModel.addHandles(a);const h=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&"disabled"===this._editor.viewModel.featureFormViewModel.state&&(this._mapViewContainer?.classList?.replace("hide-map","show-map"),this._selectedLayer&&!this._selectedLayer.isTable&&(this._currentPage="drawing"))}));this._editor.viewModel.addHandles(h)}async startCreate(){return await this.hideEditorsElements(),new Promise(((t,i)=>{if(this._editor.viewModel.featureTemplatesViewModel.items?.length){const e=this._editor.viewModel.featureTemplatesViewModel.items[0].items;this._editor.viewModel.featureTemplatesViewModel.on("select",(()=>{this.progressStatus.emit(75),setTimeout((()=>{this.hideEditorsElements().then((()=>{t({})}),(t=>i(t)))}),700)})),1===e.length&&this._editor.viewModel.featureTemplatesViewModel.select(e[0]);const s=e.length>1;this.hideEditorsElements().then((()=>{s&&t({})}),(t=>s&&i(t)))}}))}async createSearchWidget(){let t={view:this._updatedMapView};this.searchConfiguration&&(t={...this._getSearchConfig(this.searchConfiguration,this._updatedMapView)}),this._search=new this.Search(t),this._search.container="search-widget-ref",this._search.popupEnabled=!1,this._search.resultGraphicEnabled=!1;let i=null;this._search.on("search-complete",(t=>{this._updatedMapView.goTo(t.results[0].results[0].extent),"point"===this._selectedLayer.geometryType&&(i=t.results[0].results[0]?.feature.geometry)}));const e=this.reactiveUtils.watch((()=>this._search.viewModel.state),(t=>{"ready"===t&&setTimeout((()=>{this._editor.viewModel.sketchViewModel.createGraphic&&i&&(this._editor.viewModel.sketchViewModel.createGraphic.set("geometry",i),this._editor.viewModel.sketchViewModel.complete(),this.hideEditorsElements())}),100)}));this._search.viewModel.addHandles(e)}_getSearchConfig(t,i){const e=t.sources;return e?.length>0?(t.includeDefaultSources=!1,e.forEach((t=>{if(t.hasOwnProperty("layer")){const e=t,s=e.layer?.id,a=s?i.map.findLayerById(s):null,h=e?.layer?.url;a?e.layer=a:h&&(e.layer=new this.FeatureLayer(h))}})),e?.forEach((t=>{if(t.hasOwnProperty("locator")){const i=t;"ArcGIS World Geocoding Service"===i?.name&&(i.outFields=i.outFields||["Addr_type","Match_addr","StAddr","City"],i.singleLineFieldName="SingleLine"),i.url=i.url,delete i.url}}))):t={...t,includeDefaultSources:!0},t}async _setFloorLevel(t){if(!t)return;const i=this._selectedLayer;if(i?.floorInfo?.floorField){const e=i.fields.find((t=>t.name===i.floorInfo.floorField));if(e&&!i?.formTemplate)this._editor.viewModel.featureFormViewModel.setValue(e.name,t),e.editable=!1;else if(i.formTemplate&&this.formElements){const e=new this.ExpressionInfo({expression:`"${t}"`,name:"floor-info-test",title:"Floor Info",returnType:"string"}),s=new this.FieldElement({label:i.floorInfo.floorField,editableExpression:"false",fieldName:i.floorInfo.floorField,input:{type:"text-box",maxLength:50,minLength:0},valueExpression:e.name});this._updatedMapView.map.editableLayers.forEach((t=>{const i=this.formElements.orgExpressionInfos,a=[...this.formElements.orgElements];a.push(s);const h=new this.FormTemplate({title:t.formTemplate.title,description:t.formTemplate.description,elements:a,expressionInfos:[e].concat(i)});t.formTemplate=h}))}}}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach((t=>{const i=t.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");i?.querySelector("header")?.setAttribute("style","display: none"),i?.querySelector("footer")?.setAttribute("style","display: none")})))}async submitted(t){if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}timeout(t){return new Promise((i=>setTimeout(i,t)))}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],isMobile:["isMobileHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};l.style=":host{display:block}.esri-editor__panel-toolbar{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 14px 20px 14px}.display-none{display:none !important}.hide-map{height:1%;visibility:hidden}.show-map{padding:10px !important;position:absolute !important;bottom:0;height:auto !important;width:calc(100% - 22px)}.notice-msg{padding:10px;width:calc(100% - 20px)}.esri-editor__panel-content{padding-block:10px !important}@media only screen and (max-width: 600px){.esri-editor__panel-content{padding-block:0 !important;min-height:0 !important}}";const p=class{constructor(e){t(this,e),this.editsComplete=i(this,"editsComplete",7),this.deleteDialog=void 0,this.buttonType="button",this.disabled=!1,this.icon=void 0,this.ids=[],this.layer=void 0,this.locale=void 0,this._confirmDelete=!1,this._deleteEndabled=!1,this._supportsDelete=void 0,this._translations=void 0}get el(){return e(this)}async idsWatchHandler(){this._setDeleteEnabled()}async layerWatchHandler(){this._setDeleteEnabled()}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}editsComplete;async componentWillLoad(){await this._getTranslations()}render(){return s(h,{key:"73d07f24703df76fdacc1b3a1ec80cfdd7bbee30"},"button"===this.buttonType?s("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())):s("calcite-action",{appearance:"solid",disabled:!this._deleteEndabled,id:this.icon,onClick:()=>this._delete(),scale:"s",text:this._translations.delete},s("calcite-button",{appearance:"transparent",iconStart:this.icon,kind:"danger"},this._translations.delete)),this._deleteMessage(),s("calcite-tooltip",{key:"803898895029bd098264b9144ff5ccee102d4ae8",placement:"bottom","reference-element":"button"===this.buttonType?"solutions-delete":this.icon},s("span",{key:"a920ffea1849667cd58812a2c1813d2e066f0064"},this._translations.delete)))}async componentDidLoad(){this._setDeleteEnabled()}_setDeleteEnabled(){this._supportsDelete=this.layer?.editingEnabled&&this.layer?.capabilities?.operations?.supportsDelete,this._deleteEndabled=!this.disabled||this._supportsDelete&&this.ids.length>0}_delete(){this._confirmDelete=!0}_deleteMessage(){return this.deleteDialog?this.deleteDialog:s("delete-dialog",{id:"solution-delete-dialog",ids:this.ids,layer:this.layer,locale:this.locale,onDeleteDialogClose:()=>this._confirmDelete=!1,open:this._confirmDelete})}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}static get watchers(){return{ids:["idsWatchHandler"],layer:["layerWatchHandler"],locale:["localeWatchHandler"]}}};p.style=":host{display:block}.delete-modal{position:fixed}";const f=class{constructor(e){t(this,e),this.closeEdit=i(this,"closeEdit",7),this.editorInitialized=i(this,"editorInitialized",7),this.editsComplete=i(this,"editsComplete",7),this.refreshGraphics=i(this,"refreshGraphics",7),this.enableEditGeometry=!1,this.graphics=void 0,this.locale=void 0,this.mapView=void 0,this.open=!1,this.graphicIndex=0,this._editorLoading=!1,this._translations=void 0}get el(){return e(this)}_activeWorkflowHandle;_addRelatedRecordHandle;_attachmentHandle;_editHandle;_layerEditHandle;Editor;_editor;_layer;_editContainer;_editControlElements;_editingDisabled;_shouldClose=!1;reactiveUtils;async graphicsWatchHandler(){0===this.graphics.length&&this.open&&await this._closeEdit(!0)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async openWatchHandler(t){t&&this.graphics?.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)}closeEdit;editorInitialized;editsComplete;refreshGraphics;async featureSelectionChange(){this.open&&await this._closeEdit(!1)}async componentWillLoad(){await this._initModules(),await this._getTranslations()}async componentWillRender(){this.graphics?.length>0&&this.graphics[0]?.layer&&(this._layer=this.graphics[0].layer,this._layerEditHandle&&this._layerEditHandle.remove(),this._layerEditHandle=("subtype-sublayer"===this._layer.type?this._layer.parent:this._layer).on("edits",(()=>{this.editsComplete.emit()})))}render(){const t=this._editorLoading?"display-none":"position-absolute",i=this._editorLoading?"":"display-none";return s(h,{key:"e181f65e7218ce0350de5dcab9049ff63a5d39c1"},s("div",{key:"44bf2b5cf31c5acc7f65fb7ec50fd84e77c95470",class:"position-absolute"},this.graphics?.length>0&&this.graphics[0]&&this.graphics[0].layer.editingEnabled?void 0:s("calcite-notice",{kind:"warning",open:!0,slot:"content-top",width:"full"},s("div",{slot:"message"},this._translations.enableEditing)),s("div",{key:"97119476aa2a992ccadc1d61119f2640d195e7b1",class:"position-absolute"},s("div",{key:"f429decea684a6a22db89de89da3755bdbff19cc",class:t,id:"feature-form",ref:t=>this._editContainer=t}),s("calcite-loader",{key:"3ea908ef8dadd2f1c85bfac1b344f8b4441b8706",class:i,label:"",scale:"s"}))))}async _initModules(){const[t,i]=await o(["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 d(this.mapView)).map((t=>({layer:t,geometryUpdatesEnabled:this.enableEditGeometry})));this._editor=new this.Editor({view:this.mapView,layerInfos:i,visibleElements:{flow:!0,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((()=>this._editor.viewModel.activeWorkflow?.activeWorkflow),(t=>{"update-table-record"!==t?.type&&"create-features"!==t?.type||(this._shouldClose=!1),(t?.type||t?.hasPendingEdits||this._editor.activeWorkflow)&&this._editor?.activeWorkflow?.started||(this.open=!1)})),this._editContainer.appendChild(t),this.editorInitialized.emit(this._editor)}}async _closeEdit(t){this._shouldClose=!0,t&&this._editor?.activeWorkflow?(this._editor.activeWorkflow?.activeWorkflow?.hasPendingEdits&&(await this._editor.activeWorkflow.reset(),await this._editor.cancelWorkflow()),this._editor.destroy()):this.graphicIndex>-1&&this.graphics?.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 n(this.el);this._translations=t[0]}static get watchers(){return{graphics:["graphicsWatchHandler"],locale:["localeWatchHandler"],open:["openWatchHandler"]}}};f.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{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}.esri-editor__panel-content{padding-block:10px !important}";const b=class{constructor(e){t(this,e),this.popupClosed=i(this,"popupClosed",7),this.clearSelection=i(this,"clearSelection",7),this.selectionChanged=i(this,"selectionChanged",7),this.enableEditGeometry=!1,this.graphics=void 0,this.isLoading=!1,this.isMobile=void 0,this.mapView=void 0,this.allowEditing=!0,this.highlightEnabled=!0,this.locale=void 0,this.paginationEnabled=!0,this.position="absolute",this.showCloseBtn=!1,this._alertOpen=!1,this._count="",this._editRecordOpen=!1,this._mobileTitle="",this._showListView=!1,this._translations=void 0,this._navigatedToRelatedFeature=void 0}get el(){return e(this)}Features;_editEnabled;_features;_layer;_popupUtils;_featuresNodeId="features-node"+(new Date).getMilliseconds().toString();reactiveUtils;_relatedFeature;async graphicsWatchHandler(){this._navigatedToRelatedFeature&&this._features&&(this._features.clear(),this._features.close(),this._count="",this._navigatedToRelatedFeature=!1),await this.setGraphics()}async isMobileWatchHandler(){await this._initFeaturesWidget()}async localeWatchHandler(){if(this.el.lang=this.locale,await this._getTranslations(),this._features){const t=[...this.graphics];this.graphics=[],this.graphics=t}}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}popupClosed;clearSelection;selectionChanged;async closeEdit(){this._editRecordOpen=!1}async layerSelectionChange(){this._showListView=!1,this._features?.viewModel&&(this._features.viewModel.featureMenuOpen=!1,this._features.close())}async refreshGraphics(t){this._navigatedToRelatedFeature||(this.graphics=[...t.detail])}async componentWillLoad(){await this._initModules(),await this._getTranslations(),this._popupUtils=new r}async componentDidLoad(){this.graphics?.length>0&&await this.setGraphics()}render(){const t=this.isLoading?"":"display-none",i=this.isLoading||this._editRecordOpen?"visibility-hidden":"position-absolute",e=!this.isLoading&&this._editRecordOpen?"position-absolute":"display-none",a=!this.isLoading&&this._editRecordOpen||this._showListView?"display-none":"",o=this._features?.features?.length<2||this._navigatedToRelatedFeature,n=this.isMobile?"display-none":"",d=this._features?.selectedFeature?.getObjectId(),c=parseInt(d?.toString(),10)>-1?[d]:[],r=this._layer?.editingEnabled&&this._layer?.capabilities?.operations?.supportsDelete,l=this._relatedFeature?[this._relatedFeature]:this.graphics,p=this._navigatedToRelatedFeature?0:this._features?.selectedFeatureIndex;return s(h,{key:"7662ad49543f574bbcb58f2b9611efefc0420259"},s("calcite-shell",{key:"10075ee9cdf4d9e8a6dee615755c53eaaece8c21",style:{position:this.position}},this._getHeader(),s("calcite-loader",{key:"fc668f26163e1135d37a5dee1c08d72d7feee9d5",class:t,label:this._translations.fetchingData}),s("div",{key:"73faf27901ae65feaf4faae8227aa21bfb1fb0a3",class:"esri-widget feature-node "+i,id:this._featuresNodeId}),s("div",{key:"ced1edadc747dd7a087fed7b0a8e378def491381",class:`${a} width-100`,slot:"footer"},this.allowEditing&&s("div",{key:"3f1ab07a2d197730d03497d0c5c5a2970e0f42ec",class:"display-flex top-border padding-1-2"},s("calcite-button",{key:"946cb64983426ce95c8a209aa7ae59405124709f",appearance:"solid",id:"solutions-edit",onClick:()=>this._openEditRecord(),width:"full"},this._translations.edit),this.isMobile&&r?s("delete-button",{class:"padding-inline-start-1 width-100",id:"solutions-delete",ids:c,layer:this._layer,locale:this.locale,onEditsComplete:()=>this._closePopup()}):void 0,s("calcite-tooltip",{key:"4123a740f077f6d203ae75338655a3e4f988b3dd",placement:"bottom","reference-element":"solutions-edit"},s("span",{key:"6968a12b2f41737cb221bc7ddbcab834f990fe3c"},this._translations.edit)),this.isMobile&&r?s("calcite-tooltip",{placement:"bottom","reference-element":"solutions-delete"},s("span",null,this._translations.delete)):void 0),this.paginationEnabled&&!o&&s("div",{key:"31d228643a734df28880c009f8d9a989f07acedb",class:`display-flex padding-1-2 button-container top-border ${n}`},s("div",{key:"f1dd88d8e5359e8acfc3508890185f8769365ec8"},s("calcite-button",{key:"86190bfd8442bcf327c8aa60272a4071dead2dbc",appearance:"transparent",disabled:o,iconFlipRtl:"both",iconStart:"chevron-left",id:"solutions-back",onClick:()=>this._back(),width:"full"}),s("calcite-tooltip",{key:"6cf40e219e228547636a228d306dc6fc2929d186",placement:"top","reference-element":"solutions-back"},s("span",{key:"39a43c0568c3d9e71587d3e3a38970a97f16efa4"},this._translations.back))),s("calcite-action",{key:"373330d9385477e7b8701bff969d93ccf992f8b6",class:"pagination-action",iconFlipRtl:!0,onClick:()=>this._toggleListView(),scale:"s",text:"",textEnabled:!0},s("span",{key:"badd298438061c4c61b5f5561d0883fd063d1434",class:"pagination-count"},this._count)),s("div",{key:"501d8970243fa398721c9db04cff5491f59fe045"},s("calcite-button",{key:"9118e14df5f7932e91e823a5bd35fe6292af1c07",appearance:"transparent",disabled:o,iconFlipRtl:"both",iconStart:"chevron-right",id:"solutions-next",onClick:()=>this._next(),width:"full"}),s("calcite-tooltip",{key:"29a22347603b730ab160023667bb1fc7654e69d4",placement:"top","reference-element":"solutions-next"},s("span",{key:"2404d5b018b0e6478a366d995c61e6ec40e9e486"},this._translations.next))))),s("edit-card",{key:"cad638e12cf79d7efbc8d4fa05da14ddd1140197",class:e,enableEditGeometry:this.enableEditGeometry,graphicIndex:p,graphics:l,locale:this.locale,mapView:this.mapView,open:this._editRecordOpen}),s("calcite-alert",{key:"b0ce00184f525e8156d282e5efd30962b018e226",icon:"layer-broken",kind:"warning",label:"",onCalciteAlertClose:()=>this._alertClosed(),open:this._alertOpen,placement:"top"},s("div",{key:"35f655f6dc9c274b07ccafe769e8e9af357862d1",slot:"title"},this._translations.editDisabled),s("div",{key:"e2b8de0fdb5eac8b37e5bb2a872fd390d9b42d29",slot:"message"},this._translations.enableEditing))))}async _initModules(){const[t,i]=await o(["esri/widgets/Features","esri/core/reactiveUtils"]);this.Features=t,this.reactiveUtils=i}async setGraphics(){this._features||await this._initFeaturesWidget(),this.graphics.length>0?(this._layer=this.graphics[0]?.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(){return void 0!==this.isMobile?await(this.mapView?.when((()=>{this._features?(this._features.view=this.mapView,this._features.visibleElements.actionBar=!1,this._features.visibleElements.closeButton=this.showCloseBtn,this._features.visibleElements.heading=!this.isMobile):(this._features=new this.Features({view:this.mapView,container:this._featuresNodeId,visibleElements:{actionBar:!1,closeButton:this.showCloseBtn,featureMenuHeading:!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})})),this.reactiveUtils.watch((()=>this._features.selectedDrillInFeature),(t=>{t?(this._relatedFeature=t,this._navigatedToRelatedFeature=!0):(this._relatedFeature=null,this._navigatedToRelatedFeature=!1)})),this.el.querySelector("#"+this._featuresNodeId).addEventListener("calciteFlowItemClose",(()=>{this.clearSelection.emit()})))}))):Promise.resolve()}_getHeader(){return this.isMobile&&!this._editRecordOpen?s("calcite-panel",{class:"border-width-0",slot:"header"},s("calcite-action",{class:"end-border",icon:"chevron-left",iconFlipRtl:!0,onClick:()=>this._closePopup(),scale:"s",slot:"header-actions-start",text:""}),s("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(){const t=(this._features?.viewModel.selectedFeatureIndex+1).toString(),i=this._features?.features?.length.toString();return this._translations.indexOfTotal.replace("{{index}}",t).replace("{{total}}",i)}_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 n(this.el);this._translations=t[0]}static get watchers(){return{graphics:["graphicsWatchHandler"],isMobile:["isMobileWatchHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"]}}};b.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{l as create_feature,p as delete_button,f as edit_card,b as info_card}
|