import{s as f,a5 as v,f as s,y as l,dR as y,ad as g,ae as C,z as w,D as T}from"./index-DT8qTvyx.js";var _="var(--TableCell-paddingY) var(--TableCell-paddingX)",k=function(d){f(r,d);function r(e){return d.call(this,e)||this}return r.prototype.renderTd=function(e,t,o){var a=this.props,n=a.border,i=a.borderColor;a.render;var p=a.data,u=a.padding,h="td-".concat(t),c;return n&&(c="1px solid ".concat(i)),v(e,p)?s.createElement("td",{style:l({border:c,color:e.color,fontWeight:e.bold?"bold":"normal",background:e.background,padding:e.padding||u,width:e.width||"auto",textAlign:e.align||"left",verticalAlign:e.valign||"center"},e.style),align:e.align,valign:e.valign,rowSpan:e.rowspan,colSpan:e.colspan,key:h},this.renderTdBody(e.body)):null},r.prototype.renderTdBody=function(e){var t=this.props.render;return t("td",e||"")},r.prototype.renderTds=function(e,t){var o=this,a=this.props.data;return e.map(function(n,i){return o.renderTd(y(n,a),i,t)})},r.prototype.renderTr=function(e,t){var o="tr-".concat(t),a=this.props.data;return v(e,a)?s.createElement("tr",{style:l({height:e.height,background:e.background},e.style),key:o},this.renderTds(e.tds||[],t)):null},r.prototype.renderTrs=function(e){var t=this,o=this.props.data,a=e.map(function(n,i){return t.renderTr(y(n,o),i)});return a},r.prototype.renderCols=function(){var e=this.props,t=e.cols,o=e.data;if(t){var a=t.map(function(n){return n=y(n,o),s.createElement("col",{span:n.span,style:n.style})});return s.createElement("colgroup",null,a)}return null},r.prototype.renderCaption=function(){return this.props.caption?s.createElement("caption",{style:{captionSide:this.props.captionSide==="bottom"?"bottom":"top"}},this.props.caption):null},r.prototype.render=function(){var e=this.props,t=e.width,o=e.trs,a=o===void 0?[]:o,n=e.classnames,i=e.className,p=e.id,u=e.wrapperCustomStyle,h=e.env,c=e.themeCss,m=e.style,b=s.createElement("table",{className:n("TableView",i,g(l(l({},this.props),{name:"baseControlClassName",id:p,themeCss:c})),g(l(l({},this.props),{name:"wrapperCustomStyle",id:p,themeCss:u}))),style:{width:t,borderCollapse:"collapse"},"data-id":p},this.renderCaption(),this.renderCols(),s.createElement("tbody",null,this.renderTrs(a)),s.createElement(C,l({},this.props,{config:{wrapperCustomStyle:u,id:p,themeCss:c,classNames:[{key:"baseControlClassName"}]},env:h})));return m&&Object.keys(m).length?s.createElement("div",{className:"ae-TableViewEditor",style:m},b):b},r.defaultProps={padding:_,width:"100%",border:!0,borderColor:"var(--borderColor)"},r}(s.Component),N=function(d){f(r,d);function r(){return d!==null&&d.apply(this,arguments)||this}return r=w([T({type:"table-view",autoVar:!0})],r),r}(k);export{N as TableViewRenderer,k as default};
