@webx-ui/module-banners 0.2.3 → 0.3.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/BannerEditorPage-j7WlEaek.js +243 -0
- package/dist/BannerEditorPage-j7WlEaek.js.map +1 -0
- package/dist/BannersPage-Dl_BCozz.js +591 -0
- package/dist/BannersPage-Dl_BCozz.js.map +1 -0
- package/dist/index-3RALKrkh.js +1681 -0
- package/dist/index-3RALKrkh.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +28 -2484
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import { defineComponent as H, ref as T, useTemplateRef as pe, onMounted as ve, nextTick as be, openBlock as r, createBlock as _, unref as e, isRef as ye, withCtx as i, createVNode as d, createElementVNode as z, withKeys as Y, createTextVNode as R, toDisplayString as C, computed as V, watch as A, createElementBlock as U, createSlots as fe, createCommentVNode as L, Fragment as te, normalizeClass as K, resolveDynamicComponent as me, renderList as _e } from "vue";
|
|
2
|
+
import { useRoute as se, useRouter as re } from "vue-router";
|
|
3
|
+
import { useModal as ke, useLocales as we, WxDialog as ge, WxFormItem as Z, WxInput as ee, WxSpace as xe, WxButton as ae, WxTooltip as he, WxIcon as O, WxSegmented as We, WxSkeleton as oe, WxEmpty as j, WxSortableList as Be, WxBadge as le, WxAlert as Ve, toast as x, confirm as ie, createModal as qe, WxCard as Pe, WxListDetail as $e, WxText as ne, WxIndicator as ze } from "@webx-ui/core";
|
|
4
|
+
import { useAdmin as G, useTranslate as J, useErrorText as ce, WxScreenHead as Ce, WxRowMenu as ue, WxListScreen as Te } from "@webx-ui/module-admin";
|
|
5
|
+
import { c as Q, u as X, _ as de } from "./index-3RALKrkh.js";
|
|
6
|
+
const Se = /* @__PURE__ */ H({
|
|
7
|
+
name: "WxBannerPlaceDialog",
|
|
8
|
+
__name: "PlaceDialog",
|
|
9
|
+
props: {
|
|
10
|
+
place: { default: null }
|
|
11
|
+
},
|
|
12
|
+
setup(M) {
|
|
13
|
+
const h = M, { open: b, resolve: D, dismiss: S } = ke(), k = Q(G()), t = we();
|
|
14
|
+
X();
|
|
15
|
+
const p = J("webx-banners"), a = h.place !== null;
|
|
16
|
+
function q() {
|
|
17
|
+
if (h.place === null) return {};
|
|
18
|
+
if (h.place.titles) return { ...h.place.titles };
|
|
19
|
+
const c = t.list.value[0]?.code;
|
|
20
|
+
return c === void 0 ? {} : { [c]: h.place.title };
|
|
21
|
+
}
|
|
22
|
+
const u = T(h.place?.key ?? ""), m = T(q()), W = T(!1), P = T({}), v = pe("field");
|
|
23
|
+
ve(async () => {
|
|
24
|
+
await be(), v.value?.querySelector("input")?.focus();
|
|
25
|
+
});
|
|
26
|
+
function I() {
|
|
27
|
+
return Object.values(m.value).some((c) => c.trim() !== "");
|
|
28
|
+
}
|
|
29
|
+
function w(c) {
|
|
30
|
+
const y = Object.keys(P.value).find((g) => g === c || g.startsWith(`${c}.`));
|
|
31
|
+
return y === void 0 ? void 0 : P.value[y]?.[0];
|
|
32
|
+
}
|
|
33
|
+
async function B() {
|
|
34
|
+
if (!(!I() || W.value)) {
|
|
35
|
+
W.value = !0, P.value = {};
|
|
36
|
+
try {
|
|
37
|
+
D(
|
|
38
|
+
a && h.place !== null ? await k.renamePlace(h.place.key, m.value) : await k.createPlace({ key: u.value.trim(), title: m.value })
|
|
39
|
+
);
|
|
40
|
+
} catch (c) {
|
|
41
|
+
P.value = c.body?.errors ?? {};
|
|
42
|
+
} finally {
|
|
43
|
+
W.value = !1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return (c, y) => (r(), _(e(ge), {
|
|
48
|
+
open: e(b),
|
|
49
|
+
"onUpdate:open": y[3] || (y[3] = (g) => ye(b) ? b.value = g : null),
|
|
50
|
+
title: a ? e(p)("places.rename-title") : e(p)("places.new-title"),
|
|
51
|
+
width: 440
|
|
52
|
+
}, {
|
|
53
|
+
footer: i(() => [
|
|
54
|
+
d(e(xe), { size: "sm" }, {
|
|
55
|
+
default: i(() => [
|
|
56
|
+
d(e(ae), {
|
|
57
|
+
variant: "outline",
|
|
58
|
+
onClick: y[2] || (y[2] = (g) => e(S)())
|
|
59
|
+
}, {
|
|
60
|
+
default: i(() => [
|
|
61
|
+
R(C(e(p)("places.cancel")), 1)
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}),
|
|
65
|
+
d(e(ae), {
|
|
66
|
+
type: "primary",
|
|
67
|
+
loading: W.value,
|
|
68
|
+
disabled: !I() || u.value.trim() === "",
|
|
69
|
+
onClick: B
|
|
70
|
+
}, {
|
|
71
|
+
default: i(() => [
|
|
72
|
+
R(C(a ? e(p)("places.save") : e(p)("places.create")), 1)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["loading", "disabled"])
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
default: i(() => [
|
|
81
|
+
d(e(Z), {
|
|
82
|
+
label: e(p)("places.field-title"),
|
|
83
|
+
error: w("title"),
|
|
84
|
+
required: ""
|
|
85
|
+
}, {
|
|
86
|
+
default: i(() => [
|
|
87
|
+
z("div", {
|
|
88
|
+
ref_key: "field",
|
|
89
|
+
ref: v
|
|
90
|
+
}, [
|
|
91
|
+
d(e(ee), {
|
|
92
|
+
modelValue: m.value,
|
|
93
|
+
"onUpdate:modelValue": y[0] || (y[0] = (g) => m.value = g),
|
|
94
|
+
localized: "",
|
|
95
|
+
"aria-label": e(p)("places.field-title"),
|
|
96
|
+
onKeyup: Y(B, ["enter"])
|
|
97
|
+
}, null, 8, ["modelValue", "aria-label"])
|
|
98
|
+
], 512)
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
}, 8, ["label", "error"]),
|
|
102
|
+
d(e(Z), {
|
|
103
|
+
label: e(p)("places.field-key"),
|
|
104
|
+
error: w("key"),
|
|
105
|
+
help: a ? void 0 : e(p)("places.key-help"),
|
|
106
|
+
required: ""
|
|
107
|
+
}, {
|
|
108
|
+
default: i(() => [
|
|
109
|
+
d(e(ee), {
|
|
110
|
+
modelValue: u.value,
|
|
111
|
+
"onUpdate:modelValue": y[1] || (y[1] = (g) => u.value = g),
|
|
112
|
+
disabled: a,
|
|
113
|
+
"aria-label": e(p)("places.field-key"),
|
|
114
|
+
autocomplete: "off",
|
|
115
|
+
onKeyup: Y(B, ["enter"])
|
|
116
|
+
}, null, 8, ["modelValue", "aria-label"])
|
|
117
|
+
]),
|
|
118
|
+
_: 1
|
|
119
|
+
}, 8, ["label", "error", "help"])
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["open", "title"]));
|
|
123
|
+
}
|
|
124
|
+
}), Ie = { class: "wx-banner-place" }, Me = ["aria-label"], De = { class: "wx-banner-place__usage" }, Ue = {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "wx-banner-place__layout"
|
|
127
|
+
}, Le = { class: "wx-banner-row__thumb" }, Re = ["src"], Ee = { class: "wx-banner-row__body" }, Fe = { class: "wx-banner-row__title" }, Ne = {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: "wx-banner-row__facts"
|
|
130
|
+
}, Ae = /* @__PURE__ */ H({
|
|
131
|
+
name: "WxBannerPlacePane",
|
|
132
|
+
__name: "PlacePane",
|
|
133
|
+
props: {
|
|
134
|
+
place: {},
|
|
135
|
+
base: {},
|
|
136
|
+
inline: { type: Boolean, default: !0 }
|
|
137
|
+
},
|
|
138
|
+
emits: ["back", "changed"],
|
|
139
|
+
setup(M, { emit: h }) {
|
|
140
|
+
const b = M, D = h, S = G(), k = Q(S), t = se(), p = re();
|
|
141
|
+
X();
|
|
142
|
+
const a = J("webx-banners"), q = ce(), u = T([]), m = T(!0), W = V(() => S.can("banners.manage")), P = V({
|
|
143
|
+
get: () => t.query.view === "trashed" ? "trashed" : "live",
|
|
144
|
+
set: (n) => {
|
|
145
|
+
p.replace({
|
|
146
|
+
query: { ...t.query, view: n === "trashed" ? "trashed" : void 0 }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}), v = V(() => P.value === "trashed"), I = V(() => [
|
|
150
|
+
{ value: "live", label: a("banner.all") },
|
|
151
|
+
{ value: "trashed", label: a("banner.trashed"), icon: "trash" }
|
|
152
|
+
]), w = V(() => W.value && !v.value && u.value.length > 1), B = V(() => ["single", "random", "slider"].includes(b.place.layout) ? a(`places.layout-${b.place.layout}`) : "");
|
|
153
|
+
async function c() {
|
|
154
|
+
m.value = !0;
|
|
155
|
+
try {
|
|
156
|
+
u.value = await k.list(b.place.key, v.value);
|
|
157
|
+
} catch (n) {
|
|
158
|
+
x.danger(q(n));
|
|
159
|
+
} finally {
|
|
160
|
+
m.value = !1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
A(v, () => {
|
|
164
|
+
c();
|
|
165
|
+
}), c();
|
|
166
|
+
function y(n) {
|
|
167
|
+
return `${b.base}/${n.id}`;
|
|
168
|
+
}
|
|
169
|
+
function g() {
|
|
170
|
+
p.push({ path: `${b.base}/new`, query: { place: b.place.key } });
|
|
171
|
+
}
|
|
172
|
+
async function F() {
|
|
173
|
+
try {
|
|
174
|
+
await k.reorder(
|
|
175
|
+
b.place.key,
|
|
176
|
+
u.value.map((n) => n.id)
|
|
177
|
+
);
|
|
178
|
+
} catch (n) {
|
|
179
|
+
x.danger(q(n, a("banner.reorder-failed"))), await c();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
async function E(n) {
|
|
183
|
+
try {
|
|
184
|
+
const f = await k.get(n.id);
|
|
185
|
+
await k.save(n.id, { ...f.values, enabled: !n.enabled }), x.success(n.enabled ? a("banner.switched-off") : a("banner.switched-on"));
|
|
186
|
+
} catch (f) {
|
|
187
|
+
x.danger(q(f));
|
|
188
|
+
} finally {
|
|
189
|
+
await c();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function N(n) {
|
|
193
|
+
if (await ie({
|
|
194
|
+
title: a("banner.delete-title", { name: n.title }),
|
|
195
|
+
message: a("banner.delete-text"),
|
|
196
|
+
confirmText: a("banner.delete"),
|
|
197
|
+
cancelText: a("banner.cancel"),
|
|
198
|
+
tone: "danger"
|
|
199
|
+
}))
|
|
200
|
+
try {
|
|
201
|
+
await k.remove(n.id), x.success(a("banner.deleted")), D("changed");
|
|
202
|
+
} catch (o) {
|
|
203
|
+
x.danger(q(o));
|
|
204
|
+
} finally {
|
|
205
|
+
await c();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function l(n) {
|
|
209
|
+
try {
|
|
210
|
+
await k.restore(n.id), x.success(a("banner.restored")), D("changed");
|
|
211
|
+
} catch (f) {
|
|
212
|
+
x.danger(q(f));
|
|
213
|
+
} finally {
|
|
214
|
+
await c();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function $(n) {
|
|
218
|
+
if (v.value)
|
|
219
|
+
return W.value ? [
|
|
220
|
+
{
|
|
221
|
+
key: "restore",
|
|
222
|
+
icon: "refresh",
|
|
223
|
+
label: a("banner.restore"),
|
|
224
|
+
run: () => {
|
|
225
|
+
l(n);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
] : [];
|
|
229
|
+
const f = {
|
|
230
|
+
key: "open",
|
|
231
|
+
icon: "edit",
|
|
232
|
+
label: a("banner.open"),
|
|
233
|
+
run: () => {
|
|
234
|
+
p.push(y(n));
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return W.value ? [
|
|
238
|
+
f,
|
|
239
|
+
{
|
|
240
|
+
key: "toggle",
|
|
241
|
+
icon: n.enabled ? "eye-off" : "eye",
|
|
242
|
+
label: n.enabled ? a("banner.disable") : a("banner.enable"),
|
|
243
|
+
run: () => {
|
|
244
|
+
E(n);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "delete",
|
|
249
|
+
icon: "trash",
|
|
250
|
+
label: a("banner.delete"),
|
|
251
|
+
danger: !0,
|
|
252
|
+
run: () => {
|
|
253
|
+
N(n);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
] : [f];
|
|
257
|
+
}
|
|
258
|
+
const s = V(
|
|
259
|
+
() => W.value && !v.value ? [{ key: "new", label: a("banner.new"), icon: "plus", primary: !0, run: g }] : []
|
|
260
|
+
);
|
|
261
|
+
return (n, f) => (r(), U("div", Ie, [
|
|
262
|
+
d(e(Ce), {
|
|
263
|
+
level: 3,
|
|
264
|
+
back: !b.inline,
|
|
265
|
+
"back-label": e(a)("places.places"),
|
|
266
|
+
title: M.place.title,
|
|
267
|
+
actions: s.value,
|
|
268
|
+
"collapse-below": 420,
|
|
269
|
+
onBack: f[0] || (f[0] = (o) => D("back"))
|
|
270
|
+
}, fe({ _: 2 }, [
|
|
271
|
+
M.place.declared ? {
|
|
272
|
+
name: "title-after",
|
|
273
|
+
fn: i(() => [
|
|
274
|
+
d(e(he), {
|
|
275
|
+
content: e(a)("places.declared-help")
|
|
276
|
+
}, {
|
|
277
|
+
default: i(() => [
|
|
278
|
+
z("span", {
|
|
279
|
+
class: "wx-banner-place__lock",
|
|
280
|
+
tabindex: "0",
|
|
281
|
+
"aria-label": e(a)("places.declared")
|
|
282
|
+
}, [
|
|
283
|
+
d(e(O), {
|
|
284
|
+
name: "lock",
|
|
285
|
+
size: "sm"
|
|
286
|
+
})
|
|
287
|
+
], 8, Me)
|
|
288
|
+
]),
|
|
289
|
+
_: 1
|
|
290
|
+
}, 8, ["content"])
|
|
291
|
+
]),
|
|
292
|
+
key: "0"
|
|
293
|
+
} : void 0
|
|
294
|
+
]), 1032, ["back", "back-label", "title", "actions"]),
|
|
295
|
+
z("p", De, [
|
|
296
|
+
z("span", null, C(e(a)("places.usage")), 1),
|
|
297
|
+
z("code", null, "banners('" + C(M.place.key) + "')", 1),
|
|
298
|
+
B.value ? (r(), U("span", Ue, "· " + C(B.value), 1)) : L("", !0)
|
|
299
|
+
]),
|
|
300
|
+
d(e(We), {
|
|
301
|
+
modelValue: P.value,
|
|
302
|
+
"onUpdate:modelValue": f[1] || (f[1] = (o) => P.value = o),
|
|
303
|
+
class: "wx-banner-place__views",
|
|
304
|
+
size: "sm",
|
|
305
|
+
options: I.value,
|
|
306
|
+
"aria-label": e(a)("banner.all")
|
|
307
|
+
}, null, 8, ["modelValue", "options", "aria-label"]),
|
|
308
|
+
m.value && u.value.length === 0 ? (r(), _(e(oe), {
|
|
309
|
+
key: 0,
|
|
310
|
+
rows: 4
|
|
311
|
+
})) : u.value.length === 0 ? (r(), _(e(j), {
|
|
312
|
+
key: 1,
|
|
313
|
+
title: v.value ? e(a)("banner.empty-bin") : e(a)("banner.empty"),
|
|
314
|
+
description: v.value ? void 0 : e(a)("banner.empty-help")
|
|
315
|
+
}, null, 8, ["title", "description"])) : (r(), U(te, { key: 2 }, [
|
|
316
|
+
d(e(Be), {
|
|
317
|
+
modelValue: u.value,
|
|
318
|
+
"onUpdate:modelValue": f[2] || (f[2] = (o) => u.value = o),
|
|
319
|
+
class: K(["wx-banner-place__list", { "is-loading": m.value }]),
|
|
320
|
+
hoverable: "",
|
|
321
|
+
plain: "",
|
|
322
|
+
"item-key": "id",
|
|
323
|
+
handle: w.value ? "grip" : "row",
|
|
324
|
+
"item-label": (o) => o.title,
|
|
325
|
+
disabled: !w.value,
|
|
326
|
+
onMove: F
|
|
327
|
+
}, {
|
|
328
|
+
default: i(({ item: o }) => [
|
|
329
|
+
(r(), _(me(v.value ? "div" : "router-link"), {
|
|
330
|
+
to: v.value ? void 0 : y(o),
|
|
331
|
+
class: K(["wx-banner-row", { "is-off": !o.enabled && !v.value }])
|
|
332
|
+
}, {
|
|
333
|
+
default: i(() => [
|
|
334
|
+
z("span", Le, [
|
|
335
|
+
o.thumb ? (r(), U("img", {
|
|
336
|
+
key: 0,
|
|
337
|
+
src: o.thumb,
|
|
338
|
+
alt: "",
|
|
339
|
+
loading: "lazy"
|
|
340
|
+
}, null, 8, Re)) : (r(), _(e(O), {
|
|
341
|
+
key: 1,
|
|
342
|
+
name: "image",
|
|
343
|
+
size: "sm",
|
|
344
|
+
"aria-label": e(a)("banner.no-picture")
|
|
345
|
+
}, null, 8, ["aria-label"]))
|
|
346
|
+
]),
|
|
347
|
+
z("span", Ee, [
|
|
348
|
+
z("span", Fe, C(o.title), 1),
|
|
349
|
+
o.video || !o.enabled && !v.value ? (r(), U("span", Ne, [
|
|
350
|
+
o.video ? (r(), _(e(le), {
|
|
351
|
+
key: 0,
|
|
352
|
+
size: "sm",
|
|
353
|
+
type: "info"
|
|
354
|
+
}, {
|
|
355
|
+
default: i(() => [
|
|
356
|
+
R(C(e(a)("banner.video")), 1)
|
|
357
|
+
]),
|
|
358
|
+
_: 1
|
|
359
|
+
})) : L("", !0),
|
|
360
|
+
!o.enabled && !v.value ? (r(), _(e(le), {
|
|
361
|
+
key: 1,
|
|
362
|
+
dot: "",
|
|
363
|
+
size: "sm"
|
|
364
|
+
}, {
|
|
365
|
+
default: i(() => [
|
|
366
|
+
R(C(e(a)("banner.disabled")), 1)
|
|
367
|
+
]),
|
|
368
|
+
_: 1
|
|
369
|
+
})) : L("", !0)
|
|
370
|
+
])) : L("", !0)
|
|
371
|
+
])
|
|
372
|
+
]),
|
|
373
|
+
_: 2
|
|
374
|
+
}, 1032, ["to", "class"]))
|
|
375
|
+
]),
|
|
376
|
+
actions: i(({ item: o }) => [
|
|
377
|
+
d(e(ue), {
|
|
378
|
+
actions: $(o),
|
|
379
|
+
label: o.title
|
|
380
|
+
}, null, 8, ["actions", "label"])
|
|
381
|
+
]),
|
|
382
|
+
_: 1
|
|
383
|
+
}, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
|
|
384
|
+
w.value ? (r(), _(e(Ve), {
|
|
385
|
+
key: 0,
|
|
386
|
+
class: "wx-banner-place__note",
|
|
387
|
+
type: "info",
|
|
388
|
+
description: e(a)("banner.order")
|
|
389
|
+
}, null, 8, ["description"])) : L("", !0)
|
|
390
|
+
], 64))
|
|
391
|
+
]));
|
|
392
|
+
}
|
|
393
|
+
}), Ke = /* @__PURE__ */ de(Ae, [["__scopeId", "data-v-48d645bf"]]), Oe = {
|
|
394
|
+
key: 2,
|
|
395
|
+
class: "wx-banners__list"
|
|
396
|
+
}, je = ["onClick"], He = { class: "wx-banners__name" }, Ge = /* @__PURE__ */ H({
|
|
397
|
+
__name: "BannersPage",
|
|
398
|
+
props: {
|
|
399
|
+
base: { default: "/banners" }
|
|
400
|
+
},
|
|
401
|
+
setup(M) {
|
|
402
|
+
const h = M, b = G(), D = Q(b), S = se(), k = re();
|
|
403
|
+
X();
|
|
404
|
+
const t = J("webx-banners"), p = ce(), a = T([]), q = T(!0), u = T(!1), m = T(!0), W = V(() => b.can("banners.manage")), P = qe(Se), v = V(
|
|
405
|
+
() => b.state.manifest?.modules.find((l) => l.id === "banners")?.title ?? t("module.banners")
|
|
406
|
+
), I = V(() => {
|
|
407
|
+
const l = S.query.place;
|
|
408
|
+
return typeof l == "string" && l !== "" ? l : null;
|
|
409
|
+
}), w = V(() => a.value.find((l) => l.key === I.value) ?? null);
|
|
410
|
+
async function B() {
|
|
411
|
+
q.value = !0;
|
|
412
|
+
try {
|
|
413
|
+
a.value = await D.places();
|
|
414
|
+
} catch (l) {
|
|
415
|
+
x.danger(p(l));
|
|
416
|
+
} finally {
|
|
417
|
+
q.value = !1;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
B(), A([a, w, m], () => {
|
|
421
|
+
!m.value || a.value.length === 0 || w.value !== null || k.replace({ query: { ...S.query, place: a.value[0].key } });
|
|
422
|
+
}), A(w, (l) => {
|
|
423
|
+
l !== null && m.value && (u.value = !0);
|
|
424
|
+
}), I.value !== null && (u.value = !0);
|
|
425
|
+
function c(l) {
|
|
426
|
+
const $ = { ...S.query, place: l.key };
|
|
427
|
+
delete $.view, k.replace({ query: $ }), u.value = !0;
|
|
428
|
+
}
|
|
429
|
+
async function y() {
|
|
430
|
+
const l = await P({ place: null });
|
|
431
|
+
l && (x.success(t("places.created")), await B(), c(l));
|
|
432
|
+
}
|
|
433
|
+
async function g(l) {
|
|
434
|
+
await P({ place: l }) && (x.success(t("places.renamed")), await B());
|
|
435
|
+
}
|
|
436
|
+
async function F(l) {
|
|
437
|
+
if (await ie({
|
|
438
|
+
title: t("places.delete-title", { place: l.title }),
|
|
439
|
+
message: t("places.delete-text"),
|
|
440
|
+
confirmText: t("places.delete"),
|
|
441
|
+
cancelText: t("places.cancel"),
|
|
442
|
+
tone: "danger"
|
|
443
|
+
}))
|
|
444
|
+
try {
|
|
445
|
+
if (await D.removePlace(l.key), x.success(t("places.deleted")), I.value === l.key) {
|
|
446
|
+
const s = { ...S.query };
|
|
447
|
+
delete s.place, delete s.view, k.replace({ query: s }), u.value = !1;
|
|
448
|
+
}
|
|
449
|
+
} catch (s) {
|
|
450
|
+
x.danger(p(s));
|
|
451
|
+
} finally {
|
|
452
|
+
await B();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function E(l) {
|
|
456
|
+
return !W.value || l.declared ? [] : [
|
|
457
|
+
{ key: "rename", icon: "edit", label: t("places.rename"), run: () => {
|
|
458
|
+
g(l);
|
|
459
|
+
} },
|
|
460
|
+
{
|
|
461
|
+
key: "delete",
|
|
462
|
+
icon: "trash",
|
|
463
|
+
// Said in the line itself, since a switched-off line cannot carry a tooltip: an empty
|
|
464
|
+
// place is the only kind that goes (decision 1).
|
|
465
|
+
label: l.count > 0 ? t("places.delete-empty-first") : t("places.delete"),
|
|
466
|
+
danger: !0,
|
|
467
|
+
disabled: l.count > 0,
|
|
468
|
+
run: () => {
|
|
469
|
+
F(l);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
];
|
|
473
|
+
}
|
|
474
|
+
const N = V(
|
|
475
|
+
() => W.value ? [{ key: "new-place", label: t("places.new"), icon: "plus", run: () => {
|
|
476
|
+
y();
|
|
477
|
+
} }] : []
|
|
478
|
+
);
|
|
479
|
+
return (l, $) => (r(), _(e(Te), {
|
|
480
|
+
title: v.value,
|
|
481
|
+
actions: N.value,
|
|
482
|
+
card: !1
|
|
483
|
+
}, {
|
|
484
|
+
default: i(() => [
|
|
485
|
+
d(e(Pe), {
|
|
486
|
+
class: "wx-banners",
|
|
487
|
+
padding: "none"
|
|
488
|
+
}, {
|
|
489
|
+
default: i(() => [
|
|
490
|
+
d(e($e), {
|
|
491
|
+
open: u.value,
|
|
492
|
+
"onUpdate:open": $[0] || ($[0] = (s) => u.value = s),
|
|
493
|
+
class: "wx-banners__panes",
|
|
494
|
+
"list-width": 300,
|
|
495
|
+
"detail-min": 440,
|
|
496
|
+
"detail-label": e(t)("places.places"),
|
|
497
|
+
onDetailInline: $[1] || ($[1] = (s) => m.value = s)
|
|
498
|
+
}, {
|
|
499
|
+
list: i(() => [
|
|
500
|
+
q.value && a.value.length === 0 ? (r(), _(e(oe), {
|
|
501
|
+
key: 0,
|
|
502
|
+
class: "wx-banners__loading",
|
|
503
|
+
rows: 3
|
|
504
|
+
})) : a.value.length === 0 ? (r(), _(e(j), {
|
|
505
|
+
key: 1,
|
|
506
|
+
title: e(t)("places.empty"),
|
|
507
|
+
description: e(t)("places.empty-help")
|
|
508
|
+
}, null, 8, ["title", "description"])) : (r(), U("ul", Oe, [
|
|
509
|
+
(r(!0), U(te, null, _e(a.value, (s) => (r(), U("li", {
|
|
510
|
+
key: s.key,
|
|
511
|
+
class: "wx-banners__row"
|
|
512
|
+
}, [
|
|
513
|
+
z("button", {
|
|
514
|
+
type: "button",
|
|
515
|
+
class: K(["wx-banners__open", { "is-current": s.key === I.value }]),
|
|
516
|
+
onClick: (n) => c(s)
|
|
517
|
+
}, [
|
|
518
|
+
z("span", He, [
|
|
519
|
+
d(e(ne), {
|
|
520
|
+
truncate: "",
|
|
521
|
+
weight: "medium"
|
|
522
|
+
}, {
|
|
523
|
+
default: i(() => [
|
|
524
|
+
R(C(s.title), 1)
|
|
525
|
+
]),
|
|
526
|
+
_: 2
|
|
527
|
+
}, 1024),
|
|
528
|
+
s.declared ? (r(), _(e(O), {
|
|
529
|
+
key: 0,
|
|
530
|
+
class: "wx-banners__lock",
|
|
531
|
+
name: "lock",
|
|
532
|
+
size: "sm",
|
|
533
|
+
"aria-label": e(t)("places.declared")
|
|
534
|
+
}, null, 8, ["aria-label"])) : L("", !0),
|
|
535
|
+
d(e(ze), {
|
|
536
|
+
class: "wx-banners__count",
|
|
537
|
+
type: "neutral",
|
|
538
|
+
value: s.count,
|
|
539
|
+
label: e(t)("places.count")
|
|
540
|
+
}, null, 8, ["value", "label"])
|
|
541
|
+
]),
|
|
542
|
+
d(e(ne), {
|
|
543
|
+
size: "sm",
|
|
544
|
+
tone: "muted",
|
|
545
|
+
mono: "",
|
|
546
|
+
truncate: ""
|
|
547
|
+
}, {
|
|
548
|
+
default: i(() => [
|
|
549
|
+
R("banners('" + C(s.key) + "')", 1)
|
|
550
|
+
]),
|
|
551
|
+
_: 2
|
|
552
|
+
}, 1024)
|
|
553
|
+
], 10, je),
|
|
554
|
+
E(s).length > 0 ? (r(), _(e(ue), {
|
|
555
|
+
key: 0,
|
|
556
|
+
actions: E(s),
|
|
557
|
+
label: s.title
|
|
558
|
+
}, null, 8, ["actions", "label"])) : L("", !0)
|
|
559
|
+
]))), 128))
|
|
560
|
+
]))
|
|
561
|
+
]),
|
|
562
|
+
detail: i(({ inline: s, back: n }) => [
|
|
563
|
+
w.value ? (r(), _(Ke, {
|
|
564
|
+
key: w.value.key,
|
|
565
|
+
place: w.value,
|
|
566
|
+
base: h.base,
|
|
567
|
+
inline: s,
|
|
568
|
+
onBack: n,
|
|
569
|
+
onChanged: B
|
|
570
|
+
}, null, 8, ["place", "base", "inline", "onBack"])) : L("", !0)
|
|
571
|
+
]),
|
|
572
|
+
empty: i(() => [
|
|
573
|
+
d(e(j), {
|
|
574
|
+
title: e(t)("places.choose"),
|
|
575
|
+
description: e(t)("places.choose-help")
|
|
576
|
+
}, null, 8, ["title", "description"])
|
|
577
|
+
]),
|
|
578
|
+
_: 1
|
|
579
|
+
}, 8, ["open", "detail-label"])
|
|
580
|
+
]),
|
|
581
|
+
_: 1
|
|
582
|
+
})
|
|
583
|
+
]),
|
|
584
|
+
_: 1
|
|
585
|
+
}, 8, ["title", "actions"]));
|
|
586
|
+
}
|
|
587
|
+
}), ea = /* @__PURE__ */ de(Ge, [["__scopeId", "data-v-615232f0"]]);
|
|
588
|
+
export {
|
|
589
|
+
ea as default
|
|
590
|
+
};
|
|
591
|
+
//# sourceMappingURL=BannersPage-Dl_BCozz.js.map
|