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