UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 6.21 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as t}from"./chunks/tslib.es6.js";import r from"./Basemap.js";import a from"./WebDocument2D.js";import i from"./core/Error.js";import{property as e}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 s}from"./layers/knowledgeGraph/supportUtils.js";import h 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 u={currentVersion:k,createInitialViewProperties:()=>new y,parseVersion:p.parse,itemType:"Web Link Chart",name:"linkchart",origin:"link-chart"};let C=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 u}async applyLayout(t="organic-standard",a){if(await this.load(),!this.activeLinkChartLayer)throw new i("WebLinkChart:no-link-chart-layer","No link chart layer found");return"geographic-organic-standard"!==t||this.basemap?.baseLayers?.length||(this.basemap=r.fromId("topo-vector"),await(this.basemap?.load())),this.linkChartProperties.layoutType=t,a?.layoutSettings?.chronologicalLayoutSettings&&a.layoutSettings.organicLayoutSettings||!this.linkChartProperties.layoutSettings?this.linkChartProperties.layoutSettings=a?.layoutSettings:this.linkChartProperties.layoutSettings=new h({organicLayoutSettings:a?.layoutSettings?.organicLayoutSettings??this.linkChartProperties.layoutSettings?.organicLayoutSettings,chronologicalLayoutSettings:a?.layoutSettings?.chronologicalLayoutSettings??this.linkChartProperties.layoutSettings?.chronologicalLayoutSettings}),this.activeLinkChartLayer.applyNewLinkChartLayout(t,a)}changeNonspatialDataDisplay(t){if(!this.activeLinkChartLayer)throw new i("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 i("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.addRecords(t,r)}async removeRecords(t){if(await this.load(),!this.activeLinkChartLayer)throw new i("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 i("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 i("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 i("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 i("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 i("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 i("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.linkChartExtent}get entityCount(){if(!this.activeLinkChartLayer)throw new i("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.entityLinkChartDiagramLookup.size}get relationshipCount(){if(!this.activeLinkChartLayer)throw new i("WebLinkChart:no-link-chart-layer","No link chart layer found");return this.activeLinkChartLayer.relationshipLinkChartDiagramLookup.size}get knowledgeGraph(){if(!this.activeLinkChartLayer)throw new i("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 i("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 i("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=s(t);this.add(r,0)}}};t([e({readOnly:!0})],C.prototype,"activeLinkChartLayer",null),t([e({json:{write:{ignoreOrigin:!0}}})],C.prototype,"mapType",void 0),t([e({type:l,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],C.prototype,"linkChartProperties",void 0),t([e({readOnly:!0})],C.prototype,"diagramNodesExtent",null),t([e({readOnly:!0})],C.prototype,"entityCount",null),t([e({readOnly:!0})],C.prototype,"relationshipCount",null),t([e({readOnly:!0})],C.prototype,"knowledgeGraph",null),C=L=t([n("esri.WebLinkChart")],C);const d=C;export{d as default};