@webx-ui/module-auth 0.5.4 → 0.6.1
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/ProfileDialog.d.ts +20 -0
- package/dist/UserMenu.d.ts +13 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +643 -456
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +26 -2
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { useTranslate as
|
|
3
|
-
import { useModal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const a =
|
|
1
|
+
import { inject as te, defineComponent as R, computed as P, ref as g, useTemplateRef as oe, onBeforeUnmount as ze, resolveComponent as B, openBlock as L, createBlock as S, withCtx as l, createVNode as t, withModifiers as Be, createCommentVNode as T, createElementVNode as N, createTextVNode as F, toDisplayString as $, watch as Z, unref as e, isRef as se, createElementBlock as O, resolveDynamicComponent as ge, createSlots as ne, Fragment as le, renderList as _e, h as xe, normalizeClass as Te } from "vue";
|
|
2
|
+
import { useTranslate as I, HttpError as Me, useAdmin as q, useI18n as ke, useErrorText as re, WxDate as Ne, WxRowMenu as he, WxListScreen as Ee } from "@webx-ui/module-admin";
|
|
3
|
+
import { useModal as ie, WxDialog as ue, WxFormItem as M, WxInput as E, WxSelect as X, WxSpace as Y, WxCheckbox as be, WxText as de, WxButton as D, toast as j, WxTable as Oe, WxBadge as ae, WxAvatar as De, createModal as ce, confirm as Re } from "@webx-ui/core";
|
|
4
|
+
const Ve = /* @__PURE__ */ Symbol("webx-auth");
|
|
5
|
+
function me() {
|
|
6
|
+
const a = te(Ve, null);
|
|
7
7
|
if (a === null)
|
|
8
8
|
throw new Error("useAuth() was called outside a panel that installed the auth plugin.");
|
|
9
9
|
return a;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Ie(a) {
|
|
12
12
|
const i = `${a.apiPath}/auth`;
|
|
13
13
|
return {
|
|
14
14
|
async me() {
|
|
15
15
|
try {
|
|
16
16
|
return (await a.http.get(`${i}/me`)).data;
|
|
17
|
-
} catch (
|
|
18
|
-
if (
|
|
17
|
+
} catch (s) {
|
|
18
|
+
if (Ye(s))
|
|
19
19
|
return null;
|
|
20
|
-
throw
|
|
20
|
+
throw s;
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
async login(
|
|
24
|
-
const
|
|
25
|
-
email:
|
|
26
|
-
password:
|
|
27
|
-
remember:
|
|
23
|
+
async login(s) {
|
|
24
|
+
const o = await a.http.post(`${i}/login`, {
|
|
25
|
+
email: s.email,
|
|
26
|
+
password: s.password,
|
|
27
|
+
remember: s.remember ?? !1
|
|
28
28
|
});
|
|
29
|
-
return a.setUser(
|
|
29
|
+
return a.setUser(o.data), await a.reload(), o.data;
|
|
30
30
|
},
|
|
31
|
-
async setLocale(
|
|
32
|
-
const
|
|
33
|
-
a.setUser(
|
|
31
|
+
async setLocale(s) {
|
|
32
|
+
const o = await a.http.put(`${i}/locale`, { locale: s });
|
|
33
|
+
a.setUser(o.data), await a.setLocale(s);
|
|
34
|
+
},
|
|
35
|
+
async updateProfile(s) {
|
|
36
|
+
const o = await a.http.put(
|
|
37
|
+
`${i}/me`,
|
|
38
|
+
s
|
|
39
|
+
);
|
|
40
|
+
return a.setUser(o.data), o.data;
|
|
34
41
|
},
|
|
35
42
|
async logout() {
|
|
36
43
|
try {
|
|
@@ -41,14 +48,14 @@ function Re(a) {
|
|
|
41
48
|
}
|
|
42
49
|
};
|
|
43
50
|
}
|
|
44
|
-
const
|
|
45
|
-
function
|
|
46
|
-
a.provide(
|
|
51
|
+
const Ae = /* @__PURE__ */ Symbol("webx-auth-avatar"), Le = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
|
|
52
|
+
function Ke(a, i, s = null, o = null) {
|
|
53
|
+
a.provide(Ve, i), a.provide(Ae, s), a.provide(Le, o);
|
|
47
54
|
}
|
|
48
|
-
function
|
|
55
|
+
function Ye(a) {
|
|
49
56
|
return typeof a == "object" && a !== null && "status" in a && a.status === 401;
|
|
50
57
|
}
|
|
51
|
-
const
|
|
58
|
+
const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
|
|
52
59
|
__name: "LoginCard",
|
|
53
60
|
props: {
|
|
54
61
|
emailLabel: { default: void 0 },
|
|
@@ -63,171 +70,171 @@ const Ke = ["title", "aria-label", "aria-pressed"], je = /* @__PURE__ */ O({
|
|
|
63
70
|
autofocus: { type: Boolean, default: !0 }
|
|
64
71
|
},
|
|
65
72
|
emits: ["success"],
|
|
66
|
-
setup(a, { expose: i, emit:
|
|
67
|
-
const
|
|
68
|
-
email:
|
|
69
|
-
password:
|
|
70
|
-
remember:
|
|
71
|
-
submit:
|
|
72
|
-
capsLock:
|
|
73
|
-
reveal:
|
|
74
|
-
hide:
|
|
75
|
-
})), p = g(""),
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
() =>
|
|
73
|
+
setup(a, { expose: i, emit: s }) {
|
|
74
|
+
const o = a, u = s, k = me(), m = I("webx-auth"), n = P(() => ({
|
|
75
|
+
email: o.emailLabel ?? m("card.email"),
|
|
76
|
+
password: o.passwordLabel ?? m("card.password"),
|
|
77
|
+
remember: o.rememberLabel ?? m("card.remember"),
|
|
78
|
+
submit: o.submitLabel ?? m("card.submit"),
|
|
79
|
+
capsLock: o.capsLockWarning ?? m("card.caps-lock"),
|
|
80
|
+
reveal: o.revealLabel ?? m("card.reveal"),
|
|
81
|
+
hide: o.hideLabel ?? m("card.hide")
|
|
82
|
+
})), p = g(""), C = g(""), V = g(!1), d = g(!1), w = g(!1), r = g(!1), b = g(""), _ = g({}), f = g(0), U = oe("emailField");
|
|
83
|
+
let W = null;
|
|
84
|
+
ze(H);
|
|
85
|
+
const z = P(() => f.value > 0), h = P(
|
|
86
|
+
() => o.throttleMessage === void 0 ? m("card.throttled", { seconds: f.value }) : o.throttleMessage.replace(":seconds", String(f.value))
|
|
80
87
|
);
|
|
81
|
-
async function
|
|
82
|
-
if (!(
|
|
83
|
-
|
|
88
|
+
async function c() {
|
|
89
|
+
if (!(d.value || z.value)) {
|
|
90
|
+
d.value = !0, b.value = "", _.value = {};
|
|
84
91
|
try {
|
|
85
|
-
await
|
|
92
|
+
await k.login({
|
|
86
93
|
email: p.value,
|
|
87
|
-
password:
|
|
94
|
+
password: C.value,
|
|
88
95
|
remember: V.value
|
|
89
|
-
}),
|
|
90
|
-
} catch (
|
|
91
|
-
|
|
96
|
+
}), C.value = "", u("success");
|
|
97
|
+
} catch (y) {
|
|
98
|
+
x(y);
|
|
92
99
|
} finally {
|
|
93
|
-
|
|
100
|
+
d.value = !1;
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
|
-
function
|
|
98
|
-
if (!(
|
|
99
|
-
|
|
104
|
+
function x(y) {
|
|
105
|
+
if (!(y instanceof Me)) {
|
|
106
|
+
b.value = y instanceof Error ? y.message : String(y);
|
|
100
107
|
return;
|
|
101
108
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
109
|
+
if (y.isValidation) {
|
|
110
|
+
_.value = y.errors;
|
|
104
111
|
return;
|
|
105
112
|
}
|
|
106
|
-
if (
|
|
107
|
-
|
|
113
|
+
if (y.isThrottled) {
|
|
114
|
+
Q(y.retryAfter ?? 60);
|
|
108
115
|
return;
|
|
109
116
|
}
|
|
110
|
-
|
|
117
|
+
b.value = y.message;
|
|
111
118
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
function Q(y) {
|
|
120
|
+
H(), f.value = y, W = setInterval(() => {
|
|
121
|
+
f.value -= 1, f.value <= 0 && H();
|
|
115
122
|
}, 1e3);
|
|
116
123
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
124
|
+
function H() {
|
|
125
|
+
W !== null && (clearInterval(W), W = null), f.value = 0;
|
|
119
126
|
}
|
|
120
|
-
function y
|
|
121
|
-
|
|
127
|
+
function A(y) {
|
|
128
|
+
r.value = y.getModifierState("CapsLock");
|
|
122
129
|
}
|
|
123
|
-
return i({ focus: () =>
|
|
124
|
-
const
|
|
125
|
-
return
|
|
130
|
+
return i({ focus: () => U.value?.focus() }), (y, v) => {
|
|
131
|
+
const G = B("wx-alert"), ee = B("wx-icon"), fe = B("wx-input"), we = B("wx-form-item"), Fe = B("wx-checkbox"), Se = B("wx-button"), We = B("wx-form"), Pe = B("wx-card");
|
|
132
|
+
return L(), S(Pe, {
|
|
126
133
|
class: "wx-login",
|
|
127
134
|
padding: 24
|
|
128
135
|
}, {
|
|
129
136
|
default: l(() => [
|
|
130
|
-
|
|
131
|
-
errors:
|
|
132
|
-
disabled:
|
|
137
|
+
t(We, {
|
|
138
|
+
errors: _.value,
|
|
139
|
+
disabled: d.value,
|
|
133
140
|
gap: "md",
|
|
134
|
-
onSubmit:
|
|
141
|
+
onSubmit: Be(c, ["prevent"])
|
|
135
142
|
}, {
|
|
136
143
|
default: l(() => [
|
|
137
|
-
|
|
144
|
+
b.value !== "" ? (L(), S(G, {
|
|
138
145
|
key: 0,
|
|
139
146
|
type: "danger",
|
|
140
147
|
variant: "soft",
|
|
141
148
|
live: "",
|
|
142
|
-
description:
|
|
149
|
+
description: b.value,
|
|
143
150
|
class: "wx-login__message"
|
|
144
|
-
}, null, 8, ["description"])) :
|
|
151
|
+
}, null, 8, ["description"])) : z.value ? (L(), S(G, {
|
|
145
152
|
key: 1,
|
|
146
153
|
type: "warning",
|
|
147
154
|
variant: "soft",
|
|
148
155
|
live: "",
|
|
149
|
-
description:
|
|
156
|
+
description: h.value,
|
|
150
157
|
class: "wx-login__message"
|
|
151
|
-
}, null, 8, ["description"])) :
|
|
152
|
-
|
|
158
|
+
}, null, 8, ["description"])) : T("", !0),
|
|
159
|
+
t(we, { name: "email" }, {
|
|
153
160
|
default: l(() => [
|
|
154
|
-
|
|
161
|
+
t(fe, {
|
|
155
162
|
ref_key: "emailField",
|
|
156
|
-
ref:
|
|
163
|
+
ref: U,
|
|
157
164
|
modelValue: p.value,
|
|
158
|
-
"onUpdate:modelValue":
|
|
165
|
+
"onUpdate:modelValue": v[0] || (v[0] = (K) => p.value = K),
|
|
159
166
|
type: "email",
|
|
160
|
-
placeholder:
|
|
161
|
-
"aria-label":
|
|
167
|
+
placeholder: n.value.email,
|
|
168
|
+
"aria-label": n.value.email,
|
|
162
169
|
autocomplete: "username",
|
|
163
170
|
autofocus: a.autofocus,
|
|
164
171
|
inputmode: "email",
|
|
165
172
|
size: "lg"
|
|
166
173
|
}, {
|
|
167
174
|
prefix: l(() => [
|
|
168
|
-
|
|
175
|
+
t(ee, { name: "mail" })
|
|
169
176
|
]),
|
|
170
177
|
_: 1
|
|
171
178
|
}, 8, ["modelValue", "placeholder", "aria-label", "autofocus"])
|
|
172
179
|
]),
|
|
173
180
|
_: 1
|
|
174
181
|
}),
|
|
175
|
-
|
|
182
|
+
t(we, {
|
|
176
183
|
name: "password",
|
|
177
|
-
help:
|
|
184
|
+
help: r.value ? n.value.capsLock : void 0
|
|
178
185
|
}, {
|
|
179
186
|
default: l(() => [
|
|
180
|
-
|
|
181
|
-
modelValue:
|
|
182
|
-
"onUpdate:modelValue":
|
|
183
|
-
type:
|
|
184
|
-
placeholder:
|
|
185
|
-
"aria-label":
|
|
187
|
+
t(fe, {
|
|
188
|
+
modelValue: C.value,
|
|
189
|
+
"onUpdate:modelValue": v[2] || (v[2] = (K) => C.value = K),
|
|
190
|
+
type: w.value ? "text" : "password",
|
|
191
|
+
placeholder: n.value.password,
|
|
192
|
+
"aria-label": n.value.password,
|
|
186
193
|
autocomplete: "current-password",
|
|
187
194
|
size: "lg",
|
|
188
|
-
onKeydown:
|
|
189
|
-
onKeyup:
|
|
195
|
+
onKeydown: A,
|
|
196
|
+
onKeyup: A
|
|
190
197
|
}, {
|
|
191
198
|
prefix: l(() => [
|
|
192
|
-
|
|
199
|
+
t(ee, { name: "lock" })
|
|
193
200
|
]),
|
|
194
201
|
suffix: l(() => [
|
|
195
|
-
|
|
202
|
+
N("button", {
|
|
196
203
|
type: "button",
|
|
197
204
|
class: "wx-login__reveal",
|
|
198
|
-
title:
|
|
199
|
-
"aria-label":
|
|
200
|
-
"aria-pressed":
|
|
205
|
+
title: w.value ? n.value.hide : n.value.reveal,
|
|
206
|
+
"aria-label": w.value ? n.value.hide : n.value.reveal,
|
|
207
|
+
"aria-pressed": w.value,
|
|
201
208
|
tabindex: "-1",
|
|
202
|
-
onClick:
|
|
209
|
+
onClick: v[1] || (v[1] = (K) => w.value = !w.value)
|
|
203
210
|
}, [
|
|
204
|
-
|
|
205
|
-
name:
|
|
211
|
+
t(ee, {
|
|
212
|
+
name: w.value ? "eye-off" : "eye"
|
|
206
213
|
}, null, 8, ["name"])
|
|
207
|
-
], 8,
|
|
214
|
+
], 8, je)
|
|
208
215
|
]),
|
|
209
216
|
_: 1
|
|
210
217
|
}, 8, ["modelValue", "type", "placeholder", "aria-label"])
|
|
211
218
|
]),
|
|
212
219
|
_: 1
|
|
213
220
|
}, 8, ["help"]),
|
|
214
|
-
a.remember ? (
|
|
221
|
+
a.remember ? (L(), S(Fe, {
|
|
215
222
|
key: 2,
|
|
216
223
|
modelValue: V.value,
|
|
217
|
-
"onUpdate:modelValue":
|
|
218
|
-
label:
|
|
224
|
+
"onUpdate:modelValue": v[3] || (v[3] = (K) => V.value = K),
|
|
225
|
+
label: n.value.remember,
|
|
219
226
|
class: "wx-login__remember"
|
|
220
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
221
|
-
|
|
227
|
+
}, null, 8, ["modelValue", "label"])) : T("", !0),
|
|
228
|
+
t(Se, {
|
|
222
229
|
type: "primary",
|
|
223
230
|
"native-type": "submit",
|
|
224
231
|
size: "lg",
|
|
225
232
|
block: "",
|
|
226
|
-
loading:
|
|
227
|
-
disabled:
|
|
233
|
+
loading: d.value,
|
|
234
|
+
disabled: z.value
|
|
228
235
|
}, {
|
|
229
236
|
default: l(() => [
|
|
230
|
-
|
|
237
|
+
F($(n.value.submit), 1)
|
|
231
238
|
]),
|
|
232
239
|
_: 1
|
|
233
240
|
}, 8, ["loading", "disabled"])
|
|
@@ -239,12 +246,12 @@ const Ke = ["title", "aria-label", "aria-pressed"], je = /* @__PURE__ */ O({
|
|
|
239
246
|
});
|
|
240
247
|
};
|
|
241
248
|
}
|
|
242
|
-
}),
|
|
243
|
-
const
|
|
244
|
-
for (const [
|
|
245
|
-
o
|
|
246
|
-
return
|
|
247
|
-
},
|
|
249
|
+
}), ve = (a, i) => {
|
|
250
|
+
const s = a.__vccOpts || a;
|
|
251
|
+
for (const [o, u] of i)
|
|
252
|
+
s[o] = u;
|
|
253
|
+
return s;
|
|
254
|
+
}, He = /* @__PURE__ */ ve(qe, [["__scopeId", "data-v-3c206e31"]]), $e = {
|
|
248
255
|
card: {
|
|
249
256
|
email: "Email",
|
|
250
257
|
password: "Password",
|
|
@@ -302,52 +309,67 @@ const Ke = ["title", "aria-label", "aria-pressed"], je = /* @__PURE__ */ O({
|
|
|
302
309
|
"not-yourself": "You cannot do that to your own account.",
|
|
303
310
|
"last-super": "There has to be one super administrator left."
|
|
304
311
|
},
|
|
312
|
+
// Somebody editing themselves, which is a shorter list than an administrator editing them.
|
|
313
|
+
profile: {
|
|
314
|
+
title: "Your profile",
|
|
315
|
+
menu: "Edit your profile",
|
|
316
|
+
name: "Name",
|
|
317
|
+
avatar: "Photo",
|
|
318
|
+
password: "New password",
|
|
319
|
+
"password-hint": "At least 12 characters. Leave blank to keep the current one.",
|
|
320
|
+
"current-password": "Current password",
|
|
321
|
+
"current-password-hint": "Asked for before the password is changed.",
|
|
322
|
+
"wrong-password": "That is not the current password.",
|
|
323
|
+
saved: "Your profile is saved.",
|
|
324
|
+
save: "Save",
|
|
325
|
+
cancel: "Cancel"
|
|
326
|
+
},
|
|
305
327
|
menu: {
|
|
306
328
|
"sign-out": "Sign out",
|
|
307
329
|
language: "Interface language"
|
|
308
330
|
}
|
|
309
331
|
};
|
|
310
|
-
function
|
|
311
|
-
const i = `${a.apiPath}/auth`,
|
|
332
|
+
function pe(a) {
|
|
333
|
+
const i = `${a.apiPath}/auth`, s = (o) => o.data;
|
|
312
334
|
return {
|
|
313
|
-
list: (
|
|
335
|
+
list: (o = {}) => a.http.get(`${i}/admins`, {
|
|
314
336
|
query: {
|
|
315
|
-
q:
|
|
316
|
-
role:
|
|
317
|
-
active:
|
|
318
|
-
sort:
|
|
319
|
-
page:
|
|
320
|
-
per_page:
|
|
337
|
+
q: o.q || void 0,
|
|
338
|
+
role: o.role ?? void 0,
|
|
339
|
+
active: o.active ?? void 0,
|
|
340
|
+
sort: o.sort,
|
|
341
|
+
page: o.page,
|
|
342
|
+
per_page: o.per_page
|
|
321
343
|
}
|
|
322
|
-
}).then((
|
|
323
|
-
get: (
|
|
324
|
-
create: (
|
|
325
|
-
update: (
|
|
326
|
-
remove: (
|
|
327
|
-
roles: () => a.http.get(`${i}/roles`).then(
|
|
344
|
+
}).then((u) => ({ ...u.meta, data: u.data })),
|
|
345
|
+
get: (o) => a.http.get(`${i}/admins/${o}`).then(s),
|
|
346
|
+
create: (o) => a.http.post(`${i}/admins`, o).then(s),
|
|
347
|
+
update: (o, u) => a.http.patch(`${i}/admins/${o}`, u).then(s),
|
|
348
|
+
remove: (o) => a.http.delete(`${i}/admins/${o}`),
|
|
349
|
+
roles: () => a.http.get(`${i}/roles`).then(s)
|
|
328
350
|
};
|
|
329
351
|
}
|
|
330
|
-
const
|
|
331
|
-
function
|
|
352
|
+
const ye = /* @__PURE__ */ new WeakSet();
|
|
353
|
+
function J() {
|
|
332
354
|
try {
|
|
333
|
-
const { i18n: a } =
|
|
334
|
-
|
|
355
|
+
const { i18n: a } = q();
|
|
356
|
+
ye.has(a) || (a.defaults("webx-auth", $e), ye.add(a));
|
|
335
357
|
} catch {
|
|
336
358
|
}
|
|
337
359
|
}
|
|
338
|
-
const
|
|
360
|
+
const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe = {
|
|
339
361
|
key: 0,
|
|
340
362
|
class: "wx-admin-form__aside"
|
|
341
|
-
},
|
|
363
|
+
}, Xe = { class: "wx-admin-form__fields" }, Ze = /* @__PURE__ */ R({
|
|
342
364
|
__name: "AdminDialog",
|
|
343
365
|
props: {
|
|
344
366
|
admin: { default: null },
|
|
345
367
|
avatarField: { default: void 0 }
|
|
346
368
|
},
|
|
347
369
|
setup(a) {
|
|
348
|
-
const i = a, { resolve:
|
|
349
|
-
|
|
350
|
-
const p =
|
|
370
|
+
const i = a, { resolve: s, dismiss: o, open: u } = ie(), k = q(), m = pe(k), n = ke();
|
|
371
|
+
J();
|
|
372
|
+
const p = I("webx-auth"), C = re(), V = g([]), d = g(!1), w = g({}), r = g({
|
|
351
373
|
name: "",
|
|
352
374
|
email: "",
|
|
353
375
|
password: "",
|
|
@@ -356,81 +378,81 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
356
378
|
is_super: !1,
|
|
357
379
|
locale: null,
|
|
358
380
|
roles: []
|
|
359
|
-
}),
|
|
360
|
-
get: () =>
|
|
361
|
-
set: (
|
|
362
|
-
|
|
381
|
+
}), b = P({
|
|
382
|
+
get: () => r.value.avatar ? { path: r.value.avatar } : null,
|
|
383
|
+
set: (h) => {
|
|
384
|
+
r.value.avatar = h?.path ?? null;
|
|
363
385
|
}
|
|
364
|
-
}),
|
|
386
|
+
}), _ = P(() => i.admin !== null), f = P(() => V.value.map((h) => ({ value: h.id, label: h.name }))), U = P(() => [
|
|
365
387
|
{ value: "auto", label: p("admins.locale-auto") },
|
|
366
|
-
...
|
|
388
|
+
...n.state.panelLocales.map((h) => ({ value: h.code, label: h.nativeName }))
|
|
367
389
|
]);
|
|
368
|
-
m.roles().then((
|
|
390
|
+
m.roles().then((h) => V.value = h), Z(
|
|
369
391
|
() => i.admin,
|
|
370
|
-
(
|
|
371
|
-
|
|
372
|
-
name:
|
|
373
|
-
email:
|
|
392
|
+
(h) => {
|
|
393
|
+
r.value = {
|
|
394
|
+
name: h?.name ?? "",
|
|
395
|
+
email: h?.email ?? "",
|
|
374
396
|
password: "",
|
|
375
|
-
avatar:
|
|
376
|
-
is_active:
|
|
377
|
-
is_super:
|
|
378
|
-
locale:
|
|
379
|
-
roles:
|
|
380
|
-
},
|
|
397
|
+
avatar: h?.avatar ?? null,
|
|
398
|
+
is_active: h?.is_active ?? !0,
|
|
399
|
+
is_super: h?.is_super ?? !1,
|
|
400
|
+
locale: h?.locale ?? "auto",
|
|
401
|
+
roles: h?.roles.map((c) => c.id) ?? []
|
|
402
|
+
}, w.value = {};
|
|
381
403
|
},
|
|
382
404
|
{ immediate: !0 }
|
|
383
405
|
);
|
|
384
|
-
function
|
|
385
|
-
return
|
|
406
|
+
function W(h) {
|
|
407
|
+
return w.value[h]?.[0];
|
|
386
408
|
}
|
|
387
|
-
async function
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
name:
|
|
391
|
-
email:
|
|
392
|
-
avatar:
|
|
393
|
-
is_active:
|
|
394
|
-
is_super:
|
|
395
|
-
locale:
|
|
396
|
-
roles:
|
|
409
|
+
async function z() {
|
|
410
|
+
d.value = !0, w.value = {};
|
|
411
|
+
const h = {
|
|
412
|
+
name: r.value.name,
|
|
413
|
+
email: r.value.email,
|
|
414
|
+
avatar: r.value.avatar,
|
|
415
|
+
is_active: r.value.is_active,
|
|
416
|
+
is_super: r.value.is_super,
|
|
417
|
+
locale: r.value.locale === "auto" ? null : r.value.locale,
|
|
418
|
+
roles: r.value.roles ?? []
|
|
397
419
|
};
|
|
398
|
-
|
|
420
|
+
r.value.password && (h.password = r.value.password);
|
|
399
421
|
try {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
} catch (
|
|
403
|
-
const
|
|
404
|
-
|
|
422
|
+
const c = i.admin ? await m.update(i.admin.id, h) : await m.create(h);
|
|
423
|
+
j.success(p(_.value ? "admins.updated" : "admins.created")), s(c);
|
|
424
|
+
} catch (c) {
|
|
425
|
+
const x = c.body;
|
|
426
|
+
x?.errors ? w.value = x.errors : j.danger(C(c));
|
|
405
427
|
} finally {
|
|
406
|
-
|
|
428
|
+
d.value = !1;
|
|
407
429
|
}
|
|
408
430
|
}
|
|
409
|
-
return (
|
|
410
|
-
open: e(
|
|
411
|
-
"onUpdate:open":
|
|
412
|
-
title:
|
|
431
|
+
return (h, c) => (L(), S(e(ue), {
|
|
432
|
+
open: e(u),
|
|
433
|
+
"onUpdate:open": c[9] || (c[9] = (x) => se(u) ? u.value = x : null),
|
|
434
|
+
title: _.value ? e(p)("admins.edit-short") : e(p)("admins.new-short"),
|
|
413
435
|
width: 720
|
|
414
436
|
}, {
|
|
415
437
|
footer: l(() => [
|
|
416
|
-
|
|
438
|
+
t(e(Y), { size: "sm" }, {
|
|
417
439
|
default: l(() => [
|
|
418
|
-
|
|
440
|
+
t(e(D), {
|
|
419
441
|
variant: "outline",
|
|
420
|
-
onClick:
|
|
442
|
+
onClick: c[8] || (c[8] = (x) => e(o)())
|
|
421
443
|
}, {
|
|
422
444
|
default: l(() => [
|
|
423
|
-
|
|
445
|
+
F($(e(p)("admins.cancel")), 1)
|
|
424
446
|
]),
|
|
425
447
|
_: 1
|
|
426
448
|
}),
|
|
427
|
-
|
|
449
|
+
t(e(D), {
|
|
428
450
|
type: "primary",
|
|
429
|
-
loading:
|
|
430
|
-
onClick:
|
|
451
|
+
loading: d.value,
|
|
452
|
+
onClick: z
|
|
431
453
|
}, {
|
|
432
454
|
default: l(() => [
|
|
433
|
-
|
|
455
|
+
F($(e(p)("admins.save")), 1)
|
|
434
456
|
]),
|
|
435
457
|
_: 1
|
|
436
458
|
}, 8, ["loading"])
|
|
@@ -439,39 +461,39 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
439
461
|
})
|
|
440
462
|
]),
|
|
441
463
|
default: l(() => [
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
a.avatarField ? (
|
|
445
|
-
(
|
|
446
|
-
modelValue:
|
|
447
|
-
"onUpdate:modelValue":
|
|
464
|
+
N("div", Ge, [
|
|
465
|
+
N("div", Je, [
|
|
466
|
+
a.avatarField ? (L(), O("div", Qe, [
|
|
467
|
+
(L(), S(ge(a.avatarField), {
|
|
468
|
+
modelValue: b.value,
|
|
469
|
+
"onUpdate:modelValue": c[0] || (c[0] = (x) => b.value = x),
|
|
448
470
|
label: e(p)("admins.avatar"),
|
|
449
471
|
aspect: "1/1",
|
|
450
472
|
captions: !1
|
|
451
473
|
}, null, 8, ["modelValue", "label"]))
|
|
452
|
-
])) :
|
|
453
|
-
|
|
454
|
-
|
|
474
|
+
])) : T("", !0),
|
|
475
|
+
N("div", Xe, [
|
|
476
|
+
t(e(M), {
|
|
455
477
|
label: e(p)("admins.name"),
|
|
456
|
-
error:
|
|
478
|
+
error: W("name")
|
|
457
479
|
}, {
|
|
458
480
|
default: l(() => [
|
|
459
|
-
|
|
460
|
-
modelValue:
|
|
461
|
-
"onUpdate:modelValue":
|
|
481
|
+
t(e(E), {
|
|
482
|
+
modelValue: r.value.name,
|
|
483
|
+
"onUpdate:modelValue": c[1] || (c[1] = (x) => r.value.name = x),
|
|
462
484
|
name: "name"
|
|
463
485
|
}, null, 8, ["modelValue"])
|
|
464
486
|
]),
|
|
465
487
|
_: 1
|
|
466
488
|
}, 8, ["label", "error"]),
|
|
467
|
-
|
|
489
|
+
t(e(M), {
|
|
468
490
|
label: e(p)("admins.email"),
|
|
469
|
-
error:
|
|
491
|
+
error: W("email")
|
|
470
492
|
}, {
|
|
471
493
|
default: l(() => [
|
|
472
|
-
|
|
473
|
-
modelValue:
|
|
474
|
-
"onUpdate:modelValue":
|
|
494
|
+
t(e(E), {
|
|
495
|
+
modelValue: r.value.email,
|
|
496
|
+
"onUpdate:modelValue": c[2] || (c[2] = (x) => r.value.email = x),
|
|
475
497
|
type: "email",
|
|
476
498
|
name: "email",
|
|
477
499
|
autocomplete: "off"
|
|
@@ -479,15 +501,15 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
479
501
|
]),
|
|
480
502
|
_: 1
|
|
481
503
|
}, 8, ["label", "error"]),
|
|
482
|
-
|
|
504
|
+
t(e(M), {
|
|
483
505
|
label: e(p)("admins.password"),
|
|
484
|
-
error:
|
|
485
|
-
help:
|
|
506
|
+
error: W("password"),
|
|
507
|
+
help: _.value ? e(p)("admins.password-keep") : e(p)("admins.password-hint")
|
|
486
508
|
}, {
|
|
487
509
|
default: l(() => [
|
|
488
|
-
|
|
489
|
-
modelValue:
|
|
490
|
-
"onUpdate:modelValue":
|
|
510
|
+
t(e(E), {
|
|
511
|
+
modelValue: r.value.password,
|
|
512
|
+
"onUpdate:modelValue": c[3] || (c[3] = (x) => r.value.password = x),
|
|
491
513
|
type: "password",
|
|
492
514
|
name: "password",
|
|
493
515
|
autocomplete: "new-password"
|
|
@@ -495,53 +517,53 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
495
517
|
]),
|
|
496
518
|
_: 1
|
|
497
519
|
}, 8, ["label", "error", "help"]),
|
|
498
|
-
|
|
520
|
+
t(e(M), {
|
|
499
521
|
label: e(p)("admins.roles"),
|
|
500
|
-
error:
|
|
522
|
+
error: W("roles")
|
|
501
523
|
}, {
|
|
502
524
|
default: l(() => [
|
|
503
|
-
|
|
504
|
-
modelValue:
|
|
505
|
-
"onUpdate:modelValue":
|
|
506
|
-
options:
|
|
525
|
+
t(e(X), {
|
|
526
|
+
modelValue: r.value.roles,
|
|
527
|
+
"onUpdate:modelValue": c[4] || (c[4] = (x) => r.value.roles = x),
|
|
528
|
+
options: f.value,
|
|
507
529
|
multiple: ""
|
|
508
530
|
}, null, 8, ["modelValue", "options"])
|
|
509
531
|
]),
|
|
510
532
|
_: 1
|
|
511
533
|
}, 8, ["label", "error"]),
|
|
512
|
-
|
|
534
|
+
t(e(M), {
|
|
513
535
|
label: e(p)("admins.locale")
|
|
514
536
|
}, {
|
|
515
537
|
default: l(() => [
|
|
516
|
-
|
|
517
|
-
modelValue:
|
|
518
|
-
"onUpdate:modelValue":
|
|
519
|
-
options:
|
|
538
|
+
t(e(X), {
|
|
539
|
+
modelValue: r.value.locale,
|
|
540
|
+
"onUpdate:modelValue": c[5] || (c[5] = (x) => r.value.locale = x),
|
|
541
|
+
options: U.value
|
|
520
542
|
}, null, 8, ["modelValue", "options"])
|
|
521
543
|
]),
|
|
522
544
|
_: 1
|
|
523
545
|
}, 8, ["label"]),
|
|
524
|
-
|
|
546
|
+
t(e(Y), { size: "md" }, {
|
|
525
547
|
default: l(() => [
|
|
526
|
-
|
|
527
|
-
modelValue:
|
|
528
|
-
"onUpdate:modelValue":
|
|
548
|
+
t(e(be), {
|
|
549
|
+
modelValue: r.value.is_active,
|
|
550
|
+
"onUpdate:modelValue": c[6] || (c[6] = (x) => r.value.is_active = x),
|
|
529
551
|
label: e(p)("admins.active")
|
|
530
552
|
}, null, 8, ["modelValue", "label"]),
|
|
531
|
-
|
|
532
|
-
modelValue:
|
|
533
|
-
"onUpdate:modelValue":
|
|
553
|
+
t(e(be), {
|
|
554
|
+
modelValue: r.value.is_super,
|
|
555
|
+
"onUpdate:modelValue": c[7] || (c[7] = (x) => r.value.is_super = x),
|
|
534
556
|
label: e(p)("admins.super")
|
|
535
557
|
}, null, 8, ["modelValue", "label"])
|
|
536
558
|
]),
|
|
537
559
|
_: 1
|
|
538
560
|
}),
|
|
539
|
-
|
|
561
|
+
t(e(de), {
|
|
540
562
|
size: "sm",
|
|
541
563
|
tone: "muted"
|
|
542
564
|
}, {
|
|
543
565
|
default: l(() => [
|
|
544
|
-
|
|
566
|
+
F($(e(p)("admins.super-hint")), 1)
|
|
545
567
|
]),
|
|
546
568
|
_: 1
|
|
547
569
|
})
|
|
@@ -552,7 +574,7 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
552
574
|
_: 1
|
|
553
575
|
}, 8, ["open", "title"]));
|
|
554
576
|
}
|
|
555
|
-
}),
|
|
577
|
+
}), ea = { class: "wx-admin-list" }, Ce = /* @__PURE__ */ R({
|
|
556
578
|
__name: "AdminList",
|
|
557
579
|
props: {
|
|
558
580
|
picking: { type: Boolean, default: !1 },
|
|
@@ -562,26 +584,26 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
562
584
|
resolveAvatar: { type: Function, default: void 0 }
|
|
563
585
|
},
|
|
564
586
|
emits: ["open", "chosen", "selection", "remove"],
|
|
565
|
-
setup(a, { expose: i, emit:
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
const
|
|
569
|
-
let
|
|
570
|
-
const
|
|
571
|
-
{ value: "all", label:
|
|
572
|
-
...
|
|
573
|
-
]),
|
|
574
|
-
{ value: "any", label:
|
|
575
|
-
{ value: "yes", label:
|
|
576
|
-
{ value: "no", label:
|
|
577
|
-
]),
|
|
578
|
-
{ key: "name", label:
|
|
579
|
-
{ key: "email", label:
|
|
580
|
-
{ key: "roles", label:
|
|
581
|
-
{ key: "is_active", label:
|
|
587
|
+
setup(a, { expose: i, emit: s }) {
|
|
588
|
+
const o = a, u = s, k = q(), m = pe(k);
|
|
589
|
+
J();
|
|
590
|
+
const n = I("webx-auth"), p = g(null), C = g([]), V = g(!1), d = g("all"), w = g("any"), r = g([]), b = g({});
|
|
591
|
+
let _ = { page: 1, perPage: 20, sort: null, search: "" };
|
|
592
|
+
const f = P(() => [
|
|
593
|
+
{ value: "all", label: n("admins.all-roles") },
|
|
594
|
+
...C.value.map((A) => ({ value: A.slug, label: A.name }))
|
|
595
|
+
]), U = P(() => [
|
|
596
|
+
{ value: "any", label: n("admins.any-state") },
|
|
597
|
+
{ value: "yes", label: n("admins.only-active") },
|
|
598
|
+
{ value: "no", label: n("admins.only-inactive") }
|
|
599
|
+
]), W = P(() => [
|
|
600
|
+
{ key: "name", label: n("admins.name"), sortable: !0 },
|
|
601
|
+
{ key: "email", label: n("admins.email"), sortable: !0, hideBelow: 560 },
|
|
602
|
+
{ key: "roles", label: n("admins.roles"), hideBelow: 760 },
|
|
603
|
+
{ key: "is_active", label: n("admins.active"), align: "center", hideBelow: 660 },
|
|
582
604
|
{
|
|
583
605
|
key: "last_login_at",
|
|
584
|
-
label:
|
|
606
|
+
label: n("admins.last-login"),
|
|
585
607
|
sortable: !0,
|
|
586
608
|
hideBelow: 900,
|
|
587
609
|
// The first thing to go when a row becomes a card: it is a date somebody scans down a
|
|
@@ -593,156 +615,156 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
593
615
|
label: "",
|
|
594
616
|
width: 56,
|
|
595
617
|
align: "right",
|
|
596
|
-
hidden: !
|
|
618
|
+
hidden: !o.removable,
|
|
597
619
|
// A card puts them along its top instead, through the `card-actions` slot.
|
|
598
620
|
hideOnCards: !0
|
|
599
621
|
}
|
|
600
622
|
]);
|
|
601
|
-
m.roles().then((
|
|
602
|
-
async function
|
|
603
|
-
|
|
623
|
+
m.roles().then((A) => C.value = A), Z([d, w], () => z(_));
|
|
624
|
+
async function z(A) {
|
|
625
|
+
_ = A, V.value = !0;
|
|
604
626
|
try {
|
|
605
627
|
p.value = await m.list({
|
|
606
|
-
q:
|
|
607
|
-
role:
|
|
608
|
-
active:
|
|
609
|
-
sort:
|
|
610
|
-
page:
|
|
611
|
-
per_page:
|
|
612
|
-
}),
|
|
628
|
+
q: A.search,
|
|
629
|
+
role: d.value === "all" ? null : d.value,
|
|
630
|
+
active: w.value === "any" ? null : w.value,
|
|
631
|
+
sort: A.sort ? `${A.sort.order === "desc" ? "-" : ""}${A.sort.key}` : "name",
|
|
632
|
+
page: A.page,
|
|
633
|
+
per_page: A.perPage
|
|
634
|
+
}), h();
|
|
613
635
|
} finally {
|
|
614
636
|
V.value = !1;
|
|
615
637
|
}
|
|
616
638
|
}
|
|
617
|
-
async function
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
620
|
-
for (const
|
|
621
|
-
if (!
|
|
622
|
-
const
|
|
623
|
-
|
|
639
|
+
async function h() {
|
|
640
|
+
const A = o.resolveAvatar;
|
|
641
|
+
if (A)
|
|
642
|
+
for (const y of p.value?.data ?? []) {
|
|
643
|
+
if (!y.avatar || b.value[y.avatar]) continue;
|
|
644
|
+
const v = await A(y.avatar);
|
|
645
|
+
v && (b.value = { ...b.value, [y.avatar]: v });
|
|
624
646
|
}
|
|
625
647
|
}
|
|
626
|
-
function
|
|
648
|
+
function c(A) {
|
|
627
649
|
return [
|
|
628
650
|
{
|
|
629
651
|
key: "delete",
|
|
630
652
|
icon: "trash",
|
|
631
|
-
label:
|
|
653
|
+
label: n("admins.delete"),
|
|
632
654
|
danger: !0,
|
|
633
|
-
run: () =>
|
|
655
|
+
run: () => u("remove", A)
|
|
634
656
|
}
|
|
635
657
|
];
|
|
636
658
|
}
|
|
637
|
-
function
|
|
638
|
-
if (
|
|
639
|
-
|
|
659
|
+
function x(A) {
|
|
660
|
+
if (o.picking) {
|
|
661
|
+
u("chosen", [A]);
|
|
640
662
|
return;
|
|
641
663
|
}
|
|
642
|
-
|
|
664
|
+
u("open", A);
|
|
643
665
|
}
|
|
644
|
-
const
|
|
645
|
-
function
|
|
646
|
-
|
|
666
|
+
const Q = P(() => !(o.picking && o.multiple));
|
|
667
|
+
function H(A, y) {
|
|
668
|
+
r.value = y, u("selection", y);
|
|
647
669
|
}
|
|
648
|
-
return i({ reload: () =>
|
|
649
|
-
|
|
670
|
+
return i({ reload: () => z(_), chosen: () => r.value }), (A, y) => (L(), O("div", ea, [
|
|
671
|
+
t(e(Oe), {
|
|
650
672
|
data: p.value,
|
|
651
|
-
columns:
|
|
673
|
+
columns: W.value,
|
|
652
674
|
"row-key": "id",
|
|
653
675
|
searchable: "",
|
|
654
|
-
clickable:
|
|
655
|
-
hover:
|
|
676
|
+
clickable: Q.value,
|
|
677
|
+
hover: Q.value,
|
|
656
678
|
flush: "",
|
|
657
679
|
loading: V.value,
|
|
658
|
-
"search-placeholder": e(
|
|
659
|
-
"empty-text": e(
|
|
680
|
+
"search-placeholder": e(n)("admins.search"),
|
|
681
|
+
"empty-text": e(n)("admins.empty"),
|
|
660
682
|
selectable: a.picking && a.multiple,
|
|
661
|
-
onRowClick:
|
|
662
|
-
onStateChange:
|
|
663
|
-
onSelectionChange:
|
|
683
|
+
onRowClick: x,
|
|
684
|
+
onStateChange: z,
|
|
685
|
+
onSelectionChange: H
|
|
664
686
|
}, ne({
|
|
665
|
-
"cell-name": l(({ row:
|
|
666
|
-
|
|
687
|
+
"cell-name": l(({ row: v }) => [
|
|
688
|
+
t(e(Y), {
|
|
667
689
|
size: "sm",
|
|
668
690
|
align: "center"
|
|
669
691
|
}, {
|
|
670
692
|
default: l(() => [
|
|
671
|
-
|
|
672
|
-
name:
|
|
673
|
-
src:
|
|
693
|
+
t(e(De), {
|
|
694
|
+
name: v.name,
|
|
695
|
+
src: v.avatar ? b.value[v.avatar] : void 0,
|
|
674
696
|
size: "sm"
|
|
675
697
|
}, null, 8, ["name", "src"]),
|
|
676
|
-
|
|
677
|
-
|
|
698
|
+
N("span", null, $(v.name), 1),
|
|
699
|
+
v.is_super ? (L(), S(e(ae), {
|
|
678
700
|
key: 0,
|
|
679
701
|
type: "warning"
|
|
680
702
|
}, {
|
|
681
703
|
default: l(() => [
|
|
682
|
-
|
|
704
|
+
F($(e(n)("admins.super")), 1)
|
|
683
705
|
]),
|
|
684
706
|
_: 1
|
|
685
|
-
})) :
|
|
707
|
+
})) : T("", !0)
|
|
686
708
|
]),
|
|
687
709
|
_: 2
|
|
688
710
|
}, 1024)
|
|
689
711
|
]),
|
|
690
|
-
"cell-roles": l(({ row:
|
|
691
|
-
|
|
712
|
+
"cell-roles": l(({ row: v }) => [
|
|
713
|
+
v.roles.length > 0 ? (L(), S(e(Y), {
|
|
692
714
|
key: 0,
|
|
693
715
|
size: "xs",
|
|
694
716
|
wrap: ""
|
|
695
717
|
}, {
|
|
696
718
|
default: l(() => [
|
|
697
|
-
(
|
|
698
|
-
key:
|
|
719
|
+
(L(!0), O(le, null, _e(v.roles, (G) => (L(), S(e(ae), {
|
|
720
|
+
key: G.id
|
|
699
721
|
}, {
|
|
700
722
|
default: l(() => [
|
|
701
|
-
|
|
723
|
+
F($(G.name), 1)
|
|
702
724
|
]),
|
|
703
725
|
_: 2
|
|
704
726
|
}, 1024))), 128))
|
|
705
727
|
]),
|
|
706
728
|
_: 2
|
|
707
|
-
}, 1024)) : (
|
|
729
|
+
}, 1024)) : (L(), S(e(de), {
|
|
708
730
|
key: 1,
|
|
709
731
|
size: "sm",
|
|
710
732
|
tone: "muted"
|
|
711
733
|
}, {
|
|
712
734
|
default: l(() => [
|
|
713
|
-
|
|
735
|
+
F($(e(n)("admins.no-roles")), 1)
|
|
714
736
|
]),
|
|
715
737
|
_: 1
|
|
716
738
|
}))
|
|
717
739
|
]),
|
|
718
|
-
"cell-is_active": l(({ row:
|
|
719
|
-
|
|
720
|
-
type:
|
|
740
|
+
"cell-is_active": l(({ row: v }) => [
|
|
741
|
+
t(e(ae), {
|
|
742
|
+
type: v.is_active ? "success" : "default",
|
|
721
743
|
dot: ""
|
|
722
744
|
}, {
|
|
723
745
|
default: l(() => [
|
|
724
|
-
|
|
746
|
+
F($(v.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
|
|
725
747
|
]),
|
|
726
748
|
_: 2
|
|
727
749
|
}, 1032, ["type"])
|
|
728
750
|
]),
|
|
729
|
-
"card-actions": l(({ row:
|
|
730
|
-
a.removable ? (
|
|
751
|
+
"card-actions": l(({ row: v }) => [
|
|
752
|
+
a.removable ? (L(), S(e(he), {
|
|
731
753
|
key: 0,
|
|
732
|
-
actions: v
|
|
733
|
-
label:
|
|
734
|
-
}, null, 8, ["actions", "label"])) :
|
|
754
|
+
actions: c(v),
|
|
755
|
+
label: v.name
|
|
756
|
+
}, null, 8, ["actions", "label"])) : T("", !0)
|
|
735
757
|
]),
|
|
736
|
-
"cell-actions": l(({ row:
|
|
737
|
-
|
|
738
|
-
actions: v
|
|
739
|
-
label:
|
|
758
|
+
"cell-actions": l(({ row: v }) => [
|
|
759
|
+
t(e(he), {
|
|
760
|
+
actions: c(v),
|
|
761
|
+
label: v.name
|
|
740
762
|
}, null, 8, ["actions", "label"])
|
|
741
763
|
]),
|
|
742
|
-
"cell-last_login_at": l(({ row:
|
|
743
|
-
|
|
744
|
-
value:
|
|
745
|
-
tone:
|
|
764
|
+
"cell-last_login_at": l(({ row: v }) => [
|
|
765
|
+
t(e(Ne), {
|
|
766
|
+
value: v.last_login_at,
|
|
767
|
+
tone: v.last_login_at ? "default" : "muted"
|
|
746
768
|
}, null, 8, ["value", "tone"])
|
|
747
769
|
]),
|
|
748
770
|
_: 2
|
|
@@ -750,19 +772,19 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
750
772
|
a.filters ? {
|
|
751
773
|
name: "actions",
|
|
752
774
|
fn: l(() => [
|
|
753
|
-
|
|
775
|
+
t(e(Y), { size: "sm" }, {
|
|
754
776
|
default: l(() => [
|
|
755
|
-
|
|
756
|
-
modelValue:
|
|
757
|
-
"onUpdate:modelValue":
|
|
758
|
-
options:
|
|
777
|
+
t(e(X), {
|
|
778
|
+
modelValue: d.value,
|
|
779
|
+
"onUpdate:modelValue": y[0] || (y[0] = (v) => d.value = v),
|
|
780
|
+
options: f.value,
|
|
759
781
|
size: "sm",
|
|
760
782
|
style: { width: "180px" }
|
|
761
783
|
}, null, 8, ["modelValue", "options"]),
|
|
762
|
-
|
|
763
|
-
modelValue:
|
|
764
|
-
"onUpdate:modelValue":
|
|
765
|
-
options:
|
|
784
|
+
t(e(X), {
|
|
785
|
+
modelValue: w.value,
|
|
786
|
+
"onUpdate:modelValue": y[1] || (y[1] = (v) => w.value = v),
|
|
787
|
+
options: U.value,
|
|
766
788
|
size: "sm",
|
|
767
789
|
style: { width: "180px" }
|
|
768
790
|
}, null, 8, ["modelValue", "options"])
|
|
@@ -775,58 +797,58 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
775
797
|
]), 1032, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "selectable"])
|
|
776
798
|
]));
|
|
777
799
|
}
|
|
778
|
-
}),
|
|
800
|
+
}), aa = /* @__PURE__ */ R({
|
|
779
801
|
__name: "AdminsPage",
|
|
780
802
|
props: {
|
|
781
803
|
avatarField: { default: void 0 },
|
|
782
804
|
resolveAvatar: { type: Function, default: void 0 }
|
|
783
805
|
},
|
|
784
806
|
setup(a) {
|
|
785
|
-
const i = a,
|
|
786
|
-
|
|
787
|
-
const
|
|
788
|
-
() =>
|
|
807
|
+
const i = a, s = q(), o = pe(s);
|
|
808
|
+
J();
|
|
809
|
+
const u = I("webx-auth"), k = re(), m = oe("list"), n = g(null), p = ce(Ze), C = s.can("admins.manage"), V = P(
|
|
810
|
+
() => s.state.manifest?.modules.find((r) => r.id === "admins")?.title ?? u("admins.title")
|
|
789
811
|
);
|
|
790
|
-
async function
|
|
791
|
-
|
|
812
|
+
async function d(r) {
|
|
813
|
+
n.value = r, await p({ admin: r, avatarField: i.avatarField }) && m.value?.reload();
|
|
792
814
|
}
|
|
793
|
-
async function
|
|
794
|
-
if (await
|
|
795
|
-
title:
|
|
796
|
-
message:
|
|
797
|
-
confirmText:
|
|
798
|
-
cancelText:
|
|
815
|
+
async function w(r) {
|
|
816
|
+
if (await Re({
|
|
817
|
+
title: u("admins.delete-title", { name: r.name }),
|
|
818
|
+
message: u("admins.delete-text"),
|
|
819
|
+
confirmText: u("admins.delete"),
|
|
820
|
+
cancelText: u("admins.cancel"),
|
|
799
821
|
tone: "danger"
|
|
800
822
|
}))
|
|
801
823
|
try {
|
|
802
|
-
await
|
|
803
|
-
} catch (
|
|
804
|
-
|
|
824
|
+
await o.remove(r.id), j.success(u("admins.deleted")), m.value?.reload();
|
|
825
|
+
} catch (_) {
|
|
826
|
+
j.danger(k(_));
|
|
805
827
|
}
|
|
806
828
|
}
|
|
807
|
-
return (
|
|
829
|
+
return (r, b) => (L(), S(e(Ee), { title: V.value }, ne({
|
|
808
830
|
default: l(() => [
|
|
809
|
-
|
|
831
|
+
t(Ce, {
|
|
810
832
|
ref_key: "list",
|
|
811
833
|
ref: m,
|
|
812
|
-
removable: e(
|
|
834
|
+
removable: e(C),
|
|
813
835
|
"resolve-avatar": i.resolveAvatar,
|
|
814
|
-
onOpen:
|
|
815
|
-
onRemove:
|
|
836
|
+
onOpen: d,
|
|
837
|
+
onRemove: w
|
|
816
838
|
}, null, 8, ["removable", "resolve-avatar"])
|
|
817
839
|
]),
|
|
818
840
|
_: 2
|
|
819
841
|
}, [
|
|
820
|
-
e(
|
|
842
|
+
e(C) ? {
|
|
821
843
|
name: "actions",
|
|
822
844
|
fn: l(() => [
|
|
823
|
-
|
|
845
|
+
t(e(D), {
|
|
824
846
|
type: "primary",
|
|
825
847
|
icon: "add",
|
|
826
|
-
onClick:
|
|
848
|
+
onClick: b[0] || (b[0] = (_) => d(null))
|
|
827
849
|
}, {
|
|
828
850
|
default: l(() => [
|
|
829
|
-
|
|
851
|
+
F($(e(u)("admins.new-short")), 1)
|
|
830
852
|
]),
|
|
831
853
|
_: 1
|
|
832
854
|
})
|
|
@@ -836,7 +858,7 @@ const He = { class: "wx-admin-form" }, Ye = { class: "wx-admin-form__grid" }, Ge
|
|
|
836
858
|
]), 1032, ["title"]));
|
|
837
859
|
}
|
|
838
860
|
});
|
|
839
|
-
function
|
|
861
|
+
function fa(a = {}) {
|
|
840
862
|
const i = a.path ?? "/admins";
|
|
841
863
|
return {
|
|
842
864
|
id: "admins",
|
|
@@ -846,7 +868,7 @@ function sa(a = {}) {
|
|
|
846
868
|
path: i,
|
|
847
869
|
name: "webx.admins",
|
|
848
870
|
component: {
|
|
849
|
-
render: () =>
|
|
871
|
+
render: () => xe(aa, {
|
|
850
872
|
avatarField: a.avatarField,
|
|
851
873
|
resolveAvatar: a.resolveAvatar
|
|
852
874
|
})
|
|
@@ -855,7 +877,7 @@ function sa(a = {}) {
|
|
|
855
877
|
]
|
|
856
878
|
};
|
|
857
879
|
}
|
|
858
|
-
const
|
|
880
|
+
const ta = /* @__PURE__ */ R({
|
|
859
881
|
__name: "AdminPicker",
|
|
860
882
|
props: {
|
|
861
883
|
multiple: { type: Boolean, default: !1 },
|
|
@@ -863,30 +885,30 @@ const ea = /* @__PURE__ */ O({
|
|
|
863
885
|
resolveAvatar: { type: Function, default: void 0 }
|
|
864
886
|
},
|
|
865
887
|
setup(a) {
|
|
866
|
-
const i = a, { open:
|
|
867
|
-
|
|
868
|
-
const
|
|
888
|
+
const i = a, { open: s, resolve: o, dismiss: u } = ie();
|
|
889
|
+
J();
|
|
890
|
+
const k = I("webx-auth"), m = oe("list"), n = g(0);
|
|
869
891
|
function p(V) {
|
|
870
|
-
|
|
892
|
+
o(V);
|
|
871
893
|
}
|
|
872
|
-
function
|
|
873
|
-
|
|
894
|
+
function C(V) {
|
|
895
|
+
n.value = V.length;
|
|
874
896
|
}
|
|
875
|
-
return (V,
|
|
876
|
-
open: e(
|
|
877
|
-
"onUpdate:open":
|
|
878
|
-
title: a.title ?? e(
|
|
897
|
+
return (V, d) => (L(), S(e(ue), {
|
|
898
|
+
open: e(s),
|
|
899
|
+
"onUpdate:open": d[2] || (d[2] = (w) => se(s) ? s.value = w : null),
|
|
900
|
+
title: a.title ?? e(k)(a.multiple ? "admins.select-many" : "admins.select-one"),
|
|
879
901
|
width: 880
|
|
880
902
|
}, ne({
|
|
881
903
|
default: l(() => [
|
|
882
|
-
|
|
904
|
+
t(Ce, {
|
|
883
905
|
ref_key: "list",
|
|
884
906
|
ref: m,
|
|
885
907
|
picking: "",
|
|
886
908
|
multiple: a.multiple,
|
|
887
909
|
"resolve-avatar": i.resolveAvatar,
|
|
888
910
|
onChosen: p,
|
|
889
|
-
onSelection:
|
|
911
|
+
onSelection: C
|
|
890
912
|
}, null, 8, ["multiple", "resolve-avatar"])
|
|
891
913
|
]),
|
|
892
914
|
_: 2
|
|
@@ -894,36 +916,36 @@ const ea = /* @__PURE__ */ O({
|
|
|
894
916
|
a.multiple ? {
|
|
895
917
|
name: "footer",
|
|
896
918
|
fn: l(() => [
|
|
897
|
-
|
|
919
|
+
t(e(Y), {
|
|
898
920
|
size: "sm",
|
|
899
921
|
align: "center"
|
|
900
922
|
}, {
|
|
901
923
|
default: l(() => [
|
|
902
|
-
|
|
924
|
+
t(e(de), {
|
|
903
925
|
size: "sm",
|
|
904
926
|
tone: "muted"
|
|
905
927
|
}, {
|
|
906
928
|
default: l(() => [
|
|
907
|
-
|
|
929
|
+
F($(e(k)("admins.chosen", { count: n.value })), 1)
|
|
908
930
|
]),
|
|
909
931
|
_: 1
|
|
910
932
|
}),
|
|
911
|
-
|
|
933
|
+
t(e(D), {
|
|
912
934
|
variant: "outline",
|
|
913
|
-
onClick:
|
|
935
|
+
onClick: d[0] || (d[0] = (w) => e(u)())
|
|
914
936
|
}, {
|
|
915
937
|
default: l(() => [
|
|
916
|
-
|
|
938
|
+
F($(e(k)("admins.cancel")), 1)
|
|
917
939
|
]),
|
|
918
940
|
_: 1
|
|
919
941
|
}),
|
|
920
|
-
|
|
942
|
+
t(e(D), {
|
|
921
943
|
type: "primary",
|
|
922
|
-
disabled:
|
|
923
|
-
onClick:
|
|
944
|
+
disabled: n.value === 0,
|
|
945
|
+
onClick: d[1] || (d[1] = (w) => e(o)(m.value?.chosen() ?? []))
|
|
924
946
|
}, {
|
|
925
947
|
default: l(() => [
|
|
926
|
-
|
|
948
|
+
F($(e(k)("admins.save")), 1)
|
|
927
949
|
]),
|
|
928
950
|
_: 1
|
|
929
951
|
}, 8, ["disabled"])
|
|
@@ -935,131 +957,294 @@ const ea = /* @__PURE__ */ O({
|
|
|
935
957
|
} : void 0
|
|
936
958
|
]), 1032, ["open", "title"]));
|
|
937
959
|
}
|
|
938
|
-
}),
|
|
939
|
-
async function
|
|
940
|
-
return (await
|
|
960
|
+
}), Ue = ce(ta);
|
|
961
|
+
async function wa(a = {}) {
|
|
962
|
+
return (await Ue({ ...a, multiple: !1 }))?.[0];
|
|
941
963
|
}
|
|
942
|
-
function
|
|
943
|
-
return
|
|
964
|
+
function ha(a = {}) {
|
|
965
|
+
return Ue({ ...a, multiple: !0 });
|
|
944
966
|
}
|
|
945
|
-
const
|
|
967
|
+
const la = { class: "wx-profile-host" }, oa = { class: "wx-profile" }, sa = {
|
|
968
|
+
key: 0,
|
|
969
|
+
class: "wx-profile__aside"
|
|
970
|
+
}, na = { class: "wx-profile__fields" }, ra = /* @__PURE__ */ R({
|
|
971
|
+
__name: "ProfileDialog",
|
|
972
|
+
props: {
|
|
973
|
+
avatarField: { default: void 0 }
|
|
974
|
+
},
|
|
975
|
+
setup(a) {
|
|
976
|
+
const i = a, { resolve: s, dismiss: o, open: u } = ie(), k = q(), m = me();
|
|
977
|
+
J();
|
|
978
|
+
const n = I("webx-auth"), p = re(), C = g(!1), V = g({}), d = g({
|
|
979
|
+
name: k.state.user?.name ?? "",
|
|
980
|
+
avatar: k.state.user?.avatar ?? null,
|
|
981
|
+
password: "",
|
|
982
|
+
current_password: ""
|
|
983
|
+
}), w = g(d.value.avatar ? { path: d.value.avatar } : null);
|
|
984
|
+
function r(_) {
|
|
985
|
+
return V.value[_]?.[0];
|
|
986
|
+
}
|
|
987
|
+
async function b() {
|
|
988
|
+
C.value = !0, V.value = {};
|
|
989
|
+
try {
|
|
990
|
+
await m.updateProfile({
|
|
991
|
+
name: d.value.name,
|
|
992
|
+
avatar: w.value?.path ?? null,
|
|
993
|
+
// Blank is left out entirely rather than sent as an empty string: the server reads a
|
|
994
|
+
// filled password as "change it", and an empty one would be a change to nothing.
|
|
995
|
+
...d.value.password ? { password: d.value.password, current_password: d.value.current_password } : {}
|
|
996
|
+
}), j.success(n("profile.saved")), s(!0);
|
|
997
|
+
} catch (_) {
|
|
998
|
+
const f = _.body;
|
|
999
|
+
f?.errors ? V.value = f.errors : j.danger(p(_));
|
|
1000
|
+
} finally {
|
|
1001
|
+
C.value = !1;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return (_, f) => (L(), S(e(ue), {
|
|
1005
|
+
open: e(u),
|
|
1006
|
+
"onUpdate:open": f[5] || (f[5] = (U) => se(u) ? u.value = U : null),
|
|
1007
|
+
title: e(n)("profile.title"),
|
|
1008
|
+
width: 560
|
|
1009
|
+
}, {
|
|
1010
|
+
footer: l(() => [
|
|
1011
|
+
t(e(D), {
|
|
1012
|
+
onClick: f[4] || (f[4] = (U) => e(o)())
|
|
1013
|
+
}, {
|
|
1014
|
+
default: l(() => [
|
|
1015
|
+
F($(e(n)("profile.cancel")), 1)
|
|
1016
|
+
]),
|
|
1017
|
+
_: 1
|
|
1018
|
+
}),
|
|
1019
|
+
t(e(D), {
|
|
1020
|
+
type: "primary",
|
|
1021
|
+
loading: C.value,
|
|
1022
|
+
onClick: b
|
|
1023
|
+
}, {
|
|
1024
|
+
default: l(() => [
|
|
1025
|
+
F($(e(n)("profile.save")), 1)
|
|
1026
|
+
]),
|
|
1027
|
+
_: 1
|
|
1028
|
+
}, 8, ["loading"])
|
|
1029
|
+
]),
|
|
1030
|
+
default: l(() => [
|
|
1031
|
+
N("div", la, [
|
|
1032
|
+
N("div", oa, [
|
|
1033
|
+
i.avatarField ? (L(), O("div", sa, [
|
|
1034
|
+
(L(), S(ge(i.avatarField), {
|
|
1035
|
+
modelValue: w.value,
|
|
1036
|
+
"onUpdate:modelValue": f[0] || (f[0] = (U) => w.value = U),
|
|
1037
|
+
label: e(n)("profile.avatar"),
|
|
1038
|
+
aspect: "1/1",
|
|
1039
|
+
captions: !1
|
|
1040
|
+
}, null, 8, ["modelValue", "label"]))
|
|
1041
|
+
])) : T("", !0),
|
|
1042
|
+
N("div", na, [
|
|
1043
|
+
t(e(M), {
|
|
1044
|
+
label: e(n)("profile.name"),
|
|
1045
|
+
error: r("name")
|
|
1046
|
+
}, {
|
|
1047
|
+
default: l(() => [
|
|
1048
|
+
t(e(E), {
|
|
1049
|
+
modelValue: d.value.name,
|
|
1050
|
+
"onUpdate:modelValue": f[1] || (f[1] = (U) => d.value.name = U),
|
|
1051
|
+
name: "name"
|
|
1052
|
+
}, null, 8, ["modelValue"])
|
|
1053
|
+
]),
|
|
1054
|
+
_: 1
|
|
1055
|
+
}, 8, ["label", "error"]),
|
|
1056
|
+
t(e(M), {
|
|
1057
|
+
label: e(n)("admins.email")
|
|
1058
|
+
}, {
|
|
1059
|
+
default: l(() => [
|
|
1060
|
+
t(e(E), {
|
|
1061
|
+
"model-value": e(k).state.user?.email ?? "",
|
|
1062
|
+
readonly: ""
|
|
1063
|
+
}, null, 8, ["model-value"])
|
|
1064
|
+
]),
|
|
1065
|
+
_: 1
|
|
1066
|
+
}, 8, ["label"]),
|
|
1067
|
+
t(e(M), {
|
|
1068
|
+
label: e(n)("profile.password"),
|
|
1069
|
+
help: e(n)("profile.password-hint"),
|
|
1070
|
+
error: r("password")
|
|
1071
|
+
}, {
|
|
1072
|
+
default: l(() => [
|
|
1073
|
+
t(e(E), {
|
|
1074
|
+
modelValue: d.value.password,
|
|
1075
|
+
"onUpdate:modelValue": f[2] || (f[2] = (U) => d.value.password = U),
|
|
1076
|
+
type: "password",
|
|
1077
|
+
autocomplete: "new-password"
|
|
1078
|
+
}, null, 8, ["modelValue"])
|
|
1079
|
+
]),
|
|
1080
|
+
_: 1
|
|
1081
|
+
}, 8, ["label", "help", "error"]),
|
|
1082
|
+
d.value.password ? (L(), S(e(M), {
|
|
1083
|
+
key: 0,
|
|
1084
|
+
label: e(n)("profile.current-password"),
|
|
1085
|
+
help: e(n)("profile.current-password-hint"),
|
|
1086
|
+
error: r("current_password")
|
|
1087
|
+
}, {
|
|
1088
|
+
default: l(() => [
|
|
1089
|
+
t(e(E), {
|
|
1090
|
+
modelValue: d.value.current_password,
|
|
1091
|
+
"onUpdate:modelValue": f[3] || (f[3] = (U) => d.value.current_password = U),
|
|
1092
|
+
type: "password",
|
|
1093
|
+
autocomplete: "current-password"
|
|
1094
|
+
}, null, 8, ["modelValue"])
|
|
1095
|
+
]),
|
|
1096
|
+
_: 1
|
|
1097
|
+
}, 8, ["label", "help", "error"])) : T("", !0)
|
|
1098
|
+
])
|
|
1099
|
+
])
|
|
1100
|
+
])
|
|
1101
|
+
]),
|
|
1102
|
+
_: 1
|
|
1103
|
+
}, 8, ["open", "title"]));
|
|
1104
|
+
}
|
|
1105
|
+
}), ia = /* @__PURE__ */ ve(ra, [["__scopeId", "data-v-9583a67a"]]), ua = ["title"], da = {
|
|
1106
|
+
key: 0,
|
|
1107
|
+
class: "wx-user-menu__name"
|
|
1108
|
+
}, ca = /* @__PURE__ */ R({
|
|
946
1109
|
__name: "UserMenu",
|
|
947
1110
|
props: {
|
|
948
1111
|
signOutLabel: { default: void 0 },
|
|
949
|
-
resolveAvatar: { type: Function, default: void 0 }
|
|
1112
|
+
resolveAvatar: { type: Function, default: void 0 },
|
|
1113
|
+
avatarField: { default: void 0 },
|
|
1114
|
+
expanded: { type: Boolean, default: !1 }
|
|
950
1115
|
},
|
|
951
1116
|
setup(a) {
|
|
952
|
-
const i = a,
|
|
953
|
-
() =>
|
|
954
|
-
), p =
|
|
955
|
-
|
|
1117
|
+
const i = a, s = q(), o = me(), u = ke(), k = I("webx-auth"), m = P(() => s.state.user), n = P(
|
|
1118
|
+
() => u.state.panelLocales.length > 1 ? u.state.panelLocales : []
|
|
1119
|
+
), p = te(Ae, null), C = te(Le, null), V = g(void 0);
|
|
1120
|
+
Z(
|
|
956
1121
|
() => typeof m.value?.avatar == "string" ? m.value.avatar : null,
|
|
957
|
-
async (
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
960
|
-
|
|
1122
|
+
async (b) => {
|
|
1123
|
+
const _ = i.resolveAvatar ?? p;
|
|
1124
|
+
if (b === null || b === "" || _ === null) {
|
|
1125
|
+
V.value = void 0;
|
|
961
1126
|
return;
|
|
962
1127
|
}
|
|
963
|
-
const
|
|
964
|
-
m.value?.avatar ===
|
|
1128
|
+
const f = await _(b);
|
|
1129
|
+
m.value?.avatar === b && (V.value = f ?? void 0);
|
|
965
1130
|
},
|
|
966
1131
|
{ immediate: !0 }
|
|
967
1132
|
);
|
|
968
|
-
|
|
969
|
-
|
|
1133
|
+
const d = ce(ia);
|
|
1134
|
+
function w() {
|
|
1135
|
+
setTimeout(
|
|
1136
|
+
() => {
|
|
1137
|
+
d({ avatarField: i.avatarField ?? C ?? void 0 });
|
|
1138
|
+
},
|
|
1139
|
+
0
|
|
1140
|
+
);
|
|
970
1141
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1142
|
+
async function r(b) {
|
|
1143
|
+
b !== u.state.locale && await o.setLocale(b);
|
|
1144
|
+
}
|
|
1145
|
+
return (b, _) => {
|
|
1146
|
+
const f = B("wx-avatar"), U = B("wx-text"), W = B("wx-dropdown-item"), z = B("wx-divider"), h = B("wx-dropdown");
|
|
1147
|
+
return m.value !== null ? (L(), S(h, { key: 0 }, {
|
|
974
1148
|
trigger: l(() => [
|
|
975
|
-
|
|
1149
|
+
N("button", {
|
|
976
1150
|
type: "button",
|
|
977
|
-
class: "wx-user-menu__trigger",
|
|
1151
|
+
class: Te(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": a.expanded }]),
|
|
978
1152
|
title: m.value.name
|
|
979
1153
|
}, [
|
|
980
|
-
|
|
1154
|
+
t(f, {
|
|
981
1155
|
name: m.value.name,
|
|
982
|
-
src:
|
|
1156
|
+
src: V.value,
|
|
983
1157
|
size: "lg"
|
|
984
|
-
}, null, 8, ["name", "src"])
|
|
985
|
-
|
|
1158
|
+
}, null, 8, ["name", "src"]),
|
|
1159
|
+
a.expanded ? (L(), O("span", da, $(m.value.name), 1)) : T("", !0)
|
|
1160
|
+
], 10, ua)
|
|
986
1161
|
]),
|
|
987
1162
|
default: l(() => [
|
|
988
|
-
|
|
1163
|
+
t(W, { disabled: "" }, {
|
|
989
1164
|
default: l(() => [
|
|
990
|
-
|
|
1165
|
+
t(U, { size: "sm" }, {
|
|
991
1166
|
default: l(() => [
|
|
992
|
-
|
|
1167
|
+
F($(m.value.email), 1)
|
|
993
1168
|
]),
|
|
994
1169
|
_: 1
|
|
995
1170
|
})
|
|
996
1171
|
]),
|
|
997
1172
|
_: 1
|
|
998
1173
|
}),
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1174
|
+
t(z, { spacing: "sm" }),
|
|
1175
|
+
t(W, {
|
|
1176
|
+
icon: "user",
|
|
1177
|
+
onClick: w
|
|
1178
|
+
}, {
|
|
1179
|
+
default: l(() => [
|
|
1180
|
+
F($(e(k)("profile.menu")), 1)
|
|
1181
|
+
]),
|
|
1182
|
+
_: 1
|
|
1183
|
+
}),
|
|
1184
|
+
n.value.length > 0 ? (L(), O(le, { key: 0 }, [
|
|
1185
|
+
t(z, { spacing: "sm" }),
|
|
1186
|
+
t(W, { disabled: "" }, {
|
|
1002
1187
|
default: l(() => [
|
|
1003
|
-
|
|
1188
|
+
t(U, {
|
|
1004
1189
|
size: "sm",
|
|
1005
1190
|
tone: "muted"
|
|
1006
1191
|
}, {
|
|
1007
1192
|
default: l(() => [
|
|
1008
|
-
|
|
1193
|
+
F($(e(k)("menu.language")), 1)
|
|
1009
1194
|
]),
|
|
1010
1195
|
_: 1
|
|
1011
1196
|
})
|
|
1012
1197
|
]),
|
|
1013
1198
|
_: 1
|
|
1014
1199
|
}),
|
|
1015
|
-
(
|
|
1016
|
-
key:
|
|
1017
|
-
icon:
|
|
1018
|
-
onClick: (
|
|
1200
|
+
(L(!0), O(le, null, _e(n.value, (c) => (L(), S(W, {
|
|
1201
|
+
key: c.code,
|
|
1202
|
+
icon: c.code === e(u).state.locale ? "check" : void 0,
|
|
1203
|
+
onClick: (x) => r(c.code)
|
|
1019
1204
|
}, {
|
|
1020
1205
|
default: l(() => [
|
|
1021
|
-
|
|
1206
|
+
F($(c.nativeName), 1)
|
|
1022
1207
|
]),
|
|
1023
1208
|
_: 2
|
|
1024
1209
|
}, 1032, ["icon", "onClick"]))), 128)),
|
|
1025
|
-
|
|
1026
|
-
], 64)) :
|
|
1027
|
-
|
|
1210
|
+
t(z, { spacing: "sm" })
|
|
1211
|
+
], 64)) : T("", !0),
|
|
1212
|
+
t(W, {
|
|
1028
1213
|
icon: "logout",
|
|
1029
|
-
onClick:
|
|
1214
|
+
onClick: _[0] || (_[0] = (c) => e(o).logout())
|
|
1030
1215
|
}, {
|
|
1031
1216
|
default: l(() => [
|
|
1032
|
-
|
|
1217
|
+
F($(a.signOutLabel ?? e(k)("menu.sign-out")), 1)
|
|
1033
1218
|
]),
|
|
1034
1219
|
_: 1
|
|
1035
1220
|
})
|
|
1036
1221
|
]),
|
|
1037
1222
|
_: 1
|
|
1038
|
-
})) :
|
|
1223
|
+
})) : T("", !0);
|
|
1039
1224
|
};
|
|
1040
1225
|
}
|
|
1041
|
-
}),
|
|
1042
|
-
function
|
|
1226
|
+
}), ba = /* @__PURE__ */ ve(ca, [["__scopeId", "data-v-d51d13e4"]]);
|
|
1227
|
+
function ya(a = {}) {
|
|
1043
1228
|
const i = a.path ?? "/login";
|
|
1044
1229
|
return {
|
|
1045
|
-
install(
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1230
|
+
install(s) {
|
|
1231
|
+
const o = Ie(s.context);
|
|
1232
|
+
s.i18n.defaults("webx-auth", $e), Ke(s.app, o, a.resolveAvatar ?? null, a.avatarField ?? null), s.context.useSessionLoader(() => o.me()), s.router.addRoute({
|
|
1048
1233
|
path: i,
|
|
1049
1234
|
name: "webx.login",
|
|
1050
1235
|
meta: { public: !0 },
|
|
1051
|
-
component: { render: () =>
|
|
1052
|
-
}),
|
|
1053
|
-
() =>
|
|
1054
|
-
(
|
|
1055
|
-
const
|
|
1056
|
-
if (
|
|
1057
|
-
|
|
1236
|
+
component: { render: () => xe(He, { ...a.card }) }
|
|
1237
|
+
}), s.router.beforeEach((u) => u.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: i, query: u.fullPath === "/" ? {} : { next: u.fullPath } }), Z(
|
|
1238
|
+
() => s.context.state.status,
|
|
1239
|
+
(u) => {
|
|
1240
|
+
const k = s.router.currentRoute.value;
|
|
1241
|
+
if (u === "unauthenticated" && k.path !== i) {
|
|
1242
|
+
s.router.replace({ path: i, query: { next: k.fullPath } });
|
|
1058
1243
|
return;
|
|
1059
1244
|
}
|
|
1060
|
-
if (
|
|
1061
|
-
const m =
|
|
1062
|
-
|
|
1245
|
+
if (u === "ready" && k.path === i) {
|
|
1246
|
+
const m = k.query.next;
|
|
1247
|
+
s.router.replace(typeof m == "string" ? m : "/");
|
|
1063
1248
|
}
|
|
1064
1249
|
}
|
|
1065
1250
|
);
|
|
@@ -1067,20 +1252,22 @@ function da(a = {}) {
|
|
|
1067
1252
|
};
|
|
1068
1253
|
}
|
|
1069
1254
|
export {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1255
|
+
Ce as WxAdminList,
|
|
1256
|
+
aa as WxAdminsPage,
|
|
1257
|
+
He as WxLoginCard,
|
|
1258
|
+
ia as WxProfileDialog,
|
|
1259
|
+
ba as WxUserMenu,
|
|
1260
|
+
fa as admins,
|
|
1261
|
+
ya as auth,
|
|
1262
|
+
Ve as authKey,
|
|
1263
|
+
$e as authMessages,
|
|
1264
|
+
Le as avatarFieldKey,
|
|
1265
|
+
Ae as avatarResolverKey,
|
|
1266
|
+
pe as createAdminsApi,
|
|
1267
|
+
Ie as createAuthSession,
|
|
1268
|
+
Ke as provideAuth,
|
|
1269
|
+
wa as selectAdmin,
|
|
1270
|
+
ha as selectAdmins,
|
|
1271
|
+
me as useAuth
|
|
1085
1272
|
};
|
|
1086
1273
|
//# sourceMappingURL=index.js.map
|