UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.1 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 e}from"../../chunks/tslib.es6.js";import r from"../../request.js";import t from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import o from"../../core/Logger.js";import i from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";let n=class extends t{constructor(){super(...arguments),this.fieldName=null,this.modelName=null,this.label=null,this.min=null,this.max=null,this.mostFrequentValues=null,this.subLayerIds=null}};e([l({type:String})],n.prototype,"fieldName",void 0),e([l({type:String})],n.prototype,"modelName",void 0),e([l({type:String})],n.prototype,"label",void 0),e([l({type:Number})],n.prototype,"min",void 0),e([l({type:Number})],n.prototype,"max",void 0),e([l({json:{read:e=>Array.isArray(e)&&(e.every((e=>"string"==typeof e))||e.every((e=>"number"==typeof e)))?e.slice():null}})],n.prototype,"mostFrequentValues",void 0),e([l({type:[Number]})],n.prototype,"subLayerIds",void 0),n=e([a("esri.layers.support.BuildingSummaryStatistics.BuildingFieldStatistics")],n);let p=class extends(s.LoadableMixin(i.EsriPromiseMixin(t))){constructor(){super(...arguments),this.url=null}get fields(){return this.loaded||"loading"===this.loadStatus?this._get("fields"):(o.getLogger(this).error("building summary statistics are not loaded"),null)}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this._fetchService(r)),Promise.resolve(this)}async _fetchService(e){const t=(await r(this.url,{query:{f:"json"},responseType:"json",signal:e})).data;this.read(t,{origin:"service"})}};e([l({constructOnly:!0,type:String})],p.prototype,"url",void 0),e([l({readOnly:!0,type:[n],json:{read:{source:"summary"}}})],p.prototype,"fields",null),p=e([a("esri.layers.support.BuildingSummaryStatistics")],p);const u=p;export{u as default};