UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 3.16 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 r}from"../chunks/tslib.es6.js";import e from"../request.js";import{clone as s}from"../core/lang.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{writer as o}from"../core/accessorSupport/decorators/writer.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as l}from"./mixins/VisualVariablesMixin.js";import{DictionaryLoader as c}from"./support/DictionaryLoader.js";var p;let u=p=class extends(l(a)){constructor(r){super(r),this.config=null,this.fieldMap=null,this.scaleExpression=null,this.scaleExpressionTitle=null,this.url=null,this.type="dictionary"}get _loader(){const r=this.getDictionaryInfo();return new c(this.url,this.config,this.fieldMap??{},r)}writeData(r,e){r&&(e.scalingExpressionInfo={expression:r,returnType:"number"})}writeVisualVariables(r,e,s,t){t?.origin||super.writeVisualVariables(r,e,s,t)}clone(){return new p({config:s(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:s(this.fieldMap),url:s(this.url),visualVariables:s(this.visualVariables)})}async getSymbolAsync(r,e,s=!0){return this._loader.getSymbolAsync(r,e,s)}async getSymbolForControlString(r,e,s){return this._loader.getSymbolForControlString(r,e,s)}getDictionaryInfo(){return this._dictionaryInfoPromise||(this._dictionaryInfoPromise=this._fetchDictionaryInfo()),this._dictionaryInfoPromise}async collectRequiredFields(r,e){await this.collectVVRequiredFields(r,e),this.scaleExpression&&await n(r,e,this.scaleExpression);for(const s in this.fieldMap){const t=this.fieldMap[s];e.has(t)&&r.add(t)}}get arcadeRequired(){return!0}getSymbol(){return null}get symbols(){return[]}getAttributeHash(){return this.visualVariables?.reduce(((r,e)=>r+e.getAttributeHash()),"")??""}getMeshHash(){return`${this.url}-${JSON.stringify(this.fieldMap)}`}async _fetchDictionaryInfo(){const{data:r}=await e(this.url+"/resources/styles/dictionary-info.json",{responseType:"json",query:{f:"json"}});return r}};r([t({type:c})],u.prototype,"_loader",null),r([t({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],u.prototype,"config",void 0),r([t({type:Object,json:{write:!0}})],u.prototype,"fieldMap",void 0),r([t({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],u.prototype,"scaleExpression",void 0),r([o("scaleExpression")],u.prototype,"writeData",null),r([t({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(r){return{enabled:!!r&&!!this.scaleExpression}}}}})],u.prototype,"scaleExpressionTitle",void 0),r([t({type:String,json:{write:!0}})],u.prototype,"url",void 0),r([o("visualVariables")],u.prototype,"writeVisualVariables",null),u=p=r([i("esri.renderers.DictionaryRenderer")],u);export{u as default};