@webx-ui/module-pages 0.3.4 → 0.3.7
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/PageEditorPage.d.ts +1 -3
- package/dist/index.js +650 -733
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { useAdmin as
|
|
4
|
-
import { WxCard as
|
|
5
|
-
import { provideBlocksPreview as
|
|
6
|
-
function
|
|
7
|
-
const
|
|
1
|
+
import { inject as Ae, provide as Ie, defineComponent as F, ref as _, computed as W, openBlock as f, createBlock as C, unref as e, withCtx as i, createElementVNode as K, createElementBlock as N, createVNode as v, createTextVNode as $, toDisplayString as x, createCommentVNode as I, watch as ae, onMounted as ce, onBeforeUnmount as Ue, Fragment as Z, renderList as Ce, normalizeClass as Re, useModel as Le, mergeModels as Oe, useTemplateRef as Ke, nextTick as Fe, isRef as Me, withKeys as Pe, withModifiers as He } from "vue";
|
|
2
|
+
import { useRouter as _e, useRoute as je, onBeforeRouteLeave as Ge } from "vue-router";
|
|
3
|
+
import { useAdmin as Q, useTranslate as H, useErrorText as ie, WxScreenHead as Je, WxScreen as Qe, WxSaveState as Xe, WxDate as be, WxRowMenu as Ye, rowMenuWidth as Ze, WxListScreen as qe } from "@webx-ui/module-admin";
|
|
4
|
+
import { WxCard as et, WxText as U, WxButton as R, confirm as L, toast as V, useLocales as Se, localizedValue as tt, WxSkeleton as ye, WxBadge as xe, WxBreadcrumb as at, WxBreadcrumbItem as fe, WxAlert as ke, WxActionBar as lt, WxEmpty as st, WxTreeSelect as nt, WxFormItem as ne, useModal as Be, WxDialog as De, WxInput as We, WxSpace as we, createModal as Ve, WxTable as it } from "@webx-ui/core";
|
|
5
|
+
import { provideBlocksPreview as ot } from "@webx-ui/module-blocks";
|
|
6
|
+
function q(u) {
|
|
7
|
+
const o = `${u.apiPath}/pages`, g = (a) => a.data;
|
|
8
8
|
return {
|
|
9
|
-
list: (
|
|
9
|
+
list: (a = {}) => {
|
|
10
10
|
const s = new URLSearchParams();
|
|
11
|
-
|
|
11
|
+
a.parent != null && s.set("parent", String(a.parent)), a.search && s.set("search", a.search), a.status && s.set("status", a.status), a.trashed && s.set("trashed", "1"), a.flat && s.set("flat", "1");
|
|
12
12
|
const t = s.size > 0 ? `?${s}` : "";
|
|
13
|
-
return u.http.get(`${
|
|
13
|
+
return u.http.get(`${o}${t}`).then(g);
|
|
14
14
|
},
|
|
15
|
-
get: (
|
|
16
|
-
create: (
|
|
17
|
-
save: (
|
|
18
|
-
move: (
|
|
19
|
-
duplicate: (
|
|
20
|
-
publish: (
|
|
21
|
-
unpublish: (
|
|
22
|
-
remove: (
|
|
23
|
-
restore: (
|
|
24
|
-
versions: (
|
|
25
|
-
restoreVersion: (
|
|
15
|
+
get: (a) => u.http.get(`${o}/${a}`).then(g),
|
|
16
|
+
create: (a) => u.http.post(o, a).then(g),
|
|
17
|
+
save: (a, s) => u.http.put(`${o}/${a}`, s).then(g),
|
|
18
|
+
move: (a, s, t) => u.http.post(`${o}/${a}/move`, { target: s, zone: t }).then(g),
|
|
19
|
+
duplicate: (a) => u.http.post(`${o}/${a}/duplicate`, {}).then(g),
|
|
20
|
+
publish: (a) => u.http.post(`${o}/${a}/publish`, {}).then(g),
|
|
21
|
+
unpublish: (a) => u.http.post(`${o}/${a}/unpublish`, {}).then(g),
|
|
22
|
+
remove: (a) => u.http.delete(`${o}/${a}`).then((s) => s.data.trashed),
|
|
23
|
+
restore: (a) => u.http.post(`${o}/${a}/restore`, {}).then((s) => s.data.restored),
|
|
24
|
+
versions: (a) => u.http.get(`${o}/${a}/versions`).then(g),
|
|
25
|
+
restoreVersion: (a, s) => u.http.post(`${o}/${a}/versions/${s}/restore`, {}).then(g)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
|
|
28
|
+
const Ne = /* @__PURE__ */ Symbol("wx-page-editor");
|
|
29
|
+
function rt(u) {
|
|
30
|
+
Ie(Ne, u);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function Te() {
|
|
33
|
+
return Ae(Ne, null);
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const ut = {
|
|
36
36
|
module: {
|
|
37
37
|
title: "Pages"
|
|
38
38
|
},
|
|
@@ -96,9 +96,6 @@ const vt = {
|
|
|
96
96
|
// The editor.
|
|
97
97
|
trail: "Where this page sits",
|
|
98
98
|
untitled: "Untitled",
|
|
99
|
-
"state-saved": "Saved",
|
|
100
|
-
"state-saving": "Saving…",
|
|
101
|
-
"state-unsaved": "Not saved yet",
|
|
102
99
|
save: "Save",
|
|
103
100
|
"save-failed": "The page was not saved.",
|
|
104
101
|
publish: "Publish",
|
|
@@ -137,126 +134,126 @@ const vt = {
|
|
|
137
134
|
"restore-text": "It becomes the draft. The site keeps showing what is published until you publish this.",
|
|
138
135
|
"restored-version": "Version :number is now the draft."
|
|
139
136
|
}
|
|
140
|
-
},
|
|
141
|
-
function
|
|
137
|
+
}, ze = /* @__PURE__ */ new WeakSet();
|
|
138
|
+
function j() {
|
|
142
139
|
try {
|
|
143
|
-
const { i18n: u } =
|
|
144
|
-
|
|
140
|
+
const { i18n: u } = Q();
|
|
141
|
+
ze.has(u) || (u.defaults("webx-pages", ut), ze.add(u));
|
|
145
142
|
} catch {
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
|
-
const
|
|
145
|
+
const dt = { class: "wx-page-danger" }, ct = {
|
|
149
146
|
key: 0,
|
|
150
147
|
class: "wx-page-danger__row"
|
|
151
|
-
},
|
|
148
|
+
}, pt = { class: "wx-page-danger__what" }, gt = { class: "wx-page-danger__row" }, vt = { class: "wx-page-danger__what" }, ht = /* @__PURE__ */ F({
|
|
152
149
|
name: "WxPageDanger",
|
|
153
150
|
__name: "PageDanger",
|
|
154
151
|
setup(u) {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const t =
|
|
158
|
-
async function
|
|
159
|
-
const
|
|
160
|
-
if (!(!
|
|
161
|
-
title: t("page.unpublish-title", { title:
|
|
152
|
+
const o = Q(), g = q(o), a = _e(), s = Te();
|
|
153
|
+
j();
|
|
154
|
+
const t = H("webx-pages"), d = ie(), l = _(!1), c = W(() => s?.page.value ?? null), h = W(() => o.can("pages.manage"));
|
|
155
|
+
async function r() {
|
|
156
|
+
const w = c.value;
|
|
157
|
+
if (!(!w || !await L({
|
|
158
|
+
title: t("page.unpublish-title", { title: w.title }),
|
|
162
159
|
message: t("page.unpublish-text"),
|
|
163
160
|
confirmText: t("page.unpublish"),
|
|
164
161
|
cancelText: t("page.cancel"),
|
|
165
162
|
tone: "danger"
|
|
166
163
|
}))) {
|
|
167
|
-
|
|
164
|
+
l.value = !0;
|
|
168
165
|
try {
|
|
169
|
-
await
|
|
170
|
-
} catch (
|
|
171
|
-
|
|
166
|
+
await g.unpublish(w.id), await s?.reload(), V.success(t("page.unpublished"));
|
|
167
|
+
} catch (b) {
|
|
168
|
+
V.danger(d(b));
|
|
172
169
|
} finally {
|
|
173
|
-
|
|
170
|
+
l.value = !1;
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
|
-
async function
|
|
178
|
-
const
|
|
179
|
-
if (!(!
|
|
180
|
-
title: t("page.delete-title", { title:
|
|
174
|
+
async function k() {
|
|
175
|
+
const w = c.value;
|
|
176
|
+
if (!(!w || !await L({
|
|
177
|
+
title: t("page.delete-title", { title: w.title }),
|
|
181
178
|
// The whole branch, not the level under it (§7): a catalogue with two sections and forty
|
|
182
179
|
// products is forty-two pages leaving the site at once.
|
|
183
|
-
message:
|
|
180
|
+
message: w.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: w.descendants_count })}` : t("page.delete-text"),
|
|
184
181
|
confirmText: t("page.delete"),
|
|
185
182
|
cancelText: t("page.cancel"),
|
|
186
183
|
tone: "danger"
|
|
187
184
|
}))) {
|
|
188
|
-
|
|
185
|
+
l.value = !0;
|
|
189
186
|
try {
|
|
190
|
-
await
|
|
191
|
-
} catch (
|
|
192
|
-
|
|
187
|
+
await g.remove(w.id), V.success(t("page.deleted")), a.push(s?.base ?? "/pages");
|
|
188
|
+
} catch (b) {
|
|
189
|
+
V.danger(d(b));
|
|
193
190
|
} finally {
|
|
194
|
-
|
|
191
|
+
l.value = !1;
|
|
195
192
|
}
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
|
-
return (
|
|
195
|
+
return (w, z) => c.value && h.value ? (f(), C(e(et), {
|
|
199
196
|
key: 0,
|
|
200
197
|
title: e(t)("page.danger")
|
|
201
198
|
}, {
|
|
202
|
-
default:
|
|
203
|
-
|
|
204
|
-
c.value.status !== "draft" ? (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
default:
|
|
208
|
-
|
|
199
|
+
default: i(() => [
|
|
200
|
+
K("div", dt, [
|
|
201
|
+
c.value.status !== "draft" ? (f(), N("div", ct, [
|
|
202
|
+
K("div", pt, [
|
|
203
|
+
v(e(U), { weight: "medium" }, {
|
|
204
|
+
default: i(() => [
|
|
205
|
+
$(x(e(t)("page.unpublish")), 1)
|
|
209
206
|
]),
|
|
210
207
|
_: 1
|
|
211
208
|
}),
|
|
212
|
-
|
|
209
|
+
v(e(U), {
|
|
213
210
|
size: "sm",
|
|
214
211
|
tone: "muted"
|
|
215
212
|
}, {
|
|
216
|
-
default:
|
|
217
|
-
|
|
213
|
+
default: i(() => [
|
|
214
|
+
$(x(e(t)("page.unpublish-help")), 1)
|
|
218
215
|
]),
|
|
219
216
|
_: 1
|
|
220
217
|
})
|
|
221
218
|
]),
|
|
222
|
-
|
|
219
|
+
v(e(R), {
|
|
223
220
|
variant: "outline",
|
|
224
|
-
loading:
|
|
225
|
-
onClick:
|
|
221
|
+
loading: l.value,
|
|
222
|
+
onClick: r
|
|
226
223
|
}, {
|
|
227
|
-
default:
|
|
228
|
-
|
|
224
|
+
default: i(() => [
|
|
225
|
+
$(x(e(t)("page.unpublish")), 1)
|
|
229
226
|
]),
|
|
230
227
|
_: 1
|
|
231
228
|
}, 8, ["loading"])
|
|
232
|
-
])) :
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
default:
|
|
237
|
-
|
|
229
|
+
])) : I("", !0),
|
|
230
|
+
K("div", gt, [
|
|
231
|
+
K("div", vt, [
|
|
232
|
+
v(e(U), { weight: "medium" }, {
|
|
233
|
+
default: i(() => [
|
|
234
|
+
$(x(e(t)("page.delete")), 1)
|
|
238
235
|
]),
|
|
239
236
|
_: 1
|
|
240
237
|
}),
|
|
241
|
-
|
|
238
|
+
v(e(U), {
|
|
242
239
|
size: "sm",
|
|
243
240
|
tone: "muted"
|
|
244
241
|
}, {
|
|
245
|
-
default:
|
|
246
|
-
|
|
242
|
+
default: i(() => [
|
|
243
|
+
$(x(c.value.can.delete ? e(t)("page.delete-help") : e(t)("page.delete-home")), 1)
|
|
247
244
|
]),
|
|
248
245
|
_: 1
|
|
249
246
|
})
|
|
250
247
|
]),
|
|
251
|
-
|
|
248
|
+
v(e(R), {
|
|
252
249
|
type: "danger",
|
|
253
250
|
variant: "outline",
|
|
254
251
|
disabled: !c.value.can.delete,
|
|
255
|
-
loading:
|
|
256
|
-
onClick:
|
|
252
|
+
loading: l.value,
|
|
253
|
+
onClick: k
|
|
257
254
|
}, {
|
|
258
|
-
default:
|
|
259
|
-
|
|
255
|
+
default: i(() => [
|
|
256
|
+
$(x(e(t)("page.delete")), 1)
|
|
260
257
|
]),
|
|
261
258
|
_: 1
|
|
262
259
|
}, 8, ["disabled", "loading"])
|
|
@@ -264,447 +261,376 @@ const ht = { class: "wx-page-danger" }, ft = {
|
|
|
264
261
|
])
|
|
265
262
|
]),
|
|
266
263
|
_: 1
|
|
267
|
-
}, 8, ["title"])) :
|
|
264
|
+
}, 8, ["title"])) : I("", !0);
|
|
268
265
|
}
|
|
269
|
-
}),
|
|
270
|
-
const
|
|
271
|
-
for (const [
|
|
272
|
-
|
|
273
|
-
return
|
|
274
|
-
},
|
|
266
|
+
}), oe = (u, o) => {
|
|
267
|
+
const g = u.__vccOpts || u;
|
|
268
|
+
for (const [a, s] of o)
|
|
269
|
+
g[a] = s;
|
|
270
|
+
return g;
|
|
271
|
+
}, mt = /* @__PURE__ */ oe(ht, [["__scopeId", "data-v-d4a9083f"]]), ft = { class: "wx-page-editor__screen" }, bt = 1200, yt = /* @__PURE__ */ F({
|
|
275
272
|
__name: "PageEditorPage",
|
|
276
273
|
props: {
|
|
277
274
|
base: { default: "/pages" }
|
|
278
275
|
},
|
|
279
276
|
setup(u) {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
return
|
|
285
|
-
}),
|
|
286
|
-
() =>
|
|
287
|
-
id:
|
|
288
|
-
label:
|
|
277
|
+
const o = u, g = Q(), a = q(g), s = je(), t = _e(), d = Se();
|
|
278
|
+
j();
|
|
279
|
+
const l = H("webx-pages"), c = ie(), h = W(() => Number(s.params.id)), r = _(null), k = _([]), w = _({}), z = _(""), b = _(null), p = _({}), M = _(!0), P = _(!1), B = _(!1), le = _({}), A = _(null), ee = _(""), re = _(0), S = W(() => g.can("pages.manage")), te = W(() => JSON.stringify(w.value)), E = W(() => ee.value !== "" && te.value !== ee.value), ue = W(() => P.value ? "saving" : E.value ? "unsaved" : "saved"), de = W(() => {
|
|
280
|
+
const y = w.value.title;
|
|
281
|
+
return tt(y, d.active.value, r.value?.title ?? "");
|
|
282
|
+
}), pe = W(
|
|
283
|
+
() => k.value.map((y) => ({
|
|
284
|
+
id: y.id,
|
|
285
|
+
label: y.is_home ? l("pages.home") : y.title
|
|
289
286
|
}))
|
|
290
287
|
);
|
|
291
|
-
|
|
292
|
-
page:
|
|
293
|
-
ancestors:
|
|
294
|
-
values:
|
|
288
|
+
ot({ url: W(() => b.value), reload: re }), rt({
|
|
289
|
+
page: r,
|
|
290
|
+
ancestors: k,
|
|
291
|
+
values: w,
|
|
295
292
|
prefixes: p,
|
|
296
|
-
base:
|
|
297
|
-
canManage:
|
|
298
|
-
reload: () =>
|
|
299
|
-
save: () =>
|
|
293
|
+
base: o.base,
|
|
294
|
+
canManage: S.value,
|
|
295
|
+
reload: () => G(!0),
|
|
296
|
+
save: () => O()
|
|
300
297
|
});
|
|
301
|
-
function
|
|
302
|
-
|
|
298
|
+
function ge(y) {
|
|
299
|
+
r.value = y.page, k.value = y.ancestors, w.value = y.values, z.value = y.revision, b.value = y.preview_url, p.value = y.address_prefix, ee.value = JSON.stringify(y.values), A.value = null;
|
|
303
300
|
}
|
|
304
|
-
async function
|
|
305
|
-
|
|
301
|
+
async function G(y = !1) {
|
|
302
|
+
y || (M.value = !0);
|
|
306
303
|
try {
|
|
307
|
-
|
|
304
|
+
ge(await a.get(h.value));
|
|
308
305
|
} catch (Y) {
|
|
309
|
-
|
|
306
|
+
V.danger(c(Y)), t.push(o.base);
|
|
310
307
|
} finally {
|
|
311
|
-
|
|
308
|
+
M.value = !1;
|
|
312
309
|
}
|
|
313
310
|
}
|
|
314
|
-
let
|
|
315
|
-
function
|
|
316
|
-
!
|
|
317
|
-
|
|
318
|
-
},
|
|
311
|
+
let X;
|
|
312
|
+
function ve() {
|
|
313
|
+
!S.value || A.value || !E.value || (clearTimeout(X), X = setTimeout(() => {
|
|
314
|
+
O();
|
|
315
|
+
}, bt));
|
|
319
316
|
}
|
|
320
|
-
function
|
|
321
|
-
!
|
|
317
|
+
function he() {
|
|
318
|
+
!S.value || A.value || !E.value || P.value || (clearTimeout(X), O());
|
|
322
319
|
}
|
|
323
|
-
async function
|
|
324
|
-
if (!
|
|
325
|
-
clearTimeout(
|
|
326
|
-
const
|
|
327
|
-
|
|
320
|
+
async function O() {
|
|
321
|
+
if (!r.value || P.value || !S.value) return;
|
|
322
|
+
clearTimeout(X);
|
|
323
|
+
const y = te.value, Y = w.value;
|
|
324
|
+
P.value = !0, le.value = {};
|
|
328
325
|
try {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
} catch (
|
|
332
|
-
const se =
|
|
333
|
-
se.status === 409 && se.body?.data ?
|
|
326
|
+
const D = await a.save(r.value.id, { values: Y, revision: z.value });
|
|
327
|
+
r.value = D.page, k.value = D.ancestors, z.value = D.revision, b.value = D.preview_url, p.value = D.address_prefix, A.value = null, te.value === y && (ee.value = y), re.value += 1;
|
|
328
|
+
} catch (D) {
|
|
329
|
+
const se = D;
|
|
330
|
+
se.status === 409 && se.body?.data ? A.value = se.body : se.body?.errors ? (le.value = se.body.errors, V.danger(l("page.save-failed"))) : V.danger(c(D));
|
|
334
331
|
} finally {
|
|
335
|
-
|
|
332
|
+
P.value = !1;
|
|
336
333
|
}
|
|
337
334
|
}
|
|
338
|
-
async function
|
|
339
|
-
await
|
|
340
|
-
title:
|
|
341
|
-
message:
|
|
342
|
-
confirmText:
|
|
343
|
-
cancelText:
|
|
335
|
+
async function me() {
|
|
336
|
+
await L({
|
|
337
|
+
title: l("page.conflict-theirs-title"),
|
|
338
|
+
message: l("page.conflict-theirs-text"),
|
|
339
|
+
confirmText: l("page.conflict-theirs"),
|
|
340
|
+
cancelText: l("page.cancel"),
|
|
344
341
|
tone: "danger"
|
|
345
|
-
}) && await
|
|
342
|
+
}) && await G(!0);
|
|
346
343
|
}
|
|
347
|
-
async function
|
|
348
|
-
const
|
|
349
|
-
|
|
344
|
+
async function n() {
|
|
345
|
+
const y = A.value;
|
|
346
|
+
y && (z.value = y.data.revision, A.value = null, await O());
|
|
350
347
|
}
|
|
351
|
-
async function
|
|
352
|
-
if (!
|
|
353
|
-
const
|
|
354
|
-
if (await
|
|
355
|
-
title:
|
|
356
|
-
message:
|
|
357
|
-
confirmText:
|
|
358
|
-
cancelText:
|
|
359
|
-
}) && (
|
|
360
|
-
|
|
348
|
+
async function T() {
|
|
349
|
+
if (!r.value) return;
|
|
350
|
+
const y = r.value.path === null ? null : `/${r.value.path}`;
|
|
351
|
+
if (await L({
|
|
352
|
+
title: l("page.publish-title", { title: r.value.title }),
|
|
353
|
+
message: y === null ? l("page.publish-text-nowhere") : l("page.publish-text", { address: y }),
|
|
354
|
+
confirmText: l("page.publish"),
|
|
355
|
+
cancelText: l("page.cancel")
|
|
356
|
+
}) && (E.value && await O(), !A.value)) {
|
|
357
|
+
B.value = !0;
|
|
361
358
|
try {
|
|
362
|
-
await
|
|
363
|
-
} catch (
|
|
364
|
-
|
|
359
|
+
await a.publish(r.value.id), await G(!0), V.success(l("page.published"));
|
|
360
|
+
} catch (D) {
|
|
361
|
+
V.danger(c(D));
|
|
365
362
|
} finally {
|
|
366
|
-
|
|
363
|
+
B.value = !1;
|
|
367
364
|
}
|
|
368
365
|
}
|
|
369
366
|
}
|
|
370
|
-
function
|
|
371
|
-
return
|
|
367
|
+
function m() {
|
|
368
|
+
return r.value?.status === "published" ? "success" : r.value?.status === "modified" ? "warning" : "default";
|
|
372
369
|
}
|
|
373
|
-
function
|
|
374
|
-
|
|
370
|
+
function J(y) {
|
|
371
|
+
E.value && y.preventDefault();
|
|
375
372
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
}),
|
|
381
|
-
clearTimeout(
|
|
382
|
-
}),
|
|
383
|
-
title:
|
|
384
|
-
message:
|
|
385
|
-
confirmText:
|
|
386
|
-
cancelText:
|
|
373
|
+
ae(te, ve), ae(h, () => {
|
|
374
|
+
G();
|
|
375
|
+
}), ce(() => {
|
|
376
|
+
G(), window.addEventListener("beforeunload", J);
|
|
377
|
+
}), Ue(() => {
|
|
378
|
+
clearTimeout(X), window.removeEventListener("beforeunload", J);
|
|
379
|
+
}), Ge(async () => !E.value || !S.value || (await O(), !E.value) ? !0 : await L({
|
|
380
|
+
title: l("page.leave-title"),
|
|
381
|
+
message: l("page.leave-text"),
|
|
382
|
+
confirmText: l("page.leave"),
|
|
383
|
+
cancelText: l("page.cancel"),
|
|
387
384
|
tone: "danger"
|
|
388
|
-
}))
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
}));
|
|
386
|
+
const Ee = W(() => {
|
|
387
|
+
const y = [];
|
|
388
|
+
return b.value && y.push({ key: "preview", label: l("page.preview"), icon: "eye", href: b.value }), r.value?.url && r.value.status !== "draft" && y.push({ key: "site", label: l("page.open-on-site"), icon: "link", href: r.value.url }), y;
|
|
389
|
+
});
|
|
390
|
+
return (y, Y) => (f(), N("div", {
|
|
391
391
|
class: "wx-page-editor",
|
|
392
|
-
onFocusout:
|
|
392
|
+
onFocusout: he
|
|
393
393
|
}, [
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
M.value || !r.value ? (f(), N(Z, { key: 0 }, [
|
|
395
|
+
v(e(ye), {
|
|
396
396
|
class: "wx-page-editor__ghost",
|
|
397
397
|
title: "",
|
|
398
398
|
rows: 1
|
|
399
399
|
}),
|
|
400
|
-
|
|
401
|
-
], 64)) : (
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
400
|
+
v(e(ye), { rows: 8 })
|
|
401
|
+
], 64)) : (f(), N(Z, { key: 1 }, [
|
|
402
|
+
v(e(Je), {
|
|
403
|
+
divider: "",
|
|
404
|
+
back: u.base,
|
|
405
|
+
"back-label": e(l)("module.title"),
|
|
406
|
+
title: r.value.is_home ? e(l)("pages.home") : de.value || e(l)("page.untitled"),
|
|
407
|
+
actions: Ee.value
|
|
408
|
+
}, {
|
|
409
|
+
trail: i(() => [
|
|
410
|
+
v(e(at), {
|
|
410
411
|
size: "sm",
|
|
411
|
-
label: e(
|
|
412
|
+
label: e(l)("page.trail")
|
|
412
413
|
}, {
|
|
413
|
-
default:
|
|
414
|
-
|
|
414
|
+
default: i(() => [
|
|
415
|
+
v(e(fe), {
|
|
415
416
|
as: "router-link",
|
|
416
417
|
to: u.base
|
|
417
418
|
}, {
|
|
418
|
-
default:
|
|
419
|
-
|
|
419
|
+
default: i(() => [
|
|
420
|
+
$(x(e(l)("module.title")), 1)
|
|
420
421
|
]),
|
|
421
422
|
_: 1
|
|
422
423
|
}, 8, ["to"]),
|
|
423
|
-
(
|
|
424
|
-
key:
|
|
424
|
+
(f(!0), N(Z, null, Ce(pe.value, (D) => (f(), C(e(fe), {
|
|
425
|
+
key: D.id,
|
|
425
426
|
as: "router-link",
|
|
426
|
-
to: `${u.base}/${
|
|
427
|
+
to: `${u.base}/${D.id}`
|
|
427
428
|
}, {
|
|
428
|
-
default:
|
|
429
|
-
|
|
429
|
+
default: i(() => [
|
|
430
|
+
$(x(D.label), 1)
|
|
430
431
|
]),
|
|
431
432
|
_: 2
|
|
432
433
|
}, 1032, ["to"]))), 128)),
|
|
433
|
-
|
|
434
|
-
default:
|
|
435
|
-
|
|
434
|
+
v(e(fe), { current: "" }, {
|
|
435
|
+
default: i(() => [
|
|
436
|
+
$(x(r.value.is_home ? e(l)("pages.home") : de.value), 1)
|
|
436
437
|
]),
|
|
437
438
|
_: 1
|
|
438
439
|
})
|
|
439
440
|
]),
|
|
440
441
|
_: 1
|
|
441
|
-
}, 8, ["label"])
|
|
442
|
-
E("div", Tt, [
|
|
443
|
-
E("span", $t, b(i.value.is_home ? e(a)("pages.home") : ne.value || e(a)("page.untitled")), 1),
|
|
444
|
-
g(e(we), {
|
|
445
|
-
type: Re(),
|
|
446
|
-
dot: ""
|
|
447
|
-
}, {
|
|
448
|
-
default: n(() => [
|
|
449
|
-
y(b(e(a)(`page.status-${i.value.status}`)), 1)
|
|
450
|
-
]),
|
|
451
|
-
_: 1
|
|
452
|
-
}, 8, ["type"])
|
|
453
|
-
])
|
|
442
|
+
}, 8, ["label"])
|
|
454
443
|
]),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
444
|
+
"title-after": i(() => [
|
|
445
|
+
v(e(xe), {
|
|
446
|
+
type: m(),
|
|
447
|
+
dot: ""
|
|
459
448
|
}, {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
type: "more",
|
|
463
|
-
title: e(a)("page.more")
|
|
464
|
-
}, null, 8, ["title"])
|
|
465
|
-
]),
|
|
466
|
-
default: n(() => [
|
|
467
|
-
_.value ? (m(), V(e(We), {
|
|
468
|
-
key: 0,
|
|
469
|
-
icon: "eye",
|
|
470
|
-
href: _.value,
|
|
471
|
-
target: "_blank",
|
|
472
|
-
rel: "noopener"
|
|
473
|
-
}, {
|
|
474
|
-
default: n(() => [
|
|
475
|
-
y(b(e(a)("page.preview")), 1)
|
|
476
|
-
]),
|
|
477
|
-
_: 1
|
|
478
|
-
}, 8, ["href"])) : N("", !0),
|
|
479
|
-
i.value.url && i.value.status !== "draft" ? (m(), V(e(We), {
|
|
480
|
-
key: 1,
|
|
481
|
-
icon: "link",
|
|
482
|
-
href: i.value.url,
|
|
483
|
-
target: "_blank",
|
|
484
|
-
rel: "noopener"
|
|
485
|
-
}, {
|
|
486
|
-
default: n(() => [
|
|
487
|
-
y(b(e(a)("page.open-on-site")), 1)
|
|
488
|
-
]),
|
|
489
|
-
_: 1
|
|
490
|
-
}, 8, ["href"])) : N("", !0)
|
|
449
|
+
default: i(() => [
|
|
450
|
+
$(x(e(l)(`page.status-${r.value.status}`)), 1)
|
|
491
451
|
]),
|
|
492
452
|
_: 1
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
href: _.value,
|
|
499
|
-
target: "_blank",
|
|
500
|
-
rel: "noopener"
|
|
501
|
-
}, {
|
|
502
|
-
default: n(() => [
|
|
503
|
-
y(b(e(a)("page.preview")), 1)
|
|
504
|
-
]),
|
|
505
|
-
_: 1
|
|
506
|
-
}, 8, ["href"])) : N("", !0),
|
|
507
|
-
i.value.url && i.value.status !== "draft" ? (m(), V(e(I), {
|
|
508
|
-
key: 1,
|
|
509
|
-
variant: "outline",
|
|
510
|
-
icon: "link",
|
|
511
|
-
href: i.value.url,
|
|
512
|
-
target: "_blank",
|
|
513
|
-
rel: "noopener"
|
|
514
|
-
}, {
|
|
515
|
-
default: n(() => [
|
|
516
|
-
y(b(e(a)("page.open-on-site")), 1)
|
|
517
|
-
]),
|
|
518
|
-
_: 1
|
|
519
|
-
}, 8, ["href"])) : N("", !0)
|
|
520
|
-
], 64))
|
|
521
|
-
])
|
|
522
|
-
]),
|
|
523
|
-
U.value ? (m(), V(e(xe), {
|
|
453
|
+
}, 8, ["type"])
|
|
454
|
+
]),
|
|
455
|
+
_: 1
|
|
456
|
+
}, 8, ["back", "back-label", "title", "actions"]),
|
|
457
|
+
A.value ? (f(), C(e(ke), {
|
|
524
458
|
key: 0,
|
|
525
459
|
type: "warning",
|
|
526
|
-
title: e(
|
|
527
|
-
description:
|
|
460
|
+
title: e(l)("page.conflict-title"),
|
|
461
|
+
description: A.value.message
|
|
528
462
|
}, {
|
|
529
|
-
actions:
|
|
530
|
-
|
|
463
|
+
actions: i(() => [
|
|
464
|
+
v(e(R), {
|
|
531
465
|
size: "sm",
|
|
532
466
|
variant: "outline",
|
|
533
|
-
onClick:
|
|
467
|
+
onClick: me
|
|
534
468
|
}, {
|
|
535
|
-
default:
|
|
536
|
-
|
|
469
|
+
default: i(() => [
|
|
470
|
+
$(x(e(l)("page.conflict-theirs")), 1)
|
|
537
471
|
]),
|
|
538
472
|
_: 1
|
|
539
473
|
}),
|
|
540
|
-
|
|
474
|
+
v(e(R), {
|
|
541
475
|
size: "sm",
|
|
542
476
|
type: "primary",
|
|
543
|
-
onClick:
|
|
477
|
+
onClick: n
|
|
544
478
|
}, {
|
|
545
|
-
default:
|
|
546
|
-
|
|
479
|
+
default: i(() => [
|
|
480
|
+
$(x(e(l)("page.conflict-mine")), 1)
|
|
547
481
|
]),
|
|
548
482
|
_: 1
|
|
549
483
|
})
|
|
550
484
|
]),
|
|
551
485
|
_: 1
|
|
552
|
-
}, 8, ["title", "description"])) :
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
modelValue:
|
|
556
|
-
"onUpdate:modelValue": Y[0] || (Y[0] = (
|
|
486
|
+
}, 8, ["title", "description"])) : I("", !0),
|
|
487
|
+
K("div", ft, [
|
|
488
|
+
v(e(Qe), {
|
|
489
|
+
modelValue: w.value,
|
|
490
|
+
"onUpdate:modelValue": Y[0] || (Y[0] = (D) => w.value = D),
|
|
557
491
|
name: "pages.form",
|
|
558
492
|
errors: le.value,
|
|
559
|
-
disabled: !
|
|
493
|
+
disabled: !S.value || B.value
|
|
560
494
|
}, null, 8, ["modelValue", "errors", "disabled"])
|
|
561
495
|
]),
|
|
562
|
-
|
|
563
|
-
state:
|
|
564
|
-
|
|
565
|
-
size: "sm",
|
|
566
|
-
tone: "muted"
|
|
567
|
-
}, {
|
|
568
|
-
default: n(() => [
|
|
569
|
-
y(b(e(a)(`page.state-${ge.value}`)), 1)
|
|
570
|
-
]),
|
|
571
|
-
_: 1
|
|
572
|
-
})
|
|
496
|
+
S.value ? (f(), C(e(lt), { key: 1 }, {
|
|
497
|
+
state: i(() => [
|
|
498
|
+
v(e(Xe), { state: ue.value }, null, 8, ["state"])
|
|
573
499
|
]),
|
|
574
|
-
default:
|
|
575
|
-
|
|
500
|
+
default: i(() => [
|
|
501
|
+
v(e(R), {
|
|
576
502
|
variant: "outline",
|
|
577
|
-
loading:
|
|
578
|
-
disabled: !
|
|
579
|
-
onClick:
|
|
503
|
+
loading: P.value,
|
|
504
|
+
disabled: !E.value,
|
|
505
|
+
onClick: O
|
|
580
506
|
}, {
|
|
581
|
-
default:
|
|
582
|
-
|
|
507
|
+
default: i(() => [
|
|
508
|
+
$(x(e(l)("page.save")), 1)
|
|
583
509
|
]),
|
|
584
510
|
_: 1
|
|
585
511
|
}, 8, ["loading", "disabled"]),
|
|
586
|
-
|
|
512
|
+
v(e(R), {
|
|
587
513
|
type: "primary",
|
|
588
|
-
loading:
|
|
589
|
-
disabled:
|
|
590
|
-
onClick:
|
|
514
|
+
loading: B.value,
|
|
515
|
+
disabled: r.value.status === "published" && !E.value,
|
|
516
|
+
onClick: T
|
|
591
517
|
}, {
|
|
592
|
-
default:
|
|
593
|
-
|
|
518
|
+
default: i(() => [
|
|
519
|
+
$(x(e(l)("page.publish")), 1)
|
|
594
520
|
]),
|
|
595
521
|
_: 1
|
|
596
522
|
}, 8, ["loading", "disabled"])
|
|
597
523
|
]),
|
|
598
524
|
_: 1
|
|
599
|
-
})) :
|
|
525
|
+
})) : I("", !0)
|
|
600
526
|
], 64))
|
|
601
|
-
],
|
|
527
|
+
], 32));
|
|
602
528
|
}
|
|
603
|
-
}),
|
|
529
|
+
}), wt = /* @__PURE__ */ oe(yt, [["__scopeId", "data-v-653d5926"]]), _t = { class: "wx-page-history" }, xt = { class: "wx-page-history__number" }, kt = { class: "wx-page-history__who" }, Tt = /* @__PURE__ */ F({
|
|
604
530
|
name: "WxPageHistory",
|
|
605
531
|
__name: "PageHistory",
|
|
606
532
|
setup(u) {
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
const s =
|
|
533
|
+
const o = Q(), g = q(o), a = Te();
|
|
534
|
+
j();
|
|
535
|
+
const s = H("webx-pages"), t = ie(), d = _(null), l = _(!1), c = W(() => a?.page.value ?? null), h = W(() => o.can("pages.manage")), r = W(
|
|
610
536
|
() => c.value?.published_at ? d.value?.[0]?.number ?? null : null
|
|
611
537
|
);
|
|
612
|
-
async function
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
538
|
+
async function k() {
|
|
539
|
+
const z = c.value;
|
|
540
|
+
if (z)
|
|
615
541
|
try {
|
|
616
|
-
d.value = await
|
|
617
|
-
} catch (
|
|
618
|
-
d.value = [],
|
|
542
|
+
d.value = await g.versions(z.id);
|
|
543
|
+
} catch (b) {
|
|
544
|
+
d.value = [], V.danger(t(b));
|
|
619
545
|
}
|
|
620
546
|
}
|
|
621
|
-
async function
|
|
622
|
-
const
|
|
623
|
-
if (!(!
|
|
624
|
-
title: s("page.restore-title", { number:
|
|
547
|
+
async function w(z) {
|
|
548
|
+
const b = c.value;
|
|
549
|
+
if (!(!b || !await L({
|
|
550
|
+
title: s("page.restore-title", { number: z.number }),
|
|
625
551
|
message: s("page.restore-text"),
|
|
626
552
|
confirmText: s("page.restore"),
|
|
627
553
|
cancelText: s("page.cancel")
|
|
628
554
|
}))) {
|
|
629
|
-
|
|
555
|
+
l.value = !0;
|
|
630
556
|
try {
|
|
631
|
-
await
|
|
632
|
-
} catch (
|
|
633
|
-
|
|
557
|
+
await g.restoreVersion(b.id, z.number), await a?.reload(), V.success(s("page.restored-version", { number: z.number }));
|
|
558
|
+
} catch (M) {
|
|
559
|
+
V.danger(t(M));
|
|
634
560
|
} finally {
|
|
635
|
-
|
|
561
|
+
l.value = !1;
|
|
636
562
|
}
|
|
637
563
|
}
|
|
638
564
|
}
|
|
639
565
|
return ae(
|
|
640
566
|
() => [c.value?.id, c.value?.published_at, c.value?.updated_at],
|
|
641
567
|
() => {
|
|
642
|
-
|
|
568
|
+
k();
|
|
643
569
|
},
|
|
644
570
|
{
|
|
645
571
|
immediate: !0
|
|
646
572
|
}
|
|
647
|
-
), (
|
|
648
|
-
d.value === null ? (
|
|
573
|
+
), (z, b) => (f(), N("div", _t, [
|
|
574
|
+
d.value === null ? (f(), C(e(ye), {
|
|
649
575
|
key: 0,
|
|
650
576
|
class: "wx-page-history__ghost",
|
|
651
577
|
rows: 3
|
|
652
|
-
})) : d.value.length === 0 ? (
|
|
578
|
+
})) : d.value.length === 0 ? (f(), C(e(st), {
|
|
653
579
|
key: 1,
|
|
654
580
|
description: e(s)("page.history-empty")
|
|
655
|
-
}, null, 8, ["description"])) : (
|
|
581
|
+
}, null, 8, ["description"])) : (f(!0), N(Z, { key: 2 }, Ce(d.value, (p) => (f(), N("div", {
|
|
656
582
|
key: p.number,
|
|
657
|
-
class:
|
|
583
|
+
class: Re(["wx-page-history__row", { "is-live": p.number === r.value }])
|
|
658
584
|
}, [
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
p.created_at ? (
|
|
585
|
+
K("code", xt, x(e(s)("page.version", { number: p.number })), 1),
|
|
586
|
+
K("div", kt, [
|
|
587
|
+
p.created_at ? (f(), C(e(be), {
|
|
662
588
|
key: 0,
|
|
663
589
|
value: p.created_at,
|
|
664
590
|
size: "md",
|
|
665
591
|
tone: "default"
|
|
666
|
-
}, null, 8, ["value"])) :
|
|
667
|
-
|
|
592
|
+
}, null, 8, ["value"])) : I("", !0),
|
|
593
|
+
v(e(U), {
|
|
668
594
|
size: "sm",
|
|
669
595
|
tone: "muted"
|
|
670
596
|
}, {
|
|
671
|
-
default:
|
|
672
|
-
|
|
673
|
-
p.comment ? (
|
|
674
|
-
|
|
675
|
-
], 64)) :
|
|
597
|
+
default: i(() => [
|
|
598
|
+
$(x(p.author ?? e(s)(`page.source-${p.source}`)) + " ", 1),
|
|
599
|
+
p.comment ? (f(), N(Z, { key: 0 }, [
|
|
600
|
+
$(" · " + x(p.comment), 1)
|
|
601
|
+
], 64)) : I("", !0)
|
|
676
602
|
]),
|
|
677
603
|
_: 2
|
|
678
604
|
}, 1024)
|
|
679
605
|
]),
|
|
680
|
-
p.number ===
|
|
606
|
+
p.number === r.value ? (f(), C(e(xe), {
|
|
681
607
|
key: 0,
|
|
682
608
|
type: "success",
|
|
683
609
|
dot: ""
|
|
684
610
|
}, {
|
|
685
|
-
default:
|
|
686
|
-
|
|
611
|
+
default: i(() => [
|
|
612
|
+
$(x(e(s)("page.version-live")), 1)
|
|
687
613
|
]),
|
|
688
614
|
_: 1
|
|
689
|
-
})) :
|
|
690
|
-
|
|
615
|
+
})) : I("", !0),
|
|
616
|
+
h.value && p.number !== r.value ? (f(), C(e(R), {
|
|
691
617
|
key: 1,
|
|
692
618
|
size: "sm",
|
|
693
619
|
variant: "outline",
|
|
694
|
-
loading:
|
|
695
|
-
onClick: (
|
|
620
|
+
loading: l.value,
|
|
621
|
+
onClick: (M) => w(p)
|
|
696
622
|
}, {
|
|
697
|
-
default:
|
|
698
|
-
|
|
623
|
+
default: i(() => [
|
|
624
|
+
$(x(e(s)("page.restore")), 1)
|
|
699
625
|
]),
|
|
700
626
|
_: 1
|
|
701
|
-
}, 8, ["loading", "onClick"])) :
|
|
627
|
+
}, 8, ["loading", "onClick"])) : I("", !0)
|
|
702
628
|
], 2))), 128))
|
|
703
629
|
]));
|
|
704
630
|
}
|
|
705
|
-
}),
|
|
631
|
+
}), $t = /* @__PURE__ */ oe(Tt, [["__scopeId", "data-v-41bcd106"]]), $e = /* @__PURE__ */ F({
|
|
706
632
|
__name: "PagePicker",
|
|
707
|
-
props: /* @__PURE__ */
|
|
633
|
+
props: /* @__PURE__ */ Oe({
|
|
708
634
|
exclude: { default: () => [] },
|
|
709
635
|
placeholder: { default: void 0 },
|
|
710
636
|
selected: { default: () => [] }
|
|
@@ -714,182 +640,182 @@ const ht = { class: "wx-page-danger" }, ft = {
|
|
|
714
640
|
}),
|
|
715
641
|
emits: ["update:modelValue"],
|
|
716
642
|
setup(u) {
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
const t =
|
|
720
|
-
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
643
|
+
const o = u, g = Le(u, "modelValue"), a = Q(), s = q(a);
|
|
644
|
+
j();
|
|
645
|
+
const t = H("webx-pages"), d = _([]);
|
|
646
|
+
ce(async () => {
|
|
647
|
+
const h = await s.list();
|
|
648
|
+
h.home && (d.value = [
|
|
649
|
+
l(
|
|
650
|
+
h.home,
|
|
651
|
+
h.items.map((r) => l(r))
|
|
726
652
|
)
|
|
727
653
|
]);
|
|
728
654
|
});
|
|
729
|
-
function
|
|
655
|
+
function l(h, r) {
|
|
730
656
|
return {
|
|
731
|
-
id:
|
|
732
|
-
label:
|
|
733
|
-
disabled:
|
|
734
|
-
leaf:
|
|
735
|
-
...
|
|
657
|
+
id: h.id,
|
|
658
|
+
label: h.is_home ? t("pages.home") : h.title,
|
|
659
|
+
disabled: o.exclude.includes(h.id),
|
|
660
|
+
leaf: h.children_count === 0,
|
|
661
|
+
...r ? { children: r } : {}
|
|
736
662
|
};
|
|
737
663
|
}
|
|
738
|
-
async function c(
|
|
739
|
-
return (await s.list({ parent: Number(
|
|
664
|
+
async function c(h) {
|
|
665
|
+
return (await s.list({ parent: Number(h.id) })).items.map((k) => l(k));
|
|
740
666
|
}
|
|
741
|
-
return (
|
|
742
|
-
modelValue:
|
|
743
|
-
"onUpdate:modelValue":
|
|
667
|
+
return (h, r) => (f(), C(e(nt), {
|
|
668
|
+
modelValue: g.value,
|
|
669
|
+
"onUpdate:modelValue": r[0] || (r[0] = (k) => g.value = k),
|
|
744
670
|
nodes: d.value,
|
|
745
671
|
lazy: "",
|
|
746
672
|
load: c,
|
|
747
673
|
"show-path": "",
|
|
748
674
|
clearable: "",
|
|
749
|
-
"selected-path":
|
|
750
|
-
id:
|
|
751
|
-
label:
|
|
675
|
+
"selected-path": o.selected.map((k) => ({
|
|
676
|
+
id: k.id,
|
|
677
|
+
label: k.is_home ? e(t)("pages.home") : k.title
|
|
752
678
|
})),
|
|
753
|
-
placeholder:
|
|
679
|
+
placeholder: o.placeholder ?? e(t)("page.field-parent"),
|
|
754
680
|
"aria-label": e(t)("page.field-parent"),
|
|
755
681
|
teleport: ""
|
|
756
682
|
}, null, 8, ["modelValue", "nodes", "selected-path", "placeholder", "aria-label"]));
|
|
757
683
|
}
|
|
758
|
-
}),
|
|
684
|
+
}), Pt = {
|
|
759
685
|
key: 0,
|
|
760
686
|
class: "wx-page-place"
|
|
761
|
-
},
|
|
687
|
+
}, Wt = /* @__PURE__ */ F({
|
|
762
688
|
name: "WxPagePlace",
|
|
763
689
|
__name: "PagePlace",
|
|
764
690
|
setup(u) {
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
const t =
|
|
768
|
-
const
|
|
769
|
-
return typeof
|
|
770
|
-
}),
|
|
691
|
+
const o = Q(), g = q(o), a = Te(), s = Se();
|
|
692
|
+
j();
|
|
693
|
+
const t = H("webx-pages"), d = ie(), l = _(!1), c = _(null), h = W(() => a?.page.value ?? null), r = W(() => a?.ancestors.value.length === 0 ? null : a?.prefixes.value[s.active.value] ?? null), k = W(() => {
|
|
694
|
+
const b = a?.values.value.slug;
|
|
695
|
+
return typeof b == "string" ? b : b?.[s.active.value] ?? "";
|
|
696
|
+
}), w = W(() => h.value?.is_home ? "/" : r.value === null || k.value === "" ? null : `/${[r.value, k.value].filter(Boolean).join("/")}`);
|
|
771
697
|
ae(
|
|
772
|
-
|
|
773
|
-
(
|
|
774
|
-
c.value =
|
|
698
|
+
h,
|
|
699
|
+
(b) => {
|
|
700
|
+
c.value = b?.parent_id ?? null;
|
|
775
701
|
},
|
|
776
702
|
{ immediate: !0 }
|
|
777
703
|
);
|
|
778
|
-
async function
|
|
779
|
-
const p =
|
|
780
|
-
if (!p ||
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
704
|
+
async function z(b) {
|
|
705
|
+
const p = h.value;
|
|
706
|
+
if (!p || b === null || b === p.parent_id || l.value) return;
|
|
707
|
+
const M = p.descendants_count + 1;
|
|
708
|
+
if (M > 1 && !await L({
|
|
783
709
|
title: t("page.move-title", { title: p.title }),
|
|
784
|
-
message: t("page.move-branch", { count:
|
|
710
|
+
message: t("page.move-branch", { count: M }),
|
|
785
711
|
confirmText: t("page.move-confirm"),
|
|
786
712
|
cancelText: t("page.cancel")
|
|
787
713
|
})) {
|
|
788
714
|
c.value = p.parent_id;
|
|
789
715
|
return;
|
|
790
716
|
}
|
|
791
|
-
|
|
717
|
+
l.value = !0;
|
|
792
718
|
try {
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
), await
|
|
797
|
-
} catch (
|
|
798
|
-
|
|
719
|
+
const P = await g.move(p.id, b, "inside");
|
|
720
|
+
V.success(
|
|
721
|
+
P.addresses_changed > 1 ? t("page.moved", { count: P.addresses_changed }) : t("page.moved-one")
|
|
722
|
+
), await a?.reload();
|
|
723
|
+
} catch (P) {
|
|
724
|
+
V.danger(d(P)), c.value = p.parent_id;
|
|
799
725
|
} finally {
|
|
800
|
-
|
|
726
|
+
l.value = !1;
|
|
801
727
|
}
|
|
802
728
|
}
|
|
803
|
-
return (
|
|
804
|
-
|
|
729
|
+
return (b, p) => h.value ? (f(), N("div", Pt, [
|
|
730
|
+
v(e(ne), {
|
|
805
731
|
label: e(t)("page.address")
|
|
806
732
|
}, {
|
|
807
|
-
default:
|
|
808
|
-
|
|
733
|
+
default: i(() => [
|
|
734
|
+
w.value ? (f(), C(e(U), {
|
|
809
735
|
key: 0,
|
|
810
736
|
mono: "",
|
|
811
737
|
class: "wx-page-place__address"
|
|
812
738
|
}, {
|
|
813
|
-
default:
|
|
814
|
-
|
|
739
|
+
default: i(() => [
|
|
740
|
+
$(x(w.value), 1)
|
|
815
741
|
]),
|
|
816
742
|
_: 1
|
|
817
|
-
})) : (
|
|
743
|
+
})) : (f(), C(e(U), {
|
|
818
744
|
key: 1,
|
|
819
745
|
size: "sm",
|
|
820
746
|
tone: "muted"
|
|
821
747
|
}, {
|
|
822
|
-
default:
|
|
823
|
-
|
|
748
|
+
default: i(() => [
|
|
749
|
+
$(x(e(t)("page.no-address")), 1)
|
|
824
750
|
]),
|
|
825
751
|
_: 1
|
|
826
752
|
}))
|
|
827
753
|
]),
|
|
828
754
|
_: 1
|
|
829
755
|
}, 8, ["label"]),
|
|
830
|
-
|
|
831
|
-
|
|
756
|
+
h.value.can.move ? (f(), N(Z, { key: 0 }, [
|
|
757
|
+
v(e(ne), {
|
|
832
758
|
label: e(t)("page.field-parent"),
|
|
833
759
|
help: e(t)("page.parent-help")
|
|
834
760
|
}, {
|
|
835
|
-
default:
|
|
836
|
-
|
|
761
|
+
default: i(() => [
|
|
762
|
+
v($e, {
|
|
837
763
|
modelValue: c.value,
|
|
838
764
|
"onUpdate:modelValue": [
|
|
839
|
-
p[0] || (p[0] = (
|
|
840
|
-
|
|
765
|
+
p[0] || (p[0] = (M) => c.value = M),
|
|
766
|
+
z
|
|
841
767
|
],
|
|
842
|
-
exclude: [
|
|
843
|
-
selected: e(
|
|
768
|
+
exclude: [h.value.id],
|
|
769
|
+
selected: e(a)?.ancestors.value ?? []
|
|
844
770
|
}, null, 8, ["modelValue", "exclude", "selected"])
|
|
845
771
|
]),
|
|
846
772
|
_: 1
|
|
847
773
|
}, 8, ["label", "help"]),
|
|
848
|
-
|
|
774
|
+
v(e(ke), {
|
|
849
775
|
type: "info",
|
|
850
776
|
variant: "soft",
|
|
851
777
|
description: e(t)("page.parent-warning")
|
|
852
778
|
}, null, 8, ["description"])
|
|
853
|
-
], 64)) :
|
|
854
|
-
])) :
|
|
779
|
+
], 64)) : I("", !0)
|
|
780
|
+
])) : I("", !0);
|
|
855
781
|
}
|
|
856
|
-
}),
|
|
782
|
+
}), Vt = /* @__PURE__ */ oe(Wt, [["__scopeId", "data-v-bf094be2"]]), zt = /* @__PURE__ */ F({
|
|
857
783
|
__name: "PageActions",
|
|
858
784
|
props: {
|
|
859
785
|
page: {},
|
|
860
786
|
inBin: { type: Boolean, default: !1 }
|
|
861
787
|
},
|
|
862
788
|
emits: ["open", "add", "duplicate", "move", "copy", "remove", "restore"],
|
|
863
|
-
setup(u, { emit:
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
const s =
|
|
867
|
-
const d =
|
|
868
|
-
if (
|
|
789
|
+
setup(u, { emit: o }) {
|
|
790
|
+
const g = u, a = o;
|
|
791
|
+
j();
|
|
792
|
+
const s = H("webx-pages"), t = W(() => {
|
|
793
|
+
const d = g.page;
|
|
794
|
+
if (g.inBin)
|
|
869
795
|
return [
|
|
870
796
|
{
|
|
871
797
|
key: "restore",
|
|
872
798
|
icon: "refresh",
|
|
873
799
|
label: s("page.restore"),
|
|
874
|
-
run: () =>
|
|
800
|
+
run: () => a("restore", d)
|
|
875
801
|
}
|
|
876
802
|
];
|
|
877
|
-
const
|
|
878
|
-
{ key: "open", icon: "edit", label: s("page.open"), run: () =>
|
|
879
|
-
{ key: "add", icon: "plus", label: s("page.add-child"), run: () =>
|
|
803
|
+
const l = [
|
|
804
|
+
{ key: "open", icon: "edit", label: s("page.open"), run: () => a("open", d) },
|
|
805
|
+
{ key: "add", icon: "plus", label: s("page.add-child"), run: () => a("add", d) }
|
|
880
806
|
];
|
|
881
|
-
return d.is_home ||
|
|
807
|
+
return d.is_home || l.push({
|
|
882
808
|
key: "duplicate",
|
|
883
809
|
icon: "copy",
|
|
884
810
|
label: s("page.duplicate"),
|
|
885
|
-
run: () =>
|
|
886
|
-
}), d.can.move &&
|
|
811
|
+
run: () => a("duplicate", d)
|
|
812
|
+
}), d.can.move && l.push({ key: "move", icon: "drag", label: s("page.move"), run: () => a("move", d) }), l.push(
|
|
887
813
|
{
|
|
888
814
|
key: "copy-address",
|
|
889
815
|
icon: "link",
|
|
890
816
|
label: s("page.copy-address"),
|
|
891
817
|
disabled: !d.url,
|
|
892
|
-
run: () =>
|
|
818
|
+
run: () => a("copy", d)
|
|
893
819
|
},
|
|
894
820
|
{
|
|
895
821
|
key: "on-site",
|
|
@@ -898,20 +824,20 @@ const ht = { class: "wx-page-danger" }, ft = {
|
|
|
898
824
|
disabled: !d.url,
|
|
899
825
|
href: d.url ?? void 0
|
|
900
826
|
}
|
|
901
|
-
), d.can.delete &&
|
|
827
|
+
), d.can.delete && l.push({
|
|
902
828
|
key: "delete",
|
|
903
829
|
icon: "trash",
|
|
904
830
|
label: s("page.delete"),
|
|
905
831
|
danger: !0,
|
|
906
|
-
run: () =>
|
|
907
|
-
}),
|
|
832
|
+
run: () => a("remove", d)
|
|
833
|
+
}), l;
|
|
908
834
|
});
|
|
909
|
-
return (d,
|
|
835
|
+
return (d, l) => (f(), C(e(Ye), {
|
|
910
836
|
actions: t.value,
|
|
911
|
-
label:
|
|
837
|
+
label: g.page.title
|
|
912
838
|
}, null, 8, ["actions", "label"]));
|
|
913
839
|
}
|
|
914
|
-
}),
|
|
840
|
+
}), Ct = {
|
|
915
841
|
а: "a",
|
|
916
842
|
б: "b",
|
|
917
843
|
в: "v",
|
|
@@ -970,67 +896,67 @@ const ht = { class: "wx-page-danger" }, ft = {
|
|
|
970
896
|
ź: "z",
|
|
971
897
|
ż: "z"
|
|
972
898
|
};
|
|
973
|
-
function
|
|
974
|
-
return u.toLowerCase().split("").map((
|
|
899
|
+
function Mt(u) {
|
|
900
|
+
return u.toLowerCase().split("").map((o) => Ct[o] ?? o).join("").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
975
901
|
}
|
|
976
|
-
const
|
|
902
|
+
const St = /* @__PURE__ */ F({
|
|
977
903
|
__name: "PageCreateDialog",
|
|
978
904
|
props: {
|
|
979
905
|
parent: { default: null }
|
|
980
906
|
},
|
|
981
907
|
setup(u) {
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
ae(c, (
|
|
986
|
-
|
|
987
|
-
}),
|
|
988
|
-
await
|
|
908
|
+
const o = u, { open: g, resolve: a, dismiss: s } = Be(), t = Q(), d = q(t);
|
|
909
|
+
j();
|
|
910
|
+
const l = H("webx-pages"), c = _(""), h = _(""), r = _(o.parent?.id ?? null), k = _(!1), w = _({}), z = Ke("field"), b = _(!1);
|
|
911
|
+
ae(c, (M) => {
|
|
912
|
+
b.value || (h.value = Mt(M));
|
|
913
|
+
}), ce(async () => {
|
|
914
|
+
await Fe(), z.value?.querySelector("input")?.focus();
|
|
989
915
|
});
|
|
990
916
|
async function p() {
|
|
991
|
-
if (!(c.value.trim() === "" ||
|
|
992
|
-
|
|
917
|
+
if (!(c.value.trim() === "" || k.value)) {
|
|
918
|
+
k.value = !0, w.value = {};
|
|
993
919
|
try {
|
|
994
|
-
|
|
920
|
+
a(
|
|
995
921
|
await d.create({
|
|
996
922
|
title: c.value.trim(),
|
|
997
|
-
slug:
|
|
998
|
-
parent_id:
|
|
923
|
+
slug: h.value.trim(),
|
|
924
|
+
parent_id: r.value
|
|
999
925
|
})
|
|
1000
926
|
);
|
|
1001
|
-
} catch (
|
|
1002
|
-
|
|
927
|
+
} catch (M) {
|
|
928
|
+
w.value = M.body?.errors ?? {};
|
|
1003
929
|
} finally {
|
|
1004
|
-
|
|
930
|
+
k.value = !1;
|
|
1005
931
|
}
|
|
1006
932
|
}
|
|
1007
933
|
}
|
|
1008
|
-
return (
|
|
1009
|
-
open: e(
|
|
1010
|
-
"onUpdate:open":
|
|
1011
|
-
title: e(
|
|
934
|
+
return (M, P) => (f(), C(e(De), {
|
|
935
|
+
open: e(g),
|
|
936
|
+
"onUpdate:open": P[5] || (P[5] = (B) => Me(g) ? g.value = B : null),
|
|
937
|
+
title: e(l)("page.new-title"),
|
|
1012
938
|
width: 460
|
|
1013
939
|
}, {
|
|
1014
|
-
footer:
|
|
1015
|
-
|
|
1016
|
-
default:
|
|
1017
|
-
|
|
940
|
+
footer: i(() => [
|
|
941
|
+
v(e(we), { size: "sm" }, {
|
|
942
|
+
default: i(() => [
|
|
943
|
+
v(e(R), {
|
|
1018
944
|
variant: "outline",
|
|
1019
|
-
onClick:
|
|
945
|
+
onClick: P[4] || (P[4] = (B) => e(s)())
|
|
1020
946
|
}, {
|
|
1021
|
-
default:
|
|
1022
|
-
|
|
947
|
+
default: i(() => [
|
|
948
|
+
$(x(e(l)("page.cancel")), 1)
|
|
1023
949
|
]),
|
|
1024
950
|
_: 1
|
|
1025
951
|
}),
|
|
1026
|
-
|
|
952
|
+
v(e(R), {
|
|
1027
953
|
type: "primary",
|
|
1028
|
-
loading:
|
|
954
|
+
loading: k.value,
|
|
1029
955
|
disabled: c.value.trim() === "",
|
|
1030
956
|
onClick: p
|
|
1031
957
|
}, {
|
|
1032
|
-
default:
|
|
1033
|
-
|
|
958
|
+
default: i(() => [
|
|
959
|
+
$(x(e(l)("page.create")), 1)
|
|
1034
960
|
]),
|
|
1035
961
|
_: 1
|
|
1036
962
|
}, 8, ["loading", "disabled"])
|
|
@@ -1038,52 +964,52 @@ const Kt = /* @__PURE__ */ K({
|
|
|
1038
964
|
_: 1
|
|
1039
965
|
})
|
|
1040
966
|
]),
|
|
1041
|
-
default:
|
|
1042
|
-
|
|
1043
|
-
label: e(
|
|
1044
|
-
error:
|
|
967
|
+
default: i(() => [
|
|
968
|
+
v(e(ne), {
|
|
969
|
+
label: e(l)("page.field-title"),
|
|
970
|
+
error: w.value.title?.[0],
|
|
1045
971
|
required: ""
|
|
1046
972
|
}, {
|
|
1047
|
-
default:
|
|
1048
|
-
|
|
973
|
+
default: i(() => [
|
|
974
|
+
K("div", {
|
|
1049
975
|
ref_key: "field",
|
|
1050
|
-
ref:
|
|
976
|
+
ref: z
|
|
1051
977
|
}, [
|
|
1052
|
-
|
|
978
|
+
v(e(We), {
|
|
1053
979
|
modelValue: c.value,
|
|
1054
|
-
"onUpdate:modelValue":
|
|
1055
|
-
"aria-label": e(
|
|
980
|
+
"onUpdate:modelValue": P[0] || (P[0] = (B) => c.value = B),
|
|
981
|
+
"aria-label": e(l)("page.field-title"),
|
|
1056
982
|
onKeyup: Pe(p, ["enter"])
|
|
1057
983
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1058
984
|
], 512)
|
|
1059
985
|
]),
|
|
1060
986
|
_: 1
|
|
1061
987
|
}, 8, ["label", "error"]),
|
|
1062
|
-
|
|
1063
|
-
label: e(
|
|
1064
|
-
error:
|
|
1065
|
-
help: e(
|
|
988
|
+
v(e(ne), {
|
|
989
|
+
label: e(l)("page.field-slug"),
|
|
990
|
+
error: w.value.slug?.[0],
|
|
991
|
+
help: e(l)("page.slug-help")
|
|
1066
992
|
}, {
|
|
1067
|
-
default:
|
|
1068
|
-
|
|
1069
|
-
modelValue:
|
|
1070
|
-
"onUpdate:modelValue":
|
|
1071
|
-
"aria-label": e(
|
|
1072
|
-
onInput:
|
|
993
|
+
default: i(() => [
|
|
994
|
+
v(e(We), {
|
|
995
|
+
modelValue: h.value,
|
|
996
|
+
"onUpdate:modelValue": P[1] || (P[1] = (B) => h.value = B),
|
|
997
|
+
"aria-label": e(l)("page.field-slug"),
|
|
998
|
+
onInput: P[2] || (P[2] = (B) => b.value = !0),
|
|
1073
999
|
onKeyup: Pe(p, ["enter"])
|
|
1074
1000
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1075
1001
|
]),
|
|
1076
1002
|
_: 1
|
|
1077
1003
|
}, 8, ["label", "error", "help"]),
|
|
1078
|
-
|
|
1079
|
-
label: e(
|
|
1080
|
-
error:
|
|
1004
|
+
v(e(ne), {
|
|
1005
|
+
label: e(l)("page.field-parent"),
|
|
1006
|
+
error: w.value.parent_id?.[0]
|
|
1081
1007
|
}, {
|
|
1082
|
-
default:
|
|
1083
|
-
|
|
1084
|
-
modelValue:
|
|
1085
|
-
"onUpdate:modelValue":
|
|
1086
|
-
selected:
|
|
1008
|
+
default: i(() => [
|
|
1009
|
+
v($e, {
|
|
1010
|
+
modelValue: r.value,
|
|
1011
|
+
"onUpdate:modelValue": P[3] || (P[3] = (B) => r.value = B),
|
|
1012
|
+
selected: o.parent ? [o.parent] : []
|
|
1087
1013
|
}, null, 8, ["modelValue", "selected"])
|
|
1088
1014
|
]),
|
|
1089
1015
|
_: 1
|
|
@@ -1092,40 +1018,40 @@ const Kt = /* @__PURE__ */ K({
|
|
|
1092
1018
|
_: 1
|
|
1093
1019
|
}, 8, ["open", "title"]));
|
|
1094
1020
|
}
|
|
1095
|
-
}),
|
|
1021
|
+
}), Bt = /* @__PURE__ */ F({
|
|
1096
1022
|
__name: "PageMoveDialog",
|
|
1097
1023
|
props: {
|
|
1098
1024
|
page: {}
|
|
1099
1025
|
},
|
|
1100
1026
|
setup(u) {
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
const t =
|
|
1104
|
-
return (
|
|
1105
|
-
open: e(
|
|
1106
|
-
"onUpdate:open": c[3] || (c[3] = (
|
|
1107
|
-
title: e(t)("page.move-title", { title:
|
|
1027
|
+
const o = u, { open: g, resolve: a, dismiss: s } = Be();
|
|
1028
|
+
j();
|
|
1029
|
+
const t = H("webx-pages"), d = _(o.page.parent_id);
|
|
1030
|
+
return (l, c) => (f(), C(e(De), {
|
|
1031
|
+
open: e(g),
|
|
1032
|
+
"onUpdate:open": c[3] || (c[3] = (h) => Me(g) ? g.value = h : null),
|
|
1033
|
+
title: e(t)("page.move-title", { title: o.page.title }),
|
|
1108
1034
|
width: 460
|
|
1109
1035
|
}, {
|
|
1110
|
-
footer:
|
|
1111
|
-
|
|
1112
|
-
default:
|
|
1113
|
-
|
|
1036
|
+
footer: i(() => [
|
|
1037
|
+
v(e(we), { size: "sm" }, {
|
|
1038
|
+
default: i(() => [
|
|
1039
|
+
v(e(R), {
|
|
1114
1040
|
variant: "outline",
|
|
1115
|
-
onClick: c[1] || (c[1] = (
|
|
1041
|
+
onClick: c[1] || (c[1] = (h) => e(s)())
|
|
1116
1042
|
}, {
|
|
1117
|
-
default:
|
|
1118
|
-
|
|
1043
|
+
default: i(() => [
|
|
1044
|
+
$(x(e(t)("page.cancel")), 1)
|
|
1119
1045
|
]),
|
|
1120
1046
|
_: 1
|
|
1121
1047
|
}),
|
|
1122
|
-
|
|
1048
|
+
v(e(R), {
|
|
1123
1049
|
type: "primary",
|
|
1124
|
-
disabled: d.value === null || d.value ===
|
|
1125
|
-
onClick: c[2] || (c[2] = (
|
|
1050
|
+
disabled: d.value === null || d.value === o.page.parent_id,
|
|
1051
|
+
onClick: c[2] || (c[2] = (h) => e(a)(d.value))
|
|
1126
1052
|
}, {
|
|
1127
|
-
default:
|
|
1128
|
-
|
|
1053
|
+
default: i(() => [
|
|
1054
|
+
$(x(e(t)("page.move-confirm")), 1)
|
|
1129
1055
|
]),
|
|
1130
1056
|
_: 1
|
|
1131
1057
|
}, 8, ["disabled"])
|
|
@@ -1133,22 +1059,22 @@ const Kt = /* @__PURE__ */ K({
|
|
|
1133
1059
|
_: 1
|
|
1134
1060
|
})
|
|
1135
1061
|
]),
|
|
1136
|
-
default:
|
|
1137
|
-
|
|
1062
|
+
default: i(() => [
|
|
1063
|
+
v(e(we), {
|
|
1138
1064
|
direction: "vertical",
|
|
1139
1065
|
size: "md",
|
|
1140
1066
|
fill: ""
|
|
1141
1067
|
}, {
|
|
1142
|
-
default:
|
|
1143
|
-
|
|
1068
|
+
default: i(() => [
|
|
1069
|
+
v(e(ke), {
|
|
1144
1070
|
type: "info",
|
|
1145
1071
|
variant: "soft",
|
|
1146
1072
|
description: e(t)("page.move-help")
|
|
1147
1073
|
}, null, 8, ["description"]),
|
|
1148
|
-
|
|
1074
|
+
v($e, {
|
|
1149
1075
|
modelValue: d.value,
|
|
1150
|
-
"onUpdate:modelValue": c[0] || (c[0] = (
|
|
1151
|
-
exclude: [
|
|
1076
|
+
"onUpdate:modelValue": c[0] || (c[0] = (h) => d.value = h),
|
|
1077
|
+
exclude: [o.page.id]
|
|
1152
1078
|
}, null, 8, ["modelValue", "exclude"])
|
|
1153
1079
|
]),
|
|
1154
1080
|
_: 1
|
|
@@ -1157,25 +1083,25 @@ const Kt = /* @__PURE__ */ K({
|
|
|
1157
1083
|
_: 1
|
|
1158
1084
|
}, 8, ["open", "title"]));
|
|
1159
1085
|
}
|
|
1160
|
-
}),
|
|
1086
|
+
}), Dt = { class: "wx-pages" }, Nt = { class: "wx-pages__title" }, Et = ["href"], At = /* @__PURE__ */ F({
|
|
1161
1087
|
__name: "PagesPage",
|
|
1162
1088
|
props: {
|
|
1163
1089
|
base: { default: "/pages" }
|
|
1164
1090
|
},
|
|
1165
1091
|
setup(u) {
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
const t =
|
|
1169
|
-
() =>
|
|
1170
|
-
),
|
|
1092
|
+
const o = u, g = Q(), a = q(g), s = _e();
|
|
1093
|
+
j();
|
|
1094
|
+
const t = H("webx-pages"), d = ie(), l = _(null), c = _([]), h = _(!0), r = _(""), k = _(""), w = Ve(St), z = Ve(Bt), b = W(() => g.can("pages.manage")), p = W(() => k.value === "trashed"), M = W(() => !p.value && r.value.trim() === ""), P = W(
|
|
1095
|
+
() => g.state.manifest?.modules.find((n) => n.id === "pages")?.title ?? t("module.title")
|
|
1096
|
+
), B = W(() => [
|
|
1171
1097
|
{ value: "", label: t("page.filter-all") },
|
|
1172
1098
|
{ value: "draft", label: t("page.filter-draft") },
|
|
1173
1099
|
{ value: "published", label: t("page.filter-published") },
|
|
1174
1100
|
{ value: "modified", label: t("page.filter-modified") },
|
|
1175
1101
|
{ value: "trashed", label: t("page.bin"), icon: "trash" }
|
|
1176
1102
|
]), le = W(
|
|
1177
|
-
() =>
|
|
1178
|
-
),
|
|
1103
|
+
() => M.value && l.value ? [{ ...l.value, children_count: 0 }, ...c.value] : c.value
|
|
1104
|
+
), A = W(() => [
|
|
1179
1105
|
{ key: "title", label: t("page.column-title"), minWidth: 200 },
|
|
1180
1106
|
{ key: "path", label: t("page.column-address"), width: 200, hideBelow: 560 },
|
|
1181
1107
|
// In the bin the state of a page is not what it was published as — it is off the site either
|
|
@@ -1184,290 +1110,281 @@ const Kt = /* @__PURE__ */ K({
|
|
|
1184
1110
|
key: "status",
|
|
1185
1111
|
label: p.value ? t("page.column-deleted") : t("page.column-status"),
|
|
1186
1112
|
align: "center",
|
|
1187
|
-
width:
|
|
1113
|
+
width: 150,
|
|
1188
1114
|
hideBelow: 620
|
|
1189
1115
|
},
|
|
1190
1116
|
{
|
|
1191
1117
|
key: "updated_at",
|
|
1192
1118
|
label: t("page.column-updated"),
|
|
1193
|
-
width:
|
|
1119
|
+
width: 150,
|
|
1194
1120
|
hideBelow: 900,
|
|
1195
1121
|
hidden: p.value
|
|
1196
1122
|
},
|
|
1197
|
-
{ key: "actions", label: "", width:
|
|
1198
|
-
]),
|
|
1199
|
-
() =>
|
|
1123
|
+
{ key: "actions", label: "", width: Ze, align: "right" }
|
|
1124
|
+
]), ee = W(
|
|
1125
|
+
() => M.value ? {
|
|
1200
1126
|
childrenKey: "children",
|
|
1201
1127
|
hasChildrenKey: "children_count",
|
|
1202
1128
|
lazy: !0,
|
|
1203
|
-
load: (
|
|
1204
|
-
draggable:
|
|
1205
|
-
allowDrag: (
|
|
1206
|
-
allowDrop:
|
|
1129
|
+
load: (n) => a.list({ parent: n.id }).then((T) => T.items),
|
|
1130
|
+
draggable: b.value,
|
|
1131
|
+
allowDrag: (n) => n.can.move,
|
|
1132
|
+
allowDrop: re
|
|
1207
1133
|
} : void 0
|
|
1208
1134
|
);
|
|
1209
|
-
function
|
|
1210
|
-
return
|
|
1135
|
+
function re(n, T, m) {
|
|
1136
|
+
return T.is_home ? m === "inside" : n.id !== T.id;
|
|
1211
1137
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
|
|
1138
|
+
async function S() {
|
|
1139
|
+
h.value = !0;
|
|
1214
1140
|
try {
|
|
1215
|
-
const
|
|
1216
|
-
search:
|
|
1217
|
-
status: p.value ? "" :
|
|
1141
|
+
const n = await a.list({
|
|
1142
|
+
search: r.value.trim(),
|
|
1143
|
+
status: p.value ? "" : k.value,
|
|
1218
1144
|
trashed: p.value
|
|
1219
1145
|
});
|
|
1220
|
-
|
|
1221
|
-
} catch (
|
|
1222
|
-
|
|
1146
|
+
l.value = n.home, c.value = n.items;
|
|
1147
|
+
} catch (n) {
|
|
1148
|
+
V.danger(d(n));
|
|
1223
1149
|
} finally {
|
|
1224
|
-
|
|
1150
|
+
h.value = !1;
|
|
1225
1151
|
}
|
|
1226
1152
|
}
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1153
|
+
function te(n) {
|
|
1154
|
+
n.search !== r.value && (r.value = n.search, S());
|
|
1229
1155
|
}
|
|
1230
|
-
function
|
|
1231
|
-
const
|
|
1232
|
-
s.resolve(
|
|
1156
|
+
function E(n) {
|
|
1157
|
+
const T = `${o.base}/${n.id}`;
|
|
1158
|
+
s.resolve(T).matched.length > 0 && s.push(T);
|
|
1233
1159
|
}
|
|
1234
|
-
async function
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1160
|
+
async function ue(n) {
|
|
1161
|
+
const T = await w({ parent: n });
|
|
1162
|
+
T && (await S(), E(T));
|
|
1237
1163
|
}
|
|
1238
|
-
async function
|
|
1164
|
+
async function de(n) {
|
|
1239
1165
|
try {
|
|
1240
|
-
await
|
|
1241
|
-
} catch (
|
|
1242
|
-
|
|
1166
|
+
await a.duplicate(n.id), V.success(t("page.duplicated")), await S();
|
|
1167
|
+
} catch (T) {
|
|
1168
|
+
V.danger(d(T));
|
|
1243
1169
|
}
|
|
1244
1170
|
}
|
|
1245
|
-
async function
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1171
|
+
async function pe(n) {
|
|
1172
|
+
const T = await z({ page: n });
|
|
1173
|
+
T != null && await G(n, T, "inside");
|
|
1248
1174
|
}
|
|
1249
|
-
async function ge(
|
|
1250
|
-
const
|
|
1251
|
-
if (
|
|
1252
|
-
title: t("page.move-title", { title:
|
|
1253
|
-
message: t("page.move-branch", { count:
|
|
1175
|
+
async function ge(n) {
|
|
1176
|
+
const T = n.zone === "inside" ? n.target.id : n.target.parent_id, m = n.row.descendants_count + 1;
|
|
1177
|
+
if (T !== n.row.parent_id && m > 1 && !await L({
|
|
1178
|
+
title: t("page.move-title", { title: n.row.title }),
|
|
1179
|
+
message: t("page.move-branch", { count: m }),
|
|
1254
1180
|
confirmText: t("page.move-confirm"),
|
|
1255
1181
|
cancelText: t("page.cancel")
|
|
1256
1182
|
})) {
|
|
1257
|
-
await
|
|
1183
|
+
await S();
|
|
1258
1184
|
return;
|
|
1259
1185
|
}
|
|
1260
|
-
await
|
|
1186
|
+
await G(n.row, n.target.id, n.zone);
|
|
1261
1187
|
}
|
|
1262
|
-
async function
|
|
1188
|
+
async function G(n, T, m) {
|
|
1263
1189
|
try {
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
|
|
1190
|
+
const J = await a.move(n.id, T, m);
|
|
1191
|
+
V.success(
|
|
1192
|
+
J.addresses_changed > 1 ? t("page.moved", { count: J.addresses_changed }) : t("page.moved-one")
|
|
1267
1193
|
);
|
|
1268
|
-
} catch (
|
|
1269
|
-
|
|
1194
|
+
} catch (J) {
|
|
1195
|
+
V.danger(d(J));
|
|
1270
1196
|
} finally {
|
|
1271
|
-
await
|
|
1197
|
+
await S();
|
|
1272
1198
|
}
|
|
1273
1199
|
}
|
|
1274
|
-
async function
|
|
1275
|
-
if (await
|
|
1276
|
-
title: t("page.delete-title", { title:
|
|
1200
|
+
async function X(n) {
|
|
1201
|
+
if (await L({
|
|
1202
|
+
title: t("page.delete-title", { title: n.title }),
|
|
1277
1203
|
message: (
|
|
1278
1204
|
// The whole branch, not the level under it: a catalogue with two sections and forty
|
|
1279
1205
|
// products is forty-two pages leaving the site, and "2" would be a comforting lie.
|
|
1280
|
-
|
|
1206
|
+
n.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: n.descendants_count })}` : t("page.delete-text")
|
|
1281
1207
|
),
|
|
1282
1208
|
confirmText: t("page.delete"),
|
|
1283
1209
|
cancelText: t("page.cancel"),
|
|
1284
1210
|
tone: "danger"
|
|
1285
1211
|
}))
|
|
1286
1212
|
try {
|
|
1287
|
-
await
|
|
1288
|
-
} catch (
|
|
1289
|
-
|
|
1213
|
+
await a.remove(n.id), V.success(t("page.deleted")), await S();
|
|
1214
|
+
} catch (m) {
|
|
1215
|
+
V.danger(d(m));
|
|
1290
1216
|
}
|
|
1291
1217
|
}
|
|
1292
|
-
async function
|
|
1293
|
-
if (await
|
|
1294
|
-
title: t("page.restore-page-title", { title:
|
|
1295
|
-
message:
|
|
1218
|
+
async function ve(n) {
|
|
1219
|
+
if (await L({
|
|
1220
|
+
title: t("page.restore-page-title", { title: n.title }),
|
|
1221
|
+
message: n.descendants_count > 0 ? `${t("page.restore-page-text")} ${t("page.restore-branch", { count: n.descendants_count })}` : t("page.restore-page-text"),
|
|
1296
1222
|
confirmText: t("page.restore"),
|
|
1297
1223
|
cancelText: t("page.cancel")
|
|
1298
1224
|
}))
|
|
1299
1225
|
try {
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
), await
|
|
1304
|
-
} catch (
|
|
1305
|
-
|
|
1226
|
+
const m = await a.restore(n.id);
|
|
1227
|
+
V.success(
|
|
1228
|
+
m > 1 ? t("page.restored-branch", { count: m }) : t("page.restored")
|
|
1229
|
+
), await S();
|
|
1230
|
+
} catch (m) {
|
|
1231
|
+
V.danger(d(m));
|
|
1306
1232
|
}
|
|
1307
1233
|
}
|
|
1308
|
-
async function
|
|
1309
|
-
if (
|
|
1234
|
+
async function he(n) {
|
|
1235
|
+
if (n.url)
|
|
1310
1236
|
try {
|
|
1311
|
-
await navigator.clipboard.writeText(
|
|
1237
|
+
await navigator.clipboard.writeText(n.url), V.success(t("page.address-copied"));
|
|
1312
1238
|
} catch {
|
|
1313
1239
|
}
|
|
1314
1240
|
}
|
|
1315
|
-
function
|
|
1316
|
-
return
|
|
1241
|
+
function O(n) {
|
|
1242
|
+
return n === "published" ? "success" : n === "modified" ? "warning" : "default";
|
|
1317
1243
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
}),
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1244
|
+
ae(k, () => {
|
|
1245
|
+
S();
|
|
1246
|
+
}), ce(S);
|
|
1247
|
+
const me = W(
|
|
1248
|
+
() => b.value ? [{ key: "new", label: t("page.new"), icon: "plus", primary: !0, run: () => {
|
|
1249
|
+
ue(null);
|
|
1250
|
+
} }] : []
|
|
1251
|
+
);
|
|
1252
|
+
return (n, T) => (f(), N("div", Dt, [
|
|
1253
|
+
v(e(qe), {
|
|
1254
|
+
view: k.value,
|
|
1255
|
+
"onUpdate:view": T[1] || (T[1] = (m) => k.value = m),
|
|
1256
|
+
title: P.value,
|
|
1257
|
+
views: B.value,
|
|
1258
|
+
actions: me.value
|
|
1259
|
+
}, {
|
|
1260
|
+
default: i(() => [
|
|
1261
|
+
v(e(it), {
|
|
1329
1262
|
data: le.value,
|
|
1330
|
-
columns:
|
|
1263
|
+
columns: A.value,
|
|
1331
1264
|
"row-key": "id",
|
|
1332
|
-
tree:
|
|
1265
|
+
tree: ee.value,
|
|
1333
1266
|
searchable: "",
|
|
1334
1267
|
clickable: !p.value,
|
|
1335
1268
|
hover: !p.value,
|
|
1336
1269
|
flush: "",
|
|
1337
1270
|
layout: "fixed",
|
|
1338
|
-
loading:
|
|
1271
|
+
loading: h.value,
|
|
1339
1272
|
"cards-below": 0,
|
|
1340
1273
|
"search-placeholder": e(t)("page.search"),
|
|
1341
|
-
"empty-text":
|
|
1342
|
-
"aria-label":
|
|
1343
|
-
onRowClick:
|
|
1344
|
-
onStateChange:
|
|
1274
|
+
"empty-text": r.value ? e(t)("page.empty-search") : p.value ? e(t)("page.empty-bin") : e(t)("page.empty"),
|
|
1275
|
+
"aria-label": P.value,
|
|
1276
|
+
onRowClick: E,
|
|
1277
|
+
onStateChange: te,
|
|
1345
1278
|
onNodeDrop: ge
|
|
1346
1279
|
}, {
|
|
1347
|
-
"cell-title":
|
|
1348
|
-
|
|
1280
|
+
"cell-title": i(({ row: m }) => [
|
|
1281
|
+
K("span", Nt, x(m.is_home ? e(t)("pages.home") : m.title), 1)
|
|
1349
1282
|
]),
|
|
1350
|
-
"cell-path":
|
|
1351
|
-
p.value ? (
|
|
1283
|
+
"cell-path": i(({ row: m }) => [
|
|
1284
|
+
p.value ? (f(), C(e(U), {
|
|
1352
1285
|
key: 0,
|
|
1353
1286
|
size: "sm",
|
|
1354
1287
|
tone: "muted"
|
|
1355
1288
|
}, {
|
|
1356
|
-
default:
|
|
1357
|
-
|
|
1289
|
+
default: i(() => [...T[2] || (T[2] = [
|
|
1290
|
+
$("—", -1)
|
|
1358
1291
|
])]),
|
|
1359
1292
|
_: 1
|
|
1360
|
-
})) :
|
|
1293
|
+
})) : m.url && m.status !== "draft" ? (f(), N("a", {
|
|
1361
1294
|
key: 1,
|
|
1362
1295
|
class: "wx-pages__address",
|
|
1363
|
-
href:
|
|
1296
|
+
href: m.url,
|
|
1364
1297
|
target: "_blank",
|
|
1365
1298
|
rel: "noopener",
|
|
1366
|
-
onClick:
|
|
1299
|
+
onClick: T[0] || (T[0] = He(() => {
|
|
1367
1300
|
}, ["stop"]))
|
|
1368
|
-
}, " /" +
|
|
1301
|
+
}, " /" + x(m.path), 9, Et)) : m.path !== null ? (f(), C(e(U), {
|
|
1369
1302
|
key: 2,
|
|
1370
1303
|
mono: "",
|
|
1371
1304
|
size: "sm",
|
|
1372
1305
|
tone: "muted"
|
|
1373
1306
|
}, {
|
|
1374
|
-
default:
|
|
1375
|
-
|
|
1307
|
+
default: i(() => [
|
|
1308
|
+
$("/" + x(m.path), 1)
|
|
1376
1309
|
]),
|
|
1377
1310
|
_: 2
|
|
1378
|
-
}, 1024)) : (
|
|
1311
|
+
}, 1024)) : (f(), C(e(U), {
|
|
1379
1312
|
key: 3,
|
|
1380
1313
|
size: "sm",
|
|
1381
1314
|
tone: "muted"
|
|
1382
1315
|
}, {
|
|
1383
|
-
default:
|
|
1384
|
-
|
|
1316
|
+
default: i(() => [
|
|
1317
|
+
$(x(e(t)("page.no-address")), 1)
|
|
1385
1318
|
]),
|
|
1386
1319
|
_: 1
|
|
1387
1320
|
}))
|
|
1388
1321
|
]),
|
|
1389
|
-
"cell-status":
|
|
1390
|
-
p.value ? (
|
|
1322
|
+
"cell-status": i(({ row: m }) => [
|
|
1323
|
+
p.value ? (f(), C(e(be), {
|
|
1391
1324
|
key: 0,
|
|
1392
|
-
value:
|
|
1393
|
-
}, null, 8, ["value"])) : (
|
|
1325
|
+
value: m.deleted_at
|
|
1326
|
+
}, null, 8, ["value"])) : (f(), C(e(xe), {
|
|
1394
1327
|
key: 1,
|
|
1395
|
-
type:
|
|
1328
|
+
type: O(m.status),
|
|
1396
1329
|
dot: ""
|
|
1397
1330
|
}, {
|
|
1398
|
-
default:
|
|
1399
|
-
|
|
1331
|
+
default: i(() => [
|
|
1332
|
+
$(x(e(t)(`page.status-${m.status}`)), 1)
|
|
1400
1333
|
]),
|
|
1401
1334
|
_: 2
|
|
1402
1335
|
}, 1032, ["type"]))
|
|
1403
1336
|
]),
|
|
1404
|
-
"cell-updated_at":
|
|
1405
|
-
|
|
1337
|
+
"cell-updated_at": i(({ row: m }) => [
|
|
1338
|
+
v(e(U), {
|
|
1406
1339
|
size: "sm",
|
|
1407
1340
|
tone: "muted"
|
|
1408
1341
|
}, {
|
|
1409
|
-
default:
|
|
1410
|
-
|
|
1411
|
-
value:
|
|
1342
|
+
default: i(() => [
|
|
1343
|
+
v(e(be), {
|
|
1344
|
+
value: m.updated_at,
|
|
1345
|
+
compact: ""
|
|
1412
1346
|
}, null, 8, ["value"]),
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
], 64)) :
|
|
1347
|
+
m.edited_by && !p.value ? (f(), N(Z, { key: 0 }, [
|
|
1348
|
+
$(", " + x(m.edited_by), 1)
|
|
1349
|
+
], 64)) : I("", !0)
|
|
1416
1350
|
]),
|
|
1417
1351
|
_: 2
|
|
1418
1352
|
}, 1024)
|
|
1419
1353
|
]),
|
|
1420
|
-
"cell-actions":
|
|
1421
|
-
|
|
1354
|
+
"cell-actions": i(({ row: m }) => [
|
|
1355
|
+
b.value ? (f(), C(zt, {
|
|
1422
1356
|
key: 0,
|
|
1423
|
-
page:
|
|
1357
|
+
page: m,
|
|
1424
1358
|
"in-bin": p.value,
|
|
1425
|
-
onOpen:
|
|
1426
|
-
onAdd:
|
|
1427
|
-
onDuplicate:
|
|
1428
|
-
onMove:
|
|
1429
|
-
onCopy:
|
|
1430
|
-
onRemove:
|
|
1431
|
-
onRestore:
|
|
1432
|
-
}, null, 8, ["page", "in-bin"])) :
|
|
1359
|
+
onOpen: E,
|
|
1360
|
+
onAdd: ue,
|
|
1361
|
+
onDuplicate: de,
|
|
1362
|
+
onMove: pe,
|
|
1363
|
+
onCopy: he,
|
|
1364
|
+
onRemove: X,
|
|
1365
|
+
onRestore: ve
|
|
1366
|
+
}, null, 8, ["page", "in-bin"])) : I("", !0)
|
|
1433
1367
|
]),
|
|
1434
1368
|
_: 1
|
|
1435
1369
|
}, 8, ["data", "columns", "tree", "clickable", "hover", "loading", "search-placeholder", "empty-text", "aria-label"])
|
|
1436
1370
|
]),
|
|
1437
|
-
_:
|
|
1438
|
-
}, [
|
|
1439
|
-
_.value ? {
|
|
1440
|
-
name: "actions",
|
|
1441
|
-
fn: n(() => [
|
|
1442
|
-
g(e(I), {
|
|
1443
|
-
type: "primary",
|
|
1444
|
-
icon: "plus",
|
|
1445
|
-
onClick: w[0] || (w[0] = (v) => ce(null))
|
|
1446
|
-
}, {
|
|
1447
|
-
default: n(() => [
|
|
1448
|
-
y(b(e(t)("page.new")), 1)
|
|
1449
|
-
]),
|
|
1450
|
-
_: 1
|
|
1451
|
-
})
|
|
1452
|
-
]),
|
|
1453
|
-
key: "0"
|
|
1454
|
-
} : void 0
|
|
1455
|
-
]), 1032, ["view", "title", "views"])
|
|
1371
|
+
_: 1
|
|
1372
|
+
}, 8, ["view", "title", "views", "actions"])
|
|
1456
1373
|
]));
|
|
1457
1374
|
}
|
|
1458
|
-
}),
|
|
1459
|
-
function
|
|
1460
|
-
const
|
|
1375
|
+
}), It = /* @__PURE__ */ oe(At, [["__scopeId", "data-v-9f11d1cb"]]);
|
|
1376
|
+
function Ft(u = {}) {
|
|
1377
|
+
const o = u.path ?? "/pages";
|
|
1461
1378
|
return {
|
|
1462
1379
|
id: "pages",
|
|
1463
|
-
path:
|
|
1380
|
+
path: o,
|
|
1464
1381
|
routes: [
|
|
1465
|
-
{ path:
|
|
1382
|
+
{ path: o, name: "webx.pages", component: It, props: { base: o } },
|
|
1466
1383
|
{
|
|
1467
|
-
path: `${
|
|
1384
|
+
path: `${o}/:id(\\d+)`,
|
|
1468
1385
|
name: "webx.pages.edit",
|
|
1469
|
-
component:
|
|
1470
|
-
props: { base:
|
|
1386
|
+
component: wt,
|
|
1387
|
+
props: { base: o }
|
|
1471
1388
|
}
|
|
1472
1389
|
],
|
|
1473
1390
|
/*
|
|
@@ -1479,25 +1396,25 @@ function ta(u = {}) {
|
|
|
1479
1396
|
* page from the editor above it rather than from the description.
|
|
1480
1397
|
*/
|
|
1481
1398
|
types: {
|
|
1482
|
-
"wx-page-place": { component:
|
|
1483
|
-
"wx-page-danger": { component:
|
|
1484
|
-
"wx-page-history": { component:
|
|
1399
|
+
"wx-page-place": { component: Vt, kind: "display" },
|
|
1400
|
+
"wx-page-danger": { component: mt, kind: "display" },
|
|
1401
|
+
"wx-page-history": { component: $t, kind: "display" }
|
|
1485
1402
|
}
|
|
1486
1403
|
};
|
|
1487
1404
|
}
|
|
1488
1405
|
export {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1406
|
+
mt as WxPageDanger,
|
|
1407
|
+
wt as WxPageEditorPage,
|
|
1408
|
+
$t as WxPageHistory,
|
|
1409
|
+
$e as WxPagePicker,
|
|
1410
|
+
Vt as WxPagePlace,
|
|
1411
|
+
It as WxPagesPage,
|
|
1412
|
+
q as createPagesApi,
|
|
1413
|
+
Ne as pageEditorKey,
|
|
1414
|
+
Ft as pages,
|
|
1415
|
+
ut as pagesMessages,
|
|
1416
|
+
rt as providePageEditor,
|
|
1417
|
+
Mt as slugify,
|
|
1418
|
+
Te as usePageEditor
|
|
1502
1419
|
};
|
|
1503
1420
|
//# sourceMappingURL=index.js.map
|