UNPKG

@arcgis/map-components

Version:
2 lines 3.74 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import{b as f}from"./4TLYAVND.js";import c from"./FT372QJV.js";import b from"./R3NYK6BO.js";import a from"./HFRXDFTO.js";import{a as p}from"./PC4PAQXQ.js";import{O as T,U as x,a as _,b as o}from"./WUJCCZQC.js";import"./3TTFCHAA.js";export default $arcgis.t(([{watch:w,when:y},I,L,A,{compileExpression:E},{b:u,e:d},,{p:k}])=>{var J=_`.loading-container{display:flex;justify-content:center;padding:var(--calcite-spacing-md) 0;width:100%}`,$=1,v=class extends T{constructor(){super(...arguments),this._compileThrottled=f(this._startCompile,$),this._evaluateThrottled=f(this._startEvaluate,$),this.headingLevel=2}static{this.properties={_compileTask:16,_evaluateTask:16,values:0,fieldInfoMap:0,expressionInfo:0,graphic:0,headingLevel:9,interceptor:0,location:0,messages:0,spatialReference:0,map:0,view:0}}static{this.styles=J}loaded(){this.manager.onLifecycle(()=>[w(()=>[this.expressionInfo,this.graphic],()=>this._compileThrottled(),{initial:!0}),y(()=>{if(!this._compileTask?.finished)return null;let t=this._compileTask.value,s=t?.dependencies,{view:e}=this;return[t,this.spatialReference,this.map,e,s?.has("view-scale")&&e&&"scale"in e?e.scale:null,s?.has("view-time-extent")?e?.timeExtent?.start:null,s?.has("view-time-extent")?e?.timeExtent?.end:null]},([t])=>this._evaluateThrottled(t)),{remove:()=>this._cancelThrottles()}])}_cancelThrottles(){this._compileThrottled.cancel(),this._evaluateThrottled.cancel()}_startCompile(){this._evaluateTask=p(this._evaluateTask),this._compileTask=p(this._compileTask),this._compileTask=d(async t=>{let{expressionInfo:s,graphic:e}=this,a=s?.expression;if(!a||!e)return null;let n=await E({expression:a,graphic:e});return u(t),n})}_startEvaluate(t){this._evaluateTask=p(this._evaluateTask),this._evaluateTask=d(async s=>{let{graphic:e}=this;if(!t||!e)return null;let{interceptor:a,spatialReference:n,map:i,location:r,view:l}=this,c=await t.evaluate({graphic:e,interceptor:a,location:r,map:i,options:{signal:s},spatialReference:n,view:l});u(s);let g=c&&"castAsJsonAsync"in c&&typeof c.castAsJsonAsync=="function"?c:null;if(!g)return null;let h=await g.castAsJsonAsync(s);u(s);let m=h?.type;return m==="media"?I.fromJSON(h):m==="text"?A.fromJSON(h):m==="fields"?L.fromJSON(h):null})}render(){let t=!this._compileTask?.finished||!this._evaluateTask?.finished;return o`<div class="root">${t?this._renderLoading():this._evaluateTask?.value?this._renderContent():null}</div>`}_renderContent(){let{values:t,fieldInfoMap:s}=this,e=this._evaluateTask?.value,a=e?.type,n={...t,...e?.attributes};if(!a)return null;if(a==="text"){let{text:i}=e;if(!i)return null;let r=k({values:n,fieldInfoMap:s??new Map,globalValues:n,layer:void 0,text:i});return o`<arcgis-feature-content .creator=${r} .graphic=${this.graphic}></arcgis-feature-content>`}else if(a==="media"){let{title:i,description:r,mediaInfos:l}=e;return!l?.length&&!i&&!r?null:o`<arcgis-feature-media .heading=${i??""} .values=${n} .formattedValues=${n} .description=${r??""} .mediaInfos=${l??[]} .messages=${this.messages} .headingLevel=${this.headingLevel}></arcgis-feature-media>`}else if(a==="fields"){let{title:i,description:r,fieldInfos:l}=e;return!l?.length&&!i&&!r?null:o`<arcgis-feature-fields .fieldInfos=${l??[]} .heading=${i??""} .values=${n} .description=${r??""} .headingLevel=${this.headingLevel} .messages=${this.messages}></arcgis-feature-fields>`}return null}_renderLoading(){return o`<div class="loading-container"><calcite-loader inline label></calcite-loader></div>`}};x("arcgis-feature-expression",v);return v},"core/reactiveUtils","popup/content/MediaContent","popup/content/FieldsContent","popup/content/TextContent","applications/Components/arcadeFeatureUtils",a,b,c)