import{d as x,r as D,G as M,b as n,c as b,w as a,b0 as c,eA as o,e as y,er as p,ez as V,ak as B,eE as N,eF as U,bu as w,eu as C,eB as $,eC as z,v as E,H as F,a as H,f as _,u as i,cb as I,cS as j,et as G,bQ as L,bO as O,c9 as P}from"./registerWidgets.1e9167ab.js";import{M as Q}from"./Modal.b646cd22.js";import{A as W}from"./Title.d1f45d59.js";import{A as Y}from"./index.9165a659.js";import{A as q}from"./Text.c8d7b4c0.js";import{A as J}from"./index.32c7f8ee.js";import{A as K}from"./index.d74062f4.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m=new Error().stack;m&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[m]="40efa495-9b43-4909-8a8a-369b9426800c",r._sentryDebugIdIdentifier="sentry-dbid-40efa495-9b43-4909-8a8a-369b9426800c")}catch{}})();const R=r=>($("data-v-22f08b8b"),r=r(),z(),r),X={class:"main-text"},Z={class:"fields"},ee=["onUpdate:modelValue","type"],te=["onUpdate:modelValue"],ae=["value"],ne=R(()=>y("div",{class:"separator"},null,-1)),le={class:"buttons"},se=x({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(r,{expose:m,emit:h}){const u=D(null),f=M({inputValue:{}}),A={maxWidth:"350px",height:"unset",padding:"30px"},S={borderBottom:"none",fontSize:"18px",marginBottom:"17px",display:"flex",flexDirection:"column",justifyContent:"center",color:"#4E596A",lineHeight:"22px"},t={color:"#414A58",fontSize:"14px",alignItems:"unset"},T=()=>{var e;return(e=u==null?void 0:u.value)==null?void 0:e.open()},g=()=>{var e;return(e=u==null?void 0:u.value)==null?void 0:e.close()},v=()=>{h("create",f.inputValue),g()};return m({open:T,close:g}),(e,d)=>(n(),b(Q,{ref_key:"modalRef",ref:u,"container-style":A,"header-style":S,"content-style":t},{header:a(()=>[c(" Create a new "+o(e.entityName),1)]),content:a(()=>[y("div",X,"You may edit the "+o(e.entityName)+" name afterwards at Settings.",1),y("div",Z,[(n(!0),p(w,null,V(e.fields,l=>{var k;return n(),p("div",{key:l.key,class:"field"},[y("label",null,o(l.label),1),!l.type||typeof l.type=="string"?B((n(),p("input",{key:0,"onUpdate:modelValue":s=>f.inputValue[l.key]=s,type:(k=l.type)!=null?k:"text",class:"ws-name"},null,8,ee)),[[N,f.inputValue[l.key]]]):Array.isArray(l.type)?B((n(),p("select",{key:1,"onUpdate:modelValue":s=>f.inputValue[l.key]=s,class:"ws-name"},[(n(!0),p(w,null,V(l.type,s=>(n(),p("option",{key:typeof s=="string"?s:s.value,value:typeof s=="string"?s:s.value},o(typeof s=="string"?s:s.label),9,ae))),128))],8,te)),[[U,f.inputValue[l.key]]]):C("",!0)])}),128))]),ne,y("div",le,[y("button",{class:"cancel",onClick:g},"Cancel"),y("button",{class:"create",onClick:v},"Create "+o(e.entityName),1)])]),_:1},512))}});const oe=E(se,[["__scopeId","data-v-22f08b8b"]]),re={key:1},ie=["src"],_e=x({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},emptyTitle:{},entityName:{},fields:{},table:{},videoUrl:{}},emits:["create"],setup(r,{emit:m}){const h=r,u=D(null),f=()=>{var t;h.fields?(t=u.value)==null||t.open():m("create",{})};async function A(t){m("create",t)}const S=F(()=>({"--columnCount":`${h.table.columns.length}`}));return(t,T)=>{const g=H("router-link");return n(),p(w,null,[_(i(K),{direction:"vertical"},{default:a(()=>{var v;return[_(i(W),null,{default:a(()=>[c(o(t.title),1)]),_:1}),_(i(Y),null,{default:a(()=>[c(o(t.description),1)]),_:1}),t.createButtonText?(n(),b(i(I),{key:0,type:"primary",onClick:f},{default:a(()=>[c(o(t.createButtonText),1)]),_:1})):C("",!0),_(i(j),{style:G(S.value),"data-source":t.table.rows,loading:t.loading,columns:(v=t.table.columns)==null?void 0:v.map(({name:e},d)=>({title:e,key:d}))},{emptyText:a(()=>[c(o(t.emptyTitle),1)]),headerCell:a(e=>[c(o(e.title),1)]),bodyCell:a(({column:{key:e},record:d})=>[d.cells[e].link?(n(),b(g,{key:0,to:d.cells[e].link},{default:a(()=>[c(o(d.cells[e].text),1)]),_:2},1032,["to"])):d.cells[e].actions?(n(),b(i(P),{key:1},{overlay:a(()=>[_(i(L),null,{default:a(()=>[(n(!0),p(w,null,V(d.cells[e].actions,(l,k)=>(n(),b(i(O),{key:k,danger:l.dangerous,onClick:s=>l.onClick({key:d.key})},{default:a(()=>[c(o(l.label),1)]),_:2},1032,["danger","onClick"]))),128))]),_:2},1024)]),default:a(()=>[_(i(I),null,{default:a(()=>[c(" actions ")]),_:1})]),_:2},1024)):(n(),b(i(q),{key:2},{default:a(()=>[c(o(d.cells[e].text),1)]),_:2},1024))]),_:1},8,["style","data-source","loading","columns"]),t.videoUrl?(n(),p("section",re,[_(i(J),{orientation:"left"},{default:a(()=>[c("See it in action")]),_:1}),y("iframe",{style:{width:"100%","aspect-ratio":"16/9"},src:t.videoUrl,title:"runtimes example",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:""},null,8,ie)])):C("",!0)]}),_:1}),t.fields?(n(),b(oe,{key:0,ref_key:"modalRef",ref:u,fields:t.fields,"entity-name":t.entityName,onCreate:A},null,8,["fields","entity-name"])):C("",!0)],64)}}});export{_e as _};
//# sourceMappingURL=CrudView.vue_vue_type_script_setup_true_lang.e0bf9fc2.js.map
