@webx-ui/module-admin 0.5.0 → 0.7.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/AdminLanding.d.ts +21 -0
- package/dist/AdminShell.d.ts +9 -3
- package/dist/BackButton.d.ts +25 -0
- package/dist/HelpButton.d.ts +31 -0
- package/dist/NotesFeed.d.ts +30 -0
- package/dist/RenameButton.d.ts +163 -0
- package/dist/admin.d.ts +9 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +960 -481
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +14 -0
- package/dist/notes.d.ts +34 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +9 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { WxHeading as
|
|
4
|
-
import { WxScreenRenderer as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as U, useModel as he, openBlock as f, createElementBlock as b, normalizeClass as le, createBlock as x, unref as d, withCtx as w, createTextVNode as L, toDisplayString as A, createCommentVNode as E, renderSlot as W, Fragment as R, mergeModels as se, inject as G, reactive as oe, computed as S, watch as J, resolveComponent as z, renderList as I, ref as C, createVNode as y, createElementVNode as M, isRef as $e, createApp as Se, h as O, withModifiers as pe, nextTick as Te, withKeys as ze } from "vue";
|
|
2
|
+
import { useRouter as ge, useRoute as Ae, createRouter as Ce, createWebHistory as Le, RouterLink as We } from "vue-router";
|
|
3
|
+
import { WxHeading as Ee, WxTabs as Ue, WxCard as me, WxResult as Re, useResponsiveShell as Me, shellLayoutFor as Ne, WxToaster as Pe, WebxUI as Ve, localesKey as De, WxAlert as Be, WxSkeleton as we, WxActions as Ie, WxDropdownItem as je, WxAction as ue, WxPopover as He, WxInput as Oe, WxButton as X, WxDialog as Fe, WxTooltip as Ke, WxText as Y, WxEmpty as qe, WxAvatar as Xe, WxTextarea as fe, toast as B, confirm as Ye } from "@webx-ui/core";
|
|
4
|
+
import { WxScreenRenderer as Ge } from "@webx-ui/schema";
|
|
5
|
+
const Je = ["data-wx-fill"], Qe = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "wx-list-screen__head"
|
|
8
|
-
},
|
|
8
|
+
}, Ze = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "wx-list-screen__actions"
|
|
11
|
-
},
|
|
11
|
+
}, et = /* @__PURE__ */ U({
|
|
12
12
|
__name: "ListScreen",
|
|
13
|
-
props: /* @__PURE__ */
|
|
13
|
+
props: /* @__PURE__ */ se({
|
|
14
14
|
title: { default: void 0 },
|
|
15
15
|
views: { default: void 0 },
|
|
16
16
|
card: { type: Boolean, default: !0 },
|
|
@@ -23,158 +23,161 @@ const We = ["data-wx-fill"], Me = {
|
|
|
23
23
|
}),
|
|
24
24
|
emits: ["update:view"],
|
|
25
25
|
setup(e) {
|
|
26
|
-
const t =
|
|
27
|
-
return (n,
|
|
28
|
-
class:
|
|
26
|
+
const t = he(e, "view");
|
|
27
|
+
return (n, a) => (f(), b("div", {
|
|
28
|
+
class: le(["wx-list-screen", { "is-fill": e.fill }]),
|
|
29
29
|
"data-wx-fill": e.fill ? "" : void 0
|
|
30
30
|
}, [
|
|
31
|
-
e.title || n.$slots.actions ? (
|
|
32
|
-
e.title ? (
|
|
31
|
+
e.title || n.$slots.actions ? (f(), b("div", Qe, [
|
|
32
|
+
e.title ? (f(), x(d(Ee), {
|
|
33
33
|
key: 0,
|
|
34
34
|
level: 2,
|
|
35
35
|
class: "wx-list-screen__title"
|
|
36
36
|
}, {
|
|
37
|
-
default:
|
|
38
|
-
|
|
37
|
+
default: w(() => [
|
|
38
|
+
L(A(e.title), 1)
|
|
39
39
|
]),
|
|
40
40
|
_: 1
|
|
41
|
-
})) :
|
|
42
|
-
n.$slots.actions ? (
|
|
43
|
-
|
|
44
|
-
])) :
|
|
45
|
-
])) :
|
|
46
|
-
e.views && e.views.length > 0 ? (
|
|
41
|
+
})) : E("", !0),
|
|
42
|
+
n.$slots.actions ? (f(), b("div", Ze, [
|
|
43
|
+
W(n.$slots, "actions", {}, void 0, !0)
|
|
44
|
+
])) : E("", !0)
|
|
45
|
+
])) : E("", !0),
|
|
46
|
+
e.views && e.views.length > 0 ? (f(), x(d(Ue), {
|
|
47
47
|
key: 1,
|
|
48
48
|
modelValue: t.value,
|
|
49
|
-
"onUpdate:modelValue":
|
|
49
|
+
"onUpdate:modelValue": a[0] || (a[0] = (r) => t.value = r),
|
|
50
50
|
class: "wx-list-screen__views",
|
|
51
51
|
items: e.views,
|
|
52
52
|
"collapse-below": e.collapseBelow,
|
|
53
53
|
"aria-label": e.title
|
|
54
54
|
}, {
|
|
55
|
-
default:
|
|
56
|
-
e.card ? (
|
|
55
|
+
default: w(() => [
|
|
56
|
+
e.card ? (f(), x(d(me), {
|
|
57
57
|
key: 0,
|
|
58
58
|
class: "wx-list-screen__card",
|
|
59
59
|
padding: e.padding
|
|
60
60
|
}, {
|
|
61
|
-
default:
|
|
62
|
-
|
|
61
|
+
default: w(() => [
|
|
62
|
+
W(n.$slots, "default", {}, void 0, !0)
|
|
63
63
|
]),
|
|
64
64
|
_: 3
|
|
65
|
-
}, 8, ["padding"])) :
|
|
65
|
+
}, 8, ["padding"])) : W(n.$slots, "default", {}, void 0, !0, 1)
|
|
66
66
|
]),
|
|
67
67
|
_: 3
|
|
68
|
-
}, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (
|
|
69
|
-
e.card ? (
|
|
68
|
+
}, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (f(), b(R, { key: 2 }, [
|
|
69
|
+
e.card ? (f(), x(d(me), {
|
|
70
70
|
key: 0,
|
|
71
71
|
class: "wx-list-screen__card",
|
|
72
72
|
padding: e.padding
|
|
73
73
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
|
|
74
|
+
default: w(() => [
|
|
75
|
+
W(n.$slots, "default", {}, void 0, !0)
|
|
76
76
|
]),
|
|
77
77
|
_: 3
|
|
78
|
-
}, 8, ["padding"])) :
|
|
78
|
+
}, 8, ["padding"])) : W(n.$slots, "default", {}, void 0, !0, 1)
|
|
79
79
|
], 64))
|
|
80
|
-
], 10,
|
|
80
|
+
], 10, Je));
|
|
81
81
|
}
|
|
82
|
-
}),
|
|
82
|
+
}), j = (e, t) => {
|
|
83
83
|
const n = e.__vccOpts || e;
|
|
84
|
-
for (const [
|
|
85
|
-
n[
|
|
84
|
+
for (const [a, r] of t)
|
|
85
|
+
n[a] = r;
|
|
86
86
|
return n;
|
|
87
|
-
},
|
|
88
|
-
"wx-list": { component:
|
|
89
|
-
},
|
|
87
|
+
}, tt = /* @__PURE__ */ j(et, [["__scopeId", "data-v-7586ed04"]]), nt = {
|
|
88
|
+
"wx-list": { component: tt, kind: "layout", labelProp: "title" }
|
|
89
|
+
}, ye = /* @__PURE__ */ Symbol("webx-admin");
|
|
90
90
|
function H() {
|
|
91
|
-
const e =
|
|
91
|
+
const e = G(ye, null);
|
|
92
92
|
if (e === null)
|
|
93
93
|
throw new Error("useAdmin() was called outside a panel created by createAdmin().");
|
|
94
94
|
return e;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const t =
|
|
96
|
+
function at(e) {
|
|
97
|
+
const t = oe({
|
|
98
98
|
status: "loading",
|
|
99
99
|
manifest: null,
|
|
100
100
|
user: null,
|
|
101
101
|
error: null
|
|
102
|
-
}), n =
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
102
|
+
}), n = S(() => {
|
|
103
|
+
const l = t.manifest;
|
|
104
|
+
if (l === null)
|
|
105
105
|
return [];
|
|
106
|
-
const
|
|
107
|
-
for (const h of
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
106
|
+
const v = [];
|
|
107
|
+
for (const h of l.modules) {
|
|
108
|
+
const g = e.modules.find((_) => _.id === h.id);
|
|
109
|
+
if (g === void 0)
|
|
110
110
|
continue;
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
const p = g.path ?? g.routes?.[0]?.path;
|
|
112
|
+
p !== void 0 && v.push({
|
|
113
113
|
id: h.id,
|
|
114
114
|
title: h.title,
|
|
115
115
|
icon: h.icon,
|
|
116
|
-
path:
|
|
116
|
+
path: p,
|
|
117
117
|
group: h.group ?? null
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
return
|
|
121
|
-
}),
|
|
122
|
-
const
|
|
123
|
-
for (const
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
|
|
120
|
+
return v;
|
|
121
|
+
}), a = S(() => {
|
|
122
|
+
const l = t.manifest?.groups ?? [], v = [], h = /* @__PURE__ */ new Map();
|
|
123
|
+
for (const g of n.value)
|
|
124
|
+
if (g.group !== null && l.some((p) => p.id === g.group)) {
|
|
125
|
+
const p = h.get(g.group) ?? [];
|
|
126
|
+
p.push(g), h.set(g.group, p);
|
|
127
127
|
} else
|
|
128
|
-
|
|
128
|
+
v.push(g);
|
|
129
129
|
return {
|
|
130
|
-
top:
|
|
131
|
-
groups:
|
|
132
|
-
id:
|
|
133
|
-
title:
|
|
134
|
-
entries: h.get(
|
|
130
|
+
top: v,
|
|
131
|
+
groups: l.filter((g) => h.has(g.id)).map((g) => ({
|
|
132
|
+
id: g.id,
|
|
133
|
+
title: g.title,
|
|
134
|
+
entries: h.get(g.id) ?? []
|
|
135
135
|
}))
|
|
136
136
|
};
|
|
137
|
-
}),
|
|
138
|
-
for (const
|
|
139
|
-
Object.assign(
|
|
140
|
-
Object.assign(
|
|
141
|
-
const
|
|
142
|
-
async function s(
|
|
143
|
-
const
|
|
144
|
-
let h =
|
|
145
|
-
return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${
|
|
146
|
-
throw
|
|
147
|
-
}),
|
|
148
|
-
}
|
|
149
|
-
let
|
|
137
|
+
}), r = { ...nt };
|
|
138
|
+
for (const l of e.modules)
|
|
139
|
+
Object.assign(r, l.types);
|
|
140
|
+
Object.assign(r, e.types);
|
|
141
|
+
const o = /* @__PURE__ */ new Map();
|
|
142
|
+
async function s(l) {
|
|
143
|
+
const v = `${e.i18n.state.locale}:${l}`;
|
|
144
|
+
let h = o.get(v);
|
|
145
|
+
return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${l}`).then((g) => g.data.root).catch((g) => {
|
|
146
|
+
throw o.delete(v), g;
|
|
147
|
+
}), o.set(v, h)), h;
|
|
148
|
+
}
|
|
149
|
+
let u = null;
|
|
150
150
|
async function i() {
|
|
151
151
|
t.status = "loading", t.error = null;
|
|
152
152
|
try {
|
|
153
|
-
if (
|
|
153
|
+
if (u !== null && (t.user = await u(), t.user === null)) {
|
|
154
154
|
t.manifest = null, t.status = "unauthenticated";
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
t.manifest =
|
|
159
|
-
} catch (
|
|
160
|
-
if (
|
|
157
|
+
const l = await e.loadManifest();
|
|
158
|
+
t.manifest = l, e.i18n.state.contentLocales = l.locales ?? [], e.i18n.state.panelLocales = l.panelLocales ?? e.i18n.state.panelLocales, l.locale !== void 0 && l.locale !== e.i18n.state.locale && await m(l.locale), t.status = "ready";
|
|
159
|
+
} catch (l) {
|
|
160
|
+
if (st(l)) {
|
|
161
161
|
t.manifest = null, t.user = null, t.status = "unauthenticated";
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
t.error =
|
|
164
|
+
t.error = l instanceof Error ? l.message : String(l), t.status = "error";
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
async function
|
|
168
|
-
if (
|
|
169
|
-
e.i18n.state.locale = a;
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (await e.loadDictionary(a), t.manifest !== null)
|
|
167
|
+
async function c() {
|
|
168
|
+
if (t.manifest !== null)
|
|
173
169
|
try {
|
|
174
170
|
t.manifest = await e.loadManifest();
|
|
175
171
|
} catch {
|
|
176
172
|
}
|
|
177
173
|
}
|
|
174
|
+
async function m(l) {
|
|
175
|
+
if (e.loadDictionary === void 0) {
|
|
176
|
+
e.i18n.state.locale = l;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
await e.loadDictionary(l), await c();
|
|
180
|
+
}
|
|
178
181
|
return {
|
|
179
182
|
http: e.http,
|
|
180
183
|
basePath: e.basePath,
|
|
@@ -183,130 +186,154 @@ function Ie(e) {
|
|
|
183
186
|
i18n: e.i18n,
|
|
184
187
|
modules: e.modules,
|
|
185
188
|
nav: n,
|
|
186
|
-
groups:
|
|
187
|
-
types:
|
|
189
|
+
groups: a,
|
|
190
|
+
types: r,
|
|
188
191
|
reload: i,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
refreshManifest: c,
|
|
193
|
+
setLocale: m,
|
|
194
|
+
setUser(l) {
|
|
195
|
+
t.user = l;
|
|
192
196
|
},
|
|
193
|
-
useSessionLoader(
|
|
194
|
-
|
|
197
|
+
useSessionLoader(l) {
|
|
198
|
+
u = l;
|
|
195
199
|
},
|
|
196
|
-
can(
|
|
197
|
-
const
|
|
198
|
-
return
|
|
200
|
+
can(l) {
|
|
201
|
+
const v = t.user;
|
|
202
|
+
return v === null ? !1 : v.isSuper || v.permissions.includes(l);
|
|
199
203
|
},
|
|
200
204
|
loadScreen: s,
|
|
201
|
-
screenPatch(
|
|
202
|
-
return e.screens?.[
|
|
205
|
+
screenPatch(l) {
|
|
206
|
+
return e.screens?.[l] ?? [];
|
|
203
207
|
}
|
|
204
208
|
};
|
|
205
209
|
}
|
|
206
|
-
function
|
|
207
|
-
e.provide(
|
|
210
|
+
function lt(e, t) {
|
|
211
|
+
e.provide(ye, t);
|
|
208
212
|
}
|
|
209
|
-
function
|
|
213
|
+
function st(e) {
|
|
210
214
|
return typeof e == "object" && e !== null && "status" in e && e.status === 401;
|
|
211
215
|
}
|
|
212
|
-
const
|
|
213
|
-
function
|
|
214
|
-
const e =
|
|
216
|
+
const Q = /* @__PURE__ */ Symbol("webx-i18n");
|
|
217
|
+
function on() {
|
|
218
|
+
const e = G(Q, null);
|
|
215
219
|
if (e === null)
|
|
216
220
|
throw new Error("useI18n() was called outside a panel created by createAdmin().");
|
|
217
221
|
return e;
|
|
218
222
|
}
|
|
219
|
-
function
|
|
220
|
-
const t =
|
|
221
|
-
return t === null ?
|
|
223
|
+
function N(e) {
|
|
224
|
+
const t = G(Q, null);
|
|
225
|
+
return t === null ? de().scope(e) : t.scope(e);
|
|
222
226
|
}
|
|
223
|
-
function
|
|
224
|
-
e.provide(
|
|
227
|
+
function ot(e, t) {
|
|
228
|
+
e.provide(Q, t);
|
|
225
229
|
}
|
|
226
|
-
function
|
|
227
|
-
const t = e.fallback ?? "en", n =
|
|
230
|
+
function de(e = {}) {
|
|
231
|
+
const t = e.fallback ?? "en", n = oe({
|
|
228
232
|
locale: e.locale ?? t,
|
|
229
233
|
fallback: t,
|
|
230
234
|
panelLocales: [],
|
|
231
235
|
contentLocales: []
|
|
232
|
-
}),
|
|
233
|
-
function
|
|
234
|
-
let
|
|
235
|
-
for (const
|
|
236
|
-
if (typeof
|
|
236
|
+
}), a = {}, r = oe({ value: {} });
|
|
237
|
+
function o(u, i, c) {
|
|
238
|
+
let m = u[i]?.[c[0] ?? ""];
|
|
239
|
+
for (const l of c.slice(1)) {
|
|
240
|
+
if (typeof m != "object" || m === null)
|
|
237
241
|
return null;
|
|
238
|
-
|
|
242
|
+
m = m[l];
|
|
239
243
|
}
|
|
240
|
-
return typeof
|
|
244
|
+
return typeof m == "string" ? m : null;
|
|
241
245
|
}
|
|
242
|
-
function s(
|
|
243
|
-
const [
|
|
246
|
+
function s(u, i, c) {
|
|
247
|
+
const [m, l] = i.includes("::") ? i.split("::", 2) : [u, i], v = l.split("."), h = o(r.value, m, v) ?? o(a, m, v) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
|
|
244
248
|
// label says nothing to anybody trying to fix it.
|
|
245
249
|
i;
|
|
246
|
-
return
|
|
250
|
+
return c === void 0 ? h : it(h, c);
|
|
247
251
|
}
|
|
248
252
|
return {
|
|
249
253
|
state: n,
|
|
250
|
-
defaults(
|
|
251
|
-
|
|
254
|
+
defaults(u, i) {
|
|
255
|
+
a[u] = { ...a[u], ...i };
|
|
252
256
|
},
|
|
253
|
-
load(
|
|
254
|
-
|
|
257
|
+
load(u, i, c) {
|
|
258
|
+
r.value = u ?? {}, n.locale = i ?? n.locale, c !== void 0 && (n.fallback = c);
|
|
255
259
|
},
|
|
256
|
-
scope(
|
|
257
|
-
return (i,
|
|
260
|
+
scope(u) {
|
|
261
|
+
return (i, c) => s(u, i, c);
|
|
258
262
|
},
|
|
259
|
-
t: (
|
|
263
|
+
t: (u, i) => s("", u, i)
|
|
260
264
|
};
|
|
261
265
|
}
|
|
262
|
-
function
|
|
266
|
+
function it(e, t) {
|
|
263
267
|
let n = e;
|
|
264
|
-
for (const [
|
|
265
|
-
n = n.replaceAll(`:${
|
|
268
|
+
for (const [a, r] of Object.entries(t))
|
|
269
|
+
n = n.replaceAll(`:${a}`, String(r));
|
|
266
270
|
return n;
|
|
267
271
|
}
|
|
268
|
-
const
|
|
272
|
+
const rt = /* @__PURE__ */ U({
|
|
273
|
+
__name: "AdminLanding",
|
|
274
|
+
props: {
|
|
275
|
+
landing: { default: null }
|
|
276
|
+
},
|
|
277
|
+
setup(e) {
|
|
278
|
+
const t = e, n = H(), a = ge(), r = N("webx-admin"), o = S(() => {
|
|
279
|
+
const s = n.nav.value;
|
|
280
|
+
return s.length === 0 ? null : ((t.landing === null ? void 0 : s.find((i) => i.path === t.landing)) ?? s[0])?.path ?? null;
|
|
281
|
+
});
|
|
282
|
+
return J(
|
|
283
|
+
o,
|
|
284
|
+
(s) => {
|
|
285
|
+
s !== null && a.replace(s);
|
|
286
|
+
},
|
|
287
|
+
{ immediate: !0 }
|
|
288
|
+
), (s, u) => o.value === null && d(n).state.status === "ready" ? (f(), x(d(Re), {
|
|
289
|
+
key: 0,
|
|
290
|
+
status: "info",
|
|
291
|
+
title: d(r)("shell.empty-title"),
|
|
292
|
+
description: d(r)("shell.empty-description")
|
|
293
|
+
}, null, 8, ["title", "description"])) : E("", !0);
|
|
294
|
+
}
|
|
295
|
+
}), ut = /* @__PURE__ */ U({
|
|
269
296
|
__name: "AdminNav",
|
|
270
297
|
props: {
|
|
271
298
|
collapsed: { type: Boolean }
|
|
272
299
|
},
|
|
273
300
|
emits: ["select"],
|
|
274
301
|
setup(e, { emit: t }) {
|
|
275
|
-
const n = t,
|
|
276
|
-
get: () =>
|
|
302
|
+
const n = t, a = H(), r = N("webx-admin"), o = ge(), s = Ae(), u = S({
|
|
303
|
+
get: () => a.nav.value.find((c) => s.path.startsWith(c.path))?.id ?? "",
|
|
277
304
|
set: (i) => {
|
|
278
|
-
const
|
|
279
|
-
|
|
305
|
+
const c = a.nav.value.find((m) => m.id === i);
|
|
306
|
+
c !== void 0 && o.push(c.path);
|
|
280
307
|
}
|
|
281
308
|
});
|
|
282
|
-
return (i,
|
|
283
|
-
const
|
|
284
|
-
return
|
|
285
|
-
modelValue:
|
|
286
|
-
"onUpdate:modelValue":
|
|
309
|
+
return (i, c) => {
|
|
310
|
+
const m = z("wx-menu-item"), l = z("wx-submenu"), v = z("wx-menu");
|
|
311
|
+
return f(), x(v, {
|
|
312
|
+
modelValue: u.value,
|
|
313
|
+
"onUpdate:modelValue": c[0] || (c[0] = (h) => u.value = h),
|
|
287
314
|
collapsed: e.collapsed,
|
|
288
|
-
label:
|
|
289
|
-
onSelect:
|
|
315
|
+
label: d(r)("nav.sections"),
|
|
316
|
+
onSelect: c[1] || (c[1] = (h) => n("select"))
|
|
290
317
|
}, {
|
|
291
|
-
default:
|
|
292
|
-
(
|
|
293
|
-
key:
|
|
294
|
-
value:
|
|
295
|
-
icon:
|
|
296
|
-
label:
|
|
318
|
+
default: w(() => [
|
|
319
|
+
(f(!0), b(R, null, I(d(a).groups.value.top, (h) => (f(), x(m, {
|
|
320
|
+
key: h.id,
|
|
321
|
+
value: h.id,
|
|
322
|
+
icon: h.icon ?? void 0,
|
|
323
|
+
label: h.title
|
|
297
324
|
}, null, 8, ["value", "icon", "label"]))), 128)),
|
|
298
|
-
(
|
|
299
|
-
key:
|
|
300
|
-
value: `group:${
|
|
301
|
-
title:
|
|
325
|
+
(f(!0), b(R, null, I(d(a).groups.value.groups, (h) => (f(), x(l, {
|
|
326
|
+
key: h.id,
|
|
327
|
+
value: `group:${h.id}`,
|
|
328
|
+
title: h.title,
|
|
302
329
|
icon: "gear"
|
|
303
330
|
}, {
|
|
304
|
-
default:
|
|
305
|
-
(
|
|
306
|
-
key:
|
|
307
|
-
value:
|
|
308
|
-
icon:
|
|
309
|
-
label:
|
|
331
|
+
default: w(() => [
|
|
332
|
+
(f(!0), b(R, null, I(h.entries, (g) => (f(), x(m, {
|
|
333
|
+
key: g.id,
|
|
334
|
+
value: g.id,
|
|
335
|
+
icon: g.icon ?? void 0,
|
|
336
|
+
label: g.title
|
|
310
337
|
}, null, 8, ["value", "icon", "label"]))), 128))
|
|
311
338
|
]),
|
|
312
339
|
_: 2
|
|
@@ -316,64 +343,64 @@ const Be = /* @__PURE__ */ A({
|
|
|
316
343
|
}, 8, ["modelValue", "collapsed", "label"]);
|
|
317
344
|
};
|
|
318
345
|
}
|
|
319
|
-
}),
|
|
346
|
+
}), dt = {
|
|
320
347
|
key: 0,
|
|
321
348
|
class: "wx-root wx-admin-plain"
|
|
322
|
-
},
|
|
349
|
+
}, ct = {
|
|
323
350
|
key: 1,
|
|
324
351
|
class: "wx-root wx-admin-plain"
|
|
325
|
-
},
|
|
352
|
+
}, mt = {
|
|
326
353
|
key: 2,
|
|
327
354
|
class: "wx-root wx-admin-plain"
|
|
328
|
-
},
|
|
355
|
+
}, ft = ["src", "alt", "width", "height"], vt = ["src", "alt", "width", "height"], ht = ["src", "alt"], pt = { class: "wx-admin__user" }, gt = { class: "wx-admin__user wx-admin__user--drawer" }, wt = /* @__PURE__ */ U({
|
|
329
356
|
__name: "AdminShell",
|
|
330
357
|
setup(e) {
|
|
331
|
-
const t = H(), n =
|
|
332
|
-
|
|
358
|
+
const t = H(), n = N("webx-admin"), a = C(null), { width: r, layout: o, collapsed: s, showAside: u, drawerOpen: i, toggle: c, close: m } = Me(
|
|
359
|
+
a,
|
|
333
360
|
{ persist: "webx-admin-shell" }
|
|
334
|
-
),
|
|
335
|
-
return (
|
|
336
|
-
const
|
|
337
|
-
return
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
])) :
|
|
342
|
-
|
|
343
|
-
label:
|
|
361
|
+
), l = S(() => t.state.manifest?.title ?? ""), v = S(() => t.state.manifest?.branding?.logo ?? null), h = S(() => t.state.manifest?.branding?.mark ?? null), g = S(() => Ne(r.value, null));
|
|
362
|
+
return (p, _) => {
|
|
363
|
+
const V = z("router-view"), Z = z("wx-loading"), ee = z("wx-button"), te = z("wx-result"), D = z("wx-action"), k = z("wx-text"), T = z("wx-header"), $ = z("wx-aside"), P = z("wx-main"), _e = z("wx-container"), ke = z("wx-drawer");
|
|
364
|
+
return f(), b(R, null, [
|
|
365
|
+
y(d(Pe)),
|
|
366
|
+
d(t).state.status === "unauthenticated" ? (f(), b("div", dt, [
|
|
367
|
+
y(V)
|
|
368
|
+
])) : d(t).state.status === "loading" ? (f(), b("div", ct, [
|
|
369
|
+
y(Z, {
|
|
370
|
+
label: d(n)("shell.loading")
|
|
344
371
|
}, null, 8, ["label"])
|
|
345
|
-
])) :
|
|
346
|
-
|
|
372
|
+
])) : d(t).state.status === "error" ? (f(), b("div", mt, [
|
|
373
|
+
y(te, {
|
|
347
374
|
status: "error",
|
|
348
|
-
title:
|
|
349
|
-
description:
|
|
375
|
+
title: d(n)("shell.error-title"),
|
|
376
|
+
description: d(t).state.error
|
|
350
377
|
}, {
|
|
351
|
-
default:
|
|
352
|
-
|
|
378
|
+
default: w(() => [
|
|
379
|
+
y(ee, {
|
|
353
380
|
type: "primary",
|
|
354
|
-
onClick:
|
|
381
|
+
onClick: _[0] || (_[0] = (ce) => d(t).reload())
|
|
355
382
|
}, {
|
|
356
|
-
default:
|
|
357
|
-
|
|
383
|
+
default: w(() => [
|
|
384
|
+
L(A(d(n)("shell.retry")), 1)
|
|
358
385
|
]),
|
|
359
386
|
_: 1
|
|
360
387
|
})
|
|
361
388
|
]),
|
|
362
389
|
_: 1
|
|
363
390
|
}, 8, ["title", "description"])
|
|
364
|
-
])) : (
|
|
391
|
+
])) : (f(), b("div", {
|
|
365
392
|
key: 3,
|
|
366
393
|
ref_key: "shellEl",
|
|
367
|
-
ref:
|
|
368
|
-
class:
|
|
394
|
+
ref: a,
|
|
395
|
+
class: le(["wx-root wx-admin", `wx-admin--${g.value}`])
|
|
369
396
|
}, [
|
|
370
|
-
|
|
371
|
-
direction:
|
|
397
|
+
y(_e, {
|
|
398
|
+
direction: d(o) === "drawer" ? "vertical" : "horizontal",
|
|
372
399
|
"full-height": "",
|
|
373
400
|
class: "wx-admin__frame"
|
|
374
401
|
}, {
|
|
375
|
-
default:
|
|
376
|
-
|
|
402
|
+
default: w(() => [
|
|
403
|
+
d(o) === "drawer" ? (f(), x(T, {
|
|
377
404
|
key: 0,
|
|
378
405
|
class: "wx-admin__header",
|
|
379
406
|
floating: "",
|
|
@@ -382,123 +409,126 @@ const Be = /* @__PURE__ */ A({
|
|
|
382
409
|
padding: "sm",
|
|
383
410
|
height: "var(--wx-admin-header-height)"
|
|
384
411
|
}, {
|
|
385
|
-
end:
|
|
386
|
-
|
|
412
|
+
end: w(() => [
|
|
413
|
+
W(p.$slots, "user", { expanded: !1 }, void 0, !0)
|
|
387
414
|
]),
|
|
388
|
-
default:
|
|
389
|
-
|
|
415
|
+
default: w(() => [
|
|
416
|
+
y(D, {
|
|
390
417
|
icon: "menu",
|
|
391
|
-
title:
|
|
392
|
-
onClick:
|
|
418
|
+
title: d(n)("nav.menu"),
|
|
419
|
+
onClick: d(c)
|
|
393
420
|
}, null, 8, ["title", "onClick"]),
|
|
394
|
-
|
|
395
|
-
|
|
421
|
+
W(p.$slots, "brand", {}, () => [
|
|
422
|
+
v.value ? (f(), b("img", {
|
|
396
423
|
key: 0,
|
|
397
424
|
class: "wx-admin__logo",
|
|
398
|
-
src:
|
|
399
|
-
alt:
|
|
400
|
-
width:
|
|
401
|
-
height:
|
|
402
|
-
}, null, 8,
|
|
425
|
+
src: v.value.url,
|
|
426
|
+
alt: l.value,
|
|
427
|
+
width: v.value.width ?? void 0,
|
|
428
|
+
height: v.value.height ?? void 0
|
|
429
|
+
}, null, 8, ft)) : (f(), x(k, {
|
|
403
430
|
key: 1,
|
|
404
431
|
weight: "semibold",
|
|
405
432
|
truncate: ""
|
|
406
433
|
}, {
|
|
407
|
-
default:
|
|
408
|
-
|
|
434
|
+
default: w(() => [
|
|
435
|
+
L(A(l.value), 1)
|
|
409
436
|
]),
|
|
410
437
|
_: 1
|
|
411
438
|
}))
|
|
412
439
|
], !0)
|
|
413
440
|
]),
|
|
414
441
|
_: 3
|
|
415
|
-
})) :
|
|
416
|
-
|
|
442
|
+
})) : E("", !0),
|
|
443
|
+
d(u) ? (f(), x($, {
|
|
417
444
|
key: 1,
|
|
418
445
|
class: "wx-admin__aside",
|
|
419
446
|
sticky: "",
|
|
420
447
|
floating: "",
|
|
421
448
|
scroll: "",
|
|
422
449
|
bordered: !1,
|
|
423
|
-
collapsed:
|
|
450
|
+
collapsed: d(s),
|
|
424
451
|
width: 220,
|
|
425
452
|
"collapsed-width": 56
|
|
426
453
|
}, {
|
|
427
|
-
top:
|
|
428
|
-
|
|
429
|
-
class:
|
|
454
|
+
top: w(() => [
|
|
455
|
+
M("div", {
|
|
456
|
+
class: le(["wx-admin__brand", { "wx-admin__brand--stacked": d(s) && h.value }])
|
|
430
457
|
}, [
|
|
431
|
-
|
|
458
|
+
d(s) ? h.value ? (f(), b("img", {
|
|
432
459
|
key: 1,
|
|
433
460
|
class: "wx-admin__mark",
|
|
434
|
-
src:
|
|
435
|
-
alt:
|
|
436
|
-
}, null, 8,
|
|
437
|
-
|
|
461
|
+
src: h.value.url,
|
|
462
|
+
alt: l.value
|
|
463
|
+
}, null, 8, ht)) : E("", !0) : W(p.$slots, "brand", {}, () => [
|
|
464
|
+
v.value ? (f(), b("img", {
|
|
438
465
|
key: 0,
|
|
439
466
|
class: "wx-admin__logo",
|
|
440
|
-
src:
|
|
441
|
-
alt:
|
|
442
|
-
width:
|
|
443
|
-
height:
|
|
444
|
-
}, null, 8,
|
|
467
|
+
src: v.value.url,
|
|
468
|
+
alt: l.value,
|
|
469
|
+
width: v.value.width ?? void 0,
|
|
470
|
+
height: v.value.height ?? void 0
|
|
471
|
+
}, null, 8, vt)) : (f(), x(k, {
|
|
445
472
|
key: 1,
|
|
446
473
|
weight: "semibold",
|
|
447
474
|
truncate: "",
|
|
448
475
|
class: "wx-admin__title"
|
|
449
476
|
}, {
|
|
450
|
-
default:
|
|
451
|
-
|
|
477
|
+
default: w(() => [
|
|
478
|
+
L(A(l.value), 1)
|
|
452
479
|
]),
|
|
453
480
|
_: 1
|
|
454
481
|
}))
|
|
455
482
|
], !0, 0),
|
|
456
|
-
|
|
483
|
+
y(D, {
|
|
457
484
|
icon: "sidebar",
|
|
458
|
-
title:
|
|
459
|
-
onClick:
|
|
485
|
+
title: d(s) ? d(n)("nav.expand") : d(n)("nav.collapse"),
|
|
486
|
+
onClick: d(c)
|
|
460
487
|
}, null, 8, ["title", "onClick"])
|
|
461
488
|
], 2)
|
|
462
489
|
]),
|
|
463
|
-
bottom:
|
|
464
|
-
|
|
465
|
-
|
|
490
|
+
bottom: w(() => [
|
|
491
|
+
M("div", pt, [
|
|
492
|
+
W(p.$slots, "user", {
|
|
493
|
+
expanded: !d(s)
|
|
494
|
+
}, void 0, !0)
|
|
466
495
|
])
|
|
467
496
|
]),
|
|
468
|
-
default:
|
|
469
|
-
|
|
497
|
+
default: w(() => [
|
|
498
|
+
W(p.$slots, "nav", { collapsed: d(s) }, void 0, !0)
|
|
470
499
|
]),
|
|
471
500
|
_: 3
|
|
472
|
-
}, 8, ["collapsed"])) :
|
|
473
|
-
|
|
501
|
+
}, 8, ["collapsed"])) : E("", !0),
|
|
502
|
+
y(P, {
|
|
474
503
|
padding: "none",
|
|
475
504
|
class: "wx-admin__screen"
|
|
476
505
|
}, {
|
|
477
|
-
default:
|
|
478
|
-
|
|
506
|
+
default: w(() => [
|
|
507
|
+
y(V)
|
|
479
508
|
]),
|
|
480
509
|
_: 1
|
|
481
510
|
})
|
|
482
511
|
]),
|
|
483
512
|
_: 3
|
|
484
513
|
}, 8, ["direction"]),
|
|
485
|
-
|
|
486
|
-
open:
|
|
487
|
-
"onUpdate:open":
|
|
488
|
-
title:
|
|
514
|
+
y(ke, {
|
|
515
|
+
open: d(i),
|
|
516
|
+
"onUpdate:open": _[1] || (_[1] = (ce) => $e(i) ? i.value = ce : null),
|
|
517
|
+
title: l.value === "" ? d(n)("nav.menu") : l.value,
|
|
489
518
|
side: "left",
|
|
490
519
|
size: 260,
|
|
520
|
+
"full-screen": !1,
|
|
491
521
|
closable: ""
|
|
492
522
|
}, {
|
|
493
|
-
footer:
|
|
494
|
-
|
|
495
|
-
|
|
523
|
+
footer: w(() => [
|
|
524
|
+
M("div", gt, [
|
|
525
|
+
W(p.$slots, "user", { expanded: !0 }, void 0, !0)
|
|
496
526
|
])
|
|
497
527
|
]),
|
|
498
|
-
default:
|
|
499
|
-
|
|
528
|
+
default: w(() => [
|
|
529
|
+
W(p.$slots, "nav", {
|
|
500
530
|
collapsed: !1,
|
|
501
|
-
select:
|
|
531
|
+
select: d(m)
|
|
502
532
|
}, void 0, !0)
|
|
503
533
|
]),
|
|
504
534
|
_: 3
|
|
@@ -507,10 +537,10 @@ const Be = /* @__PURE__ */ A({
|
|
|
507
537
|
], 64);
|
|
508
538
|
};
|
|
509
539
|
}
|
|
510
|
-
}),
|
|
511
|
-
class
|
|
512
|
-
constructor(t, n,
|
|
513
|
-
super(t), this.status = n, this.errors =
|
|
540
|
+
}), yt = /* @__PURE__ */ j(wt, [["__scopeId", "data-v-ebc6adf3"]]);
|
|
541
|
+
class ie extends Error {
|
|
542
|
+
constructor(t, n, a = {}, r = null, o = null) {
|
|
543
|
+
super(t), this.status = n, this.errors = a, this.retryAfter = r, this.body = o, this.name = "HttpError";
|
|
514
544
|
}
|
|
515
545
|
status;
|
|
516
546
|
errors;
|
|
@@ -527,86 +557,86 @@ class B extends Error {
|
|
|
527
557
|
return this.status === 429;
|
|
528
558
|
}
|
|
529
559
|
}
|
|
530
|
-
const
|
|
531
|
-
function
|
|
532
|
-
const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie",
|
|
560
|
+
const bt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
561
|
+
function xt(e = {}) {
|
|
562
|
+
const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), r = e.onUnauthenticated, o = e.headers;
|
|
533
563
|
let s = !1;
|
|
534
|
-
async function c
|
|
535
|
-
s && !
|
|
564
|
+
async function u(c = !1) {
|
|
565
|
+
s && !c && ve("XSRF-TOKEN") !== null || (await a(n, { credentials: "same-origin" }), s = !0);
|
|
536
566
|
}
|
|
537
|
-
async function i(
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
const
|
|
567
|
+
async function i(c, m, l, v = {}, h = !1) {
|
|
568
|
+
const g = bt.has(c);
|
|
569
|
+
g && await u();
|
|
570
|
+
const p = {
|
|
541
571
|
Accept: "application/json",
|
|
542
572
|
"X-Requested-With": "XMLHttpRequest",
|
|
543
573
|
// Standing headers first, so a caller can still override one for a single request.
|
|
544
|
-
...
|
|
545
|
-
...
|
|
574
|
+
...o?.(),
|
|
575
|
+
...v.headers
|
|
546
576
|
};
|
|
547
|
-
if (
|
|
548
|
-
const
|
|
549
|
-
|
|
577
|
+
if (g) {
|
|
578
|
+
const V = ve("XSRF-TOKEN");
|
|
579
|
+
V !== null && (p["X-XSRF-TOKEN"] = V);
|
|
550
580
|
}
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
method:
|
|
581
|
+
l !== void 0 && (p["Content-Type"] = "application/json");
|
|
582
|
+
const _ = await a(kt(t, m, v.query), {
|
|
583
|
+
method: c,
|
|
554
584
|
credentials: "same-origin",
|
|
555
|
-
headers:
|
|
556
|
-
signal:
|
|
557
|
-
body:
|
|
585
|
+
headers: p,
|
|
586
|
+
signal: v.signal,
|
|
587
|
+
body: l === void 0 ? void 0 : JSON.stringify(l)
|
|
558
588
|
});
|
|
559
|
-
if (
|
|
560
|
-
return await
|
|
561
|
-
if (
|
|
562
|
-
throw await
|
|
563
|
-
if (
|
|
564
|
-
return await
|
|
589
|
+
if (_.status === 419 && g && !h)
|
|
590
|
+
return await u(!0), i(c, m, l, v, !0);
|
|
591
|
+
if (_.status === 401 && r?.(), !_.ok)
|
|
592
|
+
throw await _t(_);
|
|
593
|
+
if (_.status !== 204)
|
|
594
|
+
return await _.json();
|
|
565
595
|
}
|
|
566
596
|
return {
|
|
567
|
-
get: (
|
|
568
|
-
post: (
|
|
569
|
-
put: (
|
|
570
|
-
patch: (
|
|
571
|
-
delete: (
|
|
597
|
+
get: (c, m) => i("GET", c, void 0, m),
|
|
598
|
+
post: (c, m, l) => i("POST", c, m, l),
|
|
599
|
+
put: (c, m, l) => i("PUT", c, m, l),
|
|
600
|
+
patch: (c, m, l) => i("PATCH", c, m, l),
|
|
601
|
+
delete: (c, m) => i("DELETE", c, void 0, m)
|
|
572
602
|
};
|
|
573
603
|
}
|
|
574
|
-
async function
|
|
604
|
+
async function _t(e) {
|
|
575
605
|
let t = null;
|
|
576
606
|
try {
|
|
577
607
|
t = await e.json();
|
|
578
608
|
} catch {
|
|
579
609
|
}
|
|
580
|
-
const n = t ?? {},
|
|
581
|
-
return new
|
|
582
|
-
|
|
610
|
+
const n = t ?? {}, a = typeof n.message == "string" && n.message !== "" ? n.message : e.statusText || `Request failed with ${e.status}`, r = n.errors !== null && typeof n.errors == "object" ? n.errors : {}, o = e.headers.get("Retry-After"), s = o === null ? null : Number.parseInt(o, 10);
|
|
611
|
+
return new ie(
|
|
612
|
+
a,
|
|
583
613
|
e.status,
|
|
584
|
-
|
|
614
|
+
r,
|
|
585
615
|
Number.isFinite(s) ? s : null,
|
|
586
616
|
t
|
|
587
617
|
);
|
|
588
618
|
}
|
|
589
|
-
function
|
|
590
|
-
const
|
|
619
|
+
function kt(e, t, n) {
|
|
620
|
+
const r = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
|
|
591
621
|
if (n === void 0)
|
|
592
|
-
return
|
|
593
|
-
const
|
|
594
|
-
for (const [
|
|
595
|
-
i != null &&
|
|
596
|
-
const s =
|
|
597
|
-
return s === "" ?
|
|
598
|
-
}
|
|
599
|
-
function
|
|
622
|
+
return r;
|
|
623
|
+
const o = new URLSearchParams();
|
|
624
|
+
for (const [u, i] of Object.entries(n))
|
|
625
|
+
i != null && o.set(u, String(i));
|
|
626
|
+
const s = o.toString();
|
|
627
|
+
return s === "" ? r : `${r}${r.includes("?") ? "&" : "?"}${s}`;
|
|
628
|
+
}
|
|
629
|
+
function ve(e) {
|
|
600
630
|
if (typeof document > "u")
|
|
601
631
|
return null;
|
|
602
632
|
for (const t of document.cookie.split(";")) {
|
|
603
|
-
const [n, ...
|
|
633
|
+
const [n, ...a] = t.trim().split("=");
|
|
604
634
|
if (n === e)
|
|
605
|
-
return decodeURIComponent(
|
|
635
|
+
return decodeURIComponent(a.join("="));
|
|
606
636
|
}
|
|
607
637
|
return null;
|
|
608
638
|
}
|
|
609
|
-
const
|
|
639
|
+
const be = {
|
|
610
640
|
shell: {
|
|
611
641
|
loading: "Loading the panel…",
|
|
612
642
|
"error-title": "The panel could not start",
|
|
@@ -623,6 +653,18 @@ const ne = {
|
|
|
623
653
|
// The one menu group the panel names itself; a module's own group is named by the module.
|
|
624
654
|
system: "System"
|
|
625
655
|
},
|
|
656
|
+
// What a screen that edits one record offers whatever the record is: the way out of it, and
|
|
657
|
+
// the way to rename it. A module that opens an editor should not be inventing these.
|
|
658
|
+
editor: {
|
|
659
|
+
back: "Back",
|
|
660
|
+
rename: "Rename",
|
|
661
|
+
save: "Save"
|
|
662
|
+
},
|
|
663
|
+
// The page behind a '?'. Only the heading is the panel's: what the page says belongs to
|
|
664
|
+
// whatever is being explained, and travels with that module's own words.
|
|
665
|
+
help: {
|
|
666
|
+
title: "Help"
|
|
667
|
+
},
|
|
626
668
|
// When something happened, said the way a person would. The month names and the order of
|
|
627
669
|
// the parts come from `Intl` — only the words that no formatter knows are here.
|
|
628
670
|
dates: {
|
|
@@ -644,124 +686,221 @@ const ne = {
|
|
|
644
686
|
server: "The server could not do that. Try again in a moment.",
|
|
645
687
|
offline: "The server did not answer. Check the connection and try again.",
|
|
646
688
|
unknown: "That did not work."
|
|
689
|
+
},
|
|
690
|
+
// What one administrator writes on a record for the next one. Not the property of any
|
|
691
|
+
// section: the same feed hangs off a submission, an order and a client, so the words are
|
|
692
|
+
// the panel's own.
|
|
693
|
+
notes: {
|
|
694
|
+
title: "Notes",
|
|
695
|
+
placeholder: "A note for whoever picks this up next…",
|
|
696
|
+
add: "Add a note",
|
|
697
|
+
empty: "No notes yet.",
|
|
698
|
+
edit: "Edit",
|
|
699
|
+
delete: "Delete",
|
|
700
|
+
save: "Save",
|
|
701
|
+
cancel: "Cancel",
|
|
702
|
+
saved: "Saved.",
|
|
703
|
+
deleted: "Deleted.",
|
|
704
|
+
"delete-title": "Delete this note?",
|
|
705
|
+
"delete-text": "It goes for everybody. This cannot be undone.",
|
|
706
|
+
"unknown-author": "A deleted account",
|
|
707
|
+
// The three the server says and the browser only ever repeats.
|
|
708
|
+
"no-type": "That kind of record does not carry notes.",
|
|
709
|
+
missing: "That record no longer exists.",
|
|
710
|
+
forbidden: "You may not read the notes of this record.",
|
|
711
|
+
"not-yours": "A note is edited by whoever wrote it."
|
|
712
|
+
}
|
|
713
|
+
}, xe = "webx.locale";
|
|
714
|
+
function rn(e = {}) {
|
|
715
|
+
const t = e.manifestUrl ?? Ct() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", r = e.modules ?? [], o = [...e.routes ?? []];
|
|
716
|
+
for (const p of r)
|
|
717
|
+
o.push(...p.routes ?? []);
|
|
718
|
+
if (!o.some((p) => p.path === "/")) {
|
|
719
|
+
const p = r.find((_) => _.landing === !0);
|
|
720
|
+
o.push({
|
|
721
|
+
path: "/",
|
|
722
|
+
name: "webx.home",
|
|
723
|
+
component: rt,
|
|
724
|
+
props: { landing: p?.path ?? p?.routes?.[0]?.path ?? null }
|
|
725
|
+
});
|
|
647
726
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
m.push(...w.routes ?? []);
|
|
653
|
-
const s = ye({
|
|
654
|
-
history: pe(l),
|
|
655
|
-
routes: m
|
|
656
|
-
}), c = X({ locale: e.locale ?? ot() }), i = e.http ?? nt({
|
|
727
|
+
const s = Ce({
|
|
728
|
+
history: Le(a),
|
|
729
|
+
routes: o
|
|
730
|
+
}), u = de({ locale: e.locale ?? St() }), i = e.http ?? xt({
|
|
657
731
|
baseUrl: "",
|
|
658
732
|
onUnauthenticated: () => {
|
|
659
|
-
|
|
733
|
+
m.setUser(null), m.state.status = "unauthenticated";
|
|
660
734
|
},
|
|
661
735
|
// Every request says which language the panel is currently showing. It decides what
|
|
662
736
|
// the server writes its own messages in — a 422 under a field — for anybody who has
|
|
663
737
|
// not stored a preference yet, which is everybody until they choose one. Without it,
|
|
664
738
|
// signing in on a Russian sign-in screen lands in an English panel.
|
|
665
|
-
headers: () => ({ "X-Webx-Locale":
|
|
739
|
+
headers: () => ({ "X-Webx-Locale": u.state.locale })
|
|
666
740
|
});
|
|
667
|
-
|
|
668
|
-
async function
|
|
669
|
-
const
|
|
670
|
-
|
|
741
|
+
u.defaults("webx-admin", be);
|
|
742
|
+
async function c(p) {
|
|
743
|
+
const _ = await i.get(`${n}/translations/${p}`);
|
|
744
|
+
u.load(_.data.namespaces, _.data.locale, _.data.fallback), Tt(_.data.locale), At(_.data.locale, u.state.panelLocales);
|
|
671
745
|
}
|
|
672
|
-
const
|
|
746
|
+
const m = at({
|
|
673
747
|
http: i,
|
|
674
|
-
basePath:
|
|
748
|
+
basePath: a,
|
|
675
749
|
apiPath: n,
|
|
676
|
-
modules:
|
|
677
|
-
i18n:
|
|
678
|
-
loadDictionary:
|
|
750
|
+
modules: r,
|
|
751
|
+
i18n: u,
|
|
752
|
+
loadDictionary: c,
|
|
679
753
|
types: e.types,
|
|
680
754
|
screens: e.screens,
|
|
681
755
|
loadManifest: async () => (await i.get(t)).data
|
|
682
|
-
}),
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
list:
|
|
687
|
-
() =>
|
|
688
|
-
code:
|
|
689
|
-
label:
|
|
756
|
+
}), l = Se($t(e));
|
|
757
|
+
l.use(Ve), lt(l, m), ot(l, u);
|
|
758
|
+
const v = C("");
|
|
759
|
+
l.provide(De, {
|
|
760
|
+
list: S(
|
|
761
|
+
() => u.state.contentLocales.map((p) => ({
|
|
762
|
+
code: p.code,
|
|
763
|
+
label: p.code.toUpperCase()
|
|
690
764
|
}))
|
|
691
765
|
),
|
|
692
|
-
active:
|
|
693
|
-
get: () =>
|
|
694
|
-
set: (
|
|
695
|
-
|
|
766
|
+
active: S({
|
|
767
|
+
get: () => v.value || (u.state.contentLocales[0]?.code ?? ""),
|
|
768
|
+
set: (p) => {
|
|
769
|
+
v.value = p;
|
|
696
770
|
}
|
|
697
771
|
})
|
|
698
772
|
});
|
|
699
|
-
const
|
|
700
|
-
app:
|
|
773
|
+
const h = {
|
|
774
|
+
app: l,
|
|
701
775
|
router: s,
|
|
702
|
-
context:
|
|
703
|
-
i18n:
|
|
776
|
+
context: m,
|
|
777
|
+
i18n: u,
|
|
704
778
|
async mount() {
|
|
705
|
-
await Promise.all([
|
|
706
|
-
}),
|
|
779
|
+
await Promise.all([g(), c(u.state.locale)]).catch(() => {
|
|
780
|
+
}), l.mount(e.el ?? "#webx-app"), await m.reload();
|
|
707
781
|
}
|
|
708
782
|
};
|
|
709
|
-
async function
|
|
710
|
-
const
|
|
711
|
-
|
|
783
|
+
async function g() {
|
|
784
|
+
const p = await i.get(`${n}/locales`);
|
|
785
|
+
u.state.panelLocales = p.data.panel, u.state.contentLocales = p.data.content;
|
|
712
786
|
}
|
|
713
|
-
for (const
|
|
714
|
-
|
|
715
|
-
return
|
|
787
|
+
for (const p of e.plugins ?? [])
|
|
788
|
+
p.install(h);
|
|
789
|
+
return l.use(s), h;
|
|
716
790
|
}
|
|
717
|
-
function
|
|
791
|
+
function $t(e) {
|
|
718
792
|
const t = {
|
|
719
793
|
// The menu is the panel's own: it is the manifest, drawn.
|
|
720
794
|
// The shell hands in what a choice means where it drew the menu — in the drawer it is what
|
|
721
795
|
// closes it, and a drawer that stays open over the section it just opened is a drawer the
|
|
722
796
|
// reader has to dismiss by hand.
|
|
723
|
-
nav: (n) =>
|
|
797
|
+
nav: (n) => O(ut, { collapsed: n.collapsed === !0, onSelect: n.select })
|
|
724
798
|
};
|
|
725
|
-
return e.brand !== void 0 && (t.brand = () =>
|
|
799
|
+
return e.brand !== void 0 && (t.brand = () => O(e.brand)), e.userMenu !== void 0 && (t.user = (n) => O(e.userMenu, { expanded: n.expanded === !0 })), { render: () => O(yt, null, t) };
|
|
726
800
|
}
|
|
727
|
-
function
|
|
728
|
-
const e =
|
|
801
|
+
function St() {
|
|
802
|
+
const e = zt(xe);
|
|
729
803
|
return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
|
|
730
804
|
}
|
|
731
|
-
function
|
|
805
|
+
function Tt(e) {
|
|
732
806
|
try {
|
|
733
|
-
localStorage.setItem(
|
|
807
|
+
localStorage.setItem(xe, e);
|
|
734
808
|
} catch {
|
|
735
809
|
}
|
|
736
810
|
}
|
|
737
|
-
function
|
|
811
|
+
function zt(e) {
|
|
738
812
|
try {
|
|
739
813
|
return localStorage.getItem(e);
|
|
740
814
|
} catch {
|
|
741
815
|
return null;
|
|
742
816
|
}
|
|
743
817
|
}
|
|
744
|
-
function
|
|
818
|
+
function At(e, t) {
|
|
745
819
|
typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((n) => n.code === e)?.direction ?? "ltr");
|
|
746
820
|
}
|
|
747
|
-
function
|
|
821
|
+
function Ct() {
|
|
748
822
|
return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
|
|
749
823
|
}
|
|
750
|
-
function
|
|
824
|
+
function Lt(e) {
|
|
825
|
+
const t = e.replace(/\r\n?/g, `
|
|
826
|
+
`).split(`
|
|
827
|
+
`), n = [];
|
|
828
|
+
let a = 0;
|
|
829
|
+
for (; a < t.length; ) {
|
|
830
|
+
const r = t[a] ?? "";
|
|
831
|
+
if (r.trim() === "") {
|
|
832
|
+
a += 1;
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
if (/^```([\w-]*)\s*$/.exec(r)) {
|
|
836
|
+
const i = [];
|
|
837
|
+
for (a += 1; a < t.length && !/^```\s*$/.test(t[a] ?? ""); )
|
|
838
|
+
i.push(t[a] ?? ""), a += 1;
|
|
839
|
+
a += 1, n.push(`<pre><code>${re(i.join(`
|
|
840
|
+
`))}</code></pre>`);
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
const s = /^(#{1,4})\s+(.*)$/.exec(r);
|
|
844
|
+
if (s) {
|
|
845
|
+
const i = Math.min(s[1].length + 1, 5);
|
|
846
|
+
n.push(`<h${i}>${ne(s[2] ?? "")}</h${i}>`), a += 1;
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
if (K(r)) {
|
|
850
|
+
const i = /^\s*\d+[.)]\s+/.test(r), c = [];
|
|
851
|
+
for (; a < t.length && K(t[a] ?? ""); )
|
|
852
|
+
for (c.push((t[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < t.length; ) {
|
|
853
|
+
const l = t[a] ?? "";
|
|
854
|
+
if (l.trim() === "" || K(l) || /^(#{1,4})\s/.test(l) || /^```/.test(l))
|
|
855
|
+
break;
|
|
856
|
+
c[c.length - 1] += ` ${l.trim()}`, a += 1;
|
|
857
|
+
}
|
|
858
|
+
const m = i ? "ol" : "ul";
|
|
859
|
+
n.push(`<${m}>${c.map((l) => `<li>${ne(l)}</li>`).join("")}</${m}>`);
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
const u = [];
|
|
863
|
+
for (; a < t.length; ) {
|
|
864
|
+
const i = t[a] ?? "";
|
|
865
|
+
if (i.trim() === "" || K(i) || /^(#{1,4})\s/.test(i) || /^```/.test(i)) break;
|
|
866
|
+
u.push(i.trim()), a += 1;
|
|
867
|
+
}
|
|
868
|
+
n.push(`<p>${ne(u.join(" "))}</p>`);
|
|
869
|
+
}
|
|
870
|
+
return n.join("");
|
|
871
|
+
}
|
|
872
|
+
const F = "\0";
|
|
873
|
+
function K(e) {
|
|
874
|
+
return /^\s*(?:[-*+]|\d+[.)])\s+/.test(e);
|
|
875
|
+
}
|
|
876
|
+
function ne(e) {
|
|
877
|
+
const t = [], n = e.replace(/`([^`]+)`/g, (r, o) => (t.push(`<code>${re(o)}</code>`), `${F}${t.length - 1}${F}`));
|
|
878
|
+
return re(n).replace(
|
|
879
|
+
/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
|
|
880
|
+
'<a href="$2" target="_blank" rel="noopener">$1</a>'
|
|
881
|
+
).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(
|
|
882
|
+
new RegExp(`${F}(\\d+)${F}`, "g"),
|
|
883
|
+
(r, o) => t[Number(o)] ?? ""
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
function re(e) {
|
|
887
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
888
|
+
}
|
|
889
|
+
function Wt(e) {
|
|
751
890
|
const t = e.scope("webx-admin"), n = /* @__PURE__ */ new Map();
|
|
752
|
-
function
|
|
753
|
-
const i = e.state.locale,
|
|
754
|
-
let
|
|
755
|
-
return
|
|
891
|
+
function a(o, s, u) {
|
|
892
|
+
const i = e.state.locale, c = `${i}:${o}`;
|
|
893
|
+
let m = n.get(c);
|
|
894
|
+
return m === void 0 && (m = new Intl.DateTimeFormat(i, s), n.set(c, m)), m.format(u);
|
|
756
895
|
}
|
|
757
|
-
const
|
|
896
|
+
const r = (o) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, o);
|
|
758
897
|
return {
|
|
759
|
-
short(
|
|
760
|
-
const s =
|
|
898
|
+
short(o) {
|
|
899
|
+
const s = ae(o);
|
|
761
900
|
if (s === null)
|
|
762
901
|
return t("dates.never");
|
|
763
|
-
const
|
|
764
|
-
return i === 0 ? t("dates.today", { time:
|
|
902
|
+
const u = /* @__PURE__ */ new Date(), i = Rt(s, u);
|
|
903
|
+
return i === 0 ? t("dates.today", { time: r(s) }) : i === -1 ? t("dates.yesterday", { time: r(s) }) : s.getFullYear() === u.getFullYear() ? a(
|
|
765
904
|
"this-year",
|
|
766
905
|
{
|
|
767
906
|
day: "numeric",
|
|
@@ -771,65 +910,75 @@ function dt(e) {
|
|
|
771
910
|
hourCycle: "h23"
|
|
772
911
|
},
|
|
773
912
|
s
|
|
774
|
-
) :
|
|
913
|
+
) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, s);
|
|
775
914
|
},
|
|
776
|
-
exact(
|
|
777
|
-
const s =
|
|
778
|
-
return s === null ? "" :
|
|
915
|
+
exact(o) {
|
|
916
|
+
const s = ae(o);
|
|
917
|
+
return s === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, s);
|
|
779
918
|
},
|
|
780
|
-
iso(
|
|
781
|
-
const s =
|
|
919
|
+
iso(o) {
|
|
920
|
+
const s = ae(o);
|
|
782
921
|
return s === null ? "" : s.toISOString();
|
|
783
922
|
}
|
|
784
923
|
};
|
|
785
924
|
}
|
|
786
|
-
function
|
|
787
|
-
const e =
|
|
788
|
-
return
|
|
925
|
+
function Et() {
|
|
926
|
+
const e = G(Q, null);
|
|
927
|
+
return Wt(e ?? Ut());
|
|
789
928
|
}
|
|
790
|
-
let
|
|
791
|
-
function
|
|
792
|
-
return
|
|
929
|
+
let q = null;
|
|
930
|
+
function Ut() {
|
|
931
|
+
return q === null && (q = de(), q.defaults("webx-admin", be)), q;
|
|
793
932
|
}
|
|
794
|
-
function
|
|
933
|
+
function ae(e) {
|
|
795
934
|
if (e == null || e === "")
|
|
796
935
|
return null;
|
|
797
936
|
const t = e instanceof Date ? e : new Date(e);
|
|
798
937
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
799
938
|
}
|
|
800
|
-
function
|
|
801
|
-
const n = (
|
|
939
|
+
function Rt(e, t) {
|
|
940
|
+
const n = (a) => Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
|
|
802
941
|
return Math.round((n(e) - n(t)) / 864e5);
|
|
803
942
|
}
|
|
804
|
-
function
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
return
|
|
808
|
-
if (
|
|
809
|
-
if (
|
|
810
|
-
if (
|
|
811
|
-
if (
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
814
|
-
return
|
|
815
|
-
}
|
|
816
|
-
return
|
|
817
|
-
}
|
|
818
|
-
function
|
|
819
|
-
const e =
|
|
820
|
-
return (t, n) =>
|
|
821
|
-
}
|
|
822
|
-
function
|
|
943
|
+
function Mt(e, t, n) {
|
|
944
|
+
const a = e instanceof ie ? e.status : Pt(e);
|
|
945
|
+
if (a === 422)
|
|
946
|
+
return Vt(e) ?? n ?? t("errors.unknown");
|
|
947
|
+
if (a === 401) return t("errors.signed-out");
|
|
948
|
+
if (a === 403) return t("errors.forbidden");
|
|
949
|
+
if (a === 404) return t("errors.gone");
|
|
950
|
+
if (a === 409) return t("errors.conflict");
|
|
951
|
+
if (a === 429) {
|
|
952
|
+
const r = e instanceof ie ? e.retryAfter : null;
|
|
953
|
+
return r === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: r });
|
|
954
|
+
}
|
|
955
|
+
return a !== null && a >= 500 ? t("errors.server") : a === null ? t("errors.offline") : n ?? t("errors.unknown");
|
|
956
|
+
}
|
|
957
|
+
function Nt() {
|
|
958
|
+
const e = N("webx-admin");
|
|
959
|
+
return (t, n) => Mt(t, e, n);
|
|
960
|
+
}
|
|
961
|
+
function Pt(e) {
|
|
823
962
|
const t = e?.status;
|
|
824
963
|
return typeof t == "number" ? t : null;
|
|
825
964
|
}
|
|
826
|
-
function
|
|
965
|
+
function Vt(e) {
|
|
827
966
|
const n = e?.body?.message;
|
|
828
967
|
return typeof n == "string" && n !== "" ? n : null;
|
|
829
968
|
}
|
|
830
|
-
|
|
969
|
+
function Dt(e, t, n) {
|
|
970
|
+
const a = `${e.apiPath}/entities/${t}/${n}/notes`, r = (s) => `${e.apiPath}/notes/${s}`, o = (s) => s.data;
|
|
971
|
+
return {
|
|
972
|
+
list: () => e.http.get(a).then(o),
|
|
973
|
+
add: (s) => e.http.post(a, { body: s }).then(o),
|
|
974
|
+
save: (s, u) => e.http.put(r(s), { body: u }).then(o),
|
|
975
|
+
remove: (s) => e.http.delete(r(s)).then(() => {
|
|
976
|
+
})
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
const Bt = { class: "wx-screen-host" }, un = /* @__PURE__ */ U({
|
|
831
980
|
__name: "Screen",
|
|
832
|
-
props: /* @__PURE__ */
|
|
981
|
+
props: /* @__PURE__ */ se({
|
|
833
982
|
name: {},
|
|
834
983
|
errors: { default: void 0 },
|
|
835
984
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -840,39 +989,39 @@ const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
|
|
|
840
989
|
modelValue: { default: () => ({}) },
|
|
841
990
|
modelModifiers: {}
|
|
842
991
|
}),
|
|
843
|
-
emits: /* @__PURE__ */
|
|
992
|
+
emits: /* @__PURE__ */ se(["loaded"], ["update:modelValue"]),
|
|
844
993
|
setup(e, { expose: t, emit: n }) {
|
|
845
|
-
const
|
|
846
|
-
async function
|
|
847
|
-
i.value = null,
|
|
994
|
+
const a = e, r = n, o = he(e, "modelValue"), s = H(), u = N("webx-admin"), i = C(null), c = C(null);
|
|
995
|
+
async function m() {
|
|
996
|
+
i.value = null, c.value = null;
|
|
848
997
|
try {
|
|
849
|
-
const
|
|
850
|
-
i.value =
|
|
851
|
-
} catch (
|
|
852
|
-
|
|
998
|
+
const l = await s.loadScreen(a.name);
|
|
999
|
+
i.value = l, r("loaded", l);
|
|
1000
|
+
} catch (l) {
|
|
1001
|
+
c.value = l instanceof Error ? l.message : String(l);
|
|
853
1002
|
}
|
|
854
1003
|
}
|
|
855
|
-
return
|
|
856
|
-
|
|
857
|
-
}, { immediate: !0 }), t({ reload:
|
|
858
|
-
|
|
1004
|
+
return J([() => a.name, () => s.i18n.state.locale], () => {
|
|
1005
|
+
m();
|
|
1006
|
+
}, { immediate: !0 }), t({ reload: m }), (l, v) => (f(), b("div", Bt, [
|
|
1007
|
+
c.value ? (f(), x(d(Be), {
|
|
859
1008
|
key: 0,
|
|
860
1009
|
type: "danger",
|
|
861
|
-
title:
|
|
862
|
-
description:
|
|
863
|
-
}, null, 8, ["title", "description"])) : i.value === null ? (
|
|
1010
|
+
title: d(u)("shell.error-title"),
|
|
1011
|
+
description: c.value
|
|
1012
|
+
}, null, 8, ["title", "description"])) : i.value === null ? (f(), x(d(we), {
|
|
864
1013
|
key: 1,
|
|
865
1014
|
rows: 4
|
|
866
|
-
})) : (
|
|
1015
|
+
})) : (f(), x(d(Ge), {
|
|
867
1016
|
key: 2,
|
|
868
|
-
modelValue:
|
|
869
|
-
"onUpdate:modelValue":
|
|
1017
|
+
modelValue: o.value,
|
|
1018
|
+
"onUpdate:modelValue": v[0] || (v[0] = (h) => o.value = h),
|
|
870
1019
|
root: i.value,
|
|
871
|
-
patch:
|
|
872
|
-
types:
|
|
1020
|
+
patch: d(s).screenPatch(e.name),
|
|
1021
|
+
types: d(s).types,
|
|
873
1022
|
errors: e.errors,
|
|
874
|
-
translate:
|
|
875
|
-
can:
|
|
1023
|
+
translate: d(s).i18n.t,
|
|
1024
|
+
can: d(s).can,
|
|
876
1025
|
disabled: e.disabled,
|
|
877
1026
|
"label-position": e.labelPosition,
|
|
878
1027
|
"label-width": e.labelWidth,
|
|
@@ -880,10 +1029,10 @@ const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
|
|
|
880
1029
|
}, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
|
|
881
1030
|
]));
|
|
882
1031
|
}
|
|
883
|
-
}),
|
|
1032
|
+
}), It = {
|
|
884
1033
|
key: 0,
|
|
885
1034
|
class: "wx-dropdown__divider"
|
|
886
|
-
},
|
|
1035
|
+
}, jt = /* @__PURE__ */ U({
|
|
887
1036
|
__name: "RowMenu",
|
|
888
1037
|
props: {
|
|
889
1038
|
actions: {},
|
|
@@ -891,46 +1040,172 @@ const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
|
|
|
891
1040
|
size: { default: "sm" }
|
|
892
1041
|
},
|
|
893
1042
|
setup(e) {
|
|
894
|
-
const t = e, n =
|
|
895
|
-
...t.actions.filter((
|
|
896
|
-
...t.actions.filter((
|
|
897
|
-
]),
|
|
898
|
-
const
|
|
899
|
-
return
|
|
1043
|
+
const t = e, n = S(() => [
|
|
1044
|
+
...t.actions.filter((r) => !r.danger),
|
|
1045
|
+
...t.actions.filter((r) => r.danger)
|
|
1046
|
+
]), a = S(() => {
|
|
1047
|
+
const r = n.value.find((o) => o.danger);
|
|
1048
|
+
return r && n.value[0] !== r ? r.key : null;
|
|
900
1049
|
});
|
|
901
|
-
return (
|
|
1050
|
+
return (r, o) => n.value.length > 0 ? (f(), x(d(Ie), {
|
|
902
1051
|
key: 0,
|
|
903
1052
|
collapse: "always",
|
|
904
1053
|
align: "end",
|
|
905
1054
|
size: e.size,
|
|
906
1055
|
"aria-label": e.label,
|
|
907
|
-
onClick:
|
|
1056
|
+
onClick: o[0] || (o[0] = pe(() => {
|
|
908
1057
|
}, ["stop"]))
|
|
909
1058
|
}, {
|
|
910
|
-
collapsed:
|
|
911
|
-
(
|
|
1059
|
+
collapsed: w(() => [
|
|
1060
|
+
(f(!0), b(R, null, I(n.value, (s) => (f(), b(R, {
|
|
912
1061
|
key: s.key
|
|
913
1062
|
}, [
|
|
914
|
-
s.key ===
|
|
915
|
-
|
|
1063
|
+
s.key === a.value ? (f(), b("hr", It)) : E("", !0),
|
|
1064
|
+
y(d(je), {
|
|
916
1065
|
icon: s.icon,
|
|
917
1066
|
tone: s.danger ? "danger" : "default",
|
|
918
1067
|
href: s.href,
|
|
919
1068
|
target: s.href ? s.target ?? "_blank" : void 0,
|
|
920
1069
|
disabled: s.disabled,
|
|
921
|
-
onClick: (
|
|
1070
|
+
onClick: (u) => s.run?.()
|
|
922
1071
|
}, {
|
|
923
|
-
default:
|
|
924
|
-
|
|
1072
|
+
default: w(() => [
|
|
1073
|
+
L(A(s.label), 1)
|
|
925
1074
|
]),
|
|
926
1075
|
_: 2
|
|
927
1076
|
}, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
|
|
928
1077
|
], 64))), 128))
|
|
929
1078
|
]),
|
|
930
1079
|
_: 1
|
|
931
|
-
}, 8, ["size", "aria-label"])) :
|
|
1080
|
+
}, 8, ["size", "aria-label"])) : E("", !0);
|
|
1081
|
+
}
|
|
1082
|
+
}), dn = /* @__PURE__ */ U({
|
|
1083
|
+
__name: "BackButton",
|
|
1084
|
+
props: {
|
|
1085
|
+
to: {},
|
|
1086
|
+
label: { default: void 0 },
|
|
1087
|
+
size: { default: "sm" }
|
|
1088
|
+
},
|
|
1089
|
+
setup(e) {
|
|
1090
|
+
const t = e, n = N("webx-admin"), a = S(() => t.label ?? n("editor.back"));
|
|
1091
|
+
return (r, o) => (f(), x(d(ue), {
|
|
1092
|
+
icon: "arrow-left",
|
|
1093
|
+
class: "wx-back-button",
|
|
1094
|
+
as: d(We),
|
|
1095
|
+
to: e.to,
|
|
1096
|
+
title: a.value,
|
|
1097
|
+
size: e.size,
|
|
1098
|
+
"tooltip-side": "bottom"
|
|
1099
|
+
}, null, 8, ["as", "to", "title", "size"]));
|
|
1100
|
+
}
|
|
1101
|
+
}), Ht = { class: "wx-rename__footer" }, Ot = /* @__PURE__ */ U({
|
|
1102
|
+
__name: "RenameButton",
|
|
1103
|
+
props: {
|
|
1104
|
+
name: { default: "" },
|
|
1105
|
+
label: { default: void 0 },
|
|
1106
|
+
placeholder: { default: void 0 },
|
|
1107
|
+
disabled: { type: Boolean, default: !1 },
|
|
1108
|
+
size: { default: "sm" }
|
|
1109
|
+
},
|
|
1110
|
+
emits: ["rename"],
|
|
1111
|
+
setup(e, { emit: t }) {
|
|
1112
|
+
const n = e, a = t, r = N("webx-admin"), o = C(!1), s = C(n.name), u = C(null), i = S(() => n.label ?? r("editor.rename"));
|
|
1113
|
+
J(o, async (m) => {
|
|
1114
|
+
m && (s.value = n.name, await Te(), u.value?.focus(), u.value?.select());
|
|
1115
|
+
});
|
|
1116
|
+
function c() {
|
|
1117
|
+
const m = s.value.trim();
|
|
1118
|
+
if (m === "" || m === n.name) {
|
|
1119
|
+
o.value = !1;
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
a("rename", m), o.value = !1;
|
|
1123
|
+
}
|
|
1124
|
+
return (m, l) => (f(), x(d(He), {
|
|
1125
|
+
open: o.value,
|
|
1126
|
+
"onUpdate:open": l[2] || (l[2] = (v) => o.value = v),
|
|
1127
|
+
title: i.value,
|
|
1128
|
+
width: 320,
|
|
1129
|
+
side: "bottom",
|
|
1130
|
+
align: "start",
|
|
1131
|
+
teleport: ""
|
|
1132
|
+
}, {
|
|
1133
|
+
trigger: w(() => [
|
|
1134
|
+
y(d(ue), {
|
|
1135
|
+
type: "edit",
|
|
1136
|
+
title: i.value,
|
|
1137
|
+
size: e.size,
|
|
1138
|
+
disabled: e.disabled
|
|
1139
|
+
}, null, 8, ["title", "size", "disabled"])
|
|
1140
|
+
]),
|
|
1141
|
+
default: w(() => [
|
|
1142
|
+
M("form", {
|
|
1143
|
+
class: "wx-rename",
|
|
1144
|
+
onSubmit: pe(c, ["prevent"])
|
|
1145
|
+
}, [
|
|
1146
|
+
y(d(Oe), {
|
|
1147
|
+
ref_key: "field",
|
|
1148
|
+
ref: u,
|
|
1149
|
+
modelValue: s.value,
|
|
1150
|
+
"onUpdate:modelValue": l[0] || (l[0] = (v) => s.value = v),
|
|
1151
|
+
"aria-label": i.value,
|
|
1152
|
+
placeholder: e.placeholder,
|
|
1153
|
+
onKeydown: l[1] || (l[1] = ze((v) => o.value = !1, ["esc"]))
|
|
1154
|
+
}, null, 8, ["modelValue", "aria-label", "placeholder"]),
|
|
1155
|
+
M("div", Ht, [
|
|
1156
|
+
y(d(X), {
|
|
1157
|
+
type: "primary",
|
|
1158
|
+
size: "sm",
|
|
1159
|
+
"native-type": "submit"
|
|
1160
|
+
}, {
|
|
1161
|
+
default: w(() => [
|
|
1162
|
+
L(A(d(r)("editor.save")), 1)
|
|
1163
|
+
]),
|
|
1164
|
+
_: 1
|
|
1165
|
+
})
|
|
1166
|
+
])
|
|
1167
|
+
], 32)
|
|
1168
|
+
]),
|
|
1169
|
+
_: 1
|
|
1170
|
+
}, 8, ["open", "title"]));
|
|
1171
|
+
}
|
|
1172
|
+
}), cn = /* @__PURE__ */ j(Ot, [["__scopeId", "data-v-d879e8d3"]]), Ft = ["innerHTML"], Kt = /* @__PURE__ */ U({
|
|
1173
|
+
__name: "HelpButton",
|
|
1174
|
+
props: {
|
|
1175
|
+
body: {},
|
|
1176
|
+
title: { default: void 0 },
|
|
1177
|
+
label: { default: void 0 },
|
|
1178
|
+
size: { default: "sm" },
|
|
1179
|
+
width: { default: 720 }
|
|
1180
|
+
},
|
|
1181
|
+
setup(e) {
|
|
1182
|
+
const t = e, n = N("webx-admin"), a = C(!1), r = S(() => t.title ?? n("help.title")), o = S(() => Lt(t.body));
|
|
1183
|
+
return (s, u) => (f(), b(R, null, [
|
|
1184
|
+
y(d(ue), {
|
|
1185
|
+
type: "details",
|
|
1186
|
+
icon: "question",
|
|
1187
|
+
tone: "neutral",
|
|
1188
|
+
size: e.size,
|
|
1189
|
+
title: e.label ?? r.value,
|
|
1190
|
+
onClick: u[0] || (u[0] = (i) => a.value = !0)
|
|
1191
|
+
}, null, 8, ["size", "title"]),
|
|
1192
|
+
y(d(Fe), {
|
|
1193
|
+
open: a.value,
|
|
1194
|
+
"onUpdate:open": u[1] || (u[1] = (i) => a.value = i),
|
|
1195
|
+
title: r.value,
|
|
1196
|
+
width: e.width
|
|
1197
|
+
}, {
|
|
1198
|
+
default: w(() => [
|
|
1199
|
+
M("div", {
|
|
1200
|
+
class: "wx-help",
|
|
1201
|
+
innerHTML: o.value
|
|
1202
|
+
}, null, 8, Ft)
|
|
1203
|
+
]),
|
|
1204
|
+
_: 1
|
|
1205
|
+
}, 8, ["open", "title", "width"])
|
|
1206
|
+
], 64));
|
|
932
1207
|
}
|
|
933
|
-
}),
|
|
1208
|
+
}), mn = /* @__PURE__ */ j(Kt, [["__scopeId", "data-v-6c280d42"]]), qt = /* @__PURE__ */ U({
|
|
934
1209
|
name: "WxDate",
|
|
935
1210
|
__name: "DateText",
|
|
936
1211
|
props: {
|
|
@@ -939,62 +1214,266 @@ const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
|
|
|
939
1214
|
tone: { default: "muted" }
|
|
940
1215
|
},
|
|
941
1216
|
setup(e) {
|
|
942
|
-
const t = e, n =
|
|
943
|
-
return (s,
|
|
1217
|
+
const t = e, n = Et(), a = S(() => n.short(t.value)), r = S(() => n.exact(t.value)), o = S(() => n.iso(t.value));
|
|
1218
|
+
return (s, u) => r.value ? (f(), x(d(Ke), {
|
|
944
1219
|
key: 0,
|
|
945
|
-
content:
|
|
1220
|
+
content: r.value
|
|
946
1221
|
}, {
|
|
947
|
-
default:
|
|
948
|
-
|
|
1222
|
+
default: w(() => [
|
|
1223
|
+
y(d(Y), {
|
|
949
1224
|
as: "time",
|
|
950
|
-
datetime:
|
|
1225
|
+
datetime: o.value,
|
|
951
1226
|
size: e.size,
|
|
952
1227
|
tone: e.tone
|
|
953
1228
|
}, {
|
|
954
|
-
default:
|
|
955
|
-
|
|
1229
|
+
default: w(() => [
|
|
1230
|
+
L(A(a.value), 1)
|
|
956
1231
|
]),
|
|
957
1232
|
_: 1
|
|
958
1233
|
}, 8, ["datetime", "size", "tone"])
|
|
959
1234
|
]),
|
|
960
1235
|
_: 1
|
|
961
|
-
}, 8, ["content"])) : (
|
|
1236
|
+
}, 8, ["content"])) : (f(), x(d(Y), {
|
|
962
1237
|
key: 1,
|
|
963
1238
|
size: e.size,
|
|
964
1239
|
tone: e.tone
|
|
965
1240
|
}, {
|
|
966
|
-
default:
|
|
967
|
-
|
|
1241
|
+
default: w(() => [
|
|
1242
|
+
L(A(a.value), 1)
|
|
968
1243
|
]),
|
|
969
1244
|
_: 1
|
|
970
1245
|
}, 8, ["size", "tone"]));
|
|
971
1246
|
}
|
|
972
|
-
})
|
|
1247
|
+
}), Xt = { class: "wx-notes" }, Yt = {
|
|
1248
|
+
key: 3,
|
|
1249
|
+
class: "wx-notes__list"
|
|
1250
|
+
}, Gt = { class: "wx-note__body" }, Jt = { class: "wx-note__head" }, Qt = { class: "wx-note__buttons" }, Zt = {
|
|
1251
|
+
key: 1,
|
|
1252
|
+
class: "wx-note__text"
|
|
1253
|
+
}, en = {
|
|
1254
|
+
key: 4,
|
|
1255
|
+
class: "wx-notes__new"
|
|
1256
|
+
}, tn = /* @__PURE__ */ U({
|
|
1257
|
+
name: "WxNotes",
|
|
1258
|
+
__name: "NotesFeed",
|
|
1259
|
+
props: {
|
|
1260
|
+
type: {},
|
|
1261
|
+
id: {},
|
|
1262
|
+
can: { type: Boolean, default: !0 },
|
|
1263
|
+
title: { default: void 0 }
|
|
1264
|
+
},
|
|
1265
|
+
emits: ["change"],
|
|
1266
|
+
setup(e, { emit: t }) {
|
|
1267
|
+
const n = e, a = t, r = H(), o = N("webx-admin"), s = Nt(), u = C([]), i = C(!0), c = C(""), m = C(!1), l = C(null), v = C(""), h = S(() => Dt(r, n.type, n.id)), g = S(() => n.title ?? o("notes.title"));
|
|
1268
|
+
async function p() {
|
|
1269
|
+
i.value = !0;
|
|
1270
|
+
try {
|
|
1271
|
+
u.value = await h.value.list();
|
|
1272
|
+
} catch (k) {
|
|
1273
|
+
B.danger(s(k));
|
|
1274
|
+
} finally {
|
|
1275
|
+
i.value = !1;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
J(
|
|
1279
|
+
() => [n.type, n.id],
|
|
1280
|
+
() => {
|
|
1281
|
+
l.value = null, c.value = "", p();
|
|
1282
|
+
},
|
|
1283
|
+
{ immediate: !0 }
|
|
1284
|
+
);
|
|
1285
|
+
async function _() {
|
|
1286
|
+
const k = c.value.trim();
|
|
1287
|
+
if (!(k === "" || m.value)) {
|
|
1288
|
+
m.value = !0;
|
|
1289
|
+
try {
|
|
1290
|
+
u.value = [...u.value, await h.value.add(k)], c.value = "", a("change");
|
|
1291
|
+
} catch (T) {
|
|
1292
|
+
B.danger(s(T));
|
|
1293
|
+
} finally {
|
|
1294
|
+
m.value = !1;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
function V(k) {
|
|
1299
|
+
l.value = k.id, v.value = k.body;
|
|
1300
|
+
}
|
|
1301
|
+
async function Z(k) {
|
|
1302
|
+
const T = v.value.trim();
|
|
1303
|
+
if (T !== "")
|
|
1304
|
+
try {
|
|
1305
|
+
const $ = await h.value.save(k.id, T);
|
|
1306
|
+
u.value = u.value.map((P) => P.id === $.id ? $ : P), l.value = null, B.success(o("notes.saved")), a("change");
|
|
1307
|
+
} catch ($) {
|
|
1308
|
+
B.danger(s($));
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
async function ee(k) {
|
|
1312
|
+
if (await Ye({
|
|
1313
|
+
title: o("notes.delete-title"),
|
|
1314
|
+
message: o("notes.delete-text"),
|
|
1315
|
+
confirmText: o("notes.delete"),
|
|
1316
|
+
cancelText: o("notes.cancel"),
|
|
1317
|
+
tone: "danger"
|
|
1318
|
+
}))
|
|
1319
|
+
try {
|
|
1320
|
+
await h.value.remove(k.id), u.value = u.value.filter(($) => $.id !== k.id), B.success(o("notes.deleted")), a("change");
|
|
1321
|
+
} catch ($) {
|
|
1322
|
+
B.danger(s($));
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
function te(k) {
|
|
1326
|
+
return !n.can || !k.is_mine ? [] : [
|
|
1327
|
+
{ key: "edit", icon: "edit", label: o("notes.edit"), run: () => V(k) },
|
|
1328
|
+
{
|
|
1329
|
+
key: "delete",
|
|
1330
|
+
icon: "trash",
|
|
1331
|
+
label: o("notes.delete"),
|
|
1332
|
+
danger: !0,
|
|
1333
|
+
run: () => {
|
|
1334
|
+
ee(k);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
];
|
|
1338
|
+
}
|
|
1339
|
+
function D(k) {
|
|
1340
|
+
return k.author?.name ?? o("notes.unknown-author");
|
|
1341
|
+
}
|
|
1342
|
+
return (k, T) => (f(), b("section", Xt, [
|
|
1343
|
+
g.value ? (f(), x(d(Y), {
|
|
1344
|
+
key: 0,
|
|
1345
|
+
weight: "medium",
|
|
1346
|
+
class: "wx-notes__title"
|
|
1347
|
+
}, {
|
|
1348
|
+
default: w(() => [
|
|
1349
|
+
L(A(g.value), 1)
|
|
1350
|
+
]),
|
|
1351
|
+
_: 1
|
|
1352
|
+
})) : E("", !0),
|
|
1353
|
+
i.value ? (f(), x(d(we), {
|
|
1354
|
+
key: 1,
|
|
1355
|
+
rows: 2
|
|
1356
|
+
})) : u.value.length === 0 ? (f(), x(d(qe), {
|
|
1357
|
+
key: 2,
|
|
1358
|
+
size: "sm",
|
|
1359
|
+
description: d(o)("notes.empty")
|
|
1360
|
+
}, null, 8, ["description"])) : (f(), b("ul", Yt, [
|
|
1361
|
+
(f(!0), b(R, null, I(u.value, ($) => (f(), b("li", {
|
|
1362
|
+
key: $.id,
|
|
1363
|
+
class: "wx-note"
|
|
1364
|
+
}, [
|
|
1365
|
+
y(d(Xe), {
|
|
1366
|
+
name: D($),
|
|
1367
|
+
size: "sm",
|
|
1368
|
+
tone: "auto"
|
|
1369
|
+
}, null, 8, ["name"]),
|
|
1370
|
+
M("div", Gt, [
|
|
1371
|
+
M("div", Jt, [
|
|
1372
|
+
y(d(Y), {
|
|
1373
|
+
size: "sm",
|
|
1374
|
+
weight: "medium",
|
|
1375
|
+
truncate: ""
|
|
1376
|
+
}, {
|
|
1377
|
+
default: w(() => [
|
|
1378
|
+
L(A(D($)), 1)
|
|
1379
|
+
]),
|
|
1380
|
+
_: 2
|
|
1381
|
+
}, 1024),
|
|
1382
|
+
y(qt, {
|
|
1383
|
+
value: $.created_at
|
|
1384
|
+
}, null, 8, ["value"]),
|
|
1385
|
+
y(jt, {
|
|
1386
|
+
actions: te($),
|
|
1387
|
+
label: D($)
|
|
1388
|
+
}, null, 8, ["actions", "label"])
|
|
1389
|
+
]),
|
|
1390
|
+
l.value === $.id ? (f(), b(R, { key: 0 }, [
|
|
1391
|
+
y(d(fe), {
|
|
1392
|
+
modelValue: v.value,
|
|
1393
|
+
"onUpdate:modelValue": T[0] || (T[0] = (P) => v.value = P),
|
|
1394
|
+
autosize: { minRows: 2, maxRows: 10 }
|
|
1395
|
+
}, null, 8, ["modelValue"]),
|
|
1396
|
+
M("div", Qt, [
|
|
1397
|
+
y(d(X), {
|
|
1398
|
+
size: "sm",
|
|
1399
|
+
type: "primary",
|
|
1400
|
+
onClick: (P) => Z($)
|
|
1401
|
+
}, {
|
|
1402
|
+
default: w(() => [
|
|
1403
|
+
L(A(d(o)("notes.save")), 1)
|
|
1404
|
+
]),
|
|
1405
|
+
_: 1
|
|
1406
|
+
}, 8, ["onClick"]),
|
|
1407
|
+
y(d(X), {
|
|
1408
|
+
size: "sm",
|
|
1409
|
+
variant: "text",
|
|
1410
|
+
onClick: T[1] || (T[1] = (P) => l.value = null)
|
|
1411
|
+
}, {
|
|
1412
|
+
default: w(() => [
|
|
1413
|
+
L(A(d(o)("notes.cancel")), 1)
|
|
1414
|
+
]),
|
|
1415
|
+
_: 1
|
|
1416
|
+
})
|
|
1417
|
+
])
|
|
1418
|
+
], 64)) : (f(), b("p", Zt, A($.body), 1))
|
|
1419
|
+
])
|
|
1420
|
+
]))), 128))
|
|
1421
|
+
])),
|
|
1422
|
+
e.can ? (f(), b("div", en, [
|
|
1423
|
+
y(d(fe), {
|
|
1424
|
+
modelValue: c.value,
|
|
1425
|
+
"onUpdate:modelValue": T[2] || (T[2] = ($) => c.value = $),
|
|
1426
|
+
placeholder: d(o)("notes.placeholder"),
|
|
1427
|
+
autosize: { minRows: 2, maxRows: 8 }
|
|
1428
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
1429
|
+
y(d(X), {
|
|
1430
|
+
size: "sm",
|
|
1431
|
+
type: "primary",
|
|
1432
|
+
disabled: c.value.trim() === "",
|
|
1433
|
+
loading: m.value,
|
|
1434
|
+
onClick: _
|
|
1435
|
+
}, {
|
|
1436
|
+
default: w(() => [
|
|
1437
|
+
L(A(d(o)("notes.add")), 1)
|
|
1438
|
+
]),
|
|
1439
|
+
_: 1
|
|
1440
|
+
}, 8, ["disabled", "loading"])
|
|
1441
|
+
])) : E("", !0)
|
|
1442
|
+
]));
|
|
1443
|
+
}
|
|
1444
|
+
}), fn = /* @__PURE__ */ j(tn, [["__scopeId", "data-v-4ce005b1"]]);
|
|
973
1445
|
export {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1446
|
+
rt as AdminLanding,
|
|
1447
|
+
ut as AdminNav,
|
|
1448
|
+
yt as AdminShell,
|
|
1449
|
+
ie as HttpError,
|
|
1450
|
+
dn as WxBackButton,
|
|
1451
|
+
qt as WxDate,
|
|
1452
|
+
mn as WxHelpButton,
|
|
1453
|
+
tt as WxListScreen,
|
|
1454
|
+
fn as WxNotes,
|
|
1455
|
+
cn as WxRenameButton,
|
|
1456
|
+
jt as WxRowMenu,
|
|
1457
|
+
un as WxScreen,
|
|
1458
|
+
ye as adminKey,
|
|
1459
|
+
be as adminMessages,
|
|
1460
|
+
nt as adminTypes,
|
|
1461
|
+
rn as createAdmin,
|
|
1462
|
+
at as createAdminContext,
|
|
1463
|
+
Wt as createDates,
|
|
1464
|
+
xt as createHttp,
|
|
1465
|
+
de as createI18n,
|
|
1466
|
+
Dt as createNotesApi,
|
|
1467
|
+
Mt as errorText,
|
|
1468
|
+
Q as i18nKey,
|
|
1469
|
+
lt as provideAdmin,
|
|
1470
|
+
ot as provideI18n,
|
|
1471
|
+
ve as readCookie,
|
|
1472
|
+
Lt as renderMarkdown,
|
|
994
1473
|
H as useAdmin,
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1474
|
+
Et as useDates,
|
|
1475
|
+
Nt as useErrorText,
|
|
1476
|
+
on as useI18n,
|
|
1477
|
+
N as useTranslate
|
|
999
1478
|
};
|
|
1000
1479
|
//# sourceMappingURL=index.js.map
|