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