@esri/solutions-components 0.11.15 → 0.11.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +6 -6
- package/dist/cjs/buffer-tools_2.cjs.entry.js +1 -1
- package/dist/cjs/card-manager_3.cjs.entry.js +3 -3
- package/dist/cjs/create-feature_4.cjs.entry.js +7 -8
- package/dist/cjs/create-related-feature_3.cjs.entry.js +12 -8
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +20 -16
- package/dist/cjs/feature-list.cjs.entry.js +141 -7
- package/dist/cjs/json-editor_7.cjs.entry.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-layer-picker.cjs.entry.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
- package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
- package/dist/cjs/solution-item-accordion.cjs.entry.js +33 -2
- package/dist/cjs/solution-item-icon.cjs.entry.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
- package/dist/collection/assets/t9n/feature-list/resources.json +3 -1
- package/dist/collection/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/collection/components/create-feature/create-feature.js +5 -6
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +40 -16
- package/dist/collection/components/feature-details/feature-details.js +30 -6
- package/dist/collection/components/feature-list/feature-list.css +16 -6
- package/dist/collection/components/feature-list/feature-list.js +162 -6
- package/dist/collection/components/floor-filter/floor-filter.js +1 -1
- package/dist/collection/components/info-card/info-card.js +2 -2
- package/dist/collection/components/json-editor/json-editor.js +1 -1
- package/dist/collection/components/layer-list/layer-list.css +2 -2
- package/dist/collection/components/layer-list/layer-list.js +1 -1
- package/dist/collection/components/layer-table/layer-table.js +2 -2
- package/dist/collection/components/map-card/map-card.js +1 -1
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
- package/dist/collection/components/map-legend/map-legend.js +1 -1
- package/dist/collection/components/map-picker/map-picker.js +1 -1
- package/dist/collection/components/map-search/map-search.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/map-tools/map-tools.js +1 -1
- package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
- package/dist/collection/components/pdf-download/pdf-download.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +1 -1
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
- package/dist/collection/components/solution-contents/solution-contents.js +1 -1
- package/dist/collection/components/solution-item/solution-item.js +1 -1
- package/dist/collection/components/solution-item-accordion/solution-item-accordion.js +78 -2
- package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
- package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
- package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
- package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
- package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
- package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
- package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
- package/dist/collection/components/solution-variables/solution-variables.js +1 -1
- package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
- package/dist/collection/demos/crowdsource-reporter.html +1 -0
- package/dist/collection/demos/solution-item-accordion.html +12 -1
- package/dist/components/create-feature2.js +5 -6
- package/dist/components/crowdsource-reporter.js +21 -16
- package/dist/components/feature-details2.js +11 -6
- package/dist/components/feature-list2.js +144 -7
- package/dist/components/floor-filter2.js +1 -1
- package/dist/components/info-card2.js +2 -2
- package/dist/components/json-editor2.js +1 -1
- package/dist/components/layer-list2.js +2 -2
- package/dist/components/layer-table2.js +2 -2
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-draw-tools2.js +1 -1
- package/dist/components/map-fullscreen2.js +1 -1
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-legend2.js +1 -1
- package/dist/components/map-picker2.js +1 -1
- package/dist/components/map-search2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/map-tools2.js +1 -1
- package/dist/components/pci-calculator.js +1 -1
- package/dist/components/pdf-download2.js +1 -1
- package/dist/components/public-notification.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/solution-configuration.js +3 -3
- package/dist/components/solution-contents2.js +1 -1
- package/dist/components/solution-item-accordion.js +36 -3
- package/dist/components/solution-item-details2.js +1 -1
- package/dist/components/solution-item-icon2.js +1 -1
- package/dist/components/solution-item-sharing2.js +1 -1
- package/dist/components/solution-item2.js +1 -1
- package/dist/components/solution-organization-variables2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-spatial-ref2.js +1 -1
- package/dist/components/solution-template-data2.js +1 -1
- package/dist/components/solution-variables2.js +1 -1
- package/dist/components/spatial-ref.js +1 -1
- package/dist/esm/basemap-gallery_7.entry.js +6 -6
- package/dist/esm/buffer-tools_2.entry.js +1 -1
- package/dist/esm/card-manager_3.entry.js +3 -3
- package/dist/esm/create-feature_4.entry.js +7 -8
- package/dist/esm/create-related-feature_3.entry.js +12 -8
- package/dist/esm/crowdsource-reporter.entry.js +20 -16
- package/dist/esm/feature-list.entry.js +141 -7
- package/dist/esm/json-editor_7.entry.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-layer-picker.entry.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +3 -3
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/solution-configuration.entry.js +3 -3
- package/dist/esm/solution-contents_3.entry.js +3 -3
- package/dist/esm/solution-item-accordion.entry.js +33 -2
- package/dist/esm/solution-item-icon.entry.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/esm/spatial-ref.entry.js +1 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources.json +3 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +1 -0
- package/dist/solutions-components/demos/solution-item-accordion.html +12 -1
- package/dist/solutions-components/{p-c1a752b9.entry.js → p-182a4844.entry.js} +1 -1
- package/dist/solutions-components/{p-8ab5efc1.entry.js → p-1fb25c0c.entry.js} +1 -1
- package/dist/solutions-components/p-20bd829d.entry.js +6 -0
- package/dist/solutions-components/{p-f9b7f97e.entry.js → p-282a3090.entry.js} +1 -1
- package/dist/solutions-components/p-3ab93412.entry.js +6 -0
- package/dist/solutions-components/p-433b34a3.entry.js +6 -0
- package/dist/solutions-components/{p-7e1c353c.entry.js → p-442b2dfb.entry.js} +1 -1
- package/dist/solutions-components/p-5b3ee71d.entry.js +6 -0
- package/dist/solutions-components/{p-0d110867.entry.js → p-65df6acd.entry.js} +1 -1
- package/dist/solutions-components/{p-f64eeaad.entry.js → p-75fabd1c.entry.js} +1 -1
- package/dist/solutions-components/{p-88de10d1.entry.js → p-a5618671.entry.js} +1 -1
- package/dist/solutions-components/p-b66a3619.entry.js +6 -0
- package/dist/solutions-components/{p-340c71f3.entry.js → p-b8dde3e5.entry.js} +1 -1
- package/dist/solutions-components/{p-256ce5cc.entry.js → p-ec7c3f5c.entry.js} +1 -1
- package/dist/solutions-components/{p-a5c51211.entry.js → p-f3ee7398.entry.js} +1 -1
- package/dist/solutions-components/{p-da1ac695.entry.js → p-fe9c9f03.entry.js} +1 -1
- package/dist/solutions-components/{p-2b9d58dc.entry.js → p-ff0b00d7.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components_commit.txt +6 -8
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +8 -4
- package/dist/types/components/feature-details/feature-details.d.ts +4 -0
- package/dist/types/components/feature-list/feature-list.d.ts +52 -0
- package/dist/types/components/solution-item-accordion/solution-item-accordion.d.ts +12 -0
- package/dist/types/components.d.ts +33 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-0e3b3aa8.entry.js +0 -6
- package/dist/solutions-components/p-47abefd3.entry.js +0 -6
- package/dist/solutions-components/p-8169d4af.entry.js +0 -6
- package/dist/solutions-components/p-b0551d23.entry.js +0 -6
- package/dist/solutions-components/p-d32b5127.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 e,g as a,h as r,a as t}from"./p-8c40bdec.js";const s=class{constructor(a){e(this,a)}get el(){return a(this)}isPortal=!1;type="";typeKeywords=[];render(){return r("div",{key:"
|
6
|
+
import{r as e,g as a,h as r,a as t}from"./p-8c40bdec.js";const s=class{constructor(a){e(this,a)}get el(){return a(this)}isPortal=!1;type="";typeKeywords=[];render(){return r("div",{key:"cc13e7bfc0a58ca1727651c3c31b0dc4e50f716a",title:this.type},r("img",{key:"76808f6a3ced35a15626d4a4d30e7a2b8185d8d6",class:"item-type-icon item-type-icon-margin",height:"16",src:this._getIconUrl(this.type,this.typeKeywords),width:"16"}))}_getIconUrl(e,a){const r=this._getItemIcon(e,a);return t("group"===r?`./item-icons/${r}16.png`:`./item-icons/${r}16.svg`)}_getItemIcon(e,a){const r=e.toLowerCase(),t=a||[],s=t.includes("Hosted Service");switch(r.trim()){case"360 vr experience":return"360vr";case"3dtiles package":return"3dtileslayerpackage";case"3dtiles service":return t.includes("3DObject")?"3dobjecttileslayer":t.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dobjecttileslayer";case"feature service":case"feature collection":case"kml":case"wfs":if(t.includes("IndoorPositioningDataService"))return"indoorpositioningdataservice";const e=t.includes("Spatiotemporal");return t.includes("Table")?e?"spatiotemporaltable":"table":t.includes("Route Layer")?"routelayer":t.includes("Markup")?"markup":e?"spatiotemporal":t.includes("UtilityNetwork")?"utilitynetwork":s?"featureshosted":"features";case"group":return"group";case"group layer":return t.includes("Map")?"layergroup2d":t.includes("Scene")?"layergroup3d":"layergroup";case"wmts":return"maptiles";case"map service":case"wms":return s||t.includes("Tiled")?"maptiles":"mapimages";case"scene service":return t.includes("Line")?"sceneweblayerline":t.includes("3DObject")?"sceneweblayermultipatch":t.includes("Point")?"sceneweblayerpoint":t.includes("IntegratedMesh")?"sceneweblayermesh":t.includes("PointCloud")?"sceneweblayerpointcloud":t.includes("Polygon")?"sceneweblayerpolygon":t.includes("Building")?"sceneweblayerbuilding":t.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer";case"image service":return t.includes("Elevation 3D Layer")?"elevationlayer":t.includes("Tiled Imagery")?"tiledimagerylayer":"imagery";case"stream service":return"streamlayer";case"video service":return t.includes("Live Stream")?"livestreamvideolayer":"mediaservice";case"vector tile service":return"vectortile";case"datastore catalog service":return"datastorecollection";case"geocoding service":return"geocodeservice";case"geoprocessing service":return t.includes("Web Tool")?"tool":"layers";case"geodata service":return"geodataservice";case"web map":case"cityengine web scene":return"maps";case"web scene":return t.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal";case"application":case"web mapping application":case"mobile application":case"operation view":case"desktop application":return t.includes("configurableApp")?"instantapps":"apps";case"map document":case"map package":case"published map":case"scene document":case"globe document":case"basemap package":case"mobile basemap package":case"mobile map package":case"project package":case"project template":case"pro map":case"layout":return"mapsgray";case"layer":if(t.includes("ArcGIS Pro"))return"mapsgray";case"explorer map":if(t.indexOf("Explorer Document"))return"mapsgray";if(t.includes("Explorer Mapping Application"))return"datafilesgray";case"pro presentation":return"propresentation";case"api key":return"key";case"csv":return"csv";case"shapefile":return"shapefile";case"csv collection":return"csvcollection";case"media layer":return"medialayer";case"microsoft excel":return"excel";case"microsoft powerpoint":return"powerpoint";case"microsoft word":return"word";case"pdf":return"pdf";case"sqlite geodatabase":return"sqlite";case"administrative report":return"report";case"image":return"image";case"cad drawing":return"cad";case"service definition":case"geojson":case"360 vr experience":case"netcdf":return"data";case"explorer add in":case"desktop add in":case"windows viewer add in":case"windows viewer configuration":return"appsgray";case"arcgis pro add in":case"arcgis pro configuration":return"addindesktop";case"rule package":case"file geodatabase":case"kml collection":case"windows mobile package":case"map template":case"desktop application template":case"gml":case"arcpad package":case"code sample":case"document link":case"earth configuration":case"operations dashboard add in":case"rules package":case"workflow manager package":return"datafilesgray";case"form":return t.includes("Survey123")?"survey":"datafilesgray";case"network analysis service":case"geoprocessing service":case"geodata service":case"geometry service":case"geoprocessing package":case"locator package":case"geoprocessing sample":case"workflow manager service":return"toolsgray";case"layer":case"layer package":case"explorer layer":return"layersgray";case"scene package":return"scenepackage";case"mobile scene package":return"mobilescenepackage";case"tile package":case"compact tile package":return"tilepackage";case"task file":return"taskfile";case"report template":return"reporttemplate";case"statistical data collection":return"statisticaldatacollection";case"analysis model":return"geoprocessingmodel";case"insights workbook":return"workbook";case"insights model":return"insightsmodel";case"insights page":return"insightspage";case"insights theme":return"insightstheme";case"hub initiative":return"hubinitiative";case"hub page":return"hubpage";case"hub event":return"hubevent";case"hub site application":return"hubsite";case"hub project":return"hubproject";case"relational database connection":return"relationaldatabaseconnection";case"image":return"image";case"image collection":return"imagecollection";case"style":return t.includes("Dictionary")?"dictionarystyle":"style";case"desktop style":return"desktopstyle";case"dashboard":return"dashboard";case"raster function template":return"rasterprocessingtemplate";case"vector tile package":return"vectortilepackage";case"ortho mapping project":return"orthomappingproject";case"ortho mapping template":return"orthomappingtemplate";case"solution":return"solutions";case"geopackage":return"geopackage";case"deep learning package":return"deeplearningpackage";case"real time analytic":return"realtimeanalytics";case"big data analytic":return"bigdataanalytics";case"feed":return"feed";case"excalibur imagery project":return"excaliburimageryproject";case"notebook":return"notebook";case"reality mapping project":return"realitymappingproject";case"storymap":return t.includes("storymaptemplate")?"storymapstemplate":t.includes("storymapcollection")?"storymapcollection":t.includes("storymapbriefing")?"storymapbriefing":"storymap";case"survey123 add in":return"survey123addin";case"mission":return"mission";case"mission report":return"missionreport";case"quickcapture project":return"quickcaptureproject";case"pro report":return"proreport";case"urban model":return"urbanmodel";case"urban project":return"urbanproject";case"web experience":return"experiencebuilder";case"web experience template":return"webexperiencetemplate";case"experience builder widget":return"experiencebuilderwidget";case"experience builder widget package":return"experiencebuilderwidgetpackage";case"workflow":return"workflow";case"insights script":return"insightsscript";case"kernel gateway connection":return"kernelgatewayconnection";case"hub initiative template":return"hubinitiativetemplate";case"storymap theme":return"storymaptheme";case"knowledge graph":return"knowledgegraph";case"knowledge studio project":return"knowledgestudio";case"knowledge graph layer":return"knowledgegraphlayer";case"native application":return"nativeapp";case"native application installer":return"nativeappinstaller";case"web link chart":return"linkchart";case"knowledge graph web investigation":return"investigation";case"ogcfeatureserver":return"features";case"pro project":return"proproject";case"insights workbook package":return"insightsworkbookpackage";case"apache parquet":return"apacheparquet";case"notebook code snippets":case"notebook code snippet library":return"notebookcodesnippets";case"suitability model":return"suitabilitymodel";case"esri classifier definition":return"classifierdefinition";case"esri classification schema":return"classificationschema";case"insights data engineering workbook":return"dataengineeringworkbook";case"insights data engineering model":return"dataengineeringmodel";case"deep learning studio project":return"deeplearningproject";case"data store":return"datastore";case"data pipeline":return"datapipeline";default:return t.includes("Document")?"datafilesgray":r.includes("service")?"layers":"maps"}}static get assetsDirs(){return["item-icons"]}};s.style=".item-type-icon{pointer-events:none;display:block;height:1rem;margin-top:0.15em !important;min-width:16px;fill:currentColor;transform:rotate(360deg)}.item-type-icon-margin{margin-inline-end:0.375rem}";export{s as solution_item_icon}
|
@@ -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,g as s,h as e,F as a}from"./p-8c40bdec.js";import{l as h,g as c,f as n}from"./p-a23de3b0.js";import{b as o,d as l,a as r,c as d}from"./p-d572627c.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const p=class{constructor(s){t(this,s),this.success=i(this,"success",7),this.fail=i(this,"fail",7),this.isActionPending=i(this,"isActionPending",7),this.formReady=i(this,"formReady",7)}get el(){return s(this)}locale;mapView;table;selectedFeature;customizeSubmit=!1;showGuidingMsg=!0;_editorLoading=!1;_translations;Editor;_editor;reactiveUtils;_container;_addingAttachment;_isSubmitBtnClicked=!1;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async _editorLoadingWatchHandler(t){t&&(this._container?.classList.add("display-none"),await this.startCreate(),this._container?.classList.remove("display-none"),this._editorLoading=!1)}async submit(){this._editor&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}success;fail;isActionPending;formReady;async componentWillLoad(){await this._getTranslations(),await this.initModules()}async init(){this.mapView&&await this.createEditorWidget()}async initModules(){const[t,i]=await h(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}render(){const t=this._editorLoading?"":"display-none";return e(a,{key:"261308f81b5bbed3e136efbb2100db9c1e5994a4"},this.showGuidingMsg&&e("calcite-notice",{key:"3aca1d3f48e46208ce07f2ccdd76ac4af752162d",class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},e("div",{key:"f449d7dcde1cc75bf7470a75ae0ce915ef457459",slot:"message"},this._translations.provideDetailsMsg)),e("calcite-loader",{key:"e94e971b96ddba0ab36f27ffd4e37b820bb2432f",class:t,label:"",scale:"s"}))}async componentDidLoad(){await this.init()}disconnectedCallback(){this._editor&&this._editor.destroy()}async createEditorWidget(){this._editor&&this._editor.destroy(),this._container=document.createElement("div"),this._container?.classList.add("display-none"),this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:this._container}),this.el.appendChild(this._container);const t=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this._editorLoading=!0)}));this._editor.viewModel.addHandles(t);const i=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"adding-attachment"===t||"editing-attachment"===t?(this._addingAttachment=!0,this.isActionPending.emit(!0)):this._addingAttachment&&(this.isActionPending.emit(!1),this._addingAttachment=!1)}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureFormViewModel?.state),(t=>{"ready"===t&&this.formReady.emit()}));this._editor.viewModel.addHandles(s)}async startCreate(){const t=this.selectedFeature.layer,i=this.table,s=t.relationships[0],e=i.relationships.find((i=>t.layerId===i.relatedTableId)),a=await t.queryFeatures({objectIds:[this.selectedFeature.getObjectId()],outFields:[t.objectIdField,s.keyField]}),h=i.templates[0],c={attributeOverrides:this.makeAttributesForRelatedFeature(a.features[0],s,e),layer:i,template:h};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(c),await this.hideEditorsElements(),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach((t=>{const i=t.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");i?.querySelector("header")?.setAttribute("style","display: none"),i?.querySelector("footer")?.setAttribute("style","display: none")})))}makeAttributesForRelatedFeature(t,i,s){const e=i.keyField;let a;t.attributes.hasOwnProperty(e)?a=t.getAttribute(e):t.attributes.hasOwnProperty(e.toLowerCase())?a=t.getAttribute(e.toLowerCase()):t.attributes.hasOwnProperty(e.toUpperCase())&&(a=t.getAttribute(e.toUpperCase()));let h=s.keyField;const c=this.table.fields.find((t=>t.name.toLocaleLowerCase()===h.toLocaleLowerCase()));return h=c.name,{[h]:a}}async submitted(t){if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}timeout(t){return new Promise((i=>setTimeout(i,t)))}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};p.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.display-none{display:none !important}.esri-editor__panel-content{padding-block:10px !important}.notice-msg{padding:10px;width:calc(100% - 20px)}";const b=class{constructor(s){t(this,s),this.loadingStatus=i(this,"loadingStatus",7),this.commentSelect=i(this,"commentSelect",7),this.addComment=i(this,"addComment",7),this.likeOrDislikeClicked=i(this,"likeOrDislikeClicked",7),this.featureSelectionChange=i(this,"featureSelectionChange",7)}get el(){return s(this)}mapView;graphics;reportingOptions;layerItemsHash;locale;showUserImageInCommentsList=!1;_likeFieldAvailable=!1;_likeCount=0;_disLikeCount=0;_dislikeFieldAvailable=!1;_commentsAvailable=!1;_isLikeBtnClicked=!1;_isDislikeBtnClicked=!1;_relatedFeaturesOIDs;_updating=!1;_infoCard;_commentsList;_selectedGraphic;_likeField;_dislikeField;Graphic;RelationshipQuery;_validFieldTypes=["small-integer","integer","big-integer","single","long"];relatedTableId;async graphicsWatchHandler(){await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}async refresh(t){await this.getCompleteGraphic(t),await this.processComments(),this.isLikeDislikeConfigured(t.layer)?t&&this.graphics.length>1&&this.checkLikeDislikeFields():(this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1)}async back(){this._infoCard.back()}async next(){this._infoCard.next()}async toggleListView(){this._infoCard.toggleListView()}loadingStatus;commentSelect;addComment;likeOrDislikeClicked;featureSelectionChange;async componentWillLoad(){await this._initModules(),await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}render(){const t=this._relatedFeaturesOIDs?.length>0?`objectId in(${this._relatedFeaturesOIDs})`:"1=0";return e("calcite-panel",{key:"be7bebe9da698d963a2602fcacb95ac7206ac1e9","full-height":!0},e("info-card",{key:"1e069f52d59d42f3e2b88463ea7c536c65a0a6b5",allowEditing:!1,graphics:this.graphics,highlightEnabled:!1,isLoading:!1,isMobile:!1,locale:this.locale,mapView:this.mapView,onSelectionChanged:t=>{this.featureSelectionChange.emit(t.detail)},paginationEnabled:!1,position:"relative",ref:t=>this._infoCard=t}),(this._likeFieldAvailable||this._dislikeFieldAvailable||this._commentsAvailable)&&e("div",{key:"d53f5a1726e4c6299ffd04e266d84005181645f6",class:"buttons-container"},this._commentsAvailable&&e("calcite-button",{key:"4c2616cc9e0107258f5313b66ae96fa31fe582c5",appearance:"transparent",iconEnd:"speech-bubble",kind:"neutral",onClick:()=>{this.addComment.emit()},scale:"m"},this._relatedFeaturesOIDs.length),this._likeFieldAvailable&&e("calcite-button",{key:"7c87aa085df04a8b58625097c2ce70e5853b82f9",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onLikeButtonClick.bind(this),scale:"m"},this._likeCount??this._selectedGraphic.attributes[this._likeField]??0),this._dislikeFieldAvailable&&e("calcite-button",{key:"59eb48b91fc2a394cafdcbeeebf5baafae9a8c9b",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onDislikeButtonClick.bind(this),scale:"m"},this._disLikeCount??this._selectedGraphic.attributes[this._dislikeField]??0)),this.relatedTableId&&this._commentsAvailable&&e("feature-list",{key:"f34ee203202944666c40e14bdfdc59265414fbe1",class:"height-full",locale:this.locale,mapView:this.mapView,onFeatureSelect:t=>{this.commentSelect.emit(t.detail)},pageSize:5,ref:t=>this._commentsList=t,selectedLayerId:this.relatedTableId,showErrorWhenNoFeatures:!1,showInitialLoading:!1,showUserImageInList:this.showUserImageInCommentsList,textSize:"small",whereClause:t}))}async _initModules(){const[t,i]=await h(["esri/rest/support/RelationshipQuery","esri/Graphic"]);this.RelationshipQuery=t,this.Graphic=i}async getCompleteGraphic(t){if(t){const i=t.layer,s=i.createQuery();s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this._selectedGraphic=e.features[0]}}async processComments(){const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]&&this.reportingOptions[t.id].comment&&t.relationships?.length>0){const i=await o(this.mapView);let s=null,e=null;if(t.relationships.some((a=>{const h=i.filter((i=>t.url===i.url&&i.layerId===a.relatedTableId));if(h&&h.length>0)return s=h[0],e=a.id,!0})),this.relatedTableId=s?.id??"",this.relatedTableId){const i=this._selectedGraphic.attributes[t.objectIdField],a=new this.RelationshipQuery({objectIds:[i],outFields:["*"],relationshipId:e}),h=await t.queryRelatedFeatures(a).catch((t=>{console.error(t)})),c=[];h[i]&&h[i].features.forEach((t=>{c.push(t.attributes[s.objectIdField])})),this._relatedFeaturesOIDs=c,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((h=>{this._validFieldTypes.indexOf(h.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(h.name===e&&this.reportingOptions[t.id].like?i=!0:h.name===a&&this.reportingOptions[t.id].dislike&&(s=!0))}))}return i||s}checkLikeDislikeFields(){this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1,this._isLikeBtnClicked=!1,this._isDislikeBtnClicked=!1,this._likeCount=0,this._disLikeCount=0;const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]){if(this._likeField=this.reportingOptions[t.id].likeField,this._dislikeField=this.reportingOptions[t.id].dislikeField,!this._likeField&&!this._dislikeField)return;t.fields.forEach((i=>{this._validFieldTypes.indexOf(i.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(i.name===this._likeField&&this.reportingOptions[t.id].like?(this._likeFieldAvailable=!0,this._likeCount=this._selectedGraphic.attributes[i.name]):i.name===this._dislikeField&&this.reportingOptions[t.id].dislike&&(this._dislikeFieldAvailable=!0,this._disLikeCount=this._selectedGraphic.attributes[i.name]))})),this.getFromLocalStorage()}}onLikeButtonClick(){this._isDislikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].dislike&&this.onDislikeButtonClick(),this._isLikeBtnClicked=!this._isLikeBtnClicked,this._isLikeBtnClicked?this._likeCount++:this._likeCount--,this.updateFeaturesLikeDislikeField(this._likeField,this._isLikeBtnClicked)}onDislikeButtonClick(){this._isLikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].like&&this.onLikeButtonClick(),this._isDislikeBtnClicked=!this._isDislikeBtnClicked,this._isDislikeBtnClicked?this._disLikeCount++:this._disLikeCount--,this.updateFeaturesLikeDislikeField(this._dislikeField,this._isDislikeBtnClicked)}async updateFeaturesLikeDislikeField(t,i){const s={},e=this._selectedGraphic.layer;this._updating=!0;const a=this._selectedGraphic;a.attributes[t]=Number(a.attributes[t])+(i?1:-1),s[e.objectIdField]=a.attributes[e.objectIdField],s[t]=a.attributes[t];const h=new this.Graphic;h.attributes=s;const c={updateFeatures:[h]};await e.applyEdits(c).then((()=>{this._selectedGraphic=a,this.setInLocalStorage(),this._updating=!1,this.likeOrDislikeClicked.emit()}),(t=>{this._updating=!1,console.log(t)}))}getFromLocalStorage(){const t=localStorage[this._selectedGraphic.layer.id];if(t){const i=JSON.parse(t).filter((t=>t.id===this._selectedGraphic.getObjectId()));i.length>0&&(this._isLikeBtnClicked=i[0].like,this._isDislikeBtnClicked=i[0].dislike)}}setInLocalStorage(){const t=this._selectedGraphic.layer.id,i=localStorage[t];let s=[];if(i){s=JSON.parse(i);const t=s.findIndex((t=>t.id===this._selectedGraphic.getObjectId()));t>=0&&s.splice(t,1)}s.push({id:this._selectedGraphic.getObjectId(),like:this._isLikeBtnClicked&&0!==this._likeCount,dislike:this._isDislikeBtnClicked&&0!==this._disLikeCount}),localStorage.setItem(t,JSON.stringify(s))}static get watchers(){return{graphics:["graphicsWatchHandler"]}}};b.style=":host{display:block}.buttons-container{align-items:center;display:flex;padding:4px;color:var(--calcite-color-text-1) !important;background-color:var(--calcite-color-foreground-1) !important;border-block-start:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3)}";const y=class{constructor(s){t(this,s),this.layerSelect=i(this,"layerSelect",7),this.layersListLoaded=i(this,"layersListLoaded",7)}get el(){return s(this)}mapView;layers;locale;showFeatureCount=!0;showNextIcon=!1;applyLayerViewFilter=!1;_noLayersToDisplay=!1;_mapLayerIds=[];_isLoading=!1;_translations;_layerItemsHash;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async refresh(){await this.setLayers()}layerSelect;layersListLoaded;async componentWillLoad(){await this._getTranslations()}async componentDidLoad(){await this.setLayers()}render(){return e(a,{key:"a151c8fd65c50aacb23dcd0c858e52c0c7cd7e5e"},this._isLoading&&e("calcite-loader",{key:"544a134bccc29048ca80b996844cc944bcd97a24",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&e("calcite-notice",{key:"7557f91c8c3349c120c043ea59458b4c834dce2e",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},e("div",{key:"ea8b20f8c7da5053641cfad56e3395ae3c6286f5",slot:"title"},this._translations.error),e("div",{key:"38aaed7b456aba0b1dd70183be03e9133834dfb4",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&e("calcite-list",{key:"547b0681145fd8d8663b786472be9e5161cbd693",label:"","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&(this._isLoading=!0,await this.initLayerHash(),this._isLoading=!1)}async initLayerHash(){const t=[];this._layerItemsHash=await l(this.mapView,!0);const i=await r(this.mapView);for(const s of i)if("feature"===s?.type&&this.showFeatureCount){const i=s.createQuery();if(s?.definitionExpression&&(i.where=i.where+" AND "+s.definitionExpression),this.applyLayerViewFilter){const t=await d(this.mapView,s.id);t?.filter?.where&&(i.where=i.where?i.where+" AND "+t.filter.where:t.filter.where)}const e=s.queryFeatureCount(i);t.push(e),e.then((async t=>{const i=isNaN(t)?"":await n(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[s.id].formattedFeatureCount=i}))}await Promise.all(t).then((()=>{const t=this.getLayersToBeShownInList(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getLayersToBeShownInList(t){const i=this.layers?.length>0?this.layers:[];return Object.keys(t).reduce(((t,s)=>(i.indexOf(s)>-1&&t.push(s),t)),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const i=this._layerItemsHash[t].formattedFeatureCount;return e("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},e("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==i&&""!==i&&e("div",{class:this.showNextIcon?"":"feature-count",slot:"content-end"},"("+i+")"),this.showNextIcon&&e("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"]}}};y.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{p as create_related_feature,b as feature_details,y as layer_list}
|
6
|
+
import{r as t,c as i,g as s,h as e,F as a}from"./p-8c40bdec.js";import{l as h,g as c,f as n}from"./p-a23de3b0.js";import{b as o,d as l,a as r,c as d}from"./p-d572627c.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const p=class{constructor(s){t(this,s),this.success=i(this,"success",7),this.fail=i(this,"fail",7),this.isActionPending=i(this,"isActionPending",7),this.formReady=i(this,"formReady",7)}get el(){return s(this)}locale;mapView;table;selectedFeature;customizeSubmit=!1;showGuidingMsg=!0;_editorLoading=!1;_translations;Editor;_editor;reactiveUtils;_container;_addingAttachment;_isSubmitBtnClicked=!1;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async _editorLoadingWatchHandler(t){t&&(this._container?.classList.add("display-none"),await this.startCreate(),this._container?.classList.remove("display-none"),this._editorLoading=!1)}async submit(){this._editor&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}success;fail;isActionPending;formReady;async componentWillLoad(){await this._getTranslations(),await this.initModules()}async init(){this.mapView&&await this.createEditorWidget()}async initModules(){const[t,i]=await h(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}render(){const t=this._editorLoading?"":"display-none";return e(a,{key:"261308f81b5bbed3e136efbb2100db9c1e5994a4"},this.showGuidingMsg&&e("calcite-notice",{key:"3aca1d3f48e46208ce07f2ccdd76ac4af752162d",class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},e("div",{key:"f449d7dcde1cc75bf7470a75ae0ce915ef457459",slot:"message"},this._translations.provideDetailsMsg)),e("calcite-loader",{key:"e94e971b96ddba0ab36f27ffd4e37b820bb2432f",class:t,label:"",scale:"s"}))}async componentDidLoad(){await this.init()}disconnectedCallback(){this._editor&&this._editor.destroy()}async createEditorWidget(){this._editor&&this._editor.destroy(),this._container=document.createElement("div"),this._container?.classList.add("display-none"),this._editor=new this.Editor({view:this.mapView,visibleElements:{snappingControls:!1},container:this._container}),this.el.appendChild(this._container);const t=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&(this._editorLoading=!0)}));this._editor.viewModel.addHandles(t);const i=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"adding-attachment"===t||"editing-attachment"===t?(this._addingAttachment=!0,this.isActionPending.emit(!0)):this._addingAttachment&&(this.isActionPending.emit(!1),this._addingAttachment=!1)}));this._editor.viewModel.addHandles(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.featureFormViewModel?.state),(t=>{"ready"===t&&this.formReady.emit()}));this._editor.viewModel.addHandles(s)}async startCreate(){const t=this.selectedFeature.layer,i=this.table,s=t.relationships[0],e=i.relationships.find((i=>t.layerId===i.relatedTableId)),a=await t.queryFeatures({objectIds:[this.selectedFeature.getObjectId()],outFields:[t.objectIdField,s.keyField]}),h=i.templates[0],c={attributeOverrides:this.makeAttributesForRelatedFeature(a.features[0],s,e),layer:i,template:h};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(c),await this.hideEditorsElements(),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach((t=>{const i=t.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");i?.querySelector("header")?.setAttribute("style","display: none"),i?.querySelector("footer")?.setAttribute("style","display: none")})))}makeAttributesForRelatedFeature(t,i,s){const e=i.keyField;let a;t.attributes.hasOwnProperty(e)?a=t.getAttribute(e):t.attributes.hasOwnProperty(e.toLowerCase())?a=t.getAttribute(e.toLowerCase()):t.attributes.hasOwnProperty(e.toUpperCase())&&(a=t.getAttribute(e.toUpperCase()));let h=s.keyField;const c=this.table.fields.find((t=>t.name.toLocaleLowerCase()===h.toLocaleLowerCase()));return h=c.name,{[h]:a}}async submitted(t){if(t.invalid.length)this._isSubmitBtnClicked=!1;else if(t.valid.length&&this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}timeout(t){return new Promise((i=>setTimeout(i,t)))}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],_editorLoading:["_editorLoadingWatchHandler"]}}};p.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.display-none{display:none !important}.esri-editor__panel-content{padding-block:10px !important}.notice-msg{padding:10px;width:calc(100% - 20px)}";const b=class{constructor(s){t(this,s),this.loadingStatus=i(this,"loadingStatus",7),this.commentSelect=i(this,"commentSelect",7),this.addComment=i(this,"addComment",7),this.likeOrDislikeClicked=i(this,"likeOrDislikeClicked",7),this.featureSelectionChange=i(this,"featureSelectionChange",7)}get el(){return s(this)}mapView;graphics;reportingOptions;layerItemsHash;locale;showUserImageInCommentsList=!1;showFullCommentTitle=!0;_likeFieldAvailable=!1;_likeCount=0;_disLikeCount=0;_dislikeFieldAvailable=!1;_commentsAvailable=!1;_isLikeBtnClicked=!1;_isDislikeBtnClicked=!1;_relatedFeaturesOIDs;_updating=!1;_infoCard;_commentsList;_selectedGraphic;_likeField;_dislikeField;Graphic;RelationshipQuery;_validFieldTypes=["small-integer","integer","big-integer","single","long"];relatedTableId;async graphicsWatchHandler(){await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}async refresh(t){await this.getCompleteGraphic(t),await this.processComments(),this.isLikeDislikeConfigured(t.layer)?t&&this.graphics.length>1&&this.checkLikeDislikeFields():(this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1)}async back(){this._infoCard.back()}async next(){this._infoCard.next()}async toggleListView(){this._infoCard.toggleListView()}loadingStatus;commentSelect;addComment;likeOrDislikeClicked;featureSelectionChange;async componentWillLoad(){await this._initModules(),await this.getCompleteGraphic(this.graphics[0]),this.checkLikeDislikeFields(),await this.processComments()}render(){const t=this._relatedFeaturesOIDs?.length>0?`objectId in(${this._relatedFeaturesOIDs})`:"1=0";return e("calcite-panel",{key:"577f06f7bc41875b38e07a44f3c734ccc839e596","full-height":!0},e("info-card",{key:"e815f75d02bcdfe9cc11796c913be2a6c2bfecd2",allowEditing:!1,graphics:this.graphics,highlightEnabled:!1,isLoading:!1,isMobile:!1,locale:this.locale,mapView:this.mapView,onSelectionChanged:t=>{this.featureSelectionChange.emit(t.detail)},paginationEnabled:!1,position:"relative",ref:t=>this._infoCard=t}),(this._likeFieldAvailable||this._dislikeFieldAvailable||this._commentsAvailable)&&e("div",{key:"16d0af6b0e75b595573bd0816744f03d9d6dec37",class:"buttons-container"},this._commentsAvailable&&e("calcite-button",{key:"550b3af830911a1437fa3e967492666ec8c5a2e4",appearance:"transparent",iconEnd:"speech-bubble",kind:"neutral",onClick:()=>{this.addComment.emit()},scale:"m"},this._relatedFeaturesOIDs.length),this._likeFieldAvailable&&e("calcite-button",{key:"741848445c2083f4c0a3d9464cd810deee4a1218",appearance:"transparent",iconEnd:"thumbs-up",kind:this._isLikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onLikeButtonClick.bind(this),scale:"m"},this._likeCount??this._selectedGraphic.attributes[this._likeField]??0),this._dislikeFieldAvailable&&e("calcite-button",{key:"4d5e8ae279559dbf981b1b91238706adbd6ebeef",appearance:"transparent",iconEnd:"thumbs-down",kind:this._isDislikeBtnClicked?"brand":"neutral",loading:this._updating,onClick:this.onDislikeButtonClick.bind(this),scale:"m"},this._disLikeCount??this._selectedGraphic.attributes[this._dislikeField]??0)),this.relatedTableId&&this._commentsAvailable&&e("feature-list",{key:"0daad9b37b13a05afc4b8a3a6eca70a7356afd8f",class:"height-full",locale:this.locale,mapView:this.mapView,onFeatureSelect:t=>{this.commentSelect.emit(t.detail)},pageSize:5,ref:t=>this._commentsList=t,selectedLayerId:this.relatedTableId,showErrorWhenNoFeatures:!1,showFullTitle:this.showFullCommentTitle,showInitialLoading:!1,showUserImageInList:this.showUserImageInCommentsList,textSize:"small",whereClause:t}))}async _initModules(){const[t,i]=await h(["esri/rest/support/RelationshipQuery","esri/Graphic"]);this.RelationshipQuery=t,this.Graphic=i}async getCompleteGraphic(t){if(t){const i=t.layer,s=i.createQuery();s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this._selectedGraphic=e.features[0]}}async processComments(){const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]&&this.reportingOptions[t.id].comment&&t.relationships?.length>0){const i=await o(this.mapView);let s=null,e=null;if(t.relationships.some((a=>{const h=i.filter((i=>t.url===i.url&&i.layerId===a.relatedTableId));if(h&&h.length>0)return s=h[0],e=a.id,!0})),this.relatedTableId=s?.id??"",this.relatedTableId){const i=this._selectedGraphic.attributes[t.objectIdField],a=new this.RelationshipQuery({objectIds:[i],outFields:["*"],relationshipId:e}),h=await t.queryRelatedFeatures(a).catch((t=>{console.error(t)})),c=[];h[i]&&h[i].features.forEach((t=>{c.push(t.attributes[s.objectIdField])})),this._relatedFeaturesOIDs=c,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((h=>{this._validFieldTypes.indexOf(h.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(h.name===e&&this.reportingOptions[t.id].like?i=!0:h.name===a&&this.reportingOptions[t.id].dislike&&(s=!0))}))}return i||s}checkLikeDislikeFields(){this._likeFieldAvailable=!1,this._dislikeFieldAvailable=!1,this._isLikeBtnClicked=!1,this._isDislikeBtnClicked=!1,this._likeCount=0,this._disLikeCount=0;const t=this._selectedGraphic.layer;if(this.reportingOptions&&this.reportingOptions[t.id]){if(this._likeField=this.reportingOptions[t.id].likeField,this._dislikeField=this.reportingOptions[t.id].dislikeField,!this._likeField&&!this._dislikeField)return;t.fields.forEach((i=>{this._validFieldTypes.indexOf(i.type)>-1&&this.layerItemsHash[t.id].supportsUpdate&&(i.name===this._likeField&&this.reportingOptions[t.id].like?(this._likeFieldAvailable=!0,this._likeCount=this._selectedGraphic.attributes[i.name]):i.name===this._dislikeField&&this.reportingOptions[t.id].dislike&&(this._dislikeFieldAvailable=!0,this._disLikeCount=this._selectedGraphic.attributes[i.name]))})),this.getFromLocalStorage()}}onLikeButtonClick(){this._isDislikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].dislike&&this.onDislikeButtonClick(),this._isLikeBtnClicked=!this._isLikeBtnClicked,this._isLikeBtnClicked?this._likeCount++:this._likeCount--,this.updateFeaturesLikeDislikeField(this._likeField,this._isLikeBtnClicked)}onDislikeButtonClick(){this._isLikeBtnClicked&&this.reportingOptions[this._selectedGraphic.layer.id].like&&this.onLikeButtonClick(),this._isDislikeBtnClicked=!this._isDislikeBtnClicked,this._isDislikeBtnClicked?this._disLikeCount++:this._disLikeCount--,this.updateFeaturesLikeDislikeField(this._dislikeField,this._isDislikeBtnClicked)}async updateFeaturesLikeDislikeField(t,i){const s={},e=this._selectedGraphic.layer;this._updating=!0;const a=this._selectedGraphic;a.attributes[t]=Number(a.attributes[t])+(i?1:-1),s[e.objectIdField]=a.attributes[e.objectIdField],s[t]=a.attributes[t];const h=new this.Graphic;h.attributes=s;const c={updateFeatures:[h]};await e.applyEdits(c).then((()=>{this._selectedGraphic=a,this.setInLocalStorage(),this._updating=!1,this.likeOrDislikeClicked.emit()}),(t=>{this._updating=!1,console.log(t)}))}getFromLocalStorage(){const t=localStorage[this._selectedGraphic.layer.id];if(t){const i=JSON.parse(t).filter((t=>t.id===this._selectedGraphic.getObjectId()));i.length>0&&(this._isLikeBtnClicked=i[0].like,this._isDislikeBtnClicked=i[0].dislike)}}setInLocalStorage(){const t=this._selectedGraphic.layer.id,i=localStorage[t];let s=[];if(i){s=JSON.parse(i);const t=s.findIndex((t=>t.id===this._selectedGraphic.getObjectId()));t>=0&&s.splice(t,1)}s.push({id:this._selectedGraphic.getObjectId(),like:this._isLikeBtnClicked&&0!==this._likeCount,dislike:this._isDislikeBtnClicked&&0!==this._disLikeCount}),localStorage.setItem(t,JSON.stringify(s))}static get watchers(){return{graphics:["graphicsWatchHandler"]}}};b.style=":host{display:block}.buttons-container{align-items:center;display:flex;padding:4px;color:var(--calcite-color-text-1) !important;background-color:var(--calcite-color-foreground-1) !important;border-block-start:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3)}";const y=class{constructor(s){t(this,s),this.layerSelect=i(this,"layerSelect",7),this.layersListLoaded=i(this,"layersListLoaded",7)}get el(){return s(this)}mapView;layers;locale;showFeatureCount=!0;showNextIcon=!1;applyLayerViewFilter=!1;_noLayersToDisplay=!1;_mapLayerIds=[];_isLoading=!1;_translations;_layerItemsHash;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async refresh(){await this.setLayers()}layerSelect;layersListLoaded;async componentWillLoad(){await this._getTranslations()}async componentDidLoad(){await this.setLayers()}render(){return e(a,{key:"a151c8fd65c50aacb23dcd0c858e52c0c7cd7e5e"},this._isLoading&&e("calcite-loader",{key:"544a134bccc29048ca80b996844cc944bcd97a24",label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&e("calcite-notice",{key:"7557f91c8c3349c120c043ea59458b4c834dce2e",class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},e("div",{key:"ea8b20f8c7da5053641cfad56e3395ae3c6286f5",slot:"title"},this._translations.error),e("div",{key:"38aaed7b456aba0b1dd70183be03e9133834dfb4",slot:"message"},this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&e("calcite-list",{key:"547b0681145fd8d8663b786472be9e5161cbd693",label:"","selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&(this._isLoading=!0,await this.initLayerHash(),this._isLoading=!1)}async initLayerHash(){const t=[];this._layerItemsHash=await l(this.mapView,!0);const i=await r(this.mapView);for(const s of i)if("feature"===s?.type&&this.showFeatureCount){const i=s.createQuery();if(s?.definitionExpression&&(i.where=i.where+" AND "+s.definitionExpression),this.applyLayerViewFilter){const t=await d(this.mapView,s.id);t?.filter?.where&&(i.where=i.where?i.where+" AND "+t.filter.where:t.filter.where)}const e=s.queryFeatureCount(i);t.push(e),e.then((async t=>{const i=isNaN(t)?"":await n(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[s.id].formattedFeatureCount=i}))}await Promise.all(t).then((()=>{const t=this.getLayersToBeShownInList(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getLayersToBeShownInList(t){const i=this.layers?.length>0?this.layers:[];return Object.keys(t).reduce(((t,s)=>(i.indexOf(s)>-1&&t.push(s),t)),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const i=this._layerItemsHash[t].formattedFeatureCount;return e("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},e("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==i&&""!==i&&e("div",{class:"feature-count",slot:"content-end"},"("+i+")"),this.showNextIcon&&e("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"]}}};y.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;word-break:break-word}.feature-count{padding:0 10px}";export{p as create_related_feature,b as feature_details,y as layer_list}
|
@@ -3,4 +3,4 @@
|
|
3
3
|
* Licensed under the Apache License, Version 2.0
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
*/
|
6
|
-
import{r as e,c as t,g as i,h as s,H as a}from"./p-8c40bdec.js";import{a as l,l as h,g as n}from"./p-a23de3b0.js";import{e as r,h as c,k as o,l as d,c as p,m as b,n as f,o as g}from"./p-d572627c.js";import{a as y,e as m,f as u}from"./p-80cb7c73.js";import{s as w}from"./p-bf007c87.js";import{d as _,a as v}from"./p-20085e58.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-fa639501.js";import"./p-af7e43e0.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";const S=class{constructor(i){e(this,i),this.selectionSetChange=t(this,"selectionSetChange",7)}get el(){return i(this)}bufferColor=[227,139,79,.8];bufferOutlineColor=[255,255,255];customLabelEnabled;enabledLayerIds=[];enableLayerFeatures=!0;enableLayerFeaturesOnLoad=!1;enableSearchDistance=!0;enableSearchDistanceOnLoad=!1;enableSketchTools=!0;defaultBufferDistance;defaultBufferUnit;geometries=[];isUpdate=!1;layerViews=[];locale;mapView;noResultText;searchConfiguration;selectionSet;selectionLayerIds=[];selectLayerView;sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;searchDistanceEnabled=!1;useLayerFeaturesEnabled=!1;_numSelected=0;_searchTerm;_selectionLoading=!1;_translations;_esriRequest;FeatureLayer;Graphic;GraphicsLayer;Search;_geometryEngine;_bufferGeometry;_bufferGraphicsLayer;_bufferTools;_distance;_drawTools;_labelName;_selectLayers;_searchElement;_searchResult;_searchWidget;_selectedIds=[];_selectionLabel="";_skipGeomOIDs;_sketchGraphic;_graphics=[];_unit;_workflowType;_featuresCollection={};async watchGeometriesHandler(e,t){if(e!==t){const t=0===e.length;if(await this._clearResults(t,t),e.length>0)return this._highlightWithOIDsOrGeoms()}}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(e,t){e&&e!==t&&await this._init()}async watchSearchConfigurationHandler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&await this._initSearchWidget()}async clearSelection(){return this._clearResults(!0,!0)}async getSelection(){return/\S+/gm.test(this._selectionLabel)||await this._updateLabel(),{id:this.isUpdate?this.selectionSet.id:Date.now(),searchResult:this._searchResult,buffer:this._bufferGeometry,distance:this._bufferTools?.distance,download:!0,unit:this._bufferTools?.unit,label:this._selectionLabel,selectedIds:this._selectedIds,layerView:this.selectLayerView,geometries:this.geometries,graphics:this._graphics,selectLayers:this.layerViews,skipGeomOIDs:this._skipGeomOIDs,searchDistanceEnabled:this.searchDistanceEnabled,workflowType:this._workflowType,useLayerFeaturesEnabled:this.useLayerFeaturesEnabled,sketchGraphic:this._sketchGraphic}}selectionSetChange;searchConfigurationChangeChanged(e){this.searchConfiguration=e.detail}async distanceChanged(e){await this._distanceChanged(e.detail)}async unitChanged(e){e.detail.newValue!==e.detail.oldValue&&(this._unit=e.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init()}render(){const e=this.enableSketchTools?"":"display-none",t=this.enableSketchTools?"padding-top-1":"";return s(a,{key:"5aa96f3189490b1f544bc6802772e99ce24e30ca"},this._getMapLayerPicker(),s("div",{key:"677afdaf1c84e5c7cf0217abe331afe47682b61f",class:"border-bottom"}),s("div",{key:"45d85c333df0e1f081a85b11e94e2a29fe5b8782",class:"padding-top-sides-1"},s("div",{key:"f26f760210ee8307eea537e0df28a4856876fccc",class:"search-widget",ref:e=>{this._searchElement=e}}),s("div",{key:"d9d703d05bc2990f2345036a227fe1e57c9d79ce",class:t},s("map-draw-tools",{key:"8f0eff15a801d654dfaf855f16fe165fad013c49",active:!0,class:e,editGraphicsEnabled:!this.useLayerFeaturesEnabled,graphics:this._graphics,locale:this.locale,mapView:this.mapView,onSketchGraphicsChange:e=>{this._sketchGraphicsChanged(e)},pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:e=>{this._drawTools=e}})),this.enableSearchDistance?this._getBufferOptions():void 0,this.enableLayerFeatures?this._getUseLayerFeaturesOptions():void 0,this._getNumSelected()),s("div",{key:"89a597f46094f93d80b87c4c86a5b7f3fb6a1889",class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){this.enableSearchDistanceOnLoad&&(this.searchDistanceEnabled=!0,this.enableSearchDistanceOnLoad=!1);const e=this.searchDistanceEnabled?"search-distance":"div-not-visible",t="number"==typeof this.selectionSet?.distance?this.selectionSet.distance:this.defaultBufferDistance;return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.searchDistance,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"search-distance-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},s("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),s("calcite-switch",{checked:this.searchDistanceEnabled,onCalciteSwitchChange:()=>this.searchDistanceEnabled=!this.searchDistanceEnabled})),s("div",{class:e},s("buffer-tools",{disabled:!this.searchDistanceEnabled,distance:t,geometries:this.geometries,locale:this.locale,onBufferComplete:e=>{this._bufferComplete(e)},ref:e=>this._bufferTools=e,unit:this.selectionSet?.unit||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){this.enableLayerFeaturesOnLoad&&(this.useLayerFeaturesEnabled=!0,this.enableLayerFeaturesOnLoad=!1);const e=this.useLayerFeaturesEnabled?"div-visible":"div-not-visible";return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.useLayerFeatures,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"use-layer-features-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},s("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),s("calcite-switch",{checked:this.useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),s("div",{class:e+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},selectedIds:this.layerViews.map((e=>e.layer.id)),showTables:!1})))}_getNumSelected(){const e=l(this.el),t=e&&"en"===e?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return s("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?s("div",null,s("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{class:"info-blue",scale:"m"},this._selectionLoading?t:this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedFeatures.replace("{{n}}",this._numSelected.toString())))}_getNameInput(){return s("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},s("calcite-label",{class:"font-bold"},this._translations.listName,s("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:e=>{this._labelName=e},value:this._selectionLabel||""})))}_getMapLayerPicker(){return s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,s("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._inputLayerSelectionChange(e)},selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[e,t,i,s,a,l]=await h(["esri/request","esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this._esriRequest=e,this.GraphicsLayer=t,this.Graphic=i,this.Search=s,this._geometryEngine=a,this.FeatureLayer=l}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),await this._initSearchWidget()}async _initSelectionSet(){this.selectionSet&&(this._searchTerm=this.selectionSet.searchResult?.name,this._searchResult=this.selectionSet.searchResult,this._selectLayers=this.selectionSet.selectLayers,this._selectedIds=this.selectionSet.selectedIds,this._skipGeomOIDs=this.selectionSet.skipGeomOIDs,this.searchDistanceEnabled=this.selectionSet.searchDistanceEnabled,this.useLayerFeaturesEnabled=this.selectionSet.useLayerFeaturesEnabled,this._distance=this.selectionSet.searchDistanceEnabled?this.selectionSet.distance:0,this._unit=this.selectionSet.unit,this._workflowType=this.selectionSet.workflowType,this.selectLayerView=this.selectionSet.layerView,this._sketchGraphic=this.selectionSet.sketchGraphic,this.geometries=[...this.selectionSet?.geometries||[]],this._graphics=this.geometries.map((e=>new this.Graphic({geometry:e,symbol:"point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=this.selectionSet?.label,this.useLayerFeaturesEnabled||await(this._drawTools?.updateGraphics()),await r(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}async _initSearchWidget(){if(this.mapView&&this._searchElement){const e=this._getSearchConfig(this.searchConfiguration,this.mapView),t={view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm,...e};this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const e=this._searchClearLabel();this._clearResults(!1,e)})),this._searchWidget.on("select-result",(e=>{this._selectResult(e.result)})),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this.searchConfiguration?.allPlaceholder&&"find address or place"!==this.searchConfiguration.allPlaceholder.toLowerCase()?this.searchConfiguration.allPlaceholder:this._translations.placeholder}))}}async _selectResult(e){if(e){this._searchResult=e;const t=e.feature,i=t?.layer,s=this.selectLayerView.layer,a=t?.getObjectId();let l,h;i?.sourceJSON?.isView&&(l=await this._getViewSourceUrl(i.url)),s?.sourceJSON?.isView&&(h=await this._getViewSourceUrl(s.url));const n=i?.url?.toLowerCase(),r=l?.toLowerCase(),c=s?.url?.toLowerCase(),o=h?.toLowerCase(),d=n&&c&&(n===c||n===o||r===c||r===o)&&!isNaN(a),p=d?[a]:void 0;this._workflowType=y.SEARCH,this._updateLabel();const b=[e.feature];this._updateSelection(b,d,p),this._drawTools.graphics=b,this._searchWidget.resultGraphic.visible=!1}else{const e=this._searchClearLabel();this._clearResults(!1,e)}}async _getViewSourceUrl(e){let t="";const i=`${e}/sources?f=json`;try{const e=await this._esriRequest(i,{query:{f:"json"}});1===e?.data?.services?.length&&(t=e.data.services[0].url)}catch(e){console.log(e)}return t}_searchClearLabel(){return this._searchResult?.name&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(e,t){const i=e?.sources;return i?.length>0?(e={...e,includeDefaultSources:!1},i.forEach((e=>{if(e.hasOwnProperty("layer")){const i=e,s=i.layer?.id,a=s?t.map.findLayerById(s):null,l=i?.layer?.url;a?i.layer=a:l&&(i.layer=new this.FeatureLayer(l))}})),i?.forEach((e=>{if(e.hasOwnProperty("locator")){const t=e;"ArcGIS World Geocoding Service"===t?.name&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):e={...e,includeDefaultSources:!0},e}_initGraphicsLayer(){const e=this._translations.bufferLayer;if(this.mapView){const t=this.mapView.map.layers.findIndex((t=>t.title===e));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:e,listMode:"hide"}),w.managedLayers[e]="buffer";const t=this.mapView.map.layers.findIndex((e=>e.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}}async _sketchGraphicsChanged(e,t=!1){const i=e.detail.graphics;if(i.length>0&&i[0])if(t||(this._sketchGraphic=i[0]),this._workflowType=this.useLayerFeaturesEnabled?y.SELECT:y.SKETCH,this._workflowType===y.SKETCH&&await this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this.useLayerFeaturesEnabled&&!t){const e=Array.isArray(i)?i.map((e=>e.geometry)):this.geometries;await this._selectLayerFeatures(e[0])}else{const t=i.reduce(((e,t)=>(t?.layer?.objectIdField?e.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&e.push(t.getObjectId()),e)),[]),s=e.detail.useOIDs&&t.length>0;this._updateSelection(i,s,t),s&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){return this._skipGeomOIDs?.length>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(e){w.removeHandles(),e.length>0&&w.highlightHandles.push(await c(e,this.selectLayerView,this.mapView)),this._numSelected=e.length,this.selectionSetChange.emit(e.length)}async _selectFeatures(e){this._selectionLoading=!0,this._selectedIds=await o(e,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(e){this._bufferGeometry=Array.isArray(e.detail)?e.detail[0]:e.detail;let t=this._bufferTools.distance,i=0;if(this._bufferGeometry){const e=new this.Graphic({geometry:this._bufferGeometry,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});this._bufferGraphicsLayer.removeAll(),this._bufferGraphicsLayer.add(e),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(e.geometry.extent),i=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:i})}_geomQuery(e){const t=d(e,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(e=!0,t=!1){this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName&&(this._labelName.value="")),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),e&&this._searchWidget&&this._clearSearchWidget(),w.removeHandles(),this._drawTools?.clear&&(this._graphics=[],await this._drawTools.clear()),this._numSelected=this._selectedIds.length,this.selectionSetChange.emit(this._numSelected)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(e,t,i){this._selectedIds=t&&i?i:this._selectedIds,this._skipGeomOIDs=t?i:void 0,this.geometries=Array.isArray(e)?e.map((e=>e.geometry)):this.geometries,this._graphics=e}async _updateLabel(){if(this.enableSearchDistance){const e=this._selectionLabel.indexOf(this._translations.sketch)>-1,t=this._selectionLabel.indexOf(this._translations.select)>-1,i=this._selectionLabel.indexOf(this._searchResult?.name)>-1,s=this._workflowType===y.SEARCH?this._searchResult?.name:this._workflowType===y.SELECT?this._translations.select:this._translations.sketch,a=this._unit?this._unit:this._bufferTools.unit,l=await this._bufferTools.getTranslatedUnit(a),h=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=e||t||i||!this._selectionLabel?`${s} ${h} ${l}`:this._selectionLabel,this._labelName.value=this._selectionLabel}}async _layerSelectionChange(e){if(Array.isArray(e.detail)&&e.detail.length>0){const t=e.detail.map((e=>p(this.mapView,e)));return Promise.all(t).then((e=>{this.layerViews=e,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(e){const t=e?.detail?.length>0?e.detail[0]:"";this.selectLayerView&&t===this.selectLayerView.layer.id||(this.selectLayerView=await p(this.mapView,t),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(e){e.newValue!==e.oldValue&&(this._distance=e.newValue,await this._updateLabel())}async _selectLayerFeatures(e){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],b(0,t.layer,e,this._featuresCollection))));return Promise.all(t).then((async e=>{this._selectionLoading=!1;let t=[];e.forEach((e=>{Object.keys(e).forEach((i=>{t=t.concat(e[i])}))}));let i=!1;t.forEach((e=>{const t=e.geometry;e.symbol="point"===t.type?this.sketchPointSymbol:"polyline"===t.type?this.sketchLineSymbol:"polygon"===t.type?this.sketchPolygonSymbol:void 0,i=e?.layer?.hasOwnProperty("objectIdField")||e.hasOwnProperty("getObjectId")}));const s=this.layerViews[0].layer,a=this.selectLayerView.layer,l=i&&s.url===a.url&&a.layerId===s.layerId;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:l}},!0)}))}_useLayerFeaturesEnabledChanged(){this.useLayerFeaturesEnabled=!this.useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}static get watchers(){return{geometries:["watchGeometriesHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};S.style=':host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:"1rem" !important}.end-border{border-inline-end:1px solid var(--calcite-color-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-color-icon-color:var(--calcite-color-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2)}';const L=Object.freeze({__proto__:null,default:[{descriptionPDF:{labelWidthDisplay:"2-5/8",labelHeightDisplay:"1",labelsPerPageDisplay:"30",averyPartNumber:"*60"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.1875,rightMargin:.1875,topMargin:.5,bottomMargin:.5},numLabelsAcross:3,numLabelsDown:10,labelWidth:2.625,labelHeight:1,horizGapIn:.125,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1",labelsPerPageDisplay:"20",averyPartNumber:"*61"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.47637821,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:10,labelWidth:4,labelHeight:1.0025,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1-1/3",labelsPerPageDisplay:"14",averyPartNumber:"*62"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.81889808,bottomMargin:.83464612},numLabelsAcross:2,numLabelsDown:7,labelWidth:4,labelHeight:1.3352,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:6}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"2",labelsPerPageDisplay:"10",averyPartNumber:"*63"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.5,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:5,labelWidth:4,labelHeight:2,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:12,maxNumLabelLines:10}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"3-1/3",labelsPerPageDisplay:"6",averyPartNumber:"*64"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.4724412,bottomMargin:.50000027},numLabelsAcross:2,numLabelsDown:3,labelWidth:4,labelHeight:3.342,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:14,maxNumLabelLines:12}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"1/2",labelsPerPageDisplay:"80",averyPartNumber:"*67"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.307086375,rightMargin:.307086375,topMargin:.4724412,bottomMargin:.49606326},numLabelsAcross:4,numLabelsDown:20,labelWidth:1.75,labelHeight:.50155,horizGapIn:.29527575,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:3}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"2/3",labelsPerPageDisplay:"60",averyPartNumber:"*95"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.28936983,rightMargin:.28936983,topMargin:.53937037,bottomMargin:.5511814},numLabelsAcross:4,numLabelsDown:15,labelWidth:1.75,labelHeight:.6605,horizGapIn:.30708678,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:4}}]}),k=class{constructor(t){e(this,t)}get el(){return i(this)}defaultNumLabelsPerPage;disabled=!1;locale;_translations;_labelInfoElement;_intl;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async downloadCSV(e,t,i,s=!0){return _(e,t,!0,i,s)}async downloadPDF(e,t,i=!1,s="",a=""){return v(e,t,this._labelInfoElement.selectedOption?.value,i,s,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(a,{key:"afa6cf667c52c3923d99db3f53854f5acb12ecb3"},s("calcite-select",{key:"97eed0501514f4b1466d02dfc8f58ddce55cc2ec",disabled:this.disabled,label:"",ref:e=>{this._labelInfoElement=e}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[e]=await h(["esri/intl"]);this._intl=e}_getLabelSizeText(e){const t="‎"+e.descriptionPDF.labelWidthDisplay+" x "+e.descriptionPDF.labelHeightDisplay+"‏";return this._translations.pdfLabel.replace("{{n}}",e.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}_renderOptions(){(L.default||L).sort(((e,t)=>{const i=parseInt(e.descriptionPDF.labelsPerPageDisplay,10),s=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return i<s?-1:i>s?1:0})).forEach(((e,t)=>{const i=document.createElement("calcite-option");i.value=e,i.innerHTML=this._getLabelSizeText(e),this._labelInfoElement.appendChild(i),(this.defaultNumLabelsPerPage?parseInt(e.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(i.selected=!0)}))}static get watchers(){return{locale:["localeWatchHandler"]}}};k.style=":host{display:block}";const P=class{constructor(i){e(this,i),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7)}get el(){return i(this)}addresseeLayer;enabledLayerIds=[];locale;mapView;selectionSets=[];sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;_translations;_selectionMode=m.ADD;_refineLayer;_addEnabled=!0;_drawTools;_refineSets=[];_enabledLayerIds=[];_layerPicker;_featuresCollection={};_refineSelectionSet;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}selectionLoadingChange;selectionSetsChanged;async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){return s(a,{key:"01d9d6eb8f212f458bd6651d8e874bb108a6e773"},s("div",{key:"eb9fb249f89a671e9c67fb83db2203713814d72b",class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{key:"a5991f6da0f888e85e1cf88967c8c8aa12790575",class:"display-flex"},s("calcite-label",{key:"e8f31c546ceae8a02ed1d49ec8ae9f1f6fb78022",class:"font-bold width-full label-margin-0"},s("div",{key:"d4be658063d140f56356ce7b694841e9bc89a1b3",class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{key:"6d3ff8cbb1bcc62aca444eb4d030a236466adfac",class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{key:"1e9dad9f2c8ff2ce130f79c37d804d4bd8162a96",enabledLayerIds:this._enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},ref:e=>{this._layerPicker=e},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{key:"b4f838f56f88cff5973d8f5fd3c54b7f0d7c72b3",closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{key:"fcbdf68353eabcf090e60d8a239f07230f4bb37c",class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{key:"33891e7ff61cdd224a8652bae3e9d55256eb44a0",class:"padding-1"},s("div",{key:"a291edada53ed10197bec5fcc53d999f79042203",class:"padding-bottom-1"},s("calcite-segmented-control",{key:"0c84665a705a12d1e51fb470e604bc52d8ac7543",class:"w-100",width:"full"},s("calcite-segmented-control-item",{key:"e50d78508164a4ddf2a5da9def80a19a4562cb8c",checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.ADD),value:m.ADD},s("span",{key:"b48811b1a2e56942965c944ff1eb35e10edd1db8",class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{key:"dff6a191781fc4c6c3bde6fb3290da0ce96dea84",checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.REMOVE),value:m.REMOVE},s("span",{key:"6dd86784de32c25ffbe8c5e61847cb506a122b5e",class:"font-weight-500"},this._translations.remove)))),s("div",{key:"d39ce91248e4eb7867049bfe9d5537a74f96a0d2"},s("map-draw-tools",{key:"24a30d188807bf40749def362c21048ee92bb81b",active:!0,drawMode:u.REFINE,locale:this.locale,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:e=>this._sketchGraphicsChanged(e),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:this._refineSelectionSet?.redoStack.length>0,ref:e=>{this._drawTools=e},undoEnabled:this._refineSelectionSet?.undoStack.length>0})),s("br",{key:"7d28ea63ea92de45bd457f0aef93d99deea62553"}),s("calcite-list",{key:"9b3c34304632ccf9253eec71e955502a0be48a13",class:"list-border",label:""},this._getRefineSelectionSetList())))}_layerSelectionChange(e){this._setRefineSet(e.detail[0])}_setSelectionMode(e){this._selectionMode=e}_sketchGraphicsChanged(e){const t=e.detail?.graphics[0].geometry;this._selectFeatures(t)}_getEnabledLayerIds(){return this.selectionSets.reduce(((e,t)=>{const i=t?.layerView?.layer.id;return i&&e.indexOf(i)<0?e.push(i):t.workflowType===y.REFINE&&Object.keys(t.refineInfos).forEach((t=>{e.indexOf(t)<0&&e.push(t)})),e}),[])}async _setRefineSet(e){this.selectionSets.some((t=>{if(t.workflowType===y.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(e)>-1}))||await this._initRefineSet(e,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[e].layerView}async _initRefineSet(e,t){const i={};i[e]={addIds:[],removeIds:[],layerView:await p(this.mapView,e)},t?t.refineInfos={...t.refineInfos,...i}:(this._refineSelectionSet={id:Date.now(),searchResult:void 0,buffer:void 0,distance:0,download:!0,unit:"feet",label:"Refine",selectedIds:[],layerView:void 0,geometries:[],graphics:[],selectLayers:[],workflowType:y.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:i,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const e=this._refineSelectionSet.undoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.redoStack,e.layerView)}_redo(){const e=this._refineSelectionSet.redoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.undoStack,e.layerView)}_getRefineSelectionSetList(){const e=this._getTotal(this.selectionSets);let t;this.selectionSets.some((e=>{if(e.workflowType===y.REFINE)return t=e,!0}));let i=0,a=0;return Object.keys(t.refineInfos).forEach((e=>{i+=t.refineInfos[e].addIds.length,a+=t.refineInfos[e].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",i.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",e.toString()),"non-interactive":!0})]}_getTotal(e){const t=f(e);return Object.keys(t).reduce(((e,i)=>e+t[i].ids.length),0)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}async _selectFeatures(e){this.selectionLoadingChange.emit(!0),this._featuresCollection[this._refineLayer?.layer.id]=[];const t=await b(0,this._refineLayer?.layer,e,this._featuresCollection);this.selectionLoadingChange.emit(!1);let i=[];Object.keys(t).forEach((e=>{e===this._refineLayer?.layer.id&&(i=i.concat(t[e]))}));const s=Array.isArray(i)?i.map((e=>e.attributes[e?.layer?.objectIdField])):[];await this._updateIds(s,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),w.highlightHandles=await g(this.selectionSets)}_clearHighlight(){w.removeHandles()}async _updateIds(e,t,i,s){let a=!1;const l=this._refineSelectionSet.refineInfos,h=s.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:s};const r=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===m.ADD)r.addIds=[...new Set([...e,...r.addIds])],r.addIds.length>0&&i.push({ids:e,mode:t,layerView:s}),r.removeIds.length>0&&(r.removeIds=r.removeIds.filter((t=>e.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,i)=>(e.forEach((e=>{i.workflowType!==y.REFINE?i.selectedIds.indexOf(e)>-1&&t.push(e):Object.keys(i.refineInfos).some((a=>{const l=i.refineInfos[a];if(l.layerView.layer.id===s.layer.id&&l.addIds.indexOf(e)>-1)return t.push(e),!0}))})),t)),[]);r.removeIds=[...new Set([...l,...r.removeIds])],r.addIds=r.addIds.filter((e=>l.indexOf(e)<0)),r.removeIds.length>0&&i.push({ids:l,mode:t,layerView:s}),this.selectionSets=this.selectionSets.reduce(((e,t)=>(t.workflowType!==y.REFINE&&t.layerView.layer.id===s.layer.id?(t.selectedIds=t.selectedIds.filter((e=>r.removeIds.indexOf(e)<0)),t.selectedIds.length>0?e.push(t):a=!0):e.push(t),e)),[])}this._refineSelectionSet.refineInfos[h]=r,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}static get watchers(){return{locale:["localeWatchHandler"]}}};P.style=':host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir="rtl"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-color-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:"Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;line-height:1.3em;background-color:var(--calcite-color-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110, 110, 110, .3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110, 110, 110, .3)}.display-flex{display:flex}.font-bold{font-weight:bold}.width-full{width:100%}.label-margin-0{--calcite-label-margin-bottom:0}.padding-start-1-2{padding-inline-start:0.5rem}.font-weight-500{font-weight:500}.word-wrap-anywhere{word-wrap:anywhere}';export{S as map_select_tools,k as pdf_download,P as refine_selection}
|
6
|
+
import{r as e,c as t,g as i,h as s,H as a}from"./p-8c40bdec.js";import{a as l,l as h,g as n}from"./p-a23de3b0.js";import{e as r,h as c,k as o,l as d,c as p,m as b,n as f,o as g}from"./p-d572627c.js";import{a as y,e as m,f as u}from"./p-80cb7c73.js";import{s as w}from"./p-bf007c87.js";import{d as _,a as v}from"./p-20085e58.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-fa639501.js";import"./p-af7e43e0.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";const S=class{constructor(i){e(this,i),this.selectionSetChange=t(this,"selectionSetChange",7)}get el(){return i(this)}bufferColor=[227,139,79,.8];bufferOutlineColor=[255,255,255];customLabelEnabled;enabledLayerIds=[];enableLayerFeatures=!0;enableLayerFeaturesOnLoad=!1;enableSearchDistance=!0;enableSearchDistanceOnLoad=!1;enableSketchTools=!0;defaultBufferDistance;defaultBufferUnit;geometries=[];isUpdate=!1;layerViews=[];locale;mapView;noResultText;searchConfiguration;selectionSet;selectionLayerIds=[];selectLayerView;sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;searchDistanceEnabled=!1;useLayerFeaturesEnabled=!1;_numSelected=0;_searchTerm;_selectionLoading=!1;_translations;_esriRequest;FeatureLayer;Graphic;GraphicsLayer;Search;_geometryEngine;_bufferGeometry;_bufferGraphicsLayer;_bufferTools;_distance;_drawTools;_labelName;_selectLayers;_searchElement;_searchResult;_searchWidget;_selectedIds=[];_selectionLabel="";_skipGeomOIDs;_sketchGraphic;_graphics=[];_unit;_workflowType;_featuresCollection={};async watchGeometriesHandler(e,t){if(e!==t){const t=0===e.length;if(await this._clearResults(t,t),e.length>0)return this._highlightWithOIDsOrGeoms()}}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(e,t){e&&e!==t&&await this._init()}async watchSearchConfigurationHandler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&await this._initSearchWidget()}async clearSelection(){return this._clearResults(!0,!0)}async getSelection(){return/\S+/gm.test(this._selectionLabel)||await this._updateLabel(),{id:this.isUpdate?this.selectionSet.id:Date.now(),searchResult:this._searchResult,buffer:this._bufferGeometry,distance:this._bufferTools?.distance,download:!0,unit:this._bufferTools?.unit,label:this._selectionLabel,selectedIds:this._selectedIds,layerView:this.selectLayerView,geometries:this.geometries,graphics:this._graphics,selectLayers:this.layerViews,skipGeomOIDs:this._skipGeomOIDs,searchDistanceEnabled:this.searchDistanceEnabled,workflowType:this._workflowType,useLayerFeaturesEnabled:this.useLayerFeaturesEnabled,sketchGraphic:this._sketchGraphic}}selectionSetChange;searchConfigurationChangeChanged(e){this.searchConfiguration=e.detail}async distanceChanged(e){await this._distanceChanged(e.detail)}async unitChanged(e){e.detail.newValue!==e.detail.oldValue&&(this._unit=e.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init()}render(){const e=this.enableSketchTools?"":"display-none",t=this.enableSketchTools?"padding-top-1":"";return s(a,{key:"a5001c196db1464bffa746310638b2853ff5fdf9"},this._getMapLayerPicker(),s("div",{key:"3e023a81f76bdd371c84d9ecb42e97a9160c6f89",class:"border-bottom"}),s("div",{key:"c6be571bee2d2c1fe82407aee9a1cf9f1f27280d",class:"padding-top-sides-1"},s("div",{key:"aaf5992f616728f6be5be034700ac09b9b5b733f",class:"search-widget",ref:e=>{this._searchElement=e}}),s("div",{key:"a86b4e147b7baf4b93272bed7f189a47faf65ab8",class:t},s("map-draw-tools",{key:"9b3c2faaa8f612d055189206e2baeb868d55dceb",active:!0,class:e,editGraphicsEnabled:!this.useLayerFeaturesEnabled,graphics:this._graphics,locale:this.locale,mapView:this.mapView,onSketchGraphicsChange:e=>{this._sketchGraphicsChanged(e)},pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:e=>{this._drawTools=e}})),this.enableSearchDistance?this._getBufferOptions():void 0,this.enableLayerFeatures?this._getUseLayerFeaturesOptions():void 0,this._getNumSelected()),s("div",{key:"73b3039f0861046a3f955872180b64c15bd5c5d9",class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){this.enableSearchDistanceOnLoad&&(this.searchDistanceEnabled=!0,this.enableSearchDistanceOnLoad=!1);const e=this.searchDistanceEnabled?"search-distance":"div-not-visible",t="number"==typeof this.selectionSet?.distance?this.selectionSet.distance:this.defaultBufferDistance;return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.searchDistance,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"search-distance-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},s("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),s("calcite-switch",{checked:this.searchDistanceEnabled,onCalciteSwitchChange:()=>this.searchDistanceEnabled=!this.searchDistanceEnabled})),s("div",{class:e},s("buffer-tools",{disabled:!this.searchDistanceEnabled,distance:t,geometries:this.geometries,locale:this.locale,onBufferComplete:e=>{this._bufferComplete(e)},ref:e=>this._bufferTools=e,unit:this.selectionSet?.unit||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){this.enableLayerFeaturesOnLoad&&(this.useLayerFeaturesEnabled=!0,this.enableLayerFeaturesOnLoad=!1);const e=this.useLayerFeaturesEnabled?"div-visible":"div-not-visible";return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.useLayerFeatures,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"use-layer-features-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},s("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),s("calcite-switch",{checked:this.useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),s("div",{class:e+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},selectedIds:this.layerViews.map((e=>e.layer.id)),showTables:!1})))}_getNumSelected(){const e=l(this.el),t=e&&"en"===e?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return s("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?s("div",null,s("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{class:"info-blue",scale:"m"},this._selectionLoading?t:this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedFeatures.replace("{{n}}",this._numSelected.toString())))}_getNameInput(){return s("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},s("calcite-label",{class:"font-bold"},this._translations.listName,s("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:e=>{this._labelName=e},value:this._selectionLabel||""})))}_getMapLayerPicker(){return s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,s("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._inputLayerSelectionChange(e)},selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[e,t,i,s,a,l]=await h(["esri/request","esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this._esriRequest=e,this.GraphicsLayer=t,this.Graphic=i,this.Search=s,this._geometryEngine=a,this.FeatureLayer=l}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),await this._initSearchWidget()}async _initSelectionSet(){this.selectionSet&&(this._searchTerm=this.selectionSet.searchResult?.name,this._searchResult=this.selectionSet.searchResult,this._selectLayers=this.selectionSet.selectLayers,this._selectedIds=this.selectionSet.selectedIds,this._skipGeomOIDs=this.selectionSet.skipGeomOIDs,this.searchDistanceEnabled=this.selectionSet.searchDistanceEnabled,this.useLayerFeaturesEnabled=this.selectionSet.useLayerFeaturesEnabled,this._distance=this.selectionSet.searchDistanceEnabled?this.selectionSet.distance:0,this._unit=this.selectionSet.unit,this._workflowType=this.selectionSet.workflowType,this.selectLayerView=this.selectionSet.layerView,this._sketchGraphic=this.selectionSet.sketchGraphic,this.geometries=[...this.selectionSet?.geometries||[]],this._graphics=this.geometries.map((e=>new this.Graphic({geometry:e,symbol:"point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=this.selectionSet?.label,this.useLayerFeaturesEnabled||await(this._drawTools?.updateGraphics()),await r(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}async _initSearchWidget(){if(this.mapView&&this._searchElement){const e=this._getSearchConfig(this.searchConfiguration,this.mapView),t={view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm,...e};this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const e=this._searchClearLabel();this._clearResults(!1,e)})),this._searchWidget.on("select-result",(e=>{this._selectResult(e.result)})),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this.searchConfiguration?.allPlaceholder&&"find address or place"!==this.searchConfiguration.allPlaceholder.toLowerCase()?this.searchConfiguration.allPlaceholder:this._translations.placeholder}))}}async _selectResult(e){if(e){this._searchResult=e;const t=e.feature,i=t?.layer,s=this.selectLayerView.layer,a=t?.getObjectId();let l,h;i?.sourceJSON?.isView&&(l=await this._getViewSourceUrl(i.url)),s?.sourceJSON?.isView&&(h=await this._getViewSourceUrl(s.url));const n=i?.url?.toLowerCase(),r=l?.toLowerCase(),c=s?.url?.toLowerCase(),o=h?.toLowerCase(),d=n&&c&&(n===c||n===o||r===c||r===o)&&!isNaN(a),p=d?[a]:void 0;this._workflowType=y.SEARCH,this._updateLabel();const b=[e.feature];this._updateSelection(b,d,p),this._drawTools.graphics=b,this._searchWidget.resultGraphic.visible=!1}else{const e=this._searchClearLabel();this._clearResults(!1,e)}}async _getViewSourceUrl(e){let t="";const i=`${e}/sources?f=json`;try{const e=await this._esriRequest(i,{query:{f:"json"}});1===e?.data?.services?.length&&(t=e.data.services[0].url)}catch(e){console.log(e)}return t}_searchClearLabel(){return this._searchResult?.name&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(e,t){const i=e?.sources;return i?.length>0?(e={...e,includeDefaultSources:!1},i.forEach((e=>{if(e.hasOwnProperty("layer")){const i=e,s=i.layer?.id,a=s?t.map.findLayerById(s):null,l=i?.layer?.url;a?i.layer=a:l&&(i.layer=new this.FeatureLayer(l))}})),i?.forEach((e=>{if(e.hasOwnProperty("locator")){const t=e;"ArcGIS World Geocoding Service"===t?.name&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):e={...e,includeDefaultSources:!0},e}_initGraphicsLayer(){const e=this._translations.bufferLayer;if(this.mapView){const t=this.mapView.map.layers.findIndex((t=>t.title===e));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:e,listMode:"hide"}),w.managedLayers[e]="buffer";const t=this.mapView.map.layers.findIndex((e=>e.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}}async _sketchGraphicsChanged(e,t=!1){const i=e.detail.graphics;if(i.length>0&&i[0])if(t||(this._sketchGraphic=i[0]),this._workflowType=this.useLayerFeaturesEnabled?y.SELECT:y.SKETCH,this._workflowType===y.SKETCH&&await this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this.useLayerFeaturesEnabled&&!t){const e=Array.isArray(i)?i.map((e=>e.geometry)):this.geometries;await this._selectLayerFeatures(e[0])}else{const t=i.reduce(((e,t)=>(t?.layer?.objectIdField?e.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&e.push(t.getObjectId()),e)),[]),s=e.detail.useOIDs&&t.length>0;this._updateSelection(i,s,t),s&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){return this._skipGeomOIDs?.length>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(e){w.removeHandles(),e.length>0&&w.highlightHandles.push(await c(e,this.selectLayerView,this.mapView)),this._numSelected=e.length,this.selectionSetChange.emit(e.length)}async _selectFeatures(e){this._selectionLoading=!0,this._selectedIds=await o(e,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(e){this._bufferGeometry=Array.isArray(e.detail)?e.detail[0]:e.detail;let t=this._bufferTools.distance,i=0;if(this._bufferGeometry){const e=new this.Graphic({geometry:this._bufferGeometry,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});this._bufferGraphicsLayer.removeAll(),this._bufferGraphicsLayer.add(e),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(e.geometry.extent),i=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:i})}_geomQuery(e){const t=d(e,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(e=!0,t=!1){this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName&&(this._labelName.value="")),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),e&&this._searchWidget&&this._clearSearchWidget(),w.removeHandles(),this._drawTools?.clear&&(this._graphics=[],await this._drawTools.clear()),this._numSelected=this._selectedIds.length,this.selectionSetChange.emit(this._numSelected)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(e,t,i){this._selectedIds=t&&i?i:this._selectedIds,this._skipGeomOIDs=t?i:void 0,this.geometries=Array.isArray(e)?e.map((e=>e.geometry)):this.geometries,this._graphics=e}async _updateLabel(){if(this.enableSearchDistance){const e=this._selectionLabel.indexOf(this._translations.sketch)>-1,t=this._selectionLabel.indexOf(this._translations.select)>-1,i=this._selectionLabel.indexOf(this._searchResult?.name)>-1,s=this._workflowType===y.SEARCH?this._searchResult?.name:this._workflowType===y.SELECT?this._translations.select:this._translations.sketch,a=this._unit?this._unit:this._bufferTools.unit,l=await this._bufferTools.getTranslatedUnit(a),h=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=e||t||i||!this._selectionLabel?`${s} ${h} ${l}`:this._selectionLabel,this._labelName.value=this._selectionLabel}}async _layerSelectionChange(e){if(Array.isArray(e.detail)&&e.detail.length>0){const t=e.detail.map((e=>p(this.mapView,e)));return Promise.all(t).then((e=>{this.layerViews=e,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(e){const t=e?.detail?.length>0?e.detail[0]:"";this.selectLayerView&&t===this.selectLayerView.layer.id||(this.selectLayerView=await p(this.mapView,t),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(e){e.newValue!==e.oldValue&&(this._distance=e.newValue,await this._updateLabel())}async _selectLayerFeatures(e){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],b(0,t.layer,e,this._featuresCollection))));return Promise.all(t).then((async e=>{this._selectionLoading=!1;let t=[];e.forEach((e=>{Object.keys(e).forEach((i=>{t=t.concat(e[i])}))}));let i=!1;t.forEach((e=>{const t=e.geometry;e.symbol="point"===t.type?this.sketchPointSymbol:"polyline"===t.type?this.sketchLineSymbol:"polygon"===t.type?this.sketchPolygonSymbol:void 0,i=e?.layer?.hasOwnProperty("objectIdField")||e.hasOwnProperty("getObjectId")}));const s=this.layerViews[0].layer,a=this.selectLayerView.layer,l=i&&s.url===a.url&&a.layerId===s.layerId;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:l}},!0)}))}_useLayerFeaturesEnabledChanged(){this.useLayerFeaturesEnabled=!this.useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}static get watchers(){return{geometries:["watchGeometriesHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};S.style=':host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:"1rem" !important}.end-border{border-inline-end:1px solid var(--calcite-color-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-color-icon-color:var(--calcite-color-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2)}';const L=Object.freeze({__proto__:null,default:[{descriptionPDF:{labelWidthDisplay:"2-5/8",labelHeightDisplay:"1",labelsPerPageDisplay:"30",averyPartNumber:"*60"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.1875,rightMargin:.1875,topMargin:.5,bottomMargin:.5},numLabelsAcross:3,numLabelsDown:10,labelWidth:2.625,labelHeight:1,horizGapIn:.125,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1",labelsPerPageDisplay:"20",averyPartNumber:"*61"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.47637821,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:10,labelWidth:4,labelHeight:1.0025,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1-1/3",labelsPerPageDisplay:"14",averyPartNumber:"*62"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.81889808,bottomMargin:.83464612},numLabelsAcross:2,numLabelsDown:7,labelWidth:4,labelHeight:1.3352,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:6}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"2",labelsPerPageDisplay:"10",averyPartNumber:"*63"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.5,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:5,labelWidth:4,labelHeight:2,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:12,maxNumLabelLines:10}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"3-1/3",labelsPerPageDisplay:"6",averyPartNumber:"*64"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.4724412,bottomMargin:.50000027},numLabelsAcross:2,numLabelsDown:3,labelWidth:4,labelHeight:3.342,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:14,maxNumLabelLines:12}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"1/2",labelsPerPageDisplay:"80",averyPartNumber:"*67"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.307086375,rightMargin:.307086375,topMargin:.4724412,bottomMargin:.49606326},numLabelsAcross:4,numLabelsDown:20,labelWidth:1.75,labelHeight:.50155,horizGapIn:.29527575,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:3}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"2/3",labelsPerPageDisplay:"60",averyPartNumber:"*95"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.28936983,rightMargin:.28936983,topMargin:.53937037,bottomMargin:.5511814},numLabelsAcross:4,numLabelsDown:15,labelWidth:1.75,labelHeight:.6605,horizGapIn:.30708678,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:4}}]}),k=class{constructor(t){e(this,t)}get el(){return i(this)}defaultNumLabelsPerPage;disabled=!1;locale;_translations;_labelInfoElement;_intl;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async downloadCSV(e,t,i,s=!0){return _(e,t,!0,i,s)}async downloadPDF(e,t,i=!1,s="",a=""){return v(e,t,this._labelInfoElement.selectedOption?.value,i,s,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(a,{key:"2fd2ec44e8962468e3698b81e98746ddf6b7a3ca"},s("calcite-select",{key:"d24fca5c39aa358116ee8557249f7a4b09727b3f",disabled:this.disabled,label:"",ref:e=>{this._labelInfoElement=e}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[e]=await h(["esri/intl"]);this._intl=e}_getLabelSizeText(e){const t="‎"+e.descriptionPDF.labelWidthDisplay+" x "+e.descriptionPDF.labelHeightDisplay+"‏";return this._translations.pdfLabel.replace("{{n}}",e.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}_renderOptions(){(L.default||L).sort(((e,t)=>{const i=parseInt(e.descriptionPDF.labelsPerPageDisplay,10),s=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return i<s?-1:i>s?1:0})).forEach(((e,t)=>{const i=document.createElement("calcite-option");i.value=e,i.innerHTML=this._getLabelSizeText(e),this._labelInfoElement.appendChild(i),(this.defaultNumLabelsPerPage?parseInt(e.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(i.selected=!0)}))}static get watchers(){return{locale:["localeWatchHandler"]}}};k.style=":host{display:block}";const P=class{constructor(i){e(this,i),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7)}get el(){return i(this)}addresseeLayer;enabledLayerIds=[];locale;mapView;selectionSets=[];sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;_translations;_selectionMode=m.ADD;_refineLayer;_addEnabled=!0;_drawTools;_refineSets=[];_enabledLayerIds=[];_layerPicker;_featuresCollection={};_refineSelectionSet;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}selectionLoadingChange;selectionSetsChanged;async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){return s(a,{key:"8220100e14abd8339947a74df2d8072d06fb2a25"},s("div",{key:"1d7426778d638f347b563bfd29478fae7598e2dd",class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{key:"cfb649989c24c403bde7d358794933f8f7959bb8",class:"display-flex"},s("calcite-label",{key:"dce85bbfa526941a0fb46c1aeba57f4b028948ef",class:"font-bold width-full label-margin-0"},s("div",{key:"86c19198643381fd99681c53bf0b2b5e66ecf7dc",class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{key:"392022947cd9f53b4b83895992c5b0b32e56fb06",class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{key:"d0946a46e7a79fc613b9eb9aa3e6f896c12bef92",enabledLayerIds:this._enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},ref:e=>{this._layerPicker=e},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{key:"3b733fd5e7ceb011446112e65aa1ee1b0c5899c7",closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{key:"2076104710f4fbdd1de1f31b552b17749ebf9239",class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{key:"040efdfd6a269244790101cc0712a1cb0bac40d8",class:"padding-1"},s("div",{key:"be963f2cb157fda55980166359e53139a5713405",class:"padding-bottom-1"},s("calcite-segmented-control",{key:"459fa98e8852ea96afd0c9ab5864787f80ff6559",class:"w-100",width:"full"},s("calcite-segmented-control-item",{key:"965fa774838ecd3292c19a430cdbdfc7b44c82b2",checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.ADD),value:m.ADD},s("span",{key:"e0b6fddbded9c78fa98674709ff03f050fd47300",class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{key:"56e453183fc559ddbce5b041095fad5a8d6262ab",checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.REMOVE),value:m.REMOVE},s("span",{key:"13593da569557fa57822c98e12a5654cade219a1",class:"font-weight-500"},this._translations.remove)))),s("div",{key:"029fec164d9475274294a1d740a434cab2535cdc"},s("map-draw-tools",{key:"a212c5d21b2b1cdf7ba284a95dacaf83cf0180c9",active:!0,drawMode:u.REFINE,locale:this.locale,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:e=>this._sketchGraphicsChanged(e),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:this._refineSelectionSet?.redoStack.length>0,ref:e=>{this._drawTools=e},undoEnabled:this._refineSelectionSet?.undoStack.length>0})),s("br",{key:"352a0523461cfeeae3bae09ae1cc6f8fa759616b"}),s("calcite-list",{key:"948c7f0aa24d827d29cbc1c2c702deb52134e771",class:"list-border",label:""},this._getRefineSelectionSetList())))}_layerSelectionChange(e){this._setRefineSet(e.detail[0])}_setSelectionMode(e){this._selectionMode=e}_sketchGraphicsChanged(e){const t=e.detail?.graphics[0].geometry;this._selectFeatures(t)}_getEnabledLayerIds(){return this.selectionSets.reduce(((e,t)=>{const i=t?.layerView?.layer.id;return i&&e.indexOf(i)<0?e.push(i):t.workflowType===y.REFINE&&Object.keys(t.refineInfos).forEach((t=>{e.indexOf(t)<0&&e.push(t)})),e}),[])}async _setRefineSet(e){this.selectionSets.some((t=>{if(t.workflowType===y.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(e)>-1}))||await this._initRefineSet(e,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[e].layerView}async _initRefineSet(e,t){const i={};i[e]={addIds:[],removeIds:[],layerView:await p(this.mapView,e)},t?t.refineInfos={...t.refineInfos,...i}:(this._refineSelectionSet={id:Date.now(),searchResult:void 0,buffer:void 0,distance:0,download:!0,unit:"feet",label:"Refine",selectedIds:[],layerView:void 0,geometries:[],graphics:[],selectLayers:[],workflowType:y.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:i,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const e=this._refineSelectionSet.undoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.redoStack,e.layerView)}_redo(){const e=this._refineSelectionSet.redoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.undoStack,e.layerView)}_getRefineSelectionSetList(){const e=this._getTotal(this.selectionSets);let t;this.selectionSets.some((e=>{if(e.workflowType===y.REFINE)return t=e,!0}));let i=0,a=0;return Object.keys(t.refineInfos).forEach((e=>{i+=t.refineInfos[e].addIds.length,a+=t.refineInfos[e].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",i.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",e.toString()),"non-interactive":!0})]}_getTotal(e){const t=f(e);return Object.keys(t).reduce(((e,i)=>e+t[i].ids.length),0)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}async _selectFeatures(e){this.selectionLoadingChange.emit(!0),this._featuresCollection[this._refineLayer?.layer.id]=[];const t=await b(0,this._refineLayer?.layer,e,this._featuresCollection);this.selectionLoadingChange.emit(!1);let i=[];Object.keys(t).forEach((e=>{e===this._refineLayer?.layer.id&&(i=i.concat(t[e]))}));const s=Array.isArray(i)?i.map((e=>e.attributes[e?.layer?.objectIdField])):[];await this._updateIds(s,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),w.highlightHandles=await g(this.selectionSets)}_clearHighlight(){w.removeHandles()}async _updateIds(e,t,i,s){let a=!1;const l=this._refineSelectionSet.refineInfos,h=s.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:s};const r=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===m.ADD)r.addIds=[...new Set([...e,...r.addIds])],r.addIds.length>0&&i.push({ids:e,mode:t,layerView:s}),r.removeIds.length>0&&(r.removeIds=r.removeIds.filter((t=>e.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,i)=>(e.forEach((e=>{i.workflowType!==y.REFINE?i.selectedIds.indexOf(e)>-1&&t.push(e):Object.keys(i.refineInfos).some((a=>{const l=i.refineInfos[a];if(l.layerView.layer.id===s.layer.id&&l.addIds.indexOf(e)>-1)return t.push(e),!0}))})),t)),[]);r.removeIds=[...new Set([...l,...r.removeIds])],r.addIds=r.addIds.filter((e=>l.indexOf(e)<0)),r.removeIds.length>0&&i.push({ids:l,mode:t,layerView:s}),this.selectionSets=this.selectionSets.reduce(((e,t)=>(t.workflowType!==y.REFINE&&t.layerView.layer.id===s.layer.id?(t.selectedIds=t.selectedIds.filter((e=>r.removeIds.indexOf(e)<0)),t.selectedIds.length>0?e.push(t):a=!0):e.push(t),e)),[])}this._refineSelectionSet.refineInfos[h]=r,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}static get watchers(){return{locale:["localeWatchHandler"]}}};P.style=':host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir="rtl"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-color-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:"Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;line-height:1.3em;background-color:var(--calcite-color-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110, 110, 110, .3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110, 110, 110, .3)}.display-flex{display:flex}.font-bold{font-weight:bold}.width-full{width:100%}.label-margin-0{--calcite-label-margin-bottom:0}.padding-start-1-2{padding-inline-start:0.5rem}.font-weight-500{font-weight:500}.word-wrap-anywhere{word-wrap:anywhere}';export{S as map_select_tools,k as pdf_download,P as refine_selection}
|