@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.4 kB
JavaScript
/*
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 o from"../../core/Accessor.js";import{clone as e}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../portal/PortalItem.js";let i=class extends o{constructor(t){super(t),this._abortController=null,this.attributionEnabled=!0,this.author=null,this.copyright=null,this.customTextElements=null,this.dpi=96,this.fileName=null,this.forceFeatureAttributes=!1,this.format="pdf",this.height=null,this.includeTables=!0,this.id=null,this.state="ready",this.layout="letter-ansi-a-landscape",this.layoutItem=null,this.legendEnabled=void 0,this.northArrowEnabled=void 0,this.scale=null,this.scaleBarEnabled=void 0,this.scaleEnabled=!1,this.title=null,this.width=null}async applyTemplate(t,o){if(t?.id===this.id&&"error"!==t?.state)return;if(this._abortController&&(this._abortController.abort(),this._abortController=null),!t)return;if(this._set("state","pending"),this._resetMapSurroundInfoOptions(),this._set("id",t.id),this.set({layout:t.layout,layoutItem:t.layoutItem}),!t.layoutOptions&&t.layoutItem){const o=new AbortController;if(this._abortController=o,await t.fetchLayoutItemTemplateInfo({signal:this._abortController.signal}),"loaded"!==t.state){if("error"===t.state&&this._set("state","error"),this._abortController!==o)return;return void(this._abortController=null)}this._abortController=null}const r=o?.customLayoutOptions,s=o?.customTextElements??t.layoutTemplateInfo?.layoutOptions?.customTextElements??this.customTextElements;this.set({customTextElements:s?e(s):void 0,format:this.format??t.format,legendEnabled:r?.legend??t.layoutOptions?.legend??this.legendEnabled,northArrowEnabled:r?.northArrow??t.layoutOptions?.northArrow??this.northArrowEnabled,scaleBarEnabled:r?.scaleBar??t.layoutOptions?.scaleBar??this.scaleBarEnabled}),this._set("state","ready")}reset(){this._set("id",null),this._set("state","ready"),this.set({layout:null,layoutItem:null,customTextElements:null}),this._resetMapSurroundInfoOptions()}_resetMapSurroundInfoOptions(){this.set({legendEnabled:void 0,northArrowEnabled:void 0,scaleBarEnabled:void 0})}};t([r()],i.prototype,"attributionEnabled",void 0),t([r()],i.prototype,"author",void 0),t([r()],i.prototype,"copyright",void 0),t([r()],i.prototype,"customTextElements",void 0),t([r()],i.prototype,"dpi",void 0),t([r()],i.prototype,"fileName",void 0),t([r()],i.prototype,"forceFeatureAttributes",void 0),t([r()],i.prototype,"format",void 0),t([r()],i.prototype,"height",void 0),t([r()],i.prototype,"includeTables",void 0),t([r({readOnly:!0})],i.prototype,"id",void 0),t([r({readOnly:!0})],i.prototype,"state",void 0),t([r()],i.prototype,"layout",void 0),t([r({type:l})],i.prototype,"layoutItem",void 0),t([r()],i.prototype,"legendEnabled",void 0),t([r()],i.prototype,"northArrowEnabled",void 0),t([r()],i.prototype,"scale",void 0),t([r()],i.prototype,"scaleBarEnabled",void 0),t([r()],i.prototype,"scaleEnabled",void 0),t([r()],i.prototype,"title",void 0),t([r()],i.prototype,"width",void 0),i=t([s("esri.widgets.Print.TemplateOptions")],i);const a=i;export{a as default};