amotify
Version:
UI Component for React,NextJS,esbuild
2 lines (1 loc) • 1.68 kB
JavaScript
import{b as e,c}from"../../chunk-C5N2D3ZX.js";import{Fragment as H,jsx as a,jsxs as g}from"react/jsx-runtime";import p from"./Parts";import D from"./Wrapper";import{DefaultCellSystemAdjustingStyles as N}from"./cellStyling";import{TableClasses as y}from"../../@styles/componentClasses";const R={HeadRow:l=>{let{cellStyles:t={},cellClassName:n="",cellStylesCallback:S,colLength:u,head:f,rows:w}=l;if(!f)return null;let i=[];return f.forEach((s,r)=>{let C=p[s.type=="th"?"TH":"TD"],T={top:!0,bottom:!w.length,left:r==0,right:r==u-1,rowIndex:0,colIndex:r,isBody:!1,isHeader:!0},o=N(T),m=S?S(T):{},b=c(e(e(e(e({},t),o),m),s),{freeCSS:e(e(e({},t.freeCSS),m.freeCSS),s.freeCSS),className:[y("Cell"),n,s.className].join(" ")});i.push(a(C,e({},b),r))}),a(p.Row,{className:[y("Row"),y("HeadRow")].join(" "),children:i})},BodyRows:l=>{let{cellStyles:t={},cellClassName:n="",cellStylesCallback:S,head:u,rows:f,colLength:w,onRowClick:i}=l,s=[];return f.forEach((r,C)=>{let T=[];r.forEach((o,m)=>{let b=p[o.type=="th"?"TH":"TD"],h={top:C==0&&!u,bottom:C==f.length-1,left:m==0,right:m==w-1,rowIndex:C,colIndex:m,isBody:!0,isHeader:!1},k=N(h),d=S?S(h):{};T.push(a(b,c(e(e(e(e({},t),k),o),d),{freeCSS:e(e(e({},t.freeCSS),d.freeCSS),o.freeCSS),className:[y("Cell"),n,o.className].join(" ")}),m))}),s.push(a(p.Row,{className:[y("Row"),y("BodyRow")].join(" "),children:T,onClick:o=>{i&&i(r.rowID,o)}},C))}),a(H,{children:s})},Normal:l=>(l=e({},l),l.rows=l.rows.map((t,n)=>(t.rowID=t.rowID||n,t)),a(p.Table,{className:y("Table"),children:g(p.Body,{children:[a(R.HeadRow,e({},l)),a(R.BodyRows,e({},l))]})}))},B=l=>a(D,c(e({type:"normal"},l),{JSXChildren:R.Normal}));export{B as Normal,B as default};