@esri/solutions-components 0.8.27 → 0.8.28

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solutions-components",
3
- "version": "0.8.27",
3
+ "version": "0.8.28",
4
4
  "description": "Web Components for Esri's Solutions Applications",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as i,c as t,h as e,H as s,g as a}from"./p-6d753a3d.js";import{a as l,l as h,g as n}from"./p-896c9644.js";import{e as o,h as r,k as d,l as c,c as p,m as b,n as g,o as f}from"./p-583e5dd0.js";import{a as y,e as u,f as v}from"./p-c1cf3ebc.js";import{s as m}from"./p-f22a4439.js";import{d as w,a as S}from"./p-6f69de4d.js";import"./p-82e085d0.js";import"./p-bdcf99c0.js";import"./p-334e6394.js";import"./p-a230b270.js";import"./p-530b73ce.js";const _=class{constructor(e){i(this,e),this.selectionSetChange=t(this,"selectionSetChange",7),this._selectedIds=[],this._selectionLabel="",this._graphics=[],this._featuresCollection={},this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.enabledLayerIds=[],this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.geometries=[],this.isUpdate=!1,this.layerViews=[],this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionSet=void 0,this.selectionLayerIds=[],this.selectLayerView=void 0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._numSelected=0,this._searchDistanceEnabled=!1,this._searchTerm=void 0,this._selectionLoading=!1,this._translations=void 0,this._useLayerFeaturesEnabled=!1}async watchGeometriesHandler(i,t){if(i!==t){const t=0===i.length;if(await this._clearResults(t,t),i.length>0)return this._highlightWithOIDsOrGeoms()}}async mapViewWatchHandler(i,t){i&&i!==t&&await this._init()}async watchSearchConfigurationHandler(i,t){JSON.stringify(i)!==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}}searchConfigurationChangeChanged(i){this.searchConfiguration=i.detail}async distanceChanged(i){await this._distanceChanged(i.detail)}async unitChanged(i){i.detail.newValue!==i.detail.oldValue&&(this._unit=i.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init()}render(){return e(s,{key:"2b56c937fc1c146927f9340f69214cd13dd02646"},this._getMapLayerPicker(),e("div",{key:"c7c67b0a76390992b0e60c0cc76e483d832a8835",class:"border-bottom"}),e("div",{key:"87cefbe906df9489b371e2c4432b2bdfbb84d299",class:"padding-top-sides-1"},e("div",{key:"f8a4ca9dac6d0fab8a9197ce94051a8b2b502fd7",class:"search-widget",ref:i=>{this._searchElement=i}}),e("div",{key:"e63f6558b06b37d9c00b1a67ed47c9238b452c4a",class:"padding-top-1"},e("map-draw-tools",{key:"7c3d157f3dd7beb6172c15b62343af378c7a029e",active:!0,editGraphicsEnabled:!this._useLayerFeaturesEnabled,graphics:this._graphics,mapView:this.mapView,onSketchGraphicsChange:i=>{this._sketchGraphicsChanged(i)},pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:i=>{this._drawTools=i}})),this._getBufferOptions(),this._getUseLayerFeaturesOptions(),this._getNumSelected()),e("div",{key:"7642899857c823b6891138d19016783a77922fea",class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){var i,t;const s=this._searchDistanceEnabled?"search-distance":"div-not-visible",a="number"==typeof(null===(i=this.selectionSet)||void 0===i?void 0:i.distance)?this.selectionSet.distance:this.defaultBufferDistance;return e("div",null,e("div",{class:"padding-top-1 display-flex"},e("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},e("div",{class:"tooltip-container"},this._translations.searchDistance,e("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"search-distance-icon",scale:"s"}))),e("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},e("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),e("calcite-switch",{checked:this._searchDistanceEnabled,onCalciteSwitchChange:()=>this._searchDistanceEnabled=!this._searchDistanceEnabled})),e("div",{class:s},e("buffer-tools",{disabled:!this._searchDistanceEnabled,distance:a,geometries:this.geometries,onBufferComplete:i=>{this._bufferComplete(i)},ref:i=>this._bufferTools=i,unit:(null===(t=this.selectionSet)||void 0===t?void 0:t.unit)||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){const i=this._useLayerFeaturesEnabled?"div-visible":"div-not-visible";return e("div",null,e("div",{class:"padding-top-1 display-flex"},e("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},e("div",{class:"tooltip-container"},this._translations.useLayerFeatures,e("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"use-layer-features-icon",scale:"s"}))),e("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},e("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),e("calcite-switch",{checked:this._useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),e("div",{class:i+" padding-top-1"},e("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},selectedIds:this.layerViews.map((i=>i.layer.id)),showTables:!1})))}_getNumSelected(){const i=l(this.el),t=i&&"en"===i?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return e("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?e("div",null,e("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):e("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),e("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 e("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},e("calcite-label",{class:"font-bold"},this._translations.listName,e("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:i=>{this._labelName=i},value:this._selectionLabel||""})))}_getMapLayerPicker(){return e("div",{class:"display-flex padding-sides-1 padding-bottom-1"},e("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,e("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._inputLayerSelectionChange(i)},selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[i,t,e,s,a]=await h(["esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this.GraphicsLayer=i,this.Graphic=t,this.Search=e,this._geometryEngine=s,this.FeatureLayer=a}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),await this._initSearchWidget()}async _initSelectionSet(){var i,t,e,s;this.selectionSet&&(this._searchTerm=null===(i=this.selectionSet.searchResult)||void 0===i?void 0:i.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=[...(null===(t=this.selectionSet)||void 0===t?void 0:t.geometries)||[]],this._graphics=this.geometries.map((i=>new this.Graphic({geometry:i,symbol:"point"===i.type?this.sketchPointSymbol:"polyline"===i.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=null===(e=this.selectionSet)||void 0===e?void 0:e.label,this._useLayerFeaturesEnabled||await(null===(s=this._drawTools)||void 0===s?void 0:s.updateGraphics()),await o(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}async _initSearchWidget(){if(this.mapView&&this._searchElement){const i=this._getSearchConfig(this.searchConfiguration,this.mapView),t=Object.assign({view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm},i);this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const i=this._searchClearLabel();this._clearResults(!1,i)})),this._searchWidget.on("select-result",(i=>{var t,e;if(i.result){this._searchResult=i.result;const s=(null===(e=null===(t=i.source)||void 0===t?void 0:t.layer)||void 0===e?void 0:e.id)&&i.source.layer.id===this.selectLayerView.layer.id,a=s?[i.result.feature.getObjectId()]:void 0;this._workflowType=y.SEARCH,this._updateLabel();const l=[i.result.feature];this._updateSelection(l,s,a),this._drawTools.graphics=l,this._searchWidget.resultGraphic.visible=!1}else{const i=this._searchClearLabel();this._clearResults(!1,i)}})),await this._searchWidget.when((()=>{var i;this._searchWidget.allPlaceholder=(null===(i=this.searchConfiguration)||void 0===i?void 0:i.allPlaceholder)&&"find address or place"!==this.searchConfiguration.allPlaceholder.toLowerCase()?this.searchConfiguration.allPlaceholder:this._translations.placeholder}))}}_searchClearLabel(){var i;return(null===(i=this._searchResult)||void 0===i?void 0:i.name)&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(i,t){const e=null==i?void 0:i.sources;return(null==e?void 0:e.length)>0?(i.includeDefaultSources=!1,e.forEach((i=>{var e,s;if(i.hasOwnProperty("layer")){const a=i,l=null===(e=a.layer)||void 0===e?void 0:e.id,h=l?t.map.findLayerById(l):null,n=null===(s=null==a?void 0:a.layer)||void 0===s?void 0:s.url;h?a.layer=h:n&&(a.layer=new this.FeatureLayer(n))}})),null==e||e.forEach((i=>{if(i.hasOwnProperty("locator")){const t=i;"ArcGIS World Geocoding Service"===(null==t?void 0:t.name)&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):i=Object.assign(Object.assign({},i),{includeDefaultSources:!0}),i}_initGraphicsLayer(){const i=this._translations.bufferLayer;if(this.mapView){const t=this.mapView.map.layers.findIndex((t=>t.title===i));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:i,listMode:"hide"}),m.managedLayers[i]="buffer";const t=this.mapView.map.layers.findIndex((i=>i.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}}async _sketchGraphicsChanged(i,t=!1){const e=i.detail.graphics;if(e.length>0&&e[0])if(t||(this._sketchGraphic=e[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 i=Array.isArray(e)?e.map((i=>i.geometry)):this.geometries;await this._selectLayerFeatures(i[0])}else{const t=e.reduce(((i,t)=>{var e;return(null===(e=null==t?void 0:t.layer)||void 0===e?void 0:e.objectIdField)?i.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&i.push(t.getObjectId()),i}),[]),s=i.detail.useOIDs&&t.length>0;this._updateSelection(e,s,t),s&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){var i;return(null===(i=this._skipGeomOIDs)||void 0===i?void 0:i.length)>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(i){m.removeHandles(),i.length>0&&m.highlightHandles.push(await r(i,this.selectLayerView,this.mapView)),this._numSelected=i.length,this.selectionSetChange.emit(i.length)}async _selectFeatures(i){this._selectionLoading=!0,this._selectedIds=await d(i,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(i){this._bufferGeometry=Array.isArray(i.detail)?i.detail[0]:i.detail;let t=this._bufferTools.distance,e=0;if(this._bufferGeometry){const i=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(i),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(i.geometry.extent),e=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:e})}_geomQuery(i){const t=c(i,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(i=!0,t=!1){var e;this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName.value=""),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),i&&this._searchWidget&&this._clearSearchWidget(),m.removeHandles(),(null===(e=this._drawTools)||void 0===e?void 0:e.clear)&&(this._graphics=[],await this._drawTools.clear()),this.selectionSetChange.emit(this._selectedIds.length)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(i,t,e){this._selectedIds=t&&e?e:this._selectedIds,this._skipGeomOIDs=t?e:void 0,this.geometries=Array.isArray(i)?i.map((i=>i.geometry)):this.geometries,this._graphics=i}async _updateLabel(){var i,t;const e=this._selectionLabel.indexOf(this._translations.sketch)>-1,s=this._selectionLabel.indexOf(this._translations.select)>-1,a=this._selectionLabel.indexOf(null===(i=this._searchResult)||void 0===i?void 0:i.name)>-1,l=this._workflowType===y.SEARCH?null===(t=this._searchResult)||void 0===t?void 0:t.name:this._workflowType===y.SELECT?this._translations.select:this._translations.sketch,h=this._unit?this._unit:this._bufferTools.unit,n=await this._bufferTools.getTranslatedUnit(h),o=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=e||s||a||!this._selectionLabel?`${l} ${o} ${n}`:this._selectionLabel,this._labelName.value=this._selectionLabel}async _layerSelectionChange(i){if(Array.isArray(i.detail)&&i.detail.length>0){const t=i.detail.map((i=>p(this.mapView,i)));return Promise.all(t).then((i=>{this.layerViews=i,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(i){var t;const e=(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.length)>0?i.detail[0]:"";this.selectLayerView&&e===this.selectLayerView.layer.id||(this.selectLayerView=await p(this.mapView,e),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(i){i.newValue!==i.oldValue&&(this._distance=i.newValue,await this._updateLabel())}async _selectLayerFeatures(i){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],b(0,t.layer,i,this._featuresCollection))));return Promise.all(t).then((async i=>{this._selectionLoading=!1;let t=[];i.forEach((i=>{Object.keys(i).forEach((e=>{t=t.concat(i[e])}))}));let e=!1;t.forEach((i=>{var t;const s=i.geometry;i.symbol="point"===s.type?this.sketchPointSymbol:"polyline"===s.type?this.sketchLineSymbol:"polygon"===s.type?this.sketchPolygonSymbol:void 0,e=(null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.hasOwnProperty("objectIdField"))||i.hasOwnProperty("getObjectId")}));const s=this.layerViews[0].layer.title===this.selectLayerView.layer.title&&e;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:s}},!0)}))}_useLayerFeaturesEnabledChanged(){this._useLayerFeaturesEnabled=!this._useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const i=await n(this.el);this._translations=i[0]}get el(){return a(this)}static get watchers(){return{geometries:["watchGeometriesHandler"],mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};_.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 k=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}}]}),L=class{constructor(t){i(this,t),this.defaultNumLabelsPerPage=void 0,this.disabled=!1,this._translations=void 0}async downloadCSV(i,t,e,s=!0){return w(i,t,!0,e,s)}async downloadPDF(i,t,e=!1,s="",a=""){var l;return S(i,t,null===(l=this._labelInfoElement.selectedOption)||void 0===l?void 0:l.value,e,s,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return e(s,{key:"7474ef13bc67b7c69b0605239748ec9f1816b3be"},e("calcite-select",{key:"2a6d379cb08aef1cafd5f568438f9981cef26962",disabled:this.disabled,label:"",ref:i=>{this._labelInfoElement=i}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[i]=await h(["esri/intl"]);this._intl=i}_getLabelSizeText(i){const t="&lrm;"+i.descriptionPDF.labelWidthDisplay+" x "+i.descriptionPDF.labelHeightDisplay+"&rlm;";return this._translations.pdfLabel.replace("{{n}}",i.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const i=await n(this.el);this._translations=i[0]}_renderOptions(){(k.default||k).sort(((i,t)=>{const e=parseInt(i.descriptionPDF.labelsPerPageDisplay,10),s=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return e<s?-1:e>s?1:0})).forEach(((i,t)=>{const e=document.createElement("calcite-option");e.value=i,e.innerHTML=this._getLabelSizeText(i),this._labelInfoElement.appendChild(e),(this.defaultNumLabelsPerPage?parseInt(i.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(e.selected=!0,this._labelInfoElement.selectedOption=e)}))}get el(){return a(this)}};L.style=":host{display:block}";const P=class{constructor(e){i(this,e),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7),this._addEnabled=!0,this._refineSets=[],this._enabledLayerIds=[],this._featuresCollection={},this.addresseeLayer=void 0,this.enabledLayerIds=[],this.mapView=void 0,this.selectionSets=[],this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._translations=void 0,this._selectionMode=u.ADD,this._refineLayer=void 0}async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){var i,t;return e(s,{key:"abb0520889c7e739ccd0f7ef1cf5371169b09a4f"},e("div",{key:"3772abb5d1f741644edd934e13ce25588714be0d",class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},e("div",{key:"d0205e6127cf2df2eeb6ff9269ee0f64ccb0506b",class:"display-flex"},e("calcite-label",{key:"c6bdf8e921b6d7460198c5ea773c9f29f86dd7a4",class:"font-bold width-full label-margin-0"},e("div",{key:"49969bbbb52f847764cddd748d9ebb01ee261de1",class:"display-flex"},this._translations.inputLayer,e("calcite-icon",{key:"749c671b5b75d91e84f732daa4acb2264ed95f6c",class:"padding-start-1-2 icon",icon:"question",id:"refine-input-layer",scale:"s"})),e("map-layer-picker",{key:"b0d7a600796e8b438db67b8d0dba74066bf3261f",enabledLayerIds:this._enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},ref:i=>{this._layerPicker=i},selectedIds:[this._refineLayer.layer.id],showTables:!1})),e("calcite-popover",{key:"6ed81245f48aa8c1163031625e276a3d708fca73",closable:!0,label:"",referenceElement:"refine-input-layer"},e("span",{key:"00e817a3d1f08b5f61f262eae88859d291444294",class:"tooltip-message"},this._translations.inputLayerTip)))),e("div",{key:"0298fa4e89b539aba1aa602a84f224da905bf4f2",class:"padding-1"},e("div",{key:"385699e47f1304a89b3abfe63f0d612b8b153c54",class:"padding-bottom-1"},e("calcite-segmented-control",{key:"a3d8bc30f9df92a98bd1dad2a4b7fd6221b4ea97",class:"w-100",width:"full"},e("calcite-segmented-control-item",{key:"f45b25ce69039e7de4b416a9498b6ec8cc850c60",checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.ADD),value:u.ADD},e("span",{key:"fcaa2cfc47ef7d46c1bf6080bbed2ab8c1b2a0a1",class:"font-weight-500"},this._translations.add)),e("calcite-segmented-control-item",{key:"3be785a5d23b559021a609ae39950f7937d9b9e4",checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.REMOVE),value:u.REMOVE},e("span",{key:"ee4d85f969762c87e30f07b6d518c4ca088fdbb3",class:"font-weight-500"},this._translations.remove)))),e("div",{key:"a1717a51a57bd216a04c13e9b04baaa5510bf33b"},e("map-draw-tools",{key:"6063f82aea3984aa792e2f89e688eeaf0327ff1e",active:!0,drawMode:v.REFINE,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:i=>this._sketchGraphicsChanged(i),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:(null===(i=this._refineSelectionSet)||void 0===i?void 0:i.redoStack.length)>0,ref:i=>{this._drawTools=i},undoEnabled:(null===(t=this._refineSelectionSet)||void 0===t?void 0:t.undoStack.length)>0})),e("br",{key:"76d977c28df03e57cde309eaaa300a9f013fae2c"}),e("calcite-list",{key:"e596cc82c03ffc277dbbad244de7a985fcfcc40a",class:"list-border"},this._getRefineSelectionSetList())))}_layerSelectionChange(i){this._setRefineSet(i.detail[0])}_setSelectionMode(i){this._selectionMode=i}_sketchGraphicsChanged(i){var t;const e=null===(t=i.detail)||void 0===t?void 0:t.graphics[0].geometry;this._selectFeatures(e)}_getEnabledLayerIds(){return this.selectionSets.reduce(((i,t)=>{var e;const s=null===(e=null==t?void 0:t.layerView)||void 0===e?void 0:e.layer.id;return s&&i.indexOf(s)<0?i.push(s):t.workflowType===y.REFINE&&Object.keys(t.refineInfos).forEach((t=>{i.indexOf(t)<0&&i.push(t)})),i}),[])}async _setRefineSet(i){this.selectionSets.some((t=>{if(t.workflowType===y.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(i)>-1}))||await this._initRefineSet(i,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[i].layerView}async _initRefineSet(i,t){const e={};e[i]={addIds:[],removeIds:[],layerView:await p(this.mapView,i)},t?t.refineInfos=Object.assign(Object.assign({},t.refineInfos),e):(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:e,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const i=this._refineSelectionSet.undoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.redoStack,i.layerView)}_redo(){const i=this._refineSelectionSet.redoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.undoStack,i.layerView)}_getRefineSelectionSetList(){const i=this._getTotal(this.selectionSets);let t;this.selectionSets.some((i=>{if(i.workflowType===y.REFINE)return t=i,!0}));let s=0,a=0;return Object.keys(t.refineInfos).forEach((i=>{s+=t.refineInfos[i].addIds.length,a+=t.refineInfos[i].removeIds.length})),[e("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",s.toString()),"non-interactive":!0}),e("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),e("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",i.toString()),"non-interactive":!0})]}_getTotal(i){const t=g(i);return Object.keys(t).reduce(((i,e)=>i+t[e].ids.length),0)}async _getTranslations(){const i=await n(this.el);this._translations=i[0]}async _selectFeatures(i){var t,e;this.selectionLoadingChange.emit(!0),this._featuresCollection[null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id]=[];const s=await b(0,null===(e=this._refineLayer)||void 0===e?void 0:e.layer,i,this._featuresCollection);this.selectionLoadingChange.emit(!1);let a=[];Object.keys(s).forEach((i=>{var t;i===(null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id)&&(a=a.concat(s[i]))}));const l=Array.isArray(a)?a.map((i=>{var t;return i.attributes[null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.objectIdField]})):[];await this._updateIds(l,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),m.highlightHandles=await f(this.selectionSets)}_clearHighlight(){m.removeHandles()}async _updateIds(i,t,e,s){let a=!1;const l=this._refineSelectionSet.refineInfos,h=s.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:s};const o=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===u.ADD)o.addIds=[...new Set([...i,...o.addIds])],o.addIds.length>0&&e.push({ids:i,mode:t,layerView:s}),o.removeIds.length>0&&(o.removeIds=o.removeIds.filter((t=>i.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,e)=>(i.forEach((i=>{e.workflowType!==y.REFINE?e.selectedIds.indexOf(i)>-1&&t.push(i):Object.keys(e.refineInfos).some((a=>{const l=e.refineInfos[a];if(l.layerView.layer.id===s.layer.id&&l.addIds.indexOf(i)>-1)return t.push(i),!0}))})),t)),[]);o.removeIds=[...new Set([...l,...o.removeIds])],o.addIds=o.addIds.filter((i=>l.indexOf(i)<0)),o.removeIds.length>0&&e.push({ids:l,mode:t,layerView:s}),this.selectionSets=this.selectionSets.reduce(((i,t)=>(t.workflowType!==y.REFINE&&t.layerView.layer.id===s.layer.id?(t.selectedIds=t.selectedIds.filter((i=>o.removeIds.indexOf(i)<0)),t.selectedIds.length>0?i.push(t):a=!0):i.push(t),i)),[])}this._refineSelectionSet.refineInfos[h]=o,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}get el(){return a(this)}};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{_ as map_select_tools,L as pdf_download,P as refine_selection}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as i,h as t,H as s,g as e,c as h}from"./p-6d753a3d.js";import{g as a,l as o}from"./p-896c9644.js";import{q as l,g as n,e as d,f as c,i as r,j as v,c as p}from"./p-583e5dd0.js";import{d as u}from"./p-6f69de4d.js";import"./p-82e085d0.js";import"./p-c1cf3ebc.js";import"./p-334e6394.js";import"./p-a230b270.js";import"./p-530b73ce.js";const b=class{constructor(t){i(this,t),this.isMobile=void 0,this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._cardLoading=!1,this._graphics=void 0,this._translations=void 0}async featureSelectionChange(i){const t=i.detail;this._cardLoading=!0;const s=t.length>0?await l(t,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((i,s)=>t.indexOf(i.getObjectId())-t.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(i){const t=i.detail[0];this.layer=await n(this.mapView,t)}async componentWillLoad(){await this._getTranslations()}render(){var i,e;const h=(null===(i=this._graphics)||void 0===i?void 0:i.length)>0?"":"display-none",a=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return t(s,{key:"343554e5408de156f1973f6d1e3daa8f1ba90675"},t("div",{key:"1852562a795002314236052351cab7c29d36854e",class:"overflow-auto height-full"},t("calcite-shell",{key:"684f013e4397bc50743526357384f782a88a5cd3",class:"position-relative "+h},t("div",{key:"db6d9f4be5448b5596b22f2a4f49c6baefa88466"},t("info-card",{key:"be5cec81cae7ca00a5b57c8d9590541f78b67fbd",graphics:this._graphics,isLoading:this._cardLoading,isMobile:this.isMobile,mapView:this.mapView}))),t("calcite-shell",{key:"df34e0ae6978298130970c60d21203f52fa32e4b",class:"position-relative "+a},t("div",{key:"9525a95dd21745e211ebf888da44eca6a6c17721",class:"padding-1"},t("calcite-notice",{key:"ade0e0a2f09bbe7b7bda6fdb2ce65ba81121e633",icon:"table",open:!0},t("div",{key:"d6fce2d657e23738720e004177c510c3273017f4",slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const i=await a(this.el);this._translations=i[0]}get el(){return e(this)}};b.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}card-manager{display:block}";const f=class{constructor(t){i(this,t),this.featureSelectionChange=h(this,"featureSelectionChange",7),this._ctrlIsPressed=!1,this._defaultFilterHonored=!1,this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._observerSet=!1,this._shiftIsPressed=!1,this._skipOnChange=!1,this.onTableNodeCreate=i=>{this._tableNode=i},this.defaultGlobalId=void 0,this.defaultLayerId=void 0,this.defaultOid=void 0,this.enableAutoRefresh=void 0,this.enableColumnReorder=!0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableShare=void 0,this.isMobile=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.selectedIds=[],this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this.zoomToScale=void 0,this._allIds=[],this._controlsThatFit=void 0,this._csvExporting=!1,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._layer=void 0,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=void 0,this._translations=void 0}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}enableCSVWatchHandler(){var i;(null===(i=this._toolInfos)||void 0===i?void 0:i.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}_controlsThatFitWatchHandler(){var i;const t=this._controlsThatFit?this._controlsThatFit.reduce(((i,t)=>(i.push(t.id),i)),[]):[];this._toolInfos=null===(i=this._toolInfos)||void 0===i?void 0:i.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}isMobileWatchHandler(){this._toolInfos||this.isMobile||this._initToolInfos()}async mapInfoWatchHandler(){this._resetColumnTemplates(),this._initLayerExpressions(),this._initToolInfos(),this._updateToolbar(),await this._sortTable()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression=void 0,this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(i=>{this._mapClicked(i)})))}async _layerWatchHandler(){var i;this._fetchingData=!0,await(null===(i=this._layer)||void 0===i?void 0:i.when((async()=>{var i;this._definitionExpression=this._layer.definitionExpression,this._floorField=null===(i=this._layer.floorInfo)||void 0===i?void 0:i.floorField,this._updateFloorDefinitionExpression(),await this._resetTable(),this._initLayerExpressions(),this._updateShareUrl(),this._fetchingData=!1})))}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1)}async selectionChanged(i){const t=i.detail.selectedFeature[0],s=t.getObjectId(),e=this._table;if(e.rowHighlightIds.length&&e.rowHighlightIds.removeAll(),e.rowHighlightIds.add(s),this.zoomAndScrollToSelected){const i=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(i);const e=t.layer;let h;this.mapView.allLayerViews.toArray().some((i=>{if(i.layer.title===e.title&&"feature"===i.layer.type)return h=i,!0})),h&&await d([s],h,this.mapView,!0,void 0,this.zoomToScale)}}async editsComplete(i){const t=i.detail;"delete"!==t&&"add"!==t||(this._allIds=await c(this._layer)),await this._refresh()}async facilityChanged(i){this._floorFacility=i.detail,this._updateFloorDefinitionExpression()}async levelChanged(i){this._floorLevel=i.detail,this._updateFloorDefinitionExpression()}async siteChanged(i){this._floorSite=i.detail,this._updateFloorDefinitionExpression()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._onResize())))}render(){const i=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",h=this._allIds.length.toString(),a=this.selectedIds.length.toString(),o=this.isMobile?"height-full":"height-full-adjusted";return this._validateActiveActions(),t(s,{key:"c0451b25b6253fc017f59f471ced6347a618bdcf"},t("calcite-shell",{key:"b71245a1b347aae2e06ccccd750875d9c0571b1b"},this._getTableControlRow("header"),t("div",{key:"a4c9e51f2cfa9e90bd1b67e8d542e93896321037",class:`width-full ${o}`},t("calcite-panel",{key:"e50e3a4165c02c56f99897fa29f079b2ef1e02ff",class:"height-full width-full"},t("calcite-loader",{key:"ad263eb3ac8558d6cd0777f993f663ddd0f7fbe6",class:e,label:this._translations.fetchingData,scale:"l"}),t("div",{key:"2bcbdf8197b4bcc5102d408538dab17acd803ae9",class:i,ref:this.onTableNodeCreate})),this.isMobile?void 0:t("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",h).replace("{{selected}}",a)))),this._filterModal())}async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0),document.onclick=i=>this._handleDocumentClick(i),document.onkeydown=i=>this._handleKeyDown(i),document.onkeyup=i=>this._handleKeyUp(i)}componentDidRender(){this._updateToolbar()}async _initModules(){const[i,t,s]=await o(["esri/widgets/FeatureTable","esri/core/reactiveUtils","esri/widgets/FeatureTable/support/TableTemplate"]);this.FeatureTable=i,this.reactiveUtils=t,this.TableTemplate=s}_onResize(){this._updateToolbar()}_getTableControlRow(i){return t("div",{class:"display-flex border-bottom height-51",ref:i=>this._toolbar=i,slot:i},this._getActionBar(),this.isMobile?void 0:this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile?this._getShare("share"):void 0)}_getActionBar(){const i=this.isMobile?"width-full":"",s=this.isMobile?"border-top":"";return t("calcite-action-bar",{class:i,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},t("div",{class:`border-end ${i} ${s}`,id:"solutions-map-layer-picker-container"},t("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChanged(i)},onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showSingleLayerAsLabel:!0,showTables:!0,type:"dropdown"})),this.isMobile?void 0:this._getActions())}_getActions(){const i=this._getActionItems();return null==i?void 0:i.reduce(((i,s)=>(s&&!s.isOverflow&&i.push(s.isDanger?this._getDangerAction(s.icon,s.label,s.func,s.disabled):s.isSublist?t("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(s.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._showHideDropdown=i},this._getAction(s.active,this._showHideOpen?"chevron-down":s.icon,s.indicator,s.label,s.func,s.disabled,s.loading,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(s.active,s.icon,s.indicator,s.label,s.func,s.disabled,s.loading)),i)),[])}_getFieldlist(){return this._columnsInfo?t("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((i=>t("calcite-dropdown-item",{id:i,onClick:i=>{const t=i.target;this._columnsInfo[t.id]=t.selected,t.selected?this._table.showColumn(t.id):this._table.hideColumn(t.id)},selected:this._columnsInfo[i]},i)))):void 0}_validateEnabledActions(){var i;const t=this._featuresSelected(),s=["zoom-to-object","trash","erase","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&s.indexOf(i.icon)>-1&&(i.disabled=!t)}))}_validateActiveActions(){var i;const t=["filter","list-check-all","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&t.indexOf(i.icon)>-1&&("filter"===i.icon&&(i.indicator=this._filterActive),"list-check-all"===i.icon&&(i.active=this._selectAllActive),"selected-items-filter"===i.icon&&(i.active=this._showOnlySelected))}))}_initToolInfos(){const i=this._featuresSelected(),t=this._featuresEmpty(),s=this._hasFilterExpressions();this._translations&&(this._toolInfos=[{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1},s?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this._toggleFilter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{active:void 0,icon:"trash",indicator:void 0,label:void 0,func:void 0,disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{active:!1,icon:"list-check-all",indicator:!1,func:()=>this._selectAll(),label:this._translations.selectAll,disabled:t,isOverflow:!1},{active:!1,icon:"compare",indicator:!1,func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:t,isOverflow:!1},{active:!1,icon:"refresh",indicator:!1,func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:t,isOverflow:!1}:void 0,{active:!1,icon:this._showHideOpen?"chevron-down":"chevron-right",indicator:!1,func:()=>this._toggleShowHide(),label:this._translations.showHideColumns,disabled:!1,isOverflow:!1,isSublist:!0}],this._defaultVisibleToolSizeInfos=void 0)}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){const i=`${this._floorField} = '${this._floorLevel}'`,t=this._layer.definitionExpression;this._layer.definitionExpression=(null==t?void 0:t.indexOf(this._floorExpression))>-1?t.replace(this._floorExpression,i):t?`${t} AND (${i})`:i,this._floorExpression=i}}_featuresSelected(){return this.selectedIds.length>0}_featuresEmpty(){return 0===this._allIds.length}_hasFilterExpressions(){var i,t,s;let e;return(null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions)&&(null===(s=this._layer)||void 0===s?void 0:s.id)&&(e=this.mapInfo.filterConfig.layerExpressions.filter((i=>i.id===this._layer.id))),(null==e?void 0:e.length)>0}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const i=this._toolbar.offsetWidth;let t=this._toolbarSizeInfos.reduce(((i,t)=>i+t.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(t>i){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(t>i?t-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((i,t)=>(i.push(t.id),i)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||t+o.width<=i)?(e.indexOf(o.id)<0&&(t+=o.width),a.push(o)):s.indexOf(o.id)<0&&t+o.width>i&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),250))}_setControlsThatFit(i,t){let s=JSON.stringify(i)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((i=>{t.indexOf(i.id)<0&&!s&&(s=this._controlsThatFit.map((i=>i.id)).indexOf(i.id)<0)})),s&&(this._controlsThatFit=[...i])}_setToolbarSizeInfos(){let i=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((t,s)=>{0===s?t.childNodes.forEach((t=>{this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0)})):t.referenceElement||(this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0))})),i&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&!i.isOverflow))}_getDropdown(i){const s=this._getDropdownItems();return s.length>0?t("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._moreDropdown=i},t("calcite-action",{appearance:"solid",id:i,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},t("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),t("calcite-dropdown-group",{"selection-mode":"none"},s.map((i=>t("calcite-dropdown-group",{class:i.disabled?"disabled":"",selectionMode:i.disabled?"none":"single"},t("calcite-dropdown-item",{disabled:i.loading,iconStart:i.isSublist&&this._showHideOpen?"chevron-down":i.loading?"":i.icon,id:"solutions-subset-list",onClick:i.func},i.loading?t("div",{class:"display-flex"},t("calcite-loader",{inline:!0,label:i.label,scale:"m"}),i.label):i.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&i.isOverflow))}_getAction(i,s,e,h,a,o,l,n){const d=void 0===this._layer||o;return t("div",{class:"display-flex",id:this._getId(s),slot:n},t("calcite-action",{active:i,appearance:"solid",disabled:d,icon:s,id:s,indicator:e,label:h,loading:l,onClick:a,text:h,textEnabled:!0}),this._getToolTip("bottom",s,h))}_getShare(i){return t("div",{class:"share-action",id:this._getId(i)},t("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:i=>this._shareNode=i,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",i,this._translations.share))}_updateShareUrl(){var i,t,s,e;const h=null===(i=this._shareNode)||void 0===i?void 0:i.shareUrl;if(!h)return;const a=new URL(h);(null===(t=this.mapInfo)||void 0===t?void 0:t.id)?a.searchParams.set("webmap",this.mapInfo.id):a.searchParams.delete("webmap"),(null===(s=this._layer)||void 0===s?void 0:s.id)?a.searchParams.set("layer",this._layer.id):a.searchParams.delete("layer"),(null===(e=this.selectedIds)||void 0===e?void 0:e.length)>0?a.searchParams.set("oid",this.selectedIds.join(",")):a.searchParams.delete("oid"),this._shareNode.shareUrl=a.href}_getToolTip(i,s,e){return document.getElementById(s)?t("calcite-tooltip",{placement:i,"reference-element":s},t("span",null,e)):void 0}_getId(i){return`solutions-action-${i}`}_getDangerAction(i,s,e,h){const a=void 0===this._layer||h;return t("div",{class:"display-flex",id:this._getId(i)},"trash"===i?t("delete-button",{buttonType:"action",class:"display-flex",disabled:a,icon:i,ids:this._getIds(),layer:this._layer}):t("calcite-action",{appearance:"solid",disabled:a,id:i,onClick:e,text:""},t("calcite-button",{appearance:"transparent",iconStart:i,kind:"danger"},s)),this._getToolTip("bottom",i,s))}_getIds(){return this._table.highlightIds.toArray()}async _getTable(i,t){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:t},container:i})})),await this._table.when((()=>{this._table.highlightIds.on("change",(i=>{this._handleOnChange(i)}))})))}async _handleOnChange(i){const t=[...this._table.highlightIds.toArray()];if(this._skipOnChange)this._skipOnChange=!1;else{if(this._ctrlIsPressed||this._shiftIsPressed){if(this._ctrlIsPressed)this.selectedIds=t.reverse();else if(this._shiftIsPressed&&(this._skipOnChange=!0,this._previousCurrentId=this._currentId,this._currentId=[...this._table.highlightIds.toArray()].reverse()[0],this._previousCurrentId!==this._currentId)){const i=this._table.activeSortOrders.reduce(((i,t)=>(i.push(`${t.fieldName} ${t.direction}`),i)),[]),s=await r(this._layer,this._layer.definitionExpression,i);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),a=this._table.viewModel.getObjectIdIndex(this._currentId),o=h<a?h:a,l=a>h?a:h;this._skipOnChange=o+1!==l;const n=s.reduce(((i,t)=>{const s=t,h=this._table.viewModel.getObjectIdIndex(s);return s!==this._currentId&&s!==this._previousCurrentId||(e=!e,i.indexOf(s)<0&&i.push(s)),e&&i.indexOf(s)<0&&i.push(s),(this.selectedIds.indexOf(s)>-1||h>=o&&h<=l)&&i.indexOf(s)<0&&h>-1&&i.push(s),i}),[]);this.selectedIds=h<a?n.reverse():n,this._table.highlightIds.addMany(this.selectedIds.filter((i=>t.indexOf(i)<0)))}}else if(this.selectedIds.length>0){this._skipOnChange=!0;const s=this.selectedIds.length>1&&1===i.removed.length?i.removed:t.filter((i=>this.selectedIds.indexOf(i)<0));this._clearSelection(),this.selectedIds=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this.selectedIds=t.reverse();this._finishOnChange()}this._currentId=[...this._table.highlightIds.toArray()].reverse()[0]}_finishOnChange(){this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this.selectedIds)}_resetColumnTemplates(){var i,t;const s=this._getColumnTemplates(null===(i=this._layer)||void 0===i?void 0:i.id,null===(t=this._layer)||void 0===t?void 0:t.fields),e=null==s?void 0:s.some(((i,t)=>{var s;return JSON.stringify(null===(s=this._table)||void 0===s?void 0:s.tableTemplate.columnTemplates[t])!==JSON.stringify(i)}));if(this._table&&s&&(e||!this._columnsInfo)){this._table.tableTemplate=new this.TableTemplate({columnTemplates:s});const i=s.map((i=>i.fieldName));this._initColumnsInfo(i)}}async _resetTable(){var i;if(this._clearSelection(),this._allIds=await c(this._layer),this._table)this._table.view=this.mapView,this._table.layer=this._layer;else{const t=this._getColumnTemplates(this._layer.id,null===(i=this._layer)||void 0===i?void 0:i.fields);await this._getTable(this._tableNode,t)}await this._initLayerRefresh(),this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,await this.reactiveUtils.once((()=>"loaded"===this._table.state)).then((async()=>{this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),this._initToolInfos(),this._updateToolbar()}))}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._refreshHandle=this._layer.on("refresh",(i=>{i.dataChanged&&(this._skipOnChange=!0,this._updateAllIds())}))}async _updateAllIds(){this._allIds=await c(this._layer),this.selectedIds=this.selectedIds.filter((i=>this._allIds.indexOf(i)>-1)),await this._refresh()}async _handleDefaults(){var i,t;if(!this._defaultOidHonored&&(null===(i=this.defaultOid)||void 0===i?void 0:i.length)>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=void 0,this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&(null===(t=this.defaultGlobalId)||void 0===t?void 0:t.length)>0&&this._table){const i=await v(this.defaultGlobalId,this._layer),t=(null==i?void 0:i.length)>0?i.map((i=>i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=void 0,this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(i){var t,s;const e=null===(t=this._table)||void 0===t?void 0:t.columns.reduce(((t,s)=>((!i||(null==i?void 0:i.indexOf(s.name))>-1)&&(t[s.name]=!s.hidden),t)),{}),h=null===(s=this._table)||void 0===s?void 0:s.columns.map((i=>i.name));(i?i.filter((i=>h.indexOf(i)<0)):[]).forEach((i=>{e[i]=!0})),this._columnsInfo=i?i.reduce(((i,t)=>(i[t]=e[t],i)),{}):e}async _selectDefaultFeature(i){i.length>0&&this._table.highlightIds.addMany(i)}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){var i,t,s,e,h;let a,o=null===(i=this._layer)||void 0===i?void 0:i.objectIdField,l="desc";(null===(e=null===(s=null===(t=this.mapInfo)||void 0===t?void 0:t.layerOptions)||void 0===s?void 0:s.layers)||void 0===e?void 0:e.length)>0&&(a=this.mapInfo.layerOptions.layers.filter((i=>i.id===this._layer.id)),a&&a.length>0&&(a=a[0],a.sortField&&(null===(h=a.fields)||void 0===h?void 0:h.includes(a.sortField))&&(o=a.sortField),l=(null==a?void 0:a.sortOrder)?a.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(o,l)})))}_forceShowHide(){this._showHideDropdown&&(this._showHideDropdown.open=this._showHideOpen),this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_closeShowHide(){this._showHideOpen=!1}_handleDocumentClick(i){var t;const s=null===(t=i.target)||void 0===t?void 0:t.id;this._showHideOpen&&Object.keys(this._columnsInfo).indexOf(s)<0&&"solutions-subset-list"!==s&&"chevron-right"!==s&&(this._closeShowHide(),this._moreDropdown&&(this._moreDropdown.open=!1),this._showHideDropdown&&(this._showHideDropdown.open=!1))}_handleKeyDown(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_handleKeyUp(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_filterModal(){var i,s,e;return t("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},t("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},null===(s=null===(i=this._translations)||void 0===i?void 0:i.filter)||void 0===s?void 0:s.replace("{{title}}",null===(e=this._layer)||void 0===e?void 0:e.title)),t("div",{slot:"content"},t("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",layerExpressions:this._layerExpressions,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:i=>this._filterList=i,view:this.mapView,zoomBtn:!1})))}_handleFilterListReset(){this._filterActive=!1,this._updateShareUrl()}_handleFilterUpdate(){const i=this._layer.definitionExpression;if(this._floorExpression){const t=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=i&&this._floorField&&i.indexOf(`${this._floorField} = '`)>-1?i.replace(t,this._floorExpression):i?`${i} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=this._definitionExpression!==this._layer.definitionExpression&&(!this._floorExpression||this._layer.definitionExpression!==this._floorExpression),this._updateShareUrl()}async _closeFilter(){this._filterOpen&&(this._allIds=await c(this._layer),this._filterOpen=!1)}async _mapClicked(i){const t={include:this._layer},s=await this.mapView.hitTest(i.screenPoint,t);s.results.length>0?(s.results.forEach((i=>{const t=i.graphic.getObjectId();this._table.highlightIds.indexOf(t)<0&&this._table.highlightIds.add(t)})),this._showOnlySelected&&this._table.filterBySelection()):this._clearSelection()}_selectAll(){const i=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(i),this.selectedIds=i,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var i;this.selectedIds=[],null===(i=this._table)||void 0===i||i.highlightIds.removeAll(),this._finishOnChange()}_toggleFilter(){this._filterOpen=!this._filterOpen}_initLayerExpressions(){var i,t;const s=null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions;this._layerExpressions=s?s.filter((i=>{var t;return i.id===(null===(t=this._layer)||void 0===t?void 0:t.id)})):[],this._filterList.layerExpressions=this._layerExpressions,this._filterActive=this._layerExpressions.filter((i=>i.expressions.filter((i=>i.active)).length>0)).length>0}_switchSelected(){const i=[...this.selectedIds];this._table.highlightIds.removeAll();const t=this._allIds.reduce(((t,s)=>(i.indexOf(s)<0&&t.push(s),t)),[]).sort(((i,t)=>i-t));this._skipOnChange=!0,this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()}async _exportToCSV(){const i={},t=this._table.highlightIds.toArray();i[this._layer.id]={selectionSetNames:[this._layer.title],ids:t,layer:this._layer};const s=this._table.columns.toArray().reduce(((i,t)=>(t.hidden||i.push(t.name.toLocaleLowerCase()),i)),[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,await u(null,i,!1,!1,!0,s,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}_updateToolInfoLoading(i,t){this._toolInfos.some((s=>{if((null==s?void 0:s.icon)===i)return s.loading=t,!0}))}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this.selectedIds)}async _zoom(){if(this._layer){const i=await p(this.mapView,this._layer.id);await d(this.selectedIds,i,this.mapView,!0,void 0,this.zoomToScale)}}async _layerSelectionChanged(i){var t;const s=i.detail[0];if(s!==(null===(t=this._layer)||void 0===t?void 0:t.id)||this._featuresEmpty()){this._fetchingData=!0;const i=await n(this.mapView,s);await i.when((()=>{this._layer=i}))}this._fetchingData=!1}_getColumnTemplates(i,t){var s,e;let h;null===(e=null===(s=this.mapInfo)||void 0===s?void 0:s.layerOptions)||void 0===e||e.layers.some((t=>{if(t.id===i)return h=t,!0}));const a=(null==h?void 0:h.fields)&&(null==h?void 0:h.fieldOrder)?h.fieldOrder.filter((i=>h.fields.indexOf(i)>-1)):void 0;let o;return t&&(o=h&&(null==h?void 0:h.fields)?t.reduce(((i,t)=>{if(h.fields.indexOf(t.name)>-1){const s={type:"field",fieldName:t.name,label:t.alias,menuConfig:this._getMenuConfig(t.name)};i.push(s)}return i}),[]).sort(this._sortFields.bind(this,null==h?void 0:h.fieldOrder)):t.map((i=>({type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)})))),a?null==o?void 0:o.sort(this._sortFields.bind(this,a)):o}_sortFields(i,t,s){return(null==i?void 0:i.indexOf(t.fieldName))-i.indexOf(s.fieldName)}_getMenuConfig(i){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(i)}}]}}_handleHideClick(i){this._columnsInfo[i]=!1,this._table.hideColumn(i),this._table.tableTemplate.columnTemplates.forEach((t=>{t.fieldName===i&&(t.visible=!1)}))}async _getTranslations(){const i=await a(this.el);this._translations=i[0]}get el(){return e(this)}static get watchers(){return{defaultOid:["defaultOidWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],enableShare:["enableShareWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],selectedIds:["selectedIdsWatchHandler"]}}};f.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-background)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{font-size:14px !important;color:var(--calcite-color-text-3) !important}.share-action{position:absolute;right:0}html[dir="rtl"] .share-action{left:0}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.instant-app-share{height:50px !important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-modal-content-padding:0}.esri-feature-table__table-container{height:100%}';const m=class{constructor(t){i(this,t),this.mapChanged=h(this,"mapChanged",7),this.beforeMapChanged=h(this,"beforeMapChanged",7),this._defaultWebmapHonored=!1,this._loadedId="",this.appProxies=void 0,this.defaultWebmapId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSingleExpand=!0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.homeZoomIndex=3,this.homeZoomPosition="top-left",this.homeZoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.mapView=void 0,this.stackTools=!0,this.theme=void 0,this.toolOrder=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(i){await this._loadMap(i.detail)}async componentWillLoad(){await this._initModules()}render(){var i,e;const h=this.hidden?"visibility-hidden-1":"",a="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",o=(null===(i=this.mapInfos)||void 0===i?void 0:i.length)>1?"":"display-none",l=(null===(e=this.mapInfos)||void 0===e?void 0:e.length)>1?"map-height":"height-full";return t(s,{key:"4f5c0cd408f92856ceb2ba281a02856064ef6a5a"},t("map-picker",{key:"f69742384dc5ba13bbf257592cc8c35de77590f0",class:o,mapInfos:this.mapInfos,ref:i=>this._mapPicker=i}),t("div",{key:"3ddddf3f674d49ae59fe627af1c67ec59718c9a3",class:`${l} ${h}`,ref:i=>this._mapDiv=i}),t("map-tools",{key:"6cb9518e74af0594ab6b657f0caec3598c250cb2",basemapConfig:this.basemapConfig,class:`box-shadow ${a}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableSingleExpand:this.enableSingleExpand,homeZoomToolsSize:this.homeZoomToolsSize,mapView:this.mapView,mapWidgetsSize:this.mapWidgetsSize,position:this.mapWidgetsPosition,ref:i=>this._mapTools=i,searchConfiguration:this._searchConfiguration,stackTools:this.stackTools,toolOrder:this.toolOrder}))}async _initModules(){const[i,t,s,e]=await o(["esri/WebMap","esri/views/MapView","esri/widgets/Home","esri/config"]);this.WebMap=i,this.MapView=t,this.Home=s,this.esriConfig=e}async _loadMap(i){var t;const s=!this._defaultWebmapHonored&&this.defaultWebmapId,e=null===(t=this.mapInfos)||void 0===t?void 0:t.filter((i=>i.id===this.defaultWebmapId)),h=JSON.stringify(i)!==JSON.stringify(this._webMapInfo);this._webMapInfo=s&&e?e[0]:!(null==i?void 0:i.id)&&this.mapInfos.length>0?this.mapInfos[0]:i;const a=this._webMapInfo.id,o=s&&(null==i?void 0:i.id)===this.defaultWebmapId;if(this._loadedId!==a&&!s||o){const i=new this.WebMap({portalItem:{id:a}});this.appProxies&&(await i.load(),await(l=i,n=this.esriConfig,d=this.appProxies,d&&d.forEach((i=>{l.allLayers.forEach((t=>{t&&t.url===i.sourceUrl&&(t.url=i.proxyUrl,t.portalItem&&t.portalItem.when((()=>{t.portalItem.url=i.proxyUrl})),n.request?.interceptors?.push({urls:i.sourceUrl,before:t=>{t.url&&t.url===i.sourceUrl&&(t.url=i.proxyUrl)}}))}))})),l)),this.mapView=new this.MapView({container:this._mapDiv,map:i,resizeAlign:"center"}),this._loadedId=a,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=!!o||this._defaultWebmapHonored,this.mapChanged.emit({id:a,mapView:this.mapView})}))}else s?(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(a)):h&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:a,mapView:this.mapView}));var l,n,d}_initHome(){if(this.enableHome){this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:this.homeZoomPosition,index:this.homeZoomIndex});const i="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";this._homeWidget.domNode.style.height=i,this._homeWidget.domNode.style.width=i}else this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};m.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.height-full{height:100%}.box-shadow{box-shadow:none !important}.visibility-hidden-1{visibility:hidden;height:1px;}.display-none{display:none}";export{b as card_manager,f as layer_table,m as map_card}