@oneclick.dev/cms-core-modules 0.0.52 → 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.
- package/dist/CalendarDate-CRT2Viyt.mjs +830 -0
- package/dist/CalendarDate-CWtpXgpD.js +1 -0
- package/dist/Components-D9yIIosM.mjs +623 -0
- package/dist/Components-DXbx0RLV.js +1 -0
- package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
- package/dist/ContentEditor-DzTi8fSZ.js +290 -0
- package/dist/Create-BP8TX6rj.js +1 -0
- package/dist/Create-Bwf1RXdG.mjs +1248 -0
- package/dist/DateFormatter-BbcSwTs4.js +1 -0
- package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
- package/dist/Detail-B-PnkcXD.mjs +3473 -0
- package/dist/Detail-BVlGSjOq.mjs +380 -0
- package/dist/Detail-C4E1T87K.mjs +26 -0
- package/dist/Detail-CNfTDUE5.js +1 -0
- package/dist/Detail-Cd5CBVN0.js +1 -0
- package/dist/Detail-CpfOQChd.mjs +585 -0
- package/dist/Detail-CwagT6gQ.mjs +650 -0
- package/dist/Detail-DUo6qKqO.js +1 -0
- package/dist/Detail-Dd_OkpcN.js +1 -0
- package/dist/Detail-mvSGbnFU.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
- package/dist/Entries-DcpPvlYj.js +1 -0
- package/dist/Entries-QLMtTYLX.mjs +713 -0
- package/dist/Find-BPR0uU-Z.mjs +229 -0
- package/dist/Find-BidEQJxT.js +1 -0
- package/dist/GlobalStyling-CMzPRd18.js +17 -0
- package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
- package/dist/Overview-BDlBCUI_.js +1 -0
- package/dist/Overview-BH3NwvNX.mjs +26 -0
- package/dist/Overview-BLsZMHNW.mjs +178 -0
- package/dist/Overview-BNMZ9MUK.js +1 -0
- package/dist/Overview-BbvfH1u-.js +1 -0
- package/dist/Overview-CDN88OSM.mjs +190 -0
- package/dist/Overview-CEPodGCn.mjs +311 -0
- package/dist/Overview-CvquDPhB.js +1 -0
- package/dist/Overview-D54pjmI6.mjs +633 -0
- package/dist/Overview-D67UjG6n.mjs +947 -0
- package/dist/Overview-KT2Mgfh5.js +1 -0
- package/dist/Overview-T-lsy3UZ.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
- package/dist/TableView-CpO53xcX.js +111 -0
- package/dist/TableView-D9J5rUls.mjs +72921 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
- package/dist/View-DlHBZbFu.js +1 -0
- package/dist/View-Dv5QMrSn.mjs +25 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/agenda-B49oKGeh.mjs +706 -0
- package/dist/agenda-DipQ5IWP.js +1 -0
- package/dist/availability-C7q9tq6l.js +1 -0
- package/dist/availability-DeCkqiu8.mjs +613 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/countries-BTPvmrsb.mjs +4 -0
- package/dist/countries-CgZ081No.js +1 -0
- package/dist/exceptions-D3b18TiY.mjs +647 -0
- package/dist/exceptions-DJ9zWX3k.js +1 -0
- package/dist/floating-ui.dom-C82nbomj.js +1 -0
- package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
- package/dist/google-CvtuJwgk.mjs +4 -0
- package/dist/google-D4N3gb01.js +1 -0
- package/dist/index--jjEzba7.mjs +24 -0
- package/dist/index-9HVlmvK3.js +1 -0
- package/dist/index-BEGU8Kme.mjs +12 -0
- package/dist/index-Bwi1mtkq.mjs +24 -0
- package/dist/index-BzuHN-r8.mjs +24 -0
- package/dist/index-CImCyE3L.mjs +24 -0
- package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
- package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
- package/dist/index-CQiY-oTN.mjs +24 -0
- package/dist/index-CSxYBeVA.js +1 -0
- package/dist/index-CkiNvRzs.js +1 -0
- package/dist/index-Co4ON2Di.js +1 -0
- package/dist/index-CwqrAU-H.js +1 -0
- package/dist/index-Cz-baGax.js +1 -0
- package/dist/index-D2a6wEPh.js +1 -0
- package/dist/index-DFQGVHTs.js +1 -0
- package/dist/index-DI6mydpm.mjs +138 -0
- package/dist/index-DMoyoaks.mjs +22 -0
- package/dist/index-DT1wWnUk.mjs +24 -0
- package/dist/index-DUeFrD-B.js +1 -0
- package/dist/index-DsnoK4ia.mjs +579 -0
- package/dist/index-R2oUDsjx.js +1 -0
- package/dist/index-RLz1QPrf.mjs +203 -0
- package/dist/index-UtjLbLw-.js +1 -0
- package/dist/index-_mG-aU3Z.mjs +87 -0
- package/dist/index-_sQDF1pH.js +1 -0
- package/dist/index-ijdf0d9-.js +1 -0
- package/dist/index-klI238nT.mjs +24 -0
- package/dist/index.cjs.js +1 -357
- package/dist/index.mjs +287 -69281
- package/dist/interpolation-BNUjI7LH.js +1 -0
- package/dist/interpolation-BpGXqOz8.mjs +59 -0
- package/dist/payment-kTjsV0Jj.js +1 -0
- package/dist/payment-zpCM0LD-.mjs +981 -0
- package/dist/regular-C4_3YXqx.mjs +602 -0
- package/dist/regular-DFwPEbZO.js +1 -0
- package/dist/regular-slots-4ooEpICB.mjs +67 -0
- package/dist/regular-slots-BAVGbomI.js +1 -0
- package/dist/resources-MpQkSstv.mjs +563 -0
- package/dist/resources-iM28T3dD.js +1 -0
- package/dist/src/appointments/components/edit/PaymentAddons/Addon.vue.d.ts +12 -2
- package/dist/src/appointments/index.d.ts +4 -28
- package/dist/src/appointments/routes.d.ts +3 -9
- package/dist/src/content-manager/index.d.ts +5 -147
- package/dist/src/content-manager/routes.d.ts +4 -128
- package/dist/src/custom/index.d.ts +2 -2
- package/dist/src/custom/routes.d.ts +1 -1
- package/dist/src/lib/interpolation.d.ts +2 -2
- package/dist/src/mail-templates/index.d.ts +2 -30
- package/dist/src/mail-templates/routes.d.ts +1 -11
- package/dist/src/product-collections/index.d.ts +2 -30
- package/dist/src/product-collections/routes.d.ts +1 -11
- package/dist/src/products/index.d.ts +2 -30
- package/dist/src/products/routes.d.ts +1 -11
- package/dist/src/promo-codes/index.d.ts +2 -30
- package/dist/src/promo-codes/routes.d.ts +1 -11
- package/dist/src/shipping-options/index.d.ts +2 -30
- package/dist/src/shipping-options/routes.d.ts +1 -11
- package/dist/src/table/index.d.ts +2 -70
- package/dist/src/table/routes.d.ts +1 -51
- package/dist/utils-BVKy9S2J.mjs +29 -0
- package/dist/utils-D6CaKJbp.js +2 -0
- package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
- package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
- package/package.json +28 -29
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
import { defineComponent as X, inject as j, createElementBlock as w, openBlock as r, createElementVNode as i, Fragment as L, renderList as Q, withModifiers as de, normalizeClass as te, unref as n, createCommentVNode as z, toDisplayString as M, createTextVNode as x, resolveComponent as a, createBlock as V, withCtx as o, createVNode as t, computed as K, shallowRef as oe, watch as ne, toValue as ce, getCurrentInstance as he, onMounted as pe, renderSlot as ke, ref as O, useTemplateRef as Pe, withAsyncContext as Se, onUnmounted as $e, provide as q, withKeys as Me } from "vue";
|
|
2
|
+
import { Filter as Ve, ChevronsUpDown as Te, Check as ie, RotateCcw as Ae, ExternalLink as ze, Search as Ie, Plus as Le, LayoutGrid as Ee, List as De } from "lucide-vue-next";
|
|
3
|
+
import { useModuleRoute as Y, useModulePermissions as Z, useFirebaseIntegration as le, useConfirmation as Be, useModuleBreadcrumbs as Re } from "@oneclick.dev/cms-kit";
|
|
4
|
+
import { t as Fe, i as Ue, a as Oe, b as je } from "./index-_mG-aU3Z.mjs";
|
|
5
|
+
import { c as re } from "./utils-BVKy9S2J.mjs";
|
|
6
|
+
import { t as B } from "./index-RLz1QPrf.mjs";
|
|
7
|
+
const Ke = { class: "grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6" }, Ne = ["onClick", "onContextmenu"], Ge = ["src"], He = { class: "font-semibold" }, We = { class: "text-sm text-muted-foreground flex items-center gap-2" }, qe = { class: "flex items-center gap-2" }, Qe = { key: 0 }, Xe = /* @__PURE__ */ X({
|
|
8
|
+
__name: "GridView",
|
|
9
|
+
props: {
|
|
10
|
+
products: {
|
|
11
|
+
type: Array,
|
|
12
|
+
required: !0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(P) {
|
|
16
|
+
const l = j("selection"), { navigateTo: b } = Y(), { hasPermission: S } = Z(), h = (c, u) => {
|
|
17
|
+
const C = u.ctrlKey || u.metaKey;
|
|
18
|
+
if (u.shiftKey)
|
|
19
|
+
console.log("range");
|
|
20
|
+
else if (C || l.value.length > 0) {
|
|
21
|
+
const d = l.value.indexOf(c.id);
|
|
22
|
+
d > -1 ? l.value.splice(d, 1) : l.value.push(c.id);
|
|
23
|
+
} else
|
|
24
|
+
l.value = [], b(c.id);
|
|
25
|
+
}, s = (c) => {
|
|
26
|
+
c.target.closest(".GRID_ITEM") || (l.value = []);
|
|
27
|
+
}, g = (c, u) => {
|
|
28
|
+
u.ctrlKey || u.metaKey ? l.value.includes(c.id) ? l.value.splice(l.value.indexOf(c.id), 1) : l.value.push(c.id) : l.value.includes(c.id) || (l.value = [c.id]);
|
|
29
|
+
};
|
|
30
|
+
return (c, u) => (r(), w("div", {
|
|
31
|
+
class: "@container mb-4 flex-1 select-none",
|
|
32
|
+
onClick: u[0] || (u[0] = (C) => l.value = []),
|
|
33
|
+
onContextmenu: s
|
|
34
|
+
}, [
|
|
35
|
+
i("div", Ke, [
|
|
36
|
+
(r(!0), w(L, null, Q(P.products, (C) => (r(), w("div", {
|
|
37
|
+
key: C.id,
|
|
38
|
+
onClick: de(($) => h(C, $), ["stop"]),
|
|
39
|
+
onContextmenu: ($) => g(C, $),
|
|
40
|
+
class: "GRID_ITEM cursor-pointer"
|
|
41
|
+
}, [
|
|
42
|
+
i("div", {
|
|
43
|
+
class: te(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200", { "outline outline-4 outline-primary/50": n(l).includes(C.id) }])
|
|
44
|
+
}, [
|
|
45
|
+
C.featuredMedia ? (r(), w("img", {
|
|
46
|
+
key: 0,
|
|
47
|
+
src: C.featuredMedia,
|
|
48
|
+
class: "w-full h-full object-cover pointer-events-none",
|
|
49
|
+
draggable: "false"
|
|
50
|
+
}, null, 8, Ge)) : z("", !0)
|
|
51
|
+
], 2),
|
|
52
|
+
i("div", null, [
|
|
53
|
+
i("p", He, M(C.title), 1),
|
|
54
|
+
i("p", We, [
|
|
55
|
+
i("span", qe, [
|
|
56
|
+
C.status === "published" ? (r(), w(L, { key: 0 }, [
|
|
57
|
+
u[1] || (u[1] = i("span", { class: "block shrink-0 size-3 rounded-full bg-green-500" }, null, -1)),
|
|
58
|
+
u[2] || (u[2] = x(" Published ", -1))
|
|
59
|
+
], 64)) : C.status === "draft" ? (r(), w(L, { key: 1 }, [
|
|
60
|
+
u[3] || (u[3] = i("span", { class: "block shrink-0 size-3 rounded-full bg-blue-500" }, null, -1)),
|
|
61
|
+
u[4] || (u[4] = x(" Draft ", -1))
|
|
62
|
+
], 64)) : (r(), w(L, { key: 2 }, [
|
|
63
|
+
u[5] || (u[5] = i("span", { class: "block shrink-0 size-3 rounded-full bg-gray-300" }, null, -1)),
|
|
64
|
+
u[6] || (u[6] = x(" Archived ", -1))
|
|
65
|
+
], 64))
|
|
66
|
+
]),
|
|
67
|
+
C.variantsTotal > 1 ? (r(), w("span", Qe, "| " + M(C.variantsTotal) + " variants", 1)) : z("", !0)
|
|
68
|
+
])
|
|
69
|
+
])
|
|
70
|
+
], 40, Ne))), 128))
|
|
71
|
+
])
|
|
72
|
+
], 32));
|
|
73
|
+
}
|
|
74
|
+
}), Je = { class: "flex items-center gap-2" }, Ye = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
|
|
77
|
+
}, Ze = {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
|
|
80
|
+
}, et = {
|
|
81
|
+
key: 2,
|
|
82
|
+
class: "bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"
|
|
83
|
+
}, tt = /* @__PURE__ */ X({
|
|
84
|
+
__name: "ListView",
|
|
85
|
+
props: {
|
|
86
|
+
products: {
|
|
87
|
+
type: Array,
|
|
88
|
+
required: !0
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
setup(P) {
|
|
92
|
+
const l = j("selection"), { navigateTo: b } = Y(), { hasPermission: S } = Z(), h = (s, g) => {
|
|
93
|
+
s ? l.value.push(g) : l.value = l.value.filter((c) => c !== g);
|
|
94
|
+
};
|
|
95
|
+
return (s, g) => {
|
|
96
|
+
const c = a("TableHead"), u = a("TableRow"), C = a("TableHeader"), $ = a("Checkbox"), d = a("TableCell"), v = a("AvatarImage"), e = a("AvatarFallback"), _ = a("Avatar"), k = a("TableBody"), T = a("Table"), A = a("Card");
|
|
97
|
+
return r(), V(A, { class: "w-full py-4 px-4" }, {
|
|
98
|
+
default: o(() => [
|
|
99
|
+
t(T, { class: "rounded overflow-hidden" }, {
|
|
100
|
+
default: o(() => [
|
|
101
|
+
t(C, null, {
|
|
102
|
+
default: o(() => [
|
|
103
|
+
t(u, null, {
|
|
104
|
+
default: o(() => [
|
|
105
|
+
n(l)?.length > 0 ? (r(), V(c, { key: 0 })) : z("", !0),
|
|
106
|
+
t(c, null, {
|
|
107
|
+
default: o(() => [...g[1] || (g[1] = [
|
|
108
|
+
x("Title", -1)
|
|
109
|
+
])]),
|
|
110
|
+
_: 1
|
|
111
|
+
}),
|
|
112
|
+
t(c, null, {
|
|
113
|
+
default: o(() => [...g[2] || (g[2] = [
|
|
114
|
+
x("Status", -1)
|
|
115
|
+
])]),
|
|
116
|
+
_: 1
|
|
117
|
+
}),
|
|
118
|
+
t(c, null, {
|
|
119
|
+
default: o(() => [...g[3] || (g[3] = [
|
|
120
|
+
x(" Variants", -1)
|
|
121
|
+
])]),
|
|
122
|
+
_: 1
|
|
123
|
+
}),
|
|
124
|
+
t(c, null, {
|
|
125
|
+
default: o(() => [...g[4] || (g[4] = [
|
|
126
|
+
x("Price", -1)
|
|
127
|
+
])]),
|
|
128
|
+
_: 1
|
|
129
|
+
})
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
})
|
|
133
|
+
]),
|
|
134
|
+
_: 1
|
|
135
|
+
}),
|
|
136
|
+
t(k, null, {
|
|
137
|
+
default: o(() => [
|
|
138
|
+
(r(!0), w(L, null, Q(P.products, (y) => (r(), V(u, {
|
|
139
|
+
key: y.id,
|
|
140
|
+
onClick: (E) => n(b)(y.id),
|
|
141
|
+
class: "cursor-pointer"
|
|
142
|
+
}, {
|
|
143
|
+
default: o(() => [
|
|
144
|
+
n(l)?.length > 0 ? (r(), V(d, { key: 0 }, {
|
|
145
|
+
default: o(() => [
|
|
146
|
+
t($, {
|
|
147
|
+
"model-value": n(l)?.includes(y.id),
|
|
148
|
+
"onUpdate:modelValue": (E) => h(E, y.id),
|
|
149
|
+
onClick: g[0] || (g[0] = de(() => {
|
|
150
|
+
}, ["prevent", "stop"]))
|
|
151
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
152
|
+
]),
|
|
153
|
+
_: 2
|
|
154
|
+
}, 1024)) : z("", !0),
|
|
155
|
+
t(d, { class: "font-medium" }, {
|
|
156
|
+
default: o(() => [
|
|
157
|
+
i("div", Je, [
|
|
158
|
+
t(_, { class: "size-12 rounded-xl" }, {
|
|
159
|
+
default: o(() => [
|
|
160
|
+
t(v, {
|
|
161
|
+
src: y.media?.[0],
|
|
162
|
+
class: "object-cover"
|
|
163
|
+
}, null, 8, ["src"]),
|
|
164
|
+
t(e, { class: "rounded-xl" })
|
|
165
|
+
]),
|
|
166
|
+
_: 2
|
|
167
|
+
}, 1024),
|
|
168
|
+
i("span", null, M(y.title), 1)
|
|
169
|
+
])
|
|
170
|
+
]),
|
|
171
|
+
_: 2
|
|
172
|
+
}, 1024),
|
|
173
|
+
t(d, null, {
|
|
174
|
+
default: o(() => [
|
|
175
|
+
y.status === "published" ? (r(), w("span", Ye, "Published")) : y.status === "draft" ? (r(), w("span", Ze, "Draft")) : y.status === "archived" ? (r(), w("span", et, "Archived")) : z("", !0)
|
|
176
|
+
]),
|
|
177
|
+
_: 2
|
|
178
|
+
}, 1024),
|
|
179
|
+
t(d, null, {
|
|
180
|
+
default: o(() => [
|
|
181
|
+
x(M(y.variantsTotal), 1)
|
|
182
|
+
]),
|
|
183
|
+
_: 2
|
|
184
|
+
}, 1024),
|
|
185
|
+
t(d, { class: "text-right" }, {
|
|
186
|
+
default: o(() => [
|
|
187
|
+
x(" € " + M(y.price || 0), 1)
|
|
188
|
+
]),
|
|
189
|
+
_: 2
|
|
190
|
+
}, 1024)
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1032, ["onClick"]))), 128))
|
|
194
|
+
]),
|
|
195
|
+
_: 1
|
|
196
|
+
})
|
|
197
|
+
]),
|
|
198
|
+
_: 1
|
|
199
|
+
})
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}), fe = Ue ? window : void 0;
|
|
206
|
+
function G(P) {
|
|
207
|
+
var l;
|
|
208
|
+
const b = ce(P);
|
|
209
|
+
return (l = b?.$el) != null ? l : b;
|
|
210
|
+
}
|
|
211
|
+
// @__NO_SIDE_EFFECTS__
|
|
212
|
+
function ot() {
|
|
213
|
+
const P = oe(!1), l = he();
|
|
214
|
+
return l && pe(() => {
|
|
215
|
+
P.value = !0;
|
|
216
|
+
}, l), P;
|
|
217
|
+
}
|
|
218
|
+
// @__NO_SIDE_EFFECTS__
|
|
219
|
+
function lt(P) {
|
|
220
|
+
const l = /* @__PURE__ */ ot();
|
|
221
|
+
return K(() => (l.value, !!P()));
|
|
222
|
+
}
|
|
223
|
+
function nt(P, l, b = {}) {
|
|
224
|
+
const { window: S = fe, ...h } = b;
|
|
225
|
+
let s;
|
|
226
|
+
const g = /* @__PURE__ */ lt(() => S && "ResizeObserver" in S), c = () => {
|
|
227
|
+
s && (s.disconnect(), s = void 0);
|
|
228
|
+
}, u = K(() => {
|
|
229
|
+
const d = ce(P);
|
|
230
|
+
return Array.isArray(d) ? d.map((v) => G(v)) : [G(d)];
|
|
231
|
+
}), C = ne(
|
|
232
|
+
u,
|
|
233
|
+
(d) => {
|
|
234
|
+
if (c(), g.value && S) {
|
|
235
|
+
s = new ResizeObserver(l);
|
|
236
|
+
for (const v of d)
|
|
237
|
+
v && s.observe(v, h);
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{ immediate: !0, flush: "post" }
|
|
241
|
+
), $ = () => {
|
|
242
|
+
c(), C();
|
|
243
|
+
};
|
|
244
|
+
return Oe($), {
|
|
245
|
+
isSupported: g,
|
|
246
|
+
stop: $
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function st(P, l = { width: 0, height: 0 }, b = {}) {
|
|
250
|
+
const { window: S = fe, box: h = "content-box" } = b, s = K(() => {
|
|
251
|
+
var d, v;
|
|
252
|
+
return (v = (d = G(P)) == null ? void 0 : d.namespaceURI) == null ? void 0 : v.includes("svg");
|
|
253
|
+
}), g = oe(l.width), c = oe(l.height), { stop: u } = nt(
|
|
254
|
+
P,
|
|
255
|
+
([d]) => {
|
|
256
|
+
const v = h === "border-box" ? d.borderBoxSize : h === "content-box" ? d.contentBoxSize : d.devicePixelContentBoxSize;
|
|
257
|
+
if (S && s.value) {
|
|
258
|
+
const e = G(P);
|
|
259
|
+
if (e) {
|
|
260
|
+
const _ = e.getBoundingClientRect();
|
|
261
|
+
g.value = _.width, c.value = _.height;
|
|
262
|
+
}
|
|
263
|
+
} else if (v) {
|
|
264
|
+
const e = je(v);
|
|
265
|
+
g.value = e.reduce((_, { inlineSize: k }) => _ + k, 0), c.value = e.reduce((_, { blockSize: k }) => _ + k, 0);
|
|
266
|
+
} else
|
|
267
|
+
g.value = d.contentRect.width, c.value = d.contentRect.height;
|
|
268
|
+
},
|
|
269
|
+
b
|
|
270
|
+
);
|
|
271
|
+
Fe(() => {
|
|
272
|
+
const d = G(P);
|
|
273
|
+
d && (g.value = "offsetWidth" in d ? d.offsetWidth : l.width, c.value = "offsetHeight" in d ? d.offsetHeight : l.height);
|
|
274
|
+
});
|
|
275
|
+
const C = ne(
|
|
276
|
+
() => G(P),
|
|
277
|
+
(d) => {
|
|
278
|
+
g.value = d ? l.width : 0, c.value = d ? l.height : 0;
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
function $() {
|
|
282
|
+
u(), C();
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
width: g,
|
|
286
|
+
height: c,
|
|
287
|
+
stop: $
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const ut = { class: "truncate" }, at = { key: 0 }, it = { key: 1 }, rt = { key: 2 }, dt = { key: 3 }, ct = { class: "relative w-full max-w-sm items-center" }, pt = { class: "truncate" }, ft = { class: "truncate" }, mt = { class: "flex items-center space-x-2 mb-4" }, vt = { class: "flex items-center space-x-2 mb-4" }, gt = { class: "flex items-center space-x-2 mb-4" }, bt = /* @__PURE__ */ X({
|
|
291
|
+
__name: "FilterPopover",
|
|
292
|
+
setup(P) {
|
|
293
|
+
const l = j("filter"), b = j("collections"), S = () => {
|
|
294
|
+
l.value = {
|
|
295
|
+
collections: [],
|
|
296
|
+
published: !0,
|
|
297
|
+
draft: !0,
|
|
298
|
+
archived: !1
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
return (h, s) => {
|
|
302
|
+
const g = a("Button"), c = a("PopoverTrigger"), u = a("ComboboxTrigger"), C = a("ComboboxAnchor"), $ = a("ComboboxInput"), d = a("ComboboxEmpty"), v = a("ComboboxItemIndicator"), e = a("ComboboxItem"), _ = a("ScrollArea"), k = a("ComboboxGroup"), T = a("ComboboxList"), A = a("Combobox"), y = a("Checkbox"), E = a("PopoverContent"), D = a("Popover");
|
|
303
|
+
return r(), V(D, null, {
|
|
304
|
+
default: o(() => [
|
|
305
|
+
t(c, { asChild: "" }, {
|
|
306
|
+
default: o(() => [
|
|
307
|
+
t(g, { variant: "outline" }, {
|
|
308
|
+
default: o(() => [
|
|
309
|
+
t(n(Ve), { class: "size-4" }),
|
|
310
|
+
s[4] || (s[4] = x(" Filter ", -1))
|
|
311
|
+
]),
|
|
312
|
+
_: 1
|
|
313
|
+
})
|
|
314
|
+
]),
|
|
315
|
+
_: 1
|
|
316
|
+
}),
|
|
317
|
+
t(E, { class: "w-64" }, {
|
|
318
|
+
default: o(() => [
|
|
319
|
+
s[14] || (s[14] = i("p", { class: "text-sm font-medium text-muted-foreground mb-4" }, " Filter by Collection ", -1)),
|
|
320
|
+
t(A, {
|
|
321
|
+
modelValue: n(l).collections,
|
|
322
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => n(l).collections = f),
|
|
323
|
+
by: "id",
|
|
324
|
+
multiple: !0,
|
|
325
|
+
class: "mb-6"
|
|
326
|
+
}, {
|
|
327
|
+
default: o(() => [
|
|
328
|
+
t(C, { "as-child": "" }, {
|
|
329
|
+
default: o(() => [
|
|
330
|
+
t(u, { "as-child": "" }, {
|
|
331
|
+
default: o(() => [
|
|
332
|
+
t(g, {
|
|
333
|
+
variant: "outline",
|
|
334
|
+
class: "justify-between w-full"
|
|
335
|
+
}, {
|
|
336
|
+
default: o(() => [
|
|
337
|
+
i("span", ut, [
|
|
338
|
+
n(l).collections.length === 1 ? (r(), w("span", at, M(n(b).find((f) => f.id === n(l).collections[0])?.title), 1)) : n(l).collections.length === 2 ? (r(), w("span", it, M(n(b).find((f) => f.id === n(l).collections[0])?.title) + ", " + M(n(b).find((f) => f.id === n(l).collections[1])?.title), 1)) : n(l).collections.length > 2 ? (r(), w("span", rt, M(n(b).find((f) => f.id === n(l).collections[0])?.title) + ", " + M(n(b).find((f) => f.id === n(l).collections[1])?.title) + " + " + M(n(l).collections.length - 2), 1)) : (r(), w("span", dt, "Select collection"))
|
|
339
|
+
]),
|
|
340
|
+
t(n(Te), { class: "ml-2 size-4 shrink-0 opacity-50" })
|
|
341
|
+
]),
|
|
342
|
+
_: 1
|
|
343
|
+
})
|
|
344
|
+
]),
|
|
345
|
+
_: 1
|
|
346
|
+
})
|
|
347
|
+
]),
|
|
348
|
+
_: 1
|
|
349
|
+
}),
|
|
350
|
+
t(T, null, {
|
|
351
|
+
default: o(() => [
|
|
352
|
+
i("div", ct, [
|
|
353
|
+
t($, { placeholder: "Select category..." })
|
|
354
|
+
]),
|
|
355
|
+
t(d, null, {
|
|
356
|
+
default: o(() => [...s[5] || (s[5] = [
|
|
357
|
+
x(" No category found. ", -1)
|
|
358
|
+
])]),
|
|
359
|
+
_: 1
|
|
360
|
+
}),
|
|
361
|
+
n(b)?.filter((f) => f.status === "published")?.length > 0 ? (r(), w(L, { key: 0 }, [
|
|
362
|
+
s[7] || (s[7] = i("p", { class: "px-2 py-1.5 text-sm font-medium mt-2" }, "Published", -1)),
|
|
363
|
+
t(k, null, {
|
|
364
|
+
default: o(() => [
|
|
365
|
+
t(_, { class: "max-h-[200px] overflow-y-auto" }, {
|
|
366
|
+
default: o(() => [
|
|
367
|
+
(r(!0), w(L, null, Q(n(b).filter((f) => f.status === "published"), (f) => (r(), V(e, {
|
|
368
|
+
key: f.id,
|
|
369
|
+
value: f.id
|
|
370
|
+
}, {
|
|
371
|
+
default: o(() => [
|
|
372
|
+
s[6] || (s[6] = i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1)),
|
|
373
|
+
i("span", pt, M(f.title), 1),
|
|
374
|
+
t(v, null, {
|
|
375
|
+
default: o(() => [
|
|
376
|
+
t(n(ie), {
|
|
377
|
+
class: te(n(re)("ml-auto size-4"))
|
|
378
|
+
}, null, 8, ["class"])
|
|
379
|
+
]),
|
|
380
|
+
_: 1
|
|
381
|
+
})
|
|
382
|
+
]),
|
|
383
|
+
_: 2
|
|
384
|
+
}, 1032, ["value"]))), 128))
|
|
385
|
+
]),
|
|
386
|
+
_: 1
|
|
387
|
+
})
|
|
388
|
+
]),
|
|
389
|
+
_: 1
|
|
390
|
+
})
|
|
391
|
+
], 64)) : z("", !0),
|
|
392
|
+
n(b)?.filter((f) => f.status === "draft")?.length > 0 ? (r(), w(L, { key: 1 }, [
|
|
393
|
+
s[9] || (s[9] = i("p", { class: "px-2 py-1.5 text-sm font-medium" }, "Drafts", -1)),
|
|
394
|
+
t(k, null, {
|
|
395
|
+
default: o(() => [
|
|
396
|
+
t(_, { class: "max-h-[200px] overflow-y-auto" }, {
|
|
397
|
+
default: o(() => [
|
|
398
|
+
(r(!0), w(L, null, Q(n(b).filter((f) => f.status === "draft"), (f) => (r(), V(e, {
|
|
399
|
+
key: f.id,
|
|
400
|
+
value: f.id
|
|
401
|
+
}, {
|
|
402
|
+
default: o(() => [
|
|
403
|
+
s[8] || (s[8] = i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1)),
|
|
404
|
+
i("span", ft, M(f.title), 1),
|
|
405
|
+
t(v, null, {
|
|
406
|
+
default: o(() => [
|
|
407
|
+
t(n(ie), {
|
|
408
|
+
class: te(n(re)("ml-auto size-4"))
|
|
409
|
+
}, null, 8, ["class"])
|
|
410
|
+
]),
|
|
411
|
+
_: 1
|
|
412
|
+
})
|
|
413
|
+
]),
|
|
414
|
+
_: 2
|
|
415
|
+
}, 1032, ["value"]))), 128))
|
|
416
|
+
]),
|
|
417
|
+
_: 1
|
|
418
|
+
})
|
|
419
|
+
]),
|
|
420
|
+
_: 1
|
|
421
|
+
})
|
|
422
|
+
], 64)) : z("", !0)
|
|
423
|
+
]),
|
|
424
|
+
_: 1
|
|
425
|
+
})
|
|
426
|
+
]),
|
|
427
|
+
_: 1
|
|
428
|
+
}, 8, ["modelValue"]),
|
|
429
|
+
s[15] || (s[15] = i("p", { class: "text-sm font-medium text-muted-foreground mb-4" }, " Filter by Status ", -1)),
|
|
430
|
+
i("div", mt, [
|
|
431
|
+
t(y, {
|
|
432
|
+
id: "chk_published_products",
|
|
433
|
+
modelValue: n(l).published,
|
|
434
|
+
"onUpdate:modelValue": s[1] || (s[1] = (f) => n(l).published = f)
|
|
435
|
+
}, null, 8, ["modelValue"]),
|
|
436
|
+
s[10] || (s[10] = i("label", {
|
|
437
|
+
for: "chk_published_products",
|
|
438
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
439
|
+
}, " Show published products ", -1))
|
|
440
|
+
]),
|
|
441
|
+
i("div", vt, [
|
|
442
|
+
t(y, {
|
|
443
|
+
id: "chk_draft_products",
|
|
444
|
+
modelValue: n(l).draft,
|
|
445
|
+
"onUpdate:modelValue": s[2] || (s[2] = (f) => n(l).draft = f)
|
|
446
|
+
}, null, 8, ["modelValue"]),
|
|
447
|
+
s[11] || (s[11] = i("label", {
|
|
448
|
+
for: "chk_draft_products",
|
|
449
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
450
|
+
}, " Show draft products ", -1))
|
|
451
|
+
]),
|
|
452
|
+
i("div", gt, [
|
|
453
|
+
t(y, {
|
|
454
|
+
id: "chk_archived_products",
|
|
455
|
+
modelValue: n(l).archived,
|
|
456
|
+
"onUpdate:modelValue": s[3] || (s[3] = (f) => n(l).archived = f)
|
|
457
|
+
}, null, 8, ["modelValue"]),
|
|
458
|
+
s[12] || (s[12] = i("label", {
|
|
459
|
+
for: "chk_archived_products",
|
|
460
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
461
|
+
}, " Show archived products ", -1))
|
|
462
|
+
]),
|
|
463
|
+
n(l).collections.length > 0 || !n(l).published || !n(l).draft || n(l).archived ? (r(), V(g, {
|
|
464
|
+
key: 0,
|
|
465
|
+
variant: "secondary",
|
|
466
|
+
class: "ml-auto my-2",
|
|
467
|
+
size: "sm",
|
|
468
|
+
onClick: S
|
|
469
|
+
}, {
|
|
470
|
+
default: o(() => [
|
|
471
|
+
t(n(Ae), { class: "size-3" }),
|
|
472
|
+
s[13] || (s[13] = i("span", { class: "ml-0.5 text-xs" }, "Reset filters", -1))
|
|
473
|
+
]),
|
|
474
|
+
_: 1
|
|
475
|
+
})) : z("", !0)
|
|
476
|
+
]),
|
|
477
|
+
_: 1
|
|
478
|
+
})
|
|
479
|
+
]),
|
|
480
|
+
_: 1
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}), _t = /* @__PURE__ */ X({
|
|
485
|
+
__name: "ProductContextMenu",
|
|
486
|
+
emits: ["selectAll", "duplicateProduct", "deleteProduct", "deleteSelection"],
|
|
487
|
+
setup(P, { emit: l }) {
|
|
488
|
+
const b = l, S = j("products"), h = j("selection"), s = j("config"), { hasPermission: g } = Z(), { navigateTo: c } = Y(), u = K(() => h.value?.length !== 1 ? null : S.value?.find((v) => v.id === h.value[0])), C = (v) => {
|
|
489
|
+
let e = s.previewUrl;
|
|
490
|
+
e = e.replace("{{ id", "{{id"), e = e.replace("id }}", "id}}"), e = e.replace("{{id}}", v.id), e = e.replace("{{ slug", "{{slug"), e = e.replace("slug }}", "slug}}"), e = e.replace("{{slug}}", v.slug), window.open(e, "_blank");
|
|
491
|
+
}, $ = async (v, e) => {
|
|
492
|
+
try {
|
|
493
|
+
if (!["draft", "published", "archived"].includes(e)) return;
|
|
494
|
+
await le(s.project).update(s.productCollection, v.id, { status: e }), v.status = e, B.success("Product status changed");
|
|
495
|
+
} catch {
|
|
496
|
+
B.error("Failed to change product status");
|
|
497
|
+
}
|
|
498
|
+
}, d = async (v) => {
|
|
499
|
+
try {
|
|
500
|
+
if (!["draft", "published", "archived"].includes(v)) return;
|
|
501
|
+
const e = le(s.project), _ = [];
|
|
502
|
+
h.value.forEach(async (k) => {
|
|
503
|
+
_.push(e.update(s.productCollection, k, { status: v }));
|
|
504
|
+
}), B.promise(Promise.all(_), {
|
|
505
|
+
loading: `Changing status of ${h.value.length} products...`,
|
|
506
|
+
success: () => {
|
|
507
|
+
const k = h.value.length;
|
|
508
|
+
return h.value.forEach((T) => {
|
|
509
|
+
S.value.find((A) => A.id == T).status = v;
|
|
510
|
+
}), h.value = [], `Product status changed for ${k} products`;
|
|
511
|
+
},
|
|
512
|
+
error: (k) => "Failed to change product status"
|
|
513
|
+
});
|
|
514
|
+
} catch {
|
|
515
|
+
B.error("Failed to change product status");
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
return (v, e) => {
|
|
519
|
+
const _ = a("ContextMenuTrigger"), k = a("ContextMenuShortcut"), T = a("ContextMenuItem"), A = a("ContextMenuContent"), y = a("ContextMenuSeparator"), E = a("ContextMenuSubTrigger"), D = a("ContextMenuCheckboxItem"), f = a("ContextMenuSubContent"), H = a("ContextMenuSub"), ee = a("ContextMenu");
|
|
520
|
+
return r(), V(ee, null, {
|
|
521
|
+
default: o(() => [
|
|
522
|
+
t(_, { class: "flex flex-1" }, {
|
|
523
|
+
default: o(() => [
|
|
524
|
+
ke(v.$slots, "default")
|
|
525
|
+
]),
|
|
526
|
+
_: 3
|
|
527
|
+
}),
|
|
528
|
+
n(h).length === 0 ? (r(), V(A, {
|
|
529
|
+
key: 0,
|
|
530
|
+
class: "w-64"
|
|
531
|
+
}, {
|
|
532
|
+
default: o(() => [
|
|
533
|
+
t(T, {
|
|
534
|
+
inset: "",
|
|
535
|
+
onClick: e[0] || (e[0] = (I) => b("selectAll"))
|
|
536
|
+
}, {
|
|
537
|
+
default: o(() => [
|
|
538
|
+
e[13] || (e[13] = x(" Select all ", -1)),
|
|
539
|
+
t(k, null, {
|
|
540
|
+
default: o(() => [...e[12] || (e[12] = [
|
|
541
|
+
x("⌘ + A", -1)
|
|
542
|
+
])]),
|
|
543
|
+
_: 1
|
|
544
|
+
})
|
|
545
|
+
]),
|
|
546
|
+
_: 1
|
|
547
|
+
})
|
|
548
|
+
]),
|
|
549
|
+
_: 1
|
|
550
|
+
})) : z("", !0),
|
|
551
|
+
n(h).length === 1 && u.value ? (r(), V(A, {
|
|
552
|
+
key: 1,
|
|
553
|
+
class: "w-64"
|
|
554
|
+
}, {
|
|
555
|
+
default: o(() => [
|
|
556
|
+
t(T, {
|
|
557
|
+
inset: "",
|
|
558
|
+
onClick: e[1] || (e[1] = (I) => n(c)(u.value.id))
|
|
559
|
+
}, {
|
|
560
|
+
default: o(() => [...e[14] || (e[14] = [
|
|
561
|
+
x(" Edit product ", -1)
|
|
562
|
+
])]),
|
|
563
|
+
_: 1
|
|
564
|
+
}),
|
|
565
|
+
t(y),
|
|
566
|
+
n(s).previewUrl ? (r(), w(L, { key: 0 }, [
|
|
567
|
+
t(T, {
|
|
568
|
+
inset: "",
|
|
569
|
+
onClick: e[2] || (e[2] = (I) => C(u.value))
|
|
570
|
+
}, {
|
|
571
|
+
default: o(() => [
|
|
572
|
+
e[15] || (e[15] = x(" Preview product ", -1)),
|
|
573
|
+
t(k, null, {
|
|
574
|
+
default: o(() => [
|
|
575
|
+
t(n(ze), { class: "size-4" })
|
|
576
|
+
]),
|
|
577
|
+
_: 1
|
|
578
|
+
})
|
|
579
|
+
]),
|
|
580
|
+
_: 1
|
|
581
|
+
}),
|
|
582
|
+
t(y)
|
|
583
|
+
], 64)) : z("", !0),
|
|
584
|
+
t(T, {
|
|
585
|
+
inset: "",
|
|
586
|
+
onClick: e[3] || (e[3] = (I) => b("duplicateProduct", u.value))
|
|
587
|
+
}, {
|
|
588
|
+
default: o(() => [...e[16] || (e[16] = [
|
|
589
|
+
x(" Duplicate product ", -1)
|
|
590
|
+
])]),
|
|
591
|
+
_: 1
|
|
592
|
+
}),
|
|
593
|
+
t(H, null, {
|
|
594
|
+
default: o(() => [
|
|
595
|
+
t(E, { inset: "" }, {
|
|
596
|
+
default: o(() => [...e[17] || (e[17] = [
|
|
597
|
+
x(" Change status ", -1)
|
|
598
|
+
])]),
|
|
599
|
+
_: 1
|
|
600
|
+
}),
|
|
601
|
+
t(f, { class: "w-48" }, {
|
|
602
|
+
default: o(() => [
|
|
603
|
+
t(D, {
|
|
604
|
+
onClick: e[4] || (e[4] = (I) => $(u.value, "draft")),
|
|
605
|
+
modelValue: u.value.status === "draft"
|
|
606
|
+
}, {
|
|
607
|
+
default: o(() => [...e[18] || (e[18] = [
|
|
608
|
+
i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
|
|
609
|
+
x(" Draft ", -1)
|
|
610
|
+
])]),
|
|
611
|
+
_: 1
|
|
612
|
+
}, 8, ["modelValue"]),
|
|
613
|
+
t(D, {
|
|
614
|
+
onClick: e[5] || (e[5] = (I) => $(u.value, "published")),
|
|
615
|
+
modelValue: u.value.status === "published"
|
|
616
|
+
}, {
|
|
617
|
+
default: o(() => [...e[19] || (e[19] = [
|
|
618
|
+
i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
|
|
619
|
+
x(" Published ", -1)
|
|
620
|
+
])]),
|
|
621
|
+
_: 1
|
|
622
|
+
}, 8, ["modelValue"]),
|
|
623
|
+
t(D, {
|
|
624
|
+
onClick: e[6] || (e[6] = (I) => $(u.value, "archived")),
|
|
625
|
+
modelValue: u.value.status === "archived"
|
|
626
|
+
}, {
|
|
627
|
+
default: o(() => [...e[20] || (e[20] = [
|
|
628
|
+
i("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
|
|
629
|
+
x(" Archived ", -1)
|
|
630
|
+
])]),
|
|
631
|
+
_: 1
|
|
632
|
+
}, 8, ["modelValue"])
|
|
633
|
+
]),
|
|
634
|
+
_: 1
|
|
635
|
+
})
|
|
636
|
+
]),
|
|
637
|
+
_: 1
|
|
638
|
+
}),
|
|
639
|
+
t(T, {
|
|
640
|
+
inset: "",
|
|
641
|
+
variant: "destructive",
|
|
642
|
+
onClick: e[7] || (e[7] = (I) => b("deleteProduct", u.value))
|
|
643
|
+
}, {
|
|
644
|
+
default: o(() => [...e[21] || (e[21] = [
|
|
645
|
+
x(" Delete product ", -1)
|
|
646
|
+
])]),
|
|
647
|
+
_: 1
|
|
648
|
+
})
|
|
649
|
+
]),
|
|
650
|
+
_: 1
|
|
651
|
+
})) : z("", !0),
|
|
652
|
+
n(h).length > 1 ? (r(), V(A, {
|
|
653
|
+
key: 2,
|
|
654
|
+
class: "w-64"
|
|
655
|
+
}, {
|
|
656
|
+
default: o(() => [
|
|
657
|
+
t(H, null, {
|
|
658
|
+
default: o(() => [
|
|
659
|
+
t(E, { inset: "" }, {
|
|
660
|
+
default: o(() => [
|
|
661
|
+
x(" Change status (" + M(n(h).length) + ") ", 1)
|
|
662
|
+
]),
|
|
663
|
+
_: 1
|
|
664
|
+
}),
|
|
665
|
+
t(f, { class: "w-48" }, {
|
|
666
|
+
default: o(() => [
|
|
667
|
+
t(D, {
|
|
668
|
+
onClick: e[8] || (e[8] = (I) => d("draft"))
|
|
669
|
+
}, {
|
|
670
|
+
default: o(() => [...e[22] || (e[22] = [
|
|
671
|
+
i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
|
|
672
|
+
x(" Draft ", -1)
|
|
673
|
+
])]),
|
|
674
|
+
_: 1
|
|
675
|
+
}),
|
|
676
|
+
t(D, {
|
|
677
|
+
onClick: e[9] || (e[9] = (I) => d("published"))
|
|
678
|
+
}, {
|
|
679
|
+
default: o(() => [...e[23] || (e[23] = [
|
|
680
|
+
i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
|
|
681
|
+
x(" Published ", -1)
|
|
682
|
+
])]),
|
|
683
|
+
_: 1
|
|
684
|
+
}),
|
|
685
|
+
t(D, {
|
|
686
|
+
onClick: e[10] || (e[10] = (I) => d("archived"))
|
|
687
|
+
}, {
|
|
688
|
+
default: o(() => [...e[24] || (e[24] = [
|
|
689
|
+
i("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
|
|
690
|
+
x(" Archived ", -1)
|
|
691
|
+
])]),
|
|
692
|
+
_: 1
|
|
693
|
+
})
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
})
|
|
697
|
+
]),
|
|
698
|
+
_: 1
|
|
699
|
+
}),
|
|
700
|
+
t(T, {
|
|
701
|
+
inset: "",
|
|
702
|
+
variant: "destructive",
|
|
703
|
+
onClick: e[11] || (e[11] = (I) => b("deleteSelection"))
|
|
704
|
+
}, {
|
|
705
|
+
default: o(() => [
|
|
706
|
+
x(" Delete products (" + M(n(h).length) + ") ", 1)
|
|
707
|
+
]),
|
|
708
|
+
_: 1
|
|
709
|
+
})
|
|
710
|
+
]),
|
|
711
|
+
_: 1
|
|
712
|
+
})) : z("", !0)
|
|
713
|
+
]),
|
|
714
|
+
_: 3
|
|
715
|
+
});
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
}), xt = { class: "relative flex flex-col flex-1" }, Ct = {
|
|
719
|
+
ref: "container",
|
|
720
|
+
class: "flex items-center justify-between gap-4 w-full mt-12 mb-8"
|
|
721
|
+
}, yt = { class: "flex items-center gap-4" }, wt = { class: "text-lg whitespace-nowrap" }, ht = { class: "relative w-full max-w-sm items-center" }, kt = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2" }, Pt = { class: "flex items-center gap-4" }, St = { class: "flex flex-1" }, It = /* @__PURE__ */ X({
|
|
722
|
+
__name: "Overview",
|
|
723
|
+
props: {
|
|
724
|
+
config: {
|
|
725
|
+
type: Object,
|
|
726
|
+
required: !0
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
async setup(P) {
|
|
730
|
+
let l, b;
|
|
731
|
+
const S = P, { hasPermission: h } = Z(), { navigateTo: s } = Y(), { confirm: g } = Be();
|
|
732
|
+
Re(() => []);
|
|
733
|
+
const c = le(S.config.project), u = O([]), C = async () => {
|
|
734
|
+
const m = await c.find(S.config.productCollection);
|
|
735
|
+
u.value = m || [];
|
|
736
|
+
}, $ = Pe("container"), { width: d } = st($), v = O("grid"), e = O(1), _ = O([]), k = O(""), T = O([]);
|
|
737
|
+
T.value = ([l, b] = Se(() => D()), l = await l, b(), l);
|
|
738
|
+
const A = K(() => v.value === "grid" ? d.value < 768 ? 6 : d.value < 896 ? 8 : d.value < 1024 ? 10 : 12 : 10), y = K(() => u.value.filter((m) => !(U.value.collections.length > 0 && !m.collections?.some((p) => U.value.collections.includes(p)) || !U.value.published && m.status === "published" || !U.value.draft && m.status === "draft" || !U.value.archived && m.status === "archived")).filter((m) => m.title.toLowerCase().includes(k.value.toLowerCase()) || m.slug.toLowerCase().includes(k.value.toLowerCase()) || m.id.toLowerCase().includes(k.value.toLowerCase()))), E = K(() => {
|
|
739
|
+
if (y.value.length <= A.value)
|
|
740
|
+
return y.value;
|
|
741
|
+
const m = (e.value - 1) * A.value, p = m + A.value;
|
|
742
|
+
return y.value.slice(m, p);
|
|
743
|
+
});
|
|
744
|
+
async function D() {
|
|
745
|
+
if (!S.config.collectionsCollection) return [];
|
|
746
|
+
const m = S.config.collectionsCollection.split(":");
|
|
747
|
+
return m.length !== 2 ? [] : (await c.get(m[0]))?.[m[1]] || [];
|
|
748
|
+
}
|
|
749
|
+
async function f(m) {
|
|
750
|
+
return (await c.find(S.config.productCollection, {
|
|
751
|
+
filters: [
|
|
752
|
+
{
|
|
753
|
+
field: "slug",
|
|
754
|
+
operator: "==",
|
|
755
|
+
value: m
|
|
756
|
+
}
|
|
757
|
+
]
|
|
758
|
+
})).length > 0;
|
|
759
|
+
}
|
|
760
|
+
const H = () => {
|
|
761
|
+
_.value = E.value.map((m) => m.id);
|
|
762
|
+
}, ee = async (m) => {
|
|
763
|
+
try {
|
|
764
|
+
let p = { ...m }, F = p.slug + "-copy", N = 2;
|
|
765
|
+
for (; await f(F); )
|
|
766
|
+
F = p.slug + "-copy-" + N, N++;
|
|
767
|
+
p.id = void 0, p.createdAt = /* @__PURE__ */ new Date(), p.updatedAt = /* @__PURE__ */ new Date(), p.slug = F, p.status = "draft", p.title = p.title + " (copy)";
|
|
768
|
+
const J = await c.add(S.config.productCollection, p);
|
|
769
|
+
s(J.id), B.success("Product duplicated");
|
|
770
|
+
} catch {
|
|
771
|
+
B.error("Failed to duplicate product");
|
|
772
|
+
}
|
|
773
|
+
}, I = async (m) => {
|
|
774
|
+
if (await g(`Are you sure you want to delete "${m.title}"?`))
|
|
775
|
+
try {
|
|
776
|
+
await c.remove(S.config.productCollection, m.id), u.value = u.value.filter((F) => F.id !== m.id), _.value = [], B.success("Product deleted");
|
|
777
|
+
} catch {
|
|
778
|
+
B.error("Failed to delete product");
|
|
779
|
+
}
|
|
780
|
+
}, se = async () => {
|
|
781
|
+
if (await g(`Are you sure you want to delete all selected products (${_.value.length})?`))
|
|
782
|
+
try {
|
|
783
|
+
_.value.forEach(async (p) => {
|
|
784
|
+
await c.remove(S.config.productCollection, p);
|
|
785
|
+
}), u.value = u.value.filter((p) => !_.value.includes(p.id)), _.value = [], B.success("Products deleted");
|
|
786
|
+
} catch {
|
|
787
|
+
B.error("Failed to delete products");
|
|
788
|
+
}
|
|
789
|
+
}, U = O({
|
|
790
|
+
collections: [],
|
|
791
|
+
published: !0,
|
|
792
|
+
draft: !0,
|
|
793
|
+
archived: !1
|
|
794
|
+
});
|
|
795
|
+
ne(U, () => {
|
|
796
|
+
e.value = 1;
|
|
797
|
+
});
|
|
798
|
+
const ue = (m) => {
|
|
799
|
+
m.target?.matches("input, textarea") || m.target?.isContentEditable || (m.key === "Escape" && (_.value = []), (m.metaKey || m.ctrlKey) && m.key.toLowerCase() === "a" && (m.preventDefault(), H()));
|
|
800
|
+
};
|
|
801
|
+
return pe(() => {
|
|
802
|
+
C(), window.addEventListener("keydown", ue);
|
|
803
|
+
}), $e(() => {
|
|
804
|
+
window.removeEventListener("keydown", ue);
|
|
805
|
+
}), q("config", S.config), q("filter", U), q("products", u), q("collections", T), q("selection", _), (m, p) => {
|
|
806
|
+
const F = a("Input"), N = a("Button"), J = a("SegmentedControlButton"), me = a("SegmentedControl"), ve = a("PaginationFirst"), ge = a("PaginationPrev"), be = a("PaginationListItem"), _e = a("PaginationEllipsis"), xe = a("PaginationNext"), Ce = a("PaginationLast"), ye = a("PaginationList"), we = a("Pagination");
|
|
807
|
+
return r(), w("div", xt, [
|
|
808
|
+
i("div", Ct, [
|
|
809
|
+
i("div", yt, [
|
|
810
|
+
i("p", wt, M(y.value?.length) + " products", 1),
|
|
811
|
+
i("div", ht, [
|
|
812
|
+
t(F, {
|
|
813
|
+
id: "search",
|
|
814
|
+
type: "text",
|
|
815
|
+
placeholder: "Search...",
|
|
816
|
+
class: "pl-8",
|
|
817
|
+
onKeydown: p[0] || (p[0] = Me((R) => k.value = "", ["escape"])),
|
|
818
|
+
modelValue: k.value,
|
|
819
|
+
"onUpdate:modelValue": p[1] || (p[1] = (R) => k.value = R)
|
|
820
|
+
}, null, 8, ["modelValue"]),
|
|
821
|
+
i("span", kt, [
|
|
822
|
+
t(n(Ie), { class: "size-4 text-muted-foreground" })
|
|
823
|
+
])
|
|
824
|
+
])
|
|
825
|
+
]),
|
|
826
|
+
i("div", Pt, [
|
|
827
|
+
_.value.length > 0 ? (r(), V(N, {
|
|
828
|
+
key: 0,
|
|
829
|
+
variant: "destructive",
|
|
830
|
+
onClick: se
|
|
831
|
+
}, {
|
|
832
|
+
default: o(() => [
|
|
833
|
+
x(" Delete Selection (" + M(_.value.length) + ") ", 1)
|
|
834
|
+
]),
|
|
835
|
+
_: 1
|
|
836
|
+
})) : z("", !0),
|
|
837
|
+
n(h)("create-product") ? (r(), w(L, { key: 1 }, [
|
|
838
|
+
t(N, {
|
|
839
|
+
variant: "outline",
|
|
840
|
+
onClick: p[2] || (p[2] = (R) => n(s)("new"))
|
|
841
|
+
}, {
|
|
842
|
+
default: o(() => [
|
|
843
|
+
t(n(Le), { class: "size-4" }),
|
|
844
|
+
p[5] || (p[5] = x(" New Product ", -1))
|
|
845
|
+
]),
|
|
846
|
+
_: 1
|
|
847
|
+
}),
|
|
848
|
+
p[6] || (p[6] = i("div", { class: "w-[1px] h-8 bg-border" }, null, -1))
|
|
849
|
+
], 64)) : z("", !0),
|
|
850
|
+
t(bt),
|
|
851
|
+
p[7] || (p[7] = i("div", { class: "w-[1px] h-8 bg-border" }, null, -1)),
|
|
852
|
+
i("div", null, [
|
|
853
|
+
t(me, {
|
|
854
|
+
modelValue: v.value,
|
|
855
|
+
"onUpdate:modelValue": p[3] || (p[3] = (R) => v.value = R),
|
|
856
|
+
"aria-label": "View mode"
|
|
857
|
+
}, {
|
|
858
|
+
default: o(() => [
|
|
859
|
+
t(J, { value: "grid" }, {
|
|
860
|
+
default: o(() => [
|
|
861
|
+
t(n(Ee), { class: "size-4" })
|
|
862
|
+
]),
|
|
863
|
+
_: 1
|
|
864
|
+
}),
|
|
865
|
+
t(J, { value: "list" }, {
|
|
866
|
+
default: o(() => [
|
|
867
|
+
t(n(De), { class: "size-4" })
|
|
868
|
+
]),
|
|
869
|
+
_: 1
|
|
870
|
+
})
|
|
871
|
+
]),
|
|
872
|
+
_: 1
|
|
873
|
+
}, 8, ["modelValue"])
|
|
874
|
+
])
|
|
875
|
+
])
|
|
876
|
+
], 512),
|
|
877
|
+
i("div", St, [
|
|
878
|
+
t(_t, {
|
|
879
|
+
onSelectAll: H,
|
|
880
|
+
onDuplicateProduct: ee,
|
|
881
|
+
onDeleteProduct: I,
|
|
882
|
+
onDeleteSelection: se
|
|
883
|
+
}, {
|
|
884
|
+
default: o(() => [
|
|
885
|
+
v.value === "grid" ? (r(), V(Xe, {
|
|
886
|
+
key: 0,
|
|
887
|
+
products: E.value
|
|
888
|
+
}, null, 8, ["products"])) : (r(), V(tt, {
|
|
889
|
+
key: 1,
|
|
890
|
+
products: E.value
|
|
891
|
+
}, null, 8, ["products"]))
|
|
892
|
+
]),
|
|
893
|
+
_: 1
|
|
894
|
+
})
|
|
895
|
+
]),
|
|
896
|
+
y.value?.length > A.value ? (r(), V(we, {
|
|
897
|
+
key: 0,
|
|
898
|
+
page: e.value,
|
|
899
|
+
"onUpdate:page": p[4] || (p[4] = (R) => e.value = R),
|
|
900
|
+
"items-per-page": A.value,
|
|
901
|
+
total: y.value?.length,
|
|
902
|
+
"sibling-count": 1,
|
|
903
|
+
"show-edges": ""
|
|
904
|
+
}, {
|
|
905
|
+
default: o(() => [
|
|
906
|
+
t(ye, { class: "flex items-center gap-1" }, {
|
|
907
|
+
default: o(({ items: R }) => [
|
|
908
|
+
t(ve),
|
|
909
|
+
t(ge),
|
|
910
|
+
(r(!0), w(L, null, Q(R, (W, ae) => (r(), w(L, null, [
|
|
911
|
+
W.type === "page" ? (r(), V(be, {
|
|
912
|
+
key: ae,
|
|
913
|
+
value: W.value,
|
|
914
|
+
"as-child": ""
|
|
915
|
+
}, {
|
|
916
|
+
default: o(() => [
|
|
917
|
+
t(N, {
|
|
918
|
+
class: "size-10 p-0",
|
|
919
|
+
variant: W.value === e.value ? "default" : "outline"
|
|
920
|
+
}, {
|
|
921
|
+
default: o(() => [
|
|
922
|
+
x(M(W.value), 1)
|
|
923
|
+
]),
|
|
924
|
+
_: 2
|
|
925
|
+
}, 1032, ["variant"])
|
|
926
|
+
]),
|
|
927
|
+
_: 2
|
|
928
|
+
}, 1032, ["value"])) : (r(), V(_e, {
|
|
929
|
+
key: W.type,
|
|
930
|
+
index: ae
|
|
931
|
+
}, null, 8, ["index"]))
|
|
932
|
+
], 64))), 256)),
|
|
933
|
+
t(xe),
|
|
934
|
+
t(Ce)
|
|
935
|
+
]),
|
|
936
|
+
_: 1
|
|
937
|
+
})
|
|
938
|
+
]),
|
|
939
|
+
_: 1
|
|
940
|
+
}, 8, ["page", "items-per-page", "total"])) : z("", !0)
|
|
941
|
+
]);
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
export {
|
|
946
|
+
It as default
|
|
947
|
+
};
|