@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.96 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 e}from"../../chunks/tslib.es6.js";import r from"../../core/Collection.js";import{handlesGroup as t,makeHandle as s}from"../../core/handleUtils.js";import i from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as o}from"../../core/promiseUtils.js";import{sqlAnd as n}from"../../core/sql.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";const l=Symbol(),u=u=>{let y=class extends u{constructor(){super(...arguments),this.layerViews=new r,this._debouncedUpdate=a((async()=>{const{layer:e,parent:r}=this,t=r?.footprintLayerView;let s=[];const i=this._createQuery();if(i&&t){const{features:r}=await t.queryFeatures(i);this.suspended||(s=r.map((r=>e.acquireLayer(r))))}this.removeHandles(l),this.addHandles(s,l)}))}get creatingLayerViews(){return this.view?.layerViewManager.isCreatingLayerViewsForLayer(this.layer)??!1}isUpdating(){return this.creatingLayerViews||this.layer.updating||this.layerViews.some((e=>e.updating))}enableLayerUpdates(){return t([this._updatingHandles.addWhen((()=>!1===this.parent?.footprintLayerView?.dataUpdating),(()=>this.updateLayers())),this._updatingHandles.add((()=>[this.layer.maximumVisibleSublayers,this.layer.parent?.orderBy,this.parent?.footprintLayerView?.filter,this.parent?.footprintLayerView?.timeExtent,this.suspended]),(()=>this.updateLayers())),s((()=>this.removeHandles(l)))])}updateLayers(){this.suspended?this.removeHandles(l):this._updatingHandles.addPromise(o(this._debouncedUpdate()).catch((e=>{i.getLogger(this).error(e)})))}_createQuery(){const e=this.parent?.footprintLayerView,r=this.layer?.parent;if(!e||!r||r.destroyed)return null;const{layer:{maximumVisibleSublayers:t},view:{scale:s}}=this;if(!t)return null;const{itemTypeField:i,itemSourceField:a,itemNameField:o,minScaleField:d,maxScaleField:p,objectIdField:l,orderBy:u}=r,y=n(`${d} IS NULL OR ${s} <= ${d} OR ${d} = 0`,`${p} IS NULL OR ${s} >= ${p}`),c=u?.find((e=>e.field&&!e.valueExpression)),m=e.createQuery();if(m.returnGeometry=!1,m.num=t,m.outFields=[l,a,o],m.where=n(m.where,y),null!=this.unsupportedItemTypes){const e=`${i} NOT IN (${this.unsupportedItemTypes.map((e=>`'${e}'`))})`;m.where=n(m.where,e)}return c?.field&&(m.orderByFields=[`${c.field} ${"descending"===c.order?"DESC":"ASC"}`],m.outFields.push(c.field)),m}};return e([d({readOnly:!0})],y.prototype,"creatingLayerViews",null),e([d()],y.prototype,"layer",void 0),e([d()],y.prototype,"layerViews",void 0),e([d({readOnly:!0})],y.prototype,"unsupportedItemTypes",void 0),e([d()],y.prototype,"parent",void 0),e([d({readOnly:!0})],y.prototype,"isUpdating",null),y=e([p("esri.views.layers.CatalogDynamicGroupLayerView")],y),y};export{u as default};