@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54

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.
Files changed (126) hide show
  1. package/dist/CalendarDate-CRT2Viyt.mjs +830 -0
  2. package/dist/CalendarDate-CWtpXgpD.js +1 -0
  3. package/dist/Components-D9yIIosM.mjs +623 -0
  4. package/dist/Components-DXbx0RLV.js +1 -0
  5. package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
  6. package/dist/ContentEditor-DzTi8fSZ.js +290 -0
  7. package/dist/Create-BP8TX6rj.js +1 -0
  8. package/dist/Create-Bwf1RXdG.mjs +1248 -0
  9. package/dist/DateFormatter-BbcSwTs4.js +1 -0
  10. package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
  11. package/dist/Detail-B-PnkcXD.mjs +3473 -0
  12. package/dist/Detail-BVlGSjOq.mjs +380 -0
  13. package/dist/Detail-C4E1T87K.mjs +26 -0
  14. package/dist/Detail-CNfTDUE5.js +1 -0
  15. package/dist/Detail-Cd5CBVN0.js +1 -0
  16. package/dist/Detail-CpfOQChd.mjs +585 -0
  17. package/dist/Detail-CwagT6gQ.mjs +650 -0
  18. package/dist/Detail-DUo6qKqO.js +1 -0
  19. package/dist/Detail-Dd_OkpcN.js +1 -0
  20. package/dist/Detail-mvSGbnFU.js +1 -0
  21. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
  22. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
  23. package/dist/Entries-DcpPvlYj.js +1 -0
  24. package/dist/Entries-QLMtTYLX.mjs +713 -0
  25. package/dist/Find-BPR0uU-Z.mjs +229 -0
  26. package/dist/Find-BidEQJxT.js +1 -0
  27. package/dist/GlobalStyling-CMzPRd18.js +17 -0
  28. package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
  29. package/dist/Overview-BDlBCUI_.js +1 -0
  30. package/dist/Overview-BH3NwvNX.mjs +26 -0
  31. package/dist/Overview-BLsZMHNW.mjs +178 -0
  32. package/dist/Overview-BNMZ9MUK.js +1 -0
  33. package/dist/Overview-BbvfH1u-.js +1 -0
  34. package/dist/Overview-CDN88OSM.mjs +190 -0
  35. package/dist/Overview-CEPodGCn.mjs +311 -0
  36. package/dist/Overview-CvquDPhB.js +1 -0
  37. package/dist/Overview-D54pjmI6.mjs +633 -0
  38. package/dist/Overview-D67UjG6n.mjs +947 -0
  39. package/dist/Overview-KT2Mgfh5.js +1 -0
  40. package/dist/Overview-T-lsy3UZ.js +1 -0
  41. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
  42. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
  43. package/dist/TableView-CpO53xcX.js +111 -0
  44. package/dist/TableView-D9J5rUls.mjs +72921 -0
  45. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
  46. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
  47. package/dist/View-DlHBZbFu.js +1 -0
  48. package/dist/View-Dv5QMrSn.mjs +25 -0
  49. package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  50. package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  51. package/dist/agenda-B49oKGeh.mjs +706 -0
  52. package/dist/agenda-DipQ5IWP.js +1 -0
  53. package/dist/availability-C7q9tq6l.js +1 -0
  54. package/dist/availability-DeCkqiu8.mjs +613 -0
  55. package/dist/cms-core-modules.css +1 -1
  56. package/dist/countries-BTPvmrsb.mjs +4 -0
  57. package/dist/countries-CgZ081No.js +1 -0
  58. package/dist/exceptions-D3b18TiY.mjs +647 -0
  59. package/dist/exceptions-DJ9zWX3k.js +1 -0
  60. package/dist/floating-ui.dom-C82nbomj.js +1 -0
  61. package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
  62. package/dist/google-CvtuJwgk.mjs +4 -0
  63. package/dist/google-D4N3gb01.js +1 -0
  64. package/dist/index--jjEzba7.mjs +24 -0
  65. package/dist/index-9HVlmvK3.js +1 -0
  66. package/dist/index-BEGU8Kme.mjs +12 -0
  67. package/dist/index-Bwi1mtkq.mjs +24 -0
  68. package/dist/index-BzuHN-r8.mjs +24 -0
  69. package/dist/index-CImCyE3L.mjs +24 -0
  70. package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
  71. package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
  72. package/dist/index-CQiY-oTN.mjs +24 -0
  73. package/dist/index-CSxYBeVA.js +1 -0
  74. package/dist/index-CkiNvRzs.js +1 -0
  75. package/dist/index-Co4ON2Di.js +1 -0
  76. package/dist/index-CwqrAU-H.js +1 -0
  77. package/dist/index-Cz-baGax.js +1 -0
  78. package/dist/index-D2a6wEPh.js +1 -0
  79. package/dist/index-DFQGVHTs.js +1 -0
  80. package/dist/index-DI6mydpm.mjs +138 -0
  81. package/dist/index-DMoyoaks.mjs +22 -0
  82. package/dist/index-DT1wWnUk.mjs +24 -0
  83. package/dist/index-DUeFrD-B.js +1 -0
  84. package/dist/index-DsnoK4ia.mjs +579 -0
  85. package/dist/index-R2oUDsjx.js +1 -0
  86. package/dist/index-RLz1QPrf.mjs +203 -0
  87. package/dist/index-UtjLbLw-.js +1 -0
  88. package/dist/index-_mG-aU3Z.mjs +87 -0
  89. package/dist/index-_sQDF1pH.js +1 -0
  90. package/dist/index-ijdf0d9-.js +1 -0
  91. package/dist/index-klI238nT.mjs +24 -0
  92. package/dist/index.cjs.js +1 -330
  93. package/dist/index.mjs +287 -69051
  94. package/dist/interpolation-BNUjI7LH.js +1 -0
  95. package/dist/interpolation-BpGXqOz8.mjs +59 -0
  96. package/dist/payment-kTjsV0Jj.js +1 -0
  97. package/dist/payment-zpCM0LD-.mjs +981 -0
  98. package/dist/regular-C4_3YXqx.mjs +602 -0
  99. package/dist/regular-DFwPEbZO.js +1 -0
  100. package/dist/regular-slots-4ooEpICB.mjs +67 -0
  101. package/dist/regular-slots-BAVGbomI.js +1 -0
  102. package/dist/resources-MpQkSstv.mjs +563 -0
  103. package/dist/resources-iM28T3dD.js +1 -0
  104. package/dist/src/appointments/index.d.ts +4 -28
  105. package/dist/src/appointments/routes.d.ts +3 -9
  106. package/dist/src/content-manager/index.d.ts +5 -147
  107. package/dist/src/content-manager/routes.d.ts +4 -128
  108. package/dist/src/custom/index.d.ts +2 -2
  109. package/dist/src/custom/routes.d.ts +1 -1
  110. package/dist/src/mail-templates/index.d.ts +2 -30
  111. package/dist/src/mail-templates/routes.d.ts +1 -11
  112. package/dist/src/product-collections/index.d.ts +2 -30
  113. package/dist/src/product-collections/routes.d.ts +1 -11
  114. package/dist/src/products/index.d.ts +2 -30
  115. package/dist/src/products/routes.d.ts +1 -11
  116. package/dist/src/promo-codes/index.d.ts +2 -30
  117. package/dist/src/promo-codes/routes.d.ts +1 -11
  118. package/dist/src/shipping-options/index.d.ts +2 -30
  119. package/dist/src/shipping-options/routes.d.ts +1 -11
  120. package/dist/src/table/index.d.ts +2 -70
  121. package/dist/src/table/routes.d.ts +1 -51
  122. package/dist/utils-BVKy9S2J.mjs +29 -0
  123. package/dist/utils-D6CaKJbp.js +2 -0
  124. package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
  125. package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
  126. package/package.json +3 -3
