@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/index.js CHANGED
@@ -1,38 +1,38 @@
1
- import { inject as Le, provide as Oe, defineComponent as K, ref as k, computed as W, openBlock as m, createBlock as V, unref as e, withCtx as n, createElementVNode as E, createElementBlock as A, createVNode as g, createTextVNode as y, toDisplayString as b, createCommentVNode as N, useTemplateRef as Be, watch as ae, onMounted as pe, onBeforeUnmount as Ke, Fragment as j, renderList as Me, normalizeClass as Fe, useModel as He, mergeModels as je, nextTick as Ge, isRef as De, withKeys as Pe, createSlots as Je, withModifiers as Qe } from "vue";
2
- import { useRouter as ye, useRoute as Xe, onBeforeRouteLeave as Ye } from "vue-router";
3
- import { useAdmin as G, useTranslate as F, useErrorText as ie, WxBackButton as Ze, WxScreen as qe, WxDate as me, WxRowMenu as et, WxListScreen as tt } from "@webx-ui/module-admin";
4
- import { WxCard as at, WxText as R, WxButton as I, confirm as O, toast as z, useLocales as Se, useElementWidth as lt, localizedValue as nt, WxSkeleton as be, WxBreadcrumb as st, WxBreadcrumbItem as fe, WxBadge as we, WxDropdown as ot, WxDropdownItem as We, WxAction as it, WxAlert as xe, WxActionBar as rt, WxEmpty as ut, WxTreeSelect as dt, WxFormItem as oe, useModal as Ne, WxDialog as Ae, WxInput as Ve, WxSpace as _e, createModal as ze, WxTable as ct } from "@webx-ui/core";
5
- import { provideBlocksPreview as pt } from "@webx-ui/module-blocks";
6
- function Z(u) {
7
- const r = `${u.apiPath}/pages`, h = (l) => l.data;
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: (l = {}) => {
9
+ list: (a = {}) => {
10
10
  const s = new URLSearchParams();
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");
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(`${r}${t}`).then(h);
13
+ return u.http.get(`${o}${t}`).then(g);
14
14
  },
15
- get: (l) => u.http.get(`${r}/${l}`).then(h),
16
- create: (l) => u.http.post(r, l).then(h),
17
- save: (l, s) => u.http.put(`${r}/${l}`, s).then(h),
18
- move: (l, s, t) => u.http.post(`${r}/${l}/move`, { target: s, zone: t }).then(h),
19
- duplicate: (l) => u.http.post(`${r}/${l}/duplicate`, {}).then(h),
20
- publish: (l) => u.http.post(`${r}/${l}/publish`, {}).then(h),
21
- unpublish: (l) => u.http.post(`${r}/${l}/unpublish`, {}).then(h),
22
- remove: (l) => u.http.delete(`${r}/${l}`).then((s) => s.data.trashed),
23
- restore: (l) => u.http.post(`${r}/${l}/restore`, {}).then((s) => s.data.restored),
24
- versions: (l) => u.http.get(`${r}/${l}/versions`).then(h),
25
- restoreVersion: (l, s) => u.http.post(`${r}/${l}/versions/${s}/restore`, {}).then(h)
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 Ee = /* @__PURE__ */ Symbol("wx-page-editor");
29
- function gt(u) {
30
- Oe(Ee, u);
28
+ const Ne = /* @__PURE__ */ Symbol("wx-page-editor");
29
+ function rt(u) {
30
+ Ie(Ne, u);
31
31
  }
32
- function ke() {
33
- return Le(Ee, null);
32
+ function Te() {
33
+ return Ae(Ne, null);
34
34
  }
35
- const vt = {
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
- }, Ce = /* @__PURE__ */ new WeakSet();
141
- function H() {
137
+ }, ze = /* @__PURE__ */ new WeakSet();
138
+ function j() {
142
139
  try {
143
- const { i18n: u } = G();
144
- Ce.has(u) || (u.defaults("webx-pages", vt), Ce.add(u));
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 ht = { class: "wx-page-danger" }, ft = {
145
+ const dt = { class: "wx-page-danger" }, ct = {
149
146
  key: 0,
150
147
  class: "wx-page-danger__row"
151
- }, mt = { class: "wx-page-danger__what" }, bt = { class: "wx-page-danger__row" }, _t = { class: "wx-page-danger__what" }, yt = /* @__PURE__ */ K({
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 r = G(), h = Z(r), l = ye(), s = ke();
156
- H();
157
- const t = F("webx-pages"), d = ie(), a = k(!1), c = W(() => s?.page.value ?? null), f = W(() => r.can("pages.manage"));
158
- async function i() {
159
- const x = c.value;
160
- if (!(!x || !await O({
161
- title: t("page.unpublish-title", { title: x.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
- a.value = !0;
164
+ l.value = !0;
168
165
  try {
169
- await h.unpublish(x.id), await s?.reload(), z.success(t("page.unpublished"));
170
- } catch (_) {
171
- z.danger(d(_));
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
- a.value = !1;
170
+ l.value = !1;
174
171
  }
175
172
  }
176
173
  }
177
- async function T() {
178
- const x = c.value;
179
- if (!(!x || !await O({
180
- title: t("page.delete-title", { title: x.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: x.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: x.descendants_count })}` : t("page.delete-text"),
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
- a.value = !0;
185
+ l.value = !0;
189
186
  try {
190
- await h.remove(x.id), z.success(t("page.deleted")), l.push(s?.base ?? "/pages");
191
- } catch (_) {
192
- z.danger(d(_));
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
- a.value = !1;
191
+ l.value = !1;
195
192
  }
196
193
  }
197
194
  }
198
- return (x, C) => c.value && f.value ? (m(), V(e(at), {
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: n(() => [
203
- E("div", ht, [
204
- c.value.status !== "draft" ? (m(), A("div", ft, [
205
- E("div", mt, [
206
- g(e(R), { weight: "medium" }, {
207
- default: n(() => [
208
- y(b(e(t)("page.unpublish")), 1)
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
- g(e(R), {
209
+ v(e(U), {
213
210
  size: "sm",
214
211
  tone: "muted"
215
212
  }, {
216
- default: n(() => [
217
- y(b(e(t)("page.unpublish-help")), 1)
213
+ default: i(() => [
214
+ $(x(e(t)("page.unpublish-help")), 1)
218
215
  ]),
219
216
  _: 1
220
217
  })
221
218
  ]),
222
- g(e(I), {
219
+ v(e(R), {
223
220
  variant: "outline",
224
- loading: a.value,
225
- onClick: i
221
+ loading: l.value,
222
+ onClick: r
226
223
  }, {
227
- default: n(() => [
228
- y(b(e(t)("page.unpublish")), 1)
224
+ default: i(() => [
225
+ $(x(e(t)("page.unpublish")), 1)
229
226
  ]),
230
227
  _: 1
231
228
  }, 8, ["loading"])
232
- ])) : N("", !0),
233
- E("div", bt, [
234
- E("div", _t, [
235
- g(e(R), { weight: "medium" }, {
236
- default: n(() => [
237
- y(b(e(t)("page.delete")), 1)
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
- g(e(R), {
238
+ v(e(U), {
242
239
  size: "sm",
243
240
  tone: "muted"
244
241
  }, {
245
- default: n(() => [
246
- y(b(c.value.can.delete ? e(t)("page.delete-help") : e(t)("page.delete-home")), 1)
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
- g(e(I), {
248
+ v(e(R), {
252
249
  type: "danger",
253
250
  variant: "outline",
254
251
  disabled: !c.value.can.delete,
255
- loading: a.value,
256
- onClick: T
252
+ loading: l.value,
253
+ onClick: k
257
254
  }, {
258
- default: n(() => [
259
- y(b(e(t)("page.delete")), 1)
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"])) : N("", !0);
264
+ }, 8, ["title"])) : I("", !0);
268
265
  }
269
- }), re = (u, r) => {
270
- const h = u.__vccOpts || u;
271
- for (const [l, s] of r)
272
- h[l] = s;
273
- return h;
274
- }, wt = /* @__PURE__ */ re(yt, [["__scopeId", "data-v-d4a9083f"]]), xt = { class: "wx-page-editor__head" }, kt = { class: "wx-page-editor__id" }, Tt = { class: "wx-page-editor__name" }, $t = { class: "wx-page-editor__title" }, Pt = { class: "wx-page-editor__actions" }, Wt = { class: "wx-page-editor__screen" }, Vt = 1200, zt = 720, Ct = /* @__PURE__ */ K({
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 r = u, h = G(), l = Z(h), s = Xe(), t = ye(), d = Se();
281
- H();
282
- const a = F("webx-pages"), c = ie(), f = W(() => Number(s.params.id)), i = k(null), T = k([]), x = k({}), C = k(""), _ = k(null), p = k({}), B = k(!0), $ = k(!1), D = k(!1), le = k({}), U = k(null), q = k(""), ue = k(0), M = W(() => h.can("pages.manage")), de = Be("root"), ee = lt(de), ce = W(() => ee.value > 0 && ee.value < zt), te = W(() => JSON.stringify(x.value)), L = W(() => q.value !== "" && te.value !== q.value), ge = W(() => $.value ? "saving" : L.value ? "unsaved" : "saved"), ne = W(() => {
283
- const P = x.value.title;
284
- return nt(P, d.active.value, i.value?.title ?? "");
285
- }), ve = W(
286
- () => T.value.map((P) => ({
287
- id: P.id,
288
- label: P.is_home ? a("pages.home") : P.title
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
- pt({ url: W(() => _.value), reload: ue }), gt({
292
- page: i,
293
- ancestors: T,
294
- values: x,
288
+ ot({ url: W(() => b.value), reload: re }), rt({
289
+ page: r,
290
+ ancestors: k,
291
+ values: w,
295
292
  prefixes: p,
296
- base: r.base,
297
- canManage: M.value,
298
- reload: () => J(!0),
299
- save: () => v()
293
+ base: o.base,
294
+ canManage: S.value,
295
+ reload: () => G(!0),
296
+ save: () => O()
300
297
  });
301
- function he(P) {
302
- i.value = P.page, T.value = P.ancestors, x.value = P.values, C.value = P.revision, _.value = P.preview_url, p.value = P.address_prefix, q.value = JSON.stringify(P.values), U.value = null;
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 J(P = !1) {
305
- P || (B.value = !0);
301
+ async function G(y = !1) {
302
+ y || (M.value = !0);
306
303
  try {
307
- he(await l.get(f.value));
304
+ ge(await a.get(h.value));
308
305
  } catch (Y) {
309
- z.danger(c(Y)), t.push(r.base);
306
+ V.danger(c(Y)), t.push(o.base);
310
307
  } finally {
311
- B.value = !1;
308
+ M.value = !1;
312
309
  }
313
310
  }
314
- let Q;
315
- function o() {
316
- !M.value || U.value || !L.value || (clearTimeout(Q), Q = setTimeout(() => {
317
- v();
318
- }, Vt));
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 w() {
321
- !M.value || U.value || !L.value || $.value || (clearTimeout(Q), v());
317
+ function he() {
318
+ !S.value || A.value || !E.value || P.value || (clearTimeout(X), O());
322
319
  }
323
- async function v() {
324
- if (!i.value || $.value || !M.value) return;
325
- clearTimeout(Q);
326
- const P = te.value, Y = x.value;
327
- $.value = !0, le.value = {};
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 S = await l.save(i.value.id, { values: Y, revision: C.value });
330
- i.value = S.page, T.value = S.ancestors, C.value = S.revision, _.value = S.preview_url, p.value = S.address_prefix, U.value = null, te.value === P && (q.value = P), ue.value += 1;
331
- } catch (S) {
332
- const se = S;
333
- se.status === 409 && se.body?.data ? U.value = se.body : se.body?.errors ? (le.value = se.body.errors, z.danger(a("page.save-failed"))) : z.danger(c(S));
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
- $.value = !1;
332
+ P.value = !1;
336
333
  }
337
334
  }
338
- async function X() {
339
- await O({
340
- title: a("page.conflict-theirs-title"),
341
- message: a("page.conflict-theirs-text"),
342
- confirmText: a("page.conflict-theirs"),
343
- cancelText: a("page.cancel"),
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 J(!0);
342
+ }) && await G(!0);
346
343
  }
347
- async function Ie() {
348
- const P = U.value;
349
- P && (C.value = P.data.revision, U.value = null, await v());
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 Ue() {
352
- if (!i.value) return;
353
- const P = i.value.path === null ? null : `/${i.value.path}`;
354
- if (await O({
355
- title: a("page.publish-title", { title: i.value.title }),
356
- message: P === null ? a("page.publish-text-nowhere") : a("page.publish-text", { address: P }),
357
- confirmText: a("page.publish"),
358
- cancelText: a("page.cancel")
359
- }) && (L.value && await v(), !U.value)) {
360
- D.value = !0;
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 l.publish(i.value.id), await J(!0), z.success(a("page.published"));
363
- } catch (S) {
364
- z.danger(c(S));
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
- D.value = !1;
363
+ B.value = !1;
367
364
  }
368
365
  }
369
366
  }
370
- function Re() {
371
- return i.value?.status === "published" ? "success" : i.value?.status === "modified" ? "warning" : "default";
367
+ function m() {
368
+ return r.value?.status === "published" ? "success" : r.value?.status === "modified" ? "warning" : "default";
372
369
  }
373
- function $e(P) {
374
- L.value && P.preventDefault();
370
+ function J(y) {
371
+ E.value && y.preventDefault();
375
372
  }
376
- return ae(te, o), ae(f, () => {
377
- J();
378
- }), pe(() => {
379
- J(), window.addEventListener("beforeunload", $e);
380
- }), Ke(() => {
381
- clearTimeout(Q), window.removeEventListener("beforeunload", $e);
382
- }), Ye(async () => !L.value || !M.value || (await v(), !L.value) ? !0 : await O({
383
- title: a("page.leave-title"),
384
- message: a("page.leave-text"),
385
- confirmText: a("page.leave"),
386
- cancelText: a("page.cancel"),
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
- })), (P, Y) => (m(), A("div", {
389
- ref_key: "root",
390
- ref: de,
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: w
392
+ onFocusout: he
393
393
  }, [
394
- B.value || !i.value ? (m(), A(j, { key: 0 }, [
395
- g(e(be), {
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
- g(e(be), { rows: 8 })
401
- ], 64)) : (m(), A(j, { key: 1 }, [
402
- E("div", xt, [
403
- g(e(Ze), {
404
- class: "wx-page-editor__back",
405
- to: u.base,
406
- label: e(a)("module.title")
407
- }, null, 8, ["to", "label"]),
408
- E("div", kt, [
409
- g(e(st), {
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(a)("page.trail")
412
+ label: e(l)("page.trail")
412
413
  }, {
413
- default: n(() => [
414
- g(e(fe), {
414
+ default: i(() => [
415
+ v(e(fe), {
415
416
  as: "router-link",
416
417
  to: u.base
417
418
  }, {
418
- default: n(() => [
419
- y(b(e(a)("module.title")), 1)
419
+ default: i(() => [
420
+ $(x(e(l)("module.title")), 1)
420
421
  ]),
421
422
  _: 1
422
423
  }, 8, ["to"]),
423
- (m(!0), A(j, null, Me(ve.value, (S) => (m(), V(e(fe), {
424
- key: S.id,
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}/${S.id}`
427
+ to: `${u.base}/${D.id}`
427
428
  }, {
428
- default: n(() => [
429
- y(b(S.label), 1)
429
+ default: i(() => [
430
+ $(x(D.label), 1)
430
431
  ]),
431
432
  _: 2
432
433
  }, 1032, ["to"]))), 128)),
433
- g(e(fe), { current: "" }, {
434
- default: n(() => [
435
- y(b(i.value.is_home ? e(a)("pages.home") : ne.value), 1)
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
- E("div", Pt, [
456
- ce.value ? (m(), V(e(ot), {
457
- key: 0,
458
- align: "end"
444
+ "title-after": i(() => [
445
+ v(e(xe), {
446
+ type: m(),
447
+ dot: ""
459
448
  }, {
460
- trigger: n(() => [
461
- g(e(it), {
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
- })) : (m(), A(j, { key: 1 }, [
494
- _.value ? (m(), V(e(I), {
495
- key: 0,
496
- variant: "outline",
497
- icon: "eye",
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(a)("page.conflict-title"),
527
- description: U.value.message
460
+ title: e(l)("page.conflict-title"),
461
+ description: A.value.message
528
462
  }, {
529
- actions: n(() => [
530
- g(e(I), {
463
+ actions: i(() => [
464
+ v(e(R), {
531
465
  size: "sm",
532
466
  variant: "outline",
533
- onClick: X
467
+ onClick: me
534
468
  }, {
535
- default: n(() => [
536
- y(b(e(a)("page.conflict-theirs")), 1)
469
+ default: i(() => [
470
+ $(x(e(l)("page.conflict-theirs")), 1)
537
471
  ]),
538
472
  _: 1
539
473
  }),
540
- g(e(I), {
474
+ v(e(R), {
541
475
  size: "sm",
542
476
  type: "primary",
543
- onClick: Ie
477
+ onClick: n
544
478
  }, {
545
- default: n(() => [
546
- y(b(e(a)("page.conflict-mine")), 1)
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"])) : N("", !0),
553
- E("div", Wt, [
554
- g(e(qe), {
555
- modelValue: x.value,
556
- "onUpdate:modelValue": Y[0] || (Y[0] = (S) => x.value = S),
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: !M.value || D.value
493
+ disabled: !S.value || B.value
560
494
  }, null, 8, ["modelValue", "errors", "disabled"])
561
495
  ]),
562
- M.value ? (m(), V(e(rt), { key: 1 }, {
563
- state: n(() => [
564
- g(e(R), {
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: n(() => [
575
- g(e(I), {
500
+ default: i(() => [
501
+ v(e(R), {
576
502
  variant: "outline",
577
- loading: $.value,
578
- disabled: !L.value,
579
- onClick: v
503
+ loading: P.value,
504
+ disabled: !E.value,
505
+ onClick: O
580
506
  }, {
581
- default: n(() => [
582
- y(b(e(a)("page.save")), 1)
507
+ default: i(() => [
508
+ $(x(e(l)("page.save")), 1)
583
509
  ]),
584
510
  _: 1
585
511
  }, 8, ["loading", "disabled"]),
586
- g(e(I), {
512
+ v(e(R), {
587
513
  type: "primary",
588
- loading: D.value,
589
- disabled: i.value.status === "published" && !L.value,
590
- onClick: Ue
514
+ loading: B.value,
515
+ disabled: r.value.status === "published" && !E.value,
516
+ onClick: T
591
517
  }, {
592
- default: n(() => [
593
- y(b(e(a)("page.publish")), 1)
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
- })) : N("", !0)
525
+ })) : I("", !0)
600
526
  ], 64))
601
- ], 544));
527
+ ], 32));
602
528
  }
603
- }), Bt = /* @__PURE__ */ re(Ct, [["__scopeId", "data-v-268d0501"]]), Mt = { class: "wx-page-history" }, Dt = { class: "wx-page-history__number" }, St = { class: "wx-page-history__who" }, Nt = /* @__PURE__ */ K({
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 r = G(), h = Z(r), l = ke();
608
- H();
609
- const s = F("webx-pages"), t = ie(), d = k(null), a = k(!1), c = W(() => l?.page.value ?? null), f = W(() => r.can("pages.manage")), i = W(
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 T() {
613
- const C = c.value;
614
- if (C)
538
+ async function k() {
539
+ const z = c.value;
540
+ if (z)
615
541
  try {
616
- d.value = await h.versions(C.id);
617
- } catch (_) {
618
- d.value = [], z.danger(t(_));
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 x(C) {
622
- const _ = c.value;
623
- if (!(!_ || !await O({
624
- title: s("page.restore-title", { number: C.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
- a.value = !0;
555
+ l.value = !0;
630
556
  try {
631
- await h.restoreVersion(_.id, C.number), await l?.reload(), z.success(s("page.restored-version", { number: C.number }));
632
- } catch (B) {
633
- z.danger(t(B));
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
- a.value = !1;
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
- T();
568
+ k();
643
569
  },
644
570
  {
645
571
  immediate: !0
646
572
  }
647
- ), (C, _) => (m(), A("div", Mt, [
648
- d.value === null ? (m(), V(e(be), {
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 ? (m(), V(e(ut), {
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"])) : (m(!0), A(j, { key: 2 }, Me(d.value, (p) => (m(), A("div", {
581
+ }, null, 8, ["description"])) : (f(!0), N(Z, { key: 2 }, Ce(d.value, (p) => (f(), N("div", {
656
582
  key: p.number,
657
- class: Fe(["wx-page-history__row", { "is-live": p.number === i.value }])
583
+ class: Re(["wx-page-history__row", { "is-live": p.number === r.value }])
658
584
  }, [
659
- E("code", Dt, b(e(s)("page.version", { number: p.number })), 1),
660
- E("div", St, [
661
- p.created_at ? (m(), V(e(me), {
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"])) : N("", !0),
667
- g(e(R), {
592
+ }, null, 8, ["value"])) : I("", !0),
593
+ v(e(U), {
668
594
  size: "sm",
669
595
  tone: "muted"
670
596
  }, {
671
- default: n(() => [
672
- y(b(p.author ?? e(s)(`page.source-${p.source}`)) + " ", 1),
673
- p.comment ? (m(), A(j, { key: 0 }, [
674
- y(" · " + b(p.comment), 1)
675
- ], 64)) : N("", !0)
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 === i.value ? (m(), V(e(we), {
606
+ p.number === r.value ? (f(), C(e(xe), {
681
607
  key: 0,
682
608
  type: "success",
683
609
  dot: ""
684
610
  }, {
685
- default: n(() => [
686
- y(b(e(s)("page.version-live")), 1)
611
+ default: i(() => [
612
+ $(x(e(s)("page.version-live")), 1)
687
613
  ]),
688
614
  _: 1
689
- })) : N("", !0),
690
- f.value && p.number !== i.value ? (m(), V(e(I), {
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: a.value,
695
- onClick: (B) => x(p)
620
+ loading: l.value,
621
+ onClick: (M) => w(p)
696
622
  }, {
697
- default: n(() => [
698
- y(b(e(s)("page.restore")), 1)
623
+ default: i(() => [
624
+ $(x(e(s)("page.restore")), 1)
699
625
  ]),
700
626
  _: 1
701
- }, 8, ["loading", "onClick"])) : N("", !0)
627
+ }, 8, ["loading", "onClick"])) : I("", !0)
702
628
  ], 2))), 128))
703
629
  ]));
704
630
  }
705
- }), At = /* @__PURE__ */ re(Nt, [["__scopeId", "data-v-41bcd106"]]), Te = /* @__PURE__ */ K({
631
+ }), $t = /* @__PURE__ */ oe(Tt, [["__scopeId", "data-v-41bcd106"]]), $e = /* @__PURE__ */ F({
706
632
  __name: "PagePicker",
707
- props: /* @__PURE__ */ je({
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 r = u, h = He(u, "modelValue"), l = G(), s = Z(l);
718
- H();
719
- const t = F("webx-pages"), d = k([]);
720
- pe(async () => {
721
- const f = await s.list();
722
- f.home && (d.value = [
723
- a(
724
- f.home,
725
- f.items.map((i) => a(i))
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 a(f, i) {
655
+ function l(h, r) {
730
656
  return {
731
- id: f.id,
732
- label: f.is_home ? t("pages.home") : f.title,
733
- disabled: r.exclude.includes(f.id),
734
- leaf: f.children_count === 0,
735
- ...i ? { children: i } : {}
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(f) {
739
- return (await s.list({ parent: Number(f.id) })).items.map((T) => a(T));
664
+ async function c(h) {
665
+ return (await s.list({ parent: Number(h.id) })).items.map((k) => l(k));
740
666
  }
741
- return (f, i) => (m(), V(e(dt), {
742
- modelValue: h.value,
743
- "onUpdate:modelValue": i[0] || (i[0] = (T) => h.value = T),
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": r.selected.map((T) => ({
750
- id: T.id,
751
- label: T.is_home ? e(t)("pages.home") : T.title
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: r.placeholder ?? e(t)("page.field-parent"),
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
- }), Et = {
684
+ }), Pt = {
759
685
  key: 0,
760
686
  class: "wx-page-place"
761
- }, It = /* @__PURE__ */ K({
687
+ }, Wt = /* @__PURE__ */ F({
762
688
  name: "WxPagePlace",
763
689
  __name: "PagePlace",
764
690
  setup(u) {
765
- const r = G(), h = Z(r), l = ke(), s = Se();
766
- H();
767
- const t = F("webx-pages"), d = ie(), a = k(!1), c = k(null), f = W(() => l?.page.value ?? null), i = W(() => l?.ancestors.value.length === 0 ? null : l?.prefixes.value[s.active.value] ?? null), T = W(() => {
768
- const _ = l?.values.value.slug;
769
- return typeof _ == "string" ? _ : _?.[s.active.value] ?? "";
770
- }), x = W(() => f.value?.is_home ? "/" : i.value === null || T.value === "" ? null : `/${[i.value, T.value].filter(Boolean).join("/")}`);
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
- f,
773
- (_) => {
774
- c.value = _?.parent_id ?? null;
698
+ h,
699
+ (b) => {
700
+ c.value = b?.parent_id ?? null;
775
701
  },
776
702
  { immediate: !0 }
777
703
  );
778
- async function C(_) {
779
- const p = f.value;
780
- if (!p || _ === null || _ === p.parent_id || a.value) return;
781
- const B = p.descendants_count + 1;
782
- if (B > 1 && !await O({
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: B }),
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
- a.value = !0;
717
+ l.value = !0;
792
718
  try {
793
- const $ = await h.move(p.id, _, "inside");
794
- z.success(
795
- $.addresses_changed > 1 ? t("page.moved", { count: $.addresses_changed }) : t("page.moved-one")
796
- ), await l?.reload();
797
- } catch ($) {
798
- z.danger(d($)), c.value = p.parent_id;
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
- a.value = !1;
726
+ l.value = !1;
801
727
  }
802
728
  }
803
- return (_, p) => f.value ? (m(), A("div", Et, [
804
- g(e(oe), {
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: n(() => [
808
- x.value ? (m(), V(e(R), {
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: n(() => [
814
- y(b(x.value), 1)
739
+ default: i(() => [
740
+ $(x(w.value), 1)
815
741
  ]),
816
742
  _: 1
817
- })) : (m(), V(e(R), {
743
+ })) : (f(), C(e(U), {
818
744
  key: 1,
819
745
  size: "sm",
820
746
  tone: "muted"
821
747
  }, {
822
- default: n(() => [
823
- y(b(e(t)("page.no-address")), 1)
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
- f.value.can.move ? (m(), A(j, { key: 0 }, [
831
- g(e(oe), {
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: n(() => [
836
- g(Te, {
761
+ default: i(() => [
762
+ v($e, {
837
763
  modelValue: c.value,
838
764
  "onUpdate:modelValue": [
839
- p[0] || (p[0] = (B) => c.value = B),
840
- C
765
+ p[0] || (p[0] = (M) => c.value = M),
766
+ z
841
767
  ],
842
- exclude: [f.value.id],
843
- selected: e(l)?.ancestors.value ?? []
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
- g(e(xe), {
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)) : N("", !0)
854
- ])) : N("", !0);
779
+ ], 64)) : I("", !0)
780
+ ])) : I("", !0);
855
781
  }
856
- }), Ut = /* @__PURE__ */ re(It, [["__scopeId", "data-v-bf094be2"]]), Rt = /* @__PURE__ */ K({
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: r }) {
864
- const h = u, l = r;
865
- H();
866
- const s = F("webx-pages"), t = W(() => {
867
- const d = h.page;
868
- if (h.inBin)
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: () => l("restore", d)
800
+ run: () => a("restore", d)
875
801
  }
876
802
  ];
877
- const a = [
878
- { key: "open", icon: "edit", label: s("page.open"), run: () => l("open", d) },
879
- { key: "add", icon: "plus", label: s("page.add-child"), run: () => l("add", d) }
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 || a.push({
807
+ return d.is_home || l.push({
882
808
  key: "duplicate",
883
809
  icon: "copy",
884
810
  label: s("page.duplicate"),
885
- run: () => l("duplicate", d)
886
- }), d.can.move && a.push({ key: "move", icon: "drag", label: s("page.move"), run: () => l("move", d) }), a.push(
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: () => l("copy", d)
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 && a.push({
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: () => l("remove", d)
907
- }), a;
832
+ run: () => a("remove", d)
833
+ }), l;
908
834
  });
909
- return (d, a) => (m(), V(e(et), {
835
+ return (d, l) => (f(), C(e(Ye), {
910
836
  actions: t.value,
911
- label: h.page.title
837
+ label: g.page.title
912
838
  }, null, 8, ["actions", "label"]));
913
839
  }
914
- }), Lt = {
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 Ot(u) {
974
- return u.toLowerCase().split("").map((r) => Lt[r] ?? r).join("").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
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 Kt = /* @__PURE__ */ K({
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 r = u, { open: h, resolve: l, dismiss: s } = Ne(), t = G(), d = Z(t);
983
- H();
984
- const a = F("webx-pages"), c = k(""), f = k(""), i = k(r.parent?.id ?? null), T = k(!1), x = k({}), C = Be("field"), _ = k(!1);
985
- ae(c, (B) => {
986
- _.value || (f.value = Ot(B));
987
- }), pe(async () => {
988
- await Ge(), C.value?.querySelector("input")?.focus();
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() === "" || T.value)) {
992
- T.value = !0, x.value = {};
917
+ if (!(c.value.trim() === "" || k.value)) {
918
+ k.value = !0, w.value = {};
993
919
  try {
994
- l(
920
+ a(
995
921
  await d.create({
996
922
  title: c.value.trim(),
997
- slug: f.value.trim(),
998
- parent_id: i.value
923
+ slug: h.value.trim(),
924
+ parent_id: r.value
999
925
  })
1000
926
  );
1001
- } catch (B) {
1002
- x.value = B.body?.errors ?? {};
927
+ } catch (M) {
928
+ w.value = M.body?.errors ?? {};
1003
929
  } finally {
1004
- T.value = !1;
930
+ k.value = !1;
1005
931
  }
1006
932
  }
1007
933
  }
1008
- return (B, $) => (m(), V(e(Ae), {
1009
- open: e(h),
1010
- "onUpdate:open": $[5] || ($[5] = (D) => De(h) ? h.value = D : null),
1011
- title: e(a)("page.new-title"),
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: n(() => [
1015
- g(e(_e), { size: "sm" }, {
1016
- default: n(() => [
1017
- g(e(I), {
940
+ footer: i(() => [
941
+ v(e(we), { size: "sm" }, {
942
+ default: i(() => [
943
+ v(e(R), {
1018
944
  variant: "outline",
1019
- onClick: $[4] || ($[4] = (D) => e(s)())
945
+ onClick: P[4] || (P[4] = (B) => e(s)())
1020
946
  }, {
1021
- default: n(() => [
1022
- y(b(e(a)("page.cancel")), 1)
947
+ default: i(() => [
948
+ $(x(e(l)("page.cancel")), 1)
1023
949
  ]),
1024
950
  _: 1
1025
951
  }),
1026
- g(e(I), {
952
+ v(e(R), {
1027
953
  type: "primary",
1028
- loading: T.value,
954
+ loading: k.value,
1029
955
  disabled: c.value.trim() === "",
1030
956
  onClick: p
1031
957
  }, {
1032
- default: n(() => [
1033
- y(b(e(a)("page.create")), 1)
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: n(() => [
1042
- g(e(oe), {
1043
- label: e(a)("page.field-title"),
1044
- error: x.value.title?.[0],
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: n(() => [
1048
- E("div", {
973
+ default: i(() => [
974
+ K("div", {
1049
975
  ref_key: "field",
1050
- ref: C
976
+ ref: z
1051
977
  }, [
1052
- g(e(Ve), {
978
+ v(e(We), {
1053
979
  modelValue: c.value,
1054
- "onUpdate:modelValue": $[0] || ($[0] = (D) => c.value = D),
1055
- "aria-label": e(a)("page.field-title"),
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
- g(e(oe), {
1063
- label: e(a)("page.field-slug"),
1064
- error: x.value.slug?.[0],
1065
- help: e(a)("page.slug-help")
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: n(() => [
1068
- g(e(Ve), {
1069
- modelValue: f.value,
1070
- "onUpdate:modelValue": $[1] || ($[1] = (D) => f.value = D),
1071
- "aria-label": e(a)("page.field-slug"),
1072
- onInput: $[2] || ($[2] = (D) => _.value = !0),
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
- g(e(oe), {
1079
- label: e(a)("page.field-parent"),
1080
- error: x.value.parent_id?.[0]
1004
+ v(e(ne), {
1005
+ label: e(l)("page.field-parent"),
1006
+ error: w.value.parent_id?.[0]
1081
1007
  }, {
1082
- default: n(() => [
1083
- g(Te, {
1084
- modelValue: i.value,
1085
- "onUpdate:modelValue": $[3] || ($[3] = (D) => i.value = D),
1086
- selected: r.parent ? [r.parent] : []
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
- }), Ft = /* @__PURE__ */ K({
1021
+ }), Bt = /* @__PURE__ */ F({
1096
1022
  __name: "PageMoveDialog",
1097
1023
  props: {
1098
1024
  page: {}
1099
1025
  },
1100
1026
  setup(u) {
1101
- const r = u, { open: h, resolve: l, dismiss: s } = Ne();
1102
- H();
1103
- const t = F("webx-pages"), d = k(r.page.parent_id);
1104
- return (a, c) => (m(), V(e(Ae), {
1105
- open: e(h),
1106
- "onUpdate:open": c[3] || (c[3] = (f) => De(h) ? h.value = f : null),
1107
- title: e(t)("page.move-title", { title: r.page.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: n(() => [
1111
- g(e(_e), { size: "sm" }, {
1112
- default: n(() => [
1113
- g(e(I), {
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] = (f) => e(s)())
1041
+ onClick: c[1] || (c[1] = (h) => e(s)())
1116
1042
  }, {
1117
- default: n(() => [
1118
- y(b(e(t)("page.cancel")), 1)
1043
+ default: i(() => [
1044
+ $(x(e(t)("page.cancel")), 1)
1119
1045
  ]),
1120
1046
  _: 1
1121
1047
  }),
1122
- g(e(I), {
1048
+ v(e(R), {
1123
1049
  type: "primary",
1124
- disabled: d.value === null || d.value === r.page.parent_id,
1125
- onClick: c[2] || (c[2] = (f) => e(l)(d.value))
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: n(() => [
1128
- y(b(e(t)("page.move-confirm")), 1)
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: n(() => [
1137
- g(e(_e), {
1062
+ default: i(() => [
1063
+ v(e(we), {
1138
1064
  direction: "vertical",
1139
1065
  size: "md",
1140
1066
  fill: ""
1141
1067
  }, {
1142
- default: n(() => [
1143
- g(e(xe), {
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
- g(Te, {
1074
+ v($e, {
1149
1075
  modelValue: d.value,
1150
- "onUpdate:modelValue": c[0] || (c[0] = (f) => d.value = f),
1151
- exclude: [r.page.id]
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
- }), Ht = { class: "wx-pages" }, jt = { class: "wx-pages__title" }, Gt = ["href"], Jt = /* @__PURE__ */ K({
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 r = u, h = G(), l = Z(h), s = ye();
1167
- H();
1168
- const t = F("webx-pages"), d = ie(), a = k(null), c = k([]), f = k(!0), i = k(""), T = k(""), x = ze(Kt), C = ze(Ft), _ = W(() => h.can("pages.manage")), p = W(() => T.value === "trashed"), B = W(() => !p.value && i.value.trim() === ""), $ = W(
1169
- () => h.state.manifest?.modules.find((o) => o.id === "pages")?.title ?? t("module.title")
1170
- ), D = W(() => [
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
- () => B.value && a.value ? [{ ...a.value, children_count: 0 }, ...c.value] : c.value
1178
- ), U = W(() => [
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: 130,
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: 180,
1119
+ width: 150,
1194
1120
  hideBelow: 900,
1195
1121
  hidden: p.value
1196
1122
  },
1197
- { key: "actions", label: "", width: 56, align: "right" }
1198
- ]), q = W(
1199
- () => B.value ? {
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: (o) => l.list({ parent: o.id }).then((w) => w.items),
1204
- draggable: _.value,
1205
- allowDrag: (o) => o.can.move,
1206
- allowDrop: ue
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 ue(o, w, v) {
1210
- return w.is_home ? v === "inside" : o.id !== w.id;
1135
+ function re(n, T, m) {
1136
+ return T.is_home ? m === "inside" : n.id !== T.id;
1211
1137
  }
1212
- async function M() {
1213
- f.value = !0;
1138
+ async function S() {
1139
+ h.value = !0;
1214
1140
  try {
1215
- const o = await l.list({
1216
- search: i.value.trim(),
1217
- status: p.value ? "" : T.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
- a.value = o.home, c.value = o.items;
1221
- } catch (o) {
1222
- z.danger(d(o));
1146
+ l.value = n.home, c.value = n.items;
1147
+ } catch (n) {
1148
+ V.danger(d(n));
1223
1149
  } finally {
1224
- f.value = !1;
1150
+ h.value = !1;
1225
1151
  }
1226
1152
  }
1227
- function de(o) {
1228
- o.search !== i.value && (i.value = o.search, M());
1153
+ function te(n) {
1154
+ n.search !== r.value && (r.value = n.search, S());
1229
1155
  }
1230
- function ee(o) {
1231
- const w = `${r.base}/${o.id}`;
1232
- s.resolve(w).matched.length > 0 && s.push(w);
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 ce(o) {
1235
- const w = await x({ parent: o });
1236
- w && (await M(), ee(w));
1160
+ async function ue(n) {
1161
+ const T = await w({ parent: n });
1162
+ T && (await S(), E(T));
1237
1163
  }
1238
- async function te(o) {
1164
+ async function de(n) {
1239
1165
  try {
1240
- await l.duplicate(o.id), z.success(t("page.duplicated")), await M();
1241
- } catch (w) {
1242
- z.danger(d(w));
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 L(o) {
1246
- const w = await C({ page: o });
1247
- w != null && await ne(o, w, "inside");
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(o) {
1250
- const w = o.zone === "inside" ? o.target.id : o.target.parent_id, v = o.row.descendants_count + 1;
1251
- if (w !== o.row.parent_id && v > 1 && !await O({
1252
- title: t("page.move-title", { title: o.row.title }),
1253
- message: t("page.move-branch", { count: v }),
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 M();
1183
+ await S();
1258
1184
  return;
1259
1185
  }
1260
- await ne(o.row, o.target.id, o.zone);
1186
+ await G(n.row, n.target.id, n.zone);
1261
1187
  }
1262
- async function ne(o, w, v) {
1188
+ async function G(n, T, m) {
1263
1189
  try {
1264
- const X = await l.move(o.id, w, v);
1265
- z.success(
1266
- X.addresses_changed > 1 ? t("page.moved", { count: X.addresses_changed }) : t("page.moved-one")
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 (X) {
1269
- z.danger(d(X));
1194
+ } catch (J) {
1195
+ V.danger(d(J));
1270
1196
  } finally {
1271
- await M();
1197
+ await S();
1272
1198
  }
1273
1199
  }
1274
- async function ve(o) {
1275
- if (await O({
1276
- title: t("page.delete-title", { title: o.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
- o.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: o.descendants_count })}` : t("page.delete-text")
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 l.remove(o.id), z.success(t("page.deleted")), await M();
1288
- } catch (v) {
1289
- z.danger(d(v));
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 he(o) {
1293
- if (await O({
1294
- title: t("page.restore-page-title", { title: o.title }),
1295
- message: o.descendants_count > 0 ? `${t("page.restore-page-text")} ${t("page.restore-branch", { count: o.descendants_count })}` : t("page.restore-page-text"),
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 v = await l.restore(o.id);
1301
- z.success(
1302
- v > 1 ? t("page.restored-branch", { count: v }) : t("page.restored")
1303
- ), await M();
1304
- } catch (v) {
1305
- z.danger(d(v));
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 J(o) {
1309
- if (o.url)
1234
+ async function he(n) {
1235
+ if (n.url)
1310
1236
  try {
1311
- await navigator.clipboard.writeText(o.url), z.success(t("page.address-copied"));
1237
+ await navigator.clipboard.writeText(n.url), V.success(t("page.address-copied"));
1312
1238
  } catch {
1313
1239
  }
1314
1240
  }
1315
- function Q(o) {
1316
- return o === "published" ? "success" : o === "modified" ? "warning" : "default";
1241
+ function O(n) {
1242
+ return n === "published" ? "success" : n === "modified" ? "warning" : "default";
1317
1243
  }
1318
- return ae(T, () => {
1319
- M();
1320
- }), pe(M), (o, w) => (m(), A("div", Ht, [
1321
- g(e(tt), {
1322
- view: T.value,
1323
- "onUpdate:view": w[2] || (w[2] = (v) => T.value = v),
1324
- title: $.value,
1325
- views: D.value
1326
- }, Je({
1327
- default: n(() => [
1328
- g(e(ct), {
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: U.value,
1263
+ columns: A.value,
1331
1264
  "row-key": "id",
1332
- tree: q.value,
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: f.value,
1271
+ loading: h.value,
1339
1272
  "cards-below": 0,
1340
1273
  "search-placeholder": e(t)("page.search"),
1341
- "empty-text": i.value ? e(t)("page.empty-search") : p.value ? e(t)("page.empty-bin") : e(t)("page.empty"),
1342
- "aria-label": $.value,
1343
- onRowClick: ee,
1344
- onStateChange: de,
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": n(({ row: v }) => [
1348
- E("span", jt, b(v.is_home ? e(t)("pages.home") : v.title), 1)
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": n(({ row: v }) => [
1351
- p.value ? (m(), V(e(R), {
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: n(() => [...w[3] || (w[3] = [
1357
- y("—", -1)
1289
+ default: i(() => [...T[2] || (T[2] = [
1290
+ $("—", -1)
1358
1291
  ])]),
1359
1292
  _: 1
1360
- })) : v.url && v.status !== "draft" ? (m(), A("a", {
1293
+ })) : m.url && m.status !== "draft" ? (f(), N("a", {
1361
1294
  key: 1,
1362
1295
  class: "wx-pages__address",
1363
- href: v.url,
1296
+ href: m.url,
1364
1297
  target: "_blank",
1365
1298
  rel: "noopener",
1366
- onClick: w[1] || (w[1] = Qe(() => {
1299
+ onClick: T[0] || (T[0] = He(() => {
1367
1300
  }, ["stop"]))
1368
- }, " /" + b(v.path), 9, Gt)) : v.path !== null ? (m(), V(e(R), {
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: n(() => [
1375
- y("/" + b(v.path), 1)
1307
+ default: i(() => [
1308
+ $("/" + x(m.path), 1)
1376
1309
  ]),
1377
1310
  _: 2
1378
- }, 1024)) : (m(), V(e(R), {
1311
+ }, 1024)) : (f(), C(e(U), {
1379
1312
  key: 3,
1380
1313
  size: "sm",
1381
1314
  tone: "muted"
1382
1315
  }, {
1383
- default: n(() => [
1384
- y(b(e(t)("page.no-address")), 1)
1316
+ default: i(() => [
1317
+ $(x(e(t)("page.no-address")), 1)
1385
1318
  ]),
1386
1319
  _: 1
1387
1320
  }))
1388
1321
  ]),
1389
- "cell-status": n(({ row: v }) => [
1390
- p.value ? (m(), V(e(me), {
1322
+ "cell-status": i(({ row: m }) => [
1323
+ p.value ? (f(), C(e(be), {
1391
1324
  key: 0,
1392
- value: v.deleted_at
1393
- }, null, 8, ["value"])) : (m(), V(e(we), {
1325
+ value: m.deleted_at
1326
+ }, null, 8, ["value"])) : (f(), C(e(xe), {
1394
1327
  key: 1,
1395
- type: Q(v.status),
1328
+ type: O(m.status),
1396
1329
  dot: ""
1397
1330
  }, {
1398
- default: n(() => [
1399
- y(b(e(t)(`page.status-${v.status}`)), 1)
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": n(({ row: v }) => [
1405
- g(e(R), {
1337
+ "cell-updated_at": i(({ row: m }) => [
1338
+ v(e(U), {
1406
1339
  size: "sm",
1407
1340
  tone: "muted"
1408
1341
  }, {
1409
- default: n(() => [
1410
- g(e(me), {
1411
- value: v.updated_at
1342
+ default: i(() => [
1343
+ v(e(be), {
1344
+ value: m.updated_at,
1345
+ compact: ""
1412
1346
  }, null, 8, ["value"]),
1413
- v.edited_by && !p.value ? (m(), A(j, { key: 0 }, [
1414
- y(", " + b(v.edited_by), 1)
1415
- ], 64)) : N("", !0)
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": n(({ row: v }) => [
1421
- _.value ? (m(), V(Rt, {
1354
+ "cell-actions": i(({ row: m }) => [
1355
+ b.value ? (f(), C(zt, {
1422
1356
  key: 0,
1423
- page: v,
1357
+ page: m,
1424
1358
  "in-bin": p.value,
1425
- onOpen: ee,
1426
- onAdd: ce,
1427
- onDuplicate: te,
1428
- onMove: L,
1429
- onCopy: J,
1430
- onRemove: ve,
1431
- onRestore: he
1432
- }, null, 8, ["page", "in-bin"])) : N("", !0)
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
- _: 2
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
- }), Qt = /* @__PURE__ */ re(Jt, [["__scopeId", "data-v-580089b5"]]);
1459
- function ta(u = {}) {
1460
- const r = u.path ?? "/pages";
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: r,
1380
+ path: o,
1464
1381
  routes: [
1465
- { path: r, name: "webx.pages", component: Qt, props: { base: r } },
1382
+ { path: o, name: "webx.pages", component: It, props: { base: o } },
1466
1383
  {
1467
- path: `${r}/:id(\\d+)`,
1384
+ path: `${o}/:id(\\d+)`,
1468
1385
  name: "webx.pages.edit",
1469
- component: Bt,
1470
- props: { base: r }
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: Ut, kind: "display" },
1483
- "wx-page-danger": { component: wt, kind: "display" },
1484
- "wx-page-history": { component: At, kind: "display" }
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
- wt as WxPageDanger,
1490
- Bt as WxPageEditorPage,
1491
- At as WxPageHistory,
1492
- Te as WxPagePicker,
1493
- Ut as WxPagePlace,
1494
- Qt as WxPagesPage,
1495
- Z as createPagesApi,
1496
- Ee as pageEditorKey,
1497
- ta as pages,
1498
- vt as pagesMessages,
1499
- gt as providePageEditor,
1500
- Ot as slugify,
1501
- ke as usePageEditor
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