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