@oneclick.dev/cms-core-modules 0.0.56 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ContentEditor-HwHspQO1.mjs → ContentEditor-BnVALYPw.mjs} +5659 -5562
- package/dist/ContentEditor-CY13Sf3g.js +290 -0
- package/dist/{Entries-DcpPvlYj.js → Entries-DlFiZ8EU.js} +1 -1
- package/dist/{Entries-QLMtTYLX.mjs → Entries-zyhycw1M.mjs} +1 -1
- package/dist/{Overview-KT2Mgfh5.js → Overview-CwCAeBnX.js} +1 -1
- package/dist/{Overview-D54pjmI6.mjs → Overview-D1nJLBe1.mjs} +1 -1
- package/dist/{TableView-CpO53xcX.js → TableView-BMtKYjLK.js} +36 -36
- package/dist/{TableView-D9J5rUls.mjs → TableView-Cxs1mpIy.mjs} +8079 -8050
- package/dist/View-7qb_ohVo.js +1 -0
- package/dist/View-C7axVP9t.mjs +25 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +6 -6
- package/dist/interpolation-BHSqsh8Q.mjs +65 -0
- package/dist/interpolation-We8hT28L.js +1 -0
- package/dist/src/lib/interpolation.d.ts +1 -1
- package/package.json +2 -2
- package/dist/ContentEditor-BBdzuTJJ.js +0 -290
- package/dist/View-DlHBZbFu.js +0 -1
- package/dist/View-Dv5QMrSn.mjs +0 -25
- package/dist/interpolation-BNUjI7LH.js +0 -1
- package/dist/interpolation-BpGXqOz8.mjs +0 -59
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),g=require("@oneclick.dev/cms-kit"),K=require("./interpolation-BNUjI7LH.js"),N=require("./index-ijdf0d9-.js"),H={class:"flex items-center gap-2"},O={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},W={key:0},G={key:1},Q={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},X={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},J=["href"],Y=["href"],Z=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup($){const a=e.inject("selection"),f=e.inject("collection"),y=$,{config:c}=g.useModule(),{navigateTo:s,params:b}=g.useModuleRoute(),{hasPermission:x}=g.useModulePermissions(),i=(n,t)=>{n?a.value.push(t):a.value=a.value.filter(r=>r!==t)},v=n=>{if(!f.value)return"about:blank";let t=c.domain?.trim(),r=f.value.defaultLanguageRoutePattern?.trim();if(console.log("waza",{domain:t,pattern:r,entry:n}),!t||!r)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),r.startsWith("/")||(r="/"+r);const p=n.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return K.interpolateTemplateFromVariableContext(t+r,[{name:"slug",value:p},{name:"id",value:n.id},{name:"lang",value:c.defaultLanguage||"en"}])},k=n=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${n.id}`,C=e.computed(()=>y.entries?.map(n=>({...n,status:n.archived?"archived":n.liveByLocale&&n.liveByLocale.length>0?"published":"draft",publishProgress:{completed:n.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(n,t)=>{const r=e.resolveComponent("TableHead"),p=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),w=e.resolveComponent("Checkbox"),h=e.resolveComponent("TableCell"),E=e.resolveComponent("Button"),_=e.resolveComponent("TableBody"),T=e.resolveComponent("Table"),S=e.resolveComponent("Card");return e.openBlock(),e.createBlock(S,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(T,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(r,{key:0})):e.createCommentVNode("",!0),e.createVNode(r,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(r,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,d=>(e.openBlock(),e.createBlock(p,{key:d.id,onClick:m=>e.unref(s)("collections/"+e.unref(b).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(h,{key:0},{default:e.withCtx(()=>[e.createVNode(w,{"model-value":e.unref(a)?.includes(d.id),"onUpdate:modelValue":m=>i(m,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(h,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",O,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",W,"Published")):(e.openBlock(),e.createElementBlock("span",G,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",Q,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",X,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(h,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:v(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,J)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:k(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Y)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),ee={class:"flex items-center space-x-2 mb-4"},te={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},oe={class:"flex items-center space-x-2 mb-4"},ne={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},le={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re=e.defineComponent({__name:"FilterPopover",setup($){const a=e.inject("filter"),f=e.ref(""),y=()=>{a.value={published:!0,draft:!0,archived:!1}};return(c,s)=>{const b=e.resolveComponent("Button"),x=e.resolveComponent("PopoverTrigger"),i=e.resolveComponent("Checkbox"),v=e.resolveComponent("PopoverContent"),k=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(x,{asChild:""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),s[3]||(s[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(v,{class:"w-64"},{default:e.withCtx(()=>[s[5]||(s[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ee,[e.createVNode(i,{id:"chk_published_entries",modelValue:e.unref(a).published,"onUpdate:modelValue":s[0]||(s[0]=C=>e.unref(a).published=C)},null,8,["modelValue"]),e.createElementVNode("label",te," Show published "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",oe,[e.createVNode(i,{id:"chk_draft_entries",modelValue:e.unref(a).draft,"onUpdate:modelValue":s[1]||(s[1]=C=>e.unref(a).draft=C)},null,8,["modelValue"]),e.createElementVNode("label",ne," Show draft "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",le,[e.createVNode(i,{id:"chk_archived_entries",modelValue:e.unref(a).archived,"onUpdate:modelValue":s[2]||(s[2]=C=>e.unref(a).archived=C)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(f.value||"entries"),1)]),!e.unref(a).published||!e.unref(a).draft||e.unref(a).archived?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),s[4]||(s[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),se=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup($,{emit:a}){const f=a,y=e.inject("entries"),c=e.inject("selection"),s=e.inject("config"),{hasPermission:b}=g.useModulePermissions(),{navigateTo:x}=g.useModuleRoute(),i=e.computed(()=>c.value?.length!==1?null:y.value?.find(n=>n.id===c.value[0])),v=n=>{let t=s.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",n.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",n.slug),window.open(t,"_blank")},k=async(n,t)=>{try{if(!["draft","published","archived"].includes(t))return;await g.useFirebaseIntegration(s.project).update(s.contentCollection,n.id,{status:t}),n.status=t,N.toast.success("Entry status changed")}catch{N.toast.error("Failed to change entry status")}},C=async n=>{try{if(!["draft","published","archived"].includes(n))return;const t=g.useFirebaseIntegration(s.project),r=[];c.value.forEach(async p=>{r.push(t.update(s.contentCollection,p,{status:n}))}),N.toast.promise(Promise.all(r),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const p=c.value.length;return c.value.forEach(u=>{y.value.find(w=>w.id==u).status=n}),c.value=[],`Entry status changed for ${p} entries`},error:p=>"Failed to change entry status"})}catch{N.toast.error("Failed to change entry status")}};return(n,t)=>{const r=e.resolveComponent("ContextMenuTrigger"),p=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),w=e.resolveComponent("ContextMenuContent"),h=e.resolveComponent("ContextMenuSeparator"),E=e.resolveComponent("ContextMenuSubTrigger"),_=e.resolveComponent("ContextMenuCheckboxItem"),T=e.resolveComponent("ContextMenuSubContent"),S=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(r,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(w,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=m=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&i.value?(e.openBlock(),e.createBlock(w,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=m=>e.unref(x)(i.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(h),e.unref(s).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=m=>v(i.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(h)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=m=>f("duplicateEntry",i.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[4]||(t[4]=m=>k(i.value,"draft")),modelValue:i.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(_,{onClick:t[5]||(t[5]=m=>k(i.value,"published")),modelValue:i.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(_,{onClick:t[6]||(t[6]=m=>k(i.value,"archived")),modelValue:i.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=m=>f("deleteEntry",i.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(w,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[8]||(t[8]=m=>C("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(_,{onClick:t[9]||(t[9]=m=>C("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(_,{onClick:t[10]||(t[10]=m=>C("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=m=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ie={key:0,class:"relative flex flex-col flex-1"},ce={class:"flex items-center justify-between gap-4 w-full my-4"},de={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},ue={class:"flex items-center gap-4"},pe={class:"text-lg whitespace-nowrap"},me={class:"relative w-full max-w-sm items-center"},fe={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ve={class:"flex items-center gap-4"},Ce={class:"capitalize"},ge={class:"flex flex-1"},xe=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup($){const a=$,{hasPermission:f,isAdmin:y}=g.useModulePermissions(),{params:c,navigateTo:s}=g.useModuleRoute(),{confirm:b}=g.useConfirmation(),x=g.useFirebaseIntegration(a.config.project),i=e.ref(null),v=e.ref([]);g.useModuleBreadcrumbs(()=>[{text:i.value?.name??""}]);const k=async()=>{const l=await x.get(a.config.collectionsCollection,c.value.collectionId);l?i.value=l:(s("/"),N.toast.error("Collection not found"))},C=async()=>{const l=await x.find(a.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});v.value=l||[]},n=e.ref(1),t=e.ref([]),r=e.ref(""),p=e.ref(10),u=e.computed(()=>v.value.filter(l=>l.title.toLowerCase().includes(r.value.toLowerCase())||l.slug.toLowerCase().includes(r.value.toLowerCase())||l.id.toLowerCase().includes(r.value.toLowerCase()))),w=e.computed(()=>{if(u.value.length<=p.value)return u.value;const l=(n.value-1)*p.value,o=l+p.value;return u.value.slice(l,o)});async function h(l){return(await x.find(a.config.contentCollection,{filters:[{field:"slug",operator:"==",value:l}]})).length>0}const E=()=>{t.value=w.value.map(l=>l.id)},_=async l=>{try{let o={...l},V=o.slug+"-copy",L=2;for(;await h(V);)V=o.slug+"-copy-"+L,L++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=V,o.status="draft",o.title=o.title+" (copy)";const D=await x.add(a.config.contentCollection,o);s(D.id),N.toast.success("Entry duplicated")}catch{N.toast.error("Failed to duplicate entry")}},T=async l=>{if(await b(`Are you sure you want to delete "${l.title}"?`))try{await x.remove(a.config.contentCollection,l.id),v.value=v.value.filter(V=>V.id!==l.id),t.value=[],N.toast.success("Entry deleted")}catch{N.toast.error("Failed to delete entry")}},S=async()=>{if(await b(`Are you sure you want to delete all selected ${i?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await x.remove(a.config.contentCollection,o)}),v.value=v.value.filter(o=>!t.value.includes(o.id)),t.value=[],N.toast.success("Entries deleted")}catch{N.toast.error("Failed to delete entries")}},d=e.ref({published:!0,draft:!0,archived:!1});e.watch(d,()=>{n.value=1});const m=l=>{l.target?.matches("input, textarea")||l.target?.isContentEditable||(l.key==="Escape"&&(t.value=[]),(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="a"&&(l.preventDefault(),E()))};return e.onMounted(()=>{k(),C(),window.addEventListener("keydown",m)}),e.onUnmounted(()=>{window.removeEventListener("keydown",m)}),e.provide("config",a.config),e.provide("filter",d),e.provide("entries",v),e.provide("selection",t),e.provide("collection",i),(l,o)=>{const V=e.resolveComponent("Button"),L=e.resolveComponent("Input"),D=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),A=e.resolveComponent("PaginationEllipsis"),U=e.resolveComponent("PaginationNext"),j=e.resolveComponent("PaginationLast"),R=e.resolveComponent("PaginationList"),q=e.resolveComponent("Pagination");return i.value?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",ce,[e.createVNode(V,{onClick:o[0]||(o[0]=B=>e.unref(s)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createElementVNode("p",pe,e.toDisplayString(u.value?.length)+" "+e.toDisplayString(i.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",me,[e.createVNode(L,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>r.value="",["escape"])),modelValue:r.value,"onUpdate:modelValue":o[2]||(o[2]=B=>r.value=B)},null,8,["modelValue"]),e.createElementVNode("span",fe,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ve,[t.value.length>0?(e.openBlock(),e.createBlock(V,{key:0,variant:"destructive",onClick:S},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(y)()||e.unref(f)("create-entry")&&i.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(V,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(s)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(i.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(re)])],512),e.createElementVNode("div",ge,[e.createVNode(se,{onSelectAll:E,onDuplicateEntry:_,onDeleteEntry:T,onDeleteSelection:S},{default:e.withCtx(()=>[e.createVNode(Z,{entries:w.value},null,8,["entries"])]),_:1})]),u.value?.length>p.value?(e.openBlock(),e.createBlock(q,{key:0,page:n.value,"onUpdate:page":o[4]||(o[4]=B=>n.value=B),"items-per-page":p.value,total:u.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(R,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(D),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(M,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[M.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:M.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(V,{class:"size-10 p-0",variant:M.value===n.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(A,{key:M.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(U),e.createVNode(j)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),g=require("@oneclick.dev/cms-kit"),K=require("./interpolation-We8hT28L.js"),N=require("./index-ijdf0d9-.js"),H={class:"flex items-center gap-2"},O={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},W={key:0},G={key:1},Q={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},X={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},J=["href"],Y=["href"],Z=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup($){const a=e.inject("selection"),f=e.inject("collection"),y=$,{config:c}=g.useModule(),{navigateTo:s,params:b}=g.useModuleRoute(),{hasPermission:x}=g.useModulePermissions(),i=(n,t)=>{n?a.value.push(t):a.value=a.value.filter(r=>r!==t)},v=n=>{if(!f.value)return"about:blank";let t=c.domain?.trim(),r=f.value.defaultLanguageRoutePattern?.trim();if(console.log("waza",{domain:t,pattern:r,entry:n}),!t||!r)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),r.startsWith("/")||(r="/"+r);const p=n.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return K.interpolateTemplateFromVariableContext(t+r,[{name:"slug",value:p},{name:"id",value:n.id},{name:"lang",value:c.defaultLanguage||"en"}])},k=n=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${n.id}`,C=e.computed(()=>y.entries?.map(n=>({...n,status:n.archived?"archived":n.liveByLocale&&n.liveByLocale.length>0?"published":"draft",publishProgress:{completed:n.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(n,t)=>{const r=e.resolveComponent("TableHead"),p=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),w=e.resolveComponent("Checkbox"),h=e.resolveComponent("TableCell"),E=e.resolveComponent("Button"),_=e.resolveComponent("TableBody"),T=e.resolveComponent("Table"),S=e.resolveComponent("Card");return e.openBlock(),e.createBlock(S,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(T,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(r,{key:0})):e.createCommentVNode("",!0),e.createVNode(r,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(r,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,d=>(e.openBlock(),e.createBlock(p,{key:d.id,onClick:m=>e.unref(s)("collections/"+e.unref(b).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(h,{key:0},{default:e.withCtx(()=>[e.createVNode(w,{"model-value":e.unref(a)?.includes(d.id),"onUpdate:modelValue":m=>i(m,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(h,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",O,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",W,"Published")):(e.openBlock(),e.createElementBlock("span",G,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",Q,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",X,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(h,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:v(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,J)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:k(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Y)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),ee={class:"flex items-center space-x-2 mb-4"},te={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},oe={class:"flex items-center space-x-2 mb-4"},ne={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},le={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re=e.defineComponent({__name:"FilterPopover",setup($){const a=e.inject("filter"),f=e.ref(""),y=()=>{a.value={published:!0,draft:!0,archived:!1}};return(c,s)=>{const b=e.resolveComponent("Button"),x=e.resolveComponent("PopoverTrigger"),i=e.resolveComponent("Checkbox"),v=e.resolveComponent("PopoverContent"),k=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(x,{asChild:""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),s[3]||(s[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(v,{class:"w-64"},{default:e.withCtx(()=>[s[5]||(s[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ee,[e.createVNode(i,{id:"chk_published_entries",modelValue:e.unref(a).published,"onUpdate:modelValue":s[0]||(s[0]=C=>e.unref(a).published=C)},null,8,["modelValue"]),e.createElementVNode("label",te," Show published "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",oe,[e.createVNode(i,{id:"chk_draft_entries",modelValue:e.unref(a).draft,"onUpdate:modelValue":s[1]||(s[1]=C=>e.unref(a).draft=C)},null,8,["modelValue"]),e.createElementVNode("label",ne," Show draft "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",le,[e.createVNode(i,{id:"chk_archived_entries",modelValue:e.unref(a).archived,"onUpdate:modelValue":s[2]||(s[2]=C=>e.unref(a).archived=C)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(f.value||"entries"),1)]),!e.unref(a).published||!e.unref(a).draft||e.unref(a).archived?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),s[4]||(s[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),se=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup($,{emit:a}){const f=a,y=e.inject("entries"),c=e.inject("selection"),s=e.inject("config"),{hasPermission:b}=g.useModulePermissions(),{navigateTo:x}=g.useModuleRoute(),i=e.computed(()=>c.value?.length!==1?null:y.value?.find(n=>n.id===c.value[0])),v=n=>{let t=s.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",n.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",n.slug),window.open(t,"_blank")},k=async(n,t)=>{try{if(!["draft","published","archived"].includes(t))return;await g.useFirebaseIntegration(s.project).update(s.contentCollection,n.id,{status:t}),n.status=t,N.toast.success("Entry status changed")}catch{N.toast.error("Failed to change entry status")}},C=async n=>{try{if(!["draft","published","archived"].includes(n))return;const t=g.useFirebaseIntegration(s.project),r=[];c.value.forEach(async p=>{r.push(t.update(s.contentCollection,p,{status:n}))}),N.toast.promise(Promise.all(r),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const p=c.value.length;return c.value.forEach(u=>{y.value.find(w=>w.id==u).status=n}),c.value=[],`Entry status changed for ${p} entries`},error:p=>"Failed to change entry status"})}catch{N.toast.error("Failed to change entry status")}};return(n,t)=>{const r=e.resolveComponent("ContextMenuTrigger"),p=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),w=e.resolveComponent("ContextMenuContent"),h=e.resolveComponent("ContextMenuSeparator"),E=e.resolveComponent("ContextMenuSubTrigger"),_=e.resolveComponent("ContextMenuCheckboxItem"),T=e.resolveComponent("ContextMenuSubContent"),S=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(r,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(w,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=m=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&i.value?(e.openBlock(),e.createBlock(w,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=m=>e.unref(x)(i.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(h),e.unref(s).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=m=>v(i.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(h)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=m=>f("duplicateEntry",i.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[4]||(t[4]=m=>k(i.value,"draft")),modelValue:i.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(_,{onClick:t[5]||(t[5]=m=>k(i.value,"published")),modelValue:i.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(_,{onClick:t[6]||(t[6]=m=>k(i.value,"archived")),modelValue:i.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=m=>f("deleteEntry",i.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(w,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[8]||(t[8]=m=>C("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(_,{onClick:t[9]||(t[9]=m=>C("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(_,{onClick:t[10]||(t[10]=m=>C("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=m=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ie={key:0,class:"relative flex flex-col flex-1"},ce={class:"flex items-center justify-between gap-4 w-full my-4"},de={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},ue={class:"flex items-center gap-4"},pe={class:"text-lg whitespace-nowrap"},me={class:"relative w-full max-w-sm items-center"},fe={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ve={class:"flex items-center gap-4"},Ce={class:"capitalize"},ge={class:"flex flex-1"},xe=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup($){const a=$,{hasPermission:f,isAdmin:y}=g.useModulePermissions(),{params:c,navigateTo:s}=g.useModuleRoute(),{confirm:b}=g.useConfirmation(),x=g.useFirebaseIntegration(a.config.project),i=e.ref(null),v=e.ref([]);g.useModuleBreadcrumbs(()=>[{text:i.value?.name??""}]);const k=async()=>{const l=await x.get(a.config.collectionsCollection,c.value.collectionId);l?i.value=l:(s("/"),N.toast.error("Collection not found"))},C=async()=>{const l=await x.find(a.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});v.value=l||[]},n=e.ref(1),t=e.ref([]),r=e.ref(""),p=e.ref(10),u=e.computed(()=>v.value.filter(l=>l.title.toLowerCase().includes(r.value.toLowerCase())||l.slug.toLowerCase().includes(r.value.toLowerCase())||l.id.toLowerCase().includes(r.value.toLowerCase()))),w=e.computed(()=>{if(u.value.length<=p.value)return u.value;const l=(n.value-1)*p.value,o=l+p.value;return u.value.slice(l,o)});async function h(l){return(await x.find(a.config.contentCollection,{filters:[{field:"slug",operator:"==",value:l}]})).length>0}const E=()=>{t.value=w.value.map(l=>l.id)},_=async l=>{try{let o={...l},V=o.slug+"-copy",L=2;for(;await h(V);)V=o.slug+"-copy-"+L,L++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=V,o.status="draft",o.title=o.title+" (copy)";const D=await x.add(a.config.contentCollection,o);s(D.id),N.toast.success("Entry duplicated")}catch{N.toast.error("Failed to duplicate entry")}},T=async l=>{if(await b(`Are you sure you want to delete "${l.title}"?`))try{await x.remove(a.config.contentCollection,l.id),v.value=v.value.filter(V=>V.id!==l.id),t.value=[],N.toast.success("Entry deleted")}catch{N.toast.error("Failed to delete entry")}},S=async()=>{if(await b(`Are you sure you want to delete all selected ${i?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await x.remove(a.config.contentCollection,o)}),v.value=v.value.filter(o=>!t.value.includes(o.id)),t.value=[],N.toast.success("Entries deleted")}catch{N.toast.error("Failed to delete entries")}},d=e.ref({published:!0,draft:!0,archived:!1});e.watch(d,()=>{n.value=1});const m=l=>{l.target?.matches("input, textarea")||l.target?.isContentEditable||(l.key==="Escape"&&(t.value=[]),(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="a"&&(l.preventDefault(),E()))};return e.onMounted(()=>{k(),C(),window.addEventListener("keydown",m)}),e.onUnmounted(()=>{window.removeEventListener("keydown",m)}),e.provide("config",a.config),e.provide("filter",d),e.provide("entries",v),e.provide("selection",t),e.provide("collection",i),(l,o)=>{const V=e.resolveComponent("Button"),L=e.resolveComponent("Input"),D=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),A=e.resolveComponent("PaginationEllipsis"),U=e.resolveComponent("PaginationNext"),j=e.resolveComponent("PaginationLast"),R=e.resolveComponent("PaginationList"),q=e.resolveComponent("Pagination");return i.value?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",ce,[e.createVNode(V,{onClick:o[0]||(o[0]=B=>e.unref(s)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createElementVNode("p",pe,e.toDisplayString(u.value?.length)+" "+e.toDisplayString(i.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",me,[e.createVNode(L,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>r.value="",["escape"])),modelValue:r.value,"onUpdate:modelValue":o[2]||(o[2]=B=>r.value=B)},null,8,["modelValue"]),e.createElementVNode("span",fe,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ve,[t.value.length>0?(e.openBlock(),e.createBlock(V,{key:0,variant:"destructive",onClick:S},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(y)()||e.unref(f)("create-entry")&&i.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(V,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(s)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(i.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(re)])],512),e.createElementVNode("div",ge,[e.createVNode(se,{onSelectAll:E,onDuplicateEntry:_,onDeleteEntry:T,onDeleteSelection:S},{default:e.withCtx(()=>[e.createVNode(Z,{entries:w.value},null,8,["entries"])]),_:1})]),u.value?.length>p.value?(e.openBlock(),e.createBlock(q,{key:0,page:n.value,"onUpdate:page":o[4]||(o[4]=B=>n.value=B),"items-per-page":p.value,total:u.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(R,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(D),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(M,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[M.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:M.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(V,{class:"size-10 p-0",variant:M.value===n.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(A,{key:M.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(U),e.createVNode(j)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=xe;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as O, inject as j, computed as G, resolveComponent as a, createBlock as C, openBlock as c, withCtx as n, createVNode as t, createCommentVNode as h, unref as o, createTextVNode as v, toDisplayString as x, createElementBlock as E, Fragment as q, renderList as te, withModifiers as X, createElementVNode as d, ref as F, renderSlot as ue, watch as de, onMounted as ce, onUnmounted as pe, provide as K, withKeys as fe } from "vue";
|
|
2
2
|
import { Globe as ve, Pencil as me, Filter as ge, RotateCcw as _e, ExternalLink as be, ChevronLeft as ye, Search as Ce, Plus as xe } from "lucide-vue-next";
|
|
3
3
|
import { useModule as we, useModuleRoute as Y, useModulePermissions as Z, useFirebaseIntegration as J, useConfirmation as he, useModuleBreadcrumbs as ke } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import { i as Pe } from "./interpolation-
|
|
4
|
+
import { i as Pe } from "./interpolation-BHSqsh8Q.mjs";
|
|
5
5
|
import { t as L } from "./index-RLz1QPrf.mjs";
|
|
6
6
|
const Ee = { class: "flex items-center gap-2" }, $e = {
|
|
7
7
|
key: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-BNUjI7LH.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),o=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,o.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,o.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?o.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?o.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=l=>c.value=l)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=l=>v.value=l),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=l=>m.value=l),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=l=>a.value=l)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=l=>p.value=l),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=l=>x.value=l),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=l=>V.value=l),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=l=>n.value=l),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:o.value,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value=l),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=l=>C.value=l)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=l=>E.value=l)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,l=>(e.openBlock(),e.createBlock(D,{key:l.id,value:l.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${l.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[l.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(l.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=l=>i.value=l),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=l=>d.value=l),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{const o=await c.add(f.config.collectionsCollection,n);console.log("Added collection",o)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const o=r.value.findIndex(i=>i.id===n.id);o!==-1&&(r.value[o]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async o=>{if(o)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,o)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[0]||(o[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[1]||(o[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),o[6]||(o[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[2]||(o[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),o[7]||(o[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:o[3]||(o[3]=d=>v.value=d),onEdit:o[4]||(o[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-We8hT28L.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),o=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,o.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,o.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?o.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?o.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=l=>c.value=l)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=l=>v.value=l),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=l=>m.value=l),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=l=>a.value=l)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=l=>p.value=l),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=l=>x.value=l),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=l=>V.value=l),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=l=>n.value=l),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:o.value,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value=l),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=l=>C.value=l)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=l=>E.value=l)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,l=>(e.openBlock(),e.createBlock(D,{key:l.id,value:l.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${l.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[l.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(l.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=l=>i.value=l),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=l=>d.value=l),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{const o=await c.add(f.config.collectionsCollection,n);console.log("Added collection",o)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const o=r.value.findIndex(i=>i.id===n.id);o!==-1&&(r.value[o]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async o=>{if(o)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,o)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[0]||(o[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[1]||(o[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),o[6]||(o[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:o[2]||(o[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),o[7]||(o[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:o[3]||(o[3]=d=>v.value=d),onEdit:o[4]||(o[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as G, resolveComponent as n, createElementBlock as k, openBlock as c, Fragment as te, renderList as le, createBlock as w, unref as b, withCtx as l, createElementVNode as o, normalizeClass as oe, resolveDynamicComponent as ne, createCommentVNode as U, toDisplayString as P, createVNode as t, withModifiers as Ee, createTextVNode as d, ref as v, computed as q, useTemplateRef as Se, onMounted as De } from "vue";
|
|
2
2
|
import { icons as ae, EllipsisVertical as Te, Paintbrush as Pe, ToyBrick as Me, Plus as Ue } from "lucide-vue-next";
|
|
3
3
|
import { useModuleRoute as se, useConfirmation as ie, useModuleStorage as $e, useModulePermissions as Ne, useModuleBreadcrumbs as Ae, useFirebaseIntegration as Re } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import { i as Le } from "./interpolation-
|
|
4
|
+
import { i as Le } from "./interpolation-BHSqsh8Q.mjs";
|
|
5
5
|
import { t as z } from "./index-RLz1QPrf.mjs";
|
|
6
6
|
const Be = { class: "grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4" }, Ie = { class: "relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3" }, Fe = { class: "self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]" }, ze = ["title"], Oe = ["title"], je = { class: "absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100" }, qe = /* @__PURE__ */ G({
|
|
7
7
|
__name: "CollectionsGridView",
|