import{d as S,H as U,r as V,b as n,c as i,w as t,u as a,f as s,b2 as u,eC as c,et as g,eB as T,c6 as D,af as M,bw as w,cS as F,ew as b,J as R,a as $,cd as O,cU as z,ev as E,bS as j,bQ as H,I as J,cb as L,bR as P,e as Q}from"./outputWidgets.541a6a3f.js";import{A as N,a as B}from"./index.07910c0e.js";import{A as Y,M as q,c as G}from"./Title.3011141f.js";import{F as K}from"./Form.2a9acb85.js";import{g as W}from"./icons.fbbc5318.js";import{A as X}from"./index.f20ad580.js";import{A as I}from"./index.c3edc651.js";import{A as Z}from"./index.3cff0676.js";import{A as x}from"./index.1797b918.js";import{A as ee}from"./index.33fb7a48.js";(function(){try{var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},f=new Error().stack;f&&(p._sentryDebugIds=p._sentryDebugIds||{},p._sentryDebugIds[f]="acfe3d4d-30a4-4985-97f7-3a814f2e85f4",p._sentryDebugIdIdentifier="sentry-dbid-acfe3d4d-30a4-4985-97f7-3a814f2e85f4")}catch{}})();const te=S({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(p,{expose:f,emit:m}){const C=`Create a new ${p.entityName}`,y=U({inputValue:{}}),v=V(!1),l=()=>v.value=!0,k=()=>v.value=!1,h=()=>{m("create",y.inputValue),k()};return f({open:l,close:k}),(_,r)=>(n(),i(a(q),{open:v.value,title:C,onCancel:k,onOk:h},{default:t(()=>[s(a(N),null,{default:t(()=>[u(" You may edit the "+c(_.entityName)+" name afterwards at Settings. ",1)]),_:1}),s(a(K),{layout:"vertical"},{default:t(()=>[(n(!0),g(w,null,T(_.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(D),{key:0,value:y.inputValue[e.key],"onUpdate:value":o=>y.inputValue[e.key]=o,type:(d=e.type)!=null?d:"text"},null,8,["value","onUpdate:value","type"])):Array.isArray(e.type)?(n(),i(a(M),{key:1,value:y.inputValue[e.key],"onUpdate:value":o=>y.inputValue[e.key]=o},{default:t(()=>[(n(!0),g(w,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(c(typeof o=="string"?o:o.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value"])):b("",!0)]}),_:2},1032,["label"]))),128))]),_:1})]),_:1},8,["open"]))}}),ae={key:1},le=["src"],me=S({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},live:{type:Boolean},emptyTitle:{},entityName:{},fields:{},table:{},videoUrl:{}},emits:["create"],setup(p,{emit:f}){const m=p,A=V(null),C=()=>{var l;m.fields?(l=A.value)==null||l.open():f("create",{})};async function y(l){f("create",l)}const v=R(()=>({"--columnCount":`${m.table.columns.length}`}));return(l,k)=>{const h=$("router-link");return n(),g(w,null,[s(a(ee),{direction:"vertical"},{default:t(()=>{var _;return[s(a(G),null,{default:t(()=>[u(c(l.title),1)]),_:1}),s(a(N),null,{default:t(()=>[u(c(l.description),1)]),_:1}),l.createButtonText?(n(),i(a(O),{key:0,type:"primary",onClick:C},{default:t(()=>[u(c(l.createButtonText),1)]),_:1})):b("",!0),s(a(z),{style:E(v.value),"data-source":l.table.rows,loading:l.loading&&!l.live,columns:(_=l.table.columns)==null?void 0:_.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(X),{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(L),{key:2},{overlay:t(()=>[s(a(j),null,{default:t(()=>[(n(!0),g(w,null,T(e.cells[r].actions,(d,o)=>(n(),i(a(H),{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(J,{path:a(W),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(Z),{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})):b("",!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}),Q("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)])):b("",!0)]}),_:1}),l.fields?(n(),i(te,{key:0,ref_key:"modalRef",ref:A,fields:l.fields,"entity-name":l.entityName,onCreate:y},null,8,["fields","entity-name"])):b("",!0)],64)}}});export{me as _};
//# sourceMappingURL=CrudView.vue_vue_type_script_setup_true_lang.af69973c.js.map
