import{_ as H}from"./AbstraButton.vue_vue_type_script_setup_true_lang.aefce2d3.js";import{F as T}from"./PhKey.vue.23f3a465.js";import{G as $}from"./PhPencil.vue.feb383e2.js";import{f as v,c as k}from"./vue-flow-core.6cb99d32.js";import{d as z,c as g,i as D,o as i,a as r,b as l,f as o,u as t,A as V,g as h,ed as p,h as c,dc as y,a5 as j,ec as A,ea as b,d8 as _,aR as E,_ as L}from"./jwt-decode.esm.54a1ea22.js";import{C as R}from"./Card.fc77085c.js";(function(){try{var u=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m=new Error().stack;m&&(u._sentryDebugIds=u._sentryDebugIds||{},u._sentryDebugIds[m]="d505d1ca-fc9b-4f0a-9dda-353864e9095d",u._sentryDebugIdIdentifier="sentry-dbid-d505d1ca-fc9b-4f0a-9dda-353864e9095d")}catch{}})();const F=z({__name:"TableCard",props:{table:{},projectId:{},showHandles:{type:Boolean},maxVisibleColumns:{},connectedColumns:{},highlightedColumns:{},isHighlighted:{type:Boolean},showEditButton:{type:Boolean,default:!0}},emits:["dblclick"],setup(u,{emit:m}){const a=u,f=g(()=>{var e;return(e=a.maxVisibleColumns)!=null?e:5}),w=g(()=>a.table.getColumns().slice(0,f.value)),I=g(()=>a.table.getColumns().length>f.value),B=g(()=>!a.highlightedColumns||a.highlightedColumns.length===0?!1:a.table.getColumns().slice(f.value).some(n=>{var d;return n.id&&((d=a.highlightedColumns)==null?void 0:d.includes(n.id))})),x=e=>{var n,d;return(d=(n=a.connectedColumns)==null?void 0:n.includes(e))!=null?d:!1};return(e,n)=>{const d=D("RouterLink");return i(),r(t(R),{hoverable:!0,class:b(["table-card",{"table-highlighted":e.isHighlighted}]),onDblclick:n[0]||(n[0]=s=>m("dblclick"))},{title:l(()=>[o(t(y),{align:"center",justify:"space-between"},{default:l(()=>[o(t(V),{level:5,style:{margin:"0"}},{default:l(()=>[h(p(e.table.name),1)]),_:1}),e.showEditButton?(i(),r(d,{key:0,to:`/projects/${e.projectId}/tables/${e.table.id}`},{default:l(()=>[o(H,{size:"small",type:"text"},{default:l(()=>[o(t($),{size:16})]),_:1})]),_:1},8,["to"])):c("",!0)]),_:1})]),default:l(()=>[o(t(y),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),j(E,null,A(w.value,s=>{var C;return i(),r(t(y),{key:s.id,align:"center",gap:"small",class:b(["column-row",{"column-highlighted":s.id&&((C=e.highlightedColumns)==null?void 0:C.includes(s.id))}])},{default:l(()=>[e.showHandles&&s.foreignKey?(i(),r(t(v),{key:0,id:`target-${s.id}`,type:"target",position:t(k).Left,connectable:!1},null,8,["id","position"])):c("",!0),s.primaryKey?(i(),r(t(T),{key:1,size:14,class:"key-icon"})):c("",!0),o(t(_),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[h(p(s.name),1)]),_:2},1024),o(t(_),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[h(p(s.type),1)]),_:2},1024),e.showHandles&&(s.primaryKey||s.id&&x(s.id))?(i(),r(t(v),{key:2,id:`source-${s.id}`,type:"source",position:t(k).Right,connectable:!1},null,8,["id","position"])):c("",!0)]),_:2},1032,["class"])}),128)),I.value?(i(),r(t(y),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:b({"more-columns-highlighted":B.value})},{default:l(()=>[o(t(_),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[h(" +"+p(e.table.getColumns().length-f.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):c("",!0)]),_:1})]),_:1},8,["class"])}}});const q=L(F,[["__scopeId","data-v-e197befa"]]);export{q as T};
//# sourceMappingURL=TableCard.c9a1cf41.js.map
