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