import{d as B,G as I,r as N,b as n,c as u,w as t,u as l,f as c,b0 as s,eA as i,er as _,ez as T,c4 as D,ad as U,bu as w,cQ as M,eu as g,H as F,a as O,cb as V,cS as $,et as z,bQ as E,bO as Q,c9 as R,e as G}from"./registerWidgets.7c26f935.js";import{A as S,M as H,a as L}from"./index.315bc9f8.js";import{A as P,c as Y}from"./Title.9a021125.js";import{F as j}from"./Form.ac091445.js";import{A as q}from"./index.611607c8.js";import{A as x}from"./index.9a7a96c9.js";(function(){try{var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d=new Error().stack;d&&(p._sentryDebugIds=p._sentryDebugIds||{},p._sentryDebugIds[d]="42354538-ae2c-423e-947b-164277c38950",p._sentryDebugIdIdentifier="sentry-dbid-42354538-ae2c-423e-947b-164277c38950")}catch{}})();const J=B({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(p,{expose:d,emit:f}){const h=`Create a new ${p.entityName}`,y=I({inputValue:{}}),b=N(!1),a=()=>b.value=!0,k=()=>b.value=!1,A=()=>{f("create",y.inputValue),k()};return d({open:a,close:k}),(v,o)=>(n(),u(l(H),{open:b.value,title:h,onCancel:k,onOk:A},{default:t(()=>[c(l(S),null,{default:t(()=>[s(" You may edit the "+i(v.entityName)+" name afterwards at Settings. ",1)]),_:1}),c(l(j),{layout:"vertical"},{default:t(()=>[(n(!0),_(w,null,T(v.fields,e=>(n(),u(l(P),{key:e.key,label:e.label},{default:t(()=>{var m;return[!e.type||typeof e.type=="string"?(n(),u(l(D),{key:0,value:y.inputValue[e.key],"onUpdate:value":r=>y.inputValue[e.key]=r,type:(m=e.type)!=null?m:"text"},null,8,["value","onUpdate:value","type"])):Array.isArray(e.type)?(n(),u(l(U),{key:1,value:y.inputValue[e.key],"onUpdate:value":r=>y.inputValue[e.key]=r},{default:t(()=>[(n(!0),_(w,null,T(e.type,r=>(n(),u(l(M),{key:typeof r=="string"?r:r.value,value:typeof r=="string"?r:r.value},{default:t(()=>[s(i(typeof r=="string"?r:r.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value"])):g("",!0)]}),_:2},1032,["label"]))),128))]),_:1})]),_:1},8,["open"]))}}),K={key:1},W=["src"],re=B({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},emptyTitle:{},entityName:{},fields:{},table:{},videoUrl:{}},emits:["create"],setup(p,{emit:d}){const f=p,C=N(null),h=()=>{var a;f.fields?(a=C.value)==null||a.open():d("create",{})};async function y(a){d("create",a)}const b=F(()=>({"--columnCount":`${f.table.columns.length}`}));return(a,k)=>{const A=O("router-link");return n(),_(w,null,[c(l(x),{direction:"vertical"},{default:t(()=>{var v;return[c(l(Y),null,{default:t(()=>[s(i(a.title),1)]),_:1}),c(l(S),null,{default:t(()=>[s(i(a.description),1)]),_:1}),a.createButtonText?(n(),u(l(V),{key:0,type:"primary",onClick:h},{default:t(()=>[s(i(a.createButtonText),1)]),_:1})):g("",!0),c(l($),{style:z(b.value),"data-source":a.table.rows,loading:a.loading,columns:(v=a.table.columns)==null?void 0:v.map(({name:o},e)=>({title:o,key:e}))},{emptyText:t(()=>[s(i(a.emptyTitle),1)]),headerCell:t(o=>[s(i(o.title),1)]),bodyCell:t(({column:{key:o},record:e})=>[e.cells[o].link?(n(),u(A,{key:0,to:e.cells[o].link},{default:t(()=>[s(i(e.cells[o].text),1)]),_:2},1032,["to"])):e.cells[o].actions?(n(),u(l(R),{key:1},{overlay:t(()=>[c(l(E),null,{default:t(()=>[(n(!0),_(w,null,T(e.cells[o].actions,(m,r)=>(n(),u(l(Q),{key:r,danger:m.dangerous,onClick:X=>m.onClick({key:e.key})},{default:t(()=>[s(i(m.label),1)]),_:2},1032,["danger","onClick"]))),128))]),_:2},1024)]),default:t(()=>[c(l(V),null,{default:t(()=>[s(" actions ")]),_:1})]),_:2},1024)):(n(),u(l(L),{key:2},{default:t(()=>[s(i(e.cells[o].text),1)]),_:2},1024))]),_:1},8,["style","data-source","loading","columns"]),a.videoUrl?(n(),_("section",K,[c(l(q),{orientation:"left"},{default:t(()=>[s("See it in action")]),_:1}),G("iframe",{style:{width:"100%","aspect-ratio":"16/9"},src:a.videoUrl,title:"runtimes example",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:""},null,8,W)])):g("",!0)]}),_:1}),a.fields?(n(),u(J,{key:0,ref_key:"modalRef",ref:C,fields:a.fields,"entity-name":a.entityName,onCreate:y},null,8,["fields","entity-name"])):g("",!0)],64)}}});export{re as _};
//# sourceMappingURL=CrudView.vue_vue_type_script_setup_true_lang.7813a1ae.js.map
