@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.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{isSome as r}from"../../../core/arrayUtils.js";import t from"../../../core/Collection.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../LayerList/ListItem.js";import{canDisplayLayer as n}from"../../LayerList/support/layerListUtils.js";import{isValidSnappingLayer as a}from"./snappingLayerListUtils.js";var l;let p=l=class extends s{constructor(e){super(e),this.children=new t,this.parent=null}get enabled(){const{children:e}=this;if(0===e.length)return null!=this.featureSource&&this.featureSource.enabled?"enabled":"disabled";let r=!1,t=!1;for(const i of e){if("indeterminate"===i.enabled)return i.enabled;if("enabled"===i.enabled?r=!0:"disabled"===i.enabled&&(t=!0),t&&r)return"indeterminate"}return t?"disabled":"enabled"}get childLayerIds(){return this.children.toArray().flatMap((e=>[e.layer?.id,...e.childLayerIds]))}get featureSource(){const{layer:e,getFeatureSnappingSources:r}=this;return r().find((r=>r.layer===e))}_initializeChildLayers(e){if(!e)return;const r=e.filter(a);super._initializeChildLayers(r)}_createChildItems(e){return e.map((e=>n(e)?new l({layer:e,parent:this,view:this.view,getFeatureSnappingSources:this.getFeatureSnappingSources}):null)).filter(r).reverse()}};e([i()],p.prototype,"enabled",null),e([i()],p.prototype,"children",void 0),e([i()],p.prototype,"childLayerIds",null),e([i()],p.prototype,"featureSource",null),e([i({constructOnly:!0})],p.prototype,"getFeatureSnappingSources",void 0),e([i()],p.prototype,"parent",void 0),p=l=e([o("esri.widgets.support.SnappingControls.SnappingListItem")],p);export{p as SnappingListItem};