@esri/solutions-components 0.8.17 → 0.8.18
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-flow_6.cjs.entry.js +8 -7
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +4 -3
- package/dist/cjs/feature-list.cjs.entry.js +5 -3
- package/dist/collection/components/create-related-feature/create-related-feature.js +17 -1
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +4 -3
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +3 -2
- package/dist/collection/components/feature-details/feature-details.js +22 -7
- package/dist/collection/components/feature-list/feature-list.js +5 -3
- package/dist/components/create-related-feature2.js +2 -1
- package/dist/components/crowdsource-reporter.js +4 -3
- package/dist/components/feature-details2.js +6 -6
- package/dist/components/feature-list2.js +5 -3
- package/dist/esm/calcite-flow_6.entry.js +8 -7
- package/dist/esm/crowdsource-reporter.entry.js +4 -3
- package/dist/esm/feature-list.entry.js +5 -3
- package/dist/solutions-components/{p-d4686851.entry.js → p-48c99a48.entry.js} +1 -1
- package/dist/solutions-components/p-64779bb2.entry.js +6 -0
- package/dist/solutions-components/{p-b6d47bab.entry.js → p-f6668347.entry.js} +3 -3
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/types/components/create-related-feature/create-related-feature.d.ts +16 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +1 -0
- package/dist/types/components/feature-details/feature-details.d.ts +16 -1
- package/dist/types/components/feature-list/feature-list.d.ts +4 -0
- package/dist/types/components.d.ts +1 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-22aece81.entry.js +0 -6
@@ -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,g as o}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-583e5dd0.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 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 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].reporting)):[],await this.setMapView()})))}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(e,{key:"530bb7e6dacde9109246733345157c95c1a50dcb"},this._reportSubmitted&&s("calcite-alert",{key:"52abbe347eb4adaf526a3194cb4d389326323d19","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:"3251fcd334b449292d3597af996eb7eea08dd00e",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"0d0553df8133b8d20cc0f2d66a8462334117b5cf","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"81658d0eab5392cbddbcf42ccb0b79b0cebc22dd",slot:"title"},this._translations.error),s("div",{key:"e4a00bef08ca9121425fd4f3b8ac7bfffa70d371",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"97a200eebe63b3f6fb7515fa07c617d40f94815f","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"b9b01d82faded409059563840a4bc0ce3ef1faf7",slot:"message"},this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"3754d8a1d5d91ac3bf3b1bddc16f078170e61a80","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"977b632702e8dc176bd9a9c930c1492539689576",slot:"title"},this._translations.error),s("div",{key:"45fa0ba61f3831a743b0cc7ae4aa10854b1a9ff5",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"57be499cc8fb87ca20c6efa65fbbe9cc47269906"},s("calcite-shell",{key:"2ce48b4cdd0dc0dd52995cd7b32f476b14ddd49d","content-behind":!0},this._getReporter())),this.filterModal())}async _initModules(){const[t]=await l(["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)}))}_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(){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:this._layers,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);this._validLayers=[],s.forEach((t=>{i.includes(t.id)&&this._validLayers.push(t)})),this.handleMapClick(),this._hasValidLayers=i.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]&&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 onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,i){var e;const a=null===(e=this.layerExpressions)||void 0===e?void 0:e.filter((t=>t.id===this._selectedLayerId)),h=(null==a?void 0:a.length)>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this._toggleSort(),s("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),h&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:this._toggleFilter.bind(this),slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&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(){const t=this.reportingOptions[this._currentFeature.layer.id].comment&&this._currentFeature.layer.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,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),s("calcite-panel",null,this._selectedFeature.length>1&&this.getFeaturesPagination(),s("feature-details",{class:"full-height",graphics:this._selectedFeature,mapView:this.mapView,onFeatureSelect:this.onCommentSelectFromList.bind(this),onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions}),t&&s("calcite-button",{appearance:"solid",onClick:()=>this._flowItems=[...this._flowItems,"add-comment"],slot:"footer",width:"full"},this._translations.comment)))}getFeaturesPagination(){return s("div",{class:"feature-pagination",slot:"header-actions-start"},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",class:"pagination-action",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,zoomAndScrollToSelected:!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){if(this._currentFeature=t,t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField],this.reportingOptions[t.layer.id].comment&&t.layer.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&&"feature-details"!==this._flowItems[this._flowItems.length-1]?this._flowItems=[...this._flowItems,"feature-details"]:(this._flowItems=[...this._flowItems],this.highlightOnMap(t[0]))),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 o(this.el);this._translations=t[0]}reduceToConfiguredLayers(t){var i;const s=(null===(i=this._layers)||void 0===i?void 0:i.length)>0?this._layers:[];return Object.keys(t).reduce(((i,e)=>{let a=t[e].supportsAdd;return(null==s?void 0:s.length)>0&&(a=s.indexOf(e)>-1&&t[e].supportsAdd),a&&i.push(e),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)}async renderFeaturesList(){const t={detail:this._editableLayerIds};await this.layerListLoaded(t),this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this._flowItems=["feature-list"]}_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&&(this._selectedFeature=i,this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems],await this.highlightOnMap(i[0]))}}}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{align-items:center;margin:5% 124%;display:flex}.pagination-count{width:32px;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,g as o}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-583e5dd0.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";const b=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 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 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].reporting)):[],await this.setMapView()})))}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(e,{key:"530bb7e6dacde9109246733345157c95c1a50dcb"},this._reportSubmitted&&s("calcite-alert",{key:"52abbe347eb4adaf526a3194cb4d389326323d19","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:"3251fcd334b449292d3597af996eb7eea08dd00e",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"0d0553df8133b8d20cc0f2d66a8462334117b5cf","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"81658d0eab5392cbddbcf42ccb0b79b0cebc22dd",slot:"title"},this._translations.error),s("div",{key:"e4a00bef08ca9121425fd4f3b8ac7bfffa70d371",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"97a200eebe63b3f6fb7515fa07c617d40f94815f","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"b9b01d82faded409059563840a4bc0ce3ef1faf7",slot:"message"},this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"3754d8a1d5d91ac3bf3b1bddc16f078170e61a80","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"977b632702e8dc176bd9a9c930c1492539689576",slot:"title"},this._translations.error),s("div",{key:"45fa0ba61f3831a743b0cc7ae4aa10854b1a9ff5",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"57be499cc8fb87ca20c6efa65fbbe9cc47269906"},s("calcite-shell",{key:"2ce48b4cdd0dc0dd52995cd7b32f476b14ddd49d","content-behind":!0},this._getReporter())),this.filterModal())}async _initModules(){const[t]=await l(["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)}))}_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(){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:this._layers,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);this._validLayers=[],s.forEach((t=>{i.includes(t.id)&&this._validLayers.push(t)})),this.handleMapClick(),this._hasValidLayers=i.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]&&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 onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,i){var e;const a=null===(e=this.layerExpressions)||void 0===e?void 0:e.filter((t=>t.id===this._selectedLayerId)),h=(null==a?void 0:a.length)>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this._toggleSort(),s("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),h&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:this._toggleFilter.bind(this),slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&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(){const t=this.reportingOptions[this._currentFeature.layer.id].comment&&this._currentFeature.layer.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,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,mapView:this.mapView,onFeatureSelect:this.onCommentSelectFromList.bind(this),onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions}),t&&s("calcite-button",{appearance:"solid",onClick:()=>this._flowItems=[...this._flowItems,"add-comment"],slot:"footer",width:"full"},this._translations.comment)))}getFeaturesPagination(){return s("div",{class:"feature-pagination"},s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-left",id:"solutions-back",onClick:()=>{this._featureDetails.back()},scale:"s",width:"full"}),s("calcite-tooltip",{label:"",placement:"top","reference-element":"solutions-back"},s("span",null,this._translations.back))),s("calcite-button",{appearance:"transparent",onClick:()=>{this._featureDetails.toggleListView()},scale:"s"},s("span",{class:"pagination-count"},this._getCount())),s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-right",id:"solutions-next",onClick:()=>{this._featureDetails.next()},scale:"s",width:"full"}),s("calcite-tooltip",{placement:"top","reference-element":"solutions-next"},s("span",null,this._translations.next))))}getCommentDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedRelatedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,paginationEnabled:!1,zoomAndScrollToSelected:!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){if(this._currentFeature=t,t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField],this.reportingOptions[t.layer.id].comment&&t.layer.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&&"feature-details"!==this._flowItems[this._flowItems.length-1]?this._flowItems=[...this._flowItems,"feature-details"]:(this._flowItems=[...this._flowItems],this.highlightOnMap(t[0]))),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 o(this.el);this._translations=t[0]}reduceToConfiguredLayers(t){var i;const s=(null===(i=this._layers)||void 0===i?void 0:i.length)>0?this._layers:[];return Object.keys(t).reduce(((i,e)=>{let a=t[e].supportsAdd;return(null==s?void 0:s.length)>0&&(a=s.indexOf(e)>-1&&t[e].supportsAdd),a&&i.push(e),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)}async renderFeaturesList(){const t={detail:this._editableLayerIds};await this.layerListLoaded(t),this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this._flowItems=["feature-list"]}_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&&(this._selectedFeature=i,this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems],await this.highlightOnMap(i[0]))}}}get el(){return h(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};b.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{b as crowdsource_reporter}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import{r as t,c as i,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-ebf82ce0.js";import{g as n,c as o,h as l}from"./p-583e5dd0.js";import"./p-82e085d0.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._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:"9f702c6d98cc19704e0773e36fd969817ea7262e","full-height":!0,"full-width":!0},this._isLoading&&s("calcite-loader",{key:"e9acf13f3444057b097d6b145c1a6e0118f150ea",label:"",scale:"m"}),0===this._featureItems.length&&!this._isLoading&&s("calcite-notice",{key:"8c7fa89e2da7490b04456e51f8534c2515a02399",class:"error-msg",icon:"feature-details",kind:"info",open:!0},s("div",{key:"799d419e9c26b7928f15cb1cf9afa9f47cab0e94",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),s("calcite-list",{key:"82c60b16ab586ad57f8f98bb08814f688102b166","selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&s("div",{key:"e5b789ea46c6bedfbe83f1323ffb89271c0b76ce",class:"width-full",slot:"footer"},s("calcite-pagination",{key:"4d30b5364fc4742f278157c5f2c21e75d4ecb0b8",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",{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}.feature-list-popup-title-small{font-size:x-small;padding:10px 12px}";export{r as feature_list}
|
@@ -3,15 +3,15 @@
|
|
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,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,s as
|
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 v,s as y,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 C}from"./p-896c9644.js";import{a as _,g as S,b as j,d as I}from"./p-583e5dd0.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
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 E="frame",z="frame--advancing",W="frame--retreating",D=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],
|
11
|
+
*/const E="frame",z="frame--advancing",W="frame--retreating",D=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,[z]:"advancing"===t,[W]:"retreating"===t}},i("slot",{key:"a02231a5002f8b19542e03529aad12771787b26f"}))}get el(){return s(this)}};D.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}:host([hidden]){display:none}[hidden]{display:none}";
|
12
12
|
/*!
|
13
13
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
14
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
15
|
* v2.8.2
|
16
16
|
*/
|
17
|
-
const F=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),v(this)}async componentWillLoad(){await y(this),h(this)}componentDidRender(){b(this)}disconnectedCallback(){f(this),m(this),g(this)}componentDidLoad(){l(this)}effectiveLocaleChange(){w(this,this.effectiveLocale)}async setFocus(){await c(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:c,disabled:h,heading:l,headingLevel:r,loading:d,menuOpen:b,messages:f,overlayPositioning:u}=this;return i(a,{key:"ab926d381ff2493f3fd49a5c8724260211d69ca9"},i(p,{key:"6799b56c2116de5e08739ddc2ec1557bd291f3f8",disabled:h},i("calcite-panel",{key:"2e438b8abf573eabaaa2e966dcca5c4843a53cba",closable:o,closed:n,collapseDirection:s,collapsed:t,collapsible:e,description:c,disabled:h,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"]}}};F.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 O=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.mapView=void 0,this.selectedLayerId=void 0,this.customizeSubmit=!1,this.searchConfiguration=void 0,this.showSearchWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&this._editor.viewModel.featureFormViewModel.submit()}async componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){const t=this.showSearchWidget?"":"display-none";return i(o,{key:"66e42055c22a93c6d34440b65ac950a388639b9a"},i("div",{key:"fc4bf1fc039e4d914e416a394f0671712d116482",id:"feature-form"}),i("div",{key:"aadd529366b2b85e60fdffc306cf41f37c2a6709",class:`search-widget ${t}`,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(){this._editor&&this._editor.destroy();const t=[],i=document.createElement("div");(await _(this.mapView)).forEach((async i=>{t.push({layer:i,enabled:"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.id)===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({allowedWorkflows:"create-features",view:this.mapView,layerInfos:t,visibleElements:{snappingControls:!1},container:i}),this.el.appendChild(i);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.startCreate())}));this._editor.viewModel.addHandles(e);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&(this.showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){var t;if(null===(t=this._editor.viewModel.featureTemplatesViewModel.items)||void 0===t?void 0:t.length){const t=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()}),700),this.hideEditorsElements()})),1===t.length&&this._editor.viewModel.featureTemplatesViewModel.select(t[0]),this.hideEditorsElements()}}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,c=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;n?a.layer=n:c&&(a.layer=new this.FeatureLayer(c))}})),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}hideEditorsElements(){this.customizeSubmit&&setTimeout((()=>{var t;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")}))}),700)}async submitted(t){var i;if(!t.invalid.length&&t.valid.length){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()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};O.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 B=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.mapView=void 0,this.table=void 0,this.selectedFeature=void 0,this.customizeSubmit=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&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(a,{key:"383e8fac89d037f77241d856013202d1e04b28ba"})}async componentDidLoad(){await this.init()}async createEditorWidget(){this._editor&&this._editor.destroy();const t=document.createElement("div");this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:t}),this.el.appendChild(t);const i=this.reactiveUtils.watch((()=>{var t;return null===(t=this._editor.viewModel.featureFormViewModel)||void 0===t?void 0:t.state}),(t=>{"ready"===t&&this.hideEditorsElements()}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&this.startCreate()}));this._editor.viewModel.addHandles(s);const e=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(e)}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),this.isActionPending.emit(!1),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}hideEditorsElements(){this.customizeSubmit&&setTimeout((()=>{var t;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")}))}),700)}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&&t.valid.length){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()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};B.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}";const T=class{constructor(i){t(this,i),this.loadingStatus=e(this,"loadingStatus",7),this.featureSelect=e(this,"featureSelect",7),this._validFieldTypes=["small-integer","integer","big-integer","single","long"],this.mapView=void 0,this.graphics=void 0,this.reportingOptions=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}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:"c39c0eec021627b920972f7d4bce0d45bfe0a9c2","full-height":!0},i("info-card",{key:"e90cb427a1f874216afcfdf0a33804bf14fb6a2c",allowEditing:!1,graphics:this.graphics,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,paginationEnabled:!1,position:"relative",ref:t=>this._infoCard=t,zoomAndScrollToSelected:!0}),(this._likeFieldAvailable||this._dislikeFieldAvailable||this._commentsAvailable)&&i("div",{key:"ecfdf111612c92eacfd97dae7bb3080b7ad50e96",class:"buttons-container"},this._commentsAvailable&&i("div",{key:"07a8213e11585041fb1c5f56254447a720033f04",class:"comment-btn"},i("span",{key:"f4071fbd03372a0e88857962e9c31530e2dc693a"},this._relatedFeaturesOIDs.length),i("calcite-icon",{key:"30258e1daae5f1e00d18dd4ec052861de46b45bf",icon:"speech-bubble",scale:"s"})),this._likeFieldAvailable&&i("calcite-button",{key:"fa76245789a29e49be06482fd8cd0244f44d19ab",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",onClick:this.onLikeButtonClick.bind(this),scale:"s"},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:"ac9adc799a93f08319b2f0b797cd5d4773b1a6cb",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",onClick:this.onDislikeButtonClick.bind(this),scale:"s"},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:"165b2ac0af65cbbab945a0dfd4ac878cc41af56c",class:"height-full",mapView:this.mapView,pageSize:5,ref:t=>this._commentsList=t,selectedLayerId:this.relatedTableId,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[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&&(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((t=>{this._validFieldTypes.indexOf(t.type)>-1&&(t.name===this._likeField&&this.reportingOptions[this._selectedGraphic.layer.id].like?(this._likeFieldAvailable=!0,this._likeCount=this._selectedGraphic.attributes[t.name]):t.name===this._dislikeField&&this.reportingOptions[this._selectedGraphic.layer.id].dislike&&(this._dislikeFieldAvailable=!0,this._disLikeCount=this._selectedGraphic.attributes[t.name]))})),this.getFromLocalStorage()}}onLikeButtonClick(){this.loadingStatus.emit(!0),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.loadingStatus.emit(!0),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,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.loadingStatus.emit(!1)}),(t=>{this.loadingStatus.emit(!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"]}}};T.style=":host{display:block}.buttons-container{align-items:center;display:flex;padding:10px 0 10px 15px;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:5px;width:37px;font-size:var(--calcite-font-size--2);align-items:center}";const N=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:"c73bf36c13fed8120273d8a5321dd60fe4d4b5f4"},this._isLoading&&i("calcite-loader",{key:"e748d9cc7d1855d3a2da34702ba853d35d1a2cde",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{key:"4a06b7694fd91456ee5cdc51d33e4ac633d416b2",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{key:"63b09f02312aba71826957c5b2c04a7750bdfca1",slot:"title"},this._translations.error),i("div",{key:"5a19dfe527a6c66a5477a4c6a14f4686cde73bb3",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{key:"e8a6170a55f4ba6ea35a1397690c3e365b814886","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await I(this.mapView,!0),(await _(this.mapView)).forEach((async i=>{var s,e;if("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)&&(this._layerItemsHash[i.id].supportsAdd=!0,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)=>{let e=!0;return(null==s?void 0:s.length)>0&&(e=s.indexOf(i)>-1),e&&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",{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 C(this.el);this._translations=t[0]}get el(){return s(this)}};N.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{D as calcite_flow,F as calcite_flow_item,O as create_feature,B as create_related_feature,T as feature_details,N as layer_list}
|
17
|
+
const F=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),v(this)}async componentWillLoad(){await y(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"]}}};F.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 O=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.mapView=void 0,this.selectedLayerId=void 0,this.customizeSubmit=!1,this.searchConfiguration=void 0,this.showSearchWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&this._editor.viewModel.featureFormViewModel.submit()}async componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){const t=this.showSearchWidget?"":"display-none";return i(o,{key:"66e42055c22a93c6d34440b65ac950a388639b9a"},i("div",{key:"fc4bf1fc039e4d914e416a394f0671712d116482",id:"feature-form"}),i("div",{key:"aadd529366b2b85e60fdffc306cf41f37c2a6709",class:`search-widget ${t}`,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(){this._editor&&this._editor.destroy();const t=[],i=document.createElement("div");(await _(this.mapView)).forEach((async i=>{t.push({layer:i,enabled:"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.id)===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({allowedWorkflows:"create-features",view:this.mapView,layerInfos:t,visibleElements:{snappingControls:!1},container:i}),this.el.appendChild(i);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.startCreate())}));this._editor.viewModel.addHandles(e);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&(this.showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){var t;if(null===(t=this._editor.viewModel.featureTemplatesViewModel.items)||void 0===t?void 0:t.length){const t=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()}),700),this.hideEditorsElements()})),1===t.length&&this._editor.viewModel.featureTemplatesViewModel.select(t[0]),this.hideEditorsElements()}}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}hideEditorsElements(){this.customizeSubmit&&setTimeout((()=>{var t;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")}))}),700)}async submitted(t){var i;if(!t.invalid.length&&t.valid.length){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()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};O.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 B=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.mapView=void 0,this.table=void 0,this.selectedFeature=void 0,this.customizeSubmit=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&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(a,{key:"9807b7dcad1f8305756e6098f1e64ef8caffcbac"})}async componentDidLoad(){await this.init()}async createEditorWidget(){this._editor&&this._editor.destroy();const t=document.createElement("div");this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:t}),this.el.appendChild(t);const i=this.reactiveUtils.watch((()=>{var t;return null===(t=this._editor.viewModel.featureFormViewModel)||void 0===t?void 0:t.state}),(t=>{"ready"===t&&this.hideEditorsElements()}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&this.startCreate()}));this._editor.viewModel.addHandles(s);const e=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(e)}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),this.isActionPending.emit(!1),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}hideEditorsElements(){this.customizeSubmit&&setTimeout((()=>{var t;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")}))}),700)}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&&t.valid.length){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()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};B.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}";const T=class{constructor(i){t(this,i),this.loadingStatus=e(this,"loadingStatus",7),this.featureSelect=e(this,"featureSelect",7),this._validFieldTypes=["small-integer","integer","big-integer","single","long"],this.mapView=void 0,this.graphics=void 0,this.reportingOptions=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}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:"b8d1cc9d4d9040665be3c892f5738a179ab64eaf","full-height":!0},i("info-card",{key:"0a31a068a4e80e34ba2435a7d8d8faaea271dac8",allowEditing:!1,graphics:this.graphics,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,paginationEnabled:!1,position:"relative",ref:t=>this._infoCard=t,zoomAndScrollToSelected:!0}),(this._likeFieldAvailable||this._dislikeFieldAvailable||this._commentsAvailable)&&i("div",{key:"8e27d13341a9b4ad37f87778e046a4e8e0b2778e",class:"buttons-container"},this._commentsAvailable&&i("div",{key:"3dd02fdbc107e7ce04e8aabb96a6748b68eeec6b",class:"comment-btn"},i("span",{key:"5601fdb24ff385e0b6d2b9e5b86bde06b3c2d1b8"},this._relatedFeaturesOIDs.length),i("calcite-icon",{key:"97a517d117a4d5a8c6798da9c9c82e46c39c25f8",icon:"speech-bubble",scale:"s"})),this._likeFieldAvailable&&i("calcite-button",{key:"0d1ff14be9396ab3ff634e92208792f5fd3b8d36",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",onClick:this.onLikeButtonClick.bind(this),scale:"s"},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:"34e362e083dbc13dffae7ad5544aa33a0421a51a",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",onClick:this.onDislikeButtonClick.bind(this),scale:"s"},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:"4abc53ab7679b07f0dd7413b97f447da736e5002",class:"height-full",mapView:this.mapView,pageSize:5,ref:t=>this._commentsList=t,selectedLayerId:this.relatedTableId,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[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&&(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((t=>{this._validFieldTypes.indexOf(t.type)>-1&&(t.name===this._likeField&&this.reportingOptions[this._selectedGraphic.layer.id].like?(this._likeFieldAvailable=!0,this._likeCount=this._selectedGraphic.attributes[t.name]):t.name===this._dislikeField&&this.reportingOptions[this._selectedGraphic.layer.id].dislike&&(this._dislikeFieldAvailable=!0,this._disLikeCount=this._selectedGraphic.attributes[t.name]))})),this.getFromLocalStorage()}}onLikeButtonClick(){this.loadingStatus.emit(!0),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.loadingStatus.emit(!0),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,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.loadingStatus.emit(!1)}),(t=>{this.loadingStatus.emit(!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"]}}};T.style=":host{display:block}.buttons-container{align-items:center;display:flex;padding:10px 0 10px 15px;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:5px;width:37px;font-size:var(--calcite-font-size--2);align-items:center}";const N=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:"c73bf36c13fed8120273d8a5321dd60fe4d4b5f4"},this._isLoading&&i("calcite-loader",{key:"e748d9cc7d1855d3a2da34702ba853d35d1a2cde",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{key:"4a06b7694fd91456ee5cdc51d33e4ac633d416b2",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{key:"63b09f02312aba71826957c5b2c04a7750bdfca1",slot:"title"},this._translations.error),i("div",{key:"5a19dfe527a6c66a5477a4c6a14f4686cde73bb3",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{key:"e8a6170a55f4ba6ea35a1397690c3e365b814886","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await I(this.mapView,!0),(await _(this.mapView)).forEach((async i=>{var s,e;if("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)&&(this._layerItemsHash[i.id].supportsAdd=!0,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)=>{let e=!0;return(null==s?void 0:s.length)>0&&(e=s.indexOf(i)>-1),e&&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",{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 C(this.el);this._translations=t[0]}get el(){return s(this)}};N.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{D as calcite_flow,F as calcite_flow_item,O as create_feature,B as create_related_feature,T as feature_details,N as layer_list}
|