UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.01 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import{isSome as e}from"../../../core/arrayUtils.js";import{property as i,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isISelectableLayerWithObjectIds as l}from"../../../views/support/selectionUtils.js";import{fetchThumbnail as o}from"../symbolPreviewUtils.js";import s from"./ItemBase.js";let a=class extends s{constructor(t){super(t),this._thumbnail=null,this.graphic=null,this.layer=null,this.layerItem=null,this.thumbnailSize=24}get _filterTerms(){return[this.title,this.layerItem.title,this.layerItem.groupLayerItem?.title].filter(e)}get identifier(){return l(this.layer)&&null!=this.objectId?this.objectId:this.graphic}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get objectId(){return this.graphic.getObjectId()}get title(){const{objectId:t}=this;if(null!=t)return this.layerItem.featureTitleMap.get(t)||`${t}`}get thumbnail(){return this._thumbnail??void 0}get thumbnailKey(){return`${this.key}-${this.graphic.uid}`}get visible(){const{_filterTerms:t,viewModel:{activeLayerItem:e,filterText:i}}=this;if(e&&e.layer!==this.layer)return!1;if(null==i||""===i||!t.length)return!0;const r=new RegExp(i,"iu");return t.some(t=>r.test(t))}async fetchThumbnail(t){return this._thumbnail=await o(this.graphic,this.layer,{maxSize:this.thumbnailSize,ariaLabel:t?.ariaLabel})}};t([i()],a.prototype,"_filterTerms",null),t([i()],a.prototype,"_thumbnail",void 0),t([i()],a.prototype,"graphic",void 0),t([i()],a.prototype,"identifier",null),t([i()],a.prototype,"key",null),t([i()],a.prototype,"layer",void 0),t([i()],a.prototype,"layerItem",void 0),t([i()],a.prototype,"objectId",null),t([i()],a.prototype,"title",null),t([i()],a.prototype,"thumbnail",null),t([i()],a.prototype,"thumbnailKey",null),t([i()],a.prototype,"thumbnailSize",void 0),t([i()],a.prototype,"visible",null),a=t([r("esri.widgets.support.SelectionList.FeatureItem")],a);const n=a;export{n as default};