@webx-ui/module-admin 0.14.4 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BackButton.d.ts +1 -1
- package/dist/DateText.d.ts +1 -1
- package/dist/HelpButton.d.ts +1 -1
- package/dist/LinkField.d.ts +1 -1
- package/dist/LinkPicker.d.ts +1 -1
- package/dist/RenameButton.d.ts +4 -4
- package/dist/RowMenu.d.ts +1 -1
- package/dist/Screen.d.ts +1 -1
- package/dist/SlugField.d.ts +2 -0
- package/dist/address.d.ts +25 -0
- package/dist/categories/CategoriesField.d.ts +29 -0
- package/dist/categories/CategoriesPage.d.ts +6 -0
- package/dist/categories/CategoryCreateDialog.d.ts +8 -0
- package/dist/categories/CategoryEditorPage.d.ts +6 -0
- package/dist/categories/api.d.ts +38 -0
- package/dist/categories/editor.d.ts +22 -0
- package/dist/categories/index.d.ts +6 -0
- package/dist/categories/ordering.d.ts +41 -0
- package/dist/categories/routes.d.ts +12 -0
- package/dist/categories/types.d.ts +68 -0
- package/dist/categories/words.d.ts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1664 -959
- package/dist/index.js.map +1 -1
- package/dist/screenTypes.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,65 +1,185 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { RouterLink as
|
|
3
|
-
import {
|
|
4
|
-
import { watchSystemTheme as
|
|
5
|
-
import { WxScreenRenderer as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const e =
|
|
1
|
+
import { inject as ne, reactive as pe, defineComponent as N, useModel as ue, ref as W, watch as ee, computed as x, openBlock as p, createElementBlock as T, createVNode as b, unref as n, withCtx as g, createElementVNode as O, toDisplayString as L, createBlock as $, createTextVNode as V, createCommentVNode as U, mergeModels as oe, onMounted as Le, Fragment as H, renderList as Q, mergeProps as je, withModifiers as Ke, useSlots as ht, useTemplateRef as qe, normalizeClass as ae, renderSlot as F, createSlots as Ae, provide as Ye, normalizeProps as gt, guardReactiveProps as yt, resolveComponent as j, watchEffect as bt, onUnmounted as wt, isRef as Xe, createApp as xt, h as de, nextTick as Ge, withKeys as Je, onBeforeUnmount as Qe } from "vue";
|
|
2
|
+
import { RouterLink as kt, useRouter as ge, useRoute as Ze, createRouter as _t, createWebHistory as $t, onBeforeRouteLeave as Tt } from "vue-router";
|
|
3
|
+
import { WxSortableList as et, WxAction as se, WxBadge as ze, WxSelect as tt, WxSegmented as St, WxAutocomplete as Be, WxText as G, WxInput as ye, WxCheckbox as Ie, WxActions as Ct, WxDropdownItem as Wt, useElementWidth as Lt, WxHeading as At, WxButton as Z, WxIcon as Ve, WxTabs as zt, WxCard as Se, WxRichText as Vt, useLocales as at, WxAlert as be, WxResult as Et, useResponsiveShell as Ut, shellLayoutFor as Rt, WxToaster as Nt, WebxUI as Bt, dateLocaleKey as It, localesKey as Pt, useModal as Dt, WxDialog as nt, WxFormItem as Mt, WxSpace as Ft, createModal as Ot, WxSkeleton as re, WxEmpty as lt, WxTooltip as ot, toast as D, confirm as he, localizedValue as Ht, WxBreadcrumb as jt, WxBreadcrumbItem as Pe, WxActionBar as Kt, WxPopover as qt, WxAvatar as Yt, WxTextarea as De } from "@webx-ui/core";
|
|
4
|
+
import { watchSystemTheme as Xt, applyTheme as Gt, systemTheme as Jt } from "@webx-ui/tokens";
|
|
5
|
+
import { WxScreenRenderer as Qt } from "@webx-ui/schema";
|
|
6
|
+
const we = /* @__PURE__ */ Symbol("webx-i18n");
|
|
7
|
+
function Zt() {
|
|
8
|
+
const e = ne(we, null);
|
|
9
9
|
if (e === null)
|
|
10
10
|
throw new Error("useI18n() was called outside a panel created by createAdmin().");
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const t =
|
|
15
|
-
return t === null ?
|
|
13
|
+
function P(e) {
|
|
14
|
+
const t = ne(we, null);
|
|
15
|
+
return t === null ? Ee().scope(e) : t.scope(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
e.provide(
|
|
17
|
+
function ea(e, t) {
|
|
18
|
+
e.provide(we, t);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const t = e.fallback ?? "en",
|
|
20
|
+
function Ee(e = {}) {
|
|
21
|
+
const t = e.fallback ?? "en", a = pe({
|
|
22
22
|
locale: e.locale ?? t,
|
|
23
23
|
fallback: t,
|
|
24
24
|
panelLocales: [],
|
|
25
25
|
contentLocales: []
|
|
26
|
-
}),
|
|
27
|
-
function s(r, u,
|
|
28
|
-
let
|
|
29
|
-
for (const m of
|
|
30
|
-
if (typeof
|
|
26
|
+
}), l = {}, i = pe({ value: {} });
|
|
27
|
+
function s(r, u, c) {
|
|
28
|
+
let h = r[u]?.[c[0] ?? ""];
|
|
29
|
+
for (const m of c.slice(1)) {
|
|
30
|
+
if (typeof h != "object" || h === null)
|
|
31
31
|
return null;
|
|
32
|
-
|
|
32
|
+
h = h[m];
|
|
33
33
|
}
|
|
34
|
-
return typeof
|
|
34
|
+
return typeof h == "string" ? h : null;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const [
|
|
36
|
+
function o(r, u, c) {
|
|
37
|
+
const [h, m] = u.includes("::") ? u.split("::", 2) : [r, u], v = m.split("."), d = s(i.value, h, v) ?? s(l, h, v) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
|
|
38
38
|
// label says nothing to anybody trying to fix it.
|
|
39
39
|
u;
|
|
40
|
-
return
|
|
40
|
+
return c === void 0 ? d : ta(d, c);
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
|
-
state:
|
|
43
|
+
state: a,
|
|
44
44
|
defaults(r, u) {
|
|
45
|
-
|
|
45
|
+
l[r] = { ...l[r], ...u };
|
|
46
46
|
},
|
|
47
|
-
load(r, u,
|
|
48
|
-
i.value = r ?? {},
|
|
47
|
+
load(r, u, c) {
|
|
48
|
+
i.value = r ?? {}, a.locale = u ?? a.locale, c !== void 0 && (a.fallback = c);
|
|
49
49
|
},
|
|
50
50
|
scope(r) {
|
|
51
|
-
return (u,
|
|
51
|
+
return (u, c) => o(r, u, c);
|
|
52
52
|
},
|
|
53
|
-
t: (r, u) =>
|
|
53
|
+
t: (r, u) => o("", r, u)
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
let
|
|
58
|
-
for (const [
|
|
59
|
-
|
|
60
|
-
return
|
|
56
|
+
function ta(e, t) {
|
|
57
|
+
let a = e;
|
|
58
|
+
for (const [l, i] of Object.entries(t))
|
|
59
|
+
a = a.replaceAll(`:${l}`, String(i));
|
|
60
|
+
return a;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function xe(e, t) {
|
|
63
|
+
const a = `${e.apiPath}/${t.replace(/^\/+|\/+$/g, "")}`, l = (i) => i.data;
|
|
64
|
+
return {
|
|
65
|
+
list: (i = {}) => {
|
|
66
|
+
const s = new URLSearchParams();
|
|
67
|
+
return i.q && s.set("q", i.q), i.visible && s.set("visible", "1"), e.http.get(s.size > 0 ? `${a}?${s}` : a);
|
|
68
|
+
},
|
|
69
|
+
create: (i) => e.http.post(a, i).then(l),
|
|
70
|
+
get: (i) => e.http.get(`${a}/${i}`).then(l),
|
|
71
|
+
save: (i, s) => e.http.put(`${a}/${i}`, { values: s }).then(l),
|
|
72
|
+
remove: (i) => e.http.delete(`${a}/${i}`).then(() => {
|
|
73
|
+
}),
|
|
74
|
+
restore: (i) => e.http.post(`${a}/${i}/restore`, {}).then(l),
|
|
75
|
+
reorder: (i) => e.http.post(`${a}/reorder`, { ids: i }).then(() => {
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function aa(e, t, a, l = null) {
|
|
80
|
+
const i = `${e.apiPath}/${t.replace(/^\/+|\/+$/g, "")}`;
|
|
81
|
+
return e.http.post(`${i}/reorder`, l === null ? { ids: a } : { ids: a, category: l }).then(() => {
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const na = { class: "wx-categories-field" }, la = { class: "wx-categories-field__name" }, oa = /* @__PURE__ */ N({
|
|
85
|
+
name: "WxCategoriesField",
|
|
86
|
+
__name: "CategoriesField",
|
|
87
|
+
props: /* @__PURE__ */ oe({
|
|
88
|
+
source: {},
|
|
89
|
+
main: { type: Boolean, default: !0 },
|
|
90
|
+
disabled: { type: Boolean, default: !1 },
|
|
91
|
+
mainText: { default: void 0 },
|
|
92
|
+
addText: { default: void 0 },
|
|
93
|
+
removeText: { default: void 0 },
|
|
94
|
+
emptyText: { default: void 0 },
|
|
95
|
+
noneLeftText: { default: void 0 }
|
|
96
|
+
}, {
|
|
97
|
+
modelValue: { default: () => [] },
|
|
98
|
+
modelModifiers: {}
|
|
99
|
+
}),
|
|
100
|
+
emits: ["update:modelValue"],
|
|
101
|
+
setup(e) {
|
|
102
|
+
const t = e, a = ue(e, "modelValue"), l = X(), i = P("webx-admin"), s = W([]);
|
|
103
|
+
ee(
|
|
104
|
+
() => t.source,
|
|
105
|
+
async (v) => {
|
|
106
|
+
try {
|
|
107
|
+
const d = await xe(l, v).list();
|
|
108
|
+
s.value = d.data.map((w) => ({ id: w.id, name: w.name }));
|
|
109
|
+
} catch {
|
|
110
|
+
s.value = [];
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{ immediate: !0 }
|
|
114
|
+
);
|
|
115
|
+
const o = x(() => Array.isArray(a.value) ? a.value : []), r = x(() => new Map(s.value.map((v) => [v.id, v.name]))), u = x({
|
|
116
|
+
get: () => o.value.map((v) => ({ id: v, name: r.value.get(v) ?? `#${v}` })),
|
|
117
|
+
set: (v) => {
|
|
118
|
+
a.value = v.map((d) => d.id);
|
|
119
|
+
}
|
|
120
|
+
}), c = x(
|
|
121
|
+
() => s.value.filter((v) => !o.value.includes(v.id)).map((v) => ({ label: v.name, value: v.id }))
|
|
122
|
+
);
|
|
123
|
+
function h(v) {
|
|
124
|
+
typeof v != "number" || o.value.includes(v) || (a.value = [...o.value, v]);
|
|
125
|
+
}
|
|
126
|
+
function m(v) {
|
|
127
|
+
a.value = o.value.filter((d) => d !== v);
|
|
128
|
+
}
|
|
129
|
+
return (v, d) => (p(), T("div", na, [
|
|
130
|
+
b(n(et), {
|
|
131
|
+
modelValue: u.value,
|
|
132
|
+
"onUpdate:modelValue": d[0] || (d[0] = (w) => u.value = w),
|
|
133
|
+
plain: "",
|
|
134
|
+
size: "sm",
|
|
135
|
+
"item-key": "id",
|
|
136
|
+
"item-label": "name",
|
|
137
|
+
disabled: t.disabled,
|
|
138
|
+
"empty-text": t.emptyText ?? n(i)("categories.field-empty")
|
|
139
|
+
}, {
|
|
140
|
+
default: g(({ item: w, index: f }) => [
|
|
141
|
+
O("span", la, L(w.name), 1),
|
|
142
|
+
t.main && f === 0 ? (p(), $(n(ze), {
|
|
143
|
+
key: 0,
|
|
144
|
+
type: "primary"
|
|
145
|
+
}, {
|
|
146
|
+
default: g(() => [
|
|
147
|
+
V(L(t.mainText ?? n(i)("categories.field-main")), 1)
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})) : U("", !0)
|
|
151
|
+
]),
|
|
152
|
+
actions: g(({ item: w }) => [
|
|
153
|
+
b(n(se), {
|
|
154
|
+
type: "remove",
|
|
155
|
+
size: "sm",
|
|
156
|
+
disabled: t.disabled,
|
|
157
|
+
title: t.removeText ?? n(i)("categories.field-remove"),
|
|
158
|
+
onClick: (f) => m(w.id)
|
|
159
|
+
}, null, 8, ["disabled", "title", "onClick"])
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 8, ["modelValue", "disabled", "empty-text"]),
|
|
163
|
+
b(n(tt), {
|
|
164
|
+
"model-value": null,
|
|
165
|
+
options: c.value,
|
|
166
|
+
placeholder: t.addText ?? n(i)("categories.field-add"),
|
|
167
|
+
disabled: t.disabled || c.value.length === 0,
|
|
168
|
+
"empty-text": t.noneLeftText ?? n(i)("categories.field-none-left"),
|
|
169
|
+
filterable: "",
|
|
170
|
+
teleport: "",
|
|
171
|
+
"aria-label": t.addText ?? n(i)("categories.field-add"),
|
|
172
|
+
"onUpdate:modelValue": h
|
|
173
|
+
}, null, 8, ["options", "placeholder", "disabled", "empty-text", "aria-label"])
|
|
174
|
+
]));
|
|
175
|
+
}
|
|
176
|
+
}), Y = (e, t) => {
|
|
177
|
+
const a = e.__vccOpts || e;
|
|
178
|
+
for (const [l, i] of t)
|
|
179
|
+
a[l] = i;
|
|
180
|
+
return a;
|
|
181
|
+
}, sa = /* @__PURE__ */ Y(oa, [["__scopeId", "data-v-640cd836"]]);
|
|
182
|
+
function ia() {
|
|
63
183
|
return {
|
|
64
184
|
target: "entity",
|
|
65
185
|
entity_type: null,
|
|
@@ -70,31 +190,31 @@ function Et() {
|
|
|
70
190
|
rel: []
|
|
71
191
|
};
|
|
72
192
|
}
|
|
73
|
-
function
|
|
74
|
-
const t = `${e.apiPath}/links`,
|
|
193
|
+
function ra(e) {
|
|
194
|
+
const t = `${e.apiPath}/links`, a = (l) => l.data;
|
|
75
195
|
return {
|
|
76
|
-
sources: () => e.http.get(`${t}/sources`).then(
|
|
77
|
-
search: (
|
|
78
|
-
resolve: (
|
|
79
|
-
routes: () => e.http.get(`${t}/routes`).then(
|
|
196
|
+
sources: () => e.http.get(`${t}/sources`).then(a),
|
|
197
|
+
search: (l, i, s) => e.http.get(`${t}/search`, { query: { type: l, q: i, locale: s } }).then(a),
|
|
198
|
+
resolve: (l, i) => e.http.post(`${t}/resolve`, { links: l, locale: i }).then(a),
|
|
199
|
+
routes: () => e.http.get(`${t}/routes`).then(a)
|
|
80
200
|
};
|
|
81
201
|
}
|
|
82
|
-
const
|
|
202
|
+
const ua = { class: "wx-link-picker" }, da = {
|
|
83
203
|
key: 0,
|
|
84
204
|
class: "wx-link-picker__entity"
|
|
85
|
-
},
|
|
205
|
+
}, ca = {
|
|
86
206
|
key: 1,
|
|
87
207
|
class: "wx-link-picker__url"
|
|
88
|
-
},
|
|
208
|
+
}, ma = {
|
|
89
209
|
key: 2,
|
|
90
210
|
class: "wx-link-picker__hash"
|
|
91
|
-
},
|
|
211
|
+
}, va = {
|
|
92
212
|
key: 3,
|
|
93
213
|
class: "wx-link-picker__attributes"
|
|
94
|
-
},
|
|
214
|
+
}, fa = { class: "wx-link-picker__rel" }, pa = /* @__PURE__ */ N({
|
|
95
215
|
name: "WxLinkPicker",
|
|
96
216
|
__name: "LinkPicker",
|
|
97
|
-
props: /* @__PURE__ */
|
|
217
|
+
props: /* @__PURE__ */ oe({
|
|
98
218
|
allowNone: { type: Boolean, default: !0 },
|
|
99
219
|
attributes: { type: Boolean, default: !0 },
|
|
100
220
|
disabled: { type: Boolean, default: !1 }
|
|
@@ -104,212 +224,207 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
104
224
|
}),
|
|
105
225
|
emits: ["update:modelValue"],
|
|
106
226
|
setup(e) {
|
|
107
|
-
const t = e,
|
|
108
|
-
let
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
{ value: "entity", label:
|
|
112
|
-
{ value: "url", label:
|
|
227
|
+
const t = e, a = ue(e, "modelValue"), l = X(), i = Zt(), s = ra(l), o = P("webx-admin"), r = W([]), u = W([]), c = W([]), h = W(!1), m = W(null), v = W(""), d = W(null);
|
|
228
|
+
let w = null;
|
|
229
|
+
const f = x(() => a.value ?? ia()), y = x(() => {
|
|
230
|
+
const _ = [
|
|
231
|
+
{ value: "entity", label: o("links.target-entity") },
|
|
232
|
+
{ value: "url", label: o("links.target-url") }
|
|
113
233
|
];
|
|
114
|
-
return t.allowNone ? [...
|
|
115
|
-
}),
|
|
116
|
-
() => r.value.map((
|
|
117
|
-
),
|
|
118
|
-
() => u.value.map((
|
|
119
|
-
value:
|
|
120
|
-
description:
|
|
121
|
-
id:
|
|
234
|
+
return t.allowNone ? [..._, { value: "none", label: o("links.target-none") }] : _;
|
|
235
|
+
}), k = x(
|
|
236
|
+
() => r.value.map((_) => ({ value: _.type, label: _.title }))
|
|
237
|
+
), M = x(
|
|
238
|
+
() => u.value.map((_) => ({
|
|
239
|
+
value: _.title,
|
|
240
|
+
description: z(_),
|
|
241
|
+
id: _.id
|
|
122
242
|
}))
|
|
123
|
-
),
|
|
124
|
-
() =>
|
|
243
|
+
), J = x(
|
|
244
|
+
() => c.value.map((_) => ({ value: _.path, description: _.name }))
|
|
125
245
|
);
|
|
126
|
-
|
|
127
|
-
r.value = await s.sources(), m.value =
|
|
128
|
-
}),
|
|
129
|
-
() => [
|
|
246
|
+
Le(async () => {
|
|
247
|
+
r.value = await s.sources(), m.value = f.value.entity_type ?? r.value[0]?.type ?? null, await Promise.all([S(), B()]);
|
|
248
|
+
}), ee(
|
|
249
|
+
() => [f.value.entity_type, f.value.entity_id].join(":"),
|
|
130
250
|
() => {
|
|
131
|
-
|
|
251
|
+
S();
|
|
132
252
|
}
|
|
133
253
|
);
|
|
134
|
-
async function
|
|
135
|
-
const { entity_type:
|
|
136
|
-
if (
|
|
137
|
-
|
|
254
|
+
async function S() {
|
|
255
|
+
const { entity_type: _, entity_id: R } = f.value;
|
|
256
|
+
if (_ === null || R === null) {
|
|
257
|
+
d.value = null, v.value = "";
|
|
138
258
|
return;
|
|
139
259
|
}
|
|
140
|
-
if (
|
|
260
|
+
if (d.value?.id === R)
|
|
141
261
|
return;
|
|
142
|
-
const [
|
|
143
|
-
|
|
262
|
+
const [I] = await s.resolve([{ type: _, id: R }], i.state.locale);
|
|
263
|
+
d.value = I ?? null, v.value = I?.title ?? o("links.missing"), w = v.value;
|
|
144
264
|
}
|
|
145
|
-
async function
|
|
146
|
-
|
|
265
|
+
async function B() {
|
|
266
|
+
c.value = await s.routes();
|
|
147
267
|
}
|
|
148
|
-
async function
|
|
149
|
-
if (
|
|
150
|
-
|
|
268
|
+
async function C(_) {
|
|
269
|
+
if (_ === w) {
|
|
270
|
+
w = null;
|
|
151
271
|
return;
|
|
152
272
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
273
|
+
if (w = null, m.value !== null) {
|
|
274
|
+
h.value = !0;
|
|
155
275
|
try {
|
|
156
|
-
u.value = await s.search(m.value,
|
|
276
|
+
u.value = await s.search(m.value, _, i.state.locale);
|
|
157
277
|
} finally {
|
|
158
|
-
|
|
278
|
+
h.value = !1;
|
|
159
279
|
}
|
|
160
280
|
}
|
|
161
281
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
282
|
+
function A(_) {
|
|
283
|
+
_ !== void 0 && (a.value = { ...f.value, target: _ });
|
|
164
284
|
}
|
|
165
|
-
function
|
|
166
|
-
m.value =
|
|
285
|
+
function E(_) {
|
|
286
|
+
m.value = _ == null ? null : String(_), u.value = [], C("");
|
|
167
287
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
|
|
288
|
+
function K(_) {
|
|
289
|
+
const R = u.value.find((I) => I.id === _.id);
|
|
290
|
+
R === void 0 || m.value === null || (d.value = R, v.value = R.title, a.value = { ...f.value, entity_type: m.value, entity_id: R.id });
|
|
171
291
|
}
|
|
172
|
-
function
|
|
173
|
-
|
|
292
|
+
function le() {
|
|
293
|
+
d.value = null, v.value = "", u.value = [], a.value = { ...f.value, entity_type: null, entity_id: null };
|
|
174
294
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
295
|
+
function ie(_) {
|
|
296
|
+
a.value = { ...f.value, url: _ === "" ? null : _ };
|
|
177
297
|
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
|
|
298
|
+
function te(_) {
|
|
299
|
+
const R = (typeof _ == "string" || typeof _ == "number" ? String(_) : "").replace(/^#+/, "").trim();
|
|
300
|
+
a.value = { ...f.value, hash: R === "" ? null : R };
|
|
181
301
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
302
|
+
function ke(_) {
|
|
303
|
+
a.value = { ...f.value, new_tab: _ };
|
|
184
304
|
}
|
|
185
|
-
function
|
|
186
|
-
const
|
|
187
|
-
|
|
305
|
+
function _e(_, R) {
|
|
306
|
+
const I = f.value.rel.filter(($e) => $e !== _);
|
|
307
|
+
a.value = { ...f.value, rel: R ? [...I, _] : I };
|
|
188
308
|
}
|
|
189
|
-
function
|
|
190
|
-
const
|
|
191
|
-
(
|
|
309
|
+
function z(_) {
|
|
310
|
+
const R = [_.hint, _.url ?? void 0].filter(
|
|
311
|
+
(I) => typeof I == "string" && I !== ""
|
|
192
312
|
);
|
|
193
|
-
return
|
|
313
|
+
return _.available || R.push(o("links.unavailable")), R.join(" · ");
|
|
194
314
|
}
|
|
195
|
-
const
|
|
196
|
-
return (
|
|
197
|
-
|
|
198
|
-
options:
|
|
199
|
-
"model-value":
|
|
315
|
+
const q = ["nofollow", "sponsored", "ugc"];
|
|
316
|
+
return (_, R) => (p(), T("div", ua, [
|
|
317
|
+
b(n(St), {
|
|
318
|
+
options: y.value,
|
|
319
|
+
"model-value": f.value.target,
|
|
200
320
|
disabled: t.disabled,
|
|
201
|
-
"aria-label": o
|
|
202
|
-
"onUpdate:modelValue":
|
|
321
|
+
"aria-label": n(o)("links.target-entity"),
|
|
322
|
+
"onUpdate:modelValue": A
|
|
203
323
|
}, null, 8, ["options", "model-value", "disabled", "aria-label"]),
|
|
204
|
-
|
|
205
|
-
|
|
324
|
+
f.value.target === "entity" ? (p(), T("div", da, [
|
|
325
|
+
k.value.length > 1 ? (p(), $(n(tt), {
|
|
206
326
|
key: 0,
|
|
207
327
|
class: "wx-link-picker__section",
|
|
208
|
-
options:
|
|
328
|
+
options: k.value,
|
|
209
329
|
"model-value": m.value,
|
|
210
330
|
disabled: t.disabled,
|
|
211
|
-
"aria-label": o
|
|
212
|
-
"onUpdate:modelValue":
|
|
213
|
-
}, null, 8, ["options", "model-value", "disabled", "aria-label"])) :
|
|
214
|
-
|
|
331
|
+
"aria-label": n(o)("links.section"),
|
|
332
|
+
"onUpdate:modelValue": E
|
|
333
|
+
}, null, 8, ["options", "model-value", "disabled", "aria-label"])) : U("", !0),
|
|
334
|
+
b(n(Be), {
|
|
215
335
|
class: "wx-link-picker__search",
|
|
216
|
-
"model-value":
|
|
217
|
-
options:
|
|
336
|
+
"model-value": v.value,
|
|
337
|
+
options: M.value,
|
|
218
338
|
remote: "",
|
|
219
339
|
clearable: "",
|
|
220
|
-
loading:
|
|
221
|
-
"loading-text": o
|
|
222
|
-
"empty-text": o
|
|
223
|
-
placeholder: o
|
|
224
|
-
"aria-label": o
|
|
340
|
+
loading: h.value,
|
|
341
|
+
"loading-text": n(o)("links.searching"),
|
|
342
|
+
"empty-text": n(o)("links.empty"),
|
|
343
|
+
placeholder: n(o)("links.search"),
|
|
344
|
+
"aria-label": n(o)("links.search"),
|
|
225
345
|
disabled: t.disabled,
|
|
226
|
-
"onUpdate:modelValue":
|
|
227
|
-
onSearch:
|
|
228
|
-
onSelect:
|
|
229
|
-
onClear:
|
|
346
|
+
"onUpdate:modelValue": R[0] || (R[0] = (I) => v.value = I),
|
|
347
|
+
onSearch: C,
|
|
348
|
+
onSelect: K,
|
|
349
|
+
onClear: le
|
|
230
350
|
}, null, 8, ["model-value", "options", "loading", "loading-text", "empty-text", "placeholder", "aria-label", "disabled"])
|
|
231
|
-
])) :
|
|
232
|
-
|
|
233
|
-
"model-value":
|
|
234
|
-
options:
|
|
351
|
+
])) : f.value.target === "url" ? (p(), T("div", ca, [
|
|
352
|
+
b(n(Be), {
|
|
353
|
+
"model-value": f.value.url ?? "",
|
|
354
|
+
options: J.value,
|
|
235
355
|
clearable: "",
|
|
236
356
|
"open-on-focus": "",
|
|
237
|
-
"empty-text": o
|
|
238
|
-
placeholder: o
|
|
239
|
-
"aria-label": o
|
|
357
|
+
"empty-text": n(o)("links.url-routes"),
|
|
358
|
+
placeholder: n(o)("links.url-placeholder"),
|
|
359
|
+
"aria-label": n(o)("links.url-label"),
|
|
240
360
|
disabled: t.disabled,
|
|
241
|
-
"onUpdate:modelValue":
|
|
361
|
+
"onUpdate:modelValue": ie
|
|
242
362
|
}, null, 8, ["model-value", "options", "empty-text", "placeholder", "aria-label", "disabled"])
|
|
243
|
-
])) :
|
|
244
|
-
|
|
245
|
-
|
|
363
|
+
])) : U("", !0),
|
|
364
|
+
f.value.target !== "none" ? (p(), T("label", ma, [
|
|
365
|
+
b(n(G), {
|
|
246
366
|
size: "sm",
|
|
247
367
|
tone: "muted"
|
|
248
368
|
}, {
|
|
249
369
|
default: g(() => [
|
|
250
|
-
|
|
370
|
+
V(L(n(o)("links.hash")), 1)
|
|
251
371
|
]),
|
|
252
372
|
_: 1
|
|
253
373
|
}),
|
|
254
|
-
|
|
374
|
+
R[2] || (R[2] = O("span", {
|
|
255
375
|
class: "wx-link-picker__sign",
|
|
256
376
|
"aria-hidden": "true"
|
|
257
377
|
}, "#", -1)),
|
|
258
|
-
|
|
259
|
-
"model-value":
|
|
260
|
-
placeholder: o
|
|
261
|
-
"aria-label": o
|
|
378
|
+
b(n(ye), {
|
|
379
|
+
"model-value": f.value.hash ?? "",
|
|
380
|
+
placeholder: n(o)("links.hash-placeholder"),
|
|
381
|
+
"aria-label": n(o)("links.hash"),
|
|
262
382
|
disabled: t.disabled,
|
|
263
383
|
clearable: "",
|
|
264
|
-
"onUpdate:modelValue":
|
|
384
|
+
"onUpdate:modelValue": te
|
|
265
385
|
}, null, 8, ["model-value", "placeholder", "aria-label", "disabled"])
|
|
266
|
-
])) :
|
|
267
|
-
t.attributes &&
|
|
268
|
-
|
|
269
|
-
"model-value":
|
|
386
|
+
])) : U("", !0),
|
|
387
|
+
t.attributes && f.value.target !== "none" ? (p(), T("div", va, [
|
|
388
|
+
b(n(Ie), {
|
|
389
|
+
"model-value": f.value.new_tab,
|
|
270
390
|
disabled: t.disabled,
|
|
271
|
-
"onUpdate:modelValue":
|
|
391
|
+
"onUpdate:modelValue": R[1] || (R[1] = (I) => ke(I))
|
|
272
392
|
}, {
|
|
273
393
|
default: g(() => [
|
|
274
|
-
|
|
394
|
+
V(L(n(o)("links.new-tab")), 1)
|
|
275
395
|
]),
|
|
276
396
|
_: 1
|
|
277
397
|
}, 8, ["model-value", "disabled"]),
|
|
278
|
-
|
|
279
|
-
|
|
398
|
+
O("div", fa, [
|
|
399
|
+
b(n(G), {
|
|
280
400
|
size: "sm",
|
|
281
401
|
tone: "muted"
|
|
282
402
|
}, {
|
|
283
403
|
default: g(() => [
|
|
284
|
-
|
|
404
|
+
V(L(n(o)("links.rel")), 1)
|
|
285
405
|
]),
|
|
286
406
|
_: 1
|
|
287
407
|
}),
|
|
288
|
-
(
|
|
289
|
-
key:
|
|
290
|
-
"model-value":
|
|
408
|
+
(p(), T(H, null, Q(q, (I) => b(n(Ie), {
|
|
409
|
+
key: I,
|
|
410
|
+
"model-value": f.value.rel.includes(I),
|
|
291
411
|
disabled: t.disabled,
|
|
292
|
-
"onUpdate:modelValue": (
|
|
412
|
+
"onUpdate:modelValue": ($e) => _e(I, $e)
|
|
293
413
|
}, {
|
|
294
414
|
default: g(() => [
|
|
295
|
-
|
|
415
|
+
V(L(n(o)(`links.rel-${I}`)), 1)
|
|
296
416
|
]),
|
|
297
417
|
_: 2
|
|
298
418
|
}, 1032, ["model-value", "disabled", "onUpdate:modelValue"])), 64))
|
|
299
419
|
])
|
|
300
|
-
])) :
|
|
420
|
+
])) : U("", !0)
|
|
301
421
|
]));
|
|
302
422
|
}
|
|
303
|
-
}),
|
|
304
|
-
const n = e.__vccOpts || e;
|
|
305
|
-
for (const [a, i] of t)
|
|
306
|
-
n[a] = i;
|
|
307
|
-
return n;
|
|
308
|
-
}, Ht = /* @__PURE__ */ F(Ft, [["__scopeId", "data-v-e54022e5"]]), Ot = /* @__PURE__ */ E({
|
|
423
|
+
}), ha = /* @__PURE__ */ Y(pa, [["__scopeId", "data-v-e54022e5"]]), ga = /* @__PURE__ */ N({
|
|
309
424
|
name: "WxLinkField",
|
|
310
425
|
inheritAttrs: !1,
|
|
311
426
|
__name: "LinkField",
|
|
312
|
-
props: /* @__PURE__ */
|
|
427
|
+
props: /* @__PURE__ */ oe({
|
|
313
428
|
allowNone: { type: Boolean, default: !0 },
|
|
314
429
|
attributes: { type: Boolean, default: !0 },
|
|
315
430
|
disabled: { type: Boolean, default: !1 }
|
|
@@ -319,17 +434,17 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
319
434
|
}),
|
|
320
435
|
emits: ["update:modelValue"],
|
|
321
436
|
setup(e) {
|
|
322
|
-
const t = e,
|
|
323
|
-
return (
|
|
324
|
-
modelValue:
|
|
325
|
-
"onUpdate:modelValue": i[0] || (i[0] = (s) =>
|
|
326
|
-
},
|
|
437
|
+
const t = e, a = ue(e, "modelValue");
|
|
438
|
+
return (l, i) => (p(), $(ha, je({
|
|
439
|
+
modelValue: a.value,
|
|
440
|
+
"onUpdate:modelValue": i[0] || (i[0] = (s) => a.value = s)
|
|
441
|
+
}, l.$attrs, {
|
|
327
442
|
"allow-none": t.allowNone,
|
|
328
443
|
attributes: t.attributes,
|
|
329
444
|
disabled: t.disabled
|
|
330
445
|
}), null, 16, ["modelValue", "allow-none", "attributes", "disabled"]));
|
|
331
446
|
}
|
|
332
|
-
}),
|
|
447
|
+
}), ya = /* @__PURE__ */ N({
|
|
333
448
|
__name: "BackButton",
|
|
334
449
|
props: {
|
|
335
450
|
to: {},
|
|
@@ -337,21 +452,21 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
337
452
|
size: { default: "sm" }
|
|
338
453
|
},
|
|
339
454
|
setup(e) {
|
|
340
|
-
const t = e,
|
|
341
|
-
return (i, s) => (
|
|
455
|
+
const t = e, a = P("webx-admin"), l = x(() => t.label ?? a("editor.back"));
|
|
456
|
+
return (i, s) => (p(), $(n(se), {
|
|
342
457
|
icon: "arrow-left",
|
|
343
458
|
class: "wx-back-button",
|
|
344
|
-
as:
|
|
459
|
+
as: n(kt),
|
|
345
460
|
to: e.to,
|
|
346
|
-
title:
|
|
461
|
+
title: l.value,
|
|
347
462
|
size: e.size,
|
|
348
463
|
"tooltip-side": "bottom"
|
|
349
464
|
}, null, 8, ["as", "to", "title", "size"]));
|
|
350
465
|
}
|
|
351
|
-
}),
|
|
466
|
+
}), ba = {
|
|
352
467
|
key: 0,
|
|
353
468
|
class: "wx-dropdown__divider"
|
|
354
|
-
},
|
|
469
|
+
}, wa = /* @__PURE__ */ N({
|
|
355
470
|
__name: "RowMenu",
|
|
356
471
|
props: {
|
|
357
472
|
actions: {},
|
|
@@ -359,36 +474,36 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
359
474
|
size: { default: "sm" }
|
|
360
475
|
},
|
|
361
476
|
setup(e) {
|
|
362
|
-
const t =
|
|
363
|
-
...
|
|
364
|
-
...
|
|
477
|
+
const t = P("webx-admin"), a = e, l = x(() => [
|
|
478
|
+
...a.actions.filter((s) => !s.danger),
|
|
479
|
+
...a.actions.filter((s) => s.danger)
|
|
365
480
|
]), i = x(() => {
|
|
366
|
-
const s =
|
|
367
|
-
return s &&
|
|
481
|
+
const s = l.value.find((o) => o.danger);
|
|
482
|
+
return s && l.value[0] !== s ? s.key : null;
|
|
368
483
|
});
|
|
369
|
-
return (s,
|
|
484
|
+
return (s, o) => l.value.length > 0 ? (p(), $(n(Ct), {
|
|
370
485
|
key: 0,
|
|
371
486
|
class: "wx-row-menu",
|
|
372
487
|
collapse: "always",
|
|
373
488
|
align: "end",
|
|
374
489
|
size: e.size,
|
|
375
490
|
"aria-label": e.label,
|
|
376
|
-
onClick:
|
|
491
|
+
onClick: o[0] || (o[0] = Ke(() => {
|
|
377
492
|
}, ["stop"]))
|
|
378
493
|
}, {
|
|
379
494
|
trigger: g(() => [
|
|
380
|
-
|
|
495
|
+
b(n(se), {
|
|
381
496
|
type: "more",
|
|
382
497
|
size: e.size,
|
|
383
|
-
title:
|
|
498
|
+
title: n(t)("editor.more")
|
|
384
499
|
}, null, 8, ["size", "title"])
|
|
385
500
|
]),
|
|
386
501
|
collapsed: g(() => [
|
|
387
|
-
(
|
|
502
|
+
(p(!0), T(H, null, Q(l.value, (r) => (p(), T(H, {
|
|
388
503
|
key: r.key
|
|
389
504
|
}, [
|
|
390
|
-
r.key === i.value ? (
|
|
391
|
-
|
|
505
|
+
r.key === i.value ? (p(), T("hr", ba)) : U("", !0),
|
|
506
|
+
b(n(Wt), {
|
|
392
507
|
icon: r.icon,
|
|
393
508
|
tone: r.danger ? "danger" : "default",
|
|
394
509
|
href: r.href,
|
|
@@ -397,22 +512,22 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
397
512
|
onClick: (u) => r.run?.()
|
|
398
513
|
}, {
|
|
399
514
|
default: g(() => [
|
|
400
|
-
|
|
515
|
+
V(L(r.label), 1)
|
|
401
516
|
]),
|
|
402
517
|
_: 2
|
|
403
518
|
}, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
|
|
404
519
|
], 64))), 128))
|
|
405
520
|
]),
|
|
406
521
|
_: 1
|
|
407
|
-
}, 8, ["size", "aria-label"])) :
|
|
522
|
+
}, 8, ["size", "aria-label"])) : U("", !0);
|
|
408
523
|
}
|
|
409
|
-
}),
|
|
524
|
+
}), Ue = /* @__PURE__ */ Y(wa, [["__scopeId", "data-v-cab01f7f"]]), xa = ["data-level"], ka = {
|
|
410
525
|
key: 0,
|
|
411
526
|
class: "wx-screen-head__trail"
|
|
412
|
-
},
|
|
527
|
+
}, _a = { class: "wx-screen-head__name" }, $a = {
|
|
413
528
|
key: 4,
|
|
414
529
|
class: "wx-screen-head__actions"
|
|
415
|
-
},
|
|
530
|
+
}, Ta = /* @__PURE__ */ N({
|
|
416
531
|
__name: "ScreenHead",
|
|
417
532
|
props: {
|
|
418
533
|
title: { default: void 0 },
|
|
@@ -426,57 +541,57 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
426
541
|
},
|
|
427
542
|
emits: ["back"],
|
|
428
543
|
setup(e, { emit: t }) {
|
|
429
|
-
const
|
|
430
|
-
() =>
|
|
431
|
-
), m = x(() => u.value ?
|
|
432
|
-
() =>
|
|
433
|
-
),
|
|
434
|
-
() => m.value.length > 0 ||
|
|
544
|
+
const a = e, l = t, i = P("webx-admin"), s = ht(), o = qe("root"), r = Lt(o), u = x(() => r.value > 0 && r.value < a.collapseBelow), c = x(() => a.actions ?? []), h = x(
|
|
545
|
+
() => c.value.find((f) => f.primary) ?? null
|
|
546
|
+
), m = x(() => u.value ? h.value ? [h.value] : [] : c.value.filter((f) => !f.menu && !f.danger)), v = x(() => u.value ? c.value.filter((f) => f !== h.value) : c.value.filter((f) => f.menu || f.danger)), d = x(
|
|
547
|
+
() => a.back && a.back !== !0 ? a.back : null
|
|
548
|
+
), w = x(
|
|
549
|
+
() => m.value.length > 0 || v.value.length > 0 || !!s.extra
|
|
435
550
|
);
|
|
436
|
-
return (
|
|
551
|
+
return (f, y) => (p(), T("div", {
|
|
437
552
|
ref_key: "root",
|
|
438
|
-
ref:
|
|
439
|
-
class:
|
|
553
|
+
ref: o,
|
|
554
|
+
class: ae(["wx-screen-head", {
|
|
440
555
|
"is-narrow": u.value,
|
|
441
556
|
"has-button": m.value.length > 0,
|
|
442
|
-
"has-trail": !!
|
|
557
|
+
"has-trail": !!f.$slots.trail,
|
|
443
558
|
"has-divider": e.divider
|
|
444
559
|
}]),
|
|
445
560
|
"data-level": e.level
|
|
446
561
|
}, [
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
])) :
|
|
450
|
-
|
|
562
|
+
f.$slots.trail ? (p(), T("div", ka, [
|
|
563
|
+
F(f.$slots, "trail", {}, void 0, !0)
|
|
564
|
+
])) : U("", !0),
|
|
565
|
+
d.value ? (p(), $(ya, {
|
|
451
566
|
key: 1,
|
|
452
567
|
class: "wx-screen-head__back",
|
|
453
|
-
to:
|
|
568
|
+
to: d.value,
|
|
454
569
|
label: e.backLabel,
|
|
455
570
|
"tooltip-side": "bottom"
|
|
456
|
-
}, null, 8, ["to", "label"])) : e.back ? (
|
|
571
|
+
}, null, 8, ["to", "label"])) : e.back ? (p(), $(n(se), {
|
|
457
572
|
key: 2,
|
|
458
573
|
class: "wx-screen-head__back",
|
|
459
574
|
icon: "arrow-left",
|
|
460
575
|
size: "sm",
|
|
461
576
|
"tooltip-side": "bottom",
|
|
462
|
-
title: e.backLabel ??
|
|
463
|
-
onClick:
|
|
464
|
-
}, null, 8, ["title"])) :
|
|
465
|
-
|
|
466
|
-
e.title ? (
|
|
577
|
+
title: e.backLabel ?? n(i)("editor.back"),
|
|
578
|
+
onClick: y[0] || (y[0] = (k) => l("back"))
|
|
579
|
+
}, null, 8, ["title"])) : U("", !0),
|
|
580
|
+
O("div", _a, [
|
|
581
|
+
e.title ? (p(), $(n(At), {
|
|
467
582
|
key: 0,
|
|
468
583
|
level: e.level,
|
|
469
584
|
truncate: "",
|
|
470
585
|
class: "wx-screen-head__title"
|
|
471
586
|
}, {
|
|
472
587
|
default: g(() => [
|
|
473
|
-
|
|
588
|
+
V(L(e.title), 1)
|
|
474
589
|
]),
|
|
475
590
|
_: 1
|
|
476
|
-
}, 8, ["level"])) :
|
|
477
|
-
|
|
591
|
+
}, 8, ["level"])) : U("", !0),
|
|
592
|
+
F(f.$slots, "title-after", {}, void 0, !0)
|
|
478
593
|
]),
|
|
479
|
-
e.subtitle ||
|
|
594
|
+
e.subtitle || f.$slots.subtitle ? (p(), $(n(G), {
|
|
480
595
|
key: 3,
|
|
481
596
|
class: "wx-screen-head__subtitle",
|
|
482
597
|
size: "sm",
|
|
@@ -484,53 +599,53 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
484
599
|
truncate: ""
|
|
485
600
|
}, {
|
|
486
601
|
default: g(() => [
|
|
487
|
-
|
|
488
|
-
|
|
602
|
+
F(f.$slots, "subtitle", {}, () => [
|
|
603
|
+
V(L(e.subtitle), 1)
|
|
489
604
|
], !0)
|
|
490
605
|
]),
|
|
491
606
|
_: 3
|
|
492
|
-
})) :
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
(
|
|
496
|
-
key:
|
|
497
|
-
class:
|
|
498
|
-
type:
|
|
499
|
-
variant:
|
|
500
|
-
loading:
|
|
501
|
-
disabled:
|
|
502
|
-
href:
|
|
503
|
-
target:
|
|
504
|
-
rel:
|
|
505
|
-
onClick: (
|
|
607
|
+
})) : U("", !0),
|
|
608
|
+
w.value ? (p(), T("div", $a, [
|
|
609
|
+
F(f.$slots, "extra", {}, void 0, !0),
|
|
610
|
+
(p(!0), T(H, null, Q(m.value, (k) => (p(), $(n(Z), {
|
|
611
|
+
key: k.key,
|
|
612
|
+
class: ae(["wx-screen-head__button", { "is-primary": k.primary }]),
|
|
613
|
+
type: k.primary ? "primary" : "default",
|
|
614
|
+
variant: k.primary ? "solid" : k.variant ?? "outline",
|
|
615
|
+
loading: k.loading,
|
|
616
|
+
disabled: k.disabled,
|
|
617
|
+
href: k.href,
|
|
618
|
+
target: k.href ? k.target ?? "_blank" : void 0,
|
|
619
|
+
rel: k.href ? "noopener" : void 0,
|
|
620
|
+
onClick: (M) => k.run?.()
|
|
506
621
|
}, Ae({
|
|
507
622
|
default: g(() => [
|
|
508
|
-
|
|
623
|
+
V(" " + L(k.label), 1)
|
|
509
624
|
]),
|
|
510
625
|
_: 2
|
|
511
626
|
}, [
|
|
512
|
-
|
|
627
|
+
k.icon ? {
|
|
513
628
|
name: "icon",
|
|
514
629
|
fn: g(() => [
|
|
515
|
-
|
|
516
|
-
name:
|
|
630
|
+
b(n(Ve), {
|
|
631
|
+
name: k.icon
|
|
517
632
|
}, null, 8, ["name"])
|
|
518
633
|
]),
|
|
519
634
|
key: "0"
|
|
520
635
|
} : void 0
|
|
521
636
|
]), 1032, ["class", "type", "variant", "loading", "disabled", "href", "target", "rel", "onClick"]))), 128)),
|
|
522
|
-
|
|
637
|
+
v.value.length > 0 ? (p(), $(Ue, {
|
|
523
638
|
key: 0,
|
|
524
|
-
actions:
|
|
639
|
+
actions: v.value,
|
|
525
640
|
size: "lg",
|
|
526
|
-
label: e.title ??
|
|
527
|
-
}, null, 8, ["actions", "label"])) :
|
|
528
|
-
])) :
|
|
529
|
-
], 10,
|
|
641
|
+
label: e.title ?? n(i)("editor.more")
|
|
642
|
+
}, null, 8, ["actions", "label"])) : U("", !0)
|
|
643
|
+
])) : U("", !0)
|
|
644
|
+
], 10, xa));
|
|
530
645
|
}
|
|
531
|
-
}),
|
|
646
|
+
}), st = /* @__PURE__ */ Y(Ta, [["__scopeId", "data-v-e27d184e"]]), Sa = ["data-wx-fill"], Ca = /* @__PURE__ */ N({
|
|
532
647
|
__name: "ListScreen",
|
|
533
|
-
props: /* @__PURE__ */
|
|
648
|
+
props: /* @__PURE__ */ oe({
|
|
534
649
|
title: { default: void 0 },
|
|
535
650
|
subtitle: { default: void 0 },
|
|
536
651
|
back: { default: void 0 },
|
|
@@ -547,12 +662,12 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
547
662
|
}),
|
|
548
663
|
emits: ["update:view"],
|
|
549
664
|
setup(e) {
|
|
550
|
-
const t =
|
|
551
|
-
return (
|
|
552
|
-
class:
|
|
665
|
+
const t = ue(e, "view");
|
|
666
|
+
return (a, l) => (p(), T("div", {
|
|
667
|
+
class: ae(["wx-list-screen", { "is-fill": e.fill }]),
|
|
553
668
|
"data-wx-fill": e.fill ? "" : void 0
|
|
554
669
|
}, [
|
|
555
|
-
e.title || e.actions ||
|
|
670
|
+
e.title || e.actions || a.$slots.actions ? (p(), $(st, {
|
|
556
671
|
key: 0,
|
|
557
672
|
class: "wx-list-screen__head",
|
|
558
673
|
title: e.title,
|
|
@@ -562,196 +677,236 @@ const Nt = { class: "wx-link-picker" }, Vt = {
|
|
|
562
677
|
actions: e.actions,
|
|
563
678
|
"collapse-below": 480
|
|
564
679
|
}, Ae({ _: 2 }, [
|
|
565
|
-
|
|
680
|
+
a.$slots.actions ? {
|
|
566
681
|
name: "extra",
|
|
567
682
|
fn: g(() => [
|
|
568
|
-
|
|
683
|
+
F(a.$slots, "actions", {}, void 0, !0)
|
|
569
684
|
]),
|
|
570
685
|
key: "0"
|
|
571
686
|
} : void 0
|
|
572
|
-
]), 1032, ["title", "subtitle", "back", "back-label", "actions"])) :
|
|
573
|
-
e.views && e.views.length > 0 ? (
|
|
687
|
+
]), 1032, ["title", "subtitle", "back", "back-label", "actions"])) : U("", !0),
|
|
688
|
+
e.views && e.views.length > 0 ? (p(), $(n(zt), {
|
|
574
689
|
key: 1,
|
|
575
690
|
modelValue: t.value,
|
|
576
|
-
"onUpdate:modelValue":
|
|
691
|
+
"onUpdate:modelValue": l[0] || (l[0] = (i) => t.value = i),
|
|
577
692
|
class: "wx-list-screen__views",
|
|
578
693
|
items: e.views,
|
|
579
694
|
"collapse-below": e.collapseBelow,
|
|
580
695
|
"aria-label": e.title
|
|
581
696
|
}, {
|
|
582
697
|
default: g(() => [
|
|
583
|
-
e.card ? (
|
|
698
|
+
e.card ? (p(), $(n(Se), {
|
|
584
699
|
key: 0,
|
|
585
700
|
class: "wx-list-screen__card",
|
|
586
701
|
padding: e.padding
|
|
587
702
|
}, {
|
|
588
703
|
default: g(() => [
|
|
589
|
-
|
|
704
|
+
F(a.$slots, "default", {}, void 0, !0)
|
|
590
705
|
]),
|
|
591
706
|
_: 3
|
|
592
|
-
}, 8, ["padding"])) :
|
|
707
|
+
}, 8, ["padding"])) : F(a.$slots, "default", {}, void 0, !0, 1)
|
|
593
708
|
]),
|
|
594
709
|
_: 3
|
|
595
|
-
}, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (
|
|
596
|
-
e.card ? (
|
|
710
|
+
}, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (p(), T(H, { key: 2 }, [
|
|
711
|
+
e.card ? (p(), $(n(Se), {
|
|
597
712
|
key: 0,
|
|
598
713
|
class: "wx-list-screen__card",
|
|
599
714
|
padding: e.padding
|
|
600
715
|
}, {
|
|
601
716
|
default: g(() => [
|
|
602
|
-
|
|
717
|
+
F(a.$slots, "default", {}, void 0, !0)
|
|
603
718
|
]),
|
|
604
719
|
_: 3
|
|
605
|
-
}, 8, ["padding"])) :
|
|
720
|
+
}, 8, ["padding"])) : F(a.$slots, "default", {}, void 0, !0, 1)
|
|
606
721
|
], 64))
|
|
607
|
-
], 10,
|
|
722
|
+
], 10, Sa));
|
|
608
723
|
}
|
|
609
|
-
}),
|
|
724
|
+
}), it = /* @__PURE__ */ Y(Ca, [["__scopeId", "data-v-8c7e5ad1"]]), Wa = /* @__PURE__ */ N({
|
|
610
725
|
name: "WxRichTextField",
|
|
611
726
|
inheritAttrs: !1,
|
|
612
727
|
__name: "RichTextField",
|
|
613
728
|
setup(e) {
|
|
614
|
-
const t =
|
|
615
|
-
bold:
|
|
616
|
-
italic:
|
|
617
|
-
strike:
|
|
618
|
-
code:
|
|
619
|
-
h2:
|
|
620
|
-
h3:
|
|
621
|
-
h4:
|
|
622
|
-
bulletList:
|
|
623
|
-
orderedList:
|
|
624
|
-
blockquote:
|
|
625
|
-
hr:
|
|
626
|
-
link:
|
|
627
|
-
table:
|
|
628
|
-
image:
|
|
629
|
-
youtube:
|
|
630
|
-
undo:
|
|
631
|
-
redo:
|
|
632
|
-
addRowAfter:
|
|
633
|
-
addRowBefore:
|
|
634
|
-
addColumnAfter:
|
|
635
|
-
addColumnBefore:
|
|
636
|
-
deleteRow:
|
|
637
|
-
deleteColumn:
|
|
638
|
-
mergeOrSplit:
|
|
639
|
-
deleteTable:
|
|
640
|
-
toolbar:
|
|
641
|
-
linkAddress:
|
|
642
|
-
youtubeAddress:
|
|
643
|
-
apply:
|
|
644
|
-
cancel:
|
|
645
|
-
uploading:
|
|
729
|
+
const t = X(), a = P("webx-admin"), l = x(() => t.pickImage ?? void 0), i = x(() => ({
|
|
730
|
+
bold: a("rich-text.bold"),
|
|
731
|
+
italic: a("rich-text.italic"),
|
|
732
|
+
strike: a("rich-text.strike"),
|
|
733
|
+
code: a("rich-text.code"),
|
|
734
|
+
h2: a("rich-text.h2"),
|
|
735
|
+
h3: a("rich-text.h3"),
|
|
736
|
+
h4: a("rich-text.h4"),
|
|
737
|
+
bulletList: a("rich-text.bullet-list"),
|
|
738
|
+
orderedList: a("rich-text.ordered-list"),
|
|
739
|
+
blockquote: a("rich-text.blockquote"),
|
|
740
|
+
hr: a("rich-text.hr"),
|
|
741
|
+
link: a("rich-text.link"),
|
|
742
|
+
table: a("rich-text.table"),
|
|
743
|
+
image: a("rich-text.image"),
|
|
744
|
+
youtube: a("rich-text.youtube"),
|
|
745
|
+
undo: a("rich-text.undo"),
|
|
746
|
+
redo: a("rich-text.redo"),
|
|
747
|
+
addRowAfter: a("rich-text.row-below"),
|
|
748
|
+
addRowBefore: a("rich-text.row-above"),
|
|
749
|
+
addColumnAfter: a("rich-text.column-after"),
|
|
750
|
+
addColumnBefore: a("rich-text.column-before"),
|
|
751
|
+
deleteRow: a("rich-text.delete-row"),
|
|
752
|
+
deleteColumn: a("rich-text.delete-column"),
|
|
753
|
+
mergeOrSplit: a("rich-text.merge-cells"),
|
|
754
|
+
deleteTable: a("rich-text.delete-table"),
|
|
755
|
+
toolbar: a("rich-text.toolbar"),
|
|
756
|
+
linkAddress: a("rich-text.link-address"),
|
|
757
|
+
youtubeAddress: a("rich-text.youtube-address"),
|
|
758
|
+
apply: a("rich-text.apply"),
|
|
759
|
+
cancel: a("rich-text.cancel"),
|
|
760
|
+
uploading: a("rich-text.uploading")
|
|
646
761
|
}));
|
|
647
|
-
return (s,
|
|
762
|
+
return (s, o) => (p(), $(n(Vt), je(s.$attrs, {
|
|
648
763
|
labels: i.value,
|
|
649
|
-
"pick-image":
|
|
764
|
+
"pick-image": l.value
|
|
650
765
|
}), null, 16, ["labels", "pick-image"]));
|
|
651
766
|
}
|
|
652
|
-
}),
|
|
653
|
-
|
|
767
|
+
}), rt = /* @__PURE__ */ Symbol("wx-record-address");
|
|
768
|
+
function La(e) {
|
|
769
|
+
Ye(rt, e);
|
|
770
|
+
}
|
|
771
|
+
function Aa() {
|
|
772
|
+
return ne(rt, null);
|
|
773
|
+
}
|
|
774
|
+
const za = { class: "wx-slug" }, Va = { class: "wx-slug__prefix" }, Ea = /* @__PURE__ */ N({
|
|
775
|
+
name: "WxSlugField",
|
|
776
|
+
inheritAttrs: !1,
|
|
777
|
+
__name: "SlugField",
|
|
778
|
+
setup(e) {
|
|
779
|
+
const t = Aa(), a = at(), l = x(() => {
|
|
780
|
+
const o = t?.prefix.value ?? "";
|
|
781
|
+
return o === "" ? "/" : `/${o}/`;
|
|
782
|
+
}), i = x(() => {
|
|
783
|
+
const o = t?.values.value.slug;
|
|
784
|
+
return typeof o == "string" ? o : o?.[a.active.value] ?? "";
|
|
785
|
+
}), s = x(() => {
|
|
786
|
+
const o = t?.path.value;
|
|
787
|
+
return typeof o == "string" && i.value !== "" && `${l.value}${i.value}` != `/${o}`;
|
|
788
|
+
});
|
|
789
|
+
return (o, r) => (p(), T("div", za, [
|
|
790
|
+
b(n(ye), gt(yt(o.$attrs)), {
|
|
791
|
+
prefix: g(() => [
|
|
792
|
+
O("span", Va, L(l.value), 1)
|
|
793
|
+
]),
|
|
794
|
+
_: 1
|
|
795
|
+
}, 16),
|
|
796
|
+
s.value && n(t) ? (p(), $(n(be), {
|
|
797
|
+
key: 0,
|
|
798
|
+
type: "info",
|
|
799
|
+
variant: "soft",
|
|
800
|
+
description: n(t).moving()
|
|
801
|
+
}, null, 8, ["description"])) : U("", !0)
|
|
802
|
+
]));
|
|
803
|
+
}
|
|
804
|
+
}), Me = /* @__PURE__ */ Y(Ea, [["__scopeId", "data-v-5921c0dd"]]), Ua = {
|
|
805
|
+
"wx-list": { component: it, kind: "layout", labelProp: "title" },
|
|
654
806
|
// Full width: an editor shares a row with nothing, and a form of two columns would give it
|
|
655
807
|
// half a line to write a page of text in.
|
|
656
|
-
"wx-rich-text": { component:
|
|
808
|
+
"wx-rich-text": { component: Wa, kind: "field", wide: !0 },
|
|
657
809
|
// Wide as well: a row of the picker is a segmented switch, a section and a search box, and half
|
|
658
810
|
// a form's width leaves the search box too narrow to read a page title in.
|
|
659
|
-
"wx-link": { component:
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
811
|
+
"wx-link": { component: ga, kind: "field", wide: !0 },
|
|
812
|
+
"wx-categories": { component: sa, kind: "field" },
|
|
813
|
+
"wx-slug": { component: Me, kind: "field" },
|
|
814
|
+
"wx-category-slug": { component: Me, kind: "field" }
|
|
815
|
+
}, ut = /* @__PURE__ */ Symbol("webx-admin");
|
|
816
|
+
function X() {
|
|
817
|
+
const e = ne(ut, null);
|
|
663
818
|
if (e === null)
|
|
664
819
|
throw new Error("useAdmin() was called outside a panel created by createAdmin().");
|
|
665
820
|
return e;
|
|
666
821
|
}
|
|
667
|
-
function
|
|
668
|
-
const t =
|
|
822
|
+
function Ra(e) {
|
|
823
|
+
const t = pe({
|
|
669
824
|
status: "loading",
|
|
670
825
|
manifest: null,
|
|
671
826
|
user: null,
|
|
672
827
|
error: null
|
|
673
|
-
}),
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
828
|
+
}), a = x(() => {
|
|
829
|
+
const d = t.manifest;
|
|
830
|
+
if (d === null)
|
|
676
831
|
return [];
|
|
677
|
-
const
|
|
678
|
-
for (const
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
832
|
+
const w = [];
|
|
833
|
+
for (const f of d.modules) {
|
|
834
|
+
const y = e.modules.find((M) => M.id === f.id);
|
|
835
|
+
if (y === void 0)
|
|
681
836
|
continue;
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
id:
|
|
685
|
-
title:
|
|
686
|
-
icon:
|
|
687
|
-
path:
|
|
688
|
-
group:
|
|
837
|
+
const k = y.path ?? y.routes?.[0]?.path;
|
|
838
|
+
k !== void 0 && w.push({
|
|
839
|
+
id: f.id,
|
|
840
|
+
title: f.title,
|
|
841
|
+
icon: f.icon,
|
|
842
|
+
path: k,
|
|
843
|
+
group: f.group ?? null
|
|
689
844
|
});
|
|
690
845
|
}
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
693
|
-
const
|
|
694
|
-
for (const
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
|
|
846
|
+
return w;
|
|
847
|
+
}), l = x(() => {
|
|
848
|
+
const d = t.manifest?.groups ?? [], w = [], f = /* @__PURE__ */ new Map();
|
|
849
|
+
for (const y of a.value)
|
|
850
|
+
if (y.group !== null && d.some((k) => k.id === y.group)) {
|
|
851
|
+
const k = f.get(y.group) ?? [];
|
|
852
|
+
k.push(y), f.set(y.group, k);
|
|
698
853
|
} else
|
|
699
|
-
|
|
854
|
+
w.push(y);
|
|
700
855
|
return {
|
|
701
|
-
top:
|
|
702
|
-
groups:
|
|
703
|
-
id:
|
|
704
|
-
title:
|
|
705
|
-
icon:
|
|
706
|
-
entries:
|
|
856
|
+
top: w,
|
|
857
|
+
groups: d.filter((y) => f.has(y.id)).map((y) => ({
|
|
858
|
+
id: y.id,
|
|
859
|
+
title: y.title,
|
|
860
|
+
icon: y.icon ?? null,
|
|
861
|
+
entries: f.get(y.id) ?? []
|
|
707
862
|
}))
|
|
708
863
|
};
|
|
709
|
-
}), i = { ...
|
|
710
|
-
for (const
|
|
711
|
-
Object.assign(i,
|
|
864
|
+
}), i = { ...Ua };
|
|
865
|
+
for (const d of e.modules)
|
|
866
|
+
Object.assign(i, d.types);
|
|
712
867
|
Object.assign(i, e.types);
|
|
713
|
-
const s = e.modules.find((
|
|
714
|
-
async function r(
|
|
715
|
-
const
|
|
716
|
-
let
|
|
717
|
-
return
|
|
718
|
-
throw
|
|
719
|
-
}),
|
|
868
|
+
const s = e.modules.find((d) => d.pickImage !== void 0)?.pickImage, o = /* @__PURE__ */ new Map();
|
|
869
|
+
async function r(d) {
|
|
870
|
+
const w = `${e.i18n.state.locale}:${d}`;
|
|
871
|
+
let f = o.get(w);
|
|
872
|
+
return f === void 0 && (f = e.http.get(`${e.apiPath}/screens/${d}`).then((y) => y.data.root).catch((y) => {
|
|
873
|
+
throw o.delete(w), y;
|
|
874
|
+
}), o.set(w, f)), f;
|
|
720
875
|
}
|
|
721
876
|
let u = null;
|
|
722
|
-
async function
|
|
877
|
+
async function c() {
|
|
723
878
|
t.status = "loading", t.error = null;
|
|
724
879
|
try {
|
|
725
880
|
if (u !== null && (t.user = await u(), m(t.user), t.user === null)) {
|
|
726
881
|
t.manifest = null, t.status = "unauthenticated";
|
|
727
882
|
return;
|
|
728
883
|
}
|
|
729
|
-
const
|
|
730
|
-
t.manifest =
|
|
731
|
-
} catch (
|
|
732
|
-
if (
|
|
884
|
+
const d = await e.loadManifest();
|
|
885
|
+
t.manifest = d, e.i18n.state.contentLocales = d.locales ?? [], e.i18n.state.panelLocales = d.panelLocales ?? e.i18n.state.panelLocales, d.locale !== void 0 && d.locale !== e.i18n.state.locale && await v(d.locale), t.status = "ready";
|
|
886
|
+
} catch (d) {
|
|
887
|
+
if (Ba(d)) {
|
|
733
888
|
t.manifest = null, t.user = null, t.status = "unauthenticated";
|
|
734
889
|
return;
|
|
735
890
|
}
|
|
736
|
-
t.error =
|
|
891
|
+
t.error = d instanceof Error ? d.message : String(d), t.status = "error";
|
|
737
892
|
}
|
|
738
893
|
}
|
|
739
|
-
async function
|
|
894
|
+
async function h() {
|
|
740
895
|
if (t.manifest !== null)
|
|
741
896
|
try {
|
|
742
897
|
t.manifest = await e.loadManifest();
|
|
743
898
|
} catch {
|
|
744
899
|
}
|
|
745
900
|
}
|
|
746
|
-
function m(
|
|
747
|
-
|
|
901
|
+
function m(d) {
|
|
902
|
+
d !== null && e.theme?.adopt(d.theme);
|
|
748
903
|
}
|
|
749
|
-
async function
|
|
904
|
+
async function v(d) {
|
|
750
905
|
if (e.loadDictionary === void 0) {
|
|
751
|
-
e.i18n.state.locale =
|
|
906
|
+
e.i18n.state.locale = d;
|
|
752
907
|
return;
|
|
753
908
|
}
|
|
754
|
-
await e.loadDictionary(
|
|
909
|
+
await e.loadDictionary(d), await h();
|
|
755
910
|
}
|
|
756
911
|
return {
|
|
757
912
|
http: e.http,
|
|
@@ -760,100 +915,105 @@ function sn(e) {
|
|
|
760
915
|
state: t,
|
|
761
916
|
i18n: e.i18n,
|
|
762
917
|
modules: e.modules,
|
|
763
|
-
nav:
|
|
764
|
-
groups:
|
|
918
|
+
nav: a,
|
|
919
|
+
groups: l,
|
|
765
920
|
types: i,
|
|
766
921
|
pickImage: s ?? null,
|
|
767
|
-
reload:
|
|
768
|
-
refreshManifest:
|
|
769
|
-
setLocale:
|
|
770
|
-
setUser(
|
|
771
|
-
t.user =
|
|
922
|
+
reload: c,
|
|
923
|
+
refreshManifest: h,
|
|
924
|
+
setLocale: v,
|
|
925
|
+
setUser(d) {
|
|
926
|
+
t.user = d, m(d);
|
|
772
927
|
},
|
|
773
|
-
useSessionLoader(
|
|
774
|
-
u =
|
|
928
|
+
useSessionLoader(d) {
|
|
929
|
+
u = d;
|
|
775
930
|
},
|
|
776
|
-
can(
|
|
777
|
-
const
|
|
778
|
-
return
|
|
931
|
+
can(d) {
|
|
932
|
+
const w = t.user;
|
|
933
|
+
return w === null ? !1 : w.isSuper || w.permissions.includes(d);
|
|
779
934
|
},
|
|
780
935
|
loadScreen: r,
|
|
781
|
-
screenPatch(
|
|
782
|
-
return e.screens?.[
|
|
936
|
+
screenPatch(d) {
|
|
937
|
+
return e.screens?.[d] ?? [];
|
|
783
938
|
}
|
|
784
939
|
};
|
|
785
940
|
}
|
|
786
|
-
function
|
|
787
|
-
e.provide(
|
|
941
|
+
function Na(e, t) {
|
|
942
|
+
e.provide(ut, t);
|
|
788
943
|
}
|
|
789
|
-
function
|
|
944
|
+
function Ba(e) {
|
|
790
945
|
return typeof e == "object" && e !== null && "status" in e && e.status === 401;
|
|
791
946
|
}
|
|
792
|
-
const
|
|
947
|
+
const Ia = /* @__PURE__ */ N({
|
|
793
948
|
__name: "AdminLanding",
|
|
794
949
|
props: {
|
|
795
950
|
landing: { default: null }
|
|
796
951
|
},
|
|
797
952
|
setup(e) {
|
|
798
|
-
const t = e,
|
|
799
|
-
const
|
|
800
|
-
return
|
|
953
|
+
const t = e, a = X(), l = ge(), i = P("webx-admin"), s = x(() => {
|
|
954
|
+
const o = a.nav.value;
|
|
955
|
+
return o.length === 0 ? null : ((t.landing === null ? void 0 : o.find((u) => u.path === t.landing)) ?? o[0])?.path ?? null;
|
|
801
956
|
});
|
|
802
|
-
return
|
|
957
|
+
return ee(
|
|
803
958
|
s,
|
|
804
|
-
(
|
|
805
|
-
|
|
959
|
+
(o) => {
|
|
960
|
+
o !== null && l.replace(o);
|
|
806
961
|
},
|
|
807
962
|
{ immediate: !0 }
|
|
808
|
-
), (
|
|
963
|
+
), (o, r) => s.value === null && n(a).state.status === "ready" ? (p(), $(n(Et), {
|
|
809
964
|
key: 0,
|
|
810
965
|
status: "info",
|
|
811
|
-
title:
|
|
812
|
-
description:
|
|
813
|
-
}, null, 8, ["title", "description"])) :
|
|
966
|
+
title: n(i)("shell.empty-title"),
|
|
967
|
+
description: n(i)("shell.empty-description")
|
|
968
|
+
}, null, 8, ["title", "description"])) : U("", !0);
|
|
814
969
|
}
|
|
815
|
-
}),
|
|
970
|
+
}), Pa = /* @__PURE__ */ N({
|
|
816
971
|
__name: "AdminNav",
|
|
817
972
|
props: {
|
|
818
973
|
collapsed: { type: Boolean }
|
|
819
974
|
},
|
|
820
975
|
emits: ["select"],
|
|
821
976
|
setup(e, { emit: t }) {
|
|
822
|
-
const
|
|
823
|
-
|
|
977
|
+
const a = t, l = X(), i = P("webx-admin"), s = ge(), o = Ze(), r = x({
|
|
978
|
+
/*
|
|
979
|
+
* The longest path that contains this one, on a segment boundary: a section may live inside
|
|
980
|
+
* another's path (`/services/categories` under `/services`), and the first match in the order
|
|
981
|
+
* of the menu would light up the outer one.
|
|
982
|
+
*/
|
|
983
|
+
get: () => l.nav.value.filter((c) => o.path === c.path || o.path.startsWith(`${c.path}/`)).sort((c, h) => h.path.length - c.path.length)[0]?.id ?? "",
|
|
824
984
|
set: (u) => {
|
|
825
|
-
const
|
|
826
|
-
|
|
985
|
+
const c = l.nav.value.find((h) => h.id === u);
|
|
986
|
+
c !== void 0 && s.push(c.path);
|
|
827
987
|
}
|
|
828
988
|
});
|
|
829
|
-
return (u,
|
|
830
|
-
const
|
|
831
|
-
return
|
|
989
|
+
return (u, c) => {
|
|
990
|
+
const h = j("wx-menu-item"), m = j("wx-submenu"), v = j("wx-menu");
|
|
991
|
+
return p(), $(v, {
|
|
832
992
|
modelValue: r.value,
|
|
833
|
-
"onUpdate:modelValue":
|
|
993
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => r.value = d),
|
|
834
994
|
collapsed: e.collapsed,
|
|
835
|
-
label:
|
|
836
|
-
onSelect:
|
|
995
|
+
label: n(i)("nav.sections"),
|
|
996
|
+
onSelect: c[1] || (c[1] = (d) => a("select"))
|
|
837
997
|
}, {
|
|
838
998
|
default: g(() => [
|
|
839
|
-
(
|
|
840
|
-
key:
|
|
841
|
-
value:
|
|
842
|
-
icon:
|
|
843
|
-
label:
|
|
999
|
+
(p(!0), T(H, null, Q(n(l).groups.value.top, (d) => (p(), $(h, {
|
|
1000
|
+
key: d.id,
|
|
1001
|
+
value: d.id,
|
|
1002
|
+
icon: d.icon ?? void 0,
|
|
1003
|
+
label: d.title
|
|
844
1004
|
}, null, 8, ["value", "icon", "label"]))), 128)),
|
|
845
|
-
(
|
|
846
|
-
key:
|
|
847
|
-
value: `group:${
|
|
848
|
-
title:
|
|
849
|
-
icon:
|
|
1005
|
+
(p(!0), T(H, null, Q(n(l).groups.value.groups, (d) => (p(), $(m, {
|
|
1006
|
+
key: d.id,
|
|
1007
|
+
value: `group:${d.id}`,
|
|
1008
|
+
title: d.title,
|
|
1009
|
+
icon: d.icon ?? "gear"
|
|
850
1010
|
}, {
|
|
851
1011
|
default: g(() => [
|
|
852
|
-
(
|
|
853
|
-
key:
|
|
854
|
-
value:
|
|
855
|
-
icon:
|
|
856
|
-
label:
|
|
1012
|
+
(p(!0), T(H, null, Q(d.entries, (w) => (p(), $(h, {
|
|
1013
|
+
key: w.id,
|
|
1014
|
+
value: w.id,
|
|
1015
|
+
icon: w.icon ?? void 0,
|
|
1016
|
+
label: w.title
|
|
857
1017
|
}, null, 8, ["value", "icon", "label"]))), 128))
|
|
858
1018
|
]),
|
|
859
1019
|
_: 2
|
|
@@ -863,68 +1023,68 @@ const un = /* @__PURE__ */ E({
|
|
|
863
1023
|
}, 8, ["modelValue", "collapsed", "label"]);
|
|
864
1024
|
};
|
|
865
1025
|
}
|
|
866
|
-
}),
|
|
1026
|
+
}), Da = {
|
|
867
1027
|
key: 0,
|
|
868
1028
|
class: "wx-root wx-admin-plain"
|
|
869
|
-
},
|
|
1029
|
+
}, Ma = {
|
|
870
1030
|
key: 1,
|
|
871
1031
|
class: "wx-root wx-admin-plain"
|
|
872
|
-
},
|
|
1032
|
+
}, Fa = {
|
|
873
1033
|
key: 2,
|
|
874
1034
|
class: "wx-root wx-admin-plain"
|
|
875
|
-
},
|
|
1035
|
+
}, Oa = ["src", "alt", "width", "height"], Ha = ["src", "alt", "width", "height"], ja = ["src", "alt"], Ka = { class: "wx-admin__user" }, qa = { class: "wx-admin__user wx-admin__user--drawer" }, Ya = /* @__PURE__ */ N({
|
|
876
1036
|
__name: "AdminShell",
|
|
877
1037
|
setup(e) {
|
|
878
|
-
const t =
|
|
879
|
-
|
|
1038
|
+
const t = X(), a = P("webx-admin"), l = W(null), { width: i, layout: s, collapsed: o, showAside: r, drawerOpen: u, toggle: c, close: h } = Ut(
|
|
1039
|
+
l,
|
|
880
1040
|
{ persist: "webx-admin-shell" }
|
|
881
|
-
), m = x(() => t.state.manifest?.title ?? ""),
|
|
882
|
-
return
|
|
883
|
-
typeof document > "u" || (document.documentElement.dataset.wxShell =
|
|
884
|
-
}),
|
|
1041
|
+
), m = x(() => t.state.manifest?.title ?? ""), v = x(() => t.state.manifest?.branding?.logo ?? null), d = x(() => t.state.manifest?.branding?.mark ?? null), w = x(() => Rt(i.value, null));
|
|
1042
|
+
return bt(() => {
|
|
1043
|
+
typeof document > "u" || (document.documentElement.dataset.wxShell = w.value);
|
|
1044
|
+
}), wt(() => {
|
|
885
1045
|
typeof document < "u" && delete document.documentElement.dataset.wxShell;
|
|
886
|
-
}), (
|
|
887
|
-
const
|
|
888
|
-
return
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
k
|
|
892
|
-
])) :
|
|
893
|
-
|
|
894
|
-
label:
|
|
1046
|
+
}), (f, y) => {
|
|
1047
|
+
const k = j("router-view"), M = j("wx-loading"), J = j("wx-button"), S = j("wx-result"), B = j("wx-action"), C = j("wx-text"), A = j("wx-header"), E = j("wx-aside"), K = j("wx-main"), le = j("wx-container"), ie = j("wx-drawer");
|
|
1048
|
+
return p(), T(H, null, [
|
|
1049
|
+
b(n(Nt)),
|
|
1050
|
+
n(t).state.status === "unauthenticated" ? (p(), T("div", Da, [
|
|
1051
|
+
b(k)
|
|
1052
|
+
])) : n(t).state.status === "loading" ? (p(), T("div", Ma, [
|
|
1053
|
+
b(M, {
|
|
1054
|
+
label: n(a)("shell.loading")
|
|
895
1055
|
}, null, 8, ["label"])
|
|
896
|
-
])) :
|
|
897
|
-
|
|
1056
|
+
])) : n(t).state.status === "error" ? (p(), T("div", Fa, [
|
|
1057
|
+
b(S, {
|
|
898
1058
|
status: "error",
|
|
899
|
-
title:
|
|
900
|
-
description:
|
|
1059
|
+
title: n(a)("shell.error-title"),
|
|
1060
|
+
description: n(t).state.error
|
|
901
1061
|
}, {
|
|
902
1062
|
default: g(() => [
|
|
903
|
-
|
|
1063
|
+
b(J, {
|
|
904
1064
|
type: "primary",
|
|
905
|
-
onClick:
|
|
1065
|
+
onClick: y[0] || (y[0] = (te) => n(t).reload())
|
|
906
1066
|
}, {
|
|
907
1067
|
default: g(() => [
|
|
908
|
-
|
|
1068
|
+
V(L(n(a)("shell.retry")), 1)
|
|
909
1069
|
]),
|
|
910
1070
|
_: 1
|
|
911
1071
|
})
|
|
912
1072
|
]),
|
|
913
1073
|
_: 1
|
|
914
1074
|
}, 8, ["title", "description"])
|
|
915
|
-
])) : (
|
|
1075
|
+
])) : (p(), T("div", {
|
|
916
1076
|
key: 3,
|
|
917
1077
|
ref_key: "shellEl",
|
|
918
|
-
ref:
|
|
919
|
-
class:
|
|
1078
|
+
ref: l,
|
|
1079
|
+
class: ae(["wx-root wx-admin", `wx-admin--${w.value}`])
|
|
920
1080
|
}, [
|
|
921
|
-
|
|
922
|
-
direction:
|
|
1081
|
+
b(le, {
|
|
1082
|
+
direction: n(s) === "drawer" ? "vertical" : "horizontal",
|
|
923
1083
|
"full-height": "",
|
|
924
1084
|
class: "wx-admin__frame"
|
|
925
1085
|
}, {
|
|
926
1086
|
default: g(() => [
|
|
927
|
-
|
|
1087
|
+
n(s) === "drawer" ? (p(), $(A, {
|
|
928
1088
|
key: 0,
|
|
929
1089
|
class: "wx-admin__header",
|
|
930
1090
|
floating: "",
|
|
@@ -934,126 +1094,126 @@ const un = /* @__PURE__ */ E({
|
|
|
934
1094
|
height: "var(--wx-admin-header-height)"
|
|
935
1095
|
}, {
|
|
936
1096
|
end: g(() => [
|
|
937
|
-
|
|
1097
|
+
F(f.$slots, "user", { expanded: !1 }, void 0, !0)
|
|
938
1098
|
]),
|
|
939
1099
|
default: g(() => [
|
|
940
|
-
|
|
1100
|
+
b(B, {
|
|
941
1101
|
icon: "menu",
|
|
942
|
-
title:
|
|
943
|
-
onClick:
|
|
1102
|
+
title: n(a)("nav.menu"),
|
|
1103
|
+
onClick: n(c)
|
|
944
1104
|
}, null, 8, ["title", "onClick"]),
|
|
945
|
-
|
|
946
|
-
|
|
1105
|
+
F(f.$slots, "brand", {}, () => [
|
|
1106
|
+
v.value ? (p(), T("img", {
|
|
947
1107
|
key: 0,
|
|
948
1108
|
class: "wx-admin__logo",
|
|
949
|
-
src:
|
|
1109
|
+
src: v.value.url,
|
|
950
1110
|
alt: m.value,
|
|
951
|
-
width:
|
|
952
|
-
height:
|
|
953
|
-
}, null, 8,
|
|
1111
|
+
width: v.value.width ?? void 0,
|
|
1112
|
+
height: v.value.height ?? void 0
|
|
1113
|
+
}, null, 8, Oa)) : (p(), $(C, {
|
|
954
1114
|
key: 1,
|
|
955
1115
|
weight: "semibold",
|
|
956
1116
|
truncate: ""
|
|
957
1117
|
}, {
|
|
958
1118
|
default: g(() => [
|
|
959
|
-
|
|
1119
|
+
V(L(m.value), 1)
|
|
960
1120
|
]),
|
|
961
1121
|
_: 1
|
|
962
1122
|
}))
|
|
963
1123
|
], !0)
|
|
964
1124
|
]),
|
|
965
1125
|
_: 3
|
|
966
|
-
})) :
|
|
967
|
-
|
|
1126
|
+
})) : U("", !0),
|
|
1127
|
+
n(r) ? (p(), $(E, {
|
|
968
1128
|
key: 1,
|
|
969
1129
|
class: "wx-admin__aside",
|
|
970
1130
|
sticky: "",
|
|
971
1131
|
floating: "",
|
|
972
1132
|
scroll: "",
|
|
973
1133
|
bordered: !1,
|
|
974
|
-
collapsed: o
|
|
1134
|
+
collapsed: n(o),
|
|
975
1135
|
width: 220,
|
|
976
1136
|
"collapsed-width": 56
|
|
977
1137
|
}, {
|
|
978
1138
|
top: g(() => [
|
|
979
|
-
|
|
980
|
-
class:
|
|
1139
|
+
O("div", {
|
|
1140
|
+
class: ae(["wx-admin__brand", { "wx-admin__brand--stacked": n(o) && d.value }])
|
|
981
1141
|
}, [
|
|
982
|
-
o
|
|
1142
|
+
n(o) ? d.value ? (p(), T("img", {
|
|
983
1143
|
key: 1,
|
|
984
1144
|
class: "wx-admin__mark",
|
|
985
|
-
src:
|
|
1145
|
+
src: d.value.url,
|
|
986
1146
|
alt: m.value
|
|
987
|
-
}, null, 8,
|
|
988
|
-
|
|
1147
|
+
}, null, 8, ja)) : U("", !0) : F(f.$slots, "brand", {}, () => [
|
|
1148
|
+
v.value ? (p(), T("img", {
|
|
989
1149
|
key: 0,
|
|
990
1150
|
class: "wx-admin__logo",
|
|
991
|
-
src:
|
|
1151
|
+
src: v.value.url,
|
|
992
1152
|
alt: m.value,
|
|
993
|
-
width:
|
|
994
|
-
height:
|
|
995
|
-
}, null, 8,
|
|
1153
|
+
width: v.value.width ?? void 0,
|
|
1154
|
+
height: v.value.height ?? void 0
|
|
1155
|
+
}, null, 8, Ha)) : (p(), $(C, {
|
|
996
1156
|
key: 1,
|
|
997
1157
|
weight: "semibold",
|
|
998
1158
|
truncate: "",
|
|
999
1159
|
class: "wx-admin__title"
|
|
1000
1160
|
}, {
|
|
1001
1161
|
default: g(() => [
|
|
1002
|
-
|
|
1162
|
+
V(L(m.value), 1)
|
|
1003
1163
|
]),
|
|
1004
1164
|
_: 1
|
|
1005
1165
|
}))
|
|
1006
1166
|
], !0, 0),
|
|
1007
|
-
|
|
1167
|
+
b(B, {
|
|
1008
1168
|
icon: "sidebar",
|
|
1009
|
-
title: o
|
|
1010
|
-
onClick:
|
|
1169
|
+
title: n(o) ? n(a)("nav.expand") : n(a)("nav.collapse"),
|
|
1170
|
+
onClick: n(c)
|
|
1011
1171
|
}, null, 8, ["title", "onClick"])
|
|
1012
1172
|
], 2)
|
|
1013
1173
|
]),
|
|
1014
1174
|
bottom: g(() => [
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
expanded: !o
|
|
1175
|
+
O("div", Ka, [
|
|
1176
|
+
F(f.$slots, "user", {
|
|
1177
|
+
expanded: !n(o)
|
|
1018
1178
|
}, void 0, !0)
|
|
1019
1179
|
])
|
|
1020
1180
|
]),
|
|
1021
1181
|
default: g(() => [
|
|
1022
|
-
|
|
1182
|
+
F(f.$slots, "nav", { collapsed: n(o) }, void 0, !0)
|
|
1023
1183
|
]),
|
|
1024
1184
|
_: 3
|
|
1025
|
-
}, 8, ["collapsed"])) :
|
|
1026
|
-
|
|
1185
|
+
}, 8, ["collapsed"])) : U("", !0),
|
|
1186
|
+
b(K, {
|
|
1027
1187
|
padding: "none",
|
|
1028
1188
|
class: "wx-admin__screen"
|
|
1029
1189
|
}, {
|
|
1030
1190
|
default: g(() => [
|
|
1031
|
-
k
|
|
1191
|
+
b(k)
|
|
1032
1192
|
]),
|
|
1033
1193
|
_: 1
|
|
1034
1194
|
})
|
|
1035
1195
|
]),
|
|
1036
1196
|
_: 3
|
|
1037
1197
|
}, 8, ["direction"]),
|
|
1038
|
-
|
|
1039
|
-
open:
|
|
1040
|
-
"onUpdate:open":
|
|
1198
|
+
b(ie, {
|
|
1199
|
+
open: n(u),
|
|
1200
|
+
"onUpdate:open": y[1] || (y[1] = (te) => Xe(u) ? u.value = te : null),
|
|
1041
1201
|
class: "wx-admin__drawer",
|
|
1042
|
-
title: m.value === "" ?
|
|
1202
|
+
title: m.value === "" ? n(a)("nav.menu") : m.value,
|
|
1043
1203
|
side: "left",
|
|
1044
1204
|
size: 260,
|
|
1045
1205
|
"full-screen": !1,
|
|
1046
1206
|
closable: ""
|
|
1047
1207
|
}, {
|
|
1048
1208
|
footer: g(() => [
|
|
1049
|
-
|
|
1050
|
-
|
|
1209
|
+
O("div", qa, [
|
|
1210
|
+
F(f.$slots, "user", { expanded: !0 }, void 0, !0)
|
|
1051
1211
|
])
|
|
1052
1212
|
]),
|
|
1053
1213
|
default: g(() => [
|
|
1054
|
-
|
|
1214
|
+
F(f.$slots, "nav", {
|
|
1055
1215
|
collapsed: !1,
|
|
1056
|
-
select:
|
|
1216
|
+
select: n(h)
|
|
1057
1217
|
}, void 0, !0)
|
|
1058
1218
|
]),
|
|
1059
1219
|
_: 3
|
|
@@ -1062,10 +1222,10 @@ const un = /* @__PURE__ */ E({
|
|
|
1062
1222
|
], 64);
|
|
1063
1223
|
};
|
|
1064
1224
|
}
|
|
1065
|
-
}),
|
|
1066
|
-
class
|
|
1067
|
-
constructor(t,
|
|
1068
|
-
super(t), this.status =
|
|
1225
|
+
}), Xa = /* @__PURE__ */ Y(Ya, [["__scopeId", "data-v-309fdb9d"]]);
|
|
1226
|
+
class Ce extends Error {
|
|
1227
|
+
constructor(t, a, l = {}, i = null, s = null) {
|
|
1228
|
+
super(t), this.status = a, this.errors = l, this.retryAfter = i, this.body = s, this.name = "HttpError";
|
|
1069
1229
|
}
|
|
1070
1230
|
status;
|
|
1071
1231
|
errors;
|
|
@@ -1082,126 +1242,126 @@ class pe extends Error {
|
|
|
1082
1242
|
return this.status === 429;
|
|
1083
1243
|
}
|
|
1084
1244
|
}
|
|
1085
|
-
const
|
|
1086
|
-
function
|
|
1087
|
-
const t = (e.baseUrl ?? "").replace(/\/$/, ""),
|
|
1088
|
-
let
|
|
1089
|
-
async function r(
|
|
1090
|
-
|
|
1245
|
+
const Ga = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
1246
|
+
function Ja(e = {}) {
|
|
1247
|
+
const t = (e.baseUrl ?? "").replace(/\/$/, ""), a = e.csrfUrl ?? "/api/cms/auth/csrf-cookie", l = e.fetch ?? globalThis.fetch.bind(globalThis), i = e.onUnauthenticated, s = e.headers;
|
|
1248
|
+
let o = !1;
|
|
1249
|
+
async function r(c = !1) {
|
|
1250
|
+
o && !c && Fe("XSRF-TOKEN") !== null || (await l(a, { credentials: "same-origin" }), o = !0);
|
|
1091
1251
|
}
|
|
1092
|
-
async function u(
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1252
|
+
async function u(c, h, m, v = {}, d = !1) {
|
|
1253
|
+
const w = Ga.has(c);
|
|
1254
|
+
w && await r();
|
|
1255
|
+
const f = {
|
|
1096
1256
|
Accept: "application/json",
|
|
1097
1257
|
"X-Requested-With": "XMLHttpRequest",
|
|
1098
1258
|
// Standing headers first, so a caller can still override one for a single request.
|
|
1099
1259
|
...s?.(),
|
|
1100
|
-
...
|
|
1260
|
+
...v.headers
|
|
1101
1261
|
};
|
|
1102
|
-
if (
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1262
|
+
if (w) {
|
|
1263
|
+
const k = Fe("XSRF-TOKEN");
|
|
1264
|
+
k !== null && (f["X-XSRF-TOKEN"] = k);
|
|
1105
1265
|
}
|
|
1106
|
-
m !== void 0 && (
|
|
1107
|
-
const
|
|
1108
|
-
method:
|
|
1266
|
+
m !== void 0 && (f["Content-Type"] = "application/json");
|
|
1267
|
+
const y = await l(Za(t, h, v.query), {
|
|
1268
|
+
method: c,
|
|
1109
1269
|
credentials: "same-origin",
|
|
1110
|
-
headers:
|
|
1111
|
-
signal:
|
|
1270
|
+
headers: f,
|
|
1271
|
+
signal: v.signal,
|
|
1112
1272
|
body: m === void 0 ? void 0 : JSON.stringify(m)
|
|
1113
1273
|
});
|
|
1114
|
-
if (
|
|
1115
|
-
return await r(!0), u(
|
|
1116
|
-
if (
|
|
1117
|
-
throw await
|
|
1118
|
-
if (
|
|
1119
|
-
return await
|
|
1274
|
+
if (y.status === 419 && w && !d)
|
|
1275
|
+
return await r(!0), u(c, h, m, v, !0);
|
|
1276
|
+
if (y.status === 401 && i?.(), !y.ok)
|
|
1277
|
+
throw await Qa(y);
|
|
1278
|
+
if (y.status !== 204)
|
|
1279
|
+
return await y.json();
|
|
1120
1280
|
}
|
|
1121
1281
|
return {
|
|
1122
|
-
get: (
|
|
1123
|
-
post: (
|
|
1124
|
-
put: (
|
|
1125
|
-
patch: (
|
|
1126
|
-
delete: (
|
|
1282
|
+
get: (c, h) => u("GET", c, void 0, h),
|
|
1283
|
+
post: (c, h, m) => u("POST", c, h, m),
|
|
1284
|
+
put: (c, h, m) => u("PUT", c, h, m),
|
|
1285
|
+
patch: (c, h, m) => u("PATCH", c, h, m),
|
|
1286
|
+
delete: (c, h) => u("DELETE", c, void 0, h)
|
|
1127
1287
|
};
|
|
1128
1288
|
}
|
|
1129
|
-
async function
|
|
1289
|
+
async function Qa(e) {
|
|
1130
1290
|
let t = null;
|
|
1131
1291
|
try {
|
|
1132
1292
|
t = await e.json();
|
|
1133
1293
|
} catch {
|
|
1134
1294
|
}
|
|
1135
|
-
const
|
|
1136
|
-
return new
|
|
1137
|
-
|
|
1295
|
+
const a = t ?? {}, l = typeof a.message == "string" && a.message !== "" ? a.message : e.statusText || `Request failed with ${e.status}`, i = a.errors !== null && typeof a.errors == "object" ? a.errors : {}, s = e.headers.get("Retry-After"), o = s === null ? null : Number.parseInt(s, 10);
|
|
1296
|
+
return new Ce(
|
|
1297
|
+
l,
|
|
1138
1298
|
e.status,
|
|
1139
1299
|
i,
|
|
1140
|
-
Number.isFinite(
|
|
1300
|
+
Number.isFinite(o) ? o : null,
|
|
1141
1301
|
t
|
|
1142
1302
|
);
|
|
1143
1303
|
}
|
|
1144
|
-
function
|
|
1304
|
+
function Za(e, t, a) {
|
|
1145
1305
|
const i = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
|
|
1146
|
-
if (
|
|
1306
|
+
if (a === void 0)
|
|
1147
1307
|
return i;
|
|
1148
1308
|
const s = new URLSearchParams();
|
|
1149
|
-
for (const [r, u] of Object.entries(
|
|
1309
|
+
for (const [r, u] of Object.entries(a))
|
|
1150
1310
|
u != null && s.set(r, String(u));
|
|
1151
|
-
const
|
|
1152
|
-
return
|
|
1311
|
+
const o = s.toString();
|
|
1312
|
+
return o === "" ? i : `${i}${i.includes("?") ? "&" : "?"}${o}`;
|
|
1153
1313
|
}
|
|
1154
|
-
function
|
|
1314
|
+
function Fe(e) {
|
|
1155
1315
|
if (typeof document > "u")
|
|
1156
1316
|
return null;
|
|
1157
1317
|
for (const t of document.cookie.split(";")) {
|
|
1158
|
-
const [
|
|
1159
|
-
if (
|
|
1160
|
-
return decodeURIComponent(
|
|
1318
|
+
const [a, ...l] = t.trim().split("=");
|
|
1319
|
+
if (a === e)
|
|
1320
|
+
return decodeURIComponent(l.join("="));
|
|
1161
1321
|
}
|
|
1162
1322
|
return null;
|
|
1163
1323
|
}
|
|
1164
|
-
const
|
|
1165
|
-
function
|
|
1166
|
-
const e =
|
|
1324
|
+
const en = "webx.theme", dt = /* @__PURE__ */ Symbol("webx-theme");
|
|
1325
|
+
function Gn() {
|
|
1326
|
+
const e = ne(dt, null);
|
|
1167
1327
|
if (e === null)
|
|
1168
1328
|
throw new Error("useTheme() was called outside a panel created by createAdmin().");
|
|
1169
1329
|
return e;
|
|
1170
1330
|
}
|
|
1171
|
-
function
|
|
1172
|
-
e.provide(
|
|
1331
|
+
function tn(e, t) {
|
|
1332
|
+
e.provide(dt, t);
|
|
1173
1333
|
}
|
|
1174
|
-
function
|
|
1175
|
-
const t = e.storageKey === void 0 ?
|
|
1176
|
-
preference:
|
|
1334
|
+
function an(e = {}) {
|
|
1335
|
+
const t = e.storageKey === void 0 ? en : e.storageKey, a = pe({
|
|
1336
|
+
preference: nn(t) ?? "system",
|
|
1177
1337
|
resolved: "light"
|
|
1178
1338
|
});
|
|
1179
|
-
function
|
|
1180
|
-
|
|
1339
|
+
function l() {
|
|
1340
|
+
Gt(a.preference), a.resolved = a.preference === "system" ? Jt() : a.preference;
|
|
1181
1341
|
}
|
|
1182
|
-
return
|
|
1183
|
-
|
|
1342
|
+
return l(), Xt((i) => {
|
|
1343
|
+
a.preference === "system" && (a.resolved = i);
|
|
1184
1344
|
}), {
|
|
1185
|
-
state:
|
|
1345
|
+
state: a,
|
|
1186
1346
|
set(i) {
|
|
1187
|
-
|
|
1347
|
+
a.preference = i, l(), Oe(t, i);
|
|
1188
1348
|
},
|
|
1189
1349
|
adopt(i) {
|
|
1190
1350
|
if (i === void 0)
|
|
1191
1351
|
return;
|
|
1192
1352
|
const s = i ?? "system";
|
|
1193
|
-
s !==
|
|
1353
|
+
s !== a.preference && (a.preference = s, l(), Oe(t, s));
|
|
1194
1354
|
}
|
|
1195
1355
|
};
|
|
1196
1356
|
}
|
|
1197
|
-
function
|
|
1357
|
+
function Oe(e, t) {
|
|
1198
1358
|
if (e !== null)
|
|
1199
1359
|
try {
|
|
1200
1360
|
localStorage.setItem(e, t);
|
|
1201
1361
|
} catch {
|
|
1202
1362
|
}
|
|
1203
1363
|
}
|
|
1204
|
-
function
|
|
1364
|
+
function nn(e) {
|
|
1205
1365
|
if (e === null)
|
|
1206
1366
|
return null;
|
|
1207
1367
|
try {
|
|
@@ -1211,7 +1371,7 @@ function An(e) {
|
|
|
1211
1371
|
return null;
|
|
1212
1372
|
}
|
|
1213
1373
|
}
|
|
1214
|
-
const
|
|
1374
|
+
const ct = {
|
|
1215
1375
|
shell: {
|
|
1216
1376
|
loading: "Loading the panel…",
|
|
1217
1377
|
"error-title": "The panel could not start",
|
|
@@ -1381,27 +1541,71 @@ const Ve = {
|
|
|
1381
1541
|
"hash-length": "An anchor may be at most :max characters long.",
|
|
1382
1542
|
"hash-shape": "An anchor is a name on the page: no spaces in it.",
|
|
1383
1543
|
"not-localized": "A link is the same in every language and cannot be translated."
|
|
1544
|
+
},
|
|
1545
|
+
// The categories every module shares: the refusals the server says, and the words of the
|
|
1546
|
+
// shared screens under a module's own.
|
|
1547
|
+
categories: {
|
|
1548
|
+
"in-use": "There are :count entries in it. Move them to another category first.",
|
|
1549
|
+
"slug-shape": "Letters, digits and single hyphens between them.",
|
|
1550
|
+
new: "New category",
|
|
1551
|
+
empty: "No categories yet.",
|
|
1552
|
+
"empty-help": "A category groups entries. One entry can be in several of them.",
|
|
1553
|
+
order: "The order here is the order on the site",
|
|
1554
|
+
hidden: "Hidden from the site",
|
|
1555
|
+
"no-address": "No address in this language",
|
|
1556
|
+
count: "Entries: :count",
|
|
1557
|
+
"show-items": "Show its entries",
|
|
1558
|
+
edit: "Edit",
|
|
1559
|
+
"open-on-site": "Open on the site",
|
|
1560
|
+
delete: "Delete",
|
|
1561
|
+
"delete-blocked": "While it holds entries it cannot go — move them first.",
|
|
1562
|
+
"delete-title": "Delete “:name”?",
|
|
1563
|
+
"delete-text": "It goes to the bin and comes off the site, and its address is free again.",
|
|
1564
|
+
deleted: "The category is in the bin.",
|
|
1565
|
+
cancel: "Cancel",
|
|
1566
|
+
create: "Create",
|
|
1567
|
+
save: "Save",
|
|
1568
|
+
saved: "Saved.",
|
|
1569
|
+
"save-failed": "Not saved — look at the marked fields.",
|
|
1570
|
+
"reorder-failed": "The new order was not saved.",
|
|
1571
|
+
"field-title": "Name",
|
|
1572
|
+
"field-slug": "Address",
|
|
1573
|
+
"address-moving": "The address is changing. The old one keeps working and leads to the new one.",
|
|
1574
|
+
untitled: "Untitled",
|
|
1575
|
+
trail: "Where you are",
|
|
1576
|
+
"leave-title": "Leave without saving?",
|
|
1577
|
+
"leave-text": "What was changed here since the last save will be lost.",
|
|
1578
|
+
leave: "Leave",
|
|
1579
|
+
"field-main": "Main",
|
|
1580
|
+
"field-add": "Add a category",
|
|
1581
|
+
"field-remove": "Take out of this category",
|
|
1582
|
+
"field-empty": "In no category yet.",
|
|
1583
|
+
"field-none-left": "Every category is already chosen.",
|
|
1584
|
+
"order-all": "Drag to change the order on the site.",
|
|
1585
|
+
"order-category": "Drag to change the order inside this category. The rest of the list keeps its own.",
|
|
1586
|
+
"order-locked": "Clear the search and the filters to change the order — only a whole list, or one category, can be dragged.",
|
|
1587
|
+
unknown: "One of the chosen categories is not there any more."
|
|
1384
1588
|
}
|
|
1385
|
-
},
|
|
1386
|
-
function
|
|
1387
|
-
const t = e.manifestUrl ??
|
|
1388
|
-
for (const
|
|
1389
|
-
s.push(...
|
|
1390
|
-
if (!s.some((
|
|
1391
|
-
const
|
|
1589
|
+
}, mt = "webx.locale";
|
|
1590
|
+
function Jn(e = {}) {
|
|
1591
|
+
const t = e.manifestUrl ?? dn() ?? "/api/cms/manifest", a = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), l = e.basePath ?? "/cms", i = e.modules ?? [], s = [...e.routes ?? []];
|
|
1592
|
+
for (const y of i)
|
|
1593
|
+
s.push(...y.routes ?? []);
|
|
1594
|
+
if (!s.some((y) => y.path === "/")) {
|
|
1595
|
+
const y = i.find((k) => k.landing === !0);
|
|
1392
1596
|
s.push({
|
|
1393
1597
|
path: "/",
|
|
1394
1598
|
name: "webx.home",
|
|
1395
|
-
component:
|
|
1396
|
-
props: { landing:
|
|
1599
|
+
component: Ia,
|
|
1600
|
+
props: { landing: y?.path ?? y?.routes?.[0]?.path ?? null }
|
|
1397
1601
|
});
|
|
1398
1602
|
}
|
|
1399
|
-
const
|
|
1400
|
-
history:
|
|
1603
|
+
const o = _t({
|
|
1604
|
+
history: $t(l),
|
|
1401
1605
|
routes: s
|
|
1402
|
-
}), r =
|
|
1606
|
+
}), r = Ee({ locale: e.locale ?? on() }), u = an(), c = e.http ?? Ja({
|
|
1403
1607
|
baseUrl: "",
|
|
1404
|
-
csrfUrl: `${
|
|
1608
|
+
csrfUrl: `${a}/auth/csrf-cookie`,
|
|
1405
1609
|
onUnauthenticated: () => {
|
|
1406
1610
|
m.setUser(null), m.state.status = "unauthenticated";
|
|
1407
1611
|
},
|
|
@@ -1411,174 +1615,174 @@ function fa(e = {}) {
|
|
|
1411
1615
|
// signing in on a Russian sign-in screen lands in an English panel.
|
|
1412
1616
|
headers: () => ({ "X-Webx-Locale": r.state.locale })
|
|
1413
1617
|
});
|
|
1414
|
-
r.defaults("webx-admin",
|
|
1415
|
-
async function
|
|
1416
|
-
const
|
|
1417
|
-
r.load(
|
|
1618
|
+
r.defaults("webx-admin", ct);
|
|
1619
|
+
async function h(y) {
|
|
1620
|
+
const k = await c.get(`${a}/translations/${y}`);
|
|
1621
|
+
r.load(k.data.namespaces, k.data.locale, k.data.fallback), sn(k.data.locale), un(k.data.locale, r.state.panelLocales);
|
|
1418
1622
|
}
|
|
1419
|
-
const m =
|
|
1420
|
-
http:
|
|
1623
|
+
const m = Ra({
|
|
1624
|
+
http: c,
|
|
1421
1625
|
theme: u,
|
|
1422
|
-
basePath:
|
|
1423
|
-
apiPath:
|
|
1626
|
+
basePath: l,
|
|
1627
|
+
apiPath: a,
|
|
1424
1628
|
modules: i,
|
|
1425
1629
|
i18n: r,
|
|
1426
|
-
loadDictionary:
|
|
1630
|
+
loadDictionary: h,
|
|
1427
1631
|
types: e.types,
|
|
1428
1632
|
screens: e.screens,
|
|
1429
|
-
loadManifest: async () => (await
|
|
1430
|
-
}),
|
|
1431
|
-
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
|
|
1633
|
+
loadManifest: async () => (await c.get(t)).data
|
|
1634
|
+
}), v = xt(ln(e));
|
|
1635
|
+
v.use(Bt), Na(v, m), ea(v, r), tn(v, u);
|
|
1636
|
+
const d = W("");
|
|
1637
|
+
v.provide(
|
|
1638
|
+
It,
|
|
1435
1639
|
x(() => r.state.locale)
|
|
1436
|
-
),
|
|
1640
|
+
), v.provide(Pt, {
|
|
1437
1641
|
list: x(
|
|
1438
|
-
() => r.state.contentLocales.map((
|
|
1439
|
-
code:
|
|
1440
|
-
label:
|
|
1642
|
+
() => r.state.contentLocales.map((y) => ({
|
|
1643
|
+
code: y.code,
|
|
1644
|
+
label: y.code.toUpperCase()
|
|
1441
1645
|
}))
|
|
1442
1646
|
),
|
|
1443
1647
|
active: x({
|
|
1444
|
-
get: () =>
|
|
1445
|
-
set: (
|
|
1446
|
-
|
|
1648
|
+
get: () => d.value || (r.state.contentLocales[0]?.code ?? ""),
|
|
1649
|
+
set: (y) => {
|
|
1650
|
+
d.value = y;
|
|
1447
1651
|
}
|
|
1448
1652
|
})
|
|
1449
1653
|
});
|
|
1450
|
-
const
|
|
1451
|
-
app:
|
|
1452
|
-
router:
|
|
1654
|
+
const w = {
|
|
1655
|
+
app: v,
|
|
1656
|
+
router: o,
|
|
1453
1657
|
context: m,
|
|
1454
1658
|
i18n: r,
|
|
1455
1659
|
theme: u,
|
|
1456
1660
|
async mount() {
|
|
1457
|
-
await Promise.all([
|
|
1458
|
-
}),
|
|
1661
|
+
await Promise.all([f(), h(r.state.locale)]).catch(() => {
|
|
1662
|
+
}), v.mount(e.el ?? "#webx-app"), await m.reload();
|
|
1459
1663
|
}
|
|
1460
1664
|
};
|
|
1461
|
-
async function
|
|
1462
|
-
const
|
|
1463
|
-
r.state.panelLocales =
|
|
1665
|
+
async function f() {
|
|
1666
|
+
const y = await c.get(`${a}/locales`);
|
|
1667
|
+
r.state.panelLocales = y.data.panel, r.state.contentLocales = y.data.content;
|
|
1464
1668
|
}
|
|
1465
|
-
for (const
|
|
1466
|
-
|
|
1467
|
-
return
|
|
1669
|
+
for (const y of e.plugins ?? [])
|
|
1670
|
+
y.install(w);
|
|
1671
|
+
return v.use(o), w;
|
|
1468
1672
|
}
|
|
1469
|
-
function
|
|
1673
|
+
function ln(e) {
|
|
1470
1674
|
const t = {
|
|
1471
1675
|
// The menu is the panel's own: it is the manifest, drawn.
|
|
1472
1676
|
// The shell hands in what a choice means where it drew the menu — in the drawer it is what
|
|
1473
1677
|
// closes it, and a drawer that stays open over the section it just opened is a drawer the
|
|
1474
1678
|
// reader has to dismiss by hand.
|
|
1475
|
-
nav: (
|
|
1679
|
+
nav: (a) => de(Pa, { collapsed: a.collapsed === !0, onSelect: a.select })
|
|
1476
1680
|
};
|
|
1477
|
-
return e.brand !== void 0 && (t.brand = () =>
|
|
1681
|
+
return e.brand !== void 0 && (t.brand = () => de(e.brand)), e.userMenu !== void 0 && (t.user = (a) => de(e.userMenu, { expanded: a.expanded === !0 })), { render: () => de(Xa, null, t) };
|
|
1478
1682
|
}
|
|
1479
|
-
function
|
|
1480
|
-
const e =
|
|
1683
|
+
function on() {
|
|
1684
|
+
const e = rn(mt);
|
|
1481
1685
|
return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
|
|
1482
1686
|
}
|
|
1483
|
-
function
|
|
1687
|
+
function sn(e) {
|
|
1484
1688
|
try {
|
|
1485
|
-
localStorage.setItem(
|
|
1689
|
+
localStorage.setItem(mt, e);
|
|
1486
1690
|
} catch {
|
|
1487
1691
|
}
|
|
1488
1692
|
}
|
|
1489
|
-
function
|
|
1693
|
+
function rn(e) {
|
|
1490
1694
|
try {
|
|
1491
1695
|
return localStorage.getItem(e);
|
|
1492
1696
|
} catch {
|
|
1493
1697
|
return null;
|
|
1494
1698
|
}
|
|
1495
1699
|
}
|
|
1496
|
-
function
|
|
1497
|
-
typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((
|
|
1700
|
+
function un(e, t) {
|
|
1701
|
+
typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((a) => a.code === e)?.direction ?? "ltr");
|
|
1498
1702
|
}
|
|
1499
|
-
function
|
|
1703
|
+
function dn() {
|
|
1500
1704
|
return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
|
|
1501
1705
|
}
|
|
1502
|
-
function
|
|
1706
|
+
function cn(e) {
|
|
1503
1707
|
const t = e.replace(/\r\n?/g, `
|
|
1504
1708
|
`).split(`
|
|
1505
|
-
`),
|
|
1506
|
-
let
|
|
1507
|
-
for (;
|
|
1508
|
-
const i = t[
|
|
1709
|
+
`), a = [];
|
|
1710
|
+
let l = 0;
|
|
1711
|
+
for (; l < t.length; ) {
|
|
1712
|
+
const i = t[l] ?? "";
|
|
1509
1713
|
if (i.trim() === "") {
|
|
1510
|
-
|
|
1714
|
+
l += 1;
|
|
1511
1715
|
continue;
|
|
1512
1716
|
}
|
|
1513
1717
|
if (/^```([\w-]*)\s*$/.exec(i)) {
|
|
1514
1718
|
const u = [];
|
|
1515
|
-
for (
|
|
1516
|
-
u.push(t[
|
|
1517
|
-
|
|
1719
|
+
for (l += 1; l < t.length && !/^```\s*$/.test(t[l] ?? ""); )
|
|
1720
|
+
u.push(t[l] ?? ""), l += 1;
|
|
1721
|
+
l += 1, a.push(`<pre><code>${We(u.join(`
|
|
1518
1722
|
`))}</code></pre>`);
|
|
1519
1723
|
continue;
|
|
1520
1724
|
}
|
|
1521
|
-
const
|
|
1522
|
-
if (
|
|
1523
|
-
const u = Math.min(
|
|
1524
|
-
|
|
1725
|
+
const o = /^(#{1,4})\s+(.*)$/.exec(i);
|
|
1726
|
+
if (o) {
|
|
1727
|
+
const u = Math.min(o[1].length + 1, 5);
|
|
1728
|
+
a.push(`<h${u}>${Te(o[2] ?? "")}</h${u}>`), l += 1;
|
|
1525
1729
|
continue;
|
|
1526
1730
|
}
|
|
1527
|
-
if (
|
|
1528
|
-
const u = /^\s*\d+[.)]\s+/.test(i),
|
|
1529
|
-
for (;
|
|
1530
|
-
for (
|
|
1531
|
-
const m = t[
|
|
1532
|
-
if (m.trim() === "" ||
|
|
1731
|
+
if (me(i)) {
|
|
1732
|
+
const u = /^\s*\d+[.)]\s+/.test(i), c = [];
|
|
1733
|
+
for (; l < t.length && me(t[l] ?? ""); )
|
|
1734
|
+
for (c.push((t[l] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), l += 1; l < t.length; ) {
|
|
1735
|
+
const m = t[l] ?? "";
|
|
1736
|
+
if (m.trim() === "" || me(m) || /^(#{1,4})\s/.test(m) || /^```/.test(m))
|
|
1533
1737
|
break;
|
|
1534
|
-
|
|
1738
|
+
c[c.length - 1] += ` ${m.trim()}`, l += 1;
|
|
1535
1739
|
}
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1740
|
+
const h = u ? "ol" : "ul";
|
|
1741
|
+
a.push(`<${h}>${c.map((m) => `<li>${Te(m)}</li>`).join("")}</${h}>`);
|
|
1538
1742
|
continue;
|
|
1539
1743
|
}
|
|
1540
1744
|
const r = [];
|
|
1541
|
-
for (;
|
|
1542
|
-
const u = t[
|
|
1543
|
-
if (u.trim() === "" ||
|
|
1544
|
-
r.push(u.trim()),
|
|
1745
|
+
for (; l < t.length; ) {
|
|
1746
|
+
const u = t[l] ?? "";
|
|
1747
|
+
if (u.trim() === "" || me(u) || /^(#{1,4})\s/.test(u) || /^```/.test(u)) break;
|
|
1748
|
+
r.push(u.trim()), l += 1;
|
|
1545
1749
|
}
|
|
1546
|
-
|
|
1750
|
+
a.push(`<p>${Te(r.join(" "))}</p>`);
|
|
1547
1751
|
}
|
|
1548
|
-
return
|
|
1752
|
+
return a.join("");
|
|
1549
1753
|
}
|
|
1550
|
-
const
|
|
1551
|
-
function
|
|
1754
|
+
const ce = "\0";
|
|
1755
|
+
function me(e) {
|
|
1552
1756
|
return /^\s*(?:[-*+]|\d+[.)])\s+/.test(e);
|
|
1553
1757
|
}
|
|
1554
|
-
function
|
|
1555
|
-
const t = [],
|
|
1556
|
-
return
|
|
1758
|
+
function Te(e) {
|
|
1759
|
+
const t = [], a = e.replace(/`([^`]+)`/g, (i, s) => (t.push(`<code>${We(s)}</code>`), `${ce}${t.length - 1}${ce}`));
|
|
1760
|
+
return We(a).replace(
|
|
1557
1761
|
/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
|
|
1558
1762
|
'<a href="$2" target="_blank" rel="noopener">$1</a>'
|
|
1559
1763
|
).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(
|
|
1560
|
-
new RegExp(`${
|
|
1764
|
+
new RegExp(`${ce}(\\d+)${ce}`, "g"),
|
|
1561
1765
|
(i, s) => t[Number(s)] ?? ""
|
|
1562
1766
|
);
|
|
1563
1767
|
}
|
|
1564
|
-
function
|
|
1768
|
+
function We(e) {
|
|
1565
1769
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1566
1770
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const t = e.scope("webx-admin"),
|
|
1569
|
-
function
|
|
1570
|
-
const u = e.state.locale,
|
|
1571
|
-
let
|
|
1572
|
-
return
|
|
1771
|
+
function mn(e) {
|
|
1772
|
+
const t = e.scope("webx-admin"), a = /* @__PURE__ */ new Map();
|
|
1773
|
+
function l(s, o, r) {
|
|
1774
|
+
const u = e.state.locale, c = `${u}:${s}`;
|
|
1775
|
+
let h = a.get(c);
|
|
1776
|
+
return h === void 0 && (h = new Intl.DateTimeFormat(u, o), a.set(c, h)), h.format(r);
|
|
1573
1777
|
}
|
|
1574
|
-
const i = (s) =>
|
|
1778
|
+
const i = (s) => l("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, s);
|
|
1575
1779
|
return {
|
|
1576
1780
|
short(s) {
|
|
1577
|
-
const
|
|
1578
|
-
if (
|
|
1781
|
+
const o = fe(s);
|
|
1782
|
+
if (o === null)
|
|
1579
1783
|
return t("dates.never");
|
|
1580
|
-
const r = /* @__PURE__ */ new Date(), u =
|
|
1581
|
-
return u === 0 ? t("dates.today", { time: i(
|
|
1784
|
+
const r = /* @__PURE__ */ new Date(), u = He(o, r);
|
|
1785
|
+
return u === 0 ? t("dates.today", { time: i(o) }) : u === -1 ? t("dates.yesterday", { time: i(o) }) : o.getFullYear() === r.getFullYear() ? l(
|
|
1582
1786
|
"this-year",
|
|
1583
1787
|
{
|
|
1584
1788
|
day: "numeric",
|
|
@@ -1587,83 +1791,406 @@ function Nn(e) {
|
|
|
1587
1791
|
minute: "2-digit",
|
|
1588
1792
|
hourCycle: "h23"
|
|
1589
1793
|
},
|
|
1590
|
-
|
|
1591
|
-
) :
|
|
1794
|
+
o
|
|
1795
|
+
) : l("earlier", { day: "numeric", month: "long", year: "numeric" }, o);
|
|
1592
1796
|
},
|
|
1593
1797
|
compact(s) {
|
|
1594
|
-
const
|
|
1595
|
-
if (
|
|
1798
|
+
const o = fe(s);
|
|
1799
|
+
if (o === null)
|
|
1596
1800
|
return t("dates.never");
|
|
1597
1801
|
const r = /* @__PURE__ */ new Date();
|
|
1598
|
-
return
|
|
1802
|
+
return He(o, r) === 0 ? i(o) : o.getFullYear() === r.getFullYear() ? l("compact", { day: "numeric", month: "short" }, o) : l("compact-earlier", { dateStyle: "short" }, o);
|
|
1599
1803
|
},
|
|
1600
1804
|
exact(s) {
|
|
1601
|
-
const
|
|
1602
|
-
return
|
|
1805
|
+
const o = fe(s);
|
|
1806
|
+
return o === null ? "" : l("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, o);
|
|
1603
1807
|
},
|
|
1604
1808
|
iso(s) {
|
|
1605
|
-
const
|
|
1606
|
-
return
|
|
1809
|
+
const o = fe(s);
|
|
1810
|
+
return o === null ? "" : o.toISOString();
|
|
1607
1811
|
}
|
|
1608
1812
|
};
|
|
1609
1813
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const e =
|
|
1612
|
-
return
|
|
1814
|
+
function vt() {
|
|
1815
|
+
const e = ne(we, null);
|
|
1816
|
+
return mn(e ?? vn());
|
|
1613
1817
|
}
|
|
1614
|
-
let
|
|
1615
|
-
function
|
|
1616
|
-
return
|
|
1818
|
+
let ve = null;
|
|
1819
|
+
function vn() {
|
|
1820
|
+
return ve === null && (ve = Ee(), ve.defaults("webx-admin", ct)), ve;
|
|
1617
1821
|
}
|
|
1618
|
-
function
|
|
1822
|
+
function fe(e) {
|
|
1619
1823
|
if (e == null || e === "")
|
|
1620
1824
|
return null;
|
|
1621
1825
|
const t = e instanceof Date ? e : new Date(e);
|
|
1622
1826
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1623
1827
|
}
|
|
1624
|
-
function
|
|
1625
|
-
const
|
|
1626
|
-
return Math.round((
|
|
1828
|
+
function He(e, t) {
|
|
1829
|
+
const a = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate());
|
|
1830
|
+
return Math.round((a(e) - a(t)) / 864e5);
|
|
1627
1831
|
}
|
|
1628
|
-
function
|
|
1629
|
-
const
|
|
1630
|
-
if (
|
|
1631
|
-
return
|
|
1632
|
-
if (
|
|
1633
|
-
if (
|
|
1634
|
-
if (
|
|
1635
|
-
if (
|
|
1636
|
-
if (
|
|
1637
|
-
const i = e instanceof
|
|
1832
|
+
function fn(e, t, a) {
|
|
1833
|
+
const l = e instanceof Ce ? e.status : pn(e);
|
|
1834
|
+
if (l === 422)
|
|
1835
|
+
return hn(e) ?? a ?? t("errors.unknown");
|
|
1836
|
+
if (l === 401) return t("errors.signed-out");
|
|
1837
|
+
if (l === 403) return t("errors.forbidden");
|
|
1838
|
+
if (l === 404) return t("errors.gone");
|
|
1839
|
+
if (l === 409) return t("errors.conflict");
|
|
1840
|
+
if (l === 429) {
|
|
1841
|
+
const i = e instanceof Ce ? e.retryAfter : null;
|
|
1638
1842
|
return i === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: i });
|
|
1639
1843
|
}
|
|
1640
|
-
return
|
|
1844
|
+
return l !== null && l >= 500 ? t("errors.server") : l === null ? t("errors.offline") : a ?? t("errors.unknown");
|
|
1641
1845
|
}
|
|
1642
|
-
function
|
|
1643
|
-
const e =
|
|
1644
|
-
return (t,
|
|
1846
|
+
function Re() {
|
|
1847
|
+
const e = P("webx-admin");
|
|
1848
|
+
return (t, a) => fn(t, e, a);
|
|
1645
1849
|
}
|
|
1646
|
-
function
|
|
1850
|
+
function pn(e) {
|
|
1647
1851
|
const t = e?.status;
|
|
1648
1852
|
return typeof t == "number" ? t : null;
|
|
1649
1853
|
}
|
|
1650
|
-
function
|
|
1651
|
-
const
|
|
1652
|
-
return typeof
|
|
1854
|
+
function hn(e) {
|
|
1855
|
+
const a = e?.body?.message;
|
|
1856
|
+
return typeof a == "string" && a !== "" ? a : null;
|
|
1653
1857
|
}
|
|
1654
|
-
function
|
|
1655
|
-
const
|
|
1858
|
+
function gn(e, t, a) {
|
|
1859
|
+
const l = `${e.apiPath}/entities/${t}/${a}/notes`, i = (o) => `${e.apiPath}/notes/${o}`, s = (o) => o.data;
|
|
1656
1860
|
return {
|
|
1657
|
-
list: () => e.http.get(
|
|
1658
|
-
add: (
|
|
1659
|
-
save: (
|
|
1660
|
-
remove: (
|
|
1861
|
+
list: () => e.http.get(l).then(s),
|
|
1862
|
+
add: (o) => e.http.post(l, { body: o }).then(s),
|
|
1863
|
+
save: (o, r) => e.http.put(i(o), { body: r }).then(s),
|
|
1864
|
+
remove: (o) => e.http.delete(i(o)).then(() => {
|
|
1661
1865
|
})
|
|
1662
1866
|
};
|
|
1663
1867
|
}
|
|
1664
|
-
const
|
|
1868
|
+
const ft = /* @__PURE__ */ Symbol("wx-category-editor");
|
|
1869
|
+
function yn(e) {
|
|
1870
|
+
Ye(ft, e);
|
|
1871
|
+
}
|
|
1872
|
+
function Qn() {
|
|
1873
|
+
return ne(ft, null);
|
|
1874
|
+
}
|
|
1875
|
+
function bn(e) {
|
|
1876
|
+
return (e.q ?? "").trim() !== "" || e.filtered ? "locked" : e.category == null ? "all" : "category";
|
|
1877
|
+
}
|
|
1878
|
+
function Zn(e, t) {
|
|
1879
|
+
const a = X(), l = P("webx-admin"), i = x(() => bn(t()));
|
|
1880
|
+
return {
|
|
1881
|
+
mode: i,
|
|
1882
|
+
sortable: x(() => i.value !== "locked"),
|
|
1883
|
+
hint: x(() => l(`categories.order-${i.value}`)),
|
|
1884
|
+
move: (s) => aa(a, e, s, i.value === "category" ? t().category ?? null : null)
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
function Ne(e = {}) {
|
|
1888
|
+
const t = P("webx-admin");
|
|
1889
|
+
return (a, l) => t(e[a] ?? `webx-admin::categories.${a}`, l);
|
|
1890
|
+
}
|
|
1891
|
+
const wn = /* @__PURE__ */ N({
|
|
1892
|
+
name: "WxCategoryCreateDialog",
|
|
1893
|
+
__name: "CategoryCreateDialog",
|
|
1894
|
+
props: {
|
|
1895
|
+
options: {}
|
|
1896
|
+
},
|
|
1897
|
+
setup(e) {
|
|
1898
|
+
const t = e, { open: a, resolve: l, dismiss: i } = Dt(), s = xe(X(), t.options.api), o = Ne(t.options.words), r = W(""), u = W(!1), c = W({}), h = qe("field");
|
|
1899
|
+
Le(async () => {
|
|
1900
|
+
await Ge(), h.value?.querySelector("input")?.focus();
|
|
1901
|
+
});
|
|
1902
|
+
function m(d) {
|
|
1903
|
+
const w = Object.keys(c.value).find((f) => f === d || f.startsWith(`${d}.`));
|
|
1904
|
+
return w === void 0 ? void 0 : c.value[w]?.[0];
|
|
1905
|
+
}
|
|
1906
|
+
async function v() {
|
|
1907
|
+
if (!(r.value.trim() === "" || u.value)) {
|
|
1908
|
+
u.value = !0, c.value = {};
|
|
1909
|
+
try {
|
|
1910
|
+
l(await s.create({ title: r.value.trim() }));
|
|
1911
|
+
} catch (d) {
|
|
1912
|
+
c.value = d.body?.errors ?? {};
|
|
1913
|
+
} finally {
|
|
1914
|
+
u.value = !1;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
return (d, w) => (p(), $(n(nt), {
|
|
1919
|
+
open: n(a),
|
|
1920
|
+
"onUpdate:open": w[2] || (w[2] = (f) => Xe(a) ? a.value = f : null),
|
|
1921
|
+
title: n(o)("new"),
|
|
1922
|
+
width: 440
|
|
1923
|
+
}, {
|
|
1924
|
+
footer: g(() => [
|
|
1925
|
+
b(n(Ft), { size: "sm" }, {
|
|
1926
|
+
default: g(() => [
|
|
1927
|
+
b(n(Z), {
|
|
1928
|
+
variant: "outline",
|
|
1929
|
+
onClick: w[1] || (w[1] = (f) => n(i)())
|
|
1930
|
+
}, {
|
|
1931
|
+
default: g(() => [
|
|
1932
|
+
V(L(n(o)("cancel")), 1)
|
|
1933
|
+
]),
|
|
1934
|
+
_: 1
|
|
1935
|
+
}),
|
|
1936
|
+
b(n(Z), {
|
|
1937
|
+
type: "primary",
|
|
1938
|
+
loading: u.value,
|
|
1939
|
+
disabled: r.value.trim() === "",
|
|
1940
|
+
onClick: v
|
|
1941
|
+
}, {
|
|
1942
|
+
default: g(() => [
|
|
1943
|
+
V(L(n(o)("create")), 1)
|
|
1944
|
+
]),
|
|
1945
|
+
_: 1
|
|
1946
|
+
}, 8, ["loading", "disabled"])
|
|
1947
|
+
]),
|
|
1948
|
+
_: 1
|
|
1949
|
+
})
|
|
1950
|
+
]),
|
|
1951
|
+
default: g(() => [
|
|
1952
|
+
b(n(Mt), {
|
|
1953
|
+
label: n(o)("field-title"),
|
|
1954
|
+
error: m("title") ?? m("slug"),
|
|
1955
|
+
required: ""
|
|
1956
|
+
}, {
|
|
1957
|
+
default: g(() => [
|
|
1958
|
+
O("div", {
|
|
1959
|
+
ref_key: "field",
|
|
1960
|
+
ref: h
|
|
1961
|
+
}, [
|
|
1962
|
+
b(n(ye), {
|
|
1963
|
+
modelValue: r.value,
|
|
1964
|
+
"onUpdate:modelValue": w[0] || (w[0] = (f) => r.value = f),
|
|
1965
|
+
"aria-label": n(o)("field-title"),
|
|
1966
|
+
onKeyup: Je(v, ["enter"])
|
|
1967
|
+
}, null, 8, ["modelValue", "aria-label"])
|
|
1968
|
+
], 512)
|
|
1969
|
+
]),
|
|
1970
|
+
_: 1
|
|
1971
|
+
}, 8, ["label", "error"])
|
|
1972
|
+
]),
|
|
1973
|
+
_: 1
|
|
1974
|
+
}, 8, ["open", "title"]));
|
|
1975
|
+
}
|
|
1976
|
+
}), xn = { class: "wx-category-row__name" }, kn = /* @__PURE__ */ N({
|
|
1977
|
+
name: "WxCategoriesPage",
|
|
1978
|
+
__name: "CategoriesPage",
|
|
1979
|
+
props: {
|
|
1980
|
+
options: {}
|
|
1981
|
+
},
|
|
1982
|
+
setup(e) {
|
|
1983
|
+
const t = e, a = X(), l = xe(a, t.options.api), i = ge(), s = Ne(t.options.words), o = Re(), r = W([]), u = W(!0), c = x(() => a.can(t.options.manage)), h = x(
|
|
1984
|
+
() => a.state.manifest?.modules.find((S) => S.id === t.options.module)?.title ?? ""
|
|
1985
|
+
), m = Ot(wn), v = x(
|
|
1986
|
+
() => c.value ? [{ key: "new", label: s("new"), icon: "plus", primary: !0, run: () => {
|
|
1987
|
+
y();
|
|
1988
|
+
} }] : []
|
|
1989
|
+
);
|
|
1990
|
+
function d(S) {
|
|
1991
|
+
return Number(S[t.options.count] ?? 0);
|
|
1992
|
+
}
|
|
1993
|
+
async function w() {
|
|
1994
|
+
u.value = !0;
|
|
1995
|
+
try {
|
|
1996
|
+
r.value = (await l.list()).data;
|
|
1997
|
+
} catch (S) {
|
|
1998
|
+
D.danger(o(S));
|
|
1999
|
+
} finally {
|
|
2000
|
+
u.value = !1;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
w();
|
|
2004
|
+
function f(S) {
|
|
2005
|
+
i.push(`${t.options.path}/${S.id}`);
|
|
2006
|
+
}
|
|
2007
|
+
async function y() {
|
|
2008
|
+
const S = await m({ options: t.options });
|
|
2009
|
+
S !== void 0 && f(S);
|
|
2010
|
+
}
|
|
2011
|
+
async function k(S) {
|
|
2012
|
+
if (d(S) > 0) {
|
|
2013
|
+
D.warning(s("delete-blocked"));
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
if (await he({
|
|
2017
|
+
title: s("delete-title", { name: S.name }),
|
|
2018
|
+
message: s("delete-text"),
|
|
2019
|
+
confirmText: s("delete"),
|
|
2020
|
+
cancelText: s("cancel"),
|
|
2021
|
+
tone: "danger"
|
|
2022
|
+
}))
|
|
2023
|
+
try {
|
|
2024
|
+
await l.remove(S.id), D.success(s("deleted")), await w();
|
|
2025
|
+
} catch (C) {
|
|
2026
|
+
D.danger(o(C));
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function M(S) {
|
|
2030
|
+
const B = [{ key: "edit", label: s("edit"), icon: "edit", run: () => f(S) }], C = t.options.items;
|
|
2031
|
+
return C && d(S) > 0 && B.push({
|
|
2032
|
+
key: "items",
|
|
2033
|
+
label: s("show-items"),
|
|
2034
|
+
icon: "file-txt",
|
|
2035
|
+
run: () => {
|
|
2036
|
+
i.push(C(S.id));
|
|
2037
|
+
}
|
|
2038
|
+
}), S.url && S.is_visible && B.push({ key: "site", label: s("open-on-site"), icon: "link", href: S.url }), c.value && B.push({
|
|
2039
|
+
key: "delete",
|
|
2040
|
+
label: s("delete"),
|
|
2041
|
+
icon: "trash",
|
|
2042
|
+
danger: !0,
|
|
2043
|
+
run: () => {
|
|
2044
|
+
k(S);
|
|
2045
|
+
}
|
|
2046
|
+
}), B;
|
|
2047
|
+
}
|
|
2048
|
+
async function J() {
|
|
2049
|
+
try {
|
|
2050
|
+
await l.reorder(r.value.map((S) => S.id));
|
|
2051
|
+
} catch (S) {
|
|
2052
|
+
D.danger(o(S, s("reorder-failed"))), await w();
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
return (S, B) => {
|
|
2056
|
+
const C = j("router-link");
|
|
2057
|
+
return p(), $(it, {
|
|
2058
|
+
class: "wx-categories",
|
|
2059
|
+
title: h.value,
|
|
2060
|
+
actions: v.value,
|
|
2061
|
+
padding: "sm"
|
|
2062
|
+
}, {
|
|
2063
|
+
default: g(() => [
|
|
2064
|
+
u.value ? (p(), $(n(re), {
|
|
2065
|
+
key: 0,
|
|
2066
|
+
class: "wx-categories__loading",
|
|
2067
|
+
rows: 5
|
|
2068
|
+
})) : r.value.length === 0 ? (p(), $(n(lt), {
|
|
2069
|
+
key: 1,
|
|
2070
|
+
title: n(s)("empty"),
|
|
2071
|
+
description: n(s)("empty-help")
|
|
2072
|
+
}, null, 8, ["title", "description"])) : (p(), T(H, { key: 2 }, [
|
|
2073
|
+
b(n(et), {
|
|
2074
|
+
modelValue: r.value,
|
|
2075
|
+
"onUpdate:modelValue": B[0] || (B[0] = (A) => r.value = A),
|
|
2076
|
+
class: "wx-categories__list",
|
|
2077
|
+
plain: "",
|
|
2078
|
+
"item-key": "id",
|
|
2079
|
+
"item-label": (A) => A.name,
|
|
2080
|
+
disabled: !c.value,
|
|
2081
|
+
onMove: J
|
|
2082
|
+
}, {
|
|
2083
|
+
default: g(({ item: A }) => [
|
|
2084
|
+
b(C, {
|
|
2085
|
+
class: ae(["wx-category-row", { "is-hidden": !A.is_visible }]),
|
|
2086
|
+
to: `${t.options.path}/${A.id}`
|
|
2087
|
+
}, {
|
|
2088
|
+
default: g(() => [
|
|
2089
|
+
O("span", xn, [
|
|
2090
|
+
b(n(G), {
|
|
2091
|
+
truncate: "",
|
|
2092
|
+
weight: "medium"
|
|
2093
|
+
}, {
|
|
2094
|
+
default: g(() => [
|
|
2095
|
+
V(L(A.name), 1)
|
|
2096
|
+
]),
|
|
2097
|
+
_: 2
|
|
2098
|
+
}, 1024),
|
|
2099
|
+
A.is_visible ? U("", !0) : (p(), $(n(ot), {
|
|
2100
|
+
key: 0,
|
|
2101
|
+
content: n(s)("hidden")
|
|
2102
|
+
}, {
|
|
2103
|
+
default: g(() => [
|
|
2104
|
+
b(n(Ve), {
|
|
2105
|
+
name: "eye-off",
|
|
2106
|
+
size: "sm"
|
|
2107
|
+
})
|
|
2108
|
+
]),
|
|
2109
|
+
_: 1
|
|
2110
|
+
}, 8, ["content"]))
|
|
2111
|
+
]),
|
|
2112
|
+
b(n(G), {
|
|
2113
|
+
size: "sm",
|
|
2114
|
+
tone: "muted",
|
|
2115
|
+
truncate: ""
|
|
2116
|
+
}, {
|
|
2117
|
+
default: g(() => [
|
|
2118
|
+
V(L(A.path === null ? n(s)("no-address") : `/${A.path}`), 1)
|
|
2119
|
+
]),
|
|
2120
|
+
_: 2
|
|
2121
|
+
}, 1024)
|
|
2122
|
+
]),
|
|
2123
|
+
_: 2
|
|
2124
|
+
}, 1032, ["class", "to"])
|
|
2125
|
+
]),
|
|
2126
|
+
actions: g(({ item: A }) => [
|
|
2127
|
+
b(n(G), {
|
|
2128
|
+
class: "wx-category-row__count",
|
|
2129
|
+
size: "sm",
|
|
2130
|
+
tone: "muted"
|
|
2131
|
+
}, {
|
|
2132
|
+
default: g(() => [
|
|
2133
|
+
V(L(n(s)("count", { count: d(A) })), 1)
|
|
2134
|
+
]),
|
|
2135
|
+
_: 2
|
|
2136
|
+
}, 1024),
|
|
2137
|
+
b(Ue, {
|
|
2138
|
+
actions: M(A),
|
|
2139
|
+
label: A.name
|
|
2140
|
+
}, null, 8, ["actions", "label"])
|
|
2141
|
+
]),
|
|
2142
|
+
_: 1
|
|
2143
|
+
}, 8, ["modelValue", "item-label", "disabled"]),
|
|
2144
|
+
b(n(be), {
|
|
2145
|
+
class: "wx-categories__note",
|
|
2146
|
+
type: "info",
|
|
2147
|
+
description: n(s)("order")
|
|
2148
|
+
}, null, 8, ["description"])
|
|
2149
|
+
], 64))
|
|
2150
|
+
]),
|
|
2151
|
+
_: 1
|
|
2152
|
+
}, 8, ["title", "actions"]);
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
}), _n = {
|
|
2156
|
+
class: "wx-save-state",
|
|
2157
|
+
role: "status",
|
|
2158
|
+
"aria-live": "polite"
|
|
2159
|
+
}, $n = /* @__PURE__ */ N({
|
|
2160
|
+
__name: "SaveState",
|
|
2161
|
+
props: {
|
|
2162
|
+
state: {},
|
|
2163
|
+
linger: { default: 2e3 }
|
|
2164
|
+
},
|
|
2165
|
+
setup(e) {
|
|
2166
|
+
const t = e, a = P("webx-admin"), l = W(!1);
|
|
2167
|
+
let i = null;
|
|
2168
|
+
ee(
|
|
2169
|
+
() => t.state,
|
|
2170
|
+
(o, r) => {
|
|
2171
|
+
i !== null && clearTimeout(i), l.value = r === "saving" && o === "saved", l.value && (i = window.setTimeout(() => {
|
|
2172
|
+
l.value = !1, i = null;
|
|
2173
|
+
}, t.linger));
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
const s = x(
|
|
2177
|
+
() => t.state === "saving" ? "saving" : l.value ? "saved" : null
|
|
2178
|
+
);
|
|
2179
|
+
return Qe(() => {
|
|
2180
|
+
i !== null && clearTimeout(i);
|
|
2181
|
+
}), (o, r) => (p(), T("span", _n, [
|
|
2182
|
+
s.value ? (p(), $(n(Ve), {
|
|
2183
|
+
key: 0,
|
|
2184
|
+
class: ae(["wx-save-state__mark", { "is-saved": s.value === "saved" }]),
|
|
2185
|
+
name: s.value === "saving" ? "loader" : "check",
|
|
2186
|
+
spin: s.value === "saving",
|
|
2187
|
+
label: n(a)(`editor.${s.value}`)
|
|
2188
|
+
}, null, 8, ["class", "name", "spin", "label"])) : U("", !0)
|
|
2189
|
+
]));
|
|
2190
|
+
}
|
|
2191
|
+
}), Tn = /* @__PURE__ */ Y($n, [["__scopeId", "data-v-216e5e44"]]), Sn = { class: "wx-screen-host" }, Cn = /* @__PURE__ */ N({
|
|
1665
2192
|
__name: "Screen",
|
|
1666
|
-
props: /* @__PURE__ */
|
|
2193
|
+
props: /* @__PURE__ */ oe({
|
|
1667
2194
|
name: {},
|
|
1668
2195
|
errors: { default: void 0 },
|
|
1669
2196
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -1674,39 +2201,39 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1674
2201
|
modelValue: { default: () => ({}) },
|
|
1675
2202
|
modelModifiers: {}
|
|
1676
2203
|
}),
|
|
1677
|
-
emits: /* @__PURE__ */
|
|
1678
|
-
setup(e, { expose: t, emit:
|
|
1679
|
-
const
|
|
1680
|
-
async function
|
|
1681
|
-
u.value = null,
|
|
2204
|
+
emits: /* @__PURE__ */ oe(["loaded"], ["update:modelValue"]),
|
|
2205
|
+
setup(e, { expose: t, emit: a }) {
|
|
2206
|
+
const l = e, i = a, s = ue(e, "modelValue"), o = X(), r = P("webx-admin"), u = W(null), c = W(null);
|
|
2207
|
+
async function h() {
|
|
2208
|
+
u.value = null, c.value = null;
|
|
1682
2209
|
try {
|
|
1683
|
-
const m = await
|
|
2210
|
+
const m = await o.loadScreen(l.name);
|
|
1684
2211
|
u.value = m, i("loaded", m);
|
|
1685
2212
|
} catch (m) {
|
|
1686
|
-
|
|
2213
|
+
c.value = m instanceof Error ? m.message : String(m);
|
|
1687
2214
|
}
|
|
1688
2215
|
}
|
|
1689
|
-
return
|
|
1690
|
-
|
|
1691
|
-
}, { immediate: !0 }), t({ reload:
|
|
1692
|
-
|
|
2216
|
+
return ee([() => l.name, () => o.i18n.state.locale], () => {
|
|
2217
|
+
h();
|
|
2218
|
+
}, { immediate: !0 }), t({ reload: h }), (m, v) => (p(), T("div", Sn, [
|
|
2219
|
+
c.value ? (p(), $(n(be), {
|
|
1693
2220
|
key: 0,
|
|
1694
2221
|
type: "danger",
|
|
1695
|
-
title:
|
|
1696
|
-
description:
|
|
1697
|
-
}, null, 8, ["title", "description"])) : u.value === null ? (
|
|
2222
|
+
title: n(r)("shell.error-title"),
|
|
2223
|
+
description: c.value
|
|
2224
|
+
}, null, 8, ["title", "description"])) : u.value === null ? (p(), $(n(re), {
|
|
1698
2225
|
key: 1,
|
|
1699
2226
|
rows: 4
|
|
1700
|
-
})) : (
|
|
2227
|
+
})) : (p(), $(n(Qt), {
|
|
1701
2228
|
key: 2,
|
|
1702
2229
|
modelValue: s.value,
|
|
1703
|
-
"onUpdate:modelValue":
|
|
2230
|
+
"onUpdate:modelValue": v[0] || (v[0] = (d) => s.value = d),
|
|
1704
2231
|
root: u.value,
|
|
1705
|
-
patch: o
|
|
1706
|
-
types: o
|
|
2232
|
+
patch: n(o).screenPatch(e.name),
|
|
2233
|
+
types: n(o).types,
|
|
1707
2234
|
errors: e.errors,
|
|
1708
|
-
translate: o
|
|
1709
|
-
can: o
|
|
2235
|
+
translate: n(o).i18n.t,
|
|
2236
|
+
can: n(o).can,
|
|
1710
2237
|
disabled: e.disabled,
|
|
1711
2238
|
"label-position": e.labelPosition,
|
|
1712
2239
|
"label-width": e.labelWidth,
|
|
@@ -1714,63 +2241,225 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1714
2241
|
}, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
|
|
1715
2242
|
]));
|
|
1716
2243
|
}
|
|
1717
|
-
}),
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
"aria-live": "polite"
|
|
1721
|
-
}, jn = /* @__PURE__ */ E({
|
|
1722
|
-
__name: "SaveState",
|
|
2244
|
+
}), Wn = /* @__PURE__ */ N({
|
|
2245
|
+
name: "WxCategoryEditorPage",
|
|
2246
|
+
__name: "CategoryEditorPage",
|
|
1723
2247
|
props: {
|
|
1724
|
-
|
|
1725
|
-
linger: { default: 2e3 }
|
|
2248
|
+
options: {}
|
|
1726
2249
|
},
|
|
1727
2250
|
setup(e) {
|
|
1728
|
-
const t = e,
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
(
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
2251
|
+
const t = e, a = X(), l = xe(a, t.options.api), i = Ze(), s = ge(), o = at(), r = Ne(t.options.words), u = Re(), c = x(() => Number(i.params.id)), h = x(() => t.options.path), m = W(null), v = W({}), d = W(null), w = W(""), f = W(!0), y = W(!1), k = W({}), M = x(() => a.can(t.options.manage)), J = x(() => JSON.stringify(v.value)), S = x(() => w.value !== "" && J.value !== w.value), B = x(() => y.value ? "saving" : S.value ? "unsaved" : "saved"), C = x(
|
|
2252
|
+
() => a.state.manifest?.modules.find((z) => z.id === t.options.module)?.title ?? ""
|
|
2253
|
+
), A = x(() => {
|
|
2254
|
+
const z = v.value.title;
|
|
2255
|
+
return Ht(z, o.active.value, m.value?.name ?? "") || r("untitled");
|
|
2256
|
+
});
|
|
2257
|
+
yn({ category: m, values: v, prefix: d, moving: () => r("address-moving") }), La({
|
|
2258
|
+
values: v,
|
|
2259
|
+
prefix: d,
|
|
2260
|
+
path: x(() => m.value?.path),
|
|
2261
|
+
moving: () => r("address-moving")
|
|
2262
|
+
});
|
|
2263
|
+
function E(z) {
|
|
2264
|
+
m.value = z.category, v.value = z.values, d.value = z.prefix, w.value = JSON.stringify(z.values);
|
|
2265
|
+
}
|
|
2266
|
+
async function K() {
|
|
2267
|
+
f.value = !0;
|
|
2268
|
+
try {
|
|
2269
|
+
E(await l.get(c.value));
|
|
2270
|
+
} catch (z) {
|
|
2271
|
+
D.danger(u(z)), s.push(h.value);
|
|
2272
|
+
} finally {
|
|
2273
|
+
f.value = !1;
|
|
1736
2274
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
(
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
2275
|
+
}
|
|
2276
|
+
async function le() {
|
|
2277
|
+
if (!(!m.value || y.value || !M.value)) {
|
|
2278
|
+
y.value = !0, k.value = {};
|
|
2279
|
+
try {
|
|
2280
|
+
E(await l.save(m.value.id, v.value)), D.success(r("saved"));
|
|
2281
|
+
} catch (z) {
|
|
2282
|
+
const q = z.body;
|
|
2283
|
+
q?.errors ? (k.value = q.errors, D.danger(r("save-failed"))) : D.danger(u(z));
|
|
2284
|
+
} finally {
|
|
2285
|
+
y.value = !1;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
async function ie() {
|
|
2290
|
+
const z = m.value;
|
|
2291
|
+
if (!(!z || !await he({
|
|
2292
|
+
title: r("delete-title", { name: z.name }),
|
|
2293
|
+
message: r("delete-text"),
|
|
2294
|
+
confirmText: r("delete"),
|
|
2295
|
+
cancelText: r("cancel"),
|
|
2296
|
+
tone: "danger"
|
|
2297
|
+
})))
|
|
2298
|
+
try {
|
|
2299
|
+
await l.remove(z.id), D.success(r("deleted")), w.value = J.value, s.push(h.value);
|
|
2300
|
+
} catch (_) {
|
|
2301
|
+
D.danger(u(_));
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
function te(z) {
|
|
2305
|
+
S.value && z.preventDefault();
|
|
2306
|
+
}
|
|
2307
|
+
function ke(z) {
|
|
2308
|
+
(z.ctrlKey || z.metaKey) && z.key.toLowerCase() === "s" && (z.preventDefault(), S.value && le());
|
|
2309
|
+
}
|
|
2310
|
+
ee(c, () => {
|
|
2311
|
+
K();
|
|
2312
|
+
}), Le(() => {
|
|
2313
|
+
K(), window.addEventListener("beforeunload", te);
|
|
2314
|
+
}), Qe(() => {
|
|
2315
|
+
window.removeEventListener("beforeunload", te);
|
|
2316
|
+
}), Tt(async () => !S.value || !M.value ? !0 : await he({
|
|
2317
|
+
title: r("leave-title"),
|
|
2318
|
+
message: r("leave-text"),
|
|
2319
|
+
confirmText: r("leave"),
|
|
2320
|
+
cancelText: r("cancel"),
|
|
2321
|
+
tone: "danger"
|
|
2322
|
+
}));
|
|
2323
|
+
const _e = x(() => {
|
|
2324
|
+
const z = m.value, q = [];
|
|
2325
|
+
return z && (z.url && z.is_visible && q.push({ key: "site", label: r("open-on-site"), icon: "link", href: z.url }), M.value && q.push({
|
|
2326
|
+
key: "delete",
|
|
2327
|
+
label: r("delete"),
|
|
2328
|
+
icon: "trash",
|
|
2329
|
+
danger: !0,
|
|
2330
|
+
menu: !0,
|
|
2331
|
+
run: () => {
|
|
2332
|
+
ie();
|
|
2333
|
+
}
|
|
2334
|
+
})), q;
|
|
2335
|
+
});
|
|
2336
|
+
return (z, q) => (p(), T("div", {
|
|
2337
|
+
class: "wx-category-editor",
|
|
2338
|
+
onKeydown: ke
|
|
2339
|
+
}, [
|
|
2340
|
+
f.value || !m.value ? (p(), T(H, { key: 0 }, [
|
|
2341
|
+
b(n(re), {
|
|
2342
|
+
class: "wx-category-editor__ghost",
|
|
2343
|
+
title: "",
|
|
2344
|
+
rows: 1
|
|
2345
|
+
}),
|
|
2346
|
+
b(n(Se), null, {
|
|
2347
|
+
default: g(() => [
|
|
2348
|
+
b(n(re), { rows: 6 })
|
|
2349
|
+
]),
|
|
2350
|
+
_: 1
|
|
2351
|
+
})
|
|
2352
|
+
], 64)) : (p(), T(H, { key: 1 }, [
|
|
2353
|
+
b(st, {
|
|
2354
|
+
divider: "",
|
|
2355
|
+
back: h.value,
|
|
2356
|
+
"back-label": C.value,
|
|
2357
|
+
title: A.value,
|
|
2358
|
+
subtitle: m.value.path === null ? void 0 : `/${m.value.path}`,
|
|
2359
|
+
actions: _e.value
|
|
2360
|
+
}, Ae({
|
|
2361
|
+
trail: g(() => [
|
|
2362
|
+
b(n(jt), {
|
|
2363
|
+
size: "sm",
|
|
2364
|
+
label: n(r)("trail")
|
|
2365
|
+
}, {
|
|
2366
|
+
default: g(() => [
|
|
2367
|
+
b(n(Pe), {
|
|
2368
|
+
as: "router-link",
|
|
2369
|
+
to: h.value
|
|
2370
|
+
}, {
|
|
2371
|
+
default: g(() => [
|
|
2372
|
+
V(L(C.value), 1)
|
|
2373
|
+
]),
|
|
2374
|
+
_: 1
|
|
2375
|
+
}, 8, ["to"]),
|
|
2376
|
+
b(n(Pe), { current: "" }, {
|
|
2377
|
+
default: g(() => [
|
|
2378
|
+
V(L(A.value), 1)
|
|
2379
|
+
]),
|
|
2380
|
+
_: 1
|
|
2381
|
+
})
|
|
2382
|
+
]),
|
|
2383
|
+
_: 1
|
|
2384
|
+
}, 8, ["label"])
|
|
2385
|
+
]),
|
|
2386
|
+
_: 2
|
|
2387
|
+
}, [
|
|
2388
|
+
m.value.is_visible ? void 0 : {
|
|
2389
|
+
name: "title-after",
|
|
2390
|
+
fn: g(() => [
|
|
2391
|
+
b(n(ze), { dot: "" }, {
|
|
2392
|
+
default: g(() => [
|
|
2393
|
+
V(L(n(r)("hidden")), 1)
|
|
2394
|
+
]),
|
|
2395
|
+
_: 1
|
|
2396
|
+
})
|
|
2397
|
+
]),
|
|
2398
|
+
key: "0"
|
|
2399
|
+
}
|
|
2400
|
+
]), 1032, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
2401
|
+
b(Cn, {
|
|
2402
|
+
modelValue: v.value,
|
|
2403
|
+
"onUpdate:modelValue": q[0] || (q[0] = (_) => v.value = _),
|
|
2404
|
+
name: t.options.screen,
|
|
2405
|
+
errors: k.value,
|
|
2406
|
+
disabled: !M.value || y.value
|
|
2407
|
+
}, null, 8, ["modelValue", "name", "errors", "disabled"]),
|
|
2408
|
+
M.value ? (p(), $(n(Kt), { key: 0 }, {
|
|
2409
|
+
state: g(() => [
|
|
2410
|
+
b(Tn, { state: B.value }, null, 8, ["state"])
|
|
2411
|
+
]),
|
|
2412
|
+
default: g(() => [
|
|
2413
|
+
b(n(Z), {
|
|
2414
|
+
type: "primary",
|
|
2415
|
+
loading: y.value,
|
|
2416
|
+
disabled: !S.value,
|
|
2417
|
+
onClick: le
|
|
2418
|
+
}, {
|
|
2419
|
+
default: g(() => [
|
|
2420
|
+
V(L(n(r)("save")), 1)
|
|
2421
|
+
]),
|
|
2422
|
+
_: 1
|
|
2423
|
+
}, 8, ["loading", "disabled"])
|
|
2424
|
+
]),
|
|
2425
|
+
_: 1
|
|
2426
|
+
})) : U("", !0)
|
|
2427
|
+
], 64))
|
|
2428
|
+
], 32));
|
|
1752
2429
|
}
|
|
1753
|
-
}),
|
|
2430
|
+
}), Ln = /* @__PURE__ */ Y(Wn, [["__scopeId", "data-v-86d85f8c"]]);
|
|
2431
|
+
function el(e) {
|
|
2432
|
+
return [
|
|
2433
|
+
{ path: e.path, name: e.name, component: kn, props: { options: e } },
|
|
2434
|
+
{
|
|
2435
|
+
path: `${e.path}/:id(\\d+)`,
|
|
2436
|
+
name: `${e.name}.edit`,
|
|
2437
|
+
component: Ln,
|
|
2438
|
+
props: { options: e }
|
|
2439
|
+
}
|
|
2440
|
+
];
|
|
2441
|
+
}
|
|
2442
|
+
const tl = 76, al = /* @__PURE__ */ N({
|
|
1754
2443
|
__name: "FilterChips",
|
|
1755
2444
|
props: {
|
|
1756
2445
|
filters: {}
|
|
1757
2446
|
},
|
|
1758
2447
|
setup(e) {
|
|
1759
|
-
return (t,
|
|
1760
|
-
key:
|
|
2448
|
+
return (t, a) => (p(!0), T(H, null, Q(e.filters, (l) => (p(), $(n(ze), {
|
|
2449
|
+
key: l.key,
|
|
1761
2450
|
class: "wx-filter-chip",
|
|
1762
2451
|
size: "sm",
|
|
1763
2452
|
round: "",
|
|
1764
2453
|
closable: "",
|
|
1765
|
-
onClose: (i) =>
|
|
2454
|
+
onClose: (i) => l.clear()
|
|
1766
2455
|
}, {
|
|
1767
2456
|
default: g(() => [
|
|
1768
|
-
|
|
2457
|
+
V(L(l.label), 1)
|
|
1769
2458
|
]),
|
|
1770
2459
|
_: 2
|
|
1771
2460
|
}, 1032, ["onClose"]))), 128));
|
|
1772
2461
|
}
|
|
1773
|
-
}),
|
|
2462
|
+
}), An = { class: "wx-rename__footer" }, zn = /* @__PURE__ */ N({
|
|
1774
2463
|
__name: "RenameButton",
|
|
1775
2464
|
props: {
|
|
1776
2465
|
name: { default: "" },
|
|
@@ -1781,21 +2470,21 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1781
2470
|
},
|
|
1782
2471
|
emits: ["rename"],
|
|
1783
2472
|
setup(e, { emit: t }) {
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1786
|
-
|
|
2473
|
+
const a = e, l = t, i = P("webx-admin"), s = W(!1), o = W(a.name), r = W(null), u = x(() => a.label ?? i("editor.rename"));
|
|
2474
|
+
ee(s, async (h) => {
|
|
2475
|
+
h && (o.value = a.name, await Ge(), r.value?.focus(), r.value?.select());
|
|
1787
2476
|
});
|
|
1788
|
-
function
|
|
1789
|
-
const
|
|
1790
|
-
if (
|
|
2477
|
+
function c() {
|
|
2478
|
+
const h = o.value.trim();
|
|
2479
|
+
if (h === "" || h === a.name) {
|
|
1791
2480
|
s.value = !1;
|
|
1792
2481
|
return;
|
|
1793
2482
|
}
|
|
1794
|
-
|
|
2483
|
+
l("rename", h), s.value = !1;
|
|
1795
2484
|
}
|
|
1796
|
-
return (
|
|
2485
|
+
return (h, m) => (p(), $(n(qt), {
|
|
1797
2486
|
open: s.value,
|
|
1798
|
-
"onUpdate:open": m[2] || (m[2] = (
|
|
2487
|
+
"onUpdate:open": m[2] || (m[2] = (v) => s.value = v),
|
|
1799
2488
|
title: u.value,
|
|
1800
2489
|
width: 320,
|
|
1801
2490
|
side: "bottom",
|
|
@@ -1803,7 +2492,7 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1803
2492
|
teleport: ""
|
|
1804
2493
|
}, {
|
|
1805
2494
|
trigger: g(() => [
|
|
1806
|
-
|
|
2495
|
+
b(n(se), {
|
|
1807
2496
|
type: "edit",
|
|
1808
2497
|
title: u.value,
|
|
1809
2498
|
size: e.size,
|
|
@@ -1811,27 +2500,27 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1811
2500
|
}, null, 8, ["title", "size", "disabled"])
|
|
1812
2501
|
]),
|
|
1813
2502
|
default: g(() => [
|
|
1814
|
-
|
|
2503
|
+
O("form", {
|
|
1815
2504
|
class: "wx-rename",
|
|
1816
|
-
onSubmit:
|
|
2505
|
+
onSubmit: Ke(c, ["prevent"])
|
|
1817
2506
|
}, [
|
|
1818
|
-
|
|
2507
|
+
b(n(ye), {
|
|
1819
2508
|
ref_key: "field",
|
|
1820
2509
|
ref: r,
|
|
1821
|
-
modelValue:
|
|
1822
|
-
"onUpdate:modelValue": m[0] || (m[0] = (
|
|
2510
|
+
modelValue: o.value,
|
|
2511
|
+
"onUpdate:modelValue": m[0] || (m[0] = (v) => o.value = v),
|
|
1823
2512
|
"aria-label": u.value,
|
|
1824
2513
|
placeholder: e.placeholder,
|
|
1825
|
-
onKeydown: m[1] || (m[1] =
|
|
2514
|
+
onKeydown: m[1] || (m[1] = Je((v) => s.value = !1, ["esc"]))
|
|
1826
2515
|
}, null, 8, ["modelValue", "aria-label", "placeholder"]),
|
|
1827
|
-
|
|
1828
|
-
|
|
2516
|
+
O("div", An, [
|
|
2517
|
+
b(n(Z), {
|
|
1829
2518
|
type: "primary",
|
|
1830
2519
|
size: "sm",
|
|
1831
2520
|
"native-type": "submit"
|
|
1832
2521
|
}, {
|
|
1833
2522
|
default: g(() => [
|
|
1834
|
-
|
|
2523
|
+
V(L(n(i)("editor.save")), 1)
|
|
1835
2524
|
]),
|
|
1836
2525
|
_: 1
|
|
1837
2526
|
})
|
|
@@ -1841,7 +2530,7 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1841
2530
|
_: 1
|
|
1842
2531
|
}, 8, ["open", "title"]));
|
|
1843
2532
|
}
|
|
1844
|
-
}),
|
|
2533
|
+
}), nl = /* @__PURE__ */ Y(zn, [["__scopeId", "data-v-d879e8d3"]]), Vn = ["innerHTML"], En = /* @__PURE__ */ N({
|
|
1845
2534
|
__name: "HelpButton",
|
|
1846
2535
|
props: {
|
|
1847
2536
|
body: {},
|
|
@@ -1851,33 +2540,33 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1851
2540
|
width: { default: 720 }
|
|
1852
2541
|
},
|
|
1853
2542
|
setup(e) {
|
|
1854
|
-
const t = e,
|
|
1855
|
-
return (
|
|
1856
|
-
|
|
2543
|
+
const t = e, a = P("webx-admin"), l = W(!1), i = x(() => t.title ?? a("help.title")), s = x(() => cn(t.body));
|
|
2544
|
+
return (o, r) => (p(), T(H, null, [
|
|
2545
|
+
b(n(se), {
|
|
1857
2546
|
type: "details",
|
|
1858
2547
|
icon: "question",
|
|
1859
2548
|
tone: "neutral",
|
|
1860
2549
|
size: e.size,
|
|
1861
2550
|
title: e.label ?? i.value,
|
|
1862
|
-
onClick: r[0] || (r[0] = (u) =>
|
|
2551
|
+
onClick: r[0] || (r[0] = (u) => l.value = !0)
|
|
1863
2552
|
}, null, 8, ["size", "title"]),
|
|
1864
|
-
|
|
1865
|
-
open:
|
|
1866
|
-
"onUpdate:open": r[1] || (r[1] = (u) =>
|
|
2553
|
+
b(n(nt), {
|
|
2554
|
+
open: l.value,
|
|
2555
|
+
"onUpdate:open": r[1] || (r[1] = (u) => l.value = u),
|
|
1867
2556
|
title: i.value,
|
|
1868
2557
|
width: e.width
|
|
1869
2558
|
}, {
|
|
1870
2559
|
default: g(() => [
|
|
1871
|
-
|
|
2560
|
+
O("div", {
|
|
1872
2561
|
class: "wx-help",
|
|
1873
2562
|
innerHTML: s.value
|
|
1874
|
-
}, null, 8,
|
|
2563
|
+
}, null, 8, Vn)
|
|
1875
2564
|
]),
|
|
1876
2565
|
_: 1
|
|
1877
2566
|
}, 8, ["open", "title", "width"])
|
|
1878
2567
|
], 64));
|
|
1879
2568
|
}
|
|
1880
|
-
}),
|
|
2569
|
+
}), ll = /* @__PURE__ */ Y(En, [["__scopeId", "data-v-6c280d42"]]), pt = /* @__PURE__ */ N({
|
|
1881
2570
|
name: "WxDate",
|
|
1882
2571
|
__name: "DateText",
|
|
1883
2572
|
props: {
|
|
@@ -1887,46 +2576,46 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1887
2576
|
tone: { default: "muted" }
|
|
1888
2577
|
},
|
|
1889
2578
|
setup(e) {
|
|
1890
|
-
const t = e,
|
|
1891
|
-
return (
|
|
2579
|
+
const t = e, a = vt(), l = x(() => t.compact ? a.compact(t.value) : a.short(t.value)), i = x(() => a.exact(t.value)), s = x(() => a.iso(t.value));
|
|
2580
|
+
return (o, r) => i.value ? (p(), $(n(ot), {
|
|
1892
2581
|
key: 0,
|
|
1893
2582
|
content: i.value
|
|
1894
2583
|
}, {
|
|
1895
2584
|
default: g(() => [
|
|
1896
|
-
|
|
2585
|
+
b(n(G), {
|
|
1897
2586
|
as: "time",
|
|
1898
2587
|
datetime: s.value,
|
|
1899
2588
|
size: e.size,
|
|
1900
2589
|
tone: e.tone
|
|
1901
2590
|
}, {
|
|
1902
2591
|
default: g(() => [
|
|
1903
|
-
|
|
2592
|
+
V(L(l.value), 1)
|
|
1904
2593
|
]),
|
|
1905
2594
|
_: 1
|
|
1906
2595
|
}, 8, ["datetime", "size", "tone"])
|
|
1907
2596
|
]),
|
|
1908
2597
|
_: 1
|
|
1909
|
-
}, 8, ["content"])) : (
|
|
2598
|
+
}, 8, ["content"])) : (p(), $(n(G), {
|
|
1910
2599
|
key: 1,
|
|
1911
2600
|
size: e.size,
|
|
1912
2601
|
tone: e.tone
|
|
1913
2602
|
}, {
|
|
1914
2603
|
default: g(() => [
|
|
1915
|
-
|
|
2604
|
+
V(L(l.value), 1)
|
|
1916
2605
|
]),
|
|
1917
2606
|
_: 1
|
|
1918
2607
|
}, 8, ["size", "tone"]));
|
|
1919
2608
|
}
|
|
1920
|
-
}),
|
|
2609
|
+
}), Un = { class: "wx-notes" }, Rn = {
|
|
1921
2610
|
key: 3,
|
|
1922
2611
|
class: "wx-notes__list"
|
|
1923
|
-
},
|
|
2612
|
+
}, Nn = { class: "wx-note__body" }, Bn = { class: "wx-note__head" }, In = { class: "wx-note__buttons" }, Pn = {
|
|
1924
2613
|
key: 1,
|
|
1925
2614
|
class: "wx-note__text"
|
|
1926
|
-
},
|
|
2615
|
+
}, Dn = {
|
|
1927
2616
|
key: 4,
|
|
1928
2617
|
class: "wx-notes__new"
|
|
1929
|
-
},
|
|
2618
|
+
}, Mn = /* @__PURE__ */ N({
|
|
1930
2619
|
name: "WxNotes",
|
|
1931
2620
|
__name: "NotesFeed",
|
|
1932
2621
|
props: {
|
|
@@ -1937,52 +2626,52 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1937
2626
|
},
|
|
1938
2627
|
emits: ["change"],
|
|
1939
2628
|
setup(e, { emit: t }) {
|
|
1940
|
-
const
|
|
1941
|
-
async function
|
|
2629
|
+
const a = e, l = t, i = X(), s = P("webx-admin"), o = Re(), r = W([]), u = W(!0), c = W(""), h = W(!1), m = W(null), v = W(""), d = x(() => gn(i, a.type, a.id)), w = x(() => a.title ?? s("notes.title"));
|
|
2630
|
+
async function f() {
|
|
1942
2631
|
u.value = !0;
|
|
1943
2632
|
try {
|
|
1944
|
-
r.value = await
|
|
1945
|
-
} catch (
|
|
1946
|
-
|
|
2633
|
+
r.value = await d.value.list();
|
|
2634
|
+
} catch (C) {
|
|
2635
|
+
D.danger(o(C));
|
|
1947
2636
|
} finally {
|
|
1948
2637
|
u.value = !1;
|
|
1949
2638
|
}
|
|
1950
2639
|
}
|
|
1951
|
-
|
|
1952
|
-
() => [
|
|
2640
|
+
ee(
|
|
2641
|
+
() => [a.type, a.id],
|
|
1953
2642
|
() => {
|
|
1954
|
-
m.value = null,
|
|
2643
|
+
m.value = null, c.value = "", f();
|
|
1955
2644
|
},
|
|
1956
2645
|
{ immediate: !0 }
|
|
1957
2646
|
);
|
|
1958
|
-
async function
|
|
1959
|
-
const
|
|
1960
|
-
if (!(
|
|
1961
|
-
|
|
2647
|
+
async function y() {
|
|
2648
|
+
const C = c.value.trim();
|
|
2649
|
+
if (!(C === "" || h.value)) {
|
|
2650
|
+
h.value = !0;
|
|
1962
2651
|
try {
|
|
1963
|
-
r.value = [...r.value, await
|
|
1964
|
-
} catch (
|
|
1965
|
-
|
|
2652
|
+
r.value = [...r.value, await d.value.add(C)], c.value = "", l("change");
|
|
2653
|
+
} catch (A) {
|
|
2654
|
+
D.danger(o(A));
|
|
1966
2655
|
} finally {
|
|
1967
|
-
|
|
2656
|
+
h.value = !1;
|
|
1968
2657
|
}
|
|
1969
2658
|
}
|
|
1970
2659
|
}
|
|
1971
|
-
function
|
|
1972
|
-
m.value =
|
|
2660
|
+
function k(C) {
|
|
2661
|
+
m.value = C.id, v.value = C.body;
|
|
1973
2662
|
}
|
|
1974
|
-
async function
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
2663
|
+
async function M(C) {
|
|
2664
|
+
const A = v.value.trim();
|
|
2665
|
+
if (A !== "")
|
|
1977
2666
|
try {
|
|
1978
|
-
const
|
|
1979
|
-
r.value = r.value.map((
|
|
1980
|
-
} catch (
|
|
1981
|
-
|
|
2667
|
+
const E = await d.value.save(C.id, A);
|
|
2668
|
+
r.value = r.value.map((K) => K.id === E.id ? E : K), m.value = null, D.success(s("notes.saved")), l("change");
|
|
2669
|
+
} catch (E) {
|
|
2670
|
+
D.danger(o(E));
|
|
1982
2671
|
}
|
|
1983
2672
|
}
|
|
1984
|
-
async function
|
|
1985
|
-
if (await
|
|
2673
|
+
async function J(C) {
|
|
2674
|
+
if (await he({
|
|
1986
2675
|
title: s("notes.delete-title"),
|
|
1987
2676
|
message: s("notes.delete-text"),
|
|
1988
2677
|
confirmText: s("notes.delete"),
|
|
@@ -1990,235 +2679,251 @@ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
|
|
|
1990
2679
|
tone: "danger"
|
|
1991
2680
|
}))
|
|
1992
2681
|
try {
|
|
1993
|
-
await
|
|
1994
|
-
} catch (
|
|
1995
|
-
|
|
2682
|
+
await d.value.remove(C.id), r.value = r.value.filter((E) => E.id !== C.id), D.success(s("notes.deleted")), l("change");
|
|
2683
|
+
} catch (E) {
|
|
2684
|
+
D.danger(o(E));
|
|
1996
2685
|
}
|
|
1997
2686
|
}
|
|
1998
|
-
function
|
|
1999
|
-
return !
|
|
2000
|
-
{ key: "edit", icon: "edit", label: s("notes.edit"), run: () =>
|
|
2687
|
+
function S(C) {
|
|
2688
|
+
return !a.can || !C.is_mine ? [] : [
|
|
2689
|
+
{ key: "edit", icon: "edit", label: s("notes.edit"), run: () => k(C) },
|
|
2001
2690
|
{
|
|
2002
2691
|
key: "delete",
|
|
2003
2692
|
icon: "trash",
|
|
2004
2693
|
label: s("notes.delete"),
|
|
2005
2694
|
danger: !0,
|
|
2006
2695
|
run: () => {
|
|
2007
|
-
|
|
2696
|
+
J(C);
|
|
2008
2697
|
}
|
|
2009
2698
|
}
|
|
2010
2699
|
];
|
|
2011
2700
|
}
|
|
2012
|
-
function
|
|
2013
|
-
return
|
|
2701
|
+
function B(C) {
|
|
2702
|
+
return C.author?.name ?? s("notes.unknown-author");
|
|
2014
2703
|
}
|
|
2015
|
-
return (
|
|
2016
|
-
|
|
2704
|
+
return (C, A) => (p(), T("section", Un, [
|
|
2705
|
+
w.value ? (p(), $(n(G), {
|
|
2017
2706
|
key: 0,
|
|
2018
2707
|
weight: "medium",
|
|
2019
2708
|
class: "wx-notes__title"
|
|
2020
2709
|
}, {
|
|
2021
2710
|
default: g(() => [
|
|
2022
|
-
|
|
2711
|
+
V(L(w.value), 1)
|
|
2023
2712
|
]),
|
|
2024
2713
|
_: 1
|
|
2025
|
-
})) :
|
|
2026
|
-
u.value ? (
|
|
2714
|
+
})) : U("", !0),
|
|
2715
|
+
u.value ? (p(), $(n(re), {
|
|
2027
2716
|
key: 1,
|
|
2028
2717
|
rows: 2
|
|
2029
|
-
})) : r.value.length === 0 ? (
|
|
2718
|
+
})) : r.value.length === 0 ? (p(), $(n(lt), {
|
|
2030
2719
|
key: 2,
|
|
2031
2720
|
size: "sm",
|
|
2032
|
-
description:
|
|
2033
|
-
}, null, 8, ["description"])) : (
|
|
2034
|
-
(
|
|
2035
|
-
key:
|
|
2721
|
+
description: n(s)("notes.empty")
|
|
2722
|
+
}, null, 8, ["description"])) : (p(), T("ul", Rn, [
|
|
2723
|
+
(p(!0), T(H, null, Q(r.value, (E) => (p(), T("li", {
|
|
2724
|
+
key: E.id,
|
|
2036
2725
|
class: "wx-note"
|
|
2037
2726
|
}, [
|
|
2038
|
-
|
|
2039
|
-
name:
|
|
2727
|
+
b(n(Yt), {
|
|
2728
|
+
name: B(E),
|
|
2040
2729
|
size: "sm",
|
|
2041
2730
|
tone: "auto"
|
|
2042
2731
|
}, null, 8, ["name"]),
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2732
|
+
O("div", Nn, [
|
|
2733
|
+
O("div", Bn, [
|
|
2734
|
+
b(n(G), {
|
|
2046
2735
|
size: "sm",
|
|
2047
2736
|
weight: "medium",
|
|
2048
2737
|
truncate: ""
|
|
2049
2738
|
}, {
|
|
2050
2739
|
default: g(() => [
|
|
2051
|
-
|
|
2740
|
+
V(L(B(E)), 1)
|
|
2052
2741
|
]),
|
|
2053
2742
|
_: 2
|
|
2054
2743
|
}, 1024),
|
|
2055
|
-
|
|
2056
|
-
value:
|
|
2744
|
+
b(pt, {
|
|
2745
|
+
value: E.created_at
|
|
2057
2746
|
}, null, 8, ["value"]),
|
|
2058
|
-
|
|
2059
|
-
actions:
|
|
2060
|
-
label:
|
|
2747
|
+
b(Ue, {
|
|
2748
|
+
actions: S(E),
|
|
2749
|
+
label: B(E)
|
|
2061
2750
|
}, null, 8, ["actions", "label"])
|
|
2062
2751
|
]),
|
|
2063
|
-
m.value ===
|
|
2064
|
-
|
|
2065
|
-
modelValue:
|
|
2066
|
-
"onUpdate:modelValue":
|
|
2752
|
+
m.value === E.id ? (p(), T(H, { key: 0 }, [
|
|
2753
|
+
b(n(De), {
|
|
2754
|
+
modelValue: v.value,
|
|
2755
|
+
"onUpdate:modelValue": A[0] || (A[0] = (K) => v.value = K),
|
|
2067
2756
|
autosize: { minRows: 2, maxRows: 10 }
|
|
2068
2757
|
}, null, 8, ["modelValue"]),
|
|
2069
|
-
|
|
2070
|
-
|
|
2758
|
+
O("div", In, [
|
|
2759
|
+
b(n(Z), {
|
|
2071
2760
|
size: "sm",
|
|
2072
2761
|
type: "primary",
|
|
2073
|
-
onClick: (
|
|
2762
|
+
onClick: (K) => M(E)
|
|
2074
2763
|
}, {
|
|
2075
2764
|
default: g(() => [
|
|
2076
|
-
|
|
2765
|
+
V(L(n(s)("notes.save")), 1)
|
|
2077
2766
|
]),
|
|
2078
2767
|
_: 1
|
|
2079
2768
|
}, 8, ["onClick"]),
|
|
2080
|
-
|
|
2769
|
+
b(n(Z), {
|
|
2081
2770
|
size: "sm",
|
|
2082
2771
|
variant: "text",
|
|
2083
|
-
onClick:
|
|
2772
|
+
onClick: A[1] || (A[1] = (K) => m.value = null)
|
|
2084
2773
|
}, {
|
|
2085
2774
|
default: g(() => [
|
|
2086
|
-
|
|
2775
|
+
V(L(n(s)("notes.cancel")), 1)
|
|
2087
2776
|
]),
|
|
2088
2777
|
_: 1
|
|
2089
2778
|
})
|
|
2090
2779
|
])
|
|
2091
|
-
], 64)) : (
|
|
2780
|
+
], 64)) : (p(), T("p", Pn, L(E.body), 1))
|
|
2092
2781
|
])
|
|
2093
2782
|
]))), 128))
|
|
2094
2783
|
])),
|
|
2095
|
-
e.can ? (
|
|
2096
|
-
|
|
2097
|
-
modelValue:
|
|
2098
|
-
"onUpdate:modelValue":
|
|
2099
|
-
placeholder:
|
|
2784
|
+
e.can ? (p(), T("div", Dn, [
|
|
2785
|
+
b(n(De), {
|
|
2786
|
+
modelValue: c.value,
|
|
2787
|
+
"onUpdate:modelValue": A[2] || (A[2] = (E) => c.value = E),
|
|
2788
|
+
placeholder: n(s)("notes.placeholder"),
|
|
2100
2789
|
autosize: { minRows: 2, maxRows: 8 }
|
|
2101
2790
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
2102
|
-
|
|
2791
|
+
b(n(Z), {
|
|
2103
2792
|
size: "sm",
|
|
2104
2793
|
type: "primary",
|
|
2105
|
-
disabled:
|
|
2106
|
-
loading:
|
|
2107
|
-
onClick:
|
|
2794
|
+
disabled: c.value.trim() === "",
|
|
2795
|
+
loading: h.value,
|
|
2796
|
+
onClick: y
|
|
2108
2797
|
}, {
|
|
2109
2798
|
default: g(() => [
|
|
2110
|
-
|
|
2799
|
+
V(L(n(s)("notes.add")), 1)
|
|
2111
2800
|
]),
|
|
2112
2801
|
_: 1
|
|
2113
2802
|
}, 8, ["disabled", "loading"])
|
|
2114
|
-
])) :
|
|
2803
|
+
])) : U("", !0)
|
|
2115
2804
|
]));
|
|
2116
2805
|
}
|
|
2117
|
-
}),
|
|
2806
|
+
}), ol = /* @__PURE__ */ Y(Mn, [["__scopeId", "data-v-71004c1a"]]), Fn = {
|
|
2118
2807
|
key: 1,
|
|
2119
2808
|
class: "wx-backup-note"
|
|
2120
|
-
},
|
|
2809
|
+
}, On = 48, Hn = /* @__PURE__ */ N({
|
|
2121
2810
|
name: "WxBackupNote",
|
|
2122
2811
|
__name: "BackupNote",
|
|
2123
2812
|
setup(e) {
|
|
2124
|
-
const t =
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2127
|
-
const
|
|
2128
|
-
return Number.isNaN(
|
|
2813
|
+
const t = X(), a = vt(), l = P("webx-admin"), i = x(() => t.state.manifest?.backup ?? null), s = x(() => i.value !== null && t.can("settings.view")), o = x(() => {
|
|
2814
|
+
const c = i.value?.at;
|
|
2815
|
+
if (c == null) return !0;
|
|
2816
|
+
const h = new Date(c).getTime();
|
|
2817
|
+
return Number.isNaN(h) || Date.now() - h > On * 36e5;
|
|
2129
2818
|
}), r = x(() => {
|
|
2130
|
-
const
|
|
2131
|
-
if (
|
|
2132
|
-
const
|
|
2133
|
-
let m =
|
|
2134
|
-
for (; m >= 1024 &&
|
|
2135
|
-
m /= 1024,
|
|
2819
|
+
const c = i.value?.bytes;
|
|
2820
|
+
if (c == null) return "";
|
|
2821
|
+
const h = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte"];
|
|
2822
|
+
let m = c, v = 0;
|
|
2823
|
+
for (; m >= 1024 && v < h.length - 1; )
|
|
2824
|
+
m /= 1024, v++;
|
|
2136
2825
|
return new Intl.NumberFormat(t.i18n.state.locale, {
|
|
2137
2826
|
style: "unit",
|
|
2138
|
-
unit: v
|
|
2827
|
+
unit: h[v],
|
|
2139
2828
|
unitDisplay: "short",
|
|
2140
|
-
maximumFractionDigits: m >= 10 ||
|
|
2829
|
+
maximumFractionDigits: m >= 10 || v === 0 ? 0 : 1
|
|
2141
2830
|
}).format(m);
|
|
2142
2831
|
}), u = x(
|
|
2143
|
-
() => i.value?.at == null ?
|
|
2832
|
+
() => i.value?.at == null ? l("backup.never") : l("backup.stale", { date: a.short(i.value.at) })
|
|
2144
2833
|
);
|
|
2145
|
-
return (
|
|
2834
|
+
return (c, h) => s.value && o.value ? (p(), $(n(be), {
|
|
2146
2835
|
key: 0,
|
|
2147
2836
|
type: "warning",
|
|
2148
2837
|
variant: "soft",
|
|
2149
2838
|
description: u.value
|
|
2150
|
-
}, null, 8, ["description"])) : s.value ? (
|
|
2151
|
-
|
|
2839
|
+
}, null, 8, ["description"])) : s.value ? (p(), T("p", Fn, [
|
|
2840
|
+
b(n(G), {
|
|
2152
2841
|
size: "sm",
|
|
2153
2842
|
tone: "muted"
|
|
2154
2843
|
}, {
|
|
2155
2844
|
default: g(() => [
|
|
2156
|
-
|
|
2845
|
+
V(L(n(l)("backup.title")), 1)
|
|
2157
2846
|
]),
|
|
2158
2847
|
_: 1
|
|
2159
2848
|
}),
|
|
2160
|
-
|
|
2849
|
+
b(pt, {
|
|
2161
2850
|
value: i.value?.at
|
|
2162
2851
|
}, null, 8, ["value"]),
|
|
2163
|
-
r.value ? (
|
|
2852
|
+
r.value ? (p(), $(n(G), {
|
|
2164
2853
|
key: 0,
|
|
2165
2854
|
size: "sm",
|
|
2166
2855
|
tone: "muted"
|
|
2167
2856
|
}, {
|
|
2168
2857
|
default: g(() => [
|
|
2169
|
-
|
|
2858
|
+
V("· " + L(r.value), 1)
|
|
2170
2859
|
]),
|
|
2171
2860
|
_: 1
|
|
2172
|
-
})) :
|
|
2173
|
-
])) :
|
|
2861
|
+
})) : U("", !0)
|
|
2862
|
+
])) : U("", !0);
|
|
2174
2863
|
}
|
|
2175
|
-
}),
|
|
2864
|
+
}), sl = /* @__PURE__ */ Y(Hn, [["__scopeId", "data-v-beeee67e"]]);
|
|
2176
2865
|
export {
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2866
|
+
Ia as AdminLanding,
|
|
2867
|
+
Pa as AdminNav,
|
|
2868
|
+
Xa as AdminShell,
|
|
2869
|
+
Ce as HttpError,
|
|
2870
|
+
ya as WxBackButton,
|
|
2871
|
+
sl as WxBackupNote,
|
|
2872
|
+
sa as WxCategoriesField,
|
|
2873
|
+
kn as WxCategoriesPage,
|
|
2874
|
+
wn as WxCategoryCreateDialog,
|
|
2875
|
+
Ln as WxCategoryEditorPage,
|
|
2876
|
+
Me as WxCategorySlug,
|
|
2877
|
+
pt as WxDate,
|
|
2878
|
+
al as WxFilterChips,
|
|
2879
|
+
ll as WxHelpButton,
|
|
2880
|
+
ga as WxLinkField,
|
|
2881
|
+
ha as WxLinkPicker,
|
|
2882
|
+
it as WxListScreen,
|
|
2883
|
+
ol as WxNotes,
|
|
2884
|
+
nl as WxRenameButton,
|
|
2885
|
+
Wa as WxRichTextField,
|
|
2886
|
+
Ue as WxRowMenu,
|
|
2887
|
+
Tn as WxSaveState,
|
|
2888
|
+
Cn as WxScreen,
|
|
2889
|
+
st as WxScreenHead,
|
|
2890
|
+
Me as WxSlugField,
|
|
2891
|
+
ut as adminKey,
|
|
2892
|
+
ct as adminMessages,
|
|
2893
|
+
Ua as adminTypes,
|
|
2894
|
+
el as categoryRoutes,
|
|
2895
|
+
Jn as createAdmin,
|
|
2896
|
+
Ra as createAdminContext,
|
|
2897
|
+
xe as createCategoriesApi,
|
|
2898
|
+
mn as createDates,
|
|
2899
|
+
Ja as createHttp,
|
|
2900
|
+
Ee as createI18n,
|
|
2901
|
+
ra as createLinksApi,
|
|
2902
|
+
gn as createNotesApi,
|
|
2903
|
+
an as createTheme,
|
|
2904
|
+
ia as emptyLink,
|
|
2905
|
+
fn as errorText,
|
|
2906
|
+
we as i18nKey,
|
|
2907
|
+
bn as itemOrderMode,
|
|
2908
|
+
Na as provideAdmin,
|
|
2909
|
+
ea as provideI18n,
|
|
2910
|
+
La as provideRecordAddress,
|
|
2911
|
+
tn as provideTheme,
|
|
2912
|
+
Fe as readCookie,
|
|
2913
|
+
rt as recordAddressKey,
|
|
2914
|
+
cn as renderMarkdown,
|
|
2915
|
+
aa as reorderItems,
|
|
2916
|
+
tl as rowMenuWidth,
|
|
2917
|
+
dt as themeKey,
|
|
2918
|
+
X as useAdmin,
|
|
2919
|
+
Qn as useCategoryEditor,
|
|
2920
|
+
Ne as useCategoryWords,
|
|
2921
|
+
vt as useDates,
|
|
2922
|
+
Re as useErrorText,
|
|
2923
|
+
Zt as useI18n,
|
|
2924
|
+
Zn as useItemOrder,
|
|
2925
|
+
Aa as useRecordAddress,
|
|
2926
|
+
Gn as useTheme,
|
|
2927
|
+
P as useTranslate
|
|
2223
2928
|
};
|
|
2224
2929
|
//# sourceMappingURL=index.js.map
|