@esri/solutions-components 0.6.37 → 0.6.38
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/card-manager_3.cjs.entry.js +4 -3
- package/dist/cjs/{downloadUtils-37d9aaf3.js → downloadUtils-d8e48fbd.js} +55 -12
- package/dist/cjs/{index.es-d1d9b140.js → index.es-6159eedc.js} +4 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -3
- package/dist/cjs/{mapViewUtils-96172223.js → mapViewUtils-f7bbc35b.js} +5 -2
- package/dist/cjs/public-notification.cjs.entry.js +5 -4
- package/dist/cjs/{clean-url-d5326abb.js → restHelpersGet-c94617cf.js} +398 -0
- package/dist/cjs/solution-configuration.cjs.entry.js +565 -565
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-714601a2.js → solution-store-b40c2f46.js} +19 -383
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +6 -5
- package/dist/collection/utils/downloadUtils.js +50 -8
- package/dist/collection/utils/downloadUtils.ts +62 -9
- package/dist/collection/utils/queryUtils.js +5 -2
- package/dist/collection/utils/queryUtils.ts +4 -2
- package/dist/components/downloadUtils.js +51 -8
- package/dist/components/public-notification.js +2 -2
- package/dist/components/queryUtils.js +5 -2
- package/dist/components/{clean-url.js → restHelpersGet.js} +392 -1
- package/dist/components/solution-configuration.js +552 -552
- package/dist/components/solution-store.js +2 -365
- package/dist/esm/calcite-alert_3.entry.js +1 -1
- package/dist/esm/calcite-combobox_6.entry.js +1 -1
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/card-manager_3.entry.js +4 -3
- package/dist/esm/{downloadUtils-76379e4a.js → downloadUtils-d41ecba9.js} +53 -10
- package/dist/esm/{index.es-0d134a52.js → index.es-b226bf47.js} +4 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +4 -3
- package/dist/esm/{mapViewUtils-08f6cfce.js → mapViewUtils-1e2befd7.js} +5 -2
- package/dist/esm/public-notification.entry.js +5 -4
- package/dist/esm/{clean-url-bce022e6.js → restHelpersGet-a5ec2192.js} +392 -1
- package/dist/esm/solution-configuration.entry.js +552 -552
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-3ee6c7a3.js → solution-store-17bb0a75.js} +2 -365
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/{p-9800e602.entry.js → p-091120c5.entry.js} +1 -1
- package/dist/solutions-components/p-1b14b687.entry.js +6 -0
- package/dist/solutions-components/p-20e627ed.entry.js +6 -0
- package/dist/solutions-components/{p-646e983f.entry.js → p-2d143359.entry.js} +1 -1
- package/dist/solutions-components/{p-ac7332b3.entry.js → p-40e95e2b.entry.js} +1 -1
- package/dist/solutions-components/p-420e1585.entry.js +36 -0
- package/dist/solutions-components/p-4807b2a1.js +36 -0
- package/dist/solutions-components/p-56a3b81e.entry.js +6 -0
- package/dist/solutions-components/p-5856dc4f.js +66 -0
- package/dist/solutions-components/p-89b4b401.js +145 -0
- package/dist/solutions-components/{p-4ecad91c.entry.js → p-973625f8.entry.js} +1 -1
- package/dist/solutions-components/{p-03130804.js → p-9ecb5d66.js} +1 -1
- package/dist/solutions-components/{p-b02eb8f4.js → p-a8661f1f.js} +30 -30
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +62 -9
- package/dist/solutions-components/utils/queryUtils.ts +4 -2
- package/dist/types/components/public-notification/public-notification.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/solutions-components/p-13b21d19.entry.js +0 -36
- package/dist/solutions-components/p-15070568.js +0 -36
- package/dist/solutions-components/p-81a0c88f.entry.js +0 -6
- package/dist/solutions-components/p-b7804687.entry.js +0 -6
- package/dist/solutions-components/p-d0544f24.js +0 -192
- package/dist/solutions-components/p-eba875d9.entry.js +0 -6
- package/dist/solutions-components/p-ecc95259.js +0 -20
@@ -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 s,H as e,g as a}from"./p-91c78d98.js";import{l}from"./p-05948b48.js";import{g as h,h as n,c as o,d as r,e as d,f as c,i as p,j as g}from"./p-15070568.js";import{c as b,e as u,f as v}from"./p-2a58e378.js";import{s as y}from"./p-375fd36b.js";import{a as m,g as w}from"./p-99d8a839.js";import{d as f,a as S}from"./p-b02eb8f4.js";import"./p-482534a7.js";import"./p-e1a4994d.js";import"./p-ecc95259.js";const _=class{constructor(s){i(this,s),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 watchSearchConfigurationHandler(i,t){JSON.stringify(i)!==JSON.stringify(t)&&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(),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this._translations.placeholder,this._searchWidget.defaultSources.forEach((i=>{i.placeholder=this._translations.placeholder}))}))}render(){return s(e,null,this._getMapLayerPicker(),s("div",{class:"border-bottom"}),s("div",{class:"padding-top-sides-1"},s("div",{class:"search-widget",ref:i=>{this._searchElement=i}}),s("div",{class:"padding-top-1"},s("map-draw-tools",{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()),s("div",{class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){var i,t;const e=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 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",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: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 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",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:i+" padding-top-1"},s("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=m(this.el),t=i&&"en"===i?`${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:i=>{this._labelName=i},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,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,s,e,a]=await l(["esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this.GraphicsLayer=i,this.Graphic=t,this.Search=s,this._geometryEngine=e,this.FeatureLayer=a}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),this._initSearchWidget()}async _initSelectionSet(){var i,t,s,e;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===(s=this.selectionSet)||void 0===s?void 0:s.label,this._useLayerFeaturesEnabled||null===(e=this._drawTools)||void 0===e||e.updateGraphics(),await h(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}_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,s;if(i.result){this._searchResult=i.result;const e=(null===(s=null===(t=i.source)||void 0===t?void 0:t.layer)||void 0===s?void 0:s.id)&&i.source.layer.id===this.selectLayerView.layer.id,a=e?[i.result.feature.getObjectId()]:void 0;this._workflowType=b.SEARCH,this._updateLabel();const l=[i.result.feature];this._updateSelection(l,e,a),this._drawTools.graphics=l,this._searchWidget.resultGraphic.visible=!1}else{const i=this._searchClearLabel();this._clearResults(!1,i)}}))}}_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 s=null==i?void 0:i.sources;return(null==s?void 0:s.length)>0?(i.includeDefaultSources=!1,s.forEach((i=>{var s,e;if(i.hasOwnProperty("layer")){const a=i,l=null===(s=a.layer)||void 0===s?void 0:s.id,h=l?t.map.findLayerById(l):null,n=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;h?a.layer=h:n&&(a.layer=new this.FeatureLayer(n))}})),null==s||s.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,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"}),y.managedLayers.push(i);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 s=i.detail.graphics;if(s.length>0&&s[0])if(t||(this._sketchGraphic=s[0]),this._workflowType=this._useLayerFeaturesEnabled?b.SELECT:b.SKETCH,this._workflowType===b.SKETCH&&this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this._useLayerFeaturesEnabled&&!t){const i=Array.isArray(s)?s.map((i=>i.geometry)):this.geometries;await this._selectLayerFeatures(i[0])}else{const t=s.reduce(((i,t)=>{var s;return(null===(s=null==t?void 0:t.layer)||void 0===s?void 0:s.objectIdField)?i.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&i.push(t.getObjectId()),i}),[]),e=i.detail.useOIDs&&t.length>0;this._updateSelection(s,e,t),e&&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){y.removeHandles(),i.length>0&&y.highlightHandles.push(await n(i,this.selectLayerView,this.mapView)),this._numSelected=i.length,this.selectionSetChange.emit(i.length)}async _selectFeatures(i){this._selectionLoading=!0,this._selectedIds=await o(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,s=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),s=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:s})}_geomQuery(i){const t=r(i,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(i=!0,t=!1){var s;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(),y.removeHandles(),(null===(s=this._drawTools)||void 0===s?void 0:s.clear)&&(this._graphics=[],await this._drawTools.clear()),this.selectionSetChange.emit(this._selectedIds.length)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(i,t,s){this._selectedIds=t&&s?s:this._selectedIds,this._skipGeomOIDs=t?s:void 0,this.geometries=Array.isArray(i)?i.map((i=>i.geometry)):this.geometries,this._graphics=i}async _updateLabel(){var i,t;const s=this._selectionLabel.indexOf(this._translations.sketch)>-1,e=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===b.SEARCH?null===(t=this._searchResult)||void 0===t?void 0:t.name:this._workflowType===b.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=s||e||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=>d(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 s=(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.length)>0?i.detail[0]:"";this.selectLayerView&&s===this.selectLayerView.layer.id||(this.selectLayerView=await d(this.mapView,s),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]=[],c(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((s=>{t=t.concat(i[s])}))}));let s=!1;t.forEach((i=>{var t;const e=i.geometry;i.symbol="point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:"polygon"===e.type?this.sketchPolygonSymbol:void 0,s=(null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.hasOwnProperty("objectIdField"))||i.hasOwnProperty("getObjectId")}));const e=this.layerViews[0].layer.title===this.selectLayerView.layer.title&&s;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:e}},!0)}))}_useLayerFeaturesEnabledChanged(){this._useLayerFeaturesEnabled=!this._useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}get el(){return a(this)}static get watchers(){return{geometries:["watchGeometriesHandler"],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-ui-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-ui-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-ui-icon-color:var(--calcite-ui-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-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}}]}),P=class{constructor(t){i(this,t),this.defaultNumLabelsPerPage=void 0,this.disabled=!1,this._translations=void 0}async downloadCSV(i,t,s,e=!0){return f(i,t,!0,s,e)}async downloadPDF(i,t,s=!1,e="",a=""){var l;return S(i,t,null===(l=this._labelInfoElement.selectedOption)||void 0===l?void 0:l.value,s,e,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(e,null,s("calcite-select",{disabled:this.disabled,label:"",ref:i=>{this._labelInfoElement=i}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[i]=await l(["esri/intl"]);this._intl=i}_getLabelSizeText(i){const t="‎"+i.descriptionPDF.labelWidthDisplay+" x "+i.descriptionPDF.labelHeightDisplay+"‏";return this._translations.pdfLabel.replace("{{n}}",i.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}_renderOptions(){(L.default||L).sort(((i,t)=>{const s=parseInt(i.descriptionPDF.labelsPerPageDisplay,10),e=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return s<e?-1:s>e?1:0})).forEach(((i,t)=>{const s=document.createElement("calcite-option");s.value=i,s.innerHTML=this._getLabelSizeText(i),this._labelInfoElement.appendChild(s),(this.defaultNumLabelsPerPage?parseInt(i.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(s.selected=!0,this._labelInfoElement.selectedOption=s)}))}get el(){return a(this)}};P.style=":host{display:block}";const x=class{constructor(s){i(this,s),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 s(e,null,s("div",{class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{class:"display-flex"},s("calcite-label",{class:"font-bold width-full label-margin-0"},s("div",{class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{enabledLayerIds:this._enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},ref:i=>{this._layerPicker=i},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{class:"padding-1"},s("div",{class:"padding-bottom-1"},s("calcite-segmented-control",{class:"w-100"},s("calcite-segmented-control-item",{checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.ADD),value:u.ADD},s("span",{class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.REMOVE),value:u.REMOVE},s("span",{class:"font-weight-500"},this._translations.remove)))),s("div",null,s("map-draw-tools",{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})),s("br",null),s("calcite-list",{class:"list-border"},this._getRefineSelectionSetList())))}_layerSelectionChange(i){this._setRefineSet(i.detail[0])}_setSelectionMode(i){this._selectionMode=i}_sketchGraphicsChanged(i){var t;const s=null===(t=i.detail)||void 0===t?void 0:t.graphics[0].geometry;this._selectFeatures(s)}_getEnabledLayerIds(){return this.selectionSets.reduce(((i,t)=>{var s;const e=null===(s=null==t?void 0:t.layerView)||void 0===s?void 0:s.layer.id;return e&&i.indexOf(e)<0?i.push(e):t.workflowType===b.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===b.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 s={};s[i]={addIds:[],removeIds:[],layerView:await d(this.mapView,i)},t?t.refineInfos=Object.assign(Object.assign({},t.refineInfos),s):(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:b.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:s,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===b.REFINE)return t=i,!0}));let e=0,a=0;return Object.keys(t.refineInfos).forEach((i=>{e+=t.refineInfos[i].addIds.length,a+=t.refineInfos[i].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",e.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}}",i.toString()),"non-interactive":!0})]}_getTotal(i){const t=p(i);return Object.keys(t).reduce(((i,s)=>i+t[s].ids.length),0)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}async _selectFeatures(i){var t,s;this.selectionLoadingChange.emit(!0),this._featuresCollection[null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id]=[];const e=await c(0,null===(s=this._refineLayer)||void 0===s?void 0:s.layer,i,this._featuresCollection);this.selectionLoadingChange.emit(!1);let a=[];Object.keys(e).forEach((i=>{var t;i===(null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id)&&(a=a.concat(e[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(),y.highlightHandles=await g(this.selectionSets)}_clearHighlight(){y.removeHandles()}async _updateIds(i,t,s,e){let a=!1;const l=this._refineSelectionSet.refineInfos,h=e.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:e};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&&s.push({ids:i,mode:t,layerView:e}),o.removeIds.length>0&&(o.removeIds=o.removeIds.filter((t=>i.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,s)=>(i.forEach((i=>{s.workflowType!==b.REFINE?s.selectedIds.indexOf(i)>-1&&t.push(i):Object.keys(s.refineInfos).some((a=>{const l=s.refineInfos[a];if(l.layerView.layer.id===e.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&&s.push({ids:l,mode:t,layerView:e}),this.selectionSets=this.selectionSets.reduce(((i,t)=>(t.workflowType!==b.REFINE&&t.layerView.layer.id===e.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)}};x.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-ui-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-ui-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,P as pdf_download,x 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,c as t,a as s,h as e,H as a,g as l}from"./p-91c78d98.js";import{a as o,b as n,c as h}from"./p-2a58e378.js";import{l as c}from"./p-05948b48.js";import{g as d,h as r}from"./p-15070568.js";import{s as p}from"./p-375fd36b.js";import{g}from"./p-99d8a839.js";import{c as b,r as u}from"./p-b02eb8f4.js";import"./p-482534a7.js";import"./p-e1a4994d.js";import"./p-ecc95259.js";const m=class{constructor(s){i(this,s),this.searchConfigurationChange=t(this,"searchConfigurationChange",7),this._onboardingImageUrl="",this._titleValue=void 0,this._numSelected=0,this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.defaultExportTitle="",this.defaultNumLabelsPerPage=void 0,this.featureEffect=void 0,this.featureHighlightEnabled=void 0,this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._addMap=!1,this._addTitle=!1,this._downloadActive=!0,this._exportType=o.PDF,this._fetchingData=!1,this._isMobile=void 0,this._numDuplicates=0,this._pageType=n.LIST,this._saveEnabled=!1,this._selectionSets=[],this._translations=void 0}async mapViewWatchHandler(i){(null==i?void 0:i.popup)&&(this._popupsEnabled=null==i?void 0:i.popup.autoOpenEnabled)}async watchSearchConfigurationHandler(i,t){const s=JSON.stringify(i);s!==JSON.stringify(t)&&(this._searchConfiguration=JSON.parse(s),this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(i,t){i&&JSON.stringify(i)!==JSON.stringify(t)&&this._setLineSymbol(i)}async sketchPointSymbolWatchHandler(i,t){i&&JSON.stringify(i)!==JSON.stringify(t)&&this._setPointSymbol(i)}async sketchPolygonSymbolWatchHandler(i,t){i&&JSON.stringify(i)!==JSON.stringify(t)&&this._setPolygonSymbol(i)}async pageTypeWatchHandler(i,t){var s;if(this._checkPopups(),(null===(s=this.mapView)||void 0===s?void 0:s.popup)&&(this.mapView.popupEnabled=i===n.LIST&&this._popupsEnabled),i===n.EXPORT&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1),this._clearHighlight(),t!==n.SELECT&&t!==n.REFINE||await this._clearSelection(),i!==n.SELECT)return this._highlightFeatures()}selectionSetsChanged(i){this._selectionSets=[...i.detail]}connectedCallback(){this._mediaQuery=window.matchMedia("(max-width: 600px)"),this._mediaQuery.addEventListener("change",(i=>this._setIsMobile(i)))}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initSymbols(),this._onboardingImageUrl=s("../assets/data/images/onboarding.png")}render(){return e(a,null,e("calcite-shell",null,e("calcite-action-bar",{class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:this._isMobile?"footer":"header"},this._getActionGroup("list-check",n.LIST,this._translations.myLists),this.showRefineSelection?this._getActionGroup("test-data",n.REFINE,this._translations.refineSelection):null,this._getActionGroup("export",n.EXPORT,this._translations.export)),this._getPage(this._pageType)))}disconnectedCallback(){this._mediaQuery.removeEventListener("change",(i=>this._setIsMobile(i)))}async _initModules(){const[i,t]=await c(["esri/geometry/geometryEngine","esri/symbols/support/jsonUtils"]);this._geometryEngine=i,this._jsonUtils=t}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(i){this.sketchLineSymbol="simple-line"===(null==i?void 0:i.type)?i:this._jsonUtils.fromJSON(i||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(i){this.sketchPointSymbol="simple-marker"===(null==i?void 0:i.type)?i:this._jsonUtils.fromJSON(i||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(i){this.sketchPolygonSymbol="simple-fill"===(null==i?void 0:i.type)?i:this._jsonUtils.fromJSON(i||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(i){this._isMobile=i.matches}_getActionGroup(i,t,s){return e("calcite-action-group",{class:this.showRefineSelection?"w-1-3":"w-1-2",layout:"horizontal"},e("div",{class:"background-override"},e("calcite-action",{active:this._pageType===t,alignment:"center",class:"width-full height-full",compact:!1,icon:i,id:i,onClick:()=>{this._setPageType(t)},text:""})),e("calcite-tooltip",{label:"",placement:"bottom","reference-element":i},e("span",null,s)))}_setPageType(i){this._pageType=i}_getPage(i){let t;switch(i){case n.LIST:t=this._getListPage();break;case n.SELECT:t=this._getSelectPage();break;case n.EXPORT:t=this._getExportPage();break;case n.REFINE:t=this._getRefinePage()}return t}_getListPage(){const i=this._hasSelections();return e("calcite-panel",null,this._getLabel(this._translations.myLists),this._getNotice(i?this._translations.listHasSetsTip:this._translations.selectLayerAndAdd,"padding-sides-1 padding-bottom-1","word-wrap-anywhere"),i?this._getSelectionSetList():this._getOnboardingImage(),e("div",{class:"display-flex padding-1"},e("calcite-button",{onClick:()=>{this._setPageType(n.SELECT)},width:"full"},e("span",{class:"font-weight-500"},this._translations.add))))}_getOnboardingImage(){return e("div",{class:"display-flex padding-sides-1"},e("img",{class:"img-container",src:this._onboardingImageUrl}))}_getSelectionSetList(){return e("div",{class:"padding-top-1-2 padding-bottom-1-2"},e("calcite-list",{class:"list-border margin-sides-1"},this._selectionSets.reduce(((i,t,s)=>{var a;const l=this._getSelectionSetIds(t);let o=!0;return t.workflowType===h.REFINE&&(o=Object.keys(t.refineInfos).reduce(((i,s)=>{const e=t.refineInfos[s];return i+(e.addIds.length+e.removeIds.length)}),0)>0),o&&i.push(e("calcite-list-item",{label:t.label,onClick:()=>this._gotoSelection(t,this.mapView)},e("div",{slot:"content"},e("div",{class:"list-label"},t.label),e("div",{class:"list-description"},null===(a=null==t?void 0:t.layerView)||void 0===a?void 0:a.layer.title),e("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",l.length.toString()))),this._getAction(!0,"pencil","",(i=>this._openSelection(t,i)),!1,"actions-end"),this._getAction(!0,"x","",(i=>this._deleteSelection(s,i)),!1,"actions-end"))),i}),[])))}_getSelectionSetIds(i){return i.workflowType!==h.REFINE?i.selectedIds:Object.keys(i.refineInfos).reduce(((t,s)=>[...t,...i.refineInfos[s].addIds]),[])}_hasSelections(i=!1){let t=[];const s=this._selectionSets.some((i=>{if(i.workflowType===h.REFINE)return t=this._getSelectionSetIds(i),!0}));return i&&s?t.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){const i=this._getExportInfos(),t=await b(this.mapView.map,i),s=u(t);return t.length-s.length}_getExportInfos(){return this._selectionSets.reduce(((i,t)=>(t.download&&(t.workflowType!==h.REFINE?this._updateIds(t.layerView.layer.id,t.layerView,t.selectedIds,i):Object.keys(t.refineInfos).forEach((s=>{const e=t.refineInfos[s];e.addIds.length>0&&this._updateIds(s,e.layerView,e.addIds,i)}))),i)),{})}_updateIds(i,t,s,e){return e[i]?e[i].ids=e[i].ids.concat(s):e[i]={layerView:t,ids:s},e}_getSelectPage(){const i=this._translations.selectSearchTip;return e("calcite-panel",null,this._getLabel(this._translations.stepTwoFull,!0),this._getNotice(i,"padding-1","word-wrap-anywhere"),e("div",null,e("map-select-tools",{bufferColor:this.bufferColor,bufferOutlineColor:this.bufferOutlineColor,class:"font-bold",customLabelEnabled:this.customLabelEnabled,defaultBufferDistance:this.defaultBufferDistance,defaultBufferUnit:this.defaultBufferUnit,enabledLayerIds:this.addresseeLayerIds,isUpdate:!!this._activeSelection,mapView:this.mapView,noResultText:this.noResultText,onSelectionSetChange:i=>this._updateForSelection(i),ref:i=>{this._selectTools=i},searchConfiguration:this._searchConfiguration,selectionLayerIds:this.selectionLayerIds,selectionSet:this._activeSelection,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})),this._getPageNavButtons(this._translations.done,0===this._numSelected,(()=>{this._saveSelection()}),this._translations.cancel,!1,(()=>{this._home()})))}_getExportPage(){const i=this._hasSelections(this.showRefineSelection),t=this._numDuplicates>0?"display-block":"display-none";return e("calcite-panel",null,e("div",null,this._getLabel(this._translations.export,!1),i?e("div",null,this._getNotice(this._translations.exportTip,"padding-sides-1"),this._getLabel(this._translations.exportListsLabel),this._getExportSelectionLists(),e("div",{class:"padding-sides-1 "+t},e("div",{class:"display-flex"},e("calcite-label",{layout:"inline"},e("calcite-checkbox",{ref:i=>{this._removeDuplicates=i}}),e("div",{class:"display-flex"},this._translations.removeDuplicate,e("div",{class:"info-message padding-start-1-2"},e("calcite-input-message",{class:"info-blue margin-top-0",scale:"m"},` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`)))),e("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"remove-duplicates-icon",scale:"s"})),e("calcite-popover",{closable:!0,label:"",referenceElement:"remove-duplicates-icon"},e("span",{class:"tooltip-message"},this._translations.duplicatesTip))),e("div",{class:"border-bottom"}),e("div",{class:"padding-top-sides-1"},e("calcite-segmented-control",{class:"w-100",onCalciteSegmentedControlChange:i=>this._exportTypeChange(i)},e("calcite-segmented-control-item",{checked:this._exportType===o.PDF,class:"w-50 end-border",value:o.PDF},e("span",{class:"font-weight-500"},this._translations.pdf)),e("calcite-segmented-control-item",{checked:this._exportType===o.CSV,class:"w-50",value:o.CSV},e("span",{class:"font-weight-500"},this._translations.csv)))),e("div",{class:"padding-bottom-1"},this._getExportOptions()),e("div",{class:"padding-1 display-flex"},e("calcite-button",{disabled:!this._downloadActive,loading:this._fetchingData,onClick:()=>{this._export()},width:"full"},e("span",{class:"font-weight-500"},this._translations.export)))):this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")))}_exportTypeChange(i){this._exportType=i.target.value}_getExportOptions(){const i=this._addTitle?"display-block":"display-none",t=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"";return e("div",{class:this._exportType===o.PDF?"display-block":"display-none"},this._getLabel(this._translations.pdfOptions,!0),e("div",{class:"padding-top-sides-1"},e("calcite-label",{class:"label-margin-0"},this._translations.selectPDFLabelOption)),e("div",{class:"padding-sides-1"},e("pdf-download",{defaultNumLabelsPerPage:parseInt(this.defaultNumLabelsPerPage.toString(),10),disabled:!this._downloadActive,ref:i=>{this._downloadTools=i}})),e("div",{class:"padding-top-sides-1"},e("calcite-label",{class:"label-margin-0",layout:"inline"},e("calcite-checkbox",{checked:this._addTitle,onCalciteCheckboxChange:()=>this._addTitle=!this._addTitle}),this._translations.addTitle)),e("div",{class:i},this._getLabel(this._translations.title,!0,""),e("calcite-input-text",{class:"padding-sides-1",onCalciteInputTextInput:()=>this._changeTitle(),placeholder:this._translations.titlePlaceholder,ref:i=>{this._titleElement=i},value:t})),e("div",{class:"padding-top-sides-1"},e("calcite-label",{class:"label-margin-0",layout:"inline"},e("calcite-checkbox",{checked:this._addMap,onCalciteCheckboxChange:()=>this._addMap=!this._addMap}),this._translations.includeMap)))}_getRefinePage(){const i=this._hasSelections();return e("calcite-panel",null,this._getLabel(this._translations.refineSelection),i?e("div",null,this._getNotice(this._translations.refineTip,"padding-sides-1"),e("refine-selection",{enabledLayerIds:this.selectionLayerIds,mapView:this.mapView,selectionSets:this._selectionSets,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})):this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1"))}_getPageNavButtons(i,t,s,a,l,o){return e("div",{class:"padding-bottom-1"},e("div",{class:"display-flex padding-top-sides-1"},e("calcite-button",{disabled:t,onClick:s,width:"full"},e("span",{class:"font-weight-500"},i))),e("div",{class:"display-flex padding-top-1-2 padding-sides-1"},e("calcite-button",{appearance:"outline",disabled:l,onClick:o,width:"full"},e("span",{class:"font-weight-500"},a))))}_changeTitle(){this._titleValue=this._titleElement.value}_getNotice(i,t="padding-1",s=""){return e("calcite-notice",{class:t,icon:"lightbulb",kind:"success",open:!0},e("div",{class:s,slot:"message"},i))}_getLabel(i,t=!1,s="font-bold"){return e("div",{class:"padding-top-sides-1"},e("calcite-label",{class:s+=t?" label-margin-0":""},i))}_getExportSelectionLists(){return this._selectionSets.reduce(((i,t)=>{var s;const a=this._getSelectionSetIds(t),l=t.workflowType!==h.REFINE||a.length>0;return!this._downloadActive&&t.download&&l&&(this._downloadActive=!0),l&&i.push(e("div",{class:"display-flex padding-sides-1 padding-bottom-1"},e("calcite-checkbox",{checked:t.download,class:"align-center",onClick:()=>{this._toggleDownload(t.id)}}),e("calcite-list",{class:"list-border margin-start-1-2 width-full",id:"download-list"},e("calcite-list-item",{disabled:!t.download,label:t.label,onClick:()=>{this._toggleDownload(t.id)}},e("div",{slot:"content"},e("div",{class:"list-label"},t.label),e("div",{class:"list-description"},null===(s=null==t?void 0:t.layerView)||void 0===s?void 0:s.layer.title),e("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",a.length.toString()))))))),i}),[])||e("div",null)}async _toggleDownload(i){let t=!1;this._selectionSets=this._selectionSets.map((s=>(s.download=s.id===i?!s.download:s.download,t=!!s.download||t,s))),this._downloadActive=t,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _export(){const i=this._getSelectionIdsAndViews(this._selectionSets,!0);if(this._exportType===o.PDF){let t="";if(this._addMap&&this.mapView){const i=await this.mapView.takeScreenshot({width:1500,height:2e3});t=null==i?void 0:i.dataUrl}this._fetchingData=!0,await this._downloadTools.downloadPDF(this.mapView.map,i,this._removeDuplicates.checked,this._addTitle?this._titleElement.value:"",t),this._fetchingData=!1}this._exportType===o.CSV&&(this._fetchingData=!0,await this._downloadTools.downloadCSV(this.mapView.map,i,this._removeDuplicates.checked),this._fetchingData=!1)}_getSelectionIdsAndViews(i,t=!1){return(t?i.filter((i=>i.download)):i).reduce(((i,t)=>{var s;if(t.workflowType===h.REFINE)Object.keys(t.refineInfos).forEach((s=>{const e=t.refineInfos[s];e.addIds&&(i=this._updateExportInfos(i,e.layerView.layer.id,t.label,e.addIds,e.layerView))}));else{const e=null===(s=null==t?void 0:t.layerView)||void 0===s?void 0:s.layer.id;i=this._updateExportInfos(i,e,t.label,t.selectedIds,t.layerView)}return i}),{})}_updateExportInfos(i,t,s,e,a){return t&&Object.keys(i).indexOf(t)>-1?(i[t].ids=[...new Set([...i[t].ids,...e])],i[t].selectionSetNames.push(s)):t&&(i[t]={ids:e,layerView:a,selectionSetNames:[s]}),i}_getAction(i,t,s,a,l=!1,o=""){return e("calcite-action",{disabled:!i,icon:t,indicator:l,onClick:a,slot:o,text:s})}_updateForSelection(i){this._numSelected=i.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType(n.LIST)}async _saveSelection(){var i,t;const s=await(null===(i=this._selectTools)||void 0===i?void 0:i.getSelection()),e=null===(t=this._selectTools)||void 0===t?void 0:t.isUpdate;return this._selectionSets=e?this._selectionSets.map((i=>i.id===s.id?s:i)):[...this._selectionSets,s],this._home()}async _clearSelection(){var i;await(null===(i=this._selectTools)||void 0===i?void 0:i.clearSelection()),this._numSelected=0,this._activeSelection=void 0}_deleteSelection(i,t){return t.stopPropagation(),this._selectionSets=this._selectionSets.filter(((t,s)=>{if(s!==i)return t})),this._highlightFeatures()}_gotoSelection(i,t){d(i.selectedIds,i.layerView,t,this.featureHighlightEnabled,this.featureEffect)}_openSelection(i,t){t.stopPropagation(),this._activeSelection=i,this._pageType=i.workflowType===h.REFINE?n.REFINE:n.SELECT}async _highlightFeatures(){this._clearHighlight();const i=this._getSelectionIdsAndViews(this._selectionSets,this._pageType===n.EXPORT),t=Object.keys(i);if(t.length>0)for(let s=0;s<t.length;s++){const e=i[t[s]];p.highlightHandles.push(await r(e.ids,e.layerView,this.mapView))}}_checkPopups(){var i;"boolean"!=typeof this._popupsEnabled&&(this._popupsEnabled=null===(i=this.mapView)||void 0===i?void 0:i.popupEnabled)}_clearHighlight(){p&&p.highlightHandles&&p.removeHandles()}async _getTranslations(){const i=await g(this.el);this._translations=i[0]}get el(){return l(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"],sketchLineSymbol:["sketchLineSymbolWatchHandler"],sketchPointSymbol:["sketchPointSymbolWatchHandler"],sketchPolygonSymbol:["sketchPolygonSymbolWatchHandler"],_pageType:["pageTypeWatchHandler"]}}};m.style=':host{display:block;--calcite-input-message-spacing-value:0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-2{width:50%}.w-1-3{width:33.33%}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-top-sides-1{padding-block-start:1rem;padding-inline-start:1rem;padding-inline-end:1rem}.padding-sides-1{padding-inline-start:1rem;padding-inline-end:1rem}.padding-end-1-2{padding-inline-end:.5rem}.padding-top-1-2{padding-block-start:.5rem}.padding-top-1{padding-top:1rem}.padding-bottom-1{padding-bottom:1rem}.padding-bottom-1-2{padding-bottom:.5rem}.info-blue{color:#00A0FF}.info-message{justify-content:center;display:grid}.font-bold{font-weight:bold}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.padding-start-1-2{padding-inline-start:0.5rem}.list-border{border:1px solid var(--calcite-ui-border-2)}.margin-sides-1{margin-inline-start:1rem;margin-inline-end:1rem}.margin-start-1-2{margin-inline-start:0.5rem}.float-right{float:right}.float-right[dir="rtl"]{float:left}.float-left{float:left}.float-left[dir="rtl"]{float:right}.margin-top-0{margin-block-start:0 !important}.height-1-1-2{height:1.5rem}.main-background{background-color:var(--calcite-ui-foreground-2)}.position-right{position:absolute;right:1rem}.position-right[dir="rtl"]{position:absolute;left:1rem}.label-margin-0{--calcite-label-margin-bottom:0}.list-label{color:var(--calcite-ui-text-1)}.list-label,.list-description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);overflow-wrap:break-word;word-break:break-word}.list-description{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}.img-container{width:100%;height:100%}.font-weight-500{font-weight:500}.background-override{height:100%;width:100%;--calcite-ui-foreground-3:var(--calcite-ui-brand);--calcite-ui-foreground-2:var(--calcite-ui-brand-hover);--calcite-ui-text-1:var(--calcite-ui-text-inverse)}.word-wrap-anywhere{word-wrap:anywhere}';export{m as public_notification}
|
@@ -1,192 +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{c as e}from"./p-482534a7.js";import{d as t}from"./p-2a58e378.js";import{E as r,j as i,S as n}from"./p-ff0d7712.js";import{c as s,r as o}from"./p-ecc95259.js";
|
7
|
-
/*! *****************************************************************************
|
8
|
-
Copyright (c) Microsoft Corporation.
|
9
|
-
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
11
|
-
purpose with or without fee is hereby granted.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
20
|
-
***************************************************************************** */
|
21
|
-
var a=function(){return a=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function c(e){return void 0===e&&(e={}),e.portal?s(e.portal):e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function u(e){return e.owner?Promise.resolve(e.owner):e.item&&e.item.owner?Promise.resolve(e.item.owner):e.authentication&&e.authentication.getUsername?e.authentication.getUsername():Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."))}
|
22
|
-
/** @license
|
23
|
-
* Copyright 2018 Esri
|
24
|
-
*
|
25
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
26
|
-
* you may not use this file except in compliance with the License.
|
27
|
-
* You may obtain a copy of the License at
|
28
|
-
*
|
29
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
30
|
-
*
|
31
|
-
* Unless required by applicable law or agreed to in writing, software
|
32
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
33
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
34
|
-
* See the License for the specific language governing permissions and
|
35
|
-
* limitations under the License.
|
36
|
-
*/
|
37
|
-
function l(e){return new Promise((t=>{p(e).then((e=>{try{t(JSON.parse(e))}catch(e){t(null)}}),(()=>t(null)))}))}function f(e,t,r){return e?
|
38
|
-
/** @license
|
39
|
-
* Copyright 2020 Esri
|
40
|
-
*
|
41
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
42
|
-
* you may not use this file except in compliance with the License.
|
43
|
-
* You may obtain a copy of the License at
|
44
|
-
*
|
45
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
46
|
-
*
|
47
|
-
* Unless required by applicable law or agreed to in writing, software
|
48
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
49
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
50
|
-
* See the License for the specific language governing permissions and
|
51
|
-
* limitations under the License.
|
52
|
-
*/
|
53
|
-
function(e,t,r){let i;try{i=new File(e,t,r)}catch(n){i=function(){void 0===r&&(r={type:""});const i=new Blob(e,r);return i.lastModified=new Date,i.name=t,i}()}return i}([e],t||"",{type:r||e.type}):null}function p(e){return new Promise((t=>{const r=new FileReader;r.onload=function(e){t(e.target.result||"")},r.readAsText(e)}))}function m(e,t){return t.split(".").reduce((function(e,t){return e?e[t]:void 0}),e)}function d(e,t,r){const i=t.split(".");i.reduce(((e,t,n)=>n===i.length-1?(e[t]=r,r):(e[t]||(e[t]={}),e[t])),e)}
|
54
|
-
/** @license
|
55
|
-
* Copyright 2018 Esri
|
56
|
-
*
|
57
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
58
|
-
* you may not use this file except in compliance with the License.
|
59
|
-
* You may obtain a copy of the License at
|
60
|
-
*
|
61
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
62
|
-
*
|
63
|
-
* Unless required by applicable law or agreed to in writing, software
|
64
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
65
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
66
|
-
* See the License for the specific language governing permissions and
|
67
|
-
* limitations under the License.
|
68
|
-
*/
|
69
|
-
const h="PK";function w(e,t,r=[]){return new Promise(((i,n)=>{(function(e,t,r={}){if(!e)return Promise.reject("Url must be provided");const i={authentication:t,rawResponse:!0,...r};return o(e,i).then((e=>e.blob()))})(e,t).then((e=>{v(e).then((e=>{"application/json"===e.type?l(e).then((t=>{if(t?.error){const e=t.error.code;void 0!==e&&r.indexOf(e)>=0?i(null):n(t)}else i(e)})):i(e)}),n)}),n)}))}function v(e){return new Promise(((t,r)=>{e&&e.size>0&&(e.type.startsWith("text/plain")||e.type.startsWith("application/json"))?p(e).then((r=>{try{JSON.parse(r),t(new Blob([e],{type:"application/json"}))}catch(i){r.length>4&&r.substr(0,4)===h?t(new Blob([e],{type:"application/zip"})):r.startsWith("<")?t(new Blob([e],{type:"text/xml"})):t(e)}}),r):e?t(e):r()}))}
|
70
|
-
/** @license
|
71
|
-
* Copyright 2018 Esri
|
72
|
-
*
|
73
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
74
|
-
* you may not use this file except in compliance with the License.
|
75
|
-
* You may obtain a copy of the License at
|
76
|
-
*
|
77
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
78
|
-
*
|
79
|
-
* Unless required by applicable law or agreed to in writing, software
|
80
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
81
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
82
|
-
* See the License for the specific language governing permissions and
|
83
|
-
* limitations under the License.
|
84
|
-
*/
|
85
|
-
/** @license
|
86
|
-
* Copyright 2020 Esri
|
87
|
-
*
|
88
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
89
|
-
* you may not use this file except in compliance with the License.
|
90
|
-
* You may obtain a copy of the License at
|
91
|
-
*
|
92
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
93
|
-
*
|
94
|
-
* Unless required by applicable law or agreed to in writing, software
|
95
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
96
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
97
|
-
* See the License for the specific language governing permissions and
|
98
|
-
* limitations under the License.
|
99
|
-
*/
|
100
|
-
function b(e,t=0){const i=e.split("/");let n=i.pop(),s="";const o=i.shift();let a=r.Resource;if(o)if(o.endsWith("_info_thumbnail"))a=r.Thumbnail;else if(o.endsWith("_info_metadata"))a=r.Metadata,n="metadata.xml";else if(o.endsWith("_info_data"))a=r.Data;else if(o.endsWith("_info_dataz"))n=n.replace(/\.zip$/,""),a=r.Data;else if(t<1){const e=o.indexOf("_");e>0&&(s=o.substr(e+1))}else s=i.join("/");return{type:a,folder:s,filename:n}}
|
101
|
-
/** @license
|
102
|
-
* Copyright 2021 Esri
|
103
|
-
*
|
104
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
105
|
-
* you may not use this file except in compliance with the License.
|
106
|
-
* You may obtain a copy of the License at
|
107
|
-
*
|
108
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
109
|
-
*
|
110
|
-
* Unless required by applicable law or agreed to in writing, software
|
111
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
112
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
113
|
-
* See the License for the specific language governing permissions and
|
114
|
-
* limitations under the License.
|
115
|
-
*/function S(e,t,r){return{...e,fetchedFromSource:t,copiedToDestination:r}}
|
116
|
-
/** @license
|
117
|
-
* Copyright 2021 Esri
|
118
|
-
*
|
119
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
120
|
-
* you may not use this file except in compliance with the License.
|
121
|
-
* You may obtain a copy of the License at
|
122
|
-
*
|
123
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
124
|
-
*
|
125
|
-
* Unless required by applicable law or agreed to in writing, software
|
126
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
127
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
128
|
-
* See the License for the specific language governing permissions and
|
129
|
-
* limitations under the License.
|
130
|
-
*/
|
131
|
-
/** @license
|
132
|
-
* Copyright 2021 Esri
|
133
|
-
*
|
134
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
135
|
-
* you may not use this file except in compliance with the License.
|
136
|
-
* You may obtain a copy of the License at
|
137
|
-
*
|
138
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
139
|
-
*
|
140
|
-
* Unless required by applicable law or agreed to in writing, software
|
141
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
142
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
143
|
-
* See the License for the specific language governing permissions and
|
144
|
-
* limitations under the License.
|
145
|
-
*/
|
146
|
-
function _(e,t,r,n=40){return new Promise((s=>{let o=[];const a=[];e.length>0&&function(e,t){const r=[];let i=0;for(;i<e.length;)r.push(e.slice(i,i+t)),i+=t;return r}(e,n).forEach(((e,t)=>{const r={filename:`resources${t}.zip`,zip:new i,filelist:[]};o=o.concat(e.map((e=>function(e,t){return e.folder?t.zip.folder(e.folder).file(e.filename,e.file,{binary:!0}):t.zip.file(e.filename,e.file,{binary:!0}),t.filelist.push(e),S(e,!0)}
|
147
|
-
/** @license
|
148
|
-
* Copyright 2021 Esri
|
149
|
-
*
|
150
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
151
|
-
* you may not use this file except in compliance with the License.
|
152
|
-
* You may obtain a copy of the License at
|
153
|
-
*
|
154
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
155
|
-
*
|
156
|
-
* Unless required by applicable law or agreed to in writing, software
|
157
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
158
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
159
|
-
* See the License for the specific language governing permissions and
|
160
|
-
* limitations under the License.
|
161
|
-
*/(e,r)))),a.push(r)})),o.length>0?Promise.all(o).then((e=>{e=e.filter((e=>!(e.fetchedFromSource&&void 0===e.copiedToDestination))),function(e,t,r){return new Promise((i=>{const n=e.filter((e=>Object.keys(e.zip.files).length>0));n.length>0?g(n,t,r).then((e=>{i(e)})):i([])}))}(a,t,r).then((t=>{s(e.concat(t))}))})):s([])}))}function g(e,t,r){return new Promise((i=>{let n=[];const s=e.pop();let l=Promise.resolve([]);e.length>0&&(l=g(e,t,r)),l.then((e=>(n=e,new Promise((e=>{setTimeout((()=>e()),1e3)}))))).then((()=>function(e,t,r){return new Promise((i=>{e.zip.generateAsync({type:"blob"}).then((t=>f(t,e.filename,"application/zip"))).then((e=>{return u(i={id:t,resource:e,authentication:r,params:{archive:!0}}).then((function(e){var t=c(i)+"/content/users/"+e+"/items/"+i.id+"/addResources";return i.params=a({file:i.resource,fileName:i.name,resourcesPrefix:i.prefix,text:i.content,access:i.private?"private":"inherit"},i.params),o(t,i)}));var i})).then((()=>i(S(e,!0,!0))),(()=>i(S(e,!0,!1))))}))}(s,t,r))).then((e=>{e.filelist.forEach((t=>{n.push(S(t,!0,e.copiedToDestination))})),i(n)}))}))}
|
162
|
-
/** @license
|
163
|
-
* Copyright 2018 Esri
|
164
|
-
*
|
165
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
166
|
-
* you may not use this file except in compliance with the License.
|
167
|
-
* You may obtain a copy of the License at
|
168
|
-
*
|
169
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
170
|
-
*
|
171
|
-
* Unless required by applicable law or agreed to in writing, software
|
172
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
173
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
174
|
-
* See the License for the specific language governing permissions and
|
175
|
-
* limitations under the License.
|
176
|
-
*/
|
177
|
-
/** @license
|
178
|
-
* Copyright 2022 Esri
|
179
|
-
*
|
180
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
181
|
-
* you may not use this file except in compliance with the License.
|
182
|
-
* You may obtain a copy of the License at
|
183
|
-
*
|
184
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
185
|
-
*
|
186
|
-
* Unless required by applicable law or agreed to in writing, software
|
187
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
188
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
189
|
-
* See the License for the specific language governing permissions and
|
190
|
-
* limitations under the License.
|
191
|
-
*/
|
192
|
-
const P={solutionItemId:"",defaultWkid:void 0,solutionData:{metadata:{},templates:[]},templateEdits:{},featureServices:[],spatialReferenceInfo:{enabled:!1,services:{},spatialReference:void 0}},y=class{static get Store(){return this._instance||(this._instance=new this)}constructor(){this._hasChanges=!1,this._store=e(Object.assign({},P))}getItemInfo(e){let t;return this._store.get("solutionData").templates.some((r=>e==r.itemId&&(t=r,!0))),t}getStoreInfo(e){return this._store.get(e)}async loadSolution(e,t){this._authentication=t;const r=await function(e,t){return new Promise((r=>{(function(e,t){return new Promise((r=>{const i=function(e,t){return`${function(e){return m(e,"portal")||"https://www.arcgis.com/sharing/rest"}(t)}/content/items/${e}/data`}(e,t);w(i,t,[400,500]).then((e=>r(v(e))),(()=>r(null)))}))})(e,t).then((e=>r(l(e))),(()=>r(null)))}))}(e,t);if(r){const i=m(r,"params.wkid.default");await this._prepareSolutionItemsForEditing(e,r.templates,t);const n=this._getFeatureServices(r.templates),s=this._getSpatialReferenceInfo(n,i);this._store.set("solutionItemId",e),this._store.set("defaultWkid",i),this._store.set("solutionData",r),this._store.set("featureServices",n),this._store.set("spatialReferenceInfo",s)}this._flagStoreHasChanges(!1)}replaceItemThumbnail(e){e.resourceFilePaths.forEach((e=>{e.type===r.Thumbnail&&(e.updateType===t.None?e.updateType=t.Remove:e.updateType!==t.Add&&e.updateType!==t.Update||(e.updateType=t.Obsolete))})),e.resourceFilePaths=e.resourceFilePaths.filter((e=>e.updateType!=t.Obsolete)),e.resourceFilePaths.push({blob:e.thumbnail,filename:e.thumbnail.name,type:r.Thumbnail,updateType:t.Add}),this.setItemInfo(e)}async saveSolution(){const e=this._store.get("solutionItemId"),t=this._store.get("solutionData"),r=this._store.get("spatialReferenceInfo");await this._prepareSolutionItemsForStorage(e,t.templates,this._authentication);const i=this._setSpatialReferenceInfo(r,t.templates);d(t,"params.wkid",i?{label:"Spatial Reference",default:i,valueType:"spatialReference",attributes:{required:"true"}}:{});const n={id:e,text:t};await function(e,t){return new Promise(((r,i)=>{var n;(n={item:e,folderId:void 0,authentication:t,params:{}},u(n).then((function(e){var t,r,i,s=n.folderId?c(n)+"/content/users/"+e+"/"+n.folderId+"/items/"+n.item.id+"/update":c(n)+"/content/users/"+e+"/items/"+n.item.id+"/update";return n.params=a(a({},n.params),(t=n.item,(r=JSON.parse(JSON.stringify(t))).data&&("undefined"!=typeof Blob&&t.data instanceof Blob||"ReadStream"===t.data.constructor.name?r.file=t.data:r.text=t.data,delete r.data),r)),n.params.extent&&(i=n.params.extent,Array.isArray(i)&&Array.isArray(i[0])&&Array.isArray(i[1]))&&(n.params.extent=function(e){return e.join(",")}(n.params.extent)),o(s,n)}))).then((e=>e.success?r(e):i(e)),(e=>i(e)))}))}(n,this._authentication)}setItemInfo(e){const t=this._store.get("solutionData");t.templates.some((r=>e.itemId==r.itemId&&(r=e,this._store.set("solutionData",t),this._flagStoreHasChanges(!0),!0)))}setStoreInfo(e,t){this._store.set(e,t),this._flagStoreHasChanges(!0)}_testAccess(e,t,r,i){switch(e){case"_emptyTheStore":this._emptyTheStore();break;case"_getFeatureServices":return this._getFeatureServices(t);case"_getItemsSharedWithThisGroup":return this._getItemsSharedWithThisGroup(t,r);case"_getResourceFilePaths":return this._getResourceFilePaths(t,r,i);case"_getResourceStorageName":return this._getResourceStorageName(t,r);case"_getSpatialReferenceInfo":return this._getSpatialReferenceInfo(t,r);case"_prepareSolutionItemsForEditing":return this._prepareSolutionItemsForEditing(t,r,i);case"_prepareSolutionItemsForStorage":return this._prepareSolutionItemsForStorage(t,r,i);case"_setSpatialReferenceInfo":return this._setSpatialReferenceInfo(t,r);case"_splitFilename":return this._splitFilename(t)}return null}_emptyTheStore(){this._store.set("solutionItemId",P.solutionItemId),this._store.set("defaultWkid",P.defaultWkid),this._store.set("solutionData",P.solutionData),this._store.set("templateEdits",P.templateEdits),this._store.set("featureServices",P.featureServices),this._store.set("spatialReferenceInfo",P.spatialReferenceInfo)}_flagStoreHasChanges(e){this._hasChanges!==e&&window.dispatchEvent(new CustomEvent("solutionStoreHasChanges",{detail:e,bubbles:!0,cancelable:!1,composed:!0})),this._hasChanges=e}_getCustomizableFeatureServices(e){return e.reduce(((e,t)=>("Feature Service"===t.type&&t.item.typeKeywords.indexOf("View Service")<0&&e.push(t),e)),[])}_getFeatureServices(e){return this._getCustomizableFeatureServices(e).map((e=>({name:e.item.title||e.item.name,enabled:m(e,"properties.service.spatialReference.wkid").toString().startsWith("{{params.wkid||")})))}_getItemsSharedWithThisGroup(e,t){return t.reduce(((t,r)=>(r.itemId!==e.itemId&&"Group"!==r.type&&t.push({id:r.itemId,title:r.item.name||r.item.title,isShared:(r.groups||[]).indexOf(e.itemId)>-1,shareItem:(r.groups||[]).indexOf(e.itemId)>-1,type:r.type,typeKeywords:r.item.typeKeywords}),t)),[])}_getResourceFilePaths(e,r,i){return function(e,t,r=[],i=0){return r.map((r=>{return{url:(n=e,s=t,o=r,((a=n)?a.endsWith("/")?a:a+"/":a)+"content/items/"+s+"/resources/"+o),...b(r,i)};var n,s,o,a}))}(i,e,r.resources,n).map((e=>(e.updateType=t.None,e)))}_getResourceStorageName(e,t){let i=e;switch(t.type){case r.Data:i=`${i}_info_data`;break;case r.Info:i=`${i}_info`;break;case r.Metadata:i=`${i}_info_metadata`;break;case r.Resource:break;case r.Thumbnail:i=`${i}_info_thumbnail`}let n=t.filename;return t.type==r.Data&&n&&!function(e){const t=e.match(/\.([a-z]+)$/i);return!!t&&"|.json|.xml|.txt|.png|.pbf|.zip|.jpeg|.jpg|.gif|.bmp|.gz|.svg|.svgz|.geodatabase|".indexOf("|"+t[0]+"|")>=0}(n)&&(n+=".zip",i+="z"),i+"/"+(t.folder?t.folder+"/"+n:n)}_getSpatialReferenceInfo(e,t){const r={};return e.forEach((e=>{r[e.name]=e.enabled})),{enabled:void 0!==t,services:r,spatialReference:t||void 0}}async _prepareSolutionItemsForEditing(e,t,i){const n=[];t.forEach((s=>{s.resourceFilePaths=this._getResourceFilePaths(e,s,i.portal),n.push(s.resourceFilePaths.length>0?function(e,t){let i,n;return t.forEach((e=>{e.type===r.Thumbnail&&(i=e.url,n=e.filename)})),i?function(e,t,r){return new Promise((i=>{(function(e,t,r,i=[],n){return new Promise(((s,o)=>{w(e,r,i).then((e=>s(e?f(e,t,n):null)),o)}))})(e,t,r,[500]).then(i,(()=>i(null)))}))}(i,n,e):Promise.resolve(null)}(i,s.resourceFilePaths):Promise.resolve()),s.groupDetails="Group"===s.type?this._getItemsSharedWithThisGroup(s,t):[]}));const s=await Promise.all(n);return t.forEach(((e,t)=>{e.thumbnail=s[t]?s[t]:void 0})),Promise.resolve()}async _prepareSolutionItemsForStorage(e,r,i){const n=[],s=[];return r.forEach((r=>{r.resourceFilePaths.forEach((async l=>{const f=this._getResourceStorageName(r.itemId,l);switch(l.updateType){case t.Add:const{prefix:p,suffix:m}=this._splitFilename(f);r.resources.push(f),n.push({itemId:r.itemId,file:l.blob,folder:p,filename:m});break;case t.Update:s.push(new Promise((async t=>{try{await function(e,t,r,i){const n=t.split("/"),s=n.length>1?n.slice(0,n.length-1).join("/"):void 0;return u(l={id:e,prefix:s,name:n[n.length-1],resource:r,authentication:i}).then((function(e){var t=c(l)+"/content/users/"+e+"/items/"+l.id+"/updateResources";return l.params=a({file:l.resource,fileName:l.name,resourcesPrefix:l.prefix,text:l.content},l.params),void 0!==l.private&&(l.params.access=l.private?"private":"inherit"),o(t,l)}));var l}(e,f,l.blob,i)}catch(e){console.log("Unable to update "+f+" for item "+r.itemId+": "+JSON.stringify(e))}t()})));break;case t.Remove:s.push(new Promise((async t=>{try{await function(e,t,r){return u(i={id:e,resource:t,authentication:r}).then((function(e){var t=c(i)+"/content/users/"+e+"/items/"+i.id+"/removeResources";return i.params=a(a({},i.params),{resource:i.resource}),void 0!==i.deleteAll&&(i.params.deleteAll=i.deleteAll),o(t,i)}));var i}(e,f,i),r.resources=r.resources.filter((e=>e!==f))}catch(e){console.log("Unable to remove "+f+" for item "+r.itemId+": "+JSON.stringify(e))}t()})))}return Promise.resolve()})),delete r.resourceFilePaths,delete r.thumbnail,delete r.groupDetails})),Promise.all(s).then((async()=>{var t,r,s;return n.length>0&&await(t=n,r=e,s=i,new Promise((e=>{_(t,r,s).then((t=>{e(t.filter((e=>e.fetchedFromSource&&e.copiedToDestination)).map((e=>e.folder+"/"+e.filename)))}))}))),Promise.resolve()}))}_setSpatialReferenceInfo(e,t){const r="{{params.wkid||",i=this._getCustomizableFeatureServices(t);return e.enabled?(i.forEach((t=>{let i;e.services[t.item.title||t.item.name]?(i=`{{params.wkid||${e.spatialReference}}}`,d(t,"properties.service.spatialReference.wkid",i)):(i=m(t,"properties.service.spatialReference.wkid"),i.toString().startsWith(r)&&(i=i.toString().substring(15,i.length-2),d(t,"properties.service.spatialReference.wkid",i)))})),e.spatialReference):void i.forEach((e=>{const t=m(e,"properties.service.spatialReference.wkid");t.toString().startsWith(r)&&d(e,"properties.service.spatialReference.wkid",t.toString().substring(15,t.length-2))}))}_splitFilename(e){const t=e.split("/");return{prefix:t.length>1?t.slice(0,t.length-1).join("/"):void 0,suffix:t[t.length-1]}}}.Store;export{m as g,y as s}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,h as i,H as s,g as e,c as a}from"./p-91c78d98.js";import{g as h}from"./p-99d8a839.js";import{q as o,a as l,g as n,b as d}from"./p-15070568.js";import{l as r}from"./p-05948b48.js";import{d as c}from"./p-b02eb8f4.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";import"./p-ecc95259.js";const p=class{constructor(i){t(this,i),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(t){const i=t.detail;this._cardLoading=!0;const s=i.length>0?await o(i,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((t,s)=>i.indexOf(t.getObjectId())-i.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(t){const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations()}render(){var t,e;const a=(null===(t=this._graphics)||void 0===t?void 0:t.length)>0?"":"display-none",h=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return i(s,null,i("div",{class:"overflow-auto height-full"},i("calcite-shell",{class:"position-relative "+a},i("div",null,i("info-card",{graphics:this._graphics,isLoading:this._cardLoading,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),i("calcite-shell",{class:"position-relative "+h},i("div",{class:"padding-1"},i("calcite-notice",{icon:"table",open:!0},i("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}};p.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 u=class{constructor(i){t(this,i),this.featureSelectionChange=a(this,"featureSelectionChange",7),this.openFilterOptions=a(this,"openFilterOptions",7),this._allIds=[],this._tableSorting=!1,this.onTableNodeCreate=t=>{this._tableNode=t},this.enableAutoRefresh=void 0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableZoom=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._confirmDelete=!1,this._controlsThatFit=void 0,this._fetchingData=!1,this._isDeleting=!1,this._layer=void 0,this._selectedIndexes=[],this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}enableZoomWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableCSVWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await this._resetTable(),this._fetchingData=!1}async _selectedIndexesWatchHandler(){this._validateEnabledActions()}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async selectionChanged(t){if(this.zoomAndScrollToSelected){const i=t.detail,s=i.getObjectId(),e=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(e);const a=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===a.title&&"feature"===t.layer.type)return h=t,!0})),h&&await n([s],h,this.mapView,!0)}}async editsComplete(){await this._refresh()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver=new ResizeObserver((()=>this._onResize()))}render(){const t=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",a=this._allIds.length.toString(),h=this._selectedIndexes.length.toString();return i(s,null,i("calcite-shell",null,this._getTableControlRow("header"),i("div",{class:"height-full-adjusted width-full"},i("calcite-panel",{class:"height-full width-full"},i("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),i("div",{class:t,ref:this.onTableNodeCreate})),i("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",a).replace("{{selected}}",h)))),this._deleteMessage())}async componentDidLoad(){this._resizeObserver.observe(this._toolbar)}componentDidRender(){this._updateToolbar()}async _initModules(){const[t,i]=await r(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=t,this.reactiveUtils=i}_onResize(){this._updateToolbar()}_getTableControlRow(t){const s="more-table-options";return i("div",{class:"display-flex border-bottom height-51",ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this._getDropdown(s),this._getToolTip("","bottom",s,this._translations.moreOptions))}_getActionBar(){return i("calcite-action-bar",{expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},i("div",{class:"border-end",id:"solutions-map-layer-picker-container"},i("map-layer-picker",{appearance:"transparent",mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showTables:!0,type:"dropdown"})),this._getActions())}_getActions(){return this._getActionItems().reduce(((t,i)=>(i&&!i.isOverflow&&t.push(i.isDanger?this._getDangerAction(i.icon,i.label,i.func,i.disabled):this._getAction(i.icon,i.label,i.func,i.disabled)),t)),[])}_validateEnabledActions(){const t=this._featuresSelected(),i=["zoom-to-object","trash","erase","selected-items-filter"];this._toolInfos.forEach((s=>{s&&i.indexOf(s.icon)>-1&&(s.disabled=!t)}))}_initToolInfos(){var t;const i=this._featuresSelected(),s=this._featuresEmpty();this._toolInfos=[this.enableZoom?{icon:"zoom-to-object",label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1}:void 0,(null===(t=this.mapInfo)||void 0===t?void 0:t.filters)?{icon:"filter",label:this._translations.filters,func:()=>this._filter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{icon:"trash",label:this._translations.delete,func:()=>this._delete(),disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{icon:"erase",label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{icon:"selected-items-filter",label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{icon:"list-check-all",func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{icon:"compare",func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{icon:"refresh",func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{icon:"export",func:()=>{this._exportToCSV()},label:this._translations.exportCSV,disabled:s,isOverflow:!1}:void 0],this._defaultVisibleToolSizeInfos=void 0}_featuresSelected(){return this._selectedIndexes.length>0}_featuresEmpty(){return 0===this._allIds.length}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,a)=>(s.indexOf(a.id)<0&&(i>t?i-=a.width:e.push(a)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let a=!1;const h=[...this._defaultVisibleToolSizeInfos].reduce(((h,o)=>(!a&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),h.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(a=!0),h)),[]);this._setControlsThatFit(h,s)}}),5)}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const s=this._getDropdownItems();return s.length>0?i("calcite-dropdown",{disabled:void 0===this._layer,id:"solutions-more"},i("calcite-action",{appearance:"solid",id:t,label:"",slot:"trigger",text:""},i("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),i("calcite-dropdown-group",{"selection-mode":"none"},s.map((t=>i("calcite-dropdown-item",{iconStart:t.icon,onClick:t.func},t.label))))):void 0}_getDropdownItems(){return this._toolInfos.filter((t=>t&&t.isOverflow))}_getAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,icon:t,id:t,label:s,onClick:e,text:s,textEnabled:!0}),this._getToolTip("","bottom",t,s))}_getToolTip(t,s,e,a){return i("calcite-tooltip",{label:t,placement:s,"reference-element":e},i("span",null,a))}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,id:t,onClick:e,text:""},i("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},s)),this._getToolTip("","bottom",t,s))}async _getTable(t,i){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t})})),this._checkEditEnabled(),await this._table.when((()=>{this._table.highlightIds.on("change",(()=>{this._selectedIndexes=this._table.highlightIds.toArray().reverse(),this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(t=>{var i,s,e,a;this._sortActive=!!this._layer&&(t.length>0&&"asc"===(null===(i=t[0])||void 0===i?void 0:i.direction)||"desc"===(null===(s=t[0])||void 0===s?void 0:s.direction)||null===(null===(e=t[0])||void 0===e?void 0:e.direction)&&(null===(a=t[0])||void 0===a?void 0:a.fieldName)===this._layer.objectIdField)}))})))}async _resetTable(){var t,i;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const s=this._getColumnTemplates(this._layer.id,null===(i=null===(t=this._layer)||void 0===t?void 0:t.popupTemplate)||void 0===i?void 0:i.fieldInfos);this._allIds=await d(this._layer),this._table?s&&(this._table.tableTemplate.columnTemplates=s):await this._getTable(this._tableNode,s),this._table.layer=this._layer,this._table.view=this.mapView,this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._initToolInfos(),await this._table.when((()=>{this._table.highlightIds.removeAll(),this._table.clearSelectionFilter()})),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){this._table&&this._layer&&!this._sortActive&&!this._tableSorting&&this.showNewestFirst&&(this._tableSorting=!0,await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc"),this._tableSorting=!1})))}_deleteMessage(){return i("calcite-modal",{"aria-labelledby":"modal-title",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},i("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),i("div",{slot:"content"},this._translations.confirm),i("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),i("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this._table.highlightIds.toArray().map((t=>({objectId:t})));await this._layer.applyEdits({deleteFeatures:t}),await this._table.refresh(),this._allIds=await d(this._layer),this._isDeleting=!1,this._deleteClosed()}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0&&(s.results.forEach((t=>{this._clearSelection();const i=t.graphic.getObjectId(),s=this._table.highlightIds.indexOf(i);s>-1?this._table.highlightIds.removeAt(s):this._table.highlightIds.add(i)})),this._showOnlySelected&&this._table.filterBySelection())}_deleteClosed(){this._confirmDelete=!1}_selectAll(){const t=this._allIds;this._table.highlightIds.addMany(t),this._selectedIndexes=t}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var t;this._selectedIndexes=[],null===(t=this._table)||void 0===t||t.highlightIds.removeAll()}_filter(){this.openFilterOptions.emit()}_switchSelected(){const t=[...this._selectedIndexes];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._table.highlightIds.addMany(i),this._selectedIndexes=i}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer},c(null,t,!1,!1,!0)}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this._selectedIndexes)}_zoom(){this._table.zoomToSelection()}_delete(){this._confirmDelete=!0}async _layerSelectionChanged(t){var i;const s=t.detail[0];if(s!==(null===(i=this._layer)||void 0===i?void 0:i.id)||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,s);await t.when((()=>{this._layer=t}))}this._fetchingData=!1}_getColumnTemplates(t,i){var s;let e;null===(s=this.mapInfo.layerInfos)||void 0===s||s.some((i=>{if(i.id===t)return e=i,!0}));let a=null==e?void 0:e.columnTemplates;return i&&(a=a?a.map((t=>(i.some((i=>{if(i.fieldName===t.fieldName)return t.label=i.label,!0})),t))):i.map((t=>({type:"field",fieldName:t.fieldName,label:t.label})))),a}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{enableZoom:["enableZoomWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_selectedIndexes:["_selectedIndexesWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};u.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-ui-border-2)}.border-end{border-inline-end:1px solid var(--calcite-ui-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.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-ui-background)}.text-color{color:var(--calcite-ui-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-ui-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{padding:var(--lumo-space-xs) var(--lumo-space-m) !important;font-size:14px !important}';const b=class{constructor(i){t(this,i),this.mapChanged=a(this,"mapChanged",7),this.beforeMapChanged=a(this,"beforeMapChanged",7),this._loadedId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.mapInfos=[],this.mapView=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(t){await this._loadMap(t.detail)}async componentWillLoad(){await this._initModules()}render(){const t=this.hidden?"visibility-hidden":"";return i(s,null,i("map-picker",{mapInfos:this.mapInfos}),i("div",{class:`map-height ${t}`,ref:t=>this._mapDiv=t}),i("map-tools",{basemapConfig:this.basemapConfig,class:"box-shadow",enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableLegend:this.enableLegend,enableSearch:this.enableSearch,mapView:this.mapView,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration}))}async _initModules(){const[t,i,s]=await r(["esri/WebMap","esri/views/MapView","esri/widgets/Home"]);this.WebMap=t,this.MapView=i,this.Home=s}async _loadMap(t){let i=null==t?void 0:t.id;if(this._webMapInfo=(""===i||!i)&&this.mapInfos.length>0?this.mapInfos[0]:t,i=this._webMapInfo.id,this._loadedId!==i){const t=new this.WebMap({portalItem:{id:i}});this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"top-left"}),this._loadedId=i,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:"top-right",index:0}),this.mapChanged.emit({id:i,mapView:this.mapView})}))}}_initHome(){this.enableHome?(this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:"top-left",index:3})):this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};b.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.box-shadow{box-shadow:none !important}.visibility-hidden{visibility:hidden}";export{p as card_manager,u as layer_table,b as map_card}
|
@@ -1,20 +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
|
-
/*! *****************************************************************************
|
7
|
-
Copyright (c) Microsoft Corporation.
|
8
|
-
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
10
|
-
purpose with or without fee is hereby granted.
|
11
|
-
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
19
|
-
***************************************************************************** */
|
20
|
-
var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])},e(r,t)},r=function(){return r=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},r.apply(this,arguments)};function t(e){return Object.keys(e).some((function(r){var t=e[r];if(!t)return!1;switch(t&&t.toParam&&(t=t.toParam()),t.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}}))}function n(e){var r={};return Object.keys(e).forEach((function(t){var n,o,i=e[t];if(i&&i.toParam&&(i=i.toParam()),i||0===i||"boolean"==typeof i||"string"==typeof i){var a;switch(i.constructor.name){case"Array":var u=null===(o=null===(n=i[0])||void 0===n?void 0:n.constructor)||void 0===o?void 0:o.name;a="Array"===u?i:"Object"===u?JSON.stringify(i):i.join(",");break;case"Object":a=JSON.stringify(i);break;case"Date":a=i.valueOf();break;case"Function":a=null;break;case"Boolean":a=i+"";break;default:a=i}(a||0===a||"string"==typeof a||Array.isArray(a))&&(r[t]=a)}})),r}function o(e,r){return Array.isArray(r)&&r[0]&&Array.isArray(r[0])?r.map((function(r){return o(e,r)})).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(r)}function i(e){var r=n(e);return Object.keys(r).map((function(e){return o(e,r[e])})).join("&")}var a=function(e,r,t,n,o){e=e||"UNKNOWN_ERROR",r=r||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===r?e:r+": "+e,this.originalMessage=e,this.code=r,this.response=t,this.url=n,this.options=o};(a.prototype=Object.create(Error.prototype)).constructor=a;var u="@esri/arcgis-rest-js",c={httpMethod:"POST",params:{f:"json"}},f=function(t){function n(e,r,n,o,i){void 0===e&&(e="AUTHENTICATION_ERROR"),void 0===r&&(r="AUTHENTICATION_ERROR_CODE");var a=t.call(this,e,r,n,o,i)||this;return a.name="ArcGISAuthError",a.message="AUTHENTICATION_ERROR_CODE"===r?e:r+": "+e,a}return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(n,t),n.prototype.retry=function(e,t){var n=this;void 0===t&&(t=3);var o=0,i=function(a,u){e(n.url,n.options).then((function(e){var t=r(r({},n.options),{authentication:e});return o+=1,s(n.url,t)})).then((function(e){a(e)})).catch((function(e){"ArcGISAuthError"===e.name&&o<t?i(a,u):u("ArcGISAuthError"===e.name&&o>=t?n:e)}))};return new Promise((function(e,r){i(e,r)}))},n}(a);function s(e,o){void 0===o&&(o={params:{f:"json"}});var s=r(r(r({httpMethod:"POST"},c),o),{params:r(r({},c.params),o.params),headers:r(r({},c.headers),o.headers)}),d=[],h=[];if(s.fetch||"undefined"==typeof fetch?(d.push("`fetch`"),h.push("`node-fetch`")):s.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(d.push("`Promise`"),h.push("`es6-promise`")),"undefined"==typeof FormData&&(d.push("`FormData`"),h.push("`isomorphic-form-data`")),!s.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires a `fetch` implementation and global variables for `Promise` and `FormData` to be present in the global scope. You are missing "+d.join(", ")+". We recommend installing the "+h.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var l=s.httpMethod,O=s.authentication,v=s.rawResponse,p=r({f:"json"},s.params),m=null,R={method:l,credentials:s.credentials||"same-origin"};return s.headers&&s.headers["X-Esri-Auth-Client-Id"]&&e.indexOf("/oauth2/platformSelf")>-1&&(R.credentials="include"),(O?O.getToken(e,{fetch:s.fetch}).catch((function(r){return r.url=e,r.options=s,m=r,Promise.resolve("")})):Promise.resolve("")).then((function(o){o.length&&(p.token=o),O&&O.getDomainCredentials&&(R.credentials=O.getDomainCredentials(e));var a={};if("GET"===R.method){p.token&&s.hideToken&&"undefined"==typeof window&&(a["X-Esri-Authorization"]="Bearer "+p.token,delete p.token);var c=""===i(p)?e:e+"?"+i(p);s.maxUrlLength&&c.length>s.maxUrlLength||p.token&&s.hideToken?(R.method="POST",o.length&&s.hideToken&&(p.token=o,delete a["X-Esri-Authorization"])):e=c}var f=new RegExp("/items/.+/updateResources").test(e);return"POST"===R.method&&(R.body=function(e,r){var o=t(e)||r,a=n(e);if(o){var u=new FormData;return Object.keys(a).forEach((function(e){"undefined"!=typeof Blob&&a[e]instanceof Blob?u.append(e,a[e],a.fileName||a[e].name||e):u.append(e,a[e])})),u}return i(e)}(p,f)),R.headers=r(r({},a),s.headers),"undefined"!=typeof window||R.headers.referer||(R.headers.referer=u),t(p)||f||(R.headers["Content-Type"]="application/x-www-form-urlencoded"),s.fetch(e,R)})).then((function(r){if(!r.ok)throw new a(r.statusText,"HTTP "+r.status,r,e,s);if(v)return r;switch(p.f){case"json":case"geojson":return r.json();case"html":case"text":return r.text();default:return r.blob()}})).then((function(r){if("json"!==p.f&&"geojson"!==p.f||v)return r;var t=function(e,r,t,n,o){if(e.code>=400)throw new a(u=e.message,c=e.code,e,r,n);if(e.error){var i=e.error,u=i.message,c=i.code,s=i.messageCode,d=s||c||"UNKNOWN_ERROR_CODE";if(498===c||499===c||"GWM_0003"===s||400===c&&"Unable to generate token."===u)throw o||new f(u,d,e,r,n);throw new a(u,d,e,r,n)}if("failed"===e.status||"failure"===e.status){u=void 0,c="UNKNOWN_ERROR_CODE";try{u=JSON.parse(e.statusMessage).message,c=JSON.parse(e.statusMessage).code}catch(r){u=e.statusMessage||e.message}throw new a(u,c,e,r,n)}return e}(r,e,0,s,m);if(m){var n=e.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0];s.authentication.federatedServers[n]={token:[],expires:new Date(Date.now()+864e5)},m=null}return t}))}function d(e){return"string"!=typeof e||"/"===(e=e.trim())[e.length-1]&&(e=e.slice(0,-1)),e}export{f as A,u as N,r as _,d as c,i as e,s as r}
|