const t=window.EdelElements.h;import{a as e}from"./chunk-2e00f500.js";class n{constructor(){this.rows=[],this.columns=[],this.actions=[],this.actionMenu=!1}render(){return this.rows.length>0&&this.columns.length>0?t("table",{class:"table table--no-border-top"},t("thead",null,t("tr",{class:"table-row table-row--head"},this.renderTableHead(),this.renderActionMenuHead())),t("tbody",null,this.rows.map(e=>t("tr",{class:"table-row"},this.renderTableRow(e),this.renderActionMenuButtons(e))))):null}renderTableHead(){return this.columns.map(e=>t("th",{class:"table-head"},e.title))}renderActionMenuButtons(n){if(this.actionMenu)return t("td",{class:"table-cell"},this.actions.map(a=>t("edel-button",{type:e.default,plain:!0,slim:!0,label:a.label,onClick:()=>this.handleEvent(a.eventName,n.context.itemOrType)})))}renderActionMenuHead(){if(this.actionMenu)return t("th",{class:"table-head"})}renderTableRow(e){return this.columns.map(n=>t("td",{class:"table-cell"},this.renderCellContents(n,e)))}handleEvent(t,e){this.emit.emit({action:t,data:e})}renderCellContents(e,n){return t("concrete-visual",{visual:e.visual,context:n.context,concrete:n.data[e.property||e.title]})}static get is(){return"edel-table"}static get properties(){return{actionMenu:{type:Boolean,attr:"action-menu"},actions:{type:"Any",attr:"actions"},columns:{type:"Any",attr:"columns"},rows:{type:"Any",attr:"rows"}}}static get events(){return[{name:"emit",method:"emit",bubbles:!0,cancelable:!0,composed:!0}]}}export{n as EdelTable};