@webx-ui/module-admin 0.4.1 → 0.5.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/README.md +33 -0
- package/dist/AdminShell.d.ts +4 -1
- package/dist/DateText.d.ts +23 -0
- package/dist/ListScreen.d.ts +80 -0
- package/dist/RowMenu.d.ts +28 -0
- package/dist/dates.d.ts +40 -0
- package/dist/errors.d.ts +24 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +731 -379
- package/dist/index.js.map +1 -1
- package/dist/screenTypes.d.ts +14 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +43 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,93 +1,177 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { useResponsiveShell as
|
|
4
|
-
import { WxScreenRenderer as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { defineComponent as A, useModel as Z, openBlock as v, createElementBlock as p, normalizeClass as O, createBlock as b, unref as f, withCtx as g, createTextVNode as C, toDisplayString as E, createCommentVNode as T, renderSlot as $, Fragment as L, mergeModels as j, inject as z, reactive as F, computed as k, resolveComponent as _, renderList as M, ref as D, createVNode as S, createElementVNode as I, isRef as fe, createApp as me, h as P, watch as he, withModifiers as ve } from "vue";
|
|
2
|
+
import { useRouter as we, useRoute as ge, createRouter as ye, createWebHistory as pe } from "vue-router";
|
|
3
|
+
import { WxHeading as be, WxTabs as xe, WxCard as G, useResponsiveShell as _e, shellLayoutFor as ke, WxToaster as Se, WebxUI as $e, localesKey as Te, WxAlert as Ce, WxSkeleton as Ee, WxActions as Le, WxDropdownItem as Ae, WxTooltip as Ue, WxText as J } from "@webx-ui/core";
|
|
4
|
+
import { WxScreenRenderer as Pe } from "@webx-ui/schema";
|
|
5
|
+
const We = ["data-wx-fill"], Me = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "wx-list-screen__head"
|
|
8
|
+
}, De = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "wx-list-screen__actions"
|
|
11
|
+
}, ze = /* @__PURE__ */ A({
|
|
12
|
+
__name: "ListScreen",
|
|
13
|
+
props: /* @__PURE__ */ j({
|
|
14
|
+
title: { default: void 0 },
|
|
15
|
+
views: { default: void 0 },
|
|
16
|
+
card: { type: Boolean, default: !0 },
|
|
17
|
+
padding: { default: void 0 },
|
|
18
|
+
fill: { type: Boolean, default: !1 },
|
|
19
|
+
collapseBelow: { default: 560 }
|
|
20
|
+
}, {
|
|
21
|
+
view: { default: void 0 },
|
|
22
|
+
viewModifiers: {}
|
|
23
|
+
}),
|
|
24
|
+
emits: ["update:view"],
|
|
25
|
+
setup(e) {
|
|
26
|
+
const t = Z(e, "view");
|
|
27
|
+
return (n, l) => (v(), p("div", {
|
|
28
|
+
class: O(["wx-list-screen", { "is-fill": e.fill }]),
|
|
29
|
+
"data-wx-fill": e.fill ? "" : void 0
|
|
30
|
+
}, [
|
|
31
|
+
e.title || n.$slots.actions ? (v(), p("div", Me, [
|
|
32
|
+
e.title ? (v(), b(f(be), {
|
|
33
|
+
key: 0,
|
|
34
|
+
level: 2,
|
|
35
|
+
class: "wx-list-screen__title"
|
|
36
|
+
}, {
|
|
37
|
+
default: g(() => [
|
|
38
|
+
C(E(e.title), 1)
|
|
39
|
+
]),
|
|
40
|
+
_: 1
|
|
41
|
+
})) : T("", !0),
|
|
42
|
+
n.$slots.actions ? (v(), p("div", De, [
|
|
43
|
+
$(n.$slots, "actions", {}, void 0, !0)
|
|
44
|
+
])) : T("", !0)
|
|
45
|
+
])) : T("", !0),
|
|
46
|
+
e.views && e.views.length > 0 ? (v(), b(f(xe), {
|
|
47
|
+
key: 1,
|
|
48
|
+
modelValue: t.value,
|
|
49
|
+
"onUpdate:modelValue": l[0] || (l[0] = (u) => t.value = u),
|
|
50
|
+
class: "wx-list-screen__views",
|
|
51
|
+
items: e.views,
|
|
52
|
+
"collapse-below": e.collapseBelow,
|
|
53
|
+
"aria-label": e.title
|
|
54
|
+
}, {
|
|
55
|
+
default: g(() => [
|
|
56
|
+
e.card ? (v(), b(f(G), {
|
|
57
|
+
key: 0,
|
|
58
|
+
class: "wx-list-screen__card",
|
|
59
|
+
padding: e.padding
|
|
60
|
+
}, {
|
|
61
|
+
default: g(() => [
|
|
62
|
+
$(n.$slots, "default", {}, void 0, !0)
|
|
63
|
+
]),
|
|
64
|
+
_: 3
|
|
65
|
+
}, 8, ["padding"])) : $(n.$slots, "default", {}, void 0, !0, 1)
|
|
66
|
+
]),
|
|
67
|
+
_: 3
|
|
68
|
+
}, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (v(), p(L, { key: 2 }, [
|
|
69
|
+
e.card ? (v(), b(f(G), {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: "wx-list-screen__card",
|
|
72
|
+
padding: e.padding
|
|
73
|
+
}, {
|
|
74
|
+
default: g(() => [
|
|
75
|
+
$(n.$slots, "default", {}, void 0, !0)
|
|
76
|
+
]),
|
|
77
|
+
_: 3
|
|
78
|
+
}, 8, ["padding"])) : $(n.$slots, "default", {}, void 0, !0, 1)
|
|
79
|
+
], 64))
|
|
80
|
+
], 10, We));
|
|
81
|
+
}
|
|
82
|
+
}), ee = (e, t) => {
|
|
83
|
+
const n = e.__vccOpts || e;
|
|
84
|
+
for (const [l, u] of t)
|
|
85
|
+
n[l] = u;
|
|
86
|
+
return n;
|
|
87
|
+
}, Ne = /* @__PURE__ */ ee(ze, [["__scopeId", "data-v-7586ed04"]]), Re = {
|
|
88
|
+
"wx-list": { component: Ne, kind: "layout", labelProp: "title" }
|
|
89
|
+
}, te = /* @__PURE__ */ Symbol("webx-admin");
|
|
90
|
+
function H() {
|
|
91
|
+
const e = z(te, null);
|
|
8
92
|
if (e === null)
|
|
9
93
|
throw new Error("useAdmin() was called outside a panel created by createAdmin().");
|
|
10
94
|
return e;
|
|
11
95
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
96
|
+
function Ie(e) {
|
|
97
|
+
const t = F({
|
|
14
98
|
status: "loading",
|
|
15
99
|
manifest: null,
|
|
16
100
|
user: null,
|
|
17
101
|
error: null
|
|
18
|
-
}),
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
102
|
+
}), n = k(() => {
|
|
103
|
+
const a = t.manifest;
|
|
104
|
+
if (a === null)
|
|
21
105
|
return [];
|
|
22
|
-
const
|
|
23
|
-
for (const
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
106
|
+
const o = [];
|
|
107
|
+
for (const h of a.modules) {
|
|
108
|
+
const d = e.modules.find((w) => w.id === h.id);
|
|
109
|
+
if (d === void 0)
|
|
26
110
|
continue;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
id:
|
|
30
|
-
title:
|
|
31
|
-
icon:
|
|
32
|
-
path:
|
|
33
|
-
group:
|
|
111
|
+
const y = d.path ?? d.routes?.[0]?.path;
|
|
112
|
+
y !== void 0 && o.push({
|
|
113
|
+
id: h.id,
|
|
114
|
+
title: h.title,
|
|
115
|
+
icon: h.icon,
|
|
116
|
+
path: y,
|
|
117
|
+
group: h.group ?? null
|
|
34
118
|
});
|
|
35
119
|
}
|
|
36
|
-
return
|
|
37
|
-
}),
|
|
38
|
-
const
|
|
39
|
-
for (const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
120
|
+
return o;
|
|
121
|
+
}), l = k(() => {
|
|
122
|
+
const a = t.manifest?.groups ?? [], o = [], h = /* @__PURE__ */ new Map();
|
|
123
|
+
for (const d of n.value)
|
|
124
|
+
if (d.group !== null && a.some((y) => y.id === d.group)) {
|
|
125
|
+
const y = h.get(d.group) ?? [];
|
|
126
|
+
y.push(d), h.set(d.group, y);
|
|
43
127
|
} else
|
|
44
|
-
|
|
128
|
+
o.push(d);
|
|
45
129
|
return {
|
|
46
|
-
top:
|
|
47
|
-
groups:
|
|
48
|
-
id:
|
|
49
|
-
title:
|
|
50
|
-
entries:
|
|
130
|
+
top: o,
|
|
131
|
+
groups: a.filter((d) => h.has(d.id)).map((d) => ({
|
|
132
|
+
id: d.id,
|
|
133
|
+
title: d.title,
|
|
134
|
+
entries: h.get(d.id) ?? []
|
|
51
135
|
}))
|
|
52
136
|
};
|
|
53
|
-
}),
|
|
54
|
-
for (const
|
|
55
|
-
Object.assign(
|
|
56
|
-
Object.assign(
|
|
137
|
+
}), u = { ...Re };
|
|
138
|
+
for (const a of e.modules)
|
|
139
|
+
Object.assign(u, a.types);
|
|
140
|
+
Object.assign(u, e.types);
|
|
57
141
|
const m = /* @__PURE__ */ new Map();
|
|
58
|
-
async function
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
return
|
|
62
|
-
throw m.delete(
|
|
63
|
-
}), m.set(
|
|
142
|
+
async function s(a) {
|
|
143
|
+
const o = `${e.i18n.state.locale}:${a}`;
|
|
144
|
+
let h = m.get(o);
|
|
145
|
+
return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${a}`).then((d) => d.data.root).catch((d) => {
|
|
146
|
+
throw m.delete(o), d;
|
|
147
|
+
}), m.set(o, h)), h;
|
|
64
148
|
}
|
|
65
|
-
let
|
|
149
|
+
let c = null;
|
|
66
150
|
async function i() {
|
|
67
|
-
|
|
151
|
+
t.status = "loading", t.error = null;
|
|
68
152
|
try {
|
|
69
|
-
if (
|
|
70
|
-
|
|
153
|
+
if (c !== null && (t.user = await c(), t.user === null)) {
|
|
154
|
+
t.manifest = null, t.status = "unauthenticated";
|
|
71
155
|
return;
|
|
72
156
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
} catch (
|
|
76
|
-
if (
|
|
77
|
-
|
|
157
|
+
const a = await e.loadManifest();
|
|
158
|
+
t.manifest = a, e.i18n.state.contentLocales = a.locales ?? [], e.i18n.state.panelLocales = a.panelLocales ?? e.i18n.state.panelLocales, a.locale !== void 0 && a.locale !== e.i18n.state.locale && await r(a.locale), t.status = "ready";
|
|
159
|
+
} catch (a) {
|
|
160
|
+
if (Oe(a)) {
|
|
161
|
+
t.manifest = null, t.user = null, t.status = "unauthenticated";
|
|
78
162
|
return;
|
|
79
163
|
}
|
|
80
|
-
|
|
164
|
+
t.error = a instanceof Error ? a.message : String(a), t.status = "error";
|
|
81
165
|
}
|
|
82
166
|
}
|
|
83
|
-
async function
|
|
167
|
+
async function r(a) {
|
|
84
168
|
if (e.loadDictionary === void 0) {
|
|
85
|
-
e.i18n.state.locale =
|
|
169
|
+
e.i18n.state.locale = a;
|
|
86
170
|
return;
|
|
87
171
|
}
|
|
88
|
-
if (await e.loadDictionary(
|
|
172
|
+
if (await e.loadDictionary(a), t.manifest !== null)
|
|
89
173
|
try {
|
|
90
|
-
|
|
174
|
+
t.manifest = await e.loadManifest();
|
|
91
175
|
} catch {
|
|
92
176
|
}
|
|
93
177
|
}
|
|
@@ -95,134 +179,134 @@ function fe(e) {
|
|
|
95
179
|
http: e.http,
|
|
96
180
|
basePath: e.basePath,
|
|
97
181
|
apiPath: e.apiPath,
|
|
98
|
-
state:
|
|
182
|
+
state: t,
|
|
99
183
|
i18n: e.i18n,
|
|
100
184
|
modules: e.modules,
|
|
101
|
-
nav:
|
|
102
|
-
groups:
|
|
103
|
-
types:
|
|
185
|
+
nav: n,
|
|
186
|
+
groups: l,
|
|
187
|
+
types: u,
|
|
104
188
|
reload: i,
|
|
105
|
-
setLocale:
|
|
106
|
-
setUser(
|
|
107
|
-
|
|
189
|
+
setLocale: r,
|
|
190
|
+
setUser(a) {
|
|
191
|
+
t.user = a;
|
|
108
192
|
},
|
|
109
|
-
useSessionLoader(
|
|
110
|
-
|
|
193
|
+
useSessionLoader(a) {
|
|
194
|
+
c = a;
|
|
111
195
|
},
|
|
112
|
-
can(
|
|
113
|
-
const
|
|
114
|
-
return
|
|
196
|
+
can(a) {
|
|
197
|
+
const o = t.user;
|
|
198
|
+
return o === null ? !1 : o.isSuper || o.permissions.includes(a);
|
|
115
199
|
},
|
|
116
|
-
loadScreen:
|
|
117
|
-
screenPatch(
|
|
118
|
-
return e.screens?.[
|
|
200
|
+
loadScreen: s,
|
|
201
|
+
screenPatch(a) {
|
|
202
|
+
return e.screens?.[a] ?? [];
|
|
119
203
|
}
|
|
120
204
|
};
|
|
121
205
|
}
|
|
122
|
-
function
|
|
123
|
-
e.provide(
|
|
206
|
+
function Ve(e, t) {
|
|
207
|
+
e.provide(te, t);
|
|
124
208
|
}
|
|
125
|
-
function
|
|
209
|
+
function Oe(e) {
|
|
126
210
|
return typeof e == "object" && e !== null && "status" in e && e.status === 401;
|
|
127
211
|
}
|
|
128
|
-
const
|
|
129
|
-
function
|
|
130
|
-
const e =
|
|
212
|
+
const N = /* @__PURE__ */ Symbol("webx-i18n");
|
|
213
|
+
function St() {
|
|
214
|
+
const e = z(N, null);
|
|
131
215
|
if (e === null)
|
|
132
216
|
throw new Error("useI18n() was called outside a panel created by createAdmin().");
|
|
133
217
|
return e;
|
|
134
218
|
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
return
|
|
219
|
+
function R(e) {
|
|
220
|
+
const t = z(N, null);
|
|
221
|
+
return t === null ? X().scope(e) : t.scope(e);
|
|
138
222
|
}
|
|
139
|
-
function
|
|
140
|
-
e.provide(
|
|
223
|
+
function je(e, t) {
|
|
224
|
+
e.provide(N, t);
|
|
141
225
|
}
|
|
142
226
|
function X(e = {}) {
|
|
143
|
-
const
|
|
144
|
-
locale: e.locale ??
|
|
145
|
-
fallback:
|
|
227
|
+
const t = e.fallback ?? "en", n = F({
|
|
228
|
+
locale: e.locale ?? t,
|
|
229
|
+
fallback: t,
|
|
146
230
|
panelLocales: [],
|
|
147
231
|
contentLocales: []
|
|
148
|
-
}),
|
|
149
|
-
function m(
|
|
150
|
-
let
|
|
151
|
-
for (const
|
|
152
|
-
if (typeof
|
|
232
|
+
}), l = {}, u = F({ value: {} });
|
|
233
|
+
function m(c, i, r) {
|
|
234
|
+
let a = c[i]?.[r[0] ?? ""];
|
|
235
|
+
for (const o of r.slice(1)) {
|
|
236
|
+
if (typeof a != "object" || a === null)
|
|
153
237
|
return null;
|
|
154
|
-
|
|
238
|
+
a = a[o];
|
|
155
239
|
}
|
|
156
|
-
return typeof
|
|
240
|
+
return typeof a == "string" ? a : null;
|
|
157
241
|
}
|
|
158
|
-
function
|
|
159
|
-
const [
|
|
242
|
+
function s(c, i, r) {
|
|
243
|
+
const [a, o] = i.includes("::") ? i.split("::", 2) : [c, i], h = o.split("."), d = m(u.value, a, h) ?? m(l, a, h) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
|
|
160
244
|
// label says nothing to anybody trying to fix it.
|
|
161
245
|
i;
|
|
162
|
-
return
|
|
246
|
+
return r === void 0 ? d : Fe(d, r);
|
|
163
247
|
}
|
|
164
248
|
return {
|
|
165
|
-
state:
|
|
166
|
-
defaults(
|
|
167
|
-
|
|
249
|
+
state: n,
|
|
250
|
+
defaults(c, i) {
|
|
251
|
+
l[c] = { ...l[c], ...i };
|
|
168
252
|
},
|
|
169
|
-
load(
|
|
170
|
-
|
|
253
|
+
load(c, i, r) {
|
|
254
|
+
u.value = c ?? {}, n.locale = i ?? n.locale, r !== void 0 && (n.fallback = r);
|
|
171
255
|
},
|
|
172
|
-
scope(
|
|
173
|
-
return (i,
|
|
256
|
+
scope(c) {
|
|
257
|
+
return (i, r) => s(c, i, r);
|
|
174
258
|
},
|
|
175
|
-
t: (
|
|
259
|
+
t: (c, i) => s("", c, i)
|
|
176
260
|
};
|
|
177
261
|
}
|
|
178
|
-
function
|
|
179
|
-
let
|
|
180
|
-
for (const [
|
|
181
|
-
|
|
182
|
-
return
|
|
262
|
+
function Fe(e, t) {
|
|
263
|
+
let n = e;
|
|
264
|
+
for (const [l, u] of Object.entries(t))
|
|
265
|
+
n = n.replaceAll(`:${l}`, String(u));
|
|
266
|
+
return n;
|
|
183
267
|
}
|
|
184
|
-
const
|
|
268
|
+
const Be = /* @__PURE__ */ A({
|
|
185
269
|
__name: "AdminNav",
|
|
186
270
|
props: {
|
|
187
271
|
collapsed: { type: Boolean }
|
|
188
272
|
},
|
|
189
273
|
emits: ["select"],
|
|
190
|
-
setup(e, { emit:
|
|
191
|
-
const
|
|
192
|
-
get: () =>
|
|
274
|
+
setup(e, { emit: t }) {
|
|
275
|
+
const n = t, l = H(), u = R("webx-admin"), m = we(), s = ge(), c = k({
|
|
276
|
+
get: () => l.nav.value.find((r) => s.path.startsWith(r.path))?.id ?? "",
|
|
193
277
|
set: (i) => {
|
|
194
|
-
const
|
|
195
|
-
|
|
278
|
+
const r = l.nav.value.find((a) => a.id === i);
|
|
279
|
+
r !== void 0 && m.push(r.path);
|
|
196
280
|
}
|
|
197
281
|
});
|
|
198
|
-
return (i,
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
modelValue:
|
|
202
|
-
"onUpdate:modelValue":
|
|
282
|
+
return (i, r) => {
|
|
283
|
+
const a = _("wx-menu-item"), o = _("wx-submenu"), h = _("wx-menu");
|
|
284
|
+
return v(), b(h, {
|
|
285
|
+
modelValue: c.value,
|
|
286
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => c.value = d),
|
|
203
287
|
collapsed: e.collapsed,
|
|
204
|
-
label:
|
|
205
|
-
onSelect:
|
|
288
|
+
label: f(u)("nav.sections"),
|
|
289
|
+
onSelect: r[1] || (r[1] = (d) => n("select"))
|
|
206
290
|
}, {
|
|
207
|
-
default:
|
|
208
|
-
(
|
|
209
|
-
key:
|
|
210
|
-
value:
|
|
211
|
-
icon:
|
|
212
|
-
label:
|
|
291
|
+
default: g(() => [
|
|
292
|
+
(v(!0), p(L, null, M(f(l).groups.value.top, (d) => (v(), b(a, {
|
|
293
|
+
key: d.id,
|
|
294
|
+
value: d.id,
|
|
295
|
+
icon: d.icon ?? void 0,
|
|
296
|
+
label: d.title
|
|
213
297
|
}, null, 8, ["value", "icon", "label"]))), 128)),
|
|
214
|
-
(
|
|
215
|
-
key:
|
|
216
|
-
value: `group:${
|
|
217
|
-
title:
|
|
298
|
+
(v(!0), p(L, null, M(f(l).groups.value.groups, (d) => (v(), b(o, {
|
|
299
|
+
key: d.id,
|
|
300
|
+
value: `group:${d.id}`,
|
|
301
|
+
title: d.title,
|
|
218
302
|
icon: "gear"
|
|
219
303
|
}, {
|
|
220
|
-
default:
|
|
221
|
-
(
|
|
222
|
-
key:
|
|
223
|
-
value:
|
|
224
|
-
icon:
|
|
225
|
-
label:
|
|
304
|
+
default: g(() => [
|
|
305
|
+
(v(!0), p(L, null, M(d.entries, (y) => (v(), b(a, {
|
|
306
|
+
key: y.id,
|
|
307
|
+
value: y.id,
|
|
308
|
+
icon: y.icon ?? void 0,
|
|
309
|
+
label: y.title
|
|
226
310
|
}, null, 8, ["value", "icon", "label"]))), 128))
|
|
227
311
|
]),
|
|
228
312
|
_: 2
|
|
@@ -232,138 +316,201 @@ const we = /* @__PURE__ */ M({
|
|
|
232
316
|
}, 8, ["modelValue", "collapsed", "label"]);
|
|
233
317
|
};
|
|
234
318
|
}
|
|
235
|
-
}),
|
|
319
|
+
}), He = {
|
|
236
320
|
key: 0,
|
|
237
321
|
class: "wx-root wx-admin-plain"
|
|
238
|
-
},
|
|
322
|
+
}, Xe = {
|
|
239
323
|
key: 1,
|
|
240
324
|
class: "wx-root wx-admin-plain"
|
|
241
|
-
},
|
|
325
|
+
}, Ke = {
|
|
242
326
|
key: 2,
|
|
243
327
|
class: "wx-root wx-admin-plain"
|
|
244
|
-
},
|
|
328
|
+
}, qe = ["src", "alt", "width", "height"], Ye = ["src", "alt", "width", "height"], Ge = ["src", "alt"], Je = { class: "wx-admin__user" }, Qe = { class: "wx-admin__user wx-admin__user--drawer" }, Ze = /* @__PURE__ */ A({
|
|
245
329
|
__name: "AdminShell",
|
|
246
330
|
setup(e) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
331
|
+
const t = H(), n = R("webx-admin"), l = D(null), { width: u, layout: m, collapsed: s, showAside: c, drawerOpen: i, toggle: r, close: a } = _e(
|
|
332
|
+
l,
|
|
333
|
+
{ persist: "webx-admin-shell" }
|
|
334
|
+
), o = k(() => t.state.manifest?.title ?? ""), h = k(() => t.state.manifest?.branding?.logo ?? null), d = k(() => t.state.manifest?.branding?.mark ?? null), y = k(() => ke(u.value, null));
|
|
335
|
+
return (w, x) => {
|
|
336
|
+
const U = _("router-view"), le = _("wx-loading"), se = _("wx-button"), oe = _("wx-result"), K = _("wx-action"), q = _("wx-text"), re = _("wx-header"), ie = _("wx-aside"), ue = _("wx-main"), ce = _("wx-container"), de = _("wx-drawer");
|
|
337
|
+
return v(), p(L, null, [
|
|
338
|
+
S(f(Se)),
|
|
339
|
+
f(t).state.status === "unauthenticated" ? (v(), p("div", He, [
|
|
340
|
+
S(U)
|
|
341
|
+
])) : f(t).state.status === "loading" ? (v(), p("div", Xe, [
|
|
342
|
+
S(le, {
|
|
343
|
+
label: f(n)("shell.loading")
|
|
259
344
|
}, null, 8, ["label"])
|
|
260
|
-
])) :
|
|
261
|
-
|
|
345
|
+
])) : f(t).state.status === "error" ? (v(), p("div", Ke, [
|
|
346
|
+
S(oe, {
|
|
262
347
|
status: "error",
|
|
263
|
-
title:
|
|
264
|
-
description:
|
|
348
|
+
title: f(n)("shell.error-title"),
|
|
349
|
+
description: f(t).state.error
|
|
265
350
|
}, {
|
|
266
|
-
default:
|
|
267
|
-
|
|
351
|
+
default: g(() => [
|
|
352
|
+
S(se, {
|
|
268
353
|
type: "primary",
|
|
269
|
-
onClick:
|
|
354
|
+
onClick: x[0] || (x[0] = (Y) => f(t).reload())
|
|
270
355
|
}, {
|
|
271
|
-
default:
|
|
272
|
-
|
|
356
|
+
default: g(() => [
|
|
357
|
+
C(E(f(n)("shell.retry")), 1)
|
|
273
358
|
]),
|
|
274
359
|
_: 1
|
|
275
360
|
})
|
|
276
361
|
]),
|
|
277
362
|
_: 1
|
|
278
363
|
}, 8, ["title", "description"])
|
|
279
|
-
])) : (
|
|
364
|
+
])) : (v(), p("div", {
|
|
280
365
|
key: 3,
|
|
281
366
|
ref_key: "shellEl",
|
|
282
|
-
ref:
|
|
283
|
-
class: "wx-root wx-admin"
|
|
367
|
+
ref: l,
|
|
368
|
+
class: O(["wx-root wx-admin", `wx-admin--${y.value}`])
|
|
284
369
|
}, [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
370
|
+
S(ce, {
|
|
371
|
+
direction: f(m) === "drawer" ? "vertical" : "horizontal",
|
|
372
|
+
"full-height": "",
|
|
373
|
+
class: "wx-admin__frame"
|
|
374
|
+
}, {
|
|
375
|
+
default: g(() => [
|
|
376
|
+
f(m) === "drawer" ? (v(), b(re, {
|
|
377
|
+
key: 0,
|
|
378
|
+
class: "wx-admin__header",
|
|
379
|
+
floating: "",
|
|
380
|
+
sticky: "",
|
|
381
|
+
bordered: !1,
|
|
382
|
+
padding: "sm",
|
|
383
|
+
height: "var(--wx-admin-header-height)"
|
|
384
|
+
}, {
|
|
385
|
+
end: g(() => [
|
|
386
|
+
$(w.$slots, "user", {}, void 0, !0)
|
|
290
387
|
]),
|
|
291
|
-
default:
|
|
292
|
-
|
|
293
|
-
icon:
|
|
294
|
-
title:
|
|
295
|
-
onClick:
|
|
296
|
-
}, null, 8, ["
|
|
297
|
-
$(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
388
|
+
default: g(() => [
|
|
389
|
+
S(K, {
|
|
390
|
+
icon: "menu",
|
|
391
|
+
title: f(n)("nav.menu"),
|
|
392
|
+
onClick: f(r)
|
|
393
|
+
}, null, 8, ["title", "onClick"]),
|
|
394
|
+
$(w.$slots, "brand", {}, () => [
|
|
395
|
+
h.value ? (v(), p("img", {
|
|
396
|
+
key: 0,
|
|
397
|
+
class: "wx-admin__logo",
|
|
398
|
+
src: h.value.url,
|
|
399
|
+
alt: o.value,
|
|
400
|
+
width: h.value.width ?? void 0,
|
|
401
|
+
height: h.value.height ?? void 0
|
|
402
|
+
}, null, 8, qe)) : (v(), b(q, {
|
|
403
|
+
key: 1,
|
|
404
|
+
weight: "semibold",
|
|
405
|
+
truncate: ""
|
|
406
|
+
}, {
|
|
407
|
+
default: g(() => [
|
|
408
|
+
C(E(o.value), 1)
|
|
301
409
|
]),
|
|
302
410
|
_: 1
|
|
303
|
-
})
|
|
411
|
+
}))
|
|
304
412
|
], !0)
|
|
305
413
|
]),
|
|
306
414
|
_: 3
|
|
307
|
-
}),
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
415
|
+
})) : T("", !0),
|
|
416
|
+
f(c) ? (v(), b(ie, {
|
|
417
|
+
key: 1,
|
|
418
|
+
class: "wx-admin__aside",
|
|
419
|
+
sticky: "",
|
|
420
|
+
floating: "",
|
|
421
|
+
scroll: "",
|
|
422
|
+
bordered: !1,
|
|
423
|
+
collapsed: f(s),
|
|
424
|
+
width: 220,
|
|
425
|
+
"collapsed-width": 56
|
|
426
|
+
}, {
|
|
427
|
+
top: g(() => [
|
|
428
|
+
I("div", {
|
|
429
|
+
class: O(["wx-admin__brand", { "wx-admin__brand--stacked": f(s) && d.value }])
|
|
430
|
+
}, [
|
|
431
|
+
f(s) ? d.value ? (v(), p("img", {
|
|
432
|
+
key: 1,
|
|
433
|
+
class: "wx-admin__mark",
|
|
434
|
+
src: d.value.url,
|
|
435
|
+
alt: o.value
|
|
436
|
+
}, null, 8, Ge)) : T("", !0) : $(w.$slots, "brand", {}, () => [
|
|
437
|
+
h.value ? (v(), p("img", {
|
|
438
|
+
key: 0,
|
|
439
|
+
class: "wx-admin__logo",
|
|
440
|
+
src: h.value.url,
|
|
441
|
+
alt: o.value,
|
|
442
|
+
width: h.value.width ?? void 0,
|
|
443
|
+
height: h.value.height ?? void 0
|
|
444
|
+
}, null, 8, Ye)) : (v(), b(q, {
|
|
445
|
+
key: 1,
|
|
446
|
+
weight: "semibold",
|
|
447
|
+
truncate: "",
|
|
448
|
+
class: "wx-admin__title"
|
|
449
|
+
}, {
|
|
450
|
+
default: g(() => [
|
|
451
|
+
C(E(o.value), 1)
|
|
452
|
+
]),
|
|
453
|
+
_: 1
|
|
454
|
+
}))
|
|
455
|
+
], !0, 0),
|
|
456
|
+
S(K, {
|
|
457
|
+
icon: "sidebar",
|
|
458
|
+
title: f(s) ? f(n)("nav.expand") : f(n)("nav.collapse"),
|
|
459
|
+
onClick: f(r)
|
|
460
|
+
}, null, 8, ["title", "onClick"])
|
|
461
|
+
], 2)
|
|
462
|
+
]),
|
|
463
|
+
bottom: g(() => [
|
|
464
|
+
I("div", Je, [
|
|
465
|
+
$(w.$slots, "user", {}, void 0, !0)
|
|
466
|
+
])
|
|
467
|
+
]),
|
|
468
|
+
default: g(() => [
|
|
469
|
+
$(w.$slots, "nav", { collapsed: f(s) }, void 0, !0)
|
|
331
470
|
]),
|
|
332
471
|
_: 3
|
|
472
|
+
}, 8, ["collapsed"])) : T("", !0),
|
|
473
|
+
S(ue, {
|
|
474
|
+
padding: "none",
|
|
475
|
+
class: "wx-admin__screen"
|
|
476
|
+
}, {
|
|
477
|
+
default: g(() => [
|
|
478
|
+
S(U)
|
|
479
|
+
]),
|
|
480
|
+
_: 1
|
|
333
481
|
})
|
|
334
482
|
]),
|
|
335
483
|
_: 3
|
|
336
|
-
}),
|
|
337
|
-
|
|
338
|
-
open:
|
|
339
|
-
"onUpdate:open":
|
|
340
|
-
title:
|
|
484
|
+
}, 8, ["direction"]),
|
|
485
|
+
S(de, {
|
|
486
|
+
open: f(i),
|
|
487
|
+
"onUpdate:open": x[1] || (x[1] = (Y) => fe(i) ? i.value = Y : null),
|
|
488
|
+
title: o.value === "" ? f(n)("nav.menu") : o.value,
|
|
341
489
|
side: "left",
|
|
342
490
|
size: 260,
|
|
343
491
|
closable: ""
|
|
344
492
|
}, {
|
|
345
|
-
|
|
346
|
-
|
|
493
|
+
footer: g(() => [
|
|
494
|
+
I("div", Qe, [
|
|
495
|
+
$(w.$slots, "user", {}, void 0, !0)
|
|
496
|
+
])
|
|
497
|
+
]),
|
|
498
|
+
default: g(() => [
|
|
499
|
+
$(w.$slots, "nav", {
|
|
347
500
|
collapsed: !1,
|
|
348
|
-
|
|
349
|
-
(...L) => d(l) && d(l)(...L))
|
|
501
|
+
select: f(a)
|
|
350
502
|
}, void 0, !0)
|
|
351
503
|
]),
|
|
352
504
|
_: 3
|
|
353
505
|
}, 8, ["open", "title"])
|
|
354
|
-
],
|
|
506
|
+
], 2))
|
|
355
507
|
], 64);
|
|
356
508
|
};
|
|
357
509
|
}
|
|
358
|
-
}),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return o;
|
|
363
|
-
}, Se = /* @__PURE__ */ _e(xe, [["__scopeId", "data-v-9ef35d4d"]]);
|
|
364
|
-
class ke extends Error {
|
|
365
|
-
constructor(n, o, u = {}, f = null, m = null) {
|
|
366
|
-
super(n), this.status = o, this.errors = u, this.retryAfter = f, this.body = m, this.name = "HttpError";
|
|
510
|
+
}), et = /* @__PURE__ */ ee(Ze, [["__scopeId", "data-v-bbe585dd"]]);
|
|
511
|
+
class B extends Error {
|
|
512
|
+
constructor(t, n, l = {}, u = null, m = null) {
|
|
513
|
+
super(t), this.status = n, this.errors = l, this.retryAfter = u, this.body = m, this.name = "HttpError";
|
|
367
514
|
}
|
|
368
515
|
status;
|
|
369
516
|
errors;
|
|
@@ -380,86 +527,86 @@ class ke extends Error {
|
|
|
380
527
|
return this.status === 429;
|
|
381
528
|
}
|
|
382
529
|
}
|
|
383
|
-
const
|
|
384
|
-
function
|
|
385
|
-
const
|
|
386
|
-
let
|
|
387
|
-
async function r
|
|
388
|
-
|
|
530
|
+
const tt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
531
|
+
function nt(e = {}) {
|
|
532
|
+
const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie", l = e.fetch ?? globalThis.fetch.bind(globalThis), u = e.onUnauthenticated, m = e.headers;
|
|
533
|
+
let s = !1;
|
|
534
|
+
async function c(r = !1) {
|
|
535
|
+
s && !r && Q("XSRF-TOKEN") !== null || (await l(n, { credentials: "same-origin" }), s = !0);
|
|
389
536
|
}
|
|
390
|
-
async function i(
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
const
|
|
537
|
+
async function i(r, a, o, h = {}, d = !1) {
|
|
538
|
+
const y = tt.has(r);
|
|
539
|
+
y && await c();
|
|
540
|
+
const w = {
|
|
394
541
|
Accept: "application/json",
|
|
395
542
|
"X-Requested-With": "XMLHttpRequest",
|
|
396
543
|
// Standing headers first, so a caller can still override one for a single request.
|
|
397
544
|
...m?.(),
|
|
398
|
-
...
|
|
545
|
+
...h.headers
|
|
399
546
|
};
|
|
400
|
-
if (
|
|
401
|
-
const
|
|
402
|
-
|
|
547
|
+
if (y) {
|
|
548
|
+
const U = Q("XSRF-TOKEN");
|
|
549
|
+
U !== null && (w["X-XSRF-TOKEN"] = U);
|
|
403
550
|
}
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
method:
|
|
551
|
+
o !== void 0 && (w["Content-Type"] = "application/json");
|
|
552
|
+
const x = await l(lt(t, a, h.query), {
|
|
553
|
+
method: r,
|
|
407
554
|
credentials: "same-origin",
|
|
408
|
-
headers:
|
|
409
|
-
signal:
|
|
410
|
-
body:
|
|
555
|
+
headers: w,
|
|
556
|
+
signal: h.signal,
|
|
557
|
+
body: o === void 0 ? void 0 : JSON.stringify(o)
|
|
411
558
|
});
|
|
412
|
-
if (
|
|
413
|
-
return await
|
|
414
|
-
if (
|
|
415
|
-
throw await
|
|
416
|
-
if (
|
|
417
|
-
return await
|
|
559
|
+
if (x.status === 419 && y && !d)
|
|
560
|
+
return await c(!0), i(r, a, o, h, !0);
|
|
561
|
+
if (x.status === 401 && u?.(), !x.ok)
|
|
562
|
+
throw await at(x);
|
|
563
|
+
if (x.status !== 204)
|
|
564
|
+
return await x.json();
|
|
418
565
|
}
|
|
419
566
|
return {
|
|
420
|
-
get: (
|
|
421
|
-
post: (
|
|
422
|
-
put: (
|
|
423
|
-
patch: (
|
|
424
|
-
delete: (
|
|
567
|
+
get: (r, a) => i("GET", r, void 0, a),
|
|
568
|
+
post: (r, a, o) => i("POST", r, a, o),
|
|
569
|
+
put: (r, a, o) => i("PUT", r, a, o),
|
|
570
|
+
patch: (r, a, o) => i("PATCH", r, a, o),
|
|
571
|
+
delete: (r, a) => i("DELETE", r, void 0, a)
|
|
425
572
|
};
|
|
426
573
|
}
|
|
427
|
-
async function
|
|
428
|
-
let
|
|
574
|
+
async function at(e) {
|
|
575
|
+
let t = null;
|
|
429
576
|
try {
|
|
430
|
-
|
|
577
|
+
t = await e.json();
|
|
431
578
|
} catch {
|
|
432
579
|
}
|
|
433
|
-
const
|
|
434
|
-
return new
|
|
435
|
-
|
|
580
|
+
const n = t ?? {}, l = typeof n.message == "string" && n.message !== "" ? n.message : e.statusText || `Request failed with ${e.status}`, u = n.errors !== null && typeof n.errors == "object" ? n.errors : {}, m = e.headers.get("Retry-After"), s = m === null ? null : Number.parseInt(m, 10);
|
|
581
|
+
return new B(
|
|
582
|
+
l,
|
|
436
583
|
e.status,
|
|
437
|
-
|
|
438
|
-
Number.isFinite(
|
|
439
|
-
|
|
584
|
+
u,
|
|
585
|
+
Number.isFinite(s) ? s : null,
|
|
586
|
+
t
|
|
440
587
|
);
|
|
441
588
|
}
|
|
442
|
-
function
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
return
|
|
589
|
+
function lt(e, t, n) {
|
|
590
|
+
const u = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
|
|
591
|
+
if (n === void 0)
|
|
592
|
+
return u;
|
|
446
593
|
const m = new URLSearchParams();
|
|
447
|
-
for (const [
|
|
448
|
-
i != null && m.set(
|
|
449
|
-
const
|
|
450
|
-
return
|
|
594
|
+
for (const [c, i] of Object.entries(n))
|
|
595
|
+
i != null && m.set(c, String(i));
|
|
596
|
+
const s = m.toString();
|
|
597
|
+
return s === "" ? u : `${u}${u.includes("?") ? "&" : "?"}${s}`;
|
|
451
598
|
}
|
|
452
|
-
function
|
|
599
|
+
function Q(e) {
|
|
453
600
|
if (typeof document > "u")
|
|
454
601
|
return null;
|
|
455
|
-
for (const
|
|
456
|
-
const [
|
|
457
|
-
if (
|
|
458
|
-
return decodeURIComponent(
|
|
602
|
+
for (const t of document.cookie.split(";")) {
|
|
603
|
+
const [n, ...l] = t.trim().split("=");
|
|
604
|
+
if (n === e)
|
|
605
|
+
return decodeURIComponent(l.join("="));
|
|
459
606
|
}
|
|
460
607
|
return null;
|
|
461
608
|
}
|
|
462
|
-
const
|
|
609
|
+
const ne = {
|
|
463
610
|
shell: {
|
|
464
611
|
loading: "Loading the panel…",
|
|
465
612
|
"error-title": "The panel could not start",
|
|
@@ -471,110 +618,218 @@ const Ue = {
|
|
|
471
618
|
sections: "Sections",
|
|
472
619
|
menu: "Menu",
|
|
473
620
|
collapse: "Collapse the menu",
|
|
474
|
-
|
|
621
|
+
expand: "Expand the menu",
|
|
622
|
+
language: "Language",
|
|
623
|
+
// The one menu group the panel names itself; a module's own group is named by the module.
|
|
624
|
+
system: "System"
|
|
625
|
+
},
|
|
626
|
+
// When something happened, said the way a person would. The month names and the order of
|
|
627
|
+
// the parts come from `Intl` — only the words that no formatter knows are here.
|
|
628
|
+
dates: {
|
|
629
|
+
today: "today at :time",
|
|
630
|
+
yesterday: "yesterday at :time",
|
|
631
|
+
// Not an empty cell and not a dash: a column that says nothing leaves a reader wondering
|
|
632
|
+
// whether the panel failed to load it.
|
|
633
|
+
never: "never"
|
|
634
|
+
},
|
|
635
|
+
// How a request fails, in the panel's words rather than the server's (§13.3). `errors.ts`
|
|
636
|
+
// decides which of these a status gets.
|
|
637
|
+
errors: {
|
|
638
|
+
"signed-out": "You are signed out. Sign in again and try once more.",
|
|
639
|
+
forbidden: "You are not allowed to do that.",
|
|
640
|
+
gone: "It is not there any more — somebody may have deleted it.",
|
|
641
|
+
conflict: "Somebody changed this while you were working on it.",
|
|
642
|
+
throttled: "Too many attempts. Try again in a moment.",
|
|
643
|
+
"throttled-in": "Too many attempts. Try again in :seconds seconds.",
|
|
644
|
+
server: "The server could not do that. Try again in a moment.",
|
|
645
|
+
offline: "The server did not answer. Check the connection and try again.",
|
|
646
|
+
unknown: "That did not work."
|
|
475
647
|
}
|
|
476
|
-
},
|
|
477
|
-
function
|
|
478
|
-
const
|
|
479
|
-
for (const
|
|
480
|
-
m.push(...
|
|
481
|
-
const
|
|
482
|
-
history:
|
|
648
|
+
}, ae = "webx.locale";
|
|
649
|
+
function $t(e = {}) {
|
|
650
|
+
const t = e.manifestUrl ?? ct() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), l = e.basePath ?? "/cms", u = e.modules ?? [], m = [...e.routes ?? []];
|
|
651
|
+
for (const w of u)
|
|
652
|
+
m.push(...w.routes ?? []);
|
|
653
|
+
const s = ye({
|
|
654
|
+
history: pe(l),
|
|
483
655
|
routes: m
|
|
484
|
-
}),
|
|
656
|
+
}), c = X({ locale: e.locale ?? ot() }), i = e.http ?? nt({
|
|
485
657
|
baseUrl: "",
|
|
486
658
|
onUnauthenticated: () => {
|
|
487
|
-
|
|
659
|
+
a.setUser(null), a.state.status = "unauthenticated";
|
|
488
660
|
},
|
|
489
661
|
// Every request says which language the panel is currently showing. It decides what
|
|
490
662
|
// the server writes its own messages in — a 422 under a field — for anybody who has
|
|
491
663
|
// not stored a preference yet, which is everybody until they choose one. Without it,
|
|
492
664
|
// signing in on a Russian sign-in screen lands in an English panel.
|
|
493
|
-
headers: () => ({ "X-Webx-Locale":
|
|
665
|
+
headers: () => ({ "X-Webx-Locale": c.state.locale })
|
|
494
666
|
});
|
|
495
|
-
|
|
496
|
-
async function
|
|
497
|
-
const
|
|
498
|
-
|
|
667
|
+
c.defaults("webx-admin", ne);
|
|
668
|
+
async function r(w) {
|
|
669
|
+
const x = await i.get(`${n}/translations/${w}`);
|
|
670
|
+
c.load(x.data.namespaces, x.data.locale, x.data.fallback), rt(x.data.locale), ut(x.data.locale, c.state.panelLocales);
|
|
499
671
|
}
|
|
500
|
-
const
|
|
672
|
+
const a = Ie({
|
|
501
673
|
http: i,
|
|
502
|
-
basePath:
|
|
503
|
-
apiPath:
|
|
504
|
-
modules:
|
|
505
|
-
i18n:
|
|
506
|
-
loadDictionary:
|
|
674
|
+
basePath: l,
|
|
675
|
+
apiPath: n,
|
|
676
|
+
modules: u,
|
|
677
|
+
i18n: c,
|
|
678
|
+
loadDictionary: r,
|
|
507
679
|
types: e.types,
|
|
508
680
|
screens: e.screens,
|
|
509
|
-
loadManifest: async () => (await i.get(
|
|
510
|
-
}),
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
|
|
681
|
+
loadManifest: async () => (await i.get(t)).data
|
|
682
|
+
}), o = me(st(e));
|
|
683
|
+
o.use($e), Ve(o, a), je(o, c);
|
|
684
|
+
const h = D("");
|
|
685
|
+
o.provide(Te, {
|
|
514
686
|
list: k(
|
|
515
|
-
() =>
|
|
516
|
-
code:
|
|
517
|
-
label:
|
|
687
|
+
() => c.state.contentLocales.map((w) => ({
|
|
688
|
+
code: w.code,
|
|
689
|
+
label: w.code.toUpperCase()
|
|
518
690
|
}))
|
|
519
691
|
),
|
|
520
692
|
active: k({
|
|
521
|
-
get: () =>
|
|
522
|
-
set: (
|
|
523
|
-
|
|
693
|
+
get: () => h.value || (c.state.contentLocales[0]?.code ?? ""),
|
|
694
|
+
set: (w) => {
|
|
695
|
+
h.value = w;
|
|
524
696
|
}
|
|
525
697
|
})
|
|
526
698
|
});
|
|
527
|
-
const
|
|
528
|
-
app:
|
|
529
|
-
router:
|
|
530
|
-
context:
|
|
531
|
-
i18n:
|
|
699
|
+
const d = {
|
|
700
|
+
app: o,
|
|
701
|
+
router: s,
|
|
702
|
+
context: a,
|
|
703
|
+
i18n: c,
|
|
532
704
|
async mount() {
|
|
533
|
-
await Promise.all([
|
|
534
|
-
}),
|
|
705
|
+
await Promise.all([y(), r(c.state.locale)]).catch(() => {
|
|
706
|
+
}), o.mount(e.el ?? "#webx-app"), await a.reload();
|
|
535
707
|
}
|
|
536
708
|
};
|
|
537
|
-
async function
|
|
538
|
-
const
|
|
539
|
-
|
|
709
|
+
async function y() {
|
|
710
|
+
const w = await i.get(`${n}/locales`);
|
|
711
|
+
c.state.panelLocales = w.data.panel, c.state.contentLocales = w.data.content;
|
|
540
712
|
}
|
|
541
|
-
for (const
|
|
542
|
-
|
|
543
|
-
return
|
|
713
|
+
for (const w of e.plugins ?? [])
|
|
714
|
+
w.install(d);
|
|
715
|
+
return o.use(s), d;
|
|
544
716
|
}
|
|
545
|
-
function
|
|
546
|
-
const
|
|
717
|
+
function st(e) {
|
|
718
|
+
const t = {
|
|
547
719
|
// The menu is the panel's own: it is the manifest, drawn.
|
|
548
|
-
|
|
720
|
+
// The shell hands in what a choice means where it drew the menu — in the drawer it is what
|
|
721
|
+
// closes it, and a drawer that stays open over the section it just opened is a drawer the
|
|
722
|
+
// reader has to dismiss by hand.
|
|
723
|
+
nav: (n) => P(Be, { collapsed: n.collapsed === !0, onSelect: n.select })
|
|
549
724
|
};
|
|
550
|
-
return e.brand !== void 0 && (
|
|
725
|
+
return e.brand !== void 0 && (t.brand = () => P(e.brand)), e.userMenu !== void 0 && (t.user = () => P(e.userMenu)), { render: () => P(et, null, t) };
|
|
551
726
|
}
|
|
552
|
-
function
|
|
553
|
-
const e =
|
|
727
|
+
function ot() {
|
|
728
|
+
const e = it(ae);
|
|
554
729
|
return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
|
|
555
730
|
}
|
|
556
|
-
function
|
|
731
|
+
function rt(e) {
|
|
557
732
|
try {
|
|
558
|
-
localStorage.setItem(
|
|
733
|
+
localStorage.setItem(ae, e);
|
|
559
734
|
} catch {
|
|
560
735
|
}
|
|
561
736
|
}
|
|
562
|
-
function
|
|
737
|
+
function it(e) {
|
|
563
738
|
try {
|
|
564
739
|
return localStorage.getItem(e);
|
|
565
740
|
} catch {
|
|
566
741
|
return null;
|
|
567
742
|
}
|
|
568
743
|
}
|
|
569
|
-
function
|
|
570
|
-
typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir =
|
|
744
|
+
function ut(e, t) {
|
|
745
|
+
typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((n) => n.code === e)?.direction ?? "ltr");
|
|
571
746
|
}
|
|
572
|
-
function
|
|
747
|
+
function ct() {
|
|
573
748
|
return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
|
|
574
749
|
}
|
|
575
|
-
|
|
750
|
+
function dt(e) {
|
|
751
|
+
const t = e.scope("webx-admin"), n = /* @__PURE__ */ new Map();
|
|
752
|
+
function l(m, s, c) {
|
|
753
|
+
const i = e.state.locale, r = `${i}:${m}`;
|
|
754
|
+
let a = n.get(r);
|
|
755
|
+
return a === void 0 && (a = new Intl.DateTimeFormat(i, s), n.set(r, a)), a.format(c);
|
|
756
|
+
}
|
|
757
|
+
const u = (m) => l("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, m);
|
|
758
|
+
return {
|
|
759
|
+
short(m) {
|
|
760
|
+
const s = V(m);
|
|
761
|
+
if (s === null)
|
|
762
|
+
return t("dates.never");
|
|
763
|
+
const c = /* @__PURE__ */ new Date(), i = ht(s, c);
|
|
764
|
+
return i === 0 ? t("dates.today", { time: u(s) }) : i === -1 ? t("dates.yesterday", { time: u(s) }) : s.getFullYear() === c.getFullYear() ? l(
|
|
765
|
+
"this-year",
|
|
766
|
+
{
|
|
767
|
+
day: "numeric",
|
|
768
|
+
month: "long",
|
|
769
|
+
hour: "2-digit",
|
|
770
|
+
minute: "2-digit",
|
|
771
|
+
hourCycle: "h23"
|
|
772
|
+
},
|
|
773
|
+
s
|
|
774
|
+
) : l("earlier", { day: "numeric", month: "long", year: "numeric" }, s);
|
|
775
|
+
},
|
|
776
|
+
exact(m) {
|
|
777
|
+
const s = V(m);
|
|
778
|
+
return s === null ? "" : l("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, s);
|
|
779
|
+
},
|
|
780
|
+
iso(m) {
|
|
781
|
+
const s = V(m);
|
|
782
|
+
return s === null ? "" : s.toISOString();
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
function ft() {
|
|
787
|
+
const e = z(N, null);
|
|
788
|
+
return dt(e ?? mt());
|
|
789
|
+
}
|
|
790
|
+
let W = null;
|
|
791
|
+
function mt() {
|
|
792
|
+
return W === null && (W = X(), W.defaults("webx-admin", ne)), W;
|
|
793
|
+
}
|
|
794
|
+
function V(e) {
|
|
795
|
+
if (e == null || e === "")
|
|
796
|
+
return null;
|
|
797
|
+
const t = e instanceof Date ? e : new Date(e);
|
|
798
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
799
|
+
}
|
|
800
|
+
function ht(e, t) {
|
|
801
|
+
const n = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate());
|
|
802
|
+
return Math.round((n(e) - n(t)) / 864e5);
|
|
803
|
+
}
|
|
804
|
+
function vt(e, t, n) {
|
|
805
|
+
const l = e instanceof B ? e.status : wt(e);
|
|
806
|
+
if (l === 422)
|
|
807
|
+
return gt(e) ?? n ?? t("errors.unknown");
|
|
808
|
+
if (l === 401) return t("errors.signed-out");
|
|
809
|
+
if (l === 403) return t("errors.forbidden");
|
|
810
|
+
if (l === 404) return t("errors.gone");
|
|
811
|
+
if (l === 409) return t("errors.conflict");
|
|
812
|
+
if (l === 429) {
|
|
813
|
+
const u = e instanceof B ? e.retryAfter : null;
|
|
814
|
+
return u === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: u });
|
|
815
|
+
}
|
|
816
|
+
return l !== null && l >= 500 ? t("errors.server") : l === null ? t("errors.offline") : n ?? t("errors.unknown");
|
|
817
|
+
}
|
|
818
|
+
function Tt() {
|
|
819
|
+
const e = R("webx-admin");
|
|
820
|
+
return (t, n) => vt(t, e, n);
|
|
821
|
+
}
|
|
822
|
+
function wt(e) {
|
|
823
|
+
const t = e?.status;
|
|
824
|
+
return typeof t == "number" ? t : null;
|
|
825
|
+
}
|
|
826
|
+
function gt(e) {
|
|
827
|
+
const n = e?.body?.message;
|
|
828
|
+
return typeof n == "string" && n !== "" ? n : null;
|
|
829
|
+
}
|
|
830
|
+
const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
|
|
576
831
|
__name: "Screen",
|
|
577
|
-
props: /* @__PURE__ */
|
|
832
|
+
props: /* @__PURE__ */ j({
|
|
578
833
|
name: {},
|
|
579
834
|
errors: { default: void 0 },
|
|
580
835
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -585,39 +840,39 @@ const Oe = { class: "wx-screen-host" }, Fe = /* @__PURE__ */ M({
|
|
|
585
840
|
modelValue: { default: () => ({}) },
|
|
586
841
|
modelModifiers: {}
|
|
587
842
|
}),
|
|
588
|
-
emits: /* @__PURE__ */
|
|
589
|
-
setup(e, { expose:
|
|
590
|
-
const
|
|
591
|
-
async function
|
|
592
|
-
i.value = null,
|
|
843
|
+
emits: /* @__PURE__ */ j(["loaded"], ["update:modelValue"]),
|
|
844
|
+
setup(e, { expose: t, emit: n }) {
|
|
845
|
+
const l = e, u = n, m = Z(e, "modelValue"), s = H(), c = R("webx-admin"), i = D(null), r = D(null);
|
|
846
|
+
async function a() {
|
|
847
|
+
i.value = null, r.value = null;
|
|
593
848
|
try {
|
|
594
|
-
const
|
|
595
|
-
i.value =
|
|
596
|
-
} catch (
|
|
597
|
-
|
|
849
|
+
const o = await s.loadScreen(l.name);
|
|
850
|
+
i.value = o, u("loaded", o);
|
|
851
|
+
} catch (o) {
|
|
852
|
+
r.value = o instanceof Error ? o.message : String(o);
|
|
598
853
|
}
|
|
599
854
|
}
|
|
600
|
-
return
|
|
601
|
-
|
|
602
|
-
}, { immediate: !0 }),
|
|
603
|
-
|
|
855
|
+
return he([() => l.name, () => s.i18n.state.locale], () => {
|
|
856
|
+
a();
|
|
857
|
+
}, { immediate: !0 }), t({ reload: a }), (o, h) => (v(), p("div", yt, [
|
|
858
|
+
r.value ? (v(), b(f(Ce), {
|
|
604
859
|
key: 0,
|
|
605
860
|
type: "danger",
|
|
606
|
-
title:
|
|
607
|
-
description:
|
|
608
|
-
}, null, 8, ["title", "description"])) : i.value === null ? (
|
|
861
|
+
title: f(c)("shell.error-title"),
|
|
862
|
+
description: r.value
|
|
863
|
+
}, null, 8, ["title", "description"])) : i.value === null ? (v(), b(f(Ee), {
|
|
609
864
|
key: 1,
|
|
610
865
|
rows: 4
|
|
611
|
-
})) : (
|
|
866
|
+
})) : (v(), b(f(Pe), {
|
|
612
867
|
key: 2,
|
|
613
868
|
modelValue: m.value,
|
|
614
|
-
"onUpdate:modelValue":
|
|
869
|
+
"onUpdate:modelValue": h[0] || (h[0] = (d) => m.value = d),
|
|
615
870
|
root: i.value,
|
|
616
|
-
patch:
|
|
617
|
-
types:
|
|
871
|
+
patch: f(s).screenPatch(e.name),
|
|
872
|
+
types: f(s).types,
|
|
618
873
|
errors: e.errors,
|
|
619
|
-
translate:
|
|
620
|
-
can:
|
|
874
|
+
translate: f(s).i18n.t,
|
|
875
|
+
can: f(s).can,
|
|
621
876
|
disabled: e.disabled,
|
|
622
877
|
"label-position": e.labelPosition,
|
|
623
878
|
"label-width": e.labelWidth,
|
|
@@ -625,24 +880,121 @@ const Oe = { class: "wx-screen-host" }, Fe = /* @__PURE__ */ M({
|
|
|
625
880
|
}, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
|
|
626
881
|
]));
|
|
627
882
|
}
|
|
883
|
+
}), pt = {
|
|
884
|
+
key: 0,
|
|
885
|
+
class: "wx-dropdown__divider"
|
|
886
|
+
}, Et = /* @__PURE__ */ A({
|
|
887
|
+
__name: "RowMenu",
|
|
888
|
+
props: {
|
|
889
|
+
actions: {},
|
|
890
|
+
label: { default: void 0 },
|
|
891
|
+
size: { default: "sm" }
|
|
892
|
+
},
|
|
893
|
+
setup(e) {
|
|
894
|
+
const t = e, n = k(() => [
|
|
895
|
+
...t.actions.filter((u) => !u.danger),
|
|
896
|
+
...t.actions.filter((u) => u.danger)
|
|
897
|
+
]), l = k(() => {
|
|
898
|
+
const u = n.value.find((m) => m.danger);
|
|
899
|
+
return u && n.value[0] !== u ? u.key : null;
|
|
900
|
+
});
|
|
901
|
+
return (u, m) => n.value.length > 0 ? (v(), b(f(Le), {
|
|
902
|
+
key: 0,
|
|
903
|
+
collapse: "always",
|
|
904
|
+
align: "end",
|
|
905
|
+
size: e.size,
|
|
906
|
+
"aria-label": e.label,
|
|
907
|
+
onClick: m[0] || (m[0] = ve(() => {
|
|
908
|
+
}, ["stop"]))
|
|
909
|
+
}, {
|
|
910
|
+
collapsed: g(() => [
|
|
911
|
+
(v(!0), p(L, null, M(n.value, (s) => (v(), p(L, {
|
|
912
|
+
key: s.key
|
|
913
|
+
}, [
|
|
914
|
+
s.key === l.value ? (v(), p("hr", pt)) : T("", !0),
|
|
915
|
+
S(f(Ae), {
|
|
916
|
+
icon: s.icon,
|
|
917
|
+
tone: s.danger ? "danger" : "default",
|
|
918
|
+
href: s.href,
|
|
919
|
+
target: s.href ? s.target ?? "_blank" : void 0,
|
|
920
|
+
disabled: s.disabled,
|
|
921
|
+
onClick: (c) => s.run?.()
|
|
922
|
+
}, {
|
|
923
|
+
default: g(() => [
|
|
924
|
+
C(E(s.label), 1)
|
|
925
|
+
]),
|
|
926
|
+
_: 2
|
|
927
|
+
}, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
|
|
928
|
+
], 64))), 128))
|
|
929
|
+
]),
|
|
930
|
+
_: 1
|
|
931
|
+
}, 8, ["size", "aria-label"])) : T("", !0);
|
|
932
|
+
}
|
|
933
|
+
}), Lt = /* @__PURE__ */ A({
|
|
934
|
+
name: "WxDate",
|
|
935
|
+
__name: "DateText",
|
|
936
|
+
props: {
|
|
937
|
+
value: {},
|
|
938
|
+
size: { default: "sm" },
|
|
939
|
+
tone: { default: "muted" }
|
|
940
|
+
},
|
|
941
|
+
setup(e) {
|
|
942
|
+
const t = e, n = ft(), l = k(() => n.short(t.value)), u = k(() => n.exact(t.value)), m = k(() => n.iso(t.value));
|
|
943
|
+
return (s, c) => u.value ? (v(), b(f(Ue), {
|
|
944
|
+
key: 0,
|
|
945
|
+
content: u.value
|
|
946
|
+
}, {
|
|
947
|
+
default: g(() => [
|
|
948
|
+
S(f(J), {
|
|
949
|
+
as: "time",
|
|
950
|
+
datetime: m.value,
|
|
951
|
+
size: e.size,
|
|
952
|
+
tone: e.tone
|
|
953
|
+
}, {
|
|
954
|
+
default: g(() => [
|
|
955
|
+
C(E(l.value), 1)
|
|
956
|
+
]),
|
|
957
|
+
_: 1
|
|
958
|
+
}, 8, ["datetime", "size", "tone"])
|
|
959
|
+
]),
|
|
960
|
+
_: 1
|
|
961
|
+
}, 8, ["content"])) : (v(), b(f(J), {
|
|
962
|
+
key: 1,
|
|
963
|
+
size: e.size,
|
|
964
|
+
tone: e.tone
|
|
965
|
+
}, {
|
|
966
|
+
default: g(() => [
|
|
967
|
+
C(E(l.value), 1)
|
|
968
|
+
]),
|
|
969
|
+
_: 1
|
|
970
|
+
}, 8, ["size", "tone"]));
|
|
971
|
+
}
|
|
628
972
|
});
|
|
629
973
|
export {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
974
|
+
Be as AdminNav,
|
|
975
|
+
et as AdminShell,
|
|
976
|
+
B as HttpError,
|
|
977
|
+
Lt as WxDate,
|
|
978
|
+
Ne as WxListScreen,
|
|
979
|
+
Et as WxRowMenu,
|
|
980
|
+
Ct as WxScreen,
|
|
981
|
+
te as adminKey,
|
|
982
|
+
ne as adminMessages,
|
|
983
|
+
Re as adminTypes,
|
|
984
|
+
$t as createAdmin,
|
|
985
|
+
Ie as createAdminContext,
|
|
986
|
+
dt as createDates,
|
|
987
|
+
nt as createHttp,
|
|
639
988
|
X as createI18n,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
989
|
+
vt as errorText,
|
|
990
|
+
N as i18nKey,
|
|
991
|
+
Ve as provideAdmin,
|
|
992
|
+
je as provideI18n,
|
|
993
|
+
Q as readCookie,
|
|
994
|
+
H as useAdmin,
|
|
995
|
+
ft as useDates,
|
|
996
|
+
Tt as useErrorText,
|
|
997
|
+
St as useI18n,
|
|
998
|
+
R as useTranslate
|
|
647
999
|
};
|
|
648
1000
|
//# sourceMappingURL=index.js.map
|