@webx-ui/module-catalog-landings 0.2.2 → 0.2.3
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 → LandingEditorPage-sarEsyTC.js} +2 -2
- package/dist/{LandingEditorPage-Dt1xmQXl.js.map → LandingEditorPage-sarEsyTC.js.map} +1 -1
- package/dist/{LandingsPage-BAIQAJv2.js → LandingsPage-D3IHE6TR.js} +325 -317
- package/dist/LandingsPage-D3IHE6TR.js.map +1 -0
- package/dist/index-CL_q1v5T.js +792 -0
- package/dist/index-CL_q1v5T.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/dist/LandingsPage-BAIQAJv2.js.map +0 -1
- package/dist/index-DEreqbgG.js +0 -768
- package/dist/index-DEreqbgG.js.map +0 -1
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import { provide as $e, inject as Le, defineComponent as G, useModel as J, computed as A, ref as z, watch as le, openBlock as u, createElementBlock as P, createBlock as _, unref as e, createCommentVNode as L, withCtx as p, createTextVNode as $, toDisplayString as w, createVNode as N, createElementVNode as se, onBeforeUnmount as Ve, Fragment as Te, renderList as Ae, mergeModels as Ne, onMounted as Ce, defineAsyncComponent as pe } from "vue";
|
|
2
|
+
import { WxAutocomplete as We, WxText as M, WxSortableList as Oe, WxPopconfirm as ve, WxButton as ie, WxIcon as fe, WxBadge as he, WxAlert as ne, WxInputNumber as ce, WxSelect as oe, WxLink as ze, useLocales as Fe, WxInput as Ee } from "@webx-ui/core";
|
|
3
|
+
import { useAdmin as Q, useTranslate as R, useRemoveConfirm as be, useErrorText as ye } from "@webx-ui/module-admin";
|
|
4
|
+
import { createCatalogApi as Pe, useFacetRegistry as Ue } from "@webx-ui/module-catalog";
|
|
5
|
+
import { RouterLink as Ie } from "vue-router";
|
|
6
|
+
const xe = /* @__PURE__ */ Symbol("wx-catalog-landing");
|
|
7
|
+
function gt(s) {
|
|
8
|
+
$e(xe, s);
|
|
9
|
+
}
|
|
10
|
+
function X() {
|
|
11
|
+
return Le(xe, null);
|
|
12
|
+
}
|
|
13
|
+
const Me = {
|
|
14
|
+
module: {
|
|
15
|
+
title: "Landings",
|
|
16
|
+
landing: "Landing"
|
|
17
|
+
},
|
|
18
|
+
landing: {
|
|
19
|
+
category_id: "Base",
|
|
20
|
+
filters: "Set",
|
|
21
|
+
name: "Name",
|
|
22
|
+
slug: "Address",
|
|
23
|
+
h1: "H1",
|
|
24
|
+
text_above: "Text above the list",
|
|
25
|
+
text_below: "Text under the list",
|
|
26
|
+
sort: "Default sort",
|
|
27
|
+
on_category: "In the category’s collections",
|
|
28
|
+
position: "Order",
|
|
29
|
+
is_published: "Published",
|
|
30
|
+
attention: "Needs attention",
|
|
31
|
+
"whole-catalog": "The whole catalogue",
|
|
32
|
+
"tab-main": "Main",
|
|
33
|
+
"tab-texts": "Texts",
|
|
34
|
+
"tab-recommended": "Recommended",
|
|
35
|
+
"tab-seo": "SEO",
|
|
36
|
+
"tab-history": "History",
|
|
37
|
+
display: "On the site",
|
|
38
|
+
"name-help": "The label in the panel and in the links of the collections.",
|
|
39
|
+
"category-help": "The list the landing narrows. Empty — the whole catalogue.",
|
|
40
|
+
"slug-help": "From the site’s root, like a category’s: /laptops-apple/.",
|
|
41
|
+
"sort-help": "The order a reader sees first; the one they choose wins.",
|
|
42
|
+
"sort-default": "As the category",
|
|
43
|
+
"on-category-help": "A link in «Collections» on the page of the base.",
|
|
44
|
+
"position-help": "Smaller first, in the collections and among the neighbours.",
|
|
45
|
+
"h1-help": "Empty — the name.",
|
|
46
|
+
"text-help": "Shown on the landing’s first page with nothing more chosen.",
|
|
47
|
+
recommended: "Recommended products",
|
|
48
|
+
"recommended-help": "A strip over the list, in this order; the list itself does not change.",
|
|
49
|
+
"recommended-search": "Find a product by name or SKU",
|
|
50
|
+
"recommended-empty": "No products picked.",
|
|
51
|
+
"recommended-remove": "Remove",
|
|
52
|
+
"set-add": "Add a facet",
|
|
53
|
+
"set-empty": "Add a facet and choose its values.",
|
|
54
|
+
"set-remove": "Remove the facet",
|
|
55
|
+
"set-values": "Choose values",
|
|
56
|
+
"set-from": "From",
|
|
57
|
+
"set-to": "To",
|
|
58
|
+
"set-count": "Products: :count",
|
|
59
|
+
"set-counting": "Counting…",
|
|
60
|
+
"set-taken": "This set on this base is already the landing «:name».",
|
|
61
|
+
"set-open-taken": "Open it",
|
|
62
|
+
"slug-suggested": "Suggested: :slug",
|
|
63
|
+
"slug-use": "Use",
|
|
64
|
+
"attention-value_removed": "A value of the set was deleted",
|
|
65
|
+
"attention-duplicate": "The set became another landing’s",
|
|
66
|
+
"attention-empty_set": "Nothing is left of the set"
|
|
67
|
+
},
|
|
68
|
+
panel: {
|
|
69
|
+
new: "New landing",
|
|
70
|
+
generate: "Create in bulk",
|
|
71
|
+
empty: "No landings yet.",
|
|
72
|
+
"empty-help": "A landing is a category’s list with filters chosen in advance, under an address, texts and SEO of its own.",
|
|
73
|
+
"nothing-found": "Nothing matches the filters.",
|
|
74
|
+
search: "Name or address",
|
|
75
|
+
"column-name": "Name",
|
|
76
|
+
"column-base": "Base",
|
|
77
|
+
"column-set": "Set",
|
|
78
|
+
"column-count": "Products",
|
|
79
|
+
"column-state": "State",
|
|
80
|
+
"column-updated": "Updated",
|
|
81
|
+
"filter-base": "Base",
|
|
82
|
+
"filter-attention": "Needs attention",
|
|
83
|
+
"filter-published": "Published only",
|
|
84
|
+
"filter-empty": "Empty only",
|
|
85
|
+
"filter-trashed": "In the bin",
|
|
86
|
+
published: "Published",
|
|
87
|
+
unpublished: "Not published",
|
|
88
|
+
"not-counted": "Not counted yet",
|
|
89
|
+
open: "Open",
|
|
90
|
+
"open-site": "Open on the site",
|
|
91
|
+
publish: "Publish",
|
|
92
|
+
unpublish: "Unpublish",
|
|
93
|
+
delete: "Delete",
|
|
94
|
+
restore: "Restore",
|
|
95
|
+
"delete-title": "Delete «:name»?",
|
|
96
|
+
"delete-text": "It goes to the bin, and its address stops answering. Its set stays taken until it is gone for good.",
|
|
97
|
+
deleted: "The landing is in the bin.",
|
|
98
|
+
restored: "The landing is back.",
|
|
99
|
+
"published-toast": "The landing is published.",
|
|
100
|
+
"unpublished-toast": "The landing is unpublished.",
|
|
101
|
+
saved: "The landing is saved.",
|
|
102
|
+
created: "The landing is created.",
|
|
103
|
+
save: "Save",
|
|
104
|
+
create: "Create",
|
|
105
|
+
"save-failed": "Not saved — see the fields.",
|
|
106
|
+
cancel: "Cancel",
|
|
107
|
+
"leave-title": "Leave without saving?",
|
|
108
|
+
"leave-text": "What you changed here will be lost.",
|
|
109
|
+
leave: "Leave",
|
|
110
|
+
untitled: "A new landing",
|
|
111
|
+
"in-bin": "In the bin",
|
|
112
|
+
trail: "Where you are"
|
|
113
|
+
},
|
|
114
|
+
generate: {
|
|
115
|
+
title: "Create landings in bulk",
|
|
116
|
+
bases: "Bases",
|
|
117
|
+
"bases-help": "One category or several; a landing per category and value.",
|
|
118
|
+
subtree: "With every category under them",
|
|
119
|
+
facet: "Facet",
|
|
120
|
+
values: "Values",
|
|
121
|
+
"values-help": "Empty — every value with products on the base.",
|
|
122
|
+
"min-products": "At least products",
|
|
123
|
+
"min-products-help": "For «every value»: values with fewer products on the base are left out.",
|
|
124
|
+
templates: "Templates",
|
|
125
|
+
"templates-help": "{category} and {value} are replaced: the slugs in the address, the names in the texts.",
|
|
126
|
+
slug: "Address",
|
|
127
|
+
name: "Name",
|
|
128
|
+
h1: "H1",
|
|
129
|
+
"seo-title": "SEO title",
|
|
130
|
+
"seo-description": "SEO description",
|
|
131
|
+
"template-empty": "Empty — not set",
|
|
132
|
+
publish: "Publish at once",
|
|
133
|
+
preview: "Preview",
|
|
134
|
+
back: "Back",
|
|
135
|
+
run: "Create :count",
|
|
136
|
+
close: "Close",
|
|
137
|
+
"column-address": "Address",
|
|
138
|
+
"column-h1": "H1",
|
|
139
|
+
"column-count": "Products",
|
|
140
|
+
"column-conflict": "Skipped because",
|
|
141
|
+
summary: "Will be created: :free; skipped: :skipped.",
|
|
142
|
+
nothing: "Nothing to create: every row is skipped.",
|
|
143
|
+
running: "Creating landings…",
|
|
144
|
+
done: "Created: :done; skipped: :skipped; refused: :failed.",
|
|
145
|
+
failed: "The generation stopped. What was created stays.",
|
|
146
|
+
"conflict-slug-taken": "The address :slug is taken.",
|
|
147
|
+
"conflict-set-taken": "The set is already the landing «:name».",
|
|
148
|
+
"conflict-empty": "No products.",
|
|
149
|
+
"conflict-no-slug": "A slug or a name to fill the template with is missing."
|
|
150
|
+
}
|
|
151
|
+
}, B = "webx-catalog-landings", ge = /* @__PURE__ */ new WeakSet();
|
|
152
|
+
function Y() {
|
|
153
|
+
try {
|
|
154
|
+
const { i18n: s } = Q();
|
|
155
|
+
ge.has(s) || (s.defaults(B, Me), ge.add(s));
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const Re = { class: "wx-catalog-landing-products" }, Be = { class: "wx-catalog-landing-products__item" }, je = { class: "wx-catalog-landing-products__name" }, De = /* @__PURE__ */ G({
|
|
160
|
+
name: "WxCatalogLandingProducts",
|
|
161
|
+
__name: "LandingProductsField",
|
|
162
|
+
props: {
|
|
163
|
+
modelValue: { default: null },
|
|
164
|
+
modelModifiers: {}
|
|
165
|
+
},
|
|
166
|
+
emits: ["update:modelValue"],
|
|
167
|
+
setup(s) {
|
|
168
|
+
const t = J(s, "modelValue"), l = Q(), a = Pe(l), o = X();
|
|
169
|
+
Y();
|
|
170
|
+
const i = R(B), V = be(), S = R("webx-admin"), C = ye(), f = A(() => o?.locked.value ?? !1), k = z(/* @__PURE__ */ new Map());
|
|
171
|
+
le(
|
|
172
|
+
() => o?.landing.value?.recommended_items,
|
|
173
|
+
(y) => {
|
|
174
|
+
for (const r of y ?? []) k.value.set(r.id, r);
|
|
175
|
+
},
|
|
176
|
+
{ immediate: !0 }
|
|
177
|
+
);
|
|
178
|
+
const h = A({
|
|
179
|
+
get: () => (t.value ?? []).map(
|
|
180
|
+
(y) => k.value.get(y) ?? { id: y, name: `#${y}`, sku: null, deleted: !1 }
|
|
181
|
+
),
|
|
182
|
+
set: (y) => {
|
|
183
|
+
t.value = y.map((r) => r.id);
|
|
184
|
+
}
|
|
185
|
+
}), b = z(""), m = z([]), T = z(!1), E = z("");
|
|
186
|
+
let F = 0;
|
|
187
|
+
async function Z(y) {
|
|
188
|
+
const r = ++F;
|
|
189
|
+
T.value = !0, E.value = "";
|
|
190
|
+
try {
|
|
191
|
+
const v = await a.products({ q: y, per_page: 10 });
|
|
192
|
+
if (r !== F) return;
|
|
193
|
+
const I = new Set(t.value ?? []);
|
|
194
|
+
m.value = v.data.filter((W) => !I.has(W.id)).map((W) => (k.value.set(W.id, { id: W.id, name: W.name, sku: W.sku }), {
|
|
195
|
+
value: String(W.id),
|
|
196
|
+
label: W.name,
|
|
197
|
+
description: W.sku ?? void 0
|
|
198
|
+
}));
|
|
199
|
+
} catch (v) {
|
|
200
|
+
r === F && (E.value = C(v));
|
|
201
|
+
} finally {
|
|
202
|
+
r === F && (T.value = !1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function ee(y) {
|
|
206
|
+
const r = Number(y.value);
|
|
207
|
+
!Number.isFinite(r) || (t.value ?? []).includes(r) || (t.value = [...t.value ?? [], r], b.value = "", m.value = []);
|
|
208
|
+
}
|
|
209
|
+
function U(y) {
|
|
210
|
+
t.value = (t.value ?? []).filter((r) => r !== y);
|
|
211
|
+
}
|
|
212
|
+
return (y, r) => (u(), P("div", Re, [
|
|
213
|
+
f.value ? L("", !0) : (u(), _(e(We), {
|
|
214
|
+
key: 0,
|
|
215
|
+
modelValue: b.value,
|
|
216
|
+
"onUpdate:modelValue": r[0] || (r[0] = (v) => b.value = v),
|
|
217
|
+
options: m.value,
|
|
218
|
+
remote: "",
|
|
219
|
+
loading: T.value,
|
|
220
|
+
"min-length": 1,
|
|
221
|
+
clearable: "",
|
|
222
|
+
placeholder: e(i)("landing.recommended-search"),
|
|
223
|
+
"aria-label": e(i)("landing.recommended-search"),
|
|
224
|
+
onSearch: Z,
|
|
225
|
+
onSelect: ee
|
|
226
|
+
}, null, 8, ["modelValue", "options", "loading", "placeholder", "aria-label"])),
|
|
227
|
+
E.value ? (u(), _(e(M), {
|
|
228
|
+
key: 1,
|
|
229
|
+
size: "sm",
|
|
230
|
+
tone: "danger"
|
|
231
|
+
}, {
|
|
232
|
+
default: p(() => [
|
|
233
|
+
$(w(E.value), 1)
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
})) : L("", !0),
|
|
237
|
+
N(e(Oe), {
|
|
238
|
+
modelValue: h.value,
|
|
239
|
+
"onUpdate:modelValue": r[1] || (r[1] = (v) => h.value = v),
|
|
240
|
+
"drag-label": e(S)("filters.reorder"),
|
|
241
|
+
"item-key": "id",
|
|
242
|
+
"item-label": "name",
|
|
243
|
+
size: "sm",
|
|
244
|
+
disabled: f.value,
|
|
245
|
+
"empty-text": e(i)("landing.recommended-empty"),
|
|
246
|
+
"aria-label": e(i)("landing.recommended")
|
|
247
|
+
}, {
|
|
248
|
+
default: p(({ item: v }) => [
|
|
249
|
+
se("span", Be, [
|
|
250
|
+
se("span", je, w(v.name), 1),
|
|
251
|
+
v.sku ? (u(), _(e(M), {
|
|
252
|
+
key: 0,
|
|
253
|
+
size: "sm",
|
|
254
|
+
tone: "muted"
|
|
255
|
+
}, {
|
|
256
|
+
default: p(() => [
|
|
257
|
+
$(w(v.sku), 1)
|
|
258
|
+
]),
|
|
259
|
+
_: 2
|
|
260
|
+
}, 1024)) : L("", !0),
|
|
261
|
+
v.deleted ? (u(), _(e(he), {
|
|
262
|
+
key: 1,
|
|
263
|
+
size: "sm",
|
|
264
|
+
type: "warning",
|
|
265
|
+
round: ""
|
|
266
|
+
}, {
|
|
267
|
+
default: p(() => [
|
|
268
|
+
$(w(e(i)("panel.in-bin")), 1)
|
|
269
|
+
]),
|
|
270
|
+
_: 1
|
|
271
|
+
})) : L("", !0)
|
|
272
|
+
])
|
|
273
|
+
]),
|
|
274
|
+
actions: p(({ item: v }) => [
|
|
275
|
+
f.value ? L("", !0) : (u(), _(e(ve), {
|
|
276
|
+
key: 0,
|
|
277
|
+
title: e(V).confirm,
|
|
278
|
+
"confirm-text": e(V).confirmText,
|
|
279
|
+
"cancel-text": e(V).cancelText,
|
|
280
|
+
"confirm-type": "danger",
|
|
281
|
+
onConfirm: (I) => U(v.id)
|
|
282
|
+
}, {
|
|
283
|
+
trigger: p(() => [
|
|
284
|
+
N(e(ie), {
|
|
285
|
+
variant: "text",
|
|
286
|
+
size: "sm",
|
|
287
|
+
"aria-label": `${e(i)("landing.recommended-remove")}: ${v.name}`
|
|
288
|
+
}, {
|
|
289
|
+
icon: p(() => [
|
|
290
|
+
N(e(fe), { name: "close" })
|
|
291
|
+
]),
|
|
292
|
+
_: 1
|
|
293
|
+
}, 8, ["aria-label"])
|
|
294
|
+
]),
|
|
295
|
+
_: 2
|
|
296
|
+
}, 1032, ["title", "confirm-text", "cancel-text", "onConfirm"]))
|
|
297
|
+
]),
|
|
298
|
+
_: 1
|
|
299
|
+
}, 8, ["modelValue", "drag-label", "disabled", "empty-text", "aria-label"])
|
|
300
|
+
]));
|
|
301
|
+
}
|
|
302
|
+
}), de = (s, t) => {
|
|
303
|
+
const l = s.__vccOpts || s;
|
|
304
|
+
for (const [a, o] of t)
|
|
305
|
+
l[a] = o;
|
|
306
|
+
return l;
|
|
307
|
+
}, He = /* @__PURE__ */ de(De, [["__scopeId", "data-v-2ff197ef"]]), Ke = "catalog/landings";
|
|
308
|
+
function qe(s) {
|
|
309
|
+
const t = new URLSearchParams();
|
|
310
|
+
for (const [l, a] of Object.entries(s))
|
|
311
|
+
a == null || a === "" || t.set(l, typeof a == "boolean" ? a ? "1" : "0" : String(a));
|
|
312
|
+
return t;
|
|
313
|
+
}
|
|
314
|
+
function Ge(s) {
|
|
315
|
+
const t = `${s.apiPath}/${Ke}`, l = (a) => a.data;
|
|
316
|
+
return {
|
|
317
|
+
list: (a = {}) => {
|
|
318
|
+
const o = qe(a);
|
|
319
|
+
return s.http.get(o.size > 0 ? `${t}?${o}` : t);
|
|
320
|
+
},
|
|
321
|
+
get: (a) => s.http.get(`${t}/${a}`).then(l),
|
|
322
|
+
create: (a) => s.http.post(t, a).then(l),
|
|
323
|
+
save: (a, o) => s.http.put(`${t}/${a}`, o).then(l),
|
|
324
|
+
remove: (a) => s.http.delete(`${t}/${a}`).then(() => {
|
|
325
|
+
}),
|
|
326
|
+
restore: (a) => s.http.post(`${t}/${a}/restore`, {}).then(l),
|
|
327
|
+
publish: (a, o) => s.http.post(`${t}/${a}/${o ? "publish" : "unpublish"}`, {}).then(l),
|
|
328
|
+
count: (a, o, i = null) => s.http.post(`${t}/count`, { category_id: a, filters: o, except: i }).then(l),
|
|
329
|
+
facets: (a) => s.http.get(a === null ? `${t}/facets` : `${t}/facets?category=${a}`).then(l),
|
|
330
|
+
preview: (a) => s.http.post(`${t}/generate`, { ...a, dry_run: !0 }).then(l),
|
|
331
|
+
generate: (a) => s.http.post(`${t}/generate`, a).then(l),
|
|
332
|
+
run: (a) => s.http.get(`${t}/generate/${a}`).then(l)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const Je = [
|
|
336
|
+
"category_id",
|
|
337
|
+
"filters",
|
|
338
|
+
"name",
|
|
339
|
+
"slug",
|
|
340
|
+
"h1",
|
|
341
|
+
"text_above",
|
|
342
|
+
"text_below",
|
|
343
|
+
"sort",
|
|
344
|
+
"on_category",
|
|
345
|
+
"position",
|
|
346
|
+
"recommended",
|
|
347
|
+
"seo"
|
|
348
|
+
];
|
|
349
|
+
function mt(s) {
|
|
350
|
+
const t = {};
|
|
351
|
+
for (const l of Je) t[l] = s[l] ?? null;
|
|
352
|
+
return Array.isArray(t.filters) && (t.filters = {}), t;
|
|
353
|
+
}
|
|
354
|
+
function me(s) {
|
|
355
|
+
const t = {};
|
|
356
|
+
for (const [l, a] of Object.entries(s ?? {}))
|
|
357
|
+
"values" in a ? a.values.length > 0 && (t[l] = { values: [...a.values] }) : (a.min !== null || a.max !== null) && (t[l] = { min: a.min, max: a.max });
|
|
358
|
+
return t;
|
|
359
|
+
}
|
|
360
|
+
const Qe = { class: "wx-catalog-landing-set" }, Xe = ["data-facet"], Ye = {
|
|
361
|
+
key: 0,
|
|
362
|
+
class: "wx-catalog-landing-set__range"
|
|
363
|
+
}, Ze = { class: "wx-catalog-landing-set__foot" }, et = /* @__PURE__ */ G({
|
|
364
|
+
name: "WxCatalogLandingSet",
|
|
365
|
+
__name: "LandingSetField",
|
|
366
|
+
props: {
|
|
367
|
+
modelValue: { default: null },
|
|
368
|
+
modelModifiers: {}
|
|
369
|
+
},
|
|
370
|
+
emits: ["update:modelValue"],
|
|
371
|
+
setup(s) {
|
|
372
|
+
const t = J(s, "modelValue"), l = Q(), a = Ge(l), o = X();
|
|
373
|
+
Y();
|
|
374
|
+
const i = R(B), V = be(), S = R("webx-admin"), C = ye(), f = A(() => o?.locked.value ?? !1), k = A(() => {
|
|
375
|
+
const n = o?.values.value.category_id;
|
|
376
|
+
return typeof n == "number" ? n : n ? Number(n) : null;
|
|
377
|
+
}), h = z([]), b = z(""), m = A(
|
|
378
|
+
() => t.value && !Array.isArray(t.value) ? t.value : {}
|
|
379
|
+
), T = (n) => h.value.find((d) => d.key === n), E = A(
|
|
380
|
+
() => h.value.filter((n) => !(n.key in m.value)).map((n) => ({ value: n.key, label: n.label }))
|
|
381
|
+
);
|
|
382
|
+
let F = 0;
|
|
383
|
+
async function Z() {
|
|
384
|
+
const n = ++F;
|
|
385
|
+
b.value = "";
|
|
386
|
+
try {
|
|
387
|
+
const d = await a.facets(k.value);
|
|
388
|
+
n === F && (h.value = d);
|
|
389
|
+
} catch (d) {
|
|
390
|
+
n === F && (b.value = C(d));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
le(k, () => {
|
|
394
|
+
Z();
|
|
395
|
+
}, { immediate: !0 });
|
|
396
|
+
function ee(n, d) {
|
|
397
|
+
const c = T(n);
|
|
398
|
+
return c ? c.kind === "range" : !("values" in d);
|
|
399
|
+
}
|
|
400
|
+
function U(n) {
|
|
401
|
+
t.value = n;
|
|
402
|
+
}
|
|
403
|
+
function y(n) {
|
|
404
|
+
const d = T(String(n));
|
|
405
|
+
d && U({
|
|
406
|
+
...m.value,
|
|
407
|
+
[d.key]: d.kind === "range" ? { min: null, max: null } : { values: [] }
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function r(n) {
|
|
411
|
+
const d = { ...m.value };
|
|
412
|
+
delete d[n], U(d);
|
|
413
|
+
}
|
|
414
|
+
function v(n) {
|
|
415
|
+
return "values" in n ? n.values : [];
|
|
416
|
+
}
|
|
417
|
+
function I(n) {
|
|
418
|
+
return "values" in n ? { min: null, max: null } : n;
|
|
419
|
+
}
|
|
420
|
+
function W(n, d) {
|
|
421
|
+
const c = T(n)?.values ?? [], g = c.map((x) => ({
|
|
422
|
+
value: x.value,
|
|
423
|
+
label: `${x.label} (${x.count})`
|
|
424
|
+
}));
|
|
425
|
+
for (const x of v(d))
|
|
426
|
+
if (!c.some((ae) => ae.value === x)) {
|
|
427
|
+
const ae = _e(n, x);
|
|
428
|
+
g.push({ value: x, label: `${ae} (0)` });
|
|
429
|
+
}
|
|
430
|
+
return g;
|
|
431
|
+
}
|
|
432
|
+
function _e(n, d) {
|
|
433
|
+
return o?.landing.value?.chips.find((c) => c.key === n)?.text ?? `#${d}`;
|
|
434
|
+
}
|
|
435
|
+
function ke(n, d) {
|
|
436
|
+
U({ ...m.value, [n]: { values: Array.isArray(d) ? d.map(String) : [] } });
|
|
437
|
+
}
|
|
438
|
+
function ue(n, d, c) {
|
|
439
|
+
const g = m.value[n], x = g ? I(g) : { min: null, max: null };
|
|
440
|
+
U({ ...m.value, [n]: { ...x, [d]: c ?? null } });
|
|
441
|
+
}
|
|
442
|
+
function j(n) {
|
|
443
|
+
return T(n)?.label ?? n;
|
|
444
|
+
}
|
|
445
|
+
const O = z(null), D = z(!1), H = z("");
|
|
446
|
+
let te, K = 0;
|
|
447
|
+
const we = A(() => JSON.stringify([k.value, me(m.value)]));
|
|
448
|
+
async function Se() {
|
|
449
|
+
const n = ++K, d = me(m.value);
|
|
450
|
+
if (Object.keys(d).length === 0) {
|
|
451
|
+
O.value = null, D.value = !1, o && (o.suggested.value = {});
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
D.value = !0, H.value = "";
|
|
455
|
+
try {
|
|
456
|
+
const c = await a.count(k.value, d, o?.landing.value?.id ?? null);
|
|
457
|
+
if (n !== K) return;
|
|
458
|
+
O.value = c, o && (o.suggested.value = Array.isArray(c.suggested) ? {} : c.suggested);
|
|
459
|
+
} catch (c) {
|
|
460
|
+
n === K && (O.value = null, H.value = C(c));
|
|
461
|
+
} finally {
|
|
462
|
+
n === K && (D.value = !1);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
le(
|
|
466
|
+
we,
|
|
467
|
+
() => {
|
|
468
|
+
clearTimeout(te), te = setTimeout(() => {
|
|
469
|
+
Se();
|
|
470
|
+
}, 350);
|
|
471
|
+
},
|
|
472
|
+
{ immediate: !0 }
|
|
473
|
+
), Ve(() => clearTimeout(te));
|
|
474
|
+
const re = A(
|
|
475
|
+
() => O.value?.taken && o ? `${o.list}/${O.value.taken.id}` : null
|
|
476
|
+
);
|
|
477
|
+
return (n, d) => (u(), P("div", Qe, [
|
|
478
|
+
b.value ? (u(), _(e(ne), {
|
|
479
|
+
key: 0,
|
|
480
|
+
type: "danger"
|
|
481
|
+
}, {
|
|
482
|
+
default: p(() => [
|
|
483
|
+
$(w(b.value), 1)
|
|
484
|
+
]),
|
|
485
|
+
_: 1
|
|
486
|
+
})) : L("", !0),
|
|
487
|
+
Object.keys(m.value).length === 0 ? (u(), _(e(M), {
|
|
488
|
+
key: 1,
|
|
489
|
+
tone: "muted",
|
|
490
|
+
size: "sm"
|
|
491
|
+
}, {
|
|
492
|
+
default: p(() => [
|
|
493
|
+
$(w(e(i)("landing.set-empty")), 1)
|
|
494
|
+
]),
|
|
495
|
+
_: 1
|
|
496
|
+
})) : L("", !0),
|
|
497
|
+
(u(!0), P(Te, null, Ae(m.value, (c, g) => (u(), P("div", {
|
|
498
|
+
key: g,
|
|
499
|
+
class: "wx-catalog-landing-set__row",
|
|
500
|
+
"data-facet": g
|
|
501
|
+
}, [
|
|
502
|
+
N(e(M), {
|
|
503
|
+
class: "wx-catalog-landing-set__label",
|
|
504
|
+
size: "sm",
|
|
505
|
+
weight: "medium"
|
|
506
|
+
}, {
|
|
507
|
+
default: p(() => [
|
|
508
|
+
$(w(j(String(g))), 1)
|
|
509
|
+
]),
|
|
510
|
+
_: 2
|
|
511
|
+
}, 1024),
|
|
512
|
+
ee(String(g), c) ? (u(), P("div", Ye, [
|
|
513
|
+
N(e(ce), {
|
|
514
|
+
"model-value": I(c).min,
|
|
515
|
+
controls: !1,
|
|
516
|
+
disabled: f.value,
|
|
517
|
+
size: "sm",
|
|
518
|
+
placeholder: T(String(g))?.min?.toString() ?? e(i)("landing.set-from"),
|
|
519
|
+
"aria-label": `${j(String(g))}: ${e(i)("landing.set-from")}`,
|
|
520
|
+
"onUpdate:modelValue": (x) => ue(String(g), "min", x)
|
|
521
|
+
}, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"]),
|
|
522
|
+
N(e(ce), {
|
|
523
|
+
"model-value": I(c).max,
|
|
524
|
+
controls: !1,
|
|
525
|
+
disabled: f.value,
|
|
526
|
+
size: "sm",
|
|
527
|
+
placeholder: T(String(g))?.max?.toString() ?? e(i)("landing.set-to"),
|
|
528
|
+
"aria-label": `${j(String(g))}: ${e(i)("landing.set-to")}`,
|
|
529
|
+
"onUpdate:modelValue": (x) => ue(String(g), "max", x)
|
|
530
|
+
}, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])
|
|
531
|
+
])) : (u(), _(e(oe), {
|
|
532
|
+
key: 1,
|
|
533
|
+
"empty-text": e(S)("filters.nothing-found"),
|
|
534
|
+
class: "wx-catalog-landing-set__values",
|
|
535
|
+
"model-value": v(c),
|
|
536
|
+
options: W(String(g), c),
|
|
537
|
+
multiple: "",
|
|
538
|
+
filterable: "",
|
|
539
|
+
clearable: "",
|
|
540
|
+
size: "sm",
|
|
541
|
+
disabled: f.value,
|
|
542
|
+
placeholder: e(i)("landing.set-values"),
|
|
543
|
+
"aria-label": j(String(g)),
|
|
544
|
+
"onUpdate:modelValue": (x) => ke(String(g), x)
|
|
545
|
+
}, null, 8, ["empty-text", "model-value", "options", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])),
|
|
546
|
+
N(e(ve), {
|
|
547
|
+
title: e(V).confirm,
|
|
548
|
+
"confirm-text": e(V).confirmText,
|
|
549
|
+
"cancel-text": e(V).cancelText,
|
|
550
|
+
"confirm-type": "danger",
|
|
551
|
+
disabled: f.value,
|
|
552
|
+
onConfirm: (x) => r(String(g))
|
|
553
|
+
}, {
|
|
554
|
+
trigger: p(() => [
|
|
555
|
+
N(e(ie), {
|
|
556
|
+
variant: "text",
|
|
557
|
+
size: "sm",
|
|
558
|
+
disabled: f.value,
|
|
559
|
+
"aria-label": e(i)("landing.set-remove"),
|
|
560
|
+
title: e(i)("landing.set-remove")
|
|
561
|
+
}, {
|
|
562
|
+
icon: p(() => [
|
|
563
|
+
N(e(fe), { name: "close" })
|
|
564
|
+
]),
|
|
565
|
+
_: 1
|
|
566
|
+
}, 8, ["disabled", "aria-label", "title"])
|
|
567
|
+
]),
|
|
568
|
+
_: 1
|
|
569
|
+
}, 8, ["title", "confirm-text", "cancel-text", "disabled", "onConfirm"])
|
|
570
|
+
], 8, Xe))), 128)),
|
|
571
|
+
se("div", Ze, [
|
|
572
|
+
E.value.length > 0 ? (u(), _(e(oe), {
|
|
573
|
+
key: 0,
|
|
574
|
+
"empty-text": e(S)("filters.nothing-found"),
|
|
575
|
+
class: "wx-catalog-landing-set__add",
|
|
576
|
+
"model-value": null,
|
|
577
|
+
options: E.value,
|
|
578
|
+
filterable: "",
|
|
579
|
+
size: "sm",
|
|
580
|
+
disabled: f.value,
|
|
581
|
+
placeholder: e(i)("landing.set-add"),
|
|
582
|
+
"aria-label": e(i)("landing.set-add"),
|
|
583
|
+
"onUpdate:modelValue": y
|
|
584
|
+
}, null, 8, ["empty-text", "options", "disabled", "placeholder", "aria-label"])) : L("", !0),
|
|
585
|
+
D.value ? (u(), _(e(M), {
|
|
586
|
+
key: 1,
|
|
587
|
+
size: "sm",
|
|
588
|
+
tone: "muted"
|
|
589
|
+
}, {
|
|
590
|
+
default: p(() => [
|
|
591
|
+
$(w(e(i)("landing.set-counting")), 1)
|
|
592
|
+
]),
|
|
593
|
+
_: 1
|
|
594
|
+
})) : O.value ? (u(), _(e(he), {
|
|
595
|
+
key: 2,
|
|
596
|
+
class: "wx-catalog-landing-set__count",
|
|
597
|
+
type: O.value.count > 0 ? "success" : "warning",
|
|
598
|
+
size: "sm",
|
|
599
|
+
round: ""
|
|
600
|
+
}, {
|
|
601
|
+
default: p(() => [
|
|
602
|
+
$(w(e(i)("landing.set-count", { count: O.value.count })), 1)
|
|
603
|
+
]),
|
|
604
|
+
_: 1
|
|
605
|
+
}, 8, ["type"])) : L("", !0)
|
|
606
|
+
]),
|
|
607
|
+
H.value ? (u(), _(e(ne), {
|
|
608
|
+
key: 2,
|
|
609
|
+
type: "danger"
|
|
610
|
+
}, {
|
|
611
|
+
default: p(() => [
|
|
612
|
+
$(w(H.value), 1)
|
|
613
|
+
]),
|
|
614
|
+
_: 1
|
|
615
|
+
})) : L("", !0),
|
|
616
|
+
O.value?.taken ? (u(), _(e(ne), {
|
|
617
|
+
key: 3,
|
|
618
|
+
type: "warning"
|
|
619
|
+
}, {
|
|
620
|
+
default: p(() => [
|
|
621
|
+
$(w(e(i)("landing.set-taken", { name: O.value.taken.name })) + " ", 1),
|
|
622
|
+
re.value ? (u(), _(e(ze), {
|
|
623
|
+
key: 0,
|
|
624
|
+
as: e(Ie),
|
|
625
|
+
to: re.value
|
|
626
|
+
}, {
|
|
627
|
+
default: p(() => [
|
|
628
|
+
$(w(e(i)("landing.set-open-taken")), 1)
|
|
629
|
+
]),
|
|
630
|
+
_: 1
|
|
631
|
+
}, 8, ["as", "to"])) : L("", !0)
|
|
632
|
+
]),
|
|
633
|
+
_: 1
|
|
634
|
+
})) : L("", !0)
|
|
635
|
+
]));
|
|
636
|
+
}
|
|
637
|
+
}), tt = /* @__PURE__ */ de(et, [["__scopeId", "data-v-375f27f3"]]), at = { class: "wx-catalog-landing-slug" }, nt = {
|
|
638
|
+
key: 0,
|
|
639
|
+
class: "wx-catalog-landing-slug__hint"
|
|
640
|
+
}, lt = /* @__PURE__ */ G({
|
|
641
|
+
name: "WxCatalogLandingSlug",
|
|
642
|
+
__name: "LandingSlugField",
|
|
643
|
+
props: /* @__PURE__ */ Ne({
|
|
644
|
+
localized: { type: Boolean, default: !1 }
|
|
645
|
+
}, {
|
|
646
|
+
modelValue: { default: null },
|
|
647
|
+
modelModifiers: {}
|
|
648
|
+
}),
|
|
649
|
+
emits: ["update:modelValue"],
|
|
650
|
+
setup(s) {
|
|
651
|
+
const t = s, l = J(s, "modelValue"), a = X(), o = Fe();
|
|
652
|
+
Y();
|
|
653
|
+
const i = R(B), V = A(() => a?.locked.value ?? !1), S = A(
|
|
654
|
+
() => l.value && typeof l.value == "object" ? l.value : {}
|
|
655
|
+
), C = A(() => {
|
|
656
|
+
const k = a?.suggested.value ?? {}, h = o.active.value || Object.keys(k)[0] || "", b = k[h];
|
|
657
|
+
return b ? (t.localized ? S.value[h] : l.value) === b ? null : b : null;
|
|
658
|
+
});
|
|
659
|
+
function f() {
|
|
660
|
+
const k = a?.suggested.value ?? {};
|
|
661
|
+
if (!t.localized) {
|
|
662
|
+
l.value = C.value;
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const h = { ...S.value }, b = o.active.value;
|
|
666
|
+
for (const [m, T] of Object.entries(k))
|
|
667
|
+
(m === b || !h[m]) && (h[m] = T);
|
|
668
|
+
l.value = h;
|
|
669
|
+
}
|
|
670
|
+
return (k, h) => (u(), P("div", at, [
|
|
671
|
+
N(e(Ee), {
|
|
672
|
+
"model-value": l.value ?? void 0,
|
|
673
|
+
localized: t.localized,
|
|
674
|
+
disabled: V.value,
|
|
675
|
+
maxlength: 255,
|
|
676
|
+
"onUpdate:modelValue": h[0] || (h[0] = (b) => l.value = b)
|
|
677
|
+
}, null, 8, ["model-value", "localized", "disabled"]),
|
|
678
|
+
C.value && !V.value ? (u(), P("div", nt, [
|
|
679
|
+
N(e(M), {
|
|
680
|
+
size: "sm",
|
|
681
|
+
tone: "muted"
|
|
682
|
+
}, {
|
|
683
|
+
default: p(() => [
|
|
684
|
+
$(w(e(i)("landing.slug-suggested", { slug: C.value })), 1)
|
|
685
|
+
]),
|
|
686
|
+
_: 1
|
|
687
|
+
}),
|
|
688
|
+
N(e(ie), {
|
|
689
|
+
size: "sm",
|
|
690
|
+
variant: "text",
|
|
691
|
+
onClick: f
|
|
692
|
+
}, {
|
|
693
|
+
default: p(() => [
|
|
694
|
+
$(w(e(i)("landing.slug-use")), 1)
|
|
695
|
+
]),
|
|
696
|
+
_: 1
|
|
697
|
+
})
|
|
698
|
+
])) : L("", !0)
|
|
699
|
+
]));
|
|
700
|
+
}
|
|
701
|
+
}), st = /* @__PURE__ */ de(lt, [["__scopeId", "data-v-b1f93497"]]), q = "default", ot = /* @__PURE__ */ G({
|
|
702
|
+
name: "WxCatalogLandingSort",
|
|
703
|
+
__name: "LandingSortField",
|
|
704
|
+
props: {
|
|
705
|
+
modelValue: { default: null },
|
|
706
|
+
modelModifiers: {}
|
|
707
|
+
},
|
|
708
|
+
emits: ["update:modelValue"],
|
|
709
|
+
setup(s) {
|
|
710
|
+
const t = J(s, "modelValue"), l = Q(), a = Ue(l), o = X();
|
|
711
|
+
Y();
|
|
712
|
+
const i = R(B), V = A(() => [
|
|
713
|
+
// The registry's own 'default' stands for «none of the landing's own»: the category's order.
|
|
714
|
+
{ value: q, label: i("landing.sort-default") },
|
|
715
|
+
...a.sorts.value.filter((S) => S.key !== q).map((S) => ({ value: S.key, label: S.label }))
|
|
716
|
+
]);
|
|
717
|
+
return Ce(() => {
|
|
718
|
+
a.load().catch(() => {
|
|
719
|
+
});
|
|
720
|
+
}), (S, C) => (u(), _(e(oe), {
|
|
721
|
+
"model-value": t.value ?? q,
|
|
722
|
+
options: V.value,
|
|
723
|
+
disabled: e(o)?.locked.value ?? !1,
|
|
724
|
+
"onUpdate:modelValue": C[0] || (C[0] = (f) => t.value = f && f !== q ? String(f) : null)
|
|
725
|
+
}, null, 8, ["model-value", "options", "disabled"]));
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
function pt(s = {}) {
|
|
729
|
+
const t = s.path ?? "/catalog", l = { base: t };
|
|
730
|
+
return [
|
|
731
|
+
{
|
|
732
|
+
id: "catalog-landings",
|
|
733
|
+
path: `${t}/landings`,
|
|
734
|
+
routes: [
|
|
735
|
+
{
|
|
736
|
+
path: `${t}/landings`,
|
|
737
|
+
name: "webx.catalog-landings",
|
|
738
|
+
component: () => import("./LandingsPage-D3IHE6TR.js"),
|
|
739
|
+
props: l
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
path: `${t}/landings/new`,
|
|
743
|
+
name: "webx.catalog-landings.new",
|
|
744
|
+
component: () => import("./LandingEditorPage-sarEsyTC.js"),
|
|
745
|
+
props: l
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
path: `${t}/landings/:id(\\d+)`,
|
|
749
|
+
name: "webx.catalog-landings.edit",
|
|
750
|
+
component: () => import("./LandingEditorPage-sarEsyTC.js"),
|
|
751
|
+
props: l
|
|
752
|
+
}
|
|
753
|
+
],
|
|
754
|
+
types: {
|
|
755
|
+
// Wide: a facet's row is a label, a list of values and a button, and half a form is too
|
|
756
|
+
// narrow for a combobox of brands beside its label.
|
|
757
|
+
"wx-catalog-landing-set": { component: tt, kind: "field", wide: !0 },
|
|
758
|
+
"wx-catalog-landing-slug": { component: st, kind: "field" },
|
|
759
|
+
"wx-catalog-landing-sort": { component: ot, kind: "field" },
|
|
760
|
+
"wx-catalog-landing-products": {
|
|
761
|
+
component: He,
|
|
762
|
+
kind: "field",
|
|
763
|
+
wide: !0
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
];
|
|
768
|
+
}
|
|
769
|
+
const vt = pe(() => import("./LandingsPage-D3IHE6TR.js")), ft = pe(() => import("./LandingEditorPage-sarEsyTC.js"));
|
|
770
|
+
export {
|
|
771
|
+
Je as F,
|
|
772
|
+
Ke as L,
|
|
773
|
+
B as N,
|
|
774
|
+
ft as W,
|
|
775
|
+
de as _,
|
|
776
|
+
me as a,
|
|
777
|
+
He as b,
|
|
778
|
+
Ge as c,
|
|
779
|
+
tt as d,
|
|
780
|
+
st as e,
|
|
781
|
+
mt as f,
|
|
782
|
+
ot as g,
|
|
783
|
+
vt as h,
|
|
784
|
+
pt as i,
|
|
785
|
+
Me as j,
|
|
786
|
+
qe as k,
|
|
787
|
+
xe as l,
|
|
788
|
+
X as m,
|
|
789
|
+
gt as p,
|
|
790
|
+
Y as u
|
|
791
|
+
};
|
|
792
|
+
//# sourceMappingURL=index-CL_q1v5T.js.map
|