UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 6.07 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as t}from"./chunks/tslib.es6.js";import r from"./Basemap.js";import a from"./WebDocument2D.js";import e from"./core/Error.js";import{property as i}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import"./core/RandomLCG.js";import{subclass as n}from"./core/accessorSupport/decorators/subclass.js";import{getDefaultChronologicalOverlayLayerId as o,getChronologicalOverlay as h}from"./layers/knowledgeGraph/supportUtils.js";import s from"./linkChart/LayoutSettings.js";import l from"./linkChart/LinkChartProperties.js";import c from"./linkChart/NonspatialDataDisplay.js";import y from"./webmap/InitialViewProperties.js";import{currentVersion as k}from"./webmap/utils.js";import{Version as p}from"./webmap/Version.js";var L;const C={currentVersion:k,createInitialViewProperties:()=>new y,parseVersion:p.parse,itemType:"Web Link Chart",name:"linkchart",origin:"link-chart"};let d=L=class extends a{constructor(t){super(t),this.mapType="webLinkChart",this.linkChartProperties=new l}get activeLinkChartLayer(){return this.layers.find((({type:t})=>"link-chart"===t))}get context(){return C}async applyLayout(t="organic-standard",a){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");"geographic-organic-standard"!==t||this.basemap?.baseLayers?.length||(this.basemap=r.fromId("topo-vector"),await(this.basemap?.load())),this.linkChartProperties.layoutType=t;const i=a?.layoutSettings??this.linkChartProperties.layoutSettings??new s;this.linkChartProperties.layoutSettings=i;const n={...a,layoutSettings:i};return this.activeLinkChartLayer.applyNewLinkChartLayout(t,n)}changeNonspatialDataDisplay(t){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");this.linkChartProperties.nonspatialDataDisplay||(this.linkChartProperties.nonspatialDataDisplay=new c),this.linkChartProperties.nonspatialDataDisplay.mode=t}async addRecords(t,r){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.addRecords(t,r)}async createSublayerForNamedType(t){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.createSublayerForNamedType(t)}async removeRecords(t){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.removeRecords(t)}async expand(t,r){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");const a=await this.activeLinkChartLayer.expand(t,r);return a?.records??[]}async refreshLinkChartData(t){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.refreshLinkChartCache(t)}async connectBetweenEntities(t,r){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");const a=await this.activeLinkChartLayer.connectBetweenEntities(t,r);return a?.records??[]}async connectFromEntities(t,r){if(await this.load(),!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");const a=await this.activeLinkChartLayer.connectFromEntities(t,r);return a?.records??[]}getMemberIdsByType(t){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return Array.from(this.activeLinkChartLayer?.dataManager.sublayerCaches.get(t)?.keys()??[])}get diagramNodesExtent(){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.linkChartExtent}get entityCount(){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.entityLinkChartDiagramLookup.size}get relationshipCount(){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.relationshipLinkChartDiagramLookup.size}get knowledgeGraph(){if(!this.activeLinkChartLayer)throw new e("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer?.knowledgeGraph}add(t,r){if(this.activeLinkChartLayer&&"type"in t&&"link-chart"===t.type)throw new e("linkchart:one-link-chart-layer","Web Link Charts can only have one Link Chart Layer, another cannot be added");if(super.add(t,r),"type"in t&&"link-chart"===t.type){const r=t.initializationLinkChartConfig?.layoutMode;r&&(this.linkChartProperties.layoutType=r);const a=t.initializationLinkChartConfig?.layoutSettings;a&&(this.linkChartProperties.layoutSettings=a)}}static fromJSON(t){if(t)return new L({resourceInfo:t});throw new e("linkchart:empty-resource","Expected a JSON resource but got nothing")}handleChronologicalOverlay(){if(!this.activeLinkChartLayer)return;const t=this.activeLinkChartLayer,r=this.findLayerById(o());if(r&&this.remove(r),"chronological-mono-timeline"===this.linkChartProperties.layoutType||"chronological-multi-timeline"===this.linkChartProperties.layoutType){const r=h(t);this.add(r,0)}}};t([i({readOnly:!0})],d.prototype,"activeLinkChartLayer",null),t([i({json:{write:{ignoreOrigin:!0}}})],d.prototype,"mapType",void 0),t([i({type:l,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],d.prototype,"linkChartProperties",void 0),t([i({readOnly:!0})],d.prototype,"diagramNodesExtent",null),t([i({readOnly:!0})],d.prototype,"entityCount",null),t([i({readOnly:!0})],d.prototype,"relationshipCount",null),t([i({readOnly:!0})],d.prototype,"knowledgeGraph",null),d=L=t([n("esri.WebLinkChart")],d);const u=d;export{u as default};