@@ -0,0 +1,713 @@
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
+ 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
+ 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-BpGXqOz8.mjs";
5
+ import { t as L } from "./index-RLz1QPrf.mjs";
6
+ const Ee = { class: "flex items-center gap-2" }, $e = {
7
+ key: 0,
8
+ class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
9
+ }, Se = { key: 0 }, Le = { key: 1 }, Me = {
10
+ key: 1,
11
+ class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
12
+ }, Ve = {
13
+ key: 2,
14
+ class: "bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"
15
+ }, Te = ["href"], ze = ["href"], Be = /* @__PURE__ */ O({
16
+ __name: "ListView",
17
+ props: {
18
+ entries: {
19
+ type: Array,
20
+ required: !0
21
+ }
22
+ },
23
+ setup(R) {
24
+ const r = j("selection"), w = j("collection"), B = R, { config: m } = we(), { navigateTo: p, params: I } = Y(), { hasPermission: $ } = Z(), f = (s, e) => {
25
+ s ? r.value.push(e) : r.value = r.value.filter((u) => u !== e);
26
+ }, k = (s) => {
27
+ if (!w.value) return "about:blank";
28
+ let e = m.domain?.trim(), u = w.value.defaultLanguageRoutePattern?.trim();
29
+ if (console.log("waza", { domain: e, pattern: u, entry: s }), !e || !u) return "about:blank";
30
+ e.endsWith("/") && (e = e.slice(0, -1)), u.startsWith("/") || (u = "/" + u);
31
+ const b = s.liveByLocale.find((_) => _.locale === m.defaultLanguage)?.slug;
32
+ return Pe(e + u, [{ name: "slug", value: b }, { name: "id", value: s.id }, { name: "lang", value: m.defaultLanguage || "en" }]);
33
+ }, z = (s) => `${(window.location.origin + window.location.pathname).replace(/\/$/, "")}/${s.id}`, P = G(() => B.entries?.map((s) => ({
34
+ ...s,
35
+ status: s.archived ? "archived" : s.liveByLocale && s.liveByLocale.length > 0 ? "published" : "draft",
36
+ publishProgress: { completed: s.liveByLocale.length, total: m.supportedLanguages?.length || 1 }
37
+ })) || []);
38
+ return (s, e) => {
39
+ const u = a("TableHead"), b = a("TableRow"), _ = a("TableHeader"), M = a("Checkbox"), V = a("TableCell"), A = a("Button"), T = a("TableBody"), U = a("Table"), N = a("Card");
40
+ return c(), C(N, { class: "w-full py-4 px-4" }, {
41
+ default: n(() => [
42
+ t(U, { class: "rounded overflow-hidden" }, {
43
+ default: n(() => [
44
+ t(_, null, {
45
+ default: n(() => [
46
+ t(b, null, {
47
+ default: n(() => [
48
+ o(r)?.length > 0 ? (c(), C(u, { key: 0 })) : h("", !0),
49
+ t(u, { class: "capitalize" }, {
50
+ default: n(() => [
51
+ v(x(o(w)?.contentEntryName || "entry"), 1)
52
+ ]),
53
+ _: 1
54
+ }),
55
+ t(u, null, {
56
+ default: n(() => [...e[3] || (e[3] = [
57
+ v("Last updated at", -1)
58
+ ])]),
59
+ _: 1
60
+ }),
61
+ t(u, null, {
62
+ default: n(() => [...e[4] || (e[4] = [
63
+ v("Status", -1)
64
+ ])]),
65
+ _: 1
66
+ }),
67
+ t(u, { class: "text-right" }, {
68
+ default: n(() => [...e[5] || (e[5] = [
69
+ v("Edit", -1)
70
+ ])]),
71
+ _: 1
72
+ })
73
+ ]),
74
+ _: 1
75
+ })
76
+ ]),
77
+ _: 1
78
+ }),
79
+ t(T, null, {
80
+ default: n(() => [
81
+ (c(!0), E(q, null, te(P.value, (g) => (c(), C(b, {
82
+ key: g.id,
83
+ onClick: (y) => o(p)("collections/" + o(I).collectionId + "/" + g.id),
84
+ class: "cursor-pointer"
85
+ }, {
86
+ default: n(() => [
87
+ o(r)?.length > 0 ? (c(), C(V, { key: 0 }, {
88
+ default: n(() => [
89
+ t(M, {
90
+ "model-value": o(r)?.includes(g.id),
91
+ "onUpdate:modelValue": (y) => f(y, g.id),
92
+ onClick: e[0] || (e[0] = X(() => {
93
+ }, ["prevent", "stop"]))
94
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
95
+ ]),
96
+ _: 2
97
+ }, 1024)) : h("", !0),
98
+ t(V, { class: "font-medium" }, {
99
+ default: n(() => [
100
+ d("div", Ee, [
101
+ d("span", null, x(g.title), 1)
102
+ ])
103
+ ]),
104
+ _: 2
105
+ }, 1024),
106
+ t(V, null, {
107
+ default: n(() => [
108
+ v(x(g.updated?.at ? new Date(g.updated.at).toLocaleString() : "N/A"), 1)
109
+ ]),
110
+ _: 2
111
+ }, 1024),
112
+ t(V, null, {
113
+ default: n(() => [
114
+ g.status === "published" ? (c(), E("span", $e, [
115
+ g.publishProgress.completed === g.publishProgress.total ? (c(), E("span", Se, "Published")) : (c(), E("span", Le, "Partly Published (" + x(g.publishProgress.completed) + "/" + x(g.publishProgress.total) + ")", 1))
116
+ ])) : g.status === "draft" ? (c(), E("span", Me, "Draft")) : g.status === "archived" ? (c(), E("span", Ve, "Archived")) : h("", !0)
117
+ ]),
118
+ _: 2
119
+ }, 1024),
120
+ t(V, { class: "text-right" }, {
121
+ default: n(() => [
122
+ g.status === "published" ? (c(), E("a", {
123
+ key: 0,
124
+ href: k(g),
125
+ target: "_blank",
126
+ rel: "noreferrer",
127
+ onClick: e[1] || (e[1] = X(() => {
128
+ }, ["stop"]))
129
+ }, [
130
+ t(A, {
131
+ variant: "ghost",
132
+ size: "icon"
133
+ }, {
134
+ default: n(() => [
135
+ t(o(ve), { class: "size-4" })
136
+ ]),
137
+ _: 1
138
+ })
139
+ ], 8, Te)) : h("", !0),
140
+ d("a", {
141
+ href: z(g),
142
+ rel: "noreferrer",
143
+ onClick: e[2] || (e[2] = X(() => {
144
+ }, ["stop"]))
145
+ }, [
146
+ t(A, {
147
+ variant: "ghost",
148
+ size: "icon"
149
+ }, {
150
+ default: n(() => [
151
+ t(o(me), { class: "size-4" })
152
+ ]),
153
+ _: 1
154
+ })
155
+ ], 8, ze)
156
+ ]),
157
+ _: 2
158
+ }, 1024)
159
+ ]),
160
+ _: 2
161
+ }, 1032, ["onClick"]))), 128))
162
+ ]),
163
+ _: 1
164
+ })
165
+ ]),
166
+ _: 1
167
+ })
168
+ ]),
169
+ _: 1
170
+ });
171
+ };
172
+ }
173
+ }), Ie = { class: "flex items-center space-x-2 mb-4" }, Ae = {
174
+ for: "chk_published_entries",
175
+ class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
176
+ }, De = { class: "flex items-center space-x-2 mb-4" }, Fe = {
177
+ for: "chk_draft_entries",
178
+ class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
179
+ }, Ne = { class: "flex items-center space-x-2 mb-4" }, Ue = {
180
+ for: "chk_archived_entries",
181
+ class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
182
+ }, je = /* @__PURE__ */ O({
183
+ __name: "FilterPopover",
184
+ setup(R) {
185
+ const r = j("filter"), w = F(""), B = () => {
186
+ r.value = {
187
+ published: !0,
188
+ draft: !0,
189
+ archived: !1
190
+ };
191
+ };
192
+ return (m, p) => {
193
+ const I = a("Button"), $ = a("PopoverTrigger"), f = a("Checkbox"), k = a("PopoverContent"), z = a("Popover");
194
+ return c(), C(z, null, {
195
+ default: n(() => [
196
+ t($, { asChild: "" }, {
197
+ default: n(() => [
198
+ t(I, { variant: "outline" }, {
199
+ default: n(() => [
200
+ t(o(ge), { class: "size-4" }),
201
+ p[3] || (p[3] = v(" Filter ", -1))
202
+ ]),
203
+ _: 1
204
+ })
205
+ ]),
206
+ _: 1
207
+ }),
208
+ t(k, { class: "w-64" }, {
209
+ default: n(() => [
210
+ p[5] || (p[5] = d("p", { class: "text-sm font-medium text-muted-foreground mb-4" }, " Filter by Status ", -1)),
211
+ d("div", Ie, [
212
+ t(f, {
213
+ id: "chk_published_entries",
214
+ modelValue: o(r).published,
215
+ "onUpdate:modelValue": p[0] || (p[0] = (P) => o(r).published = P)
216
+ }, null, 8, ["modelValue"]),
217
+ d("label", Ae, " Show published " + x(w.value || "entries"), 1)
218
+ ]),
219
+ d("div", De, [
220
+ t(f, {
221
+ id: "chk_draft_entries",
222
+ modelValue: o(r).draft,
223
+ "onUpdate:modelValue": p[1] || (p[1] = (P) => o(r).draft = P)
224
+ }, null, 8, ["modelValue"]),
225
+ d("label", Fe, " Show draft " + x(w.value || "entries"), 1)
226
+ ]),
227
+ d("div", Ne, [
228
+ t(f, {
229
+ id: "chk_archived_entries",
230
+ modelValue: o(r).archived,
231
+ "onUpdate:modelValue": p[2] || (p[2] = (P) => o(r).archived = P)
232
+ }, null, 8, ["modelValue"]),
233
+ d("label", Ue, " Show archived " + x(w.value || "entries"), 1)
234
+ ]),
235
+ !o(r).published || !o(r).draft || o(r).archived ? (c(), C(I, {
236
+ key: 0,
237
+ variant: "secondary",
238
+ class: "ml-auto my-2",
239
+ size: "sm",
240
+ onClick: B
241
+ }, {
242
+ default: n(() => [
243
+ t(o(_e), { class: "size-3" }),
244
+ p[4] || (p[4] = d("span", { class: "ml-0.5 text-xs" }, "Reset filters", -1))
245
+ ]),
246
+ _: 1
247
+ })) : h("", !0)
248
+ ]),
249
+ _: 1
250
+ })
251
+ ]),
252
+ _: 1
253
+ });
254
+ };
255
+ }
256
+ }), Re = /* @__PURE__ */ O({
257
+ __name: "ContentEntryContextMenu",
258
+ emits: ["selectAll", "duplicateEntry", "deleteEntry", "deleteSelection"],
259
+ setup(R, { emit: r }) {
260
+ const w = r, B = j("entries"), m = j("selection"), p = j("config"), { hasPermission: I } = Z(), { navigateTo: $ } = Y(), f = G(() => m.value?.length !== 1 ? null : B.value?.find((s) => s.id === m.value[0])), k = (s) => {
261
+ let e = p.previewUrl;
262
+ e = e.replace("{{ id", "{{id"), e = e.replace("id }}", "id}}"), e = e.replace("{{id}}", s.id), e = e.replace("{{ slug", "{{slug"), e = e.replace("slug }}", "slug}}"), e = e.replace("{{slug}}", s.slug), window.open(e, "_blank");
263
+ }, z = async (s, e) => {
264
+ try {
265
+ if (!["draft", "published", "archived"].includes(e)) return;
266
+ await J(p.project).update(p.contentCollection, s.id, { status: e }), s.status = e, L.success("Entry status changed");
267
+ } catch {
268
+ L.error("Failed to change entry status");
269
+ }
270
+ }, P = async (s) => {
271
+ try {
272
+ if (!["draft", "published", "archived"].includes(s)) return;
273
+ const e = J(p.project), u = [];
274
+ m.value.forEach(async (b) => {
275
+ u.push(e.update(p.contentCollection, b, { status: s }));
276
+ }), L.promise(Promise.all(u), {
277
+ loading: `Changing status of ${m.value.length} entries...`,
278
+ success: () => {
279
+ const b = m.value.length;
280
+ return m.value.forEach((_) => {
281
+ B.value.find((M) => M.id == _).status = s;
282
+ }), m.value = [], `Entry status changed for ${b} entries`;
283
+ },
284
+ error: (b) => "Failed to change entry status"
285
+ });
286
+ } catch {
287
+ L.error("Failed to change entry status");
288
+ }
289
+ };
290
+ return (s, e) => {
291
+ const u = a("ContextMenuTrigger"), b = a("ContextMenuShortcut"), _ = a("ContextMenuItem"), M = a("ContextMenuContent"), V = a("ContextMenuSeparator"), A = a("ContextMenuSubTrigger"), T = a("ContextMenuCheckboxItem"), U = a("ContextMenuSubContent"), N = a("ContextMenuSub"), g = a("ContextMenu");
292
+ return c(), C(g, null, {
293
+ default: n(() => [
294
+ t(u, { class: "flex flex-1" }, {
295
+ default: n(() => [
296
+ ue(s.$slots, "default")
297
+ ]),
298
+ _: 3
299
+ }),
300
+ o(m).length === 0 ? (c(), C(M, {
301
+ key: 0,
302
+ class: "w-64"
303
+ }, {
304
+ default: n(() => [
305
+ t(_, {
306
+ inset: "",
307
+ onClick: e[0] || (e[0] = (y) => w("selectAll"))
308
+ }, {
309
+ default: n(() => [
310
+ e[13] || (e[13] = v(" Select all ", -1)),
311
+ t(b, null, {
312
+ default: n(() => [...e[12] || (e[12] = [
313
+ v("⌘ + A", -1)
314
+ ])]),
315
+ _: 1
316
+ })
317
+ ]),
318
+ _: 1
319
+ })
320
+ ]),
321
+ _: 1
322
+ })) : h("", !0),
323
+ o(m).length === 1 && f.value ? (c(), C(M, {
324
+ key: 1,
325
+ class: "w-64"
326
+ }, {
327
+ default: n(() => [
328
+ t(_, {
329
+ inset: "",
330
+ onClick: e[1] || (e[1] = (y) => o($)(f.value.id))
331
+ }, {
332
+ default: n(() => [...e[14] || (e[14] = [
333
+ v(" Edit entry ", -1)
334
+ ])]),
335
+ _: 1
336
+ }),
337
+ t(V),
338
+ o(p).previewUrl ? (c(), E(q, { key: 0 }, [
339
+ t(_, {
340
+ inset: "",
341
+ onClick: e[2] || (e[2] = (y) => k(f.value))
342
+ }, {
343
+ default: n(() => [
344
+ e[15] || (e[15] = v(" Preview entry ", -1)),
345
+ t(b, null, {
346
+ default: n(() => [
347
+ t(o(be), { class: "size-4" })
348
+ ]),
349
+ _: 1
350
+ })
351
+ ]),
352
+ _: 1
353
+ }),
354
+ t(V)
355
+ ], 64)) : h("", !0),
356
+ t(_, {
357
+ inset: "",
358
+ onClick: e[3] || (e[3] = (y) => w("duplicateEntry", f.value))
359
+ }, {
360
+ default: n(() => [...e[16] || (e[16] = [
361
+ v(" Duplicate entry ", -1)
362
+ ])]),
363
+ _: 1
364
+ }),
365
+ t(N, null, {
366
+ default: n(() => [
367
+ t(A, { inset: "" }, {
368
+ default: n(() => [...e[17] || (e[17] = [
369
+ v(" Change status ", -1)
370
+ ])]),
371
+ _: 1
372
+ }),
373
+ t(U, { class: "w-48" }, {
374
+ default: n(() => [
375
+ t(T, {
376
+ onClick: e[4] || (e[4] = (y) => z(f.value, "draft")),
377
+ modelValue: f.value.status === "draft"
378
+ }, {
379
+ default: n(() => [...e[18] || (e[18] = [
380
+ d("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
381
+ v(" Draft ", -1)
382
+ ])]),
383
+ _: 1
384
+ }, 8, ["modelValue"]),
385
+ t(T, {
386
+ onClick: e[5] || (e[5] = (y) => z(f.value, "published")),
387
+ modelValue: f.value.status === "published"
388
+ }, {
389
+ default: n(() => [...e[19] || (e[19] = [
390
+ d("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
391
+ v(" Published ", -1)
392
+ ])]),
393
+ _: 1
394
+ }, 8, ["modelValue"]),
395
+ t(T, {
396
+ onClick: e[6] || (e[6] = (y) => z(f.value, "archived")),
397
+ modelValue: f.value.status === "archived"
398
+ }, {
399
+ default: n(() => [...e[20] || (e[20] = [
400
+ d("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
401
+ v(" Archived ", -1)
402
+ ])]),
403
+ _: 1
404
+ }, 8, ["modelValue"])
405
+ ]),
406
+ _: 1
407
+ })
408
+ ]),
409
+ _: 1
410
+ }),
411
+ t(_, {
412
+ inset: "",
413
+ variant: "destructive",
414
+ onClick: e[7] || (e[7] = (y) => w("deleteEntry", f.value))
415
+ }, {
416
+ default: n(() => [...e[21] || (e[21] = [
417
+ v(" Delete entry ", -1)
418
+ ])]),
419
+ _: 1
420
+ })
421
+ ]),
422
+ _: 1
423
+ })) : h("", !0),
424
+ o(m).length > 1 ? (c(), C(M, {
425
+ key: 2,
426
+ class: "w-64"
427
+ }, {
428
+ default: n(() => [
429
+ t(N, null, {
430
+ default: n(() => [
431
+ t(A, { inset: "" }, {
432
+ default: n(() => [
433
+ v(" Change status (" + x(o(m).length) + ") ", 1)
434
+ ]),
435
+ _: 1
436
+ }),
437
+ t(U, { class: "w-48" }, {
438
+ default: n(() => [
439
+ t(T, {
440
+ onClick: e[8] || (e[8] = (y) => P("draft"))
441
+ }, {
442
+ default: n(() => [...e[22] || (e[22] = [
443
+ d("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
444
+ v(" Draft ", -1)
445
+ ])]),
446
+ _: 1
447
+ }),
448
+ t(T, {
449
+ onClick: e[9] || (e[9] = (y) => P("published"))
450
+ }, {
451
+ default: n(() => [...e[23] || (e[23] = [
452
+ d("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
453
+ v(" Published ", -1)
454
+ ])]),
455
+ _: 1
456
+ }),
457
+ t(T, {
458
+ onClick: e[10] || (e[10] = (y) => P("archived"))
459
+ }, {
460
+ default: n(() => [...e[24] || (e[24] = [
461
+ d("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
462
+ v(" Archived ", -1)
463
+ ])]),
464
+ _: 1
465
+ })
466
+ ]),
467
+ _: 1
468
+ })
469
+ ]),
470
+ _: 1
471
+ }),
472
+ t(_, {
473
+ inset: "",
474
+ variant: "destructive",
475
+ onClick: e[11] || (e[11] = (y) => w("deleteSelection"))
476
+ }, {
477
+ default: n(() => [
478
+ v(" Delete entries (" + x(o(m).length) + ") ", 1)
479
+ ]),
480
+ _: 1
481
+ })
482
+ ]),
483
+ _: 1
484
+ })) : h("", !0)
485
+ ]),
486
+ _: 3
487
+ });
488
+ };
489
+ }
490
+ }), He = {
491
+ key: 0,
492
+ class: "relative flex flex-col flex-1"
493
+ }, Ke = { class: "flex items-center justify-between gap-4 w-full my-4" }, qe = {
494
+ ref: "container",
495
+ class: "flex items-center justify-between gap-4 w-full mb-8"
496
+ }, We = { class: "flex items-center gap-4" }, Ge = { class: "text-lg whitespace-nowrap" }, Oe = { class: "relative w-full max-w-sm items-center" }, Qe = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2" }, Xe = { class: "flex items-center gap-4" }, Je = { class: "capitalize" }, Ye = { class: "flex flex-1" }, ot = /* @__PURE__ */ O({
497
+ __name: "Entries",
498
+ props: {
499
+ config: {
500
+ type: Object,
501
+ required: !0
502
+ }
503
+ },
504
+ setup(R) {
505
+ const r = R, { hasPermission: w, isAdmin: B } = Z(), { params: m, navigateTo: p } = Y(), { confirm: I } = he(), $ = J(r.config.project), f = F(null), k = F([]);
506
+ ke(() => [
507
+ { text: f.value?.name ?? "" }
508
+ ]);
509
+ const z = async () => {
510
+ const i = await $.get(r.config.collectionsCollection, m.value.collectionId);
511
+ i ? f.value = i : (p("/"), L.error("Collection not found"));
512
+ }, P = async () => {
513
+ const i = await $.find(r.config.contentCollection, {
514
+ filters: [
515
+ {
516
+ field: "collectionId",
517
+ operator: "==",
518
+ value: m.value.collectionId
519
+ }
520
+ ]
521
+ });
522
+ k.value = i || [];
523
+ }, s = F(1), e = F([]), u = F(""), b = F(10), _ = G(() => k.value.filter((i) => i.title.toLowerCase().includes(u.value.toLowerCase()) || i.slug.toLowerCase().includes(u.value.toLowerCase()) || i.id.toLowerCase().includes(u.value.toLowerCase()))), M = G(() => {
524
+ if (_.value.length <= b.value)
525
+ return _.value;
526
+ const i = (s.value - 1) * b.value, l = i + b.value;
527
+ return _.value.slice(i, l);
528
+ });
529
+ async function V(i) {
530
+ return (await $.find(r.config.contentCollection, {
531
+ filters: [
532
+ {
533
+ field: "slug",
534
+ operator: "==",
535
+ value: i
536
+ }
537
+ ]
538
+ })).length > 0;
539
+ }
540
+ const A = () => {
541
+ e.value = M.value.map((i) => i.id);
542
+ }, T = async (i) => {
543
+ try {
544
+ let l = { ...i }, S = l.slug + "-copy", W = 2;
545
+ for (; await V(S); )
546
+ S = l.slug + "-copy-" + W, W++;
547
+ l.id = void 0, l.createdAt = /* @__PURE__ */ new Date(), l.updatedAt = /* @__PURE__ */ new Date(), l.slug = S, l.status = "draft", l.title = l.title + " (copy)";
548
+ const Q = await $.add(r.config.contentCollection, l);
549
+ p(Q.id), L.success("Entry duplicated");
550
+ } catch {
551
+ L.error("Failed to duplicate entry");
552
+ }
553
+ }, U = async (i) => {
554
+ if (await I(`Are you sure you want to delete "${i.title}"?`))
555
+ try {
556
+ await $.remove(r.config.contentCollection, i.id), k.value = k.value.filter((S) => S.id !== i.id), e.value = [], L.success("Entry deleted");
557
+ } catch {
558
+ L.error("Failed to delete entry");
559
+ }
560
+ }, N = async () => {
561
+ if (await I(`Are you sure you want to delete all selected ${f?.contentEntryNamePlural || "entries"} (${e.value.length})?`))
562
+ try {
563
+ e.value.forEach(async (l) => {
564
+ await $.remove(r.config.contentCollection, l);
565
+ }), k.value = k.value.filter((l) => !e.value.includes(l.id)), e.value = [], L.success("Entries deleted");
566
+ } catch {
567
+ L.error("Failed to delete entries");
568
+ }
569
+ }, g = F({
570
+ published: !0,
571
+ draft: !0,
572
+ archived: !1
573
+ });
574
+ de(g, () => {
575
+ s.value = 1;
576
+ });
577
+ const y = (i) => {
578
+ i.target?.matches("input, textarea") || i.target?.isContentEditable || (i.key === "Escape" && (e.value = []), (i.metaKey || i.ctrlKey) && i.key.toLowerCase() === "a" && (i.preventDefault(), A()));
579
+ };
580
+ return ce(() => {
581
+ z(), P(), window.addEventListener("keydown", y);
582
+ }), pe(() => {
583
+ window.removeEventListener("keydown", y);
584
+ }), K("config", r.config), K("filter", g), K("entries", k), K("selection", e), K("collection", f), (i, l) => {
585
+ const S = a("Button"), W = a("Input"), Q = a("PaginationFirst"), ne = a("PaginationPrev"), le = a("PaginationListItem"), oe = a("PaginationEllipsis"), se = a("PaginationNext"), ae = a("PaginationLast"), ie = a("PaginationList"), re = a("Pagination");
586
+ return f.value ? (c(), E("div", He, [
587
+ d("div", Ke, [
588
+ t(S, {
589
+ onClick: l[0] || (l[0] = (D) => o(p)("/")),
590
+ variant: "link",
591
+ class: "!pl-0"
592
+ }, {
593
+ default: n(() => [
594
+ t(o(ye), { class: "size-4" }),
595
+ l[5] || (l[5] = v(" Collections ", -1))
596
+ ]),
597
+ _: 1
598
+ })
599
+ ]),
600
+ d("div", qe, [
601
+ d("div", We, [
602
+ d("p", Ge, x(_.value?.length) + " " + x(f.value?.contentEntryNamePlural || "entries"), 1),
603
+ d("div", Oe, [
604
+ t(W, {
605
+ id: "search",
606
+ type: "text",
607
+ placeholder: "Search...",
608
+ class: "pl-8",
609
+ onKeydown: l[1] || (l[1] = fe((D) => u.value = "", ["escape"])),
610
+ modelValue: u.value,
611
+ "onUpdate:modelValue": l[2] || (l[2] = (D) => u.value = D)
612
+ }, null, 8, ["modelValue"]),
613
+ d("span", Qe, [
614
+ t(o(Ce), { class: "size-4 text-muted-foreground" })
615
+ ])
616
+ ])
617
+ ]),
618
+ d("div", Xe, [
619
+ e.value.length > 0 ? (c(), C(S, {
620
+ key: 0,
621
+ variant: "destructive",
622
+ onClick: N
623
+ }, {
624
+ default: n(() => [
625
+ v(" Delete Selection (" + x(e.value.length) + ") ", 1)
626
+ ]),
627
+ _: 1
628
+ })) : h("", !0),
629
+ o(B)() || o(w)("create-entry") && f.value?.allowUserEntryManagement ? (c(), E(q, { key: 1 }, [
630
+ o(m)?.collectionId ? (c(), C(S, {
631
+ key: 0,
632
+ variant: "outline",
633
+ onClick: l[3] || (l[3] = (D) => o(p)(`collections/${o(m).collectionId}/new`))
634
+ }, {
635
+ default: n(() => [
636
+ t(o(xe), { class: "size-4" }),
637
+ d("span", null, [
638
+ l[6] || (l[6] = v(" New ", -1)),
639
+ d("span", Je, x(f.value?.contentEntryName || "entry"), 1)
640
+ ])
641
+ ]),
642
+ _: 1
643
+ })) : h("", !0),
644
+ l[7] || (l[7] = d("div", { class: "w-[1px] h-8 bg-border" }, null, -1))
645
+ ], 64)) : h("", !0),
646
+ t(je)
647
+ ])
648
+ ], 512),
649
+ d("div", Ye, [
650
+ t(Re, {
651
+ onSelectAll: A,
652
+ onDuplicateEntry: T,
653
+ onDeleteEntry: U,
654
+ onDeleteSelection: N
655
+ }, {
656
+ default: n(() => [
657
+ t(Be, { entries: M.value }, null, 8, ["entries"])
658
+ ]),
659
+ _: 1
660
+ })
661
+ ]),
662
+ _.value?.length > b.value ? (c(), C(re, {
663
+ key: 0,
664
+ page: s.value,
665
+ "onUpdate:page": l[4] || (l[4] = (D) => s.value = D),
666
+ "items-per-page": b.value,
667
+ total: _.value?.length,
668
+ "sibling-count": 1,
669
+ "show-edges": ""
670
+ }, {
671
+ default: n(() => [
672
+ t(ie, { class: "flex items-center gap-1" }, {
673
+ default: n(({ items: D }) => [
674
+ t(Q),
675
+ t(ne),
676
+ (c(!0), E(q, null, te(D, (H, ee) => (c(), E(q, null, [
677
+ H.type === "page" ? (c(), C(le, {
678
+ key: ee,
679
+ value: H.value,
680
+ "as-child": ""
681
+ }, {
682
+ default: n(() => [
683
+ t(S, {
684
+ class: "size-10 p-0",
685
+ variant: H.value === s.value ? "default" : "outline"
686
+ }, {
687
+ default: n(() => [
688
+ v(x(H.value), 1)
689
+ ]),
690
+ _: 2
691
+ }, 1032, ["variant"])
692
+ ]),
693
+ _: 2
694
+ }, 1032, ["value"])) : (c(), C(oe, {
695
+ key: H.type,
696
+ index: ee
697
+ }, null, 8, ["index"]))
698
+ ], 64))), 256)),
699
+ t(se),
700
+ t(ae)
701
+ ]),
702
+ _: 1
703
+ })
704
+ ]),
705
+ _: 1
706
+ }, 8, ["page", "items-per-page", "total"])) : h("", !0)
707
+ ])) : h("", !0);
708
+ };
709
+ }
710
+ });
711
+ export {
712
+ ot as default
713
+ };