import{d as B,G as D,r as S,b as n,c as i,w as t,u as a,f as s,b0 as u,eA as p,er as g,ez as T,c4 as M,ad as U,bu as A,cQ as F,eu as _,H as O,a as $,cb as z,cS as R,et as E,bQ as P,bO as Q,I as j,c9 as G,bP as H,e as L}from"./registerWidgets.4340e287.js";import{A as N,a as I}from"./index.f58e2ef8.js";import{A as Y,M as q,c as J}from"./Title.4165770a.js";import{F as K}from"./Form.7b78c348.js";import{g as W}from"./icons.da02f7f7.js";import{A as X}from"./index.17a2edf7.js";import{A as V}from"./index.7bc7e814.js";import{A as Z}from"./index.d24f6130.js";import{A as x}from"./index.9aade351.js";import{A as ee}from"./index.c13b703c.js";(function(){try{var c=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y=new Error().stack;y&&(c._sentryDebugIds=c._sentryDebugIds||{},c._sentryDebugIds[y]="69aff3b4-d84e-4269-9dbd-83b03d3f5290",c._sentryDebugIdIdentifier="sentry-dbid-69aff3b4-d84e-4269-9dbd-83b03d3f5290")}catch{}})();const te=B({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(c,{expose:y,emit:m}){const w=`Create a new ${c.entityName}`,f=D({inputValue:{}}),b=S(!1),l=()=>b.value=!0,k=()=>b.value=!1,h=()=>{m("create",f.inputValue),k()};return y({open:l,close:k}),(v,r)=>(n(),i(a(q),{open:b.value,title:w,onCancel:k,onOk:h},{default:t(()=>[s(a(N),null,{default:t(()=>[u(" You may edit the "+p(v.entityName)+" name afterwards at Settings. ",1)]),_:1}),s(a(K),{layout:"vertical"},{default:t(()=>[(n(!0),g(A,null,T(v.fields,e=>(n(),i(a(Y),{key:e.key,label:e.label},{default:t(()=>{var d;return[!e.type||typeof e.type=="string"?(n(),i(a(M),{key:0,value:f.inputValue[e.key],"onUpdate:value":o=>f.inputValue[e.key]=o,type:(d=e.type)!=null?d:"text"},null,8,["value","onUpdate:value","type"])):Array.isArray(e.type)?(n(),i(a(U),{key:1,value:f.inputValue[e.key],"onUpdate:value":o=>f.inputValue[e.key]=o},{default:t(()=>[(n(!0),g(A,null,T(e.type,o=>(n(),i(a(F),{key:typeof o=="string"?o:o.value,value:typeof o=="string"?o:o.value},{default:t(()=>[u(p(typeof o=="string"?o:o.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value"])):_("",!0)]}),_:2},1032,["label"]))),128))]),_:1})]),_:1},8,["open"]))}}),ae={key:1},le=["src"],me=B({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},live:{type:Boolean},emptyTitle:{},entityName:{},fields:{},table:{},videoUrl:{}},emits:["create"],setup(c,{emit:y}){const m=c,C=S(null),w=()=>{var l;m.fields?(l=C.value)==null||l.open():y("create",{})};async function f(l){y("create",l)}const b=O(()=>({"--columnCount":`${m.table.columns.length}`}));return(l,k)=>{const h=$("router-link");return n(),g(A,null,[s(a(ee),{direction:"vertical"},{default:t(()=>{var v;return[s(a(J),null,{default:t(()=>[u(p(l.title),1)]),_:1}),s(a(N),null,{default:t(()=>[u(p(l.description),1)]),_:1}),l.createButtonText?(n(),i(a(z),{key:0,type:"primary",onClick:w},{default:t(()=>[u(p(l.createButtonText),1)]),_:1})):_("",!0),s(a(R),{style:E(b.value),"data-source":l.table.rows,loading:l.loading&&!l.live,columns:(v=l.table.columns)==null?void 0:v.map(({name:r,align:e},d,o)=>({title:r,key:d,align:e!=null?e:"center"}))},{emptyText:t(()=>[u(p(l.emptyTitle),1)]),headerCell:t(r=>[u(p(r.title),1)]),bodyCell:t(({column:{key:r},record:e})=>[e.cells[r].tagColor?(n(),i(a(X),{key:0,color:e.cells[r].tagColor},{default:t(()=>[u(p(e.cells[r].text),1)]),_:2},1032,["color"])):e.cells[r].link?(n(),i(h,{key:1,to:e.cells[r].link},{default:t(()=>[u(p(e.cells[r].text),1)]),_:2},1032,["to"])):e.cells[r].actions?(n(),i(a(G),{key:2},{overlay:t(()=>[s(a(P),null,{default:t(()=>[(n(!0),g(A,null,T(e.cells[r].actions,(d,o)=>(n(),i(a(Q),{key:o,danger:d.dangerous,onClick:ne=>d.onClick({key:e.key})},{default:t(()=>[u(p(d.label),1)]),_:2},1032,["danger","onClick"]))),128))]),_:2},1024)]),default:t(()=>[s(j,{path:a(W),style:{cursor:"pointer"}},null,8,["path"])]),_:2},1024)):(n(),i(a(I),{key:3},{default:t(()=>[u(p(e.cells[r].text),1)]),_:2},1024))]),footer:t(()=>[l.live?(n(),i(a(Z),{key:0,justify:"end",gutter:10},{default:t(()=>[s(a(V),null,{default:t(()=>[s(a(H),{size:"small"})]),_:1}),s(a(V),null,{default:t(()=>[s(a(I),null,{default:t(()=>[u(" auto updating ")]),_:1})]),_:1})]),_:1})):_("",!0)]),_:1},8,["style","data-source","loading","columns"]),l.videoUrl?(n(),g("section",ae,[s(a(x),{orientation:"left"},{default:t(()=>[u("See it in action")]),_:1}),L("iframe",{style:{width:"100%","aspect-ratio":"16/9"},src:l.videoUrl,title:"runtimes example",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:""},null,8,le)])):_("",!0)]}),_:1}),l.fields?(n(),i(te,{key:0,ref_key:"modalRef",ref:C,fields:l.fields,"entity-name":l.entityName,onCreate:f},null,8,["fields","entity-name"])):_("",!0)],64)}}});export{me as _};
//# sourceMappingURL=CrudView.vue_vue_type_script_setup_true_lang.e9f57b5e.js.map
