import{r as e,h as i,H as t}from"./p-1ea36ff3.js";import{I as s}from"./p-2536e466.js";import{I as a}from"./p-b3906d17.js";import"./p-d50d0ec8.js";import"./p-d343a062.js";import"./p-f46dff5e.js";const n={seeMore:"See More"};let d=class{constructor(i){e(this,i),this.showInfoDetailDialog=!1,this.itemFetchState=a.init()}async componentWillLoad(){this.strings=await this.apiSozluk.getContent(this.view.i18nEntryId,n);const{apiData:e,params:i,view:t}=this,{query:a,table:d}=t;this.itemDataProvider=new s(e,i,d,a,(null==a?void 0:a.fields)||t.table.fields,(e=>{this.itemFetchState=e})),(null==i?void 0:i.item)||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:n,showInfoDetailDialog:d,view:o}=this,{ui:r}=o,l=o.table.fields,c=(null===(e=this.params)||void 0===e?void 0:e.item)||n.data;return i(t,null,!n.isPending&&!n.error&&i("dvn-card-view",r.summaryCardConfig?{key:`summary-card-view-${c._id}`,config:Object.assign(Object.assign({},r.summaryCardConfig),{footer:Object.assign(Object.assign({},r.summaryCardConfig.footer||{}),{actions:[...(null===(a=null===(s=r.summaryCardConfig)||void 0===s?void 0:s.footer)||void 0===a?void 0:a.actions)||[],{ui:{label:this.strings.seeMore,name:"open-dvn-card-view-detail-view",view:"flat"}}]})}),fields:l,item:c,cornerRadius:r.cardCornerRadius,leaned:!0,overrideStyle:{width:"100%"}}:{key:`card-view-${c._id}`,config:r.cardConfig,fields:l,item:c,cornerRadius:r.cardCornerRadius,leaned:!0,overrideStyle:{width:"100%"}}),n.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"})),n.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")),d&&i("dvn-dialog",{shown:this.showInfoDetailDialog,onDismiss:()=>this.showInfoDetailDialog=!1,raw:!0},i("dvn-card-view",{key:`detail-card-view-${c._id}`,config:r.cardConfig,fields:l,item:c,cornerRadius:r.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%;overflow:auto}.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}