import{e as I,b as g,$ as D,q as o,g as n,s as e,F as h,x as s,v as a,f as x,j as d,X as _,Y as j,at as u,a1 as y,T as b,U as p,a0 as V,b4 as E,K as F,b2 as G,b5 as K,ar as L}from"./jwt-decode.esm-CX61wVx3.js";import{_ as N}from"./AbstraButton.vue_vue_type_script_setup_true_lang-BBMaXQJu.js";import{_ as w,P as v,H as k}from"./HighlightedText-Dt8zryEd.js";import{F as P}from"./PhKey.vue-B8QZAw4x.js";import{G as R}from"./PhLockSimple.vue-9xY97cAM.js";import{G as M}from"./PhPencil.vue-3MngK8zN.js";import{C as O}from"./index-GnIaed8S.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[c]="ddd2a8fd-22cf-4b43-8fdc-abe706f26c66",t._sentryDebugIdIdentifier="sentry-dbid-ddd2a8fd-22cf-4b43-8fdc-abe706f26c66")}catch{}})();const q=I({__name:"TableCard",props:{table:{},projectId:{},showHandles:{type:Boolean},maxVisibleColumns:{},connectedColumns:{},highlightedColumns:{},isHighlighted:{type:Boolean},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},searchTerm:{}},emits:["dblclick","delete"],setup(t,{emit:c}){const i=t,C=c,f=g(()=>i.maxVisibleColumns??5),B=g(()=>i.table.getColumns().slice(0,f.value)),T=g(()=>i.table.getColumns().length>f.value),$=g(()=>!i.highlightedColumns||i.highlightedColumns.length===0?!1:i.table.getColumns().slice(f.value).some(r=>r.id&&i.highlightedColumns?.includes(r.id))),z=m=>i.connectedColumns?.includes(m)??!1;return(m,r)=>{const H=D("RouterLink");return n(),o(e(O),{hoverable:!0,class:h(["table-card",{"table-highlighted":t.isHighlighted}]),onDblclick:r[1]||(r[1]=l=>C("dblclick"))},{title:s(()=>[a(e(u),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:s(()=>[a(e(V),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:s(()=>[a(k,{text:t.table.name,term:t.searchTerm},null,8,["text","term"])]),_:1}),a(e(u),{gap:"small",align:"center",wrap:"nowrap",style:{"flex-shrink":"0"}},{default:s(()=>[t.readOnly?(n(),o(e(E),{key:0,color:"default",class:"readonly-tag"},{default:s(()=>[a(e(R),{size:12,style:{"margin-right":"4px"}}),b(" "+p(e(F).translate("i18n_systemtables_read_only")),1)]),_:1})):d("",!0),t.showEditButton?(n(),o(H,{key:1,to:`/projects/${t.projectId}/tables/${t.table.id}`},{default:s(()=>[a(N,{size:"small",type:"text"},{default:s(()=>[a(e(M),{size:16})]),_:1})]),_:1},8,["to"])):d("",!0),t.showDeleteButton?(n(),x("button",{key:2,class:"delete-btn",onClick:r[0]||(r[0]=G(l=>C("delete"),["stop","prevent"]))},[a(e(K),{size:16})])):d("",!0)]),_:1})]),_:1})]),default:s(()=>[a(e(u),{vertical:"",gap:"small",class:"columns-list"},{default:s(()=>[(n(!0),x(_,null,j(B.value,l=>(n(),o(e(u),{key:l.id??l.name,align:"center",gap:"small",class:h(["column-row",{"column-highlighted":l.id&&t.highlightedColumns?.includes(l.id)}])},{default:s(()=>[t.showHandles&&l.foreignKey?(n(),o(e(w),{key:0,id:`target-${l.id}`,type:"target",position:e(v).Left,connectable:!1},null,8,["id","position"])):d("",!0),l.primaryKey?(n(),o(e(P),{key:1,size:14,class:"key-icon"})):d("",!0),a(e(y),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:s(()=>[a(k,{text:l.name,term:t.searchTerm},null,8,["text","term"])]),_:2},1024),a(e(y),{type:"secondary",style:{"font-size":"12px","line-height":"1"}},{default:s(()=>[b(p(l.type),1)]),_:2},1024),t.showHandles&&(l.primaryKey||l.id&&z(l.id))?(n(),o(e(w),{key:2,id:`source-${l.id}`,type:"source",position:e(v).Right,connectable:!1},null,8,["id","position"])):d("",!0)]),_:2},1032,["class"]))),128)),T.value?(n(),o(e(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:h({"more-columns-highlighted":$.value})},{default:s(()=>[a(e(y),{type:"secondary",style:{"font-size":"12px"}},{default:s(()=>[b(" +"+p(t.table.getColumns().length-f.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):d("",!0)]),_:1})]),_:1},8,["class"])}}}),W=L(q,[["__scopeId","data-v-5acdf99f"]]);export{W as T};
//# sourceMappingURL=TableCard-DY1KrKVd.js.map
