UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 4.08 kB
import{c as D,j as r,m as T,b as I}from"./index-ztdGKvBm.js";import{T as E,a as H,b as R,c as K,d as W,e as z}from"./table-C3AdbrSy.js";import{i as L,n as $}from"./ArrowUp-D5DDc3Cp.js";function A(S){const e=D.c(33),{columns:a,data:b,sortKey:h,sortDirection:l,onSort:i,onRowClick:m,rowClassName:u,isRowClickable:x}=S;let v;e[0]!==l?(v=function(t,j){return r.jsx("div",{className:"w-4 flex items-center justify-center",children:j&&l&&(l==="asc"?r.jsx(L,{size:16,className:"text-muted-foreground transition-colors"}):r.jsx($,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=l,e[1]=v):v=e[1];const p=v;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=function(t,j){let w="px-4 py-2 text-left font-normal text-meta h-9";return t===j-1&&(w="px-4 py-2 text-left font-normal text-meta h-9 w-8"),w},e[2]=y):y=e[2];const g=y;let c;if(e[3]!==a||e[4]!==i||e[5]!==p||e[6]!==l||e[7]!==h){let d;e[9]!==a.length||e[10]!==i||e[11]!==p||e[12]!==l||e[13]!==h?(d=(t,j)=>{const w=h===t.id,N=t.sortable&&i;return r.jsx(E,{className:T(g(j,a.length),"group transition-colors select-none",t.sortable&&"hover:bg-accent cursor-pointer",t.rowClassName,t.cellClassName),"aria-sort":w&&l?l==="asc"?"ascending":"descending":t.sortable?"none":void 0,role:N?"button":void 0,tabIndex:N?0:void 0,onClick:N?()=>i(t.id):void 0,onKeyDown:N?f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),i(t.id))}:void 0,children:r.jsxs("span",{className:"flex items-center gap-1",children:[t.header,t.sortable&&p(t.id,w)]})},t.id)},e[9]=a.length,e[10]=i,e[11]=p,e[12]=l,e[13]=h,e[14]=d):d=e[14],c=a.map(d),e[3]=a,e[4]=i,e[5]=p,e[6]=l,e[7]=h,e[8]=c}else c=e[8];let s;e[15]!==c?(s=r.jsx(H,{className:"border-b-0",children:r.jsx(R,{className:"h-9 hover:bg-transparent border-b border-border",children:c})}),e[15]=c,e[16]=s):s=e[16];let n;if(e[17]!==a||e[18]!==b||e[19]!==x||e[20]!==m||e[21]!==u){let d;e[23]!==a||e[24]!==x||e[25]!==m||e[26]!==u?(d=(t,j)=>{const w=u?.(t),N=x?.(t)??!0,f=m&&N?()=>m(t):void 0;return r.jsx(R,{"data-row-index":j,className:T("group/data-row transition-colors border-b-0",N&&"hover:bg-accent",f?"cursor-pointer":"",w),role:f?"button":void 0,tabIndex:f?0:void 0,onClick:f,onKeyDown:f?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),f())}:void 0,children:a.map(o=>r.jsx(K,{className:T("px-5 py-4 h-16 align-middle text-sm text-foreground",o.cellClassName,o.wrap?"whitespace-normal wrap-break-word":""),children:r.jsx("div",{className:T(o.wrap?"w-full":"min-w-0",!o.wrap&&"-m-0.5 truncate overflow-hidden whitespace-nowrap p-0.5"),children:o.render?o.render(t):o.accessor?o.accessor(t):null})},o.id))},j)},e[23]=a,e[24]=x,e[25]=m,e[26]=u,e[27]=d):d=e[27],n=b.map(d),e[17]=a,e[18]=b,e[19]=x,e[20]=m,e[21]=u,e[22]=n}else n=e[22];let C;e[28]!==n?(C=r.jsx(W,{children:n}),e[28]=n,e[29]=C):C=e[29];let k;return e[30]!==s||e[31]!==C?(k=r.jsxs(z,{className:"w-full border-collapse",children:[s,C]}),e[30]=s,e[31]=C,e[32]=k):k=e[32],k}function G(S){const e=D.c(18),{columns:a,data:b,isLoading:h,sortKey:l,sortDirection:i,onSort:m,onRowClick:u,rowClassName:x,isRowClickable:v,emptyState:p}=S,y=h===void 0?!1:h,g=I();if(y){let s;e[0]!==g?(s=g("collections.collectionTableWrapper.loading"),e[0]=g,e[1]=s):s=e[1];let n;return e[2]!==s?(n=r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"text-muted-foreground",children:s})}),e[2]=s,e[3]=n):n=e[3],n}if(b.length===0){let s;e[4]!==p||e[5]!==g?(s=p||r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:g("collections.collectionTableWrapper.noItemsFound")}),e[4]=p,e[5]=g,e[6]=s):s=e[6];let n;return e[7]!==s?(n=r.jsx("div",{className:"flex items-center justify-center h-full",children:s}),e[7]=s,e[8]=n):n=e[8],n}let c;return e[9]!==a||e[10]!==b||e[11]!==v||e[12]!==u||e[13]!==m||e[14]!==x||e[15]!==i||e[16]!==l?(c=r.jsx("div",{className:"flex-1",children:r.jsx(A,{columns:a,data:b,sortKey:l,sortDirection:i,onSort:m,onRowClick:u,rowClassName:x,isRowClickable:v})}),e[9]=a,e[10]=b,e[11]=v,e[12]=u,e[13]=m,e[14]=x,e[15]=i,e[16]=l,e[17]=c):c=e[17],c}export{G as C};