@accounter/client
Version:
Accounter client application
2 lines (1 loc) • 1.54 kB
JavaScript
import{r as s,j as t,B as r,dw as a}from"./index-CDv8MTrU.js";import{T as c}from"./Table-CnwiwZMD.js";function h(e){const[i,o]=s.useState(!1),l=e.moreInfo?e.moreInfo(e.item):null;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{children:[e.columns.map((n,d)=>n.disabled?null:t.jsx("td",{style:n.style,children:n.value(e.item,e.rowContext?e.rowContext(e.item):void 0)},String(d))),e.moreInfo&&t.jsx("td",{children:l===null?t.jsx("p",{children:"No Data Related"}):t.jsx(r,{onClick:()=>o(!i),className:"ml-auto",children:"More Info"})})]}),(e.isShowAll||i)&&l!==null&&t.jsx("tr",{children:t.jsx("td",{colSpan:12,children:t.jsx(a,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:l})})})]})}function u(e){const[i,o]=s.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-row justify-end w-full",children:e.showButton===!0?t.jsx(r,{type:"button",onClick:()=>{o(l=>!l)},children:i?"Hide All":"Show All"}):null}),t.jsxs(c,{striped:e.striped,highlightOnHover:e.highlightOnHover,children:[t.jsx("thead",{style:e.stickyHeader?{position:"sticky",top:0,zIndex:20}:{},children:t.jsxs("tr",{className:"px-10 py-10 title-font tracking-wider font-medium text-gray-900 text-sm bg-gray-100 rounded-tl rounded-bl",children:[e.columns.map((l,n)=>l.disabled?null:t.jsx("th",{children:l.title},String(n))),e.moreInfo&&t.jsx("th",{children:"More Info"})]})}),t.jsx("tbody",{children:e.items.map((l,n)=>t.jsx(h,{columns:e.columns,item:l,moreInfo:e.moreInfo,isShowAll:i,rowContext:e.rowContext},n))})]})]})}export{h as A,u as a};