@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.27 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 e from"../../request.js";import r 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 p=class extends r{constructor(){super(...arguments),this.fieldName=null,this.modelName=null,this.label=null,this.min=null,this.max=null,this.mostFrequentValues=null,this.subLayerIds=null}};t([l({type:String})],p.prototype,"fieldName",void 0),t([l({type:String})],p.prototype,"modelName",void 0),t([l({type:String})],p.prototype,"label",void 0),t([l({type:Number})],p.prototype,"min",void 0),t([l({type:Number})],p.prototype,"max",void 0),t([l({json:{read:t=>Array.isArray(t)&&(t.every((t=>"string"==typeof t))||t.every((t=>"number"==typeof t)))?t.slice():null}})],p.prototype,"mostFrequentValues",void 0),t([l({type:[Number]})],p.prototype,"subLayerIds",void 0),p=t([a("esri.layers.support.BuildingSummaryStatistics.BuildingFieldStatistics")],p);let n=class extends(s.LoadableMixin(i.EsriPromiseMixin(r))){constructor(t){super(t),this.url=null,this.customParameters=null}get fields(){return this.loaded||"loading"===this.loadStatus?this._get("fields"):(o.getLogger(this).error("building summary statistics are not loaded"),null)}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._fetchService(e)),Promise.resolve(this)}async _fetchService(t){const r=(await e(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:t})).data;this.read(r,{origin:"service"})}};t([l({constructOnly:!0,type:String})],n.prototype,"url",void 0),t([l({constructOnly:!0})],n.prototype,"customParameters",void 0),t([l({constructOnly:!0})],n.prototype,"apiKey",void 0),t([l({readOnly:!0,type:[p],json:{read:{source:"summary"}}})],n.prototype,"fields",null),n=t([a("esri.layers.support.BuildingSummaryStatistics")],n);export{n as default};