@webx-ui/module-catalog-landings 0.1.12 → 0.2.0
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/LandingEditorPage-Dt1xmQXl.js +292 -0
- package/dist/LandingEditorPage-Dt1xmQXl.js.map +1 -0
- package/dist/LandingsPage-BAIQAJv2.js +864 -0
- package/dist/LandingsPage-BAIQAJv2.js.map +1 -0
- package/dist/index-DEreqbgG.js +768 -0
- package/dist/index-DEreqbgG.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +19 -1896
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { defineComponent as he, ref as g, onMounted as _e, watch as ie, computed as h, onBeforeUnmount as Pe, openBlock as v, createBlock as V, unref as e, isRef as Ae, withCtx as l, createTextVNode as m, toDisplayString as p, createCommentVNode as H, createElementBlock as w, createVNode as t, createElementVNode as P, Fragment as ne, renderList as ke } from "vue";
|
|
2
|
+
import { useRoute as Le, useRouter as Oe } from "vue-router";
|
|
3
|
+
import { useModal as Ie, useLocales as xe, WxDialog as Re, WxAlert as ge, WxFormItem as b, WxTreeSelect as we, WxSwitch as J, WxSelect as fe, WxInputNumber as De, WxText as R, WxInput as ae, WxTable as Ve, WxProgress as Ee, WxSpace as Fe, WxButton as G, createModal as je, WxBadge as te, WxTooltip as Ge, WxIcon as ye, toast as I, localizedValue as be, confirm as He } from "@webx-ui/core";
|
|
4
|
+
import { useAdmin as We, useTranslate as ve, useErrorText as Ue, rowMenuWidth as Je, WxListScreen as Ke, WxRowMenu as Qe, WxDate as Xe, WxFilterChips as Ye } from "@webx-ui/module-admin";
|
|
5
|
+
import { useCategoryTree as ze } from "@webx-ui/module-catalog";
|
|
6
|
+
import { c as $e, u as qe, N as Ce, _ as Se } from "./index-DEreqbgG.js";
|
|
7
|
+
const Ze = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "wx-catalog-landings-generate"
|
|
10
|
+
}, el = {
|
|
11
|
+
key: 2,
|
|
12
|
+
class: "wx-catalog-landings-generate"
|
|
13
|
+
}, ll = { class: "wx-catalog-landings-generate__mono" }, al = {
|
|
14
|
+
key: 3,
|
|
15
|
+
class: "wx-catalog-landings-generate"
|
|
16
|
+
}, tl = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "wx-catalog-landings-generate__errors"
|
|
19
|
+
}, nl = /* @__PURE__ */ he({
|
|
20
|
+
__name: "GenerateDialog",
|
|
21
|
+
setup(me) {
|
|
22
|
+
const { open: D, resolve: E } = Ie(), A = We(), S = $e(A), T = ze(A), K = xe();
|
|
23
|
+
qe();
|
|
24
|
+
const r = ve(Ce), u = Ue(), x = g("form"), W = g([]), Q = g(!1), U = g(null), z = g([]), F = g(1), _ = g({ slug: "", name: "", h1: "", title: "", description: "" }), N = g(!1), $ = g([]), q = g({}), f = g(""), k = g(!1), y = g(null), c = g(null);
|
|
25
|
+
_e(() => {
|
|
26
|
+
T.load().catch(() => {
|
|
27
|
+
});
|
|
28
|
+
}), ie(
|
|
29
|
+
() => W.value[0] ?? null,
|
|
30
|
+
async (d) => {
|
|
31
|
+
if (d === null) {
|
|
32
|
+
$.value = [];
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
$.value = (await S.facets(d)).filter((o) => o.kind !== "range");
|
|
37
|
+
} catch (o) {
|
|
38
|
+
f.value = u(o);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
const B = h(
|
|
43
|
+
() => $.value.map((d) => ({ value: d.key, label: d.label }))
|
|
44
|
+
), ue = h(
|
|
45
|
+
() => ($.value.find((d) => d.key === U.value)?.values ?? []).map((d) => ({
|
|
46
|
+
value: d.value,
|
|
47
|
+
label: `${d.label} (${d.count})`
|
|
48
|
+
}))
|
|
49
|
+
);
|
|
50
|
+
ie(U, () => z.value = []);
|
|
51
|
+
const X = h(() => ({
|
|
52
|
+
categories: W.value,
|
|
53
|
+
subtree: Q.value,
|
|
54
|
+
facet: U.value ?? "",
|
|
55
|
+
values: z.value.length > 0 ? z.value : null,
|
|
56
|
+
min_products: F.value,
|
|
57
|
+
..._.value,
|
|
58
|
+
publish: N.value
|
|
59
|
+
})), oe = h(() => W.value.length > 0 && U.value !== null);
|
|
60
|
+
function Y(d) {
|
|
61
|
+
return q.value[d]?.[0];
|
|
62
|
+
}
|
|
63
|
+
function L(d) {
|
|
64
|
+
const o = d.body;
|
|
65
|
+
o?.errors ? q.value = o.errors : f.value = u(d);
|
|
66
|
+
}
|
|
67
|
+
async function re() {
|
|
68
|
+
if (!(!oe.value || k.value)) {
|
|
69
|
+
k.value = !0, q.value = {}, f.value = "";
|
|
70
|
+
try {
|
|
71
|
+
y.value = await S.preview(X.value), x.value = "preview";
|
|
72
|
+
} catch (d) {
|
|
73
|
+
L(d);
|
|
74
|
+
} finally {
|
|
75
|
+
k.value = !1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
let Z;
|
|
80
|
+
async function O(d, o = 1500) {
|
|
81
|
+
Z = setTimeout(async () => {
|
|
82
|
+
try {
|
|
83
|
+
c.value = await S.run(d), (c.value.status === "queued" || c.value.status === "running") && O(d);
|
|
84
|
+
} catch {
|
|
85
|
+
O(d, Math.min(o * 2, 15e3));
|
|
86
|
+
}
|
|
87
|
+
}, o);
|
|
88
|
+
}
|
|
89
|
+
async function M() {
|
|
90
|
+
if (!k.value) {
|
|
91
|
+
k.value = !0, f.value = "";
|
|
92
|
+
try {
|
|
93
|
+
c.value = await S.generate(X.value), x.value = "run", c.value.id !== null && !j.value && O(c.value.id);
|
|
94
|
+
} catch (d) {
|
|
95
|
+
L(d), x.value = "form";
|
|
96
|
+
} finally {
|
|
97
|
+
k.value = !1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
Pe(() => clearTimeout(Z));
|
|
102
|
+
const j = h(() => c.value?.status === "done" || c.value?.status === "failed");
|
|
103
|
+
function ee() {
|
|
104
|
+
E(c.value && c.value.done > 0 ? c.value : null);
|
|
105
|
+
}
|
|
106
|
+
const se = (d) => d[K.active.value] ?? Object.values(d)[0] ?? "", le = h(() => [
|
|
107
|
+
{ key: "address", label: r("generate.column-address"), minWidth: 180 },
|
|
108
|
+
{ key: "title", label: r("generate.column-h1"), minWidth: 180, hideBelow: 560 },
|
|
109
|
+
{ key: "count", label: r("generate.column-count"), width: 100, align: "right" },
|
|
110
|
+
{ key: "conflict", label: r("generate.column-conflict"), minWidth: 180 }
|
|
111
|
+
]), de = h(
|
|
112
|
+
() => (y.value?.rows ?? []).map((d, o) => ({ ...d, id: o }))
|
|
113
|
+
);
|
|
114
|
+
return (d, o) => (v(), V(e(Re), {
|
|
115
|
+
open: e(D),
|
|
116
|
+
"onUpdate:open": [
|
|
117
|
+
o[12] || (o[12] = (s) => Ae(D) ? D.value = s : null),
|
|
118
|
+
o[13] || (o[13] = (s) => !s && ee())
|
|
119
|
+
],
|
|
120
|
+
title: e(r)("generate.title"),
|
|
121
|
+
width: x.value === "form" ? 600 : 860
|
|
122
|
+
}, {
|
|
123
|
+
footer: l(() => [
|
|
124
|
+
t(e(Fe), { size: "sm" }, {
|
|
125
|
+
default: l(() => [
|
|
126
|
+
x.value === "form" ? (v(), w(ne, { key: 0 }, [
|
|
127
|
+
t(e(G), {
|
|
128
|
+
variant: "outline",
|
|
129
|
+
onClick: ee
|
|
130
|
+
}, {
|
|
131
|
+
default: l(() => [
|
|
132
|
+
m(p(e(r)("panel.cancel")), 1)
|
|
133
|
+
]),
|
|
134
|
+
_: 1
|
|
135
|
+
}),
|
|
136
|
+
t(e(G), {
|
|
137
|
+
type: "primary",
|
|
138
|
+
loading: k.value,
|
|
139
|
+
disabled: !oe.value,
|
|
140
|
+
onClick: re
|
|
141
|
+
}, {
|
|
142
|
+
default: l(() => [
|
|
143
|
+
m(p(e(r)("generate.preview")), 1)
|
|
144
|
+
]),
|
|
145
|
+
_: 1
|
|
146
|
+
}, 8, ["loading", "disabled"])
|
|
147
|
+
], 64)) : x.value === "preview" ? (v(), w(ne, { key: 1 }, [
|
|
148
|
+
t(e(G), {
|
|
149
|
+
variant: "outline",
|
|
150
|
+
onClick: o[11] || (o[11] = (s) => x.value = "form")
|
|
151
|
+
}, {
|
|
152
|
+
default: l(() => [
|
|
153
|
+
m(p(e(r)("generate.back")), 1)
|
|
154
|
+
]),
|
|
155
|
+
_: 1
|
|
156
|
+
}),
|
|
157
|
+
t(e(G), {
|
|
158
|
+
type: "primary",
|
|
159
|
+
loading: k.value,
|
|
160
|
+
disabled: (y.value?.free ?? 0) === 0,
|
|
161
|
+
onClick: M
|
|
162
|
+
}, {
|
|
163
|
+
default: l(() => [
|
|
164
|
+
m(p(e(r)("generate.run", { count: y.value?.free ?? 0 })), 1)
|
|
165
|
+
]),
|
|
166
|
+
_: 1
|
|
167
|
+
}, 8, ["loading", "disabled"])
|
|
168
|
+
], 64)) : (v(), V(e(G), {
|
|
169
|
+
key: 2,
|
|
170
|
+
type: "primary",
|
|
171
|
+
disabled: !j.value,
|
|
172
|
+
onClick: ee
|
|
173
|
+
}, {
|
|
174
|
+
default: l(() => [
|
|
175
|
+
m(p(e(r)("generate.close")), 1)
|
|
176
|
+
]),
|
|
177
|
+
_: 1
|
|
178
|
+
}, 8, ["disabled"]))
|
|
179
|
+
]),
|
|
180
|
+
_: 1
|
|
181
|
+
})
|
|
182
|
+
]),
|
|
183
|
+
default: l(() => [
|
|
184
|
+
f.value ? (v(), V(e(ge), {
|
|
185
|
+
key: 0,
|
|
186
|
+
type: "danger"
|
|
187
|
+
}, {
|
|
188
|
+
default: l(() => [
|
|
189
|
+
m(p(f.value), 1)
|
|
190
|
+
]),
|
|
191
|
+
_: 1
|
|
192
|
+
})) : H("", !0),
|
|
193
|
+
x.value === "form" ? (v(), w("div", Ze, [
|
|
194
|
+
t(e(b), {
|
|
195
|
+
label: e(r)("generate.bases"),
|
|
196
|
+
help: e(r)("generate.bases-help"),
|
|
197
|
+
error: Y("categories"),
|
|
198
|
+
required: ""
|
|
199
|
+
}, {
|
|
200
|
+
default: l(() => [
|
|
201
|
+
t(e(we), {
|
|
202
|
+
"model-value": W.value,
|
|
203
|
+
nodes: e(T).nodes.value ?? [],
|
|
204
|
+
"node-key": "id",
|
|
205
|
+
"label-key": "name",
|
|
206
|
+
"children-key": "children",
|
|
207
|
+
multiple: "",
|
|
208
|
+
"check-strictly": "",
|
|
209
|
+
filterable: "",
|
|
210
|
+
clearable: "",
|
|
211
|
+
"onUpdate:modelValue": o[0] || (o[0] = (s) => W.value = Array.isArray(s) ? s.map(Number) : s ? [Number(s)] : [])
|
|
212
|
+
}, null, 8, ["model-value", "nodes"])
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
}, 8, ["label", "help", "error"]),
|
|
216
|
+
t(e(b), null, {
|
|
217
|
+
default: l(() => [
|
|
218
|
+
t(e(J), {
|
|
219
|
+
modelValue: Q.value,
|
|
220
|
+
"onUpdate:modelValue": o[1] || (o[1] = (s) => Q.value = s)
|
|
221
|
+
}, {
|
|
222
|
+
default: l(() => [
|
|
223
|
+
m(p(e(r)("generate.subtree")), 1)
|
|
224
|
+
]),
|
|
225
|
+
_: 1
|
|
226
|
+
}, 8, ["modelValue"])
|
|
227
|
+
]),
|
|
228
|
+
_: 1
|
|
229
|
+
}),
|
|
230
|
+
t(e(b), {
|
|
231
|
+
label: e(r)("generate.facet"),
|
|
232
|
+
error: Y("facet"),
|
|
233
|
+
required: ""
|
|
234
|
+
}, {
|
|
235
|
+
default: l(() => [
|
|
236
|
+
t(e(fe), {
|
|
237
|
+
modelValue: U.value,
|
|
238
|
+
"onUpdate:modelValue": o[2] || (o[2] = (s) => U.value = s),
|
|
239
|
+
options: B.value,
|
|
240
|
+
disabled: W.value.length === 0
|
|
241
|
+
}, null, 8, ["modelValue", "options", "disabled"])
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
}, 8, ["label", "error"]),
|
|
245
|
+
t(e(b), {
|
|
246
|
+
label: e(r)("generate.values"),
|
|
247
|
+
help: e(r)("generate.values-help")
|
|
248
|
+
}, {
|
|
249
|
+
default: l(() => [
|
|
250
|
+
t(e(fe), {
|
|
251
|
+
modelValue: z.value,
|
|
252
|
+
"onUpdate:modelValue": o[3] || (o[3] = (s) => z.value = s),
|
|
253
|
+
options: ue.value,
|
|
254
|
+
multiple: "",
|
|
255
|
+
filterable: "",
|
|
256
|
+
clearable: "",
|
|
257
|
+
disabled: U.value === null
|
|
258
|
+
}, null, 8, ["modelValue", "options", "disabled"])
|
|
259
|
+
]),
|
|
260
|
+
_: 1
|
|
261
|
+
}, 8, ["label", "help"]),
|
|
262
|
+
t(e(b), {
|
|
263
|
+
label: e(r)("generate.min-products"),
|
|
264
|
+
help: e(r)("generate.min-products-help")
|
|
265
|
+
}, {
|
|
266
|
+
default: l(() => [
|
|
267
|
+
t(e(De), {
|
|
268
|
+
modelValue: F.value,
|
|
269
|
+
"onUpdate:modelValue": o[4] || (o[4] = (s) => F.value = s),
|
|
270
|
+
min: 0,
|
|
271
|
+
disabled: z.value.length > 0
|
|
272
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
273
|
+
]),
|
|
274
|
+
_: 1
|
|
275
|
+
}, 8, ["label", "help"]),
|
|
276
|
+
t(e(R), { weight: "medium" }, {
|
|
277
|
+
default: l(() => [
|
|
278
|
+
m(p(e(r)("generate.templates")), 1)
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
}),
|
|
282
|
+
t(e(R), {
|
|
283
|
+
size: "sm",
|
|
284
|
+
tone: "muted"
|
|
285
|
+
}, {
|
|
286
|
+
default: l(() => [
|
|
287
|
+
m(p(e(r)("generate.templates-help")), 1)
|
|
288
|
+
]),
|
|
289
|
+
_: 1
|
|
290
|
+
}),
|
|
291
|
+
t(e(b), {
|
|
292
|
+
label: e(r)("generate.slug"),
|
|
293
|
+
error: Y("slug")
|
|
294
|
+
}, {
|
|
295
|
+
default: l(() => [
|
|
296
|
+
t(e(ae), {
|
|
297
|
+
modelValue: _.value.slug,
|
|
298
|
+
"onUpdate:modelValue": o[5] || (o[5] = (s) => _.value.slug = s),
|
|
299
|
+
placeholder: "{category}-{value}"
|
|
300
|
+
}, null, 8, ["modelValue"])
|
|
301
|
+
]),
|
|
302
|
+
_: 1
|
|
303
|
+
}, 8, ["label", "error"]),
|
|
304
|
+
t(e(b), {
|
|
305
|
+
label: e(r)("generate.name")
|
|
306
|
+
}, {
|
|
307
|
+
default: l(() => [
|
|
308
|
+
t(e(ae), {
|
|
309
|
+
modelValue: _.value.name,
|
|
310
|
+
"onUpdate:modelValue": o[6] || (o[6] = (s) => _.value.name = s),
|
|
311
|
+
placeholder: "{category} {value}"
|
|
312
|
+
}, null, 8, ["modelValue"])
|
|
313
|
+
]),
|
|
314
|
+
_: 1
|
|
315
|
+
}, 8, ["label"]),
|
|
316
|
+
t(e(b), {
|
|
317
|
+
label: e(r)("generate.h1")
|
|
318
|
+
}, {
|
|
319
|
+
default: l(() => [
|
|
320
|
+
t(e(ae), {
|
|
321
|
+
modelValue: _.value.h1,
|
|
322
|
+
"onUpdate:modelValue": o[7] || (o[7] = (s) => _.value.h1 = s),
|
|
323
|
+
placeholder: e(r)("generate.template-empty")
|
|
324
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
325
|
+
]),
|
|
326
|
+
_: 1
|
|
327
|
+
}, 8, ["label"]),
|
|
328
|
+
t(e(b), {
|
|
329
|
+
label: e(r)("generate.seo-title")
|
|
330
|
+
}, {
|
|
331
|
+
default: l(() => [
|
|
332
|
+
t(e(ae), {
|
|
333
|
+
modelValue: _.value.title,
|
|
334
|
+
"onUpdate:modelValue": o[8] || (o[8] = (s) => _.value.title = s),
|
|
335
|
+
placeholder: e(r)("generate.template-empty")
|
|
336
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
337
|
+
]),
|
|
338
|
+
_: 1
|
|
339
|
+
}, 8, ["label"]),
|
|
340
|
+
t(e(b), {
|
|
341
|
+
label: e(r)("generate.seo-description")
|
|
342
|
+
}, {
|
|
343
|
+
default: l(() => [
|
|
344
|
+
t(e(ae), {
|
|
345
|
+
modelValue: _.value.description,
|
|
346
|
+
"onUpdate:modelValue": o[9] || (o[9] = (s) => _.value.description = s),
|
|
347
|
+
placeholder: e(r)("generate.template-empty")
|
|
348
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
349
|
+
]),
|
|
350
|
+
_: 1
|
|
351
|
+
}, 8, ["label"]),
|
|
352
|
+
t(e(b), null, {
|
|
353
|
+
default: l(() => [
|
|
354
|
+
t(e(J), {
|
|
355
|
+
modelValue: N.value,
|
|
356
|
+
"onUpdate:modelValue": o[10] || (o[10] = (s) => N.value = s)
|
|
357
|
+
}, {
|
|
358
|
+
default: l(() => [
|
|
359
|
+
m(p(e(r)("generate.publish")), 1)
|
|
360
|
+
]),
|
|
361
|
+
_: 1
|
|
362
|
+
}, 8, ["modelValue"])
|
|
363
|
+
]),
|
|
364
|
+
_: 1
|
|
365
|
+
})
|
|
366
|
+
])) : x.value === "preview" && y.value ? (v(), w("div", el, [
|
|
367
|
+
t(e(R), null, {
|
|
368
|
+
default: l(() => [
|
|
369
|
+
m(p(y.value.free > 0 ? e(r)("generate.summary", { free: y.value.free, skipped: y.value.total - y.value.free }) : e(r)("generate.nothing")), 1)
|
|
370
|
+
]),
|
|
371
|
+
_: 1
|
|
372
|
+
}),
|
|
373
|
+
t(e(Ve), {
|
|
374
|
+
data: de.value,
|
|
375
|
+
columns: le.value,
|
|
376
|
+
"row-key": "id",
|
|
377
|
+
flush: "",
|
|
378
|
+
layout: "fixed"
|
|
379
|
+
}, {
|
|
380
|
+
"cell-address": l(({ row: s }) => [
|
|
381
|
+
P("span", ll, "/" + p(se(s.slug)) + "/", 1)
|
|
382
|
+
]),
|
|
383
|
+
"cell-title": l(({ row: s }) => [
|
|
384
|
+
m(p(se(Object.keys(s.h1).length > 0 ? s.h1 : s.name)), 1)
|
|
385
|
+
]),
|
|
386
|
+
"cell-conflict": l(({ row: s }) => [
|
|
387
|
+
s.conflict ? (v(), V(e(R), {
|
|
388
|
+
key: 0,
|
|
389
|
+
size: "sm",
|
|
390
|
+
tone: "warning"
|
|
391
|
+
}, {
|
|
392
|
+
default: l(() => [
|
|
393
|
+
m(p(s.message), 1)
|
|
394
|
+
]),
|
|
395
|
+
_: 2
|
|
396
|
+
}, 1024)) : H("", !0)
|
|
397
|
+
]),
|
|
398
|
+
_: 1
|
|
399
|
+
}, 8, ["data", "columns"])
|
|
400
|
+
])) : x.value === "run" && c.value ? (v(), w("div", al, [
|
|
401
|
+
j.value ? (v(), V(e(ge), {
|
|
402
|
+
key: 1,
|
|
403
|
+
type: c.value.status === "failed" ? "danger" : "success"
|
|
404
|
+
}, {
|
|
405
|
+
default: l(() => [
|
|
406
|
+
m(p(c.value.status === "failed" ? e(r)("generate.failed") : e(r)("generate.done", { done: c.value.done, skipped: c.value.skipped, failed: c.value.failed })), 1)
|
|
407
|
+
]),
|
|
408
|
+
_: 1
|
|
409
|
+
}, 8, ["type"])) : (v(), w(ne, { key: 0 }, [
|
|
410
|
+
t(e(R), null, {
|
|
411
|
+
default: l(() => [
|
|
412
|
+
m(p(e(r)("generate.running")), 1)
|
|
413
|
+
]),
|
|
414
|
+
_: 1
|
|
415
|
+
}),
|
|
416
|
+
t(e(Ee), {
|
|
417
|
+
value: c.value.done + c.value.failed,
|
|
418
|
+
max: Math.max(1, c.value.total - c.value.skipped)
|
|
419
|
+
}, null, 8, ["value", "max"])
|
|
420
|
+
], 64)),
|
|
421
|
+
c.value.errors.length > 0 ? (v(), w("ul", tl, [
|
|
422
|
+
(v(!0), w(ne, null, ke(c.value.errors, (s, ce) => (v(), w("li", { key: ce }, [
|
|
423
|
+
P("strong", null, "/" + p(s.slug) + "/", 1),
|
|
424
|
+
m(" — " + p(s.message), 1)
|
|
425
|
+
]))), 128))
|
|
426
|
+
])) : H("", !0)
|
|
427
|
+
])) : H("", !0)
|
|
428
|
+
]),
|
|
429
|
+
_: 1
|
|
430
|
+
}, 8, ["open", "title", "width"]));
|
|
431
|
+
}
|
|
432
|
+
}), ul = /* @__PURE__ */ Se(nl, [["__scopeId", "data-v-9deeece3"]]), ol = { class: "wx-catalog-landings" }, sl = { class: "wx-catalog-landings__name" }, il = { class: "wx-catalog-landings__title" }, rl = { class: "wx-catalog-landings__slug" }, dl = { class: "wx-catalog-landings__chips" }, cl = {
|
|
433
|
+
key: 2,
|
|
434
|
+
class: "wx-catalog-landings__count"
|
|
435
|
+
}, pl = { class: "wx-catalog-landings__state" }, vl = { class: "wx-catalog-landings__sr" }, pe = "root", ml = /* @__PURE__ */ he({
|
|
436
|
+
name: "WxCatalogLandingsPage",
|
|
437
|
+
__name: "LandingsPage",
|
|
438
|
+
props: {
|
|
439
|
+
base: { default: "/catalog" }
|
|
440
|
+
},
|
|
441
|
+
setup(me) {
|
|
442
|
+
const D = me, E = We(), A = $e(E), S = ze(E), T = Le(), K = Oe(), r = xe();
|
|
443
|
+
qe();
|
|
444
|
+
const u = ve(Ce), x = ve("webx-admin"), W = Ue(), Q = je(ul), U = h(() => `${D.base}/landings`), z = h(() => E.can("catalog.manage")), F = g(null), _ = g(!0), N = (n) => T.query[n] === "1", $ = g(String(T.query.q ?? "")), q = g(Number(T.query.page ?? 1) || 1), f = g(T.query.category ? String(T.query.category) : null), k = g(N("attention")), y = g(N("published")), c = g(N("empty")), B = g(N("trashed"));
|
|
445
|
+
let ue = 25;
|
|
446
|
+
const X = h(
|
|
447
|
+
() => E.state.manifest?.modules.find((n) => n.id === "catalog-landings")?.title ?? u("module.title")
|
|
448
|
+
), oe = h(() => [
|
|
449
|
+
{
|
|
450
|
+
id: pe,
|
|
451
|
+
name: u("landing.whole-catalog"),
|
|
452
|
+
parent_id: null,
|
|
453
|
+
children: []
|
|
454
|
+
},
|
|
455
|
+
...S.nodes.value ?? []
|
|
456
|
+
]), Y = h(() => {
|
|
457
|
+
if (f.value === null) return "";
|
|
458
|
+
if (f.value === pe) return u("landing.whole-catalog");
|
|
459
|
+
const n = (i) => i.reduce(
|
|
460
|
+
(a, C) => a || (String(C.id) === f.value ? C.name : n(C.children ?? [])),
|
|
461
|
+
""
|
|
462
|
+
);
|
|
463
|
+
return n(S.nodes.value ?? []) || `#${f.value}`;
|
|
464
|
+
}), L = h(() => {
|
|
465
|
+
const n = [];
|
|
466
|
+
f.value !== null && n.push({
|
|
467
|
+
key: "base",
|
|
468
|
+
label: `${u("panel.filter-base")}: ${Y.value}`,
|
|
469
|
+
clear: () => f.value = null
|
|
470
|
+
});
|
|
471
|
+
for (const [i, a, C] of [
|
|
472
|
+
["attention", k, "panel.filter-attention"],
|
|
473
|
+
["published", y, "panel.filter-published"],
|
|
474
|
+
["empty", c, "panel.filter-empty"],
|
|
475
|
+
["trashed", B, "panel.filter-trashed"]
|
|
476
|
+
])
|
|
477
|
+
a.value && n.push({ key: i, label: u(C), clear: () => a.value = !1 });
|
|
478
|
+
return n;
|
|
479
|
+
});
|
|
480
|
+
function re() {
|
|
481
|
+
f.value = null, k.value = !1, y.value = !1, c.value = !1, B.value = !1;
|
|
482
|
+
}
|
|
483
|
+
function Z(n) {
|
|
484
|
+
return {
|
|
485
|
+
q: n?.search ?? $.value,
|
|
486
|
+
category: f.value ?? void 0,
|
|
487
|
+
attention: k.value || void 0,
|
|
488
|
+
published: y.value || void 0,
|
|
489
|
+
empty: c.value || void 0,
|
|
490
|
+
trashed: B.value || void 0,
|
|
491
|
+
page: n?.page ?? q.value,
|
|
492
|
+
per_page: n?.perPage ?? ue
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
let O = 0;
|
|
496
|
+
async function M(n) {
|
|
497
|
+
const i = ++O;
|
|
498
|
+
_.value = !0;
|
|
499
|
+
try {
|
|
500
|
+
const a = await A.list(Z(n));
|
|
501
|
+
i === O && (F.value = a);
|
|
502
|
+
} catch (a) {
|
|
503
|
+
I.danger(W(a));
|
|
504
|
+
} finally {
|
|
505
|
+
i === O && (_.value = !1);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function j() {
|
|
509
|
+
const n = {}, i = Z();
|
|
510
|
+
i.q && (n.q = i.q), i.category && (n.category = i.category), i.page && i.page > 1 && (n.page = String(i.page));
|
|
511
|
+
for (const a of ["attention", "published", "empty", "trashed"])
|
|
512
|
+
i[a] && (n[a] = "1");
|
|
513
|
+
K.replace({ query: n });
|
|
514
|
+
}
|
|
515
|
+
function ee(n) {
|
|
516
|
+
ue = n.perPage, M(n);
|
|
517
|
+
}
|
|
518
|
+
ie([f, k, y, c, B], () => {
|
|
519
|
+
q.value = 1, j(), M();
|
|
520
|
+
}), ie([$, q], j);
|
|
521
|
+
const se = h(() => [
|
|
522
|
+
{ key: "name", label: u("panel.column-name"), minWidth: 220 },
|
|
523
|
+
{ key: "category", label: u("panel.column-base"), width: 180, hideBelow: 760 },
|
|
524
|
+
{ key: "chips", label: u("panel.column-set"), minWidth: 180, hideBelow: 640 },
|
|
525
|
+
{ key: "products_count", label: u("panel.column-count"), width: 110, align: "right" },
|
|
526
|
+
{ key: "state", label: u("panel.column-state"), width: 170, hideBelow: 900 },
|
|
527
|
+
{ key: "updated_at", label: u("panel.column-updated"), width: 130, hideBelow: 1180 },
|
|
528
|
+
{ key: "actions", label: "", width: Je, align: "right" }
|
|
529
|
+
]), le = (n) => be(n.name, r.active.value, "") || `#${n.id}`, de = (n) => be(n.slug, r.active.value, "");
|
|
530
|
+
function d(n) {
|
|
531
|
+
K.push(`${U.value}/${n.id}`);
|
|
532
|
+
}
|
|
533
|
+
async function o(n, i) {
|
|
534
|
+
try {
|
|
535
|
+
await A.publish(n.id, i), I.success(u(i ? "panel.published-toast" : "panel.unpublished-toast")), await M();
|
|
536
|
+
} catch (a) {
|
|
537
|
+
I.danger(W(a));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
async function s(n) {
|
|
541
|
+
if (await He({
|
|
542
|
+
title: u("panel.delete-title", { name: le(n) }),
|
|
543
|
+
message: u("panel.delete-text"),
|
|
544
|
+
confirmText: u("panel.delete"),
|
|
545
|
+
cancelText: u("panel.cancel"),
|
|
546
|
+
tone: "danger"
|
|
547
|
+
}))
|
|
548
|
+
try {
|
|
549
|
+
await A.remove(n.id), I.success(u("panel.deleted")), await M();
|
|
550
|
+
} catch (a) {
|
|
551
|
+
I.danger(W(a));
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
async function ce(n) {
|
|
555
|
+
try {
|
|
556
|
+
await A.restore(n.id), I.success(u("panel.restored")), await M();
|
|
557
|
+
} catch (i) {
|
|
558
|
+
I.danger(W(i));
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function Te(n) {
|
|
562
|
+
if (n.deleted_at !== null)
|
|
563
|
+
return z.value ? [
|
|
564
|
+
{
|
|
565
|
+
key: "restore",
|
|
566
|
+
icon: "refresh",
|
|
567
|
+
label: u("panel.restore"),
|
|
568
|
+
run: () => {
|
|
569
|
+
ce(n);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
] : [];
|
|
573
|
+
const i = [
|
|
574
|
+
{ key: "open", icon: "edit", label: u("panel.open"), run: () => d(n) }
|
|
575
|
+
];
|
|
576
|
+
return n.url && i.push({ key: "site", icon: "link", label: u("panel.open-site"), href: n.url }), z.value && i.push(
|
|
577
|
+
n.is_published ? {
|
|
578
|
+
key: "unpublish",
|
|
579
|
+
icon: "eye-off",
|
|
580
|
+
label: u("panel.unpublish"),
|
|
581
|
+
run: () => {
|
|
582
|
+
o(n, !1);
|
|
583
|
+
}
|
|
584
|
+
} : {
|
|
585
|
+
key: "publish",
|
|
586
|
+
icon: "eye",
|
|
587
|
+
label: u("panel.publish"),
|
|
588
|
+
run: () => {
|
|
589
|
+
o(n, !0);
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
key: "delete",
|
|
594
|
+
icon: "trash",
|
|
595
|
+
label: u("panel.delete"),
|
|
596
|
+
danger: !0,
|
|
597
|
+
run: () => {
|
|
598
|
+
s(n);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
), i;
|
|
602
|
+
}
|
|
603
|
+
async function Ne() {
|
|
604
|
+
await Q({ base: D.base }) && await M();
|
|
605
|
+
}
|
|
606
|
+
const Be = h(
|
|
607
|
+
() => z.value ? [
|
|
608
|
+
{
|
|
609
|
+
key: "new",
|
|
610
|
+
label: u("panel.new"),
|
|
611
|
+
icon: "plus",
|
|
612
|
+
primary: !0,
|
|
613
|
+
run: () => {
|
|
614
|
+
K.push({
|
|
615
|
+
path: `${U.value}/new`,
|
|
616
|
+
query: f.value && f.value !== pe ? { category: f.value } : {}
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
{ key: "generate", label: u("panel.generate"), icon: "grid", run: () => {
|
|
621
|
+
Ne();
|
|
622
|
+
} }
|
|
623
|
+
] : []
|
|
624
|
+
), Me = h(
|
|
625
|
+
() => L.value.length > 0 || $.value ? u("panel.nothing-found") : u("panel.empty")
|
|
626
|
+
);
|
|
627
|
+
return _e(() => {
|
|
628
|
+
S.load().catch(() => {
|
|
629
|
+
});
|
|
630
|
+
}), (n, i) => (v(), w("div", ol, [
|
|
631
|
+
t(e(Ke), {
|
|
632
|
+
title: X.value,
|
|
633
|
+
actions: Be.value
|
|
634
|
+
}, {
|
|
635
|
+
default: l(() => [
|
|
636
|
+
t(e(Ve), {
|
|
637
|
+
search: $.value,
|
|
638
|
+
"onUpdate:search": i[5] || (i[5] = (a) => $.value = a),
|
|
639
|
+
page: q.value,
|
|
640
|
+
"onUpdate:page": i[6] || (i[6] = (a) => q.value = a),
|
|
641
|
+
data: F.value,
|
|
642
|
+
columns: se.value,
|
|
643
|
+
"row-key": "id",
|
|
644
|
+
searchable: "",
|
|
645
|
+
clickable: "",
|
|
646
|
+
hover: "",
|
|
647
|
+
flush: "",
|
|
648
|
+
loading: _.value,
|
|
649
|
+
layout: "fixed",
|
|
650
|
+
"filters-count": L.value.length,
|
|
651
|
+
"filters-label": e(x)("filters.title"),
|
|
652
|
+
"search-placeholder": e(u)("panel.search"),
|
|
653
|
+
"empty-text": Me.value,
|
|
654
|
+
"aria-label": X.value,
|
|
655
|
+
onRowClick: d,
|
|
656
|
+
onStateChange: ee
|
|
657
|
+
}, {
|
|
658
|
+
filters: l(() => [
|
|
659
|
+
t(e(b), {
|
|
660
|
+
label: e(u)("panel.filter-base")
|
|
661
|
+
}, {
|
|
662
|
+
default: l(() => [
|
|
663
|
+
t(e(we), {
|
|
664
|
+
"model-value": f.value,
|
|
665
|
+
nodes: oe.value,
|
|
666
|
+
"node-key": "id",
|
|
667
|
+
"label-key": "name",
|
|
668
|
+
"children-key": "children",
|
|
669
|
+
"check-strictly": "",
|
|
670
|
+
filterable: "",
|
|
671
|
+
clearable: "",
|
|
672
|
+
size: "sm",
|
|
673
|
+
"onUpdate:modelValue": i[0] || (i[0] = (a) => f.value = a == null || Array.isArray(a) ? null : String(a))
|
|
674
|
+
}, null, 8, ["model-value", "nodes"])
|
|
675
|
+
]),
|
|
676
|
+
_: 1
|
|
677
|
+
}, 8, ["label"]),
|
|
678
|
+
t(e(b), null, {
|
|
679
|
+
default: l(() => [
|
|
680
|
+
t(e(J), {
|
|
681
|
+
modelValue: k.value,
|
|
682
|
+
"onUpdate:modelValue": i[1] || (i[1] = (a) => k.value = a),
|
|
683
|
+
size: "sm",
|
|
684
|
+
label: e(u)("panel.filter-attention")
|
|
685
|
+
}, null, 8, ["modelValue", "label"])
|
|
686
|
+
]),
|
|
687
|
+
_: 1
|
|
688
|
+
}),
|
|
689
|
+
t(e(b), null, {
|
|
690
|
+
default: l(() => [
|
|
691
|
+
t(e(J), {
|
|
692
|
+
modelValue: y.value,
|
|
693
|
+
"onUpdate:modelValue": i[2] || (i[2] = (a) => y.value = a),
|
|
694
|
+
size: "sm",
|
|
695
|
+
label: e(u)("panel.filter-published")
|
|
696
|
+
}, null, 8, ["modelValue", "label"])
|
|
697
|
+
]),
|
|
698
|
+
_: 1
|
|
699
|
+
}),
|
|
700
|
+
t(e(b), null, {
|
|
701
|
+
default: l(() => [
|
|
702
|
+
t(e(J), {
|
|
703
|
+
modelValue: c.value,
|
|
704
|
+
"onUpdate:modelValue": i[3] || (i[3] = (a) => c.value = a),
|
|
705
|
+
size: "sm",
|
|
706
|
+
label: e(u)("panel.filter-empty")
|
|
707
|
+
}, null, 8, ["modelValue", "label"])
|
|
708
|
+
]),
|
|
709
|
+
_: 1
|
|
710
|
+
}),
|
|
711
|
+
t(e(b), null, {
|
|
712
|
+
default: l(() => [
|
|
713
|
+
t(e(J), {
|
|
714
|
+
modelValue: B.value,
|
|
715
|
+
"onUpdate:modelValue": i[4] || (i[4] = (a) => B.value = a),
|
|
716
|
+
size: "sm",
|
|
717
|
+
label: e(u)("panel.filter-trashed")
|
|
718
|
+
}, null, 8, ["modelValue", "label"])
|
|
719
|
+
]),
|
|
720
|
+
_: 1
|
|
721
|
+
}),
|
|
722
|
+
L.value.length > 0 ? (v(), V(e(G), {
|
|
723
|
+
key: 0,
|
|
724
|
+
variant: "text",
|
|
725
|
+
size: "sm",
|
|
726
|
+
block: "",
|
|
727
|
+
onClick: re
|
|
728
|
+
}, {
|
|
729
|
+
icon: l(() => [
|
|
730
|
+
t(e(ye), { name: "close" })
|
|
731
|
+
]),
|
|
732
|
+
default: l(() => [
|
|
733
|
+
m(" " + p(e(x)("filters.reset")), 1)
|
|
734
|
+
]),
|
|
735
|
+
_: 1
|
|
736
|
+
})) : H("", !0)
|
|
737
|
+
]),
|
|
738
|
+
applied: l(() => [
|
|
739
|
+
t(e(Ye), { filters: L.value }, null, 8, ["filters"])
|
|
740
|
+
]),
|
|
741
|
+
"cell-name": l(({ row: a }) => [
|
|
742
|
+
P("div", sl, [
|
|
743
|
+
P("span", il, p(le(a)), 1),
|
|
744
|
+
P("span", rl, "/" + p(de(a)) + "/", 1)
|
|
745
|
+
])
|
|
746
|
+
]),
|
|
747
|
+
"cell-category": l(({ row: a }) => [
|
|
748
|
+
t(e(R), {
|
|
749
|
+
size: "sm",
|
|
750
|
+
truncate: "",
|
|
751
|
+
tone: a.category === null ? "muted" : void 0
|
|
752
|
+
}, {
|
|
753
|
+
default: l(() => [
|
|
754
|
+
m(p(a.category ?? e(u)("landing.whole-catalog")), 1)
|
|
755
|
+
]),
|
|
756
|
+
_: 2
|
|
757
|
+
}, 1032, ["tone"])
|
|
758
|
+
]),
|
|
759
|
+
"cell-chips": l(({ row: a }) => [
|
|
760
|
+
P("div", dl, [
|
|
761
|
+
(v(!0), w(ne, null, ke(a.chips, (C) => (v(), V(e(te), {
|
|
762
|
+
key: C.key,
|
|
763
|
+
size: "sm",
|
|
764
|
+
variant: "soft"
|
|
765
|
+
}, {
|
|
766
|
+
default: l(() => [
|
|
767
|
+
m(p(C.label) + ": " + p(C.text), 1)
|
|
768
|
+
]),
|
|
769
|
+
_: 2
|
|
770
|
+
}, 1024))), 128))
|
|
771
|
+
])
|
|
772
|
+
]),
|
|
773
|
+
"cell-products_count": l(({ row: a }) => [
|
|
774
|
+
a.products_count === null ? (v(), V(e(R), {
|
|
775
|
+
key: 0,
|
|
776
|
+
size: "sm",
|
|
777
|
+
tone: "muted"
|
|
778
|
+
}, {
|
|
779
|
+
default: l(() => [
|
|
780
|
+
m(p(e(u)("panel.not-counted")), 1)
|
|
781
|
+
]),
|
|
782
|
+
_: 1
|
|
783
|
+
})) : a.products_count === 0 ? (v(), V(e(te), {
|
|
784
|
+
key: 1,
|
|
785
|
+
type: "warning",
|
|
786
|
+
size: "sm",
|
|
787
|
+
round: ""
|
|
788
|
+
}, {
|
|
789
|
+
default: l(() => [...i[7] || (i[7] = [
|
|
790
|
+
m("0", -1)
|
|
791
|
+
])]),
|
|
792
|
+
_: 1
|
|
793
|
+
})) : (v(), w("span", cl, p(a.products_count), 1))
|
|
794
|
+
]),
|
|
795
|
+
"cell-state": l(({ row: a }) => [
|
|
796
|
+
P("div", pl, [
|
|
797
|
+
a.deleted_at ? (v(), V(e(te), {
|
|
798
|
+
key: 0,
|
|
799
|
+
dot: "",
|
|
800
|
+
size: "sm"
|
|
801
|
+
}, {
|
|
802
|
+
default: l(() => [
|
|
803
|
+
m(p(e(u)("panel.in-bin")), 1)
|
|
804
|
+
]),
|
|
805
|
+
_: 1
|
|
806
|
+
})) : (v(), V(e(te), {
|
|
807
|
+
key: 1,
|
|
808
|
+
type: a.is_published ? "success" : "default",
|
|
809
|
+
dot: "",
|
|
810
|
+
size: "sm"
|
|
811
|
+
}, {
|
|
812
|
+
default: l(() => [
|
|
813
|
+
m(p(e(u)(a.is_published ? "panel.published" : "panel.unpublished")), 1)
|
|
814
|
+
]),
|
|
815
|
+
_: 2
|
|
816
|
+
}, 1032, ["type"])),
|
|
817
|
+
a.attention ? (v(), V(e(Ge), {
|
|
818
|
+
key: 2,
|
|
819
|
+
content: e(u)(`landing.attention-${a.attention}`)
|
|
820
|
+
}, {
|
|
821
|
+
default: l(() => [
|
|
822
|
+
t(e(te), {
|
|
823
|
+
type: "warning",
|
|
824
|
+
size: "sm",
|
|
825
|
+
round: ""
|
|
826
|
+
}, {
|
|
827
|
+
default: l(() => [
|
|
828
|
+
t(e(ye), {
|
|
829
|
+
name: "warning",
|
|
830
|
+
size: "sm"
|
|
831
|
+
}),
|
|
832
|
+
P("span", vl, p(e(u)("landing.attention")), 1)
|
|
833
|
+
]),
|
|
834
|
+
_: 1
|
|
835
|
+
})
|
|
836
|
+
]),
|
|
837
|
+
_: 1
|
|
838
|
+
}, 8, ["content"])) : H("", !0)
|
|
839
|
+
])
|
|
840
|
+
]),
|
|
841
|
+
"cell-updated_at": l(({ row: a }) => [
|
|
842
|
+
t(e(Xe), {
|
|
843
|
+
value: a.updated_at,
|
|
844
|
+
compact: ""
|
|
845
|
+
}, null, 8, ["value"])
|
|
846
|
+
]),
|
|
847
|
+
"cell-actions": l(({ row: a }) => [
|
|
848
|
+
t(e(Qe), {
|
|
849
|
+
actions: Te(a),
|
|
850
|
+
label: le(a)
|
|
851
|
+
}, null, 8, ["actions", "label"])
|
|
852
|
+
]),
|
|
853
|
+
_: 1
|
|
854
|
+
}, 8, ["search", "page", "data", "columns", "loading", "filters-count", "filters-label", "search-placeholder", "empty-text", "aria-label"])
|
|
855
|
+
]),
|
|
856
|
+
_: 1
|
|
857
|
+
}, 8, ["title", "actions"])
|
|
858
|
+
]));
|
|
859
|
+
}
|
|
860
|
+
}), kl = /* @__PURE__ */ Se(ml, [["__scopeId", "data-v-eccbf1d9"]]);
|
|
861
|
+
export {
|
|
862
|
+
kl as default
|
|
863
|
+
};
|
|
864
|
+
//# sourceMappingURL=LandingsPage-BAIQAJv2.js.map
|