UNPKG

@arcgis/map-components

Version:
5 lines (4 loc) 6.34 kB
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. v4.32.13 */ import{a,c,d as t}from"./JM4XJJFL.js";import{f as d,g as r}from"./AX2MGWNF.js";import{A as s,B as w,G as p,g as o,r as n}from"./NIZJVZRG.js";var[{watch:v},u,l]=await $arcgis.l(["core/reactiveUtils","views/MapView","WebMap"]);var _=n`@layer{arcgis-map{display:block;height:100%;.esri-view{height:100%;width:100%}}}`,V=a(l,{}),b=a(u,{}),h=class extends w{constructor(){super(...arguments),this._center=void 0,this._extent=void 0,this._itemId=void 0,this._scale=void 0,this._viewpoint=void 0,this._zoom=void 0,this._map=V(this,{editConstructorProperties:this._editMapProperties}),this.view=b(this,{editConstructorProperties:this._editViewProperties}),this.allLayerViews=this.view.allLayerViews,this.autoDestroyDisabled=!1,this.background=this.view.background,this.basemap=this._map.basemap,this.basemapView=this.view.basemapView,this.constraints=this.view.constraints,this.displayFilterDisabled=this.view.displayFilterEnabled,this.fatalError=this.view.fatalError,this.floors=this.view.floors,this.graphics=this.view.graphics,this.ground=this._map.ground,this.highlights=this.view.highlights,this.highlightOptions=this.view.highlightOptions,this.ipsInfo=this._map.ipsInfo,this.layerViews=this.view.layerViews,this.magnifier=this.view.magnifier,this.map=this.view.map,this.navigation=this.view.navigation,this.padding=this.view.padding,this.popup=this.view.popup,this.popupDisabled=this.view.popupEnabled,this.ready=this.view.ready,this.resizeAlign=this.view.resizeAlign,this.resolution=this.view.resolution,this.rotation=this.view.rotation,this.spatialReference=this.view.spatialReference,this.suspended=this.view.suspended,this.theme=this.view.theme,this.timeExtent=this.view.timeExtent,this.timeZone=this.view.timeZone,this.updating=this.view.updating,this.arcgisViewChange=s(),this.arcgisViewClick=t(()=>this.view,"click"),this.arcgisViewDoubleClick=t(()=>this.view,"double-click"),this.arcgisViewDrag=t(()=>this.view,"drag"),this.arcgisViewHold=t(()=>this.view,"hold"),this.arcgisViewImmediateClick=t(()=>this.view,"immediate-click"),this.arcgisViewImmediateDoubleClick=t(()=>this.view,"immediate-double-click"),this.arcgisViewKeyDown=t(()=>this.view,"key-down"),this.arcgisViewKeyUp=t(()=>this.view,"key-up"),this.arcgisViewLayerviewCreate=t(()=>this.view,"layerview-create"),this.arcgisViewLayerviewCreateError=t(()=>this.view,"layerview-create-error"),this.arcgisViewLayerviewDestroy=t(()=>this.view,"layerview-destroy"),this.arcgisViewMouseWheel=t(()=>this.view,"mouse-wheel"),this.arcgisViewPointerDown=t(()=>this.view,"pointer-down"),this.arcgisViewPointerEnter=t(()=>this.view,"pointer-enter"),this.arcgisViewPointerLeave=t(()=>this.view,"pointer-leave"),this.arcgisViewPointerMove=t(()=>this.view,"pointer-move"),this.arcgisViewPointerUp=t(()=>this.view,"pointer-up"),this.arcgisViewReadyChange=s()}static{this.properties={_map:16,view:32,allLayerViews:0,autoDestroyDisabled:5,background:0,basemap:1,basemapView:0,center:1,constraints:0,displayFilterDisabled:5,extent:0,fatalError:0,floors:0,gamepad:32,graphics:0,ground:1,highlights:0,highlightOptions:0,interacting:32,ipsInfo:0,itemId:3,layerViews:0,magnifier:0,map:0,navigating:32,navigation:0,padding:0,popup:0,popupDisabled:5,ready:4,resizeAlign:1,resolution:8,rotation:9,scale:9,spatialReference:0,stationary:32,suspended:7,theme:0,timeExtent:0,timeZone:1,updating:7,viewpoint:0,zoom:9}}static{this.shadowRootOptions=o}static{this.styles=_}get center(){return this.view.center??this._center}set center(i){let e=r(i,this.ready?this.view:void 0);e&&(this.ready&&(this.view.center=e),this._center=e)}get extent(){return this.view.extent??this._extent}set extent(i){this.view.ready||(this._extent=i),i&&!this.extent?.equals(i)&&(this.view.extent=i)}get gamepad(){return this.ready?this.view.input.gamepad:void 0}get interacting(){return this.view.interacting}get itemId(){return this._map.portalItem?.id??this._itemId}set itemId(i){this._itemId=i,this.ready?c.reCreate(this._map,this).then(()=>{this.view.map=this._map}).catch(console.error):this.view.ready!=null&&(this._map.destroy(),this._map=new l(this._editMapProperties({portalItem:{id:this._itemId}})),this.view.map=this._map)}get navigating(){return this.view.navigating}get scale(){return this.view.scale??this._scale}set scale(i){this.ready&&(this.view.scale=i),this._scale=i}get stationary(){return this.view.stationary}get viewpoint(){return this.view.viewpoint??this._viewpoint}set viewpoint(i){this.ready&&d(this.viewpoint,i)&&(this.view.viewpoint=i),this._viewpoint=i}get zoom(){return this.view.zoom??this._zoom}set zoom(i){this.ready&&(this.view.zoom=i),this._zoom=i}async addLayer(i,e){this.map?.add(i,e)}async addLayers(i,e){this.map?.addMany(i,e)}async addTable(i){this.map?.tables.add(i)}async addTables(i,e){this.map?.tables.addMany(i,e)}async closePopup(){this.view?.closePopup()}async destroy(){await this.manager.destroy()}async goTo(i,e){return await this.view?.goTo(i,e)}async hitTest(i,e){return await this.view?.hitTest(i,e)}async openPopup(i){await this.view?.openPopup(i)}async takeScreenshot(i){return await this.view?.takeScreenshot(i)}toMap(i){return this.view.toMap(i)}toScreen(i,e){return this.view.toScreen(i,e)}async tryFatalErrorRecovery(){this.view?.tryFatalErrorRecovery()}async whenLayerView(i){return await this.view?.whenLayerView(i)}load(){this.el.childElem=document.createElement("div"),this.el.append(this.el.childElem),this.view.container??=this.el.childElem}loaded(){this.manager.onLifecycle(()=>[v(()=>this.view.stationary,()=>{this.arcgisViewChange.emit()},{initial:!0}),v(()=>this.view.ready,()=>this.arcgisViewReadyChange.emit(),{initial:this.view.ready})])}_editMapProperties(i){this.map&&(this._map=this.map),this.itemId&&(i.portalItem={id:this.itemId});let{basemap:e,...m}=i;e||(i=m);let{ground:g,...y}=i;return g||(i=y),i}async _editViewProperties(i){await this.manager.use(this._map),this.view.ui||(i.ui={components:["attribution"]}),i.map??=this._map;let e=r(this.center,void 0);return e&&(i.center=e),this.viewpoint&&(i.viewpoint=this.viewpoint),this.scale!==void 0&&(i.scale=this.scale),this.extent&&(i.extent=this.extent),this.zoom!==void 0&&(i.zoom=this.zoom),i}};p("arcgis-map",h);export{h as ArcgisMap};