import{g as D}from"./icons.158b4825.js";import{d as V,H as M,r as N,b as n,c as i,w as t,u as a,f as s,aJ as u,eC as c,et as _,eB as T,bZ as U,af as F,bg as A,cL as $,ew as g,J as E,a as O,c4 as R,cN as z,ev as J,bG as L,bE as j,I as G,c2 as H,bF as P,e as Y}from"./outputWidgets.c072fe4e.js";import{A as S,a as B}from"./index.4cff163b.js";import{A as Z,M as q,c as K}from"./Title.e3dcb8ea.js";import{F as Q}from"./Form.9f52866c.js";import{A as W}from"./index.4e6af937.js";import{A as I}from"./index.d9c3e0de.js";import{A as X}from"./index.2e3640f1.js";import{A as x}from"./index.e7c5574b.js";import{A as ee}from"./index.ec8e038a.js";(function(){try{var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y=new Error().stack;y&&(p._sentryDebugIds=p._sentryDebugIds||{},p._sentryDebugIds[y]="4e9bc3b5-d1e3-4102-80db-489d8547584c",p._sentryDebugIdIdentifier="sentry-dbid-4e9bc3b5-d1e3-4102-80db-489d8547584c")}catch{}})();const te=V({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(p,{expose:y,emit:f}){const w=`Create a new ${p.entityName}`,m=M({inputValue:{}}),b=N(!1),l=()=>b.value=!0,k=()=>b.value=!1,h=()=>{f("create",m.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(S),null,{default:t(()=>[u(" You may edit the "+c(v.entityName)+" name afterwards at Settings. ",1)]),_:1}),s(a(Q),{layout:"vertical"},{default:t(()=>[(n(!0),_(A,null,T(v.fields,e=>(n(),i(a(Z),{key:e.key,label:e.label},{default:t(()=>{var d;return[!e.type||typeof e.type=="string"?(n(),i(a(U),{key:0,value:m.inputValue[e.key],"onUpdate:value":o=>m.inputValue[e.key]=o,type:(d=e.type)!=null?d:"text"},null,8,["value","onUpdate:value","type"])):Array.isArray(e.type)?(n(),i(a(F),{key:1,value:m.inputValue[e.key],"onUpdate:value":o=>m.inputValue[e.key]=o},{default:t(()=>[(n(!0),_(A,null,T(e.type,o=>(n(),i(a($),{key:typeof o=="string"?o:o.value,value:typeof o=="string"?o:o.value},{default:t(()=>[u(c(typeof o=="string"?o:o.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value"])):g("",!0)]}),_:2},1032,["label"]))),128))]),_:1})]),_:1},8,["open"]))}}),ae={key:1},le=["src"],fe=V({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},live:{type:Boolean},emptyTitle:{},entityName:{},fields:{},table:{},videoUrl:{}},emits:["create"],setup(p,{emit:y}){const f=p,C=N(null),w=()=>{var l;f.fields?(l=C.value)==null||l.open():y("create",{})};async function m(l){y("create",l)}const b=E(()=>({"--columnCount":`${f.table.columns.length}`}));return(l,k)=>{const h=O("router-link");return n(),_(A,null,[s(a(ee),{direction:"vertical"},{default:t(()=>{var v;return[s(a(K),null,{default:t(()=>[u(c(l.title),1)]),_:1}),s(a(S),null,{default:t(()=>[u(c(l.description),1)]),_:1}),l.createButtonText?(n(),i(a(R),{key:0,type:"primary",onClick:w},{default:t(()=>[u(c(l.createButtonText),1)]),_:1})):g("",!0),s(a(z),{style:J(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(c(l.emptyTitle),1)]),headerCell:t(r=>[u(c(r.title),1)]),bodyCell:t(({column:{key:r},record:e})=>[e.cells[r].tagColor?(n(),i(a(W),{key:0,color:e.cells[r].tagColor},{default:t(()=>[u(c(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(c(e.cells[r].text),1)]),_:2},1032,["to"])):e.cells[r].actions?(n(),i(a(H),{key:2},{overlay:t(()=>[s(a(L),null,{default:t(()=>[(n(!0),_(A,null,T(e.cells[r].actions,(d,o)=>(n(),i(a(j),{key:o,danger:d.dangerous,onClick:ne=>d.onClick({key:e.key})},{default:t(()=>[u(c(d.label),1)]),_:2},1032,["danger","onClick"]))),128))]),_:2},1024)]),default:t(()=>[s(G,{path:a(D),style:{cursor:"pointer"}},null,8,["path"])]),_:2},1024)):(n(),i(a(B),{key:3},{default:t(()=>[u(c(e.cells[r].text),1)]),_:2},1024))]),footer:t(()=>[l.live?(n(),i(a(X),{key:0,justify:"end",gutter:10},{default:t(()=>[s(a(I),null,{default:t(()=>[s(a(P),{size:"small"})]),_:1}),s(a(I),null,{default:t(()=>[s(a(B),null,{default:t(()=>[u(" auto updating ")]),_:1})]),_:1})]),_:1})):g("",!0)]),_:1},8,["style","data-source","loading","columns"]),l.videoUrl?(n(),_("section",ae,[s(a(x),{orientation:"left"},{default:t(()=>[u("See it in action")]),_:1}),Y("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)])):g("",!0)]}),_:1}),l.fields?(n(),i(te,{key:0,ref_key:"modalRef",ref:C,fields:l.fields,"entity-name":l.entityName,onCreate:m},null,8,["fields","entity-name"])):g("",!0)],64)}}});export{fe as _};
//# sourceMappingURL=CrudView.vue_vue_type_script_setup_true_lang.9296340f.js.map
