12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import s from"../../core/Logger.js";import{isSome as i,isNone as l}from"../../core/maybe.js";import{watch as n,initial as a}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{renderPreviewHTML as u}from"../../symbols/support/symbolUtils.js";var c;const y="esri.widgets.FeatureTemplates.TemplateItem";let h=c=class extends(o(r)){constructor(t){super(t),this._activeFetchInfo={id:null,request:null},this.layer=null,this.template=null,this.thumbnail=null}initialize(){this.handles.add(n((()=>{const{layer:t}=this;return[t&&"renderer"in t?t.renderer:null,this.template]}),(()=>{this._activeFetchInfo.id=null,this._activeFetchInfo.request=null,this._set("thumbnail",null)}),a))}get description(){return this.template?.description}set description(t){this.template&&(this.template.description=t)}get label(){return this.template?.name}set label(t){this.template&&(this.template.name=t)}clone(){const t=i(this.thumbnail)?this.thumbnail.cloneNode(!0):null,e=new c({layer:this.layer,template:this.template});return e._set("thumbnail",t),e}static async fetchThumbnail(t,e){if(f(t))return s.getLogger(y).warn("Thumbnails for sublayers of a SubtypeGroupLayer are not yet supported."),null;const r=await d(t,e);if(l(r))return null;const o={maxSize:36};"dictionary"===t.renderer?.type&&(o.fieldMap=t.renderer.fieldMap,o.feature={attributes:e.prototype.attributes});return await u(r,o)}};async function d(t,r){const{renderer:o}=t;if(o){const t=new e({attributes:r.prototype.attributes}),s=await o.getSymbolAsync(t);if(s)return s}return b(t)}async function b(t){const{geometryType:e}=t,r="point"===e||"multipoint"===e?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===e?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===e||"mesh"===e||"multipatch"===e?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}function f(t){return"subtype-group"===t.type}t([p()],h.prototype,"description",null),t([p()],h.prototype,"label",null),t([p()],h.prototype,"layer",void 0),t([p()],h.prototype,"template",void 0),t([p({readOnly:!0})],h.prototype,"thumbnail",void 0),h=c=t([m(y)],h);const j=h;export{j as default};
|