UNPKG

@arcgis/map-components

Version:
2 lines 11.6 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import g from"./FT372QJV.js";import f from"./R3NYK6BO.js";import e from"./KA7BM2DQ.js";import{a as V}from"./HZFVK34O.js";import d from"./LKOVDQTE.js";import c from"./OAWV35F7.js";import{h as F}from"./AKBXFBDL.js";import"./LMBRORN7.js";import a from"./5E6WEUZS.js";import{d as x}from"./PBSJQPB2.js";import{N as y,O as I,P as M,R as b,U as C,a as $,b as n,x as w}from"./WUJCCZQC.js";import"./3TTFCHAA.js";export default $arcgis.t(([{substitute:k},{renderingSanitizer:B},N,{watch:H},{stripHTML:Z},P,,,,R,,{a:_,b:L,c:T,d:E,e:A,i:D,p:c}])=>{var z=$`:host{display:flex;flex:1 1 auto;background-color:var(--calcite-color-foreground-1);--calcite-color-background: var(--calcite-color-foreground-1)}.root{flex:1 1 auto}.root calcite-icon{box-sizing:content-box}.loading-container{display:flex;justify-content:center;padding:var(--calcite-spacing-md) 0;width:100%}.content-element{margin-bottom:var(--calcite-spacing-lg);padding:0 var(--calcite-spacing-sm);display:flex;flex-direction:column}.content-element:only-child,.content-element:last-child{margin-bottom:var(--calcite-spacing-xxs)}.last-edited-info{padding-top:var(--calcite-spacing-xs);font-size:var(--calcite-font-size-sm)}`,U=R(P),v=class extends I{constructor(){super(...arguments),this.messages=V(),this._rootFlowNode=null,this.internalFlowItems=new N,this.flowType="feature",this.viewModel=U(this),this.view=this.viewModel.view,this.icon="icon",this.isFeatureFromTable=this.viewModel.isFeatureFromTable,this.graphic=this.viewModel.graphic,this.defaultPopupTemplateEnabled=this.viewModel.defaultPopupTemplateEnabled,this.headingLevel=2,this.spatialReference=this.viewModel.spatialReference,this.timeZone=this.viewModel.timeZone,this.heading=this.viewModel.title,this.map=this.viewModel.map,this.chartAnimationDisabled=this.viewModel.abilities.chartAnimation,this.hideHeading=!1,this.hideContent=!1,this.hideAttachmentsContent=!1,this.hideCustomContent=!1,this.hideExpressionContent=!1,this.hideFieldsContent=!1,this.hideMediaContent=!1,this.showRelationshipContent=!1,this.hideTextContent=!1,this.showUtilityNetworkContent=!1,this.hideLastEditedInfo=!1,this.autoDestroyDisabled=!1,this.location=this.viewModel.location,this.state=this.viewModel.state,this.arcgisPropertyChange=F()("flowItems","state"),this.arcgisReady=w()}static{this.properties={popupTemplate:16,sourceLayer:16,fieldInfoMap:16,values:16,globalValues:16,internalFlowItems:16,flowType:1,viewModel:0,view:0,flowItems:0,referenceElement:1,icon:1,isFeatureFromTable:36,graphic:0,defaultPopupTemplateEnabled:5,headingLevel:9,spatialReference:0,timeZone:1,heading:0,map:0,chartAnimationDisabled:5,hideHeading:5,hideContent:5,hideAttachmentsContent:5,hideCustomContent:5,hideExpressionContent:5,hideFieldsContent:5,hideMediaContent:5,showRelationshipContent:5,hideTextContent:5,showUtilityNetworkContent:5,hideLastEditedInfo:5,autoDestroyDisabled:5,messageOverrides:0,label:1,location:0,state:32}}static{this.styles=z}get popupTemplate(){return T(this.graphic,this.defaultPopupTemplateEnabled)??void 0}get sourceLayer(){return E(this.graphic)}get fieldInfoMap(){return _(L(this.popupTemplate),this.sourceLayer)}get values(){return this.graphic?.attributes??{}}get globalValues(){return this.viewModel.formattedAttributes?.global??{}}async destroy(){this._removeFlowItems(),await this.manager.destroy()}async nextMedia(e){return this.viewModel.nextMedia(e)}async previousMedia(e){return this.viewModel.previousMedia(e)}async setActiveMedia(e,t){return this.viewModel.setActiveMedia(e,t)}async updateGeometry(){return await this.viewModel.updateGeometry()}loaded(){this.manager.onLifecycle(()=>[H(()=>[this.internalFlowItems?.length],()=>this._setFocus())])}_removeFlowItems(){this.internalFlowItems?.destroyAll()}_storeRootFlowNode(e){this._rootFlowNode=e}_setFocus(){this._rootFlowNode?.setFocus()}_handleDrillInBackClick(){this.internalFlowItems?.pop()?.destroy()}render(){let{state:e}=this.viewModel,t=n`<div class="container">${e==="error"?this._renderError():this._renderContentContainer()}</div>`;return n`<div class="root">${t}</div>`}_renderError(){let{messages:e,hideHeading:t}=this;return n`<calcite-notice icon=exclamation-mark-circle kind=danger open scale=s>${t?null:n`<div slot=title>${e.error}</div>`}<div slot=message>${e.loadingError}</div></calcite-notice>`}_renderAttachments(e){let{values:t,fieldInfoMap:i,sourceLayer:o,globalValues:s}=this,a=c({values:t,fieldInfoMap:i,globalValues:s,layer:o,text:e.title}),r=c({values:t,fieldInfoMap:i,globalValues:s,layer:o,text:e.description});return n`<arcgis-feature-attachments .headingLevel=${this.headingLevel} .heading=${a} class="content-element" .displayType=${e.displayType} .attachmentKeywords=${e.attachmentKeywords??void 0} .attachmentTypes=${e.attachmentTypes??void 0} .orderByFields=${e.orderByFields??void 0} .graphic=${this.graphic??void 0} .description=${r} .messages=${this.messages}></arcgis-feature-attachments>`}_renderCustom(e){return n`<arcgis-feature-content .creator=${e.creator} .destroyer=${e.destroyer??void 0} .graphic=${this.graphic??void 0} class="content-element"></arcgis-feature-content>`}_renderFields(e,t){let i=this.viewModel.formattedAttributes,{values:o,fieldInfoMap:s,sourceLayer:a,popupTemplate:r,globalValues:l,graphic:d}=this,h=!!e?.fieldInfos,p=(e.fieldInfos??r?.fieldInfos??[])?.filter(({fieldName:f})=>!!f&&(D(f)||A(f)||f in o)),u=r?.expressionInfos,m=c({values:o,fieldInfoMap:s,globalValues:l,layer:a,text:e.title}),g=c({values:o,fieldInfoMap:s,globalValues:l,layer:a,text:e.description});return n`<arcgis-feature-fields .headingLevel=${this.headingLevel} .heading=${m} class="content-element" .messages=${this.messages} .graphic=${d??void 0} .isContentFieldInfos=${h} .layer=${a} .description=${g} .values=${{...i?.global,...i?.content?.[t]}} .fieldInfos=${p} .expressionInfos=${u??void 0}></arcgis-feature-fields>`}_renderMedia(e,t){let{values:i,graphic:o,fieldInfoMap:s,sourceLayer:a,popupTemplate:r,globalValues:l}=this,{formattedAttributes:d,relatedInfos:h}=this.viewModel,p={...d?.global,...d?.content?.[t]},u=c({values:i,fieldInfoMap:s,globalValues:l,layer:a,text:e.title}),m=c({values:i,fieldInfoMap:s,globalValues:l,layer:a,text:e.description});return n`<arcgis-feature-media .activeMediaInfoIndex=${e.activeMediaInfoIndex??0} .chartAnimationDisabled=${this.chartAnimationDisabled} .headingLevel=${this.headingLevel} .heading=${u} class="content-element" .description=${m} .values=${i} .layer=${a} .graphic=${o??void 0} .messages=${this.messages} .fieldInfoMap=${s} .mediaInfos=${e.mediaInfos??[]} .popupTemplate=${r??void 0} .relatedInfos=${h} .formattedValues=${p}></arcgis-feature-media>`}_renderText(e){return n`<arcgis-feature-content .creator=${e.text} .graphic=${this.graphic??void 0} class="content-element"></arcgis-feature-content>`}_renderExpression(e,t){let i=this.viewModel.formattedAttributes,{fieldInfoMap:o}=this;return n`<arcgis-feature-expression .expressionInfo=${e.expressionInfo} .map=${this.map??void 0} .spatialReference=${this.spatialReference??void 0} .view=${this.viewModel.view??void 0} .graphic=${this.graphic??void 0} .location=${this.location??void 0} .headingLevel=${this.headingLevel} class="content-element" .interceptor=${this.viewModel.interceptor} .messages=${this.messages} .fieldInfoMap=${o} .values=${{...i?.global,...i?.content?.[t]}}></arcgis-feature-expression>`}_renderRelationship(e,t){let{values:i,graphic:o,fieldInfoMap:s,sourceLayer:a,globalValues:r}=this,{displayCount:l,orderByFields:d,relationshipId:h}=e,{formattedAttributes:p,view:u}=this.viewModel,m={...p?.global,...p?.content?.[t]},g=c({values:i,fieldInfoMap:s,globalValues:r,layer:a,text:e.title}),f=c({values:i,fieldInfoMap:s,globalValues:r,layer:a,text:e.description});return n`<arcgis-feature-relationship .autoDestroyDisabled=${this.autoDestroyDisabled} class="content-element" .flowItems=${this.flowItems??this.internalFlowItems} .description=${f} .layer=${a} .map=${this.map??void 0} .displayCount=${l} .graphic=${o??void 0} .heading=${g} .headingLevel=${this.headingLevel} .messages=${this.messages} .orderByFields=${d??void 0} .relationshipId=${h??void 0} .spatialReference=${this.spatialReference??void 0} .timeZone=${this.timeZone??void 0} .values=${m} .view=${u??void 0}></arcgis-feature-relationship>`}_renderAssociation(e){let{fieldInfoMap:t,globalValues:i,graphic:o,messages:s,sourceLayer:a,values:r}=this,l=c({values:r,fieldInfoMap:t,globalValues:i,layer:a,text:e.title}),d=c({values:r,fieldInfoMap:t,globalValues:i,layer:a,text:e.description});return n`<arcgis-feature-utility-network-associations .autoDestroyDisabled=${this.autoDestroyDisabled} .associationTypes=${e.associationTypes} class="content-element" .description=${d} .flowItems=${this.flowItems??this.internalFlowItems} .graphic=${o??void 0} .heading=${l} .headingLevel=${this.headingLevel} .layer=${a} .map=${this.map??void 0} .messages=${s} .parentFeatureViewModel=${this.viewModel} .referenceElement=${this.referenceElement} .spatialReference=${this.spatialReference??void 0} .timeZone=${this.timeZone??void 0} .view=${this.viewModel.view??void 0}></arcgis-feature-utility-network-associations>`}_renderContentElement(e,t){switch(e.type){case"attachments":return this.hideAttachmentsContent?null:this._renderAttachments(e);case"custom":return this.hideCustomContent?null:this._renderCustom(e);case"fields":return this.hideFieldsContent?null:this._renderFields(e,t);case"media":return this.hideMediaContent?null:this._renderMedia(e,t);case"text":return this.hideTextContent?null:this._renderText(e);case"expression":return this.hideExpressionContent?null:this._renderExpression(e,t);case"relationship":return this.showRelationshipContent?this._renderRelationship(e,t):null;case"utility-network-associations":return this.showUtilityNetworkContent?this._renderAssociation(e):null;default:return null}}_renderContent(){let{content:e,graphic:t}=this.viewModel;return e?Array.isArray(e)&&e.length?e.length?e.map(this._renderContentElement,this):null:typeof e=="string"?n`<arcgis-feature-content .creator=${e} .graphic=${t??void 0} class="content-element"></arcgis-feature-content>`:e instanceof HTMLElement?e:null:null}_renderContentContainer(){let{flowItems:e,hideContent:t,internalFlowItems:i,headingLevel:o,state:s,messages:a,heading:r,hideHeading:l}=this,d=t?null:n`<div class="main">${[this._renderContent(),this._renderLastEditInfo()]}</div>`,h=a.returnToInitialFeature??"";return e?d:n`<calcite-flow ${y(this._storeRootFlowNode)}><calcite-flow-item .loading=${s==="loading"} .headingLevel=${o} .heading=${l?void 0:Z(r)} .selected=${!i.length}>${!l&&r?n`<div slot=heading><div .innerHTML=${B.sanitize(r??"")??""}></div></div>`:null}${d}</calcite-flow-item>${i.toArray().map((p,u)=>n`<calcite-flow-item @calciteFlowItemBack=${m=>{m.preventDefault(),this._handleDrillInBackClick()}} .loading=${s==="loading"} .headingLevel=${o} .selected=${u===i.length-1}><calcite-action icon=move-up @click=${this._removeFlowItems} slot=header-actions-start .text=${h} title=${h??b}></calcite-action>${p}</calcite-flow-item>`)}</calcite-flow>`}_renderLastEditInfo(){let{hideLastEditedInfo:e,messages:t}=this,{lastEditInfo:i}=this.viewModel;if(!i||e)return null;let{date:o,user:s}=i,a=i.type==="edit"?s?t.lastEditedByUser:t.lastEdited:s?t.lastCreatedByUser:t.lastCreated,r=k(a??"",{date:o,user:s});return n`<div class=${M(x("last-edited-info","content-element"))}>${r}</div>`}};C("arcgis-feature",v);return v},"intl","applications/Components/sanitizerUtils","core/Collection","core/reactiveUtils","applications/Components/stringUtils","widgets/Feature/FeatureViewModel",a,c,d,e,f,g)