UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.98 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import i from"../../core/ReactiveMap.js";import{property as r,subclass as o}from"../../core/accessorSupport/decorators.js";let a=class extends t{constructor(e){super(e),this._featureTitleMap=null,this.editorItem=null,this.features=[],this.initialFeatures=[],this.keyFeature=null,this.edits=null,this.mergedGeometry=null,this.parent=null,this.temporaryHighlightFeature=null,this.viewModel=null}async initialize(){const{features:e,timeZone:t}=this,{layer:r}=this.editorItem;if(this.keyFeature??=e[0],0===this.initialFeatures.length&&(this.initialFeatures=e.slice()),!("getFeatureTitle"in r))return;const o=await Promise.all(e.map(async e=>[e,await r.getFeatureTitle(e,{fetchMissingFields:!1,timeZone:t})]));this._featureTitleMap=new i(o)}get _initialFeatureMap(){const e=new Map(this.initialFeatures.map(e=>[e.getObjectId(),e])),t=new Map(this.features.map(e=>[e.getObjectId(),e])),i=new Map;for(const[r,o]of t){const t=e.get(r);r&&t&&i.set(o,t)}return i}get timeZone(){return this.viewModel.view?.timeZone}set timeZone(e){null==e?this._clearOverride("timeZone"):this._override("timeZone",e)}getFeatureTitle(e){return this._featureTitleMap?.get(e)}getInitialFeature(e){return this._initialFeatureMap.get(e)}};e([r()],a.prototype,"_featureTitleMap",void 0),e([r()],a.prototype,"_initialFeatureMap",null),e([r({constructOnly:!0})],a.prototype,"editorItem",void 0),e([r({constructOnly:!0})],a.prototype,"features",void 0),e([r()],a.prototype,"initialFeatures",void 0),e([r()],a.prototype,"keyFeature",void 0),e([r()],a.prototype,"edits",void 0),e([r()],a.prototype,"mergedGeometry",void 0),e([r()],a.prototype,"parent",void 0),e([r()],a.prototype,"temporaryHighlightFeature",void 0),e([r()],a.prototype,"timeZone",null),e([r()],a.prototype,"viewModel",void 0),a=e([o("esri.widgets.Editor.MergeFeaturesWorkflowData")],a);const s=a;export{s as default};