import{r as e,h as i,H as t}from"./p-cb5076d4.js";import{I as s}from"./p-d1e739e3.js";import{I as a}from"./p-b3906d17.js";import"./p-0db2169b.js";import"./p-eebad85b.js";import"./p-d50d0ec8.js";import"./p-d343a062.js";import"./p-f46dff5e.js";const d=class{constructor(i){e(this,i),this.showInfoDetailDialog=!1,this.itemFetchState=a.init()}componentWillLoad(){const{apiData:e,params:i,view:t}=this;if(null==i?void 0:i.item)return;const{query:a,table:d,ui:n}=t;this.itemDataProvider=new s(e,i,d,a,(null==a?void 0:a.fields)||n.fields||t.table.fields,(e=>{this.itemFetchState=e})),this.itemDataProvider.fetchData(this.itemFetchState)}componentDidUpdate(){const{params:e,itemFetchState:i}=this;(null==e?void 0:e.item)||i.data||i.isPending||i.error||this.itemDataProvider.fetchData(this.itemFetchState)}async invalidate(e){this.itemDataProvider.fetchData(this.itemFetchState)}onAction(e){"open-dvn-card-view-detail-view"===e.detail.name&&(e.preventDefault(),this.showInfoDetailDialog=!0)}render(){var e,s,a;const{itemFetchState:d,showInfoDetailDialog:n,view:r}=this,{ui:o}=r,l=o.fields||r.table.fields,c=(null===(e=this.params)||void 0===e?void 0:e.item)||d.data;return i(t,null,!d.isPending&&!d.error&&i("dvn-card-view",o.summaryCardConfig?{key:`summary-card-view-${c._id}`,config:Object.assign(Object.assign({},o.summaryCardConfig),{footer:Object.assign(Object.assign({},o.summaryCardConfig.footer||{}),{actions:[...(null===(a=null===(s=o.summaryCardConfig)||void 0===s?void 0:s.footer)||void 0===a?void 0:a.actions)||[],{ui:{label:"See More",name:"open-dvn-card-view-detail-view",view:"flat"}}]})}),fields:l,item:c,cornerRadius:o.cardCornerRadius,leaned:!0,overrideStyle:{width:"100%"}}:{key:`card-view-${c._id}`,config:o.cardConfig,fields:l,item:c,cornerRadius:o.cardCornerRadius,leaned:!0,overrideStyle:{width:"100%"}}),d.isPending&&i("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center detail-view-progress-container"},i("dvn-progress",{indefinite:!0,tint:"primary"})),d.error&&i("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center flex-column detail-view-progress-container"},"Fetching data failed.",i("dvn-button",{onClick:()=>this.itemDataProvider.fetchData(this.itemFetchState)},"Retry")),n&&i("dvn-dialog",{shown:this.showInfoDetailDialog,onDismiss:()=>this.showInfoDetailDialog=!1,raw:!0},i("dvn-card-view",{key:`detail-card-view-${c._id}`,config:o.cardConfig,fields:l,item:c,cornerRadius:o.cardCornerRadius,leaned:!0,overrideStyle:{width:"100%"}})))}};d.style=".sc-dvn-app-view-detail-view-card-h{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:stretch;align-items:stretch;max-width:100%}.detail-view-progress-container.sc-dvn-app-view-detail-view-card{padding:calc(4 * var(--spacing-unit))}";export{d as dvn_app_view_detail_view_card}